Browse Source

原有214切换上一计划下一计划,数据库和客户端电脑时间格式不正确,导致切换时出错. 214新功能,页面改为一个扫码框

master
wrx 3 months ago
parent
commit
8742730416
  1. 48
      SjMes/PunchAssemble/PunchAndWeld/DataSouce/ProScreenFunc.cs
  2. 3
      SjMes/PunchAssemble/PunchAndWeld/FrmDoorSill_214.cs
  3. 236
      SjMes/PunchAssemble/PunchAndWeld/FrmDoorSill_214_3.Designer.cs
  4. 176
      SjMes/PunchAssemble/PunchAndWeld/FrmDoorSill_214_3.cs
  5. 3
      SjMes/PunchAssemble/PunchAndWeld/FrmDoorSill_214_3.resx
  6. 4
      SjMes/PunchAssemble/PunchAndWeld/Properties/AssemblyInfo.cs

48
SjMes/PunchAssemble/PunchAndWeld/DataSouce/ProScreenFunc.cs

@ -113,7 +113,8 @@ namespace PunchAndWeld.DataSouce
#endregion
#region 查询下一计划
DateTime dtime = DateTime.Now;
DateTime.TryParse(time, out dtime);
sql = @"
select top 1 a.ID, d.[Des], a.OrderNo, a.PartNo,b.ProductName,a.OrderCount,a.CompleteCount,a.BadCount, c.ProductID1, c.ProductID2, b.IsHigh
from tb_Plan_Punch a
@ -125,7 +126,7 @@ namespace PunchAndWeld.DataSouce
on c.StationID = d.StationID
where d.StationNo = '" + stationNo + @"'
and IsFinish <> 3
and a.CreateTime > '" + time + @"'
and a.CreateTime > '" + dtime.ToString("yyyy-MM-dd HH:mm:ss") + @"'
order by CreateTime asc
";
res = SqlHelper.GetDataDateTable(SqlHelper.SqlConnString, CommandType.Text, sql, null);
@ -149,6 +150,8 @@ namespace PunchAndWeld.DataSouce
#endregion
#region 查询上一计划
DateTime dtime = DateTime.Now;
DateTime.TryParse(time, out dtime);
sql = @"
select top 1 a.ID, d.[Des], a.OrderNo, a.PartNo,b.ProductName,a.OrderCount,a.CompleteCount,a.BadCount, c.ProductID1, c.ProductID2, b.IsHigh
@ -161,7 +164,7 @@ namespace PunchAndWeld.DataSouce
on c.StationID = d.StationID
where d.StationNo = '" + stationNo + @"'
and IsFinish <> 3
and a.CreateTime < '" + time + @"'
and a.CreateTime < '" + dtime.ToString("yyyy-MM-dd HH:mm:ss") + @"'
order by CreateTime desc
";
res = SqlHelper.GetDataDateTable(SqlHelper.SqlConnString, CommandType.Text, sql, null);
@ -2455,11 +2458,23 @@ order by CreateTime desc
time = dt.Rows[0][0].ToString();
time = Tools.NumericParse.StringToDateTime(time).Value.AddSeconds(1).ToString("yyyy-MM-dd HH:mm:ss");
}
LogHelper.WriteLog($" 语句1:{sqll}, 连接字符串:{SqlHelper.SqlConnString}");
#endregion
#region 查询下一计划
DateTime dtime = DateTime.Now;
DateTime.TryParse(time, out dtime);
//sql = @"
// SELECT a.*,b.ProductName,b.IsHigh,b.ProductID,s.Des
// FROM tb_Plan_Punch_214 a
// LEFT OUTER JOIN dbo.tb_Product b ON a.PartNo=b.PartNo
// LEFT OUTER JOIN dbo.tb_Station s ON a.StationId=s.StationID
// WHERE s.StationNo = '" + stationNo + @"'
// and a.IsFinish <> 3
// and a.CreateTime > '" + time + @"'
// order by a.CreateTime asc
// ";
sql = @"
SELECT a.*,b.ProductName,b.IsHigh,b.ProductID,s.Des
FROM tb_Plan_Punch_214 a
@ -2467,11 +2482,11 @@ order by CreateTime desc
LEFT OUTER JOIN dbo.tb_Station s ON a.StationId=s.StationID
WHERE s.StationNo = '" + stationNo + @"'
and a.IsFinish <> 3
and a.CreateTime > '" + time + @"'
and a.CreateTime > '" + dtime.ToString("yyyy-MM-dd HH:mm:ss") + @"'
order by a.CreateTime asc
";
res = SqlHelper.GetDataDateTable(SqlHelper.SqlConnString, CommandType.Text, sql, null);
LogHelper.WriteLog($" 语句2:{sql} ");
#endregion
}
else if (plan == "上一计划")
@ -2487,22 +2502,33 @@ order by CreateTime desc
time = dt.Rows[0][0].ToString();
}
LogHelper.WriteLog($" 语句3:{sqll}, 连接字符串:{SqlHelper.SqlConnString}");
#endregion
#region 查询上一计划
try
{
DateTime dtime = DateTime.Now;
DateTime.TryParse(time, out dtime);
sql = @"
sql = @"
SELECT a.*,b.ProductName,b.IsHigh,b.ProductID,s.Des
FROM tb_Plan_Punch_214 a
LEFT OUTER JOIN dbo.tb_Product b ON a.PartNo=b.PartNo
LEFT OUTER JOIN dbo.tb_Station s ON a.StationId=s.StationID
WHERE s.StationNo = '" + stationNo + @"'
and a.IsFinish <> 3
and a.CreateTime < '" + time + @"'
and a.CreateTime < '" + dtime.ToString("yyyy-MM-dd HH:mm:ss") + @"'
order by a.CreateTime desc
";
res = SqlHelper.GetDataDateTable(SqlHelper.SqlConnString, CommandType.Text, sql, null);
res = SqlHelper.GetDataDateTable(SqlHelper.SqlConnString, CommandType.Text, sql, null);
LogHelper.WriteLog($" 语句4:{sql}, 结果:{res.Rows.Count}");
}
catch(Exception ex)
{
LogHelper.WriteLog($" 异常信息:{ex.Message}");
}
#endregion
}

3
SjMes/PunchAssemble/PunchAndWeld/FrmDoorSill_214.cs

@ -365,6 +365,7 @@ namespace PunchAndWeld
public void LoadPlanScreen(string id, string plan)
{
LogHelper.WriteLog($"ID={id},stationNo={stationNo},plan={plan}");
DataTable dt = ProScreenFunc.GetProScreenPlan_1(id, stationNo, plan);
if (dt != null && dt.Rows.Count > 0)
{
@ -379,7 +380,7 @@ namespace PunchAndWeld
else
{
MessageBox.Show("无上一计划");
MessageBox.Show("无上一计划.");
}
}
}

236
SjMes/PunchAssemble/PunchAndWeld/FrmDoorSill_214_3.Designer.cs

@ -29,8 +29,8 @@
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.panel1 = new System.Windows.Forms.Panel();
this.txtLastScanL = new System.Windows.Forms.TextBox();
@ -46,9 +46,6 @@
this.btnSearch = 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();
@ -68,19 +65,18 @@
this.label2 = new System.Windows.Forms.Label();
this.tableLayoutPanel4 = new System.Windows.Forms.TableLayoutPanel();
this.dgridScanRecords = new System.Windows.Forms.DataGridView();
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.txtAllQty = new System.Windows.Forms.Label();
this.panel3 = new System.Windows.Forms.Panel();
this.panel4 = new System.Windows.Forms.Panel();
this.lbTime = new System.Windows.Forms.Label();
this.label11 = new System.Windows.Forms.Label();
this.focusTimer = new System.Windows.Forms.Timer(this.components);
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.dateTimer = 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.tableLayoutPanel1.SuspendLayout();
this.panel1.SuspendLayout();
this.tableLayoutPanel2.SuspendLayout();
@ -110,9 +106,9 @@
this.tableLayoutPanel1.RowCount = 8;
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, 4F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 170F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 120F));
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, 160F));
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, 60F));
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, 100F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 70F));
@ -136,7 +132,7 @@
this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel1.Location = new System.Drawing.Point(3, 107);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(1701, 164);
this.panel1.Size = new System.Drawing.Size(1701, 154);
this.panel1.TabIndex = 0;
//
// txtLastScanL
@ -288,67 +284,22 @@
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, 277);
this.tableLayoutPanel2.Location = new System.Drawing.Point(3, 267);
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(1701, 114);
this.tableLayoutPanel2.Size = new System.Drawing.Size(1701, 94);
this.tableLayoutPanel2.TabIndex = 1;
//
// txtRightScan
//
this.txtRightScan.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.txtRightScan.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(38)))), ((int)(((byte)(46)))), ((int)(((byte)(64)))));
this.txtRightScan.Font = new System.Drawing.Font("宋体", 24F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.txtRightScan.ForeColor = System.Drawing.Color.White;
this.txtRightScan.Location = new System.Drawing.Point(913, 30);
this.txtRightScan.Name = "txtRightScan";
this.txtRightScan.Size = new System.Drawing.Size(785, 53);
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.Transparent;
this.label9.Font = new System.Drawing.Font("宋体", 25.8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label9.ForeColor = System.Drawing.Color.White;
this.label9.Location = new System.Drawing.Point(3, 0);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(54, 114);
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.Transparent;
this.label10.Font = new System.Drawing.Font("宋体", 25.8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label10.ForeColor = System.Drawing.Color.White;
this.label10.Location = new System.Drawing.Point(853, 0);
this.label10.Name = "label10";
this.label10.Size = new System.Drawing.Size(54, 114);
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.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(38)))), ((int)(((byte)(46)))), ((int)(((byte)(64)))));
this.txtLeftScan.Font = new System.Drawing.Font("宋体", 25.8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.txtLeftScan.ForeColor = System.Drawing.Color.White;
this.txtLeftScan.Location = new System.Drawing.Point(63, 28);
this.txtLeftScan.Location = new System.Drawing.Point(63, 18);
this.txtLeftScan.Name = "txtLeftScan";
this.txtLeftScan.Size = new System.Drawing.Size(784, 57);
this.txtLeftScan.TabIndex = 2;
@ -376,7 +327,7 @@
this.tableLayoutPanel3.Controls.Add(this.label4, 4, 0);
this.tableLayoutPanel3.Controls.Add(this.label8, 6, 0);
this.tableLayoutPanel3.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel3.Location = new System.Drawing.Point(3, 477);
this.tableLayoutPanel3.Location = new System.Drawing.Point(3, 427);
this.tableLayoutPanel3.Name = "tableLayoutPanel3";
this.tableLayoutPanel3.RowCount = 1;
this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
@ -539,9 +490,9 @@
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, 397);
this.panel2.Location = new System.Drawing.Point(3, 367);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(1701, 74);
this.panel2.Size = new System.Drawing.Size(1701, 54);
this.panel2.TabIndex = 6;
//
// lbEnd
@ -596,26 +547,26 @@
this.tableLayoutPanel4.Controls.Add(this.dgridScanRecords, 1, 0);
this.tableLayoutPanel4.Controls.Add(this.txtAllQty, 0, 0);
this.tableLayoutPanel4.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel4.Location = new System.Drawing.Point(3, 577);
this.tableLayoutPanel4.Location = new System.Drawing.Point(3, 527);
this.tableLayoutPanel4.Name = "tableLayoutPanel4";
this.tableLayoutPanel4.RowCount = 1;
this.tableLayoutPanel4.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel4.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 452F));
this.tableLayoutPanel4.Size = new System.Drawing.Size(1701, 452);
this.tableLayoutPanel4.Size = new System.Drawing.Size(1701, 502);
this.tableLayoutPanel4.TabIndex = 7;
//
// dgridScanRecords
//
this.dgridScanRecords.AllowUserToAddRows = false;
this.dgridScanRecords.BackgroundColor = System.Drawing.Color.FromArgb(((int)(((byte)(38)))), ((int)(((byte)(46)))), ((int)(((byte)(64)))));
dataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle5.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(38)))), ((int)(((byte)(46)))), ((int)(((byte)(64)))));
dataGridViewCellStyle5.Font = new System.Drawing.Font("宋体", 13.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle5.ForeColor = System.Drawing.Color.White;
dataGridViewCellStyle5.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle5.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle5.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.dgridScanRecords.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle5;
dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(38)))), ((int)(((byte)(46)))), ((int)(((byte)(64)))));
dataGridViewCellStyle1.Font = new System.Drawing.Font("宋体", 13.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle1.ForeColor = System.Drawing.Color.White;
dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.dgridScanRecords.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1;
this.dgridScanRecords.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dgridScanRecords.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.,
@ -628,65 +579,19 @@
this.dgridScanRecords.Location = new System.Drawing.Point(853, 3);
this.dgridScanRecords.Name = "dgridScanRecords";
this.dgridScanRecords.ReadOnly = true;
dataGridViewCellStyle6.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle6.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(38)))), ((int)(((byte)(46)))), ((int)(((byte)(64)))));
dataGridViewCellStyle6.Font = new System.Drawing.Font("宋体", 13.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle6.ForeColor = System.Drawing.Color.White;
dataGridViewCellStyle6.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle6.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle6.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.dgridScanRecords.RowHeadersDefaultCellStyle = dataGridViewCellStyle6;
dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(38)))), ((int)(((byte)(46)))), ((int)(((byte)(64)))));
dataGridViewCellStyle2.Font = new System.Drawing.Font("宋体", 13.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle2.ForeColor = System.Drawing.Color.White;
dataGridViewCellStyle2.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.dgridScanRecords.RowHeadersDefaultCellStyle = dataGridViewCellStyle2;
this.dgridScanRecords.RowHeadersWidth = 51;
this.dgridScanRecords.RowTemplate.Height = 27;
this.dgridScanRecords.Size = new System.Drawing.Size(845, 446);
this.dgridScanRecords.Size = new System.Drawing.Size(845, 496);
this.dgridScanRecords.TabIndex = 4;
//
// 塑件唯一码
//
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;
//
// txtAllQty
//
this.txtAllQty.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
@ -698,7 +603,7 @@
this.txtAllQty.ForeColor = System.Drawing.Color.Yellow;
this.txtAllQty.Location = new System.Drawing.Point(3, 0);
this.txtAllQty.Name = "txtAllQty";
this.txtAllQty.Size = new System.Drawing.Size(844, 452);
this.txtAllQty.Size = new System.Drawing.Size(844, 502);
this.txtAllQty.TabIndex = 5;
this.txtAllQty.Text = "0";
this.txtAllQty.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
@ -750,17 +655,60 @@
this.focusTimer.Interval = 1500;
this.focusTimer.Tick += new System.EventHandler(this.focusTimer_Tick);
//
// timer1
//
this.timer1.Interval = 1000;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
//
// dateTimer
//
this.dateTimer.Enabled = true;
this.dateTimer.Interval = 500;
this.dateTimer.Tick += new System.EventHandler(this.dateTimer_Tick);
//
// 塑件唯一码
//
this..DataPropertyName = "BarCode";
this..HeaderText = "塑件唯一码";
this..MinimumWidth = 6;
this..Name = "塑件唯一码";
this..ReadOnly = true;
this..Width = 300;
//
// 零件号
//
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..Visible = false;
this..Width = 200;
//
// 配置
//
this..DataPropertyName = "Cfg";
this..HeaderText = "配置";
this..MinimumWidth = 6;
this..Name = "配置";
this..ReadOnly = true;
this..Visible = false;
this..Width = 200;
//
// 生产时间
//
this..AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
this..DataPropertyName = "ScanTime";
this..HeaderText = "扫描时间";
this..MinimumWidth = 6;
this..Name = "生产时间";
this..ReadOnly = true;
//
// FrmDoorSill_214_3
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
@ -807,9 +755,6 @@
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 label13;
@ -828,13 +773,7 @@
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;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel4;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label8;
@ -843,5 +782,10 @@
private System.Windows.Forms.Label label11;
private System.Windows.Forms.Label lbTime;
private System.Windows.Forms.Timer dateTimer;
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 ;
}
}

176
SjMes/PunchAssemble/PunchAndWeld/FrmDoorSill_214_3.cs

@ -52,14 +52,7 @@ namespace PunchAndWeld
}
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++)
@ -71,17 +64,8 @@ namespace PunchAndWeld
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)
@ -95,7 +79,7 @@ namespace PunchAndWeld
{
if(e.KeyCode == Keys.Enter)
{
ScanBarCode(txtLeftScan,"左");
ScanBarCode(txtLeftScan);
}
}
@ -103,7 +87,7 @@ namespace PunchAndWeld
{
if (e.KeyCode == Keys.Enter)
{
ScanBarCode(txtRightScan,"右");
// ScanBarCode(txtRightScan,"右");
}
}
@ -113,54 +97,54 @@ namespace PunchAndWeld
{
if (string.IsNullOrEmpty(_produceModel)) return;
if(_produceModel == "左")
{
txtLeftScan.Focus();
txtLeftScan.SelectAll();
}
else if (_produceModel == "右")
{
txtRightScan.Focus();
txtRightScan.SelectAll();
}
//else if (_produceModel == "左右")
//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))
//else if (_produceModel == "右")
//{
// txtRightScan.Focus();
// txtRightScan.SelectAll();
//}
//else
//else if (_produceModel == "左右")
//{
// txtLeftScan.Focus();
// txtLeftScan.SelectAll();
//}
}
//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
@ -315,7 +299,6 @@ namespace PunchAndWeld
txtProduceModel.Text = produceModel;
this.Show();
_conditionDialog.Hide();
timer1.Enabled = true;
};
_conditionDialog.FormClosed += (arg1, arg2) => {
@ -326,11 +309,12 @@ namespace PunchAndWeld
_conditionDialog.ShowDialog();
}
void ScanBarCode(TextBox scanBox, string leftOrRight)
void ScanBarCode(TextBox scanBox)
{
try
{
_lastScan = leftOrRight;
string leftOrRightModel = txtProduceModel.Text?.Trim();
//_lastScan =
if (lbScanState.Text.StartsWith("处理中"))
{
ShowHint($"设备正在处理中,请等待完成后,再重新操作", true);
@ -338,14 +322,13 @@ namespace PunchAndWeld
scanBox.SelectAll();
return;
}
string model = txtProduceModel.Text?.Trim();
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)
if (VerifyConfig(ref produceModel, ref config, ref barCode, ref tableName) == false)
return;
@ -363,9 +346,22 @@ namespace PunchAndWeld
scanBox.SelectAll();
return;
}
string scanLeftOrRight = string.Empty;
if( ProScreenFunc.GetPartNameByStock(barCode.Substring(0, 10)).Contains("左"))
{
scanLeftOrRight = "左";
}
else
{
scanLeftOrRight = "右";
}
if((leftOrRightModel =="左" && scanLeftOrRight == "右")|| (leftOrRightModel == "右" && scanLeftOrRight == "左"))
{
ShowHint($"生产模式为[{leftOrRightModel}],当前扫码为[{scanLeftOrRight}],与设置不匹配", true);
}
if (leftOrRight == "左")
if (scanLeftOrRight == "左")
{
txtLastScanL.Text = barCode;
_leftScanCode = barCode;
@ -375,14 +371,13 @@ namespace PunchAndWeld
txtLastScanR.Text = barCode;
_rightScanCode = barCode;
}
txtLeftScan.Text = "";
txtRightScan.Text = "";
if (model == "左右")
if (leftOrRightModel == "左右")
{
LeftAndRightFocus();
if (string.IsNullOrEmpty(_leftScanCode) || string.IsNullOrEmpty(_rightScanCode)) // txtLeftScan
{
ShowHint($"扫描条码{leftOrRight}条码:{barCode}", false);
ShowHint($"扫描条码{scanLeftOrRight}条码:{barCode}", false);
return;
}
if (_leftScanCode == _rightScanCode)
@ -403,8 +398,8 @@ namespace PunchAndWeld
}
else
{
ProScreenFunc.AddScanRecordNew(barCode, "", leftOrRight, tableName);
ShowHint($"操作{leftOrRight}条码:{_leftScanCode},操作成功", false);
ProScreenFunc.AddScanRecordNew(barCode, "", scanLeftOrRight, tableName);
ShowHint($"操作{scanLeftOrRight}条码:{_leftScanCode},操作成功", false);
}
SendToPLC(config.ToString(), produceModel.ToString(), 1);
@ -469,9 +464,10 @@ namespace PunchAndWeld
}
bool VerifyConfig(string leftOrRight, ref int produceModel,ref int config,ref string barCode,ref string tableName)
bool VerifyConfig( ref int produceModel,ref int config,ref string barCode,ref string tableName)
{
int cfg = 1;
string leftOrRight = txtProduceModel.Text?.Trim();
if (string.IsNullOrEmpty(leftOrRight))
{
ShowHint("生产模式不能为空", true);
@ -498,22 +494,22 @@ namespace PunchAndWeld
return false;
}
string model = txtProduceModel.Text?.Trim();
if (model!="左右" && model.Contains(leftOrRight)==false)
{
ShowHint($"当前输入框为[{leftOrRight}],当前生产模式为[{model}],二者不匹配.", true);
return false;
}
if(model == "左")
//string model = txtProduceModel.Text?.Trim();
//if (model!="左右" && model.Contains(leftOrRight)==false)
//{
// ShowHint($"当前输入框为[{leftOrRight}],当前生产模式为[{model}],二者不匹配.", true);
// return false;
//}
if(leftOrRight == "左")
{
produceModel = 2;
}
else if (model == "右")
else if (leftOrRight == "右")
{
produceModel = 3;
}
else if (model == "左右")
else if (leftOrRight == "左右")
{
produceModel = 1;
}
@ -523,22 +519,23 @@ namespace PunchAndWeld
return false;
}
if (leftOrRight == "左")
{
//if (leftOrRight == "左")
//{
barCode = txtLeftScan.Text?.Trim();
}
else
{
barCode = txtRightScan.Text?.Trim();
}
//}
//else
//{
// barCode = txtRightScan.Text?.Trim();
//}
if (string.IsNullOrEmpty(barCode))
{
ShowHint(leftOrRight + "扫描条码为空", true);
ShowHint("扫描条码为空", true);
return false;
}
if (barCode.Length!=20)
{
ShowHint(leftOrRight + "侧,请扫20位塑件码", true);
ShowHint("请扫20位塑件码", true);
return false;
}
return true;
@ -609,7 +606,6 @@ namespace PunchAndWeld
lbLinkState.Text = "";
lbScanState.Text = "";
txtLeftScan.Text = "";
txtRightScan.Text = "";
txtAllQty.Text = "0";
txtLeftQty.Text = "0";
txtRightQty.Text = "0";

3
SjMes/PunchAssemble/PunchAndWeld/FrmDoorSill_214_3.resx

@ -135,9 +135,6 @@
<metadata name="focusTimer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>155, 17</value>
</metadata>
<metadata name="dateTimer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>260, 17</value>
</metadata>

4
SjMes/PunchAssemble/PunchAndWeld/Properties/AssemblyInfo.cs

@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
// 方法是按如下所示使用“*”:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.19")]
[assembly: AssemblyFileVersion("1.0.0.19")]
[assembly: AssemblyVersion("1.0.0.20")]
[assembly: AssemblyFileVersion("1.0.0.20")]

Loading…
Cancel
Save