| | |
| | | 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); |
| | |
| | | // 请求WMS空托盘任务 |
| | | CreateAndSendEmptyTrayTask(conveyorLine, command, childDeviceCode, ProtocalDetailValue); |
| | | } |
| | | else if ((conveyorLine.DeviceCode == "1001" && childDeviceCode == "1088")||(conveyorLine.DeviceCode == "1004" && childDeviceCode == "1339")) |
| | | else if ((conveyorLine.DeviceCode == "1001" && childDeviceCode == "1088") || (conveyorLine.DeviceCode == "1004" && childDeviceCode == "1339")) |
| | | { |
| | | // 请求WMS入库任务 |
| | | RequestWmsTask(conveyorLine, command, childDeviceCode, ProtocalDetailValue); |
| | |
| | | } |
| | | |
| | | // TODO调用WMS任务完成接口 |
| | | var result = HttpHelper.GetAsync("http://127.0.0.1:8098/api/Task/CompleteTaskAsync", new { taskNum = taskOut.TaskNum }.ToJsonString()).Result; |
| | | var keys = new Dictionary<string, object>() |
| | | { |
| | | {"taskNum", taskOut.TaskNum} |
| | | }; |
| | | var result = HttpHelper.GetAsync($"http://127.0.0.1:5000/api/Task/CompleteTaskAsync", keys).Result; |
| | | WebResponseContent content = JsonConvert.DeserializeObject<WebResponseContent>(result); |
| | | if (content.Status) |
| | | { |
| | |
| | | /// </summary> |
| | | private WMSTaskDTO CreateEmptyTrayTaskDto(string barcode, string childDeviceCode) |
| | | { |
| | | // 创建并返回空托盘任务DTO |
| | | //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() |
| | | { |
| | | Position = childDeviceCode, |
| | | PalletCode = barcode, |
| | | }; |
| | | var result = HttpHelper.PostAsync("http:127.0.0.1:8098/api/Task/RequestTaskAsync", request.ToJsonString()).Result; |
| | | var result = HttpHelper.PostAsync("http://127.0.0.1:5000/api/Task/RequestTrayInTaskAsync", request.ToJsonString()).Result; |
| | | if (result == null) |
| | | return wMSTaskDTO; |
| | | |
| | | WebResponseContent content = JsonConvert.DeserializeObject<WebResponseContent>(result); |
| | | |
| | | // 检查状态并返回 |
| | | if (!content.Status) |
| | | return wMSTaskDTO; |
| | |
| | | if (_taskService.RequestWMSTask(command.Barcode, childDeviceCode).Status) |
| | | { |
| | | // 查询任务 |
| | | Dt_Task task = _taskService.QueryConveyorLineTask(conveyorLine.DeviceCode, childDeviceCode); |
| | | Dt_Task task = _taskService.QueryBarCodeConveyorLineTask(command.Barcode, childDeviceCode); |
| | | if (task != null) |
| | | { |
| | | // 映射任务命令 |