Commit 00dba650 张东亮

新ui

1 个父辈 9fc90979
...@@ -36,6 +36,7 @@ namespace SmartScan ...@@ -36,6 +36,7 @@ namespace SmartScan
this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel(); this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
this.facePanel1 = new Asa.FaceControl.FacePanel(); this.facePanel1 = new Asa.FaceControl.FacePanel();
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.NudMiddleTextCount = new Asa.FaceControl.FaceNumericUpDown();
this.ChkCheckCodeType = new Asa.FaceControl.FaceCheckBox(); this.ChkCheckCodeType = new Asa.FaceControl.FaceCheckBox();
this.LblCodeType = new Asa.FaceControl.FaceLabel(); this.LblCodeType = new Asa.FaceControl.FaceLabel();
this.ChkMatchingStart = new Asa.FaceControl.FaceCheckBox(); this.ChkMatchingStart = new Asa.FaceControl.FaceCheckBox();
...@@ -46,7 +47,7 @@ namespace SmartScan ...@@ -46,7 +47,7 @@ namespace SmartScan
this.TxtMatchingMiddleText = new Asa.FaceControl.FaceTextBox(); this.TxtMatchingMiddleText = new Asa.FaceControl.FaceTextBox();
this.ChkCaseSensitivity = new Asa.FaceControl.FaceCheckBox(); this.ChkCaseSensitivity = new Asa.FaceControl.FaceCheckBox();
this.ChoMatchMiddleType = new Asa.FaceControl.FaceComboBox(); this.ChoMatchMiddleType = new Asa.FaceControl.FaceComboBox();
this.NudMiddleTextCount = new Asa.FaceControl.FaceNumericUpDown(); this.lblMatchRes = new Asa.FaceControl.FaceLabel();
this.facePanel1.SuspendLayout(); this.facePanel1.SuspendLayout();
this.tableLayoutPanel1.SuspendLayout(); this.tableLayoutPanel1.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
...@@ -156,6 +157,7 @@ namespace SmartScan ...@@ -156,6 +157,7 @@ namespace SmartScan
this.tableLayoutPanel1.Controls.Add(this.TxtMatchingMiddleText, 1, 2); this.tableLayoutPanel1.Controls.Add(this.TxtMatchingMiddleText, 1, 2);
this.tableLayoutPanel1.Controls.Add(this.ChkCaseSensitivity, 2, 2); this.tableLayoutPanel1.Controls.Add(this.ChkCaseSensitivity, 2, 2);
this.tableLayoutPanel1.Controls.Add(this.ChoMatchMiddleType, 0, 3); this.tableLayoutPanel1.Controls.Add(this.ChoMatchMiddleType, 0, 3);
this.tableLayoutPanel1.Controls.Add(this.lblMatchRes, 3, 3);
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel1.Location = new System.Drawing.Point(3, 3); this.tableLayoutPanel1.Location = new System.Drawing.Point(3, 3);
this.tableLayoutPanel1.Name = "tableLayoutPanel1"; this.tableLayoutPanel1.Name = "tableLayoutPanel1";
...@@ -167,6 +169,28 @@ namespace SmartScan ...@@ -167,6 +169,28 @@ namespace SmartScan
this.tableLayoutPanel1.Size = new System.Drawing.Size(830, 222); this.tableLayoutPanel1.Size = new System.Drawing.Size(830, 222);
this.tableLayoutPanel1.TabIndex = 0; this.tableLayoutPanel1.TabIndex = 0;
// //
// NudMiddleTextCount
//
this.NudMiddleTextCount.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(20)))), ((int)(((byte)(20)))), ((int)(((byte)(20)))));
this.NudMiddleTextCount.BorderStyle = Asa.FaceControl.ControlShape.Rectangle;
this.NudMiddleTextCount.BorderWidth = 2;
this.NudMiddleTextCount.DecimalPlaces = 0;
this.NudMiddleTextCount.Dock = System.Windows.Forms.DockStyle.Fill;
this.NudMiddleTextCount.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(230)))), ((int)(((byte)(230)))));
this.NudMiddleTextCount.Increment = 1F;
this.NudMiddleTextCount.Location = new System.Drawing.Point(211, 172);
this.NudMiddleTextCount.Margin = new System.Windows.Forms.Padding(4);
this.NudMiddleTextCount.Maximum = 100F;
this.NudMiddleTextCount.Minimum = 1F;
this.NudMiddleTextCount.Name = "NudMiddleTextCount";
this.NudMiddleTextCount.Padding = new System.Windows.Forms.Padding(4);
this.NudMiddleTextCount.Size = new System.Drawing.Size(199, 48);
this.NudMiddleTextCount.TabIndex = 62;
this.NudMiddleTextCount.Text = "1";
this.NudMiddleTextCount.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
this.NudMiddleTextCount.Value = 1F;
this.NudMiddleTextCount.ValueChanged += new System.EventHandler(this.matchChanged);
//
// ChkCheckCodeType // ChkCheckCodeType
// //
this.ChkCheckCodeType.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(20)))), ((int)(((byte)(20)))), ((int)(((byte)(20))))); this.ChkCheckCodeType.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(20)))), ((int)(((byte)(20)))), ((int)(((byte)(20)))));
...@@ -182,6 +206,7 @@ namespace SmartScan ...@@ -182,6 +206,7 @@ namespace SmartScan
this.ChkCheckCodeType.TabIndex = 52; this.ChkCheckCodeType.TabIndex = 52;
this.ChkCheckCodeType.Text = "CheckCodeType"; this.ChkCheckCodeType.Text = "CheckCodeType";
this.ChkCheckCodeType.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; this.ChkCheckCodeType.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.ChkCheckCodeType.CheckedChanged += new System.EventHandler(this.matchChanged);
// //
// LblCodeType // LblCodeType
// //
...@@ -215,6 +240,7 @@ namespace SmartScan ...@@ -215,6 +240,7 @@ namespace SmartScan
this.ChkMatchingStart.TabIndex = 54; this.ChkMatchingStart.TabIndex = 54;
this.ChkMatchingStart.Text = "Start"; this.ChkMatchingStart.Text = "Start";
this.ChkMatchingStart.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; this.ChkMatchingStart.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.ChkMatchingStart.CheckedChanged += new System.EventHandler(this.matchChanged);
// //
// TxtMatchingStartText // TxtMatchingStartText
// //
...@@ -235,6 +261,7 @@ namespace SmartScan ...@@ -235,6 +261,7 @@ namespace SmartScan
this.TxtMatchingStartText.Size = new System.Drawing.Size(199, 48); this.TxtMatchingStartText.Size = new System.Drawing.Size(199, 48);
this.TxtMatchingStartText.TabIndex = 55; this.TxtMatchingStartText.TabIndex = 55;
this.TxtMatchingStartText.Text = "faceTextBox1"; this.TxtMatchingStartText.Text = "faceTextBox1";
this.TxtMatchingStartText.TextChanged += new System.EventHandler(this.matchChanged);
// //
// ChkMatchingEnd // ChkMatchingEnd
// //
...@@ -251,6 +278,7 @@ namespace SmartScan ...@@ -251,6 +278,7 @@ namespace SmartScan
this.ChkMatchingEnd.TabIndex = 56; this.ChkMatchingEnd.TabIndex = 56;
this.ChkMatchingEnd.Text = "End"; this.ChkMatchingEnd.Text = "End";
this.ChkMatchingEnd.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; this.ChkMatchingEnd.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.ChkMatchingEnd.CheckedChanged += new System.EventHandler(this.matchChanged);
// //
// TxtMatchingEndText // TxtMatchingEndText
// //
...@@ -271,6 +299,7 @@ namespace SmartScan ...@@ -271,6 +299,7 @@ namespace SmartScan
this.TxtMatchingEndText.Size = new System.Drawing.Size(201, 48); this.TxtMatchingEndText.Size = new System.Drawing.Size(201, 48);
this.TxtMatchingEndText.TabIndex = 57; this.TxtMatchingEndText.TabIndex = 57;
this.TxtMatchingEndText.Text = "faceTextBox2"; this.TxtMatchingEndText.Text = "faceTextBox2";
this.TxtMatchingEndText.TextChanged += new System.EventHandler(this.matchChanged);
// //
// ChkMatchingMiddle // ChkMatchingMiddle
// //
...@@ -287,6 +316,7 @@ namespace SmartScan ...@@ -287,6 +316,7 @@ namespace SmartScan
this.ChkMatchingMiddle.TabIndex = 58; this.ChkMatchingMiddle.TabIndex = 58;
this.ChkMatchingMiddle.Text = "Middle"; this.ChkMatchingMiddle.Text = "Middle";
this.ChkMatchingMiddle.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; this.ChkMatchingMiddle.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.ChkMatchingMiddle.CheckedChanged += new System.EventHandler(this.matchChanged);
// //
// TxtMatchingMiddleText // TxtMatchingMiddleText
// //
...@@ -307,6 +337,7 @@ namespace SmartScan ...@@ -307,6 +337,7 @@ namespace SmartScan
this.TxtMatchingMiddleText.Size = new System.Drawing.Size(199, 48); this.TxtMatchingMiddleText.Size = new System.Drawing.Size(199, 48);
this.TxtMatchingMiddleText.TabIndex = 59; this.TxtMatchingMiddleText.TabIndex = 59;
this.TxtMatchingMiddleText.Text = "faceTextBox3"; this.TxtMatchingMiddleText.Text = "faceTextBox3";
this.TxtMatchingMiddleText.TextChanged += new System.EventHandler(this.matchChanged);
// //
// ChkCaseSensitivity // ChkCaseSensitivity
// //
...@@ -323,6 +354,7 @@ namespace SmartScan ...@@ -323,6 +354,7 @@ namespace SmartScan
this.ChkCaseSensitivity.TabIndex = 60; this.ChkCaseSensitivity.TabIndex = 60;
this.ChkCaseSensitivity.Text = "Sensitivity"; this.ChkCaseSensitivity.Text = "Sensitivity";
this.ChkCaseSensitivity.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; this.ChkCaseSensitivity.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.ChkCaseSensitivity.CheckedChanged += new System.EventHandler(this.matchChanged);
// //
// ChoMatchMiddleType // ChoMatchMiddleType
// //
...@@ -341,27 +373,21 @@ namespace SmartScan ...@@ -341,27 +373,21 @@ namespace SmartScan
this.ChoMatchMiddleType.TabIndex = 61; this.ChoMatchMiddleType.TabIndex = 61;
this.ChoMatchMiddleType.Text = "faceComboBox1"; this.ChoMatchMiddleType.Text = "faceComboBox1";
this.ChoMatchMiddleType.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; this.ChoMatchMiddleType.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
// this.ChoMatchMiddleType.SelectedIndexChanged += new System.EventHandler(this.matchChanged);
// NudMiddleTextCount //
// // lblMatchRes
this.NudMiddleTextCount.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(20)))), ((int)(((byte)(20)))), ((int)(((byte)(20))))); //
this.NudMiddleTextCount.BorderStyle = Asa.FaceControl.ControlShape.Rectangle; this.lblMatchRes.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(20)))), ((int)(((byte)(20)))), ((int)(((byte)(20)))));
this.NudMiddleTextCount.BorderWidth = 2; this.lblMatchRes.BorderStyle = Asa.FaceControl.ControlShape.Rectangle;
this.NudMiddleTextCount.DecimalPlaces = 0; this.lblMatchRes.BorderWidth = 0;
this.NudMiddleTextCount.Dock = System.Windows.Forms.DockStyle.Fill; this.lblMatchRes.Dock = System.Windows.Forms.DockStyle.Fill;
this.NudMiddleTextCount.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(230)))), ((int)(((byte)(230))))); this.lblMatchRes.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(230)))), ((int)(((byte)(230)))));
this.NudMiddleTextCount.Increment = 1F; this.lblMatchRes.Location = new System.Drawing.Point(625, 172);
this.NudMiddleTextCount.Location = new System.Drawing.Point(211, 172); this.lblMatchRes.Margin = new System.Windows.Forms.Padding(4);
this.NudMiddleTextCount.Margin = new System.Windows.Forms.Padding(4); this.lblMatchRes.Name = "lblMatchRes";
this.NudMiddleTextCount.Maximum = 100F; this.lblMatchRes.Padding = new System.Windows.Forms.Padding(4);
this.NudMiddleTextCount.Minimum = 1F; this.lblMatchRes.Size = new System.Drawing.Size(201, 48);
this.NudMiddleTextCount.Name = "NudMiddleTextCount"; this.lblMatchRes.TabIndex = 63;
this.NudMiddleTextCount.Padding = new System.Windows.Forms.Padding(4);
this.NudMiddleTextCount.Size = new System.Drawing.Size(199, 48);
this.NudMiddleTextCount.TabIndex = 62;
this.NudMiddleTextCount.Text = "1";
this.NudMiddleTextCount.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
this.NudMiddleTextCount.Value = 1F;
// //
// FrmCodeExtract // FrmCodeExtract
// //
...@@ -411,5 +437,6 @@ namespace SmartScan ...@@ -411,5 +437,6 @@ namespace SmartScan
private Asa.FaceControl.FaceCheckBox ChkCaseSensitivity; private Asa.FaceControl.FaceCheckBox ChkCaseSensitivity;
private Asa.FaceControl.FaceComboBox ChoMatchMiddleType; private Asa.FaceControl.FaceComboBox ChoMatchMiddleType;
private Asa.FaceControl.FaceNumericUpDown NudMiddleTextCount; private Asa.FaceControl.FaceNumericUpDown NudMiddleTextCount;
private Asa.FaceControl.FaceLabel lblMatchRes;
} }
} }
\ No newline at end of file \ No newline at end of file
...@@ -9,6 +9,7 @@ using System.Threading.Tasks; ...@@ -9,6 +9,7 @@ using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using Asa.FaceControl; using Asa.FaceControl;
using BLL; using BLL;
using CameraVisionLib.Model;
using Model; using Model;
namespace SmartScan namespace SmartScan
...@@ -22,7 +23,7 @@ namespace SmartScan ...@@ -22,7 +23,7 @@ namespace SmartScan
int windowHeight = 0; int windowHeight = 0;
MaterialCodeMatch matchShared = new MaterialCodeMatch(); MaterialCodeMatch matchShared = new MaterialCodeMatch();
public FrmCodeExtract(string codeText, int codeID,string codeType, List<MaterialCodeMatch> match) public FrmCodeExtract(string codeText, int codeID, string codeType, List<MaterialCodeMatch> match)
{ {
InitializeComponent(); InitializeComponent();
windowHeight = this.Height; windowHeight = this.Height;
...@@ -37,7 +38,7 @@ namespace SmartScan ...@@ -37,7 +38,7 @@ namespace SmartScan
ChoMatchMiddleType.Items.Add(Language.Dialog("MatchType_max")); ChoMatchMiddleType.Items.Add(Language.Dialog("MatchType_max"));
ChoMatchMiddleType.Items.Add(Language.Dialog("MatchType_equals")); ChoMatchMiddleType.Items.Add(Language.Dialog("MatchType_equals"));
ChoMatchMiddleType.Items.Add(Language.Dialog("MatchType_min")); ChoMatchMiddleType.Items.Add(Language.Dialog("MatchType_min"));
if(match.Count > 0) if (match.Count > 0)
{ {
matchShared = match[0]; matchShared = match[0];
} }
...@@ -71,9 +72,9 @@ namespace SmartScan ...@@ -71,9 +72,9 @@ namespace SmartScan
btn.Click += Btn_Click; btn.Click += Btn_Click;
btn.Tag = "not"; btn.Tag = "not";
flowLayoutPanel1.Controls.Add(btn); flowLayoutPanel1.Controls.Add(btn);
UsrCodeExtractList list = new(codeText,codeType, codeText.Length, match);
UsrCodeExtractList list = new(codeText, codeType, codeText.Length, match);
list.DelClick += List_DelClick; list.DelClick += List_DelClick;
list.AddClick += List_AddClick; list.AddClick += List_AddClick;
list.KeyChanged += List_KeyChanged; list.KeyChanged += List_KeyChanged;
...@@ -96,10 +97,11 @@ namespace SmartScan ...@@ -96,10 +97,11 @@ namespace SmartScan
BtnAddMatch_Click(sender, e); BtnAddMatch_Click(sender, e);
} }
void clacWindowHeight() { void clacWindowHeight()
{
if (flowLayoutPanel1.Controls.Count > 14) if (flowLayoutPanel1.Controls.Count > 14)
{ {
matchButton.Values.ToList().ForEach((x)=> {x.GetPanel().Top = 418 + 56 * 2; });//184 matchButton.Values.ToList().ForEach((x) => { x.GetPanel().Top = 418 + 56 * 2; });//184
flowLayoutPanel1.Height = 56 * 3; flowLayoutPanel1.Height = 56 * 3;
this.Height = windowHeight + 56 * 2 - 4; this.Height = windowHeight + 56 * 2 - 4;
...@@ -175,7 +177,8 @@ namespace SmartScan ...@@ -175,7 +177,8 @@ namespace SmartScan
foreach (FaceButton btn in matchButton.Keys) foreach (FaceButton btn in matchButton.Keys)
{ {
string key = matchButton[btn].GetMatchKey(); string key = matchButton[btn].GetMatchKey();
if (string.IsNullOrWhiteSpace(key)) { if (string.IsNullOrWhiteSpace(key))
{
string text = Language.Dialog("KeyEmpty"); string text = Language.Dialog("KeyEmpty");
new FaceMessageBox("", text, MessageBoxButtons.OK).ShowDialog(); new FaceMessageBox("", text, MessageBoxButtons.OK).ShowDialog();
...@@ -246,7 +249,68 @@ namespace SmartScan ...@@ -246,7 +249,68 @@ namespace SmartScan
private void FrmCodeExtract_Load(object sender, EventArgs e) private void FrmCodeExtract_Load(object sender, EventArgs e)
{ {
LblCode.Text = codeText; LblCode.Text = codeText;
}
private void matchChanged(object sender, EventArgs e)
{
lblMatchRes.Invoke(new Action(() => {
if(CheckMatch())
{
lblMatchRes.Text = "";
//lblMatchRes.ForeColor = Color.Green;
}
else
{
lblMatchRes.Text = "NG";
lblMatchRes.ForeColor = Color.Red;
}
}));
}
private bool CheckMatch()
{
string code = ChkCaseSensitivity.Checked ? codeText : codeText.ToUpper();
bool ismatch = true;
string text = "";
//开头
if (ChkMatchingStart.Checked)
{
text = ChkCaseSensitivity.Checked ? TxtMatchingStartText.Text : TxtMatchingStartText.Text.ToUpper();
if (!code.StartsWith(text))
ismatch = false;
}
//结尾
if (ChkMatchingEnd.Checked)
{
text = ChkCaseSensitivity.Checked ? TxtMatchingEndText.Text : TxtMatchingEndText.Text.ToUpper();
if (!code.EndsWith(text))
ismatch = false;
}
//中间
if (ChkMatchingMiddle.Checked)
{
int index, count;
text = ChkCaseSensitivity.Checked ? TxtMatchingMiddleText.Text : TxtMatchingMiddleText.Text.ToUpper();
if (text == "") return false;
index = count = 0;
while ((index = code.IndexOf(text, index)) != -1)
{
count++;
index += text.Length;
}
if (count == 0)
ismatch = false;
if (ChoMatchMiddleType.SelectedIndex == -1 && count > Convert.ToInt32(NudMiddleTextCount.Value))
ismatch = false;
if (ChoMatchMiddleType.SelectedIndex == 0 && count != Convert.ToInt32(NudMiddleTextCount.Value))
ismatch = false;
if (ChoMatchMiddleType.SelectedIndex == 1 && count < Convert.ToInt32(NudMiddleTextCount.Value))
ismatch = false;
}
return ismatch;
} }
} }
} }
...@@ -118,48 +118,55 @@ namespace SmartScan ...@@ -118,48 +118,55 @@ namespace SmartScan
// if (string.IsNullOrEmpty(text)) // if (string.IsNullOrEmpty(text))
// return; // return;
//} //}
try
if (ChkMatchingSplit.Checked)
{
string str = Model.MaterialAsciiCode.GetAsciiCode(CboMatchingSplit.Text);
string[] arr = codeText.Split(new string[] { str }, StringSplitOptions.RemoveEmptyEntries);
int index = Convert.ToInt32(NudSplitPart.Value) - 1;
if (index < arr.Length)
text = arr[index];
else
text = "";
}
if (ChkMinLength.Checked)
{ {
if (text.Length < NudMinLength.Value) if (ChkMatchingSplit.Checked)
text = ""; {
} string str = Model.MaterialAsciiCode.GetAsciiCode(CboMatchingSplit.Text);
string[] arr = codeText.Split(new string[] { str }, StringSplitOptions.RemoveEmptyEntries);
int index = Convert.ToInt32(NudSplitPart.Value) - 1;
if (index < arr.Length)
text = arr[index];
else
text = "";
}
if (ChkMaxLength.Checked) if (ChkMinLength.Checked)
{ {
if (text.Length > NudMaxLength.Value) if (text.Length < NudMinLength.Value)
text = ""; text = "";
} }
if (text.Length > 0) if (ChkMaxLength.Checked)
{
int startIndex = Convert.ToInt32(NudStart.Value);
int length = Convert.ToInt32(NudLength.Value);
if (ChkLengthEnd.Checked)
{ {
text = text.Substring(startIndex); if (text.Length > NudMaxLength.Value)
text = "";
} }
else
if (text.Length > 0)
{ {
if (startIndex + length <= text.Length) int startIndex = Convert.ToInt32(NudStart.Value);
text = text.Substring(startIndex, length); int length = Convert.ToInt32(NudLength.Value);
if (ChkLengthEnd.Checked)
{
text = text.Substring(startIndex);
}
else else
text = ""; {
if (startIndex + length <= text.Length)
text = text.Substring(startIndex, length);
else
text = "";
}
} }
}
faceTextBox1.Text = text; faceTextBox1.Text = text;
}catch(Exception ex)
{
faceTextBox1.Text = "";
LogNet.log.Error("ShowPreview", ex);
}
} }
private void ChkLengthEnd_CheckedChanged(object sender, EventArgs e) private void ChkLengthEnd_CheckedChanged(object sender, EventArgs e)
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!