From d6ce83b1f1bb87b88c11df1e0fe96169de5b571f Mon Sep 17 00:00:00 2001
From: hutongqing <hutongqing@hnkhzn.com>
Date: 星期一, 16 十二月 2024 16:31:28 +0800
Subject: [PATCH] ERP接口调用开发

---
 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/LocationInfoService.cs |   48 ++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 40 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..d7f434a 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,7 +141,7 @@
             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 +181,45 @@
             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