| | |
| | | using WIDESEA_Common.TaskEnum; |
| | | using WIDESEA_Common.WareHouseEnum; |
| | | using WIDESEA_Core; |
| | | using WIDESEA_Core.Helper; |
| | | using WIDESEA_DTO.MES; |
| | | using WIDESEA_DTO.Task; |
| | | using WIDESEA_IBasicService; |
| | |
| | | LocalTime = DateTime.Now, |
| | | ContainerCode = taskDto.PalletCode |
| | | }; |
| | | var outboundResult = string.IsNullOrWhiteSpace(token) |
| | | ? _mesService.OutboundInContainer(outboundRequest) |
| | | : _mesService.OutboundInContainer(outboundRequest, token); |
| | | if (outboundResult == null || outboundResult.Data == null || !outboundResult.Data.IsSuccess) |
| | | { |
| | | return content.Error($"出库完成失败:MES出站失败: {outboundResult?.Data?.Msg ?? outboundResult?.ErrorMessage ?? "未知错误"}"); |
| | | } |
| | | string palletCode = taskDto.PalletCode; |
| | | string requestJson = outboundRequest.ToJson(); |
| | | |
| | | // Fire-and-forget: 异步执行MES出站,不阻塞主业务逻辑 |
| | | _mesUploadHelper.FireAndForget( |
| | | palletCode, |
| | | MesUploadStatusEnum.出站上传成功, |
| | | "OutboundInContainer", |
| | | requestJson, |
| | | () => |
| | | { |
| | | var result = string.IsNullOrWhiteSpace(token) |
| | | ? _mesService.OutboundInContainer(outboundRequest) |
| | | : _mesService.OutboundInContainer(outboundRequest, token); |
| | | return ( |
| | | result?.Data?.IsSuccess ?? false, |
| | | Newtonsoft.Json.JsonConvert.SerializeObject(result), |
| | | result?.Data?.Msg ?? result?.ErrorMessage ?? "未知错误" |
| | | ); |
| | | }); |
| | | |
| | | var completeResult = await CompleteTaskAsync(task, "出库完成"); |
| | | if (!completeResult.Status) |