Commit cd0daa29 刘韬

数量去掉pcs再匹配

1 个父辈 5f5fd015
......@@ -619,8 +619,11 @@ namespace BLL
{
int matchCount = 0;
var codeText = codeinfo.Text;
if (codeinfo.CodeType == "OCR")
{
codeText = codeText.Replace("\r", "");
codeText = codeText.Replace("\n", "");
}
MatchAnalysis.SetBarcode(codeinfo);
code = codeMatch[i].CaseSensitive ? codeText : codeText.ToUpper();
bool ismatch = true;
......@@ -649,7 +652,7 @@ namespace BLL
if (!code.StartsWith(text))
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;
}
......@@ -662,7 +665,7 @@ namespace BLL
if (!code.EndsWith(text))
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;
}
......@@ -689,7 +692,7 @@ namespace BLL
ismatch = false;
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;
}
......@@ -714,7 +717,7 @@ namespace BLL
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;
}
......@@ -740,13 +743,14 @@ namespace BLL
if (codeMatch[i].MatchISNumber)
{
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))
{
ismatch = false;
analysisReason += $" NG";
}
else
{
......@@ -765,7 +769,7 @@ namespace BLL
//bool ismatch = true;
if (code.Length < codeMatch[i].MinLength)
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;
}
......@@ -776,7 +780,7 @@ namespace BLL
//bool ismatch = true;
if (code.Length > codeMatch[i].MaxLength)
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)
......
......@@ -12,19 +12,19 @@ namespace Model
/// </summary>
public static class FilePath
{
public static readonly string LANGUAGE_DIR = Environment.CurrentDirectory + "\\Language\\";
public static readonly string MATERIAL_DIR = Environment.CurrentDirectory + "\\Material\\";
public static readonly string LANGUAGE_DIR = Application.StartupPath + "\\Language\\";
public static readonly string MATERIAL_DIR = Application.StartupPath + "\\Material\\";
public static readonly string RETROSPECT_DIR = Application.StartupPath + "\\Retrospect\\";
public static readonly string PRINT_LABEL_DIR = Environment.CurrentDirectory + "\\PrintLabel\\";
public static readonly string CONFIG_DIR = Environment.CurrentDirectory + "\\Config\\";
public static readonly string PRINT_LABEL_DIR = Application.StartupPath + "\\PrintLabel\\";
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_CAMERA = Environment.CurrentDirectory + "\\Config\\Camera.json";
public static readonly string CONFIG_MACRO_KEY = Environment.CurrentDirectory + "\\Config\\MacroKey.txt";
public static readonly string CONFIG_HTTP_TEST_DATA = Environment.CurrentDirectory + "\\Config\\HttpTestData.json";
public static readonly string CONFIG_EXTENSION = Environment.CurrentDirectory + "\\Config\\Extension.json";
public static readonly string CONFIG_REELID = Environment.CurrentDirectory + "\\Config\\ReelID";
public static readonly string CONFIG_DATABASE = Environment.CurrentDirectory + "\\Config\\Database.db3";
public static readonly string CONFIG_AUTOGENRULES = Environment.CurrentDirectory + "\\Config\\AutoGenRules.json";
public static readonly string CONFIG_APP = Application.StartupPath + "\\Config\\app.config";
public static readonly string CONFIG_CAMERA = Application.StartupPath + "\\Config\\Camera.json";
public static readonly string CONFIG_MACRO_KEY = Application.StartupPath + "\\Config\\MacroKey.txt";
public static readonly string CONFIG_HTTP_TEST_DATA = Application.StartupPath + "\\Config\\HttpTestData.json";
public static readonly string CONFIG_EXTENSION = Application.StartupPath + "\\Config\\Extension.json";
public static readonly string CONFIG_REELID = Application.StartupPath + "\\Config\\ReelID";
public static readonly string CONFIG_DATABASE = Application.StartupPath + "\\Config\\Database.db3";
public static readonly string CONFIG_AUTOGENRULES = Application.StartupPath + "\\Config\\AutoGenRules.json";
}
}
......@@ -29,8 +29,12 @@ namespace SmartScan
{
InitializeComponent();
windowHeight = this.Height;
this.codeText = codeText;
if (codeType == "OCR")
{
codeText = codeText.Replace("\r", "");
this.codeText = codeText.Replace("\n", "");
}
this.codeID = codeID;
this.codeType = codeType;
TxtMatchingEndText.Tag = "not";
......
......@@ -99,6 +99,7 @@ namespace SmartScan
Application.SetCompatibleTextRenderingDefault(false);
//BLL.Config.Backgrounder = true;
bool back = BLL.Config.Backgrounder;
bool hide = false;
if (args.Length > 0)
hide = args[0].ToLower() == "hide";
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!