From ab598d6f7f3819f14d78f22d7e0acf83ce1037a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A6=82=E6=84=8F=20=E5=BD=AD?= <2417589739@qq.com> Date: Thu, 15 Sep 2022 10:44:39 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8D=8F=E8=AE=AE=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BPASmartClient.JXJFoodBigStation/Model/ProcessControl.cs | 4 ++-- BPASmartClient.S7Net/SiemensHelper.cs | 2 +- DosingSystem/Model/DeviceInquire.cs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/BPASmartClient.JXJFoodBigStation/Model/ProcessControl.cs b/BPASmartClient.JXJFoodBigStation/Model/ProcessControl.cs index a71305ad..9a6bb512 100644 --- a/BPASmartClient.JXJFoodBigStation/Model/ProcessControl.cs +++ b/BPASmartClient.JXJFoodBigStation/Model/ProcessControl.cs @@ -351,7 +351,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model { if (SiemensDevice.IsConnected) { - return SiemensDevice.Siemens_PLC_S7.Read(Address); + return SiemensDevice.Siemens_PLC_S7.Read(Address); } else { @@ -373,7 +373,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model { if (HKDevice.IsConnected) { - return HKDevice.HK_PLC_S7.Read(Address); + return HKDevice.HK_PLC_S7.Read(Address); } else { diff --git a/BPASmartClient.S7Net/SiemensHelper.cs b/BPASmartClient.S7Net/SiemensHelper.cs index e221e93e..c5926b92 100644 --- a/BPASmartClient.S7Net/SiemensHelper.cs +++ b/BPASmartClient.S7Net/SiemensHelper.cs @@ -51,7 +51,7 @@ namespace BPASmartClient.S7Net public void Write(string address, TValue value) { - myPlc?.Write(address, value); + if (IsConnected) myPlc?.Write(address, value); } public TResult ReadClass(int db, int startByteAdr = 0) where TResult : class, new() diff --git a/DosingSystem/Model/DeviceInquire.cs b/DosingSystem/Model/DeviceInquire.cs index 4b21be78..40b697f6 100644 --- a/DosingSystem/Model/DeviceInquire.cs +++ b/DosingSystem/Model/DeviceInquire.cs @@ -98,7 +98,7 @@ namespace BPASmartClient.DosingSystem.Model public void Init() { - //TestData(); + TestData(); IpAddressLines(); DeviceDataInit(); ThreadManage.GetInstance().StartLong(new Action(() =>