| | |
| | | /// </summary> |
| | | /// <param name="outboundOrderDetails"></param> |
| | | /// <returns></returns> |
| | | (List<Dt_StockInfo>, List<Dt_OutSGOrderDetail>, List<Dt_OutStockLockInfo>, List<Dt_LocationInfo>) AssignStockOutbound(List<Dt_OutSGOrderDetail> outboundOrderDetails); |
| | | (List<Dt_StockInfo>, List<Dt_OutSGOrderDetail>, List<Dt_OutStockLockInfo>, List<Dt_LocationInfo>,string) AssignStockOutbound(List<Dt_OutSGOrderDetail> outboundOrderDetails); |
| | | |
| | | /// <summary> |
| | | /// åºåºåºååé
åï¼æ´æ°æ°æ®åºæ°æ® |
| | |
| | | /// <summary> |
| | | /// åé
åºå |
| | | /// </summary> |
| | | public (List<Dt_StockInfo>, List<Dt_OutSGOrderDetail>, List<Dt_OutStockLockInfo>, List<Dt_LocationInfo>) AssignStockOutbound(List<Dt_OutSGOrderDetail> outboundOrderDetails) |
| | | public (List<Dt_StockInfo>, List<Dt_OutSGOrderDetail>, List<Dt_OutStockLockInfo>, List<Dt_LocationInfo>,string) AssignStockOutbound(List<Dt_OutSGOrderDetail> outboundOrderDetails) |
| | | { |
| | | if (!outboundOrderDetails.Any()) |
| | | { |
| | | throw new Exception($"æªæ¾å°åºåºåæç»ä¿¡æ¯"); |
| | | } |
| | | |
| | | string message = ""; |
| | | //è·åæææç¨ä¸»è¡¨ |
| | | List<Dt_OutSGOrder> outBSTOrders = _outboundRepository.OutSGOrderRepository.QueryData(x => outboundOrderDetails.Select(x=>x.OutSGOrderId).Distinct().Contains(x.Id)); |
| | | List<Dt_StockInfo> outStocks = new List<Dt_StockInfo>(); |
| | |
| | | foreach (var item in groupDetails) |
| | | { |
| | | decimal needQuantity = item.XqLen; |
| | | //è·åæææ¡ç |
| | | List<string> palletCodes = outStocks.Select(x => x.PalletCode).ToList(); |
| | | //è·åèåç¼åå¯ç¨åºå |
| | | List<Dt_StockInfo> stockInfos = _stockService.StockInfoService.GetUseOldCacheStocks(item.MaterialNo, item.Width) ?? new List<Dt_StockInfo>(); |
| | | List<Dt_StockInfo> stockInfos = _stockService.StockInfoService.GetUseOldCacheStocks(item.MaterialNo, item.Width).Where(x => !palletCodes.Contains(x.PalletCode)).ToList() ?? new List<Dt_StockInfo>(); |
| | | //è·åç«åºå¯ç¨åºå |
| | | stockInfos.AddRange(_stockService.StockInfoService.GetUseableStocks(item.MaterialNo, item.Width, outBSTOrders.FirstOrDefault().WarehouseId).Where(x=>!outStocks.Select(x=>x.PalletCode).Contains(x.PalletCode)).ToList()); |
| | | stockInfos.AddRange(_stockService.StockInfoService.GetUseableStocks(item.MaterialNo, item.Width, outBSTOrders.FirstOrDefault().WarehouseId).Where(x=>!palletCodes.Contains(x.PalletCode)).ToList()); |
| | | if (!stockInfos.Any()) |
| | | { |
| | | message += $"ç©æï¼{item.MaterialNo},å¹
宽ï¼{item.Width}æ åºåï¼"; |
| | | continue; |
| | | } |
| | | |
| | | //åé
å®é
åºå |
| | | List<Dt_StockInfo> autoAssignStocks = _stockService.StockInfoService.GetOutOldStocks(stockInfos, needQuantity).ToList(); |
| | | //æ·»å åºååé
|
| | |
| | | locationInfos.AddRange(_basicRepository.LocationInfoRepository.GetLocationInfos(outStocks.Where(x=>!x.LocationCode.IsNullOrEmpty() && !locationInfos.Select(x=>x.LocationCode).Contains(x.LocationCode)).Select(x => x.LocationCode).ToList())); |
| | | } |
| | | |
| | | return (outStocks, outboundOrderDetails, outStockLockInfos, locationInfos); |
| | | return (outStocks, outboundOrderDetails, outStockLockInfos, locationInfos, message); |
| | | } |
| | | /// <summary> |
| | | /// åºåºåºååé
åï¼æ´æ°æ°æ®åºæ°æ® |
| | |
| | | throw new Exception($"æªæ¾å°æ¡ç {stockInfoOld.PalletCode}䏿ERPåºåä¸åå¨"); |
| | | } |
| | | BSTStockInfoDTO bSTStockInfoDTO = bSTResponse.Data ?? throw new Exception($"䏿ERPæªè¿å{stockInfoOld.PalletCode}çåºåä¿¡æ¯"); |
| | | if (stockInfoOld.StockLength <= 0 || bSTStockInfoDTO.StockMeter<=0) |
| | | { |
| | | throw new Exception($"{stockInfoOld.RfidCode}ç»å®æ¡ç {stockInfoOld.PalletCode}åºå为0"); |
| | | } |
| | | stockInfoOld.IsPick = WhetherEnum.False.ObjToInt(); |
| | | decimal stockLength = bSTStockInfoDTO.StockMeter; |
| | | decimal errWeight = Math.Abs(weight - bSTStockInfoDTO.Qty); |
| | |
| | | List<Dt_OutStockLockInfo> outStockLockInfos = new List<Dt_OutStockLockInfo>(); |
| | | List<Dt_LocationInfo> locationInfos = new List<Dt_LocationInfo>(); |
| | | //çæä»»å¡ãåºåçä¿¡æ¯ |
| | | (List<Dt_Task>, List<Dt_StockInfo>?, List<Dt_OutSGOrderDetail>?, List<Dt_OutStockLockInfo>?, List<Dt_LocationInfo>?) result = OutSGTaskDataHandle(keys); |
| | | (List<Dt_Task>, List<Dt_StockInfo>?, List<Dt_OutSGOrderDetail>?, List<Dt_OutStockLockInfo>?, List<Dt_LocationInfo>?,string) result = OutSGTaskDataHandle(keys); |
| | | if (result.Item2 != null && result.Item2.Count > 0) |
| | | { |
| | | stockInfos.AddRange(result.Item2); |
| | |
| | | { |
| | | tasks.AddRange(result.Item1); |
| | | } |
| | | content.Message = result.Item6; |
| | | //å¤çåºåºæ°æ® |
| | | return GenerateOutboundTaskDataUpdate(tasks, stockInfos, outSGOrderDetails, outStockLockInfos, locationInfos); |
| | | } |
| | |
| | | /// <param name="stockSelectViews"></param> |
| | | /// <returns></returns> |
| | | /// <exception cref="Exception"></exception> |
| | | public (List<Dt_Task>, List<Dt_StockInfo>?, List<Dt_OutSGOrderDetail>?, List<Dt_OutStockLockInfo>?, List<Dt_LocationInfo>?) OutSGTaskDataHandle(int[] keys) |
| | | public (List<Dt_Task>, List<Dt_StockInfo>?, List<Dt_OutSGOrderDetail>?, List<Dt_OutStockLockInfo>?, List<Dt_LocationInfo>?,string) OutSGTaskDataHandle(int[] keys) |
| | | { |
| | | List<Dt_Task> tasks = new List<Dt_Task>(); |
| | | List<Dt_OutSGOrderDetail> outSGOrderDetails = _outboundRepository.OutSGOrderDetailRepository.QueryData(x => keys.Contains(x.Id)); |
| | |
| | | List<Dt_LocationInfo>? locationInfos = null; |
| | | |
| | | //åé
åºå |
| | | (List<Dt_StockInfo>, List<Dt_OutSGOrderDetail>, List<Dt_OutStockLockInfo>, List<Dt_LocationInfo>) result = _outboundService.OutSGOrderDetailService.AssignStockOutbound(outSGOrderDetails); |
| | | (List<Dt_StockInfo>, List<Dt_OutSGOrderDetail>, List<Dt_OutStockLockInfo>, List<Dt_LocationInfo>,string) result = _outboundService.OutSGOrderDetailService.AssignStockOutbound(outSGOrderDetails); |
| | | if (result.Item1 != null && result.Item1.Count > 0) |
| | | { |
| | | //è·åä»»å¡ |
| | |
| | | throw new Exception("æ åºå"); |
| | | } |
| | | |
| | | return (tasks, stockInfos, orderDetails, outStockLockInfos, locationInfos); |
| | | return (tasks, stockInfos, orderDetails, outStockLockInfos, locationInfos, result.Item5); |
| | | } |
| | | /// <summary> |
| | | /// å¤çåºåºæ°æ® |