zhuo
2025-04-23 234b0ac195934b34c06045b2d2ef0f10e239dd8e
inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderPlanServiceImpl.java
@@ -499,13 +499,15 @@
                    }
                }
                //查询检验单信息
                // 添加工时
                InsProduct finalInsProduct = insProductMapper.selectById(product.getId());
                threadPoolTaskExecutor.execute(() -> {
                    InsOrder insOrder = insOrderMapper.selectById(insSample.getInsOrderId());
                    this.addAuxiliary(userId, finalInsProduct, insOrder);
                });
                // 判断是否只是参与计算值, 参与计算值实际没有填写
                if (StringUtils.isNotBlank(newResult.getInsValue()) && !newResult.getInsValue().equals("[]")) {
                    InsProduct finalInsProduct = insProductMapper.selectById(product.getId());
                    threadPoolTaskExecutor.execute(() -> {
                        InsOrder insOrder = insOrderMapper.selectById(insSample.getInsOrderId());
                        this.addAuxiliary(userId, finalInsProduct, insOrder);
                    });
                }
            }
        });
@@ -820,9 +822,10 @@
        // 5.发送消息通知给复核人
        // 查询当前人信息
        Integer userId = SecurityUtils.getUserId().intValue();
        String userName = insProductMapper.selectUserById(userId).get("name");
        Map<String, String> userMap = insProductMapper.selectUserById(verifyUser);
        String userName = userMap.get("name");
        // 查询发送人信息
        String sendUserAccount = insProductMapper.selectUserById(verifyUser).get("account");
        String sendUserAccount = userMap.get("account");
        InformationNotification info = new InformationNotification();
        info.setCreateUser(userName);
        info.setMessageType("2");
@@ -876,22 +879,8 @@
            this.addProductSpotCheck(insSamples, order);
        }
        // 12.添加工时
//        // 删除原本订单工时
//        auxiliaryOutputWorkingHoursService.remove(Wrappers.<AuxiliaryOutputWorkingHours>lambdaQuery()
//                .eq(AuxiliaryOutputWorkingHours::getOrderId, orderId));
//        // 查询工时暂存
//        List<AuxiliaryOutputWorkingHoursTemporary> hoursTemporaries = auxiliaryOutputWorkingHoursTemporaryService.list(Wrappers.<AuxiliaryOutputWorkingHoursTemporary>lambdaQuery()
//                .eq(AuxiliaryOutputWorkingHoursTemporary::getOrderId, orderId));
//        List<AuxiliaryOutputWorkingHours> outputWorkingHours = hoursTemporaries.stream().map(hoursTemporary -> {
//            AuxiliaryOutputWorkingHours workingHours = new AuxiliaryOutputWorkingHours();
//            BeanUtil.copyProperties(hoursTemporary, workingHours);
//            workingHours.setId(null);
//            return workingHours;
//        }).collect(Collectors.toList());
//        auxiliaryOutputWorkingHoursService.saveBatch(outputWorkingHours);
        // 13.添加订单费用统计信息
        // 12.添加订单费用统计信息
        List<InsProduct> productList = insProductMapper.selectProductByOrderId(orderId);
        // 删除原本费用信息
        insOrderRatesService.remove(Wrappers.<InsOrderRates>lambdaQuery()
@@ -914,7 +903,7 @@
        insOrderRatesService.saveBatch(orderRatesList);
        // 14.发送企业微信通知
        // 13.发送企业微信通知
        // 查询原材料
        IfsInventoryQuantity ifsInventoryQuantity = ifsInventoryQuantityMapper.selectById(order.getIfsInventoryId());
        // 查询样品信息
@@ -923,7 +912,7 @@
                .last("limit 1"));
        threadPoolTaskExecutor.execute(() -> {
            String message = "";
            message += "检验任务复核通知";
            message += "耐丝系统检验任务复核通知";
            message += "\n提交人: " + userName;
            message += "\n委托编号: " + order.getEntrustCode();
            message += "\n样品名称: " + insSample.getModel();
@@ -939,18 +928,18 @@
            }
        });
        // 15.ifs移库(原材料需要进行移库操作) --> 最后执行,因为失败无法回滚
        // 14.ifs移库(原材料需要进行移库操作) --> 最后执行,因为失败无法回滚
        if (ifsInventoryQuantity != null) {
            // 登记检验结果
            // 判断是否有不合格, 有不合格不能移库
            // todo: ifs移库
            insReportService.isRawMaterial(order);
            // 16 判断当前样品是否为原材料, 原材料需要进行数据分析, 判断之前10条数据同一个供应商, 同一个检验项的偏差是否超过10%
            // 15 判断当前样品是否为原材料, 原材料需要进行数据分析, 判断之前10条数据同一个供应商, 同一个检验项的偏差是否超过10%
            // 查询ifs信息获取获取前10个供应商一样的, 检验项一样信息
            threadPoolTaskExecutor.execute(() -> {
                // 添加分析数据
                addAnalysis(productList, ifsInventoryQuantity, order, userName);
                addAnalysis(productList, ifsInventoryQuantity, order, sendUserAccount);
            });
@@ -1184,7 +1173,7 @@
                IfsInventoryQuantity ifsInventoryQuantity = ifsInventoryQuantityMapper.selectById(order.getIfsInventoryId());
                String message = "";
                message += "报告编制审批通知";
                message += "耐丝系统报告编制审批通知";
                message += "\n检验人: " + userName;
                message += "\n复核人: " + chenkUserName;
                message += "\n委托编号: " + order.getEntrustCode();
@@ -1226,7 +1215,7 @@
                IfsInventoryQuantity ifsInventoryQuantity = ifsInventoryQuantityMapper.selectById(order.getIfsInventoryId());
                String message = "";
                message += "检验任务复核退回通知";
                message += "耐丝系统检验任务复核退回通知";
                message += "\n复核人: " + userName;
                message += "\n委托编号: " + order.getEntrustCode();
                message += "\n样品名称: " + insSample.getModel();
@@ -1320,7 +1309,6 @@
    /**
     * 新增不合格复测内容
     * @param ids
     * @return
     */
    @Override
@@ -1336,6 +1324,20 @@
        // 查询不合格内容
        List<InsUnqualifiedRetestProduct> list = insUnqualifiedRetestProductMapper.selectRetestProduct(ids);
        // 循环判断是否是绑定值, 绑定值修改检验要求
        for (InsUnqualifiedRetestProduct insUnqualifiedRetestProduct : list) {
            for (InsProduct insProduct : insProductsList) {
                if (insProduct.getIsBinding().equals(1)) {
                    insUnqualifiedRetestProduct.setIsBinding(1);
                    insUnqualifiedRetestProduct.setAsk(null);
                    insUnqualifiedRetestProduct.setTell(null);
                    insUnqualifiedRetestProduct.setPrice(null);
                    insUnqualifiedRetestProduct.setManHour(null);
                    insUnqualifiedRetestProduct.setSection(null);
                }
            }
        }
        // 新增不合格内容
        insUnqualifiedRetestProductService.saveBatch(list);
        list.forEach(insUnqualifiedRetestProduct -> {
@@ -2154,7 +2156,6 @@
     * @param
     */
    private void addBitReport(Integer orderId, InsOrder insOrder) {
        Map<String, String> user = insProductMapper.selectUserById(insOrder.getUserId());
        //samples是不包括带有"/"的样品
        List<SampleProductDto> samples = insSampleMapper.selectSampleProductListByOrderId(orderId);
        InsReport insReport = new InsReport();
@@ -2173,7 +2174,6 @@
        boolean isOneSample = samples.size() == 1 ? true : false;
        /*基础报告(根据绘制的原始记录模版形成)*/
        samples.forEach(a -> {
            Map<Integer, String> map2 = new HashMap<>();
            models.add(a.getModel());
            String standardMethodCode = baseMapper.getStandardMethodCode(a.getStandardMethodListId());
            if (StrUtil.isNotBlank(a.getSpecialStandardMethod())) {