|  |  | 
 |  |  |  | 
 |  |  | namespace WIDESEA_BasicService | 
 |  |  | { | 
 |  |  |     public partial class LocationInfoService : ServiceBase<Dt_LocationInfo, ILocationInfoRepository>, ILocationInfoService | 
 |  |  |     public class LocationInfoService_Old | 
 |  |  |     { | 
 |  |  |         private readonly IRecordService _recordService; | 
 |  |  |         public LocationInfoService(ILocationInfoRepository BaseDal, IBasicRepository basicRepository, IRecordService recordService) : base(BaseDal) | 
 |  |  |         private readonly ILocationInfoRepository Repository; | 
 |  |  |  | 
 |  |  |         public LocationInfoService_Old(ILocationInfoRepository repository) | 
 |  |  |         { | 
 |  |  |             _basicRepository = basicRepository; | 
 |  |  |             _recordService = recordService; | 
 |  |  |             Repository = repository; | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         double weightValue = 0.5; | 
 |  |  |  | 
 |  |  |         private readonly static object _locker = new object(); | 
 |  |  |         static List<LocationCache> locationCaches = new List<LocationCache>(); | 
 |  |  |  | 
 |  |  |         /// <summary> | 
 |  |  |         /// è´§ä½åé
é»è¾ | 
 |  |  |         /// </summary> | 
 |  |  |         /// <param name="roadwayNo">å··éå·</param> | 
 |  |  |         /// <param name="palletType">æçç±»å</param> | 
 |  |  |         /// <returns></returns> | 
 |  |  |         public Dt_LocationInfo? AssignLocation(string roadwayNo, PalletTypeEnum palletType) | 
 |  |  |         { | 
 |  |  |             lock (_locker) | 
 |  |  | 
 |  |  |             return null; | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         public void UpdateLocationStatus(string locationCode, PalletTypeEnum palletType, LocationStatusEnum locationStatus, string taskNum = "", string orderNo = "") | 
 |  |  |         /// <summary> | 
 |  |  |         /// ä¿®æ¹è´§ä½ç¶æåç±»å | 
 |  |  |         /// </summary> | 
 |  |  |         /// <param name="locationCode">è´§ä½ç¼å·</param> | 
 |  |  |         /// <param name="palletType">æçç±»å</param> | 
 |  |  |         /// <param name="locationStatus">è´§ä½ç¶æ</param> | 
 |  |  |         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); | 
 |  |  | 
 |  |  |             Repository.UpdateData(locations); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         /// <summary> | 
 |  |  |         /// ä¿®æ¹è´§ä½ç¶æåç±»å | 
 |  |  |         /// </summary> | 
 |  |  |         /// <param name="location">è´§ä½å¯¹è±¡</param> | 
 |  |  |         /// <param name="palletType">æçç±»å</param> | 
 |  |  |         /// <param name="locationStatus">è´§ä½ç¶æ</param> | 
 |  |  |         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 }; |