Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
张东亮
/
NS100
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 909825a2
由
贾鹏旭
编写于
2023-08-28 17:14:02 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
获取最新数据
1 个父辈
b2199b45
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
10 个修改的文件
包含
56 行增加
和
39 行删除
BLL/Config.cs
BLL/Extension/Item_General.cs
BLL/Replacekeywords.cs
SmartScan/Form/FrmCodeExtract.cs
SmartScan/Language/en-US.xml
SmartScan/Language/zh-CN.xml
SmartScan/SetControl/UsrMacro.Designer.cs
SmartScan/SetControl/UsrMacro.cs
SmartScan/SetControl/UsrMaterialTemplate.cs
SmartScan/SmartScan.csproj
BLL/Config.cs
查看文件 @
909825a
...
@@ -328,7 +328,13 @@ namespace BLL
...
@@ -328,7 +328,13 @@ namespace BLL
public
static
MyConfig
<
bool
>
Func_EnabledOCR
;
public
static
MyConfig
<
bool
>
Func_EnabledOCR
;
[
MyConfigComment
(
"允许修改打内容"
)]
[
MyConfigComment
(
"允许修改打内容"
)]
public
static
MyConfig
<
bool
>
AllowModifyPrintInfo
;
public
static
MyConfig
<
bool
>
AllowModifyPrintInfo
;
/// <summary>
/// 0,不重置
/// 1,按天
/// 2,按月
/// </summary>
[
MyConfigComment
(
"唯一码后缀编号重置策略"
)]
public
static
MyConfig
<
int
>
REEL_ID_AutoResetStrategy
;
public
void
Save
()
public
void
Save
()
{
{
config
.
Save
();
config
.
Save
();
...
...
BLL/Extension/Item_General.cs
查看文件 @
909825a
...
@@ -247,13 +247,17 @@ namespace BLL
...
@@ -247,13 +247,17 @@ namespace BLL
int
reelID
=
1
;
int
reelID
=
1
;
try
try
{
{
var
reelidfile
=
FilePath
.
CONFIG_REELID
;
var
reelidfile
=
FilePath
.
CONFIG_REELID
;
if
(
config
.
ReelIDAutoResetByDate
)
if
(
Config
.
REEL_ID_AutoResetStrategy
==
1
)
{
{
Directory
.
CreateDirectory
(
reelidfile
+
"_dir"
);
Directory
.
CreateDirectory
(
reelidfile
+
"_dir"
);
reelidfile
=
Path
.
Combine
(
FilePath
.
CONFIG_REELID
+
"_dir"
,
DateTime
.
Now
.
ToString
(
"yyyyMMdd"
));
reelidfile
=
Path
.
Combine
(
FilePath
.
CONFIG_REELID
+
"_dir"
,
DateTime
.
Now
.
ToString
(
"yyyyMMdd"
));
}
}
else
if
(
Config
.
REEL_ID_AutoResetStrategy
==
2
)
{
Directory
.
CreateDirectory
(
reelidfile
+
"_dir"
);
reelidfile
=
Path
.
Combine
(
FilePath
.
CONFIG_REELID
+
"_dir"
,
DateTime
.
Now
.
ToString
(
"yyyyMM"
));
}
if
(
File
.
Exists
(
reelidfile
))
if
(
File
.
Exists
(
reelidfile
))
{
{
string
text
=
File
.
ReadAllText
(
reelidfile
);
string
text
=
File
.
ReadAllText
(
reelidfile
);
...
...
BLL/Replacekeywords.cs
查看文件 @
909825a
using
DAL
;
using
Model
;
using
DocumentFormat.OpenXml.Office2016.Drawing.Command
;
using
DocumentFormat.OpenXml.Wordprocessing
;
using
Model
;
using
Newtonsoft.Json.Linq
;
using
Newtonsoft.Json.Linq
;
using
RestSharp
;
using
RestSharp
;
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Configuration
;
using
System.Configuration
;
using
System.Linq
;
using
System.Linq
;
using
System.Net
;
using
System.Net.Http
;
using
System.Security.Policy
;
using
System.Text
;
using
System.Web
;
using
ZXing.Aztec.Internal
;
using
Http
=
Model
.
Http
;
using
Http
=
Model
.
Http
;
namespace
BLL
namespace
BLL
...
...
SmartScan/Form/FrmCodeExtract.cs
查看文件 @
909825a
...
@@ -252,13 +252,13 @@ namespace SmartScan
...
@@ -252,13 +252,13 @@ namespace SmartScan
emptyMatch
=
true
;
emptyMatch
=
true
;
}
}
}
}
else
if
(
match
.
MatchSplit
)
//
else if (match.MatchSplit)
{
//
{
if
(
string
.
IsNullOrEmpty
(
match
.
MiddleText
))
//
if(string.IsNullOrEmpty(match.MiddleText))
{
//
{
emptyMatch
=
true
;
//
emptyMatch = true;
}
//
}
}
//
}
else
if
(
match
.
MatchStart
)
else
if
(
match
.
MatchStart
)
{
{
if
(
string
.
IsNullOrEmpty
(
match
.
StartText
))
if
(
string
.
IsNullOrEmpty
(
match
.
StartText
))
...
...
SmartScan/Language/en-US.xml
0 → 100644
查看文件 @
909825a
此文件的差异被折叠,
点击展开。
SmartScan/Language/zh-CN.xml
0 → 100644
查看文件 @
909825a
此文件的差异被折叠,
点击展开。
SmartScan/SetControl/UsrMacro.Designer.cs
查看文件 @
909825a
此文件的差异被折叠,
点击展开。
SmartScan/SetControl/UsrMacro.cs
查看文件 @
909825a
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Windows.Forms
;
using
System.Windows.Forms
;
using
Asa.FaceControl
;
using
BLL
;
using
BLL
;
using
Model
;
using
Model
;
...
@@ -13,6 +14,8 @@ namespace SmartScan
...
@@ -13,6 +14,8 @@ namespace SmartScan
public
UsrMacro
()
public
UsrMacro
()
{
{
InitializeComponent
();
InitializeComponent
();
//CmbResetidBy.Tag = "not";
CmbResetidBy
.
Items
.
AddRange
(
new
string
[]
{
Language
.
Dialog
(
"ResetidByNone"
),
Language
.
Dialog
(
"ResetidByDay"
),
Language
.
Dialog
(
"ResetidByMonth"
)
});
keyCopy
=
new
(
BLLCommon
.
macroKey
);
keyCopy
=
new
(
BLLCommon
.
macroKey
);
LstKey
.
Items
.
AddRange
(
keyCopy
.
ToArray
());
LstKey
.
Items
.
AddRange
(
keyCopy
.
ToArray
());
setRIkey
();
setRIkey
();
...
@@ -21,7 +24,13 @@ namespace SmartScan
...
@@ -21,7 +24,13 @@ namespace SmartScan
TxtPostfix
.
Text
=
BLLCommon
.
config
.
ReelIDPostfix
;
TxtPostfix
.
Text
=
BLLCommon
.
config
.
ReelIDPostfix
;
NumReelIDPlaces
.
Value
=
BLLCommon
.
config
.
ReelIDPlaces
;
NumReelIDPlaces
.
Value
=
BLLCommon
.
config
.
ReelIDPlaces
;
ChkReelIDFillZero
.
Checked
=
BLLCommon
.
config
.
ReelIDFillZero
;
ChkReelIDFillZero
.
Checked
=
BLLCommon
.
config
.
ReelIDFillZero
;
ChkResetidbydate
.
Checked
=
BLLCommon
.
config
.
ReelIDAutoResetByDate
;
int
sel
=
Config
.
REEL_ID_AutoResetStrategy
;
if
(
sel
<
0
||
sel
>
CmbResetidBy
.
Items
.
Count
-
1
)
{
Config
.
REEL_ID_AutoResetStrategy
=
0
;
sel
=
0
;
}
CmbResetidBy
.
SelectedIndex
=
sel
;
Asa
.
FaceControl
.
Language
.
SetLanguage
(
this
);
Asa
.
FaceControl
.
Language
.
SetLanguage
(
this
);
}
}
...
@@ -41,10 +50,10 @@ namespace SmartScan
...
@@ -41,10 +50,10 @@ namespace SmartScan
BLLCommon
.
config
.
ReelIDPostfix
=
TxtPostfix
.
Text
;
BLLCommon
.
config
.
ReelIDPostfix
=
TxtPostfix
.
Text
;
BLLCommon
.
config
.
ReelIDPlaces
=
(
int
)
NumReelIDPlaces
.
Value
;
BLLCommon
.
config
.
ReelIDPlaces
=
(
int
)
NumReelIDPlaces
.
Value
;
BLLCommon
.
config
.
ReelIDFillZero
=
ChkReelIDFillZero
.
Checked
;
BLLCommon
.
config
.
ReelIDFillZero
=
ChkReelIDFillZero
.
Checked
;
BLLCommon
.
config
.
ReelIDAutoResetByDate
=
ChkResetidbydate
.
Checked
;
BLLCommon
.
config
.
Save
();
BLLCommon
.
config
.
Save
();
}
}
void
setRIkey
()
{
void
setRIkey
()
{
LstKey
.
Items
.
Clear
();
LstKey
.
Items
.
Clear
();
LstKey
.
Items
.
AddRange
(
keyCopy
.
ToArray
());
LstKey
.
Items
.
AddRange
(
keyCopy
.
ToArray
());
for
(
int
i
=
0
;
i
<
LstKey
.
Items
.
Count
;
i
++)
for
(
int
i
=
0
;
i
<
LstKey
.
Items
.
Count
;
i
++)
...
@@ -57,7 +66,7 @@ namespace SmartScan
...
@@ -57,7 +66,7 @@ namespace SmartScan
private
void
LstKey_SelectedIndexChanged
(
object
sender
,
EventArgs
e
)
private
void
LstKey_SelectedIndexChanged
(
object
sender
,
EventArgs
e
)
{
{
if
(
LstKey
.
SelectedIndex
>=
0
)
if
(
LstKey
.
SelectedIndex
>=
0
)
TxtKey
.
Text
=
keyCopy
[
LstKey
.
SelectedIndex
];
TxtKey
.
Text
=
keyCopy
[
LstKey
.
SelectedIndex
];
}
}
...
@@ -102,7 +111,7 @@ namespace SmartScan
...
@@ -102,7 +111,7 @@ namespace SmartScan
hint
=
hint
.
Replace
(
"[name]"
,
text
);
hint
=
hint
.
Replace
(
"[name]"
,
text
);
new
Asa
.
FaceControl
.
FaceMessageBox
(
""
,
hint
,
MessageBoxButtons
.
OK
).
ShowDialog
();
new
Asa
.
FaceControl
.
FaceMessageBox
(
""
,
hint
,
MessageBoxButtons
.
OK
).
ShowDialog
();
}
}
}
}
private
void
BtnAppendKey_Click
(
object
sender
,
EventArgs
e
)
private
void
BtnAppendKey_Click
(
object
sender
,
EventArgs
e
)
...
@@ -114,9 +123,9 @@ namespace SmartScan
...
@@ -114,9 +123,9 @@ namespace SmartScan
private
void
btn_up_Click
(
object
sender
,
EventArgs
e
)
private
void
btn_up_Click
(
object
sender
,
EventArgs
e
)
{
{
if
(
LstKey
.
SelectedIndex
==
-
1
||
LstKey
.
SelectedIndex
==
0
)
return
;
if
(
LstKey
.
SelectedIndex
==
-
1
||
LstKey
.
SelectedIndex
==
0
)
return
;
keyCopy
.
Insert
(
LstKey
.
SelectedIndex
-
1
,
keyCopy
[
LstKey
.
SelectedIndex
]);
keyCopy
.
Insert
(
LstKey
.
SelectedIndex
-
1
,
keyCopy
[
LstKey
.
SelectedIndex
]);
keyCopy
.
RemoveAt
(
LstKey
.
SelectedIndex
+
1
);
keyCopy
.
RemoveAt
(
LstKey
.
SelectedIndex
+
1
);
LstKey
.
Items
.
Clear
();
LstKey
.
Items
.
Clear
();
LstKey
.
Items
.
AddRange
(
keyCopy
.
ToArray
());
LstKey
.
Items
.
AddRange
(
keyCopy
.
ToArray
());
LstKey
.
SelectedIndex
=
LstKey
.
SelectedIndex
-
1
;
LstKey
.
SelectedIndex
=
LstKey
.
SelectedIndex
-
1
;
...
@@ -125,8 +134,8 @@ namespace SmartScan
...
@@ -125,8 +134,8 @@ namespace SmartScan
private
void
btn_down_Click
(
object
sender
,
EventArgs
e
)
private
void
btn_down_Click
(
object
sender
,
EventArgs
e
)
{
{
if
(
LstKey
.
SelectedIndex
==
-
1
||
LstKey
.
SelectedIndex
==
keyCopy
.
Count
-
1
)
return
;
if
(
LstKey
.
SelectedIndex
==
-
1
||
LstKey
.
SelectedIndex
==
keyCopy
.
Count
-
1
)
return
;
keyCopy
.
Insert
(
LstKey
.
SelectedIndex
+
2
,
keyCopy
[
LstKey
.
SelectedIndex
]);
keyCopy
.
Insert
(
LstKey
.
SelectedIndex
+
2
,
keyCopy
[
LstKey
.
SelectedIndex
]);
keyCopy
.
RemoveAt
(
LstKey
.
SelectedIndex
);
keyCopy
.
RemoveAt
(
LstKey
.
SelectedIndex
);
LstKey
.
Items
.
Clear
();
LstKey
.
Items
.
Clear
();
LstKey
.
Items
.
AddRange
(
keyCopy
.
ToArray
());
LstKey
.
Items
.
AddRange
(
keyCopy
.
ToArray
());
...
...
SmartScan/SetControl/UsrMaterialTemplate.cs
查看文件 @
909825a
...
@@ -232,6 +232,7 @@ namespace SmartScan
...
@@ -232,6 +232,7 @@ namespace SmartScan
private
void
BtnLocalImage_Click
(
object
sender
,
EventArgs
e
)
private
void
BtnLocalImage_Click
(
object
sender
,
EventArgs
e
)
{
{
if
(
mateIndex
<
0
)
return
;
using
OpenFileDialog
dlg
=
new
()
{
Filter
=
"Image Files|*.jpg;*.jpeg;*.png;*.bmp;*.gif|All Files|*.*"
};
using
OpenFileDialog
dlg
=
new
()
{
Filter
=
"Image Files|*.jpg;*.jpeg;*.png;*.bmp;*.gif|All Files|*.*"
};
if
(
dlg
.
ShowDialog
()
!=
DialogResult
.
OK
)
return
;
if
(
dlg
.
ShowDialog
()
!=
DialogResult
.
OK
)
return
;
...
@@ -473,7 +474,7 @@ namespace SmartScan
...
@@ -473,7 +474,7 @@ namespace SmartScan
var
curMatch
=
mateCopy
[
mateIndex
];
var
curMatch
=
mateCopy
[
mateIndex
];
List
<
BarcodeInfo
>
code
=
new
List
<
BarcodeInfo
>();
List
<
BarcodeInfo
>
code
=
new
List
<
BarcodeInfo
>();
curMatch
.
Code
.
ForEach
(
s
=>
{
code
.
Add
(
new
BarcodeInfo
()
{
Text
=
s
.
Text
,
CodeType
=
s
.
CodeType
});
});
curMatch
.
Code
.
ForEach
(
s
=>
{
code
.
Add
(
new
BarcodeInfo
()
{
Text
=
s
.
Text
,
CodeType
=
s
.
CodeType
});
});
ismatch
=
TemplateExtract
(
curMatch
,
code
,
out
Dictionary
<
string
,
string
>
keyword
,
out
List
<
string
>
allkeys
);
ismatch
=
TemplateExtract
(
curMatch
,
code
,
out
Dictionary
<
string
,
string
>
keyword
,
out
List
<
string
>
allkeys
);
var
codeMatch
=
curMatch
.
Match
.
FindAll
(
s
=>
!
string
.
IsNullOrEmpty
(
s
.
Keyword
));
var
codeMatch
=
curMatch
.
Match
.
FindAll
(
s
=>
!
string
.
IsNullOrEmpty
(
s
.
Keyword
));
if
(
codeMatch
!=
null
)
if
(
codeMatch
!=
null
)
{
{
...
@@ -482,8 +483,8 @@ namespace SmartScan
...
@@ -482,8 +483,8 @@ namespace SmartScan
StringBuilder
sb
=
new
StringBuilder
();
StringBuilder
sb
=
new
StringBuilder
();
foreach
(
var
key
in
keyword
.
Keys
)
foreach
(
var
key
in
keyword
.
Keys
)
{
{
var
dul
=
allkeys
.
FindAll
(
s
=>
s
.
Equals
(
key
));
var
dul
=
allkeys
.
FindAll
(
s
=>
s
.
Equals
(
key
));
if
(
dul
!=
null
&&
dul
.
Count
>
1
)
if
(
dul
!=
null
&&
dul
.
Count
>
1
)
{
{
sb
.
AppendLine
(
key
);
sb
.
AppendLine
(
key
);
}
}
...
@@ -511,7 +512,7 @@ namespace SmartScan
...
@@ -511,7 +512,7 @@ namespace SmartScan
}
}
if
(!
ismatch
)
if
(!
ismatch
)
{
{
if
(
codeMatch
.
Count
==
0
)
if
(
codeMatch
.
Count
==
0
)
{
{
string
text
=
Language
.
Dialog
(
LanguageDialogKey
.
TEMPLATE_UN_SET_MATCHING
,
"[name] 模板不匹配,未设置匹配规则"
);
string
text
=
Language
.
Dialog
(
LanguageDialogKey
.
TEMPLATE_UN_SET_MATCHING
,
"[name] 模板不匹配,未设置匹配规则"
);
text
=
text
.
Replace
(
"[name]"
,
curMatch
.
Name
);
text
=
text
.
Replace
(
"[name]"
,
curMatch
.
Name
);
...
@@ -537,17 +538,17 @@ namespace SmartScan
...
@@ -537,17 +538,17 @@ namespace SmartScan
StringBuilder
sb
=
new
StringBuilder
();
StringBuilder
sb
=
new
StringBuilder
();
for
(
int
i
=
0
;
i
<
mateCopy
.
Count
;
i
++)
for
(
int
i
=
0
;
i
<
mateCopy
.
Count
;
i
++)
{
{
if
(
mateIndex
==
i
)
continue
;
if
(
mateIndex
==
i
)
continue
;
var
othMatch
=
mateCopy
[
i
];
var
othMatch
=
mateCopy
[
i
];
bool
ismatch
=
TemplateExtract
(
othMatch
,
code
,
out
Dictionary
<
string
,
string
>
keyword
,
out
List
<
string
>
allkeys
);
bool
ismatch
=
TemplateExtract
(
othMatch
,
code
,
out
Dictionary
<
string
,
string
>
keyword
,
out
List
<
string
>
allkeys
);
if
(
ismatch
)
if
(
ismatch
)
{
{
sb
.
AppendLine
(
othMatch
.
Name
);
sb
.
AppendLine
(
othMatch
.
Name
);
LogNet
.
log
.
Info
(
$
"【{othMatch.Name}】模板与当前模板【{curMatch.Name}】匹配冲突"
);
LogNet
.
log
.
Info
(
$
"【{othMatch.Name}】模板与当前模板【{curMatch.Name}】匹配冲突"
);
}
}
}
}
string
templates
=
sb
.
ToString
();
string
templates
=
sb
.
ToString
();
if
(
templates
.
Length
>
0
)
if
(
templates
.
Length
>
0
)
{
{
string
text
=
Language
.
Dialog
(
LanguageDialogKey
.
TEMPLATE_MATCHING_CONFLICT
,
"[name] 与以下的模板匹配冲突"
);
string
text
=
Language
.
Dialog
(
LanguageDialogKey
.
TEMPLATE_MATCHING_CONFLICT
,
"[name] 与以下的模板匹配冲突"
);
text
=
text
.
Replace
(
"[name]"
,
curMatch
.
Name
);
text
=
text
.
Replace
(
"[name]"
,
curMatch
.
Name
);
...
@@ -560,7 +561,7 @@ namespace SmartScan
...
@@ -560,7 +561,7 @@ namespace SmartScan
}
}
return
true
;
return
true
;
}
}
private
bool
TemplateExtract
(
MaterialTemplate
materialTemplate
,
List
<
BarcodeInfo
>
code
,
out
Dictionary
<
string
,
string
>
keyword
,
out
List
<
string
>
allKeywords
)
private
bool
TemplateExtract
(
MaterialTemplate
materialTemplate
,
List
<
BarcodeInfo
>
code
,
out
Dictionary
<
string
,
string
>
keyword
,
out
List
<
string
>
allKeywords
)
{
{
keyword
=
new
(
StringComparer
.
OrdinalIgnoreCase
);
keyword
=
new
(
StringComparer
.
OrdinalIgnoreCase
);
allKeywords
=
new
List
<
string
>();
allKeywords
=
new
List
<
string
>();
...
...
SmartScan/SmartScan.csproj
查看文件 @
909825a
...
@@ -401,6 +401,12 @@
...
@@ -401,6 +401,12 @@
</ItemGroup>
</ItemGroup>
<ItemGroup>
<ItemGroup>
<Content Include="App.ico" />
<Content Include="App.ico" />
<Content Include="Language\en-US.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Language\zh-CN.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<None Include="Resources\copy.png" />
<None Include="Resources\copy.png" />
<None Include="Resources\validate.png" />
<None Include="Resources\validate.png" />
<None Include="Resources\filter.png" />
<None Include="Resources\filter.png" />
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论