3.25 测试
改端子扫码,产线页面,主页
This commit is contained in:
parent
bd70f38e1a
commit
083c4ec3ac
2
.gitignore
vendored
2
.gitignore
vendored
@ -15,7 +15,7 @@
|
||||
|
||||
# Mono auto generated files
|
||||
mono_crash.*
|
||||
|
||||
.DS_Store
|
||||
# Build results
|
||||
[Dd]ebug/
|
||||
[Dd]ebugPublic/
|
||||
|
||||
712
WindowsFormsApp1/MainForm.Designer.cs
generated
712
WindowsFormsApp1/MainForm.Designer.cs
generated
File diff suppressed because it is too large
Load Diff
@ -42,16 +42,16 @@ namespace WindowsFormsApp1
|
||||
FormRecover();
|
||||
|
||||
linename.Text = Init.t_Line.linename;
|
||||
linecode.Text = Init.t_Line.linecode;
|
||||
linetype.Text = Init.t_Line.linetype;
|
||||
linemode.Text = Init.t_Line.linemode;
|
||||
lineremark1.Text = Init.t_Line.lineremark1;
|
||||
lineremark2.Text = Init.t_Line.lineremark2;
|
||||
lineremark3.Text = Init.t_Line.lineremark3;
|
||||
lineremark4.Text = Init.t_Line.lineremark4;
|
||||
lineremark5.Text = Init.t_Line.lineremark5;
|
||||
lineremark6.Text = Init.t_Line.lineremark6;
|
||||
lineremark7.Text = Init.t_Line.lineremark7;
|
||||
linecode.Text = Init.t_Line.lineremark1;
|
||||
linetype.Text = Init.t_Line.lineremark2;
|
||||
linemode.Text = Init.t_Line.lineremark3;
|
||||
//lineremark1.Text = "";
|
||||
//lineremark2.Text = "";
|
||||
//lineremark3.Text = "";
|
||||
//lineremark4.Text = "";
|
||||
//lineremark5.Text = "";
|
||||
//lineremark6.Text = "";
|
||||
//lineremark7.Text = "";
|
||||
|
||||
操作人员ID.Text = Init.t_User.username;
|
||||
}
|
||||
@ -136,7 +136,7 @@ namespace WindowsFormsApp1
|
||||
{
|
||||
DateTime oldPlcstatus_LastTime = Init.Plcstatus_LastTime;
|
||||
//状态+报警
|
||||
if (oldstatus != PlcData.Read_Status || (Plc_Time - oldPlcstatus_LastTime).TotalSeconds > 5)
|
||||
if (oldstatus != PlcData.Read_Status || (Plc_Time - oldPlcstatus_LastTime).TotalSeconds >= 15)
|
||||
{
|
||||
//反馈状态
|
||||
Init.Plcstatus = PlcData.Read_Status;
|
||||
@ -271,6 +271,7 @@ namespace WindowsFormsApp1
|
||||
//扫码
|
||||
ScanForm_DZ scanForm = new ScanForm_DZ();
|
||||
DialogResult scan_result = scanForm.ShowDialog();
|
||||
ChangeBarcode();
|
||||
|
||||
var writeresult = siemensHelp.WriteAddress(plcaddress, PlcData);
|
||||
if (!writeresult.Success)
|
||||
@ -379,6 +380,9 @@ namespace WindowsFormsApp1
|
||||
}
|
||||
else
|
||||
{
|
||||
ChangeBarcode();
|
||||
MES_MsgfORM(nowinterface.code, result.Mesresult, result.Requesttime);
|
||||
|
||||
MES链接状态.Text = "MES链接状态:OK";
|
||||
MES链接状态.BackColor = SystemColors.Control;
|
||||
MES通讯时间.Text = "MES通讯时间:" + DateTime.Now.ToString("MM-dd HH:mm:ss");
|
||||
@ -770,57 +774,21 @@ namespace WindowsFormsApp1
|
||||
底部注释5.Visible = false;
|
||||
|
||||
剩余寿命.Visible = false;
|
||||
barcode1.Visible = false;
|
||||
barcode2.Visible = false;
|
||||
barcode3.Visible = false;
|
||||
barcode4.Visible = false;
|
||||
barcode5.Visible = false;
|
||||
barcode6.Visible = false;
|
||||
barcode7.Visible = false;
|
||||
barcode8.Visible = false;
|
||||
barcode9.Visible = false;
|
||||
|
||||
}
|
||||
|
||||
public void ChangeBarcode()
|
||||
{
|
||||
剩余寿命.Visible = true;
|
||||
barcode1.Visible = true;
|
||||
barcode2.Visible = true;
|
||||
barcode3.Visible = true;
|
||||
barcode4.Visible = true;
|
||||
barcode5.Visible = true;
|
||||
barcode6.Visible = true;
|
||||
barcode7.Visible = true;
|
||||
barcode8.Visible = true;
|
||||
barcode9.Visible = true;
|
||||
|
||||
var power = Init.t_Keyvalues.FirstOrDefault(a => a.key == "Power");
|
||||
var i_barcode1 = Init.t_Keyvalues.FirstOrDefault(a => a.key == "Barcode1");
|
||||
var i_barcode2 = Init.t_Keyvalues.FirstOrDefault(a => a.key == "Barcode2");
|
||||
var i_barcode3 = Init.t_Keyvalues.FirstOrDefault(a => a.key == "Barcode3");
|
||||
var i_barcode4 = Init.t_Keyvalues.FirstOrDefault(a => a.key == "Barcode4");
|
||||
var i_barcode5 = Init.t_Keyvalues.FirstOrDefault(a => a.key == "Barcode5");
|
||||
var i_barcode6 = Init.t_Keyvalues.FirstOrDefault(a => a.key == "Barcode6");
|
||||
var i_barcode7 = Init.t_Keyvalues.FirstOrDefault(a => a.key == "Barcode7");
|
||||
var i_barcode8 = Init.t_Keyvalues.FirstOrDefault(a => a.key == "Barcode8");
|
||||
var i_barcode9 = Init.t_Keyvalues.FirstOrDefault(a => a.key == "Barcode9");
|
||||
|
||||
|
||||
剩余寿命.Text = power == null ? "": power.value;
|
||||
barcode1.Text = i_barcode1 == null ? "":i_barcode1.value;
|
||||
barcode2.Text = i_barcode2 == null ? "":i_barcode2.value;
|
||||
barcode3.Text = i_barcode3 == null ? "":i_barcode3.value;
|
||||
barcode4.Text = i_barcode4 == null ? "":i_barcode4.value;
|
||||
barcode5.Text = i_barcode5 == null ? "":i_barcode5.value;
|
||||
barcode6.Text = i_barcode6 == null ? "":i_barcode6.value;
|
||||
barcode7.Text = i_barcode7 == null ? "":i_barcode7.value;
|
||||
barcode8.Text = i_barcode8 == null ? "":i_barcode8.value;
|
||||
barcode9.Text = i_barcode9 == null ? "":i_barcode9.value;
|
||||
}
|
||||
|
||||
public void PLC_Form(t_plc plc, plcstate state, DateTime time)
|
||||
{
|
||||
string plcname = plc.plcname + ":" + plc.plcip;
|
||||
string plcname = plc.plcip;
|
||||
string datetime = time.ToString("HH:mm:ss");
|
||||
PLC1名称.Visible = true;
|
||||
PLC1状态.Visible = true;
|
||||
@ -963,6 +931,7 @@ namespace WindowsFormsApp1
|
||||
{
|
||||
ScanForm_SSQ scanForm = new ScanForm_SSQ();
|
||||
DialogResult result = scanForm.ShowDialog();
|
||||
// 写plc
|
||||
}
|
||||
public void AirtightPort_DataReceived(object sender, SerialDataReceivedEventArgs e)
|
||||
{
|
||||
|
||||
64
WindowsFormsApp1/form/LINE_Manage.Designer.cs
generated
64
WindowsFormsApp1/form/LINE_Manage.Designer.cs
generated
@ -38,12 +38,15 @@
|
||||
this.新增 = new System.Windows.Forms.Button();
|
||||
this.id = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.linename = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.linecode = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.linetype = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.linemode = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
//this.linecode = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
//this.linetype = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
//this.linemode = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.lineremark1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.lineremark2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.lineremark3 = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.lineremark4 = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.lineremark5 = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.lineremark6 = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.flowname = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.plcname = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
|
||||
@ -97,12 +100,15 @@
|
||||
this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
|
||||
this.id,
|
||||
this.linename,
|
||||
this.linecode,
|
||||
this.linetype,
|
||||
this.linemode,
|
||||
//this.linecode,
|
||||
//this.linetype,
|
||||
//this.linemode,
|
||||
this.lineremark1,
|
||||
this.lineremark2,
|
||||
this.lineremark3,
|
||||
this.lineremark4,
|
||||
this.lineremark5,
|
||||
this.lineremark6,
|
||||
this.flowname,
|
||||
this.plcname});
|
||||
dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
|
||||
@ -174,6 +180,8 @@
|
||||
this.linename.MinimumWidth = 9;
|
||||
this.linename.Name = "linename";
|
||||
this.linename.ReadOnly = true;
|
||||
#region 不显示
|
||||
/*
|
||||
//
|
||||
// linecode
|
||||
//
|
||||
@ -201,12 +209,14 @@
|
||||
this.linemode.MinimumWidth = 9;
|
||||
this.linemode.Name = "linemode";
|
||||
this.linemode.ReadOnly = true;
|
||||
*/
|
||||
#endregion 不显示
|
||||
//
|
||||
// lineremark1
|
||||
//
|
||||
this.lineremark1.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
|
||||
this.lineremark1.DataPropertyName = "lineremark1";
|
||||
this.lineremark1.HeaderText = "备用显示1";
|
||||
this.lineremark1.HeaderText = "Line";
|
||||
this.lineremark1.MinimumWidth = 9;
|
||||
this.lineremark1.Name = "lineremark1";
|
||||
this.lineremark1.ReadOnly = true;
|
||||
@ -217,7 +227,7 @@
|
||||
//
|
||||
this.lineremark2.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
|
||||
this.lineremark2.DataPropertyName = "lineremark2";
|
||||
this.lineremark2.HeaderText = "备用显示2";
|
||||
this.lineremark2.HeaderText = "StationID";
|
||||
this.lineremark2.MinimumWidth = 9;
|
||||
this.lineremark2.Name = "lineremark2";
|
||||
this.lineremark2.ReadOnly = true;
|
||||
@ -228,13 +238,46 @@
|
||||
//
|
||||
this.lineremark3.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
|
||||
this.lineremark3.DataPropertyName = "lineremark3";
|
||||
this.lineremark3.HeaderText = "备用显示3";
|
||||
this.lineremark3.HeaderText = "MachineID";
|
||||
this.lineremark3.MinimumWidth = 9;
|
||||
this.lineremark3.Name = "lineremark3";
|
||||
this.lineremark3.ReadOnly = true;
|
||||
this.lineremark3.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
|
||||
this.lineremark3.ToolTipText = "lineremark3";
|
||||
//
|
||||
// lineremark4
|
||||
//
|
||||
this.lineremark4.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
|
||||
this.lineremark4.DataPropertyName = "lineremark4";
|
||||
this.lineremark4.HeaderText = "Token";
|
||||
this.lineremark4.MinimumWidth = 9;
|
||||
this.lineremark4.Name = "lineremark4";
|
||||
this.lineremark4.ReadOnly = true;
|
||||
this.lineremark4.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
|
||||
this.lineremark4.ToolTipText = "lineremark4";
|
||||
//
|
||||
// lineremark5
|
||||
//
|
||||
this.lineremark5.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
|
||||
this.lineremark5.DataPropertyName = "lineremark5";
|
||||
this.lineremark5.HeaderText = "FixSn";
|
||||
this.lineremark5.MinimumWidth = 9;
|
||||
this.lineremark5.Name = "lineremark5";
|
||||
this.lineremark5.ReadOnly = true;
|
||||
this.lineremark5.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
|
||||
this.lineremark5.ToolTipText = "lineremark5";
|
||||
//
|
||||
// lineremark6
|
||||
//
|
||||
this.lineremark6.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
|
||||
this.lineremark6.DataPropertyName = "lineremark6";
|
||||
this.lineremark6.HeaderText = "Mold";
|
||||
this.lineremark6.MinimumWidth = 9;
|
||||
this.lineremark6.Name = "lineremark6";
|
||||
this.lineremark6.ReadOnly = true;
|
||||
this.lineremark6.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
|
||||
this.lineremark6.ToolTipText = "lineremark6";
|
||||
//
|
||||
// flowname
|
||||
//
|
||||
this.flowname.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
|
||||
@ -292,6 +335,9 @@
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn lineremark1;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn lineremark2;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn lineremark3;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn lineremark4;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn lineremark5;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn lineremark6;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn flowname;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn plcname;
|
||||
}
|
||||
|
||||
@ -93,14 +93,17 @@ namespace WindowsFormsApp1.form
|
||||
id = line.id,
|
||||
flowid = line.flowid,
|
||||
linename = line.linename,
|
||||
linecode = line.linecode,
|
||||
linetype = line.linetype,
|
||||
linemode = line.linemode,
|
||||
//linecode = line.linecode,
|
||||
//linetype = line.linetype,
|
||||
//linemode = line.linemode,
|
||||
flowname = flowname.flowname,
|
||||
plcname = plcname.plcname,
|
||||
lineremark1 = line.lineremark1,
|
||||
lineremark2 = line.lineremark2,
|
||||
lineremark3 = line.lineremark3,
|
||||
lineremark4 = line.lineremark4,
|
||||
lineremark5 = line.lineremark5,
|
||||
lineremark6 = line.lineremark6,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
110
WindowsFormsApp1/form/ScanForm_DZ.Designer.cs
generated
110
WindowsFormsApp1/form/ScanForm_DZ.Designer.cs
generated
@ -64,10 +64,10 @@ namespace WindowsFormsApp1
|
||||
this.groupBox1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.groupBox1.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.groupBox1.Location = new System.Drawing.Point(0, 0);
|
||||
this.groupBox1.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5);
|
||||
this.groupBox1.Margin = new System.Windows.Forms.Padding(7, 6, 7, 6);
|
||||
this.groupBox1.Name = "groupBox1";
|
||||
this.groupBox1.Padding = new System.Windows.Forms.Padding(6, 5, 6, 5);
|
||||
this.groupBox1.Size = new System.Drawing.Size(1647, 704);
|
||||
this.groupBox1.Padding = new System.Windows.Forms.Padding(7, 6, 7, 6);
|
||||
this.groupBox1.Size = new System.Drawing.Size(1797, 805);
|
||||
this.groupBox1.TabIndex = 5;
|
||||
this.groupBox1.TabStop = false;
|
||||
this.groupBox1.Text = "端子扫码";
|
||||
@ -103,7 +103,7 @@ namespace WindowsFormsApp1
|
||||
this.tableLayoutPanel1.Controls.Add(this.端子2校验, 5, 3);
|
||||
this.tableLayoutPanel1.Controls.Add(this.端子3校验, 5, 4);
|
||||
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.tableLayoutPanel1.Location = new System.Drawing.Point(6, 37);
|
||||
this.tableLayoutPanel1.Location = new System.Drawing.Point(7, 43);
|
||||
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
|
||||
this.tableLayoutPanel1.RowCount = 8;
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 5F));
|
||||
@ -114,16 +114,16 @@ namespace WindowsFormsApp1
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 5F));
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 17F));
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 5F));
|
||||
this.tableLayoutPanel1.Size = new System.Drawing.Size(1635, 662);
|
||||
this.tableLayoutPanel1.Size = new System.Drawing.Size(1783, 756);
|
||||
this.tableLayoutPanel1.TabIndex = 0;
|
||||
//
|
||||
// button3
|
||||
//
|
||||
this.button3.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.button3.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.button3.Location = new System.Drawing.Point(1390, 372);
|
||||
this.button3.Location = new System.Drawing.Point(1516, 424);
|
||||
this.button3.Name = "button3";
|
||||
this.button3.Size = new System.Drawing.Size(157, 106);
|
||||
this.button3.Size = new System.Drawing.Size(172, 122);
|
||||
this.button3.TabIndex = 14;
|
||||
this.button3.Text = "清空条码";
|
||||
this.button3.UseVisualStyleBackColor = true;
|
||||
@ -133,9 +133,9 @@ namespace WindowsFormsApp1
|
||||
//
|
||||
this.button2.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.button2.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.button2.Location = new System.Drawing.Point(1390, 260);
|
||||
this.button2.Location = new System.Drawing.Point(1516, 296);
|
||||
this.button2.Name = "button2";
|
||||
this.button2.Size = new System.Drawing.Size(157, 106);
|
||||
this.button2.Size = new System.Drawing.Size(172, 122);
|
||||
this.button2.TabIndex = 13;
|
||||
this.button2.Text = "清空条码";
|
||||
this.button2.UseVisualStyleBackColor = true;
|
||||
@ -145,9 +145,9 @@ namespace WindowsFormsApp1
|
||||
//
|
||||
this.button1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
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(1390, 148);
|
||||
this.button1.Location = new System.Drawing.Point(1516, 168);
|
||||
this.button1.Name = "button1";
|
||||
this.button1.Size = new System.Drawing.Size(157, 106);
|
||||
this.button1.Size = new System.Drawing.Size(172, 122);
|
||||
this.button1.TabIndex = 12;
|
||||
this.button1.Text = "清空条码";
|
||||
this.button1.UseVisualStyleBackColor = true;
|
||||
@ -157,9 +157,9 @@ namespace WindowsFormsApp1
|
||||
//
|
||||
this.确认.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.确认.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.确认.Location = new System.Drawing.Point(84, 517);
|
||||
this.确认.Location = new System.Drawing.Point(92, 589);
|
||||
this.确认.Name = "确认";
|
||||
this.确认.Size = new System.Drawing.Size(321, 106);
|
||||
this.确认.Size = new System.Drawing.Size(350, 122);
|
||||
this.确认.TabIndex = 2;
|
||||
this.确认.Text = "确认";
|
||||
this.确认.UseVisualStyleBackColor = true;
|
||||
@ -170,9 +170,9 @@ namespace WindowsFormsApp1
|
||||
this.tableLayoutPanel1.SetColumnSpan(this.取消, 2);
|
||||
this.取消.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.取消.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.取消.Location = new System.Drawing.Point(1227, 517);
|
||||
this.取消.Location = new System.Drawing.Point(1338, 589);
|
||||
this.取消.Name = "取消";
|
||||
this.取消.Size = new System.Drawing.Size(320, 106);
|
||||
this.取消.Size = new System.Drawing.Size(350, 122);
|
||||
this.取消.TabIndex = 3;
|
||||
this.取消.Text = "取消";
|
||||
this.取消.UseVisualStyleBackColor = true;
|
||||
@ -182,10 +182,10 @@ namespace WindowsFormsApp1
|
||||
//
|
||||
this.端子2结果.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.端子2结果.AutoSize = true;
|
||||
this.端子2结果.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.端子2结果.Location = new System.Drawing.Point(1274, 292);
|
||||
this.端子2结果.Font = new System.Drawing.Font("宋体", 14F, System.Drawing.FontStyle.Bold);
|
||||
this.端子2结果.Location = new System.Drawing.Point(1395, 338);
|
||||
this.端子2结果.Name = "端子2结果";
|
||||
this.端子2结果.Size = new System.Drawing.Size(62, 42);
|
||||
this.端子2结果.Size = new System.Drawing.Size(57, 38);
|
||||
this.端子2结果.TabIndex = 7;
|
||||
this.端子2结果.Text = "NG";
|
||||
//
|
||||
@ -193,12 +193,12 @@ namespace WindowsFormsApp1
|
||||
//
|
||||
this.端子3结果.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.端子3结果.AutoSize = true;
|
||||
this.端子3结果.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.端子3结果.Location = new System.Drawing.Point(1274, 404);
|
||||
this.端子3结果.Font = new System.Drawing.Font("宋体", 14F, System.Drawing.FontStyle.Bold);
|
||||
this.端子3结果.Location = new System.Drawing.Point(1395, 466);
|
||||
this.端子3结果.Name = "端子3结果";
|
||||
this.端子3结果.Size = new System.Drawing.Size(62, 42);
|
||||
this.端子3结果.Size = new System.Drawing.Size(57, 38);
|
||||
this.端子3结果.TabIndex = 8;
|
||||
this.端子3结果.Text = "OK";
|
||||
this.端子3结果.Text = "NG";
|
||||
//
|
||||
// 端子1
|
||||
//
|
||||
@ -206,9 +206,9 @@ namespace WindowsFormsApp1
|
||||
this.端子1.AutoSize = true;
|
||||
this.tableLayoutPanel1.SetColumnSpan(this.端子1, 2);
|
||||
this.端子1.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.端子1.Location = new System.Drawing.Point(645, 180);
|
||||
this.端子1.Location = new System.Drawing.Point(698, 205);
|
||||
this.端子1.Name = "端子1";
|
||||
this.端子1.Size = new System.Drawing.Size(260, 42);
|
||||
this.端子1.Size = new System.Drawing.Size(295, 48);
|
||||
this.端子1.TabIndex = 1;
|
||||
this.端子1.Text = "12112312312";
|
||||
//
|
||||
@ -218,9 +218,9 @@ namespace WindowsFormsApp1
|
||||
this.端子2.AutoSize = true;
|
||||
this.tableLayoutPanel1.SetColumnSpan(this.端子2, 2);
|
||||
this.端子2.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.端子2.Location = new System.Drawing.Point(645, 292);
|
||||
this.端子2.Location = new System.Drawing.Point(698, 333);
|
||||
this.端子2.Name = "端子2";
|
||||
this.端子2.Size = new System.Drawing.Size(260, 42);
|
||||
this.端子2.Size = new System.Drawing.Size(295, 48);
|
||||
this.端子2.TabIndex = 6;
|
||||
this.端子2.Text = "12112312312";
|
||||
//
|
||||
@ -230,9 +230,9 @@ namespace WindowsFormsApp1
|
||||
this.端子3.AutoSize = true;
|
||||
this.tableLayoutPanel1.SetColumnSpan(this.端子3, 2);
|
||||
this.端子3.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.端子3.Location = new System.Drawing.Point(645, 404);
|
||||
this.端子3.Location = new System.Drawing.Point(698, 461);
|
||||
this.端子3.Name = "端子3";
|
||||
this.端子3.Size = new System.Drawing.Size(260, 42);
|
||||
this.端子3.Size = new System.Drawing.Size(295, 48);
|
||||
this.端子3.TabIndex = 5;
|
||||
this.端子3.Text = "12112312312";
|
||||
//
|
||||
@ -240,12 +240,12 @@ namespace WindowsFormsApp1
|
||||
//
|
||||
this.端子1结果.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.端子1结果.AutoSize = true;
|
||||
this.端子1结果.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.端子1结果.Location = new System.Drawing.Point(1274, 180);
|
||||
this.端子1结果.Font = new System.Drawing.Font("宋体", 14F, System.Drawing.FontStyle.Bold);
|
||||
this.端子1结果.Location = new System.Drawing.Point(1395, 210);
|
||||
this.端子1结果.Name = "端子1结果";
|
||||
this.端子1结果.Size = new System.Drawing.Size(62, 42);
|
||||
this.端子1结果.Size = new System.Drawing.Size(57, 38);
|
||||
this.端子1结果.TabIndex = 4;
|
||||
this.端子1结果.Text = "OK";
|
||||
this.端子1结果.Text = "NG";
|
||||
//
|
||||
// 请扫描条码
|
||||
//
|
||||
@ -254,9 +254,9 @@ namespace WindowsFormsApp1
|
||||
this.tableLayoutPanel1.SetColumnSpan(this.请扫描条码, 3);
|
||||
this.请扫描条码.Font = new System.Drawing.Font("宋体", 24F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.请扫描条码.ForeColor = System.Drawing.Color.Red;
|
||||
this.请扫描条码.Location = new System.Drawing.Point(508, 61);
|
||||
this.请扫描条码.Location = new System.Drawing.Point(543, 69);
|
||||
this.请扫描条码.Name = "请扫描条码";
|
||||
this.请扫描条码.Size = new System.Drawing.Size(452, 56);
|
||||
this.请扫描条码.Size = new System.Drawing.Size(515, 64);
|
||||
this.请扫描条码.TabIndex = 0;
|
||||
this.请扫描条码.Text = "请扫描端子条码:";
|
||||
//
|
||||
@ -265,9 +265,9 @@ namespace WindowsFormsApp1
|
||||
this.label6.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.label6.AutoSize = true;
|
||||
this.label6.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.label6.Location = new System.Drawing.Point(160, 180);
|
||||
this.label6.Location = new System.Drawing.Point(171, 205);
|
||||
this.label6.Name = "label6";
|
||||
this.label6.Size = new System.Drawing.Size(169, 42);
|
||||
this.label6.Size = new System.Drawing.Size(192, 48);
|
||||
this.label6.TabIndex = 9;
|
||||
this.label6.Text = "端子1:";
|
||||
//
|
||||
@ -276,9 +276,9 @@ namespace WindowsFormsApp1
|
||||
this.label7.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.label7.AutoSize = true;
|
||||
this.label7.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.label7.Location = new System.Drawing.Point(160, 292);
|
||||
this.label7.Location = new System.Drawing.Point(171, 333);
|
||||
this.label7.Name = "label7";
|
||||
this.label7.Size = new System.Drawing.Size(169, 42);
|
||||
this.label7.Size = new System.Drawing.Size(192, 48);
|
||||
this.label7.TabIndex = 10;
|
||||
this.label7.Text = "端子2:";
|
||||
//
|
||||
@ -287,9 +287,9 @@ namespace WindowsFormsApp1
|
||||
this.label8.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.label8.AutoSize = true;
|
||||
this.label8.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.label8.Location = new System.Drawing.Point(160, 404);
|
||||
this.label8.Location = new System.Drawing.Point(171, 461);
|
||||
this.label8.Name = "label8";
|
||||
this.label8.Size = new System.Drawing.Size(169, 42);
|
||||
this.label8.Size = new System.Drawing.Size(192, 48);
|
||||
this.label8.TabIndex = 11;
|
||||
this.label8.Text = "端子3:";
|
||||
//
|
||||
@ -297,21 +297,21 @@ namespace WindowsFormsApp1
|
||||
//
|
||||
this.端子1校验.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.端子1校验.AutoSize = true;
|
||||
this.端子1校验.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.端子1校验.Location = new System.Drawing.Point(1111, 180);
|
||||
this.端子1校验.Font = new System.Drawing.Font("宋体", 14F, System.Drawing.FontStyle.Bold);
|
||||
this.端子1校验.Location = new System.Drawing.Point(1217, 210);
|
||||
this.端子1校验.Name = "端子1校验";
|
||||
this.端子1校验.Size = new System.Drawing.Size(62, 42);
|
||||
this.端子1校验.Size = new System.Drawing.Size(57, 38);
|
||||
this.端子1校验.TabIndex = 15;
|
||||
this.端子1校验.Text = "OK";
|
||||
this.端子1校验.Text = "NG";
|
||||
//
|
||||
// 端子2校验
|
||||
//
|
||||
this.端子2校验.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.端子2校验.AutoSize = true;
|
||||
this.端子2校验.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.端子2校验.Location = new System.Drawing.Point(1111, 292);
|
||||
this.端子2校验.Font = new System.Drawing.Font("宋体", 14F, System.Drawing.FontStyle.Bold);
|
||||
this.端子2校验.Location = new System.Drawing.Point(1217, 338);
|
||||
this.端子2校验.Name = "端子2校验";
|
||||
this.端子2校验.Size = new System.Drawing.Size(62, 42);
|
||||
this.端子2校验.Size = new System.Drawing.Size(57, 38);
|
||||
this.端子2校验.TabIndex = 16;
|
||||
this.端子2校验.Text = "NG";
|
||||
//
|
||||
@ -319,12 +319,12 @@ namespace WindowsFormsApp1
|
||||
//
|
||||
this.端子3校验.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.端子3校验.AutoSize = true;
|
||||
this.端子3校验.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.端子3校验.Location = new System.Drawing.Point(1111, 404);
|
||||
this.端子3校验.Font = new System.Drawing.Font("宋体", 14F, System.Drawing.FontStyle.Bold);
|
||||
this.端子3校验.Location = new System.Drawing.Point(1217, 466);
|
||||
this.端子3校验.Name = "端子3校验";
|
||||
this.端子3校验.Size = new System.Drawing.Size(62, 42);
|
||||
this.端子3校验.Size = new System.Drawing.Size(57, 38);
|
||||
this.端子3校验.TabIndex = 17;
|
||||
this.端子3校验.Text = "OK";
|
||||
this.端子3校验.Text = "NG";
|
||||
//
|
||||
// timer1
|
||||
//
|
||||
@ -334,16 +334,16 @@ namespace WindowsFormsApp1
|
||||
//
|
||||
// ScanForm_DZ
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(11F, 21F);
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(12F, 24F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(1647, 704);
|
||||
this.ClientSize = new System.Drawing.Size(1797, 805);
|
||||
this.Controls.Add(this.groupBox1);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
|
||||
this.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.Name = "ScanForm_DZ";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "扫码界面";
|
||||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.ScanForm_FormClosing);
|
||||
this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.ScanForm_DZ_FormClosed);
|
||||
this.groupBox1.ResumeLayout(false);
|
||||
this.tableLayoutPanel1.ResumeLayout(false);
|
||||
this.tableLayoutPanel1.PerformLayout();
|
||||
|
||||
@ -24,7 +24,7 @@ namespace WindowsFormsApp1
|
||||
public ScanForm_DZ()
|
||||
{
|
||||
InitializeComponent();
|
||||
Init.ScanPort.DataReceived += SerialPort_DataReceived;
|
||||
Init.ScanPort.DataReceived += SerialPort_DataReceived_DZ;
|
||||
端子1.Text = "";
|
||||
端子2.Text = "";
|
||||
端子3.Text = "";
|
||||
@ -33,6 +33,18 @@ namespace WindowsFormsApp1
|
||||
private void button1_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.DialogResult = DialogResult.OK;
|
||||
//Init.ScanPort.DataReceived -= SerialPort_DataReceived_DZ;
|
||||
//if (string.IsNullOrEmpty(端子1.Text)
|
||||
// || string.IsNullOrEmpty(端子2.Text)
|
||||
// || string.IsNullOrEmpty(端子3.Text))
|
||||
//{
|
||||
// //MessageBox.Show($"有端子未扫描!");
|
||||
// //return;
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// this.Close();
|
||||
//}
|
||||
this.Close();
|
||||
}
|
||||
|
||||
@ -54,10 +66,11 @@ namespace WindowsFormsApp1
|
||||
}
|
||||
}
|
||||
|
||||
public void SerialPort_DataReceived(object sender, SerialDataReceivedEventArgs e)
|
||||
public void SerialPort_DataReceived_DZ(object sender, SerialDataReceivedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
var PlcData = new plcdata();
|
||||
if (!Init.ScanPort.IsOpen)
|
||||
{
|
||||
Init.ScanPort?.Open();
|
||||
@ -75,14 +88,15 @@ namespace WindowsFormsApp1
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
SQLiteHelper<t_keyvalue> sQLiteHelper_key = new db.SQLiteHelper<t_keyvalue>();
|
||||
var key_sqlresult = sQLiteHelper_key.QueryAll();
|
||||
if (string.IsNullOrWhiteSpace(端子1.Text))
|
||||
{
|
||||
this.Invoke(new Action(() =>
|
||||
{
|
||||
端子1.Text = barcode;
|
||||
}));
|
||||
var result = ApiClient.CallFunctionByName("nowinterface.code", null, new otherdata() { JS_SN = barcode });
|
||||
var result = ApiClient.CallFunctionByName("SN_FeedingCheck", PlcData, new otherdata() { JS_SN = barcode });
|
||||
if (result.Success)
|
||||
{
|
||||
this.Invoke(new Action(() =>
|
||||
@ -90,7 +104,7 @@ namespace WindowsFormsApp1
|
||||
端子1校验.Text = "校验OK";
|
||||
}));
|
||||
//继续调用接口
|
||||
var result2 = ApiClient.CallFunctionByName("nowinterface.code", null, new otherdata() { JS_SN = barcode });
|
||||
var result2 = ApiClient.CallFunctionByName("Link_Comp", PlcData, new otherdata() { JS_SN = barcode });
|
||||
if (result2.Success)
|
||||
{
|
||||
this.Invoke(new Action(() =>
|
||||
@ -98,6 +112,13 @@ namespace WindowsFormsApp1
|
||||
端子1结果.Text = "绑定OK";
|
||||
button1.Visible = false;
|
||||
}));
|
||||
// 写数据到 主页的barcode 数据库改,缓存改
|
||||
var txt = Init.t_Keyvalues.FirstOrDefault(a => a.key == "Barcode1");
|
||||
txt.value = 端子1.Text;
|
||||
|
||||
var code = key_sqlresult.Data.First(x => x.key == txt.key);
|
||||
code.value = 端子1.Text;
|
||||
sQLiteHelper_key.Update(code);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -121,7 +142,7 @@ namespace WindowsFormsApp1
|
||||
{
|
||||
端子2.Text = barcode;
|
||||
}));
|
||||
var result = ApiClient.CallFunctionByName("nowinterface.code", null, new otherdata() { JS_SN = barcode });
|
||||
var result = ApiClient.CallFunctionByName("SN_FeedingCheck", PlcData, new otherdata() { JS_SN = barcode });
|
||||
if (result.Success)
|
||||
{
|
||||
this.Invoke(new Action(() =>
|
||||
@ -130,10 +151,30 @@ namespace WindowsFormsApp1
|
||||
}));
|
||||
//继续调用接口
|
||||
|
||||
this.Invoke(new Action(() =>
|
||||
var result2 = ApiClient.CallFunctionByName("Link_Comp", PlcData, new otherdata() { JS_SN = barcode });
|
||||
if (result2.Success)
|
||||
{
|
||||
button2.Visible = false;
|
||||
}));
|
||||
this.Invoke(new Action(() =>
|
||||
{
|
||||
端子2结果.Text = "绑定OK";
|
||||
button2.Visible = false;
|
||||
}));
|
||||
|
||||
// 写数据到 主页的barcode 数据库改,缓存改
|
||||
var txt = Init.t_Keyvalues.FirstOrDefault(a => a.key == "Barcode2");
|
||||
txt.value = 端子2.Text;
|
||||
|
||||
var code = key_sqlresult.Data.First(x => x.key == txt.key);
|
||||
code.value = 端子2.Text;
|
||||
sQLiteHelper_key.Update(code);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.Invoke(new Action(() =>
|
||||
{
|
||||
端子2结果.Text = "绑定NG";
|
||||
}));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -149,7 +190,7 @@ namespace WindowsFormsApp1
|
||||
{
|
||||
端子3.Text = barcode;
|
||||
}));
|
||||
var result = ApiClient.CallFunctionByName("nowinterface.code", null, new otherdata() { JS_SN = barcode });
|
||||
var result = ApiClient.CallFunctionByName("SN_FeedingCheck", PlcData, new otherdata() { JS_SN = barcode });
|
||||
if (result.Success)
|
||||
{
|
||||
this.Invoke(new Action(() =>
|
||||
@ -157,11 +198,30 @@ namespace WindowsFormsApp1
|
||||
端子3校验.Text = "校验OK";
|
||||
}));
|
||||
|
||||
//继续调用接口
|
||||
this.Invoke(new Action(() =>
|
||||
var result2 = ApiClient.CallFunctionByName("Link_Comp", PlcData, new otherdata() { JS_SN = barcode });
|
||||
if (result2.Success)
|
||||
{
|
||||
button3.Visible = false;
|
||||
}));
|
||||
this.Invoke(new Action(() =>
|
||||
{
|
||||
端子3结果.Text = "绑定OK";
|
||||
button3.Visible = false;
|
||||
}));
|
||||
|
||||
// 写数据到 主页的barcode 数据库改,缓存改
|
||||
var txt = Init.t_Keyvalues.FirstOrDefault(a => a.key == "Barcode3");
|
||||
txt.value = 端子3.Text;
|
||||
|
||||
var code = key_sqlresult.Data.First(x => x.key == txt.key);
|
||||
code.value = 端子3.Text;
|
||||
sQLiteHelper_key.Update(code);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.Invoke(new Action(() =>
|
||||
{
|
||||
端子3结果.Text = "绑定NG";
|
||||
}));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -169,7 +229,7 @@ namespace WindowsFormsApp1
|
||||
{
|
||||
端子3校验.Text = "校验NG";
|
||||
}));
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -209,5 +269,10 @@ namespace WindowsFormsApp1
|
||||
{
|
||||
端子3.Text = "";
|
||||
}
|
||||
|
||||
private void ScanForm_DZ_FormClosed(object sender, FormClosedEventArgs e)
|
||||
{
|
||||
FormHelp.RemoveAllEventHandlers(Init.ScanPort, "DataReceived");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
41
WindowsFormsApp1/form/ScanForm_SSQ.Designer.cs
generated
41
WindowsFormsApp1/form/ScanForm_SSQ.Designer.cs
generated
@ -48,10 +48,10 @@
|
||||
this.groupBox1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.groupBox1.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.groupBox1.Location = new System.Drawing.Point(0, 0);
|
||||
this.groupBox1.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5);
|
||||
this.groupBox1.Margin = new System.Windows.Forms.Padding(7, 6, 7, 6);
|
||||
this.groupBox1.Name = "groupBox1";
|
||||
this.groupBox1.Padding = new System.Windows.Forms.Padding(6, 5, 6, 5);
|
||||
this.groupBox1.Size = new System.Drawing.Size(1647, 704);
|
||||
this.groupBox1.Padding = new System.Windows.Forms.Padding(7, 6, 7, 6);
|
||||
this.groupBox1.Size = new System.Drawing.Size(1797, 805);
|
||||
this.groupBox1.TabIndex = 5;
|
||||
this.groupBox1.TabStop = false;
|
||||
this.groupBox1.Text = "物料扫码";
|
||||
@ -71,7 +71,7 @@
|
||||
this.tableLayoutPanel1.Controls.Add(this.确认, 1, 6);
|
||||
this.tableLayoutPanel1.Controls.Add(this.取消, 3, 6);
|
||||
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.tableLayoutPanel1.Location = new System.Drawing.Point(6, 37);
|
||||
this.tableLayoutPanel1.Location = new System.Drawing.Point(7, 43);
|
||||
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
|
||||
this.tableLayoutPanel1.RowCount = 8;
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 4.588645F));
|
||||
@ -82,16 +82,16 @@
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 9.50806F));
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 13.76593F));
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 17.19009F));
|
||||
this.tableLayoutPanel1.Size = new System.Drawing.Size(1635, 662);
|
||||
this.tableLayoutPanel1.Size = new System.Drawing.Size(1783, 756);
|
||||
this.tableLayoutPanel1.TabIndex = 0;
|
||||
//
|
||||
// button1
|
||||
//
|
||||
this.button1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.button1.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.button1.Location = new System.Drawing.Point(184, 304);
|
||||
this.button1.Location = new System.Drawing.Point(201, 347);
|
||||
this.button1.Name = "button1";
|
||||
this.button1.Size = new System.Drawing.Size(539, 85);
|
||||
this.button1.Size = new System.Drawing.Size(588, 98);
|
||||
this.button1.TabIndex = 4;
|
||||
this.button1.Text = "位置1";
|
||||
this.button1.UseVisualStyleBackColor = true;
|
||||
@ -101,9 +101,9 @@
|
||||
//
|
||||
this.button2.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.button2.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.button2.Location = new System.Drawing.Point(910, 304);
|
||||
this.button2.Location = new System.Drawing.Point(993, 347);
|
||||
this.button2.Name = "button2";
|
||||
this.button2.Size = new System.Drawing.Size(539, 85);
|
||||
this.button2.Size = new System.Drawing.Size(588, 98);
|
||||
this.button2.TabIndex = 5;
|
||||
this.button2.Text = "位置2";
|
||||
this.button2.UseVisualStyleBackColor = true;
|
||||
@ -116,9 +116,9 @@
|
||||
this.tableLayoutPanel1.SetColumnSpan(this.请扫描条码, 3);
|
||||
this.请扫描条码.Font = new System.Drawing.Font("宋体", 24F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.请扫描条码.ForeColor = System.Drawing.Color.Red;
|
||||
this.请扫描条码.Location = new System.Drawing.Point(647, 47);
|
||||
this.请扫描条码.Location = new System.Drawing.Point(698, 54);
|
||||
this.请扫描条码.Name = "请扫描条码";
|
||||
this.请扫描条码.Size = new System.Drawing.Size(338, 56);
|
||||
this.请扫描条码.Size = new System.Drawing.Size(385, 64);
|
||||
this.请扫描条码.TabIndex = 0;
|
||||
this.请扫描条码.Text = "请扫描条码:";
|
||||
//
|
||||
@ -128,9 +128,9 @@
|
||||
this.LOt号.AutoSize = true;
|
||||
this.tableLayoutPanel1.SetColumnSpan(this.LOt号, 3);
|
||||
this.LOt号.Font = new System.Drawing.Font("宋体", 24F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.LOt号.Location = new System.Drawing.Point(544, 153);
|
||||
this.LOt号.Location = new System.Drawing.Point(581, 175);
|
||||
this.LOt号.Name = "LOt号";
|
||||
this.LOt号.Size = new System.Drawing.Size(544, 56);
|
||||
this.LOt号.Size = new System.Drawing.Size(619, 64);
|
||||
this.LOt号.TabIndex = 1;
|
||||
this.LOt号.Text = "LOt号:12112312312";
|
||||
//
|
||||
@ -138,9 +138,9 @@
|
||||
//
|
||||
this.确认.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.确认.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.确认.Location = new System.Drawing.Point(184, 457);
|
||||
this.确认.Location = new System.Drawing.Point(201, 522);
|
||||
this.确认.Name = "确认";
|
||||
this.确认.Size = new System.Drawing.Size(539, 85);
|
||||
this.确认.Size = new System.Drawing.Size(588, 98);
|
||||
this.确认.TabIndex = 2;
|
||||
this.确认.Text = "上线";
|
||||
this.确认.UseVisualStyleBackColor = true;
|
||||
@ -150,9 +150,9 @@
|
||||
//
|
||||
this.取消.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.取消.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.取消.Location = new System.Drawing.Point(910, 457);
|
||||
this.取消.Location = new System.Drawing.Point(993, 522);
|
||||
this.取消.Name = "取消";
|
||||
this.取消.Size = new System.Drawing.Size(539, 85);
|
||||
this.取消.Size = new System.Drawing.Size(588, 98);
|
||||
this.取消.TabIndex = 3;
|
||||
this.取消.Text = "下线";
|
||||
this.取消.UseVisualStyleBackColor = true;
|
||||
@ -166,15 +166,16 @@
|
||||
//
|
||||
// ScanForm_SSQ
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(11F, 21F);
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(12F, 24F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(1647, 704);
|
||||
this.ClientSize = new System.Drawing.Size(1797, 805);
|
||||
this.Controls.Add(this.groupBox1);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
|
||||
this.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.Name = "ScanForm_SSQ";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "扫码界面";
|
||||
this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.ScanForm_SSQ_FormClosed);
|
||||
this.groupBox1.ResumeLayout(false);
|
||||
this.tableLayoutPanel1.ResumeLayout(false);
|
||||
this.tableLayoutPanel1.PerformLayout();
|
||||
|
||||
@ -12,6 +12,7 @@ using System.Windows.Forms;
|
||||
using WindowsFormsApp1.db;
|
||||
using WindowsFormsApp1.mod;
|
||||
using WindowsFormsApp1.mod.database;
|
||||
using WindowsFormsApp1.mod.server;
|
||||
using WindowsFormsApp1.server;
|
||||
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
|
||||
|
||||
@ -25,12 +26,12 @@ namespace WindowsFormsApp1
|
||||
/// </summary>
|
||||
int index = 0;
|
||||
public string ReturnValue { get; set; }
|
||||
public ApiClient ApiClient = new ApiClient();
|
||||
public ScanForm_SSQ()
|
||||
{
|
||||
InitializeComponent();
|
||||
//Init.ScanPort.DataReceived += SerialPort_DataReceived;
|
||||
Init.ScanPort.DataReceived += SerialPort_DataReceived_SSQ;
|
||||
LOt号.Visible = false;
|
||||
|
||||
}
|
||||
private void button1_Click(object sender, EventArgs e)
|
||||
{
|
||||
@ -39,9 +40,25 @@ namespace WindowsFormsApp1
|
||||
MessageBox.Show("扫码为空,请确认!");
|
||||
return;
|
||||
}
|
||||
|
||||
LogExecute.logNet.WriteDebug($"{ReturnValue}上线点击");
|
||||
//this.Close();
|
||||
//请求后端接口,index代表位置
|
||||
//更新下数据库和init里面的keyvalue值
|
||||
var PlcData = new plcdata();
|
||||
var OtherData = new otherdata();
|
||||
OtherData.locationindex = index;
|
||||
OtherData.opindex = 1;
|
||||
OtherData.JS_SN = ReturnValue;
|
||||
|
||||
var result = ApiClient.CallFunctionByName("Glue_CheckOut", PlcData, OtherData);
|
||||
if (result.Success && result.Mesresult == mesresult.PASS)
|
||||
{
|
||||
this.Close();
|
||||
}
|
||||
else
|
||||
{
|
||||
//失败逻辑
|
||||
}
|
||||
//更新下数据库和init里面的keyvalue值,缓存
|
||||
}
|
||||
|
||||
private void button2_Click(object sender, EventArgs e)
|
||||
@ -51,8 +68,25 @@ namespace WindowsFormsApp1
|
||||
MessageBox.Show("扫码为空,请确认!");
|
||||
return;
|
||||
}
|
||||
LogExecute.logNet.WriteDebug($"{ReturnValue}下线点击");
|
||||
this.Close();
|
||||
//请求后端接口,index代表位置
|
||||
//更新下数据库和init里面的keyvalue值
|
||||
var PlcData = new plcdata();
|
||||
var OtherData = new otherdata();
|
||||
OtherData.locationindex = index;
|
||||
OtherData.opindex = 1;
|
||||
OtherData.JS_SN = ReturnValue;
|
||||
|
||||
var result = ApiClient.CallFunctionByName("Glue_CheckOut", PlcData, OtherData);
|
||||
if (result.Success)
|
||||
{
|
||||
this.Close();
|
||||
}
|
||||
else
|
||||
{
|
||||
//失败逻辑
|
||||
}
|
||||
//更新下数据库和init里面的keyvalue值,删除缓存
|
||||
}
|
||||
|
||||
private void timer1_Tick(object sender, EventArgs e)
|
||||
@ -67,7 +101,7 @@ namespace WindowsFormsApp1
|
||||
}
|
||||
}
|
||||
|
||||
public void SerialPort_DataReceived(object sender, SerialDataReceivedEventArgs e)
|
||||
public void SerialPort_DataReceived_SSQ(object sender, SerialDataReceivedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -135,5 +169,10 @@ namespace WindowsFormsApp1
|
||||
button1.BackColor = SystemColors.Control;
|
||||
}
|
||||
}
|
||||
|
||||
private void ScanForm_SSQ_FormClosed(object sender, FormClosedEventArgs e)
|
||||
{
|
||||
FormHelp.RemoveAllEventHandlers(Init.ScanPort, "DataReceived");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -30,11 +30,11 @@ namespace WindowsFormsApp1.form
|
||||
MessageBox.Show("关键字不能为空");
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrWhiteSpace(值.Text))
|
||||
{
|
||||
MessageBox.Show("值不能为空");
|
||||
return;
|
||||
}
|
||||
//if (string.IsNullOrWhiteSpace(值.Text))
|
||||
//{
|
||||
// MessageBox.Show("值不能为空");
|
||||
// return;
|
||||
//}
|
||||
if (string.IsNullOrWhiteSpace(备注.Text))
|
||||
{
|
||||
MessageBox.Show("备注不能为空");
|
||||
|
||||
146
WindowsFormsApp1/form/editForm/Line_Insert.Designer.cs
generated
146
WindowsFormsApp1/form/editForm/Line_Insert.Designer.cs
generated
@ -41,9 +41,9 @@
|
||||
this.label7 = new System.Windows.Forms.Label();
|
||||
this.产线编号 = new System.Windows.Forms.TextBox();
|
||||
this.关联流程 = new System.Windows.Forms.ComboBox();
|
||||
this.备用显示1 = new System.Windows.Forms.TextBox();
|
||||
this.备用显示2 = new System.Windows.Forms.TextBox();
|
||||
this.备用显示3 = new System.Windows.Forms.TextBox();
|
||||
this.Line = new System.Windows.Forms.TextBox();
|
||||
this.StationID = new System.Windows.Forms.TextBox();
|
||||
this.MachineID = new System.Windows.Forms.TextBox();
|
||||
this.label5 = new System.Windows.Forms.Label();
|
||||
this.label6 = new System.Windows.Forms.Label();
|
||||
this.label8 = new System.Windows.Forms.Label();
|
||||
@ -73,9 +73,9 @@
|
||||
this.tableLayoutPanel1.Controls.Add(this.label7, 1, 2);
|
||||
this.tableLayoutPanel1.Controls.Add(this.产线编号, 2, 2);
|
||||
this.tableLayoutPanel1.Controls.Add(this.关联流程, 2, 5);
|
||||
this.tableLayoutPanel1.Controls.Add(this.备用显示1, 4, 1);
|
||||
this.tableLayoutPanel1.Controls.Add(this.备用显示2, 4, 2);
|
||||
this.tableLayoutPanel1.Controls.Add(this.备用显示3, 4, 3);
|
||||
this.tableLayoutPanel1.Controls.Add(this.Line, 4, 1);
|
||||
this.tableLayoutPanel1.Controls.Add(this.StationID, 4, 2);
|
||||
this.tableLayoutPanel1.Controls.Add(this.MachineID, 4, 3);
|
||||
this.tableLayoutPanel1.Controls.Add(this.label5, 3, 1);
|
||||
this.tableLayoutPanel1.Controls.Add(this.label6, 3, 2);
|
||||
this.tableLayoutPanel1.Controls.Add(this.label8, 3, 3);
|
||||
@ -96,7 +96,7 @@
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F));
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F));
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F));
|
||||
this.tableLayoutPanel1.Size = new System.Drawing.Size(1087, 854);
|
||||
this.tableLayoutPanel1.Size = new System.Drawing.Size(1186, 976);
|
||||
this.tableLayoutPanel1.TabIndex = 0;
|
||||
//
|
||||
// label1
|
||||
@ -104,9 +104,9 @@
|
||||
this.label1.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.label1.Location = new System.Drawing.Point(182, 113);
|
||||
this.label1.Location = new System.Drawing.Point(197, 129);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(68, 28);
|
||||
this.label1.Size = new System.Drawing.Size(79, 33);
|
||||
this.label1.TabIndex = 0;
|
||||
this.label1.Text = "名称";
|
||||
//
|
||||
@ -115,9 +115,9 @@
|
||||
this.button1.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.tableLayoutPanel1.SetColumnSpan(this.button1, 2);
|
||||
this.button1.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.button1.Location = new System.Drawing.Point(228, 683);
|
||||
this.button1.Location = new System.Drawing.Point(249, 779);
|
||||
this.button1.Name = "button1";
|
||||
this.button1.Size = new System.Drawing.Size(194, 79);
|
||||
this.button1.Size = new System.Drawing.Size(212, 90);
|
||||
this.button1.TabIndex = 14;
|
||||
this.button1.Text = "保存";
|
||||
this.button1.UseVisualStyleBackColor = true;
|
||||
@ -128,9 +128,9 @@
|
||||
this.button2.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.tableLayoutPanel1.SetColumnSpan(this.button2, 2);
|
||||
this.button2.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.button2.Location = new System.Drawing.Point(664, 683);
|
||||
this.button2.Location = new System.Drawing.Point(725, 779);
|
||||
this.button2.Name = "button2";
|
||||
this.button2.Size = new System.Drawing.Size(190, 79);
|
||||
this.button2.Size = new System.Drawing.Size(207, 90);
|
||||
this.button2.TabIndex = 15;
|
||||
this.button2.Text = "取消";
|
||||
this.button2.UseVisualStyleBackColor = true;
|
||||
@ -140,9 +140,9 @@
|
||||
//
|
||||
this.名称.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.名称.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.名称.Location = new System.Drawing.Point(328, 108);
|
||||
this.名称.Location = new System.Drawing.Point(358, 123);
|
||||
this.名称.Name = "名称";
|
||||
this.名称.Size = new System.Drawing.Size(211, 39);
|
||||
this.名称.Size = new System.Drawing.Size(230, 44);
|
||||
this.名称.TabIndex = 16;
|
||||
//
|
||||
// label4
|
||||
@ -150,9 +150,9 @@
|
||||
this.label4.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.label4.AutoSize = true;
|
||||
this.label4.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.label4.Location = new System.Drawing.Point(154, 453);
|
||||
this.label4.Location = new System.Drawing.Point(165, 517);
|
||||
this.label4.Name = "label4";
|
||||
this.label4.Size = new System.Drawing.Size(124, 28);
|
||||
this.label4.Size = new System.Drawing.Size(143, 33);
|
||||
this.label4.TabIndex = 3;
|
||||
this.label4.Text = "关联流程";
|
||||
//
|
||||
@ -161,39 +161,39 @@
|
||||
this.label3.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.label3.Location = new System.Drawing.Point(182, 368);
|
||||
this.label3.Location = new System.Drawing.Point(197, 420);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(68, 28);
|
||||
this.label3.Size = new System.Drawing.Size(79, 33);
|
||||
this.label3.TabIndex = 2;
|
||||
this.label3.Text = "模组";
|
||||
this.label3.Text = "Mold";
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.label2.Location = new System.Drawing.Point(154, 283);
|
||||
this.label2.Location = new System.Drawing.Point(189, 323);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(124, 28);
|
||||
this.label2.Size = new System.Drawing.Size(95, 33);
|
||||
this.label2.TabIndex = 1;
|
||||
this.label2.Text = "产线类型";
|
||||
this.label2.Text = "FixSn";
|
||||
//
|
||||
// 模组
|
||||
//
|
||||
this.模组.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.模组.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.模组.Location = new System.Drawing.Point(328, 363);
|
||||
this.模组.Location = new System.Drawing.Point(358, 414);
|
||||
this.模组.Name = "模组";
|
||||
this.模组.Size = new System.Drawing.Size(211, 39);
|
||||
this.模组.Size = new System.Drawing.Size(230, 44);
|
||||
this.模组.TabIndex = 20;
|
||||
//
|
||||
// 产线类型
|
||||
//
|
||||
this.产线类型.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.产线类型.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.产线类型.Location = new System.Drawing.Point(328, 278);
|
||||
this.产线类型.Location = new System.Drawing.Point(358, 317);
|
||||
this.产线类型.Name = "产线类型";
|
||||
this.产线类型.Size = new System.Drawing.Size(211, 39);
|
||||
this.产线类型.Size = new System.Drawing.Size(230, 44);
|
||||
this.产线类型.TabIndex = 17;
|
||||
//
|
||||
// label7
|
||||
@ -201,19 +201,19 @@
|
||||
this.label7.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.label7.AutoSize = true;
|
||||
this.label7.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.label7.Location = new System.Drawing.Point(154, 198);
|
||||
this.label7.Location = new System.Drawing.Point(189, 226);
|
||||
this.label7.Name = "label7";
|
||||
this.label7.Size = new System.Drawing.Size(124, 28);
|
||||
this.label7.Size = new System.Drawing.Size(95, 33);
|
||||
this.label7.TabIndex = 29;
|
||||
this.label7.Text = "产线编号";
|
||||
this.label7.Text = "Token";
|
||||
//
|
||||
// 产线编号
|
||||
//
|
||||
this.产线编号.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.产线编号.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.产线编号.Location = new System.Drawing.Point(328, 193);
|
||||
this.产线编号.Location = new System.Drawing.Point(358, 220);
|
||||
this.产线编号.Name = "产线编号";
|
||||
this.产线编号.Size = new System.Drawing.Size(211, 39);
|
||||
this.产线编号.Size = new System.Drawing.Size(230, 44);
|
||||
this.产线编号.TabIndex = 30;
|
||||
//
|
||||
// 关联流程
|
||||
@ -222,79 +222,79 @@
|
||||
this.tableLayoutPanel1.SetColumnSpan(this.关联流程, 3);
|
||||
this.关联流程.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.关联流程.FormattingEnabled = true;
|
||||
this.关联流程.Location = new System.Drawing.Point(364, 453);
|
||||
this.关联流程.Location = new System.Drawing.Point(398, 517);
|
||||
this.关联流程.Name = "关联流程";
|
||||
this.关联流程.Size = new System.Drawing.Size(573, 36);
|
||||
this.关联流程.Size = new System.Drawing.Size(625, 41);
|
||||
this.关联流程.TabIndex = 31;
|
||||
//
|
||||
// 备用显示1
|
||||
// Line
|
||||
//
|
||||
this.备用显示1.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.备用显示1.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.备用显示1.Location = new System.Drawing.Point(762, 108);
|
||||
this.备用显示1.Name = "备用显示1";
|
||||
this.备用显示1.Size = new System.Drawing.Size(211, 39);
|
||||
this.备用显示1.TabIndex = 32;
|
||||
this.Line.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.Line.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.Line.Location = new System.Drawing.Point(832, 123);
|
||||
this.Line.Name = "Line";
|
||||
this.Line.Size = new System.Drawing.Size(230, 44);
|
||||
this.Line.TabIndex = 32;
|
||||
//
|
||||
// 备用显示2
|
||||
// StationID
|
||||
//
|
||||
this.备用显示2.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.备用显示2.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.备用显示2.Location = new System.Drawing.Point(762, 193);
|
||||
this.备用显示2.Name = "备用显示2";
|
||||
this.备用显示2.Size = new System.Drawing.Size(211, 39);
|
||||
this.备用显示2.TabIndex = 33;
|
||||
this.StationID.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.StationID.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.StationID.Location = new System.Drawing.Point(832, 220);
|
||||
this.StationID.Name = "StationID";
|
||||
this.StationID.Size = new System.Drawing.Size(230, 44);
|
||||
this.StationID.TabIndex = 33;
|
||||
//
|
||||
// 备用显示3
|
||||
// MachineID
|
||||
//
|
||||
this.备用显示3.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.备用显示3.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.备用显示3.Location = new System.Drawing.Point(762, 278);
|
||||
this.备用显示3.Name = "备用显示3";
|
||||
this.备用显示3.Size = new System.Drawing.Size(211, 39);
|
||||
this.备用显示3.TabIndex = 34;
|
||||
this.MachineID.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.MachineID.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.MachineID.Location = new System.Drawing.Point(832, 317);
|
||||
this.MachineID.Name = "MachineID";
|
||||
this.MachineID.Size = new System.Drawing.Size(230, 44);
|
||||
this.MachineID.TabIndex = 34;
|
||||
//
|
||||
// label5
|
||||
//
|
||||
this.label5.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.label5.AutoSize = true;
|
||||
this.label5.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.label5.Location = new System.Drawing.Point(581, 113);
|
||||
this.label5.Location = new System.Drawing.Point(671, 129);
|
||||
this.label5.Name = "label5";
|
||||
this.label5.Size = new System.Drawing.Size(138, 28);
|
||||
this.label5.Size = new System.Drawing.Size(79, 33);
|
||||
this.label5.TabIndex = 35;
|
||||
this.label5.Text = "备用显示1";
|
||||
this.label5.Text = "Line";
|
||||
//
|
||||
// label6
|
||||
//
|
||||
this.label6.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.label6.AutoSize = true;
|
||||
this.label6.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.label6.Location = new System.Drawing.Point(581, 198);
|
||||
this.label6.Location = new System.Drawing.Point(631, 226);
|
||||
this.label6.Name = "label6";
|
||||
this.label6.Size = new System.Drawing.Size(138, 28);
|
||||
this.label6.Size = new System.Drawing.Size(159, 33);
|
||||
this.label6.TabIndex = 36;
|
||||
this.label6.Text = "备用显示2";
|
||||
this.label6.Text = "StationID";
|
||||
//
|
||||
// label8
|
||||
//
|
||||
this.label8.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.label8.AutoSize = true;
|
||||
this.label8.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.label8.Location = new System.Drawing.Point(581, 283);
|
||||
this.label8.Location = new System.Drawing.Point(631, 323);
|
||||
this.label8.Name = "label8";
|
||||
this.label8.Size = new System.Drawing.Size(138, 28);
|
||||
this.label8.Size = new System.Drawing.Size(159, 33);
|
||||
this.label8.TabIndex = 37;
|
||||
this.label8.Text = "备用显示3";
|
||||
this.label8.Text = "MachineID";
|
||||
//
|
||||
// label9
|
||||
//
|
||||
this.label9.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.label9.AutoSize = true;
|
||||
this.label9.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.label9.Location = new System.Drawing.Point(161, 538);
|
||||
this.label9.Location = new System.Drawing.Point(173, 614);
|
||||
this.label9.Name = "label9";
|
||||
this.label9.Size = new System.Drawing.Size(110, 28);
|
||||
this.label9.Size = new System.Drawing.Size(127, 33);
|
||||
this.label9.TabIndex = 38;
|
||||
this.label9.Text = "关联PLC";
|
||||
//
|
||||
@ -304,16 +304,16 @@
|
||||
this.tableLayoutPanel1.SetColumnSpan(this.关联PLC, 3);
|
||||
this.关联PLC.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.关联PLC.FormattingEnabled = true;
|
||||
this.关联PLC.Location = new System.Drawing.Point(364, 538);
|
||||
this.关联PLC.Location = new System.Drawing.Point(398, 614);
|
||||
this.关联PLC.Name = "关联PLC";
|
||||
this.关联PLC.Size = new System.Drawing.Size(573, 36);
|
||||
this.关联PLC.Size = new System.Drawing.Size(625, 41);
|
||||
this.关联PLC.TabIndex = 39;
|
||||
//
|
||||
// Line_Insert
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(11F, 21F);
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(12F, 24F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(1087, 854);
|
||||
this.ClientSize = new System.Drawing.Size(1186, 976);
|
||||
this.Controls.Add(this.tableLayoutPanel1);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
|
||||
this.Name = "Line_Insert";
|
||||
@ -340,9 +340,9 @@
|
||||
private System.Windows.Forms.Label label7;
|
||||
private System.Windows.Forms.TextBox 产线编号;
|
||||
private System.Windows.Forms.ComboBox 关联流程;
|
||||
private System.Windows.Forms.TextBox 备用显示1;
|
||||
private System.Windows.Forms.TextBox 备用显示2;
|
||||
private System.Windows.Forms.TextBox 备用显示3;
|
||||
private System.Windows.Forms.TextBox Line;
|
||||
private System.Windows.Forms.TextBox StationID;
|
||||
private System.Windows.Forms.TextBox MachineID;
|
||||
private System.Windows.Forms.Label label5;
|
||||
private System.Windows.Forms.Label label6;
|
||||
private System.Windows.Forms.Label label8;
|
||||
|
||||
@ -31,36 +31,36 @@ namespace WindowsFormsApp1.form
|
||||
MessageBox.Show("名称不能为空");
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrWhiteSpace(产线类型.Text))
|
||||
{
|
||||
MessageBox.Show("产线类型不能为空");
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrWhiteSpace(产线编号.Text))
|
||||
{
|
||||
MessageBox.Show("产线编号不能为空");
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrWhiteSpace(模组.Text))
|
||||
{
|
||||
MessageBox.Show("模组不能为空");
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrWhiteSpace(备用显示1.Text))
|
||||
{
|
||||
MessageBox.Show("备用显示1不能为空");
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrWhiteSpace(备用显示2.Text))
|
||||
{
|
||||
MessageBox.Show("备用显示2不能为空");
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrWhiteSpace(备用显示3.Text))
|
||||
{
|
||||
MessageBox.Show("备用显示3不能为空");
|
||||
return;
|
||||
}
|
||||
//if (string.IsNullOrWhiteSpace(产线类型.Text))
|
||||
//{
|
||||
// MessageBox.Show("产线类型不能为空");
|
||||
// return;
|
||||
//}
|
||||
//if (string.IsNullOrWhiteSpace(产线编号.Text))
|
||||
//{
|
||||
// MessageBox.Show("产线编号不能为空");
|
||||
// return;
|
||||
//}
|
||||
//if (string.IsNullOrWhiteSpace(模组.Text))
|
||||
//{
|
||||
// MessageBox.Show("模组不能为空");
|
||||
// return;
|
||||
//}
|
||||
//if (string.IsNullOrWhiteSpace(Line.Text))
|
||||
//{
|
||||
// MessageBox.Show("Line不能为空");
|
||||
// return;
|
||||
//}
|
||||
//if (string.IsNullOrWhiteSpace(StationID.Text))
|
||||
//{
|
||||
// MessageBox.Show("StationID不能为空");
|
||||
// return;
|
||||
//}
|
||||
//if (string.IsNullOrWhiteSpace(MachineID.Text))
|
||||
//{
|
||||
// MessageBox.Show("MachineID不能为空");
|
||||
// return;
|
||||
//}
|
||||
if (关联流程.SelectedValue == null || (int)关联流程.SelectedValue == 0)
|
||||
{
|
||||
MessageBox.Show("关联流程不能为空");
|
||||
@ -74,14 +74,17 @@ namespace WindowsFormsApp1.form
|
||||
|
||||
t_line t_Flow = new t_line();
|
||||
t_Flow.linename = 名称.Text;
|
||||
t_Flow.linetype = 产线类型.Text;
|
||||
t_Flow.linecode = 产线编号.Text;
|
||||
t_Flow.linemode = 模组.Text;
|
||||
//t_Flow.linetype = 产线类型.Text;
|
||||
//t_Flow.linecode = 产线编号.Text;
|
||||
//t_Flow.linemode = 模组.Text;
|
||||
t_Flow.flowid = (int)关联流程.SelectedValue;
|
||||
t_Flow.plcid = (int)关联PLC.SelectedValue;
|
||||
t_Flow.lineremark1 = 备用显示1.Text;
|
||||
t_Flow.lineremark2 = 备用显示2.Text;
|
||||
t_Flow.lineremark3 = 备用显示3.Text;
|
||||
t_Flow.lineremark1 = Line.Text;
|
||||
t_Flow.lineremark2 = StationID.Text;
|
||||
t_Flow.lineremark3 = MachineID.Text;
|
||||
t_Flow.lineremark4 = 产线编号.Text;
|
||||
t_Flow.lineremark5 = 产线类型.Text;
|
||||
t_Flow.lineremark6 = 模组.Text;
|
||||
|
||||
|
||||
SQLiteHelper<t_line> sQLiteHelper1 = new db.SQLiteHelper<t_line>();
|
||||
@ -92,7 +95,7 @@ namespace WindowsFormsApp1.form
|
||||
}
|
||||
else
|
||||
{
|
||||
sQLiteHelper1.Insert(t_Flow);
|
||||
var re = sQLiteHelper1.Insert(t_Flow);
|
||||
}
|
||||
MessageBox.Show("保存成功");
|
||||
this.Close();
|
||||
@ -158,12 +161,12 @@ namespace WindowsFormsApp1.form
|
||||
}
|
||||
var DataToEdit = result.Data;
|
||||
名称.Text = DataToEdit.linename;
|
||||
产线编号.Text = DataToEdit.linecode;
|
||||
产线类型.Text = DataToEdit.linetype;
|
||||
模组.Text = DataToEdit.linemode;
|
||||
备用显示1.Text = DataToEdit.lineremark1;
|
||||
备用显示2.Text = DataToEdit.lineremark2;
|
||||
备用显示3.Text = DataToEdit.lineremark3;
|
||||
产线编号.Text = DataToEdit.lineremark4;
|
||||
产线类型.Text = DataToEdit.lineremark5;
|
||||
模组.Text = DataToEdit.lineremark6;
|
||||
Line.Text = DataToEdit.lineremark1;
|
||||
StationID.Text = DataToEdit.lineremark2;
|
||||
MachineID.Text = DataToEdit.lineremark3;
|
||||
SelectItemByValue(关联流程, DataToEdit.flowid.ToString());
|
||||
SelectItemByValue2(关联PLC, DataToEdit.plcid.ToString());
|
||||
}
|
||||
|
||||
@ -16,11 +16,29 @@ namespace WindowsFormsApp1.mod
|
||||
public string linecode { get; set; }
|
||||
public string linetype { get; set; }
|
||||
public string linemode { get; set; }
|
||||
/// <summary>
|
||||
/// line
|
||||
/// </summary>
|
||||
public string lineremark1 { get; set; }
|
||||
/// <summary>
|
||||
/// stationid
|
||||
/// </summary>
|
||||
public string lineremark2 { get; set; }
|
||||
/// <summary>
|
||||
/// machineid
|
||||
/// </summary>
|
||||
public string lineremark3 { get; set; }
|
||||
/// <summary>
|
||||
/// token
|
||||
/// </summary>
|
||||
public string lineremark4 { get; set; }
|
||||
/// <summary>
|
||||
/// fixsn
|
||||
/// </summary>
|
||||
public string lineremark5 { get; set; }
|
||||
/// <summary>
|
||||
/// mold
|
||||
/// </summary>
|
||||
public string lineremark6 { get; set; }
|
||||
public string lineremark7 { get; set; }
|
||||
|
||||
|
||||
@ -52,6 +52,15 @@ namespace WindowsFormsApp1.mod.server
|
||||
/// 气密仪参数
|
||||
/// </summary>
|
||||
public Airtight FinalAirtightValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 上下料位置
|
||||
/// </summary>
|
||||
public int locationindex { get; set; }
|
||||
/// <summary>
|
||||
/// 上下料操作 上料:1;下料 2
|
||||
/// </summary>
|
||||
public int opindex { get; set; }
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -17,6 +17,8 @@ using System.Security.Cryptography;
|
||||
using Newtonsoft.Json;
|
||||
using HslCommunication.BasicFramework;
|
||||
using System.IO;
|
||||
using static WindowsFormsApp1.server.ApiClient;
|
||||
using System.Security.Policy;
|
||||
|
||||
namespace WindowsFormsApp1.server
|
||||
{
|
||||
@ -28,6 +30,9 @@ namespace WindowsFormsApp1.server
|
||||
private readonly string _stationID;
|
||||
private readonly string _machineID;
|
||||
private readonly string _opID;
|
||||
private readonly string _mold;
|
||||
private readonly string _token;
|
||||
private readonly string _fixsn;
|
||||
|
||||
public ApiClient()
|
||||
{
|
||||
@ -36,14 +41,24 @@ namespace WindowsFormsApp1.server
|
||||
_httpClient.Timeout = TimeSpan.FromSeconds(10);
|
||||
|
||||
SQLiteHelper<t_interface> helper = new db.SQLiteHelper<t_interface>();
|
||||
var apiList = helper.QueryAll().Data.ToList();
|
||||
var apiList = helper.QueryAll().Data.Select(x => new { x.code, url = x.url + x.code }).ToList();
|
||||
apiUrlDict = apiList.ToDictionary(x => x.code, x => x.url);
|
||||
|
||||
// 从配置中读取通用参数
|
||||
_line = "Testline";
|
||||
_stationID = "TestStation";
|
||||
_machineID = "TestMachine";
|
||||
_opID = "";
|
||||
_line = Init.t_Line.lineremark1;
|
||||
_stationID = Init.t_Line.lineremark2;
|
||||
_machineID = Init.t_Line.lineremark3;
|
||||
_token = Init.t_Line.lineremark4;
|
||||
_fixsn = Init.t_Line.lineremark5;
|
||||
_mold = Init.t_Line.lineremark6;
|
||||
|
||||
_opID = Init.t_User.username;
|
||||
|
||||
|
||||
//线别.Text = "线别:" + Init.t_Line.linename;
|
||||
//段别.Text = "段别:" + Init.t_Line.linemode;
|
||||
//机台编号.Text = "机台编号:" + Init.t_Line.linecode;
|
||||
//操作人员ID.Text = "操作人员ID:" + Init.t_User.username;
|
||||
}
|
||||
|
||||
// 通用API调用方法,减少代码重复
|
||||
@ -59,14 +74,35 @@ namespace WindowsFormsApp1.server
|
||||
try
|
||||
{
|
||||
// 测试
|
||||
LogExecute.logNet.WriteDebug($"{eventName} 接口请求成功\n请求:{jsonPayload}");
|
||||
LogExecute.logNet.WriteDebug($"{eventName} 接口请求模拟测试成功\n请求:{jsonPayload}");
|
||||
|
||||
// 回写对应PLC
|
||||
if (statusCode > 0)
|
||||
PlcData.Write_Status = (short)statusCode;
|
||||
if (eventName == "SN_Release")
|
||||
PlcData.Write_stSN = "testsn";
|
||||
if(eventName == "Glue_CheckOut")
|
||||
{
|
||||
var station = Init.t_Line.lineremark2.ToLower();
|
||||
switch (station)
|
||||
{
|
||||
case "Potting"://灌胶
|
||||
case "ThermalPaste"://点胶&CCD检测
|
||||
case "UVCoating"://三防漆涂覆
|
||||
case "Sealant"://点密封胶&CCD
|
||||
break;
|
||||
default:
|
||||
var power = Init.t_Keyvalues.First(x => x.key == "Power");
|
||||
power.value = DateTime.Now.Millisecond.ToString();
|
||||
SQLiteHelper<t_keyvalue> kvHelper = new db.SQLiteHelper<t_keyvalue>();
|
||||
kvHelper.Update(power);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
return ApiFormResult.Sucess(mesresult.PASS, false, "", PlcData, DateTime.Now);
|
||||
|
||||
#region 测试不用
|
||||
/*
|
||||
var response = _httpClient.PostAsync(url, httpContent).Result;
|
||||
// 检查响应状态码
|
||||
@ -93,12 +129,20 @@ namespace WindowsFormsApp1.server
|
||||
// 回写对应PLC
|
||||
if (statusCode > 0)
|
||||
PlcData.Write_Status = (short)statusCode;
|
||||
if(eventName == "SN_Release")
|
||||
if (eventName == "SN_Release")
|
||||
PlcData.Write_stSN = res.SN.Value;
|
||||
}
|
||||
else
|
||||
{
|
||||
// 判断此站是否有胶水。返回fail,执行胶水下线
|
||||
if (eventName == "SN_FeedingCheck")
|
||||
{
|
||||
//执行胶水下线操作
|
||||
}
|
||||
}
|
||||
return result
|
||||
? ApiFormResult.Sucess(mesresult.PASS, false, res.MSG.Value, PlcData, DateTime.Now)
|
||||
: ApiFormResult.Sucess(mesresult.FAIL, true, res.MSG.Value, PlcData, DateTime.Now);
|
||||
? ApiFormResult.Sucess(mesresult.PASS, false, res.MSG.Value, PlcData, DateTime.Now)
|
||||
: ApiFormResult.Sucess(mesresult.FAIL, true, res.MSG.Value, PlcData, DateTime.Now);
|
||||
}
|
||||
else if (res.IsSuccess != null) // 打印 mes不返回result
|
||||
{
|
||||
@ -116,13 +160,14 @@ namespace WindowsFormsApp1.server
|
||||
throw new Exception($"请求失败,状态码:{response.StatusCode}");
|
||||
}
|
||||
*/
|
||||
#endregion 测试不用
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogExecute.logNet.WriteError($"{eventName} 接口请求失败: {ex.Message}");
|
||||
throw new Exception(ex.Message);
|
||||
}
|
||||
//return ApiFormResult.Sucess(mesresult.PASS, false, "", PlcData, DateTime.Now);
|
||||
return ApiFormResult.Sucess(mesresult.PASS, false, "", PlcData, DateTime.Now);
|
||||
}
|
||||
|
||||
public ApiFormResult SN_CheckIN(string url, plcdata PlcData, otherdata OtherData)
|
||||
@ -135,16 +180,23 @@ namespace WindowsFormsApp1.server
|
||||
StationID = _stationID,
|
||||
MachineID = _machineID,
|
||||
OPID = _opID,
|
||||
Token = "",
|
||||
FixSN = "",
|
||||
Token = _token,
|
||||
FixSN = _fixsn,
|
||||
SN = PlcData.Read_MaterialCode1,
|
||||
CarrierID = "",
|
||||
SendTime = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss")
|
||||
};
|
||||
|
||||
// 1对4 有部分不需要 callapi todo
|
||||
return CallApi(url, request, "SN_CheckIN", PlcData, PLC_Status.SN_CheckIN);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 核对载具合法性
|
||||
/// </summary>
|
||||
/// <param name="url"></param>
|
||||
/// <param name="PlcData"></param>
|
||||
/// <param name="OtherData"></param>
|
||||
/// <returns></returns>
|
||||
public ApiFormResult Carrier_Check(string url, plcdata PlcData, otherdata OtherData)
|
||||
{
|
||||
// 组装 request json
|
||||
@ -155,8 +207,8 @@ namespace WindowsFormsApp1.server
|
||||
StationID = _stationID,
|
||||
MachineID = _machineID,
|
||||
OPID = _opID,
|
||||
Token = "",
|
||||
FixSN = "",
|
||||
Token = _token,
|
||||
FixSN = _fixsn,
|
||||
CarrierID = PlcData.Read_MaterialCode1,
|
||||
SendTime = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss")
|
||||
};
|
||||
@ -164,6 +216,13 @@ namespace WindowsFormsApp1.server
|
||||
return CallApi(url, request, "Carrier_Check", PlcData, PLC_Status.Carrier_Check);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 核对材料,核对胶水寿命
|
||||
/// </summary>
|
||||
/// <param name="url"></param>
|
||||
/// <param name="PlcData"></param>
|
||||
/// <param name="OtherData"></param>
|
||||
/// <returns></returns>
|
||||
public ApiFormResult SN_FeedingCheck(string url, plcdata PlcData, otherdata OtherData)
|
||||
{
|
||||
// 组装 request json
|
||||
@ -174,15 +233,31 @@ namespace WindowsFormsApp1.server
|
||||
StationID = _stationID,
|
||||
MachineID = _machineID,
|
||||
OPID = _opID,
|
||||
Token = "",
|
||||
FixSN = "",
|
||||
Token = _token,
|
||||
FixSN = _fixsn,
|
||||
SN = OtherData.JS_SN,//扫码
|
||||
SendTime = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss")
|
||||
};
|
||||
|
||||
return CallApi(url, request, "SN_FeedingCheck", PlcData, PLC_Status.SN_FeedingCheck);
|
||||
var result = CallApi(url, request, "SN_FeedingCheck", PlcData, PLC_Status.SN_FeedingCheck);
|
||||
if (result.Success && result.Mesresult != mesresult.PASS)
|
||||
{
|
||||
// 判断是否是胶水站,FAIL 直接下线 todo
|
||||
return CallFunctionByName("Glue_CheckOut", PlcData, OtherData);
|
||||
}
|
||||
else
|
||||
{
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 追溯码+材料绑定
|
||||
/// </summary>
|
||||
/// <param name="url"></param>
|
||||
/// <param name="PlcData"></param>
|
||||
/// <param name="OtherData"></param>
|
||||
/// <returns></returns>
|
||||
public ApiFormResult Link_Comp(string url, plcdata PlcData, otherdata OtherData)
|
||||
{
|
||||
// 组装 request json
|
||||
@ -193,8 +268,15 @@ namespace WindowsFormsApp1.server
|
||||
StationID = _stationID,
|
||||
MachineID = _machineID,
|
||||
OPID = _opID,
|
||||
Token = "",
|
||||
FixSN = "",
|
||||
CompList = new List<CompListItem>()
|
||||
{
|
||||
new CompListItem()
|
||||
{
|
||||
// 安装主板 端子
|
||||
CompID = OtherData.JS_SN ?? Init.ScanString,
|
||||
Qty = "1"
|
||||
}
|
||||
},
|
||||
SN = OtherData.JS_SN,
|
||||
SendTime = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss")
|
||||
};
|
||||
@ -202,6 +284,13 @@ namespace WindowsFormsApp1.server
|
||||
return CallApi(url, request, "Link_Comp", PlcData, PLC_Status.Link_Comp);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 扫描机壳码,返回MES SN号,写入PLC
|
||||
/// </summary>
|
||||
/// <param name="url"></param>
|
||||
/// <param name="PlcData"></param>
|
||||
/// <param name="OtherData"></param>
|
||||
/// <returns></returns>
|
||||
public ApiFormResult SN_Release(string url, plcdata PlcData, otherdata OtherData)
|
||||
{
|
||||
// 组装 request json
|
||||
@ -212,9 +301,9 @@ namespace WindowsFormsApp1.server
|
||||
StationID = _stationID,
|
||||
MachineID = _machineID,
|
||||
OPID = _opID,
|
||||
Token = "",
|
||||
FixSN = "",
|
||||
SN = Init.ScanString,
|
||||
Token = _token,
|
||||
FixSN = _fixsn,
|
||||
SN = OtherData.JS_SN,
|
||||
CarrierID = "",
|
||||
SendTime = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss")
|
||||
};
|
||||
@ -222,25 +311,56 @@ namespace WindowsFormsApp1.server
|
||||
return CallApi(url, request, "SN_Release", PlcData, PLC_Status.SN_Release);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 胶水、三防漆,材料 上下线
|
||||
/// </summary>
|
||||
/// <param name="url"></param>
|
||||
/// <param name="PlcData"></param>
|
||||
/// <param name="OtherData"></param>
|
||||
/// <returns></returns>
|
||||
public ApiFormResult Glue_CheckOut(string url, plcdata PlcData, otherdata OtherData)
|
||||
{
|
||||
// 组装 request json
|
||||
//判断站
|
||||
var station = Init.t_Line.lineremark2.ToLower();
|
||||
var fixsn_1 = "";
|
||||
var locationindex = 1;
|
||||
switch (station)
|
||||
{
|
||||
case "Potting"://灌胶
|
||||
case "ThermalPaste"://点胶&CCD检测
|
||||
case "UVCoating"://三防漆涂覆
|
||||
case "Sealant"://点密封胶&CCD
|
||||
break;
|
||||
default:
|
||||
fixsn_1 = "CompPN";
|
||||
locationindex = OtherData.locationindex;
|
||||
break;
|
||||
}
|
||||
|
||||
var request = new
|
||||
{
|
||||
EventID = "Glue_CheckOut",
|
||||
Line = _line,
|
||||
StationID = _stationID,
|
||||
MachineID = _machineID,
|
||||
OPID = "",//判断站,胶水不用传
|
||||
Token = "",//判断站,胶水不用传
|
||||
FixSN = "",//判断站,胶水不用传
|
||||
SN = PlcData.Read_MaterialCode0,
|
||||
OPID = OtherData.opindex,
|
||||
Token = locationindex.ToString(),//判断站,胶水不用传
|
||||
FixSN = fixsn_1,//判断站,胶水不用传
|
||||
SN = OtherData.JS_SN,
|
||||
SendTime = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss")
|
||||
};
|
||||
|
||||
return CallApi(url, request, "Glue_CheckOut", PlcData, PLC_Status.Glue_CheckOut);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 压力曲线 扭力曲线
|
||||
/// </summary>
|
||||
/// <param name="url"></param>
|
||||
/// <param name="PlcData"></param>
|
||||
/// <param name="OtherData"></param>
|
||||
/// <returns></returns>
|
||||
public ApiFormResult Data_Collection(string url, plcdata PlcData, otherdata OtherData)
|
||||
{
|
||||
// 组装 request json
|
||||
@ -293,8 +413,38 @@ namespace WindowsFormsApp1.server
|
||||
return CallApi(url, request, "Alarm", PlcData, 0);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 视频、图片上传
|
||||
/// </summary>
|
||||
/// <param name="url"></param>
|
||||
/// <param name="PlcData"></param>
|
||||
/// <param name="OtherData"></param>
|
||||
/// <returns></returns>
|
||||
public ApiFormResult SN_FileUpload(string url, plcdata PlcData, otherdata OtherData)
|
||||
{
|
||||
// 准备文件 视频/图片
|
||||
var month = DateTime.Now.ToString("yyyyMM");
|
||||
var day = DateTime.Now.ToString("dd");
|
||||
var monthDay = DateTime.Now.ToString("MMdd");
|
||||
var time = DateTime.Now.ToString("HHmmss");
|
||||
var result = PlcData.Read_Result == 1 ? "OK" : "NG";
|
||||
|
||||
var sourceDirectory = @"";
|
||||
var targetDirectory = $"{OtherData.FileUploadAddress}\\{_line.Substring(0, 2)}\\{month}\\{day}\\line{_line.Substring(_line.Length - 2)}\\{_stationID}\\{_machineID}\\{result}";
|
||||
var fileName = $"{month}{day}_{_stationID}_{result}_{PlcData.Write_stSN}_{monthDay}_{time}_{_machineID}_Original01.png";
|
||||
// 查找源文件 可能会有多张照片或视频
|
||||
string sourceFile = Path.Combine(sourceDirectory, "source.png");
|
||||
//string targetDir = Path.Combine(targetDirectory, "target");
|
||||
// 执行复制
|
||||
try
|
||||
{
|
||||
CopyFileToDirectory(sourceFile, targetDirectory, fileName);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return ApiFormResult.Error(mesresult.FAIL, false, ex.Message, PlcData, DateTime.Now);
|
||||
}
|
||||
|
||||
// 组装 request json
|
||||
var request = new
|
||||
{
|
||||
@ -309,26 +459,49 @@ namespace WindowsFormsApp1.server
|
||||
SN = OtherData.JS_SN,
|
||||
FileInfo = new List<dynamic>()
|
||||
{
|
||||
new
|
||||
{
|
||||
FileName = OtherData.FileUploadAddress,
|
||||
FilePath = OtherData.FileUploadAddress
|
||||
}
|
||||
//new
|
||||
//{
|
||||
// FileName = OtherData.FileUploadAddress,
|
||||
// FilePath = OtherData.FileUploadAddress
|
||||
//}
|
||||
}
|
||||
}
|
||||
},
|
||||
SendTime = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss")
|
||||
};
|
||||
|
||||
// 多个视频或图片
|
||||
// 动态添加 FileInfo
|
||||
/*
|
||||
var newFileInfo = new
|
||||
{
|
||||
FileName = "NewFileName.txt",
|
||||
FilePath = "C:\\path\\to\\newfile.txt"
|
||||
};
|
||||
|
||||
// 获取 SNList 的第一个元素(假设只有一个 SN 元素)
|
||||
dynamic snElement = request.SNList[0];
|
||||
|
||||
// 将 newFileInfo 添加到 FileInfo 列表中
|
||||
snElement.FileInfo.Add(newFileInfo);
|
||||
*/
|
||||
|
||||
return CallApi(url, request, "SN_FileUpload", PlcData, PLC_Status.SN_FileUpload);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 触发MES打印
|
||||
/// </summary>
|
||||
/// <param name="url"></param>
|
||||
/// <param name="PlcData"></param>
|
||||
/// <param name="OtherData"></param>
|
||||
/// <returns></returns>
|
||||
public ApiFormResult CodeSoftPrint(string url, plcdata PlcData, otherdata OtherData)
|
||||
{
|
||||
// 组装 request json
|
||||
var request = new
|
||||
{
|
||||
Line = "CodeSoftPrint", // 特殊值,不使用_line
|
||||
Line = _line, // 特殊值,不使用_line
|
||||
StationID = _stationID,
|
||||
MachineID = _machineID,
|
||||
SN = PlcData.Read_MaterialCode0
|
||||
@ -341,7 +514,10 @@ namespace WindowsFormsApp1.server
|
||||
{
|
||||
// 根据不同的lineCode构建不同的请求
|
||||
var lineCode = Init.t_Line.linecode;
|
||||
var stationid = Init.t_Line.lineremark2;
|
||||
|
||||
var result = PlcData.Read_Result == 1 ? "PASS" : "FAIL";
|
||||
var logresult = PlcData.Read_Result == 1 ? "OK" : "NG";
|
||||
// 基础请求对象
|
||||
var request = new CheckOutObject()
|
||||
{
|
||||
@ -355,89 +531,125 @@ namespace WindowsFormsApp1.server
|
||||
new SNInfoItem()
|
||||
{
|
||||
SN = PlcData.Read_MaterialCode0,
|
||||
Result = PlcData.Read_Result == 1 ? "PASS" : "FAIL",
|
||||
DC_INFO = new List<DCInfoItem>()
|
||||
{
|
||||
new DCInfoItem()
|
||||
{
|
||||
Item = PlcData.Read_MaterialCode2,
|
||||
Value = PlcData.Read_UploadData1.ToString(),
|
||||
Result = PlcData.Read_Result == 1 ? "PASS" : "FAIL"
|
||||
}
|
||||
},
|
||||
Result = result,
|
||||
DC_INFO = new List<DCInfoItem>(),
|
||||
CompList = new List<CompListItem>()
|
||||
{
|
||||
new CompListItem()
|
||||
{
|
||||
CompID = "",
|
||||
Qty = "1"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
Qty = "",
|
||||
CarrierID = PlcData.Read_MaterialCode1,
|
||||
Mold = "",
|
||||
Token = "",
|
||||
FixSN = "",
|
||||
Mold = _mold,
|
||||
Token = _token,
|
||||
FixSN = _fixsn,
|
||||
SendTime = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss")
|
||||
};
|
||||
|
||||
//LogExecute.logNet.WriteDebug($"checkout:{request}");
|
||||
|
||||
// 根据不同的lineCode可以在这里扩展request对象
|
||||
switch (lineCode)
|
||||
var dcInfo = new DCInfoItem();
|
||||
var sninfo = request.SNInfo[0];
|
||||
var compListItem = new CompListItem();
|
||||
|
||||
//气密
|
||||
if ("SWAT".Contains(stationid))
|
||||
{
|
||||
case "OP1060": // 追溯码+载具,默认(todo)
|
||||
case "OP1120":
|
||||
case "OP1170":
|
||||
case "OP1190":
|
||||
case "OP1220":
|
||||
case "OP1250":
|
||||
break;
|
||||
|
||||
sninfo.DC_INFO.Add(new DCInfoItem
|
||||
{
|
||||
Item = OutItem.充气压力,
|
||||
Value = Init.airtight.Airtight_Value,
|
||||
Result = result
|
||||
});
|
||||
sninfo.DC_INFO.Add(new DCInfoItem
|
||||
{
|
||||
Item = OutItem.泄漏量,
|
||||
Value = Init.airtight.Leak_Value,
|
||||
Result = result
|
||||
});
|
||||
|
||||
case "OP1010":// 传气密
|
||||
case "OP1330":
|
||||
var dcInfo = new DCInfoItem();
|
||||
dcInfo.Item = PlcData.Read_MaterialCode2;
|
||||
dcInfo.Value = "气密测试值";
|
||||
dcInfo.Result = "PASS";
|
||||
//request.SNInfo
|
||||
break;
|
||||
|
||||
case "OP1050":// 胶水码
|
||||
case "OP1210":// 三防漆码
|
||||
break;
|
||||
|
||||
case "OP1070":// 传螺丝 角度,扭力,【扭力曲线(datacollection)】
|
||||
case "OP1080":
|
||||
case "OP1090":
|
||||
case "OP1100":
|
||||
case "OP1130":
|
||||
case "OP1260":
|
||||
break;
|
||||
|
||||
case "OP1140"://压力值,压力曲线
|
||||
break;
|
||||
|
||||
case "OP1160"://加热,冷却温度
|
||||
break;
|
||||
|
||||
case "OP1110"://CCD检测结果
|
||||
case "OP1200"://AOI检测结果
|
||||
case "OP1240"://CCD检测结果
|
||||
case "OP1340"://CCD检测结果
|
||||
break;
|
||||
|
||||
case "OP1360"://产品码
|
||||
break;
|
||||
|
||||
case "OP1230"://AOI检测结果,三防漆涂胶胶宽
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
LogExecute.SNlogNet.WriteDebug($"{PlcData.Read_MaterialCode0},{Init.airtight.Airtight_Value},{Init.airtight.Leak_Value}");
|
||||
}
|
||||
//扭力,角度
|
||||
if ("ScrewE,Assy2,Assy3,ScrewS,ScrewM".Contains(stationid))
|
||||
{
|
||||
var AngleCount = 1;
|
||||
foreach (var item in OtherData.FinalAngleValue.Where(x => x > 0))
|
||||
{
|
||||
//角度
|
||||
dcInfo = new DCInfoItem();
|
||||
dcInfo.Item = $"{Init.t_Line.lineremark2}_Angle{AngleCount}";
|
||||
dcInfo.Value = item.ToString();
|
||||
dcInfo.Result = result;
|
||||
|
||||
sninfo.DC_INFO.Add(dcInfo);
|
||||
AngleCount++;
|
||||
}
|
||||
var TorqueCount = 1;
|
||||
foreach (var item in OtherData.FinalTorqueValue.Where(x => x > 0))
|
||||
{
|
||||
//扭力
|
||||
dcInfo = new DCInfoItem();
|
||||
dcInfo.Item = $"{Init.t_Line.lineremark2}_Torque{TorqueCount}";
|
||||
dcInfo.Value = item.ToString();
|
||||
dcInfo.Result = result;
|
||||
|
||||
sninfo.DC_INFO.Add(dcInfo);
|
||||
TorqueCount++;
|
||||
}
|
||||
}
|
||||
|
||||
//CCD
|
||||
if ("Assy2,Assy3,AOI,Assy5,Sealant,CCD,PrintLabel".Contains(stationid))
|
||||
{
|
||||
dcInfo.Item = stationid == "CCD"? "CCD" : $"{Init.t_Line.lineremark2}_CCD";
|
||||
dcInfo.Value = PlcData.Read_UploadData0.ToString();
|
||||
dcInfo.Result = result;
|
||||
sninfo.DC_INFO.Add(dcInfo);
|
||||
|
||||
LogExecute.SNlogNet.WriteDebug($"追溯码:{PlcData.Read_MaterialCode0},检测结果:{logresult}");
|
||||
}
|
||||
//抽真空 压力
|
||||
if ("Vacuum".Contains(stationid))
|
||||
{
|
||||
|
||||
}
|
||||
//固化 时间
|
||||
if ("Curing".Contains(stationid))
|
||||
{
|
||||
|
||||
}
|
||||
//胶重
|
||||
if ("Potting,ThermalPaste,Sealant".Contains(stationid))
|
||||
{
|
||||
dcInfo.Item = $"{stationid}_Weight";
|
||||
dcInfo.Value = PlcData.Read_UploadData0.ToString();
|
||||
dcInfo.Result = result;
|
||||
sninfo.DC_INFO.Add(dcInfo);
|
||||
}
|
||||
//胶宽
|
||||
if ("Sealant".Contains(stationid))
|
||||
{
|
||||
dcInfo.Item = $"{stationid}_Width";
|
||||
dcInfo.Value = PlcData.Read_UploadData1.ToString();
|
||||
dcInfo.Result = result;
|
||||
sninfo.DC_INFO.Add(dcInfo);
|
||||
}
|
||||
//胶水 材料码
|
||||
if ("Potting,ThermalPaste,Sel_Soldering,UVCoating,Sealant".Contains(stationid))
|
||||
{
|
||||
compListItem.CompID = OtherData.JS_SN;
|
||||
compListItem.Qty = "1";
|
||||
|
||||
sninfo.CompList.Add(compListItem);
|
||||
|
||||
LogExecute.SNlogNet.WriteDebug($"{PlcData.Read_MaterialCode0},胶水码:{OtherData.JS_SN},胶重:{PlcData.Read_UploadData0}");
|
||||
}
|
||||
else //其他不传
|
||||
{
|
||||
compListItem.CompID = "";
|
||||
compListItem.Qty = "1";
|
||||
|
||||
sninfo.CompList.Add(compListItem);
|
||||
}
|
||||
return CallApi(url, request, "SN_Checkout", PlcData, PLC_Status.SN_Checkout);
|
||||
}
|
||||
|
||||
@ -581,6 +793,22 @@ namespace WindowsFormsApp1.server
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// checkout dcinfo item
|
||||
/// </summary>
|
||||
public sealed class OutItem
|
||||
{
|
||||
public const string 充气压力 = "Set_Fill";
|
||||
public const string 泄漏量 = "Leakage_Rate";
|
||||
public const string 灌胶重量 = "Glue_Weight";
|
||||
public const string 点胶重量 = "ThermalPaste_Weight";
|
||||
public const string 腔体压力 = "Chamber_Pressure";
|
||||
public const string 保压时间 = "Hold_Time";
|
||||
public const string 固化温度 = "Cure_Temperature";
|
||||
public const string 固化时间 = "Curing_Time";
|
||||
public const string 重量 = "Sealant_Weight";
|
||||
public const string 宽度 = "Sealant_Width";
|
||||
}
|
||||
public sealed class PLC_Status
|
||||
{
|
||||
public const int SN_CheckIN = 10;
|
||||
@ -606,7 +834,8 @@ namespace WindowsFormsApp1.server
|
||||
public const int Fail = 1001;
|
||||
}
|
||||
|
||||
//checkout class
|
||||
|
||||
#region checkout class
|
||||
// 根对象类
|
||||
public class CheckOutObject
|
||||
{
|
||||
@ -647,5 +876,36 @@ namespace WindowsFormsApp1.server
|
||||
public string CompID { get; set; }
|
||||
public string Qty { get; set; }
|
||||
}
|
||||
#endregion checkout class
|
||||
|
||||
// 文件copy方法
|
||||
public bool CopyFileToDirectory(string sourceFilePath, string targetDirectory, string fileName)
|
||||
{
|
||||
// 检查源文件是否存在
|
||||
if (!File.Exists(sourceFilePath))
|
||||
{
|
||||
throw new FileNotFoundException("源文件不存在", sourceFilePath);
|
||||
}
|
||||
|
||||
// 如果目标目录不存在,则创建
|
||||
if (!Directory.Exists(targetDirectory))
|
||||
{
|
||||
Directory.CreateDirectory(targetDirectory);
|
||||
}
|
||||
|
||||
string targetPath = Path.Combine(targetDirectory, fileName);
|
||||
|
||||
try
|
||||
{
|
||||
// 复制文件
|
||||
File.Copy(sourceFilePath, targetPath, true);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new Exception(ex.Message);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -12,7 +12,7 @@ namespace WindowsFormsApp1.server
|
||||
public static ILogNet logNet = new LogNetDateTime("C:\\Log\\Logs", GenerateMode.ByEveryDay);
|
||||
public static ILogNet PlclogNet = new LogNetDateTime("C:\\Log\\PlcLogs", GenerateMode.ByEveryDay);
|
||||
public static ILogNet ApilogNet = new LogNetDateTime("C:\\Log\\Apilogs", GenerateMode.ByEveryHour);
|
||||
public static ILogNet QMlogNet = new LogNetDateTime("C:\\Log\\QMlogs", GenerateMode.ByEveryHour);
|
||||
public static ILogNet SNlogNet = new LogNetDateTime("C:\\Log\\SNlogs", GenerateMode.ByEveryDay);
|
||||
public static HslCommunication.BasicFramework.SoftNumericalOrder softNumericalOrder = new HslCommunication.BasicFramework.SoftNumericalOrder("", "yyyyMMdd", 4, @"\numericalOrder.txt");
|
||||
|
||||
public LogExecute()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user