From 5bedccab71622d4c0f3b9e75966802be704ee019 Mon Sep 17 00:00:00 2001
From: wankeda <Administrator@DESKTOP-HAU3ST3>
Date: 星期四, 12 三月 2026 14:20:23 +0800
Subject: [PATCH] 1
---
WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs | 455 ++++++++++++++++++++++++++++++--------------------------
1 files changed, 247 insertions(+), 208 deletions(-)
diff --git a/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs b/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs
index b8909c6..2c6dab6 100644
--- a/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs
+++ b/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs
@@ -578,9 +578,9 @@
return WebResponseContent.Instance.Error("鏈壘鍒板叆搴撳崟淇℃伅");
}
var allBoxCodesForDetail = BaseDal.Db.Queryable<Dt_StockInfoDetailCP>()
- .Where(x => dt_StockInfo.Details.Select(d => d.Id).Contains(x.StockDetailId))
- .Select(x => x.BoxCode)
- .ToList();
+ .Where(x => dt_StockInfo.Details.Select(d => d.Id).Contains(x.StockDetailId))
+ .Select(x => x.BoxCode)
+ .ToList();
// 2. 鑾峰彇鎵樼洏涓嬬殑鎵�鏈夌鍙�
var boxCodes = new List<string>();
@@ -808,9 +808,10 @@
// 鍒ゆ柇Success鐨勫��
if (!response.Success)
{
+ WriteLog.Write_Log("API", "SMOM绔嬪簱鍥炰紶缁橶MS", "璇锋眰澶辫触", new { 璇锋眰鎶ユ枃 = houseInboundPassBack, 鎺ユ敹鎶ユ枃 = response });
throw new Exception($"鎿嶄綔澶辫触: {response.Message ?? "鏈彁渚涢敊璇俊鎭�"}");
}
-
+ WriteLog.Write_Log("API", "SMOM绔嬪簱鍏ュ簱鍥炰紶WMS", "璇锋眰鎴愬姛", new { 璇锋眰鎶ユ枃 = houseInboundPassBack, 鎺ユ敹鎶ユ枃 = response });
}
}
@@ -886,8 +887,11 @@
var response = HttpHelper.Post<MomRequestContent>(ReceiveWMSTaskAllocatein, inventoryAllocate, "璋冩嫧鍏ュ簱鏁伴噺鍥炰紶WMS");
if (!response.Success)
{
+ WriteLog.Write_Log("API", "SMOM璋冩嫧鍏ュ簱鏁伴噺鍥炰紶WMS", "璇锋眰澶辫触", new { 璇锋眰鎶ユ枃 = inventoryAllocate, 鎺ユ敹鎶ユ枃 = response });
throw new Exception($"鎿嶄綔澶辫触锛歿response.Message ?? "鏈彁渚涢敊璇俊鎭�"}");
}
+ WriteLog.Write_Log("API", "SMOM璋冩嫧鍏ュ簱鏁伴噺鍥炰紶WMS", "璇锋眰鎴愬姛", new { 璇锋眰鎶ユ枃 = inventoryAllocate, 鎺ユ敹鎶ユ枃 = response });
+
}
}
else if (inboundOrder.OrderStatus == InboundStatusEnum.鍏ュ簱瀹屾垚.ObjToInt() && inboundOrder.OrderType == 5 && inboundOrder.System.Equals("SMOM"))
@@ -913,33 +917,28 @@
{
Value = new Parame.Syncretism
- {
- OrderNo = inboundOrder.OrderNo,
- Details = StockInfos.SelectMany(stockInfo =>
+ {
+ OrderNo = inboundOrder.OrderNo,
+ Details = StockInfos.SelectMany(stockInfo =>
+ stockInfo.Details.Select(g =>
+ {
+ //var InboundOrderde1=dt_InboundOrder.Details.FirstOrDefault;
- stockInfo.Details.Select(g =>
- {
- //var InboundOrderde1=dt_InboundOrder.Details.FirstOrDefault;
-
- return new Parame.Syncretism.details
- {
- MoveType = 0,
- WareHouseCode = warehouse.WarehouseCode,
- ItemCode = g.MaterielCode,
- MoveNumber = g.StockQuantity,
- LotNo = g.BatchNo,
- WipBatch = g.BatchNo,
- Lpn = g.StockDetails.FirstOrDefault().LPNNO,
- LocationName = g.StockDetails.FirstOrDefault().OrinalLocation,
- TargetLocName = stockInfo.LocationCode, // 娣诲姞null妫�鏌�
- TargetLpn = stockInfo.PalletCode, // 娣诲姞null妫�鏌�
- };
-
-
- })).ToList()
-
- }
-
+ return new Parame.Syncretism.details
+ {
+ MoveType = 0,
+ WareHouseCode = warehouse.WarehouseCode,
+ ItemCode = g.MaterielCode,
+ MoveNumber = g.StockQuantity,
+ LotNo = g.BatchNo,
+ WipBatch = g.BatchNo,
+ Lpn = g.StockDetails.FirstOrDefault().LPNNO,
+ LocationName = g.StockDetails.FirstOrDefault().OrinalLocation,
+ TargetLocName = stockInfo.LocationCode, // 娣诲姞null妫�鏌�
+ TargetLpn = stockInfo.PalletCode, // 娣诲姞null妫�鏌�
+ };
+ })).ToList()
+ }
}
}
};
@@ -948,17 +947,19 @@
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", "SMOM绔嬪簱鍏ュ簱鏁伴噺鍥炰紶WMS", "璇锋眰澶辫触", new { 璇锋眰鎶ユ枃 = houseSyncretism, 鎺ユ敹鎶ユ枃 = response });
throw new Exception($"鎿嶄綔澶辫触: {response.Message ?? "鏈彁渚涢敊璇俊鎭�"}");
}
+ WriteLog.Write_Log("API", "SMOM绔嬪簱鍏ュ簱鏁伴噺鍥炰紶WMS", "璇锋眰鎴愬姛", new { 璇锋眰鎶ユ枃 = houseSyncretism, 鎺ユ敹鎶ユ枃 = response });
}
@@ -1087,6 +1088,8 @@
if (inboundOrder.OrderStatus == InboundStatusEnum.鍏ュ簱瀹屾垚.ObjToInt() && inboundOrder.OrderType == 0 && inboundOrder.System.Equals("SMOM"))
{
//SendInboundInfoToWMS(task, inboundOrder, stockInfo);
+ SendInboundInfoToWMS(task, inboundOrder, dt_StockInfo);
+
}
else if (inboundOrder.OrderStatus == InboundStatusEnum.鍏ュ簱瀹屾垚.ObjToInt() && inboundOrder.OrderType == 2 && inboundOrder.System.Equals("SMOM"))
{
@@ -1506,11 +1509,13 @@
// 鍒ゆ柇Success鐨勫��
if (response.Success)
{
+ WriteLog.Write_Log("API", "SMOM绔嬪簱鍏ュ簱鍥炰紶WMS", "璇锋眰鎴愬姛", new { 璇锋眰鎶ユ枃 = houseInboundPassBack, 鎺ユ敹鎶ユ枃 = response });
// 濡傛灉Success涓簍rue锛岃繑鍥為渶瑕佺殑鍊硷紙杩欓噷浠ヨ繑鍥炴暣涓搷搴斿璞′负渚嬶級
return WebResponseContent.Instance.OK();
}
else
{
+ WriteLog.Write_Log("API", "SMOM绔嬪簱鍏ュ簱鍥炰紶WMS", "璇锋眰澶辫触", new { 璇锋眰鎶ユ枃 = houseInboundPassBack, 鎺ユ敹鎶ユ枃 = response });
// 濡傛灉Success涓篺alse锛屾姏鍑哄紓甯稿苟鍖呭惈閿欒淇℃伅
throw new Exception($"鎿嶄綔澶辫触: {response.Message ?? "鏈彁渚涢敊璇俊鎭�"}");
}
@@ -1531,9 +1536,9 @@
Parameters = new List<HouseBackboundPassBack.backdata>
{
new HouseBackboundPassBack.backdata
- {
+ {
Value= new List<backdata.backdata1>
- {
+ {
new backdata.backdata1
{
OrderType = returnOrder.OrderType,
@@ -1549,7 +1554,7 @@
WarehouseCode = returnOrder.WarehouseCode,
System = returnOrder.System,
}
- }
+ }
}
}
};
@@ -1565,11 +1570,16 @@
// 鍒ゆ柇Success鐨勫��
if (response.Success)
{
+ WriteLog.Write_Log("API", "鍙栨秷鍙戣揣鍚庣珛搴撳弽鎷e叆搴撳洖浼燱MS", "璇锋眰鎴愬姛", new { 璇锋眰鎶ユ枃 = houseReturnOrders, 鎺ユ敹鎶ユ枃 = response });
+
// 濡傛灉Success涓簍rue锛岃繑鍥為渶瑕佺殑鍊硷紙杩欓噷浠ヨ繑鍥炴暣涓搷搴斿璞′负渚嬶級
return WebResponseContent.Instance.OK();
+
}
else
{
+ WriteLog.Write_Log("API", "鍙栨秷鍙戣揣鍚庣珛搴撳弽鎷e叆搴撳洖浼燱MS", "璇锋眰澶辫触", new { 璇锋眰鎶ユ枃 = houseReturnOrders, 鎺ユ敹鎶ユ枃 = response });
+
// 濡傛灉Success涓篺alse锛屾姏鍑哄紓甯稿苟鍖呭惈閿欒淇℃伅
throw new Exception($"鎿嶄綔澶辫触: {response.Message ?? "鏈彁渚涢敊璇俊鎭�"}");
}
@@ -1634,33 +1644,33 @@
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
+ new InventoryAllocate.Allocate
{
- 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()
+ 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();
@@ -1673,6 +1683,8 @@
};
HttpHelper.Post<WebResponseContent>(ReceiveWMSTaskAllocatein, inventoryAllocate, "璋冩嫧鍏ュ簱鏁伴噺鍥炰紶WMS");
+ WriteLog.Write_Log("API", "璋冩嫧鍏ュ簱鏁伴噺鍥炰紶WMS", "璇锋眰", new { 璇锋眰鎶ユ枃 = inventoryAllocate, 鎺ユ敹鎶ユ枃 = inventoryAllocate });
+
}
}
@@ -1701,10 +1713,10 @@
{
ApiType = "AuthenticationController",
Parameters = new List<Parameter>
- {
- new Parameter { Value = "LK-Admin" },
- new Parameter { Value = "LK-Admin" }
- },
+ {
+ new Parameter { Value = "LK-Admin" },
+ new Parameter { Value = "LK-Admin" }
+ },
Method = "Login",
};
@@ -1879,6 +1891,7 @@
foreach (var orderDetail in outboundOrderDetails1.Where(x => x.OrderDetailStatus == OrderDetailStatusEnum.Over.ObjToInt()))
{
FeedBackOutERP(outboundOrder.OrderNo, orderDetail.LinId);
+
}
// 濡傛灉鏈夊畬鎴愮殑鏄庣粏锛屼笅杞芥姤琛�
@@ -1905,33 +1918,33 @@
ApiType = "ShippingOrderController",
Method = "AsrsOutboundSO",
Parameters = new List<HouseoutboundPassBack.datas>
- {
- new HouseoutboundPassBack.datas
- {
- Value = new List<HouseoutboundPassBack.datas.data1>
- {
- new HouseoutboundPassBack.datas.data1
- {
- No = outboundOrder.OrderNo,
- OutWareHouse = task.Roadway,
- TransactionCode = outboundOrder.TransactionCode,
- InoutType = outboundOrder.OrderType,
- OrderType = outboundOrder.InoutType,
- DetailList = outStockLockInfoList.Select(d => new HouseoutboundPassBack.datas.data1.Inbound
+ {
+ new HouseoutboundPassBack.datas
+ {
+ Value = new List<HouseoutboundPassBack.datas.data1>
{
- LinId = d.LinId?? "",
- LPN_No = d.PalletCode,
- MaterielCode = d.MaterielCode?? "",
- OrderQuantity = d.OrderQuantity,
- BatchNo = d.BatchNo,
- FinishQty = d.OrderQuantity,
- LocationName = d.LocationCode
- })
- .ToList()
- }
- }
- }
- }
+ new HouseoutboundPassBack.datas.data1
+ {
+ No = outboundOrder.OrderNo,
+ OutWareHouse = task.Roadway,
+ TransactionCode = outboundOrder.TransactionCode,
+ InoutType = outboundOrder.OrderType,
+ OrderType = outboundOrder.InoutType,
+ DetailList = outStockLockInfoList.Select(d => new HouseoutboundPassBack.datas.data1.Inbound
+ {
+ LinId = d.LinId?? "",
+ LPN_No = d.PalletCode,
+ MaterielCode = d.MaterielCode?? "",
+ OrderQuantity = d.OrderQuantity,
+ BatchNo = d.BatchNo,
+ FinishQty = d.OrderQuantity,
+ LocationName = d.LocationCode
+ })
+ .ToList()
+ }
+ }
+ }
+ }
};
//璋冪敤SMOM鎺ュ彛...
@@ -1946,8 +1959,11 @@
var response = HttpHelper.Post<MomRequestContent>(ReceiveWMSTaskout, passBack, "绔嬪簱鍑哄簱鏁伴噺鍥炰紶WMS");
if (!response.Success)
{
+ WriteLog.Write_Log("API", "SMOM绔嬪簱搴撴暟閲忓洖浼燱MS", "璇锋眰澶辫触", new { 璇锋眰鎶ユ枃 = passBack, 鎺ユ敹鎶ユ枃 = response });
+
throw new Exception($"鎿嶄綔澶辫触: {response.Message ?? "鏈彁渚涢敊璇俊鎭�"}");
}
+ WriteLog.Write_Log("API", "SMOM绔嬪簱搴撴暟閲忓洖浼燱MS", "璇锋眰鎴愬姛", new { 璇锋眰鎶ユ枃 = passBack, 鎺ユ敹鎶ユ枃 = response });
}
}
@@ -1959,36 +1975,36 @@
ApiType = "InventoryAllocateController",
Method = "AsrsFinishedStockCount",
Parameters = new List<Allocate>
- {
- new Allocate
- {
- Value = new List<Allocate.data1>
- {
- new Allocate.data1
- {
- No = outboundOrder.OrderNo,
- InWarehouse = task.Roadway,
- TransactionCode = outboundOrder.TransactionCode,
- InoutType = outboundOrder.OrderType,
- OrderType = outboundOrder.InoutType,
- ActiveType = 2,
- DetailList = outStockLockInfoList.Select(item =>
+ {
+ new Allocate
+ {
+ Value = new List<Allocate.data1>
{
- return new Allocate.data1.Inventory
+ new Allocate.data1
{
- LinId = item.LinId,
- LPNNo = item.PalletCode,
- MaterielCode = item.MaterielCode,
- OrderQuantity = item.OrderQuantity,
- BatchNo = item.BatchNo,
- FinishQty = item.OrderQuantity,
- LocationName = task.SourceAddress
- };
- }).ToList()
- }
- }
- }
- }
+ No = outboundOrder.OrderNo,
+ InWarehouse = task.Roadway,
+ TransactionCode = outboundOrder.TransactionCode,
+ InoutType = outboundOrder.OrderType,
+ OrderType = outboundOrder.InoutType,
+ ActiveType = 2,
+ DetailList = outStockLockInfoList.Select(item =>
+ {
+ return new Allocate.data1.Inventory
+ {
+ LinId = item.LinId,
+ LPNNo = item.PalletCode,
+ MaterielCode = item.MaterielCode,
+ OrderQuantity = item.OrderQuantity,
+ BatchNo = item.BatchNo,
+ FinishQty = item.OrderQuantity,
+ LocationName = task.SourceAddress
+ };
+ }).ToList()
+ }
+ }
+ }
+ }
};
// 璋冪敤SMOM鎺ュ彛...
@@ -1996,15 +2012,19 @@
if (authResult.IsSuccess)
{
allocate.Context = new Dictionary<string, string>
- {
- { "Ticket", authResult.Ticket },
- { "InvOrgId", authResult.InvOrgId }
- };
+ {
+ { "Ticket", authResult.Ticket },
+ { "InvOrgId", authResult.InvOrgId }
+ };
var response = HttpHelper.Post<MomRequestContent>(ReceiveWMSTaskin, allocate, "绔嬪簱鍏ュ簱鏁伴噺鍥炰紶WMS");
if (!response.Success)
{
+ WriteLog.Write_Log("API", "SMOM绔嬪簱搴撴暟閲忓洖浼燱MS", "璇锋眰澶辫触", new { 璇锋眰鎶ユ枃 = allocate, 鎺ユ敹鎶ユ枃 = response });
+
throw new Exception($"鎿嶄綔澶辫触: {response.Message ?? "鏈彁渚涢敊璇俊鎭�"}");
}
+ WriteLog.Write_Log("API", "SMOM绔嬪簱搴撴暟閲忓洖浼燱MS", "璇锋眰鎴愬姛", new { 璇锋眰鎶ユ枃 = allocate, 鎺ユ敹鎶ユ枃 = response });
+
}
}
}
@@ -2137,33 +2157,33 @@
ApiType = "ShippingOrderController",
Method = "AsrsOutboundSO",
Parameters = new List<HouseoutboundPassBack.datas>
- {
- new HouseoutboundPassBack.datas
- {
- Value = new List<HouseoutboundPassBack.datas.data1>
- {
- new HouseoutboundPassBack.datas.data1
- {
- No = outboundOrder.OrderNo,
- OutWareHouse = task.Roadway,
- TransactionCode = outboundOrder.TransactionCode,
- InoutType = outboundOrder.OrderType,
- OrderType = outboundOrder.InoutType,
- DetailList = outStockLockInfoList.Select(d => new HouseoutboundPassBack.datas.data1.Inbound
+ {
+ new HouseoutboundPassBack.datas
+ {
+ Value = new List<HouseoutboundPassBack.datas.data1>
{
- LinId = d.LinId?? "",
- LPN_No = d.PalletCode,
- MaterielCode = d.MaterielCode?? "",
- OrderQuantity = d.OrderQuantity,
- BatchNo = d.BatchNo,
- FinishQty = d.OrderQuantity,
- LocationName = d.LocationCode
- })
- .ToList()
- }
- }
- }
- }
+ new HouseoutboundPassBack.datas.data1
+ {
+ No = outboundOrder.OrderNo,
+ OutWareHouse = task.Roadway,
+ TransactionCode = outboundOrder.TransactionCode,
+ InoutType = outboundOrder.OrderType,
+ OrderType = outboundOrder.InoutType,
+ DetailList = outStockLockInfoList.Select(d => new HouseoutboundPassBack.datas.data1.Inbound
+ {
+ LinId = d.LinId?? "",
+ LPN_No = d.PalletCode,
+ MaterielCode = d.MaterielCode?? "",
+ OrderQuantity = d.OrderQuantity,
+ BatchNo = d.BatchNo,
+ FinishQty = d.OrderQuantity,
+ LocationName = d.LocationCode
+ })
+ .ToList()
+ }
+ }
+ }
+ }
};
//璋冪敤SMOM鎺ュ彛...
@@ -2178,8 +2198,12 @@
var response = HttpHelper.Post<MomRequestContent>(ReceiveWMSTaskout, passBack, "绔嬪簱鍑哄簱鏁伴噺鍥炰紶WMS");
if (!response.Success)
{
+ WriteLog.Write_Log("API", "SMOM绔嬪簱搴撴暟閲忓洖浼燱MS", "璇锋眰澶辫触", new { 璇锋眰鎶ユ枃 = passBack, 鎺ユ敹鎶ユ枃 = response });
+
throw new Exception($"鎿嶄綔澶辫触: {response.Message ?? "鏈彁渚涢敊璇俊鎭�"}");
}
+ WriteLog.Write_Log("API", "SMOM绔嬪簱搴撴暟閲忓洖浼燱MS", "璇锋眰鎴愬姛", new { 璇锋眰鎶ユ枃 = passBack, 鎺ユ敹鎶ユ枃 = response });
+
}
}
@@ -2191,36 +2215,36 @@
ApiType = "InventoryAllocateController",
Method = "AsrsFinishedStockCount",
Parameters = new List<Allocate>
- {
- new Allocate
- {
- Value = new List<Allocate.data1>
- {
- new Allocate.data1
- {
- No = outboundOrder.OrderNo,
- InWarehouse = task.Roadway,
- TransactionCode = outboundOrder.TransactionCode,
- InoutType = outboundOrder.OrderType,
- OrderType = outboundOrder.InoutType,
- ActiveType = 2,
- DetailList = outStockLockInfoList.Select(item =>
+ {
+ new Allocate
+ {
+ Value = new List<Allocate.data1>
{
- return new Allocate.data1.Inventory
+ new Allocate.data1
{
- LinId = item.LinId,
- LPNNo = item.PalletCode,
- MaterielCode = item.MaterielCode,
- OrderQuantity = item.OrderQuantity,
- BatchNo = item.BatchNo,
- FinishQty = item.OrderQuantity,
- LocationName = task.SourceAddress
- };
- }).ToList()
- }
- }
- }
- }
+ No = outboundOrder.OrderNo,
+ InWarehouse = task.Roadway,
+ TransactionCode = outboundOrder.TransactionCode,
+ InoutType = outboundOrder.OrderType,
+ OrderType = outboundOrder.InoutType,
+ ActiveType = 2,
+ DetailList = outStockLockInfoList.Select(item =>
+ {
+ return new Allocate.data1.Inventory
+ {
+ LinId = item.LinId,
+ LPNNo = item.PalletCode,
+ MaterielCode = item.MaterielCode,
+ OrderQuantity = item.OrderQuantity,
+ BatchNo = item.BatchNo,
+ FinishQty = item.OrderQuantity,
+ LocationName = task.SourceAddress
+ };
+ }).ToList()
+ }
+ }
+ }
+ }
};
// 璋冪敤SMOM鎺ュ彛...
@@ -2235,8 +2259,12 @@
var response = HttpHelper.Post<MomRequestContent>(ReceiveWMSTaskin, allocate, "绔嬪簱鍏ュ簱鏁伴噺鍥炰紶WMS");
if (!response.Success)
{
+ WriteLog.Write_Log("API", "SMOM绔嬪簱搴撴暟閲忓洖浼燱MS", "璇锋眰澶辫触", new { 璇锋眰鎶ユ枃 = allocate, 鎺ユ敹鎶ユ枃 = response });
+
throw new Exception($"鎿嶄綔澶辫触: {response.Message ?? "鏈彁渚涢敊璇俊鎭�"}");
}
+ WriteLog.Write_Log("API", "SMOM绔嬪簱搴撴暟閲忓洖浼燱MS", "璇锋眰鎴愬姛", new { 璇锋眰鎶ユ枃 = allocate, 鎺ユ敹鎶ユ枃 = response });
+
}
}
}
@@ -2801,48 +2829,50 @@
ApiType = "InventoryAllocateController",
Method = "AsrsFinishedStockCount",
Parameters = new List<Allocate>
- {
- new Allocate
- {
- Value = new List<Allocate.data1>
{
- new Allocate.data1
+ new Allocate
{
- No = outboundOrder.OrderNo,
- InWarehouse = task.Roadway,
- TransactionCode = outboundOrder.TransactionCode,
- InoutType = outboundOrder.OrderType,
- OrderType = outboundOrder.InoutType,
- DetailList = outStockLockInfos.Select(item =>
+ Value = new List<Allocate.data1>
{
- //var detail = _stockService.StockInfoDetailService.Repository.QueryFirst(x => x.StockId == item.StockId);
- return new Allocate.data1.Inventory
+ new Allocate.data1
{
- LinId = outDetail.LinId,
- LPNNo = item.PalletCode,
- MaterielCode = outDetail.MaterielCode,
- OrderQuantity = outDetail.OrderQuantity,
- BatchNo = outDetail.BatchNo,
- FinishQty = outDetail.OrderQuantity,
- LocationName = task.SourceAddress
- };
- }).ToList()
+ No = outboundOrder.OrderNo,
+ InWarehouse = task.Roadway,
+ TransactionCode = outboundOrder.TransactionCode,
+ InoutType = outboundOrder.OrderType,
+ OrderType = outboundOrder.InoutType,
+ DetailList = outStockLockInfos.Select(item =>
+ {
+ //var detail = _stockService.StockInfoDetailService.Repository.QueryFirst(x => x.StockId == item.StockId);
+ return new Allocate.data1.Inventory
+ {
+ LinId = outDetail.LinId,
+ LPNNo = item.PalletCode,
+ MaterielCode = outDetail.MaterielCode,
+ OrderQuantity = outDetail.OrderQuantity,
+ BatchNo = outDetail.BatchNo,
+ FinishQty = outDetail.OrderQuantity,
+ LocationName = task.SourceAddress
+ };
+ }).ToList()
+ }
+ }
}
}
- }
- }
};
var authResult = AuthenticateWithWMS();
if (authResult.IsSuccess)
{
allocate.Context = new Dictionary<string, string>
- {
- { "Ticket", authResult.Ticket },
- { "InvOrgId", authResult.InvOrgId }
- };
+ {
+ { "Ticket", authResult.Ticket },
+ { "InvOrgId", authResult.InvOrgId }
+ };
- HttpHelper.Post<WebResponseContent>(ReceiveWMSTaskin, allocate, "绔嬪簱鍏ュ簱鏁伴噺鍥炰紶WMS");
+ var response = HttpHelper.Post<WebResponseContent>(ReceiveWMSTaskin, allocate, "绔嬪簱鍏ュ簱鏁伴噺鍥炰紶WMS");
+ WriteLog.Write_Log("API", "SMOM绔嬪簱鍏ュ簱鏁伴噺鍥炰紶WMS", "璇锋眰", new { 璇锋眰鎶ユ枃 = allocate, 鎺ユ敹鎶ユ枃 = response });
+
}
}
@@ -3039,8 +3069,7 @@
var matchedStockDetail = stockInfoDetails.FirstOrDefault(x => x.MaterielCode == outDetail.MaterielCode && x.BatchNo == outDetail.BatchNo);
if (matchedStockDetail == null)
{
- matchedStockDetail = stockInfoDetails.FirstOrDefault(x =>
- x.MaterielCode == outDetail.MaterielCode);
+ matchedStockDetail = stockInfoDetails.FirstOrDefault(x =>x.MaterielCode == outDetail.MaterielCode);
if (matchedStockDetail == null)
{
@@ -3264,6 +3293,8 @@
result = response.Content.ReadAsStringAsync()
.ConfigureAwait(false).GetAwaiter().GetResult();
+ WriteLog.Write_Log("API", "鍗曟嵁鏄庣粏鍑哄簱瀹屾垚鍥炶皟ERP", "璇锋眰鎴愬姛", new { 璇锋眰鎶ユ枃 = postContent, 鎺ユ敹鎶ユ枃 = response });
+
}
// 鍋囪ERP杩斿洖鎴愬姛鏃惰繑鍥炴垚鍔熷搷搴�
@@ -3271,11 +3302,15 @@
}
catch (HttpRequestException ex)
{
+ WriteLog.Write_Log("API", "鍗曟嵁鏄庣粏鍑哄簱瀹屾垚鍥炶皟ERP", "璇锋眰澶辫触", new { 璇锋眰鎶ユ枃 = postContent, 鎺ユ敹鎶ユ枃 = ex.Message });
+
// 澶勭悊HTTP璇锋眰鐩稿叧寮傚父
return WebResponseContent.Instance.Error($"HTTP璇锋眰閿欒: {ex.Message}");
}
catch (Exception ex)
{
+ WriteLog.Write_Log("API", "鍗曟嵁鏄庣粏鍑哄簱瀹屾垚鍥炶皟ERP", "璇锋眰澶辫触", new { 璇锋眰鎶ユ枃 = postContent, 鎺ユ敹鎶ユ枃 = ex.Message });
+
// 澶勭悊鍏朵粬寮傚父
return WebResponseContent.Instance.Error($"澶勭悊澶辫触: {ex.Message}");
}
@@ -3303,11 +3338,15 @@
// 鍒ゆ柇Success鐨勫��
if (response.Code == 0)
{
+ WriteLog.Write_Log("API", "浠诲姟鍥炰紶缁檈rp", "璇锋眰鎴愬姛", new { 璇锋眰鎶ユ枃 = feedbackInboundOrder, 鎺ユ敹鎶ユ枃 = response });
+
// 濡傛灉Success涓簍rue锛岃繑鍥為渶瑕佺殑鍊硷紙杩欓噷浠ヨ繑鍥炴暣涓搷搴斿璞′负渚嬶級
return WebResponseContent.Instance.OK();
}
else
{
+ WriteLog.Write_Log("API", "浠诲姟鍥炰紶缁檈rp", "璇锋眰澶辫触", new { 璇锋眰鎶ユ枃 = feedbackInboundOrder, 鎺ユ敹鎶ユ枃 = response });
+
// 濡傛灉Success涓篺alse锛屾姏鍑哄紓甯稿苟鍖呭惈閿欒淇℃伅
throw new Exception($"鎿嶄綔澶辫触: {response.Message ?? "鏈彁渚涢敊璇俊鎭�"}");
}
--
Gitblit v1.9.3