| | |
| | | } |
| | | |
| | | |
| | | public string AccessingTunnel(int WarehouseId, int LocationType) |
| | | public string AccessingTunnel(int WarehouseId, int LocationType, int taskCount) |
| | | { |
| | | List<Dt_LocationInfo> locationData = BaseDal.QueryData(x => x.WarehouseId == WarehouseId); |
| | | var roadwayGroups = locationData.Where(x => x.LocationType == LocationType && x.LocationStatus== (int)LocationStatusEnum.Free && x.EnableStatus== (int)EnableStatusEnum.Normal).GroupBy(x => x.RoadwayNo) |
| | | .Select(g => new |
| | | { |
| | | RoadwayNo = g.Key, |
| | | LocationCount = g.Count(), |
| | | LocationCount = g.Count() - taskCount, |
| | | }).OrderByDescending(g => g.LocationCount).ToList(); |
| | | |
| | | int minRequired = 15; |
| | | int minRequired = 3; |
| | | if(WarehouseId== (int)WarehouseEnum.YMYL) |
| | | { |
| | | if (LocationType == 2) minRequired = 6; |
| | | if (LocationType == 2) minRequired = 2; |
| | | |
| | | var selectedRoadway = roadwayGroups.FirstOrDefault(g => g.LocationCount >= minRequired); |
| | | if(selectedRoadway!=null) return selectedRoadway.RoadwayNo; |
| | |
| | | |
| | | return WebResponseContent.Instance.OK("æå", result); |
| | | } |
| | | |
| | | // ç»§ç»åï¼WarehouseId =1ï¼æä¸¤ä¸ªä¸åçè´§ç©ï¼LocationType =1å2 |
| | | public WebResponseContent GetWarehouseCapacity() |
| | | { |
| | | // æ¥è¯¢ææä»åºçè´§ä½æ°æ® |
| | | // æ¥è¯¢ææä»åºçè´§ä½æ°æ®ï¼å
å«è´§ä½ç±»å |
| | | var allLocations = BaseDal.QueryData() |
| | | .Select(x => new |
| | | { |
| | | x.WarehouseId, |
| | | x.LocationStatus |
| | | x.LocationStatus, |
| | | x.LocationType // æ·»å è´§ä½ç±»å |
| | | }) |
| | | .ToList(); |
| | | |
| | |
| | | return WebResponseContent.Instance.OK("æªæ¾å°ä»»ä½è´§ä½æ°æ®", new List<object>()); |
| | | } |
| | | |
| | | // è®¡ç®æ¯ä¸ªä»åºç容éä½¿ç¨æ
åµ |
| | | // æä»åºåè´§ä½ç±»ååç»ç»è®¡ |
| | | var result = allLocations |
| | | .GroupBy(x => x.WarehouseId) |
| | | .GroupBy(x => new { x.WarehouseId, x.LocationType }) |
| | | .Select(g => new |
| | | { |
| | | WarehouseId = g.Key, |
| | | WarehouseId = g.Key.WarehouseId, |
| | | LocationType = g.Key.LocationType, |
| | | TotalLocations = g.Count(), |
| | | FreeLocations = g.Count(x => x.LocationStatus == 0), |
| | | UsedLocations = g.Count(x => x.LocationStatus == 1), |
| | | OccupancyRate = (int)Math.Round((double)g.Count(x => x.LocationStatus == 1) / g.Count() * 100), |
| | | RemainingCapacityPercentage = (int)Math.Round((double)g.Count(x => x.LocationStatus == 0) / g.Count() * 100) |
| | | }) |
| | | .OrderBy(x => x.WarehouseId) |
| | | .ThenBy(x => x.LocationType) |
| | | .ToList(); |
| | | |
| | | return WebResponseContent.Instance.OK("æå", result); |