From 5f35c217da1424cf6a1aafd5e912e9cf29450fa4 Mon Sep 17 00:00:00 2001
From: Administrator <Administrator@DESKTOP-5BIMHQ3>
Date: 星期二, 27 二月 2024 16:01:53 +0800
Subject: [PATCH] PDA开发AGV转运模块功能

---
 Wms/WMS.BLL/BllPdaServer/PdaCrServer.cs |  207 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 207 insertions(+), 0 deletions(-)

diff --git a/Wms/WMS.BLL/BllPdaServer/PdaCrServer.cs b/Wms/WMS.BLL/BllPdaServer/PdaCrServer.cs
index cda3452..e01b252 100644
--- a/Wms/WMS.BLL/BllPdaServer/PdaCrServer.cs
+++ b/Wms/WMS.BLL/BllPdaServer/PdaCrServer.cs
@@ -8,6 +8,7 @@
 using WMS.BLL.LogServer;
 using WMS.Entity.BllAsnEntity;
 using WMS.Entity.BllCheckEntity;
+using WMS.Entity.BllSoEntity;
 using WMS.Entity.Context;
 using WMS.Entity.DataEntity;
 using WMS.Entity.SysEntity;
@@ -656,6 +657,10 @@
                 {
                     throw new Exception("鎵樼洏鍌ㄤ綅淇℃伅涓嶅瓨鍦�,璇锋鏌�!");
                 }
+                if (models.WareHouseNo != "W02")
+                {
+                    throw new Exception("璇ユ墭鐩樻湭鍦ㄥ钩搴撳唴,璇锋鏌�!");
+                }
                 return models.LocatNo;
             }
             catch (Exception ex)
@@ -682,6 +687,10 @@
                 {
                     throw new Exception("鎵樼洏鍌ㄤ綅淇℃伅涓嶅瓨鍦�,璇锋鏌�!");
                 }
+                if (models.WareHouseNo != "W02")
+                {
+                    throw new Exception("璇ユ墭鐩樻湭鍦ㄥ钩搴撳唴,璇锋鏌�!");
+                }
                 var storageLocat = Db.Queryable<SysStorageLocat>().First(w => w.IsDel == "0" && w.LocatNo == models.LocatNo);
                 if (storageLocat == null)
                 {
@@ -703,6 +712,204 @@
                 throw new Exception(ex.Message);
             }
         }
+        /// <summary>
+        /// 鑾峰彇宸插垎閰嶇殑鍑哄簱鍗曟嵁
+        /// </summary>
+        /// <returns></returns>
+        public List<string> GetRunSoNoticeList()
+        {
+            try
+            {
+                var allotList = Db.Queryable<BllExportNotice>().Where(m => m.IsDel == "0" && m.Status == "2").Select(m => m.SONo).Distinct().ToList();
+                return allotList;
+            }
+            catch (Exception ex)
+            {
+                throw new Exception(ex.Message);
+            }
+        }
+        /// <summary>
+        /// 鏍规嵁鎵樼洏鍙疯幏鍙栨墭鐩樹笂鐗╂枡淇℃伅
+        /// </summary>
+        /// <param name="palletNo"></param>
+        /// <returns></returns>
+        public List<DataStockDetail> GetSkuInfoByPalletNo(string palletNo)
+        {
+            try
+            {
+                if (string.IsNullOrEmpty(palletNo))
+                {
+                    throw new Exception("璇锋壂鎻忔墭鐩樻潯鐮侊紒");
+                }
+                var skuInfoList = Db.Queryable<DataStockDetail>().Where(m => m.IsDel == "0" && m.PalletNo == palletNo).ToList();
+                return skuInfoList;
+            }
+            catch (Exception ex)
+            {
+                throw new Exception(ex.Message);
+            }
+        }
+        /// <summary>
+        /// 鏍规嵁鍑哄簱鍗曞彿鑾峰彇鍒嗛厤鐨勬墭鐩樹俊鎭�
+        /// </summary>
+        /// <param name="soNo"></param>
+        /// <returns></returns>
+        public List<string> GetPalletNoListBySoNo(string soNo)
+        {
+            try
+            {
+                if (string.IsNullOrEmpty(soNo))
+                {
+                    throw new Exception("璇烽�夋嫨鍑哄簱鍗曞彿锛�");
+                }
+                var palletNoList = Db.Queryable<BllExportAllot>().Where(m => m.IsDel == "0" && m.SONo == soNo).Select(m => m.PalletNo).Distinct().ToList();
+                return palletNoList;
+            }
+            catch (Exception ex)
+            {
+                throw new Exception(ex.Message);
+            }
+        }
+
+        /// <summary>
+        /// agv杞繍鍛煎彨灏忚溅-寮�鍙戞湭瀹屾垚寰呯‘璁�
+        /// </summary>
+        /// <param name="palletNo"></param>
+        /// <param name="areaNo"></param>
+        /// <param name="ruku"></param>
+        public void AgvTransport(string palletNo, string areaNo, string ruku, int userId)
+        {
+            if (string.IsNullOrEmpty(palletNo))
+            {
+                throw new Exception("璇锋壂鎻忔墭鐩樻潯鐮侊紒");
+            }
+            if (string.IsNullOrEmpty(areaNo) && string.IsNullOrEmpty(ruku))
+            {
+                throw new Exception("璇烽�夋嫨鐩爣鍖哄煙鎴栧叆搴撳彛锛�");
+            }
+            try
+            {
+                var stockDetail = Db.Queryable<DataStockDetail>().First(w => w.IsDel == "0" && w.PalletNo == palletNo);
+                if (stockDetail == null)
+                {
+                    throw new Exception("鎵樼洏搴撳瓨淇℃伅涓嶅瓨鍦�,璇锋鏌�!");
+                }
+                if (string.IsNullOrEmpty(stockDetail.LocatNo))
+                {
+                    throw new Exception("鎵樼洏鍌ㄤ綅淇℃伅涓嶅瓨鍦�,璇锋鏌�!");
+                }
+                if (stockDetail.WareHouseNo != "W02")
+                {
+                    throw new Exception("璇ユ墭鐩樻湭鍦ㄥ钩搴撳唴,璇锋鏌�!");
+                }
+                var storageLocat = Db.Queryable<SysStorageLocat>().First(w => w.IsDel == "0" && w.LocatNo == stockDetail.LocatNo);
+                if (storageLocat == null)
+                {
+                    throw new Exception("鍌ㄤ綅淇℃伅涓嶅瓨鍦�,璇锋鏌�!");
+                }
+                //寮�鍚簨鍔�
+                Db.BeginTran();
+                //淇敼搴撳瓨鏄庣粏淇℃伅
+                stockDetail.WareHouseNo = "";
+                stockDetail.RoadwayNo = "";
+                stockDetail.AreaNo = "";
+                stockDetail.LocatNo = "";
+
+                Db.Updateable(stockDetail).ExecuteCommand();
+                //淇敼鍌ㄤ綅鍦板潃鐘舵��
+                storageLocat.Status = "0";//绌哄偍浣�
+
+                Db.Updateable(storageLocat).ExecuteCommand();
+
+                #region 鍛煎彨灏忚溅浠g爜
+
+                #endregion
+                //鎻愪氦浜嬪姟
+                Db.CommitTran();
+            }
+            catch (Exception ex)
+            {
+                Db.RollbackTran();
+                throw new Exception(ex.Message);
+            }
+        }
+        /// <summary>
+        /// agv杞繍鍛煎彨灏忚溅鍙栬揣-寮�鍙戞湭瀹屾垚寰呯‘璁�
+        /// </summary>
+        /// <param name="soNo"></param>
+        /// <param name="palletNo"></param>
+        /// <param name="areaNo"></param>
+        /// <param name="userId"></param>
+        public void AgvTransport2(string soNo,string palletNo, string areaNo, int userId)
+        {
+            if (string.IsNullOrEmpty(soNo))
+            {
+                throw new Exception("璇烽�夋嫨鍑哄簱鍗曟嵁锛�");
+            }
+            if (string.IsNullOrEmpty(palletNo))
+            {
+                throw new Exception("璇锋壂鎻忔墭鐩樻潯鐮侊紒");
+            }
+            if (string.IsNullOrEmpty(areaNo))
+            {
+                throw new Exception("璇烽�夋嫨鐩爣鍖哄煙锛�");
+            }
+            try
+            {
+                var notice = Db.Queryable<BllExportNotice>().First(w => w.IsDel == "0" && w.SONo == soNo);
+                if (notice == null)
+                {
+                    throw new Exception("鍑哄簱鍗曟嵁淇℃伅涓嶅瓨鍦�,璇锋鏌�!");
+                }
+                var allot = Db.Queryable<BllExportAllot>().First(w => w.IsDel == "0" && w.SONo == soNo && w.PalletNo == palletNo);
+                if (allot == null)
+                {
+                    throw new Exception("璇ユ墭鐩樺嚭搴撳垎閰嶄俊鎭笉瀛樺湪,璇锋鏌�!");
+                }
+                var stockDetail = Db.Queryable<DataStockDetail>().First(w => w.IsDel == "0" && w.PalletNo == palletNo);
+                if (stockDetail == null)
+                {
+                    throw new Exception("鎵樼洏搴撳瓨淇℃伅涓嶅瓨鍦�,璇锋鏌�!");
+                }
+                if (string.IsNullOrEmpty(stockDetail.LocatNo))
+                {
+                    throw new Exception("鎵樼洏鍌ㄤ綅淇℃伅涓嶅瓨鍦�,璇锋鏌�!");
+                }
+                if (stockDetail.WareHouseNo != "W02")
+                {
+                    throw new Exception("璇ユ墭鐩樻湭鍦ㄥ钩搴撳唴,璇锋鏌�!");
+                }
+                var storageLocat = Db.Queryable<SysStorageLocat>().First(w => w.IsDel == "0" && w.LocatNo == stockDetail.LocatNo);
+                if (storageLocat == null)
+                {
+                    throw new Exception("鍌ㄤ綅淇℃伅涓嶅瓨鍦�,璇锋鏌�!");
+                }
+                //寮�鍚簨鍔�
+                Db.BeginTran();
+                //淇敼搴撳瓨鏄庣粏淇℃伅
+                stockDetail.WareHouseNo = "";
+                stockDetail.RoadwayNo = "";
+                stockDetail.AreaNo = "";
+                stockDetail.LocatNo = "";
+
+                Db.Updateable(stockDetail).ExecuteCommand();
+                //淇敼鍌ㄤ綅鍦板潃鐘舵��
+                storageLocat.Status = "0";//绌哄偍浣�
+
+                Db.Updateable(storageLocat).ExecuteCommand();
+
+                #region 鍛煎彨灏忚溅浠g爜
+
+                #endregion
+                //鎻愪氦浜嬪姟
+                Db.CommitTran();
+            }
+            catch (Exception ex)
+            {
+                Db.RollbackTran();
+                throw new Exception(ex.Message);
+            }
+        }
         #endregion
 
     }

--
Gitblit v1.8.0