| | |
| | | /// <summary> |
| | | /// åæ¹åé
åºå |
| | | /// </summary> |
| | | public async Task<WebResponseContent> BatchAllocateStock(string orderNo, int orderDetailId, decimal batchQuantity, string outStation) |
| | | public async Task<WebResponseContent> GenerateOutboundBatchTasksAsync(int orderDetailId, decimal batchQuantity, string outStation) |
| | | { |
| | | try |
| | | { |
| | |
| | | List<Dt_OutStockLockInfo> outStockLockInfos = new List<Dt_OutStockLockInfo>(); |
| | | List<Dt_LocationInfo> locationInfos = new List<Dt_LocationInfo>(); |
| | | |
| | | (List<Dt_Task>, List<Dt_StockInfo>?, List<Dt_OutboundOrderDetail>?, List<Dt_OutStockLockInfo>?, List<Dt_LocationInfo>?) result = await BatchAllocateStockDataHandle(orderNo, orderDetailId, batchQuantity, outStation); |
| | | (List<Dt_Task>, List<Dt_StockInfo>?, List<Dt_OutboundOrderDetail>?, List<Dt_OutStockLockInfo>?, List<Dt_LocationInfo>?) result = await BatchAllocateStockDataHandle(orderDetailId, batchQuantity, outStation); |
| | | |
| | | if (result.Item2 != null && result.Item2.Count > 0) |
| | | { |
| | |
| | | catch (Exception ex) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | _logger.LogError($"åæ¹åé
åºå失败 - OrderNo: {orderNo}, OrderDetailId: {orderDetailId}, Quantity: {batchQuantity}, Error: {ex.Message}"); |
| | | _logger.LogError($"åæ¹åé
åºå失败 - OrderDetailId: {orderDetailId}, Quantity: {batchQuantity}, Error: {ex.Message}"); |
| | | return WebResponseContent.Instance.Error($"åæ¹åé
失败ï¼{ex.Message}"); |
| | | } |
| | | } |
| | |
| | | /// åæ¹åé
åºåæ°æ®å¤ç |
| | | /// </summary> |
| | | public async Task<(List<Dt_Task>, List<Dt_StockInfo>?, List<Dt_OutboundOrderDetail>?, List<Dt_OutStockLockInfo>?, List<Dt_LocationInfo>?)> |
| | | BatchAllocateStockDataHandle(string orderNo, int orderDetailId, decimal batchQuantity, string outStation) |
| | | BatchAllocateStockDataHandle( int orderDetailId, decimal batchQuantity, string outStation) |
| | | { |
| | | List<Dt_Task> tasks = new List<Dt_Task>(); |
| | | |
| | |
| | | { |
| | | throw new Exception("æªæ¾å°åºåºåæç»ä¿¡æ¯"); |
| | | } |
| | | |
| | | var outboundOrder = await _outboundOrderService.Db.Queryable<Dt_OutboundOrder>().FirstAsync(x => x.Id == outboundOrderDetail.OrderId); |
| | | if(outboundOrder == null) |
| | | { |
| | | throw new Exception("æªæ¾å°åºåºåä¿¡æ¯"); |
| | | } |
| | | // éªè¯è®¢åæç»ç¶æ |
| | | if (outboundOrderDetail.OrderDetailStatus > OrderDetailStatusEnum.New.ObjToInt() && |
| | | outboundOrderDetail.OrderDetailStatus != OrderDetailStatusEnum.AssignOverPartial.ObjToInt()) |
| | |
| | | if (allocateResult.Item1 != null && allocateResult.Item1.Count > 0) |
| | | { |
| | | // åå»ºåæ¹è®°å½ |
| | | await CreateBatchRecord(orderNo, orderDetailId, batchQuantity, batchNo); |
| | | |
| | | Dt_OutboundOrder outboundOrder = await _outboundOrderService.Repository.QueryFirstAsync(x => x.Id == outboundOrderDetail.OrderId); |
| | | await CreateBatchRecord(outboundOrder.OrderNo, orderDetailId, batchQuantity, batchNo); |
| | | |
| | | TaskTypeEnum typeEnum = outboundOrder.OrderType switch |
| | | { |
| | | (int)OutOrderTypeEnum.Issue => TaskTypeEnum.Outbound, |