Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
张东亮
/
NS100
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit d085dcda
由
刘韬
编写于
2025-11-04 10:41:03 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
添加 标签二次验证结果上传接口
1 个父辈
fcf24ffe
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
80 行增加
和
91 行删除
BLL/Config.cs
BLL/Extension.cs
BLL/Extension/Item_General.cs
BLL/Extension/Item_Inventec.cs
SmartScan/Language/en-US.lngres
SmartScan/ScanWork.cs
BLL/Config.cs
查看文件 @
d085dcd
...
@@ -277,6 +277,12 @@ namespace BLL
...
@@ -277,6 +277,12 @@ namespace BLL
set
=>
config
.
Write
(
HTTP_REEL_ID
,
value
);
set
=>
config
.
Write
(
HTTP_REEL_ID
,
value
);
}
}
public
string
HttpLabelReport
{
get
=>
config
.
Read
<
string
>(
Http_Label_Report
);
set
=>
config
.
Write
(
Http_Label_Report
,
value
);
}
/// <summary>
/// <summary>
/// 默认的物料模板名称
/// 默认的物料模板名称
/// </summary>
/// </summary>
...
@@ -407,6 +413,7 @@ namespace BLL
...
@@ -407,6 +413,7 @@ namespace BLL
private
const
string
EXTENSION_NAME
=
"ExtensionGroup"
;
private
const
string
EXTENSION_NAME
=
"ExtensionGroup"
;
private
const
string
HTTP_SERVER
=
"HttpServer"
;
private
const
string
HTTP_SERVER
=
"HttpServer"
;
private
const
string
HTTP_REEL_ID
=
"HttpReelID"
;
private
const
string
HTTP_REEL_ID
=
"HttpReelID"
;
private
const
string
Http_Label_Report
=
"HttpLabelReport"
;
private
const
string
DEFAULT_MATERIAL_NAME
=
"DefaultMaterialName"
;
private
const
string
DEFAULT_MATERIAL_NAME
=
"DefaultMaterialName"
;
private
const
string
TRIGGER_OPEN_LIGHT
=
"TriggerOpenLight"
;
private
const
string
TRIGGER_OPEN_LIGHT
=
"TriggerOpenLight"
;
private
const
string
WEB_SERVICE
=
"WebService"
;
private
const
string
WEB_SERVICE
=
"WebService"
;
...
...
BLL/Extension.cs
查看文件 @
d085dcd
...
@@ -265,7 +265,7 @@ namespace BLL
...
@@ -265,7 +265,7 @@ namespace BLL
if
(!
string
.
IsNullOrEmpty
(
config
.
HttpReelID
))
if
(!
string
.
IsNullOrEmpty
(
config
.
HttpReelID
.
Trim
()
))
listrow
.
Add
(
new
object
[]
{
A
});
listrow
.
Add
(
new
object
[]
{
A
});
#
region
显示替换数据按钮
#
region
显示替换数据按钮
string
pnkey
=
ConfigHelper
.
Config
.
Get
(
"SelectHttpPN_KeyWords"
,
""
);
string
pnkey
=
ConfigHelper
.
Config
.
Get
(
"SelectHttpPN_KeyWords"
,
""
);
...
...
BLL/Extension/Item_General.cs
查看文件 @
d085dcd
...
@@ -109,28 +109,6 @@ namespace BLL
...
@@ -109,28 +109,6 @@ namespace BLL
{
{
extension
.
Check
(
text
);
extension
.
Check
(
text
);
}
}
//public bool SetKey(string[] originalCode, Dictionary<string, string> key, bool hasMatch, out string errmsg)
//{
// errmsg = "";
// mesResult = false;
// var now = DateTime.Now;
// bool isSame = false;
// try
// {
// OnKeySet(originalCode, key, hasMatch);
// if (!updatereelid(key, out errmsg))
// return false;
// }
// catch (Exception ex)
// {
// return false;
// }
// return true;
//}
//读码后第一步
//
public
bool
SetKey
(
string
templateName
,
string
[]
originalCode
,
Dictionary
<
string
,
string
>
key
,
bool
hasMatch
,
out
string
errmsg
)
public
bool
SetKey
(
string
templateName
,
string
[]
originalCode
,
Dictionary
<
string
,
string
>
key
,
bool
hasMatch
,
out
string
errmsg
)
{
{
...
@@ -450,8 +428,8 @@ namespace BLL
...
@@ -450,8 +428,8 @@ namespace BLL
errmsg
=
""
;
errmsg
=
""
;
try
try
{
{
LogNet
.
log
.
Info
(
$
"接口上传信息 url: {config.HttpReelID}, data: {JsonConvert.SerializeObject(key)}"
);
LogNet
.
log
.
Info
(
$
"接口上传信息 url: {config.HttpReelID
.Trim()
}, data: {JsonConvert.SerializeObject(key)}"
);
if
(!
string
.
IsNullOrEmpty
(
config
.
HttpReelID
))
if
(!
string
.
IsNullOrEmpty
(
config
.
HttpReelID
.
Trim
()
))
{
{
Dictionary
<
string
,
object
>
pairs
=
new
Dictionary
<
string
,
object
>();
Dictionary
<
string
,
object
>
pairs
=
new
Dictionary
<
string
,
object
>();
if
(!
GetHttpReelID
(
key
,
out
errmsg
,
out
pairs
))
if
(!
GetHttpReelID
(
key
,
out
errmsg
,
out
pairs
))
...
@@ -585,62 +563,6 @@ namespace BLL
...
@@ -585,62 +563,6 @@ namespace BLL
.
ToList
();
.
ToList
();
}
}
//private string GetReelid()
//{
// LogNet.log.Debug("Enter GetReelid Method");
// if (extensions != null)
// {
// int idIndex = extensions.FindIndex(match => match.Key == config.ReelIDKeyWord);
// if (idIndex == -1) return "";
// }
// //读取参数
// string matchID = config.ReelIDMatch;
// int matchPlace = config.ReelIDPlaces;
// bool matchFill = config.ReelIDFillZero;
// string matchPrefix = config.ReelIDPrefix;
// string matchPostfix = config.ReelIDPostfix;
// //把key替换成实际值
// string[] keys = ObjConversion.StrGetKey(matchID);
// for (int i = 0; i < keys.Length; i++)
// {
// if (keys[i].ToLower().StartsWith("datetime"))
// {
// string ov = string.Format("[{0}]", keys[i]);
// var d = keys[i].Split(':');
// if (d.Length == 2)
// {
// matchID = matchID.Replace(ov, DateTime.Now.ToString(d[1]));
// }
// else
// {
// matchID = matchID.Replace(ov, DateTime.Now.ToString());
// }
// continue;
// }
// if (extensions != null)
// {
// int index = extensions.FindIndex(match => match.Key == keys[i]);
// if (index == -1) continue;
// string oldValue = string.Format("[{0}]", keys[i]);
// //matchID = matchID.Replace(oldValue, extensions[index].Control.Text);
// matchID = matchID.Replace(oldValue, "");
// }
// }
// //SaveAddReelID();
// var reelID = ReadReelID();
// //填充0
// string text = matchPrefix + matchID;
// if (matchFill)
// text += string.Format("{0:d" + matchPlace + "}", reelID);
// else
// text += reelID.ToString();
// text += matchPostfix;
// return text;
//}
private
int
ReadReelID
()
private
int
ReadReelID
()
{
{
int
reelID
=
1
;
int
reelID
=
1
;
...
@@ -704,7 +626,6 @@ namespace BLL
...
@@ -704,7 +626,6 @@ namespace BLL
"NEO SCAN"
,
"NEO SCAN"
,
true
);
true
);
if
(
result
)
if
(
result
)
{
{
lastKeys
=
null
;
lastKeys
=
null
;
...
@@ -848,7 +769,7 @@ namespace BLL
...
@@ -848,7 +769,7 @@ namespace BLL
{
{
errmsg
=
""
;
errmsg
=
""
;
dic
=
null
;
dic
=
null
;
string
url
=
config
.
HttpReelID
;
string
url
=
config
.
HttpReelID
.
Trim
()
;
string
json
=
Http
.
PostJson
(
url
,
null
,
key
);
string
json
=
Http
.
PostJson
(
url
,
null
,
key
);
if
(
json
==
""
)
if
(
json
==
""
)
{
{
...
@@ -863,7 +784,10 @@ namespace BLL
...
@@ -863,7 +784,10 @@ namespace BLL
//Dictionary<string, object> dic;
//Dictionary<string, object> dic;
try
try
{
{
dic
=
(
Dictionary
<
string
,
object
>)
serializer
.
DeserializeObject
(
json
);
var
raw
=
(
Dictionary
<
string
,
object
>)
serializer
.
DeserializeObject
(
json
);
// 重新建一个忽略大小写的字典,把数据拷进去
dic
=
new
Dictionary
<
string
,
object
>(
raw
,
StringComparer
.
OrdinalIgnoreCase
);
}
}
catch
catch
{
{
...
...
BLL/Extension/Item_Inventec.cs
查看文件 @
d085dcd
...
@@ -116,7 +116,7 @@ namespace BLL
...
@@ -116,7 +116,7 @@ namespace BLL
if
(
index
>
-
1
)
param
.
Add
(
key
[
i
],
extensions
[
index
].
Control
.
Text
);
if
(
index
>
-
1
)
param
.
Add
(
key
[
i
],
extensions
[
index
].
Control
.
Text
);
}
}
string
url
=
config
.
HttpReelID
;
string
url
=
config
.
HttpReelID
.
Trim
()
;
string
json
=
Http
.
Post
(
url
,
param
);
string
json
=
Http
.
Post
(
url
,
param
);
if
(
json
==
""
)
return
id
;
if
(
json
==
""
)
return
id
;
JavaScriptSerializer
serializer
=
new
();
JavaScriptSerializer
serializer
=
new
();
...
...
SmartScan/Language/en-US.lngres
查看文件 @
d085dcd
...
@@ -417,3 +417,4 @@ NS_KetRight_Detect 已检测字段 Detected Fields 微软雅黑,12,,
...
@@ -417,3 +417,4 @@ NS_KetRight_Detect 已检测字段 Detected Fields 微软雅黑,12,,
Dialog_NS_KetRight_Detect 已检测字段 Detected Fields 微软雅黑,12,,
Dialog_NS_KetRight_Detect 已检测字段 Detected Fields 微软雅黑,12,,
Dialog_About_About 关于 About
Dialog_About_About 关于 About
Dialog_About_mrs 物料注册系统 Material Registration System
Dialog_About_mrs 物料注册系统 Material Registration System
Dialog_Using_OCR_Result 是否使用OCR识别结果? 是否使用OCR识别结果? Should OCR recognition results be used?
\ No newline at end of file
\ No newline at end of file
SmartScan/ScanWork.cs
查看文件 @
d085dcd
using
Asa.FaceControl
;
using
Asa.FaceControl
;
using
BLL
;
using
BLL
;
using
DocumentFormat.OpenXml.Wordprocessing
;
using
HandyControl.Controls
;
using
HandyControl.Controls
;
using
MemoryRead
;
using
Model
;
using
Model
;
using
OnlineStore.Common.util
;
using
OnlineStore.Common.util
;
using
SmartScan.Form
;
using
SmartScan.Form
;
...
@@ -13,6 +15,7 @@ using System.Drawing.Drawing2D;
...
@@ -13,6 +15,7 @@ using System.Drawing.Drawing2D;
using
System.IO
;
using
System.IO
;
using
System.Linq
;
using
System.Linq
;
using
System.Threading.Tasks
;
using
System.Threading.Tasks
;
using
System.Web.Script.Serialization
;
using
System.Web.UI.WebControls
;
using
System.Web.UI.WebControls
;
using
System.Windows
;
using
System.Windows
;
using
System.Windows.Forms
;
using
System.Windows.Forms
;
...
@@ -172,7 +175,12 @@ namespace SmartScan
...
@@ -172,7 +175,12 @@ namespace SmartScan
LoadingScreen
.
Instance
.
Hide
();
LoadingScreen
.
Instance
.
Hide
();
originalCodeText
=
Camera
.
GetBarCodeText
(
workCodeInfo
);
originalCodeText
=
Camera
.
GetBarCodeText
(
workCodeInfo
);
// 检查条码内容是否与文件中的内容匹配
// 检查条码内容是否与文件中的内容匹配
bool
isMatched
=
CheckCodeWithFileContent
(
originalCodeText
);
bool
isMatched
=
CheckCodeWithFileContent
(
originalCodeText
,
out
List
<
string
>
matchedTexts
);
if
(
isMatched
)
{
isMatched
=
Request_API_C2
(
matchedTexts
);
}
if
(
isMatched
)
if
(
isMatched
)
{
{
Check2s
?.
Invoke
(
"2"
);
Check2s
?.
Invoke
(
"2"
);
...
@@ -242,9 +250,57 @@ namespace SmartScan
...
@@ -242,9 +250,57 @@ namespace SmartScan
});
});
}
}
}
}
private
bool
Request_API_C2
(
List
<
string
>
matchedTexts
)
{
string
url
=
config
.
HttpLabelReport
.
Trim
();
if
(
string
.
IsNullOrWhiteSpace
(
url
))
return
true
;
var
keylist
=
matchedTexts
.
Select
(
x
=>
new
{
Content
=
x
}).
ToList
();
var
errmsg
=
""
;
Dictionary
<
string
,
object
>
dic
=
null
;
string
json
=
Http
.
PostJson
(
url
,
null
,
keylist
);
if
(
json
==
""
)
{
LogUtil
.
info
(
"Api C2 response empty error"
);
return
false
;
}
JavaScriptSerializer
serializer
=
new
();
try
{
var
raw
=
(
Dictionary
<
string
,
object
>)
serializer
.
DeserializeObject
(
json
);
// 重新建一个忽略大小写的字典,把数据拷进去
dic
=
new
Dictionary
<
string
,
object
>(
raw
,
StringComparer
.
OrdinalIgnoreCase
);
}
catch
{
LogUtil
.
info
(
"Api C2 parse error:\r\n"
+
json
);
return
MessageboxNeo
.
Show
(
"BoxReelIDInfoMaintain"
,
errmsg
,
"NEO SCAN"
,
true
);
}
if
(!
dic
.
TryGetValue
(
"CODE"
,
out
object
value
))
{
LogUtil
.
info
(
"Api C2 return data error:\r\n"
+
json
);
return
MessageboxNeo
.
Show
(
"BoxReelIDInfoMaintain"
,
errmsg
,
"NEO SCAN"
,
true
);
}
if
(
Convert
.
ToInt32
(
value
)
!=
0
)
{
LogUtil
.
info
(
"Api C2 parse error:\r\n"
+
dic
[
"MSG"
].
ToString
());
return
MessageboxNeo
.
Show
(
"BoxReelIDInfoMaintain"
,
errmsg
,
"NEO SCAN"
,
true
);
}
return
true
;
}
// 修改方法定义
// 修改方法定义
private
bool
CheckCodeWithFileContent
(
string
[]
codeTexts
)
private
bool
CheckCodeWithFileContent
(
string
[]
codeTexts
,
out
List
<
string
>
matchedCodeText
)
{
{
matchedCodeText
=
new
List
<
string
>();
if
(
codeTexts
==
null
||
codeTexts
.
Length
==
0
)
if
(
codeTexts
==
null
||
codeTexts
.
Length
==
0
)
{
{
LogNet
.
log
.
Warn
(
"条码文本数组为空,无法进行匹配"
);
LogNet
.
log
.
Warn
(
"条码文本数组为空,无法进行匹配"
);
...
@@ -274,6 +330,7 @@ namespace SmartScan
...
@@ -274,6 +330,7 @@ namespace SmartScan
{
{
LogNet
.
log
.
Info
(
$
"条码 {codeText} 在文件中找到匹配"
);
LogNet
.
log
.
Info
(
$
"条码 {codeText} 在文件中找到匹配"
);
lines
.
Remove
(
ln
);
lines
.
Remove
(
ln
);
matchedCodeText
.
Add
(
codeText
.
Trim
());
}
}
}
}
}
}
...
@@ -529,7 +586,7 @@ namespace SmartScan
...
@@ -529,7 +586,7 @@ namespace SmartScan
using
(
Graphics
g
=
Graphics
.
FromImage
(
bmp
))
using
(
Graphics
g
=
Graphics
.
FromImage
(
bmp
))
{
{
string
str
=
contenI
.
ToString
();
string
str
=
contenI
.
ToString
();
Font
font
=
new
Font
(
"Arial"
,
60
,
System
.
Drawing
.
FontStyle
.
Bold
);
System
.
Drawing
.
Font
font
=
new
System
.
Drawing
.
Font
(
"Arial"
,
60
,
System
.
Drawing
.
FontStyle
.
Bold
);
SizeF
sz
=
g
.
MeasureString
(
str
,
font
);
SizeF
sz
=
g
.
MeasureString
(
str
,
font
);
// 为了让文字中心落在 info.Center 上
// 为了让文字中心落在 info.Center 上
...
@@ -548,14 +605,14 @@ namespace SmartScan
...
@@ -548,14 +605,14 @@ namespace SmartScan
StringFormat
.
GenericDefault
);
StringFormat
.
GenericDefault
);
// 描边宽度可调
// 描边宽度可调
using
(
Pen
pen
=
new
Pen
(
Color
.
White
,
10f
))
using
(
Pen
pen
=
new
Pen
(
System
.
Drawing
.
Color
.
White
,
10f
))
{
{
pen
.
LineJoin
=
LineJoin
.
Round
;
pen
.
LineJoin
=
LineJoin
.
Round
;
g
.
DrawPath
(
pen
,
gp
);
g
.
DrawPath
(
pen
,
gp
);
}
}
// 2. 填充红色字
// 2. 填充红色字
using
(
Brush
brush
=
new
SolidBrush
(
Color
.
Red
))
using
(
Brush
brush
=
new
SolidBrush
(
System
.
Drawing
.
Color
.
Red
))
{
{
g
.
FillPath
(
brush
,
gp
);
g
.
FillPath
(
brush
,
gp
);
}
}
...
@@ -808,7 +865,7 @@ namespace SmartScan
...
@@ -808,7 +865,7 @@ namespace SmartScan
if
(
workCodeKeyword
.
Any
(
a
=>
a
.
Value
.
StartsWith
(
"<OCR>"
)))
if
(
workCodeKeyword
.
Any
(
a
=>
a
.
Value
.
StartsWith
(
"<OCR>"
)))
{
{
BLLCommon
.
extension
.
DrawTextBackground
(
workCodeKeyword
);
BLLCommon
.
extension
.
DrawTextBackground
(
workCodeKeyword
);
bool
results
=
NeoAlertBox
.
Show
(
""
,
"Using OCR Result"
,
AlertType
.
Warning
,
"NEO SCAN"
,
true
);
bool
results
=
NeoAlertBox
.
Show
(
""
,
Language
.
Dialog
(
"Using_OCR_Result"
,
"是否使用OCR识别结果?"
)
,
AlertType
.
Warning
,
"NEO SCAN"
,
true
);
//FrmDrawText frmDraw = new FrmDrawText();
//FrmDrawText frmDraw = new FrmDrawText();
if
(
results
==
true
)
if
(
results
==
true
)
{
{
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论