| | |
| | | var stockInfo = await _stockInfoService.GetStockInfoAsync(taskDto.PalletCode); |
| | | if (stockInfo == null) return WebResponseContent.Instance.Error("未找到对应库存信息"); |
| | | |
| | | WebResponseContent content = new WebResponseContent(); |
| | | return await ExecuteWithinTransactionAsync(async () => |
| | | { |
| | | stockInfo.LocationId = 0; |
| | |
| | | var updateStockResult = await _stockInfoService.UpdateStockAsync(stockInfo); |
| | | if (!updateLocationResult || !updateStockResult) |
| | | return WebResponseContent.Instance.Error("任务完成失败"); |
| | | |
| | | // 调用MES托盘出站 |
| | | var outboundRequest = new OutboundInContainerRequest |
| | | { |
| | | EquipmentCode = "STK-GROUP-001", |
| | | ResourceCode = "STK-GROUP-001", |
| | | LocalTime = DateTime.Now, |
| | | ContainerCode = taskDto.PalletCode, |
| | | ParamList = new List<ParamItem>() |
| | | }; |
| | | var outboundResult = _mesService.OutboundInContainer(outboundRequest); |
| | | if (outboundResult == null || outboundResult.Data == null || !outboundResult.Data.IsSuccess) |
| | | { |
| | | return content.Error($"任务完成失败:MES出站失败: {outboundResult?.Data?.Msg ?? outboundResult?.ErrorMessage ?? "未知错误"}"); |
| | | } |
| | | |
| | | return await CompleteTaskAsync(task); |
| | | }); |
| | | } |