From 8df624a41b03581fc06132172156a5d33b2cfcd3 Mon Sep 17 00:00:00 2001
From: admin <qiutairan163@163.com>
Date: 星期四, 18 十二月 2025 14:24:24 +0800
Subject: [PATCH] 取消AGV移库任务CancelMoveTask目标储位去除仓库限制

---
 Wms/WMS.BLL/BllPdaServer/PdaSoServer.cs |   89 ++++++++++++++++++++++++++------------------
 1 files changed, 53 insertions(+), 36 deletions(-)

diff --git a/Wms/WMS.BLL/BllPdaServer/PdaSoServer.cs b/Wms/WMS.BLL/BllPdaServer/PdaSoServer.cs
index 80533df..351a2c9 100644
--- a/Wms/WMS.BLL/BllPdaServer/PdaSoServer.cs
+++ b/Wms/WMS.BLL/BllPdaServer/PdaSoServer.cs
@@ -1,29 +1,30 @@
-锘縰sing System;
-using System.Collections.Generic;
-using SqlSugar;
-using System.Linq;
-using System.Linq.Expressions;
-using Model.InterFaceModel;
+锘縰sing Model.InterFaceModel;
 using Model.ModelDto;
-using SqlSugar.Extensions;
-using WMS.Entity.BllSoEntity;
-using WMS.Entity.Context;
-using WMS.Entity.DataEntity;
-using WMS.Entity.SysEntity;
-using WMS.IBLL.IPdaServer;
 using Model.ModelVm;
 using Model.ModelVm.PdaVm;
 using Newtonsoft.Json;
+using SqlSugar;
+using SqlSugar.Extensions;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Linq;
+using System.Linq.Expressions;
+using System.Threading.Tasks;
+using System.Web;
+using Utility;
 using Utility.Tools;
+using WMS.BLL.Logic;
 using WMS.BLL.LogServer;
 using WMS.DAL;
-using WMS.Entity.LogEntity;
-using WMS.Entity.BllQualityEntity;
 using WMS.Entity.BllAsnEntity;
-using System.Threading.Tasks;
-using Utility;
-using WMS.BLL.Logic;
-using System.Web;
+using WMS.Entity.BllQualityEntity;
+using WMS.Entity.BllSoEntity;
+using WMS.Entity.Context;
+using WMS.Entity.DataEntity;
+using WMS.Entity.LogEntity;
+using WMS.Entity.SysEntity;
+using WMS.IBLL.IPdaServer;
 
 namespace WMS.BLL.BllPdaServer
 {
@@ -80,9 +81,15 @@
                 {
                     throw Oops.Bah("鏈煡璇㈠埌璇ュ嚭搴撳崟鐨勪俊鎭�");
                 }
-                if (notice.Status != "3")
+                //if (notice.Status != "3")
+                //{
+                //    throw Oops.Bah("鍑哄簱鍗曠殑鐘舵�佷笉鏄鍦ㄦ墽琛岋紝涓嶈兘鎷h揣");
+                //}
+                //2025骞�12鏈�05鏃ョ敳鏂硅姹傝秴鎹★紝鍑哄簱鍗曡皟鏁翠负鎵ц瀹屾瘯涔熷彲浠ヨ秴鎹�
+                List<string> statusList = new List<string>() { "3", "4" };
+                if (!statusList.Contains(notice.Status))
                 {
-                    throw Oops.Bah("鍑哄簱鍗曠殑鐘舵�佷笉鏄鍦ㄦ墽琛岋紝涓嶈兘鎷h揣");
+                    throw Oops.Bah("鍑哄簱鍗曠殑鐘舵�侀潪姝e湪鎵ц锛屼笉鑳芥嫞璐�");
                 }
                 //鍑哄簱鍗曟槑缁�
                 var noticeDetail = await Db.Queryable<BllExportNoticeDetail>().FirstAsync(m => m.IsDel == "0" && m.Id == int.Parse(soDetailId));
@@ -1561,9 +1568,12 @@
                 string skuNo = boxInfos.First().SkuNo;
                 string skuName = boxInfos.First().SkuName;
 
-                // 楠岃瘉鏄惁杞﹂棿绾胯竟浠撳簱
-                var areaList = new List<string>() { "B06", "B07", "B09", "B24" };
-                if (!areaList.Contains(stockDetail.AreaNo))
+                //楠岃瘉鏄惁杞﹂棿绾胯竟浠撳簱
+                string areaNoSql = $@"select AreaNo from SysStorageArea where IsDel='0' and AreaType='1'";
+                DataTable areaNoDt = Db.Ado.GetDataTable(areaNoSql);
+                List<string> areaNoList = areaNoDt.Rows.Cast<DataRow>().Select(e => e["AreaNo"] + "").ToList();
+
+                if (!areaNoList.Contains(stockDetail.AreaNo))
                 {
                     throw Oops.Bah("鎵樼洏涓嶆槸杞﹂棿鎵樼洏锛�");
                 }
@@ -1653,10 +1663,10 @@
                     boxNo, "鍑哄簱", $"鍦≒DA涓婂绠卞彿涓猴細{boxNo}鐨勬墭鐩樼爜涓猴細{palletNo}鐨勬嫞璐ф搷浣�", userId);
                 Db.CommitTran();
             }
-            catch (AppFriendlyException e)
-            {
-                Db.RollbackTran();
-            }
+            //catch (AppFriendlyException e)
+            //{
+            //    Db.RollbackTran();
+            //}
             catch (Exception e)
             {
                 Db.RollbackTran();
@@ -1719,9 +1729,12 @@
                     throw Oops.Bah("鏈煡璇㈠埌璇ユ墭鐩樹笂璐х墿鐨勫簱瀛樻槑缁嗕俊鎭紒");
                 }
 
-                // 楠岃瘉鏄惁杞﹂棿绾胯竟浠撳簱
-                var areaList = new List<string>() { "B06", "B07", "B09", "B24" };
-                if (!areaList.Contains(stockDetail.AreaNo))
+                //楠岃瘉鏄惁杞﹂棿绾胯竟浠撳簱
+                string areaNoSql = $@"select AreaNo from SysStorageArea where IsDel='0' and AreaType='1'";
+                DataTable areaNoDt = Db.Ado.GetDataTable(areaNoSql);
+                List<string> areaNoList = areaNoDt.Rows.Cast<DataRow>().Select(e => e["AreaNo"] + "").ToList();
+
+                if (!areaNoList.Contains(stockDetail.AreaNo))
                 {
                     throw Oops.Bah("鎵樼洏涓嶆槸杞﹂棿鎵樼洏锛�");
                 }
@@ -1918,10 +1931,12 @@
                 throw Oops.Bah("鍑哄簱鏄庣粏涓虹┖锛岃閫夋嫨鐗╂枡-鎵规");
             }
 
-            var allotList = await Db.Queryable<BllExportAllot>().Where(m => m.IsDel == "0" && m.Status == "0" && m.SONo == soNo && m.SODetailNo == int.Parse(soDetailId)).Select(m => m.PalletNo).Distinct().Where(m => !string.IsNullOrWhiteSpace(m)).ToListAsync();
+            //var allotList = await Db.Queryable<BllExportAllot>().Where(m => m.IsDel == "0" && m.Status == "0" && m.SONo == soNo && m.SODetailNo == int.Parse(soDetailId)).Select(m => m.PalletNo).Distinct().Where(m => !string.IsNullOrWhiteSpace(m)).ToListAsync();
+            //鑾峰彇鐘舵�佷负0寰呬笅鍙戙��1浠诲姟涓嬪彂銆�2寰呮嫞璐с��3閮ㄥ垎鎷h揣鐨勫嚭搴撳崟
+            List<string> statusList = new List<string>() { "0", "1", "2", "3" };
+            var allotList = await Db.Queryable<BllExportAllot>().Where(m => m.IsDel == "0" && statusList.Contains(m.Status) && m.SONo == soNo && m.SODetailNo == int.Parse(soDetailId)).Select(m => m.PalletNo).Distinct().Where(m => !string.IsNullOrWhiteSpace(m)).ToListAsync();
+
             return allotList;
-
-
         }
 
 
@@ -1931,7 +1946,8 @@
         {
             if (type == "1")//骞冲簱鍑哄簱鑾峰彇鍗曟嵁
             {
-                var allotList = await Db.Queryable<BllExportAllot>().Where(m => m.IsDel == "0" && (m.Status == "1" || m.Status == "0")).Select(m => m.SONo).Distinct().Where(m => !string.IsNullOrWhiteSpace(m)).ToListAsync();
+                List<string> statusList = new List<string>() { "0", "1", "2", "3" };
+                var allotList = await Db.Queryable<BllExportAllot>().Where(m => m.IsDel == "0" && statusList.Contains(m.Status)).Select(m => m.SONo).Distinct().Where(m => !string.IsNullOrWhiteSpace(m)).ToListAsync();
                 return allotList;
             }
             //鑾峰彇鐘舵�佷负寰呮嫞璐ф垨鑰呴儴鍒嗘嫞璐х殑鍑哄簱鍗�
@@ -1951,8 +1967,9 @@
             {
                 throw Oops.Bah("鍗曟嵁涓虹┖锛岃閫夋嫨鍗曟嵁");
             }
-            //鑾峰彇鐘舵�佷负寰呮嫞璐ф垨鑰呴儴鍒嗘嫞璐х殑鍑哄簱鍗�
-            var allotList = Db.Queryable<BllExportAllot>().Where(m => m.IsDel == "0" && m.SONo == soNo && (m.Status == "0" || m.Status == "1"));
+            //鑾峰彇鐘舵�佷负0寰呬笅鍙戙��1浠诲姟涓嬪彂銆�2寰呮嫞璐с��3閮ㄥ垎鎷h揣鐨勫嚭搴撳崟
+            List<string> statusList = new List<string>() { "0", "1", "2", "3" };
+            var allotList = Db.Queryable<BllExportAllot>().Where(m => m.IsDel == "0" && m.SONo == soNo && (statusList.Contains(m.Status)));
 
             var list = await allotList.GroupBy(m => new { m.SODetailNo, m.SkuNo, m.SkuName, m.LotNo }).Select(m => new DetailIdSkuLotNo()
             {

--
Gitblit v1.8.0