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_Tray.cs | 32 +++++++++++++++++---------------
1 files changed, 17 insertions(+), 15 deletions(-)
diff --git a/Code/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/WCS/TaskService_Tray.cs b/Code/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/WCS/TaskService_Tray.cs
index 51d6888..23f06b6 100644
--- a/Code/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/WCS/TaskService_Tray.cs
+++ b/Code/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/WCS/TaskService_Tray.cs
@@ -51,14 +51,14 @@
var stockInfo = await _stockInfoService.GetStockInfoAsync(taskDto.PalletCode);
if (stockInfo == null) return WebResponseContent.Instance.Error("鏈壘鍒板搴斿簱瀛樹俊鎭�");
+ stockInfo.LocationCode = location.LocationCode;
+ stockInfo.LocationId = location.Id;
+ stockInfo.StockStatus = StockStatusEmun.绌烘墭鐩樺簱瀛�.GetHashCode();
+
+ location.LocationStatus = LocationStatusEnum.InStock.GetHashCode();
+
return await _unitOfWorkManage.BeginTranAsync(async () =>
{
- stockInfo.LocationCode = location.LocationCode;
- stockInfo.LocationId = location.Id;
- stockInfo.StockStatus = StockStatusEmun.绌烘墭鐩樺簱瀛�.GetHashCode();
-
- location.LocationStatus = LocationStatusEnum.InStock.GetHashCode();
-
var updateLocationResult = await _locationInfoService.UpdateLocationInfoAsync(location);
var updateStockResult = await _stockInfoService.UpdateStockAsync(stockInfo);
if (!updateLocationResult || !updateStockResult)
@@ -100,7 +100,7 @@
return WebResponseContent.Instance.OK("浠诲姟鍒涘缓鎴愬姛", taskDTO);
}
- var stockInfo = await _stockInfoService.Repository.QueryDataNavFirstAsync(x => x.LocationDetails.WarehouseId == taskDto.WarehouseId && x.LocationDetails.LocationStatus == LocationStatusEnum.InStock.GetHashCode() && x.StockStatus == StockStatusEmun.绌烘墭鐩樺簱瀛�.GetHashCode());
+ var stockInfo = await _stockInfoService.Repository.QueryDataNavFirstAsync(x => x.LocationDetails.WarehouseId == taskDto.WarehouseId && x.LocationDetails.LocationStatus == LocationStatusEnum.InStock.GetHashCode() && x.StockStatus == StockStatusEmun.绌烘墭鐩樺簱瀛�.GetHashCode() && x.LocationDetails.EnableStatus == (int)EnableStatusEnum.Normal);
if (stockInfo == null)
return WebResponseContent.Instance.Error("鏈壘鍒板搴旂殑搴撳瓨淇℃伅");
@@ -117,6 +117,7 @@
TaskType = TaskOutboundTypeEnum.OutEmpty.GetHashCode(),
TaskStatus = TaskStatusEnum.New.GetHashCode(),
Grade = 1,
+ Dispatchertime = DateTime.Now,
TaskNum = await BaseDal.GetTaskNo(),
Creater = "system",
};
@@ -150,10 +151,10 @@
{
try
{
- var task = await BaseDal.QueryFirstAsync(s => s.PalletCode == taskDto.PalletCode);
- if (task == null) return WebResponseContent.Instance.Error("鏈壘鍒板搴旂殑浠诲姟");
+ //var task = await BaseDal.QueryFirstAsync(s => s.PalletCode == taskDto.PalletCode);
+ //if (task == null) return WebResponseContent.Instance.Error("鏈壘鍒板搴旂殑浠诲姟");
- var location = await _locationInfoService.GetLocationInfo(task.Roadway, task.SourceAddress);
+ var location = await _locationInfoService.GetLocationInfo(taskDto.Roadway, taskDto.SourceAddress);
if (location == null) return WebResponseContent.Instance.Error("鏈壘鍒板搴旂殑璐т綅");
var stockInfo = await _stockInfoService.GetStockInfoAsync(taskDto.PalletCode);
@@ -167,21 +168,22 @@
location.LocationStatus = LocationStatusEnum.Free.GetHashCode();
+
var updateLocationResult = await _locationInfoService.UpdateLocationInfoAsync(location);
var updateStockResult = await _stockInfoService.UpdateStockAsync(stockInfo);
if (!updateLocationResult || !updateStockResult)
return WebResponseContent.Instance.Error("浠诲姟瀹屾垚澶辫触");
- var saveTaskHistoryResult = await SaveTaskHistoryAsync(task, "绌烘墭鐩樺嚭搴撳畬鎴�");
- if (!saveTaskHistoryResult.Status)
- return saveTaskHistoryResult;
+ //var saveTaskHistoryResult = await SaveTaskHistoryAsync(task, "绌烘墭鐩樺嚭搴撳畬鎴�");
+ //if (!saveTaskHistoryResult.Status)
+ // return saveTaskHistoryResult;
var saveStockHistoryResult = await SaveStockHistoryAsync(stockInfo, "绌烘墭鐩樺嚭搴撳畬鎴�");
if (!saveStockHistoryResult.Status)
return saveStockHistoryResult;
- var deleteResult = await BaseDal.DeleteDataAsync(task);
- if (!deleteResult) return WebResponseContent.Instance.Error("浠诲姟瀹屾垚澶辫触");
+ //var deleteResult = await BaseDal.DeleteDataAsync(task);
+ //if (!deleteResult) return WebResponseContent.Instance.Error("浠诲姟瀹屾垚澶辫触");
return WebResponseContent.Instance.OK("浠诲姟瀹屾垚");
});
--
Gitblit v1.9.3