Pārlūkot izejas kodu

v2.0 加入打标

master
CPL pirms 1 gada
vecāks
revīzija
1020667987
7 mainītis faili ar 268 papildinājumiem un 88 dzēšanām
  1. +5
    -0
      LeatherProject/GeBoShi/ImageDefect/DefectLib.cs
  2. +104
    -69
      LeatherProject/GeBoShi/Main.Designer.cs
  3. +20
    -10
      LeatherProject/GeBoShi/Main.cs
  4. +9
    -0
      LeatherProject/GeBoShi/Main.resx
  5. +2
    -0
      LeatherProject/GeBoShi/SysCtrl/SysEnum.cs
  6. +117
    -9
      LeatherProject/GeBoShi/SysCtrl/SysMgr.cs
  7. +11
    -0
      LeatherProject/Models/Records.cs

+ 5
- 0
LeatherProject/GeBoShi/ImageDefect/DefectLib.cs Parādīt failu

@@ -1191,5 +1191,10 @@ namespace GeBoShi.ImageDefect
/// 等比例填充的宽度
/// </summary>
public int xw;
/// <summary>
/// 当前图像计米器位置
/// </summary>
public double CurrDis;
}
}

+ 104
- 69
LeatherProject/GeBoShi/Main.Designer.cs Parādīt failu

@@ -30,17 +30,17 @@
{
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Main));
System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea1 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
System.Windows.Forms.DataVisualization.Charting.Legend legend1 = new System.Windows.Forms.DataVisualization.Charting.Legend();
System.Windows.Forms.DataVisualization.Charting.Series series1 = new System.Windows.Forms.DataVisualization.Charting.Series();
System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea2 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
System.Windows.Forms.DataVisualization.Charting.Legend legend2 = new System.Windows.Forms.DataVisualization.Charting.Legend();
System.Windows.Forms.DataVisualization.Charting.Series series2 = new System.Windows.Forms.DataVisualization.Charting.Series();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea3 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
System.Windows.Forms.DataVisualization.Charting.Legend legend3 = new System.Windows.Forms.DataVisualization.Charting.Legend();
System.Windows.Forms.DataVisualization.Charting.Series series3 = new System.Windows.Forms.DataVisualization.Charting.Series();
System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea4 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
System.Windows.Forms.DataVisualization.Charting.Legend legend4 = new System.Windows.Forms.DataVisualization.Charting.Legend();
System.Windows.Forms.DataVisualization.Charting.Series series4 = new System.Windows.Forms.DataVisualization.Charting.Series();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle9 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle10 = new System.Windows.Forms.DataGridViewCellStyle();
this.toolStrip1 = new System.Windows.Forms.ToolStrip();
this.toolStripSeparator10 = new System.Windows.Forms.ToolStripSeparator();
this.tsbtnImpStop = new System.Windows.Forms.ToolStripButton();
@@ -144,6 +144,8 @@
this.colTarget = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.keyPanel = new System.Windows.Forms.Panel();
this.ucKeyBorderAll1 = new HZH_Controls.Controls.UCKeyBorderAll();
this.label9 = new System.Windows.Forms.Label();
this.ucSwitch2 = new HZH_Controls.Controls.UCSwitch();
this.toolStrip1.SuspendLayout();
this.menuStrip1.SuspendLayout();
this.statusStrip1.SuspendLayout();
@@ -903,6 +905,8 @@
// groupBox2
//
this.groupBox2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(8)))), ((int)(((byte)(31)))), ((int)(((byte)(120)))));
this.groupBox2.Controls.Add(this.label9);
this.groupBox2.Controls.Add(this.ucSwitch2);
this.groupBox2.Controls.Add(this.dataGridView1);
this.groupBox2.Controls.Add(this.label7);
this.groupBox2.Controls.Add(this.label6);
@@ -970,11 +974,11 @@
//
this.label7.AutoSize = true;
this.label7.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label7.Location = new System.Drawing.Point(39, 27);
this.label7.Location = new System.Drawing.Point(15, 27);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(93, 20);
this.label7.Size = new System.Drawing.Size(65, 20);
this.label7.TabIndex = 8;
this.label7.Text = "瑕疵二次判断";
this.label7.Text = "二次判断";
//
// label6
//
@@ -994,7 +998,7 @@
this.ucSwitch1.FalseColor = System.Drawing.Color.FromArgb(((int)(((byte)(189)))), ((int)(((byte)(189)))), ((int)(((byte)(189)))));
this.ucSwitch1.FalseTextColr = System.Drawing.Color.Black;
this.ucSwitch1.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.ucSwitch1.Location = new System.Drawing.Point(177, 21);
this.ucSwitch1.Location = new System.Drawing.Point(91, 21);
this.ucSwitch1.Name = "ucSwitch1";
this.ucSwitch1.Size = new System.Drawing.Size(80, 28);
this.ucSwitch1.SwitchType = HZH_Controls.Controls.SwitchType.Ellipse;
@@ -1093,22 +1097,22 @@
//
// chart1
//
chartArea1.AxisX.Maximum = 160D;
chartArea1.AxisX.Minimum = 0D;
chartArea1.AxisY.LabelStyle.Format = "N0";
chartArea1.AxisY.MaximumAutoSize = 95F;
chartArea1.Name = "ChartArea1";
this.chart1.ChartAreas.Add(chartArea1);
chartArea3.AxisX.Maximum = 160D;
chartArea3.AxisX.Minimum = 0D;
chartArea3.AxisY.LabelStyle.Format = "N0";
chartArea3.AxisY.MaximumAutoSize = 95F;
chartArea3.Name = "ChartArea1";
this.chart1.ChartAreas.Add(chartArea3);
this.chart1.Dock = System.Windows.Forms.DockStyle.Fill;
legend1.Name = "Legend1";
this.chart1.Legends.Add(legend1);
legend3.Name = "Legend1";
this.chart1.Legends.Add(legend3);
this.chart1.Location = new System.Drawing.Point(0, 0);
this.chart1.Margin = new System.Windows.Forms.Padding(2);
this.chart1.Name = "chart1";
series1.ChartArea = "ChartArea1";
series1.Legend = "Legend1";
series1.Name = "Series1";
this.chart1.Series.Add(series1);
series3.ChartArea = "ChartArea1";
series3.Legend = "Legend1";
series3.Name = "Series1";
this.chart1.Series.Add(series3);
this.chart1.Size = new System.Drawing.Size(135, 218);
this.chart1.TabIndex = 3;
this.chart1.Text = "chart1";
@@ -1217,20 +1221,20 @@
this.chart3.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
chartArea2.AxisX.LabelStyle.Format = "N0";
chartArea2.AxisX.MaximumAutoSize = 95F;
chartArea2.AxisX.Minimum = 0D;
chartArea2.Name = "ChartArea1";
this.chart3.ChartAreas.Add(chartArea2);
legend2.Name = "Legend1";
this.chart3.Legends.Add(legend2);
chartArea4.AxisX.LabelStyle.Format = "N0";
chartArea4.AxisX.MaximumAutoSize = 95F;
chartArea4.AxisX.Minimum = 0D;
chartArea4.Name = "ChartArea1";
this.chart3.ChartAreas.Add(chartArea4);
legend4.Name = "Legend1";
this.chart3.Legends.Add(legend4);
this.chart3.Location = new System.Drawing.Point(4, 30);
this.chart3.Margin = new System.Windows.Forms.Padding(2);
this.chart3.Name = "chart3";
series2.ChartArea = "ChartArea1";
series2.Legend = "Legend1";
series2.Name = "Series1";
this.chart3.Series.Add(series2);
series4.ChartArea = "ChartArea1";
series4.Legend = "Legend1";
series4.Name = "Series1";
this.chart3.Series.Add(series4);
this.chart3.Size = new System.Drawing.Size(500, 56);
this.chart3.TabIndex = 2;
this.chart3.Text = "chart3";
@@ -1313,20 +1317,20 @@
//
// skinDataGridView1
//
dataGridViewCellStyle1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(231)))), ((int)(((byte)(246)))), ((int)(((byte)(253)))));
this.skinDataGridView1.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1;
dataGridViewCellStyle6.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(231)))), ((int)(((byte)(246)))), ((int)(((byte)(253)))));
this.skinDataGridView1.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle6;
this.skinDataGridView1.BackgroundColor = System.Drawing.SystemColors.Window;
this.skinDataGridView1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.skinDataGridView1.ColumnFont = null;
this.skinDataGridView1.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.Single;
dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(246)))), ((int)(((byte)(239)))));
dataGridViewCellStyle2.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle2.ForeColor = System.Drawing.SystemColors.Window;
dataGridViewCellStyle2.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.skinDataGridView1.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2;
dataGridViewCellStyle7.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle7.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(246)))), ((int)(((byte)(239)))));
dataGridViewCellStyle7.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle7.ForeColor = System.Drawing.SystemColors.Window;
dataGridViewCellStyle7.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle7.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle7.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.skinDataGridView1.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle7;
this.skinDataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.skinDataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.colUid,
@@ -1341,14 +1345,14 @@
this.colZXD,
this.colTarget});
this.skinDataGridView1.ColumnSelectForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle3.BackColor = System.Drawing.Color.White;
dataGridViewCellStyle3.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle3.ForeColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle3.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(59)))), ((int)(((byte)(188)))), ((int)(((byte)(240)))));
dataGridViewCellStyle3.SelectionForeColor = System.Drawing.Color.White;
dataGridViewCellStyle3.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.skinDataGridView1.DefaultCellStyle = dataGridViewCellStyle3;
dataGridViewCellStyle8.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle8.BackColor = System.Drawing.Color.White;
dataGridViewCellStyle8.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle8.ForeColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle8.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(59)))), ((int)(((byte)(188)))), ((int)(((byte)(240)))));
dataGridViewCellStyle8.SelectionForeColor = System.Drawing.Color.White;
dataGridViewCellStyle8.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.skinDataGridView1.DefaultCellStyle = dataGridViewCellStyle8;
this.skinDataGridView1.Dock = System.Windows.Forms.DockStyle.Fill;
this.skinDataGridView1.EnableHeadersVisualStyles = false;
this.skinDataGridView1.GridColor = System.Drawing.SystemColors.GradientActiveCaption;
@@ -1358,21 +1362,21 @@
this.skinDataGridView1.Location = new System.Drawing.Point(0, 0);
this.skinDataGridView1.Name = "skinDataGridView1";
this.skinDataGridView1.RowHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.None;
dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle4.BackColor = System.Drawing.SystemColors.ButtonHighlight;
dataGridViewCellStyle4.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle4.ForeColor = System.Drawing.SystemColors.MenuText;
dataGridViewCellStyle4.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle4.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle4.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.skinDataGridView1.RowHeadersDefaultCellStyle = dataGridViewCellStyle4;
dataGridViewCellStyle9.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle9.BackColor = System.Drawing.SystemColors.ButtonHighlight;
dataGridViewCellStyle9.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle9.ForeColor = System.Drawing.SystemColors.MenuText;
dataGridViewCellStyle9.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle9.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle9.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.skinDataGridView1.RowHeadersDefaultCellStyle = dataGridViewCellStyle9;
this.skinDataGridView1.RowHeadersWidth = 51;
this.skinDataGridView1.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.DisableResizing;
dataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle5.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle5.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle5.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
this.skinDataGridView1.RowsDefaultCellStyle = dataGridViewCellStyle5;
dataGridViewCellStyle10.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle10.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle10.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle10.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
this.skinDataGridView1.RowsDefaultCellStyle = dataGridViewCellStyle10;
this.skinDataGridView1.RowTemplate.Height = 23;
this.skinDataGridView1.Size = new System.Drawing.Size(512, 131);
this.skinDataGridView1.TabIndex = 0;
@@ -1499,6 +1503,35 @@
this.ucKeyBorderAll1.Size = new System.Drawing.Size(753, 308);
this.ucKeyBorderAll1.TabIndex = 0;
//
// label9
//
this.label9.AutoSize = true;
this.label9.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label9.Location = new System.Drawing.Point(194, 27);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(37, 20);
this.label9.TabIndex = 11;
this.label9.Text = "打标";
//
// ucSwitch2
//
this.ucSwitch2.BackColor = System.Drawing.Color.Transparent;
this.ucSwitch2.Checked = false;
this.ucSwitch2.FalseColor = System.Drawing.Color.FromArgb(((int)(((byte)(189)))), ((int)(((byte)(189)))), ((int)(((byte)(189)))));
this.ucSwitch2.FalseTextColr = System.Drawing.Color.Black;
this.ucSwitch2.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.ucSwitch2.Location = new System.Drawing.Point(270, 21);
this.ucSwitch2.Name = "ucSwitch2";
this.ucSwitch2.Size = new System.Drawing.Size(80, 28);
this.ucSwitch2.SwitchType = HZH_Controls.Controls.SwitchType.Ellipse;
this.ucSwitch2.TabIndex = 10;
this.ucSwitch2.Texts = new string[] {
"开启",
"关闭"};
this.ucSwitch2.TrueColor = System.Drawing.Color.Lime;
this.ucSwitch2.TrueTextColr = System.Drawing.Color.Black;
this.ucSwitch2.CheckedChanged += new System.EventHandler(this.ucSwitch2_CheckedChanged);
//
// Main
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
@@ -1678,6 +1711,8 @@
private System.Windows.Forms.DataGridViewTextBoxColumn colTarget;
private System.Windows.Forms.ToolStripStatusLabel stsSaveQueue;
private System.Windows.Forms.ToolStripStatusLabel tslabelTime;
private System.Windows.Forms.Label label9;
private HZH_Controls.Controls.UCSwitch ucSwitch2;
}
}

+ 20
- 10
LeatherProject/GeBoShi/Main.cs Parādīt failu

@@ -187,6 +187,7 @@ namespace GeBoShi
lblDefectSpeed.Text = $"检测速度: 0 米/分钟";
ucSwitch1.Checked = SysMgr.Instance.GetDefectPause();
ucSwitch2.Checked = SysMgr.Instance.GetDefectDB();
this.Refresh();
imageBox3.RefreshWindow(null);
@@ -794,18 +795,18 @@ namespace GeBoShi
btn1.Name = "Pause";
btn1.HeaderText = "判断";
//btn1.DefaultCellStyle.va = "启用";
btn1.Text = "启";
btn1.Text = "启";
btn1.UseColumnTextForButtonValue = false;
btn1.DefaultCellStyle.NullValue = "启";
btn1.DefaultCellStyle.NullValue = "启";
btn1.DefaultCellStyle.BackColor = Color.LimeGreen;
dataGridView1.Columns.Add(btn1);
DataGridViewButtonColumn btn2 = new DataGridViewButtonColumn();
btn2.Name = "Print";
btn2.HeaderText = "打标";
btn2.Text = "启";
btn2.Text = "启";
btn2.UseColumnTextForButtonValue = false;
btn2.DefaultCellStyle.NullValue = "启";
btn2.DefaultCellStyle.NullValue = "启";
btn2.DefaultCellStyle.BackColor = Color.LimeGreen;
dataGridView1.Columns.Add(btn2);
@@ -1328,6 +1329,13 @@ namespace GeBoShi
#endregion
#region 打标
private void ucSwitch2_CheckedChanged(object sender, EventArgs e)
{
SysMgr.Instance.SetDefectDB(ucSwitch2.Checked);
}
#endregion
#region 控制光源
private void ucTrackBar1_ValueChanged(object sender, EventArgs e)
{
@@ -1348,7 +1356,7 @@ namespace GeBoShi
{
List<string> namelist = new List<string>();
DataGridViewButtonCell btn = (DataGridViewButtonCell)this.dataGridView1.CurrentCell;
if (btn.FormattedValue.ToString() == "启")
if (btn.FormattedValue.ToString() == "启")
{
this.dataGridView1.CurrentCell.Value = "禁用";
this.dataGridView1.CurrentCell.Style.BackColor = Color.Red;
@@ -1356,14 +1364,14 @@ namespace GeBoShi
}
else
{
this.dataGridView1.CurrentCell.Value = "启";
this.dataGridView1.CurrentCell.Value = "启";
this.dataGridView1.CurrentCell.Style.BackColor = Color.LimeGreen;
this.dataGridView1.CurrentCell.Style.ForeColor = Color.Black;
}
for (int i = 0; i < this.dataGridView1.RowCount; i++)
{
DataGridViewButtonCell btn2 = (DataGridViewButtonCell)this.dataGridView1.Rows[i].Cells[1];
if (btn2.FormattedValue.ToString() == "启")
if (btn2.FormattedValue.ToString() == "启")
namelist.Add(this.dataGridView1.Rows[i].Cells[0].Value.ToString());
}
//开启该项二次判断功能
@@ -1374,7 +1382,7 @@ namespace GeBoShi
{
List<string> namelist = new List<string>();
DataGridViewButtonCell btn = (DataGridViewButtonCell)this.dataGridView1.CurrentCell;
if (btn.FormattedValue.ToString() == "启")
if (btn.FormattedValue.ToString() == "启")
{
this.dataGridView1.CurrentCell.Value = "禁用";
this.dataGridView1.CurrentCell.Style.BackColor = Color.Red;
@@ -1382,14 +1390,14 @@ namespace GeBoShi
}
else
{
this.dataGridView1.CurrentCell.Value = "启";
this.dataGridView1.CurrentCell.Value = "启";
this.dataGridView1.CurrentCell.Style.BackColor = Color.LimeGreen;
this.dataGridView1.CurrentCell.Style.ForeColor = Color.Black;
}
for (int i = 0; i < this.dataGridView1.RowCount; i++)
{
DataGridViewButtonCell btn2 = (DataGridViewButtonCell)this.dataGridView1.Rows[i].Cells[1];
if (btn2.FormattedValue.ToString() == "启")
if (btn2.FormattedValue.ToString() == "启")
namelist.Add(this.dataGridView1.Rows[i].Cells[0].Value.ToString());
}
//开启该项打标功能
@@ -1444,5 +1452,7 @@ namespace GeBoShi
{
}
}
}

+ 9
- 0
LeatherProject/GeBoShi/Main.resx Parādīt failu

@@ -404,6 +404,15 @@
<metadata name="PrintLabel.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="DefectItem.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Enable.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="PrintLabel.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colUid.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>


+ 2
- 0
LeatherProject/GeBoShi/SysCtrl/SysEnum.cs Parādīt failu

@@ -41,6 +41,8 @@ namespace GeBoShi.SysCtrl
复位 = 9,
停止 = 1,
打标 = 2,
日光灯 = 15,
}


+ 117
- 9
LeatherProject/GeBoShi/SysCtrl/SysMgr.cs Parādīt failu

@@ -130,8 +130,18 @@ namespace GeBoShi.SysCtrl
///
/// </summary>
private ConcurrentDictionary<int, Mat> defectPuaseImgList = new ConcurrentDictionary<int, Mat>();
private object lock_defectDB = new object();
/// <summary>
/// 需要打标缺陷
/// </summary>
private List<DefectInfo> defectDBList = new List<DefectInfo>();
//实时速度
private double ActiveSpeed = 0;
//实时位置
private double ActiveDis = 0;
//图片队列
private int listCntMax = 60;
private int Cam1Cnt = 0;
@@ -144,6 +154,10 @@ namespace GeBoShi.SysCtrl
/// </summary>
private bool DefectPauseForUser = true;
/// <summary>
/// 界面打标开启
/// </summary>
private bool DefectDBForUser = true;
/// <summary>
/// 第一次计米启用
/// </summary>
private bool JmFtStart = false;
@@ -166,11 +180,12 @@ namespace GeBoShi.SysCtrl
photoIndex = _photoIndex;
path = _path;
}
public ScanPhotoInfo(int _devIndex, int _photoIndex, Mat _mat)
public ScanPhotoInfo(int _devIndex, int _photoIndex, Mat _mat, double dis = 0)
{
devIndex = _devIndex;
photoIndex = _photoIndex;
mat = _mat;
CurrDis = dis;
}
public int devIndex { get; set; }
/// <summary>
@@ -180,6 +195,8 @@ namespace GeBoShi.SysCtrl
public string path { get; set; }
public Mat mat { get; set; }
public double CurrDis { get; set; }
}
#endregion
private ConcurrentQueue<ScanPhotoInfo> _matList1 = new ConcurrentQueue<ScanPhotoInfo>();
@@ -529,6 +546,18 @@ namespace GeBoShi.SysCtrl
}
#endregion
#region 打标开关
public void SetDefectDB(bool val)
{
DefectDBForUser = val;
}
public bool GetDefectDB()
{
return DefectDBForUser;
}
#endregion
#region 界面光源设置
public void SetLightValue(int val)
{
@@ -607,8 +636,11 @@ namespace GeBoShi.SysCtrl
#endregion
#region 后台
#region 计米器位置和速度
private object LockSpd = new object();
private void SedSpd(double spd)
private object LockDis = new object();
private void SetSpd(double spd)
{
lock (LockSpd)
{
@@ -624,6 +656,25 @@ namespace GeBoShi.SysCtrl
}
return spd;
}
private void SetDis(double dis)
{
lock (LockDis)
{
ActiveDis = dis;
}
}
private double GetDis()
{
double dis;
lock (LockDis)
{
dis = ActiveDis;
}
return dis;
}
#endregion
#region 中断
/// <summary>
/// 中断工序运行
/// </summary>
@@ -632,7 +683,9 @@ namespace GeBoShi.SysCtrl
{
return statusMgr.Status == SystemStsEnum.Pause || statusMgr.Warning == WarningEnum.High;
}
#endregion
#region 长度与速度流程
/// <summary>
/// 获取速度和长度
/// </summary>
@@ -671,6 +724,7 @@ namespace GeBoShi.SysCtrl
double length = GetLength();
if (length >= 0)
{
if (!JmFtStart)
{
//第一次记录起始数据
@@ -697,7 +751,7 @@ namespace GeBoShi.SysCtrl
//}
preSpd = spd;
SedSpd(spd);
SetSpd(spd);
if (spdcnt > 2)
{
@@ -710,6 +764,7 @@ namespace GeBoShi.SysCtrl
}
etl = length;//记录当前读数
yqjimi = Math.Round((etl - stl) / 1.00, 2); //记录长度
SetDis(yqjimi);
}
lock (lockCurrKey)
{
@@ -728,7 +783,7 @@ namespace GeBoShi.SysCtrl
double StopDecRunDis = tRunSpd / 60.0 * confMgr.SysConfigParams.StopDecTime / 2;
double atcDis = (confMgr.SysConfigParams.StopLookDis - StopDecRunDis);
//计米器判断暂停:瑕疵二次判断
//计米器判断暂停:瑕疵二次判断 存在问题
if (confMgr.SysConfigParams.OpenLengthCountStop && DefectPauseForUser && defectPuaseList.Count > 0)
{
if ((yqjimi - atcDis) > (defectPuaseList[0].Y / 100))
@@ -809,6 +864,19 @@ namespace GeBoShi.SysCtrl
}
}
//计米器判定打标
if(DefectDBForUser && defectDBList.Count >0)
{
//判断是否开启打标
if((yqjimi - defectDBList[0].CurrDis + (defectDBList[0].PicY / 100) - confMgr.SysConfigParams.CamToDBDis) >= 0)
{
Log($"打标", $"计米器{yqjimi},瑕疵位置{defectDBList[0].PicY / 100},拍照位置{defectDBList[0].CurrDis},打标机距离{confMgr.SysConfigParams.StopLookDis}m,", WarningEnum.Normal, false);
StartDB();
Log($"打标判断删除", $"{defectDBList[0].PhotoIndex}-{defectDBList[0].Name}", WarningEnum.Normal, false);
defectDBList.RemoveAt(0);
}
}
#endregion
}
}
@@ -865,6 +933,9 @@ namespace GeBoShi.SysCtrl
}
}
}
#endregion
#region 相机线程1 && 二次判定
/// <summary>
/// 相机1采图预处理
/// </summary>
@@ -1146,6 +1217,9 @@ namespace GeBoShi.SysCtrl
}
}
}
#endregion
#region 相机线程2 && 图片位置
/// <summary>
/// 相机2采图预处理
/// </summary>
@@ -1188,6 +1262,9 @@ namespace GeBoShi.SysCtrl
if (acq.GrabStatus == "GrabPass")
{
#endif
//获取图片成功,说明正好拍完照片,获取当前计米器位置
double picDis = GetDis();
Mat img = acq.Image.Clone();
//预处理
Stopwatch stopWatch = new Stopwatch();
@@ -1277,7 +1354,7 @@ namespace GeBoShi.SysCtrl
}
//Log($"图像2入队列", $"相机2-{Cam1Cnt}", WarningEnum.Normal, false);
//Cv2.Flip(img, img, FlipMode.XY);//翻转
_matList2.Enqueue(new ScanPhotoInfo(1, Cam2Cnt++, mat.Clone()));
_matList2.Enqueue(new ScanPhotoInfo(1, Cam2Cnt++, mat.Clone(), picDis));
//System.GC.Collect();
}
else
@@ -1310,6 +1387,9 @@ namespace GeBoShi.SysCtrl
}
}
}
#endregion
#region 处理线程
int testCnt = 0;
/// <summary>
/// 后台运行主线程
@@ -1663,7 +1743,7 @@ namespace GeBoShi.SysCtrl
//Log($"图像拼接处理", $"相机1-{scanPhotos0.photoIndex},相机2-{scanPhotos1.photoIndex}", WarningEnum.Normal, false);
string time = "";
string time = $"图像位置:{scanPhotos1.CurrDis}";
stopWatch.Start();
try
{
@@ -1880,6 +1960,7 @@ namespace GeBoShi.SysCtrl
cm2px_x = confMgr.SysConfigParams.Cm2px_x,
cm2px_y = confMgr.SysConfigParams.Cm2px_y,
expand_pixel = confMgr.SysConfigParams.Expand_pixel,
CurrDis = scanPhotos1.CurrDis,
});
curRecord.ScannerPhotoCount++;
errStep = 10;
@@ -1930,9 +2011,9 @@ namespace GeBoShi.SysCtrl
}
}
}
#endregion
#endregion
#endregion
#region 模型label
private JArray _defectItemList;
@@ -2116,10 +2197,13 @@ namespace GeBoShi.SysCtrl
Contrast = double.Parse(res.excelTable.Rows[i]["对比度"].ToString()),
Target = int.Parse(res.excelTable.Rows[i]["目标"].ToString()),
image = res.lstDefectBmp[i].Clone(),
PicY = double.Parse(res.excelTable.Rows[i]["Y"].ToString()),//cm
CurrDis = res.CurrDis,
};
defectInfo.ModifyUserCode = defectInfo.CreateUserCode = res.record.CreateUserCode;
step = 6 + i * 10;
//判定是否加入二次判断
if (DefectItemsPuaseNameList.Contains(defectInfo.Name))
{
lock (lock_defectPuase)
@@ -2129,7 +2213,14 @@ namespace GeBoShi.SysCtrl
if (!defectPuaseImgList.ContainsKey(res.photoIndex))
defectPuaseImgList.TryAdd(res.photoIndex, res.bmpTag.Clone());
}
//判定是否加入打标
if (DefectItemsDBNameList.Contains(defectInfo.Name))
{
lock (lock_defectDB)
{
defectDBList.Add(defectInfo);
}
}
res.record.DefectInfoList.Add(defectInfo);
defectInfo.uid = preTicks++;// res.record.DefectInfoList.Count;//程序中的唯一索引,用于移除用索引
@@ -3400,6 +3491,7 @@ namespace GeBoShi.SysCtrl
Cam2Cnt = 0;
defectPuaseList.Clear();
defectDBList.Clear();
defectPuaseImgList.Clear();
System.GC.Collect();
@@ -3722,6 +3814,22 @@ namespace GeBoShi.SysCtrl
}
#endregion
#region 启动打标
public void StartDB()
{
if (confMgr.SysConfigParams.OpenIO)
{
bool sts;
ioCardDev.WriteBitState(GetIOPortIndex((int)DOName.打标), GetIOBitIndex((int)DOName.打标), true);
Task.Run(async () =>
{
await Task.Delay(200);
ioCardDev.WriteBitState(GetIOPortIndex((int)DOName.打标), GetIOBitIndex((int)DOName.打标), false);
});
}
}
#endregion
}
#region 系统事件
/// <summary>


+ 11
- 0
LeatherProject/Models/Records.cs Parādīt failu

@@ -210,5 +210,16 @@ namespace Models
public string Name { get; set; }
[SugarColumn(IsIgnore = true)]
public string TagFilePath { get; set; }//打标小图路径,用于二次瑕疵检测修改和忽略时的改名/删除
/// <summary>
/// 图片中缺陷当前Y方向位置
/// </summary>
[SugarColumn(IsIgnore = true)]
public double PicY { get; set; }
/// <summary>
/// 当前图像计米器位置
/// </summary>
[SugarColumn(IsIgnore = true)]
public double CurrDis { get; set; }
}
}

Notiek ielāde…
Atcelt
Saglabāt