| | |
| | | { |
| | | try |
| | | { |
| | | if (!x.DeviceName.Contains("机械手")) |
| | | if (!x.DevicePlcType.Contains("Socket")) |
| | | { |
| | | #region 连接PLC |
| | | |
| | |
| | | }).ToList(); |
| | | |
| | | // 根据设备类型获取设备协议详情 |
| | | List<DeviceProtocolDetailDTO> deviceProtocolDetails = _deviceProtocolDetailService.GetDeviceProtocolDetailsByDeviceType(x.DeviceType); |
| | | List<DeviceProtocolDetailDTO> deviceProtocolDetails = _deviceProtocolDetailService.GetDeviceProtocolDetailsByDeviceId(x.Id); |
| | | |
| | | // 加载设备程序集 |
| | | Assembly assemblyDevice = Assembly.Load($"WIDESEAWCS_QuartzJob"); |
| | |
| | | }); |
| | | for (int i = 0; i < dispatches.Count; i++) |
| | | { |
| | | var targetDevice = deviceInfos.FirstOrDefault(x => x.Id == dispatches[i].Id); |
| | | var targetDevice = deviceInfos.FirstOrDefault(x => x.DispatchId == dispatches[i].Id); |
| | | |
| | | if (targetDevice is null) continue; |
| | | |
| | | // 使用模式匹配 |
| | | dispatches[i].JobParams = targetDevice switch |
| | | { |
| | | { DeviceName: var name } when name.Contains("机械手") |
| | | { DevicePlcType: var type } when type.Contains("Socket") |
| | | => new RobotCraneDevice { DeviceCode = targetDevice.DeviceCode, DeviceName = targetDevice.DeviceName, IPAddress = targetDevice.DeviceIp + ":" + targetDevice.DevicePort }, |
| | | _ => targetDevice.Device |
| | | }; |