chengsc
2024-09-12 4683c8a19e593e8f999c6f1a145e0bb73eb20dea
Admin.NET/WCS.Application/PLC/PLCTaskAction.cs
@@ -25,7 +25,7 @@
    private static List<WcsPlc> listPlc = new List<WcsPlc>();
    private static List<WcsDevice> listPlcDevice = new List<WcsDevice>();
    private static List<WcsPosition> listPlcStation = new List<WcsPosition>();
    private static List<WcsPosition> listPlcPosition = new List<WcsPosition>();
    private static List<WcsAlarmInfo> listAlarmInfo = new List<WcsAlarmInfo>();
    private static List<PLCUtil> listPlcUtil = new List<PLCUtil>();
@@ -36,16 +36,14 @@
        get { return listPlcUtil; }
    }
    // 交互点集合
    public static List<WcsDevice> plcDevices
    public static List<WcsDevice> plcDevices
    {
        get { return listPlcDevice; }
    }
    // 交互点集合
    public static List<WcsPosition> plcStation
    public static List<WcsPosition> plcPositions
    {
        get { return listPlcStation; }
        get { return listPlcPosition; }
    }
    public static event EventHandler DeviceValueChangeEvent;
    static PLCTaskAction()
    {
@@ -64,7 +62,7 @@
        cts.Cancel();
        listPlc = _db.Queryable<WcsPlc>().Where(s => s.Type == PLCTypeEnum.StackingMachine || s.Type == PLCTypeEnum.ConveyorLine || s.Type == PLCTypeEnum.BoxConveyorLine).ToList();
        listPlcDevice = _db.Queryable<WcsDevice>().ToList();
        listPlcStation = _db.Queryable<WcsPosition>().ToList();
        listPlcPosition = _db.Queryable<WcsPosition>().ToList();
        listAlarmInfo = _db.Queryable<WcsAlarmInfo>().ToList();
        //等待几秒钟,把已有线程取消掉再连接
        //Thread.Sleep(5000);
@@ -156,7 +154,7 @@
                                dto.Value = value;
                                dto.Type = _modplc.Type;
                                dto.PLCUtil = modPlcUtil;
                                dto.listStation = listPlcStation.Where(s => s.DeviceId == modDevice.Id).ToList();
                                dto.listStation = listPlcPosition.Where(s => s.DeviceId == modDevice.Id).ToList();
                                dto.listDevice = listDevice.Where(s => s.StationNum == modDevice.StationNum && s.Level == DeviceLevelEnum.Station).ToList();
                                //这里触发值变更事件
                                DeviceValueChangeEvent?.Invoke(dto, EventArgs.Empty);