|  |  |  | 
|---|
|  |  |  | List<WOutbound> outboundList = new ArrayList<>(); | 
|---|
|  |  |  | //如果需要投料的物料集合,在库存中寻找投料来源 | 
|---|
|  |  |  | for(WStock model : materialList){ | 
|---|
|  |  |  | List<WStock> useList = allList.stream().filter(wStock -> Constants.equalsInteger(model.getMaterialId(),wStock.getMaterialId())).collect(Collectors.toList()); | 
|---|
|  |  |  | BigDecimal wStockNum = useList.stream().map(s -> s.getNum()).reduce(BigDecimal.ZERO, BigDecimal::add); | 
|---|
|  |  |  | if(wStockNum.compareTo(Constants.formatBigdecimal(model.getNum()))<Constants.ZERO){ | 
|---|
|  |  |  | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "对不起,生产物料不足,无法进行该操作!"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | for(WStock ts : allList){ | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if(Constants.equalsInteger(model.getMaterialId(),ts.getMaterialId())){ | 
|---|
|  |  |  | //还需要投料数量 | 
|---|
|  |  |  | BigDecimal actNum = Constants.formatBigdecimal(model.getNum()).subtract(Constants.formatBigdecimal(model.getTNum())); | 
|---|