diff --git a/WindowsFormsApp1/MES_PLC_Control.csproj b/WindowsFormsApp1/MES_PLC_Control.csproj
index 4bc796a..560ad8d 100644
--- a/WindowsFormsApp1/MES_PLC_Control.csproj
+++ b/WindowsFormsApp1/MES_PLC_Control.csproj
@@ -245,6 +245,7 @@
MaterialScanForm.cs
+
diff --git a/WindowsFormsApp1/MainForm.Designer.cs b/WindowsFormsApp1/MainForm.Designer.cs
index 1f1c04e..39ca28b 100644
--- a/WindowsFormsApp1/MainForm.Designer.cs
+++ b/WindowsFormsApp1/MainForm.Designer.cs
@@ -19,7 +19,11 @@ namespace WindowsFormsApp1
{
components.Dispose();
}
- base.Dispose(disposing);
+ try
+ {
+ base.Dispose(disposing);
+ }
+ catch { }
}
#region Windows 窗体设计器生成的代码
@@ -31,6 +35,8 @@ namespace WindowsFormsApp1
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
+ this.plcStatusGroupBox = new System.Windows.Forms.GroupBox();
+ this.plcStatusTableLayout = new System.Windows.Forms.TableLayoutPanel();
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
this.用户管理ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.修改密码ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@@ -55,26 +61,11 @@ namespace WindowsFormsApp1
this.图片展示ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.tableLayoutPanel4 = new System.Windows.Forms.TableLayoutPanel();
- this.groupBox4 = new System.Windows.Forms.GroupBox();
- this.tableLayoutPanel9 = new System.Windows.Forms.TableLayoutPanel();
- this.PLC1状态 = new System.Windows.Forms.Label();
- this.PLC1名称 = new System.Windows.Forms.Label();
- this.PLC1机台状态 = new System.Windows.Forms.Label();
- this.PLC1时间 = new System.Windows.Forms.Label();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.tableLayoutPanel7 = new System.Windows.Forms.TableLayoutPanel();
- this.事件4时间 = new System.Windows.Forms.Label();
- this.事件3时间 = new System.Windows.Forms.Label();
- this.事件2时间 = new System.Windows.Forms.Label();
this.事件1时间 = new System.Windows.Forms.Label();
- this.事件2 = new System.Windows.Forms.Label();
this.事件1 = new System.Windows.Forms.Label();
- this.事件2结果 = new System.Windows.Forms.Label();
this.事件1结果 = new System.Windows.Forms.Label();
- this.事件3结果 = new System.Windows.Forms.Label();
- this.事件3 = new System.Windows.Forms.Label();
- this.事件4 = new System.Windows.Forms.Label();
- this.事件4结果 = new System.Windows.Forms.Label();
this.gropb = new System.Windows.Forms.GroupBox();
this.tableLayoutPanel6 = new System.Windows.Forms.TableLayoutPanel();
this.MES提示信息 = new System.Windows.Forms.Label();
@@ -82,6 +73,7 @@ namespace WindowsFormsApp1
this.tableLayoutPanel5 = new System.Windows.Forms.TableLayoutPanel();
this.LOT号显示 = new System.Windows.Forms.Label();
this.LOT号 = new System.Windows.Forms.Label();
+ this.胶水上下线 = new System.Windows.Forms.Button();
this.剩余寿命 = new System.Windows.Forms.Label();
this.MES提示 = new System.Windows.Forms.Label();
this.Tray盘二维码 = new System.Windows.Forms.Label();
@@ -90,8 +82,6 @@ namespace WindowsFormsApp1
this.开始处理 = new System.Windows.Forms.Button();
this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel();
this.linemode = new System.Windows.Forms.Label();
- this.MES通讯时间 = new System.Windows.Forms.Label();
- this.MES链接状态 = new System.Windows.Forms.Label();
this.当前时间 = new System.Windows.Forms.Label();
this.操作人员ID = new System.Windows.Forms.Label();
this.linetype = new System.Windows.Forms.Label();
@@ -106,12 +96,10 @@ namespace WindowsFormsApp1
this.底部注释4 = new System.Windows.Forms.Label();
this.底部注释5 = new System.Windows.Forms.Label();
this.timer1 = new System.Windows.Forms.Timer(this.components);
- this.胶水上下线 = new System.Windows.Forms.Button();
+ this.plcStatusGroupBox.SuspendLayout();
this.menuStrip1.SuspendLayout();
this.tableLayoutPanel1.SuspendLayout();
this.tableLayoutPanel4.SuspendLayout();
- this.groupBox4.SuspendLayout();
- this.tableLayoutPanel9.SuspendLayout();
this.groupBox2.SuspendLayout();
this.tableLayoutPanel7.SuspendLayout();
this.gropb.SuspendLayout();
@@ -125,6 +113,30 @@ namespace WindowsFormsApp1
this.tableLayoutPanel8.SuspendLayout();
this.SuspendLayout();
//
+ // plcStatusGroupBox
+ //
+ 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, 927);
+ this.plcStatusGroupBox.Name = "plcStatusGroupBox";
+ this.plcStatusGroupBox.Size = new System.Drawing.Size(1754, 94);
+ this.plcStatusGroupBox.TabIndex = 9;
+ this.plcStatusGroupBox.TabStop = false;
+ this.plcStatusGroupBox.Text = "PLC连接状态";
+ //
+ // plcStatusTableLayout
+ //
+ this.plcStatusTableLayout.AutoSize = true;
+ this.plcStatusTableLayout.ColumnCount = 2;
+ this.plcStatusTableLayout.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 30F));
+ this.plcStatusTableLayout.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
+ 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.TabIndex = 0;
+ //
// menuStrip1
//
this.menuStrip1.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
@@ -160,21 +172,21 @@ namespace WindowsFormsApp1
// 修改密码ToolStripMenuItem
//
this.修改密码ToolStripMenuItem.Name = "修改密码ToolStripMenuItem";
- this.修改密码ToolStripMenuItem.Size = new System.Drawing.Size(283, 50);
+ this.修改密码ToolStripMenuItem.Size = new System.Drawing.Size(359, 50);
this.修改密码ToolStripMenuItem.Text = "修改密码";
this.修改密码ToolStripMenuItem.Click += new System.EventHandler(this.修改密码ToolStripMenuItem_Click);
//
// 切换用户ToolStripMenuItem
//
this.切换用户ToolStripMenuItem.Name = "切换用户ToolStripMenuItem";
- this.切换用户ToolStripMenuItem.Size = new System.Drawing.Size(283, 50);
+ this.切换用户ToolStripMenuItem.Size = new System.Drawing.Size(359, 50);
this.切换用户ToolStripMenuItem.Text = "切换用户";
this.切换用户ToolStripMenuItem.Click += new System.EventHandler(this.切换用户ToolStripMenuItem_Click);
//
// 用户管理ToolStripMenuItem1
//
this.用户管理ToolStripMenuItem1.Name = "用户管理ToolStripMenuItem1";
- this.用户管理ToolStripMenuItem1.Size = new System.Drawing.Size(283, 50);
+ this.用户管理ToolStripMenuItem1.Size = new System.Drawing.Size(359, 50);
this.用户管理ToolStripMenuItem1.Text = "用户管理";
this.用户管理ToolStripMenuItem1.Click += new System.EventHandler(this.用户管理ToolStripMenuItem1_Click);
//
@@ -295,7 +307,6 @@ namespace WindowsFormsApp1
this.材料扫码ToolStripMenuItem.Size = new System.Drawing.Size(166, 45);
this.材料扫码ToolStripMenuItem.Text = "材料扫码";
this.材料扫码ToolStripMenuItem.Click += new System.EventHandler(this.材料扫码ToolStripMenuItem_Click);
-
//
// 图片展示ToolStripMenuItem
//
@@ -303,7 +314,6 @@ namespace WindowsFormsApp1
this.图片展示ToolStripMenuItem.Size = new System.Drawing.Size(166, 45);
this.图片展示ToolStripMenuItem.Text = "图片展示";
this.图片展示ToolStripMenuItem.Click += new System.EventHandler(this.图片展示ToolStripMenuItem_Click);
-
//
// tableLayoutPanel1
//
@@ -312,16 +322,18 @@ namespace WindowsFormsApp1
this.tableLayoutPanel1.Controls.Add(this.tableLayoutPanel4, 0, 1);
this.tableLayoutPanel1.Controls.Add(this.groupBox1, 0, 0);
this.tableLayoutPanel1.Controls.Add(this.groupBox3, 0, 2);
- this.tableLayoutPanel1.Controls.Add(this.tableLayoutPanel8, 0, 3);
+ this.tableLayoutPanel1.Controls.Add(this.plcStatusGroupBox, 0, 3);
+ this.tableLayoutPanel1.Controls.Add(this.tableLayoutPanel8, 0, 4);
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0);
this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(5, 6, 5, 6);
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
- this.tableLayoutPanel1.RowCount = 4;
- this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 23.69995F));
- this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 49.35099F));
- this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 22.89995F));
- this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 4.049108F));
+ this.tableLayoutPanel1.RowCount = 5;
+ this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 16.42934F));
+ this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 54.05363F));
+ this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 25.08208F));
+ 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.Percent, 4.434946F));
this.tableLayoutPanel1.Size = new System.Drawing.Size(1760, 1068);
this.tableLayoutPanel1.TabIndex = 6;
//
@@ -334,99 +346,18 @@ namespace WindowsFormsApp1
this.tableLayoutPanel4.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 70F));
this.tableLayoutPanel4.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 10F));
this.tableLayoutPanel4.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 20F));
- this.tableLayoutPanel4.Controls.Add(this.groupBox4, 1, 0);
this.tableLayoutPanel4.Controls.Add(this.groupBox2, 2, 0);
this.tableLayoutPanel4.Controls.Add(this.gropb, 0, 1);
this.tableLayoutPanel4.Controls.Add(this.原料包装LOT号, 0, 0);
- this.tableLayoutPanel4.Location = new System.Drawing.Point(3, 257);
+ this.tableLayoutPanel4.Location = new System.Drawing.Point(3, 163);
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, 60.04619F));
this.tableLayoutPanel4.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 39.95381F));
- this.tableLayoutPanel4.Size = new System.Drawing.Size(1754, 519);
+ this.tableLayoutPanel4.Size = new System.Drawing.Size(1754, 515);
this.tableLayoutPanel4.TabIndex = 8;
//
- // groupBox4
- //
- this.groupBox4.Controls.Add(this.tableLayoutPanel9);
- this.groupBox4.Dock = System.Windows.Forms.DockStyle.Fill;
- this.groupBox4.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
- this.groupBox4.Location = new System.Drawing.Point(1230, 4);
- this.groupBox4.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
- this.groupBox4.Name = "groupBox4";
- this.groupBox4.Padding = new System.Windows.Forms.Padding(3, 4, 3, 4);
- this.groupBox4.Size = new System.Drawing.Size(169, 303);
- this.groupBox4.TabIndex = 4;
- this.groupBox4.TabStop = false;
- this.groupBox4.Text = "PLC链接";
- //
- // tableLayoutPanel9
- //
- this.tableLayoutPanel9.CellBorderStyle = System.Windows.Forms.TableLayoutPanelCellBorderStyle.Single;
- this.tableLayoutPanel9.ColumnCount = 1;
- this.tableLayoutPanel9.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
- this.tableLayoutPanel9.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 22F));
- this.tableLayoutPanel9.Controls.Add(this.PLC1状态, 0, 0);
- this.tableLayoutPanel9.Controls.Add(this.PLC1名称, 0, 1);
- this.tableLayoutPanel9.Controls.Add(this.PLC1机台状态, 0, 2);
- this.tableLayoutPanel9.Controls.Add(this.PLC1时间, 0, 3);
- this.tableLayoutPanel9.Dock = System.Windows.Forms.DockStyle.Fill;
- this.tableLayoutPanel9.Location = new System.Drawing.Point(3, 41);
- this.tableLayoutPanel9.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
- this.tableLayoutPanel9.Name = "tableLayoutPanel9";
- this.tableLayoutPanel9.RowCount = 4;
- this.tableLayoutPanel9.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 52F));
- this.tableLayoutPanel9.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 16F));
- this.tableLayoutPanel9.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 16F));
- this.tableLayoutPanel9.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 16F));
- this.tableLayoutPanel9.Size = new System.Drawing.Size(163, 258);
- this.tableLayoutPanel9.TabIndex = 0;
- //
- // PLC1状态
- //
- this.PLC1状态.Anchor = System.Windows.Forms.AnchorStyles.None;
- this.PLC1状态.AutoSize = true;
- this.PLC1状态.Font = new System.Drawing.Font("宋体", 26.14286F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
- this.PLC1状态.Location = new System.Drawing.Point(30, 31);
- this.PLC1状态.Name = "PLC1状态";
- this.PLC1状态.Size = new System.Drawing.Size(102, 70);
- this.PLC1状态.TabIndex = 0;
- this.PLC1状态.Text = "OK";
- //
- // PLC1名称
- //
- this.PLC1名称.Anchor = System.Windows.Forms.AnchorStyles.None;
- this.PLC1名称.AutoSize = true;
- this.PLC1名称.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
- this.PLC1名称.Location = new System.Drawing.Point(26, 136);
- this.PLC1名称.Name = "PLC1名称";
- this.PLC1名称.Size = new System.Drawing.Size(111, 33);
- this.PLC1名称.TabIndex = 12;
- this.PLC1名称.Text = "label6";
- //
- // PLC1机台状态
- //
- this.PLC1机台状态.Anchor = System.Windows.Forms.AnchorStyles.None;
- this.PLC1机台状态.AutoSize = true;
- this.PLC1机台状态.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
- this.PLC1机台状态.Location = new System.Drawing.Point(26, 177);
- this.PLC1机台状态.Name = "PLC1机台状态";
- this.PLC1机台状态.Size = new System.Drawing.Size(111, 33);
- this.PLC1机台状态.TabIndex = 2;
- this.PLC1机台状态.Text = "label6";
- //
- // PLC1时间
- //
- this.PLC1时间.Anchor = System.Windows.Forms.AnchorStyles.None;
- this.PLC1时间.AutoSize = true;
- this.PLC1时间.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
- this.PLC1时间.Location = new System.Drawing.Point(26, 219);
- this.PLC1时间.Name = "PLC1时间";
- this.PLC1时间.Size = new System.Drawing.Size(111, 33);
- this.PLC1时间.TabIndex = 8;
- this.PLC1时间.Text = "label4";
- //
// groupBox2
//
this.groupBox2.Controls.Add(this.tableLayoutPanel7);
@@ -437,7 +368,7 @@ namespace WindowsFormsApp1
this.groupBox2.Name = "groupBox2";
this.groupBox2.Padding = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.tableLayoutPanel4.SetRowSpan(this.groupBox2, 2);
- this.groupBox2.Size = new System.Drawing.Size(346, 511);
+ this.groupBox2.Size = new System.Drawing.Size(346, 507);
this.groupBox2.TabIndex = 3;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "MES事件结果";
@@ -445,167 +376,58 @@ namespace WindowsFormsApp1
// tableLayoutPanel7
//
this.tableLayoutPanel7.CellBorderStyle = System.Windows.Forms.TableLayoutPanelCellBorderStyle.Single;
- this.tableLayoutPanel7.ColumnCount = 2;
- this.tableLayoutPanel7.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
- this.tableLayoutPanel7.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
- this.tableLayoutPanel7.Controls.Add(this.事件4时间, 1, 5);
- this.tableLayoutPanel7.Controls.Add(this.事件3时间, 0, 5);
- this.tableLayoutPanel7.Controls.Add(this.事件2时间, 1, 2);
+ this.tableLayoutPanel7.ColumnCount = 1;
+ this.tableLayoutPanel7.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel7.Controls.Add(this.事件1时间, 0, 2);
- this.tableLayoutPanel7.Controls.Add(this.事件2, 1, 1);
this.tableLayoutPanel7.Controls.Add(this.事件1, 0, 1);
- this.tableLayoutPanel7.Controls.Add(this.事件2结果, 1, 0);
this.tableLayoutPanel7.Controls.Add(this.事件1结果, 0, 0);
- this.tableLayoutPanel7.Controls.Add(this.事件3结果, 0, 3);
- this.tableLayoutPanel7.Controls.Add(this.事件3, 0, 4);
- this.tableLayoutPanel7.Controls.Add(this.事件4, 1, 4);
- this.tableLayoutPanel7.Controls.Add(this.事件4结果, 1, 3);
this.tableLayoutPanel7.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel7.Location = new System.Drawing.Point(3, 41);
this.tableLayoutPanel7.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.tableLayoutPanel7.Name = "tableLayoutPanel7";
- this.tableLayoutPanel7.RowCount = 6;
- this.tableLayoutPanel7.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 30F));
- this.tableLayoutPanel7.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F));
- this.tableLayoutPanel7.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F));
- this.tableLayoutPanel7.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 30F));
- this.tableLayoutPanel7.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F));
- this.tableLayoutPanel7.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F));
- this.tableLayoutPanel7.Size = new System.Drawing.Size(340, 466);
+ this.tableLayoutPanel7.RowCount = 3;
+ this.tableLayoutPanel7.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 60F));
+ this.tableLayoutPanel7.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F));
+ this.tableLayoutPanel7.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F));
+ this.tableLayoutPanel7.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
+ this.tableLayoutPanel7.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
+ this.tableLayoutPanel7.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
+ this.tableLayoutPanel7.Size = new System.Drawing.Size(340, 462);
this.tableLayoutPanel7.TabIndex = 0;
//
- // 事件4时间
- //
- this.事件4时间.Anchor = System.Windows.Forms.AnchorStyles.None;
- this.事件4时间.AutoSize = true;
- this.事件4时间.Font = new System.Drawing.Font("宋体", 10F);
- this.事件4时间.Location = new System.Drawing.Point(187, 426);
- this.事件4时间.Name = "事件4时间";
- this.事件4时间.Size = new System.Drawing.Size(134, 27);
- this.事件4时间.TabIndex = 11;
- this.事件4时间.Text = "事件4时间";
- //
- // 事件3时间
- //
- this.事件3时间.Anchor = System.Windows.Forms.AnchorStyles.None;
- this.事件3时间.AutoSize = true;
- this.事件3时间.Font = new System.Drawing.Font("宋体", 10F);
- this.事件3时间.Location = new System.Drawing.Point(18, 426);
- this.事件3时间.Name = "事件3时间";
- this.事件3时间.Size = new System.Drawing.Size(134, 27);
- this.事件3时间.TabIndex = 10;
- this.事件3时间.Text = "事件3时间";
- //
- // 事件2时间
- //
- this.事件2时间.Anchor = System.Windows.Forms.AnchorStyles.None;
- this.事件2时间.AutoSize = true;
- this.事件2时间.Font = new System.Drawing.Font("宋体", 10F);
- this.事件2时间.Location = new System.Drawing.Point(187, 194);
- this.事件2时间.Name = "事件2时间";
- this.事件2时间.Size = new System.Drawing.Size(134, 27);
- this.事件2时间.TabIndex = 9;
- this.事件2时间.Text = "事件2时间";
- //
// 事件1时间
//
- this.事件1时间.Anchor = System.Windows.Forms.AnchorStyles.None;
this.事件1时间.AutoEllipsis = true;
this.事件1时间.AutoSize = true;
+ this.事件1时间.Dock = System.Windows.Forms.DockStyle.Fill;
this.事件1时间.Font = new System.Drawing.Font("宋体", 10F);
- this.事件1时间.Location = new System.Drawing.Point(18, 194);
+ this.事件1时间.Location = new System.Drawing.Point(4, 368);
this.事件1时间.Name = "事件1时间";
- this.事件1时间.Size = new System.Drawing.Size(134, 27);
+ this.事件1时间.Size = new System.Drawing.Size(332, 93);
this.事件1时间.TabIndex = 8;
- this.事件1时间.Text = "事件1时间";
- //
- // 事件2
- //
- this.事件2.Anchor = System.Windows.Forms.AnchorStyles.None;
- this.事件2.AutoSize = true;
- this.事件2.Font = new System.Drawing.Font("宋体", 12F);
- this.事件2.Location = new System.Drawing.Point(207, 145);
- this.事件2.Name = "事件2";
- this.事件2.Size = new System.Drawing.Size(95, 33);
- this.事件2.TabIndex = 3;
- this.事件2.Text = "事件2";
+ this.事件1时间.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// 事件1
//
- this.事件1.Anchor = System.Windows.Forms.AnchorStyles.None;
this.事件1.AutoSize = true;
+ this.事件1.Dock = System.Windows.Forms.DockStyle.Fill;
this.事件1.Font = new System.Drawing.Font("宋体", 12F);
- this.事件1.Location = new System.Drawing.Point(37, 145);
+ this.事件1.Location = new System.Drawing.Point(4, 276);
this.事件1.Name = "事件1";
- this.事件1.Size = new System.Drawing.Size(95, 33);
+ this.事件1.Size = new System.Drawing.Size(332, 91);
this.事件1.TabIndex = 2;
- this.事件1.Text = "事件1";
- //
- // 事件2结果
- //
- this.事件2结果.Anchor = System.Windows.Forms.AnchorStyles.None;
- this.事件2结果.AutoSize = true;
- this.事件2结果.Font = new System.Drawing.Font("宋体", 26.14286F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
- this.事件2结果.Location = new System.Drawing.Point(203, 34);
- this.事件2结果.Name = "事件2结果";
- this.事件2结果.Size = new System.Drawing.Size(102, 70);
- this.事件2结果.TabIndex = 1;
- this.事件2结果.Text = "OK";
+ this.事件1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// 事件1结果
//
- this.事件1结果.Anchor = System.Windows.Forms.AnchorStyles.None;
this.事件1结果.AutoSize = true;
+ this.事件1结果.Dock = System.Windows.Forms.DockStyle.Fill;
this.事件1结果.Font = new System.Drawing.Font("宋体", 26.14286F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
- this.事件1结果.Location = new System.Drawing.Point(34, 34);
+ this.事件1结果.Location = new System.Drawing.Point(4, 1);
this.事件1结果.Name = "事件1结果";
- this.事件1结果.Size = new System.Drawing.Size(102, 70);
+ this.事件1结果.Size = new System.Drawing.Size(332, 274);
this.事件1结果.TabIndex = 0;
- this.事件1结果.Text = "OK";
- //
- // 事件3结果
- //
- this.事件3结果.Anchor = System.Windows.Forms.AnchorStyles.None;
- this.事件3结果.AutoSize = true;
- this.事件3结果.Font = new System.Drawing.Font("宋体", 26.14286F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
- this.事件3结果.Location = new System.Drawing.Point(34, 264);
- this.事件3结果.Name = "事件3结果";
- this.事件3结果.Size = new System.Drawing.Size(102, 70);
- this.事件3结果.TabIndex = 4;
- this.事件3结果.Text = "OK";
- //
- // 事件3
- //
- this.事件3.Anchor = System.Windows.Forms.AnchorStyles.None;
- this.事件3.AutoSize = true;
- this.事件3.Font = new System.Drawing.Font("宋体", 12F);
- this.事件3.Location = new System.Drawing.Point(37, 375);
- this.事件3.Name = "事件3";
- this.事件3.Size = new System.Drawing.Size(95, 33);
- this.事件3.TabIndex = 6;
- this.事件3.Text = "事件3";
- //
- // 事件4
- //
- this.事件4.Anchor = System.Windows.Forms.AnchorStyles.None;
- this.事件4.AutoSize = true;
- this.事件4.Font = new System.Drawing.Font("宋体", 12F);
- this.事件4.Location = new System.Drawing.Point(207, 375);
- this.事件4.Name = "事件4";
- this.事件4.Size = new System.Drawing.Size(95, 33);
- this.事件4.TabIndex = 7;
- this.事件4.Text = "事件4";
- //
- // 事件4结果
- //
- this.事件4结果.Anchor = System.Windows.Forms.AnchorStyles.None;
- this.事件4结果.AutoSize = true;
- this.事件4结果.Font = new System.Drawing.Font("宋体", 26.14286F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
- this.事件4结果.Location = new System.Drawing.Point(203, 264);
- this.事件4结果.Name = "事件4结果";
- this.事件4结果.Size = new System.Drawing.Size(102, 70);
- this.事件4结果.TabIndex = 5;
- this.事件4结果.Text = "OK";
+ this.事件1结果.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// gropb
//
@@ -613,11 +435,11 @@ namespace WindowsFormsApp1
this.gropb.Controls.Add(this.tableLayoutPanel6);
this.gropb.Dock = System.Windows.Forms.DockStyle.Fill;
this.gropb.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
- this.gropb.Location = new System.Drawing.Point(3, 315);
+ this.gropb.Location = new System.Drawing.Point(3, 313);
this.gropb.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.gropb.Name = "gropb";
this.gropb.Padding = new System.Windows.Forms.Padding(3, 4, 3, 4);
- this.gropb.Size = new System.Drawing.Size(1396, 200);
+ this.gropb.Size = new System.Drawing.Size(1396, 198);
this.gropb.TabIndex = 1;
this.gropb.TabStop = false;
this.gropb.Text = "MES提示:";
@@ -635,22 +457,23 @@ namespace WindowsFormsApp1
this.tableLayoutPanel6.Name = "tableLayoutPanel6";
this.tableLayoutPanel6.RowCount = 1;
this.tableLayoutPanel6.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
- this.tableLayoutPanel6.Size = new System.Drawing.Size(1390, 155);
+ this.tableLayoutPanel6.Size = new System.Drawing.Size(1390, 153);
this.tableLayoutPanel6.TabIndex = 1;
//
// MES提示信息
//
- this.MES提示信息.Anchor = System.Windows.Forms.AnchorStyles.None;
- this.MES提示信息.AutoSize = true;
+ this.MES提示信息.Dock = System.Windows.Forms.DockStyle.Fill;
this.MES提示信息.Font = new System.Drawing.Font("宋体", 21.85714F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
- this.MES提示信息.Location = new System.Drawing.Point(83, 48);
+ this.MES提示信息.ForeColor = System.Drawing.SystemColors.ControlText;
+ this.MES提示信息.Location = new System.Drawing.Point(4, 1);
this.MES提示信息.Name = "MES提示信息";
- this.MES提示信息.Size = new System.Drawing.Size(1224, 59);
+ this.MES提示信息.Size = new System.Drawing.Size(1382, 151);
this.MES提示信息.TabIndex = 6;
- this.MES提示信息.Text = "MES提示信息:11111333332222222222222222";
+ this.MES提示信息.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// 原料包装LOT号
//
+ this.tableLayoutPanel4.SetColumnSpan(this.原料包装LOT号, 2);
this.原料包装LOT号.Controls.Add(this.tableLayoutPanel5);
this.原料包装LOT号.Dock = System.Windows.Forms.DockStyle.Fill;
this.原料包装LOT号.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
@@ -658,7 +481,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(1221, 303);
+ this.原料包装LOT号.Size = new System.Drawing.Size(1396, 301);
this.原料包装LOT号.TabIndex = 0;
this.原料包装LOT号.TabStop = false;
this.原料包装LOT号.Text = "产品信息:";
@@ -684,7 +507,7 @@ namespace WindowsFormsApp1
this.tableLayoutPanel5.RowCount = 2;
this.tableLayoutPanel5.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel5.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
- this.tableLayoutPanel5.Size = new System.Drawing.Size(1215, 258);
+ this.tableLayoutPanel5.Size = new System.Drawing.Size(1390, 256);
this.tableLayoutPanel5.TabIndex = 0;
//
// LOT号显示
@@ -692,7 +515,7 @@ namespace WindowsFormsApp1
this.LOT号显示.Anchor = System.Windows.Forms.AnchorStyles.None;
this.LOT号显示.AutoSize = true;
this.LOT号显示.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
- this.LOT号显示.Location = new System.Drawing.Point(74, 40);
+ this.LOT号显示.Location = new System.Drawing.Point(93, 40);
this.LOT号显示.Name = "LOT号显示";
this.LOT号显示.Size = new System.Drawing.Size(116, 48);
this.LOT号显示.TabIndex = 2;
@@ -703,20 +526,30 @@ namespace WindowsFormsApp1
this.LOT号.Anchor = System.Windows.Forms.AnchorStyles.None;
this.LOT号.AutoSize = true;
this.LOT号.Font = new System.Drawing.Font("宋体", 21.85714F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
- this.LOT号.Location = new System.Drawing.Point(473, 35);
+ this.LOT号.Location = new System.Drawing.Point(767, 34);
this.LOT号.Name = "LOT号";
- this.LOT号.Size = new System.Drawing.Size(395, 59);
+ this.LOT号.Size = new System.Drawing.Size(0, 59);
this.LOT号.TabIndex = 0;
- this.LOT号.Text = "SN:23199191";
+ //
+ // 胶水上下线
+ //
+ this.胶水上下线.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.胶水上下线.Location = new System.Drawing.Point(1236, 5);
+ this.胶水上下线.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
+ this.胶水上下线.Name = "胶水上下线";
+ this.胶水上下线.Size = new System.Drawing.Size(150, 118);
+ this.胶水上下线.TabIndex = 3;
+ this.胶水上下线.Text = "胶水寿命";
+ this.胶水上下线.UseVisualStyleBackColor = true;
//
// 剩余寿命
//
this.剩余寿命.Anchor = System.Windows.Forms.AnchorStyles.None;
this.剩余寿命.AutoSize = true;
this.剩余寿命.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
- this.剩余寿命.Location = new System.Drawing.Point(1090, 160);
+ this.剩余寿命.Location = new System.Drawing.Point(1239, 175);
this.剩余寿命.Name = "剩余寿命";
- this.剩余寿命.Size = new System.Drawing.Size(111, 66);
+ this.剩余寿命.Size = new System.Drawing.Size(143, 33);
this.剩余寿命.TabIndex = 5;
this.剩余寿命.Text = "剩余寿命";
//
@@ -725,7 +558,7 @@ namespace WindowsFormsApp1
this.MES提示.Anchor = System.Windows.Forms.AnchorStyles.None;
this.MES提示.AutoSize = true;
this.MES提示.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
- this.MES提示.Location = new System.Drawing.Point(26, 169);
+ this.MES提示.Location = new System.Drawing.Point(45, 167);
this.MES提示.Name = "MES提示";
this.MES提示.Size = new System.Drawing.Size(212, 48);
this.MES提示.TabIndex = 4;
@@ -736,11 +569,10 @@ namespace WindowsFormsApp1
this.Tray盘二维码.Anchor = System.Windows.Forms.AnchorStyles.None;
this.Tray盘二维码.AutoSize = true;
this.Tray盘二维码.Font = new System.Drawing.Font("宋体", 21.85714F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
- this.Tray盘二维码.Location = new System.Drawing.Point(339, 163);
+ this.Tray盘二维码.Location = new System.Drawing.Point(767, 162);
this.Tray盘二维码.Name = "Tray盘二维码";
- this.Tray盘二维码.Size = new System.Drawing.Size(664, 59);
+ this.Tray盘二维码.Size = new System.Drawing.Size(0, 59);
this.Tray盘二维码.TabIndex = 2;
- this.Tray盘二维码.Text = "托盘二维码:921391293";
//
// groupBox1
//
@@ -753,7 +585,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, 243);
+ this.groupBox1.Size = new System.Drawing.Size(1752, 149);
this.groupBox1.TabIndex = 4;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "处理界面";
@@ -777,7 +609,7 @@ namespace WindowsFormsApp1
this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F));
this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 80F));
this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F));
- this.tableLayoutPanel3.Size = new System.Drawing.Size(1721, 183);
+ this.tableLayoutPanel3.Size = new System.Drawing.Size(1721, 89);
this.tableLayoutPanel3.TabIndex = 4;
//
// 开始处理
@@ -785,10 +617,10 @@ namespace WindowsFormsApp1
this.开始处理.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(192)))), ((int)(((byte)(0)))));
this.开始处理.Dock = System.Windows.Forms.DockStyle.Fill;
this.开始处理.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
- this.开始处理.Location = new System.Drawing.Point(21, 23);
+ this.开始处理.Location = new System.Drawing.Point(21, 13);
this.开始处理.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.开始处理.Name = "开始处理";
- this.开始处理.Size = new System.Drawing.Size(129, 136);
+ this.开始处理.Size = new System.Drawing.Size(129, 61);
this.开始处理.TabIndex = 1;
this.开始处理.Text = "开始处理";
this.开始处理.UseVisualStyleBackColor = false;
@@ -808,8 +640,6 @@ namespace WindowsFormsApp1
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 16.66667F));
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 16.66667F));
this.tableLayoutPanel2.Controls.Add(this.linemode, 3, 0);
- this.tableLayoutPanel2.Controls.Add(this.MES通讯时间, 5, 1);
- this.tableLayoutPanel2.Controls.Add(this.MES链接状态, 4, 1);
this.tableLayoutPanel2.Controls.Add(this.当前时间, 5, 0);
this.tableLayoutPanel2.Controls.Add(this.操作人员ID, 4, 0);
this.tableLayoutPanel2.Controls.Add(this.linetype, 2, 0);
@@ -818,12 +648,10 @@ namespace WindowsFormsApp1
this.tableLayoutPanel2.Location = new System.Drawing.Point(176, 6);
this.tableLayoutPanel2.Margin = new System.Windows.Forms.Padding(5, 6, 5, 6);
this.tableLayoutPanel2.Name = "tableLayoutPanel2";
- this.tableLayoutPanel2.RowCount = 3;
+ this.tableLayoutPanel2.RowCount = 1;
this.tableLayoutPanel3.SetRowSpan(this.tableLayoutPanel2, 3);
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
- this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
- this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
- this.tableLayoutPanel2.Size = new System.Drawing.Size(1540, 171);
+ this.tableLayoutPanel2.Size = new System.Drawing.Size(1540, 77);
this.tableLayoutPanel2.TabIndex = 3;
//
// linemode
@@ -834,40 +662,11 @@ namespace WindowsFormsApp1
this.linemode.Location = new System.Drawing.Point(774, 1);
this.linemode.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
this.linemode.Name = "linemode";
- this.tableLayoutPanel2.SetRowSpan(this.linemode, 3);
- this.linemode.Size = new System.Drawing.Size(245, 169);
+ this.linemode.Size = new System.Drawing.Size(245, 75);
this.linemode.TabIndex = 16;
this.linemode.Text = "MachineID";
this.linemode.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
- // MES通讯时间
- //
- this.MES通讯时间.AutoSize = true;
- this.MES通讯时间.Dock = System.Windows.Forms.DockStyle.Fill;
- this.MES通讯时间.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
- this.MES通讯时间.Location = new System.Drawing.Point(1286, 57);
- this.MES通讯时间.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
- this.MES通讯时间.Name = "MES通讯时间";
- this.tableLayoutPanel2.SetRowSpan(this.MES通讯时间, 2);
- this.MES通讯时间.Size = new System.Drawing.Size(248, 113);
- this.MES通讯时间.TabIndex = 15;
- this.MES通讯时间.Text = "MES通讯时间:None";
- this.MES通讯时间.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
- //
- // MES链接状态
- //
- this.MES链接状态.AutoSize = true;
- this.MES链接状态.Dock = System.Windows.Forms.DockStyle.Fill;
- this.MES链接状态.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
- this.MES链接状态.Location = new System.Drawing.Point(1030, 57);
- this.MES链接状态.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
- this.MES链接状态.Name = "MES链接状态";
- this.tableLayoutPanel2.SetRowSpan(this.MES链接状态, 2);
- this.MES链接状态.Size = new System.Drawing.Size(245, 113);
- this.MES链接状态.TabIndex = 12;
- this.MES链接状态.Text = "MES链接状态:None";
- this.MES链接状态.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
- //
// 当前时间
//
this.当前时间.AutoSize = true;
@@ -876,7 +675,7 @@ namespace WindowsFormsApp1
this.当前时间.Location = new System.Drawing.Point(1286, 1);
this.当前时间.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
this.当前时间.Name = "当前时间";
- this.当前时间.Size = new System.Drawing.Size(248, 55);
+ this.当前时间.Size = new System.Drawing.Size(248, 75);
this.当前时间.TabIndex = 11;
this.当前时间.Text = "当前时间:";
this.当前时间.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
@@ -885,11 +684,11 @@ 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("微软雅黑", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.操作人员ID.Location = new System.Drawing.Point(1030, 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, 55);
+ this.操作人员ID.Size = new System.Drawing.Size(245, 75);
this.操作人员ID.TabIndex = 6;
this.操作人员ID.Text = "操作人员ID:";
this.操作人员ID.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
@@ -902,8 +701,7 @@ namespace WindowsFormsApp1
this.linetype.Location = new System.Drawing.Point(518, 1);
this.linetype.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
this.linetype.Name = "linetype";
- this.tableLayoutPanel2.SetRowSpan(this.linetype, 3);
- this.linetype.Size = new System.Drawing.Size(245, 169);
+ this.linetype.Size = new System.Drawing.Size(245, 75);
this.linetype.TabIndex = 5;
this.linetype.Text = "StationID";
this.linetype.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
@@ -916,8 +714,7 @@ namespace WindowsFormsApp1
this.linecode.Location = new System.Drawing.Point(262, 1);
this.linecode.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
this.linecode.Name = "linecode";
- this.tableLayoutPanel2.SetRowSpan(this.linecode, 3);
- this.linecode.Size = new System.Drawing.Size(245, 169);
+ this.linecode.Size = new System.Drawing.Size(245, 75);
this.linecode.TabIndex = 4;
this.linecode.Text = "Line";
this.linecode.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
@@ -930,8 +727,7 @@ namespace WindowsFormsApp1
this.linename.Location = new System.Drawing.Point(6, 1);
this.linename.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
this.linename.Name = "linename";
- this.tableLayoutPanel2.SetRowSpan(this.linename, 3);
- this.linename.Size = new System.Drawing.Size(245, 169);
+ this.linename.Size = new System.Drawing.Size(245, 75);
this.linename.TabIndex = 3;
this.linename.Text = "线别:";
this.linename.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
@@ -943,11 +739,11 @@ namespace WindowsFormsApp1
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBox3.Controls.Add(this.richTextBox1);
this.groupBox3.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
- this.groupBox3.Location = new System.Drawing.Point(4, 785);
+ this.groupBox3.Location = new System.Drawing.Point(4, 687);
this.groupBox3.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Padding = new System.Windows.Forms.Padding(4, 5, 4, 5);
- this.groupBox3.Size = new System.Drawing.Size(1752, 234);
+ this.groupBox3.Size = new System.Drawing.Size(1752, 232);
this.groupBox3.TabIndex = 6;
this.groupBox3.TabStop = false;
this.groupBox3.Text = "日志页面";
@@ -957,11 +753,11 @@ namespace WindowsFormsApp1
this.richTextBox1.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)));
- this.richTextBox1.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+ this.richTextBox1.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.richTextBox1.Location = new System.Drawing.Point(20, 48);
this.richTextBox1.Margin = new System.Windows.Forms.Padding(5, 6, 5, 6);
this.richTextBox1.Name = "richTextBox1";
- this.richTextBox1.Size = new System.Drawing.Size(1718, 171);
+ this.richTextBox1.Size = new System.Drawing.Size(1718, 169);
this.richTextBox1.TabIndex = 0;
this.richTextBox1.Text = "";
//
@@ -1048,17 +844,6 @@ namespace WindowsFormsApp1
this.timer1.Interval = 1000;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
//
- // 胶水上下线
- //
- this.胶水上下线.Dock = System.Windows.Forms.DockStyle.Fill;
- this.胶水上下线.Location = new System.Drawing.Point(1081, 5);
- this.胶水上下线.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
- this.胶水上下线.Name = "胶水上下线";
- this.胶水上下线.Size = new System.Drawing.Size(130, 119);
- this.胶水上下线.TabIndex = 3;
- this.胶水上下线.Text = "胶水寿命";
- this.胶水上下线.UseVisualStyleBackColor = true;
- //
// MainForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(12F, 24F);
@@ -1073,19 +858,17 @@ namespace WindowsFormsApp1
this.Text = "Form1";
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
this.Load += new System.EventHandler(this.Form1_Load);
+ this.plcStatusGroupBox.ResumeLayout(false);
+ this.plcStatusGroupBox.PerformLayout();
this.menuStrip1.ResumeLayout(false);
this.menuStrip1.PerformLayout();
this.tableLayoutPanel1.ResumeLayout(false);
this.tableLayoutPanel4.ResumeLayout(false);
- this.groupBox4.ResumeLayout(false);
- this.tableLayoutPanel9.ResumeLayout(false);
- this.tableLayoutPanel9.PerformLayout();
this.groupBox2.ResumeLayout(false);
this.tableLayoutPanel7.ResumeLayout(false);
this.tableLayoutPanel7.PerformLayout();
this.gropb.ResumeLayout(false);
this.tableLayoutPanel6.ResumeLayout(false);
- this.tableLayoutPanel6.PerformLayout();
this.原料包装LOT号.ResumeLayout(false);
this.tableLayoutPanel5.ResumeLayout(false);
this.tableLayoutPanel5.PerformLayout();
@@ -1146,31 +929,14 @@ namespace WindowsFormsApp1
private System.Windows.Forms.ToolStripMenuItem 扭力角度扭矩设置ToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem 压力曲线设置ToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem 螺丝枪扭力设置ToolStripMenuItem;
- private System.Windows.Forms.GroupBox groupBox4;
- private System.Windows.Forms.TableLayoutPanel tableLayoutPanel9;
- private System.Windows.Forms.Label PLC1时间;
- private System.Windows.Forms.Label PLC1机台状态;
- private System.Windows.Forms.Label PLC1状态;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel7;
- private System.Windows.Forms.Label 事件4时间;
- private System.Windows.Forms.Label 事件3时间;
- private System.Windows.Forms.Label 事件2时间;
private System.Windows.Forms.Label 事件1时间;
- private System.Windows.Forms.Label 事件2;
private System.Windows.Forms.Label 事件1;
- private System.Windows.Forms.Label 事件2结果;
private System.Windows.Forms.Label 事件1结果;
- private System.Windows.Forms.Label 事件3结果;
- private System.Windows.Forms.Label 事件3;
- private System.Windows.Forms.Label 事件4;
- private System.Windows.Forms.Label 事件4结果;
- private System.Windows.Forms.Label PLC1名称;
private System.Windows.Forms.Label MES提示信息;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2;
private System.Windows.Forms.Label linemode;
- private System.Windows.Forms.Label MES通讯时间;
- private System.Windows.Forms.Label MES链接状态;
private System.Windows.Forms.Label 当前时间;
private System.Windows.Forms.Label 操作人员ID;
private System.Windows.Forms.Label linetype;
@@ -1179,6 +945,9 @@ namespace WindowsFormsApp1
private System.Windows.Forms.Label 剩余寿命;
private System.Windows.Forms.Button 胶水上下线;
private System.Windows.Forms.ToolStripMenuItem 图片展示ToolStripMenuItem;
+ private System.Windows.Forms.GroupBox plcStatusGroupBox;
+ private System.Windows.Forms.TableLayoutPanel plcStatusTableLayout;
+
}
}
diff --git a/WindowsFormsApp1/MainForm.cs b/WindowsFormsApp1/MainForm.cs
index ebb839f..59e721c 100644
--- a/WindowsFormsApp1/MainForm.cs
+++ b/WindowsFormsApp1/MainForm.cs
@@ -23,14 +23,28 @@ using WindowsFormsApp1.mod.server;
using WindowsFormsApp1.server;
using static SQLite.SQLite3;
using static WindowsFormsApp1.server.ApiClient;
+using Label = System.Windows.Forms.Label;
+
namespace WindowsFormsApp1
{
public partial class MainForm : Form
{
+ // 添加一个标志变量,用于标记是否已经执行了清理操作
+ private bool _isCleanupDone = false;
+ private bool _isFormClosing = false; // 添加标志,表示窗体正在关闭
+ // 添加一个静态变量来跟踪下一个要使用的槽位
+ private static int _nextEventSlot = 1;
+ // 在MainForm类中添加一个字典,用于存储PLC状态控件
+ private Dictionary plcStatusLabels = new Dictionary();
+ private Dictionary plcStatusIndicators = new Dictionary();
+
public MainForm()
{
InitializeComponent();
+ // 添加FormClosed事件处理程序
+ this.FormClosed += MainForm_FormClosed;
+
CheckForIllegalCrossThreadCalls = false;
}
@@ -55,6 +69,14 @@ namespace WindowsFormsApp1
//lineremark7.Text = "";
操作人员ID.Text = Init.t_User.username;
+
+
+ // 添加窗体关闭事件处理
+ this.FormClosing += MainForm_FormClosing;
+
+ // 自动开始处理
+ 开始处理_Click(this, EventArgs.Empty);
+
}
@@ -84,7 +106,10 @@ namespace WindowsFormsApp1
{
//PLC链接状态.Text = "PLC链接状态:NG";
//PLC链接状态.BackColor = Color.Red;
- PLC_Form(Plc, plcstate.NG, DateTime.Now);
+
+ // 更新对应PLC的状态指示器为红色
+ UpdatePlcStatus(Plc.id, false);
+
LogExecute.logNet.WriteError($"{Plc.plcip}建立S7连接失败");
continue;
}
@@ -101,7 +126,6 @@ namespace WindowsFormsApp1
{
//PLC链接状态.Text = "PLC链接状态:NG";
//PLC链接状态.BackColor = Color.Red;
- PLC_Form(Plc, plcstate.NG, DateTime.Now);
LogExecute.logNet.WriteError($"{Plc.plcip}读取全部地址处理错误:处理停止");
continue;
}
@@ -113,12 +137,10 @@ namespace WindowsFormsApp1
{
//PLC链接状态.Text = "PLC链接状态:NG";
//PLC链接状态.BackColor = Color.Red;
- PLC_Form(Plc, plcstate.NG, DateTime.Now);
LogExecute.logNet.WriteError($"{Plc.plcip}写入心跳错误:处理停止");
continue;
}
-
LOT号.Text = PlcData.Read_MaterialCode0;
Tray盘二维码.Text = PlcData.Read_MaterialCode1;
@@ -127,7 +149,9 @@ namespace WindowsFormsApp1
//PLC链接状态.Text = "PLC链接状态:OK";
//PLC链接状态.BackColor = SystemColors.Control;
//PLC通讯时间.Text = "PLC通讯时间:" + Plc_Time.ToString("MM-dd HH:mm:ss");
- PLC_Form(Plc, plcstate.OK, Plc_Time);
+ // 更新对应PLC的状态指示器为绿色
+ UpdatePlcStatus(Plc.id, true);
+
#endregion
ApiClient apiClient = new ApiClient();
@@ -150,10 +174,10 @@ namespace WindowsFormsApp1
var statusresult = apiClient.CallFunctionByName("Status", PlcData, otherdata);
if (statusresult.Success)
{
- MES链接状态.Text = "MES链接状态:OK";
- MES链接状态.BackColor = SystemColors.Control;
- MES通讯时间.Text = "MES通讯时间:" + DateTime.Now.ToString("MM-dd HH:mm:ss");
- MES_MsgfORM("Status", statusresult.Mesresult, statusresult.Requesttime);
+ //MES链接状态.Text = "MES链接状态:OK";
+ //MES链接状态.BackColor = SystemColors.Control;
+ //MES通讯时间.Text = "MES通讯时间:" + DateTime.Now.ToString("MM-dd HH:mm:ss");
+ MES_MsgfORM("Status", statusresult, statusresult.Requesttime);
if (statusresult.Mesresult != mesresult.PASS)
{
PlcData.Write_Status = 1001;
@@ -163,8 +187,8 @@ namespace WindowsFormsApp1
}
else
{
- MES链接状态.Text = "MES链接状态:NG";
- MES链接状态.BackColor = Color.Red;
+ //MES链接状态.Text = "MES链接状态:NG";
+ //MES链接状态.BackColor = Color.Red;
LogExecute.logNet.WriteError($"MES通讯异常!");
PlcData.Write_Status = 1002;
var errresult = siemensHelp.WriteAddress(plcaddress, PlcData);
@@ -180,7 +204,7 @@ namespace WindowsFormsApp1
{
//反馈报警
List list = new List();
-///////////////////////////////测试用
+ ///////////////////////////////测试用
list.Add("M03CVSO-01");
otherdata.Plc_ErrorMsgs = list;
Init.Plcstatus = PlcData.Read_Status;
@@ -188,10 +212,10 @@ namespace WindowsFormsApp1
var statusresult = apiClient.CallFunctionByName("Alarm", PlcData, otherdata);
if (statusresult.Success)
{
- MES链接状态.Text = "MES链接状态:OK";
- MES链接状态.BackColor = SystemColors.Control;
- MES通讯时间.Text = "MES通讯时间:" + DateTime.Now.ToString("MM-dd HH:mm:ss");
- MES_MsgfORM("Alarm", statusresult.Mesresult, statusresult.Requesttime);
+ //MES链接状态.Text = "MES链接状态:OK";
+ //MES链接状态.BackColor = SystemColors.Control;
+ //MES通讯时间.Text = "MES通讯时间:" + DateTime.Now.ToString("MM-dd HH:mm:ss");
+ MES_MsgfORM("Alarm", statusresult, statusresult.Requesttime);
if (statusresult.Mesresult != mesresult.PASS)
{
PlcData.Write_Status = 1001;
@@ -201,8 +225,8 @@ namespace WindowsFormsApp1
}
else
{
- MES链接状态.Text = "MES链接状态:NG";
- MES链接状态.BackColor = Color.Red;
+ //MES链接状态.Text = "MES链接状态:NG";
+ //MES链接状态.BackColor = Color.Red;
LogExecute.logNet.WriteError($"MES通讯异常!");
PlcData.Write_Status = 1002;
siemensHelp.WriteAddress(plcaddress, PlcData);
@@ -232,7 +256,6 @@ namespace WindowsFormsApp1
{
//PLC链接状态.Text = "PLC链接状态:NG";
//PLC链接状态.BackColor = Color.Red;
- PLC_Form(Plc, plcstate.NG, DateTime.Now);
LogExecute.logNet.WriteError($"{Plc.plcip}写入地址处理错误:处理停止");
}
continue;
@@ -251,7 +274,7 @@ namespace WindowsFormsApp1
LogExecute.logNet.WriteError($"未找到当前期望接口ID {nowflow.hopeinterfaceid},对应的接口!");
continue;
}
-
+
#endregion
#region 根据流程,判断是否需要扫码、气密、扭力等
if (nowflow.scan)
@@ -263,7 +286,8 @@ namespace WindowsFormsApp1
{
string returnValue = scanForm.ReturnValue;
otherdata.JS_SN = returnValue;
-
+ //Init.SN = returnValue;
+ LOT号.Text = returnValue;
Init.ScanString = returnValue;
}
else
@@ -283,15 +307,14 @@ namespace WindowsFormsApp1
{
//PLC链接状态.Text = "PLC链接状态:NG";
//PLC链接状态.BackColor = Color.Red;
- PLC_Form(Plc, plcstate.NG, DateTime.Now);
LogExecute.logNet.WriteError($"{Plc.plcip}写入地址处理错误:处理停止");
continue;
}
else
{
- MES链接状态.Text = "MES链接状态:OK";
- MES链接状态.BackColor = SystemColors.Control;
- MES通讯时间.Text = "MES通讯时间:" + DateTime.Now.ToString("MM-dd HH:mm:ss");
+ //MES链接状态.Text = "MES链接状态:OK";
+ //MES链接状态.BackColor = SystemColors.Control;
+ //MES通讯时间.Text = "MES通讯时间:" + DateTime.Now.ToString("MM-dd HH:mm:ss");
}
continue;
@@ -315,7 +338,6 @@ namespace WindowsFormsApp1
{
//PLC链接状态.Text = "PLC链接状态:NG";
//PLC链接状态.BackColor = Color.Red;
- PLC_Form(Plc, plcstate.NG, DateTime.Now);
LogExecute.logNet.WriteError($"{Plc.plcip}压力曲线数据地址处理错误:处理停止");
continue;
}
@@ -333,7 +355,6 @@ namespace WindowsFormsApp1
{
//PLC链接状态.Text = "PLC链接状态:NG";
//PLC链接状态.BackColor = Color.Red;
- PLC_Form(Plc, plcstate.NG, DateTime.Now);
LogExecute.logNet.WriteError($"{Plc.plcip}螺丝枪扭力数据地址处理错误:处理停止");
continue;
}
@@ -352,7 +373,6 @@ namespace WindowsFormsApp1
{
//PLC链接状态.Text = "PLC链接状态:NG";
//PLC链接状态.BackColor = Color.Red;
- PLC_Form(Plc, plcstate.NG, DateTime.Now);
LogExecute.logNet.WriteError($"{Plc.plcip}螺丝枪角度数据地址处理错误:处理停止");
continue;
}
@@ -363,7 +383,8 @@ namespace WindowsFormsApp1
//文件上传
}
#endregion
-
+ // NG料进站不判断,进站MES返回FAIL,记录。该站其他事件不触发MES,直接跳过
+ //if()
#region 判断物料调用次数 固化站
if (Init.t_Line.lineremark2 == "Curing")
{
@@ -388,7 +409,7 @@ namespace WindowsFormsApp1
materialCall.checkin1 = DateTime.Now;
shouldCallApi = true;
}
- else if (!materialCall.checkout3.HasValue
+ else if (!materialCall.checkout3.HasValue
&& materialCall.checkout2.HasValue
&& materialCall.checkout1.HasValue
&& nowinterface.code.Contains("Checkout"))
@@ -406,6 +427,7 @@ namespace WindowsFormsApp1
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"))
{
@@ -413,6 +435,7 @@ namespace WindowsFormsApp1
materialCall.checkout1 = DateTime.Now;
else if (!materialCall.checkout2.HasValue)
materialCall.checkout2 = DateTime.Now;
+ PlcData.Write_Status = PLC_Status.SN_Checkout;
}
}
materialCallHelper.Update(materialCall);
@@ -427,7 +450,6 @@ namespace WindowsFormsApp1
var writeresult = siemensHelp.WriteAddress(plcaddress, PlcData);
if (!writeresult.Success)
{
- PLC_Form(Plc, plcstate.NG, DateTime.Now);
LogExecute.logNet.WriteError($"{Plc.plcip}写入地址处理错误:处理停止");
continue;
}
@@ -436,12 +458,17 @@ namespace WindowsFormsApp1
}
#endregion
+ //文件路径 列表
+ 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;
+
+
#region 调用后端接口
var result = apiClient.CallFunctionByName(nowinterface.code, PlcData, otherdata);
if (result.IsShow)
{
- MES提示信息.Visible = true;
- MES提示信息.Text = DateTime.Now.ToString("HH:mm:ss") + ":" + result.Msg;
+ MES_MsgfORM(nowinterface.code, result, result.Requesttime);
}
if (result.Success)
@@ -451,18 +478,17 @@ namespace WindowsFormsApp1
{
//PLC链接状态.Text = "PLC链接状态:NG";
//PLC链接状态.BackColor = Color.Red;
- PLC_Form(Plc, plcstate.NG, DateTime.Now);
LogExecute.logNet.WriteError($"{Plc.plcip}写入地址处理错误:处理停止");
continue;
}
else
{
ChangeBarcode();
- MES_MsgfORM(nowinterface.code, result.Mesresult, result.Requesttime);
+ MES_MsgfORM(nowinterface.code, result, result.Requesttime);
- MES链接状态.Text = "MES链接状态:OK";
- MES链接状态.BackColor = SystemColors.Control;
- MES通讯时间.Text = "MES通讯时间:" + DateTime.Now.ToString("MM-dd HH:mm:ss");
+ //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;
@@ -473,8 +499,8 @@ namespace WindowsFormsApp1
}
else
{
- MES链接状态.Text = "MES链接状态:NG";
- MES链接状态.BackColor = Color.Red;
+ //MES链接状态.Text = "MES链接状态:NG";
+ //MES链接状态.BackColor = Color.Red;
LogExecute.logNet.WriteError($"MES通讯异常!");
PlcData.Write_Status = 1002;
siemensHelp.WriteAddress(plcaddress, PlcData);
@@ -501,12 +527,13 @@ namespace WindowsFormsApp1
{
SQLiteHelper sQLiteHelper_plc = new db.SQLiteHelper();
- var plc_sqlresult = sQLiteHelper_plc.QuerySingle(a=>a.id == Init.t_Line.plcid);
+ var plc_sqlresult = sQLiteHelper_plc.QueryAll();
if (!plc_sqlresult.Success)
{
MessageBox.Show("无法初始化PLC信息,无法开始处理!");
return;
}
+ var plc_result = plc_sqlresult.Data.FindAll(a => Init.t_Lineplcs.Select(p => p.plcid).Contains(a.id));
SQLiteHelper sQLiteHelper_key = new db.SQLiteHelper();
var key_sqlresult = sQLiteHelper_key.QueryAll();
@@ -583,6 +610,9 @@ namespace WindowsFormsApp1
Init.t_Pressurecurves = pressurecurve_result.Data;
Init.t_Interfaces = interface_result.Data;
Init.t_Keyvalues = key_sqlresult.Data;
+
+ // 初始化PLC状态面板
+ InitializePlcStatusPanel();
#endregion
#region 初始化COM口服务
try
@@ -640,17 +670,19 @@ namespace WindowsFormsApp1
#endregion
Init.threadHelps = new List();
- var plc = plc_sqlresult.Data;
- plc.plchelp = new SiemensHelp(plc.plcip, plc.timeout);
- ThreadHelp threadHelp = new ThreadHelp();
- if (!threadHelp.isrunning1)
+ foreach (var plc in plc_result)
{
- threadHelp.cancellationTokenSource1 = new CancellationTokenSource();
- threadHelp.Thread = new Thread(() => build(plc, threadHelp.cancellationTokenSource1.Token));
- threadHelp.Thread.Start();
- threadHelp.isrunning1 = true;
+ plc.plchelp = new SiemensHelp(plc.plcip, plc.timeout);
+ ThreadHelp threadHelp = new ThreadHelp();
+ if (!threadHelp.isrunning1)
+ {
+ threadHelp.cancellationTokenSource1 = new CancellationTokenSource();
+ threadHelp.Thread = new Thread(() => build(plc, threadHelp.cancellationTokenSource1.Token));
+ threadHelp.Thread.Start();
+ threadHelp.isrunning1 = true;
+ }
+ Init.threadHelps.Add(threadHelp);
}
- Init.threadHelps.Add(threadHelp);
开始处理.Text = "停止处理";
开始处理.BackColor = Color.Red;
@@ -685,6 +717,78 @@ namespace WindowsFormsApp1
LogExecute.logNet.WriteInfo($"用户{Init.t_User.username},停止处理!");
}
}
+
+ // 添加FormClosed事件处理程序
+ private void MainForm_FormClosed(object sender, FormClosedEventArgs e)
+ {
+ // 如果已经执行过清理,则直接返回
+ if (_isCleanupDone)
+ return;
+
+ try
+ {
+ _isCleanupDone = true; // 标记清理操作已执行
+ // 给日志系统一点时间完成写入
+ System.Threading.Thread.Sleep(100);
+ // 停止所有线程
+ if (Init.threadHelps != null)
+ {
+ foreach (var thread in Init.threadHelps)
+ {
+ try
+ {
+ if (thread.Thread != null && thread.Thread.IsAlive)
+ {
+ thread.cancellationTokenSource1?.Cancel();
+ }
+ }
+ catch { /* 忽略异常 */ }
+ }
+ }
+
+ // 安全关闭串口
+ try
+ {
+ if (Init.ScanPort != null && Init.ScanPort.IsOpen)
+ {
+ Init.ScanPort.Close();
+ Init.ScanPort = null;
+ }
+ }
+ catch { /* 忽略异常 */ }
+
+ try
+ {
+ if (Init.AirtightPort != null && Init.AirtightPort.IsOpen)
+ {
+ Init.AirtightPort.Close();
+ Init.AirtightPort = null;
+ }
+ }
+ catch { /* 忽略异常 */ }
+ }
+ catch { /* 忽略所有异常 */ }
+ }
+
+ private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
+ {
+ // 设置窗体正在关闭标志
+ _isFormClosing = true;
+
+ // 如果当前正在处理中,则记录日志
+ if (开始处理.Text == "停止处理")
+ {
+ try
+ {
+ LogExecute.logNet.WriteInfo($"用户{Init.t_User.username},程序关闭时自动停止处理!");
+ // 给日志系统一点时间完成写入
+ System.Threading.Thread.Sleep(100);
+ }
+ catch { /* 忽略异常 */ }
+ }
+
+ }
+
#endregion
#region 页面按钮-跳转
private void 扭力角度扭矩设置ToolStripMenuItem_Click(object sender, EventArgs e)
@@ -771,46 +875,77 @@ namespace WindowsFormsApp1
#region 页面-布局、日志等
private void LogNet_BeforeSaveToFile(object sender, HslEventArgs e)
{
- lock (this)
+ // 如果窗体正在关闭,则不再尝试更新UI
+ if (_isFormClosing)
{
- DateTime time = e.HslMessage.Time;//获取时间
- string text = e.HslMessage.Text;//日志文本
- int textLength = richTextBox1.TextLength;
- int lineCount = richTextBox1.GetLineFromCharIndex(textLength);
-
- if (lineCount >= 200)
- {
- richTextBox1.Clear();
- }
-
- if (e.HslMessage.Degree == HslMessageDegree.ERROR)
- {
- richTextBox1.SelectionColor = Color.Red;
- richTextBox1.AppendText("[错误] " + time.ToString() + " | " + text + "\n");
- }
- else if (e.HslMessage.Degree == HslMessageDegree.DEBUG)
- {
- richTextBox1.SelectionColor = Color.Green;
- richTextBox1.AppendText("[日志] " + time.ToString() + " | " + text + "\n");
- }
- else if (e.HslMessage.Degree == HslMessageDegree.WARN)
- {
- richTextBox1.SelectionColor = Color.Orange;
- richTextBox1.AppendText("[警告] " + time.ToString() + " | " + text + "\n");
- }
- else if (e.HslMessage.Degree == HslMessageDegree.INFO)
- {
- richTextBox1.SelectionColor = Color.Orange;
- richTextBox1.AppendText("[提示] " + time.ToString() + " | " + text + "\n");
- }
- else
- {
- richTextBox1.SelectionColor = Color.Red;
- richTextBox1.AppendText("[未知] " + time.ToString() + " | " + text + "\n");
- }
+ // 仅写入文件日志,不更新UI
+ return;
}
- }
+ try
+ {
+ // 使用 BeginInvoke 而不是直接在锁内操作 UI 控件,减少 UI 线程阻塞
+ this.BeginInvoke(new Action(() =>
+ {
+ DateTime time = e.HslMessage.Time;
+ string text = e.HslMessage.Text;
+ // 使用 StringBuilder 构建日志文本,提高性能
+ StringBuilder logBuilder = new StringBuilder();
+ string logPrefix;
+ Color logColor;
+
+ // 根据日志级别设置前缀和颜色
+ switch (e.HslMessage.Degree)
+ {
+ case HslMessageDegree.ERROR:
+ logPrefix = "[错误] ";
+ logColor = Color.Red;
+ break;
+ case HslMessageDegree.DEBUG:
+ logPrefix = "[日志] ";
+ logColor = Color.Green;
+ break;
+ case HslMessageDegree.WARN:
+ case HslMessageDegree.INFO:
+ logPrefix = e.HslMessage.Degree == HslMessageDegree.WARN ? "[警告] " : "[提示] ";
+ logColor = Color.Orange;
+ break;
+ default:
+ logPrefix = "[未知] ";
+ logColor = Color.Red;
+ break;
+ }
+
+ logBuilder.Append(logPrefix).Append(time.ToString()).Append(" | ").Append(text).Append("\n");
+
+ // 检查日志行数,如果超过阈值则清理
+ int lineCount = richTextBox1.GetLineFromCharIndex(richTextBox1.TextLength);
+ if (lineCount >= 200)
+ {
+ // 优化:只保留后 100 行,而不是全部清空再重新添加
+ int startIndex = richTextBox1.GetFirstCharIndexFromLine(lineCount - 100);
+ if (startIndex > 0)
+ {
+ richTextBox1.Select(0, startIndex);
+ richTextBox1.SelectedText = "";
+ }
+ }
+
+ // 添加新日志
+ richTextBox1.SelectionStart = richTextBox1.TextLength;
+ richTextBox1.SelectionLength = 0;
+ richTextBox1.SelectionColor = logColor;
+ richTextBox1.AppendText(logBuilder.ToString());
+
+ // 重置颜色并滚动到底部
+ richTextBox1.SelectionStart = richTextBox1.TextLength;
+ richTextBox1.SelectionLength = 0;
+ richTextBox1.SelectionColor = richTextBox1.ForeColor;
+ richTextBox1.ScrollToCaret();
+ }));
+ }
+ catch { /* 忽略异常 */ }
+ }
private void timer1_Tick(object sender, EventArgs e)
{
当前时间.Text = "当前时间:" + DateTime.Now.ToString("MM-dd HH:mm:ss");
@@ -820,41 +955,19 @@ namespace WindowsFormsApp1
开始处理.Text = "开始处理";
开始处理.BackColor = Color.Green;
- MES链接状态.Text = "MES链接状态:None";
- MES链接状态.BackColor = SystemColors.Control;
+ //MES链接状态.Text = "MES链接状态:None";
+ //MES链接状态.BackColor = SystemColors.Control;
- MES通讯时间.Text = "MES通讯时间:None";
- MES通讯时间.BackColor = SystemColors.Control;
+ //MES通讯时间.Text = "MES通讯时间:None";
+ //MES通讯时间.BackColor = SystemColors.Control;
- PLC1名称.Visible = false;
-
- PLC1状态.Visible = false;
-
- PLC1机台状态.Visible = false;
-
- PLC1时间.Visible = false;
//胶水上下线.Enabled = false;
- MES提示信息.Visible = false;
- LOT号.Visible = false;
- Tray盘二维码.Visible = false;
+ //MES提示信息.Visible = false;
+ //LOT号.Visible = false;
+ //Tray盘二维码.Visible = false;
- 事件1.Visible = false;
- 事件1结果.Visible = false;
- 事件1时间.Visible = false;
-
- 事件2.Visible = false;
- 事件2结果.Visible = false;
- 事件2时间.Visible = false;
-
- 事件3.Visible = false;
- 事件3结果.Visible = false;
- 事件3时间.Visible = false;
-
- 事件4.Visible = false;
- 事件4结果.Visible = false;
- 事件4时间.Visible = false;
底部注释1.Visible = false;
底部注释2.Visible = false;
@@ -864,6 +977,12 @@ namespace WindowsFormsApp1
剩余寿命.Visible = false;
+ // 初始化所有PLC状态指示器为灰色(未连接状态)
+ foreach (var indicator in plcStatusIndicators.Values)
+ {
+ indicator.BackColor = Color.Gray;
+ }
+
}
public void ChangeBarcode()
@@ -871,148 +990,211 @@ namespace WindowsFormsApp1
剩余寿命.Visible = true;
var power = Init.t_Keyvalues.FirstOrDefault(a => a.key == "Power");
-
- 剩余寿命.Text = power == null ? "": power.value;
+
+ 剩余寿命.Text = power == null ? "" : power.value;
}
- public void PLC_Form(t_plc plc, plcstate state, DateTime time)
+ // 添加初始化PLC状态面板的方法
+ private void InitializePlcStatusPanel()
{
- string plcname = plc.plcip;
- string datetime = time.ToString("HH:mm:ss");
- PLC1名称.Visible = true;
- PLC1状态.Visible = true;
- PLC1机台状态.Visible = true;
- PLC1时间.Visible = true;
- PLC1名称.Text = plcname;
- PLC1状态.Text = state.ToString();
- PLC1机台状态.Text = Enum.GetName(typeof(plcstatus), Init.Plcstatus);
- PLC1时间.Text = datetime;
- if (PLC1状态.Text == plcstate.NG.ToString())
+ // 假设我们已经有一个名为plcStatusGroupBox的GroupBox控件
+ // 和一个名为plcStatusTableLayout的TableLayoutPanel控件
+
+ // 清空现有控件
+ plcStatusTableLayout.Controls.Clear();
+ plcStatusLabels.Clear();
+ plcStatusIndicators.Clear();
+
+ // 设置TableLayoutPanel的行列数
+ int plcCount = Init.t_Lineplcs?.Count ?? 0;
+ // 修改为横向布局:每列显示一个PLC,每个PLC占用一行两列
+ plcStatusTableLayout.ColumnCount = plcCount * 2; // 每个PLC需要2列
+ plcStatusTableLayout.RowCount = 1; // 只需要1行
+
+ // 设置列样式
+ plcStatusTableLayout.ColumnStyles.Clear();
+ for (int i = 0; i < plcCount; i++)
{
- PLC1状态.BackColor = Color.Red;
+ // 为每个PLC添加两列:一列放指示灯,一列放标签
+ plcStatusTableLayout.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 30F)); // 状态指示灯列
+ plcStatusTableLayout.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 150F)); // PLC信息列
}
- else
+
+ // 设置行样式
+ plcStatusTableLayout.RowStyles.Clear();
+ plcStatusTableLayout.RowStyles.Add(new RowStyle(SizeType.Absolute, 25F));
+
+ // 如果没有PLC,显示提示信息
+ if (plcCount == 0)
{
- PLC1状态.BackColor = SystemColors.Control;
+ var noPlcLabel = new System.Windows.Forms.Label();
+ noPlcLabel.Text = "未配置PLC";
+ noPlcLabel.Dock = DockStyle.Fill;
+ noPlcLabel.TextAlign = ContentAlignment.MiddleCenter;
+ plcStatusTableLayout.Controls.Add(noPlcLabel, 0, 0);
+ plcStatusTableLayout.SetColumnSpan(noPlcLabel, 2);
+ return;
}
- if (PLC1机台状态.Text == plcstatus.停机.ToString())
+
+ // 为每个PLC创建状态指示器
+ int colIndex = 0;
+ foreach (var linePlc in Init.t_Lineplcs)
{
- PLC1机台状态.BackColor = Color.Red;
- }
- else
- {
- PLC1机台状态.BackColor = SystemColors.Control;
+ // 获取PLC信息
+ var plc = Init.t_Plcaddresses.FirstOrDefault(p => p.plcid == linePlc.plcid);
+ if (plc == null) continue;
+
+ // 创建状态指示灯(一个小Panel)
+ Panel statusIndicator = new Panel();
+ statusIndicator.Size = new Size(16, 16);
+ statusIndicator.BackColor = Color.Gray; // 初始为灰色
+ statusIndicator.Margin = new Padding(5);
+
+ // 创建PLC名称标签
+ Label plcLabel = new Label();
+ plcLabel.Text = $"PLC-{plc.plcid}:{plc.dbaddress}";
+ plcLabel.Dock = DockStyle.Fill;
+ plcLabel.TextAlign = ContentAlignment.MiddleLeft;
+
+ // 添加到TableLayoutPanel(使用列索引)
+ plcStatusTableLayout.Controls.Add(statusIndicator, colIndex, 0); // 状态指示灯放在第一列
+ plcStatusTableLayout.Controls.Add(plcLabel, colIndex + 1, 0); // 标签放在第二列
+
+ // 保存引用以便后续更新
+ plcStatusIndicators[linePlc.plcid] = statusIndicator;
+ plcStatusLabels[linePlc.plcid] = plcLabel;
+
+ colIndex += 2; // 每个PLC占用两列,所以索引加2
}
}
- public void MES_MsgfORM(string name, mesresult result, DateTime dateTime)
+ // 添加更新PLC状态的方法
+ private void UpdatePlcStatus(int plcId, bool isConnected)
{
- if (事件1.Text == name)
+ try
{
- 事件1.Visible = true;
- 事件1结果.Visible = true;
- 事件1时间.Visible = true;
- 事件1.Text = name;
- 事件1时间.Text = dateTime.ToString("MM-dd HH:mm:ss");
- 事件1结果.Text = result.ToString();
- }
- else if (事件2.Text == name)
- {
- 事件2.Visible = true;
- 事件2结果.Visible = true;
- 事件2时间.Visible = true;
- 事件2.Text = name;
- 事件2时间.Text = dateTime.ToString("MM-dd HH:mm:ss");
- 事件2结果.Text = result.ToString();
- }
- else if (事件3.Text == name)
- {
- 事件3.Visible = true;
- 事件3结果.Visible = true;
- 事件3时间.Visible = true;
- 事件3.Text = name;
- 事件3时间.Text = dateTime.ToString("MM-dd HH:mm:ss");
- 事件3结果.Text = result.ToString();
- }
- else if (事件4.Text == name)
- {
- 事件4.Visible = true;
- 事件4结果.Visible = true;
- 事件4时间.Visible = true;
- 事件4.Text = name;
- 事件4时间.Text = dateTime.ToString("MM-dd HH:mm:ss");
- 事件4结果.Text = result.ToString();
- }
- else
- {
- if (事件1.Text.Contains("事件"))
+ if (plcStatusIndicators.ContainsKey(plcId))
{
- 事件1.Visible = true;
- 事件1结果.Visible = true;
- 事件1时间.Visible = true;
- 事件1.Text = name;
- 事件1时间.Text = dateTime.ToString("MM-dd HH:mm:ss");
- 事件1结果.Text = result.ToString();
+ // 使用Invoke确保在UI线程上更新控件
+ this.Invoke((MethodInvoker)delegate
+ {
+ plcStatusIndicators[plcId].BackColor = isConnected ? Color.Green : Color.Red;
+ });
}
- else if (事件2.Text.Contains("事件"))
- {
- 事件2.Visible = true;
- 事件2结果.Visible = true;
- 事件2时间.Visible = true;
- 事件2.Text = name;
- 事件2时间.Text = dateTime.ToString("MM-dd HH:mm:ss");
- 事件2结果.Text = result.ToString();
- }
- else if (事件3.Text.Contains("事件"))
- {
- 事件3.Visible = true;
- 事件3结果.Visible = true;
- 事件3时间.Visible = true;
- 事件3.Text = name;
- 事件3时间.Text = dateTime.ToString("MM-dd HH:mm:ss");
- 事件3结果.Text = result.ToString();
- }
- else if (事件4.Text.Contains("事件"))
- {
- 事件4.Visible = true;
- 事件4结果.Visible = true;
- 事件4时间.Visible = true;
- 事件4.Text = name;
- 事件4时间.Text = dateTime.ToString("MM-dd HH:mm:ss");
- 事件4结果.Text = result.ToString();
- }
- else
- {
- 事件1.Visible = true;
- 事件1结果.Visible = true;
- 事件1时间.Visible = true;
- 事件1.Text = name;
- 事件1时间.Text = dateTime.ToString("MM-dd HH:mm:ss");
- 事件1结果.Text = result.ToString();
+ }
+ catch { /* 忽略异常 */ }
+ }
- 事件2.Visible = false;
- 事件2结果.Visible = false;
- 事件2时间.Visible = false;
- 事件2.Text = "事件2";
- 事件2时间.Text = "事件2时间";
- 事件2结果.Text = "OK";
+ ///
+ /// 更新事件显示区域
+ ///
+ private void UpdateEventDisplay(string name, mesresult result, DateTime dateTime, string message)
+ {
+ UpdateEventSlot(事件1, 事件1结果, 事件1时间, name, result, dateTime, message);
+ // 根据接口名称显示特定信息
+ //UpdateSpecificEventInfo(name, message);
+ }
- 事件3.Visible = false;
- 事件3结果.Visible = false;
- 事件3时间.Visible = false;
- 事件3.Text = "事件3";
- 事件3时间.Text = "事件3时间";
- 事件3结果.Text = "OK";
+ ///
+ /// 查找可用的事件显示槽位
+ ///
+ private int FindAvailableEventSlot()
+ {
+ // 首先查找不可见的事件槽位
+ if (!事件1.Visible) return 1;
+ return 1;
+ }
- 事件4.Visible = false;
- 事件4结果.Visible = false;
- 事件4时间.Visible = false;
- 事件4.Text = "事件4";
- 事件4时间.Text = "事件4时间";
- 事件4结果.Text = "OK";
- }
+ ///
+ /// 更新指定事件槽位的显示内容
+ ///
+ private void UpdateEventSlot(Label eventLabel, Label resultLabel, Label timeLabel,
+ string name, mesresult result, DateTime dateTime, string message)
+ {
+ // 设置事件名称
+ eventLabel.Text = $"{name}";
+ eventLabel.Visible = true;
+
+ // 设置事件结果
+ resultLabel.Text = $"{(result == mesresult.PASS ? "PASS" : "FAIL")}";
+ resultLabel.ForeColor = result == mesresult.PASS ? Color.Green : Color.Red;
+ resultLabel.Visible = true;
+
+ // 设置事件时间
+ timeLabel.Text = $"{dateTime:MM-dd HH:mm:ss}";
+ timeLabel.Visible = true;
+ }
+
+ ///
+ /// 根据接口名称更新特定信息显示
+ ///
+ private void UpdateSpecificEventInfo(string name, string message)
+ {
+ // 根据不同的接口名称,显示特定的信息
+ switch (name)
+ {
+ case "SN_Release":
+ // 显示SN号
+ if (!string.IsNullOrEmpty(Init.ScanString))
+ {
+ LOT号.Text = $"SN号:{Init.ScanString}";
+ LOT号.Visible = true;
+ }
+ break;
+
+ case "Tray_Release":
+ // 显示Tray盘信息
+ if (!string.IsNullOrEmpty(message))
+ {
+ Tray盘二维码.Text = $"Tray盘:{message}";
+ Tray盘二维码.Visible = true;
+ }
+ break;
+
+ case "Status":
+ // 机台状态信息已在其他地方更新
+ break;
+
+ case "Alarm":
+ // 报警信息可以在底部注释中显示
+ if (!string.IsNullOrEmpty(message))
+ {
+ 底部注释3.Text = $"报警信息:{message}";
+ 底部注释3.Visible = true;
+ }
+ break;
+
+ // 可以根据需要添加更多的接口类型处理
+ default:
+ // 对于其他类型的接口,可以在底部注释中显示额外信息
+ if (!string.IsNullOrEmpty(message))
+ {
+ if (!底部注释4.Visible)
+ {
+ 底部注释4.Text = $"{name}:{message}";
+ 底部注释4.Visible = true;
+ }
+ else if (!底部注释5.Visible)
+ {
+ 底部注释5.Text = $"{name}:{message}";
+ 底部注释5.Visible = true;
+ }
+ }
+ break;
}
}
+
+ public void MES_MsgfORM(string name, ApiFormResult result, DateTime dateTime)
+ {
+ // 显示MES提示信息
+ MES提示信息.Visible = true;
+ MES提示信息.Text = $"{result.Msg}";
+ MES提示信息.ForeColor = result.Mesresult == mesresult.PASS ? Color.Green : Color.Red;
+
+ // 更新事件显示区域
+ UpdateEventDisplay(name, result.Mesresult, dateTime, result.Msg);
+ }
+
#endregion
#region 其他业务处理
diff --git a/WindowsFormsApp1/MaterialScanForm.cs b/WindowsFormsApp1/MaterialScanForm.cs
index f8412d4..91e1144 100644
--- a/WindowsFormsApp1/MaterialScanForm.cs
+++ b/WindowsFormsApp1/MaterialScanForm.cs
@@ -88,6 +88,12 @@ namespace WindowsFormsApp1
OtherData.opindex = 1;
var mesResult = _apiClient.CallFunctionByName("Glue_CheckOut", new plcdata(), OtherData);
+ if (mesResult.Mesresult == mesresult.FAIL)
+ {
+ MessageBox.Show("上线失败!", mesResult.Msg, MessageBoxButtons.OK, MessageBoxIcon.Error);
+
+ return;
+ }
var material = new t_materialscan
{
scancode = scanCode,
@@ -130,6 +136,12 @@ namespace WindowsFormsApp1
OtherData.opindex = 2;
var mesResult = _apiClient.CallFunctionByName("Glue_CheckOut", new plcdata(), OtherData);
+ if (mesResult.Mesresult == mesresult.FAIL)
+ {
+ MessageBox.Show("下线失败!", mesResult.Msg, MessageBoxButtons.OK, MessageBoxIcon.Error);
+ return;
+ }
+
material.isonline = false;
var result = _dbHelper.Update(material);
if (result.Success)
diff --git a/WindowsFormsApp1/Program.cs b/WindowsFormsApp1/Program.cs
index 6b8791d..c0f6b83 100644
--- a/WindowsFormsApp1/Program.cs
+++ b/WindowsFormsApp1/Program.cs
@@ -40,7 +40,7 @@ namespace WindowsFormsApp1
public static t_user t_User;
public static List t_Flows;
-
+ public static List t_Lineplcs;
public static List t_Interfaces;
public static List t_Plcaddresses;
diff --git a/WindowsFormsApp1/db/MES_PLCold.db b/WindowsFormsApp1/db/MES_PLCold.db
new file mode 100644
index 0000000..9f0c825
Binary files /dev/null and b/WindowsFormsApp1/db/MES_PLCold.db differ
diff --git a/WindowsFormsApp1/form/FLOW_Manage.Designer.cs b/WindowsFormsApp1/form/FLOW_Manage.Designer.cs
index 6c13765..10a7cc1 100644
--- a/WindowsFormsApp1/form/FLOW_Manage.Designer.cs
+++ b/WindowsFormsApp1/form/FLOW_Manage.Designer.cs
@@ -97,24 +97,24 @@
dataGridViewCellStyle3.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle3.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.dataGridView1.DefaultCellStyle = dataGridViewCellStyle3;
- this.dataGridView1.Location = new System.Drawing.Point(6, 5);
- this.dataGridView1.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5);
+ this.dataGridView1.Location = new System.Drawing.Point(7, 6);
+ this.dataGridView1.Margin = new System.Windows.Forms.Padding(7, 6, 7, 6);
this.dataGridView1.Name = "dataGridView1";
this.dataGridView1.ReadOnly = true;
this.dataGridView1.RowHeadersWidth = 72;
this.tableLayoutPanel1.SetRowSpan(this.dataGridView1, 4);
this.dataGridView1.RowTemplate.Height = 23;
- this.dataGridView1.Size = new System.Drawing.Size(1557, 818);
+ this.dataGridView1.Size = new System.Drawing.Size(1698, 934);
this.dataGridView1.TabIndex = 1;
//
// 关闭
//
this.关闭.Anchor = System.Windows.Forms.AnchorStyles.None;
this.关闭.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
- this.关闭.Location = new System.Drawing.Point(1575, 708);
- this.关闭.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5);
+ this.关闭.Location = new System.Drawing.Point(1719, 810);
+ this.关闭.Margin = new System.Windows.Forms.Padding(7, 6, 7, 6);
this.关闭.Name = "关闭";
- this.关闭.Size = new System.Drawing.Size(163, 72);
+ this.关闭.Size = new System.Drawing.Size(177, 82);
this.关闭.TabIndex = 6;
this.关闭.Text = "关闭";
this.关闭.UseVisualStyleBackColor = true;
@@ -124,10 +124,10 @@
//
this.查询.Anchor = System.Windows.Forms.AnchorStyles.None;
this.查询.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
- this.查询.Location = new System.Drawing.Point(1575, 46);
- this.查询.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5);
+ this.查询.Location = new System.Drawing.Point(1719, 53);
+ this.查询.Margin = new System.Windows.Forms.Padding(7, 6, 7, 6);
this.查询.Name = "查询";
- this.查询.Size = new System.Drawing.Size(163, 72);
+ this.查询.Size = new System.Drawing.Size(177, 82);
this.查询.TabIndex = 4;
this.查询.Text = "查询";
this.查询.UseVisualStyleBackColor = true;
@@ -144,24 +144,24 @@
this.tableLayoutPanel1.Controls.Add(this.button1, 1, 2);
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0);
- this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5);
+ this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(7, 6, 7, 6);
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
this.tableLayoutPanel1.RowCount = 4;
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 40F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F));
- this.tableLayoutPanel1.Size = new System.Drawing.Size(1744, 828);
+ this.tableLayoutPanel1.Size = new System.Drawing.Size(1903, 946);
this.tableLayoutPanel1.TabIndex = 7;
//
// button1
//
this.button1.Anchor = System.Windows.Forms.AnchorStyles.None;
this.button1.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
- this.button1.Location = new System.Drawing.Point(1575, 542);
- this.button1.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5);
+ this.button1.Location = new System.Drawing.Point(1719, 620);
+ this.button1.Margin = new System.Windows.Forms.Padding(7, 6, 7, 6);
this.button1.Name = "button1";
- this.button1.Size = new System.Drawing.Size(163, 72);
+ this.button1.Size = new System.Drawing.Size(177, 82);
this.button1.TabIndex = 7;
this.button1.Text = "新增";
this.button1.UseVisualStyleBackColor = true;
@@ -256,8 +256,8 @@
// fileupload
//
this.fileupload.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
- this.fileupload.DataPropertyName = "fileupload";
- this.fileupload.HeaderText = "文件上传";
+ this.fileupload.DataPropertyName = "dzscan";
+ this.fileupload.HeaderText = "端子扫码";
this.fileupload.MinimumWidth = 9;
this.fileupload.Name = "fileupload";
this.fileupload.ReadOnly = true;
@@ -307,15 +307,15 @@
this.airtight.Name = "airtight";
this.airtight.ReadOnly = true;
//
- // FLOW_Manage
+ // Flow_Manage
//
- this.AutoScaleDimensions = new System.Drawing.SizeF(11F, 21F);
+ this.AutoScaleDimensions = new System.Drawing.SizeF(12F, 24F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(1744, 828);
+ this.ClientSize = new System.Drawing.Size(1903, 946);
this.Controls.Add(this.tableLayoutPanel1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
- this.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5);
- this.Name = "FLOW_Manage";
+ this.Margin = new System.Windows.Forms.Padding(7, 6, 7, 6);
+ this.Name = "Flow_Manage";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "FLOW_Mange";
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
diff --git a/WindowsFormsApp1/form/FLOW_Manage.cs b/WindowsFormsApp1/form/FLOW_Manage.cs
index 030c5d6..b580980 100644
--- a/WindowsFormsApp1/form/FLOW_Manage.cs
+++ b/WindowsFormsApp1/form/FLOW_Manage.cs
@@ -152,7 +152,7 @@ namespace WindowsFormsApp1.form
finaltorquecurve = flow.finaltorquecurve,
finalpressurecurve = flow.finalpressurecurve,
airtight = flow.airtight,
-
+ dzscan = flow.dzscan
});
}
dataGridView1.DataSource = null;
diff --git a/WindowsFormsApp1/form/LoginForm.cs b/WindowsFormsApp1/form/LoginForm.cs
index b1c7283..19e35d0 100644
--- a/WindowsFormsApp1/form/LoginForm.cs
+++ b/WindowsFormsApp1/form/LoginForm.cs
@@ -42,6 +42,15 @@ namespace WindowsFormsApp1
}
else
{
+ SQLiteHelper sQLiteHelper_lineplc = new db.SQLiteHelper();
+ var lineplc_result = sQLiteHelper_lineplc.Query(a => a.lineid == result_combox.Data.id);
+ if (!lineplc_result.Success)
+ {
+ MessageBox.Show("无法初始化PLC-产线关联信息!");
+ return;
+ }
+
+ Init.t_Lineplcs = lineplc_result.Data;
Init.t_User = result.Data;
Init.t_Line = result_combox.Data;
DialogResult = DialogResult.OK;
diff --git a/WindowsFormsApp1/form/ScanForm.cs b/WindowsFormsApp1/form/ScanForm.cs
index f3bae2c..11e2073 100644
--- a/WindowsFormsApp1/form/ScanForm.cs
+++ b/WindowsFormsApp1/form/ScanForm.cs
@@ -81,11 +81,27 @@ namespace WindowsFormsApp1
LOt号.Text = ReturnValue;
LOt号.Visible = true;
}));
+
+ // 添加延时后自动确认
+ System.Threading.Thread.Sleep(500); // 显示扫码结果0.5秒
+ if (!string.IsNullOrWhiteSpace(ReturnValue))
+ {
+ this.DialogResult = DialogResult.OK;
+ this.Close();
+ }
}
else
{
LOt号.Text = ReturnValue;
LOt号.Visible = true;
+
+ // 添加延时后自动确认
+ System.Threading.Thread.Sleep(500); // 显示扫码结果0.5秒
+ if (!string.IsNullOrWhiteSpace(ReturnValue))
+ {
+ this.DialogResult = DialogResult.OK;
+ this.Close();
+ }
}
}
catch (Exception ex)
diff --git a/WindowsFormsApp1/form/ScanForm_SSQ.cs b/WindowsFormsApp1/form/ScanForm_SSQ.cs
index cbfb22d..fa6fc28 100644
--- a/WindowsFormsApp1/form/ScanForm_SSQ.cs
+++ b/WindowsFormsApp1/form/ScanForm_SSQ.cs
@@ -40,7 +40,7 @@ namespace WindowsFormsApp1
MessageBox.Show("扫码为空,请确认!");
return;
}
- LogExecute.logNet.WriteDebug($"{ReturnValue}上线点击");
+ //LogExecute.logNet.WriteDebug($"{ReturnValue}上线点击");
//this.Close();
//请求后端接口,index代表位置
var PlcData = new plcdata();
diff --git a/WindowsFormsApp1/form/editForm/FLow_Insert.Designer.cs b/WindowsFormsApp1/form/editForm/FLow_Insert.Designer.cs
index a3736e7..db273d8 100644
--- a/WindowsFormsApp1/form/editForm/FLow_Insert.Designer.cs
+++ b/WindowsFormsApp1/form/editForm/FLow_Insert.Designer.cs
@@ -116,7 +116,7 @@
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F));
- this.tableLayoutPanel1.Size = new System.Drawing.Size(1087, 854);
+ this.tableLayoutPanel1.Size = new System.Drawing.Size(1186, 976);
this.tableLayoutPanel1.TabIndex = 0;
//
// label1
@@ -124,9 +124,9 @@
this.label1.Anchor = System.Windows.Forms.AnchorStyles.None;
this.label1.AutoSize = true;
this.label1.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
- this.label1.Location = new System.Drawing.Point(154, 113);
+ this.label1.Location = new System.Drawing.Point(165, 129);
this.label1.Name = "label1";
- this.label1.Size = new System.Drawing.Size(124, 28);
+ this.label1.Size = new System.Drawing.Size(143, 33);
this.label1.TabIndex = 0;
this.label1.Text = "流程名称";
//
@@ -135,9 +135,9 @@
this.label8.Anchor = System.Windows.Forms.AnchorStyles.None;
this.label8.AutoSize = true;
this.label8.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
- this.label8.Location = new System.Drawing.Point(616, 113);
+ this.label8.Location = new System.Drawing.Point(671, 129);
this.label8.Name = "label8";
- this.label8.Size = new System.Drawing.Size(68, 28);
+ this.label8.Size = new System.Drawing.Size(79, 33);
this.label8.TabIndex = 7;
this.label8.Text = "扫码";
//
@@ -146,20 +146,20 @@
this.label9.Anchor = System.Windows.Forms.AnchorStyles.None;
this.label9.AutoSize = true;
this.label9.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
- this.label9.Location = new System.Drawing.Point(588, 198);
+ this.label9.Location = new System.Drawing.Point(639, 226);
this.label9.Name = "label9";
- this.label9.Size = new System.Drawing.Size(124, 28);
+ this.label9.Size = new System.Drawing.Size(143, 33);
this.label9.TabIndex = 8;
- this.label9.Text = "文件上传";
+ this.label9.Text = "端子扫码";
//
// label10
//
this.label10.Anchor = System.Windows.Forms.AnchorStyles.None;
this.label10.AutoSize = true;
this.label10.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
- this.label10.Location = new System.Drawing.Point(588, 283);
+ this.label10.Location = new System.Drawing.Point(639, 323);
this.label10.Name = "label10";
- this.label10.Size = new System.Drawing.Size(124, 28);
+ this.label10.Size = new System.Drawing.Size(143, 33);
this.label10.TabIndex = 9;
this.label10.Text = "螺丝扭力";
//
@@ -168,9 +168,9 @@
this.button1.Anchor = System.Windows.Forms.AnchorStyles.None;
this.tableLayoutPanel1.SetColumnSpan(this.button1, 2);
this.button1.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
- this.button1.Location = new System.Drawing.Point(228, 683);
+ this.button1.Location = new System.Drawing.Point(249, 779);
this.button1.Name = "button1";
- this.button1.Size = new System.Drawing.Size(194, 79);
+ this.button1.Size = new System.Drawing.Size(212, 90);
this.button1.TabIndex = 14;
this.button1.Text = "保存";
this.button1.UseVisualStyleBackColor = true;
@@ -181,9 +181,9 @@
this.button2.Anchor = System.Windows.Forms.AnchorStyles.None;
this.tableLayoutPanel1.SetColumnSpan(this.button2, 2);
this.button2.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
- this.button2.Location = new System.Drawing.Point(664, 683);
+ this.button2.Location = new System.Drawing.Point(725, 779);
this.button2.Name = "button2";
- this.button2.Size = new System.Drawing.Size(190, 79);
+ this.button2.Size = new System.Drawing.Size(207, 90);
this.button2.TabIndex = 15;
this.button2.Text = "取消";
this.button2.UseVisualStyleBackColor = true;
@@ -194,9 +194,9 @@
this.压力曲线.Anchor = System.Windows.Forms.AnchorStyles.None;
this.压力曲线.AutoSize = true;
this.压力曲线.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
- this.压力曲线.Location = new System.Drawing.Point(856, 542);
+ this.压力曲线.Location = new System.Drawing.Point(933, 617);
this.压力曲线.Name = "压力曲线";
- this.压力曲线.Size = new System.Drawing.Size(22, 21);
+ this.压力曲线.Size = new System.Drawing.Size(28, 27);
this.压力曲线.TabIndex = 23;
this.压力曲线.UseVisualStyleBackColor = true;
//
@@ -205,9 +205,9 @@
this.螺丝扭力.Anchor = System.Windows.Forms.AnchorStyles.None;
this.螺丝扭力.AutoSize = true;
this.螺丝扭力.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
- this.螺丝扭力.Location = new System.Drawing.Point(856, 287);
+ this.螺丝扭力.Location = new System.Drawing.Point(933, 326);
this.螺丝扭力.Name = "螺丝扭力";
- this.螺丝扭力.Size = new System.Drawing.Size(22, 21);
+ this.螺丝扭力.Size = new System.Drawing.Size(28, 27);
this.螺丝扭力.TabIndex = 26;
this.螺丝扭力.UseVisualStyleBackColor = true;
//
@@ -216,9 +216,9 @@
this.文件上传.Anchor = System.Windows.Forms.AnchorStyles.None;
this.文件上传.AutoSize = true;
this.文件上传.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
- this.文件上传.Location = new System.Drawing.Point(856, 202);
+ this.文件上传.Location = new System.Drawing.Point(933, 229);
this.文件上传.Name = "文件上传";
- this.文件上传.Size = new System.Drawing.Size(22, 21);
+ this.文件上传.Size = new System.Drawing.Size(28, 27);
this.文件上传.TabIndex = 27;
this.文件上传.UseVisualStyleBackColor = true;
//
@@ -226,9 +226,9 @@
//
this.流程名称.Anchor = System.Windows.Forms.AnchorStyles.None;
this.流程名称.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
- this.流程名称.Location = new System.Drawing.Point(328, 108);
+ this.流程名称.Location = new System.Drawing.Point(358, 123);
this.流程名称.Name = "流程名称";
- this.流程名称.Size = new System.Drawing.Size(211, 39);
+ this.流程名称.Size = new System.Drawing.Size(230, 44);
this.流程名称.TabIndex = 16;
//
// 气密参数
@@ -236,9 +236,9 @@
this.气密参数.Anchor = System.Windows.Forms.AnchorStyles.None;
this.气密参数.AutoSize = true;
this.气密参数.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
- this.气密参数.Location = new System.Drawing.Point(856, 627);
+ this.气密参数.Location = new System.Drawing.Point(933, 714);
this.气密参数.Name = "气密参数";
- this.气密参数.Size = new System.Drawing.Size(22, 21);
+ this.气密参数.Size = new System.Drawing.Size(28, 27);
this.气密参数.TabIndex = 22;
this.气密参数.UseVisualStyleBackColor = true;
//
@@ -247,9 +247,9 @@
this.label6.Anchor = System.Windows.Forms.AnchorStyles.None;
this.label6.AutoSize = true;
this.label6.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
- this.label6.Location = new System.Drawing.Point(126, 623);
+ this.label6.Location = new System.Drawing.Point(133, 711);
this.label6.Name = "label6";
- this.label6.Size = new System.Drawing.Size(180, 28);
+ this.label6.Size = new System.Drawing.Size(207, 33);
this.label6.TabIndex = 5;
this.label6.Text = "错误调用接口";
//
@@ -258,9 +258,9 @@
this.label5.Anchor = System.Windows.Forms.AnchorStyles.None;
this.label5.AutoSize = true;
this.label5.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
- this.label5.Location = new System.Drawing.Point(147, 538);
+ this.label5.Location = new System.Drawing.Point(157, 614);
this.label5.Name = "label5";
- this.label5.Size = new System.Drawing.Size(138, 28);
+ this.label5.Size = new System.Drawing.Size(159, 33);
this.label5.TabIndex = 4;
this.label5.Text = "错误PLC值";
//
@@ -269,9 +269,9 @@
this.label4.Anchor = System.Windows.Forms.AnchorStyles.None;
this.label4.AutoSize = true;
this.label4.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
- this.label4.Location = new System.Drawing.Point(126, 453);
+ this.label4.Location = new System.Drawing.Point(133, 517);
this.label4.Name = "label4";
- this.label4.Size = new System.Drawing.Size(180, 28);
+ this.label4.Size = new System.Drawing.Size(207, 33);
this.label4.TabIndex = 3;
this.label4.Text = "成功调用接口";
//
@@ -280,9 +280,9 @@
this.label3.Anchor = System.Windows.Forms.AnchorStyles.None;
this.label3.AutoSize = true;
this.label3.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
- this.label3.Location = new System.Drawing.Point(147, 368);
+ this.label3.Location = new System.Drawing.Point(157, 420);
this.label3.Name = "label3";
- this.label3.Size = new System.Drawing.Size(138, 28);
+ this.label3.Size = new System.Drawing.Size(159, 33);
this.label3.TabIndex = 2;
this.label3.Text = "期望PLC值";
//
@@ -291,9 +291,9 @@
this.label2.Anchor = System.Windows.Forms.AnchorStyles.None;
this.label2.AutoSize = true;
this.label2.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
- this.label2.Location = new System.Drawing.Point(182, 283);
+ this.label2.Location = new System.Drawing.Point(197, 323);
this.label2.Name = "label2";
- this.label2.Size = new System.Drawing.Size(68, 28);
+ this.label2.Size = new System.Drawing.Size(79, 33);
this.label2.TabIndex = 1;
this.label2.Text = "步骤";
//
@@ -301,18 +301,18 @@
//
this.期望PLC值.Anchor = System.Windows.Forms.AnchorStyles.None;
this.期望PLC值.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
- this.期望PLC值.Location = new System.Drawing.Point(328, 363);
+ this.期望PLC值.Location = new System.Drawing.Point(358, 414);
this.期望PLC值.Name = "期望PLC值";
- this.期望PLC值.Size = new System.Drawing.Size(211, 39);
+ this.期望PLC值.Size = new System.Drawing.Size(230, 44);
this.期望PLC值.TabIndex = 20;
//
// 步骤
//
this.步骤.Anchor = System.Windows.Forms.AnchorStyles.None;
this.步骤.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
- this.步骤.Location = new System.Drawing.Point(328, 278);
+ this.步骤.Location = new System.Drawing.Point(358, 317);
this.步骤.Name = "步骤";
- this.步骤.Size = new System.Drawing.Size(211, 39);
+ this.步骤.Size = new System.Drawing.Size(230, 44);
this.步骤.TabIndex = 17;
//
// label7
@@ -320,9 +320,9 @@
this.label7.Anchor = System.Windows.Forms.AnchorStyles.None;
this.label7.AutoSize = true;
this.label7.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
- this.label7.Location = new System.Drawing.Point(154, 198);
+ this.label7.Location = new System.Drawing.Point(165, 226);
this.label7.Name = "label7";
- this.label7.Size = new System.Drawing.Size(124, 28);
+ this.label7.Size = new System.Drawing.Size(143, 33);
this.label7.TabIndex = 29;
this.label7.Text = "流程编号";
//
@@ -330,9 +330,9 @@
//
this.流程编号.Anchor = System.Windows.Forms.AnchorStyles.None;
this.流程编号.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
- this.流程编号.Location = new System.Drawing.Point(328, 193);
+ this.流程编号.Location = new System.Drawing.Point(358, 220);
this.流程编号.Name = "流程编号";
- this.流程编号.Size = new System.Drawing.Size(211, 39);
+ this.流程编号.Size = new System.Drawing.Size(230, 44);
this.流程编号.TabIndex = 30;
//
// label11
@@ -340,9 +340,9 @@
this.label11.Anchor = System.Windows.Forms.AnchorStyles.None;
this.label11.AutoSize = true;
this.label11.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
- this.label11.Location = new System.Drawing.Point(588, 368);
+ this.label11.Location = new System.Drawing.Point(639, 420);
this.label11.Name = "label11";
- this.label11.Size = new System.Drawing.Size(124, 28);
+ this.label11.Size = new System.Drawing.Size(143, 33);
this.label11.TabIndex = 10;
this.label11.Text = "螺丝角度";
//
@@ -351,9 +351,9 @@
this.螺丝角度.Anchor = System.Windows.Forms.AnchorStyles.None;
this.螺丝角度.AutoSize = true;
this.螺丝角度.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
- this.螺丝角度.Location = new System.Drawing.Point(856, 372);
+ this.螺丝角度.Location = new System.Drawing.Point(933, 423);
this.螺丝角度.Name = "螺丝角度";
- this.螺丝角度.Size = new System.Drawing.Size(22, 21);
+ this.螺丝角度.Size = new System.Drawing.Size(28, 27);
this.螺丝角度.TabIndex = 24;
this.螺丝角度.UseVisualStyleBackColor = true;
//
@@ -362,9 +362,9 @@
this.label12.Anchor = System.Windows.Forms.AnchorStyles.None;
this.label12.AutoSize = true;
this.label12.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
- this.label12.Location = new System.Drawing.Point(588, 453);
+ this.label12.Location = new System.Drawing.Point(639, 517);
this.label12.Name = "label12";
- this.label12.Size = new System.Drawing.Size(124, 28);
+ this.label12.Size = new System.Drawing.Size(143, 33);
this.label12.TabIndex = 11;
this.label12.Text = "扭力曲线";
//
@@ -373,9 +373,9 @@
this.扭力曲线.Anchor = System.Windows.Forms.AnchorStyles.None;
this.扭力曲线.AutoSize = true;
this.扭力曲线.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
- this.扭力曲线.Location = new System.Drawing.Point(856, 457);
+ this.扭力曲线.Location = new System.Drawing.Point(933, 520);
this.扭力曲线.Name = "扭力曲线";
- this.扭力曲线.Size = new System.Drawing.Size(22, 21);
+ this.扭力曲线.Size = new System.Drawing.Size(28, 27);
this.扭力曲线.TabIndex = 25;
this.扭力曲线.UseVisualStyleBackColor = true;
//
@@ -384,9 +384,9 @@
this.label13.Anchor = System.Windows.Forms.AnchorStyles.None;
this.label13.AutoSize = true;
this.label13.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
- this.label13.Location = new System.Drawing.Point(588, 538);
+ this.label13.Location = new System.Drawing.Point(639, 614);
this.label13.Name = "label13";
- this.label13.Size = new System.Drawing.Size(124, 28);
+ this.label13.Size = new System.Drawing.Size(143, 33);
this.label13.TabIndex = 12;
this.label13.Text = "压力曲线";
//
@@ -395,9 +395,9 @@
this.label14.Anchor = System.Windows.Forms.AnchorStyles.None;
this.label14.AutoSize = true;
this.label14.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
- this.label14.Location = new System.Drawing.Point(588, 623);
+ this.label14.Location = new System.Drawing.Point(639, 711);
this.label14.Name = "label14";
- this.label14.Size = new System.Drawing.Size(124, 28);
+ this.label14.Size = new System.Drawing.Size(143, 33);
this.label14.TabIndex = 13;
this.label14.Text = "气密参数";
//
@@ -406,9 +406,9 @@
this.扫码.Anchor = System.Windows.Forms.AnchorStyles.None;
this.扫码.AutoSize = true;
this.扫码.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
- this.扫码.Location = new System.Drawing.Point(856, 117);
+ this.扫码.Location = new System.Drawing.Point(933, 132);
this.扫码.Name = "扫码";
- this.扫码.Size = new System.Drawing.Size(22, 21);
+ this.扫码.Size = new System.Drawing.Size(28, 27);
this.扫码.TabIndex = 28;
this.扫码.UseVisualStyleBackColor = true;
//
@@ -416,9 +416,9 @@
//
this.错误PLC值.Anchor = System.Windows.Forms.AnchorStyles.None;
this.错误PLC值.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
- this.错误PLC值.Location = new System.Drawing.Point(328, 533);
+ this.错误PLC值.Location = new System.Drawing.Point(358, 608);
this.错误PLC值.Name = "错误PLC值";
- this.错误PLC值.Size = new System.Drawing.Size(211, 39);
+ this.错误PLC值.Size = new System.Drawing.Size(230, 44);
this.错误PLC值.TabIndex = 18;
//
// 成功接口
@@ -426,9 +426,9 @@
this.成功接口.Anchor = System.Windows.Forms.AnchorStyles.None;
this.成功接口.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.成功接口.FormattingEnabled = true;
- this.成功接口.Location = new System.Drawing.Point(328, 453);
+ this.成功接口.Location = new System.Drawing.Point(358, 513);
this.成功接口.Name = "成功接口";
- this.成功接口.Size = new System.Drawing.Size(211, 36);
+ this.成功接口.Size = new System.Drawing.Size(230, 41);
this.成功接口.TabIndex = 31;
//
// 错误接口
@@ -436,19 +436,19 @@
this.错误接口.Anchor = System.Windows.Forms.AnchorStyles.None;
this.错误接口.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.错误接口.FormattingEnabled = true;
- this.错误接口.Location = new System.Drawing.Point(328, 623);
+ this.错误接口.Location = new System.Drawing.Point(358, 707);
this.错误接口.Name = "错误接口";
- this.错误接口.Size = new System.Drawing.Size(211, 36);
+ this.错误接口.Size = new System.Drawing.Size(230, 41);
this.错误接口.TabIndex = 32;
//
- // FLOW_Insert
+ // FLow_Insert
//
- this.AutoScaleDimensions = new System.Drawing.SizeF(11F, 21F);
+ this.AutoScaleDimensions = new System.Drawing.SizeF(12F, 24F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(1087, 854);
+ this.ClientSize = new System.Drawing.Size(1186, 976);
this.Controls.Add(this.tableLayoutPanel1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
- this.Name = "FLOW_Insert";
+ this.Name = "FLow_Insert";
this.Text = "Form_Insert";
this.Load += new System.EventHandler(this.FLOW_Insert_Load);
this.tableLayoutPanel1.ResumeLayout(false);
diff --git a/WindowsFormsApp1/form/editForm/FLow_Insert.cs b/WindowsFormsApp1/form/editForm/FLow_Insert.cs
index 912a07b..2032817 100644
--- a/WindowsFormsApp1/form/editForm/FLow_Insert.cs
+++ b/WindowsFormsApp1/form/editForm/FLow_Insert.cs
@@ -63,12 +63,13 @@ namespace WindowsFormsApp1.form
t_Flow.errstatus = _错误PLC值;
t_Flow.errinterfaceid = (int)错误接口.SelectedValue;
t_Flow.scan = 扫码.Checked;
- t_Flow.fileupload = 文件上传.Checked;
+ //t_Flow.fileupload = 文件上传.Checked;
t_Flow.finaltorquevalue = 螺丝扭力.Checked;
t_Flow.finalanglevaluue = 螺丝角度.Checked;
t_Flow.finaltorquecurve = 扭力曲线.Checked;
t_Flow.finalpressurecurve = 压力曲线.Checked;
t_Flow.airtight = 气密参数.Checked;
+ t_Flow.dzscan = 文件上传.Checked;
SQLiteHelper sQLiteHelper1 = new db.SQLiteHelper();
if (Operation == OperationType.Edit)
@@ -145,7 +146,7 @@ namespace WindowsFormsApp1.form
错误PLC值.Text = DataToEdit.errstatus.ToString();
SelectItemByValue(错误接口, DataToEdit.errinterfaceid.ToString());
扫码.Checked = DataToEdit.scan;
- 文件上传.Checked = DataToEdit.fileupload;
+ 文件上传.Checked = DataToEdit.dzscan;
螺丝扭力.Checked = DataToEdit.finaltorquevalue;
螺丝角度.Checked = DataToEdit.finalanglevaluue;
扭力曲线.Checked = DataToEdit.finaltorquecurve;
diff --git a/WindowsFormsApp1/mod/database/t_lineplc.cs b/WindowsFormsApp1/mod/database/t_lineplc.cs
new file mode 100644
index 0000000..0539961
--- /dev/null
+++ b/WindowsFormsApp1/mod/database/t_lineplc.cs
@@ -0,0 +1,18 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using SQLite;
+
+namespace WindowsFormsApp1.mod
+{
+ [Table("lineplc")]
+ public class t_lineplc
+ {
+ [PrimaryKey, AutoIncrement]
+ public int id { get; set; }
+ public int lineid { get; set; }
+ public int plcid { get; set; }
+ }
+}
diff --git a/WindowsFormsApp1/mod/server/otherdata.cs b/WindowsFormsApp1/mod/server/otherdata.cs
index 70401c9..ff3be6a 100644
--- a/WindowsFormsApp1/mod/server/otherdata.cs
+++ b/WindowsFormsApp1/mod/server/otherdata.cs
@@ -23,6 +23,16 @@ namespace WindowsFormsApp1.mod.server
///
public string FileUploadAddress { get; set; }
+ ///
+ /// 图片地址地址
+ ///
+ public string ImageAddress { get; set; }
+
+ ///
+ /// 视频地址
+ ///
+ public string VedioAddress { get; set; }
+
///
/// 前端返回的扫码
///
diff --git a/WindowsFormsApp1/server/ApiClient.cs b/WindowsFormsApp1/server/ApiClient.cs
index 12f5dad..7c5973e 100644
--- a/WindowsFormsApp1/server/ApiClient.cs
+++ b/WindowsFormsApp1/server/ApiClient.cs
@@ -34,6 +34,8 @@ namespace WindowsFormsApp1.server
private readonly string _mold;
private readonly string _token;
private readonly string _fixsn;
+ private readonly string _logBasePath;
+
public ApiClient()
{
@@ -56,15 +58,62 @@ namespace WindowsFormsApp1.server
_opID = Init.t_User.username;
// 初始化 CsvLogger
- CsvLogger.Initialize("D:/Logs/logs.csv");
+ // 初始化日志路径
+ _logBasePath = Path.Combine(@"D:\", "Logs", $"logs.csv");
- // 设置自定义表头
- //var customHeaders = new List { "SN", "值1", "消息", "异常" };
- //CsvLogger.SetHeaders(customHeaders);
- //线别.Text = "线别:" + Init.t_Line.linename;
- //段别.Text = "段别:" + Init.t_Line.linemode;
- //机台编号.Text = "机台编号:" + Init.t_Line.linecode;
- //操作人员ID.Text = "操作人员ID:" + Init.t_User.username;
+ // 初始化CSV日志记录器
+ CsvLogger.Initialize(_logBasePath);
+
+ // 根据站别设置不同的表头
+ List headers = GetStationSpecificHeaders();
+ CsvLogger.SetHeaders(headers);
+ }
+
+ // 根据站别获取特定的表头
+ private List GetStationSpecificHeaders()
+ {
+ // 基础表头,所有站别都需要的
+ List headers = new List
+ {
+ "SN"
+ };
+
+ // 根据站别或产线代码添加特定表头
+ var station = Init.t_Line.lineremark2.ToLower();
+ switch (station)
+ {
+ case "wat":
+ headers.Add("充气压力");
+ headers.Add("泄漏量");
+ break;
+ case "potting":
+ case "thermalaste":
+ headers.Add("胶重");
+ break;
+ case "vacuum":
+ headers.Add("腔体压力");
+ headers.Add("保压时间");
+ break;
+ case "sealant":
+ headers.Add("重量");
+ headers.Add("宽度");
+ break;
+ case "curing":
+ headers.Add("固化温度");
+ headers.Add("固化时间");
+ break;
+ }
+ if ("ScrewE,Assy2,Assy3,ScrewS,ScrewM,ScrewTC".ToLower().Contains(station))
+ {
+ headers.Add("角度");
+ headers.Add("扭矩");
+ }
+
+ if ("Assy2,Assy3,AOI,Assy5,Sealant,CCD,PrintLabel".ToLower().Contains(station))
+ {
+ headers.Add("CCD");
+ }
+ return headers;
}
// 通用API调用方法,减少代码重复
@@ -79,35 +128,8 @@ namespace WindowsFormsApp1.server
// 调用接口
try
{
- // 测试
- //LogExecute.logNet.WriteDebug($"{eventName} 接口请求模拟测试成功\n请求:{jsonPayload}");
-
- // 回写对应PLC
- //if (statusCode > 0)
- // PlcData.Write_Status = (short)statusCode;
- //if (eventName == "SN_Release")
- // PlcData.Write_stSN = "testsn";
- //if(eventName == "Glue_CheckOut")
- //{
- // 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 = DateTime.Now.Millisecond.ToString();
- // SQLiteHelper kvHelper = new db.SQLiteHelper();
- // kvHelper.Update(power);
-
- // break;
- // }
- //}
- //return ApiFormResult.Sucess(mesresult.PASS, false, "", PlcData, DateTime.Now);
-
#region MES交互
-
+
var response = _httpClient.PostAsync(url, httpContent).Result;
// 检查响应状态码
if (response.IsSuccessStatusCode)
@@ -162,8 +184,8 @@ namespace WindowsFormsApp1.server
}
}
return result
- ? ApiFormResult.Sucess(mesresult.PASS, false, res.Msg.Value, PlcData, DateTime.Now)
- : ApiFormResult.Sucess(mesresult.FAIL, true, res.Msg.Value, PlcData, DateTime.Now);
+ ? 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
{
@@ -172,7 +194,7 @@ namespace WindowsFormsApp1.server
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, false, res.Msg?.Value ?? "", PlcData, DateTime.Now);
+ : ApiFormResult.Sucess(mesresult.FAIL, true, res.Msg?.Value ?? "", PlcData, DateTime.Now);
}
}
}
@@ -180,19 +202,32 @@ namespace WindowsFormsApp1.server
{
throw new Exception($"请求失败,状态码:{response.StatusCode}");
}
-
- #endregion 测试不用
+
+ #endregion
}
catch (Exception ex)
{
LogExecute.logNet.WriteError($"{eventName} 接口请求失败: {ex.Message}");
- throw new Exception(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);
}
public ApiFormResult SN_CheckIN(string url, plcdata PlcData, otherdata OtherData)
{
+ // 换盘 老化上线 SN需要调用扫码的值 Init.Sn
+ var sn = "";
+ var stationid = Init.t_Line.lineremark2.ToLower();
+ if ("loadaging,exchange2,exchange1".Contains(stationid))
+ {
+ sn = Init.SN;
+ }
+ else
+ {
+ sn = PlcData.Read_MaterialCode1;
+ }
// 组装 request json
var request = new
{
@@ -203,11 +238,10 @@ namespace WindowsFormsApp1.server
OPID = _opID,
Token = _token,
FixSN = _fixsn,
- SN = PlcData.Read_MaterialCode1,
+ SN = sn,
CarrierID = "",
SendTime = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss")
};
- // 1对4 有部分不需要 callapi todo
return CallApi(url, request, "SN_CheckIN", PlcData, PLC_Status.SN_CheckIN);
}
@@ -273,7 +307,7 @@ namespace WindowsFormsApp1.server
OPID = _opID,
Token = _token,
FixSN = _fixsn,
- SN = OtherData.JS_SN??"test",//扫码
+ SN = OtherData.JS_SN ?? "",//扫码
SendTime = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss")
};
@@ -343,7 +377,7 @@ namespace WindowsFormsApp1.server
Token = _token,
FixSN = _fixsn,
SN = Init.ScanString,
- CarrierID = PlcData.Read_MaterialCode1,
+ //CarrierID = PlcData.Read_MaterialCode1,
SendTime = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss")
};
// 特殊处理:需要设置Write_stSN
@@ -376,7 +410,7 @@ namespace WindowsFormsApp1.server
locationindex = OtherData.locationindex;
break;
}
-
+
var request = new
{
EventID = "Glue_CheckOut",
@@ -425,7 +459,7 @@ namespace WindowsFormsApp1.server
if (station == "vacuum")
{
// 抽真空
- foreach(var val in OtherData.FinalPressureCurve.Where(x => x > 0))
+ foreach (var val in OtherData.FinalPressureCurve.Where(x => x > 0))
{
request.DC_INFO.Add(new DCInfoItem
{
@@ -490,16 +524,20 @@ namespace WindowsFormsApp1.server
var time = DateTime.Now.ToString("HHmmss");
var result = PlcData.Read_Result == 1 ? "OK" : "NG";
- OtherData.FileUploadAddress = @"W:\\";
- var sourceDirectory = @"D:\\";
var targetDirectory = $"{OtherData.FileUploadAddress}{_line.Substring(0, 2)}\\{month}\\{day}\\Line{_line.Substring(_line.Length - 2)}\\{_stationID}\\{_machineID}\\{result}";
var fileName = "";
try
{
- string[] sourceFolders = OtherData.FileUploadAddress.Split(';'); // 使用分号分隔多个源文件夹
- string targetFolder = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "UploadFiles");
+ string[] sourceFolders = new string[] {
+ OtherData.ImageAddress,
+ OtherData.VedioAddress
+ };
+ // 使用分号分隔多个源文件夹
+ string targetFolder = targetDirectory;
List fileList = new List();
+
+ //从数据库读 未上传的 todo
string snNumber = PlcData.Read_MaterialCode0;
if (string.IsNullOrEmpty(snNumber))
@@ -513,23 +551,45 @@ namespace WindowsFormsApp1.server
Directory.CreateDirectory(targetFolder);
}
- foreach (string sourceFolder in sourceFolders)
+ foreach (string sourceFolder1 in sourceFolders)
{
+ if (string.IsNullOrEmpty(sourceFolder1))
+ {
+ continue;
+ }
+ string sourceFolder = sourceFolders[0];
+ if (sourceFolder == sourceFolder1)
+ {
+ // 图片
+ // 组装路径 可能需要从数据库读 result和sn和日期
+ sourceFolder = Path.Combine(sourceFolder, DateTime.Now.ToString("yyyyMMdd"), "DCDC", result);
+ }
+ else
+ {
+ // 视频
+ }
if (Directory.Exists(sourceFolder.Trim()))
{
string[] files = Directory.GetFiles(sourceFolder.Trim());
+ int num = 1;
+ var extensionstr = "";
foreach (string file in files)
{
string fileName1 = Path.GetFileName(file);
+ string filePath = "";
if (!fileName1.Contains(snNumber))
{
continue;
}
-
- string targetPath = Path.Combine(targetFolder, fileName);
- File.Copy(file, targetPath, true);
+ extensionstr = Path.GetExtension(file);
+ fileName = $"{month}{day}_{_stationID}_{result}_{PlcData.Read_MaterialCode0}_{monthDay}_{time}_{_machineID}_01_Original{num}{extensionstr}";
+ filePath = Path.Combine(sourceFolder, fileName1);
+ //string targetPath = Path.Combine(targetFolder, fileName);
+ //File.Copy(file, targetPath, true);
+ CopyFileToDirectory(filePath, targetFolder, fileName);
fileList.Add(fileName);
- LogExecute.logNet.WriteDebug($"文件 {fileName} 已从 {sourceFolder.Trim()} 复制到 {targetPath}");
+ num++;
+ LogExecute.logNet.WriteDebug($"文件 {fileName} 已从 {sourceFolder.Trim()} 复制到 {targetFolder}");
}
}
else
@@ -541,6 +601,7 @@ namespace WindowsFormsApp1.server
if (fileList.Count == 0)
{
LogExecute.logNet.WriteDebug($"在所有源文件夹中未找到包含SN号 {snNumber} 的文件");
+ return ApiFormResult.Error(mesresult.FAIL, false, "", PlcData, DateTime.Now);
}
// 组装 request json
@@ -554,10 +615,10 @@ namespace WindowsFormsApp1.server
{
new
{
- SN = OtherData.JS_SN,
+ SN = PlcData.Read_MaterialCode0,
FileInfo = fileList.Select(x => new
{
- FileName = fileName,
+ FileName = x,
FilePath = targetFolder
}).ToList()
}
@@ -722,14 +783,25 @@ namespace WindowsFormsApp1.server
Value = Init.airtight.Leak_Value ?? "0",
Result = result
});
- CsvLogger.Log($"{PlcData.Read_MaterialCode0},{Init.airtight.Airtight_Value},{Init.airtight.Leak_Value},{DateTime.Now}");
+ CsvLogger.Log($"{PlcData.Read_MaterialCode0},{Init.airtight.Airtight_Value},{Init.airtight.Leak_Value}");
}
//扭力,角度
- if ("ScrewE,Assy2,Assy3,ScrewS,ScrewM".Contains(stationid))
+ if ("ScrewE,Assy2,Assy3,ScrewS,ScrewM,ScrewTC".Contains(stationid))
{
+ var count = OtherData.FinalAngleValue.Count(x => x > 0);
+ for(int i = 0; i < count; i++)
+ {
+ if ("Assy2,Assy3".Contains(stationid))
+ {
+ CsvLogger.Log($"{PlcData.Read_MaterialCode0},{OtherData.FinalAngleValue[i]},{OtherData.FinalTorqueValue[i]},{PlcData.Read_UploadData0.ToString()}");
+ }
+ else
+ {
+ CsvLogger.Log($"{PlcData.Read_MaterialCode0},{OtherData.FinalAngleValue[i]},{OtherData.FinalTorqueValue[i]}");
+ }
+ }
+
var AngleCount = 1;
- OtherData.FinalAngleValue[0] = (float)12.8888;
- OtherData.FinalAngleValue[1] = (float)11.9999;
foreach (var item in OtherData.FinalAngleValue.Where(x => x > 0))
{
//角度
@@ -739,13 +811,9 @@ namespace WindowsFormsApp1.server
dcInfo.Result = result;
sninfo.DC_INFO.Add(dcInfo);
- LogExecute.SNlogNet.WriteDebug($"{PlcData.Read_MaterialCode0},{dcInfo.Item},{dcInfo.Value}");
-
AngleCount++;
}
var TorqueCount = 1;
- OtherData.FinalTorqueValue[0] = (float)120;
- OtherData.FinalTorqueValue[1] = (float)110;
foreach (var item in OtherData.FinalTorqueValue.Where(x => x > 0))
{
//扭力
@@ -755,41 +823,45 @@ namespace WindowsFormsApp1.server
dcInfo.Result = result;
sninfo.DC_INFO.Add(dcInfo);
- LogExecute.SNlogNet.WriteDebug($"{PlcData.Read_MaterialCode0},{dcInfo.Item},{dcInfo.Value}");
-
TorqueCount++;
}
}
-
+
//CCD
if ("Assy2,Assy3,AOI,Assy5,Sealant,CCD,PrintLabel".Contains(stationid))
{
dcInfo = new DCInfoItem();
- dcInfo.Item = stationid == "CCD"? "CCD" : $"{Init.t_Line.lineremark2}_CCD";
+ dcInfo.Item = stationid == "CCD" ? "CCD" : $"{Init.t_Line.lineremark2}_CCD";
dcInfo.Value = PlcData.Read_UploadData0.ToString();
dcInfo.Result = result;
sninfo.DC_INFO.Add(dcInfo);
-
- LogExecute.SNlogNet.WriteDebug($"追溯码:{PlcData.Read_MaterialCode0},检测结果:{logresult}");
+ if (!"Assy2,Assy3".Contains(stationid))
+ {
+ CsvLogger.Log($"{PlcData.Read_MaterialCode0},{PlcData.Read_UploadData0.ToString()}");
+ }
+ //LogExecute.SNlogNet.WriteDebug($"追溯码:{PlcData.Read_MaterialCode0},检测结果:{logresult}");
}
//抽真空 压力
if ("Vacuum".Contains(stationid))
{
+ var str = "";
var Chamber_Pressure = OtherData.FinalPressureCurve.First();
dcInfo = new DCInfoItem();
dcInfo.Item = $"Chamber_Pressure";
dcInfo.Value = Chamber_Pressure.ToString();
dcInfo.Result = result;
- LogExecute.SNlogNet.WriteDebug($"{PlcData.Read_MaterialCode0},{dcInfo.Item},{dcInfo.Value}");
-
sninfo.DC_INFO.Add(dcInfo);
+ str += $"{PlcData.Read_MaterialCode0},{dcInfo.Value}";
+
dcInfo = new DCInfoItem();
dcInfo.Item = $"Hold_Time";
- dcInfo.Value = PlcData.Read_Other0.ToString();
+ dcInfo.Value = PlcData.Read_Other0.ToString() ?? "0";
dcInfo.Result = result;
- LogExecute.SNlogNet.WriteDebug($"{PlcData.Read_MaterialCode0},{dcInfo.Item},{dcInfo.Value}");
+ sninfo.DC_INFO.Add(dcInfo);
+ str += $",{dcInfo.Value},";
+ CsvLogger.Log(str);
}
//固化 时间
if ("Curing".Contains(stationid))
@@ -799,7 +871,7 @@ namespace WindowsFormsApp1.server
if (material.Success)
{
// 计算加热时间
- var time = ((TimeSpan)(material.Data.checkin2 - material.Data.checkout1)).TotalMilliseconds;
+ var time = ((TimeSpan)(material.Data.checkin2 - material.Data.checkout1)).TotalMinutes;
var jrTime = Convert.ToInt32(time).ToString();
sninfo.DC_INFO.Add(new DCInfoItem
{
@@ -815,7 +887,7 @@ namespace WindowsFormsApp1.server
Down = "75",
Result = result
});
-
+ CsvLogger.Log($"{PlcData.Read_MaterialCode0},{PlcData.Read_UploadData0.ToString()},{jrTime}");
}
else
{
@@ -823,22 +895,32 @@ namespace WindowsFormsApp1.server
}
}
//胶重
- if ("Potting,ThermalPaste,Sealant".Contains(stationid))
+ if ("Potting,ThermalPaste".Contains(stationid))
{
+ dcInfo = new DCInfoItem();
dcInfo.Item = $"{stationid}_Weight";
dcInfo.Value = PlcData.Read_UploadData0.ToString();
dcInfo.Result = result;
- LogExecute.SNlogNet.WriteDebug($"{PlcData.Read_MaterialCode0},{dcInfo.Item},{dcInfo.Value}");
+ //LogExecute.SNlogNet.WriteDebug($"{PlcData.Read_MaterialCode0},{dcInfo.Item},{dcInfo.Value}");
+ CsvLogger.Log($"{PlcData.Read_MaterialCode0},{dcInfo.Value}");
sninfo.DC_INFO.Add(dcInfo);
}
- //胶宽
+ //胶重 胶宽
if ("Sealant".Contains(stationid))
{
+ dcInfo = new DCInfoItem();
+ dcInfo.Item = $"{stationid}_Weight";
+ dcInfo.Value = PlcData.Read_UploadData0.ToString();
+ dcInfo.Result = result;
+
+ sninfo.DC_INFO.Add(dcInfo);
+
+ dcInfo = new DCInfoItem();
dcInfo.Item = $"{stationid}_Width";
dcInfo.Value = PlcData.Read_UploadData1.ToString();
dcInfo.Result = result;
- LogExecute.SNlogNet.WriteDebug($"{PlcData.Read_MaterialCode0},{dcInfo.Item},{dcInfo.Value}");
+ CsvLogger.Log($"{PlcData.Read_MaterialCode0},{PlcData.Read_UploadData0.ToString()},{PlcData.Read_UploadData1.ToString()}");
sninfo.DC_INFO.Add(dcInfo);
}
@@ -854,7 +936,6 @@ namespace WindowsFormsApp1.server
sninfo.CompList.Add(compListItem);
}
- //LogExecute.SNlogNet.WriteDebug($"{PlcData.Read_MaterialCode0},胶水码:{OtherData.JS_SN},胶重:{PlcData.Read_UploadData0}");
}
else //其他不传
{
diff --git a/WindowsFormsApp1/server/CsvHelper.cs b/WindowsFormsApp1/server/CsvHelper.cs
index bfe6627..da2c2a1 100644
--- a/WindowsFormsApp1/server/CsvHelper.cs
+++ b/WindowsFormsApp1/server/CsvHelper.cs
@@ -3,6 +3,7 @@ using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
+using System.Text;
namespace WindowsFormsApp1
{
@@ -20,16 +21,33 @@ namespace WindowsFormsApp1
{
private static string _baseFilePath;
private static List _customHeaders = new List();
+ private static readonly object _lockObj = new object(); // 添加锁对象用于线程安全
+ private static bool _initialized = false;
public static void Initialize(string baseFilePath)
{
+ if (string.IsNullOrEmpty(baseFilePath))
+ throw new ArgumentNullException(nameof(baseFilePath), "日志文件路径不能为空");
+
_baseFilePath = baseFilePath;
+ _initialized = true;
+
+ // 确保目录存在
+ string directory = Path.GetDirectoryName(baseFilePath);
+ if (!Directory.Exists(directory))
+ Directory.CreateDirectory(directory);
}
// 设置自定义表头
public static void SetHeaders(List headers)
{
- _customHeaders = headers;
+ if (headers == null)
+ throw new ArgumentNullException(nameof(headers));
+
+ lock (_lockObj)
+ {
+ _customHeaders = new List(headers); // 创建副本
+ }
}
private static string GetCurrentLogFilePath()
@@ -37,48 +55,60 @@ namespace WindowsFormsApp1
var date = DateTime.Now.ToString("yyyy-MM-dd");
var fileExtension = Path.GetExtension(_baseFilePath);
var fileNameWithoutExtension = Path.GetFileNameWithoutExtension(_baseFilePath);
- if (!Directory.Exists(Path.GetDirectoryName(_baseFilePath)))
- {
- Directory.CreateDirectory(Path.GetDirectoryName(_baseFilePath));
- }
return $"{Path.GetDirectoryName(_baseFilePath)}/{fileNameWithoutExtension}_{date}{fileExtension}";
}
public static void Log(string csvFormattedString)
{
- var filePath = GetCurrentLogFilePath();
- // 检查文件是否存在,如果不存在则创建并写入表头
- if (!File.Exists(filePath))
+ if (!_initialized)
+ throw new InvalidOperationException("CsvLogger 未初始化,请先调用 Initialize 方法");
+
+ lock (_lockObj)
{
- using (var writer = new StreamWriter(filePath))
- using (var csv = new CsvWriter(writer, CultureInfo.InvariantCulture))
+ try
{
- if (_customHeaders.Count > 0)
+ var filePath = GetCurrentLogFilePath();
+ bool fileExists = File.Exists(filePath);
+
+ // 如果文件不存在,先写入表头
+ if (!fileExists)
{
- foreach (var header in _customHeaders)
+ using (var writer = new StreamWriter(filePath, false, Encoding.UTF8))
+ using (var csv = new CsvWriter(writer, CultureInfo.InvariantCulture))
{
- csv.WriteField(header);
+ if (_customHeaders.Count > 0)
+ {
+ foreach (var header in _customHeaders)
+ {
+ csv.WriteField(header);
+ }
+ csv.NextRecord();
+ }
+ else
+ {
+ csv.WriteHeader();
+ csv.NextRecord();
+ }
+ }
+ }
+
+ // 直接写入日志,不使用队列
+ using (var writer = new StreamWriter(filePath, true, Encoding.UTF8))
+ using (var csv = new CsvWriter(writer, CultureInfo.InvariantCulture))
+ {
+ var fields = csvFormattedString.Split(',');
+ foreach (var field in fields)
+ {
+ csv.WriteField(field);
}
csv.NextRecord();
}
- else
- {
- csv.WriteHeader();
- csv.NextRecord();
- }
}
- }
-
- // 追加日志条目到文件
- using (var writer = new StreamWriter(filePath, true))
- using (var csv = new CsvWriter(writer, CultureInfo.InvariantCulture))
- {
- var fields = csvFormattedString.Split(',');
- foreach (var field in fields)
+ catch (Exception ex)
{
- csv.WriteField(field);
+ // 记录错误,但不抛出异常
+ Console.WriteLine($"写入日志文件时出错: {ex.Message}");
}
- csv.NextRecord();
}
}
}