From bfcd7f5b405e431a5c07fe3fa77d74c892d4e66b Mon Sep 17 00:00:00 2001
From: xiazhengtongxue <133085197+xiazhengtongxue@users.noreply.github.com>
Date: 星期四, 19 三月 2026 15:52:42 +0800
Subject: [PATCH] fix: 修复出入库冲突拦截,系统位置与实际位置的映射和修复

---
 项目代码/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockInfoService.cs |   84 ++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 84 insertions(+), 0 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockInfoService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockInfoService.cs"
index 339d933..f4418ab 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockInfoService.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockInfoService.cs"
@@ -1,6 +1,13 @@
 锘縰sing AutoMapper;
+using Org.BouncyCastle.Crypto;
+using SqlSugar;
+using StackExchange.Profiling.Internal;
+using WIDESEA_Common.Log;
+using WIDESEA_Common.StockEnum;
+using WIDESEA_Core;
 using WIDESEA_Core.BaseRepository;
 using WIDESEA_Core.BaseServices;
+using WIDESEA_Core.Utilities;
 using WIDESEA_IStockService;
 using WIDESEA_Model.Models;
 
@@ -17,5 +24,82 @@
             _mapper = mapper;
         }
 
+        /*public WebResponseContent AddStockInfo(string PalletCode, int PalletType, int WarehouseId)
+        {
+            WebResponseContent webResponse=new WebResponseContent();
+            try
+            {
+                Dt_StockInfo dt_StockInfo = new Dt_StockInfo();
+                dt_StockInfo.PalletCode = PalletCode;
+                dt_StockInfo.PalletType = PalletType;
+                dt_StockInfo.WarehouseId = WarehouseId;
+                dt_StockInfo.StockStatus = (int)StockStatusEmun.鍏ュ簱涓�;
+                dt_StockInfo.Creater = "MWS";
+                dt_StockInfo.CreateDate = DateTime.Now;
+                BaseDal.AddData(dt_StockInfo);
+                return webResponse.OK();
+            }
+            catch (Exception ex)
+            {
+                return webResponse.Error($"搴撳瓨娣诲姞閿欒锛氬師鍥狅細{ex.Message}");
+            }
+        }*/
+
+        
+        public virtual WebResponseContent DeleteData(object[] keys)
+        {
+            List<Dt_StockInfo> stodata = new List<Dt_StockInfo>();
+            try
+            {
+                if (typeof(Dt_StockInfo).GetNavigatePro() == null)
+                    return BaseDal.DeleteDataByIds(keys) ? WebResponseContent.Instance.OK() : WebResponseContent.Instance.Error();
+                else
+                {
+                    if (keys != null)
+                    {
+                        Type detailType = typeof(Dt_StockInfo).GetDetailType();
+                        string name = typeof(Dt_StockInfo).GetMainIdByDetail();
+                        List<object> dynamicDelKeys = new List<object>();
+
+                        for (int i = 0; i < keys.Length; i++)
+                        {
+                            dynamicDelKeys.Add(keys[i]);
+                        }
+                        ((SqlSugarClient)BaseDal.Db).BeginTran();
+
+                        foreach (var key in keys)
+                        {
+                            int idt = int.Parse(key.ToString());
+                            stodata.Add(BaseDal.QueryData(x => x.Id == idt).FirstOrDefault());
+                        }
+
+                        if (dynamicDelKeys.Count > 0)
+                            WriteLog.Write_Log("WMS_鍒犻櫎搴撳瓨", $"鍒犻櫎淇℃伅", "鎴愬姛", $"鍙傛暟锛歿stodata.ToJson()}");
+                            BaseDal.Db.Deleteable<object>().AS(detailType.Name).Where($"{name} in (@id)", new { id = dynamicDelKeys.ToArray() }).ExecuteCommandHasChange();
+
+                        BaseDal.DeleteDataByIds(keys);
+
+                        ((SqlSugarClient)BaseDal.Db).CommitTran();
+
+                        return WebResponseContent.Instance.OK();
+                    }
+                    else
+                    {
+                        return WebResponseContent.Instance.Error("鍙傛暟閿欒");
+                    }
+                }
+            }
+            catch (Exception ex)
+            {
+                ((SqlSugarClient)BaseDal.Db).RollbackTran();
+                return WebResponseContent.Instance.Error(ex.Message);
+            }
+        }
+
+        public bool IsContainerNoExist(string containerNo)
+        {
+            // 鐩存帴鍒ゆ柇鏄惁瀛樺湪婊¤冻鏉′欢鐨勮褰�
+            return BaseDal.QueryData(x => x.PalletCode == containerNo).Any();
+        }
     }
 }

--
Gitblit v1.9.3