From 65ecd34acf0a3d33e6c1e10c93e351716d749e2f Mon Sep 17 00:00:00 2001
From: Administrator <Administrator@DESKTOP-5BIMHQ3>
Date: 星期三, 06 三月 2024 14:51:29 +0800
Subject: [PATCH] 修改出库单编辑页面

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

diff --git a/Wms/WMS.BLL/BllPdaServer/PdaCrServer.cs b/Wms/WMS.BLL/BllPdaServer/PdaCrServer.cs
index ed93f45..91da3f6 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;
@@ -292,6 +293,17 @@
                         checkDetail.RealQty = qty;
                     }
                     checkDetail.CheckResult = 1;
+                    var checkInfo = Db.Queryable<BllStockCheckLog>().First(m =>
+                    m.IsDel == "0" && m.CRNo == crNo && m.PalletNo == palletNo && m.SkuNo == sku && m.LotNo == lotNo);
+                    checkInfo.RealQty = qty;
+                    checkInfo.CheckResult = 1;
+
+                    checkInfo.CheckUserId = userId;
+                    checkInfo.CheckDate = time;
+
+                    checkInfo.UpdateUser = userId;
+                    checkInfo.UpdateTime = time;
+                    Db.Updateable(checkInfo).ExecuteCommand();
                     Db.Updateable(checkDetail).ExecuteCommand();
                     Db.Updateable(list).ExecuteCommand();
                 }
@@ -738,6 +750,10 @@
                 {
                     throw new Exception("鎵樼洏鍌ㄤ綅淇℃伅涓嶅瓨鍦�,璇锋鏌�!");
                 }
+                if (models.WareHouseNo != "W02")
+                {
+                    throw new Exception("璇ユ墭鐩樻湭鍦ㄥ钩搴撳唴,璇锋鏌�!");
+                }
                 return models.LocatNo;
             }
             catch (Exception ex)
@@ -764,6 +780,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)
                 {
@@ -785,6 +805,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