From 71d1dcdf796f08fa01cbc2d3faab86eea28b295b Mon Sep 17 00:00:00 2001
From: zhaowc <526854230@qq.com>
Date: 星期三, 17 十二月 2025 08:59:03 +0800
Subject: [PATCH] 物料管理页面修改

---
 Wms/WMS.BLL/SysServer/PalletsServer.cs |   87 ++++++++++++++++++++++++-------------------
 1 files changed, 48 insertions(+), 39 deletions(-)

diff --git a/Wms/WMS.BLL/SysServer/PalletsServer.cs b/Wms/WMS.BLL/SysServer/PalletsServer.cs
index dc5f08f..223b7ab 100644
--- a/Wms/WMS.BLL/SysServer/PalletsServer.cs
+++ b/Wms/WMS.BLL/SysServer/PalletsServer.cs
@@ -123,7 +123,7 @@
         /// <param name="locatNo"></param>
         /// <param name="userId"></param>
         /// <exception cref="Exception"></exception>
-        public void AddPallets(string palletNo,string locatNo, string deviceCode, string url, int userId)
+        public void AddPallets(string palletNo,string locatNo, string status, string url, int userId)
         {
             var db = DataContext.Db;
             try
@@ -146,6 +146,18 @@
                 {
                     throw new Exception("鍌ㄤ綅鍦板潃涓嶅瓨鍦�");
                 }
+                if (locatModel.Flag == "1") 
+                {
+                    throw new Exception("璇ュ偍浣嶅凡灞忚斀");
+                }
+                var nlocat = db.Queryable<SysStorageLocat>().First(w => w.AisleOne == locatModel.LocatNo && w.IsDel == "0");
+                if (nlocat != null)
+                {
+                    if (nlocat.Status == "0")
+                    {
+                        throw new Exception("璇蜂粠鍐呬晶搴撲綅寮�濮嬬粦瀹�");
+                    }
+                }
                 if (locatModel.Status != "0")
                 {
                     throw new Exception("璇ュ偍浣嶅湴鍧�闈炵┖闂茬姸鎬�");
@@ -155,33 +167,28 @@
                 {
                     throw new Exception("鍌ㄤ綅鍦板潃鎵�灞炲尯鍩熶笉瀛樺湪");
                 }
-                if (!areaModel.AreaName.Contains("鍑�妗�"))
+                switch (status)
                 {
-                    throw new Exception("鏂版坊鍔犵殑妗跺彧鑳界粦瀹氬噣妗跺尯");
+                    case "0":
+                        if (!areaModel.AreaName.Contains("鍑�妗�"))
+                        {
+                            throw new Exception("璇烽�夋嫨鍑�妗跺尯鍩熻繘琛岀粦瀹�");
+                        }
+                        break;
+                    case "3":
+                        if (!areaModel.AreaName.Contains("鑴忔《"))
+                        {
+                            throw new Exception("璇烽�夋嫨鑴忔《鍖哄煙杩涜缁戝畾");
+                        }
+                        break;
+                    default:
+                        throw new Exception("璇烽�夋嫨妗剁被鍨嬶紒");
+                        break;
                 }
-                //if (!string.IsNullOrEmpty(deviceCode))
-                //{
-                //    var areaInfo = db.Queryable<SysStorageArea>().First(w => w.IsDel == "0" && w.DeviceCode.Contains(deviceCode));
-                //    if (areaInfo == null)
-                //    {
-                //        throw new Exception("鏈煡鍒拌澶囨墍灞炲尯鍩熶俊鎭�");
-                //    }
-                //    //125璁惧鏄帴鏂欏拰娣锋枡涓�浣撴満
-                //    if (deviceCode != "125")
-                //    {
-                //        if (!areaInfo.AreaName.Contains("鎺ユ枡璁惧"))
-                //        {
-                //            throw new Exception("鍙兘缁戝畾鎺ユ枡璁惧");
-                //        }
-                //        if (areaInfo.WareHouseNo != "M03")
-                //        {
-                //            throw new Exception("鍙湁澶у崟浣撹溅闂存墠鑳界粦瀹氳澶�");
-                //        }
-                //    }                    
-                //}
-                if (!string.IsNullOrEmpty(deviceCode))
+                string deviceCode = "";
+                if (!string.IsNullOrEmpty(palletNo))
                 {
-                    switch (deviceCode)
+                    switch (palletNo.Substring(2,3))
                     {
                         case "400":
                             deviceCode = "400L";
@@ -189,11 +196,11 @@
                         case "800":
                             deviceCode = "800L";
                             break;
-                        case "1000":
+                        case "100":
                             deviceCode = "1000L";
                             break;
                         default:
-                            throw new Exception("涓嶈兘褰曞叆400锛�800锛�1000浠ュ鐨勫��");
+                            throw new Exception("妗跺彿褰曞叆閿欒锛岃鏍稿疄锛�");
                     }
 
                 }
@@ -208,6 +215,7 @@
                 palletModel.CreateUser = userId;
                 //娣诲姞妗�
                 db.Insertable(palletModel).ExecuteCommand();
+
 
                 var comTime = DateTime.Now;
                 var model = new DataStockDetail()
@@ -240,7 +248,7 @@
                     SkuName = "",
                     LotNo = "",
 
-                    PalletStatus = "0",//鍑�妗�
+                    PalletStatus = status,
 
                     Standard = deviceCode,  //瑙勬牸
 
@@ -254,21 +262,22 @@
 
                 //鏇存柊鍌ㄤ綅鐘舵��
                 locatModel.Status = "1";//鏈夌墿鍝�
+                locatModel.UpdateTime = DateTime.Now;
                 db.Updateable(locatModel).ExecuteCommand();
 
                 //涓嬪彂AGV缁戝畾杞藉叿鎺ュ彛
                 //璋冪敤AGV鎺ュ彛涓嬪彂浠诲姟
-                //string agvMsg = string.Empty;
-                ////缁欎笅杞︿笅鍙戜换鍔�
-                //var agvResult = RcsHelper.BindPalletAndSite(palletNo, locatNo,url, out agvMsg);
-                //if (agvResult)//鎴愬姛
-                //{
-                //     //澧炲姞鏃ュ織
-                //}
-                //else//澶辫触
-                //{
-                //    throw new Exception("灏忚溅杞藉叿鍜屽簱浣嶅叧绯荤粦瀹氬け璐ワ紝鍘熷洜锛�"+agvMsg);
-                //}
+                string agvMsg = string.Empty;
+                //缁欎笅杞︿笅鍙戜换鍔�
+                var agvResult = RcsHelper.BindPalletAndSite(palletNo, locatNo, url, out agvMsg);
+                if (agvResult)//鎴愬姛
+                {
+                    //澧炲姞鏃ュ織
+                }
+                else//澶辫触
+                {
+                    throw new Exception("灏忚溅杞藉叿鍜屽簱浣嶅叧绯荤粦瀹氬け璐ワ紝鍘熷洜锛�" + agvMsg);
+                }
 
                 //鎻愪氦浜嬪姟
                 db.CommitTran();

--
Gitblit v1.8.0