From b4083a6b047fc9e0964133c87227213c5154e37a Mon Sep 17 00:00:00 2001 From: IPC-610 <IPC-610@DESKTOP-6LEOOS3> Date: 星期三, 15 一月 2025 15:47:44 +0800 Subject: [PATCH] 11111111 --- Admin.NET/WCS.Application/PLC/PLCTaskAction.cs | 15 ++++++++------- 1 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Admin.NET/WCS.Application/PLC/PLCTaskAction.cs b/Admin.NET/WCS.Application/PLC/PLCTaskAction.cs index 3a30f2c..451a68d 100644 --- a/Admin.NET/WCS.Application/PLC/PLCTaskAction.cs +++ b/Admin.NET/WCS.Application/PLC/PLCTaskAction.cs @@ -69,7 +69,7 @@ /// </summary> public static void Init() { - // var strMsg = new HttpService().RequestPackWcs("LN000001"); + // var strMsg = new HttpService().RequestPackWcs("LN000001"); cts.Cancel(); listPlc = _db.Queryable<WcsPlc>() .Where(s => s.Type == PLCTypeEnum.StackingMachine || s.Type == PLCTypeEnum.ConveyorLine || s.Type == PLCTypeEnum.BoxConveyorLine) @@ -162,7 +162,7 @@ { //Console.WriteLine($"{modPlc.IP}璇诲彇{modDevice.DbNumber}.{modDevice.PlcPos}鐨勫�间负锛歿value}"); //鏃犳祦绋嬭烦鍑� - if (value == 0 )// && modPlc.Type!= PLCTypeEnum.BoxConveyorLine + if (value == 0)// && modPlc.Type!= PLCTypeEnum.BoxConveyorLine continue; var dto = modDevice.Adapt<WcsDeviceDto>(); dto.Value = value; @@ -316,7 +316,7 @@ listPulish.Add(modAlarm); } //鍙栨秷鎶ヨ - else if (value && modAlarm.Status == YesNoEnum.Y) + else if (!value && modAlarm.Status == YesNoEnum.Y) { modAlarm.AlarmTime = null; modAlarm.Status = YesNoEnum.N; @@ -333,7 +333,8 @@ modLog.Id = 0; listLog.Add(modLog); } - _db.Insertable(listLog).ExecuteCommand(); + if (listLog.Count >= 0) + _db.Insertable(listLog).ExecuteCommand(); HubUtil.PublicAlarm(listPulish); } } @@ -375,8 +376,8 @@ if (modPlcUtil == null) continue; var plcIp = modPlcUtil.PlcIP; - var listDevice = listPlcDevice.Where(s => s.PlcId == modPlcUtil.PlcId && s.DeviceType == DeviceTypeEnum.Show).ToList(); - var modPlc = listPlc.FirstOrDefault(s => s.Id == modPlcUtil.PlcId); + var listDevice = listPlcDevice.Where(s => s.PlcId == modPlcUtil.PlcId && s.DeviceType == DeviceTypeEnum.Show).ToList(); + var modPlc = listPlc.FirstOrDefault(s => s.Id == modPlcUtil.PlcId); var listaddress = new Dictionary<string, PLCDataTypeEnum>(); foreach (var modDevice in listDevice) { @@ -435,7 +436,7 @@ { bl = false; } - else + else { bl = true; } -- Gitblit v1.8.0