Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
张东亮
/
NS100
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit fc66978b
由
刘韬
编写于
2025-12-02 15:51:00 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
1
1 个父辈
75d9da12
显示空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
49 行增加
和
56 行删除
BLL/Extension/Item_General.cs
SmartScan/Form/FrmMain.cs
SmartScan/ScanWork.cs
SmartScan/SetControl/WPF/WPF_CodeExtract.xaml.cs
BLL/Extension/Item_General.cs
查看文件 @
fc66978
...
...
@@ -250,7 +250,6 @@ namespace BLL
CheckText
(
"等待中"
);
}
islast
=
false
;
}
// 创建不包含自增ID的临时字典进行比较
//var keyWithoutReelID = new Dictionary<string, string>(key);
...
...
SmartScan/Form/FrmMain.cs
查看文件 @
fc66978
using
Asa.FaceControl
;
using
BLL
;
using
DocumentFormat.OpenXml.Bibliography
;
using
HandyControl.Properties.Langs
;
using
HandyControl.Tools.Extension
;
using
Model
;
using
Newtonsoft.Json
;
using
OnlineStore.Common.util
;
using
SmartScan.Form
;
using
SmartScan.SetControl.WPF
;
using
SmartScan.SetControl.WPF.Model
;
using
System
;
...
...
@@ -15,14 +12,11 @@ using System.Data;
using
System.Drawing
;
using
System.IO
;
using
System.Linq
;
using
System.Security.RightsManagement
;
using
System.Threading
;
using
System.Threading.Tasks
;
using
System.Web.Script.Serialization
;
using
System.Web.UI.WebControls
;
using
System.Windows.Forms
;
using
System.Windows.Forms.Integration
;
using
System.Windows.Input
;
using
static
BLL
.
BLLCommon
;
using
static
SmartScan
.
SetControl
.
WPF
.
Model
.
NeoAlertBox
;
...
...
@@ -258,7 +252,8 @@ namespace SmartScan
// 默认不显示WPF控件
wpfImagePanel
.
Visible
=
true
;
// 注册SizeChanged事件
wpfImagePanel
.
SizeChanged
+=
(
sender
,
args
)
=>
{
wpfImagePanel
.
SizeChanged
+=
(
sender
,
args
)
=>
{
// 当Panel大小改变时,通知WPF控件重新适应图片
if
(
Imagetest
!=
null
)
{
...
...
@@ -298,7 +293,7 @@ namespace SmartScan
ElementHost
host
=
new
ElementHost
();
host
.
Dock
=
DockStyle
.
Left
;
host
.
Width
=
205
;
host
.
Height
=
this
.
ClientSize
.
Height
-
55
-
10
;
// 减去标题区域的高度(假设为40像素)
host
.
Height
=
this
.
ClientSize
.
Height
-
55
-
10
;
// 减去标题区域的高度(假设为40像素)
// wpfMenu.Button1Text = "设置";
host
.
Location
=
new
Point
(
10
,
55
);
// 将控件放在标题区域下方
host
.
Anchor
=
AnchorStyles
.
Left
|
AnchorStyles
.
Top
|
AnchorStyles
.
Bottom
;
// 确保在窗体大小调整时保持相对位置
...
...
@@ -322,13 +317,14 @@ namespace SmartScan
//scanWork.TouchOff();
});
}
else
{
else
{
string
YU
=
BLLCommon
.
config
.
Language
;
if
(
YU
==
"English"
)
if
(
YU
==
"English"
)
{
bool
result
=
NeoAlertBox
.
Show
(
"Camera Not Connected"
,
"Unable to detect the camera device or the camera device is offline.\nPlease check the camera connection status."
,
AlertType
.
Warning
,
"NEO SCAN"
,
true
);
}
else
if
(
YU
==
"日语"
)
else
if
(
YU
==
"日语"
)
{
bool
result
=
NeoAlertBox
.
Show
(
"カメラが接続されていません"
,
"カメラデバイスが検出できませんでした/カメラデバイスがオフライン状態です。\nカメラの接続状態をご確認ください。"
,
AlertType
.
Warning
,
"NEO SCAN"
,
true
);
}
...
...
@@ -347,7 +343,8 @@ namespace SmartScan
monitor
.
Pause
=
false
;
};
wpfMenu
.
BtnSetClicked
+=
(
s
,
e
)
=>
{
wpfMenu
.
BtnSetClicked
+=
(
s
,
e
)
=>
{
monitor
.
Pause
=
true
;
FrmSet
set
=
new
FrmSet
();
set
.
Width
=
PicShow
.
Width
;
...
...
@@ -374,7 +371,8 @@ namespace SmartScan
if
(
YU
==
"English"
)
{
bool
result
=
NeoAlertBox
.
Show
(
""
,
$
"Application not found: {appPath}"
,
AlertType
.
Warning
,
"NEO SCAN"
,
true
);
}
else
if
(
YU
==
"日语"
)
}
else
if
(
YU
==
"日语"
)
{
bool
result
=
NeoAlertBox
.
Show
(
""
,
$
"アプリケーションが見つかりません: {appPath}"
,
AlertType
.
Warning
,
"NEO SCAN"
,
true
);
}
...
...
@@ -443,7 +441,7 @@ namespace SmartScan
YU
=
"en-US"
;
}
else
if
(
YU
==
"日语"
)
else
if
(
YU
==
"日语"
)
{
YU
=
"ja-JP"
;
}
...
...
@@ -510,7 +508,7 @@ namespace SmartScan
if
(
result
)
{
wpfControl
.
ClearFieldContents
();
// 这会将文本设置为空,颜色设置为白色
scanWork
.
needPrint
=
false
;
scanWork
.
WaitLabelRecheck
=
false
;
//lastKeys = null;
string
text
=
""
;
if
(
BLLCommon
.
config
.
Language
.
Equals
(
"English"
))
...
...
@@ -544,7 +542,7 @@ namespace SmartScan
{
wpfControl
.
ClearFieldContents
();
// 这会将文本设置为空,颜色设置为白色
scanWork
.
needPrint
=
false
;
scanWork
.
WaitLabelRecheck
=
false
;
//lastKeys = null;
string
text
=
""
;
if
(
BLLCommon
.
config
.
Language
.
Equals
(
"English"
))
...
...
@@ -573,7 +571,7 @@ namespace SmartScan
if
(
result
)
{
wpfControl
.
ClearFieldContents
();
// 这会将文本设置为空,颜色设置为白色
scanWork
.
needPrint
=
false
;
scanWork
.
WaitLabelRecheck
=
false
;
//lastKeys = null;
string
text
=
""
;
if
(
BLLCommon
.
config
.
Language
.
Equals
(
"English"
))
...
...
@@ -641,7 +639,7 @@ namespace SmartScan
{
bool
result
=
NeoAlertBox
.
Show
(
"Print Error"
,
"Unable to print label, no valid identification data"
,
AlertType
.
Warning
,
"NEO SCAN"
,
true
);
}
else
if
(
YU
==
"日语"
)
else
if
(
YU
==
"日语"
)
{
bool
result
=
NeoAlertBox
.
Show
(
"印刷に异常が発生しました"
,
"ラベルを印刷できません。有効な認識データがありません"
,
AlertType
.
Warning
,
"NEO SCAN"
,
true
);
}
...
...
@@ -690,7 +688,7 @@ namespace SmartScan
else
{
LblCameraExist
.
ForeColor
=
Color
.
Lime
;
wpfMenu
.
LblCameraExist
.
Foreground
=
System
.
Windows
.
Media
.
Brushes
.
Lime
;
wpfMenu
.
LblCameraExist
.
Foreground
=
System
.
Windows
.
Media
.
Brushes
.
Lime
;
// 更新状态卡片 - 相机已启用且已连接
wpfMenu
.
UpdateCameraStatus
(
true
,
true
);
return
true
;
...
...
@@ -718,7 +716,7 @@ namespace SmartScan
{
LogNet
.
log
.
Info
(
$
"IO模块 {BLLCommon.ioModule.IP} 连接成功"
);
wpfMenu
.
LblIOExist
.
Background
=
System
.
Windows
.
Media
.
Brushes
.
Lime
;
wpfMenu
.
LblIOExist
.
Content
=
$
"IO模块 {BLLCommon.ioModule.IP} 连接成功"
;
wpfMenu
.
LblIOExist
.
Content
=
$
"IO模块 {BLLCommon.ioModule.IP} 连接成功"
;
wpfMenu
.
UpdateIOStatus
(
true
);
LblIOExist
.
ForeColor
=
Color
.
Lime
;
...
...
@@ -885,7 +883,7 @@ namespace SmartScan
{
try
{
LogNet
.
log
.
Info
(
"打印内容:"
+
JsonConvert
.
SerializeObject
(
content
));
LogNet
.
log
.
Info
(
"打印内容:"
+
JsonConvert
.
SerializeObject
(
content
));
SaveResult
(
content
);
//Bitmap labelBmp = Common.labelEdit.PrintImage(Common.config.DefaultPrintLabel, content, out _);
BLLCommon
.
labelEdit
.
PrintLast
(
BLLCommon
.
config
.
DefaultPrintLabel
,
BLLCommon
.
config
.
PrinterName
,
BLLCommon
.
config
.
PrintLandscape
,
content
,
out
List
<
string
>
barcode
);
...
...
@@ -1044,7 +1042,6 @@ namespace SmartScan
{
wpfControl
.
SetResultNG
();
// 显示NG
}
}
private
void
OnBllKeySet
(
string
templateName
,
string
[]
originalCode
,
Dictionary
<
string
,
string
>
key
,
bool
hasMatch
)
...
...
@@ -1112,7 +1109,7 @@ namespace SmartScan
changeBtnStartText
();
Language
.
SetLanguage
(
this
);
LanguageWwitchover
.
LoadLanguage
(
CboLanguage
.
Text
);
if
(
wpfMenu
!=
null
&&
wpfControl
!=
null
)
if
(
wpfMenu
!=
null
&&
wpfControl
!=
null
)
{
wpfMenu
.
ApplyLanguage
();
wpfControl
.
UpdateRight
();
...
...
@@ -1124,16 +1121,16 @@ namespace SmartScan
}
void
changeBtnStartText
()
{
if
(
BLLCommon
.
config
.
Language
.
Equals
(
"English"
))
if
(
BLLCommon
.
config
.
Language
.
Equals
(
"English"
))
{
BtnStart
.
Font
=
new
Font
(
"Arial"
,
14
,
FontStyle
.
Bold
);
BtnStart
.
Font
=
new
Font
(
"Arial"
,
14
,
FontStyle
.
Bold
);
}
else
{
BtnStart
.
Font
=
new
Font
(
"微软雅黑"
,
14
,
FontStyle
.
Bold
);
}
if
(
scanWork
?.
isRun
??
false
)
if
(
scanWork
?.
isRun
??
false
)
{
BtnStart
.
Text
=
Language
.
Dialog
(
"Exit"
,
"退出"
);
}
...
...
@@ -1177,7 +1174,7 @@ namespace SmartScan
monitor
.
Pause
=
true
;
new
FrmRetrospect
().
ShowDialog
();
monitor
.
Pause
=
false
;
WPF_Date_From
wPF_Date_From
=
new
WPF_Date_From
();
WPF_Date_From
wPF_Date_From
=
new
WPF_Date_From
();
wPF_Date_From
.
Show
();
}
...
...
@@ -1234,12 +1231,13 @@ namespace SmartScan
});
}
catch
{
}
};
}
;
return
;
}
Common
.
frmWaitting
.
Close
();
}
public
void
SetWaittingMsg
(
string
msg
,
int
keepsec
=
3
)
public
void
SetWaittingMsg
(
string
msg
,
int
keepsec
=
3
)
{
if
(
Common
.
frmMain
.
InvokeRequired
)
{
...
...
@@ -1254,7 +1252,7 @@ namespace SmartScan
Application
.
DoEvents
();
}
public
void
DrawTextForm
(
Dictionary
<
string
,
string
>
valuePairs
)
public
void
DrawTextForm
(
Dictionary
<
string
,
string
>
valuePairs
)
{
//
if
(
Common
.
frmMain
.
InvokeRequired
)
...
...
SmartScan/ScanWork.cs
查看文件 @
fc66978
using
Asa.FaceControl
;
using
BLL
;
using
DocumentFormat.OpenXml.Wordprocessing
;
using
HandyControl.Controls
;
using
MemoryRead
;
using
Model
;
using
OnlineStore.Common.util
;
using
SmartScan.Form
;
using
SmartScan.SetControl.WPF
;
using
SmartScan.SetControl.WPF.Model
;
using
System
;
using
System.Collections.Generic
;
...
...
@@ -17,7 +13,6 @@ using System.Linq;
using
System.Threading.Tasks
;
using
System.Web.Script.Serialization
;
using
System.Web.UI.WebControls
;
using
System.Windows
;
using
System.Windows.Forms
;
using
static
BLL
.
BLLCommon
;
using
static
SmartScan
.
SetControl
.
WPF
.
Model
.
NeoAlertBox
;
...
...
@@ -101,7 +96,7 @@ namespace SmartScan
}
public
delegate
void
Check2
(
string
text
);
public
event
Check2
Check2s
;
public
void
Scan
(
bool
fromlocalfile
=
false
)
public
void
Scan
(
bool
fromlocalfile
=
false
)
{
//此段代码加锁是因为,客户在连续点击识别设备按钮时,线程会同时生成rid=123并且rid赋值是重复的123123
//在测试时也遇到这个情况,但只成功复现了一次;故加锁。
...
...
@@ -147,8 +142,8 @@ namespace SmartScan
return
;
}
string
YU
=
BLLCommon
.
config
.
Language
;
if
(
YU
==
"English"
)
string
YU
=
BLLCommon
.
config
.
Language
;
if
(
YU
==
"English"
)
{
LoadingScreen
.
Instance
.
Show
(
"Matching"
,
"Please wait..."
);
}
...
...
@@ -170,7 +165,8 @@ namespace SmartScan
reckontime
.
Restart
();
//Common.frmMain.Showlogs("OCR识别中请稍后");
Common
.
frmMain
.
Showlogs
(
""
);
if
(
needPrint
&&
BLLCommon
.
config
.
CheckFunction
)
LogNet
.
log
.
Info
(
$
"WaitLabelRecheck:{WaitLabelRecheck},CheckFunction:{BLLCommon.config.CheckFunction}"
);
if
(
WaitLabelRecheck
&&
BLLCommon
.
config
.
CheckFunction
)
{
LoadingScreen
.
Instance
.
Hide
();
originalCodeText
=
Camera
.
GetBarCodeText
(
workCodeInfo
);
...
...
@@ -186,7 +182,7 @@ namespace SmartScan
Check2s
?.
Invoke
(
"2"
);
// Common.frmMain.wpfControl.SetResultOK();
Check2s
?.
Invoke
(
"OK"
);
needPrint
=
false
;
WaitLabelRecheck
=
false
;
}
else
{
...
...
@@ -239,7 +235,7 @@ namespace SmartScan
}
finally
{
bendi
=
false
;
bendi
=
false
;
isTouch
=
false
;
Common
.
frmMain
.
CloseWaittingDialog
();
}
...
...
@@ -318,9 +314,9 @@ namespace SmartScan
// 读取文件内容
string
fileContent
=
File
.
ReadAllText
(
FilePath
.
CONFIG_Code_Value
);
List
<
string
>
lines
=
fileContent
.
Split
(
new
[]
{
'\n'
},
StringSplitOptions
.
RemoveEmptyEntries
).
Select
(
s
=>
s
.
Trim
()).
ToList
();
LogNet
.
log
.
Info
(
"扫描到条码:"
+
string
.
Join
(
","
,
codeTexts
));
LogNet
.
log
.
Info
(
"在以下条码中匹配:"
+
fileContent
);
List
<
string
>
lines
=
fileContent
.
Split
(
new
[]
{
'\n'
},
StringSplitOptions
.
RemoveEmptyEntries
).
Select
(
s
=>
s
.
Trim
()).
ToList
();
LogNet
.
log
.
Info
(
"扫描到条码:"
+
string
.
Join
(
","
,
codeTexts
));
LogNet
.
log
.
Info
(
"在以下条码中匹配:"
+
fileContent
);
// 检查文件内容是否包含任一条码文本
foreach
(
string
ln
in
lines
.
ToArray
())
{
...
...
@@ -492,7 +488,7 @@ namespace SmartScan
}
LogNet
.
log
.
Info
(
"2"
);
List
<
Bitmap
>
image
=
new
List
<
Bitmap
>(
Camera
.
CaptureAndGetCode
(
out
workCodeInfo
));
LogNet
.
log
.
Info
(
"image"
+
image
.
Count
);
LogNet
.
log
.
Info
(
"image"
+
image
.
Count
);
LogNet
.
log
.
Info
(
"image[0]"
+
image
[
0
]);
if
(
image
.
Count
>
0
&&
image
[
0
]
!=
null
)
{
...
...
@@ -830,7 +826,7 @@ namespace SmartScan
if
(!
BLL
.
Config
.
Backgrounder
)
{
string
text
=
Language
.
Dialog
(
"MaterialTemplateNoMatch"
);
NeoAlertBox
.
Show
(
""
,
text
,
AlertType
.
Warning
,
"NEO SCAN"
,
true
);
NeoAlertBox
.
Show
(
""
,
text
,
AlertType
.
Warning
,
"NEO SCAN"
,
true
);
//var fm = new FaceMessageBox("", text, MessageBoxButtons.OK);
//fm.TopMost = true;
...
...
@@ -840,15 +836,15 @@ namespace SmartScan
});
return
rtn
;
}
public
bool
Ispring
=
true
;
public
bool
needPrint
=
false
;
public
void
SetKey
(
bool
hasMatch
,
string
templateName
)
public
bool
Ispring
=
true
;
public
bool
WaitLabelRecheck
=
false
;
public
void
SetKey
(
bool
hasMatch
,
string
templateName
)
{
LogNet
.
log
.
Info
(
"Work SetKey hasMatch:"
+
hasMatch
);
//if (workCodeKeyword.Count == 0){ return;}
//if(hasMatch)
Ispring
=
true
;
bool
a
=
BLLCommon
.
extension
.
SetKey
(
templateName
,
originalCodeText
,
workCodeKeyword
,
hasMatch
,
out
_
);
bool
a
=
BLLCommon
.
extension
.
SetKey
(
templateName
,
originalCodeText
,
workCodeKeyword
,
hasMatch
,
out
_
);
LoadingScreen
.
Instance
.
Hide
();
Common
.
frmMain
.
Showlogs
(
""
);
// 通过检查结果状态来判断是否需要打印
...
...
@@ -857,15 +853,15 @@ namespace SmartScan
// 检查结果是否为"等待中"/"Waiting"/"待機中",以判断是否是第一次拍照
if
(
BLLCommon
.
extension
.
labelText
!=
null
)
{
string
status
=
BLLCommon
.
extension
.
labelText
.
ToLower
()
;
needPrint
=
(
status
==
"等待中"
||
status
==
"Waiting"
||
status
==
"待機中"
);
string
status
=
BLLCommon
.
extension
.
labelText
;
WaitLabelRecheck
=
(
status
==
"等待中"
||
status
==
"Waiting"
||
status
==
"待機中"
);
}
if
(
needPrint
&&
BLLCommon
.
config
.
AutoPrint
)
if
(
WaitLabelRecheck
&&
BLLCommon
.
config
.
AutoPrint
)
{
if
(
workCodeKeyword
.
Any
(
a
=>
a
.
Value
.
StartsWith
(
"<OCR>"
)))
{
BLLCommon
.
extension
.
DrawTextBackground
(
workCodeKeyword
);
bool
results
=
NeoAlertBox
.
Show
(
""
,
Language
.
Dialog
(
"Using_OCR_Result"
,
"是否使用OCR识别结果?"
),
AlertType
.
Warning
,
"NEO SCAN"
,
true
);
bool
results
=
NeoAlertBox
.
Show
(
""
,
Language
.
Dialog
(
"Using_OCR_Result"
,
"是否使用OCR识别结果?"
),
AlertType
.
Warning
,
"NEO SCAN"
,
true
);
//FrmDrawText frmDraw = new FrmDrawText();
if
(
results
==
true
)
{
...
...
SmartScan/SetControl/WPF/WPF_CodeExtract.xaml.cs
查看文件 @
fc66978
...
...
@@ -323,7 +323,7 @@ namespace SmartScan.SetControl.WPF
if
(
target
!=
null
)
{
int
value
;
if
(
int
.
TryParse
(
target
.
Text
,
out
value
)
&&
value
>
1
)
if
(
int
.
TryParse
(
target
.
Text
,
out
value
)
&&
value
>
0
)
{
target
.
Text
=
(
value
-
1
).
ToString
();
CheckMatchForUserControl
(
match
,
userControl
);
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论