diff --git a/WindowsFormsApp1/MainForm.cs b/WindowsFormsApp1/MainForm.cs index 2521d8b..2f0ef60 100644 --- a/WindowsFormsApp1/MainForm.cs +++ b/WindowsFormsApp1/MainForm.cs @@ -271,17 +271,35 @@ namespace WindowsFormsApp1 //扫码 ScanForm_DZ scanForm = new ScanForm_DZ(); DialogResult scan_result = scanForm.ShowDialog(); - if (scan_result == DialogResult.OK) - { - string returnValue = scanForm.ReturnValue; - otherdata.JS_SN = returnValue; - Init.ScanString = returnValue; + var writeresult = siemensHelp.WriteAddress(plcaddress, PlcData); + if (!writeresult.Success) + { + //PLC链接状态.Text = "PLC链接状态:NG"; + //PLC链接状态.BackColor = Color.Red; + PLC_Form(Plc, plcstate.NG, DateTime.Now); + LogExecute.logNet.WriteError($"{Plc.plcip}写入地址处理错误:处理停止"); + continue; } else { - continue; + MES链接状态.Text = "MES链接状态:OK"; + MES链接状态.BackColor = SystemColors.Control; + MES通讯时间.Text = "MES通讯时间:" + DateTime.Now.ToString("MM-dd HH:mm:ss"); } + continue; + + //if (scan_result == DialogResult.OK) + //{ + // string returnValue = scanForm.ReturnValue; + // otherdata.JS_SN = returnValue; + + // Init.ScanString = returnValue; + //} + //else + //{ + // continue; + //} } if (nowflow.finalpressurecurve) { diff --git a/WindowsFormsApp1/form/ScanForm_DZ.cs b/WindowsFormsApp1/form/ScanForm_DZ.cs index 931b503..6ddde1e 100644 --- a/WindowsFormsApp1/form/ScanForm_DZ.cs +++ b/WindowsFormsApp1/form/ScanForm_DZ.cs @@ -90,11 +90,22 @@ namespace WindowsFormsApp1 端子1校验.Text = "校验OK"; })); //继续调用接口 - - this.Invoke(new Action(() => + var result2 = ApiClient.CallFunctionByName("nowinterface.code", null, new otherdata() { JS_SN = barcode }); + if (result2.Success) { - button1.Visible = false; - })); + this.Invoke(new Action(() => + { + 端子1结果.Text = "绑定OK"; + button1.Visible = false; + })); + } + else + { + this.Invoke(new Action(() => + { + 端子1结果.Text = "绑定NG"; + })); + } } else {