| | |
| | | Dt_PalletTypeInfo? palletTypeInfo = _basicRepository.PalletTypeInfoRepository.QueryFirst(x => x.PalletType == palletType && x.WarehouseId == warehouseId); |
| | | if (palletTypeInfo == null) |
| | | { |
| | | if (warehouse.WarehouseCode == WarehouseEnum.HA153.ToString() && warehouse.WarehouseCode == WarehouseEnum.HA71.ToString() && warehouse.WarehouseCode == WarehouseEnum.HA60.ToString()) |
| | | if (warehouse.WarehouseCode == WarehouseEnum.HA153.ToString() || warehouse.WarehouseCode == WarehouseEnum.HA71.ToString()) |
| | | { |
| | | palletTypeInfo = new Dt_PalletTypeInfo() |
| | | { |
| | |
| | | "HA153" => AssignLocation(roadwayNo), |
| | | "HA71" or "HA72" or "HA73" => AssignLocation(roadwayNo), |
| | | "HA60" => AssignLocation(roadwayNo), |
| | | "HA581" => AssignLocation_PPPK(roadwayNo,palletTypeInfo.PalletType), |
| | | _ => throw new Exception($"æªæ¾å°ä»åºè´§ä½åé
æ¹æ³") |
| | | }; |
| | | } |
| | |
| | | List<Dt_PalletTypeInfo> palletTypeInfos = _basicRepository.PalletTypeInfoRepository.QueryData(x => x.WarehouseId == warehousId); |
| | | Dt_Warehouse warehouse = _basicRepository.WarehouseRepository.QueryFirst(x => x.WarehouseId == warehousId); |
| | | Dt_PalletTypeInfo? palletTypeInfo = palletTypeInfos.FirstOrDefault(x => x.PalletType == palletType && x.WarehouseId == warehousId); |
| | | if (palletTypeInfo == null || warehouse.WarehouseCode == WarehouseEnum.HA60.ToString()) |
| | | if (palletTypeInfo == null) |
| | | { |
| | | if (warehouse.WarehouseCode == WarehouseEnum.HA153.ToString() || warehouse.WarehouseCode == WarehouseEnum.HA71.ToString() || warehouse.WarehouseCode == WarehouseEnum.HA60.ToString()) |
| | | if (warehouse.WarehouseCode == WarehouseEnum.HA153.ToString() || warehouse.WarehouseCode == WarehouseEnum.HA71.ToString()) |
| | | { |
| | | palletTypeInfo = new Dt_PalletTypeInfo() |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | if (palletTypeInfos.FirstOrDefault(x => x.LocaitonCount == 2) != null) |
| | | if (palletTypeInfo.LocaitonCount == 2) |
| | | { |
| | | Dt_LocationInfo? nearLocation; |
| | | if (palletTypeInfo.IsOdd) |
| | |
| | | int row = location.Row; |
| | | for (int j = location.Depth + 1; j <= maxDepth; j++) |
| | | { |
| | | row += 1; |
| | | Dt_LocationInfo? locationInfo = locationInfos.FirstOrDefault(x => x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row); |
| | | Dt_LocationInfo? locationInfo = locationInfos.FirstOrDefault(x => x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == (row + 1)); |
| | | #region æµè¯æ¶ãPP夿åç»è´§ä½ |
| | | if (j == 3 && (location.RoadwayNo.Contains("CSJ") || location.RoadwayNo.Contains("PP")) && (row == 2 || row == 5)) |
| | | { |
| | | if (row <= maxDepth) |
| | | { |
| | | locationInfo = locationInfos.FirstOrDefault(x => x.Row <= maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row - 1); |
| | | } |
| | | else |
| | | { |
| | | locationInfo = locationInfos.FirstOrDefault(x => x.Row > maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row + 1); |
| | | } |
| | | } |
| | | if (j == 3 && (location.RoadwayNo.Contains("CSJ") || location.RoadwayNo.Contains("PP")) && (row == 3 || row == 4)) |
| | | { |
| | | if (row <= maxDepth) |
| | | { |
| | | locationInfo = locationInfos.FirstOrDefault(x => x.Row <= maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row - 2); |
| | | } |
| | | else |
| | | { |
| | | locationInfo = locationInfos.FirstOrDefault(x => x.Row > maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row + 2); |
| | | } |
| | | } |
| | | if (j == 2 && (location.RoadwayNo.Contains("CSJ") || location.RoadwayNo.Contains("PP")) && (row == 1 || row == 6)) |
| | | { |
| | | if (row <= maxDepth) |
| | | { |
| | | locationInfo = locationInfos.FirstOrDefault(x => x.Row <= maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row + 1); |
| | | } |
| | | else |
| | | { |
| | | locationInfo = locationInfos.FirstOrDefault(x => x.Row > maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row - 1); |
| | | } |
| | | } |
| | | if (j == 2 && (location.RoadwayNo.Contains("CSJ") || location.RoadwayNo.Contains("PP")) && (row == 3 || row == 4)) |
| | | { |
| | | if (row <= maxDepth) |
| | | { |
| | | locationInfo = locationInfos.FirstOrDefault(x => x.Row <= maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row - 1); |
| | | } |
| | | else |
| | | { |
| | | locationInfo = locationInfos.FirstOrDefault(x => x.Row > maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row + 1); |
| | | } |
| | | } |
| | | #endregion |
| | | if (locationInfo != null) |
| | | { |
| | | groupLocations.Add(locationInfo); |
| | |
| | | |
| | | for (int j = location.Depth - 1; j >= 1; j--) |
| | | { |
| | | row -= 1; |
| | | Dt_LocationInfo? locationInfo = locationInfos.FirstOrDefault(x => x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row); |
| | | Dt_LocationInfo? locationInfo = locationInfos.FirstOrDefault(x => x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == (row -1)); |
| | | #region æµè¯æ¶ãPP夿åç»è´§ä½ |
| | | if (j == 1 && (location.RoadwayNo.Contains("CSJ") || location.RoadwayNo.Contains("PP")) && (row == 1 || row == 6)) |
| | | { |
| | | if (row <= maxDepth) |
| | | { |
| | | locationInfo = locationInfos.FirstOrDefault(x => x.Row <= maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row + 2); |
| | | } |
| | | else |
| | | { |
| | | locationInfo = locationInfos.FirstOrDefault(x => x.Row > maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row - 2); |
| | | } |
| | | } |
| | | if (j == 1 && (location.RoadwayNo.Contains("CSJ") || location.RoadwayNo.Contains("PP")) && (row == 2 || row == 5)) |
| | | { |
| | | if (row <= maxDepth) |
| | | { |
| | | locationInfo = locationInfos.FirstOrDefault(x => x.Row <= maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row + 1); |
| | | } |
| | | else |
| | | { |
| | | locationInfo = locationInfos.FirstOrDefault(x => x.Row > maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row - 1); |
| | | } |
| | | } |
| | | if (j == 2 && (location.RoadwayNo.Contains("CSJ") || location.RoadwayNo.Contains("PP")) && (row == 1 || row == 6)) |
| | | { |
| | | if (row <= maxDepth) |
| | | { |
| | | locationInfo = locationInfos.FirstOrDefault(x => x.Row <= maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row + 1); |
| | | } |
| | | else |
| | | { |
| | | locationInfo = locationInfos.FirstOrDefault(x => x.Row > maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row - 1); |
| | | } |
| | | } |
| | | #endregion |
| | | if (locationInfo != null) |
| | | { |
| | | groupLocations.Add(locationInfo); |
| | |
| | | for (int j = location.Depth + 1; j <= maxDepth; j++) |
| | | { |
| | | Dt_LocationInfo? locationInfo = locationInfos.FirstOrDefault(x => x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && (x.Row == row + 1 || x.Row == row - 1)); |
| | | #region æµè¯æ¶ãPP夿åç»è´§ä½ |
| | | if (j == 3 && (location.RoadwayNo.Contains("CSJ") || location.RoadwayNo.Contains("PP")) && (row == 2 || row == 5)) |
| | | { |
| | | if (row <= maxDepth) |
| | | { |
| | | locationInfo = locationInfos.FirstOrDefault(x => x.Row <= maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row - 1); |
| | | } |
| | | else |
| | | { |
| | | locationInfo = locationInfos.FirstOrDefault(x => x.Row > maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row + 1); |
| | | } |
| | | } |
| | | if (j == 3 && (location.RoadwayNo.Contains("CSJ") || location.RoadwayNo.Contains("PP")) && (row == 3 || row == 4)) |
| | | { |
| | | if (row <= maxDepth) |
| | | { |
| | | locationInfo = locationInfos.FirstOrDefault(x => x.Row <= maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row - 2); |
| | | } |
| | | else |
| | | { |
| | | locationInfo = locationInfos.FirstOrDefault(x => x.Row > maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row + 2); |
| | | } |
| | | } |
| | | if (j == 2 && (location.RoadwayNo.Contains("CSJ") || location.RoadwayNo.Contains("PP")) && (row == 1 || row == 6)) |
| | | { |
| | | if (row <= maxDepth) |
| | | { |
| | | locationInfo = locationInfos.FirstOrDefault(x => x.Row <= maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row + 1); |
| | | } |
| | | else |
| | | { |
| | | locationInfo = locationInfos.FirstOrDefault(x => x.Row > maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row - 1); |
| | | } |
| | | } |
| | | if (j == 2 && (location.RoadwayNo.Contains("CSJ") || location.RoadwayNo.Contains("PP")) && (row == 3 || row == 4)) |
| | | { |
| | | if (row <= maxDepth) |
| | | { |
| | | locationInfo = locationInfos.FirstOrDefault(x => x.Row <= maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row - 1); |
| | | } |
| | | else |
| | | { |
| | | locationInfo = locationInfos.FirstOrDefault(x => x.Row > maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row + 1); |
| | | } |
| | | } |
| | | #endregion |
| | | if (locationInfo != null) |
| | | { |
| | | groupLocations.Add(locationInfo); |
| | |
| | | for (int j = location.Depth - 1; j >= 1; j--) |
| | | { |
| | | Dt_LocationInfo? locationInfo = locationInfos.FirstOrDefault(x => x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && (x.Row == row + 1 || x.Row == row - 1)); |
| | | if (j == 1 && location.RoadwayNo.Contains("CSJ") && (row==1 || row==6)) |
| | | #region æµè¯æ¶ãPP夿åç»è´§ä½ |
| | | if (j == 1 && (location.RoadwayNo.Contains("CSJ") || location.RoadwayNo.Contains("PP")) && (row == 1 || row == 6)) |
| | | { |
| | | locationInfo = locationInfos.FirstOrDefault(x => x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && (x.Row == row + 2 || x.Row == row - 2)); |
| | | if (row <= maxDepth) |
| | | { |
| | | locationInfo = locationInfos.FirstOrDefault(x => x.Row <= maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row + 2); |
| | | } |
| | | else |
| | | { |
| | | locationInfo = locationInfos.FirstOrDefault(x => x.Row > maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row - 2); |
| | | } |
| | | } |
| | | if (j == 1 && (location.RoadwayNo.Contains("CSJ") || location.RoadwayNo.Contains("PP")) && (row == 2 || row == 5)) |
| | | { |
| | | if (row <= maxDepth) |
| | | { |
| | | locationInfo = locationInfos.FirstOrDefault(x => x.Row <= maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row + 1); |
| | | } |
| | | else |
| | | { |
| | | locationInfo = locationInfos.FirstOrDefault(x => x.Row > maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row - 1); |
| | | } |
| | | } |
| | | if (j == 2 && (location.RoadwayNo.Contains("CSJ") || location.RoadwayNo.Contains("PP")) && (row == 1 || row == 6)) |
| | | { |
| | | if (row <= maxDepth) |
| | | { |
| | | locationInfo = locationInfos.FirstOrDefault(x => x.Row <= maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row + 1); |
| | | } |
| | | else |
| | | { |
| | | locationInfo = locationInfos.FirstOrDefault(x => x.Row > maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row - 1); |
| | | } |
| | | } |
| | | #endregion |
| | | if (locationInfo != null) |
| | | { |
| | | groupLocations.Add(locationInfo); |
| | |
| | | } |
| | | return groupLocations; |
| | | } |
| | | |
| | | |
| | | public Dt_LocationInfo? AssignLocation_PPPK(string roadwayNo, int palletType) |
| | | { |
| | | lock (_locker) |
| | | { |
| | | List<LocationCache> removeItems = locationCaches.Where(x => (DateTime.Now - x.DateTime).TotalMinutes > 5).ToList();//æ¥è¯¢æ·»å éæåéè¶
è¿5åéçè´§ä½ |
| | | int count = removeItems.Count; |
| | | for (int i = 0; i < count; i++) |
| | | { |
| | | locationCaches.Remove(removeItems[i]);//ç§»é¤æ¥è¯¢æ·»å éæåéè¶
è¿5åéçè´§ä½ |
| | | } |
| | | |
| | | List<string> lockLocations = locationCaches.Select(x => x.LocationCode).ToList(); |
| | | |
| | | List<Dt_LocationInfo> locationInfos = BaseDal.QueryData(x => x.RoadwayNo == roadwayNo);//æ¥è¯¢å··éææè´§ä½ä¿¡æ¯ |
| | | |
| | | Dictionary<string, OrderByType> orderBy = new Dictionary<string, OrderByType>() |
| | | { |
| | | { nameof(Dt_LocationInfo.Layer),OrderByType.Asc }, |
| | | { nameof(Dt_LocationInfo.Column),OrderByType.Asc }, |
| | | { nameof(Dt_LocationInfo.Depth),OrderByType.Desc }, |
| | | { nameof(Dt_LocationInfo.Row),OrderByType.Asc } |
| | | }; |
| | | |
| | | return BaseDal.QueryFirst(x => x.RoadwayNo == roadwayNo && x.LocationStatus == LocationStatusEnum.Free.ObjToInt() && x.EnableStatus != EnableStatusEnum.Disable.ObjToInt() && x.LocationType == palletType && !lockLocations.Contains(x.LocationCode), orderBy); |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |