From e4921e003cc293fea714bdaf74dc6a6b6b750295 Mon Sep 17 00:00:00 2001
From: wanshenmean <cathay_xy@163.com>
Date: 星期六, 25 四月 2026 16:20:51 +0800
Subject: [PATCH] Merge branch 'xiaoyang' into dev
---
Code/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_GradingMachine.cs | 60 ++++++++++++++++++++++++++++++++++--------------------------
1 files changed, 34 insertions(+), 26 deletions(-)
diff --git a/Code/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_GradingMachine.cs b/Code/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_GradingMachine.cs
index 29ecd75..23d3d27 100644
--- a/Code/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_GradingMachine.cs
+++ b/Code/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_GradingMachine.cs
@@ -49,12 +49,19 @@
if (stockInfo == null)
{
var location = await _locationInfoService.GetLocationInfoAsync(input.LocationCode);
- locationStatus = location?.LocationStatus ?? 0;
+ locationStatus = location?.LocationStatus == (int)LocationStatusEnum.InStock ? 10 : 0;
}
else
{
- locationStatus = stockInfo.LocationDetails?.LocationStatus ?? 0;
+ locationStatus = MapLocationStatus(stockInfo.StockStatus);
}
+
+ int MapLocationStatus(int stockStatus) => stockStatus switch
+ {
+ (int)StockStatusEmun.鍏ュ簱瀹屾垚 => 10,
+ (int)StockStatusEmun.绌烘墭鐩樺簱瀛� => 11,
+ _ => 0
+ };
OutputDto outPutDto = new OutputDto()
{
@@ -91,8 +98,8 @@
var result = await _locationInfoService.Db.Updateable<Dt_LocationInfo>()
.SetColumns(s => new Dt_LocationInfo
{
- LocationStatus = input.LocationStatus
- }).Where(s => s.LocationCode == input.LocationCode).ExecuteCommandAsync() > 0;
+ EnableStatus = input.LocationStatus == 1 ? 0 : 3,
+ }).Where(s => s.LocationCode == input.LocationCode && s.RoadwayNo == TaskAddressConstants.GRADING_RoadWayNo).ExecuteCommandAsync() > 0;
if (result)
{
@@ -127,40 +134,41 @@
var stock = await _stockInfoService.GetStockInfoAsync(input.PalletCode, input.LocationCode);
if (stock == null)
{
- content.Error("鏈壘鍒板搴旂殑鎵樼洏");
+ return content.Error("鏈壘鍒板搴旂殑鎵樼洏");
}
- else
- {
- var taskList = new Dt_Task
- {
- WarehouseId = stock.WarehouseId,
- PalletCode = stock.PalletCode,
- PalletType = stock.PalletType,
- SourceAddress = stock.LocationCode,
- CurrentAddress = stock.LocationCode,
- NextAddress = TaskAddressConstants.DEFAULT_ADDRESS,
- TargetAddress = TaskAddressConstants.GRADING_OUTBOUND_ADDRESS,
- Roadway = stock.LocationDetails.RoadwayNo,
- TaskType = TaskOutboundTypeEnum.Outbound.GetHashCode(),
- TaskStatus = TaskOutStatusEnum.OutNew.GetHashCode(),
- Grade = 1,
- TaskNum = await BaseDal.GetTaskNo(),
- Creater = "system",
- };
+ var taskList = new Dt_Task
+ {
+ WarehouseId = stock.WarehouseId,
+ PalletCode = stock.PalletCode,
+ PalletType = stock.PalletType,
+ SourceAddress = stock.LocationCode,
+ CurrentAddress = stock.LocationCode,
+ NextAddress = TaskAddressConstants.DEFAULT_ADDRESS,
+ TargetAddress = TaskAddressConstants.GRADING_OUTBOUND_ADDRESS,
+ Roadway = stock.LocationDetails.RoadwayNo,
+ TaskType = TaskOutboundTypeEnum.Outbound.GetHashCode(),
+ TaskStatus = TaskOutStatusEnum.OutNew.GetHashCode(),
+ Grade = 1,
+ TaskNum = await BaseDal.GetTaskNo(),
+ Creater = "system",
+ };
+
+ return await _unitOfWorkManage.BeginTranAsync(async () =>
+ {
var result = await BaseDal.AddDataAsync(taskList) > 0;
var wmstaskDto = result ? _mapper.Map<WMSTaskDTO>(taskList) : null;
var httpResponse = _httpClientHelper.Post<WebResponseContent>("http://logistics-service/api/logistics/notifyoutbound", JsonSerializer.Serialize(wmstaskDto)).Data;
if (result && httpResponse != null)
{
- content.OK("鍑哄簱璇锋眰鎴愬姛");
+ return content.OK("鍑哄簱璇锋眰鎴愬姛");
}
else
{
- content.Error("鍑哄簱璇锋眰澶辫触");
+ return content.Error("鍑哄簱璇锋眰澶辫触");
}
- }
+ });
}
catch (Exception ex)
{
--
Gitblit v1.9.3