From 4b483d9d06bead231b88ca212fd799196668a057 Mon Sep 17 00:00:00 2001
From: wanshenmean <cathay_xy@163.com>
Date: 星期二, 28 四月 2026 22:58:27 +0800
Subject: [PATCH] fix(任务服务): 修复出库任务选择逻辑和货位分配问题
---
Code/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/WCS/TaskService_Outbound.cs | 62 +++++++++++++++++++++++++++++-
1 files changed, 59 insertions(+), 3 deletions(-)
diff --git a/Code/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/WCS/TaskService_Outbound.cs b/Code/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/WCS/TaskService_Outbound.cs
index 1a085ab..48d5b2a 100644
--- a/Code/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/WCS/TaskService_Outbound.cs
+++ b/Code/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/WCS/TaskService_Outbound.cs
@@ -4,7 +4,10 @@
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;
using WIDESEA_Model.Models;
namespace WIDESEA_TaskInfoService
@@ -82,9 +85,24 @@
WebResponseContent content = new WebResponseContent();
return await _unitOfWorkManage.BeginTranAsync(async () =>
{
+ if (task.TaskType == (int)TaskOutboundTypeEnum.OutEmpty)
+ {
+ location.LocationStatus = LocationStatusEnum.Free.GetHashCode();
+
+ var updateResult = await _locationInfoService.UpdateLocationInfoAsync(location);
+ var deleteResult = _stockInfoService.DeleteData(stockInfo).Status;
+ if (!updateResult && !deleteResult)
+ return content.Error("浠诲姟瀹屾垚澶辫触");
+
+ var completeResult1 = await CompleteTaskAsync(task, "鍑哄簱瀹屾垚");
+ return content.OK();
+
+ }
+
stockInfo.LocationId = 0;
stockInfo.LocationCode = string.Empty;
stockInfo.OutboundDate = DateTime.Now;
+ stockInfo.StockStatus = (int)StockStatusEmun.鍑哄簱瀹屾垚;
location.LocationStatus = LocationStatusEnum.Free.GetHashCode();
@@ -102,12 +120,12 @@
TaskNum = await BaseDal.GetTaskNo(),
PalletCode = task.PalletCode,
PalletType = task.PalletType,
- Roadway = "CW1",
+ Roadway = "CWSC1",
TaskType = TaskInboundTypeEnum.Inbound.GetHashCode(),
TaskStatus = TaskInStatusEnum.InNew.GetHashCode(),
- SourceAddress = task.TargetAddress,
+ SourceAddress = "11042",
TargetAddress = task.TargetAddress,
- CurrentAddress = task.TargetAddress,
+ CurrentAddress = "11042",
NextAddress = task.TargetAddress,
WarehouseId = (int)WarehouseEnum.CW1,
Grade = 1,
@@ -117,6 +135,44 @@
inboundTaskDto = _mapper.Map<WMSTaskDTO>(inboundTask);
}
+ // 璋冪敤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;
+
+ var outboundRequest = new OutboundInContainerRequest
+ {
+ EquipmentCode = equipmentCode,
+ ResourceCode = resourceCode,
+ LocalTime = DateTime.Now,
+ ContainerCode = taskDto.PalletCode
+ };
+ 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 ?? "鏈煡閿欒",
+ _mesService.BuildConfig(token ?? string.Empty).ToJson()
+ );
+ });
+
var completeResult = await CompleteTaskAsync(task, "鍑哄簱瀹屾垚");
if (!completeResult.Status)
return completeResult;
--
Gitblit v1.9.3