From 18ef8c37e6290ba6f47cbd5bbd26e56a682d767e Mon Sep 17 00:00:00 2001
From: yanjinhui <3306209981@qq.com>
Date: 星期一, 29 九月 2025 16:34:15 +0800
Subject: [PATCH] 1
---
代码管理/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/InventoryServices.cs | 93 ++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 93 insertions(+), 0 deletions(-)
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/InventoryServices.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/InventoryServices.cs"
index fdec116..0e4cb00 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/InventoryServices.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/InventoryServices.cs"
@@ -9,12 +9,14 @@
using WIDESEA_Core;
using WIDESEA_Core.BaseServices;
using WIDESEA_Core.Helper;
+using WIDESEA_DTO.SquareCabin;
using WIDESEA_ISquareCabinRepository;
using WIDESEA_ISquareCabinServices;
using WIDESEA_Model.Models;
using WIDESEA_Model.Models.SquareCabin;
using WIDESEA_SquareCabinRepository;
using static WIDESEA_DTO.SquareCabin.OrderDto;
+using static WIDESEA_DTO.SquareCabin.TowcsDto;
namespace WIDESEA_SquareCabinServices
{
@@ -75,6 +77,97 @@
}
}
+
+ /// <summary>
+ /// wcs鍥炰紶缁欐垜
+ /// </summary>
+ /// <param name="request"></param>
+ /// <returns></returns>
+ public ApiResponse<Dt_Inventory> OrderFeedback(EdiOrderCallbackRequest request)
+ {
+ try
+ {
+ if (request == null || request.details == null || !request.details.Any())
+ {
+ return new ApiResponse<Dt_Inventory> { code ="500",msg = "璇锋眰鍙傛暟鏃犳晥" };
+ }
+
+ foreach (var detail in request.details)
+ {
+ // 鍏堟煡搴撳瓨鏄惁瀛樺湪
+ var entity = Db.Queryable<Dt_Inventory>()
+ .First(x => x.Goods_no == detail.productCode);
+ //灏嗛泦鍚堜腑鐨勬暟閲忚繘琛岀疮鍔�
+ decimal orderQty = detail.orderDetails?.Sum(x => Convert.ToDecimal(x.quantity)) ?? 0;
+ decimal diffQty = detail.stocktakingDetails?.Sum(x => Convert.ToDecimal(x.differenceQuantity)) ?? 0;
+ //decimal orderQty = detail.orderDetails?.Sum(x => Convert.ToDecimal(x.quantity)) ?? 0;
+ //decimal diffQty = detail.stocktakingDetails?.Sum(x => Convert.ToDecimal(x.differenceQuantity)) ?? 0;
+
+ if (entity == null)
+ {
+ // 濡傛灉涓嶅瓨鍦紝鏂板缓涓�鏉�
+ entity = new Dt_Inventory
+ {
+ Goods_no = detail.productCode ?? detail.productName,
+ Reservoirarea = "榛樿搴撳尯",
+ Batch_num = detail.batchNo,
+ Business_qty = 0,
+ Actual_qty = 0
+ };
+ }
+
+ switch (request.orderType)
+ {
+ case "1": // 鍏ュ簱
+ entity.Business_qty += orderQty;
+ entity.Actual_qty += orderQty;
+ break;
+
+ case "2": // 鍑哄簱
+ entity.Business_qty -= orderQty;
+ entity.Actual_qty -= orderQty;
+ if (entity.Business_qty < 0) entity.Business_qty = 0; // 鍙�夛細闃叉璐熸暟
+ if (entity.Actual_qty < 0) entity.Actual_qty = 0;
+ break;
+
+ case "3": // 鐩樼偣
+ if (detail.stocktakingDetails != null && detail.stocktakingDetails.Any())
+ {
+ foreach (var stock in detail.stocktakingDetails)
+ {
+ decimal diff = Convert.ToDecimal(stock.differenceQuantity);
+ if (stock.IsProfit == "1") // 鐩樼泩
+ {
+ entity.Actual_qty += diff;
+ }
+ else // 鐩樹簭
+ {
+ entity.Actual_qty -= diff;
+ if (entity.Actual_qty < 0) entity.Actual_qty = 0;
+ }
+ }
+ }
+ break;
+ }
+
+ // 淇濆瓨鏁版嵁
+ if (entity.Id == 0) // 鏂板缓
+ Db.Insertable(entity).ExecuteCommand();
+ else // 鏇存柊
+ Db.Updateable(entity).ExecuteCommand();
+ }
+
+ return new ApiResponse<Dt_Inventory> {code = "0", msg = "鎴愬姛" };
+ }
+ catch (Exception ex)
+ {
+ return new ApiResponse<Dt_Inventory> { code = "500", msg = ex.Message };
+ }
+ }
+
+
+
+
/// <summary>
/// 鎺ㄩ�佸紓甯镐俊鎭粰涓婃父绯荤粺1.鍏ュ簱鍗曟帴鍙o紱2.鍏ュ簱鍗曟姤瀹屾垚鎺ュ彛锛�3.鍑哄簱鍗曟帴鍙o紱4.鍑哄簱鎶ュ畬鎴愭帴鍙o紱5.鑽搧鍩虹淇℃伅鍚屾鎺ュ彛锛�6.渚涘簲鍟嗕俊鎭帴鍙o紱7.瀹㈡埛淇℃伅鎺ュ彛锛�8.搴撳瓨
/// </summary>
--
Gitblit v1.9.3