From 844c7c3ce2c39139490a6ecb0f35170f6cade290 Mon Sep 17 00:00:00 2001
From: wankeda <Administrator@DESKTOP-HAU3ST3>
Date: 星期二, 28 四月 2026 16:31:54 +0800
Subject: [PATCH] 1
---
WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs | 168 +++++++++++++++++++++++++++++++++++++++++--------------
1 files changed, 125 insertions(+), 43 deletions(-)
diff --git a/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs b/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs
index a5d8808..b0eb149 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 });
+
}
}
}
@@ -2856,7 +2920,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 +3427,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 +3470,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