Commit 4e445bf9 刘韬

1

1 个父辈 4dadab67
......@@ -86,6 +86,7 @@
<Compile Include="IO\IO_Interface.cs" />
<Compile Include="IO\KND.cs" />
<Compile Include="IO\NirenIO.cs" />
<Compile Include="MatchAnalysis.cs" />
<Compile Include="MonitorMouseKeyboard.cs" />
<Compile Include="PrinterHelper.cs" />
<Compile Include="PrintLabelEdit.cs" />
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BLL
{
class MatchAnalysis
{
static MatchCollection matchCollection;
public static void StartNewAnalysis(string templatename)
{
matchCollection = new MatchCollection();
matchCollection.templateName = templatename;
matchCollection.Matchs = new List<Match>();
}
public static void AddMatch(string matchKey, bool isMatch, int codeID, string matchDesc) {
Match match = new Match(matchKey, isMatch, codeID, matchDesc);
matchCollection.Matchs.Add(match);
}
static List<MatchTemplate> MatchTemplateList;
public class MatchTemplate {
}
public class MatchCollection
{
public string templateName;
public List<Match> Matchs;
public bool isMatch;
public string result;
}
public class Match {
public string matchKey;
public bool isMatch;
public int codeID;
public string matchDesc;
public Match(string matchKey, bool isMatch, int codeID, string matchDesc) {
this.matchKey = matchKey;
this.isMatch = isMatch;
this.codeID = codeID;
this.matchDesc = matchDesc;
}
}
}
}
......@@ -139,6 +139,7 @@ namespace BLL
LogNet.log.Info($"扫描到 {c.CodeType},{c.Text}");
});
//MatchAnalysis.StartNewAnalysis()
//优先匹配
int firstIndex = mateTemp.FindIndex(math => math.Name == firstMaterial);
if (firstIndex > -1)
......@@ -407,7 +408,7 @@ namespace BLL
Bitmap bmp = CodeOcr(codeTemp, mateTemp[index].Ocr[i], mateTemp[index].Image);
string codeOcr = oCR.GetString(bmp);
var x = new BarcodeInfo() {Text=codeOcr };
var x = new BarcodeInfo() {Text=codeOcr,CodeType="OCR"};
Dictionary<string, string> matchKey = CodeMatch(x, codeMatch);
if (matchKey != null)
{
......@@ -519,6 +520,20 @@ namespace BLL
return null;
}
//分割
code = codeText;
if (codeMatch[i].MatchSplit)
{
matchCount++;
string str = MaterialAsciiCode.GetAsciiCode(codeMatch[i].SplitText);
string[] arr = codeText.Split(new string[] { str }, StringSplitOptions.RemoveEmptyEntries);
index = codeMatch[i].SplitPart - 1;
if (index >= arr.Length)
return null;
else
code = arr[index];
}
//最小
if (codeMatch[i].MatchMinLength)
{
......@@ -535,19 +550,6 @@ namespace BLL
return null;
}
//分割
code = codeText;
if (codeMatch[i].MatchSplit)
{
matchCount++;
string str = MaterialAsciiCode.GetAsciiCode(codeMatch[i].SplitText);
string[] arr = codeText.Split(new string[] { str }, StringSplitOptions.RemoveEmptyEntries);
index = codeMatch[i].SplitPart - 1;
if (index >= arr.Length)
return null;
else
code = arr[index];
}
//截取
if (matchCount == 0 && !codeMatch[i].MatchISNumber) continue;
......
f08182a8667a0d04a12b18635a66f3406a72ff45
b3779df0e1d99f6a50b50ac0c10a2045586c3cb8
......@@ -31,6 +31,8 @@ namespace SmartScan
{
this.facePanel1 = new Asa.FaceControl.FacePanel();
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.ChoMatchMiddleType = new Asa.FaceControl.FaceComboBox();
this.ChkMatchisnumber = new Asa.FaceControl.FaceCheckBox();
this.LblCodeType = new Asa.FaceControl.FaceLabel();
this.ChkCheckCodeType = new Asa.FaceControl.FaceCheckBox();
this.NudMiddleTextCount = new Asa.FaceControl.FaceNumericUpDown();
......@@ -58,8 +60,6 @@ namespace SmartScan
this.NudMaxLength = new Asa.FaceControl.FaceNumericUpDown();
this.BtnDel = new Asa.FaceControl.FaceButton();
this.faceTextBox1 = new Asa.FaceControl.FaceTextBox();
this.ChkMatchisnumber = new Asa.FaceControl.FaceCheckBox();
this.ChoMatchMiddleType = new Asa.FaceControl.FaceComboBox();
this.facePanel1.SuspendLayout();
this.tableLayoutPanel1.SuspendLayout();
this.SuspendLayout();
......@@ -133,6 +133,39 @@ namespace SmartScan
this.tableLayoutPanel1.Size = new System.Drawing.Size(508, 461);
this.tableLayoutPanel1.TabIndex = 43;
//
// ChoMatchMiddleType
//
this.ChoMatchMiddleType.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(20)))), ((int)(((byte)(20)))), ((int)(((byte)(20)))));
this.ChoMatchMiddleType.BorderStyle = Asa.FaceControl.ControlShape.Rectangle;
this.ChoMatchMiddleType.BorderWidth = 2;
this.ChoMatchMiddleType.Dock = System.Windows.Forms.DockStyle.Fill;
this.ChoMatchMiddleType.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(230)))), ((int)(((byte)(230)))));
this.ChoMatchMiddleType.Location = new System.Drawing.Point(3, 183);
this.ChoMatchMiddleType.Name = "ChoMatchMiddleType";
this.ChoMatchMiddleType.Padding = new System.Windows.Forms.Padding(3);
this.ChoMatchMiddleType.SelectedIndex = -1;
this.ChoMatchMiddleType.SelectedText = "";
this.ChoMatchMiddleType.Size = new System.Drawing.Size(136, 39);
this.ChoMatchMiddleType.TabIndex = 54;
this.ChoMatchMiddleType.Text = "faceComboBox1";
this.ChoMatchMiddleType.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
this.ChoMatchMiddleType.SelectedIndexChanged += new System.EventHandler(this.CboKeyword_SelectedIndexChanged);
//
// ChkMatchisnumber
//
this.ChkMatchisnumber.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(20)))), ((int)(((byte)(20)))), ((int)(((byte)(20)))));
this.ChkMatchisnumber.BorderStyle = Asa.FaceControl.ControlShape.Rectangle;
this.ChkMatchisnumber.BorderWidth = 0;
this.ChkMatchisnumber.Dock = System.Windows.Forms.DockStyle.Fill;
this.ChkMatchisnumber.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(230)))), ((int)(((byte)(230)))));
this.ChkMatchisnumber.Location = new System.Drawing.Point(3, 318);
this.ChkMatchisnumber.Name = "ChkMatchisnumber";
this.ChkMatchisnumber.Padding = new System.Windows.Forms.Padding(3);
this.ChkMatchisnumber.Size = new System.Drawing.Size(136, 39);
this.ChkMatchisnumber.TabIndex = 53;
this.ChkMatchisnumber.Text = "AsNumber";
this.ChkMatchisnumber.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// LblCodeType
//
this.LblCodeType.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(20)))), ((int)(((byte)(20)))), ((int)(((byte)(20)))));
......@@ -182,6 +215,7 @@ namespace SmartScan
this.NudMiddleTextCount.Text = "1";
this.NudMiddleTextCount.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
this.NudMiddleTextCount.Value = 1F;
this.NudMiddleTextCount.ValueChanged += new System.EventHandler(this.NudMinLength_ValueChanged);
//
// NudSplitPart
//
......@@ -337,6 +371,7 @@ namespace SmartScan
this.ChkMatchingMiddle.TabIndex = 27;
this.ChkMatchingMiddle.Text = "Middle";
this.ChkMatchingMiddle.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.ChkMatchingMiddle.CheckedChanged += new System.EventHandler(this.ChkLengthEnd_CheckedChanged);
//
// NudStart
//
......@@ -448,6 +483,7 @@ namespace SmartScan
this.TxtMatchingMiddleText.Size = new System.Drawing.Size(105, 39);
this.TxtMatchingMiddleText.TabIndex = 33;
this.TxtMatchingMiddleText.Text = "faceTextBox3";
this.TxtMatchingMiddleText.TextChanged += new System.EventHandler(this.NudLength_ValueChanged);
//
// LblStart
//
......@@ -607,38 +643,6 @@ namespace SmartScan
this.faceTextBox1.Text = "faceTextBox1";
this.faceTextBox1.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// ChkMatchisnumber
//
this.ChkMatchisnumber.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(20)))), ((int)(((byte)(20)))), ((int)(((byte)(20)))));
this.ChkMatchisnumber.BorderStyle = Asa.FaceControl.ControlShape.Rectangle;
this.ChkMatchisnumber.BorderWidth = 0;
this.ChkMatchisnumber.Dock = System.Windows.Forms.DockStyle.Fill;
this.ChkMatchisnumber.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(230)))), ((int)(((byte)(230)))));
this.ChkMatchisnumber.Location = new System.Drawing.Point(3, 318);
this.ChkMatchisnumber.Name = "ChkMatchisnumber";
this.ChkMatchisnumber.Padding = new System.Windows.Forms.Padding(3);
this.ChkMatchisnumber.Size = new System.Drawing.Size(136, 39);
this.ChkMatchisnumber.TabIndex = 53;
this.ChkMatchisnumber.Text = "AsNumber";
this.ChkMatchisnumber.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// ChoMatchMiddleType
//
this.ChoMatchMiddleType.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(20)))), ((int)(((byte)(20)))), ((int)(((byte)(20)))));
this.ChoMatchMiddleType.BorderStyle = Asa.FaceControl.ControlShape.Rectangle;
this.ChoMatchMiddleType.BorderWidth = 2;
this.ChoMatchMiddleType.Dock = System.Windows.Forms.DockStyle.Fill;
this.ChoMatchMiddleType.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(230)))), ((int)(((byte)(230)))));
this.ChoMatchMiddleType.Location = new System.Drawing.Point(3, 183);
this.ChoMatchMiddleType.Name = "ChoMatchMiddleType";
this.ChoMatchMiddleType.Padding = new System.Windows.Forms.Padding(3);
this.ChoMatchMiddleType.SelectedIndex = -1;
this.ChoMatchMiddleType.SelectedText = "";
this.ChoMatchMiddleType.Size = new System.Drawing.Size(136, 39);
this.ChoMatchMiddleType.TabIndex = 54;
this.ChoMatchMiddleType.Text = "faceComboBox1";
this.ChoMatchMiddleType.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// UsrCodeExtractList
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
......
......@@ -112,6 +112,29 @@ namespace SmartScan
{
if (changed) return;
string text = codeText;
if (ChkMatchingMiddle.Checked) {
int textcount=1;
int.TryParse(NudMiddleTextCount.Text, out textcount);
var t = ChoMatchMiddleType.SelectedIndex - 1;
int index = 0;
int count = 0;
while ((index = text.IndexOf(TxtMatchingMiddleText.Text, index)) != -1)
{
count++;
index += TxtMatchingMiddleText.Text.Length;
}
if (t == -1 && count > textcount)
text = "";
if (t == 0 && count != textcount)
text = "";
if (t == 1 && count < textcount)
text = "";
faceTextBox1.Text = text;
return;
}
if (ChkMatchingSplit.Checked)
{
string str = Model.MaterialAsciiCode.GetAsciiCode(CboMatchingSplit.Text);
......
......@@ -262,6 +262,9 @@ namespace SmartScan
mateCopy[mateIndex].Match.RemoveAll(s => s.CodeID == code.ID);
mateCopy[mateIndex].Match.AddRange(frm.CodeMatch);
mateCopy[mateIndex].State = TemplateState.Unsaved;
mateCopy[mateIndex].Match.RemoveAll(x => { return mateCopy[mateIndex].Code.FindIndex(c => c.ID == x.CodeID) == -1 && mateCopy[mateIndex].Ocr.FindIndex(c => c.ID == x.CodeID) == -1; });
LstCode.Items[codeIndex] = FormatCode(codeIndex);
}
}
......
Reelid
PN
DATE
QTY
PRODATE
BATCH
Description
SP
Memo
LOT
h1
*h2
h2
......@@ -28,7 +28,7 @@
<HttpServer>
</HttpServer>
<HttpReelID>http://127.0.0.1:8888/test</HttpReelID>
<DefaultMaterialName>test</DefaultMaterialName>
<DefaultMaterialName>m1</DefaultMaterialName>
<TriggerOpenLight>True</TriggerOpenLight>
<WebService>
</WebService>
......
此文件的差异太大,无法显示。
此文件的差异太大,无法显示。
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!