| | |
| | | qualityInspect.setUnqualifiedQuantity(BigDecimal.ZERO); |
| | | } |
| | | |
| | | // 合格直接入库 |
| | | if(qualityInspect.getQualifiedQuantity().compareTo(BigDecimal.ZERO) > 0){ |
| | | // 合格入库处理(根据检验类型区分) |
| | | // 过程检验(inspectType=1):入库到成品库 |
| | | // 出厂检验(inspectType=2):不做任何业务处理 |
| | | // 原材料检验(inspectType=0):正常质检入库 |
| | | Integer inspectType = qualityInspect.getInspectType(); |
| | | boolean shouldStockIn = inspectType == null || inspectType == 0 || inspectType == 1; |
| | | |
| | | if (shouldStockIn && qualityInspect.getQualifiedQuantity().compareTo(BigDecimal.ZERO) > 0) { |
| | | //仅添加入库记录 |
| | | StockInventoryDto stockInventoryDto = new StockInventoryDto(); |
| | | //如果是采购质检合格入库选用CUSTOMIZATION_UNSTOCK_OUT,其余合格入库选用QUALITYINSPECT_STOCK_IN |
| | | stockInventoryDto.setRecordType(String.valueOf(StockInQualifiedRecordTypeEnum.QUALITYINSPECT_STOCK_IN.getCode())); |
| | | if (ObjectUtils.isNotEmpty(qualityInspect.getPurchaseLedgerId())){ |
| | | //过程检验使用生产报工入库类型,其他质检使用质检入库类型 |
| | | if (inspectType != null && inspectType == 1) { |
| | | stockInventoryDto.setRecordType(String.valueOf(StockInQualifiedRecordTypeEnum.PRODUCTION_REPORT_STOCK_IN.getCode())); |
| | | } else if (ObjectUtils.isNotEmpty(qualityInspect.getPurchaseLedgerId())) { |
| | | //采购质检合格入库 |
| | | stockInventoryDto.setRecordType(String.valueOf(StockInQualifiedRecordTypeEnum.CUSTOMIZATION_UNSTOCK_OUT.getCode())); |
| | | } else { |
| | | stockInventoryDto.setRecordType(String.valueOf(StockInQualifiedRecordTypeEnum.QUALITYINSPECT_STOCK_IN.getCode())); |
| | | } |
| | | stockInventoryDto.setRecordId(qualityInspect.getId()); |
| | | stockInventoryDto.setProductModelId(qualityInspect.getProductModelId()); |
| | |
| | | // 4. 更新检验单 |
| | | qualityInspectMapper.updateById(qualityInspect); |
| | | |
| | | // 5. 合格入库处理 |
| | | if (qualified.compareTo(BigDecimal.ZERO) > 0) { |
| | | // 5. 合格入库处理(根据检验类型区分) |
| | | // 过程检验(inspectType=1):入库到成品库 |
| | | // 出厂检验(inspectType=2):不做任何业务处理 |
| | | // 原材料检验(inspectType=0):正常质检入库 |
| | | Integer inspectType = qualityInspect.getInspectType(); |
| | | boolean shouldStockIn = inspectType == null || inspectType == 0 || inspectType == 1; |
| | | |
| | | if (shouldStockIn && qualified.compareTo(BigDecimal.ZERO) > 0) { |
| | | StockInventoryDto stockInventoryDto = new StockInventoryDto(); |
| | | stockInventoryDto.setRecordType(String.valueOf(StockInQualifiedRecordTypeEnum.QUALITYINSPECT_STOCK_IN.getCode())); |
| | | if (ObjectUtils.isNotEmpty(qualityInspect.getPurchaseLedgerId())) { |
| | | //过程检验使用生产报工入库类型,其他质检使用质检入库类型 |
| | | if (inspectType != null && inspectType == 1) { |
| | | stockInventoryDto.setRecordType(String.valueOf(StockInQualifiedRecordTypeEnum.PRODUCTION_REPORT_STOCK_IN.getCode())); |
| | | } else if (ObjectUtils.isNotEmpty(qualityInspect.getPurchaseLedgerId())) { |
| | | stockInventoryDto.setRecordType(String.valueOf(StockInQualifiedRecordTypeEnum.CUSTOMIZATION_UNSTOCK_OUT.getCode())); |
| | | } else { |
| | | stockInventoryDto.setRecordType(String.valueOf(StockInQualifiedRecordTypeEnum.QUALITYINSPECT_STOCK_IN.getCode())); |
| | | } |
| | | stockInventoryDto.setRecordId(qualityInspect.getId()); |
| | | stockInventoryDto.setProductModelId(qualityInspect.getProductModelId()); |
| | |
| | | AutoJudgeAllResponse response = new AutoJudgeAllResponse(); |
| | | List<AutoJudgeAllResponse.ParamJudgeResult> paramResults = new ArrayList<>(); |
| | | boolean hasRequiredUnqualified = false; |
| | | boolean hasNonRequiredUnqualified = false; |
| | | boolean allTextDescription = true; |
| | | boolean hasRequiredParam = false; |
| | | |
| | |
| | | if (paramResult.getIsRequired() && Boolean.FALSE.equals(result.getQualified())) { |
| | | hasRequiredUnqualified = true; |
| | | } |
| | | // 检查非必要判断参数是否不合格 |
| | | if (!paramResult.getIsRequired() && Boolean.FALSE.equals(result.getQualified())) { |
| | | hasNonRequiredUnqualified = true; |
| | | } |
| | | } |
| | | paramResults.add(paramResult); |
| | | } |
| | | |
| | | response.setParamResults(paramResults); |
| | | response.setHasRequiredUnqualified(hasRequiredUnqualified); |
| | | response.setHasNonRequiredUnqualified(hasNonRequiredUnqualified); |
| | | response.setAllTextDescription(allTextDescription); |
| | | |
| | | // 确定整体判断结果 |
| | |
| | | response.setAutoJudgeResult(null); |
| | | } else if (hasRequiredUnqualified) { |
| | | response.setAutoJudgeResult("不合格"); |
| | | } else if (hasNonRequiredUnqualified) { |
| | | // 必要参数都合格,但有非必要参数不合格 → 部分合格 |
| | | response.setAutoJudgeResult("部分合格"); |
| | | } else { |
| | | // 所有需要自动判断的参数项都合格,整体为合格 |
| | | response.setAutoJudgeResult("合格"); |