| | |
| | | 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())); |
| | |
| | | if (bomDetailList == null || bomDetailList.size() == 0) { |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "对不起,该生产物料的bom配置有误,请联系管理员!"); |
| | | } |
| | | // for (BomDetailExtListVO i :bomDetailList) { |
| | | // //查询是否投料 |
| | | // if(workorderRecordExtMapper.selectCount(new QueryWrapper<WorkorderRecord>() |
| | | // .eq("DELETED",Constants.ZERO).eq("MATERIAL_ID",i.getMaterialId()).eq("TYPE",Constants.ZERO))<=0){ |
| | | // throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"存在未投料BOM物料,无法进行报工"); |
| | | // } |
| | | // } |
| | | for (BomDetailExtListVO i :bomDetailList) { |
| | | //查询是否投料 |
| | | if(workorderRecordExtMapper.selectCount(new QueryWrapper<WorkorderRecord>() |
| | | .eq("WORKORDER_ID",mp.getId()) |
| | | .eq("DELETED",Constants.ZERO).eq("MATERIAL_ID",i.getMaterialId()).eq("TYPE",Constants.ZERO))<=0){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"存在未投料BOM物料,无法进行报工"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | WOutbound outbound = new WOutbound(); |