| | |
| | | private static List<WcsStation> listPlcStation; |
| | | |
| | | private static List<PLCUtil> listPlcUtil = new List<PLCUtil>(); |
| | | private static CancellationTokenSource cts = new CancellationTokenSource();//取消线程标识 |
| | | private static CancellationTokenSource cts;//取消线程标识 |
| | | |
| | | public static event EventHandler DeviceValueChangeEvent; |
| | | static PLCTaskAction() |
| | |
| | | var (result, value) = modPlcUtil.GetPlcDBValue(modDevice.PosType.Value, modDevice.DbNumber, modDevice.PlcPos); |
| | | if (result.IsSucceed) |
| | | { |
| | | if (value != 0) |
| | | { |
| | | var dto = modDevice.Adapt<WcsDeviceDto>(); |
| | | dto.Value = value; |
| | | dto.Type = _modplc.Type; |
| | | dto.PLCUtil = modPlcUtil; |
| | | dto.listStation = listPlcStation.Where(s => s.DeviceId == modDevice.Id).ToList(); |
| | | //这里触发值变更事件 |
| | | DeviceValueChangeEvent?.Invoke(dto, EventArgs.Empty); |
| | | } |
| | | //if (value != 0) |
| | | //{ |
| | | var dto = modDevice.Adapt<WcsDeviceDto>(); |
| | | dto.Value = value; |
| | | dto.Type = _modplc.Type; |
| | | dto.PLCUtil = modPlcUtil; |
| | | dto.listStation = listPlcStation.Where(s => s.DeviceId == modDevice.Id).ToList(); |
| | | //这里触发值变更事件 |
| | | DeviceValueChangeEvent?.Invoke(dto, EventArgs.Empty); |
| | | //} |
| | | } |
| | | else |
| | | { |