diff --git a/SjMes/PunchAssemble/MESClassLibrary/EFModel/tb_ScanRecord_Laser.cs b/SjMes/PunchAssemble/MESClassLibrary/EFModel/tb_ScanRecord_Laser.cs index 9e67a2e..d5de1da 100644 --- a/SjMes/PunchAssemble/MESClassLibrary/EFModel/tb_ScanRecord_Laser.cs +++ b/SjMes/PunchAssemble/MESClassLibrary/EFModel/tb_ScanRecord_Laser.cs @@ -17,5 +17,8 @@ namespace MESClassLibrary.EFModel public long ID { get; set; } public string BarCode { get; set; } public Nullable ScanTime { get; set; } + + public string LeftOrRight { get; set; } + public string MCode { get; set; } } } diff --git a/SjMes/PunchAssemble/PunchAndWeld/App.config b/SjMes/PunchAssemble/PunchAndWeld/App.config index 4f1b765..33f99f3 100644 --- a/SjMes/PunchAssemble/PunchAndWeld/App.config +++ b/SjMes/PunchAssemble/PunchAndWeld/App.config @@ -9,6 +9,7 @@ + @@ -21,8 +22,8 @@ - - + + diff --git a/SjMes/PunchAssemble/PunchAndWeld/DataSouce/ProScreenFunc.cs b/SjMes/PunchAssemble/PunchAndWeld/DataSouce/ProScreenFunc.cs index cb6d1db..c286c3b 100644 --- a/SjMes/PunchAssemble/PunchAndWeld/DataSouce/ProScreenFunc.cs +++ b/SjMes/PunchAssemble/PunchAndWeld/DataSouce/ProScreenFunc.cs @@ -1805,7 +1805,7 @@ namespace PunchAndWeld.DataSouce return res; } - public static bool IsScan(string barCode) + public static bool IsScan(string barCode) { bool res = false; @@ -1825,6 +1825,64 @@ namespace PunchAndWeld.DataSouce return res; } + public static bool IsScanNew(string barCode,string tableName) + { + bool res = false; + + try + { + string sql = $@"select ID from {tableName} where BarCode='" + barCode + @"'"; + DataTable dt = SqlHelper.GetDataDateTable(SqlHelper.SqlConnString, CommandType.Text, sql, null); + if (dt != null && dt.Rows.Count > 0) + { + res = true; + } + } + catch (Exception ex) + { + LogHelper.WriteErrLogBase(ex.ToString(), MethodBase.GetCurrentMethod().Name); + } + + return res; + } + public static bool IsBarCodeExsit214(string barCode) + { + bool res = false; + + try + { + string sql = $@"select ID from tb_StockIn where BarCode='" + barCode + @"'"; + DataTable dt = SqlHelper.GetDataDateTable(SqlHelper.SqlConnString, CommandType.Text, sql, null); + if (dt != null && dt.Rows.Count > 0) + { + res = true; + } + } + catch (Exception ex) + { + LogHelper.WriteErrLogBase(ex.ToString(), MethodBase.GetCurrentMethod().Name); + } + + return res; + } + public static DataTable GetScanRecord_Lasers(DateTime timeFr,DateTime timeTo) + { + bool res = false; + + try + { + string sql = $@"select BarCode,ScanTime,LeftOrRight,MCode,'高' as Cfg from tb_ScanRecord_Laser where ScanTime>='{timeFr}' and ScanTime<='{timeTo}' + union all select BarCode,ScanTime,LeftOrRight,MCode,'低' as Cfg from tb_ScanRecord_LaserL where ScanTime>='{timeFr}' and ScanTime<='{timeTo}'"; + DataTable dt = SqlHelper.GetDataDateTable(SqlHelper.SqlConnString, CommandType.Text, sql, null); + return dt; + } + catch (Exception ex) + { + LogHelper.WriteErrLogBase(ex.ToString(), MethodBase.GetCurrentMethod().Name); + } + + return null; + } public static int AddScanRecord(string barCode) { @@ -1843,6 +1901,23 @@ namespace PunchAndWeld.DataSouce return res; } + public static int AddScanRecordNew(string barCode,string partCode,string leftOrright,string tableName) + { + int res = 0; + + try + { + string sql = $@"insert into {tableName}(BarCode,LeftOrRight,MCode) values('{barCode}','{leftOrright}','{partCode}')"; + res = SqlHelper.ExecuteNonQuery(SqlHelper.SqlConnString, CommandType.Text, sql, null); + return res; + } + catch (Exception ex) + { + LogHelper.WriteErrLogBase(ex.ToString(), MethodBase.GetCurrentMethod().Name); + } + + return res; + } public static string GetScanCountByClass(string workClass) { diff --git a/SjMes/PunchAssemble/PunchAndWeld/FrmDoorSill_214_3.Designer.cs b/SjMes/PunchAssemble/PunchAndWeld/FrmDoorSill_214_3.Designer.cs new file mode 100644 index 0000000..e12a3ee --- /dev/null +++ b/SjMes/PunchAssemble/PunchAndWeld/FrmDoorSill_214_3.Designer.cs @@ -0,0 +1,725 @@ +namespace PunchAndWeld +{ + partial class FrmDoorSill_214_3 + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); + this.panel1 = new System.Windows.Forms.Panel(); + this.txtLastScanR = new System.Windows.Forms.TextBox(); + this.txtProduceModel = new System.Windows.Forms.Label(); + this.label7 = new System.Windows.Forms.Label(); + this.txtConfig = new System.Windows.Forms.Label(); + this.label5 = new System.Windows.Forms.Label(); + this.lbScanState = new System.Windows.Forms.Label(); + this.label3 = new System.Windows.Forms.Label(); + this.lbLinkState = new System.Windows.Forms.Label(); + this.btnOpenParamDialog = new System.Windows.Forms.Button(); + this.button1 = new System.Windows.Forms.Button(); + this.label1 = new System.Windows.Forms.Label(); + this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel(); + this.txtRightScan = new System.Windows.Forms.TextBox(); + this.label9 = new System.Windows.Forms.Label(); + this.label10 = new System.Windows.Forms.Label(); + this.txtLeftScan = new System.Windows.Forms.TextBox(); + this.tableLayoutPanel3 = new System.Windows.Forms.TableLayoutPanel(); + this.txtLowQty = new System.Windows.Forms.Label(); + this.txtHighQty = new System.Windows.Forms.Label(); + this.txtRightQty = new System.Windows.Forms.Label(); + this.txtLeftQty = new System.Windows.Forms.Label(); + this.label12 = new System.Windows.Forms.Label(); + this.label13 = new System.Windows.Forms.Label(); + this.label14 = new System.Windows.Forms.Label(); + this.label15 = new System.Windows.Forms.Label(); + this.label16 = new System.Windows.Forms.Label(); + this.txtAllQty = new System.Windows.Forms.Label(); + this.lbVer = new System.Windows.Forms.Label(); + this.dgridScanRecords = new System.Windows.Forms.DataGridView(); + this.lbMsg = new System.Windows.Forms.Label(); + this.panel2 = new System.Windows.Forms.Panel(); + this.lbEnd = new System.Windows.Forms.Label(); + this.label6 = new System.Windows.Forms.Label(); + this.lbBegin = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.focusTimer = new System.Windows.Forms.Timer(this.components); + this.塑件唯一码 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.零件号 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.位置 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.配置 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.生产时间 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.txtLastScanL = new System.Windows.Forms.TextBox(); + this.timer1 = new System.Windows.Forms.Timer(this.components); + this.tableLayoutPanel1.SuspendLayout(); + this.panel1.SuspendLayout(); + this.tableLayoutPanel2.SuspendLayout(); + this.tableLayoutPanel3.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.dgridScanRecords)).BeginInit(); + this.panel2.SuspendLayout(); + this.SuspendLayout(); + // + // tableLayoutPanel1 + // + this.tableLayoutPanel1.ColumnCount = 1; + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel1.Controls.Add(this.panel1, 0, 0); + this.tableLayoutPanel1.Controls.Add(this.tableLayoutPanel2, 0, 1); + this.tableLayoutPanel1.Controls.Add(this.tableLayoutPanel3, 0, 3); + this.tableLayoutPanel1.Controls.Add(this.dgridScanRecords, 0, 4); + this.tableLayoutPanel1.Controls.Add(this.lbMsg, 0, 5); + this.tableLayoutPanel1.Controls.Add(this.panel2, 0, 2); + this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0); + this.tableLayoutPanel1.Name = "tableLayoutPanel1"; + this.tableLayoutPanel1.RowCount = 6; + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 100F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 80F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 40F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 60F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 40F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); + this.tableLayoutPanel1.Size = new System.Drawing.Size(1279, 765); + this.tableLayoutPanel1.TabIndex = 0; + // + // panel1 + // + this.panel1.Controls.Add(this.txtLastScanL); + this.panel1.Controls.Add(this.txtLastScanR); + this.panel1.Controls.Add(this.txtProduceModel); + this.panel1.Controls.Add(this.label7); + this.panel1.Controls.Add(this.txtConfig); + this.panel1.Controls.Add(this.label5); + this.panel1.Controls.Add(this.lbScanState); + this.panel1.Controls.Add(this.label3); + this.panel1.Controls.Add(this.lbLinkState); + this.panel1.Controls.Add(this.btnOpenParamDialog); + this.panel1.Controls.Add(this.button1); + this.panel1.Controls.Add(this.label1); + this.panel1.Dock = System.Windows.Forms.DockStyle.Fill; + this.panel1.Location = new System.Drawing.Point(3, 3); + this.panel1.Name = "panel1"; + this.panel1.Size = new System.Drawing.Size(1273, 94); + this.panel1.TabIndex = 0; + // + // txtLastScanR + // + this.txtLastScanR.Font = new System.Drawing.Font("宋体", 16.2F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.txtLastScanR.Location = new System.Drawing.Point(520, 47); + this.txtLastScanR.Name = "txtLastScanR"; + this.txtLastScanR.ReadOnly = true; + this.txtLastScanR.Size = new System.Drawing.Size(457, 38); + this.txtLastScanR.TabIndex = 10; + // + // txtProduceModel + // + this.txtProduceModel.AutoSize = true; + this.txtProduceModel.BackColor = System.Drawing.Color.Lime; + this.txtProduceModel.Font = new System.Drawing.Font("宋体", 10.8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.txtProduceModel.Location = new System.Drawing.Point(928, 8); + this.txtProduceModel.Name = "txtProduceModel"; + this.txtProduceModel.Size = new System.Drawing.Size(49, 19); + this.txtProduceModel.TabIndex = 9; + this.txtProduceModel.Text = "左右"; + // + // label7 + // + this.label7.AutoSize = true; + this.label7.Font = new System.Drawing.Font("宋体", 10.8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label7.Location = new System.Drawing.Point(793, 8); + this.label7.Name = "label7"; + this.label7.Size = new System.Drawing.Size(129, 19); + this.label7.TabIndex = 8; + this.label7.Text = "当前生产模式"; + // + // txtConfig + // + this.txtConfig.AutoSize = true; + this.txtConfig.BackColor = System.Drawing.Color.Lime; + this.txtConfig.Font = new System.Drawing.Font("宋体", 10.8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.txtConfig.Location = new System.Drawing.Point(721, 8); + this.txtConfig.Name = "txtConfig"; + this.txtConfig.Size = new System.Drawing.Size(49, 19); + this.txtConfig.TabIndex = 7; + this.txtConfig.Text = "高配"; + // + // label5 + // + this.label5.AutoSize = true; + this.label5.Font = new System.Drawing.Font("宋体", 10.8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label5.Location = new System.Drawing.Point(586, 8); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(129, 19); + this.label5.TabIndex = 6; + this.label5.Text = "当前配置状态"; + // + // lbScanState + // + this.lbScanState.AutoSize = true; + this.lbScanState.BackColor = System.Drawing.Color.Lime; + this.lbScanState.Font = new System.Drawing.Font("宋体", 10.8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.lbScanState.Location = new System.Drawing.Point(341, 8); + this.lbScanState.Name = "lbScanState"; + this.lbScanState.Size = new System.Drawing.Size(89, 19); + this.lbScanState.TabIndex = 5; + this.lbScanState.Text = "允许扫码"; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Font = new System.Drawing.Font("宋体", 10.8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label3.Location = new System.Drawing.Point(232, 8); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(89, 19); + this.label3.TabIndex = 4; + this.label3.Text = "扫描状态"; + // + // lbLinkState + // + this.lbLinkState.AutoSize = true; + this.lbLinkState.BackColor = System.Drawing.Color.Lime; + this.lbLinkState.Font = new System.Drawing.Font("宋体", 10.8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.lbLinkState.Location = new System.Drawing.Point(108, 8); + this.lbLinkState.Name = "lbLinkState"; + this.lbLinkState.Size = new System.Drawing.Size(89, 19); + this.lbLinkState.TabIndex = 3; + this.lbLinkState.Text = "连接成功"; + // + // btnOpenParamDialog + // + this.btnOpenParamDialog.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.btnOpenParamDialog.Location = new System.Drawing.Point(1089, 47); + this.btnOpenParamDialog.Name = "btnOpenParamDialog"; + this.btnOpenParamDialog.Size = new System.Drawing.Size(175, 37); + this.btnOpenParamDialog.TabIndex = 2; + this.btnOpenParamDialog.Text = "返回选中窗口"; + this.btnOpenParamDialog.UseVisualStyleBackColor = true; + this.btnOpenParamDialog.Click += new System.EventHandler(this.btnOpenParamDialog_Click); + // + // button1 + // + this.button1.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.button1.Location = new System.Drawing.Point(1089, 4); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(175, 37); + this.button1.TabIndex = 1; + this.button1.Text = "查询明细"; + this.button1.UseVisualStyleBackColor = true; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Font = new System.Drawing.Font("宋体", 10.8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label1.Location = new System.Drawing.Point(10, 8); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(82, 19); + this.label1.TabIndex = 0; + this.label1.Text = "PLC状态"; + // + // tableLayoutPanel2 + // + this.tableLayoutPanel2.ColumnCount = 4; + this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 60F)); + this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); + this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 60F)); + this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); + this.tableLayoutPanel2.Controls.Add(this.txtRightScan, 3, 0); + this.tableLayoutPanel2.Controls.Add(this.label9, 0, 0); + this.tableLayoutPanel2.Controls.Add(this.label10, 2, 0); + this.tableLayoutPanel2.Controls.Add(this.txtLeftScan, 1, 0); + this.tableLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableLayoutPanel2.Location = new System.Drawing.Point(3, 103); + this.tableLayoutPanel2.Name = "tableLayoutPanel2"; + this.tableLayoutPanel2.RowCount = 1; + this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel2.Size = new System.Drawing.Size(1273, 74); + this.tableLayoutPanel2.TabIndex = 1; + // + // txtRightScan + // + this.txtRightScan.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); + this.txtRightScan.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.txtRightScan.Location = new System.Drawing.Point(699, 16); + this.txtRightScan.Name = "txtRightScan"; + this.txtRightScan.Size = new System.Drawing.Size(571, 42); + this.txtRightScan.TabIndex = 3; + this.txtRightScan.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtRightScan_KeyDown); + // + // label9 + // + this.label9.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left))); + this.label9.AutoSize = true; + this.label9.BackColor = System.Drawing.Color.Lime; + this.label9.Font = new System.Drawing.Font("宋体", 24F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label9.Location = new System.Drawing.Point(3, 0); + this.label9.Name = "label9"; + this.label9.Size = new System.Drawing.Size(54, 74); + this.label9.TabIndex = 0; + this.label9.Text = "左"; + this.label9.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // label10 + // + this.label10.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left))); + this.label10.AutoSize = true; + this.label10.BackColor = System.Drawing.Color.Lime; + this.label10.Font = new System.Drawing.Font("宋体", 24F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label10.Location = new System.Drawing.Point(639, 0); + this.label10.Name = "label10"; + this.label10.Size = new System.Drawing.Size(54, 74); + this.label10.TabIndex = 1; + this.label10.Text = "右"; + this.label10.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // txtLeftScan + // + this.txtLeftScan.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); + this.txtLeftScan.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.txtLeftScan.Location = new System.Drawing.Point(63, 16); + this.txtLeftScan.Name = "txtLeftScan"; + this.txtLeftScan.Size = new System.Drawing.Size(570, 42); + this.txtLeftScan.TabIndex = 2; + this.txtLeftScan.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtLeftScan_KeyDown); + // + // tableLayoutPanel3 + // + this.tableLayoutPanel3.ColumnCount = 11; + this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 80F)); + this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 100F)); + this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 60F)); + this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 100F)); + this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 60F)); + this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 100F)); + this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 80F)); + this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 100F)); + this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 80F)); + this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 100F)); + this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel3.Controls.Add(this.txtLowQty, 9, 0); + this.tableLayoutPanel3.Controls.Add(this.txtHighQty, 7, 0); + this.tableLayoutPanel3.Controls.Add(this.txtRightQty, 5, 0); + this.tableLayoutPanel3.Controls.Add(this.txtLeftQty, 3, 0); + this.tableLayoutPanel3.Controls.Add(this.label12, 0, 0); + this.tableLayoutPanel3.Controls.Add(this.label13, 2, 0); + this.tableLayoutPanel3.Controls.Add(this.label14, 4, 0); + this.tableLayoutPanel3.Controls.Add(this.label15, 6, 0); + this.tableLayoutPanel3.Controls.Add(this.label16, 8, 0); + this.tableLayoutPanel3.Controls.Add(this.txtAllQty, 1, 0); + this.tableLayoutPanel3.Controls.Add(this.lbVer, 10, 0); + this.tableLayoutPanel3.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableLayoutPanel3.Location = new System.Drawing.Point(3, 223); + this.tableLayoutPanel3.Name = "tableLayoutPanel3"; + this.tableLayoutPanel3.RowCount = 1; + this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel3.Size = new System.Drawing.Size(1273, 54); + this.tableLayoutPanel3.TabIndex = 3; + // + // txtLowQty + // + this.txtLowQty.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.txtLowQty.AutoSize = true; + this.txtLowQty.Font = new System.Drawing.Font("宋体", 15F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.txtLowQty.Location = new System.Drawing.Point(763, 0); + this.txtLowQty.Name = "txtLowQty"; + this.txtLowQty.Size = new System.Drawing.Size(94, 54); + this.txtLowQty.TabIndex = 9; + this.txtLowQty.Text = "0"; + this.txtLowQty.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // txtHighQty + // + this.txtHighQty.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.txtHighQty.AutoSize = true; + this.txtHighQty.Font = new System.Drawing.Font("宋体", 15F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.txtHighQty.Location = new System.Drawing.Point(583, 0); + this.txtHighQty.Name = "txtHighQty"; + this.txtHighQty.Size = new System.Drawing.Size(94, 54); + this.txtHighQty.TabIndex = 8; + this.txtHighQty.Text = "0"; + this.txtHighQty.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // txtRightQty + // + this.txtRightQty.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.txtRightQty.AutoSize = true; + this.txtRightQty.Font = new System.Drawing.Font("宋体", 15F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.txtRightQty.Location = new System.Drawing.Point(403, 0); + this.txtRightQty.Name = "txtRightQty"; + this.txtRightQty.Size = new System.Drawing.Size(94, 54); + this.txtRightQty.TabIndex = 7; + this.txtRightQty.Text = "0"; + this.txtRightQty.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // txtLeftQty + // + this.txtLeftQty.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.txtLeftQty.AutoSize = true; + this.txtLeftQty.Font = new System.Drawing.Font("宋体", 15F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.txtLeftQty.Location = new System.Drawing.Point(243, 0); + this.txtLeftQty.Name = "txtLeftQty"; + this.txtLeftQty.Size = new System.Drawing.Size(94, 54); + this.txtLeftQty.TabIndex = 6; + this.txtLeftQty.Text = "0"; + this.txtLeftQty.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // label12 + // + this.label12.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.label12.AutoSize = true; + this.label12.BackColor = System.Drawing.Color.Lime; + this.label12.Font = new System.Drawing.Font("宋体", 15F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label12.Location = new System.Drawing.Point(3, 0); + this.label12.Name = "label12"; + this.label12.Size = new System.Drawing.Size(74, 54); + this.label12.TabIndex = 0; + this.label12.Text = "总数"; + this.label12.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // label13 + // + this.label13.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.label13.AutoSize = true; + this.label13.BackColor = System.Drawing.Color.Lime; + this.label13.Font = new System.Drawing.Font("宋体", 15F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label13.Location = new System.Drawing.Point(183, 0); + this.label13.Name = "label13"; + this.label13.Size = new System.Drawing.Size(54, 54); + this.label13.TabIndex = 1; + this.label13.Text = "左"; + this.label13.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // label14 + // + this.label14.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.label14.AutoSize = true; + this.label14.BackColor = System.Drawing.Color.Lime; + this.label14.Font = new System.Drawing.Font("宋体", 15F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label14.Location = new System.Drawing.Point(343, 0); + this.label14.Name = "label14"; + this.label14.Size = new System.Drawing.Size(54, 54); + this.label14.TabIndex = 2; + this.label14.Text = "右"; + this.label14.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // label15 + // + this.label15.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.label15.AutoSize = true; + this.label15.BackColor = System.Drawing.Color.Lime; + this.label15.Font = new System.Drawing.Font("宋体", 15F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label15.Location = new System.Drawing.Point(503, 0); + this.label15.Name = "label15"; + this.label15.Size = new System.Drawing.Size(74, 54); + this.label15.TabIndex = 3; + this.label15.Text = "高配"; + this.label15.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // label16 + // + this.label16.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.label16.AutoSize = true; + this.label16.BackColor = System.Drawing.Color.Lime; + this.label16.Font = new System.Drawing.Font("宋体", 15F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label16.Location = new System.Drawing.Point(683, 0); + this.label16.Name = "label16"; + this.label16.Size = new System.Drawing.Size(74, 54); + this.label16.TabIndex = 4; + this.label16.Text = "低配"; + this.label16.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // txtAllQty + // + this.txtAllQty.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.txtAllQty.AutoSize = true; + this.txtAllQty.Font = new System.Drawing.Font("宋体", 15F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.txtAllQty.Location = new System.Drawing.Point(83, 0); + this.txtAllQty.Name = "txtAllQty"; + this.txtAllQty.Size = new System.Drawing.Size(94, 54); + this.txtAllQty.TabIndex = 5; + this.txtAllQty.Text = "0"; + this.txtAllQty.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // lbVer + // + this.lbVer.Anchor = System.Windows.Forms.AnchorStyles.Right; + this.lbVer.AutoSize = true; + this.lbVer.Location = new System.Drawing.Point(1231, 19); + this.lbVer.Name = "lbVer"; + this.lbVer.Size = new System.Drawing.Size(39, 15); + this.lbVer.TabIndex = 10; + this.lbVer.Text = " "; + // + // dgridScanRecords + // + this.dgridScanRecords.AllowUserToAddRows = false; + this.dgridScanRecords.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.dgridScanRecords.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { + this.塑件唯一码, + this.零件号, + this.位置, + this.配置, + this.生产时间}); + this.dgridScanRecords.Dock = System.Windows.Forms.DockStyle.Fill; + this.dgridScanRecords.Location = new System.Drawing.Point(3, 283); + this.dgridScanRecords.Name = "dgridScanRecords"; + this.dgridScanRecords.ReadOnly = true; + this.dgridScanRecords.RowHeadersWidth = 51; + this.dgridScanRecords.RowTemplate.Height = 27; + this.dgridScanRecords.Size = new System.Drawing.Size(1273, 439); + this.dgridScanRecords.TabIndex = 4; + // + // lbMsg + // + this.lbMsg.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left))); + this.lbMsg.AutoSize = true; + this.lbMsg.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.lbMsg.ForeColor = System.Drawing.Color.Red; + this.lbMsg.Location = new System.Drawing.Point(3, 725); + this.lbMsg.Name = "lbMsg"; + this.lbMsg.Size = new System.Drawing.Size(146, 40); + this.lbMsg.TabIndex = 5; + this.lbMsg.Text = "异常信息 提示"; + this.lbMsg.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // panel2 + // + this.panel2.Controls.Add(this.lbEnd); + this.panel2.Controls.Add(this.label6); + this.panel2.Controls.Add(this.lbBegin); + this.panel2.Controls.Add(this.label2); + this.panel2.Dock = System.Windows.Forms.DockStyle.Fill; + this.panel2.Location = new System.Drawing.Point(3, 183); + this.panel2.Name = "panel2"; + this.panel2.Size = new System.Drawing.Size(1273, 34); + this.panel2.TabIndex = 6; + // + // lbEnd + // + this.lbEnd.AutoSize = true; + this.lbEnd.Font = new System.Drawing.Font("宋体", 10.8F, System.Drawing.FontStyle.Bold); + this.lbEnd.Location = new System.Drawing.Point(404, 10); + this.lbEnd.Name = "lbEnd"; + this.lbEnd.Size = new System.Drawing.Size(218, 19); + this.lbEnd.TabIndex = 3; + this.lbEnd.Text = "2024-06-01 23:59:59"; + // + // label6 + // + this.label6.AutoSize = true; + this.label6.Font = new System.Drawing.Font("宋体", 10.8F, System.Drawing.FontStyle.Bold); + this.label6.Location = new System.Drawing.Point(374, 10); + this.label6.Name = "label6"; + this.label6.Size = new System.Drawing.Size(20, 19); + this.label6.TabIndex = 2; + this.label6.Text = "-"; + // + // lbBegin + // + this.lbBegin.AutoSize = true; + this.lbBegin.Font = new System.Drawing.Font("宋体", 10.8F, System.Drawing.FontStyle.Bold); + this.lbBegin.Location = new System.Drawing.Point(150, 10); + this.lbBegin.Name = "lbBegin"; + this.lbBegin.Size = new System.Drawing.Size(218, 19); + this.lbBegin.TabIndex = 1; + this.lbBegin.Text = "2024-06-01 00:00:00"; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Font = new System.Drawing.Font("宋体", 10.8F, System.Drawing.FontStyle.Bold); + this.label2.Location = new System.Drawing.Point(5, 10); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(140, 19); + this.label2.TabIndex = 0; + this.label2.Text = "当前生产数据:"; + // + // focusTimer + // + this.focusTimer.Enabled = true; + this.focusTimer.Interval = 1500; + this.focusTimer.Tick += new System.EventHandler(this.focusTimer_Tick); + // + // 塑件唯一码 + // + this.塑件唯一码.DataPropertyName = "BarCode"; + this.塑件唯一码.HeaderText = "塑件唯一码"; + this.塑件唯一码.MinimumWidth = 6; + this.塑件唯一码.Name = "塑件唯一码"; + this.塑件唯一码.ReadOnly = true; + this.塑件唯一码.Width = 200; + // + // 零件号 + // + this.零件号.DataPropertyName = "MCode"; + this.零件号.HeaderText = "零件号"; + this.零件号.MinimumWidth = 6; + this.零件号.Name = "零件号"; + this.零件号.ReadOnly = true; + this.零件号.Visible = false; + this.零件号.Width = 200; + // + // 位置 + // + this.位置.DataPropertyName = "LeftOrRight"; + this.位置.HeaderText = "位置"; + this.位置.MinimumWidth = 6; + this.位置.Name = "位置"; + this.位置.ReadOnly = true; + this.位置.Width = 200; + // + // 配置 + // + this.配置.DataPropertyName = "Cfg"; + this.配置.HeaderText = "配置"; + this.配置.MinimumWidth = 6; + this.配置.Name = "配置"; + this.配置.ReadOnly = true; + this.配置.Width = 200; + // + // 生产时间 + // + this.生产时间.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; + this.生产时间.DataPropertyName = "ScanTime"; + this.生产时间.HeaderText = "生产时间"; + this.生产时间.MinimumWidth = 6; + this.生产时间.Name = "生产时间"; + this.生产时间.ReadOnly = true; + // + // txtLastScanL + // + this.txtLastScanL.Font = new System.Drawing.Font("宋体", 16.2F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.txtLastScanL.Location = new System.Drawing.Point(40, 46); + this.txtLastScanL.Name = "txtLastScanL"; + this.txtLastScanL.ReadOnly = true; + this.txtLastScanL.Size = new System.Drawing.Size(457, 38); + this.txtLastScanL.TabIndex = 11; + // + // timer1 + // + this.timer1.Interval = 1000; + this.timer1.Tick += new System.EventHandler(this.timer1_Tick); + // + // FrmDoorSill_214_3 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(1279, 765); + this.Controls.Add(this.tableLayoutPanel1); + this.Name = "FrmDoorSill_214_3"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "FrmDoorSill_214_3"; + this.Load += new System.EventHandler(this.FrmDoorSill_214_3_Load); + this.tableLayoutPanel1.ResumeLayout(false); + this.tableLayoutPanel1.PerformLayout(); + this.panel1.ResumeLayout(false); + this.panel1.PerformLayout(); + this.tableLayoutPanel2.ResumeLayout(false); + this.tableLayoutPanel2.PerformLayout(); + this.tableLayoutPanel3.ResumeLayout(false); + this.tableLayoutPanel3.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.dgridScanRecords)).EndInit(); + this.panel2.ResumeLayout(false); + this.panel2.PerformLayout(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; + private System.Windows.Forms.Panel panel1; + private System.Windows.Forms.Button btnOpenParamDialog; + private System.Windows.Forms.Button button1; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label txtProduceModel; + private System.Windows.Forms.Label label7; + private System.Windows.Forms.Label txtConfig; + private System.Windows.Forms.Label label5; + private System.Windows.Forms.Label lbScanState; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.Label lbLinkState; + private System.Windows.Forms.TextBox txtLastScanR; + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2; + private System.Windows.Forms.Label label9; + private System.Windows.Forms.Label label10; + private System.Windows.Forms.TextBox txtRightScan; + private System.Windows.Forms.TextBox txtLeftScan; + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel3; + private System.Windows.Forms.Label label12; + private System.Windows.Forms.Label label13; + private System.Windows.Forms.Label label14; + private System.Windows.Forms.Label label15; + private System.Windows.Forms.Label label16; + private System.Windows.Forms.Label txtAllQty; + private System.Windows.Forms.Label txtLowQty; + private System.Windows.Forms.Label txtHighQty; + private System.Windows.Forms.Label txtRightQty; + private System.Windows.Forms.Label txtLeftQty; + private System.Windows.Forms.DataGridView dgridScanRecords; + private System.Windows.Forms.Label lbMsg; + private System.Windows.Forms.Label lbVer; + private System.Windows.Forms.Timer focusTimer; + private System.Windows.Forms.Panel panel2; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Label lbEnd; + private System.Windows.Forms.Label label6; + private System.Windows.Forms.Label lbBegin; + private System.Windows.Forms.DataGridViewTextBoxColumn 塑件唯一码; + private System.Windows.Forms.DataGridViewTextBoxColumn 零件号; + private System.Windows.Forms.DataGridViewTextBoxColumn 位置; + private System.Windows.Forms.DataGridViewTextBoxColumn 配置; + private System.Windows.Forms.DataGridViewTextBoxColumn 生产时间; + private System.Windows.Forms.TextBox txtLastScanL; + private System.Windows.Forms.Timer timer1; + } +} \ No newline at end of file diff --git a/SjMes/PunchAssemble/PunchAndWeld/FrmDoorSill_214_3.cs b/SjMes/PunchAssemble/PunchAndWeld/FrmDoorSill_214_3.cs new file mode 100644 index 0000000..9c865e0 --- /dev/null +++ b/SjMes/PunchAssemble/PunchAndWeld/FrmDoorSill_214_3.cs @@ -0,0 +1,583 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Configuration; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using System.Windows.Forms; +using MESClassLibrary.BLL.Log; +using OPCAutomation; +using PunchAndWeld.DataSouce; + +namespace PunchAndWeld +{ + public partial class FrmDoorSill_214_3 : Form + { + private FrmDoorSill_214_3_Condition _conditionDialog = null; + private OPCHelper opcHelper = new OPCHelper(); + private int stationState = 0; + private string _produceModel = string.Empty; + private SynchronizationContext _syncontext = SynchronizationContext.Current; //同步上下文 + private string _lastScan = string.Empty; + public FrmDoorSill_214_3() + { + InitializeComponent(); + + this.Hide(); + ShowParamDialog("",""); + } + + #region event + + private void FrmDoorSill_214_3_Load(object sender, EventArgs e) + { + _syncontext = SynchronizationContext.Current; + lbVer.Text = "当前版本:" + Assembly.GetExecutingAssembly().GetName().Version; + lbBegin.Text = DateTime.Now.ToShortDateString() + " 00:00:00"; + lbEnd.Text = DateTime.Now.ToShortDateString() + " 23:59:59"; + dgridScanRecords.RowsAdded += DgridScanRecords_RowsAdded; + ClearDisplay(); + InitPLC(); + GetScanRecords(); + LoadScanBoxEnabled(); + + + + } + private void timer1_Tick(object sender, EventArgs e) + { + if(txtProduceModel.Text?.Trim() == "左右") + { + LeftAndRightFocus(); + } + timer1.Enabled = false; + } + private void DgridScanRecords_RowsAdded(object sender, DataGridViewRowsAddedEventArgs e) + { + for (int i = 0; i < e.RowCount; i++) + { + ((DataGridView)sender).Rows[e.RowIndex + i].HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleRight; + ((DataGridView)sender).Rows[e.RowIndex + i].HeaderCell.Value = (e.RowIndex + i + 1).ToString(); + } + } + + void LoadScanBoxEnabled() + { + txtRightScan.Enabled = true; + txtLeftScan.Enabled = true; + _produceModel = txtProduceModel.Text.Trim(); + if (_produceModel == "左") + { + txtRightScan.Enabled = false; + } + else if (_produceModel == "右") + { + txtLeftScan.Enabled = false; + } + } + + private void btnOpenParamDialog_Click(object sender, EventArgs e) + { + txtConfig.Text = ""; + txtProduceModel.Text = ""; + ShowParamDialog(txtConfig.Text, txtProduceModel.Text); + LoadScanBoxEnabled(); + } + private void txtLeftScan_KeyDown(object sender, KeyEventArgs e) + { + if(e.KeyCode == Keys.Enter) + { + ScanBarCode("左"); + } + } + + private void txtRightScan_KeyDown(object sender, KeyEventArgs e) + { + if (e.KeyCode == Keys.Enter) + { + ScanBarCode("右"); + } + } + + + + private void focusTimer_Tick(object sender, EventArgs e) + { + if (string.IsNullOrEmpty(_produceModel)) return; + + if(_produceModel == "左") + { + txtLeftScan.Focus(); + txtLeftScan.SelectAll(); + } + else if (_produceModel == "右") + { + txtRightScan.Focus(); + txtRightScan.SelectAll(); + } + //else if (_produceModel == "左右") + //{ + + //} + } + void LeftAndRightFocus() + { + if(string.IsNullOrEmpty( _lastScan)) + { + txtLeftScan.Focus(); + txtLeftScan.SelectAll(); + } + else if (_lastScan == "右") + { + txtLeftScan.Focus(); + txtLeftScan.SelectAll(); + } + else + { + txtRightScan.Focus(); + txtRightScan.SelectAll(); + } + //if (string.IsNullOrEmpty(txtLeftScan.Text)) + //{ + // txtLeftScan.Focus(); + // txtLeftScan.SelectAll(); + //} + //else if (string.IsNullOrEmpty(txtRightScan.Text)) + //{ + // txtRightScan.Focus(); + // txtRightScan.SelectAll(); + //} + //else + //{ + // txtLeftScan.Focus(); + // txtLeftScan.SelectAll(); + //} + } + #endregion + + #region PLC + void InitPLC() + { + if (ConfigurationManager.AppSettings["IsHaveVisual"] == "1") + { + try + { + if (opcHelper.CreateServer()) + { + if (opcHelper.ConnectServer("", "Kepware.KEPServerEX.V6")) + { + opcHelper.Connected = true; + ShowLinkState(true); + + opcHelper.opcGroups = opcHelper.opcServer.OPCGroups; + opcHelper.opcGroup1 = opcHelper.opcGroups.Add("Right"); + opcHelper.SetGroupProperty(opcHelper.opcGroup1, 500); + + + opcHelper.opcItems1 = opcHelper.opcGroup1.OPCItems; + opcHelper.opcItems1.DefaultIsActive = true; + + Dictionary dict = GetDevInfo(); + opcHelper.opcItemm1 = new OPCItem[dict.Count]; + foreach (var dictItem in dict) + { + opcHelper.opcItemm1[dictItem.Key] = opcHelper.opcItems1.AddItem(dictItem.Value, dictItem.Key); + } + + opcHelper.opcGroup1.DataChange += new DIOPCGroupEvent_DataChangeEventHandler(opcGroup1_DataChange); + stationState = opcHelper.ReadSingleValueFromOPC2(1); + + //Thread t1 = new Thread(new ThreadStart(TimeGo1)); + //t1.Start(); + + } + } + else + { + MessageBox.Show("创建OPC服务失败!", "提示", MessageBoxButtons.OK); + opcHelper.Connected = false; + LogHelper.WriteErrLogBase("工位:" + label1.Text + "创建OPC服务失败!", MethodBase.GetCurrentMethod().Name); + return; + } + } + catch (Exception ex) + { + LogHelper.WriteErrLogBase(ex.ToString(), MethodBase.GetCurrentMethod().Name); + ShowLinkState(false); + ShowHint("初始化设备时失败,请检查KepServer配置, 堆栈原因:" + ex.Message, true); + } + } + else + { + ShowLinkState(null); + } + + } + + + /// + /// + /// + /// 配置 1高配,2低配 + /// 1左右,2左,3右 + /// 1允许生产,0生产完成 + public void SendToPLC(string config, string leftOrRight, int state) + { + if (ConfigurationManager.AppSettings["IsHaveVisual"] == "1") + { + if (opcHelper.opcItemm1.Count() == 0) + { + throw new Exception("没有加载设备地址标记,地址标记列表为空."); + } + ShowDevState(true); + //opcItemm1[2].ItemID + opcHelper.opcItemm1[0].Write(config);//配置 + opcHelper.opcItemm1[1].Write(leftOrRight); //左右 + opcHelper.opcItemm1[2].Write(state); //完成信号, 发送时写1,完成时写0 + //opcHelper.opcItemm1[3].Write(1); + + ShowDevState(true); + //LogHelper.Write($"向设备发送工位[{stationCode}],配置[{cfg}]"); + } + + } + + void opcGroup1_DataChange(int TransactionID, int NumItems, ref Array ClientHandles, ref Array ItemValues, ref Array Qualities, ref Array TimeStamps) + { + try + { + for (int i = 1; i <= NumItems; i++) + { + int handle = Convert.ToInt32(ClientHandles.GetValue(i).ToString().Trim()); + string value = ItemValues.GetValue(i).ToString(); + string address = opcHelper.opcItemm1[(Convert.ToInt32(ClientHandles.GetValue(i)))].ItemID; + + if (handle == 2) + { + if (value == "0") + { + ShowDevState(false); + + } + else if (value == "1") + { + ShowDevState(true); + } + + } + if (handle == 1) + { + + } + } + } + catch (Exception ex) + { + LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod()); + } + } + Dictionary GetDevInfo() + { + Dictionary dict = new Dictionary(); + + //正式 + //dict.Add(0, "BBMPT.ZP214.Config"); + //dict.Add(1, "BBMPT.ZP214.LeftOrRight"); + //dict.Add(2, "BBMPT.ZP214.State"); + //dict.Add(3, "BBMPT.ZP214.Pulse"); + + //测试 + dict.Add(0, "BBMPT_TEST.Dev1.Config"); + dict.Add(1, "BBMPT_TEST.Dev1.LeftOrRight"); + dict.Add(2, "BBMPT_TEST.Dev1.State"); + dict.Add(3, "BBMPT_TEST.Dev1.Pulse"); + + return dict; + } + + + #endregion + + #region business + void ShowParamDialog(string cfg, string pm) + { + _conditionDialog = new FrmDoorSill_214_3_Condition(cfg, pm); + _conditionDialog.AfterOkButtonClick += (configCode, produceModel) => { + txtConfig.Text = configCode; + txtProduceModel.Text = produceModel; + this.Show(); + _conditionDialog.Hide(); + timer1.Enabled = true; + }; + + _conditionDialog.FormClosed += (arg1, arg2) => { + this.Close(); + this.Dispose(); + + }; + _conditionDialog.ShowDialog(); + + } + void ScanBarCode( string leftOrRight) + { + try + { + _lastScan = leftOrRight; + if (lbScanState.Text.StartsWith("处理中")) + { + ShowHint($"设备正在处理中,请等待完成后,再重新操作", true); + return; + } + ShowHint("", true); + int produceModel = 0; + int config = 0; + string barCode = string.Empty; + string tableName = string.Empty; + if (VerifyConfig(leftOrRight, ref produceModel, ref config, ref barCode, ref tableName) == false) + return; + + if (ProScreenFunc.IsBarCodeExsit214(barCode) == false) + { + ShowHint($"条码[{barCode}]在系统中不存在,请扫新的条码", true); + return; + } + if (ProScreenFunc.IsScanNew(barCode, tableName) == true) + { + ShowHint($"条码[{barCode}]已存在扫码记录,请扫新的条码", true); + return; + } + if(leftOrRight == "左") + { + txtLastScanL.Text = barCode; + } + else + { + txtLastScanR.Text = barCode; + } + txtLeftScan.Text = ""; + txtRightScan.Text = ""; + + ProScreenFunc.AddScanRecordNew(barCode, "", leftOrRight, tableName); + SendToPLC(config.ToString(), produceModel.ToString(), 1); + + string model = txtProduceModel.Text?.Trim(); + if (model == "左右") + { + LeftAndRightFocus(); + } + Action searchAction = GetScanRecords; + searchAction.BeginInvoke(null, null); + + } + catch(Exception ex) + { + ShowHint("扫码处理时发生错误,错误内容:" + ex.Message, true); + } + + + + } + void GetScanRecords() + { + DateTime timeFr = DateTime.Now; + DateTime timeTo = DateTime.Now; + _syncontext.Send(rst1 => + { + DateTime.TryParse(lbBegin.Text, out timeFr); + DateTime.TryParse(lbEnd.Text, out timeTo); + + DataTable dt = ProScreenFunc.GetScanRecord_Lasers(timeFr, timeTo); + dgridScanRecords.DataSource = dt; + + txtAllQty.Text = dt.Rows.Count.ToString(); + + var grp1 = dt.AsEnumerable().GroupBy(p => p.Field("LeftOrRight")); + foreach (var item1 in grp1) + { + if (item1.Key == "左") + { + txtLeftQty.Text = item1.ToList().Count.ToString(); + } + else + { + txtRightQty.Text = item1.ToList().Count.ToString(); + } + } + + var grp2 = dt.AsEnumerable().GroupBy(p => p.Field("Cfg")); + foreach (var item2 in grp2) + { + if (item2.Key == "高") + { + txtHighQty.Text = item2.ToList().Count.ToString(); + } + else + { + txtLowQty.Text = item2.ToList().Count.ToString(); + } + } + }, null); + + + } + bool VerifyConfig(string leftOrRight, ref int produceModel,ref int config,ref string barCode,ref string tableName) + { + int cfg = 1; + if (string.IsNullOrEmpty(leftOrRight)) + { + ShowHint("生产模式不能为空", true); + return false; + }; + if (string.IsNullOrEmpty(txtConfig.Text)) + { + ShowHint("当前配置不能为空", true); + return false; + }; + if (txtConfig.Text?.Trim() == "高配") + { + config = 1; + tableName = "tb_ScanRecord_Laser"; + } + else if (txtConfig.Text?.Trim() == "低配") + { + config = 2; + tableName = "tb_ScanRecord_LaserL"; + } + else + { + ShowHint("当前配置内容格式错误", true); + return false; + } + + string model = txtProduceModel.Text?.Trim(); + if (model!="左右" && model.Contains(leftOrRight)==false) + { + ShowHint($"当前输入框为[{leftOrRight}],当前生产模式为[{model}],二者不匹配.", true); + return false; + } + if(model == "左") + { + produceModel = 2; + + } + else if (model == "右") + { + produceModel = 3; + } + else if (model == "左右") + { + produceModel = 1; + } + else + { + ShowHint("生产模式内容格式错误", true); + return false; + } + + if (leftOrRight == "左") + { + barCode = txtLeftScan.Text?.Trim(); + } + else + { + barCode = txtRightScan.Text?.Trim(); + } + if (string.IsNullOrEmpty(barCode)) + { + ShowHint(leftOrRight + "侧扫描条码为空", true); + return false; + } + if (barCode.Length!=20) + { + ShowHint(leftOrRight + "侧,请扫20位塑件码", true); + return false; + } + return true; + } + #endregion + + #region tools + + + + void ShowHint(string txt, bool isErr) + { + lbMsg.Text = txt; + if (isErr) + { + lbMsg.ForeColor = Color.Red; + } + else + { + lbMsg.ForeColor = Color.Green; + } + } + + /// + /// 显示PLC连接状态 + /// + /// + void ShowLinkState(bool? isLink) + { + if (isLink==true) + { + lbLinkState.Text = "连接成功"; + lbLinkState.BackColor = Color.Lime; + } + else if (isLink == false) + { + lbLinkState.Text = "连接失败"; + lbLinkState.BackColor = Color.Red; + } + else if (isLink == null) + { + lbLinkState.Text = "离线模式"; + lbLinkState.BackColor = Color.Red; + } + } + + /// + /// 显示设备状态 + /// + /// + void ShowDevState(bool isBusy) + { + if (isBusy) + { + lbScanState.Text = "处理中..."; + lbScanState.BackColor = Color.Red; + } + else + { + lbScanState.Text = "允许扫码"; + lbScanState.BackColor = Color.Lime; + } + + } + + void ClearDisplay() + { + lbLinkState.Text = ""; + lbScanState.Text = ""; + txtLeftScan.Text = ""; + txtRightScan.Text = ""; + txtAllQty.Text = "0"; + txtLeftQty.Text = "0"; + txtRightQty.Text = "0"; + txtHighQty.Text = "0"; + txtLowQty.Text = "0"; + lbMsg.Text = ""; + } + + + + #endregion + + + } +} diff --git a/SjMes/PunchAssemble/PunchAndWeld/FrmDoorSill_214_3.resx b/SjMes/PunchAssemble/PunchAndWeld/FrmDoorSill_214_3.resx new file mode 100644 index 0000000..a65a826 --- /dev/null +++ b/SjMes/PunchAssemble/PunchAndWeld/FrmDoorSill_214_3.resx @@ -0,0 +1,156 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + True + + + True + + + True + + + True + + + True + + + 17, 17 + + + True + + + True + + + True + + + True + + + True + + + 155, 17 + + \ No newline at end of file diff --git a/SjMes/PunchAssemble/PunchAndWeld/FrmDoorSill_214_3_Condition.Designer.cs b/SjMes/PunchAssemble/PunchAndWeld/FrmDoorSill_214_3_Condition.Designer.cs new file mode 100644 index 0000000..225ece6 --- /dev/null +++ b/SjMes/PunchAssemble/PunchAndWeld/FrmDoorSill_214_3_Condition.Designer.cs @@ -0,0 +1,222 @@ +namespace PunchAndWeld +{ + partial class FrmDoorSill_214_3_Condition + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); + this.groupBox2 = new System.Windows.Forms.GroupBox(); + this.checkBox5 = new System.Windows.Forms.CheckBox(); + this.checkBox4 = new System.Windows.Forms.CheckBox(); + this.checkBox3 = new System.Windows.Forms.CheckBox(); + this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.cboxL = new System.Windows.Forms.CheckBox(); + this.cboxH = new System.Windows.Forms.CheckBox(); + this.panel1 = new System.Windows.Forms.Panel(); + this.btnCancel = new System.Windows.Forms.Button(); + this.btnOK = new System.Windows.Forms.Button(); + this.tableLayoutPanel1.SuspendLayout(); + this.groupBox2.SuspendLayout(); + this.groupBox1.SuspendLayout(); + this.panel1.SuspendLayout(); + this.SuspendLayout(); + // + // tableLayoutPanel1 + // + this.tableLayoutPanel1.ColumnCount = 1; + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel1.Controls.Add(this.groupBox2, 0, 1); + this.tableLayoutPanel1.Controls.Add(this.groupBox1, 0, 0); + this.tableLayoutPanel1.Controls.Add(this.panel1, 0, 2); + this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0); + this.tableLayoutPanel1.Name = "tableLayoutPanel1"; + this.tableLayoutPanel1.RowCount = 3; + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 60F)); + this.tableLayoutPanel1.Size = new System.Drawing.Size(934, 535); + this.tableLayoutPanel1.TabIndex = 0; + // + // groupBox2 + // + this.groupBox2.BackColor = System.Drawing.Color.White; + this.groupBox2.Controls.Add(this.checkBox5); + this.groupBox2.Controls.Add(this.checkBox4); + this.groupBox2.Controls.Add(this.checkBox3); + this.groupBox2.Dock = System.Windows.Forms.DockStyle.Fill; + this.groupBox2.ForeColor = System.Drawing.Color.Blue; + this.groupBox2.Location = new System.Drawing.Point(3, 240); + this.groupBox2.Name = "groupBox2"; + this.groupBox2.Size = new System.Drawing.Size(928, 231); + this.groupBox2.TabIndex = 1; + this.groupBox2.TabStop = false; + this.groupBox2.Text = "生产模式设置"; + // + // checkBox5 + // + this.checkBox5.AutoSize = true; + this.checkBox5.Font = new System.Drawing.Font("宋体", 25.8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.checkBox5.Location = new System.Drawing.Point(245, 163); + this.checkBox5.Name = "checkBox5"; + this.checkBox5.Size = new System.Drawing.Size(129, 47); + this.checkBox5.TabIndex = 3; + this.checkBox5.Text = "左右"; + this.checkBox5.UseVisualStyleBackColor = true; + this.checkBox5.CheckedChanged += new System.EventHandler(this.CBoxLeftOrRight_CheckedChanged); + // + // checkBox4 + // + this.checkBox4.AutoSize = true; + this.checkBox4.Font = new System.Drawing.Font("宋体", 25.8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.checkBox4.Location = new System.Drawing.Point(245, 98); + this.checkBox4.Name = "checkBox4"; + this.checkBox4.Size = new System.Drawing.Size(85, 47); + this.checkBox4.TabIndex = 2; + this.checkBox4.Text = "右"; + this.checkBox4.UseVisualStyleBackColor = true; + this.checkBox4.CheckedChanged += new System.EventHandler(this.CBoxLeftOrRight_CheckedChanged); + // + // checkBox3 + // + this.checkBox3.AutoSize = true; + this.checkBox3.Font = new System.Drawing.Font("宋体", 25.8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.checkBox3.Location = new System.Drawing.Point(245, 24); + this.checkBox3.Name = "checkBox3"; + this.checkBox3.Size = new System.Drawing.Size(85, 47); + this.checkBox3.TabIndex = 1; + this.checkBox3.Text = "左"; + this.checkBox3.UseVisualStyleBackColor = true; + this.checkBox3.CheckedChanged += new System.EventHandler(this.CBoxLeftOrRight_CheckedChanged); + // + // groupBox1 + // + this.groupBox1.BackColor = System.Drawing.Color.White; + this.groupBox1.Controls.Add(this.cboxL); + this.groupBox1.Controls.Add(this.cboxH); + this.groupBox1.Dock = System.Windows.Forms.DockStyle.Fill; + this.groupBox1.ForeColor = System.Drawing.Color.Blue; + this.groupBox1.Location = new System.Drawing.Point(3, 3); + this.groupBox1.Name = "groupBox1"; + this.groupBox1.Size = new System.Drawing.Size(928, 231); + this.groupBox1.TabIndex = 0; + this.groupBox1.TabStop = false; + this.groupBox1.Text = "配置设置"; + // + // cboxL + // + this.cboxL.AutoSize = true; + this.cboxL.Font = new System.Drawing.Font("宋体", 25.8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.cboxL.Location = new System.Drawing.Point(245, 136); + this.cboxL.Name = "cboxL"; + this.cboxL.Size = new System.Drawing.Size(129, 47); + this.cboxL.TabIndex = 1; + this.cboxL.Text = "低配"; + this.cboxL.UseVisualStyleBackColor = true; + this.cboxL.CheckedChanged += new System.EventHandler(this.CBoxCfg_CheckedChanged); + // + // cboxH + // + this.cboxH.AutoSize = true; + this.cboxH.Font = new System.Drawing.Font("宋体", 25.8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.cboxH.Location = new System.Drawing.Point(245, 45); + this.cboxH.Name = "cboxH"; + this.cboxH.Size = new System.Drawing.Size(129, 47); + this.cboxH.TabIndex = 0; + this.cboxH.Text = "高配"; + this.cboxH.UseVisualStyleBackColor = true; + this.cboxH.CheckedChanged += new System.EventHandler(this.CBoxCfg_CheckedChanged); + // + // panel1 + // + this.panel1.BackColor = System.Drawing.Color.DeepSkyBlue; + this.panel1.Controls.Add(this.btnCancel); + this.panel1.Controls.Add(this.btnOK); + this.panel1.Dock = System.Windows.Forms.DockStyle.Fill; + this.panel1.Location = new System.Drawing.Point(3, 477); + this.panel1.Name = "panel1"; + this.panel1.Size = new System.Drawing.Size(928, 55); + this.panel1.TabIndex = 2; + // + // btnCancel + // + this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom))); + this.btnCancel.Font = new System.Drawing.Font("宋体", 22.2F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.btnCancel.Location = new System.Drawing.Point(537, 0); + this.btnCancel.Name = "btnCancel"; + this.btnCancel.Size = new System.Drawing.Size(154, 55); + this.btnCancel.TabIndex = 1; + this.btnCancel.Text = "取消"; + this.btnCancel.UseVisualStyleBackColor = true; + this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click); + // + // btnOK + // + this.btnOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom))); + this.btnOK.Font = new System.Drawing.Font("宋体", 22.2F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.btnOK.Location = new System.Drawing.Point(147, 3); + this.btnOK.Name = "btnOK"; + this.btnOK.Size = new System.Drawing.Size(154, 55); + this.btnOK.TabIndex = 0; + this.btnOK.Text = "确定"; + this.btnOK.UseVisualStyleBackColor = true; + this.btnOK.Click += new System.EventHandler(this.btnOK_Click); + // + // FrmDoorSill_214_3_Condition + // + this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(934, 535); + this.Controls.Add(this.tableLayoutPanel1); + this.Name = "FrmDoorSill_214_3_Condition"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "214生产参数配置"; + this.tableLayoutPanel1.ResumeLayout(false); + this.groupBox2.ResumeLayout(false); + this.groupBox2.PerformLayout(); + this.groupBox1.ResumeLayout(false); + this.groupBox1.PerformLayout(); + this.panel1.ResumeLayout(false); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; + private System.Windows.Forms.GroupBox groupBox2; + private System.Windows.Forms.GroupBox groupBox1; + private System.Windows.Forms.Panel panel1; + private System.Windows.Forms.CheckBox cboxL; + private System.Windows.Forms.CheckBox cboxH; + private System.Windows.Forms.CheckBox checkBox5; + private System.Windows.Forms.CheckBox checkBox4; + private System.Windows.Forms.CheckBox checkBox3; + private System.Windows.Forms.Button btnCancel; + private System.Windows.Forms.Button btnOK; + } +} \ No newline at end of file diff --git a/SjMes/PunchAssemble/PunchAndWeld/FrmDoorSill_214_3_Condition.cs b/SjMes/PunchAssemble/PunchAndWeld/FrmDoorSill_214_3_Condition.cs new file mode 100644 index 0000000..6427c42 --- /dev/null +++ b/SjMes/PunchAssemble/PunchAndWeld/FrmDoorSill_214_3_Condition.cs @@ -0,0 +1,127 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Windows.Forms; + +namespace PunchAndWeld +{ + public partial class FrmDoorSill_214_3_Condition : Form + { + public event Action AfterOkButtonClick; + + public event Action AfterCancelClick; + public string ConfigCode { get; set; } + public string ProduceModel { get; set; } + public FrmDoorSill_214_3_Condition(string configCode,string produceModel) + { + InitializeComponent(); + if (!string.IsNullOrEmpty(configCode)) + { + SetContend(groupBox1, configCode); + } + + if (!string.IsNullOrEmpty(produceModel)) + { + SetContend(groupBox2, produceModel); + } + } + + private void CBoxCfg_CheckedChanged(object sender, EventArgs e) + { + CheckBox cbox = sender as CheckBox; + SetChecked(groupBox1, cbox); + } + + private void CBoxLeftOrRight_CheckedChanged(object sender, EventArgs e) + { + CheckBox cbox = sender as CheckBox; + SetChecked(groupBox2, cbox); + } + + void SetContend(GroupBox grp, string txt) + { + foreach (Control c in grp.Controls) + { + if (c is CheckBox) + { + if ((c as CheckBox).Text == txt) + { + (c as CheckBox).Checked = true; + return; + } + } + } + } + + string GetChecked(GroupBox grp) + { + foreach (Control c in grp.Controls) + { + if (c is CheckBox) + { + if ((c as CheckBox).Checked == true) + { + (c as CheckBox).Checked = true; + return c.Text?.Trim(); + } + } + } + return null; + } + + void SetChecked(GroupBox grp, CheckBox cbox) + { + foreach (Control c in grp.Controls) + { + if (c is CheckBox) + { + if (cbox.Checked == true) + { + if (cbox.Name != c.Name) + { + (c as CheckBox).Checked = false; + } + } + } + } + } + + private void btnCancel_Click(object sender, EventArgs e) + { + this.Close(); + if(AfterCancelClick != null) + { + AfterCancelClick(); + } + } + + private void btnOK_Click(object sender, EventArgs e) + { + ConfigCode = GetChecked(groupBox1); + ProduceModel = GetChecked(groupBox2); + if(string.IsNullOrEmpty(ConfigCode)) + { + MessageBox.Show("配置设置未填写"); + return; + } + if (string.IsNullOrEmpty(ProduceModel)) + { + MessageBox.Show("生产模式设置未填写"); + return; + } + + //base.DialogResult = DialogResult.OK; + if (AfterOkButtonClick != null) + { + AfterOkButtonClick(ConfigCode, ProduceModel); + } + //FrmDoorSill_214_3 doorSill = new FrmDoorSill_214_3(this, cfg, pmodel); + + //doorSill.Show(); + } + } +} diff --git a/SjMes/PunchAssemble/PunchAndWeld/FrmDoorSill_214_3_Condition.resx b/SjMes/PunchAssemble/PunchAndWeld/FrmDoorSill_214_3_Condition.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/SjMes/PunchAssemble/PunchAndWeld/FrmDoorSill_214_3_Condition.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/SjMes/PunchAssemble/PunchAndWeld/Program.cs b/SjMes/PunchAssemble/PunchAndWeld/Program.cs index 0dd81b6..94e7c90 100644 --- a/SjMes/PunchAssemble/PunchAndWeld/Program.cs +++ b/SjMes/PunchAssemble/PunchAndWeld/Program.cs @@ -71,6 +71,9 @@ namespace PunchAndWeld case "14": Application.Run(new FrmDoorSill_214_2()); break; + case "15": + Application.Run(new FrmDoorSill_214_3()); + break; } mutex.ReleaseMutex(); diff --git a/SjMes/PunchAssemble/PunchAndWeld/PunchAndWeld.csproj b/SjMes/PunchAssemble/PunchAndWeld/PunchAndWeld.csproj index 1ebcd86..f540440 100644 --- a/SjMes/PunchAssemble/PunchAndWeld/PunchAndWeld.csproj +++ b/SjMes/PunchAssemble/PunchAndWeld/PunchAndWeld.csproj @@ -99,6 +99,18 @@ FrmDoorSill_214.cs + + Form + + + FrmDoorSill_214_3.cs + + + Form + + + FrmDoorSill_214_3_Condition.cs + Form @@ -257,6 +269,12 @@ FrmDoorSill_214.cs + + FrmDoorSill_214_3.cs + + + FrmDoorSill_214_3_Condition.cs + FrmHybird.cs