wxw
2024-09-23 3d2f1d836cd271a51f0c02b99f538070a783139d
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;//取消线程标识
@@ -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>();