| | |
| | | { |
| | | 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(); |
| | |
| | | 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); |
| | | |
| | |
| | | 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 }; |