|  |  |  | 
|---|
|  |  |  | private WorkorderRecordStandardService workorderRecordStandardService; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private UnqualifiedRecordMapper unqualifiedRecordMapper; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private CompanyUserExtMapper companyUserExtMapper; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public  PlansExtListVO findById(Integer id){ | 
|---|
|  |  |  | 
|---|
|  |  |  | List<WorkorderHistory> whList = new ArrayList<>(); | 
|---|
|  |  |  | Workorder order = new Workorder(); | 
|---|
|  |  |  | order.setCreateTime(DateUtil.getCurrentDate()); | 
|---|
|  |  |  | order.setCreateUser(user.getId()); | 
|---|
|  |  |  | order.setCreateUser(param.getCreateUser()); | 
|---|
|  |  |  | order.setDeleted(Constants.ZERO); | 
|---|
|  |  |  | order.setStatus(Constants.WORKORDER_STATUS.create); | 
|---|
|  |  |  | order.setPlanId(mp.getId()); | 
|---|
|  |  |  | 
|---|
|  |  |  | public void autoWorkReport(LoginUserInfo user, AutoWorkReportDTO autoWorkReportDTO){ | 
|---|
|  |  |  | if(Objects.isNull(autoWorkReportDTO) | 
|---|
|  |  |  | || Objects.isNull(autoWorkReportDTO.getCreateWorkorderRecordDTO()) | 
|---|
|  |  |  | || Objects.isNull(autoWorkReportDTO.getProUserList()) | 
|---|
|  |  |  | || Objects.isNull(autoWorkReportDTO.getProUserList().size()==0) | 
|---|
|  |  |  | || Objects.isNull(autoWorkReportDTO.getCreateWorkorderRecordDTO().getUnQualifiedNum())|| autoWorkReportDTO.getCreateWorkorderRecordDTO().getUnQualifiedNum().compareTo(BigDecimal.ZERO) < Constants.ZERO | 
|---|
|  |  |  | || Objects.isNull(autoWorkReportDTO.getCreateWorkorderRecordDTO().getQualifiedNum())|| autoWorkReportDTO.getCreateWorkorderRecordDTO().getQualifiedNum().compareTo(BigDecimal.ZERO) < Constants.ZERO){ | 
|---|
|  |  |  | throw new BusinessException(ResponseStatus.BAD_REQUEST); | 
|---|
|  |  |  | 
|---|
|  |  |  | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"参数错误:产出数据"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //工单已分配数量 | 
|---|
|  |  |  | Integer produceNum = workorderList.stream().map(s -> s.getPlanNum()).reduce(Constants.ZERO, Integer::sum); | 
|---|
|  |  |  | Integer produceNum = workorderList.stream().map(s -> s.getUnqualifiedNum() + s.getQualifiedNum()).reduce(Constants.ZERO, Integer::sum); | 
|---|
|  |  |  | Integer surplusNum = plans.getNum() - produceNum; | 
|---|
|  |  |  | if(num.compareTo(BigDecimal.valueOf(surplusNum))>0){ | 
|---|
|  |  |  | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"超出当前工序计划可报工数量"); | 
|---|
|  |  |  | 
|---|
|  |  |  | Workorder param = new Workorder(); | 
|---|
|  |  |  | param.setPlanId(autoWorkReportDTO.getPlansId()); | 
|---|
|  |  |  | param.setPlanDate(new Date()); | 
|---|
|  |  |  | //        CompanyUser companyUser= companyUserExtMapper.selectById(autoWorkReportDTO.getProUserList().get(Constants.ZERO)); | 
|---|
|  |  |  | param.setCreateUser(autoWorkReportDTO.getProUserList().get(Constants.ZERO)); | 
|---|
|  |  |  | param.setProGroupId(autoWorkReportDTO.getProGroupId()); | 
|---|
|  |  |  | param.setProUserList(autoWorkReportDTO.getProUserList()); | 
|---|
|  |  |  | param.setPlanNum(num.intValue()); | 
|---|