From 8d341db9d2d5699d527c88c935f0c4ce255a57a4 Mon Sep 17 00:00:00 2001
From: hutongqing <hutongqing@hnkhzn.com>
Date: 星期二, 10 十二月 2024 16:38:12 +0800
Subject: [PATCH] 代码提交

---
 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/LocationInfoService.cs |   51 +++++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 43 insertions(+), 8 deletions(-)

diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/LocationInfoService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/LocationInfoService.cs"
index 679c7cd..176c147 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/LocationInfoService.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/LocationInfoService.cs"
@@ -23,13 +23,6 @@
 {
     public partial class LocationInfoService : ServiceBase<Dt_LocationInfo, ILocationInfoRepository>, ILocationInfoService
     {
-        private readonly IRecordService _recordService;
-        public LocationInfoService(ILocationInfoRepository BaseDal, IBasicRepository basicRepository, IRecordService recordService) : base(BaseDal)
-        {
-            _basicRepository = basicRepository;
-            _recordService = recordService;
-        }
-
         double weightValue = 0.5;
 
         private readonly static object _locker = new object();
@@ -148,8 +141,9 @@
             return null;
         }
 
-        public void UpdateLocationStatus(string locationCode, PalletTypeEnum palletType, LocationStatusEnum locationStatus, string taskNum = "", string orderNo = "")
+        public void UpdateLocationStatus(string locationCode, PalletTypeEnum palletType, LocationStatusEnum locationStatus)
         {
+
             Dt_LocationInfo location = Repository.QueryFirst(x => x.LocationCode == locationCode);
             List<Dt_LocationInfo> locationInfos = Repository.QueryData(x => x.RoadwayNo == location.RoadwayNo);
 
@@ -188,6 +182,47 @@
             Repository.UpdateData(locations);
         }
 
+        public void UpdateLocationStatus(Dt_LocationInfo location, PalletTypeEnum palletType, LocationStatusEnum locationStatus)
+        {
+            
+
+            List<Dt_LocationInfo> locationInfos = Repository.QueryData(x => x.RoadwayNo == location.RoadwayNo);
+
+            List<Dt_LocationInfo> locations = GetGroupLocations(locationInfos, location);
+            if (locationInfos.Max(x => x.Depth) < 3)
+            {
+                for (int i = 0; i < locations.Count; i++)
+                {
+                    locations[i].LocationStatus = locationStatus.ObjToInt();
+                    locations[i].LocationType = palletType.ObjToInt();
+                }
+
+                Dt_LocationInfo? nearLocation = locationInfos.FirstOrDefault(x => x.Row == location.Row && x.Layer == location.Layer && x.Depth == location.Depth && x.Column == location.Column + 1);
+                if (nearLocation != null)
+                {
+                    List<Dt_LocationInfo> nearLocations = GetGroupLocations(locationInfos, nearLocation);
+                    for (int i = 0; i < nearLocations.Count; i++)
+                    {
+                        nearLocations[i].LocationType = palletType.ObjToInt();
+                        if (palletType == PalletTypeEnum.LargePallet)
+                        {
+                            nearLocations[i].LocationStatus = locationStatus.ObjToInt();
+                        }
+                    }
+                    locations.AddRange(nearLocations);
+                }
+            }
+            else
+            {
+                for (int i = 0; i < locations.Count; i++)
+                {
+                    locations[i].LocationStatus = locationStatus.ObjToInt();
+                    locations[i].LocationType = palletType.ObjToInt();
+                }
+            }
+            Repository.UpdateData(locations);
+        }
+
         private List<Dt_LocationInfo> GetGroupLocations(List<Dt_LocationInfo> locationInfos, Dt_LocationInfo location)
         {
             List<Dt_LocationInfo> groupLocations = new List<Dt_LocationInfo>() { location };

--
Gitblit v1.9.3