From d09a1552e45e6cfc8f83c0249cd296b8706c0dc2 Mon Sep 17 00:00:00 2001
From: zhaowc <526854230@qq.com>
Date: 星期二, 20 五月 2025 09:33:27 +0800
Subject: [PATCH] 修改下发AGV任务接口,修改条码增加功能

---
 Wms/WMS.BLL/SysServer/PalletsServer.cs |   69 ++++++++++++++++++++++++++--------
 1 files changed, 52 insertions(+), 17 deletions(-)

diff --git a/Wms/WMS.BLL/SysServer/PalletsServer.cs b/Wms/WMS.BLL/SysServer/PalletsServer.cs
index d43f570..dc5f08f 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 deviceCode, string url, int userId)
         {
             var db = DataContext.Db;
             try
@@ -157,31 +159,50 @@
                 {
                     throw new Exception("鏂版坊鍔犵殑妗跺彧鑳界粦瀹氬噣妗跺尯");
                 }
+                //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))
                 {
-                    var areaInfo = db.Queryable<SysStorageArea>().First(w => w.IsDel == "0" && w.DeviceCode.Contains(deviceCode));
-                    if (areaInfo == null)
+                    switch (deviceCode)
                     {
-                        throw new Exception("鏈煡鍒拌澶囨墍灞炲尯鍩熶俊鎭�");
+                        case "400":
+                            deviceCode = "400L";
+                            break;
+                        case "800":
+                            deviceCode = "800L";
+                            break;
+                        case "1000":
+                            deviceCode = "1000L";
+                            break;
+                        default:
+                            throw new Exception("涓嶈兘褰曞叆400锛�800锛�1000浠ュ鐨勫��");
                     }
-                    //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;
@@ -221,7 +242,7 @@
 
                     PalletStatus = "0",//鍑�妗�
 
-                    UDF1 = deviceCode,
+                    Standard = deviceCode,  //瑙勬牸
 
                     IsDel = "0",
                     CreateUser = userId,
@@ -235,6 +256,20 @@
                 locatModel.Status = "1";//鏈夌墿鍝�
                 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