| | |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using SqlSugar; |
| | | using SqlSugar.Extensions; |
| | | using WIDESEA_Common.StockEnum; |
| | | using WIDESEA_Core; |
| | | using WIDESEA_DTO.CalcOut; |
| | |
| | | .QueryData(x => x.PalletCode == palletCode && x.OrderNo == orderNo); |
| | | |
| | | bool isMatMixed = false; |
| | | bool orderOver = false; |
| | | decimal sumQty = 0; |
| | | if (stockInfo != null && stockInfo.Details != null && stockInfo.Details.Any()) |
| | | { |
| | | if (outStockLockInfos.FirstOrDefault() != null) |
| | | { |
| | | bool includeBatchNo = !string.IsNullOrEmpty(outStockLockInfos.FirstOrDefault().BatchNo); |
| | | bool includeSupplyCode = !string.IsNullOrEmpty(outStockLockInfos.FirstOrDefault().SupplyCode); |
| | | |
| | | var orderId = outStockLockInfos.FirstOrDefault().OrderDetailIds.Split(","); |
| | | foreach (var item in orderId) |
| | | { |
| | | Dt_OutboundOrderDetail outboundOrderDetail = _outboundRepository.Db.Queryable<Dt_OutboundOrderDetail>().Where(x=>x.Id == item.ObjToInt()).First(); |
| | | if(outboundOrderDetail == null) |
| | | { |
| | | return WebResponseContent.Instance.Error("该æççåºåºæç»æªæ¾å°"); |
| | | } |
| | | sumQty += (outboundOrderDetail.OrderQuantity - outboundOrderDetail.OverOutQuantity - outboundOrderDetail.MoveQty); |
| | | } |
| | | if(sumQty < outStockLockInfos.FirstOrDefault().AssignQuantity) |
| | | { |
| | | orderOver = true; |
| | | } |
| | | if (includeBatchNo && includeSupplyCode) |
| | | { |
| | | isMatMixed = stockInfo.Details.GroupBy(x => new |
| | |
| | | x.MaterielName, |
| | | x.WarehouseCode |
| | | }).Count() > 1; |
| | | |
| | | Dt_OutStockLockInfo outStockLockInfo = _outboundLockInfoRepository.QueryFirst(x=>x.PalletCode == palletCode); |
| | | |
| | | if (outStockLockInfo != null) |
| | | { |
| | | return WebResponseContent.Instance.Error($"该æçå¨è¯¥åæ®ä¸æ æ£éè®°å½ï¼è¯·åå¾{outStockLockInfo.OrderNo}åæ®ä¸è¿è¡æ£è´§æä½"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | return WebResponseContent.Instance.OK(data: new { outStockLockInfos, stockInfo, isMatMixed }); |
| | | return WebResponseContent.Instance.OK(data: new { outStockLockInfos, stockInfo, isMatMixed, orderOver }); |
| | | } |
| | | catch (Exception ex) |
| | | { |