Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
张东亮
/
NS100
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 32e31c7f
由
贾鹏旭
编写于
2024-03-22 12:33:51 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
1
1 个父辈
4426c22f
全部展开
显示空白字符变更
内嵌
并排
正在显示
16 个修改的文件
包含
208 行增加
和
19 行删除
BLL/Extension.cs
BLL/Extension/Item_General.cs
BLL/ExtraFileData.cs
BLL/MaterialEdit.cs
BLL/PrintLabelEdit.cs
SmartScan/Form/FrmMain.Designer.cs
SmartScan/Form/FrmMain.cs
SmartScan/PlusSettingFrm/FrmSetPlus.Designer.cs
SmartScan/PlusSettingFrm/FrmSetPlus.cs
SmartScan/ScanWork.cs
SmartScan/SetControl/UsrMacro.Designer.cs
SmartScan/SetControl/UsrMacro.cs
SmartScan/SetControl/UsrMaterialTemplate.cs
SmartScan/SetControl/UsrWorkMode.Designer.cs
SmartScan/SetControl/UsrWorkMode.cs
SmartScan/WebCallWork.cs
BLL/Extension.cs
查看文件 @
32e31c7
...
@@ -8,6 +8,7 @@ using Asa.FaceControl;
...
@@ -8,6 +8,7 @@ using Asa.FaceControl;
using
Model
;
using
Model
;
using
System.Windows.Forms
;
using
System.Windows.Forms
;
using
DocumentFormat.OpenXml.Drawing
;
using
DocumentFormat.OpenXml.Drawing
;
using
DocumentFormat.OpenXml.Spreadsheet
;
namespace
BLL
namespace
BLL
{
{
...
@@ -124,8 +125,15 @@ namespace BLL
...
@@ -124,8 +125,15 @@ namespace BLL
}
}
},
},
};
};
Dictionary
<
string
,
object
>
R
=
new
()
{
Dictionary
<
string
,
object
>
R
;
{
"Type"
,
"TextBox"
},
bool
isdis
=
ConfigHelper
.
Config
.
Get
<
bool
>(
"DataSource_ShowBox"
,
false
);
string
type
=
"TextBox"
;
if
(
key
==
Config
.
DataSource_DataTitle
&&
isdis
)
{
type
=
"ComboBox"
;
}
R
=
new
()
{
{
"Type"
,
type
},
{
"Key"
,
key
},
{
"Key"
,
key
},
{
"LinkName"
,
key
},
{
"LinkName"
,
key
},
{
"CanClear"
,
"True"
},
{
"CanClear"
,
"True"
},
...
@@ -258,7 +266,10 @@ namespace BLL
...
@@ -258,7 +266,10 @@ namespace BLL
}
}
ctlY
=
startPoint
.
Y
;
ctlY
=
startPoint
.
Y
;
for
(
int
i
=
0
;
i
<
rows
.
Length
;
i
++)
for
(
int
i
=
0
;
i
<
rows
.
Length
;
i
++)
{
LoadRow
(
rows
[
i
]);
LoadRow
(
rows
[
i
]);
}
currentExtension
.
Load
(
ctlGroup
);
currentExtension
.
Load
(
ctlGroup
);
}
}
...
...
BLL/Extension/Item_General.cs
查看文件 @
32e31c7
...
@@ -94,7 +94,25 @@ namespace BLL
...
@@ -94,7 +94,25 @@ namespace BLL
}
}
}
}
Application
.
DoEvents
();
Application
.
DoEvents
();
if
(!
string
.
IsNullOrEmpty
(
config
.
ReelIDKeyWord
))
#
region
判断指定关键字是否存在内容
bool
isdisplay
=
true
;
string
str
=
ConfigHelper
.
Config
.
Get
(
"DataSource_ForceMatching"
,
""
);
if
(!
string
.
IsNullOrWhiteSpace
(
str
))
{
string
[]
arr
=
str
.
Split
(
','
);
foreach
(
var
item
in
arr
)
{
key
.
TryGetValue
(
item
,
out
string
value
);
if
(
string
.
IsNullOrEmpty
(
value
))
{
isdisplay
=
false
;
break
;
}
}
}
#
endregion
if
(!
string
.
IsNullOrEmpty
(
config
.
ReelIDKeyWord
)&&
isdisplay
)
{
{
var
Reelidstr
=
GetReelid
();
var
Reelidstr
=
GetReelid
();
if
(
key
.
ContainsKey
(
config
.
ReelIDKeyWord
))
if
(
key
.
ContainsKey
(
config
.
ReelIDKeyWord
))
...
@@ -139,6 +157,16 @@ namespace BLL
...
@@ -139,6 +157,16 @@ namespace BLL
//第二次刷新界面
//第二次刷新界面
for
(
int
i
=
0
;
i
<
extensions
.
Count
;
i
++)
for
(
int
i
=
0
;
i
<
extensions
.
Count
;
i
++)
{
{
#
region
如果是下拉框加载内容
if
(
extensions
[
i
].
Type
==
"ComboBox"
)
{
var
s
=
extensions
[
i
].
Control
as
Asa
.
FaceControl
.
FaceComboBox
;
s
.
Items
.
AddRange
(
ExtraFileData
.
DataTitle
.
OrderBy
(
tit
=>
tit
).
ToArray
());
s
.
Text
=
""
;
s
.
SelectedIndex
=
-
1
;
s
.
Enabled
=
true
;
}
#
endregion
extensions
[
i
].
Control
.
ForeColor
=
System
.
Drawing
.
Color
.
White
;
extensions
[
i
].
Control
.
ForeColor
=
System
.
Drawing
.
Color
.
White
;
if
(
key
.
ContainsKey
(
extensions
[
i
].
Key
))
if
(
key
.
ContainsKey
(
extensions
[
i
].
Key
))
{
{
...
@@ -243,12 +271,14 @@ namespace BLL
...
@@ -243,12 +271,14 @@ namespace BLL
}
}
continue
;
continue
;
}
}
if
(
extensions
!=
null
)
if
(
extensions
!=
null
)
{
{
int
index
=
extensions
.
FindIndex
(
match
=>
match
.
Key
==
keys
[
i
]);
int
index
=
extensions
.
FindIndex
(
match
=>
match
.
Key
==
keys
[
i
]);
if
(
index
==
-
1
)
continue
;
if
(
index
==
-
1
)
continue
;
string
oldValue
=
string
.
Format
(
"[{0}]"
,
keys
[
i
]);
string
oldValue
=
string
.
Format
(
"[{0}]"
,
keys
[
i
]);
matchID
=
matchID
.
Replace
(
oldValue
,
extensions
[
index
].
Control
.
Text
);
//matchID = matchID.Replace(oldValue, extensions[index].Control.Text);
matchID
=
matchID
.
Replace
(
oldValue
,
""
);
}
}
}
}
//SaveAddReelID();
//SaveAddReelID();
...
@@ -311,7 +341,9 @@ namespace BLL
...
@@ -311,7 +341,9 @@ namespace BLL
{
{
LogNet
.
log
.
Debug
(
"Enter PrintLabel Method"
);
LogNet
.
log
.
Debug
(
"Enter PrintLabel Method"
);
if
(
lastkey
==
null
)
return
;
if
(
lastkey
==
null
)
return
;
//Dictionary<string, string> key = new();
for
(
int
i
=
0
;
i
<
extensions
.
Count
;
i
++)
for
(
int
i
=
0
;
i
<
extensions
.
Count
;
i
++)
{
{
if
(
extensions
[
i
].
Key
==
""
)
continue
;
if
(
extensions
[
i
].
Key
==
""
)
continue
;
...
@@ -320,6 +352,44 @@ namespace BLL
...
@@ -320,6 +352,44 @@ namespace BLL
else
else
lastkey
.
Add
(
extensions
[
i
].
Key
,
extensions
[
i
].
Control
.
Text
);
lastkey
.
Add
(
extensions
[
i
].
Key
,
extensions
[
i
].
Control
.
Text
);
}
}
#
region
判断指定关键字是否存在内容
List
<
string
>
strings
=
new
List
<
string
>();
string
str
=
ConfigHelper
.
Config
.
Get
(
"DataSource_ForceMatching"
,
""
);
if
(!
string
.
IsNullOrWhiteSpace
(
str
))
{
string
[]
arr
=
str
.
Split
(
','
);
foreach
(
var
item
in
arr
)
{
lastkey
.
TryGetValue
(
item
,
out
string
value
);
if
(
string
.
IsNullOrEmpty
(
value
))
{
strings
.
Add
(
item
);
}
}
}
#
endregion
for
(
int
i
=
0
;
i
<
extensions
.
Count
;
i
++)
{
if
(
strings
.
Contains
(
extensions
[
i
].
Key
))
{
extensions
[
i
].
Control
.
BackColor
=
System
.
Drawing
.
Color
.
Red
;
return
;
}
}
#
region
点击打印按钮,
rid
内容为空时,生成
rid
if
(!
string
.
IsNullOrEmpty
(
config
.
ReelIDKeyWord
))
{
if
(
lastkey
.
ContainsKey
(
config
.
ReelIDKeyWord
))
{
string
rid
=
lastkey
[
config
.
ReelIDKeyWord
];
if
(
string
.
IsNullOrWhiteSpace
(
rid
))
{
var
Reelidstr
=
GetReelid
();
lastkey
[
config
.
ReelIDKeyWord
]
=
Reelidstr
;
}
}
}
#
endregion
Printing
?.
Invoke
(
lastkey
);
Printing
?.
Invoke
(
lastkey
);
bool
close
=
ConfigHelper
.
Config
.
Get
(
"isprinclose"
,
false
);
bool
close
=
ConfigHelper
.
Config
.
Get
(
"isprinclose"
,
false
);
...
@@ -334,6 +404,10 @@ namespace BLL
...
@@ -334,6 +404,10 @@ namespace BLL
}
}
//进行追溯配置保存
//进行追溯配置保存
SaveRetrospect
?.
Invoke
(
lastkey
);
SaveRetrospect
?.
Invoke
(
lastkey
);
for
(
int
i
=
0
;
i
<
extensions
.
Count
;
i
++)
{
extensions
[
i
].
Control
.
BackColor
=
System
.
Drawing
.
Color
.
FromArgb
(
255
,
20
,
20
,
20
);
}
}
}
/// <summary>
/// <summary>
///
///
...
...
BLL/ExtraFileData.cs
查看文件 @
32e31c7
...
@@ -14,6 +14,8 @@ namespace BLL
...
@@ -14,6 +14,8 @@ namespace BLL
{
{
public
static
Dictionary
<
string
,
Dictionary
<
string
,
string
>>
AllData
=
new
Dictionary
<
string
,
Dictionary
<
string
,
string
>>();
public
static
Dictionary
<
string
,
Dictionary
<
string
,
string
>>
AllData
=
new
Dictionary
<
string
,
Dictionary
<
string
,
string
>>();
public
static
List
<
string
>
Titles
=
new
List
<
string
>();
public
static
List
<
string
>
Titles
=
new
List
<
string
>();
public
static
List
<
string
>
DataTitle
=
new
List
<
string
>();
public
static
void
Init
()
{
public
static
void
Init
()
{
var
ext
=
Path
.
GetExtension
(
Config
.
DataSource_FilePath
);
var
ext
=
Path
.
GetExtension
(
Config
.
DataSource_FilePath
);
if
(
string
.
IsNullOrEmpty
(
ext
))
if
(
string
.
IsNullOrEmpty
(
ext
))
...
@@ -75,7 +77,11 @@ namespace BLL
...
@@ -75,7 +77,11 @@ namespace BLL
}
}
}
}
if
(!
string
.
IsNullOrEmpty
(
keydata
)
&&
!
AllData
.
ContainsKey
(
keydata
))
if
(!
string
.
IsNullOrEmpty
(
keydata
)
&&
!
AllData
.
ContainsKey
(
keydata
))
{
AllData
.
Add
(
keydata
,
rowdata
);
AllData
.
Add
(
keydata
,
rowdata
);
DataTitle
.
Add
(
keydata
);
}
}
}
}
}
catch
(
Exception
ex
)
{
catch
(
Exception
ex
)
{
...
@@ -142,7 +148,10 @@ namespace BLL
...
@@ -142,7 +148,10 @@ namespace BLL
}
}
}
}
if
(!
string
.
IsNullOrEmpty
(
keydata
)
&&
!
AllData
.
ContainsKey
(
keydata
))
if
(!
string
.
IsNullOrEmpty
(
keydata
)
&&
!
AllData
.
ContainsKey
(
keydata
))
{
AllData
.
Add
(
keydata
,
rowdata
);
AllData
.
Add
(
keydata
,
rowdata
);
DataTitle
.
Add
(
keydata
);
}
if
(
string
.
IsNullOrEmpty
(
keydata
))
if
(
string
.
IsNullOrEmpty
(
keydata
))
emptyrow
++;
emptyrow
++;
...
...
BLL/MaterialEdit.cs
查看文件 @
32e31c7
...
@@ -151,13 +151,17 @@ namespace BLL
...
@@ -151,13 +151,17 @@ namespace BLL
MatchAnalysis
.
StartNewAnalysis
(
code
);
MatchAnalysis
.
StartNewAnalysis
(
code
);
if
(
Config
.
Func_EnabledOCR
)
if
(
Config
.
Func_EnabledOCR
)
{
{
Bitmap
bitmaps
=
new
Bitmap
(
CurrntBitmap
);
//LogNet.log.Info($"开始加载图片");
//Bitmap bitmaps = new Bitmap(CurrntBitmap);
//LogNet.log.Info($"加载结束图片");
//保存需要识别ocr的区域
//保存需要识别ocr的区域
//CurrntBitmap?.Save(@"ocr.jpg", System.Drawing.Imaging.ImageFormat.Jpeg);
string
currentDirectory
=
System
.
Windows
.
Forms
.
Application
.
StartupPath
;
string
currentDirectory
=
System
.
Windows
.
Forms
.
Application
.
StartupPath
;
string
filePath
=
System
.
IO
.
Path
.
Combine
(
currentDirectory
,
"ocr.jpg"
);
string
filePath
=
System
.
IO
.
Path
.
Combine
(
currentDirectory
,
"ocr.jpg"
);
//CurrntBitmap?.Save(filePath, System.Drawing.Imaging.ImageFormat.Jpeg);
//CurrntBitmap?.Save(filePath, System.Drawing.Imaging.ImageFormat.Jpeg);
bitmaps
?.
Save
(
filePath
);
LogNet
.
log
.
Info
(
$
"开始保存图片"
);
CurrntBitmap
?.
Save
(
filePath
,
System
.
Drawing
.
Imaging
.
ImageFormat
.
Jpeg
);
LogNet
.
log
.
Info
(
$
"保存图片"
);
regOcrCodes
=
OcrRecognize
(
$
"{currentDirectory}\\ocr.jpg"
);
regOcrCodes
=
OcrRecognize
(
$
"{currentDirectory}\\ocr.jpg"
);
LogNet
.
log
.
Info
(
$
"保存地址:{filePath};获取地址:{currentDirectory}\\ocr.jpg"
);
LogNet
.
log
.
Info
(
$
"保存地址:{filePath};获取地址:{currentDirectory}\\ocr.jpg"
);
LogNet
.
log
.
Info
(
$
"OCR 识别结果:{regOcrCodes}"
);
LogNet
.
log
.
Info
(
$
"OCR 识别结果:{regOcrCodes}"
);
...
...
BLL/PrintLabelEdit.cs
查看文件 @
32e31c7
...
@@ -330,7 +330,11 @@ namespace BLL
...
@@ -330,7 +330,11 @@ namespace BLL
{
{
barCode
=
null
;
barCode
=
null
;
int
index
=
labelTemp
.
FindIndex
(
match
=>
match
.
Name
==
labelName
);
int
index
=
labelTemp
.
FindIndex
(
match
=>
match
.
Name
==
labelName
);
if
(
index
==
-
1
)
return
;
if
(
index
==
-
1
)
{
LogNet
.
log
.
Info
(
"未找到标签!"
);
return
;
}
SizeF
sf
;
SizeF
sf
;
barCode
=
new
string
[
labelTemp
[
index
].
Field
.
Count
];
barCode
=
new
string
[
labelTemp
[
index
].
Field
.
Count
];
...
@@ -360,7 +364,6 @@ namespace BLL
...
@@ -360,7 +364,6 @@ namespace BLL
print
.
PrintPage
+=
PrintLast_PrintPage
;
print
.
PrintPage
+=
PrintLast_PrintPage
;
interimLabel
=
labelTemp
[
index
];
interimLabel
=
labelTemp
[
index
];
print
.
Print
();
print
.
Print
();
}
}
//====================================
//====================================
...
...
SmartScan/Form/FrmMain.Designer.cs
查看文件 @
32e31c7
...
@@ -308,12 +308,12 @@ namespace SmartScan
...
@@ -308,12 +308,12 @@ namespace SmartScan
private
Asa
.
FaceControl
.
FaceButton
BtnTriggerIO
;
private
Asa
.
FaceControl
.
FaceButton
BtnTriggerIO
;
private
Asa
.
FaceControl
.
FaceLabel
LblCameraExist
;
private
Asa
.
FaceControl
.
FaceLabel
LblCameraExist
;
private
Asa
.
FaceControl
.
FaceLabel
LblIOExist
;
private
Asa
.
FaceControl
.
FaceLabel
LblIOExist
;
private
Asa
.
FaceControl
.
FacePictureBox
PicShow
;
private
Asa
.
FaceControl
.
FacePanel
PnlExtension
;
private
Asa
.
FaceControl
.
FacePanel
PnlExtension
;
private
Asa
.
FaceControl
.
FaceComboBox
CboLanguage
;
private
Asa
.
FaceControl
.
FaceComboBox
CboLanguage
;
private
Asa
.
FaceControl
.
FaceButton
BtnMatchedName
;
private
Asa
.
FaceControl
.
FaceButton
BtnMatchedName
;
private
Asa
.
FaceControl
.
FaceLabel
LblVersion
;
private
Asa
.
FaceControl
.
FaceLabel
LblVersion
;
private
Asa
.
FaceControl
.
FaceLabel
LblUserName
;
private
Asa
.
FaceControl
.
FaceLabel
LblUserName
;
public
Asa
.
FaceControl
.
FacePictureBox
PicShow
;
}
}
}
}
SmartScan/Form/FrmMain.cs
查看文件 @
32e31c7
...
@@ -250,6 +250,7 @@ namespace SmartScan
...
@@ -250,6 +250,7 @@ namespace SmartScan
BtnSet
.
Enabled
=
BLLCommon
.
config
.
UserLevel
==
UserLevel
.
Admin
;
BtnSet
.
Enabled
=
BLLCommon
.
config
.
UserLevel
==
UserLevel
.
Admin
;
FrmRetrospect
.
Print
+=
Extension_Printing
;
FrmRetrospect
.
Print
+=
Extension_Printing
;
UsrWorkMode
.
Printing
+=
Extension_Printing
;
//扩展面板
//扩展面板
PnlExtension
.
Width
=
BLLCommon
.
config
.
ExtensionWidth
;
PnlExtension
.
Width
=
BLLCommon
.
config
.
ExtensionWidth
;
PnlExtension
.
Left
=
Width
-
PnlExtension
.
Width
-
12
;
PnlExtension
.
Left
=
Width
-
PnlExtension
.
Width
-
12
;
...
...
SmartScan/PlusSettingFrm/FrmSetPlus.Designer.cs
查看文件 @
32e31c7
...
@@ -229,6 +229,7 @@ namespace SmartScan
...
@@ -229,6 +229,7 @@ namespace SmartScan
// FrmSetPlus
// FrmSetPlus
//
//
this
.
AutoScaleMode
=
System
.
Windows
.
Forms
.
AutoScaleMode
.
None
;
this
.
AutoScaleMode
=
System
.
Windows
.
Forms
.
AutoScaleMode
.
None
;
this
.
AutoSize
=
true
;
this
.
ClientSize
=
new
System
.
Drawing
.
Size
(
1293
,
788
);
this
.
ClientSize
=
new
System
.
Drawing
.
Size
(
1293
,
788
);
this
.
Controls
.
Add
(
this
.
but_Labeling
);
this
.
Controls
.
Add
(
this
.
but_Labeling
);
this
.
Controls
.
Add
(
this
.
Keywordlabeling
);
this
.
Controls
.
Add
(
this
.
Keywordlabeling
);
...
...
SmartScan/PlusSettingFrm/FrmSetPlus.cs
查看文件 @
32e31c7
...
@@ -17,8 +17,8 @@ namespace SmartScan
...
@@ -17,8 +17,8 @@ namespace SmartScan
//Language.SetLanguage(this);
//Language.SetLanguage(this);
this
.
SizeChanged
+=
FrmSetPlus_SizeChanged
;
this
.
SizeChanged
+=
FrmSetPlus_SizeChanged
;
this
.
FormClosing
+=
FrmSetPlus_FormClosing
;
this
.
FormClosing
+=
FrmSetPlus_FormClosing
;
this
.
Width
=
1024
;
//
this.Width = 1024;
this
.
Height
=
738
;
//
this.Height = 738;
this
.
Top
=
15
;
this
.
Top
=
15
;
this
.
Left
=
0
;
this
.
Left
=
0
;
WebService
.
Open
();
//启动条码匹配服务
WebService
.
Open
();
//启动条码匹配服务
...
...
SmartScan/ScanWork.cs
查看文件 @
32e31c7
...
@@ -229,7 +229,7 @@ namespace SmartScan
...
@@ -229,7 +229,7 @@ namespace SmartScan
if
(
BLLCommon
.
config
.
TriggerOpenLight
)
if
(
BLLCommon
.
config
.
TriggerOpenLight
)
{
{
BLLCommon
.
lightSource
.
TurnOn
();
BLLCommon
.
lightSource
.
TurnOn
();
System
.
Threading
.
Thread
.
Sleep
(
20
00
);
//光源打开有一个由暗变亮的过程
System
.
Threading
.
Thread
.
Sleep
(
1
00
);
//光源打开有一个由暗变亮的过程
}
}
List
<
Bitmap
>
image
=
new
List
<
Bitmap
>(
Camera
.
CaptureAndGetCode
(
out
workCodeInfo
));
List
<
Bitmap
>
image
=
new
List
<
Bitmap
>(
Camera
.
CaptureAndGetCode
(
out
workCodeInfo
));
if
(
image
.
Count
>
0
&&
!
BLL
.
Config
.
Backgrounder
)
picShow
.
Image
=
image
[
0
];
if
(
image
.
Count
>
0
&&
!
BLL
.
Config
.
Backgrounder
)
picShow
.
Image
=
image
[
0
];
...
@@ -332,9 +332,8 @@ namespace SmartScan
...
@@ -332,9 +332,8 @@ namespace SmartScan
private
void
SetKey
(
bool
hasMatch
)
private
void
SetKey
(
bool
hasMatch
)
{
{
LogNet
.
log
.
Info
(
"Work SetKey hasMatch:"
+
hasMatch
);
LogNet
.
log
.
Info
(
"Work SetKey hasMatch:"
+
hasMatch
);
if
(
workCodeKeyword
.
Count
==
0
)
return
;
//if (workCodeKeyword.Count == 0){ return;}
BLLCommon
.
extension
.
SetKey
(
originalCodeText
,
workCodeKeyword
,
hasMatch
,
out
_
);
BLLCommon
.
extension
.
SetKey
(
originalCodeText
,
workCodeKeyword
,
hasMatch
,
out
_
);
//if (workCodeKeyword.Count == 0) return;放前面执行
if
(
workCodeKeyword
.
Any
(
a
=>
a
.
Value
.
StartsWith
(
"<OCR>"
)))
if
(
workCodeKeyword
.
Any
(
a
=>
a
.
Value
.
StartsWith
(
"<OCR>"
)))
{
{
BLLCommon
.
extension
.
DrawTextBackground
(
workCodeKeyword
);
BLLCommon
.
extension
.
DrawTextBackground
(
workCodeKeyword
);
...
...
SmartScan/SetControl/UsrMacro.Designer.cs
查看文件 @
32e31c7
此文件的差异被折叠,
点击展开。
SmartScan/SetControl/UsrMacro.cs
查看文件 @
32e31c7
SmartScan/SetControl/UsrMaterialTemplate.cs
查看文件 @
32e31c7
...
@@ -183,8 +183,6 @@ namespace SmartScan
...
@@ -183,8 +183,6 @@ namespace SmartScan
if
(
System
.
IO
.
File
.
Exists
(
iamgepath
))
if
(
System
.
IO
.
File
.
Exists
(
iamgepath
))
{
{
ImgShow
.
Image
=
ObjConversion
.
ReadImageFile
(
iamgepath
);
ImgShow
.
Image
=
ObjConversion
.
ReadImageFile
(
iamgepath
);
}
}
//ImgShow.Image = mateCopy[mateIndex].Image;
//ImgShow.Image = mateCopy[mateIndex].Image;
ImgShow
.
CodeCenterClear
();
ImgShow
.
CodeCenterClear
();
ImgShow
.
AddCodeCenter
(
LabelCenter
());
ImgShow
.
AddCodeCenter
(
LabelCenter
());
...
@@ -193,6 +191,21 @@ namespace SmartScan
...
@@ -193,6 +191,21 @@ namespace SmartScan
LstCode
.
SelectedIndex
=
-
1
;
LstCode
.
SelectedIndex
=
-
1
;
bmp
=
ImgShow
.
Image
;
bmp
=
ImgShow
.
Image
;
}
}
else
{
ImgShow
.
Image
=
null
;
ImgShow
.
CodeCenterClear
();
LstCode
.
Items
.
Clear
();
}
}
else
{
ImgShow
.
Image
=
null
;
ImgShow
.
CodeCenterClear
();
LstCode
.
Items
.
Clear
();
}
}
private
void
BtnAddMate_Click
(
object
sender
,
EventArgs
e
)
private
void
BtnAddMate_Click
(
object
sender
,
EventArgs
e
)
{
{
...
@@ -514,6 +527,7 @@ namespace SmartScan
...
@@ -514,6 +527,7 @@ namespace SmartScan
}
}
private
void
BtnOcrCode_Click_1
(
object
sender
,
EventArgs
e
)
private
void
BtnOcrCode_Click_1
(
object
sender
,
EventArgs
e
)
{
{
if
(
bmp
==
null
)
return
;
if
(
bmp
==
null
)
return
;
LstCode
.
Items
.
Clear
();
LstCode
.
Items
.
Clear
();
//保存需要识别ocr的区域
//保存需要识别ocr的区域
...
...
SmartScan/SetControl/UsrWorkMode.Designer.cs
查看文件 @
32e31c7
此文件的差异被折叠,
点击展开。
SmartScan/SetControl/UsrWorkMode.cs
查看文件 @
32e31c7
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.IO
;
using
System.Linq
;
using
System.Text
;
using
System.Windows.Forms
;
using
System.Windows.Forms
;
using
Asa.FaceControl
;
using
Asa.FaceControl
;
using
BLL
;
using
BLL
;
using
ClosedXML.Excel
;
using
Model
;
using
Model
;
namespace
SmartScan
namespace
SmartScan
...
@@ -106,5 +110,73 @@ namespace SmartScan
...
@@ -106,5 +110,73 @@ namespace SmartScan
BLLCommon
.
config
.
Save
();
BLLCommon
.
config
.
Save
();
}
}
int
i
=
0
;
private
void
but_Readfileprint_Click
(
object
sender
,
EventArgs
e
)
{
Dictionary
<
int
,
Dictionary
<
string
,
string
>>
valuePairs
=
new
Dictionary
<
int
,
Dictionary
<
string
,
string
>>();
i
++;
if
(
i
==
10
)
{
OpenFileDialog
openFileDialog
=
new
OpenFileDialog
();
openFileDialog
.
Multiselect
=
false
;
openFileDialog
.
Title
=
"请选择文件"
;
openFileDialog
.
Filter
=
"所有文件(*.*)|*.*"
;
if
(
openFileDialog
.
ShowDialog
()
==
DialogResult
.
OK
)
{
string
file
=
openFileDialog
.
FileName
;
ContinuousPrinting
(
file
);
}
i
=
0
;
}
}
public
delegate
void
PrintDelegate
(
Dictionary
<
string
,
string
>
content
);
public
static
event
PrintDelegate
Printing
;
public
void
ContinuousPrinting
(
string
filepath
)
{
Dictionary
<
int
,
Dictionary
<
string
,
string
>>
valuePairs
=
new
Dictionary
<
int
,
Dictionary
<
string
,
string
>>();
if
(!
File
.
Exists
(
filepath
))
{
MessageBox
.
Show
(
"文件不存在"
);
return
;
}
var
Titles
=
ExtraFileData
.
ParseXLSFileTitle
(
filepath
);
try
{
XLWorkbook
wb
=
new
XLWorkbook
(
filepath
);
IXLWorksheet
ws
=
wb
.
Worksheet
(
1
);
int
emptyrow
=
0
;
int
currow
=
1
;
while
(
emptyrow
<
3
)
{
var
rowdata
=
new
Dictionary
<
string
,
string
>();
for
(
int
i
=
0
;
i
<
Titles
.
Count
;
i
++)
{
var
v
=
ws
.
Row
(
currow
+
1
).
Cell
(
i
+
1
).
Value
.
ToString
().
Trim
();
rowdata
.
Add
(
Titles
[
i
],
v
);
}
currow
++;
if
(!
valuePairs
.
ContainsKey
(
currow
))
{
valuePairs
.
Add
(
currow
,
rowdata
);
}
if
(
rowdata
.
Values
.
Contains
(
""
))
{
emptyrow
++;
}
}
}
catch
(
Exception
ex
)
{
LogNet
.
log
.
Info
(
"数据源加载文件出错:"
+
ex
.
ToString
());
}
foreach
(
var
item
in
valuePairs
)
{
Printing
?.
Invoke
(
item
.
Value
);
}
}
}
}
}
}
SmartScan/WebCallWork.cs
查看文件 @
32e31c7
...
@@ -197,6 +197,7 @@ namespace SmartScan
...
@@ -197,6 +197,7 @@ namespace SmartScan
bool
rtn
=
BLLCommon
.
mateEdit
.
MatchingTemplate
(
workCodeInfo
,
BLLCommon
.
config
.
DefaultMaterialName
,
false
,
out
string
mateName
,
out
workCodeKeyword
,
out
AMatch
aMatch
);
bool
rtn
=
BLLCommon
.
mateEdit
.
MatchingTemplate
(
workCodeInfo
,
BLLCommon
.
config
.
DefaultMaterialName
,
false
,
out
string
mateName
,
out
workCodeKeyword
,
out
AMatch
aMatch
);
var
point
=
new
Point
(-
1
,-
1
);
var
point
=
new
Point
(-
1
,-
1
);
int
angle
=
0
;
int
angle
=
0
;
LogNet
.
log
.
Info
(
"模板匹配结果:"
+
rtn
);
if
(
rtn
)
if
(
rtn
)
{
{
string
key
=
ConfigHelper
.
Config
.
Get
(
"Label_Key"
,
""
);
string
key
=
ConfigHelper
.
Config
.
Get
(
"Label_Key"
,
""
);
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论