wanshenmean
23 小时以前 314076388f664f8ce1a1d19c4c9717fe54634e05
Code/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/WCS/TaskService_Inbound.cs
@@ -6,6 +6,7 @@
using WIDESEA_Core;
using WIDESEA_DTO.MES;
using WIDESEA_DTO.Task;
using WIDESEA_IBasicService;
using WIDESEA_Model.Models;
namespace WIDESEA_TaskInfoService
@@ -150,15 +151,26 @@
                    var updateStockResult = await _stockInfoService.UpdateStockAsync(stockInfo);
                    if (!updateLocationResult || !updateStockResult)
                        return WebResponseContent.Instance.Error("任务完成失败");
                    // 根据库存Remark选择静置设备,查MES动态凭证
                    string deviceName = stockInfo.Remark == "GW_1" ? "高温静置1"
                        : stockInfo.Remark == "GW_2" ? "高温静置2"
                        : "常温静置1";
                    var mesConfig = _mesDeviceConfigService.GetByDeviceName(deviceName);
                    string equipmentCode = mesConfig?.EquipmentCode ?? StockConstants.MES_EQUIPMENT_CODE;
                    string resourceCode = mesConfig?.ResourceCode ?? StockConstants.MES_RESOURCE_CODE;
                    string token = mesConfig?.Token;
                    // 调用MES托盘进站
                    var inboundRequest = new InboundInContainerRequest
                    {
                        EquipmentCode = "STK-GROUP-001",
                        ResourceCode = "STK-GROUP-001",
                        EquipmentCode = equipmentCode,
                        ResourceCode = resourceCode,
                        LocalTime = DateTime.Now,
                        ContainerCode = taskDto.PalletCode
                    };
                    var inboundResult = _mesService.InboundInContainer(inboundRequest);
                    var inboundResult = string.IsNullOrWhiteSpace(token)
                        ? _mesService.InboundInContainer(inboundRequest)
                        : _mesService.InboundInContainer(inboundRequest, token);
                    if (inboundResult == null || inboundResult.Data == null || !inboundResult.Data.IsSuccess)
                    {
                        return content.Error($"任务完成失败:MES进站失败: {inboundResult?.Data?.Msg ?? inboundResult?.ErrorMessage ?? "未知错误"}");