Commit cd0daa29 刘韬

数量去掉pcs再匹配

1 个父辈 5f5fd015
...@@ -619,8 +619,11 @@ namespace BLL ...@@ -619,8 +619,11 @@ namespace BLL
{ {
int matchCount = 0; int matchCount = 0;
var codeText = codeinfo.Text; var codeText = codeinfo.Text;
codeText = codeText.Replace("\r", ""); if (codeinfo.CodeType == "OCR")
codeText = codeText.Replace("\n", ""); {
codeText = codeText.Replace("\r", "");
codeText = codeText.Replace("\n", "");
}
MatchAnalysis.SetBarcode(codeinfo); MatchAnalysis.SetBarcode(codeinfo);
code = codeMatch[i].CaseSensitive ? codeText : codeText.ToUpper(); code = codeMatch[i].CaseSensitive ? codeText : codeText.ToUpper();
bool ismatch = true; bool ismatch = true;
...@@ -649,7 +652,7 @@ namespace BLL ...@@ -649,7 +652,7 @@ namespace BLL
if (!code.StartsWith(text)) if (!code.StartsWith(text))
ismatch = false; ismatch = false;
MatchAnalysis.AddMatch(codeMatch[i].Keyword, ismatch, codeMatch[i].CodeID, $"开头字符:\"{text}\"", $"NG"); MatchAnalysis.AddMatch(codeMatch[i].Keyword, ismatch, codeMatch[i].CodeID, $"开头字符:\"{text}\"", ismatch ? "OK" : "NG");
//if (!ismatch) return null; //if (!ismatch) return null;
} }
...@@ -662,7 +665,7 @@ namespace BLL ...@@ -662,7 +665,7 @@ namespace BLL
if (!code.EndsWith(text)) if (!code.EndsWith(text))
ismatch = false; ismatch = false;
MatchAnalysis.AddMatch(codeMatch[i].Keyword, ismatch, codeMatch[i].CodeID, $"结尾字符:\"{text}\"", $"NG"); MatchAnalysis.AddMatch(codeMatch[i].Keyword, ismatch, codeMatch[i].CodeID, $"结尾字符:\"{text}\"", ismatch ? "OK" : "NG");
//if (!ismatch) return null; //if (!ismatch) return null;
} }
...@@ -689,7 +692,7 @@ namespace BLL ...@@ -689,7 +692,7 @@ namespace BLL
ismatch = false; ismatch = false;
var mode = codeMatch[i].MatchMiddleType == 0 ? "相等" : codeMatch[i].MatchMiddleType == 1 ? "至多" : "至少"; var mode = codeMatch[i].MatchMiddleType == 0 ? "相等" : codeMatch[i].MatchMiddleType == 1 ? "至多" : "至少";
MatchAnalysis.AddMatch(codeMatch[i].Keyword, ismatch, codeMatch[i].CodeID, $"中间字符:\"{text}\",{mode}匹配:{codeMatch[i].MiddleTextCount}次", $"NG"); MatchAnalysis.AddMatch(codeMatch[i].Keyword, ismatch, codeMatch[i].CodeID, $"中间字符:\"{text}\",{mode}匹配:{codeMatch[i].MiddleTextCount}次", ismatch ? "OK" : "NG");
//if (!ismatch) return null; //if (!ismatch) return null;
} }
...@@ -714,7 +717,7 @@ namespace BLL ...@@ -714,7 +717,7 @@ namespace BLL
ismatch = false; ismatch = false;
} }
MatchAnalysis.AddMatch(codeMatch[i].Keyword, ismatch, codeMatch[i].CodeID, $"分割符:{codeMatch[i].SplitText},第:{codeMatch[i].SplitPart}位", $"NG"); MatchAnalysis.AddMatch(codeMatch[i].Keyword, ismatch, codeMatch[i].CodeID, $"分割符:{codeMatch[i].SplitText},第:{codeMatch[i].SplitPart}位", ismatch ? "OK" : "NG");
//if (!ismatch) return null; //if (!ismatch) return null;
} }
...@@ -740,13 +743,14 @@ namespace BLL ...@@ -740,13 +743,14 @@ namespace BLL
if (codeMatch[i].MatchISNumber) if (codeMatch[i].MatchISNumber)
{ {
LogNet.log.Info($"开始匹配数字 [{filtercode}]"); LogNet.log.Info($"开始匹配数字 [{filtercode}]");
string analysisReason = $"\"{filtercode}\""; filtercode = filtercode.Trim().ToLower().Replace("pcs", "");
filtercode = filtercode.Replace(",", "");
string analysisReason = filtercode;
if (!int.TryParse(filtercode, out int res)) if (!int.TryParse(filtercode, out int res))
{ {
ismatch = false; ismatch = false;
analysisReason += $" NG"; analysisReason += $" NG";
} }
else else
{ {
...@@ -765,7 +769,7 @@ namespace BLL ...@@ -765,7 +769,7 @@ namespace BLL
//bool ismatch = true; //bool ismatch = true;
if (code.Length < codeMatch[i].MinLength) if (code.Length < codeMatch[i].MinLength)
ismatch = false; ismatch = false;
MatchAnalysis.AddMatch(codeMatch[i].Keyword, ismatch, codeMatch[i].CodeID, $"长度小于:{codeMatch[i].MatchMinLength}", $"NG"); MatchAnalysis.AddMatch(codeMatch[i].Keyword, ismatch, codeMatch[i].CodeID, $"长度小于:{codeMatch[i].MatchMinLength}", ismatch ? "OK" : "NG");
//if (!ismatch) return null; //if (!ismatch) return null;
} }
...@@ -776,7 +780,7 @@ namespace BLL ...@@ -776,7 +780,7 @@ namespace BLL
//bool ismatch = true; //bool ismatch = true;
if (code.Length > codeMatch[i].MaxLength) if (code.Length > codeMatch[i].MaxLength)
ismatch = false; ismatch = false;
MatchAnalysis.AddMatch(codeMatch[i].Keyword, ismatch, codeMatch[i].CodeID, $"长度最大:{codeMatch[i].MatchMaxLength}", $"NG"); MatchAnalysis.AddMatch(codeMatch[i].Keyword, ismatch, codeMatch[i].CodeID, $"长度最大:{codeMatch[i].MatchMaxLength}", ismatch ? "OK" : "NG");
} }
if (!ismatch) if (!ismatch)
......
...@@ -12,19 +12,19 @@ namespace Model ...@@ -12,19 +12,19 @@ namespace Model
/// </summary> /// </summary>
public static class FilePath public static class FilePath
{ {
public static readonly string LANGUAGE_DIR = Environment.CurrentDirectory + "\\Language\\"; public static readonly string LANGUAGE_DIR = Application.StartupPath + "\\Language\\";
public static readonly string MATERIAL_DIR = Environment.CurrentDirectory + "\\Material\\"; public static readonly string MATERIAL_DIR = Application.StartupPath + "\\Material\\";
public static readonly string RETROSPECT_DIR = Application.StartupPath + "\\Retrospect\\"; public static readonly string RETROSPECT_DIR = Application.StartupPath + "\\Retrospect\\";
public static readonly string PRINT_LABEL_DIR = Environment.CurrentDirectory + "\\PrintLabel\\"; public static readonly string PRINT_LABEL_DIR = Application.StartupPath + "\\PrintLabel\\";
public static readonly string CONFIG_DIR = Environment.CurrentDirectory + "\\Config\\"; public static readonly string CONFIG_DIR = Application.StartupPath + "\\Config\\";
public static readonly string CONFIG_APP = Environment.CurrentDirectory + "\\Config\\app.config"; public static readonly string CONFIG_APP = Application.StartupPath + "\\Config\\app.config";
public static readonly string CONFIG_CAMERA = Environment.CurrentDirectory + "\\Config\\Camera.json"; public static readonly string CONFIG_CAMERA = Application.StartupPath + "\\Config\\Camera.json";
public static readonly string CONFIG_MACRO_KEY = Environment.CurrentDirectory + "\\Config\\MacroKey.txt"; public static readonly string CONFIG_MACRO_KEY = Application.StartupPath + "\\Config\\MacroKey.txt";
public static readonly string CONFIG_HTTP_TEST_DATA = Environment.CurrentDirectory + "\\Config\\HttpTestData.json"; public static readonly string CONFIG_HTTP_TEST_DATA = Application.StartupPath + "\\Config\\HttpTestData.json";
public static readonly string CONFIG_EXTENSION = Environment.CurrentDirectory + "\\Config\\Extension.json"; public static readonly string CONFIG_EXTENSION = Application.StartupPath + "\\Config\\Extension.json";
public static readonly string CONFIG_REELID = Environment.CurrentDirectory + "\\Config\\ReelID"; public static readonly string CONFIG_REELID = Application.StartupPath + "\\Config\\ReelID";
public static readonly string CONFIG_DATABASE = Environment.CurrentDirectory + "\\Config\\Database.db3"; public static readonly string CONFIG_DATABASE = Application.StartupPath + "\\Config\\Database.db3";
public static readonly string CONFIG_AUTOGENRULES = Environment.CurrentDirectory + "\\Config\\AutoGenRules.json"; public static readonly string CONFIG_AUTOGENRULES = Application.StartupPath + "\\Config\\AutoGenRules.json";
} }
} }
...@@ -29,8 +29,12 @@ namespace SmartScan ...@@ -29,8 +29,12 @@ namespace SmartScan
{ {
InitializeComponent(); InitializeComponent();
windowHeight = this.Height; windowHeight = this.Height;
codeText = codeText.Replace("\r", ""); this.codeText = codeText;
this.codeText = codeText.Replace("\n", ""); if (codeType == "OCR")
{
codeText = codeText.Replace("\r", "");
this.codeText = codeText.Replace("\n", "");
}
this.codeID = codeID; this.codeID = codeID;
this.codeType = codeType; this.codeType = codeType;
TxtMatchingEndText.Tag = "not"; TxtMatchingEndText.Tag = "not";
......
...@@ -99,6 +99,7 @@ namespace SmartScan ...@@ -99,6 +99,7 @@ namespace SmartScan
Application.SetCompatibleTextRenderingDefault(false); Application.SetCompatibleTextRenderingDefault(false);
//BLL.Config.Backgrounder = true; //BLL.Config.Backgrounder = true;
bool back = BLL.Config.Backgrounder; bool back = BLL.Config.Backgrounder;
bool hide = false; bool hide = false;
if (args.Length > 0) if (args.Length > 0)
hide = args[0].ToLower() == "hide"; hide = args[0].ToLower() == "hide";
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!