From 5ab19c977cfb0551a88b3885b0648183fbfff672 Mon Sep 17 00:00:00 2001
From: libo <Administrator@DESKTOP-1A6QMNS>
Date: 星期一, 31 三月 2025 10:10:12 +0800
Subject: [PATCH] 调整wms出入库、返库逻辑,调整与比亚迪接口对接的类型和方法,调整配置参数,写入服务器上数据库密码

---
 项目代码/WMS/WIDESEA_WMSServer/WIDESEA_StockRepository/StockInfoRepository.cs |   62 ++++++++++++++++++++++++------
 1 files changed, 49 insertions(+), 13 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_StockRepository/StockInfoRepository.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_StockRepository/StockInfoRepository.cs"
index 67d309a..e06c147 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_StockRepository/StockInfoRepository.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_StockRepository/StockInfoRepository.cs"
@@ -24,7 +24,7 @@
     public class StockInfoRepository : RepositoryBase<Dt_StockInfo>, IStockInfoRepository
     {
         private readonly ILabelMasterRepository _labelMasterRepository;
-        public StockInfoRepository(IUnitOfWorkManage unitOfWorkManage,ILabelMasterRepository labelMasterRepository) : base(unitOfWorkManage)
+        public StockInfoRepository(IUnitOfWorkManage unitOfWorkManage, ILabelMasterRepository labelMasterRepository) : base(unitOfWorkManage)
         {
             _labelMasterRepository = labelMasterRepository;
         }
@@ -78,15 +78,15 @@
         /// </summary>
         /// <param name="materielCode"></param>
         /// <returns></returns>
-        public List<Dt_StockInfo> GetStockInfos(string materielCode,string batchNo)
+        public List<Dt_StockInfo> GetStockInfos(string materielCode, string batchNo)
         {
-            return Db.Queryable<Dt_StockInfo>().Includes(x => x.Details).Where(x => x.Details.Any(v => v.MaterielCode == materielCode&&v.BatchNo==batchNo)).ToList();       
+            return Db.Queryable<Dt_StockInfo>().Includes(x => x.Details).Where(x => x.Details.Any(v => v.MaterielCode == materielCode && v.BatchNo == batchNo)).ToList();
         }
 
         public List<Dt_StockInfo> GetStockInfos(string materielCode, List<string> locationCodes)
         {
             //淇敼鍙幏鍙栧凡涓婃灦鐘舵�佺殑搴撳瓨
-            return Db.Queryable<Dt_StockInfo>().Where(x => locationCodes.Contains(x.LocationCode)&&x.StockStatus== (int)StockStatusEmun.宸蹭笂鏋�).Includes(x => x.Details).Where(x => x.Details.Any(v => v.MaterielCode == materielCode)).ToList();
+            return Db.Queryable<Dt_StockInfo>().Where(x => locationCodes.Contains(x.LocationCode) && x.StockStatus == (int)StockStatusEmun.宸蹭笂鏋�).Includes(x => x.Details).Where(x => x.Details.Any(v => v.MaterielCode == materielCode)).ToList();
 
 
             //ISugarQueryable<Dt_LocationInfo> sugarQueryable = Db.Queryable<Dt_LocationInfo>().Where(x => locationCodes.Contains(x.LocationCode));
@@ -118,9 +118,9 @@
         {
             //ISugarQueryable<string> locationCodes = Db.Queryable<Dt_LocationInfo>().Where(x => x.RoadwayNo == roadwayNo && x.LocationStatus == LocationStatusEnum.Pallet.ObjToInt() && (x.EnalbeStatus == LocationEnalbeStatusEnum.OnlyOut.ObjToInt() || LocationEnalbeStatusEnum.Normal.ObjToInt() == x.EnalbeStatus)).Select(x => x.LocationCode);
             return Db.Queryable<Dt_StockInfo>().Where(x => x.StockStatus == StockStatusEmun.宸插叆搴�.ObjToInt() && SqlFunc.Subqueryable<Dt_LocationInfo>().Where(v => v.LocationCode == x.LocationCode && v.RoadwayNo == roadwayNo && v.LocationStatus == LocationStatusEnum.Pallet.ObjToInt() && (EnableStatusEnum.Normal.ObjToInt() == v.EnableStatus)).Any()).OrderBy(x => x.ModifyDate).First();
-        
+
         }
-        public Dt_StockInfo GetPalletStockInfo(string roadwayNo,string strayType)
+        public Dt_StockInfo GetPalletStockInfo(string roadwayNo, string strayType)
         {
             //ISugarQueryable<string> locationCodes = Db.Queryable<Dt_LocationInfo>().Where(x => x.RoadwayNo == roadwayNo && x.LocationStatus == LocationStatusEnum.Pallet.ObjToInt() && (x.EnalbeStatus == LocationEnalbeStatusEnum.OnlyOut.ObjToInt() || LocationEnalbeStatusEnum.Normal.ObjToInt() == x.EnalbeStatus)).Select(x => x.LocationCode);
             if (strayType == "1")
@@ -161,7 +161,7 @@
                             stockItem.LGORT = "0030";//搴撲綅
                             if (labelMaster != null)
                             {
-                                if (labelMaster.WH_NUMBER == inventoryQueryRequest.DATA[0].WH_NUMBER && labelMaster.WERKS == inventoryQueryRequest.DATA[0].WH_NUMBER)
+                                if (labelMaster.WH_NUMBER == inventoryQueryRequest.DATA[0].WH_NUMBER && labelMaster.WERKS == inventoryQueryRequest.DATA[0].WERKS)
                                 {
                                     stockItem.LIFNR = labelMaster.LIFNR;
                                     stockItem.LIKTX = labelMaster.LIKTX;
@@ -170,7 +170,20 @@
                                     stockItem.MATNR = labelMaster.MATNR;
                                     stockItem.MEINS = labelMaster.UNIT;
                                     stockItem.QTY = labelMaster.BOX_QTY;
-                                    stockItem.SOBKZ = labelMaster.SOBKZ;
+                                    var sobkz = "闈為檺鍒�";
+                                    if (labelMaster.SOBKZ == "0")
+                                    {
+                                        sobkz = "闈為檺鍒�";
+                                    }
+                                    else if (labelMaster.SOBKZ == "1")
+                                    {
+                                        sobkz = "鍐荤粨";
+                                    }
+                                    else if (labelMaster.SOBKZ == "2")
+                                    {
+                                        sobkz = "寰呰川妫�";
+                                    }
+                                    stockItem.SOBKZ = sobkz;
                                     stockItem.TPNUM = view.PalletCode;
                                     stockItem.WERKS = labelMaster.WERKS;//宸ュ巶
                                     stockItem.WH_NUMBER = labelMaster.WH_NUMBER;//浠撳簱鍙�
@@ -206,18 +219,20 @@
         /// </summary>
         /// <param name="freezeByCustomerResponse"></param>
         /// <returns></returns>
-        public freezeByCustomerResponse freezeByCustomer(string  freezeRequeststr)
+        public freezeByCustomerResponse freezeByCustomer(string freezeRequeststr)
         {
-          
+
             freezeByCustomerResponse freezeResponse = new freezeByCustomerResponse();
             try
             {
                 freezeByCustomerRequest freezeRequest = JsonConvert.DeserializeObject<freezeByCustomerRequest>(freezeRequeststr);
-                if (freezeRequest.WERKS == AppSettings.Configuration["WERKS"] && freezeRequest.WH_NUMBER == AppSettings.Configuration["SYSNO"])
+                if (freezeRequest.WERKS == AppSettings.Configuration["WERKS"] && freezeRequest.WH_NUMBER == AppSettings.Configuration["WERKS"])
                 {
                     //鏍规嵁鎵规鍜岀墿鏂欏彿鏌ユ壘瀵瑰簲鐨勬墭鐩樺彿锛屽喕缁撳簱瀛橈紝鍙湁鍏ュ簱鎴愬姛浜嗭紝鎵嶈兘琚喕缁�
                     List<Dt_StockInfo> stockInfos = GetStockInfos(freezeRequest.MATNR, freezeRequest.BATCH);
-                    if (freezeRequest.FREEZE_TYPE == "00")//00鍐荤粨 
+
+                    List<Dt_LabelMaster> labelInfos = _labelMasterRepository.QueryData(x => x.MATNR == freezeRequest.MATNR && x.BATCH == freezeRequest.BATCH);
+                    if (freezeRequest.YWLX == "00")//00鍐荤粨 
                     {
                         foreach (var item in stockInfos)
                         {
@@ -227,10 +242,17 @@
                                 UpdateData(item);
                             }
                         }
+
+                        foreach (var li in labelInfos)
+                        {
+                            li.SOBKZ = "1";
+                        }
+                        _labelMasterRepository.UpdateData(labelInfos);
+
                         freezeResponse.MSGTY = "S";
                         freezeResponse.MSGTX = "";
                     }
-                    else if (freezeRequest.FREEZE_TYPE == "01") //01瑙e喕
+                    else if (freezeRequest.YWLX == "01") //01瑙e喕
                     {
                         foreach (var item in stockInfos)
                         {
@@ -240,6 +262,20 @@
                                 UpdateData(item);
                             }
                         }
+
+                        foreach (var li in labelInfos)
+                        {
+                            //if (li.LABEL_STATUS == "01")
+                            //{
+                            //    li.SOBKZ = "2";
+                            //}
+                            //else
+                            //{
+                            li.SOBKZ = "0";
+                            //}
+                        }
+                        _labelMasterRepository.UpdateData(labelInfos);
+
                         freezeResponse.MSGTY = "S";
                         freezeResponse.MSGTX = "";
 

--
Gitblit v1.9.3