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 |   86 ++++++++++++++++++++++++++++++++----------
 1 files changed, 65 insertions(+), 21 deletions(-)

diff --git a/Wms/WMS.BLL/SysServer/PalletsServer.cs b/Wms/WMS.BLL/SysServer/PalletsServer.cs
index d43f570..223b7ab 100644
--- a/Wms/WMS.BLL/SysServer/PalletsServer.cs
+++ b/Wms/WMS.BLL/SysServer/PalletsServer.cs
@@ -2,6 +2,7 @@
 using System.Collections.Generic;
 using System.Linq;
 using System.Linq.Expressions;
+using System.Security.Policy;
 using System.Text;
 using System.Threading;
 using System.Threading.Tasks;
@@ -9,6 +10,7 @@
 using Model.ModelDto.LogDto;
 using Model.ModelDto.SysDto;
 using SqlSugar;
+using Utility.Tools;
 using WMS.BLL.LogServer;
 using WMS.Entity.Context;
 using WMS.Entity.DataEntity;
@@ -121,7 +123,7 @@
         /// <param name="locatNo"></param>
         /// <param name="userId"></param>
         /// <exception cref="Exception"></exception>
-        public void AddPallets(string palletNo,string locatNo, string deviceCode, int userId)
+        public void AddPallets(string palletNo,string locatNo, string status, string url, int userId)
         {
             var db = DataContext.Db;
             try
@@ -144,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("璇ュ偍浣嶅湴鍧�闈炵┖闂茬姸鎬�");
@@ -153,40 +167,55 @@
                 {
                     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))
+                string deviceCode = "";
+                if (!string.IsNullOrEmpty(palletNo))
                 {
-                    var areaInfo = db.Queryable<SysStorageArea>().First(w => w.IsDel == "0" && w.DeviceCode.Contains(deviceCode));
-                    if (areaInfo == null)
+                    switch (palletNo.Substring(2,3))
                     {
-                        throw new Exception("鏈煡鍒拌澶囨墍灞炲尯鍩熶俊鎭�");
+                        case "400":
+                            deviceCode = "400L";
+                            break;
+                        case "800":
+                            deviceCode = "800L";
+                            break;
+                        case "100":
+                            deviceCode = "1000L";
+                            break;
+                        default:
+                            throw new Exception("妗跺彿褰曞叆閿欒锛岃鏍稿疄锛�");
                     }
-                    //125璁惧鏄帴鏂欏拰娣锋枡涓�浣撴満
-                    if (deviceCode != "125")
-                    {
-                        if (!areaInfo.AreaName.Contains("鎺ユ枡璁惧"))
-                        {
-                            throw new Exception("鍙兘缁戝畾鎺ユ枡璁惧");
-                        }
-                        if (areaInfo.WareHouseNo != "M03")
-                        {
-                            throw new Exception("鍙湁澶у崟浣撹溅闂存墠鑳界粦瀹氳澶�");
-                        }
-                    }                    
+
                 }
                 //寮�鍚簨鍔�
                 db.BeginTran();
 
                 palletModel = new SysPallets();
                 palletModel.PalletNo = palletNo;
+                palletModel.Standard = deviceCode;
                 palletModel.Type = "0";
                 palletModel.Status = "0";
                 palletModel.CreateUser = userId;
                 //娣诲姞妗�
                 db.Insertable(palletModel).ExecuteCommand();
+
 
                 var comTime = DateTime.Now;
                 var model = new DataStockDetail()
@@ -219,9 +248,9 @@
                     SkuName = "",
                     LotNo = "",
 
-                    PalletStatus = "0",//鍑�妗�
+                    PalletStatus = status,
 
-                    UDF1 = deviceCode,
+                    Standard = deviceCode,  //瑙勬牸
 
                     IsDel = "0",
                     CreateUser = userId,
@@ -233,8 +262,23 @@
 
                 //鏇存柊鍌ㄤ綅鐘舵��
                 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);
+                }
+
                 //鎻愪氦浜嬪姟
                 db.CommitTran();
             }

--
Gitblit v1.8.0