Commit eb5f893d 张东亮

打开图片前先选择模板

1 个父辈 7eb17a14
......@@ -232,6 +232,7 @@ namespace SmartScan
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|*.*" };
if (dlg.ShowDialog() != DialogResult.OK) return;
......@@ -473,7 +474,7 @@ namespace SmartScan
var curMatch = mateCopy[mateIndex];
List<BarcodeInfo> code = new List<BarcodeInfo>();
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));
if (codeMatch != null)
{
......@@ -482,8 +483,8 @@ namespace SmartScan
StringBuilder sb = new StringBuilder();
foreach (var key in keyword.Keys)
{
var dul = allkeys.FindAll(s=>s.Equals(key));
if (dul!=null&& dul.Count>1)
var dul = allkeys.FindAll(s => s.Equals(key));
if (dul != null && dul.Count > 1)
{
sb.AppendLine(key);
}
......@@ -511,7 +512,7 @@ namespace SmartScan
}
if (!ismatch)
{
if(codeMatch.Count==0)
if (codeMatch.Count == 0)
{
string text = Language.Dialog(LanguageDialogKey.TEMPLATE_UN_SET_MATCHING, "[name] 模板不匹配,未设置匹配规则");
text = text.Replace("[name]", curMatch.Name);
......@@ -537,17 +538,17 @@ namespace SmartScan
StringBuilder sb = new StringBuilder();
for (int i = 0; i < mateCopy.Count; i++)
{
if(mateIndex == i) continue;
if (mateIndex == i) continue;
var othMatch = mateCopy[i];
bool ismatch = TemplateExtract(othMatch, code, out Dictionary<string, string> keyword, out List<string> allkeys);
if(ismatch)
if (ismatch)
{
sb.AppendLine(othMatch.Name);
LogNet.log.Info($"【{othMatch.Name}】模板与当前模板【{curMatch.Name}】匹配冲突");
}
}
string templates= sb.ToString();
if(templates.Length > 0)
string templates = sb.ToString();
if (templates.Length > 0)
{
string text = Language.Dialog(LanguageDialogKey.TEMPLATE_MATCHING_CONFLICT, "[name] 与以下的模板匹配冲突");
text = text.Replace("[name]", curMatch.Name);
......@@ -560,7 +561,7 @@ namespace SmartScan
}
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);
allKeywords = new List<string>();
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!