4.11更新

1.添加是否调用mes接口按钮,并只有admin用户可以点击,2.修改螺丝引导页面
3.端子只有一个,端子扫码借用扫码页面
This commit is contained in:
zhougf committed 2025-04-11 15:47:10 +08:00
1 parent 752e1f37b6
commit 69c851c09e
15 files changed
+999 -380

No files matched your search

+4 -3
View File
@@ -244,16 +244,17 @@
<Compile Include="form\MESUrl.Designer.cs">
<DependentUpon>MESUrl.cs</DependentUpon>
</Compile>
<Compile Include="MaterialScanForm.cs">
<Compile Include="form\MaterialScanForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="MaterialScanForm.Designer.cs">
<Compile Include="form\MaterialScanForm.Designer.cs">
<DependentUpon>MaterialScanForm.cs</DependentUpon>
</Compile>
<Compile Include="mod\database\t_imageposition.cs" />
<Compile Include="mod\database\t_lineplc.cs" />
<Compile Include="mod\database\t_materialcall.cs" />
<Compile Include="mod\database\t_materialscan.cs" />
<Compile Include="mod\database\t_materialupload.cs" />
<Compile Include="mod\database\t_pressurecurve.cs" />
<Compile Include="mod\database\t_flow.cs" />
<Compile Include="mod\database\t_interface.cs" />
@@ -370,7 +371,7 @@
<EmbeddedResource Include="form\MESUrl.resx">
<DependentUpon>MESUrl.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="MaterialScanForm.resx">
<EmbeddedResource Include="form\MaterialScanForm.resx">
<DependentUpon>MaterialScanForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
+125 -108
View File
@@ -77,9 +77,9 @@ namespace WindowsFormsApp1
this.材料值 = new System.Windows.Forms.Label();
this.材料 = new System.Windows.Forms.Label();
this.LOT号显示 = new System.Windows.Forms.Label();
this.LOT号 = new System.Windows.Forms.Label();
this.MES提示 = new System.Windows.Forms.Label();
this.Tray盘二维码 = new System.Windows.Forms.Label();
this.LOT号 = new System.Windows.Forms.Label();
this.tableLayoutPanel6 = new System.Windows.Forms.TableLayoutPanel();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
@@ -108,6 +108,7 @@ namespace WindowsFormsApp1
this.底部注释3 = new System.Windows.Forms.Label();
this.底部注释4 = new System.Windows.Forms.Label();
this.底部注释5 = new System.Windows.Forms.Label();
this.btnToggleTestMode = new System.Windows.Forms.Button();
this.tableLayoutPanel7 = new System.Windows.Forms.TableLayoutPanel();
this.richTextBox1 = new System.Windows.Forms.RichTextBox();
this.richTextBox2 = new System.Windows.Forms.RichTextBox();
@@ -133,9 +134,9 @@ namespace WindowsFormsApp1
this.plcStatusGroupBox.Controls.Add(this.plcStatusTableLayout);
this.plcStatusGroupBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.plcStatusGroupBox.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold);
this.plcStatusGroupBox.Location = new System.Drawing.Point(3, 969);
this.plcStatusGroupBox.Location = new System.Drawing.Point(3, 931);
this.plcStatusGroupBox.Name = "plcStatusGroupBox";
this.plcStatusGroupBox.Size = new System.Drawing.Size(1754, 94);
this.plcStatusGroupBox.Size = new System.Drawing.Size(1754, 90);
this.plcStatusGroupBox.TabIndex = 9;
this.plcStatusGroupBox.TabStop = false;
this.plcStatusGroupBox.Text = "PLC连接状态";
@@ -149,7 +150,7 @@ namespace WindowsFormsApp1
this.plcStatusTableLayout.Dock = System.Windows.Forms.DockStyle.Fill;
this.plcStatusTableLayout.Location = new System.Drawing.Point(3, 40);
this.plcStatusTableLayout.Name = "plcStatusTableLayout";
this.plcStatusTableLayout.Size = new System.Drawing.Size(1748, 51);
this.plcStatusTableLayout.Size = new System.Drawing.Size(1748, 47);
this.plcStatusTableLayout.TabIndex = 0;
//
// menuStrip1
@@ -369,13 +370,13 @@ namespace WindowsFormsApp1
this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(5, 6, 5, 6);
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
this.tableLayoutPanel1.RowCount = 6;
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 50F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 105F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 48F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 101F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 59.66998F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 35.03736F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 100F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 96F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 5.292663F));
this.tableLayoutPanel1.Size = new System.Drawing.Size(1760, 1112);
this.tableLayoutPanel1.Size = new System.Drawing.Size(1760, 1068);
this.tableLayoutPanel1.TabIndex = 6;
//
// tableLayoutPanel3
@@ -388,12 +389,12 @@ namespace WindowsFormsApp1
this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.tableLayoutPanel3.Controls.Add(this.tableLayoutPanel2, 0, 0);
this.tableLayoutPanel3.Location = new System.Drawing.Point(5, 56);
this.tableLayoutPanel3.Location = new System.Drawing.Point(5, 54);
this.tableLayoutPanel3.Margin = new System.Windows.Forms.Padding(5, 6, 5, 6);
this.tableLayoutPanel3.Name = "tableLayoutPanel3";
this.tableLayoutPanel3.RowCount = 1;
this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel3.Size = new System.Drawing.Size(1750, 93);
this.tableLayoutPanel3.Size = new System.Drawing.Size(1750, 89);
this.tableLayoutPanel3.TabIndex = 4;
//
// tableLayoutPanel2
@@ -422,18 +423,19 @@ namespace WindowsFormsApp1
this.tableLayoutPanel2.Name = "tableLayoutPanel2";
this.tableLayoutPanel2.RowCount = 1;
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel2.Size = new System.Drawing.Size(1740, 81);
this.tableLayoutPanel2.Size = new System.Drawing.Size(1740, 77);
this.tableLayoutPanel2.TabIndex = 3;
//
// linemode
//
this.linemode.AutoEllipsis = true;
this.linemode.AutoSize = true;
this.linemode.Dock = System.Windows.Forms.DockStyle.Fill;
this.linemode.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.linemode.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.linemode.Location = new System.Drawing.Point(975, 1);
this.linemode.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
this.linemode.Name = "linemode";
this.linemode.Size = new System.Drawing.Size(245, 79);
this.linemode.Size = new System.Drawing.Size(245, 75);
this.linemode.TabIndex = 16;
this.linemode.Text = "MachineID";
this.linemode.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
@@ -442,11 +444,11 @@ namespace WindowsFormsApp1
//
this.当前时间.AutoSize = true;
this.当前时间.Dock = System.Windows.Forms.DockStyle.Fill;
this.当前时间.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.当前时间.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.当前时间.Location = new System.Drawing.Point(1487, 1);
this.当前时间.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
this.当前时间.Name = "当前时间";
this.当前时间.Size = new System.Drawing.Size(247, 79);
this.当前时间.Size = new System.Drawing.Size(247, 75);
this.当前时间.TabIndex = 11;
this.当前时间.Text = "当前状态:";
this.当前时间.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
@@ -455,37 +457,39 @@ namespace WindowsFormsApp1
//
this.操作人员ID.AutoSize = true;
this.操作人员ID.Dock = System.Windows.Forms.DockStyle.Fill;
this.操作人员ID.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.操作人员ID.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.操作人员ID.Location = new System.Drawing.Point(1231, 1);
this.操作人员ID.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
this.操作人员ID.Name = "操作人员ID";
this.操作人员ID.Size = new System.Drawing.Size(245, 79);
this.操作人员ID.Size = new System.Drawing.Size(245, 75);
this.操作人员ID.TabIndex = 6;
this.操作人员ID.Text = "操作人员ID:";
this.操作人员ID.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// linetype
//
this.linetype.AutoEllipsis = true;
this.linetype.AutoSize = true;
this.linetype.Dock = System.Windows.Forms.DockStyle.Fill;
this.linetype.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.linetype.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.linetype.Location = new System.Drawing.Point(719, 1);
this.linetype.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
this.linetype.Name = "linetype";
this.linetype.Size = new System.Drawing.Size(245, 79);
this.linetype.Size = new System.Drawing.Size(245, 75);
this.linetype.TabIndex = 5;
this.linetype.Text = "StationID";
this.linetype.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// linecode
//
this.linecode.AutoEllipsis = true;
this.linecode.AutoSize = true;
this.linecode.Dock = System.Windows.Forms.DockStyle.Fill;
this.linecode.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.linecode.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.linecode.Location = new System.Drawing.Point(463, 1);
this.linecode.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
this.linecode.Name = "linecode";
this.linecode.Size = new System.Drawing.Size(245, 79);
this.linecode.Size = new System.Drawing.Size(245, 75);
this.linecode.TabIndex = 4;
this.linecode.Text = "Line";
this.linecode.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
@@ -494,11 +498,11 @@ namespace WindowsFormsApp1
//
this.linename.AutoSize = true;
this.linename.Dock = System.Windows.Forms.DockStyle.Fill;
this.linename.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.linename.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.linename.Location = new System.Drawing.Point(207, 1);
this.linename.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
this.linename.Name = "linename";
this.linename.Size = new System.Drawing.Size(245, 79);
this.linename.Size = new System.Drawing.Size(245, 75);
this.linename.TabIndex = 3;
this.linename.Text = "线别:";
this.linename.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
@@ -509,7 +513,7 @@ namespace WindowsFormsApp1
this.开始处理.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.开始处理.Location = new System.Drawing.Point(4, 4);
this.开始处理.Name = "开始处理";
this.开始处理.Size = new System.Drawing.Size(194, 73);
this.开始处理.Size = new System.Drawing.Size(194, 69);
this.开始处理.TabIndex = 17;
this.开始处理.Text = "开始处理";
this.开始处理.UseVisualStyleBackColor = true;
@@ -526,13 +530,13 @@ namespace WindowsFormsApp1
this.tableLayoutPanel4.Controls.Add(this.原料包装LOT号, 0, 0);
this.tableLayoutPanel4.Controls.Add(this.tableLayoutPanel6, 0, 1);
this.tableLayoutPanel4.Controls.Add(this.tableLayoutPanel9, 1, 0);
this.tableLayoutPanel4.Location = new System.Drawing.Point(3, 159);
this.tableLayoutPanel4.Location = new System.Drawing.Point(3, 153);
this.tableLayoutPanel4.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.tableLayoutPanel4.Name = "tableLayoutPanel4";
this.tableLayoutPanel4.RowCount = 2;
this.tableLayoutPanel4.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 40F));
this.tableLayoutPanel4.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 60F));
this.tableLayoutPanel4.Size = new System.Drawing.Size(1754, 503);
this.tableLayoutPanel4.Size = new System.Drawing.Size(1754, 483);
this.tableLayoutPanel4.TabIndex = 8;
//
// 原料包装LOT号
@@ -544,7 +548,7 @@ namespace WindowsFormsApp1
this.原料包装LOT号.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.原料包装LOT号.Name = "原料包装LOT号";
this.原料包装LOT号.Padding = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.原料包装LOT号.Size = new System.Drawing.Size(1397, 193);
this.原料包装LOT号.Size = new System.Drawing.Size(1397, 185);
this.原料包装LOT号.TabIndex = 0;
this.原料包装LOT号.TabStop = false;
this.原料包装LOT号.Text = "产品信息:";
@@ -553,15 +557,14 @@ namespace WindowsFormsApp1
//
this.tableLayoutPanel5.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None;
this.tableLayoutPanel5.ColumnCount = 2;
this.tableLayoutPanel5.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 24.49411F));
this.tableLayoutPanel5.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 75.50589F));
this.tableLayoutPanel5.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.tableLayoutPanel5.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F));
this.tableLayoutPanel5.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 75F));
this.tableLayoutPanel5.Controls.Add(this.材料值, 1, 1);
this.tableLayoutPanel5.Controls.Add(this.材料, 0, 1);
this.tableLayoutPanel5.Controls.Add(this.LOT号显示, 0, 0);
this.tableLayoutPanel5.Controls.Add(this.LOT号, 1, 0);
this.tableLayoutPanel5.Controls.Add(this.MES提示, 0, 2);
this.tableLayoutPanel5.Controls.Add(this.Tray盘二维码, 1, 2);
this.tableLayoutPanel5.Controls.Add(this.LOT号, 1, 0);
this.tableLayoutPanel5.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel5.Location = new System.Drawing.Point(3, 41);
this.tableLayoutPanel5.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
@@ -570,7 +573,7 @@ namespace WindowsFormsApp1
this.tableLayoutPanel5.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.33334F));
this.tableLayoutPanel5.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.33334F));
this.tableLayoutPanel5.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.33334F));
this.tableLayoutPanel5.Size = new System.Drawing.Size(1391, 148);
this.tableLayoutPanel5.Size = new System.Drawing.Size(1391, 140);
this.tableLayoutPanel5.TabIndex = 0;
//
// 材料值
@@ -578,9 +581,9 @@ namespace WindowsFormsApp1
this.材料值.AutoSize = true;
this.材料值.Dock = System.Windows.Forms.DockStyle.Fill;
this.材料值.Font = new System.Drawing.Font("宋体", 15F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.材料值.Location = new System.Drawing.Point(343, 49);
this.材料值.Location = new System.Drawing.Point(350, 46);
this.材料值.Name = "材料值";
this.材料值.Size = new System.Drawing.Size(1045, 49);
this.材料值.Size = new System.Drawing.Size(1038, 46);
this.材料值.TabIndex = 7;
this.材料值.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
@@ -589,9 +592,9 @@ namespace WindowsFormsApp1
this.材料.AutoSize = true;
this.材料.Dock = System.Windows.Forms.DockStyle.Fill;
this.材料.Font = new System.Drawing.Font("宋体", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.材料.Location = new System.Drawing.Point(3, 49);
this.材料.Location = new System.Drawing.Point(3, 46);
this.材料.Name = "材料";
this.材料.Size = new System.Drawing.Size(334, 49);
this.材料.Size = new System.Drawing.Size(341, 46);
this.材料.TabIndex = 6;
this.材料.Text = "材 料:";
this.材料.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
@@ -603,30 +606,19 @@ namespace WindowsFormsApp1
this.LOT号显示.Font = new System.Drawing.Font("宋体", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.LOT号显示.Location = new System.Drawing.Point(3, 0);
this.LOT号显示.Name = "LOT号显示";
this.LOT号显示.Size = new System.Drawing.Size(334, 49);
this.LOT号显示.Size = new System.Drawing.Size(341, 46);
this.LOT号显示.TabIndex = 2;
this.LOT号显示.Text = "产品 SN:";
this.LOT号显示.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// LOT号
//
this.LOT号.AutoSize = true;
this.LOT号.Dock = System.Windows.Forms.DockStyle.Fill;
this.LOT号.Font = new System.Drawing.Font("宋体", 15F, System.Drawing.FontStyle.Bold);
this.LOT号.Location = new System.Drawing.Point(343, 0);
this.LOT号.Name = "LOT号";
this.LOT号.Size = new System.Drawing.Size(1045, 49);
this.LOT号.TabIndex = 0;
this.LOT号.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// MES提示
//
this.MES提示.AutoSize = true;
this.MES提示.Dock = System.Windows.Forms.DockStyle.Fill;
this.MES提示.Font = new System.Drawing.Font("宋体", 15F);
this.MES提示.Location = new System.Drawing.Point(3, 98);
this.MES提示.Location = new System.Drawing.Point(3, 92);
this.MES提示.Name = "MES提示";
this.MES提示.Size = new System.Drawing.Size(334, 50);
this.MES提示.Size = new System.Drawing.Size(341, 48);
this.MES提示.TabIndex = 4;
this.MES提示.Text = "托 盘 码:";
this.MES提示.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
@@ -636,20 +628,31 @@ namespace WindowsFormsApp1
this.Tray盘二维码.AutoSize = true;
this.Tray盘二维码.Dock = System.Windows.Forms.DockStyle.Fill;
this.Tray盘二维码.Font = new System.Drawing.Font("宋体", 15F, System.Drawing.FontStyle.Bold);
this.Tray盘二维码.Location = new System.Drawing.Point(343, 98);
this.Tray盘二维码.Location = new System.Drawing.Point(350, 92);
this.Tray盘二维码.Name = "Tray盘二维码";
this.Tray盘二维码.Size = new System.Drawing.Size(1045, 50);
this.Tray盘二维码.Size = new System.Drawing.Size(1038, 48);
this.Tray盘二维码.TabIndex = 2;
this.Tray盘二维码.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// LOT号
//
this.LOT号.AutoSize = true;
this.LOT号.Dock = System.Windows.Forms.DockStyle.Fill;
this.LOT号.Font = new System.Drawing.Font("宋体", 15F, System.Drawing.FontStyle.Bold);
this.LOT号.Location = new System.Drawing.Point(350, 0);
this.LOT号.Name = "LOT号";
this.LOT号.Size = new System.Drawing.Size(1038, 46);
this.LOT号.TabIndex = 0;
this.LOT号.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// tableLayoutPanel6
//
this.tableLayoutPanel6.CellBorderStyle = System.Windows.Forms.TableLayoutPanelCellBorderStyle.Single;
this.tableLayoutPanel6.ColumnCount = 3;
this.tableLayoutPanel4.SetColumnSpan(this.tableLayoutPanel6, 2);
this.tableLayoutPanel6.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F));
this.tableLayoutPanel6.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 15F));
this.tableLayoutPanel6.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 60F));
this.tableLayoutPanel6.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F));
this.tableLayoutPanel6.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel6.Controls.Add(this.label1, 0, 0);
this.tableLayoutPanel6.Controls.Add(this.label2, 1, 0);
this.tableLayoutPanel6.Controls.Add(this.label3, 2, 0);
@@ -657,12 +660,12 @@ namespace WindowsFormsApp1
this.tableLayoutPanel6.Controls.Add(this.MES提示信息, 2, 1);
this.tableLayoutPanel6.Controls.Add(this.eventTableLayout, 0, 1);
this.tableLayoutPanel6.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel6.Location = new System.Drawing.Point(3, 204);
this.tableLayoutPanel6.Location = new System.Drawing.Point(3, 196);
this.tableLayoutPanel6.Name = "tableLayoutPanel6";
this.tableLayoutPanel6.RowCount = 2;
this.tableLayoutPanel6.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 50F));
this.tableLayoutPanel6.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 48F));
this.tableLayoutPanel6.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel6.Size = new System.Drawing.Size(1748, 296);
this.tableLayoutPanel6.Size = new System.Drawing.Size(1748, 284);
this.tableLayoutPanel6.TabIndex = 3;
//
// label1
@@ -672,7 +675,7 @@ namespace WindowsFormsApp1
this.label1.Font = new System.Drawing.Font("宋体", 10.125F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label1.Location = new System.Drawing.Point(4, 1);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(430, 50);
this.label1.Size = new System.Drawing.Size(430, 48);
this.label1.TabIndex = 0;
this.label1.Text = "MES事件";
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
@@ -684,7 +687,7 @@ namespace WindowsFormsApp1
this.label2.Font = new System.Drawing.Font("宋体", 10.125F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label2.Location = new System.Drawing.Point(441, 1);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(255, 50);
this.label2.Size = new System.Drawing.Size(430, 48);
this.label2.TabIndex = 1;
this.label2.Text = "MES事件结果";
this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
@@ -694,9 +697,9 @@ namespace WindowsFormsApp1
this.label3.AutoSize = true;
this.label3.Dock = System.Windows.Forms.DockStyle.Fill;
this.label3.Font = new System.Drawing.Font("宋体", 10.125F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label3.Location = new System.Drawing.Point(703, 1);
this.label3.Location = new System.Drawing.Point(878, 1);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(1041, 50);
this.label3.Size = new System.Drawing.Size(866, 48);
this.label3.TabIndex = 2;
this.label3.Text = "MES信息提示";
this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
@@ -706,9 +709,9 @@ namespace WindowsFormsApp1
this.事件结果.AutoSize = true;
this.事件结果.Dock = System.Windows.Forms.DockStyle.Fill;
this.事件结果.Font = new System.Drawing.Font("宋体", 25.875F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.事件结果.Location = new System.Drawing.Point(441, 52);
this.事件结果.Location = new System.Drawing.Point(441, 50);
this.事件结果.Name = "事件结果";
this.事件结果.Size = new System.Drawing.Size(255, 243);
this.事件结果.Size = new System.Drawing.Size(430, 233);
this.事件结果.TabIndex = 3;
this.事件结果.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
@@ -716,10 +719,10 @@ namespace WindowsFormsApp1
//
this.MES提示信息.AutoSize = true;
this.MES提示信息.Dock = System.Windows.Forms.DockStyle.Fill;
this.MES提示信息.Font = new System.Drawing.Font("宋体", 16.125F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.MES提示信息.Location = new System.Drawing.Point(703, 52);
this.MES提示信息.Font = new System.Drawing.Font("宋体", 22.125F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.MES提示信息.Location = new System.Drawing.Point(878, 50);
this.MES提示信息.Name = "MES提示信息";
this.MES提示信息.Size = new System.Drawing.Size(1041, 243);
this.MES提示信息.Size = new System.Drawing.Size(866, 233);
this.MES提示信息.TabIndex = 4;
this.MES提示信息.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
@@ -739,7 +742,7 @@ namespace WindowsFormsApp1
this.eventTableLayout.Controls.Add(this.label8, 0, 3);
this.eventTableLayout.Controls.Add(this.label9, 0, 4);
this.eventTableLayout.Dock = System.Windows.Forms.DockStyle.Fill;
this.eventTableLayout.Location = new System.Drawing.Point(4, 55);
this.eventTableLayout.Location = new System.Drawing.Point(4, 53);
this.eventTableLayout.Name = "eventTableLayout";
this.eventTableLayout.RowCount = 5;
this.eventTableLayout.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F));
@@ -747,7 +750,7 @@ namespace WindowsFormsApp1
this.eventTableLayout.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F));
this.eventTableLayout.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F));
this.eventTableLayout.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F));
this.eventTableLayout.Size = new System.Drawing.Size(430, 237);
this.eventTableLayout.Size = new System.Drawing.Size(430, 227);
this.eventTableLayout.TabIndex = 5;
//
// panel1
@@ -756,46 +759,46 @@ namespace WindowsFormsApp1
this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel1.Location = new System.Drawing.Point(333, 3);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(94, 41);
this.panel1.Size = new System.Drawing.Size(94, 39);
this.panel1.TabIndex = 0;
//
// panel2
//
this.panel2.Location = new System.Drawing.Point(38, 47);
this.panel2.Location = new System.Drawing.Point(38, 45);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(200, 41);
this.panel2.Size = new System.Drawing.Size(200, 39);
this.panel2.TabIndex = 1;
//
// panel4
//
this.panel4.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel4.Location = new System.Drawing.Point(333, 50);
this.panel4.Location = new System.Drawing.Point(333, 48);
this.panel4.Name = "panel4";
this.panel4.Size = new System.Drawing.Size(94, 41);
this.panel4.Size = new System.Drawing.Size(94, 39);
this.panel4.TabIndex = 2;
//
// panel3
//
this.panel3.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel3.Location = new System.Drawing.Point(333, 97);
this.panel3.Location = new System.Drawing.Point(333, 93);
this.panel3.Name = "panel3";
this.panel3.Size = new System.Drawing.Size(94, 41);
this.panel3.Size = new System.Drawing.Size(94, 39);
this.panel3.TabIndex = 1;
//
// panel5
//
this.panel5.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel5.Location = new System.Drawing.Point(333, 144);
this.panel5.Location = new System.Drawing.Point(333, 138);
this.panel5.Name = "panel5";
this.panel5.Size = new System.Drawing.Size(94, 41);
this.panel5.Size = new System.Drawing.Size(94, 39);
this.panel5.TabIndex = 3;
//
// panel6
//
this.panel6.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel6.Location = new System.Drawing.Point(333, 191);
this.panel6.Location = new System.Drawing.Point(333, 183);
this.panel6.Name = "panel6";
this.panel6.Size = new System.Drawing.Size(94, 43);
this.panel6.Size = new System.Drawing.Size(94, 41);
this.panel6.TabIndex = 4;
//
// label5
@@ -805,7 +808,7 @@ namespace WindowsFormsApp1
this.label5.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold);
this.label5.Location = new System.Drawing.Point(3, 0);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(324, 47);
this.label5.Size = new System.Drawing.Size(324, 45);
this.label5.TabIndex = 5;
this.label5.Text = "label5";
this.label5.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
@@ -815,9 +818,9 @@ namespace WindowsFormsApp1
this.label6.AutoSize = true;
this.label6.Dock = System.Windows.Forms.DockStyle.Fill;
this.label6.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label6.Location = new System.Drawing.Point(3, 47);
this.label6.Location = new System.Drawing.Point(3, 45);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(324, 47);
this.label6.Size = new System.Drawing.Size(324, 45);
this.label6.TabIndex = 6;
this.label6.Text = "label6";
this.label6.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
@@ -827,9 +830,9 @@ namespace WindowsFormsApp1
this.label7.AutoSize = true;
this.label7.Dock = System.Windows.Forms.DockStyle.Fill;
this.label7.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label7.Location = new System.Drawing.Point(3, 94);
this.label7.Location = new System.Drawing.Point(3, 90);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(324, 47);
this.label7.Size = new System.Drawing.Size(324, 45);
this.label7.TabIndex = 7;
this.label7.Text = "label7";
this.label7.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
@@ -839,9 +842,9 @@ namespace WindowsFormsApp1
this.label8.AutoSize = true;
this.label8.Dock = System.Windows.Forms.DockStyle.Fill;
this.label8.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label8.Location = new System.Drawing.Point(3, 141);
this.label8.Location = new System.Drawing.Point(3, 135);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(324, 47);
this.label8.Size = new System.Drawing.Size(324, 45);
this.label8.TabIndex = 8;
this.label8.Text = "label8";
this.label8.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
@@ -851,9 +854,9 @@ namespace WindowsFormsApp1
this.label9.AutoSize = true;
this.label9.Dock = System.Windows.Forms.DockStyle.Fill;
this.label9.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label9.Location = new System.Drawing.Point(3, 188);
this.label9.Location = new System.Drawing.Point(3, 180);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(324, 49);
this.label9.Size = new System.Drawing.Size(324, 47);
this.label9.TabIndex = 9;
this.label9.Text = "label9";
this.label9.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
@@ -869,9 +872,9 @@ namespace WindowsFormsApp1
this.tableLayoutPanel9.Location = new System.Drawing.Point(1406, 3);
this.tableLayoutPanel9.Name = "tableLayoutPanel9";
this.tableLayoutPanel9.RowCount = 2;
this.tableLayoutPanel9.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 50F));
this.tableLayoutPanel9.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 48F));
this.tableLayoutPanel9.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel9.Size = new System.Drawing.Size(345, 195);
this.tableLayoutPanel9.Size = new System.Drawing.Size(345, 187);
this.tableLayoutPanel9.TabIndex = 4;
//
// label4
@@ -881,7 +884,7 @@ namespace WindowsFormsApp1
this.label4.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label4.Location = new System.Drawing.Point(3, 0);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(339, 50);
this.label4.Size = new System.Drawing.Size(339, 48);
this.label4.TabIndex = 0;
this.label4.Text = "胶水寿命";
this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
@@ -891,9 +894,9 @@ namespace WindowsFormsApp1
this.剩余寿命.AutoSize = true;
this.剩余寿命.Dock = System.Windows.Forms.DockStyle.Fill;
this.剩余寿命.Font = new System.Drawing.Font("宋体", 24F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.剩余寿命.Location = new System.Drawing.Point(3, 50);
this.剩余寿命.Location = new System.Drawing.Point(3, 48);
this.剩余寿命.Name = "剩余寿命";
this.剩余寿命.Size = new System.Drawing.Size(339, 145);
this.剩余寿命.Size = new System.Drawing.Size(339, 139);
this.剩余寿命.TabIndex = 1;
this.剩余寿命.Text = "label5";
this.剩余寿命.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
@@ -906,7 +909,7 @@ namespace WindowsFormsApp1
this.groupBox1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Padding = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.groupBox1.Size = new System.Drawing.Size(1752, 40);
this.groupBox1.Size = new System.Drawing.Size(1752, 38);
this.groupBox1.TabIndex = 4;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "处理界面";
@@ -929,13 +932,14 @@ namespace WindowsFormsApp1
this.tableLayoutPanel8.Controls.Add(this.底部注释3, 2, 0);
this.tableLayoutPanel8.Controls.Add(this.底部注释4, 3, 0);
this.tableLayoutPanel8.Controls.Add(this.底部注释5, 4, 0);
this.tableLayoutPanel8.Controls.Add(this.btnToggleTestMode, 9, 0);
this.tableLayoutPanel8.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel8.Location = new System.Drawing.Point(3, 1070);
this.tableLayoutPanel8.Location = new System.Drawing.Point(3, 1028);
this.tableLayoutPanel8.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.tableLayoutPanel8.Name = "tableLayoutPanel8";
this.tableLayoutPanel8.RowCount = 1;
this.tableLayoutPanel8.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel8.Size = new System.Drawing.Size(1754, 38);
this.tableLayoutPanel8.Size = new System.Drawing.Size(1754, 36);
this.tableLayoutPanel8.TabIndex = 7;
//
// 底部注释1
@@ -944,7 +948,7 @@ namespace WindowsFormsApp1
this.底部注释1.AutoSize = true;
this.底部注释1.Location = new System.Drawing.Point(3, 6);
this.底部注释1.Name = "底部注释1";
this.底部注释1.Size = new System.Drawing.Size(108, 25);
this.底部注释1.Size = new System.Drawing.Size(118, 24);
this.底部注释1.TabIndex = 0;
this.底部注释1.Text = "底部注释1";
//
@@ -954,7 +958,7 @@ namespace WindowsFormsApp1
this.底部注释2.AutoSize = true;
this.底部注释2.Location = new System.Drawing.Point(178, 6);
this.底部注释2.Name = "底部注释2";
this.底部注释2.Size = new System.Drawing.Size(108, 25);
this.底部注释2.Size = new System.Drawing.Size(118, 24);
this.底部注释2.TabIndex = 1;
this.底部注释2.Text = "底部注释2";
//
@@ -964,7 +968,7 @@ namespace WindowsFormsApp1
this.底部注释3.AutoSize = true;
this.底部注释3.Location = new System.Drawing.Point(353, 6);
this.底部注释3.Name = "底部注释3";
this.底部注释3.Size = new System.Drawing.Size(108, 25);
this.底部注释3.Size = new System.Drawing.Size(118, 24);
this.底部注释3.TabIndex = 2;
this.底部注释3.Text = "底部注释3";
//
@@ -974,7 +978,7 @@ namespace WindowsFormsApp1
this.底部注释4.AutoSize = true;
this.底部注释4.Location = new System.Drawing.Point(528, 6);
this.底部注释4.Name = "底部注释4";
this.底部注释4.Size = new System.Drawing.Size(108, 25);
this.底部注释4.Size = new System.Drawing.Size(118, 24);
this.底部注释4.TabIndex = 3;
this.底部注释4.Text = "底部注释4";
//
@@ -984,10 +988,22 @@ namespace WindowsFormsApp1
this.底部注释5.AutoSize = true;
this.底部注释5.Location = new System.Drawing.Point(703, 6);
this.底部注释5.Name = "底部注释5";
this.底部注释5.Size = new System.Drawing.Size(108, 25);
this.底部注释5.Size = new System.Drawing.Size(118, 24);
this.底部注释5.TabIndex = 4;
this.底部注释5.Text = "底部注释5";
//
// btnToggleTestMode
//
this.btnToggleTestMode.BackColor = System.Drawing.Color.Gray;
this.btnToggleTestMode.Dock = System.Windows.Forms.DockStyle.Fill;
this.btnToggleTestMode.Location = new System.Drawing.Point(1578, 3);
this.btnToggleTestMode.Name = "btnToggleTestMode";
this.btnToggleTestMode.Size = new System.Drawing.Size(173, 30);
this.btnToggleTestMode.TabIndex = 5;
this.btnToggleTestMode.Text = "调试模式";
this.btnToggleTestMode.UseVisualStyleBackColor = false;
this.btnToggleTestMode.Click += new System.EventHandler(this.BtnToggleTestMode_Click);
//
// tableLayoutPanel7
//
this.tableLayoutPanel7.ColumnCount = 2;
@@ -996,12 +1012,12 @@ namespace WindowsFormsApp1
this.tableLayoutPanel7.Controls.Add(this.richTextBox1, 0, 0);
this.tableLayoutPanel7.Controls.Add(this.richTextBox2, 1, 0);
this.tableLayoutPanel7.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel7.Location = new System.Drawing.Point(3, 669);
this.tableLayoutPanel7.Location = new System.Drawing.Point(3, 643);
this.tableLayoutPanel7.Name = "tableLayoutPanel7";
this.tableLayoutPanel7.RowCount = 1;
this.tableLayoutPanel7.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel7.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.tableLayoutPanel7.Size = new System.Drawing.Size(1754, 294);
this.tableLayoutPanel7.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 19F));
this.tableLayoutPanel7.Size = new System.Drawing.Size(1754, 282);
this.tableLayoutPanel7.TabIndex = 10;
//
// richTextBox1
@@ -1009,7 +1025,7 @@ namespace WindowsFormsApp1
this.richTextBox1.Dock = System.Windows.Forms.DockStyle.Fill;
this.richTextBox1.Location = new System.Drawing.Point(3, 3);
this.richTextBox1.Name = "richTextBox1";
this.richTextBox1.Size = new System.Drawing.Size(871, 288);
this.richTextBox1.Size = new System.Drawing.Size(871, 276);
this.richTextBox1.TabIndex = 0;
this.richTextBox1.Text = "";
//
@@ -1018,15 +1034,15 @@ namespace WindowsFormsApp1
this.richTextBox2.Dock = System.Windows.Forms.DockStyle.Fill;
this.richTextBox2.Location = new System.Drawing.Point(880, 3);
this.richTextBox2.Name = "richTextBox2";
this.richTextBox2.Size = new System.Drawing.Size(871, 288);
this.richTextBox2.Size = new System.Drawing.Size(871, 276);
this.richTextBox2.TabIndex = 1;
this.richTextBox2.Text = "";
//
// MainForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(12F, 25F);
this.AutoScaleDimensions = new System.Drawing.SizeF(12F, 24F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1760, 1112);
this.ClientSize = new System.Drawing.Size(1760, 1068);
this.Controls.Add(this.menuStrip1);
this.Controls.Add(this.tableLayoutPanel1);
this.MainMenuStrip = this.menuStrip1;
@@ -1142,6 +1158,7 @@ namespace WindowsFormsApp1
private System.Windows.Forms.Label label7;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.Label label9;
private System.Windows.Forms.Button btnToggleTestMode;
}
}
+347 -119
View File
@@ -3,8 +3,10 @@ using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.IO.Ports;
using System.Linq;
using System.Media;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.InteropServices;
@@ -30,10 +32,15 @@ namespace WindowsFormsApp1
{
public partial class MainForm : Form
{
#region 内部变量
// 添加一个静态互斥体对象,用于防止程序多开
private static Mutex _singleInstanceMutex;
// 添加一个标志变量,用于标记是否已经执行了清理操作
private bool _isCleanupDone = false;
private bool _isFormClosing = false; // 添加标志,表示窗体正在关闭
// 添加一个静态变量来跟踪下一个要使用的槽位
// 添加标志,表示窗体正在关闭
private bool _isFormClosing = false;
// 添加一个静态变量来跟踪下一个要使用的槽位
private static int _nextEventSlot = 1;
// 在MainForm类中添加一个字典,用于存储PLC状态控件
private Dictionary<int, System.Windows.Forms.Label> plcStatusLabels = new Dictionary<int, System.Windows.Forms.Label>();
@@ -43,23 +50,35 @@ namespace WindowsFormsApp1
private System.Windows.Forms.Timer statusReportTimer = new System.Windows.Forms.Timer();
private ApiClient statusApiClient = new ApiClient(); // 专用于状态上报的API客户端
private object curingLock = new object();
private int OldPlcTrigger = 0;
private Dictionary<int, int> OldPlcTrigger = new Dictionary<int, int>();
// 在MainForm类的成员变量部分添加
private List<Label> eventNameLabels = new List<Label>();
private List<Panel> eventPanels = new List<Panel>();
private Queue<EventInfo> eventHistory = new Queue<EventInfo>();
private const int MAX_EVENT_DISPLAY = 5;
#endregion 内部变量
public MainForm()
{
if (!EnsureSingleInstance())
{
MessageBox.Show("程序已经在运行中,不能重复启动!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
Environment.Exit(0);
return;
}
InitializeComponent();
InitializeEventDisplay();
CheckForIllegalCrossThreadCalls = false;
}
// 初始化状态上报定时器
statusReportTimer.Interval = 15000; // 15秒
statusReportTimer.Tick += StatusReportTimer_Tick;
// 单实例运行的方法
private bool EnsureSingleInstance()
{
bool createdNew;
// 创建一个全局命名的互斥体
_singleInstanceMutex = new Mutex(true, "WindowsFormsApp1_MES_PLC_Control_SingleInstance", out createdNew);
return createdNew;
}
private void Form1_Load(object sender, EventArgs e)
@@ -69,20 +88,12 @@ namespace WindowsFormsApp1
LogExecute.ApilogNet.BeforeSaveToFile += LogNet_BeforeSaveToFile;
LogExecute.OEElogNet.BeforeSaveToFile += LogNet_BeforeSaveToFile;
FormRecover();
linename.Text = $"{Init.t_Line.linename}";
linecode.Text = $"Line: {Init.t_Line.lineremark1}";
linetype.Text = $"Station: {Init.t_Line.lineremark2}";
linemode.Text = $"MachineID: {Init.t_Line.lineremark3}";
//lineremark1.Text = "";
//lineremark2.Text = "";
//lineremark3.Text = "";
//lineremark4.Text = "";
//lineremark5.Text = "";
//lineremark6.Text = "";
//lineremark7.Text = "";
操作人员ID.Text = Init.t_User.username;
@@ -98,6 +109,8 @@ namespace WindowsFormsApp1
系统参数配置ToolStripMenuItem.Enabled = true;
}
// 初始化测试模式切换按钮
InitializeTestModeButton();
// 添加窗体关闭事件处理
this.FormClosing += MainForm_FormClosing;
@@ -105,9 +118,11 @@ namespace WindowsFormsApp1
// 自动开始处理
开始处理_Click(this, EventArgs.Empty);
// 初始化状态上报定时器
statusReportTimer.Interval = int.Parse(Init.t_Keyvalues.First(x => x.key == "StatusTime").value) * 1000; // 15秒
statusReportTimer.Tick += StatusReportTimer_Tick;
}
public void build(t_plc Plc, CancellationToken token)
{
// 获取当前线程名称
@@ -147,7 +162,7 @@ namespace WindowsFormsApp1
// 更新对应PLC的状态指示器为红色
UpdatePlcStatus(Plc.id, false);
LogExecute.logNet.WriteError($"{Plc.plcip}建立S7连接失败");
LogExecute.logNet.WriteError($"{Plc.plcname}:{Plc.plcip}建立S7连接失败");
continue;
}
@@ -163,7 +178,7 @@ namespace WindowsFormsApp1
{
//PLC链接状态.Text = "PLC链接状态:NG";
//PLC链接状态.BackColor = Color.Red;
LogExecute.logNet.WriteError($"{Plc.plcip}读取全部地址处理错误:处理停止");
LogExecute.logNet.WriteError($"{Plc.plcname}:{Plc.plcip}读取全部地址处理错误:处理停止");
continue;
}
@@ -174,32 +189,97 @@ namespace WindowsFormsApp1
{
//PLC链接状态.Text = "PLC链接状态:NG";
//PLC链接状态.BackColor = Color.Red;
LogExecute.logNet.WriteError($"{Plc.plcip}写入心跳错误:处理停止");
LogExecute.logNet.WriteError($"{Plc.plcname}:{Plc.plcip}写入心跳错误:处理停止");
continue;
}
//if(Plc.id == 1)
//{
//PlcData.Read_MaterialCode0 = PlcData.Write_stSN;
LOT号.Text = PlcData.Write_stSN;
Tray盘二维码.Text = PlcData.Read_MaterialCode1;
if (Init.t_Lineplcs.Count >= 2 && Plc.id == Init.t_Lineplcs.First().plcid)
{
LOT号.Text = PlcData.Write_stSN;
Tray盘二维码.Text = PlcData.Read_MaterialCode1;
}
if(Init.t_Lineplcs.Count == 1)
{
LOT号.Text = PlcData.Write_stSN;
Tray盘二维码.Text = PlcData.Read_MaterialCode1;
}
材料值.Text = PlcData.Read_MaterialCode2;
Init.ImageLocation = PlcData.Read_Other4;
Init.ImageName = PlcData.Read_Other3.ToString();
//}
#region 螺丝引导相关
// 螺丝 OK/NG
string vedioFolder = Path.Combine(Application.StartupPath, "WAV");
if (PlcData.Read_Other1 == 1 && PlcData.Write_Other0 != 1)
{
var player = new SoundPlayer(Path.Combine(vedioFolder, "OK.wav"));
player.Play();
PlcData.Write_Other0 = 1;
}
else if (PlcData.Read_Other1 == 2 && PlcData.Write_Other0 != 1)
{
var player = new SoundPlayer(Path.Combine(vedioFolder, "NOK.wav"));
player.Play();
PlcData.Write_Other0 = 1;
}
var okNgresult = siemensHelp.WriteAddress(plcaddress, PlcData);
if (!okNgresult.Success)
{
LogExecute.logNet.WriteError($"{Plc.plcip}写入OK/NG:处理停止");
continue;
}
var imageFormIsOpened = false;
foreach (Form form in Application.OpenForms)
{
if (form.Name == "ImageDisplayForm")
{
imageFormIsOpened = true;
}
}
// 开始打螺丝 1
if (PlcData.Read_Other2 == 1)
{
if (!imageFormIsOpened)
{
ThreadHelp threadHelp = new ThreadHelp();
if (!threadHelp.isrunning1)
{
threadHelp.cancellationTokenSource1 = new CancellationTokenSource();
threadHelp.Thread = new Thread(() => 螺丝引导ToolStripMenuItem_Click(this, EventArgs.Empty));
threadHelp.Thread.Name = $"imagedisplay_Thread"; // 显式设置线程名称
threadHelp.Thread.Start();
threadHelp.isrunning1 = true;
}
Init.threadHelps.Add(threadHelp);
}
}
// 结束打螺丝 0
else
{
if (imageFormIsOpened)
{
var list = Init.threadHelps.Where(x => x.Thread.Name == "imagedisplay_Thread" && x.Thread.IsAlive).ToList();
foreach (var thread in list)
{
if (thread.Thread != null)
{
thread.cancellationTokenSource1?.Cancel();
thread.Thread.Abort();
thread.isrunning1 = false;
}
Init.threadHelps.Remove(thread);
}
}
}
#endregion 螺丝引导相关
当前时间.Text = $"PLC状态:{plcstatus.GetName(typeof(plcstatus), PlcData.Read_Status)}";
DateTime Plc_Time = DateTime.Now;
//PLC链接状态.Text = "PLC链接状态:OK";
//PLC链接状态.BackColor = SystemColors.Control;
//PLC通讯时间.Text = "PLC通讯时间:" + Plc_Time.ToString("MM-dd HH:mm:ss");
// 更新对应PLC的状态指示器为绿色
//LogExecute.logNet.WriteError($"{Plc.plcname}");
UpdatePlcStatus(Plc.id, true);
#endregion
@@ -207,6 +287,7 @@ namespace WindowsFormsApp1
ApiClient apiClient = new ApiClient();
otherdata otherdata = new otherdata();
//Init.SN = PlcData.Read_MaterialCode0;
#region 机台状态及报警
//机台状态
@@ -295,13 +376,14 @@ namespace WindowsFormsApp1
#region 判断及查找流程
if (PlcData.Read_Trigger == OldPlcTrigger)
var oldtrigger = OldPlcTrigger[Plc.id];
if (PlcData.Read_Trigger == oldtrigger)
{
continue;
}
else
{
OldPlcTrigger = PlcData.Read_Trigger;
OldPlcTrigger[Plc.id] = PlcData.Read_Trigger;
}
if (PlcData.Read_Trigger == 0 && PlcData.Write_Status == 0)
@@ -324,7 +406,7 @@ namespace WindowsFormsApp1
}
continue;
}
LogExecute.logNet.WriteDebug($"读取状态字{PlcData.Read_Trigger}");
LogExecute.logNet.WriteDebug($"读取状态字{Plc.id}-{PlcData.Read_Trigger}");
var nowflow = Init.t_Flows.FirstOrDefault(a => a.hopestatus == PlcData.Read_Trigger);
if (nowflow == null)
@@ -364,6 +446,20 @@ namespace WindowsFormsApp1
// ccd 扫码,dzcan不用了
if (nowflow.dzscan)
{
//扫码
ScanForm scanForm = new ScanForm();
DialogResult scan_result = scanForm.ShowDialog();
if (scan_result == DialogResult.OK)
{
string returnValue = scanForm.ReturnValue;
材料值.Text = returnValue;
Init.DZString = returnValue;
}
else
{
continue;
}
/*
//扫码
var stationid = Init.t_Line.lineremark2;
// ccd扫码
@@ -418,7 +514,7 @@ namespace WindowsFormsApp1
//MES通讯时间.Text = "MES通讯时间:" + DateTime.Now.ToString("MM-dd HH:mm:ss");
}
continue;
*/
//if (scan_result == DialogResult.OK)
//{
// string returnValue = scanForm.ReturnValue;
@@ -489,71 +585,75 @@ namespace WindowsFormsApp1
}
#endregion
#region 判断物料调用次数 固化站
#region 判断物料调用次数 固化站,抽真空
lock (curingLock)
{
if (Init.t_Line.lineremark2 == "Curing")
bool shouldCallApi = false;
if (Init.t_Line.lineremark2.ToLower() == "curing")
{
SQLiteHelper<t_materialcall> materialCallHelper = new SQLiteHelper<t_materialcall>();
string materialId = PlcData.Read_MaterialCode0;
bool shouldCallApi = false;
string materialId = PlcData.Read_MaterialCode1;
var materialCall = materialCallHelper.QuerySingle(m => m.materialid == materialId).Data;
if (materialCall == null)
var materialCall = materialCallHelper.QuerySingle(m => m.materialid == materialId
&& !m.isout).Data;
// plc1 进 plc2,3 加热,冷却,plc3 出
if (Plc.id == 1)
{
// 首次进站,需要调用接口
materialCall = new t_materialcall { materialid = materialId };
materialCall.checkin1 = DateTime.Now;
materialCallHelper.Insert(materialCall);
shouldCallApi = true;
}
else
{
// 判断当前是第几次调用
if (!materialCall.checkin1.HasValue)
// checkin callapi
if (nowinterface.code.Contains("SN_CheckIN"))
{
materialCall = new t_materialcall { materialid = materialId };
materialCall.sn = "testsn";
materialCall.checkin1 = DateTime.Now;
materialCallHelper.Insert(materialCall);
shouldCallApi = true;
}
else if (!materialCall.checkout3.HasValue
&& materialCall.checkout2.HasValue
&& materialCall.checkout1.HasValue
&& nowinterface.code.Contains("Checkout"))
else if (nowinterface.code.Contains("Checkout"))
{
materialCall.checkout1 = DateTime.Now;
materialCall.sn = PlcData.Write_stSN;
materialCallHelper.Update(materialCall);
}
}
else if (Plc.id == 2 || Plc.id == 3)
{
if (nowinterface.code.Contains("SN_CheckIN"))
{
materialCall.checkin2 = DateTime.Now;
materialCallHelper.Update(materialCall);
PlcData.Write_stSN = materialCall.sn;
}
else if (nowinterface.code.Contains("Checkout"))
{
materialCall.checkout2 = DateTime.Now;
materialCallHelper.Update(materialCall);
}
}
else if (Plc.id == 4)
{
//checkout callapi
if (nowinterface.code.Contains("SN_CheckIN"))
{
materialCall.checkin3 = DateTime.Now;
materialCallHelper.Update(materialCall);
PlcData.Write_stSN = materialCall.sn;
}
else if (nowinterface.code.Contains("Checkout"))
{
// 第三次出站,需要调用接口
materialCall.checkout3 = DateTime.Now;
materialCall.isout = true;
materialCallHelper.Update(materialCall);
shouldCallApi = true;
}
else
{
// 更新对应的时间
if (nowinterface.code.Contains("SN_CheckIN"))
{
if (!materialCall.checkin2.HasValue)
materialCall.checkin2 = DateTime.Now;
else if (!materialCall.checkin3.HasValue)
materialCall.checkin3 = DateTime.Now;
PlcData.Write_Status = PLC_Status.SN_CheckIN;
}
else if (nowinterface.code.Contains("SN_Checkout"))
{
if (!materialCall.checkout1.HasValue)
materialCall.checkout1 = DateTime.Now;
else if (!materialCall.checkout2.HasValue)
materialCall.checkout2 = DateTime.Now;
PlcData.Write_Status = PLC_Status.SN_Checkout;
}
}
materialCallHelper.Update(materialCall);
}
if (!shouldCallApi)
{
// 不需要调用接口,直接返回成功
PlcData.Write_Status = nowinterface.code.Contains("SN_CheckIN")
? (short)PLC_Status.SN_CheckIN
: (short)PLC_Status.SN_Checkout;
PlcData.Write_Status = PlcData.Read_Trigger;
var writeresult = siemensHelp.WriteAddress(plcaddress, PlcData);
if (!writeresult.Success)
{
@@ -563,6 +663,42 @@ namespace WindowsFormsApp1
continue;
}
}
/* else if (Init.t_Line.lineremark2.ToLower() == "vacuum")
{
//抽真空,两个穴位,判断是否重复进站
SQLiteHelper<t_materialcall> materialCallHelper = new SQLiteHelper<t_materialcall>();
string materialId = PlcData.Read_MaterialCode1;
var materialCall = materialCallHelper.QuerySingle(m => m.materialid == materialId
&& !m.isout).Data;
if (materialCall == null)
{
//首次进站 in
materialCall.materialid = materialId;
materialCallHelper.Insert(materialCall);
shouldCallApi = true;
}
else if (materialCall.isout)
{
//不交互MES,直接返回状态字
PlcData.Write_Status = PlcData.Read_Trigger;
var writeresult = siemensHelp.WriteAddress(plcaddress, PlcData);
if (!writeresult.Success)
{
LogExecute.logNet.WriteError($"{Plc.plcip}写入地址处理错误:处理停止");
continue;
}
continue;
}
else
{
// out
materialCall.isout = true;
materialCallHelper.Update(materialCall);
shouldCallApi = true;
}
}*/
}
#endregion
@@ -570,6 +706,7 @@ namespace WindowsFormsApp1
otherdata.FileUploadAddress = Init.t_Keyvalues.First(x => x.key == "UploadPath").value;
otherdata.ImageAddress = Init.t_Keyvalues.First(x => x.key == "ImageFilePath").value;
otherdata.VedioAddress = Init.t_Keyvalues.First(x => x.key == "VedioFilePath").value;
otherdata.plcid = Plc.id;
#region 调用后端接口
var result = apiClient.CallFunctionByName(nowinterface.code, PlcData, otherdata);
@@ -580,25 +717,33 @@ namespace WindowsFormsApp1
if (result.Success)
{
ChangeBarcode();
MES_MsgfORM(nowinterface.code, result, result.Requesttime);
var writeresult = siemensHelp.WriteAddress(plcaddress, PlcData);
if (!writeresult.Success)
{
//PLC链接状态.Text = "PLC链接状态:NG";
//PLC链接状态.BackColor = Color.Red;
LogExecute.logNet.WriteError($"{Plc.plcip}写入地址处理错误:处理停止");
LogExecute.logNet.WriteError($"{Plc.plcname}:{Plc.plcip}写入地址处理错误:处理停止");
continue;
}
else
{
ChangeBarcode();
MES_MsgfORM(nowinterface.code, result, result.Requesttime);
LogExecute.logNet.WriteDebug($"上位机写入触发字:{PlcData.Write_Status}");
//MES链接状态.Text = "MES链接状态:OK";
//MES链接状态.BackColor = SystemColors.Control;
//MES通讯时间.Text = "MES通讯时间:" + DateTime.Now.ToString("MM-dd HH:mm:ss");
if (result.Mesresult != mesresult.PASS)
{
PlcData.Write_Status = 1001;
if (resdresult.Msg.Contains("机台上料数量不够扣料"))
{
PlcData.Write_Status = 1003;
}
else if (resdresult.Msg.Contains("此载具为空"))
{
PlcData.Write_Status = 1004;
}
else
{
PlcData.Write_Status = 1001;
}
siemensHelp.WriteAddress(plcaddress, PlcData);
continue;
}
@@ -606,8 +751,6 @@ namespace WindowsFormsApp1
}
else
{
//MES链接状态.Text = "MES链接状态:NG";
//MES链接状态.BackColor = Color.Red;
LogExecute.logNet.WriteError($"MES通讯异常!");
PlcData.Write_Status = 1002;
siemensHelp.WriteAddress(plcaddress, PlcData);
@@ -706,7 +849,10 @@ namespace WindowsFormsApp1
return;
}
foreach (var item in Init.t_Lineplcs)
{
OldPlcTrigger.Add(item.plcid, 0);
}
#region 初始化全局变量
@@ -720,10 +866,12 @@ namespace WindowsFormsApp1
// 初始化PLC状态面板
InitializePlcStatusPanel();
// 启动状态上报定时器
statusReportTimer.Start();
#endregion
#region 初始化COM口服务
try
{
@@ -793,6 +941,11 @@ namespace WindowsFormsApp1
Init.threadHelps.Add(threadHelp);
}
if(Init.t_User.username.ToLower() != "admin")
{
this.btnToggleTestMode.Enabled = false;
}
开始处理.Text = "停止处理";
开始处理.BackColor = Color.Red;
LogExecute.logNet.WriteInfo($"用户{Init.t_User.username},开始处理!");
@@ -853,6 +1006,14 @@ namespace WindowsFormsApp1
}
});
}
// 释放互斥体
if (_singleInstanceMutex != null)
{
_singleInstanceMutex.ReleaseMutex();
_singleInstanceMutex.Close();
_singleInstanceMutex = null;
}
}
// 添加一个清理资源的私有方法
@@ -911,6 +1072,7 @@ namespace WindowsFormsApp1
}
#endregion
#region 页面按钮-跳转
private void 扭力角度扭矩设置ToolStripMenuItem_Click(object sender, EventArgs e)
{
@@ -923,6 +1085,7 @@ namespace WindowsFormsApp1
Torqueaddress_Manage torqueaddress_Manage = new Torqueaddress_Manage();
torqueaddress_Manage.ShowDialog();
}
private void 流程管理ToolStripMenuItem_Click(object sender, EventArgs e)
{
Flow_Manage fLOW_Mange = new Flow_Manage();
@@ -947,12 +1110,6 @@ namespace WindowsFormsApp1
materialScanForm.Show();
}
//private void 图片展示ToolStripMenuItem_Click(object sender, EventArgs e)
//{
// ImageDisplayForm displayForm = new ImageDisplayForm();
// displayForm.Show();
//}
private void pLC通讯设置ToolStripMenuItem_Click(object sender, EventArgs e)
{
Plc_Manage pLC_Manage = new Plc_Manage();
@@ -964,6 +1121,7 @@ namespace WindowsFormsApp1
PlcAddress_Manage pLCADDRESS_Manage = new PlcAddress_Manage();
pLCADDRESS_Manage.ShowDialog();
}
private void 切换用户ToolStripMenuItem_Click(object sender, EventArgs e)
{
Application.Restart();
@@ -992,7 +1150,27 @@ namespace WindowsFormsApp1
SerialPort_Manage serialPort_Manage = new SerialPort_Manage();
serialPort_Manage.ShowDialog();
}
private void 图片标注ToolStripMenuItem_Click(object sender, EventArgs e)
{
SimpleImageDisplayForm simpleImageDisplayForm = new SimpleImageDisplayForm();
simpleImageDisplayForm.ShowDialog();
}
private void 螺丝引导ToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
ImageDisplayForm imageDisplayForm = new ImageDisplayForm();
imageDisplayForm.SetCurrentName(Init.ImageName);
imageDisplayForm.ShowDialog();
}
catch
{
}
}
#endregion
#region 页面-布局、日志等
private void LogNet_BeforeSaveToFile(object sender, HslEventArgs e)
{
@@ -1094,6 +1272,7 @@ namespace WindowsFormsApp1
{
当前时间.Text = "当前时间:" + DateTime.Now.ToString("MM-dd HH:mm:ss");
}
public void FormRecover()
{
开始处理.Text = "开始处理";
@@ -1124,6 +1303,7 @@ namespace WindowsFormsApp1
剩余寿命.Text = power == null ? "" : power.value;
}
#region PLC状态面板
// 添加初始化PLC状态面板的方法
private void InitializePlcStatusPanel()
{
@@ -1208,13 +1388,16 @@ namespace WindowsFormsApp1
// 使用Invoke确保在UI线程上更新控件
this.Invoke((MethodInvoker)delegate
{
plcStatusIndicators[plcId].BackColor = Color.Gray;
plcStatusIndicators[plcId].BackColor = isConnected ? Color.Green : Color.Red;
});
}
}
catch { /* 忽略异常 */ }
}
#endregion PLC状态面板
#region 事件显示区域
// 添加初始化事件显示区域的方法
private void InitializeEventDisplay()
{
@@ -1290,6 +1473,7 @@ namespace WindowsFormsApp1
eventHistory = new Queue<EventInfo>();
}
// 修改UpdateEventDisplay方法
private void UpdateEventDisplay(string name, mesresult result, DateTime dateTime, string message)
{
@@ -1354,7 +1538,7 @@ namespace WindowsFormsApp1
}
}
// 修改MES_MsgfORM方法
// 显示信息
public void MES_MsgfORM(string name, ApiFormResult result, DateTime dateTime)
{
if ("status,alarm".Contains(name.ToLower()))
@@ -1365,22 +1549,19 @@ namespace WindowsFormsApp1
MES提示信息.ForeColor = result.Mesresult == mesresult.PASS ? Color.Green : Color.Red;
事件结果.Visible = true;
事件结果.Text = result.Mesresult == mesresult.PASS ? "PASS" : "FIELD";
事件结果.Text = result.Mesresult == mesresult.PASS ? "PASS" : "FAIL";
事件结果.ForeColor = result.Mesresult == mesresult.PASS ? Color.Green : Color.Red;
// 更新事件显示区域
UpdateEventDisplay(name, result.Mesresult, dateTime, result.Msg);
}
#endregion 事件显示区域
#endregion
#region 其他业务处理
private void 胶水上下线_Click(object sender, EventArgs e)
{
ScanForm_SSQ scanForm = new ScanForm_SSQ();
DialogResult result = scanForm.ShowDialog();
// 写plc
}
//气密接收
public void AirtightPort_DataReceived(object sender, SerialDataReceivedEventArgs e)
{
try
@@ -1469,15 +1650,73 @@ namespace WindowsFormsApp1
LogExecute.logNet.WriteError($"通过气密仪获取到压力参数失败,错误原因{ex.Message}");
}
}
// 在初始化组件的方法中添加按钮
private void InitializeTestModeButton()
{
// 初始化按钮状态
UpdateTestModeButtonState();
}
// 切换测试模式的事件处理程序
private void BtnToggleTestMode_Click(object sender, EventArgs e)
{
// 获取当前模式并切换
SQLiteHelper<t_keyvalue> kvHelper = new db.SQLiteHelper<t_keyvalue>();
var testModeSetting = kvHelper.QuerySingle(x => x.key == "TestMode");
bool currentMode = testModeSetting.Success ? testModeSetting.Data.value == "1" : true;
// 切换模式
bool newMode = !currentMode;
// 更新数据库
if (testModeSetting.Success)
{
testModeSetting.Data.value = newMode ? "1" : "0";
kvHelper.Update(testModeSetting.Data);
}
else
{
// 如果设置不存在,创建新的设置
t_keyvalue newSetting = new t_keyvalue
{
key = "TestMode",
value = newMode ? "1" : "0",
remark = "接口测试模式:1=调试模式,0=MES模式"
};
kvHelper.Insert(newSetting);
}
// 更新按钮状态
UpdateTestModeButtonState();
// 显示提示
MessageBox.Show(newMode ? "已切换到调试模式,不调用实际接口" : "已切换到MES模式,将调用实际接口");
// 记录日志
LogExecute.logNet.WriteInfo($"用户{Init.t_User.username}切换接口模式为: {(newMode ? "调试模式" : "MES模式")}");
}
// 更新测试模式按钮状态
private void UpdateTestModeButtonState()
{
SQLiteHelper<t_keyvalue> kvHelper = new db.SQLiteHelper<t_keyvalue>();
var testModeSetting = kvHelper.QuerySingle(x => x.key == "TestMode");
bool isTestMode = testModeSetting.Success ? testModeSetting.Data.value == "1" : true;
btnToggleTestMode.Text = $"{(isTestMode ? "调试模式" : "MES模式")}";
btnToggleTestMode.BackColor = isTestMode ? Color.LightPink : Color.LightGreen;
}
#endregion
#region 定时器
// 添加状态上报定时器的事件处理方法
private void StatusReportTimer_Tick(object sender, EventArgs e)
{
try
{
// 如果没有PLC数据或者状态为0,则不上报
if (Init.Plcstatus == 0)
if (Init.Plcstatus == 0 || Init.Plcstatus == -1)
return;
otherdata statusOtherData = new otherdata();
@@ -1503,17 +1742,6 @@ namespace WindowsFormsApp1
LogExecute.logNet.WriteError($"定时上报机台状态异常: {ex.Message}");
}
}
private void 图片标注ToolStripMenuItem_Click(object sender, EventArgs e)
{
SimpleImageDisplayForm simpleImageDisplayForm = new SimpleImageDisplayForm();
simpleImageDisplayForm.ShowDialog();
}
private void 螺丝引导ToolStripMenuItem_Click(object sender, EventArgs e)
{
ImageDisplayForm imageDisplayForm = new ImageDisplayForm();
imageDisplayForm.ShowDialog();
}
#endregion 定时器
}
}
+1
View File
@@ -54,6 +54,7 @@ namespace WindowsFormsApp1
public static List<ThreadHelp> threadHelps;
public static string ScanString;
public static string DZString;
//PLC状态存储
public static short Plcstatus = -1;
+292 -48
View File
@@ -5,6 +5,8 @@ using System.ComponentModel;
using System.IO;
using WindowsFormsApp1.mod;
using WindowsFormsApp1.db;
using System.Collections.Generic;
using System.Linq;
namespace WindowsFormsApp1
{
@@ -26,10 +28,30 @@ namespace WindowsFormsApp1
// 圆形标记相关参数
private float currentRadius = 20f;
private const float MIN_RADIUS = 20f;
private const float MAX_RADIUS = 50f;
private const float MIN_RADIUS = 30f;
private const float MAX_RADIUS = 55f;
private bool isExpanding = true;
private const float RADIUS_CHANGE_SPEED = 2f;
// 添加上一个位置的坐标
private int previousX = -1;
private int previousY = -1;
private bool hasPreviousPosition = false;
// 添加所有点位的列表
private List<t_imageposition> allPositions = new List<t_imageposition>();
private bool showAllPositions = true;
// 添加历史位置列表
private List<PositionHistory> previousPositions = new List<PositionHistory>();
// 定义历史位置类
private class PositionHistory
{
public int X { get; set; }
public int Y { get; set; }
public string Position { get; set; }
}
#endregion
#region 构造函数和初始化
@@ -43,6 +65,25 @@ namespace WindowsFormsApp1
autoUpdateTimer.Interval = 1000;
autoUpdateTimer.Tick += new EventHandler(AutoUpdateTimer_Tick);
autoUpdateTimer.Start();
// 添加窗体加载事件
this.Load += ImageDisplayForm_Load;
}
private void ImageDisplayForm_Load(object sender, EventArgs e)
{
// 设置窗体大小为屏幕工作区的80%
Screen screen = Screen.FromControl(this);
this.Size = new Size(
(int)(screen.WorkingArea.Width * 0.8),
(int)(screen.WorkingArea.Height * 0.8)
);
this.CenterToScreen();
// 或者使用以下代码设置为全屏但非最大化
// this.WindowState = FormWindowState.Normal;
// this.FormBorderStyle = FormBorderStyle.None;
// this.Bounds = Screen.FromControl(this).Bounds;
}
#endregion
@@ -98,6 +139,9 @@ namespace WindowsFormsApp1
originalImage = new Bitmap(imagePath);
markedImage = new Bitmap(originalImage);
pictureBox.Image = markedImage;
// 加载所有点位并标注
LoadAllPositions(name);
}
catch (Exception ex)
{
@@ -110,56 +154,101 @@ namespace WindowsFormsApp1
}
}
// 在图像上绘制标记
private void DrawMark(int x, int y)
// 加载所有点位并标注
private void LoadAllPositions(string name)
{
try
{
SQLiteHelper<t_imageposition> sQLiteHelper_position = new db.SQLiteHelper<t_imageposition>();
allPositions = sQLiteHelper_position.Query(x => x.name == name).Data;
if (allPositions != null && allPositions.Count > 0)
{
// 重新绘制图像,标注所有点位
RedrawImage();
}
}
catch (Exception ex)
{
Console.WriteLine($"加载所有点位失败:{ex.Message}");
}
}
// 重新绘制图像,包括所有标记
private void RedrawImage()
{
if (originalImage == null)
return;
// 创建新的标记图像
if (markedImage != null)
markedImage.Dispose();
markedImage = new Bitmap(originalImage);
using (Graphics g = Graphics.FromImage(markedImage))
{
if (isBlinking)
// 设置高质量绘图模式
g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
// 绘制所有点位(白色实心圆和序号)
if (showAllPositions && allPositions != null)
{
// 设置高质量绘图模式
g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
// 只绘制白色圆
using (Brush whiteBrush = new SolidBrush(Color.White))
for (int i = 0; i < allPositions.Count; i++)
{
g.FillEllipse(whiteBrush,
x - currentRadius,
y - currentRadius,
currentRadius * 2,
currentRadius * 2);
}
var pos = allPositions[i];
// 更新半径
if (isExpanding)
{
currentRadius += RADIUS_CHANGE_SPEED;
if (currentRadius >= MAX_RADIUS)
// 绘制白色实心圆
using (Brush whiteBrush = new SolidBrush(Color.White))
{
currentRadius = MAX_RADIUS;
isExpanding = false;
g.FillEllipse(whiteBrush,
pos.x - MIN_RADIUS,
pos.y - MIN_RADIUS,
MIN_RADIUS * 2,
MIN_RADIUS * 2);
}
}
else
{
currentRadius -= RADIUS_CHANGE_SPEED;
if (currentRadius <= MIN_RADIUS)
// 绘制白色序号
using (Font font = new Font("Arial", 16, FontStyle.Bold))
using (Brush textBrush = new SolidBrush(Color.Black))
{
currentRadius = MIN_RADIUS;
isExpanding = true;
string text = pos.position; // 使用position属性
SizeF textSize = g.MeasureString(text, font);
g.DrawString(text, font, textBrush,
pos.x - textSize.Width / 2,
pos.y - textSize.Height / 2);
}
}
}
// 绘制所有历史位置的绿色标记
foreach (var history in previousPositions)
{
using (Brush greenBrush = new SolidBrush(Color.Green))
{
g.FillEllipse(greenBrush,
history.X - MIN_RADIUS,
history.Y - MIN_RADIUS,
MIN_RADIUS * 2,
MIN_RADIUS * 2);
}
// 绘制绿色标记上的文字
using (Font font = new Font("Arial", 16, FontStyle.Bold))
using (Brush textBrush = new SolidBrush(Color.White))
{
string text = history.Position;
SizeF textSize = g.MeasureString(text, font);
g.DrawString(text, font, textBrush,
history.X - textSize.Width / 2,
history.Y - textSize.Height / 2);
}
}
}
pictureBox.Image = markedImage;
}
#endregion
#region 数据查询和更新
// 自动更新定时器事件
private void AutoUpdateTimer_Tick(object sender, EventArgs e)
{
@@ -169,6 +258,48 @@ namespace WindowsFormsApp1
if (newPosition != currentPosition || (string.IsNullOrEmpty(currentPosition) && !string.IsNullOrEmpty(newPosition)))
{
// 保存上一个位置
if (!string.IsNullOrEmpty(currentPosition))
{
SQLiteHelper<t_imageposition> sQLiteHelper_position = new db.SQLiteHelper<t_imageposition>();
var positions = sQLiteHelper_position.Query(x => x.name == currentName
&& x.position == currentPosition).Data;
if (positions != null && positions.Count > 0)
{
var pos = positions[0];
// 检查是否已经存在相同位置的历史记录
bool exists = false;
foreach (var history in previousPositions)
{
if (history.X == pos.x && history.Y == pos.y)
{
// 更新位置文本
history.Position = currentPosition;
exists = true;
break;
}
}
// 如果不存在,添加到历史记录
if (!exists)
{
previousPositions.Add(new PositionHistory
{
X = pos.x,
Y = pos.y,
Position = currentPosition
});
}
// 设置最近的历史位置
previousX = pos.x;
previousY = pos.y;
hasPreviousPosition = true;
}
}
currentPosition = newPosition;
// 如果名称和位置都有值,则查询坐标并标注
@@ -193,49 +324,162 @@ namespace WindowsFormsApp1
{
try
{
SQLiteHelper<t_imageposition> sQLiteHelper_position = new db.SQLiteHelper<t_imageposition>();
var positions = sQLiteHelper_position.Query(x => x.name == name
&& x.position == position).Data;
// 从已加载的点位列表中查找,避免重复查询数据库
var pos = allPositions?.FirstOrDefault(x => x.name == name && x.position == position);
if (positions != null && positions.Count > 0)
if (pos != null)
{
var pos = positions[0];
// 标记位置
if (originalImage != null)
{
isBlinking = true; // 设置为 true 后不再切换
currentRadius = MIN_RADIUS; // 重置半径
blinkTimer.Start();
// 确保闪烁定时器已启动
if (blinkTimer != null && !blinkTimer.Enabled)
blinkTimer.Start();
// 在图像上绘制标记
DrawMark(pos.x, pos.y);
}
}
else
{
// 如果在内存中没有找到,尝试从数据库查询
SQLiteHelper<t_imageposition> sQLiteHelper_position = new db.SQLiteHelper<t_imageposition>();
var positions = sQLiteHelper_position.Query(x => x.name == name && x.position == position).Data;
if (positions != null && positions.Count > 0)
{
pos = positions[0];
// 添加到内存中的列表
if (!allPositions.Any(x => x.name == name && x.position == position))
{
allPositions.Add(pos);
}
// 标记位置
if (originalImage != null)
{
isBlinking = true;
currentRadius = MIN_RADIUS;
if (blinkTimer != null && !blinkTimer.Enabled)
blinkTimer.Start();
DrawMark(pos.x, pos.y);
}
}
else
{
// 如果没有找到对应的位置,停止闪烁
isBlinking = false;
blinkTimer?.Stop();
// 仍然重绘图像以显示所有点位和之前的绿色标记
RedrawImage();
Console.WriteLine($"未找到名称为 {name} 位置为 {position} 的坐标");
}
}
}
catch (Exception ex)
{
Console.WriteLine($"查询坐标失败:{ex.Message}");
// 发生异常时也重绘图像
RedrawImage();
}
}
#endregion
#region 事件处理
// 在图像上绘制标记
private void DrawMark(int x, int y)
{
if (originalImage == null)
return;
// 先重新绘制基础图像(包含所有点位标记)
RedrawImage();
using (Graphics g = Graphics.FromImage(markedImage))
{
// 设置高质量绘图模式
g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
if (isBlinking)
{
// 绘制当前位置的黄色实心圆
using (Brush brush = new SolidBrush(Color.Yellow))
{
g.FillEllipse(brush,
x - MIN_RADIUS,
y - MIN_RADIUS,
MIN_RADIUS * 2,
MIN_RADIUS * 2);
}
// 绘制白色数字标记
using (Font font = new Font("Arial", 16, FontStyle.Bold))
using (Brush textBrush = new SolidBrush(Color.Black))
{
string text = currentPosition;
SizeF textSize = g.MeasureString(text, font);
g.DrawString(text, font, textBrush,
x - textSize.Width / 2,
y - textSize.Height / 2);
}
// 绘制黄色虚线空心圆闪烁效果
using (Pen yellowPen = new Pen(Color.Yellow, 2))
{
yellowPen.DashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
g.DrawEllipse(yellowPen,
x - currentRadius,
y - currentRadius,
currentRadius * 2,
currentRadius * 2);
}
}
}
pictureBox.Image = markedImage;
}
// 闪烁定时器事件
private void BlinkTimer_Tick(object sender, EventArgs e)
{
SQLiteHelper<t_imageposition> sQLiteHelper_position = new db.SQLiteHelper<t_imageposition>();
var positions = sQLiteHelper_position.Query(x => x.name == currentName
&& x.position == currentPosition).Data;
// 从已加载的点位列表中查找当前位置
var pos = allPositions?.FirstOrDefault(x => x.name == currentName && x.position == currentPosition);
if (positions != null && positions.Count > 0)
if (pos != null)
{
var pos = positions[0];
// 直接调用DrawMark方法绘制标记
DrawMark(pos.x, pos.y);
// 更新半径
if (isExpanding)
{
currentRadius += RADIUS_CHANGE_SPEED;
if (currentRadius >= MAX_RADIUS)
{
currentRadius = MAX_RADIUS;
isExpanding = false;
}
}
else
{
currentRadius -= RADIUS_CHANGE_SPEED;
if (currentRadius <= MIN_RADIUS)
{
currentRadius = MIN_RADIUS;
isExpanding = true;
}
}
}
}
// 移除了 BtnLoadImage_Click 事件处理程序
#endregion
#region 资源释放
protected override void Dispose(bool disposing)
{
@@ -42,6 +42,7 @@ namespace WindowsFormsApp1
else
{
MessageBox.Show("扫码枪串口未配置,请检查系统设置", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
_dbHelper = new SQLiteHelper<t_materialscan>();
_apiClient = new ApiClient();
+11 -2
View File
@@ -104,8 +104,17 @@ namespace WindowsFormsApp1
{
端子1校验.Text = "校验OK";
}));
// 写数据到 主页的barcode 数据库改,缓存改
var txt = Init.t_Keyvalues.FirstOrDefault(a => a.key == "Barcode1");
txt.value = 端子1.Text;
var code = key_sqlresult.Data.First(x => x.key == txt.key);
code.value = 端子1.Text;
sQLiteHelper_key.Update(code);
//继续调用接口
var result2 = ApiClient.CallFunctionByName("Link_Comp", PlcData, new otherdata() { JS_SN = barcode });
/*var result2 = ApiClient.CallFunctionByName("Link_Comp", PlcData, new otherdata() { JS_SN = barcode });
if (result2.Success && result2.Mesresult == mesresult.PASS)
{
this.Invoke(new Action(() =>
@@ -127,7 +136,7 @@ namespace WindowsFormsApp1
{
端子1结果.Text = "绑定NG";
}));
}
}*/
}
else
{
@@ -34,7 +34,7 @@ namespace WindowsFormsApp1
// 圆形标记相关参数
private float currentRadius = 20f;
private const float MIN_RADIUS = 20f;
private const float MIN_RADIUS = 25f;
private const float MAX_RADIUS = 50f;
private bool isExpanding = true;
private const float RADIUS_CHANGE_SPEED = 2f;
@@ -44,6 +44,24 @@ namespace WindowsFormsApp1
public SimpleImageDisplayForm()
{
InitializeComponent();
// 添加窗体加载事件
this.Load += ImageDisplayForm_Load;
}
private void ImageDisplayForm_Load(object sender, EventArgs e)
{
// 设置窗体大小为屏幕工作区的80%
Screen screen = Screen.FromControl(this);
this.Size = new Size(
(int)(screen.WorkingArea.Width * 0.8),
(int)(screen.WorkingArea.Height * 0.8)
);
this.CenterToScreen();
// 或者使用以下代码设置为全屏但非最大化
// this.WindowState = FormWindowState.Normal;
// this.FormBorderStyle = FormBorderStyle.None;
// this.Bounds = Screen.FromControl(this).Bounds;
}
#endregion
@@ -53,7 +71,7 @@ namespace WindowsFormsApp1
{
if (originalImage == null)
return;
markedImage.Dispose();
markedImage = new Bitmap(originalImage);
using (Graphics g = Graphics.FromImage(markedImage))
{
@@ -63,9 +81,9 @@ namespace WindowsFormsApp1
g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
// 只绘制白色圆
using (Brush whiteBrush = new SolidBrush(Color.White))
using (var brush = new Pen(Color.Yellow))
{
g.FillEllipse(whiteBrush,
g.DrawEllipse(brush,
x - currentRadius,
y - currentRadius,
currentRadius * 2,
@@ -7,6 +7,7 @@ using SQLite;
namespace WindowsFormsApp1.mod
{
[Table("t_imageposition")]
public class t_imageposition
{
[PrimaryKey, AutoIncrement]
@@ -9,6 +9,8 @@ namespace WindowsFormsApp1.mod
[PrimaryKey, AutoIncrement]
public int id { get; set; }
public string materialid { get; set; }
public string sn { get; set; }
public bool isout { get; set; }
public DateTime? checkin1 { get; set; }
public DateTime? checkin2 { get; set; }
public DateTime? checkin3 { get; set; }
@@ -0,0 +1,19 @@
using SQLite;
using System;
namespace WindowsFormsApp1.mod
{
[Table("material_upload")]
public class t_materialupload
{
[PrimaryKey, AutoIncrement]
public int id { get; set; }
public string sn { get; set; }
// plc·´À¡µÄ½á¹û£¬ok/ng
public string result { get; set; }
public int imageUploaded { get; set; }
public int vedioUploaded { get; set; }
public int datacollectionUploaded { get; set; }
public string date { get; set; }
}
}
+2
View File
@@ -76,6 +76,8 @@ namespace WindowsFormsApp1.mod.server
/// 上下料操作 上料:1;下料 2
/// </summary>
public int opindex { get; set; }
public int plcid { get; set; }
}
+172 -96
View File
@@ -35,6 +35,7 @@ namespace WindowsFormsApp1.server
private readonly string _token;
private readonly string _fixsn;
private readonly string _logBasePath;
private static bool _isTestMode = true; // 默认为测试模式
public ApiClient()
{
@@ -46,6 +47,13 @@ namespace WindowsFormsApp1.server
var apiList = helper.QueryAll().Data.Select(x => new { x.code, url = x.url + x.code }).ToList();
apiUrlDict = apiList.ToDictionary(x => x.code, x => x.url);
SQLiteHelper<t_keyvalue> kvHelper = new db.SQLiteHelper<t_keyvalue>();
var testModeSetting = kvHelper.QuerySingle(x => x.key == "TestMode");
if (testModeSetting.Success)
{
_isTestMode = testModeSetting.Data.value == "1";
}
// 从配置中读取通用参数
_line = Init.t_Line.lineremark1;
_stationID = Init.t_Line.lineremark2;
@@ -58,7 +66,7 @@ namespace WindowsFormsApp1.server
// 初始化 CsvLogger
// 初始化日志路径
_logBasePath = Path.Combine(@"C:\", "Logs", $"logs.csv");
_logBasePath = Path.Combine(@"D:\", "Logs", $"logs.csv");
// 初始化CSV日志记录器
CsvLogger.Initialize(_logBasePath);
@@ -95,7 +103,7 @@ namespace WindowsFormsApp1.server
break;
case "sealant":
headers.Add("胶宽");
headers.Add("CCD结果");
headers.Add("胶高");
break;
case "curing":
headers.Add("固化温度");
@@ -125,108 +133,110 @@ namespace WindowsFormsApp1.server
var httpContent = new StringContent(jsonPayload, Encoding.UTF8, "application/json");
#region test
// 回写对应PLC
if (statusCode > 0)
PlcData.Write_Status = (short)statusCode;
if (eventName == "SN_Release" || eventName == "SN_CheckIN")
PlcData.Write_stSN = "testsn";
LogExecute.logNet.WriteDebug($"{eventName} 测ui接口请求成功\n请求:{jsonPayload}\n");
return ApiFormResult.Sucess(mesresult.PASS, true, "PASS", PlcData, DateTime.Now);
if (_isTestMode)
{
// 回写对应PLC
if (statusCode > 0)
PlcData.Write_Status = (short)statusCode;
if (eventName == "SN_Release" || eventName == "SN_CheckIN")
PlcData.Write_stSN = "TEST MODE testsn";
LogExecute.logNet.WriteDebug($"{eventName} 测试接口请求成功\n请求:{jsonPayload}\n");
return ApiFormResult.Sucess(mesresult.PASS, true, "PASS", PlcData, DateTime.Now);
}
#endregion test
#region 正式调用接口
/*try
else
{
#region MES交互
var response = _httpClient.PostAsync(url, httpContent).Result;
// 检查响应状态码
if (response.IsSuccessStatusCode)
try
{
// 读取响应内容
string responseContent = response.Content.ReadAsStringAsync().Result;
#region MES交互
// 使用 Newtonsoft.Json 将响应内容反序列化为动态对象
dynamic res = JsonConvert.DeserializeObject(responseContent);
// 访问动态对象的属性
if (res != null)
var response = _httpClient.PostAsync(url, httpContent).Result;
// 检查响应状态码
if (response.IsSuccessStatusCode)
{
LogExecute.logNet.WriteDebug($"{eventName} 接口请求成功\n请求:{jsonPayload}\n 返回: {responseContent}");
// 读取响应内容
string responseContent = response.Content.ReadAsStringAsync().Result;
// 成功!
if (res.Result != null && !string.IsNullOrEmpty(res.Result.Value))
// 使用 Newtonsoft.Json 将响应内容反序列化为动态对象
dynamic res = JsonConvert.DeserializeObject(responseContent);
// 访问动态对象的属性
if (res != null)
{
var result = res.Result.Value == "PASS";
LogExecute.logNet.WriteDebug($"{eventName} 接口请求成功\n请求:{jsonPayload}\n 返回: {responseContent}");
if (result)
// 成功!
if (res.Result != null && !string.IsNullOrEmpty(res.Result.Value))
{
var result = res.Result.Value == "PASS";
if (result)
{
// 回写对应PLC
if (statusCode > 0)
PlcData.Write_Status = (short)statusCode;
if (eventName == "SN_Release" || eventName == "SN_CheckIN")
PlcData.Write_stSN = res.SN.Value;
if (eventName == "SN_FeedingCheck")
{
var station = Init.t_Line.lineremark2.ToLower();
switch (station)
{
case "potting"://灌胶
case "thermalpaste"://点胶&CCD检测
case "uvcoating"://三防漆涂覆
case "sealant"://点密封胶&CCD
var power = Init.t_Keyvalues.First(x => x.key == "Power");
power.value = res.SN.Value.ToString();
SQLiteHelper<t_keyvalue> kvHelper = new db.SQLiteHelper<t_keyvalue>();
kvHelper.Update(power);
break;
}
}
}
else
{
// 判断此站是否有胶水。返回fail,执行胶水下线
if (eventName == "SN_FeedingCheck")
{
//执行胶水下线操作
}
}
return result
? ApiFormResult.Sucess(mesresult.PASS, true, res.Msg?.Value ?? "", PlcData, DateTime.Now)
: ApiFormResult.Sucess(mesresult.FAIL, true, res.Msg?.Value ?? "", PlcData, DateTime.Now);
}
else if (res.IsSuccess != null) // 打印 mes不返回result
{
// 回写对应PLC
if (statusCode > 0)
PlcData.Write_Status = (short)statusCode;
if (eventName == "SN_Release" || eventName == "SN_CheckIN")
PlcData.Write_stSN = res.SN.Value;
if (eventName == "SN_FeedingCheck")
{
var station = Init.t_Line.lineremark2.ToLower();
switch (station)
{
case "potting"://灌胶
case "thermalpaste"://点胶&CCD检测
case "uvcoating"://三防漆涂覆
case "sealant"://点密封胶&CCD
var power = Init.t_Keyvalues.First(x => x.key == "Power");
power.value = res.SN.Value.ToString();
SQLiteHelper<t_keyvalue> kvHelper = new db.SQLiteHelper<t_keyvalue>();
kvHelper.Update(power);
break;
}
}
}
else
{
// 判断此站是否有胶水。返回fail,执行胶水下线
if (eventName == "SN_FeedingCheck")
{
//执行胶水下线操作
}
}
return result
return res.IsSuccess.Value == true
? ApiFormResult.Sucess(mesresult.PASS, true, res.Msg?.Value ?? "", PlcData, DateTime.Now)
: ApiFormResult.Sucess(mesresult.FAIL, true, res.Msg?.Value ?? "", PlcData, DateTime.Now);
}
else if (res.IsSuccess != null) // 打印 mes不返回result
{
// 回写对应PLC
if (statusCode > 0)
PlcData.Write_Status = (short)statusCode;
return res.IsSuccess.Value == true
? ApiFormResult.Sucess(mesresult.PASS, true, res.Msg?.Value ?? "", PlcData, DateTime.Now)
: ApiFormResult.Sucess(mesresult.FAIL, true, res.Msg?.Value ?? "", PlcData, DateTime.Now);
}
}
}
else
{
throw new Exception($"请求失败,状态码:{response.StatusCode}");
}
#endregion
}
else
catch (Exception ex)
{
throw new Exception($"请求失败,状态码:{response.StatusCode}");
LogExecute.logNet.WriteError($"{eventName} 接口请求失败: {ex.Message}");
//return ApiFormResult.Sucess(mesresult.PASS, true, "PASS", PlcData, DateTime.Now);
throw new Exception(ex.Message);
}
#endregion
return ApiFormResult.Sucess(mesresult.PASS, false, "", PlcData, DateTime.Now);
}
catch (Exception ex)
{
LogExecute.logNet.WriteError($"{eventName} 接口请求失败: {ex.Message}");
//return ApiFormResult.Sucess(mesresult.PASS, true, "PASS", PlcData, DateTime.Now);
throw new Exception(ex.Message);
}
return ApiFormResult.Sucess(mesresult.PASS, false, "", PlcData, DateTime.Now);
*/
#endregion 正式调用接口
}
@@ -238,7 +248,7 @@ namespace WindowsFormsApp1.server
var stationid = Init.t_Line.lineremark2.ToLower();
if ("loadaging,exchange2,exchange1".Contains(stationid))
{
sn = PlcData.Write_stSN ?? OtherData.JS_SN;
sn = PlcData.Read_MaterialCode0 ?? OtherData.JS_SN;
}
else
{
@@ -296,7 +306,7 @@ namespace WindowsFormsApp1.server
/// <returns></returns>
public ApiFormResult SN_FeedingCheck(string url, plcdata PlcData, otherdata OtherData)
{
OtherData.JS_SN = PlcData.Read_MaterialCode2;
//OtherData.JS_SN = PlcData.Read_MaterialCode2;
//判断是否为胶水站,是查询materialscan中上线的胶水码
var station = Init.t_Line.lineremark2.ToLower();
switch (station)
@@ -324,18 +334,29 @@ namespace WindowsFormsApp1.server
OPID = _opID,
Token = _token,
FixSN = _fixsn,
SN = OtherData.JS_SN ?? PlcData.Write_stSN,//扫码
SN = OtherData.JS_SN ?? PlcData.Read_MaterialCode2 ?? Init.DZString,//扫码
SendTime = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss")
};
var result = CallApi(url, request, "SN_FeedingCheck", PlcData, PLC_Status.SN_FeedingCheck);
if (result.Success && result.Mesresult != mesresult.PASS)
if (result.Success && result.Mesresult != mesresult.PASS && result.Msg.Contains("过期"))
{
// 判断是否是胶水站,FAIL 直接下线 todo
if ("Potting,ThermalPaste,Sel_Soldering,UVCoating,Sealant".Contains(station))
// 判断是否是胶水站,FAIL 直接下线
if ("potting,thermalpaste,sel_soldering,uvcoating,sealant".Contains(station))
{
OtherData.opindex = 2;
return CallFunctionByName("Glue_CheckOut", PlcData, OtherData);
var glueResult = CallFunctionByName("Glue_CheckOut", PlcData, OtherData);
if (glueResult.Success && glueResult.Mesresult == mesresult.PASS)
{
//更新胶水为下线
var _dbHelper = new SQLiteHelper<t_materialscan>();
var material = _dbHelper.QuerySingle(x => x.scancode == OtherData.JS_SN).Data;
if (material != null)
{
material.isonline = false;
_dbHelper.Update(material);
}
}
}
}
return result;
@@ -365,7 +386,7 @@ namespace WindowsFormsApp1.server
new CompListItem()
{
// 安装主板 端子
CompID = OtherData.JS_SN ?? Init.ScanString,
CompID = OtherData.JS_SN ?? Init.DZString,
Qty = "1"
}
},
@@ -556,8 +577,8 @@ namespace WindowsFormsApp1.server
string targetFolder = targetDirectory;
List<string> fileList = new List<string>();
//从数据库读 未上传的 todo
string snNumber = PlcData.Write_stSN;
//从数据库读 未上传的,从定时器中传出来
string snNumber = OtherData.SN;
if (string.IsNullOrEmpty(snNumber))
{
@@ -601,7 +622,7 @@ namespace WindowsFormsApp1.server
continue;
}
extensionstr = Path.GetExtension(file);
fileName = $"{month}{day}_{_stationID}_{result}_{PlcData.Write_stSN}_{monthDay}_{time}_{_machineID}_01_Original{num}{extensionstr}";
fileName = $"{month}{day}_{_stationID}_{result}_{snNumber}_{monthDay}_{time}_{_machineID}_01_Detection_{num}{extensionstr}";
filePath = Path.Combine(sourceFolder, fileName1);
//string targetPath = Path.Combine(targetFolder, fileName);
//File.Copy(file, targetPath, true);
@@ -779,6 +800,12 @@ namespace WindowsFormsApp1.server
SendTime = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss")
};
//抽真空 fixsn 用作穴位
if (stationid.ToLower() == "vacuum")
{
request.FixSN = OtherData.plcid.ToString();
}
// 根据不同的lineCode可以在这里扩展request对象
var dcInfo = new DCInfoItem();
var sninfo = request.SNInfo[0];
@@ -883,7 +910,7 @@ namespace WindowsFormsApp1.server
if ("Curing".Contains(stationid))
{
SQLiteHelper<t_materialcall> materialHelper = new db.SQLiteHelper<t_materialcall>();
var material = materialHelper.QuerySingle(x => x.materialid == PlcData.Write_stSN);
var material = materialHelper.QuerySingle(x => x.sn == PlcData.Write_stSN);
if (material.Success)
{
// 计算加热时间
@@ -910,6 +937,7 @@ namespace WindowsFormsApp1.server
//报错,没有这个物料
}
}
//胶重
if ("Potting,ThermalPaste".Contains(stationid))
{
@@ -922,24 +950,26 @@ namespace WindowsFormsApp1.server
sninfo.DC_INFO.Add(dcInfo);
}
//胶重 胶宽 CCD
// 胶宽 胶高 CCD
if ("Sealant".Contains(stationid))
{
dcInfo = new DCInfoItem();
dcInfo.Item = $"{stationid}_Weight";
dcInfo.Item = $"{stationid}_Width";
dcInfo.Value = PlcData.Read_UploadData0.ToString();
dcInfo.Result = result;
sninfo.DC_INFO.Add(dcInfo);
dcInfo = new DCInfoItem();
dcInfo.Item = $"{stationid}_Width";
dcInfo.Item = $"{stationid}_Height";
dcInfo.Value = PlcData.Read_UploadData1.ToString();
dcInfo.Result = result;
CsvLogger.Log($"{PlcData.Write_stSN},{PlcData.Read_UploadData0.ToString()},{PlcData.Read_UploadData1.ToString()},{logresult}");
sninfo.DC_INFO.Add(dcInfo);
}
//胶水 材料码
if ("Potting,ThermalPaste,Sel_Soldering,UVCoating,Sealant".Contains(stationid))
{
@@ -960,6 +990,52 @@ namespace WindowsFormsApp1.server
sninfo.CompList.Add(compListItem);
}
//图片上传
if ("Assy1,Assy4,Assy6,ThermalPaste,Sealant,CCD,AOI,Assy5".Contains(stationid))
{
SQLiteHelper<t_materialupload> materialuploadHelper = new db.SQLiteHelper<t_materialupload>();
var material = materialuploadHelper.QuerySingle(x => x.sn == PlcData.Write_stSN).Data;
if (material == null)
{
material = new t_materialupload
{
sn = PlcData.Write_stSN,
imageUploaded = 1,
result = logresult,
date = DateTime.Now.ToString("yyyyMMdd")
};
materialuploadHelper.Insert(material);
}
else
{
material.imageUploaded = 1;
materialuploadHelper.Update(material);
}
}
//视频上传
if ("WAT,Assy2,Assy3,ScrewS,Assy5,LoadAging,PrintLabel".Contains(stationid))
{
SQLiteHelper<t_materialupload> materialuploadHelper = new db.SQLiteHelper<t_materialupload>();
var material = materialuploadHelper.QuerySingle(x => x.sn == PlcData.Write_stSN).Data;
if (material == null)
{
material = new t_materialupload
{
sn = PlcData.Write_stSN,
vedioUploaded = 1,
result = logresult,
date = DateTime.Now.ToString("yyyyMMdd")
};
materialuploadHelper.Insert(material);
}
else
{
material.vedioUploaded = 1;
materialuploadHelper.Update(material);
}
}
return CallApi(url, request, "SN_Checkout", PlcData, PLC_Status.SN_Checkout);
}