| | |
| | | } |
| | | var listDevice = listPlcDevice.Where(s => s.PlcId == _modplc.Id).ToList(); |
| | | //循环读设备 |
| | | foreach (var modDevice in listDevice) |
| | | foreach (var modDevice in listDevice.Where(s => s.Level == DeviceLevelEnum.DB)) |
| | | { |
| | | var (result, value) = modPlcUtil.GetPlcDBValue(modDevice.PosType.Value, modDevice.DbNumber, modDevice.PlcPos); |
| | | if (result.IsSucceed) |
| | | { |
| | | //if (value != 0) |
| | | //{ |
| | | //无流程跳出 |
| | | if (value == 0) |
| | | continue; |
| | | 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(); |
| | | dto.listDevice = listDevice.Where(s => s.StationNum == modDevice.StationNum).ToList(); |
| | | //这里触发值变更事件 |
| | | DeviceValueChangeEvent?.Invoke(dto, EventArgs.Empty); |
| | | //} |
| | | } |
| | | else |
| | | { |