111
k94314517
2023-08-15 f41e23e6db7436fd9e1b811314d2f497d8bc63f2
server/src/main/java/doumeemes/service/ext/impl/PlansExtServiceImpl.java
@@ -1563,14 +1563,17 @@
        if(Objects.isNull(plans)){
            throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"未查询到工序计划数据");
        }
        if(plans.getStatus().equals(Constants.PLAN_STATUS.create)){
        if(!(plans.getStatus().equals(Constants.PLAN_STATUS.create)||plans.getStatus().equals(Constants.PLAN_STATUS.distribute))){
            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"工序计划已流转,无法操作");
        }
        if(plans.getPaused().equals(Constants.ONE)){
            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"工序计划已暂停,无法操作");
        }
        if(Objects.isNull(autoWorkReportDTO.getCreateWorkorderRecordDTO())){
            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"参数错误:产出数据");
        }
        //查询工序计划已分配数量
        List<Workorder> workorderList = workorderExtMapper.selectList(new QueryWrapper<Workorder>().eq("PLAN_ID",plans.getId()));
        List<Workorder> workorderList = workorderExtMapper.selectList(new QueryWrapper<Workorder>().eq("PLAN_ID",plans.getId()).notIn("STATUS",7,8));
        //本次产出数量
        BigDecimal num = autoWorkReportDTO.getCreateWorkorderRecordDTO().getQualifiedNum().add(autoWorkReportDTO.getCreateWorkorderRecordDTO().getUnQualifiedNum());
        if(num.compareTo(BigDecimal.ZERO)<=Constants.ZERO){
@@ -1601,6 +1604,15 @@
        workorderRecordStandardService.createWorkorderRecord(autoWorkReportDTO.getCreateWorkorderRecordDTO(),user);
        //工单报工
        workorderRecordStandardService.comfirmDone(workorder);
        //更新工单状态
        if(num.compareTo(BigDecimal.valueOf(surplusNum))==Constants.ZERO){
            plans.setStatus(Constants.PLAN_STATUS.done);
        }else{
            if(plans.getStatus().equals(Constants.PLAN_STATUS.create)){
                plans.setStatus(Constants.PLAN_STATUS.distribute);
            }
        }
        plansExtMapper.updateById(plans);
    }