From ef48a7627cbb8dd2a257960a0890cebf190f75b5 Mon Sep 17 00:00:00 2001
From: DESKTOP-9BNTV8O <DESKTOP-9BNTV8O@163.com>
Date: 星期六, 14 十二月 2024 14:38:53 +0800
Subject: [PATCH] 修改问题

---
 Wms/WMS.BLL/BllTransServer/RcsServer.cs |   51 ++++++++++++++++++++++++++++++++++++++-------------
 1 files changed, 38 insertions(+), 13 deletions(-)

diff --git a/Wms/WMS.BLL/BllTransServer/RcsServer.cs b/Wms/WMS.BLL/BllTransServer/RcsServer.cs
index addb71c..9c651a2 100644
--- a/Wms/WMS.BLL/BllTransServer/RcsServer.cs
+++ b/Wms/WMS.BLL/BllTransServer/RcsServer.cs
@@ -56,8 +56,11 @@
                 switch (model.Type)
                 {
                     case "0"://鍙噣妗�
+                        //鏌ユ壘鍒拌杞﹂棿鍑�妗跺尯
+                        List<string> areaNoList = Db.Queryable<SysStorageArea>().Where(w => w.IsDel == "0" && w.Status == "0" && w.Type == "0" && w.WareHouseNo == houseNo).Select(s=>s.AreaNo).ToList();
+                        //鏌ユ壘鍑�妗�
                         pallet = stockDetail.Where(w => w.WareHouseNo == houseNo && w.PalletStatus == "0" && w.Status == "0"
-                        && (w.AreaNo.Contains("01") || w.AreaNo.Contains("11") || w.AreaNo.Contains("21") || w.AreaNo.Contains("31"))).OrderByDescending(o => o.CreateTime).First();
+                        && areaNoList.Contains(w.AreaNo)).OrderByDescending(o => o.CreateTime).First();
                         if (pallet == null)
                         {
                             throw new Exception("鏆傛棤鍑�妗跺彲鍒嗛厤");
@@ -74,9 +77,11 @@
                         {
                             throw new Exception("鎵规鍙蜂负绌猴紒");
                         }
+                        //鏌ユ壘鍒拌杞﹂棿棰勬贩鍖�
+                        List<string> areaNoList2 = Db.Queryable<SysStorageArea>().Where(w => w.IsDel == "0" && w.Status == "0" && w.Type == "1" && w.WareHouseNo == houseNo).Select(s => s.AreaNo).ToList();
                         //鏌ユ壘搴撳瓨涓槸鍚︽湁鍙敤鐨勬鎵规鐨勬贩鏂欐《
                         pallet = stockDetail.Where(w => w.WareHouseNo == houseNo && w.PalletStatus == "1" && w.Status == "0" && w.LotNo == model.LotNo
-                        && (w.AreaNo.Contains("02") || w.AreaNo.Contains("12") || w.AreaNo.Contains("22") || w.AreaNo.Contains("32"))).OrderByDescending(o => o.CompleteTime).First();
+                        && areaNoList2.Contains(w.AreaNo)).OrderByDescending(o => o.CompleteTime).First();
                         if (pallet == null)
                         {
                             throw new Exception("鏆傛棤娣锋枡妗跺彲鍒嗛厤");
@@ -112,9 +117,11 @@
                         //鏇存柊鍑哄簱鍗�
                         Db.Updateable(soNotice).ExecuteCommand();
 
+                        //鏌ユ壘鍒拌杞﹂棿鍗婃垚鍝佸尯
+                        List<string> areaNoList3 = Db.Queryable<SysStorageArea>().Where(w => w.IsDel == "0" && w.Status == "0" && w.Type == "2" && w.WareHouseNo == houseNo).Select(s => s.AreaNo).ToList();
                         //鏌ユ壘搴撳瓨涓槸鍚︽湁姝ゆ壒娆$殑鍚堟牸涓嬫枡妗�
                         pallet = stockDetail.Where(w => w.WareHouseNo == houseNo && w.PalletStatus == "2" && w.Status == "0" && w.LotNo == model.LotNo && w.InspectStatus=="1"
-                        && (w.AreaNo.Contains("03") || w.AreaNo.Contains("13") || w.AreaNo.Contains("23") || w.AreaNo.Contains("33"))).OrderByDescending(o => o.CompleteTime).First();
+                        && areaNoList3.Contains(w.AreaNo)).OrderByDescending(o => o.CompleteTime).First();
                         if (pallet == null)
                         {
                             throw new Exception("鏆傛棤涓嬫枡妗跺彲鍒嗛厤");
@@ -126,8 +133,10 @@
                         taskMsg = "璁惧鍙枡妗朵笅鏂欎换鍔�";
                         break;
                     case "3"://鍙剰妗�
+                        //鏌ユ壘鍒拌杞﹂棿鑴忔《鍖�
+                        List<string> areaNoList4 = Db.Queryable<SysStorageArea>().Where(w => w.IsDel == "0" && w.Status == "0" && w.Type == "3" && w.WareHouseNo == houseNo).Select(s => s.AreaNo).ToList();
                         List<DataStockDetail> palletList = stockDetail.Where(w => w.WareHouseNo == houseNo && w.PalletStatus == "3" && w.Status == "0"
-                        && (w.AreaNo.Contains("03") || w.AreaNo.Contains("13") || w.AreaNo.Contains("23") || w.AreaNo.Contains("33"))).OrderByDescending(o => o.CompleteTime).ToList();
+                        && areaNoList4.Contains(w.AreaNo)).OrderByDescending(o => o.CompleteTime).ToList();
                         if (palletList.Count <= 0)
                         {
                             throw new Exception("鏆傛棤鑴忔《鍙垎閰�");
@@ -348,7 +357,9 @@
                 switch (model.Type)
                 {
                     case "3"://娓呮礂璁惧鐢宠鍌ㄤ綅锛堝噣妗剁敵璇峰偍浣嶏級
-                        loction = storageLocat.Where(w => w.WareHouseNo == houseNo && (w.AreaNo.Contains("01") || w.AreaNo.Contains("11") || w.AreaNo.Contains("21") || w.AreaNo.Contains("31"))).OrderByDescending(o => o.CreateTime).First();
+                        //鏌ユ壘鍒拌杞﹂棿鍑�妗跺尯
+                        List<string> areaNoList = Db.Queryable<SysStorageArea>().Where(w => w.IsDel == "0" && w.Status == "0" && w.Type == "0" && w.WareHouseNo == houseNo).Select(s => s.AreaNo).ToList();
+                        loction = storageLocat.Where(w => w.WareHouseNo == houseNo && areaNoList.Contains(w.AreaNo)).OrderByDescending(o => o.CreateTime).First();
                         if (loction == null)
                         {
                             throw new Exception("璇ヨ溅闂村噣妗跺尯鏆傛棤绌轰綑鍌ㄤ綅");
@@ -362,7 +373,9 @@
                         {
                             throw new Exception("鎵规鍙蜂负绌猴紒");
                         }
-                        loction = storageLocat.Where(w => w.WareHouseNo == houseNo && (w.AreaNo.Contains("02") || w.AreaNo.Contains("12") || w.AreaNo.Contains("22") || w.AreaNo.Contains("32"))).OrderByDescending(o => o.CreateTime).First();
+                        //鏌ユ壘鍒拌杞﹂棿棰勬贩鍖�
+                        List<string> areaNoList2 = Db.Queryable<SysStorageArea>().Where(w => w.IsDel == "0" && w.Status == "0" && w.Type == "1" && w.WareHouseNo == houseNo).Select(s => s.AreaNo).ToList();
+                        loction = storageLocat.Where(w => w.WareHouseNo == houseNo && areaNoList2.Contains(w.AreaNo)).OrderByDescending(o => o.CreateTime).First();
                         if (loction == null)
                         {
                             throw new Exception("璇ヨ溅闂撮娣峰尯鏆傛棤绌轰綑鍌ㄤ綅");
@@ -393,7 +406,9 @@
                         //鏇存柊鍏ュ簱鍗曠姸鎬�
                         Db.Updateable(notice).ExecuteCommand();
 
-                        loction = storageLocat.Where(w => w.WareHouseNo == houseNo && (w.AreaNo.Contains("03") || w.AreaNo.Contains("13") || w.AreaNo.Contains("23") || w.AreaNo.Contains("33"))).OrderByDescending(o => o.CreateTime).First();
+                        //鏌ユ壘鍒拌杞﹂棿鍗婃垚鍝佸尯
+                        List<string> areaNoList3 = Db.Queryable<SysStorageArea>().Where(w => w.IsDel == "0" && w.Status == "0" && w.Type == "2" && w.WareHouseNo == houseNo).Select(s => s.AreaNo).ToList();
+                        loction = storageLocat.Where(w => w.WareHouseNo == houseNo && areaNoList3.Contains(w.AreaNo)).OrderByDescending(o => o.CreateTime).First();
                         if (loction == null)
                         {
                             throw new Exception("璇ヨ溅闂村崐鎴愬搧鍖烘殏鏃犵┖浣欏偍浣�");
@@ -402,7 +417,9 @@
                         taskMsg = "鎺ユ枡璁惧锛堟贩鏂欐《锛夌敵璇峰偍浣嶄换鍔�";
                         break;
                     case "2"://涓嬫枡璁惧鐢宠鍌ㄤ綅锛堣剰妗剁敵璇峰偍浣嶏級
-                        loction = storageLocat.Where(w => w.WareHouseNo == houseNo && (w.AreaNo.Contains("04") || w.AreaNo.Contains("14") || w.AreaNo.Contains("24") || w.AreaNo.Contains("34"))).OrderByDescending(o => o.CreateTime).First();
+                        //鏌ユ壘鍒拌杞﹂棿鑴忔《鍖�
+                        List<string> areaNoList4 = Db.Queryable<SysStorageArea>().Where(w => w.IsDel == "0" && w.Status == "0" && w.Type == "3" && w.WareHouseNo == houseNo).Select(s => s.AreaNo).ToList();
+                        loction = storageLocat.Where(w => w.WareHouseNo == houseNo && areaNoList4.Contains(w.AreaNo)).OrderByDescending(o => o.CreateTime).First();
                         if (loction == null)
                         {
                             throw new Exception("璇ヨ溅闂磋剰妗跺尯鏆傛棤绌轰綑鍌ㄤ綅");
@@ -617,7 +634,8 @@
 
             //涓嬭溅浠诲姟鍗�
             AgvSchedulingTask agvTask = new AgvSchedulingTask();
-            agvTask.reqCode = taskDetial.Taskno;//浠诲姟鍙�
+            agvTask.reqCode = taskDetial.Taskno;//璇锋眰缂栧彿
+            agvTask.taskCode= taskDetial.Taskno;//浠诲姟鍙�
             agvTask.ctnrCode = taskDetial.Pallno;//妗跺彿
             agvTask.ctnrTyp = "1";
             agvTask.reqTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");//璇锋眰鏃堕棿                
@@ -737,26 +755,33 @@
                 //淇敼鐩爣鍌ㄤ綅鐘舵��
                 Db.Updateable(endLocatInfo).ExecuteCommand();
 
+                //鐩爣鍌ㄤ綅鎵�灞炲尯鍩�
+                var endAreaInfo = Db.Queryable<SysStorageArea>().First(w => w.IsDel == "0" && w.WareHouseNo == endLocatInfo.WareHouseNo && w.AreaNo == endLocatInfo.AreaNo);
+                if (endAreaInfo == null)
+                {
+                    throw new Exception($"鐩爣鍌ㄤ綅鎵�灞炲尯鍩熶俊鎭笉瀛樺湪");
+                }
+
                 stockDetail.WareHouseNo = endLocatInfo.WareHouseNo;//鎵�灞炰粨搴�
                 stockDetail.RoadwayNo = endLocatInfo.RoadwayNo;//鎵�灞炲贩閬�
                 stockDetail.AreaNo = endLocatInfo.AreaNo;//鎵�灞炲尯鍩�
                 stockDetail.LocatNo = endLocatInfo.LocatNo;//鍌ㄤ綅鍦板潃               
-                if (endLocatInfo.AreaNo.Contains("01") || endLocatInfo.AreaNo.Contains("11") || endLocatInfo.AreaNo.Contains("21") || endLocatInfo.AreaNo.Contains("31"))//娲佸噣鍖�
+                if (endAreaInfo.Type=="0")//娲佸噣鍖�
                 {
                     stockDetail.PalletStatus = "0";
                     stockDetail.Status = "0";//寰呭垎閰�
                 }
-                else if (endLocatInfo.AreaNo.Contains("02") || endLocatInfo.AreaNo.Contains("12") || endLocatInfo.AreaNo.Contains("22") || endLocatInfo.AreaNo.Contains("32"))//棰勬贩鍖�
+                else if (endAreaInfo.Type == "1")//棰勬贩鍖�
                 {
                     stockDetail.PalletStatus = "1";
                     stockDetail.Status = "0";//寰呭垎閰�
                 }
-                else if (endLocatInfo.AreaNo.Contains("03") || endLocatInfo.AreaNo.Contains("13") || endLocatInfo.AreaNo.Contains("23") || endLocatInfo.AreaNo.Contains("33"))//鍗婃垚鍝佸尯
+                else if (endAreaInfo.Type == "2")//鍗婃垚鍝佸尯
                 {
                     stockDetail.PalletStatus = "2";
                     stockDetail.Status = "0";//寰呭垎閰�
                 }
-                else if (endLocatInfo.AreaNo.Contains("04") || endLocatInfo.AreaNo.Contains("14") || endLocatInfo.AreaNo.Contains("24")|| endLocatInfo.AreaNo.Contains("34"))//鑴忔《鍖�
+                else if (endAreaInfo.Type == "3")//鑴忔《鍖�
                 {
                     stockDetail.PalletStatus = "3";
                     stockDetail.LotNo = "";//鎵规

--
Gitblit v1.8.0