Commit b1a35793 刘韬

优化从web接口解析式的结果排序

1 个父辈 1fe12e83
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing; using System.Drawing;
using System.IO; using System.IO;
using System.Linq;
using System.Reflection.Emit; using System.Reflection.Emit;
using System.Xml; using System.Xml;
using CameraVisionLib.Model; using CameraVisionLib.Model;
...@@ -397,6 +398,8 @@ namespace BLL ...@@ -397,6 +398,8 @@ namespace BLL
bool isMatch = false; bool isMatch = false;
List<MaterialCodeOCR> ocrlist = new List<MaterialCodeOCR>(); List<MaterialCodeOCR> ocrlist = new List<MaterialCodeOCR>();
List<BarcodeInfo> ocrcode = new List<BarcodeInfo>(); List<BarcodeInfo> ocrcode = new List<BarcodeInfo>();
//命中规则的条码索引
List<int> MatchCodeIndex = new List<int>();
int[] id = mateTemp[index].GetCodeID(); int[] id = mateTemp[index].GetCodeID();
for (int i = 0; i < id.Length; i++) for (int i = 0; i < id.Length; i++)
{ {
...@@ -415,6 +418,7 @@ namespace BLL ...@@ -415,6 +418,7 @@ namespace BLL
{ {
if (!keyword.ContainsKey(key)) if (!keyword.ContainsKey(key))
{ {
MatchCodeIndex.Add(j);
keyword.Add(key, matchKey[key]); keyword.Add(key, matchKey[key]);
LogNet.log.Info($"{mateTemp[index].Name} 匹配 [{key}={matchKey[key]}]"); LogNet.log.Info($"{mateTemp[index].Name} 匹配 [{key}={matchKey[key]}]");
} }
...@@ -484,6 +488,20 @@ namespace BLL ...@@ -484,6 +488,20 @@ namespace BLL
if (isMatch) if (isMatch)
{ {
MatchAnalysis.TemplateResult(true); MatchAnalysis.TemplateResult(true);
#region Code按照 匹配到的列表重新排序
MatchCodeIndex = MatchCodeIndex.Distinct().ToList();
var code2 = new List<BarcodeInfo>();
foreach(var i in MatchCodeIndex) {
if (code.Count>i)
code2.Add(code[i]);
}
foreach (var c in code)
{
if (!code2.Contains(c))
code2.Add(c);
}
code = code2.ToList();
#endregion
return true; return true;
} }
else else
......
...@@ -9,9 +9,10 @@ ...@@ -9,9 +9,10 @@
<AppDesignerFolder>Properties</AppDesignerFolder> <AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ExtensionGroup</RootNamespace> <RootNamespace>ExtensionGroup</RootNamespace>
<AssemblyName>ExtensionGroup</AssemblyName> <AssemblyName>ExtensionGroup</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion> <TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic> <Deterministic>true</Deterministic>
<TargetFrameworkProfile />
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
......
...@@ -20,6 +20,10 @@ namespace SmartScan ...@@ -20,6 +20,10 @@ 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.Height = 738;
this.Top = 15;
this.Left = 0;
} }
private void FrmSetPlus_FormClosing(object sender, FormClosingEventArgs e) private void FrmSetPlus_FormClosing(object sender, FormClosingEventArgs e)
......
...@@ -50,7 +50,8 @@ namespace SmartScan ...@@ -50,7 +50,8 @@ namespace SmartScan
process.StartInfo = new ProcessStartInfo(); process.StartInfo = new ProcessStartInfo();
process.StartInfo.FileName = paddle; process.StartInfo.FileName = paddle;
process.StartInfo.WorkingDirectory = ".\\paddle"; process.StartInfo.WorkingDirectory = ".\\paddle";
process.Start(); if (File.Exists(".\\paddle\\paddleOCR.exe"))
process.Start();
} }
//else //else
......
...@@ -77,7 +77,7 @@ namespace SmartScan ...@@ -77,7 +77,7 @@ namespace SmartScan
} }
if (webResultCode != null) if (webResultCode != null || !rtn)
return webResultCode; return webResultCode;
LogNet.log.Info("Work scan is done"); LogNet.log.Info("Work scan is done");
List<KeyValuePair<string, string>> result = new List<KeyValuePair<string, string>>(); List<KeyValuePair<string, string>> result = new List<KeyValuePair<string, string>>();
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!