From 60328b34b853959613f8c97567b4a1ba934a15a9 Mon Sep 17 00:00:00 2001 From: IPC-610 <IPC-610@DESKTOP-6LEOOS3> Date: 星期日, 22 九月 2024 17:36:39 +0800 Subject: [PATCH] 修改问题 --- Admin.NET/WCS.Application/Hub/PlcDeviceHub.cs | 8 +++----- 1 files changed, 3 insertions(+), 5 deletions(-) diff --git a/Admin.NET/WCS.Application/Hub/PlcDeviceHub.cs b/Admin.NET/WCS.Application/Hub/PlcDeviceHub.cs index 988502b..7a2c8ff 100644 --- a/Admin.NET/WCS.Application/Hub/PlcDeviceHub.cs +++ b/Admin.NET/WCS.Application/Hub/PlcDeviceHub.cs @@ -16,7 +16,6 @@ [MapHub("/hubs/PlcDevice")] public class PlcDeviceHub : Hub<IPlcDeviceHub> { - private static readonly IHubContext<PlcDeviceHub, IPlcDeviceHub> _plcDeviceHubContext = App.GetService<IHubContext<PlcDeviceHub, IPlcDeviceHub>>(); private static readonly SysCacheService _sysCacheService = App.GetRequiredService<SysCacheService>(); private static bool boRunningState = false; private static CancellationTokenSource cts;//鍙栨秷绾跨▼鏍囪瘑 @@ -71,7 +70,7 @@ // 鐢ㄤ簬淇濆瓨姣忎釜璁惧鐨勫垵濮嬬姸鎬� var initialStates = new Dictionary<long, WcsDeviceOutput>(); - var listPlc = _db.Queryable<WcsPlc>().Where(s => s.Type == PLCTypeEnum.StackingMachine || s.Type == PLCTypeEnum.ConveyorLine).ToList(); + var listPlc = _db.Queryable<WcsPlc>().Where(s => s.Type == PLCTypeEnum.StackingMachine || s.Type == PLCTypeEnum.ConveyorLine).Where(s => s.Enable == YesNoEnum.Y).ToList(); var listPlcId = listPlc.Select(s => s.Id).ToList(); var listPlcDevice = _db.Queryable<WcsDevice>().Where(s => s.DeviceType == DeviceTypeEnum.Business && listPlcId.Contains(s.PlcId)).Select<WcsDeviceOutput>().ToList(); var listPlcDeviceId = listPlcDevice.Select(s => s.Id).ToList(); @@ -142,7 +141,6 @@ { (result, var palletNo) = modConn.GetPlcDBValue(modPositionPalletNo.PosType, modDevice.DbNumber, modPositionPalletNo.PlcPos, modPositionPalletNo.StringLength); modDevice.PalletNo = Convert.ToString(palletNo); - Console.WriteLine(modDevice.DbNumber + "." + modPositionPalletNo.PlcPos + "----------"); } if (modPlc.Type == PLCTypeEnum.ConveyorLine) { @@ -204,7 +202,7 @@ if (initialStates.TryGetValue(modDevice.Id, out var initialState)) { if (modDevice.Status != initialState.Status || - modDevice.Plc != initialState.Plc || + (modDevice.Plc.IsNullOrEmpty() && modDevice.Plc != initialState.Plc) || modDevice.Wcs != initialState.Wcs || modDevice.TaskNo != initialState.TaskNo || modDevice.TaskType != initialState.TaskType || @@ -220,7 +218,7 @@ modDevice.PickStorey != initialState.PickStorey))) { // 閫氱煡鐢ㄦ埛鍙樻洿 - _plcDeviceHubContext.Clients.All.PublicPlcDevice(modDevice); + HubUtil.PublicPlcDevice(modDevice); } } initialStates[modDevice.Id] = modDevice.Adapt<WcsDeviceOutput>(); -- Gitblit v1.8.0