| | |
| | | decimal availableQuantity = availableStockMap.GetValueOrDefault(stock.Id, 0); |
| | | if (availableQuantity <= 0) continue; |
| | | |
| | | // 计ç®è¯¥æçå¯åé
æ°é |
| | | decimal allocateQuantity = Math.Min(remainingQuantity, availableQuantity); |
| | | (decimal ActualAllocatedQuantity, List<Dt_OutStockLockInfo> LockInfoList) actualAllocated = AllocateStockQuantity(stock, allocateQuantity, availableQuantity, outboundOrder, firstDetail, request, lockStockMap.GetValueOrDefault(stock.Id, new List<Dt_OutStockLockInfo>()), stockDetailMap); |
| | | |
| | | // æ¬æ¬¡åé
çæ°é |
| | | decimal actualAllocatedQuantity = actualAllocated.ActualAllocatedQuantity; |
| | | |
| | | if (actualAllocatedQuantity > 0) |
| | |
| | | // è®¡ç®æ»åºåæ°é |
| | | decimal totalQuantity = stockInfo.Details.Sum(x => x.StockQuantity); |
| | | |
| | | List<Dt_OutStockLockInfo> outStockLockInfos = allocatedData.Where(x => x.StockId == stockInfo.Id).ToList(); |
| | | List<Dt_OutStockLockInfo> outStockLockInfos = allocatedData.Where(x => x.StockId == stockInfo.Id && x.MaterielCode == materielCalc.MaterielCode).ToList(); |
| | | |
| | | // 计ç®å·²åé
æ°é |
| | | decimal allocatedQuantity = outStockLockInfos.Sum(x => x.AllocatedQuantity); |
| | |
| | | |
| | | lockStockMap[stockInfo.Id] = outStockLockInfos; |
| | | } |
| | | |
| | | |
| | | return (availableStockMap, lockStockMap); |
| | | } |
| | |
| | | |
| | | // æ´æ°åé
åºåºé |
| | | decimal beforeAssignQuantity = totalAllocatedQuantity; // æ¬æ¬¡åé
åçæ»ç´¯è®¡é |
| | | lockInfo.AssignQuantity += actualAllocatedQuantity; // ç´¯å æ¬æ¬¡åé
æ°é |
| | | lockInfo.AssignQuantity += actualAllocatedQuantity; // æ¬æ¬¡åé
æ°é |
| | | lockInfo.AllocatedQuantity = beforeAssignQuantity; // è®°å½æ¬æ¬¡åé
åçæ»ç´¯è®¡é |
| | | |
| | | lockInfoList.Add(lockInfo); |
| | |
| | | _detailService.Repository.UpdateData(updateDetails); |
| | | |
| | | // æ´æ°éå®è®°å½ç累计已åºåºæ°éï¼éè¦æ´æ°è¯¥æçè¯¥ç©æçææç¸å
³è®°å½ï¼ |
| | | UpdateLockInfoAllocatedQuantity(stockInfo.Id, stockDetail.MaterielCode, stockDetail.BatchNo, actualOutboundQuantity); |
| | | //UpdateLockInfoAllocatedQuantity(stockInfo.Id, stockDetail.MaterielCode, stockDetail.BatchNo, actualOutboundQuantity); |
| | | |
| | | // æäº¤äºå¡ |
| | | _unitOfWorkManage.CommitTran(); |
| | |
| | | if (CheckOutboundOrderCompleted(request.OrderNo)) |
| | | { |
| | | UpdateOutboundOrderStatus(request.OrderNo, OutOrderStatusEnum.åºåºå®æ.ObjToInt()); |
| | | |
| | | //todo: åä¼ MES |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | |
| | | { |
| | | // æ´æ°ååºåæç» |
| | | stockDetail.StockQuantity = remainingQuantity; |
| | | //stockDetail.Barcode = newBarcode; |
| | | stockDetail.Remark = $"æå
åæ´æ°ï¼åæ¡ç ï¼{request.Barcode}ï¼æ°æ°éï¼{remainingQuantity}ï¼æä½è
ï¼{request.Operator}"; |
| | | _stockDetailService.Repository.UpdateData(stockDetail); |
| | | } |