From 071e6262409c5e96f904d0724b73a07fb21bcdf3 Mon Sep 17 00:00:00 2001
From: 肖洋 <cathay_xy@163.com>
Date: 星期四, 26 十二月 2024 14:12:42 +0800
Subject: [PATCH] 优化枚举和查询逻辑

---
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs |   10 +++++-----
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/Enums/ManageEnum.cs                   |   27 +++++++++++++++++++--------
 2 files changed, 24 insertions(+), 13 deletions(-)

diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/Enums/ManageEnum.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/Enums/ManageEnum.cs
index aad02cc..8c0f2a0 100644
--- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/Enums/ManageEnum.cs
+++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/Enums/ManageEnum.cs
@@ -1,9 +1,4 @@
-锘縰sing System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+锘縰sing System.ComponentModel;
 
 namespace WIDESEA_Core.Enums
 {
@@ -94,10 +89,25 @@
         NotAllow = 2
     }
 
+    public enum LocationType
+    {
+        /// <summary>
+        /// 鍗曟繁璐т綅
+        /// </summary>
+        [Description("鍗曟繁璐т綅")]
+        Single = 1,
+
+        /// <summary>
+        /// 鍙屾繁璐т綅
+        /// </summary>
+        [Description("鍙屾繁璐т綅")]
+        Double = 2
+    }
+
     #region 浠诲姟绫诲瀷
 
     /// <summary>
-    /// 浠诲姟绫诲瀷   
+    /// 浠诲姟绫诲瀷
     /// </summary>
 
     public enum TaskInboundTypeEnum
@@ -175,7 +185,7 @@
         /// NG鍑哄簱
         /// </summary>
         [Description("NG鍑哄簱")]
-        OutNG =105,
+        OutNG = 105,
 
         /// <summary>
         /// 鐩存帴鍑哄簱
@@ -202,6 +212,7 @@
     public enum TaskOtherTypeEnum
     {
     }
+
     public enum TaskTypeEnum
     {
         /// <summary>
diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs
index e6c0992..e32b07f 100644
--- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs
+++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs
@@ -1178,7 +1178,7 @@
             .Includes(x => x.StockInfoDetails) // 棰勫姞杞絊tockInfoDetails
             .Where(x => x.AreaCode == areaCode && x.OutboundTime < DateTime.Now && x.IsFull == true) // 杩囨护鏉′欢
             .WhereIF(!productionLine.IsNullOrEmpty(), x => x.ProductionLine == productionLine)
-            .Where(x => x.LocationInfo.LocationStatus == (int)LocationEnum.InStock && x.LocationInfo.AreaId == area.AreaID) // 杩囨护鏉′欢
+            .Where(x => x.LocationInfo.LocationStatus == (int)LocationEnum.InStock && x.LocationInfo.AreaId == area.AreaID && x.LocationInfo.EnalbeStatus == (int)EnableEnum.Enable) // 杩囨护鏉′欢
             .WhereIF(!devices.IsNullOrEmpty(), x => devices.Contains(x.LocationInfo.RoadwayNo))
             .OrderBy(x => x.OutboundTime) // 鎺掑簭
             .FirstAsync(); // 鑾峰彇绗竴涓厓绱�
@@ -1201,7 +1201,7 @@
             .Includes(x => x.StockInfoDetails) // 棰勫姞杞絊tockInfoDetails
             .Where(x => areaCodes.Contains(x.AreaCode) && x.OutboundTime < DateTime.Now && x.IsFull == true) // 杩囨护鏉′欢
             .WhereIF(!productionLine.IsNullOrEmpty(), x => x.ProductionLine == productionLine)
-            .Where(x => x.LocationInfo.LocationStatus == (int)LocationEnum.InStock && x.LocationInfo.AreaId == area.AreaID) // 杩囨护鏉′欢
+            .Where(x => x.LocationInfo.LocationStatus == (int)LocationEnum.InStock && x.LocationInfo.AreaId == area.AreaID && x.LocationInfo.EnalbeStatus == (int)EnableEnum.Enable) // 杩囨护鏉′欢
             .OrderBy(x => x.OutboundTime) // 鎺掑簭
             .FirstAsync(); // 鑾峰彇绗竴涓厓绱�
 
@@ -1223,7 +1223,7 @@
             .Includes(x => x.StockInfoDetails) // 棰勫姞杞絊tockInfoDetails
             .Where(x => x.AreaCode == areaCode && x.IsFull == false)
             .Where(x => x.StockInfoDetails.Any(y => y.MaterielCode == "绌烘墭鐩�"))
-            .Where(x => x.LocationInfo.LocationStatus == (int)LocationEnum.InStock && x.LocationInfo.AreaId == area.AreaID) // 杩囨护鏉′欢
+            .Where(x => x.LocationInfo.LocationStatus == (int)LocationEnum.InStock && x.LocationInfo.AreaId == area.AreaID && x.LocationInfo.EnalbeStatus == (int)EnableEnum.Enable) // 杩囨护鏉′欢
             .OrderBy(x => x.CreateDate) // 鎺掑簭
             .FirstAsync(); // 杞崲涓哄垪琛�
 
@@ -2191,11 +2191,11 @@
             List<DtLocationInfo> locations;
             if (IsFull)
             {
-                locations = await _locationRepository.QueryDataAsync(x => x.LocationStatus == (int)LocationEnum.Free && x.RoadwayNo == roadWay);
+                locations = await _locationRepository.QueryDataAsync(x => x.LocationStatus == (int)LocationEnum.Free && x.RoadwayNo == roadWay && x.EnalbeStatus == (int)EnableEnum.Enable);
             }
             else
             {
-                locations = await _locationRepository.QueryDataAsync(x => x.LocationStatus == (int)LocationEnum.Free && x.RoadwayNo == roadWay /*&& x.LocationType ==*/);
+                locations = await _locationRepository.QueryDataAsync(x => x.LocationStatus == (int)LocationEnum.Free && x.RoadwayNo == roadWay && x.EnalbeStatus == (int)EnableEnum.Enable);
             }
 
             if (locations == null)

--
Gitblit v1.9.3