| | |
| | | using WIDESEAWCS_Tasks.ConveyorLineJob; |
| | | using HslCommunication; |
| | | using OfficeOpenXml.ConditionalFormatting; |
| | | using WIDESEAWCS_DTO.WMS; |
| | | |
| | | namespace WIDESEAWCS_Tasks |
| | | { |
| | | partial class CommonConveyorLineJob |
| | | public partial class CommonConveyorLineJob |
| | | { |
| | | /// <summary> |
| | | /// 处理出库任务 |
| | |
| | | bool isOutboundAndOutFinish = taskOut.TaskType == (int)TaskOutboundTypeEnum.Outbound && taskOut.TaskState == (int)TaskOutStatusEnum.SC_OutFinish; |
| | | bool isOutboundAndLineOutExecuting = taskOut.TaskType == (int)TaskOutboundTypeEnum.Outbound && taskOut.TaskState == (int)TaskOutStatusEnum.Line_OutExecuting; |
| | | |
| | | if (isOutTray || isOutboundAndOutFinish || isOutboundAndLineOutExecuting) |
| | | if (isOutTray || isOutboundAndOutFinish || !isOutboundAndLineOutExecuting) |
| | | { |
| | | // 发送命令到输送线 |
| | | conveyorLine.SendCommand(taskCommand, childDeviceCode); |
| | |
| | | private void HandleNewTask(CommonConveyorLine conveyorLine, ConveyorLineTaskCommand command, string childDeviceCode, int ProtocalDetailValue) |
| | | { |
| | | // 特定条件下创建并发送空托盘入库任务 |
| | | if (conveyorLine.DeviceCode == "1003" && childDeviceCode == "1016") |
| | | if ((conveyorLine.DeviceCode == "1003" && childDeviceCode == "1016") || (conveyorLine.DeviceCode == "1005" && childDeviceCode == "1048")) |
| | | { |
| | | // 请求WMS空托盘任务 |
| | | CreateAndSendEmptyTrayTask(conveyorLine, command, childDeviceCode, ProtocalDetailValue); |
| | | } |
| | | else if (conveyorLine.DeviceCode == "1001" && childDeviceCode == "1088") |
| | | else if ((conveyorLine.DeviceCode == "1001" && childDeviceCode == "1088")||(conveyorLine.DeviceCode == "1004" && childDeviceCode == "1339")) |
| | | { |
| | | // 请求WMS任务 |
| | | // 请求WMS入库任务 |
| | | RequestWmsTask(conveyorLine, command, childDeviceCode, ProtocalDetailValue); |
| | | } |
| | | else if ((conveyorLine.DeviceCode == "1001" && childDeviceCode == "1073") || (conveyorLine.DeviceCode == "1003" && childDeviceCode == "1002")) |
| | |
| | | /// <summary> |
| | | /// 创建并发送空托盘任务 |
| | | /// </summary> |
| | | private void CreateAndSendEmptyTrayTask(CommonConveyorLine conveyorLine, ConveyorLineTaskCommand command, string childDeviceCode, int ProtocalDetailValue) |
| | | public void CreateAndSendEmptyTrayTask(CommonConveyorLine conveyorLine, ConveyorLineTaskCommand command, string childDeviceCode, int ProtocalDetailValue) |
| | | { |
| | | if (command.Barcode != "NoRead") |
| | | { |
| | |
| | | private WMSTaskDTO CreateEmptyTrayTaskDto(string barcode, string childDeviceCode) |
| | | { |
| | | // 创建并返回空托盘任务DTO |
| | | return new WMSTaskDTO |
| | | //return new WMSTaskDTO |
| | | //{ |
| | | // TaskNum = Convert.ToInt32(DateTime.Now.ToString("HHmmss")), |
| | | // Grade = 1, |
| | | // PalletCode = barcode, |
| | | // RoadWay = "JZSC01", |
| | | // SourceAddress = childDeviceCode, |
| | | // TargetAddress = "JZSC01", |
| | | // TaskState = (int)TaskInStatusEnum.InNew, |
| | | // Id = 0, |
| | | // TaskType = (int)TaskInboundTypeEnum.InTray, |
| | | //}; |
| | | |
| | | #region 向WMS请求空托盘任务 |
| | | |
| | | WMSTaskDTO wMSTaskDTO = new WMSTaskDTO(); |
| | | RequestTaskDto request = new RequestTaskDto() |
| | | { |
| | | TaskNum = Convert.ToInt32(DateTime.Now.ToString("HHmmss")), |
| | | Grade = 1, |
| | | Position = childDeviceCode, |
| | | PalletCode = barcode, |
| | | RoadWay = "CHSC01", |
| | | SourceAddress = childDeviceCode, |
| | | TargetAddress = "CHSC01", |
| | | TaskState = (int)TaskInStatusEnum.InNew, |
| | | Id = 0, |
| | | TaskType = (int)TaskInboundTypeEnum.InTray, |
| | | }; |
| | | var result = HttpHelper.PostAsync("http:127.0.0.1:8098/api/Task/RequestTaskAsync", request.ToJsonString()).Result; |
| | | |
| | | WebResponseContent content = JsonConvert.DeserializeObject<WebResponseContent>(result); |
| | | |
| | | // 检查状态并返回 |
| | | if (!content.Status) |
| | | return wMSTaskDTO; |
| | | |
| | | return JsonConvert.DeserializeObject<WMSTaskDTO>(content.Data.ToString()); |
| | | |
| | | #endregion 向WMS请求空托盘任务 |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |