| | |
| | | public int submit(QualityInspect inspect) { |
| | | QualityInspect qualityInspect = qualityInspectMapper.selectById(inspect.getId()); |
| | | /*判断不合格*/ |
| | | LoginUser loginUser = SecurityUtils.getLoginUser(); |
| | | |
| | | if (ObjectUtils.isNotNull(qualityInspect.getCheckResult()) && qualityInspect.getCheckResult().equals("不合格")){ |
| | | QualityUnqualified qualityUnqualified = new QualityUnqualified(); |
| | | BeanUtils.copyProperties(qualityInspect,qualityUnqualified); |
| | |
| | | String text = inspectParams.stream().map(QualityInspectParam::getParameterItem).collect(Collectors.joining(",")); |
| | | qualityUnqualified.setDefectivePhenomena(text+"这些指标中存在不合格");//不合格现象 |
| | | qualityUnqualifiedMapper.insert(qualityUnqualified); |
| | | } |
| | | } else { |
| | | |
| | | LoginUser loginUser = SecurityUtils.getLoginUser(); |
| | | if (qualityInspect.getInspectType() == 0) { |
| | | if ("合格".equals(qualityInspect.getCheckResult())) { |
| | | ProcurementAddDto procurementRecordOutAdd = new ProcurementAddDto(); |
| | | procurementRecordOutAdd.setType(1); |
| | | procurementRecordOutAdd.setTypeName("采购入库"); |
| | | procurementRecordOutAdd.setTypeName("采购原材料检验合格入库"); |
| | | procurementRecordOutAdd.setNickName(loginUser.getNickName()); |
| | | procurementRecordOutAdd.setPurchaseLedgerId(Math.toIntExact(qualityInspect.getPurchaseLedgerId())); |
| | | if (qualityInspect.getPurchaseLedgerId() == null) { |
| | | throw new BaseException("请选择采购单"); |
| | | } |
| | | SalesLedgerProduct salesLedgerProduct = salesLedgerProductMapper.selectById(qualityInspect.getProductId()); |
| | | SalesLedgerProduct salesLedgerProduct = salesLedgerProductMapper.selectById(qualityInspect.getPurchaseLedgerId()); |
| | | |
| | | ArrayList<Details> detailss = new ArrayList<>(); |
| | | Details details = new Details(); |
| | |
| | | details.setProductModelId(qualityInspect.getProductModelId()); |
| | | detailss.add( details); |
| | | procurementRecordOutAdd.setDetails(detailss); |
| | | procurementRecordOutAdd.setQualityInspectId(qualityInspect.getId()); |
| | | procurementRecordService.add(procurementRecordOutAdd); |
| | | } |
| | | }else if (qualityInspect.getInspectType() == 1) { |
| | | //查询UnitPrice/TotalPrice |
| | | ProcurementAddDto procurementRecordOutAdd = new ProcurementAddDto(); |
| | | procurementRecordOutAdd.setType(2); |
| | | procurementRecordOutAdd.setTypeName("生产入库"); |
| | | procurementRecordOutAdd.setTypeName("生产过程检验合格入库"); |
| | | procurementRecordOutAdd.setNickName(loginUser.getNickName()); |
| | | List<Details> details = new ArrayList<>(); |
| | | Details details1 = new Details(); |
| | |
| | | .updateTime(LocalDateTime.now()) |
| | | .updateUser(loginUser.getUserId()) |
| | | .createBy(procurementRecordOutAdd.getNickName()) |
| | | .productModelId(details1.getProductModelId()); |
| | | .productModelId(details1.getProductModelId()) |
| | | .qualityInspectId(qualityInspect.getId()); |
| | | procurementRecordService.save(procurementRecordBuilder.build()); |
| | | |
| | | |
| | | |
| | | }else if (qualityInspect.getInspectType() == 2) { |
| | |
| | | SalesLedgerProduct salesLedgerProduct = salesLedgerProductMapper.selectSalesLedgerProductByMainId(qualityInspect.getProductMainId()); |
| | | ProcurementAddDto procurementRecordOutAdd = new ProcurementAddDto(); |
| | | procurementRecordOutAdd.setType(2); |
| | | procurementRecordOutAdd.setTypeName("生产入库"); |
| | | procurementRecordOutAdd.setTypeName("生产出厂检验合格入库"); |
| | | procurementRecordOutAdd.setNickName(loginUser.getNickName()); |
| | | List<Details> details = new ArrayList<>(); |
| | | Details details1 = new Details(); |
| | |
| | | details1.setProductModelId(salesLedgerProduct.getProductModelId()); |
| | | details.add(details1); |
| | | procurementRecordOutAdd.setDetails(details); |
| | | procurementRecordOutAdd.setQualityInspectId(qualityInspect.getId()); |
| | | procurementRecordService.add(procurementRecordOutAdd); |
| | | } |
| | | } |
| | | |
| | | qualityInspect.setInspectState(1);//已提交 |
| | | return qualityInspectMapper.updateById(qualityInspect); |
| | | } |