| | |
| | | throw new Exception($"æªæ¾å°è´§ä½ä¿¡æ¯"); |
| | | } |
| | | int maxDepth = locationInfos.Max(x => x.Depth); |
| | | int mathCurrentRow = beRelocation.Row - Convert.ToInt32(Math.Ceiling(beRelocation.Row / maxDepth / 2.0)) * maxDepth * 2; |
| | | if (mathCurrentRow <= maxDepth) |
| | | if (beRelocation.Row <= maxDepth) |
| | | { |
| | | locationInfos = locationInfos.Where(x => x.Row - Convert.ToInt32(Math.Ceiling(x.Row / maxDepth / 2.0)) * maxDepth * 2 <= maxDepth).ToList(); |
| | | locationInfos = locationInfos.Where(x => x.Row <= maxDepth).ToList(); |
| | | } |
| | | else |
| | | else if (beRelocation.Row > maxDepth) |
| | | { |
| | | locationInfos = locationInfos.Where(x => x.Row - Convert.ToInt32(Math.Ceiling(x.Row / maxDepth / 2.0)) * maxDepth * 2 > maxDepth).ToList(); |
| | | locationInfos = locationInfos.Where(x => x.Row > maxDepth).ToList(); |
| | | } |
| | | } |
| | | |
| | |
| | | throw new Exception($"æªæ¾å°è´§ä½ä¿¡æ¯"); |
| | | } |
| | | int maxDepth = locationInfos.Max(x => x.Depth); |
| | | int mathCurrentRow = beRelocation.Row - Convert.ToInt32(Math.Ceiling(beRelocation.Row / maxDepth / 2.0)) * maxDepth * 2; |
| | | if (mathCurrentRow <= maxDepth) |
| | | //int mathCurrentRow = beRelocation.Row - Convert.ToInt32(Math.Ceiling(beRelocation.Row / maxDepth / 2.0)) * maxDepth * 2; |
| | | //if (mathCurrentRow <= maxDepth) |
| | | //{ |
| | | // locationInfos = locationInfos.Where(x => x.Row - Convert.ToInt32(Math.Ceiling(x.Row / maxDepth / 2.0)) * maxDepth * 2 <= maxDepth).ToList(); |
| | | |
| | | //} |
| | | //else |
| | | //{ |
| | | // locationInfos = locationInfos.Where(x => x.Row - Convert.ToInt32(Math.Ceiling(x.Row / maxDepth / 2.0)) * maxDepth * 2 > maxDepth).ToList(); |
| | | |
| | | //} |
| | | if (beRelocation.Row <= maxDepth) |
| | | { |
| | | locationInfos = locationInfos.Where(x => x.Row - Convert.ToInt32(Math.Ceiling(x.Row / maxDepth / 2.0)) * maxDepth * 2 <= maxDepth).ToList(); |
| | | if (beRelocation.Row <= maxDepth) |
| | | { |
| | | locationInfos = locationInfos.Where(x=>x.Row <= maxDepth).ToList(); |
| | | } |
| | | locationInfos = locationInfos.Where(x => x.Row <= maxDepth).ToList(); |
| | | } |
| | | else |
| | | else if (beRelocation.Row > maxDepth) |
| | | { |
| | | locationInfos = locationInfos.Where(x => x.Row - Convert.ToInt32(Math.Ceiling(x.Row / maxDepth / 2.0)) * maxDepth * 2 > maxDepth).ToList(); |
| | | if (beRelocation.Row > maxDepth) |
| | | { |
| | | locationInfos = locationInfos.Where(x => x.Row > maxDepth).ToList(); |
| | | } |
| | | locationInfos = locationInfos.Where(x => x.Row > maxDepth).ToList(); |
| | | } |
| | | } |
| | | |
| | |
| | | throw new Exception($"æªæ¾å°è´§ä½ä¿¡æ¯"); |
| | | } |
| | | int maxDepth = locationInfos.Max(x => x.Depth); |
| | | int mathCurrentRow = beRelocation.Row - Convert.ToInt32(Math.Ceiling(beRelocation.Row / maxDepth / 2.0)) * maxDepth * 2; |
| | | if (mathCurrentRow <= maxDepth) |
| | | //int mathCurrentRow = beRelocation.Row - Convert.ToInt32(Math.Ceiling(beRelocation.Row / maxDepth / 2.0)) * maxDepth * 2; |
| | | //if (mathCurrentRow <= maxDepth) |
| | | //{ |
| | | // locationInfos = locationInfos.Where(x => x.Row - Convert.ToInt32(Math.Ceiling(x.Row / maxDepth / 2.0)) * maxDepth * 2 <= maxDepth).ToList(); |
| | | //} |
| | | //else |
| | | //{ |
| | | // locationInfos = locationInfos.Where(x => x.Row - Convert.ToInt32(Math.Ceiling(x.Row / maxDepth / 2.0)) * maxDepth * 2 > maxDepth).ToList(); |
| | | //} |
| | | if (beRelocation.Row <= maxDepth) |
| | | { |
| | | locationInfos = locationInfos.Where(x => x.Row - Convert.ToInt32(Math.Ceiling(x.Row / maxDepth / 2.0)) * maxDepth * 2 <= maxDepth).ToList(); |
| | | locationInfos = locationInfos.Where(x => x.Row <= maxDepth).ToList(); |
| | | } |
| | | else |
| | | else if (beRelocation.Row > maxDepth) |
| | | { |
| | | locationInfos = locationInfos.Where(x => x.Row - Convert.ToInt32(Math.Ceiling(x.Row / maxDepth / 2.0)) * maxDepth * 2 > maxDepth).ToList(); |
| | | locationInfos = locationInfos.Where(x => x.Row > maxDepth).ToList(); |
| | | } |
| | | } |
| | | |
| | |
| | | continue; |
| | | } |
| | | } |
| | | if (palletTypeInfo.IsOdd) |
| | | { |
| | | Dt_LocationInfo? locationInfoExist = locationInfoDepth.FirstOrDefault(x => x.Row == locationInfo.Row && x.Column == (locationInfo.Column-1) && x.Layer == locationInfo.Layer); |
| | | if (locationInfoExist!=null && locationInfoExist.LocationStatus!= LocationStatusEnum.Free.ObjToInt() && locationInfoExist.LocationStatus != LocationStatusEnum.FreeLock.ObjToInt()) |
| | | { |
| | | continue; |
| | | } |
| | | } |
| | | locationCaches_ZH.Add(new LocationCache { LocationCode = locationInfo.LocationCode, DateTime = DateTime.Now }); |
| | | return locationInfo; |
| | | } |
| | |
| | | continue; |
| | | } |
| | | } |
| | | if (palletTypeInfo.IsOdd) |
| | | { |
| | | Dt_LocationInfo? locationInfoExist = locationInfoDepth.FirstOrDefault(x => x.Row == locationInfo.Row && x.Column == (locationInfo.Column - 1) && x.Layer == locationInfo.Layer); |
| | | if (locationInfoExist != null && locationInfoExist.LocationStatus != LocationStatusEnum.Free.ObjToInt() && locationInfoExist.LocationStatus != LocationStatusEnum.FreeLock.ObjToInt()) |
| | | { |
| | | continue; |
| | | } |
| | | } |
| | | locationCaches_ZH.Add(new LocationCache { LocationCode = locationInfo.LocationCode, DateTime = DateTime.Now }); |
| | | return 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)) |
| | | { |
| | | locationInfo = locationInfos.FirstOrDefault(x => x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && (x.Row == row + 2 || x.Row == row - 2)); |
| | | } |
| | | if (locationInfo != null) |
| | | { |
| | | groupLocations.Add(locationInfo); |
| | |
| | | InStockLock = 10, |
| | | |
| | | /// <summary> |
| | | /// æè´§éå® |
| | | /// 空é²éå® |
| | | /// </summary> |
| | | [Description("空é²éå®")] |
| | | FreeLock = 20, |
| | |
| | | float originalNeedQuantity = mesOutboundOrder.OrderQuantity; |
| | | |
| | | float needQuantity = originalNeedQuantity; |
| | | |
| | | //è·ååºå |
| | | List<Dt_StockInfo> stockInfos = _stockService.StockInfoService.GetUseableStocks(mesOutboundOrder.MaterialCode, "", mesOutboundOrder.WarehouseId); |
| | | if (!stockInfos.Any()) |
| | | { |
| | | throw new Exception($"æªæ¾å°å¯åé
åºå"); |
| | | } |
| | | List<Dt_StockInfo> autoAssignStocks = _stockService.StockInfoService.GetOutboundStocks(stockInfos, mesOutboundOrder.MaterialCode, needQuantity, out float residueQuantity); |
| | | mesOutboundOrder.LockQuantity += needQuantity - residueQuantity; |
| | | if (residueQuantity>0) |
| | | { |
| | | throw new Exception($"åºåä¸è¶³"); |
| | | } |
| | | autoAssignStocks.OrderBy(x => x.Details.FirstOrDefault()?.StockQuantity).ToList(); |
| | | outStocks.AddRange(autoAssignStocks); |
| | | float assignQuantity = needQuantity - residueQuantity; |
| | | |
| | | float orderQuantity = mesOutboundOrder.OrderQuantity; |
| | | for (int j = 0; j < autoAssignStocks.Count; j++) |
| | | { |
| | | float detailAssignQuantity = outStockLockInfos.Where(x => x.MaterielCode == mesOutboundOrder.MaterialCode).Sum(x => x.AssignQuantity);//åºåºè®¢åæç»å·²åé
æ°é |
| | |
| | | } |
| | | else |
| | | { |
| | | for (int i = 0; i < stockInfos.Count; i++) |
| | | { |
| | | Dt_StockInfo stockInfo = stockInfos[i]; |
| | | float useableStockQuantity = stockInfo.Details.Where(x => x.MaterielCode == materielCode).Sum(x => x.StockQuantity - x.OutboundQuantity); |
| | | if (useableStockQuantity < needQuantity) |
| | | { |
| | | stockInfo.Details.ForEach(x => x.OutboundQuantity = x.StockQuantity); |
| | | needQuantity -= useableStockQuantity; |
| | | } |
| | | else |
| | | { |
| | | stockInfo.Details.ForEach(x => |
| | | { |
| | | if (x.StockQuantity > x.OutboundQuantity && x.MaterielCode == materielCode) |
| | | { |
| | | if (x.StockQuantity - x.OutboundQuantity >= needQuantity) |
| | | { |
| | | x.OutboundQuantity += needQuantity; |
| | | needQuantity = 0; |
| | | } |
| | | else |
| | | { |
| | | needQuantity -= (x.StockQuantity - x.OutboundQuantity); |
| | | x.OutboundQuantity = x.StockQuantity; |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | outStocks.Add(stockInfo); |
| | | } |
| | | throw new Exception("åºåä¸è¶³"); |
| | | } |
| | | residueQuantity = needQuantity; |
| | | return outStocks; |
| | |
| | | List<Dt_OutStockLockInfo>? outStockLockInfos = null; |
| | | List<Dt_LocationInfo>? locationInfos = null; |
| | | { |
| | | //åé
åºå |
| | | (List<Dt_StockInfo>, Dt_MesOutboundOrder, List<Dt_OutStockLockInfo>, List<Dt_LocationInfo>) result = _outboundService.MesOutboundOrderService.AssignStockOutbound(mesOutboundOrder); |
| | | if (result.Item1 != null && result.Item1.Count > 0) |
| | | { |
| | | //åå»ºä»»å¡ |
| | | tasks = GetTasks(result.Item1, TaskTypeEnum.MesOutbound); |
| | | result.Item2.OrderStatus = OrderDetailStatusEnum.Outbound.ObjToInt(); |
| | | result.Item3.ForEach(x => |
| | |
| | | public List<Dt_Task> GetTasks(List<Dt_StockInfo> stockInfos, TaskTypeEnum taskType) |
| | | { |
| | | List<Dt_Task> tasks = new List<Dt_Task>(); |
| | | List<Dt_LocationInfo> locationInfos = _basicService.LocationInfoService.Repository.QueryData(x => stockInfos.Select(x=>x.LocationCode).Contains(x.LocationCode)); |
| | | for (int i = 0; i < stockInfos.Count; i++) |
| | | { |
| | | Dt_StockInfo stockInfo = stockInfos[i]; |
| | | |
| | | if (stockInfo != null) |
| | | { |
| | | Dt_LocationInfo locationInfo = _basicService.LocationInfoService.Repository.QueryFirst(x => x.LocationCode == stockInfo.LocationCode); |
| | | Dt_LocationInfo? locationInfo = locationInfos.FirstOrDefault(x => x.LocationCode == stockInfo.LocationCode); |
| | | if (!tasks.Exists(x => x.PalletCode == stockInfo.PalletCode)) |
| | | { |
| | | Dt_Task task = new() |