From 57a4c1da029cc9cbbf431e24ff23e5525ff341e8 Mon Sep 17 00:00:00 2001
From: yangpeixing <yangpeixing@hnkhzn.com>
Date: 星期四, 30 四月 2026 17:01:35 +0800
Subject: [PATCH] 1
---
WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs | 194 +++++++++++++++++++++++++++++++++++-------------
1 files changed, 141 insertions(+), 53 deletions(-)
diff --git a/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs b/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs
index a5d8808..28cba13 100644
--- a/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs
+++ b/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs
@@ -813,7 +813,14 @@
// 鍒ゆ柇Success鐨勫��
if (!response.Success)
{
+ WriteLog.Write_Log("API", "鍏ュ簱鈥斿洖璋僑MOM(澶辫触)", "璇锋眰澶辫触", new { 璇锋眰鎶ユ枃 = houseInboundPassBack, 鎺ユ敹鎶ユ枃 = response });
+
throw new Exception($"鎿嶄綔澶辫触: {response.Message ?? "鏈彁渚涢敊璇俊鎭�"}");
+ }
+ else
+ {
+ WriteLog.Write_Log("API", "鍏ュ簱鈥斿洖璋僑MOM(鎴愬姛)", "璇锋眰鎴愬姛", new { 璇锋眰鎶ユ枃 = houseInboundPassBack, 鎺ユ敹鎶ユ枃 = response });
+
}
}
@@ -891,7 +898,14 @@
var response = HttpHelper.Post<MomRequestContent>(ReceiveWMSTaskAllocatein, inventoryAllocate, "璋冩嫧鍏ュ簱鏁伴噺鍥炰紶WMS");
if (!response.Success)
{
+ WriteLog.Write_Log("API", "鍏ュ簱鈥斿洖璋僑MOM(澶辫触)", "璇锋眰澶辫触", new { 璇锋眰鎶ユ枃 = inventoryAllocate, 鎺ユ敹鎶ユ枃 = response });
+
throw new Exception($"鎿嶄綔澶辫触锛歿response.Message ?? "鏈彁渚涢敊璇俊鎭�"}");
+ }
+ else
+ {
+ WriteLog.Write_Log("API", "鍏ュ簱鈥斿洖璋僑MOM(鎴愬姛)", "璇锋眰鎴愬姛", new { 璇锋眰鎶ユ枃 = inventoryAllocate, 鎺ユ敹鎶ユ枃 = response });
+
}
}
}
@@ -953,16 +967,23 @@
if (authResult.IsSuccess)
{
houseSyncretism.Context = new Dictionary<string, string>
- {
- { "Ticket", authResult.Ticket },
- { "InvOrgId", authResult.InvOrgId }
+ {
+ { "Ticket", authResult.Ticket },
+ { "InvOrgId", authResult.InvOrgId }
- };
+ };
var response = HttpHelper.Post<MomRequestContent>(ReceiveWMSTaskin, houseSyncretism, "绔嬪簱鍏ュ簱鏁伴噺鍥炰紶WMS");
if (!response.Success)
{
+ WriteLog.Write_Log("API", "鍏ュ簱鈥斿洖璋僑MOM(澶辫触)", "璇锋眰澶辫触", new { 璇锋眰鎶ユ枃 = houseSyncretism, 鎺ユ敹鎶ユ枃 = response });
+
throw new Exception($"鎿嶄綔澶辫触: {response.Message ?? "鏈彁渚涢敊璇俊鎭�"}");
+ }
+ else
+ {
+ WriteLog.Write_Log("API", "鍏ュ簱鈥斿洖璋僑MOM(鎴愬姛)", "璇锋眰鎴愬姛", new { 璇锋眰鎶ユ枃 = houseSyncretism, 鎺ユ敹鎶ユ枃 = response });
+
}
}
@@ -1502,20 +1523,24 @@
if (authResult.IsSuccess)
{
houseInboundPassBack.Context = new Dictionary<string, string>
- {
- { "Ticket", authResult.Ticket },
- { "InvOrgId", authResult.InvOrgId }
- };
+ {
+ { "Ticket", authResult.Ticket },
+ { "InvOrgId", authResult.InvOrgId }
+ };
var response = HttpHelper.Post<MomRequestContent>(ReceiveWMSTaskin, houseInboundPassBack, "绔嬪簱鍏ュ簱鏁伴噺鍥炰紶WMS");
// 鍒ゆ柇Success鐨勫��
if (response.Success)
{
+ WriteLog.Write_Log("API", "鍏ュ簱鈥斿洖璋僑MOM(鎴愬姛)", "璇锋眰鎴愬姛", new { 璇锋眰鎶ユ枃 = houseInboundPassBack, 鎺ユ敹鎶ユ枃 = response });
+
// 濡傛灉Success涓簍rue锛岃繑鍥為渶瑕佺殑鍊硷紙杩欓噷浠ヨ繑鍥炴暣涓搷搴斿璞′负渚嬶級
return WebResponseContent.Instance.OK();
}
else
{
+ WriteLog.Write_Log("API", "鍏ュ簱鈥斿洖璋僑MOM(澶辫触)", "璇锋眰澶辫触", new { 璇锋眰鎶ユ枃 = houseInboundPassBack, 鎺ユ敹鎶ユ枃 = response });
+
// 濡傛灉Success涓篺alse锛屾姏鍑哄紓甯稿苟鍖呭惈閿欒淇℃伅
throw new Exception($"鎿嶄綔澶辫触: {response.Message ?? "鏈彁渚涢敊璇俊鎭�"}");
}
@@ -1562,19 +1587,23 @@
if (authResult.IsSuccess)
{
houseReturnOrders.Context = new Dictionary<string, string>
- {
- { "Ticket", authResult.Ticket },
- { "InvOrgId", authResult.InvOrgId }
- };
+ {
+ { "Ticket", authResult.Ticket },
+ { "InvOrgId", authResult.InvOrgId }
+ };
var response = HttpHelper.Post<MomRequestContent>(ReceiveWMSTaskreturn, houseReturnOrders, "鍙栨秷鍙戣揣鍚庣珛搴撳弽鎷e叆搴撳洖浼燱MS");
// 鍒ゆ柇Success鐨勫��
if (response.Success)
{
+ WriteLog.Write_Log("API", "鍏ュ簱鈥斿洖璋僑MOM(鎴愬姛)", "璇锋眰鎴愬姛", new { 璇锋眰鎶ユ枃 = houseReturnOrders, 鎺ユ敹鎶ユ枃 = response });
+
// 濡傛灉Success涓簍rue锛岃繑鍥為渶瑕佺殑鍊硷紙杩欓噷浠ヨ繑鍥炴暣涓搷搴斿璞′负渚嬶級
return WebResponseContent.Instance.OK();
}
else
{
+ WriteLog.Write_Log("API", "鍏ュ簱鈥斿洖璋僑MOM(澶辫触)", "璇锋眰澶辫触", new { 璇锋眰鎶ユ枃 = houseReturnOrders, 鎺ユ敹鎶ユ枃 = response });
+
// 濡傛灉Success涓篺alse锛屾姏鍑哄紓甯稿苟鍖呭惈閿欒淇℃伅
throw new Exception($"鎿嶄綔澶辫触: {response.Message ?? "鏈彁渚涢敊璇俊鎭�"}");
}
@@ -1639,45 +1668,54 @@
ApiType = "InventoryAllocateController",
Method = "AsrsFinishedStockCount",
Parameters = new List<InventoryAllocate.Allocate>
- {
- new InventoryAllocate.Allocate
- {
- Value = new List<Allocate.data1>
{
- new Allocate.data1
- {
- No = inboundOrder.OrderNo,
- //InWarehouse = task.Roadway,
- TransactionCode = inboundOrder.TransactionCode,
- InoutType = inboundOrder.OrderType,
- OrderType = inboundOrder.InoutType,
- // 閬嶅巻鎵�鏈夊簱瀛樻槑缁嗭紝娣诲姞鍒� DetailList
- DetailList = StockInfos.Select(d => new Allocate.data1.Inventory
- {
- LinId = d.Details.FirstOrDefault()?.LinId?? "",
- MaterielCode = d.Details.FirstOrDefault()?.MaterielCode?? "",
- OrderQuantity = d.Details.FirstOrDefault().StockQuantity,
- BatchNo = d.BatchNo,
- LPNNo = d.PalletCode,
- FinishQty = d.Details.FirstOrDefault().StockQuantity,
- LocationName = d.LocationCode
- }).ToList()
+ new InventoryAllocate.Allocate
+ {
+ Value = new List<Allocate.data1>
+ {
+ new Allocate.data1
+ {
+ No = inboundOrder.OrderNo,
+ //InWarehouse = task.Roadway,
+ TransactionCode = inboundOrder.TransactionCode,
+ InoutType = inboundOrder.OrderType,
+ OrderType = inboundOrder.InoutType,
+ // 閬嶅巻鎵�鏈夊簱瀛樻槑缁嗭紝娣诲姞鍒� DetailList
+ DetailList = StockInfos.Select(d => new Allocate.data1.Inventory
+ {
+ LinId = d.Details.FirstOrDefault()?.LinId?? "",
+ MaterielCode = d.Details.FirstOrDefault()?.MaterielCode?? "",
+ OrderQuantity = d.Details.FirstOrDefault().StockQuantity,
+ BatchNo = d.BatchNo,
+ LPNNo = d.PalletCode,
+ FinishQty = d.Details.FirstOrDefault().StockQuantity,
+ LocationName = d.LocationCode
+ }).ToList()
+ }
+ }
+ }
}
- }
- }
- }
};
var authResult = AuthenticateWithWMS();
if (authResult.IsSuccess)
{
inventoryAllocate.Context = new Dictionary<string, string>
- {
- { "Ticket", authResult.Ticket },
- { "InvOrgId", authResult.InvOrgId }
- };
+ {
+ { "Ticket", authResult.Ticket },
+ { "InvOrgId", authResult.InvOrgId }
+ };
- HttpHelper.Post<WebResponseContent>(ReceiveWMSTaskAllocatein, inventoryAllocate, "璋冩嫧鍏ュ簱鏁伴噺鍥炰紶WMS");
+ var response = HttpHelper.Post<WebResponseContent>(ReceiveWMSTaskAllocatein, inventoryAllocate, "璋冩嫧鍏ュ簱鏁伴噺鍥炰紶WMS");
+ if (!response.Status)
+ {
+ WriteLog.Write_Log("API", "鍏ュ簱鈥斿洖璋僑MOM(澶辫触)", "璇锋眰澶辫触", new { 璇锋眰鎶ユ枃 = inventoryAllocate, 鎺ユ敹鎶ユ枃 = response });
+ }
+ else
+ {
+ WriteLog.Write_Log("API", "鍏ュ簱鈥斿洖璋僑MOM(鎴愬姛)", "璇锋眰鎴愬姛", new { 璇锋眰鎶ユ枃 = inventoryAllocate, 鎺ユ敹鎶ユ枃 = response });
+
+ }
}
}
@@ -1951,8 +1989,14 @@
var response = HttpHelper.Post<MomRequestContent>(ReceiveWMSTaskout, passBack, "绔嬪簱鍑哄簱鏁伴噺鍥炰紶WMS");
if (!response.Success)
{
+ WriteLog.Write_Log("API", "鍑哄簱鈥斿洖璋僑MOM(澶辫触)", "璇锋眰澶辫触", new { 璇锋眰鎶ユ枃 = passBack, 鎺ユ敹鎶ユ枃 = response });
+
throw new Exception($"鎿嶄綔澶辫触: {response.Message ?? "鏈彁渚涢敊璇俊鎭�"}");
}
+ else
+ {
+ WriteLog.Write_Log("API", "鍑哄簱鈥斿洖璋僑MOM(鎴愬姛)", "璇锋眰鎴愬姛", new { 璇锋眰鎶ユ枃 = passBack, 鎺ユ敹鎶ユ枃 = response });
+ }
}
}
@@ -2008,8 +2052,14 @@
var response = HttpHelper.Post<MomRequestContent>(ReceiveWMSTaskin, allocate, "绔嬪簱鍏ュ簱鏁伴噺鍥炰紶WMS");
if (!response.Success)
{
+ WriteLog.Write_Log("API", "鍑哄簱鈥斿洖璋僑MOM(澶辫触)", "璇锋眰澶辫触", new { 璇锋眰鎶ユ枃 = allocate, 鎺ユ敹鎶ユ枃 = response });
+
throw new Exception($"鎿嶄綔澶辫触: {response.Message ?? "鏈彁渚涢敊璇俊鎭�"}");
}
+ else
+ {
+ WriteLog.Write_Log("API", "鍑哄簱鈥斿洖璋僑MOM(鎴愬姛)", "璇锋眰鎴愬姛", new { 璇锋眰鎶ユ枃 = allocate, 鎺ユ敹鎶ユ枃 = response });
+ }
}
}
}
@@ -2183,7 +2233,14 @@
var response = HttpHelper.Post<MomRequestContent>(ReceiveWMSTaskout, passBack, "绔嬪簱鍑哄簱鏁伴噺鍥炰紶WMS");
if (!response.Success)
{
+ WriteLog.Write_Log("API", "鍑哄簱鈥斿洖璋僑MOM(澶辫触)", "璇锋眰澶辫触", new { 璇锋眰鎶ユ枃 = passBack, 鎺ユ敹鎶ユ枃 = response });
+
throw new Exception($"鎿嶄綔澶辫触: {response.Message ?? "鏈彁渚涢敊璇俊鎭�"}");
+ }
+ else
+ {
+ WriteLog.Write_Log("API", "鍑哄簱鈥斿洖璋僑MOM(鎴愬姛)", "璇锋眰鎴愬姛", new { 璇锋眰鎶ユ枃 = passBack, 鎺ユ敹鎶ユ枃 = response });
+
}
}
}
@@ -2240,7 +2297,14 @@
var response = HttpHelper.Post<MomRequestContent>(ReceiveWMSTaskin, allocate, "绔嬪簱鍏ュ簱鏁伴噺鍥炰紶WMS");
if (!response.Success)
{
+ WriteLog.Write_Log("API", "鍑哄簱鈥斿洖璋僑MOM(澶辫触)", "璇锋眰澶辫触", new { 璇锋眰鎶ユ枃 = allocate, 鎺ユ敹鎶ユ枃 = response });
+
throw new Exception($"鎿嶄綔澶辫触: {response.Message ?? "鏈彁渚涢敊璇俊鎭�"}");
+ }
+ else
+ {
+ WriteLog.Write_Log("API", "鍑哄簱鈥斿洖璋僑MOM(鎴愬姛)", "璇锋眰鎴愬姛", new { 璇锋眰鎶ユ枃 = allocate, 鎺ユ敹鎶ユ枃 = response });
+
}
}
}
@@ -2278,11 +2342,12 @@
List<Dt_OutboundOrderDetail> outboundOrderDetails = new List<Dt_OutboundOrderDetail>();
foreach (var detail in stockInfo.Details)
{
- Dt_OutboundOrderDetail outboundOrderDetail = _outboundService.OutboundOrderService.Db.Queryable<Dt_OutboundOrderDetail>()
- .Where(x => x.OrderId == inboundOrder.Id && x.BatchNo == detail.BatchNo).First();
- if (outboundOrderDetail != null)
+
+ List<Dt_OutboundOrderDetail> NEWoutboundOrderDetails = _outboundService.OutboundOrderService.Db.Queryable<Dt_OutboundOrderDetail>()
+ .Where(x => x.OrderId == inboundOrder.Id && x.BatchNo == detail.BatchNo).ToList();
+ if (NEWoutboundOrderDetails != null && NEWoutboundOrderDetails.Count != 0)
{
- outboundOrderDetails.Add(outboundOrderDetail);
+ outboundOrderDetails.AddRange(NEWoutboundOrderDetails);
}
}
@@ -2555,7 +2620,6 @@
}
else if (inboundOrderDetail.OrderDetailStatus == OrderDetailStatusEnum.New.ObjToInt())
{
- inboundOrderDetail.OrderDetailStatus = OutboundStatusEnum.鍑哄簱涓�.ObjToInt();
inboundOrder.OrderStatus = OutboundStatusEnum.鍑哄簱涓�.ObjToInt();
}
}
@@ -2568,9 +2632,9 @@
//浣庢俯銆佽嵂姘�
private void DWANDYSUpdateOutboundOrderDetails(Dt_StockInfo stockInfo, Dt_OutboundOrder inboundOrder, ref List<Dt_OutboundOrderDetail> inboundOrderDetails)
{
- List<Dt_OutboundOrderDetail> newOutboundOrderDetails = inboundOrderDetails;
+ //List<Dt_OutboundOrderDetail> newOutboundOrderDetails = inboundOrderDetails;
int CompeletedNum = inboundOrder.Details.Where(x => x.OrderDetailStatus == OrderDetailStatusEnum.Over.ObjToInt()).Count();
- foreach (var newOutboundOrderDetail in newOutboundOrderDetails)
+ foreach (var newOutboundOrderDetail in inboundOrderDetails)
{
string BatchNo = newOutboundOrderDetail.BatchNo;
//inboundOrderDetail = inboundOrder.Details.FirstOrDefault(x => x.BatchNo == stockInfo.Details.FirstOrDefault()?.BatchNo&&x.LPNNo==stockInfo.PalletCode);
@@ -2582,10 +2646,16 @@
if (newOutboundOrderDetail.BatchNo == item.BatchNo)
{
- newOutboundOrderDetail.OverOutQuantity += item.OutboundQuantity;
-
- if (newOutboundOrderDetail.OverOutQuantity == newOutboundOrderDetail.OrderQuantity)
+ if(item.OutboundQuantity > newOutboundOrderDetail.OrderQuantity)
{
+ newOutboundOrderDetail.OverOutQuantity = newOutboundOrderDetail.OrderQuantity;
+ }
+ else
+ {
+ newOutboundOrderDetail.OverOutQuantity += item.OutboundQuantity;
+ }
+ if (newOutboundOrderDetail.OverOutQuantity == newOutboundOrderDetail.OrderQuantity)
+ {
newOutboundOrderDetail.OrderDetailStatus = OrderDetailStatusEnum.Over.ObjToInt();
CompeletedNum++;
}
@@ -2856,7 +2926,16 @@
{ "InvOrgId", authResult.InvOrgId }
};
- HttpHelper.Post<WebResponseContent>(ReceiveWMSTaskin, allocate, "绔嬪簱鍏ュ簱鏁伴噺鍥炰紶WMS");
+ var response = HttpHelper.Post<WebResponseContent>(ReceiveWMSTaskin, allocate, "绔嬪簱鍏ュ簱鏁伴噺鍥炰紶WMS");
+ if (!response.Status)
+ {
+ WriteLog.Write_Log("API", "鍑哄簱鈥斿洖璋僑MOM(澶辫触)", "璇锋眰澶辫触", new { 璇锋眰鎶ユ枃 = allocate, 鎺ユ敹鎶ユ枃 = response });
+
+ }
+ else
+ {
+ WriteLog.Write_Log("API", "鍑哄簱鈥斿洖璋僑MOM(鎴愬姛)", "璇锋眰鎴愬姛", new { 璇锋眰鎶ユ枃 = allocate, 鎺ユ敹鎶ユ枃 = response });
+ }
}
}
@@ -3354,17 +3433,22 @@
result = response.Content.ReadAsStringAsync()
.ConfigureAwait(false).GetAwaiter().GetResult();
}
+ WriteLog.Write_Log("API", "鍑哄簱鈥斿洖璋僂RP(鎴愬姛)", "璇锋眰鎴愬姛", new { 璇锋眰鎶ユ枃 = postContent, 鎺ユ敹鎶ユ枃 = result });
// 鍋囪ERP杩斿洖鎴愬姛鏃惰繑鍥炴垚鍔熷搷搴�
return WebResponseContent.Instance.OK(result);
}
catch (HttpRequestException ex)
{
+ WriteLog.Write_Log("API", "鍑哄簱鈥斿洖璋僂RP(澶辫触)", "璇锋眰澶辫触", new { 璇锋眰鎶ユ枃 = postContent, 鎺ユ敹鎶ユ枃 = ex.Message });
+
// 澶勭悊HTTP璇锋眰鐩稿叧寮傚父
return WebResponseContent.Instance.Error($"HTTP璇锋眰閿欒: {ex.Message}");
}
catch (Exception ex)
{
+ WriteLog.Write_Log("API", "鍑哄簱鈥斿洖璋僂RP(澶辫触)", "璇锋眰澶辫触", new { 璇锋眰鎶ユ枃 = postContent, 鎺ユ敹鎶ユ枃 = ex.Message });
+
// 澶勭悊鍏朵粬寮傚父
return WebResponseContent.Instance.Error($"澶勭悊澶辫触: {ex.Message}");
}
@@ -3392,11 +3476,15 @@
// 鍒ゆ柇Success鐨勫��
if (response.Code == 0)
{
+ WriteLog.Write_Log("API", "鍏ュ簱鈥斿洖璋僂RP(鎴愬姛)", "璇锋眰鎴愬姛", new { 璇锋眰鎶ユ枃 = feedbackInboundOrderERPs, 鎺ユ敹鎶ユ枃 = response });
+
// 濡傛灉Success涓簍rue锛岃繑鍥為渶瑕佺殑鍊硷紙杩欓噷浠ヨ繑鍥炴暣涓搷搴斿璞′负渚嬶級
return WebResponseContent.Instance.OK();
}
else
{
+ WriteLog.Write_Log("API", "鍏ュ簱鈥斿洖璋僂RP(澶辫触)", "璇锋眰澶辫触", new { 璇锋眰鎶ユ枃 = feedbackInboundOrderERPs, 鎺ユ敹鎶ユ枃 = response });
+
// 濡傛灉Success涓篺alse锛屾姏鍑哄紓甯稿苟鍖呭惈閿欒淇℃伅
throw new Exception($"鎿嶄綔澶辫触: {response.Message ?? "鏈彁渚涢敊璇俊鎭�"}");
}
--
Gitblit v1.9.3