zss
2024-10-18 1f15333b0a97a327865f7aab8f1e3f9ba8fc16f8
inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderPlanServiceImpl.java
@@ -204,8 +204,22 @@
                //样品
                insProducts = insSampleMapper.getInsProduct1(id, laboratory);
                if (insProducts.size() == 0) {
                    insProducts = insSampleMapper.getIns2Product1(id, laboratory);
                    insProducts = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery()
                            .eq(InsProduct::getInsSampleId, id)
                            .eq(InsProduct::getState, 1)
                            .eq(InsProduct::getSonLaboratory, laboratory));
                    for (InsProduct insProduct : insProducts) {
                        List<InsProductResult2> insProductResult2List = insProductResult2Mapper.selectList(Wrappers.<InsProductResult2>lambdaQuery()
                                .eq(InsProductResult2::getInsProductId, insProduct.getId()).isNull(InsProductResult2::getNum));
                        insProduct.setInsProductResult2(insProductResult2List);
                        InsProductResult insProductResult = insProductResultMapper.selectOne(Wrappers.<InsProductResult>lambdaQuery()
                                .eq(InsProductResult::getInsProductId, insProduct.getId()).isNull(InsProductResult::getNum));
                        insProduct.setInsProductResult(insProductResult);
                    }
                }
                /*if (insProducts.size() == 0) {
                    insProducts = insSampleMapper.getIns2Product1(id, laboratory);
                }*/
                break;
            case 1:
                //光纤带
@@ -274,7 +288,9 @@
    public Map<String, Object> getFileList(Page page, InsOrderFile insOrderFile) {
        Map<String, Object> map = new HashMap<>();
        map.put("head", PrintChina.printChina(InsOrderFile.class));
        IPage<InsOrderFile> insOrderFileIPage = insOrderFileMapper.getFileList(page, QueryWrappers.queryWrappers(insOrderFile));
        Integer insOrderId = insOrderFile.getInsOrderId();
        insOrderFile.setInsOrderId(null);
        IPage<InsOrderFile> insOrderFileIPage = insOrderFileMapper.getFileList(page, QueryWrappers.queryWrappers(insOrderFile), insOrderId);
        map.put("body", insOrderFileIPage);
        return map;
    }
@@ -393,13 +409,15 @@
        //判断该订单是否站点任务有(继续试验或者是结束试验)
        List<InsOrderState> orderStates = insOrderStateMapper.selectList(Wrappers.<InsOrderState>lambdaQuery()
                .eq(InsOrderState::getInsOrderId, insSample.getInsOrderId())
                .and(wrapper -> wrapper
                        .eq(InsOrderState::getInsState, 5)
                        .or()
                        .eq(InsOrderState::getInsState, 6)
                ));
                .eq(InsOrderState::getInsState, 5));
        if (CollectionUtils.isEmpty(orderStates)) {
            throw new ErrorException("该样品的检验任务还没有结束试验,暂时无法出库!");
            List<InsOrderState> orderStates1 = insOrderStateMapper.selectList(Wrappers.<InsOrderState>lambdaQuery()
                    .eq(InsOrderState::getInsOrderId, insSample.getInsOrderId())
                    .eq(InsOrderState::getLaboratory, sonLaboratory)
                    .eq(InsOrderState::getInsState, 6));
            if (CollectionUtils.isEmpty(orderStates1)) {
                throw new ErrorException("该样品的检验任务还没有结束试验或继续试验,暂时无法出库!");
            }
        }
        warehouseService.outWarehouse(sampleCode);
        return 0;
@@ -857,7 +875,6 @@
        Integer userId = getLook.selectPowerByMethodAndUserId(null).get("userId");
        List<InsUnPass> insUnPasses = new ArrayList<>();
        /*样品下的项目只要有一个项目不合格则检验结果为0,否则为1*/
        //这里的insSamples是订单下的所有样品包括("/")
        List<InsSample> samples = insSampleMapper.selectList(Wrappers.<InsSample>lambdaQuery().eq(InsSample::getInsOrderId, orderId));
        for (InsSample insSample : samples) {
            List<InsProduct> insProducts = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery()
@@ -935,6 +952,14 @@
                    //如果订单类型是原理样机,则该订单直接闭环
                    InsOrder insOrder = insOrderMapper.selectById(orderId);
                    if (insOrder.getFormType().equals("原理样机")) {
                        for (InsSample sample : samples) {
                            //出库
                            try{
                                outInsOrderState(laboratory,sample.getSampleCode());
                            }catch (Exception e){
                            }
                        }
                        insOrder.setState(4);
                        insOrderMapper.updateById(insOrder);
                    }
@@ -1032,8 +1057,8 @@
                .eq(InsOrderState::getLaboratory, submitPlanDto.getLaboratory())
                .set(InsOrderState::getInsState, 3)
                .set(InsOrderState::getVerifyUser, submitPlanDto.getVerifyUser()));
        InsOrder insOrder = insOrderMapper.selectById(submitPlanDto.getOrderId());
        /*这个情况先关闭----如果是C类订单且是下发到质量部,则直接复核通过(结束试验)*/
//        InsOrder insOrder = insOrderMapper.selectById(orderId);
//        if (insOrder.getOrderType().equals("C") && insOrder.getDepartmentLims().equals("质量部")) {
//            try {
//                verifyPlan(orderId, laboratory, 2, null);
@@ -1056,14 +1081,14 @@
        //todo 企业微信消息推送@zss
           /* HashMap<String, Object> map = new HashMap<>();
            String account = userMapper.selectById(userId).getAccount();
            map.put("touser", *//*account*//*"ZT-012117");//接收消息成员的账号'ZT-031292'这种类型(如果有多个用'|'分隔)
            map.put("touser", account);//接收消息成员的账号'ZT-031292'这种类型(如果有多个用'|'分隔)
            map.put("toparty", "");//接收部门id
            map.put("totag", "");//消息标签id
            map.put("msgtype", "text");//消息类型 text:文本
            map.put("agentid", 1000513);//应用id
            map.put("agentid", 1000517);//应用id
            HashMap<String, Object> hashMap = new HashMap<>();
            hashMap.put("content", "您有一条检验任务待复核消息,请前往LIMS系统查看。<a href=\"http://10.1.13.77/enter\"> </a>");
            map.put("text", JSONArray.toJSONString(hashMap));//消息内容
            hashMap.put("content", "您有一条检验任务待复核消息,订单号是:"+insOrder.getEntrustCode()+",请前往LIMS系统查看。<a href=\"https://ztwxlims.ztt.cn:7443/enter\">中天通信LIMS系统 </a>");
            map.put("text", hashMap);//消息内容
            map.put("safe", 0);//是否保密消息.0否
            map.put("enable_id_trans", 0);//是否开启id转译.0否
            map.put("enable_duplicate_check", 0);//是否开启重复消息检查.0否
@@ -1093,19 +1118,18 @@
        });*/
        /*生成电路试验的站点报告并上传到附件中*/
        if (submitPlanDto.getLaboratory().equals("电路试验")) {
            try {
                wordUtils.generateWord(submitPlanDto.getNote(), submitPlanDto.getTerm(), orderState);
            } catch (Exception e) {
                throw new ErrorException("电路试验的站点报告生成有误,请联系开发人员调整!");
            }
            wordUtils.generateWord(submitPlanDto.getNote(), submitPlanDto.getTerm(), orderState);
//            try {
//                wordUtils.generateWord(submitPlanDto.getNote(), submitPlanDto.getTerm(), orderState);
//            } catch (Exception e) {
//                throw new ErrorException("电路试验的站点报告生成有误,请联系开发人员调整!");
//            }
        }
        /*// 删除数采采集次数
        String key = "frequency" + ":" + submitPlanDto.getEntrustCode() + ":*";
        RedisUtil.delsLike(key);*/
        /*生成产量工时*/
        //查询检验单信息
        InsOrder insOrder = insOrderMapper.selectById(submitPlanDto.getOrderId());
        //校验如果这个人这个检测项目已经添加过了则不需要再新增
        //首先判断当前人的当前时间是否是排班时间内,如果不是就是加班
        LocalDateTime today = LocalDateTime.of(LocalDate.now(), LocalTime.MIDNIGHT);