From bd70f38e1ae01f8ac6551fbf3a3cf3008bdda7fb Mon Sep 17 00:00:00 2001 From: bnala Date: Tue, 25 Mar 2025 00:01:26 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E7=AB=AF=E5=AD=90=E6=89=AB?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- WindowsFormsApp1/MainForm.cs | 30 ++++++++++++++++++++++------ WindowsFormsApp1/form/ScanForm_DZ.cs | 19 ++++++++++++++---- 2 files changed, 39 insertions(+), 10 deletions(-) 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 {