From 12b86d75b82acd4930062e38a533743b22b558ae Mon Sep 17 00:00:00 2001
From: huangxiaoqiang <1247017146@qq.com>
Date: 星期四, 05 六月 2025 10:21:36 +0800
Subject: [PATCH] 批量删除任务

---
 CodeManagement/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs |   35 +++++++++++++++++++----------------
 1 files changed, 19 insertions(+), 16 deletions(-)

diff --git a/CodeManagement/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs b/CodeManagement/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs
index d4991a2..f1e1cbe 100644
--- a/CodeManagement/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs
+++ b/CodeManagement/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs
@@ -1086,11 +1086,11 @@
                 .ToList().Select(x => x.DeviceCode).ToList();
 
             var result = await _stockInfoRepository.Db.Queryable<DtStockInfo>()
-                .Where(x => x.ProductionLine == station.productLine)
+                .WhereIF(!station.Roadway.Contains("JZSC"), x => x.ProductionLine == station.productLine)
                 .Where(x => x.AreaCode == areaCode && x.IsFull == false)
-                .Includes(x=>x.StockInfoDetails)
+                .Includes(x => x.StockInfoDetails)
                 .Where(x => x.StockInfoDetails.Any(y => y.MaterielCode == "绌烘墭鐩�"))
-                .Includes(x=>x.LocationInfo)
+                .Includes(x => x.LocationInfo)
                 .WhereIF(!deviceCode.IsNullOrEmpty(), x => deviceCode.Contains(x.LocationInfo.RoadwayNo))
                 .Where(x => x.LocationInfo.LocationStatus == (int)LocationEnum.InStock && x.LocationInfo.AreaId == area.AreaID && x.LocationInfo.EnalbeStatus == (int)EnableEnum.Enable) // 杩囨护鏉′欢
                 .OrderBy(x => x.CreateDate) // 鎺掑簭
@@ -1115,7 +1115,7 @@
     {
         return new Dt_Task
         {
-            Grade = tag == 104 ? (stockInfo.LocationInfo.RoadwayNo.Contains("CWSC") ? 1 : 2) : (stockInfo.LocationInfo.RoadwayNo.Contains("CWSC") ? 2 : 1),
+            Grade = tag == 104 ? (stockInfo.LocationInfo.RoadwayNo.Contains("CWSC")|| stockInfo.LocationInfo.RoadwayNo.Contains("JZSC") ? 1 : 2) : (stockInfo.LocationInfo.RoadwayNo.Contains("CWSC") || stockInfo.LocationInfo.RoadwayNo.Contains("JZSC") ? 2 : 1),
             Roadway = stockInfo.LocationInfo.RoadwayNo,
             TargetAddress = position,
             Dispatchertime = DateTime.Now,
@@ -1840,20 +1840,23 @@
         // 鍒涘缓鍘嗗彶浠诲姟瀹炰緥妯″瀷
         try
         {
-            Dt_Task task = BaseDal.QueryFirst(x => x.TaskId == Convert.ToInt32(key[0]));
-            if (task == null)
+            foreach (var item in key)
             {
-                return content.Error("鏈壘鍒颁换鍔′俊鎭�!");
+                Dt_Task task = BaseDal.QueryFirst(x => x.TaskId == Convert.ToInt32(key));
+                if (task == null)
+                {
+                    return content.Error("鏈壘鍒颁换鍔′俊鎭�!");
+                }
+                var taskHtyNG = CreateHistoricalTask(task, true);
+
+                // 鎵ц鏁版嵁搴撲簨鍔�
+
+                // 娣诲姞鍘嗗彶浠诲姟
+                var isTaskHtyAdd = _task_HtyRepository.AddData(taskHtyNG) > 0;
+
+                // 鍒犻櫎浠诲姟鏁版嵁
+                var isTaskDelete = BaseDal.Delete(task.TaskId);
             }
-            var taskHtyNG = CreateHistoricalTask(task, true);
-
-            // 鎵ц鏁版嵁搴撲簨鍔�
-
-            // 娣诲姞鍘嗗彶浠诲姟
-            var isTaskHtyAdd = _task_HtyRepository.AddData(taskHtyNG) > 0;
-
-            // 鍒犻櫎浠诲姟鏁版嵁
-            var isTaskDelete = BaseDal.Delete(task.TaskId);
 
             return content.OK("鍒犻櫎鎴愬姛!");
         }

--
Gitblit v1.9.3