jiangping
2023-08-18 40609a1bd11ce79445562ac23f16af23a48c3933
server/src/main/java/doumeemes/service/ext/impl/WorkorderRecordStandardServiceImpl.java
@@ -705,8 +705,12 @@
            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()));
@@ -830,13 +834,14 @@
            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();