| | |
| | | // 质检总数 |
| | | BigDecimal quantity = qualityInspect.getQuantity(); |
| | | // 合格数量 = 质检总数 - 不良数量 |
| | | if (ObjectUtils.isNull(qualityInspect.getDefectiveQuantity())) { |
| | | qualityInspect.setDefectiveQuantity(BigDecimal.ZERO); |
| | | } |
| | | BigDecimal productQty = quantity.subtract(qualityInspect.getDefectiveQuantity()); |
| | | // 合格率=合格数量/质检总数 |
| | | BigDecimal productQtyRate = productQty.divide(quantity, 2, RoundingMode.HALF_UP) |
| | |
| | | if (productQtyRate.compareTo(productProcess.getQualifiedRate()) < 0) { |
| | | // 查询生产订单 |
| | | ProductionProductMain productionProductMain = productionProductMainMapper.selectById(qualityInspect.getProductMainId()); |
| | | ProductWorkOrder productWorkOrder = productWorkOrderMapper.selectById(productionProductMain.getWorkOrderId()); |
| | | ProductOrder productOrder = productOrderMapper.selectOne(new LambdaQueryWrapper<ProductOrder>().eq(ProductOrder::getId, productWorkOrder.getProductOrderId())); |
| | | if (!ObjectUtils.isNull(productOrder)) { |
| | | // 发送通知给管理员 |
| | | sysNoticeService.simpleNoticeByUser("质检提示", |
| | | String.format("%s生产订单,%s工序合格率%.2f%%低于标准%.2f%%", productOrder.getNpsNo(), productProcess.getName(), productQtyRate, productProcess.getQualifiedRate()), |
| | | Arrays.asList(Long.valueOf(1L)), |
| | | qualityInspect.getInspectType() == 2 ? "/qualityManagement/finalInspection" : "/qualityManagement/processInspection"); |
| | | if (!ObjectUtils.isNull(productionProductMain)) { |
| | | ProductWorkOrder productWorkOrder = productWorkOrderMapper.selectById(productionProductMain.getWorkOrderId()); |
| | | if (!ObjectUtils.isNull(productWorkOrder)) { |
| | | ProductOrder productOrder = productOrderMapper.selectOne(new LambdaQueryWrapper<ProductOrder>().eq(ProductOrder::getId, productWorkOrder.getProductOrderId())); |
| | | if (!ObjectUtils.isNull(productOrder)) { |
| | | // 发送通知给管理员 |
| | | sysNoticeService.simpleNoticeByUser("质检提示", |
| | | String.format("%s生产订单,%s工序合格率%.2f%%低于标准%.2f%%", productOrder.getNpsNo(), productProcess.getName(), productQtyRate, productProcess.getQualifiedRate()), |
| | | Arrays.asList(Long.valueOf(1L)), |
| | | qualityInspect.getInspectType() == 2 ? "/qualityManagement/finalInspection" : "/qualityManagement/processInspection"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | |