From 3713a17fe36d877ce3e588c1dc08526fc8afffdc Mon Sep 17 00:00:00 2001
From: yanjinhui <3306209981@qq.com>
Date: 星期四, 23 十月 2025 09:26:31 +0800
Subject: [PATCH] 111
---
新建文件夹/WIDESEA_WMSServer/ClassLibrary2/InventoryInfoService.cs | 150 -------------------------------------------------
1 files changed, 2 insertions(+), 148 deletions(-)
diff --git "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/ClassLibrary2/InventoryInfoService.cs" "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/ClassLibrary2/InventoryInfoService.cs"
index 858b401..dc66a17 100644
--- "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/ClassLibrary2/InventoryInfoService.cs"
+++ "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/ClassLibrary2/InventoryInfoService.cs"
@@ -1,4 +1,5 @@
锘縰sing HslCommunication;
+using MailKit.Search;
using SqlSugar;
using System;
using System.Collections.Generic;
@@ -23,153 +24,6 @@
}
public IRepository<Dt_InventoryInfo> Repository => BaseDal;
- /// <summary>
- /// wcs鍥炰紶缁欐垜璋冪敤鎴戠殑鏂规硶
- /// </summary>
- /// <param name="request"></param>
- /// <returns></returns>
- public ApiResponse<Dt_InventoryInfo> OrderFeedback(EdiOrderCallbackRequest request)
- {
- try
- {
- if (request == null || request.details == null || !request.details.Any())
- {
- return new ApiResponse<Dt_InventoryInfo> { code = "500", msg = "璇锋眰鍙傛暟鏃犳晥" };
- }
-
- BaseDal.Db.Ado.BeginTran(); // 寮�鍚簨鍔�
-
- foreach (var detail in request.details)
- {
- // 鑾峰彇鏄庣粏涓殑鎬诲叆搴撴暟閲忥紙鑷姩杞负姝f暟锛�
- decimal orderQty = detail.orderDetails?
- .Sum(x => decimal.TryParse(x.quantity, out var q) ? Math.Abs(q) : 0)
- ?? 0;
-
- //鐩樼偣
- decimal diffQty = detail.stocktakingDetails?
- .Sum(x => Convert.ToDecimal(x.differenceQuantity))
- ?? 0;
-
- // 鏍规嵁鐗╂枡缂栧彿 + 鎵规鍙� 鏌ユ壘鏄惁宸叉湁搴撳瓨
- var entity = BaseDal.Db.Queryable<Dt_InventoryInfo>()
- .First(x => x.MaterielCode == detail.productCode && x.BatchNo == detail.batchNo);
-
- if (entity == null)
- {
- // 馃啎 涓嶅瓨鍦ㄥ垯鏂板缓搴撳瓨璁板綍
- entity = new Dt_InventoryInfo
- {
- PalletCode = detail.orderDetails?.FirstOrDefault()?.palletCode ?? "",
- WarehouseCode = 001.ToString(), // 榛樿搴撴埧缂栧彿锛屽彲鏍规嵁涓氬姟鏀�
- LocationCode = "", // 鏆傛棤鍙┖
- StockStatus = 1, // 绔嬪簱鍥哄畾涓� 1
- MaterielCode = detail.productCode ?? detail.productName,
- MaterielName = detail.productName ?? "",
- MaterielSpec = detail.productSpecifications ?? "",
- BatchNo = detail.batchNo,
- // 鍒濇鍏ュ簱鏁伴噺 = 瀹為檯鍏ュ簱鏁伴噺
- StockQuantity = 0,
- OutboundQuantity = 0,
- SupplyQuantity = 0,
- InDate = DateTime.Now,
- ProductionDate = detail.finishDate.ToString("yyyy-MM-dd"),
- ShelfLife = 0,
- ValidityPeriod = "",
- Remark = "WCS鍥炰紶鍒涘缓"
- };
- }
-
- switch (request.orderType)
- {
- case "1": // 鍏ュ簱
- entity.StockQuantity += (float)orderQty;
- entity.InDate = DateTime.Now;
- entity.Remark = "鍏ュ簱鍗曞洖浼�";
- break;
-
- case "2": // 鍑哄簱
- entity.OutboundQuantity += (float)orderQty;
- entity.StockQuantity -= (float)orderQty;
- if (entity.StockQuantity < 0) entity.StockQuantity = 0;
- entity.Remark = "鍑哄簱鍗曞洖浼�";
- 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.SupplyQuantity += (float)Math.Abs(diff);
- }
- else // 鐩樹簭
- {
- entity.SupplyQuantity -= (float)Math.Abs(diff);
- if (entity.SupplyQuantity < 0) entity.SupplyQuantity = 0;
- }
- entity.PalletCode = stock.palletCode;
- entity.Remark = "鐩樼偣鍗曞洖浼�";
- }
- }
- break;
- }
-
- // 鎻掑叆鎴栨洿鏂版暟鎹簱
- if (entity.Id == 0)
- {
- BaseDal.Db.Insertable(entity).ExecuteCommand();
- }
- else
- {
- BaseDal.Db.Updateable(entity).ExecuteCommand();
- }
- }
-
- BaseDal.Db.Ado.CommitTran();
- return new ApiResponse<Dt_InventoryInfo> { code = "0", msg = "鎴愬姛" };
- }
- catch (Exception ex)
- {
- BaseDal.Db.Ado.RollbackTran();
- return new ApiResponse<Dt_InventoryInfo> { code = "500", msg = ex.Message };
- }
- }
-
-
-
-
-
-
-
-
- /// <summary>
- /// 鎺ㄩ�佸紓甯镐俊鎭粰涓婃父绯荤粺1.鍏ュ簱鍗曟帴鍙o紱2.鍏ュ簱鍗曟姤瀹屾垚鎺ュ彛锛�3.鍑哄簱鍗曟帴鍙o紱4.鍑哄簱鎶ュ畬鎴愭帴鍙o紱5.鑽搧鍩虹淇℃伅鍚屾鎺ュ彛锛�6.渚涘簲鍟嗕俊鎭帴鍙o紱7.瀹㈡埛淇℃伅鎺ュ彛锛�8.搴撳瓨
- /// </summary>
- public void SendErrorToUpstream(int type, string code, string message, string remark)
- {
- try
- {
- var url = "http://121.37.118.63:80/GYZ2/95fck/exceptionLog";
-
- var requestData = new
- {
- type = type.ToString(),
- code = code,
- message = message,
- remark = remark
- };
-
- var result = HttpHelper.Post(url, requestData.ToJsonString());
- // 鍙互鍙嶅簭鍒楀寲妫�鏌� resultCode 鏄惁涓�0
- }
- catch (Exception e)
- {
- // 杩欓噷涓嶈鍐嶆姏寮傚父浜嗭紝閬垮厤姝诲惊鐜�
- Console.WriteLine("寮傚父鎺ュ彛鎺ㄩ�佸け璐ワ細" + e.Message);
- }
- }
+
}
}
--
Gitblit v1.9.3