| | |
| | | insOrderPlanDTO.setUserId(null); |
| | | } |
| | | String sonLaboratory = insOrderPlanDTO.getSonLaboratory();//试验室 |
| | | insOrderPlanDTO.setSonLaboratory(null); |
| | | IPage<InsOrderPlanVO> insOrderPage = insSampleMapper.findInsSampleAndOrder(page, QueryWrappers.queryWrappers(insOrderPlanDTO), userName, sonLaboratory, laboratory); |
| | | map.put("body", insOrderPage); |
| | | return map; |
| | |
| | | List<InsProduct> insProducts = new ArrayList<>(); |
| | | switch (type) { |
| | | case 0: |
| | | //样品 |
| | | insProducts = insSampleMapper.getInsProduct1(id, laboratory); |
| | | break; |
| | | case 1: |
| | | //光纤带 |
| | | insProducts = insSampleMapper.getInsProduct2(id); |
| | | break; |
| | | case 2: |
| | | //光纤 |
| | | insProducts = insSampleMapper.getInsProduct3(id); |
| | | break; |
| | | case 3: |
| | | //套管 |
| | | insProducts = insSampleMapper.getInsProduct4(id); |
| | | break; |
| | | } |
| | | |
| | | //如果是大样品下的项目为空,那么查询第一个光纤的项目 |
| | | if (ObjectUtils.isEmpty(insProducts) && type==0){ |
| | | //查询第一个光纤的id |
| | | List<InsFiber> insFibers = insFiberMapper.selectList(Wrappers.<InsFiber>lambdaQuery().eq(InsFiber::getInsBushingId, insBushingMapper.selectList(Wrappers.<InsBushing>lambdaQuery().eq(InsBushing::getInsSampleId, id)).get(0).getId())); |
| | | insProducts = insSampleMapper.getInsProduct3(insFibers.get(0).getId()); |
| | | } |
| | | Set<Integer> set = new HashSet<>(); |
| | | Map<Integer, String> map2 = new HashMap<>(); |
| | | if (BeanUtil.isEmpty(insProducts)) return null; |
| | |
| | | List<InsBushing> insBushings = insBushingMapper.selectList(Wrappers.<InsBushing>lambdaQuery().eq(InsBushing::getInsSampleId, sampleId)); |
| | | List<InsFibers> fibers = new ArrayList<>(); |
| | | List<InsFiber> fiber = new ArrayList<>(); |
| | | List<InsBushing> bush = new ArrayList<>(); |
| | | for (InsBushing insBushing : insBushings) { |
| | | //再查询出所有的光纤带 |
| | | List<InsFibers> insFibers = insFibersMapper.selectList(Wrappers.<InsFibers>lambdaQuery().eq(InsFibers::getInsBushingId, insBushing.getId())); |
| | | List<InsFiber> insFiberList = insFiberMapper.selectList(Wrappers.<InsFiber>lambdaQuery().eq(InsFiber::getInsBushingId, insBushing.getId())); |
| | | if (CollectionUtils.isNotEmpty(insFibers)) { |
| | | for (InsFibers insFiber : insFibers) { |
| | | List<InsProduct> insProducts = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery().eq(InsProduct::getInsFibersId, insFiber.getId())); |
| | | List<Integer> collect = insProducts.stream().map(InsProduct::getInsResult).filter(sm -> ObjectUtils.isNotEmpty(sm)).collect(Collectors.toList()); |
| | | List<Integer> collect = insProducts.stream().map(InsProduct::getInsResult) |
| | | .filter(sm -> ObjectUtils.isNotEmpty(sm) && sm != 2).collect(Collectors.toList()); |
| | | if (insProducts.size() == collect.size()) { |
| | | insFiber.setState(1);//已检验 |
| | | } else { |
| | |
| | | List<InsFiber> fiberList = insFiberMapper.selectList(Wrappers.<InsFiber>lambdaQuery().in(InsFiber::getInsFibersId, insFibers.stream().map(InsFibers::getId).collect(Collectors.toList()))); |
| | | for (InsFiber insFiber : fiberList) { |
| | | List<InsProduct> insProducts = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery().eq(InsProduct::getInsFiberId, insFiber.getId())); |
| | | List<Integer> collect = insProducts.stream().map(InsProduct::getInsResult).filter(sm -> ObjectUtils.isNotEmpty(sm)).collect(Collectors.toList()); |
| | | List<Integer> collect = insProducts.stream().map(InsProduct::getInsResult) |
| | | .filter(sm -> ObjectUtils.isNotEmpty(sm) && sm != 2).collect(Collectors.toList()); |
| | | if (insProducts.size() == collect.size()) { |
| | | insFiber.setState(1);//已检验 |
| | | } else { |
| | |
| | | } |
| | | } |
| | | fiber.addAll(fiberList); |
| | | } else { |
| | | //如果套管下没有光纤带就只有光纤了 |
| | | List<InsFiber> insFiberList = insFiberMapper.selectList(Wrappers.<InsFiber>lambdaQuery().eq(InsFiber::getInsBushingId, insBushing.getId())); |
| | | } |
| | | //如果套管下没有光纤带就只有光纤了 |
| | | else if (CollectionUtils.isNotEmpty(insFiberList)) { |
| | | for (InsFiber insFiber : insFiberList) { |
| | | List<InsProduct> insProducts = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery().eq(InsProduct::getInsFiberId, insFiber.getId())); |
| | | List<Integer> collect = insProducts.stream().map(InsProduct::getInsResult).filter(sm -> ObjectUtils.isNotEmpty(sm)).collect(Collectors.toList()); |
| | | List<Integer> collect = insProducts.stream().map(InsProduct::getInsResult) |
| | | .filter(sm -> ObjectUtils.isNotEmpty(sm) && sm != 2).collect(Collectors.toList()); |
| | | if (insProducts.size() == collect.size()) { |
| | | insFiber.setState(1);//已检验 |
| | | } else { |
| | |
| | | } |
| | | fiber.addAll(insFiberList); |
| | | } |
| | | //如果光纤带和光纤都没有就只有套管(松套管) |
| | | else { |
| | | List<InsProduct> insProducts = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery() |
| | | .eq(InsProduct::getInsBushId, insBushing.getId())); |
| | | List<Integer> collect = insProducts.stream() |
| | | .map(InsProduct::getInsResult) |
| | | .filter(sm -> ObjectUtils.isNotEmpty(sm) && sm != 2).collect(Collectors.toList()); |
| | | if (insProducts.size() == collect.size()) { |
| | | insBushing.setState(1);//已检验 |
| | | } else { |
| | | insBushing.setState(0);//未检验 |
| | | } |
| | | bush.add(insBushing); |
| | | } |
| | | } |
| | | map.put("光纤带", fibers); |
| | | map.put("光纤", fiber); |
| | | map.put("套管", bush); |
| | | return map; |
| | | } |
| | | |
| | |
| | | insProduct.setId(Integer.parseInt(k)); |
| | | List<InsProductResult> results = insProductResultMapper.selectList(Wrappers.<InsProductResult>lambdaQuery() |
| | | .eq(InsProductResult::getInsProductId, insProduct.getId())); |
| | | InsProduct product = insProductMapper.selectById(insProduct.getId()); |
| | | InsProductResult result; |
| | | if (CollectionUtils.isEmpty(results)) { |
| | | result = new InsProductResult(); |
| | |
| | | result = results.get(0); |
| | | } |
| | | result.setInsProductId(Integer.parseInt(k)); |
| | | InsProductResult insProductResult = insProductResultMapper.selectOne(Wrappers.<InsProductResult>lambdaQuery().eq(InsProductResult::getInsProductId, Integer.parseInt(k))); |
| | | /*校验一下result表*/ |
| | | List<InsProductResult> insProductResultss = insProductResultMapper.selectList(Wrappers.<InsProductResult>lambdaQuery() |
| | | .eq(InsProductResult::getInsProductId, insProduct.getId())); |
| | | if (insProductResultss.size() > 1) { |
| | | for (int i = 1; i < insProductResultss.size(); i++) { |
| | | insProductResultMapper.deleteById(insProductResultss.get(i)); |
| | | } |
| | | } |
| | | //InsProductResult insProductResult = insProductResultMapper.selectOne(Wrappers.<InsProductResult>lambdaQuery().eq(InsProductResult::getInsProductId, Integer.parseInt(k))); |
| | | //检验值 |
| | | if (jo.get("insValue") != null) { |
| | | JSONArray jsonArray = JSON.parseArray(JSON.toJSONString(jo.get("insValue"))); |
| | | List<Map<String, Object>> iv = new ArrayList<>(); |
| | |
| | | } |
| | | result.setInsValue(JSON.toJSONString(iv)); |
| | | } |
| | | //计算值 |
| | | if (jo.get("comValue") != null && !Objects.equals(jo.get("comValue"), "")) { |
| | | JSONArray jsonArray2 = JSON.parseArray(JSON.toJSONString(jo.get("comValue"))); |
| | | List<Map<String, Object>> cv = new ArrayList<>(); |
| | |
| | | } |
| | | result.setComValue(JSON.toJSONString(cv)); |
| | | } |
| | | //最终值 |
| | | try { |
| | | JSONObject resValue = JSON.parseObject(JSON.toJSONString(jo.get("resValue"))); |
| | | if (resValue.get("v") != null) { |
| | |
| | | } catch (Exception e) { |
| | | insProduct.setLastValue("");//'' |
| | | } |
| | | //设备编号 |
| | | if (jo.get("equipValue") != null) { |
| | | JSONArray jsonArray2 = JSON.parseArray(JSON.toJSONString(jo.get("equipValue"))); |
| | | List<Map<String, Object>> ev = new ArrayList<>(); |
| | |
| | | } |
| | | result.setEquipValue(JSON.toJSONString(ev)); |
| | | } |
| | | //设备名称 |
| | | if (jo.get("equipName") != null) { |
| | | JSONArray jsonArray2 = JSON.parseArray(JSON.toJSONString(jo.get("equipName"))); |
| | | List<Map<String, Object>> ev = new ArrayList<>(); |
| | |
| | | } |
| | | result.setEquipName(JSON.toJSONString(ev)); |
| | | } |
| | | //结论 |
| | | try { |
| | | JSONObject insResult = JSON.parseObject(JSON.toJSONString(jo.get("insResult"))); |
| | | String ir = JSON.parseObject(JSON.toJSONString(insResult.get("v"))).get("v") + ""; |
| | |
| | | |
| | | /*如果是第一次选择设备信息,且还有其余样品也有同一个经验项目,那么所有样品的该项目都用这个设备信息*/ |
| | | //先查询是否还有其余样品 |
| | | InsProduct product = insProductMapper.selectById(insProduct.getId()); |
| | | |
| | | Integer insSampleId = product.getInsSampleId(); |
| | | List<InsSample> insSamples = insSampleMapper.selectList(Wrappers.<InsSample>lambdaQuery().eq(InsSample::getInsOrderId, insSampleMapper.selectById(insSampleId).getInsOrderId())); |
| | | if (insSamples.size() > 1) { |
| | | //如果有多个样品或者是不是采集类型就同一个设备 |
| | | if (insSamples.size() > 1 && !product.getInspectionItemType().equals("1")) { |
| | | //存在其余样品,查询是否有同一种检验项目 |
| | | for (InsSample sample : insSamples.stream().filter(insSample -> !insSample.getId().equals(insSampleId)).collect(Collectors.toList())) { |
| | | InsProduct product1 = insProductMapper.selectOne(Wrappers.<InsProduct>lambdaQuery() |
| | |
| | | .eq(InsProduct::getInspectionItemSubclassEn, product.getInspectionItemSubclassEn()) |
| | | .eq(InsProduct::getTemplateId, product.getTemplateId()) |
| | | .eq(InsProduct::getStandardMethodListId, product.getStandardMethodListId()) |
| | | .eq(InsProduct::getInsBushId, product.getInsBushId()) |
| | | .eq(InsProduct::getInsFibersId, product.getInsFibersId()) |
| | | .eq(InsProduct::getInsFiberId, product.getInsFiberId()) |
| | | ); |
| | | if (ObjectUtils.isNotEmpty(product1)){ |
| | | if (ObjectUtils.isNotEmpty(product1)) { |
| | | //如果存在项目,查询是否有表 |
| | | InsProductResult productResult = insProductResultMapper.selectOne(Wrappers.<InsProductResult>lambdaQuery().eq(InsProductResult::getInsProductId, product1.getId())); |
| | | if (ObjectUtils.isEmpty(productResult)){ |
| | | InsProductResult productResult = insProductResultMapper.selectOne(Wrappers.<InsProductResult>lambdaQuery() |
| | | .eq(InsProductResult::getInsProductId, product1.getId())); |
| | | if (ObjectUtils.isEmpty(productResult)) { |
| | | //没有表新建表 |
| | | productResult = new InsProductResult(); |
| | | productResult.setInsProductId(product1.getId()); |
| | |
| | | productResult.setCreateUser(userId); |
| | | productResult.setUpdateUser(userId); |
| | | insProductResultMapper.insert(productResult); |
| | | }else if(ObjectUtils.isEmpty(productResult.getEquipValue())){ |
| | | } else if (ObjectUtils.isEmpty(productResult.getEquipValue())) { |
| | | //有表判断是否有设备 |
| | | productResult.setEquipValue(result.getEquipValue()); |
| | | productResult.setEquipName(result.getEquipValue()); |
| | |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | insProduct.setUpdateUser(userId); |
| | | insProductMapper.updateById(insProduct); |
| | | insProductUserMapper.insert(new InsProductUser(null, userId, LocalDateTime.now(), insProduct.getId())); |
| | |
| | | isWithinRange = !now.isBefore(startTime) || !now.isAfter(endTime); |
| | | } |
| | | //加班 |
| | | AuxiliaryOutputWorkingHours count1 = auxiliaryOutputWorkingHoursMapper.selectOne(Wrappers.<AuxiliaryOutputWorkingHours>lambdaQuery() |
| | | List<AuxiliaryOutputWorkingHours> count1s = auxiliaryOutputWorkingHoursMapper.selectList(Wrappers.<AuxiliaryOutputWorkingHours>lambdaQuery() |
| | | .eq(AuxiliaryOutputWorkingHours::getCheck, userId) |
| | | .eq(AuxiliaryOutputWorkingHours::getInspectionItem, insProduct.getInspectionItem()) |
| | | .eq(AuxiliaryOutputWorkingHours::getInspectionItemSubclass, insProduct.getInspectionItemSubclass()) |
| | | .eq(AuxiliaryOutputWorkingHours::getOvertimeOrderNo, insOrder.getEntrustCode())); |
| | | .eq(AuxiliaryOutputWorkingHours::getOvertimeOrderNo, insOrder.getEntrustCode()) |
| | | .eq(AuxiliaryOutputWorkingHours::getSample, insSampleMapper.selectById(insProduct.getInsSampleId()).getSampleCode())); |
| | | if (count1s.size() > 1) { |
| | | for (int i = 1; i < count1s.size(); i++) { |
| | | auxiliaryOutputWorkingHoursMapper.deleteById(count1s.get(i)); |
| | | } |
| | | } |
| | | //非加班 |
| | | AuxiliaryOutputWorkingHours count2 = auxiliaryOutputWorkingHoursMapper.selectOne(Wrappers.<AuxiliaryOutputWorkingHours>lambdaQuery() |
| | | List<AuxiliaryOutputWorkingHours> count2s = auxiliaryOutputWorkingHoursMapper.selectList(Wrappers.<AuxiliaryOutputWorkingHours>lambdaQuery() |
| | | .eq(AuxiliaryOutputWorkingHours::getCheck, userId) |
| | | .eq(AuxiliaryOutputWorkingHours::getInspectionItem, insProduct.getInspectionItem()) |
| | | .eq(AuxiliaryOutputWorkingHours::getInspectionItemSubclass, insProduct.getInspectionItemSubclass()) |
| | | .eq(AuxiliaryOutputWorkingHours::getOrderNo, insOrder.getEntrustCode())); |
| | | if (ObjectUtils.isNotEmpty(insProduct.getManHour()) && ObjectUtils.isEmpty(count2) && ObjectUtils.isEmpty(count1)) { |
| | | .eq(AuxiliaryOutputWorkingHours::getOrderNo, insOrder.getEntrustCode()) |
| | | .eq(AuxiliaryOutputWorkingHours::getSample, insSampleMapper.selectById(insProduct.getInsSampleId()).getSampleCode())); |
| | | if (count2s.size() > 1) { |
| | | for (int i = 1; i < count2s.size(); i++) { |
| | | auxiliaryOutputWorkingHoursMapper.deleteById(count2s.get(i)); |
| | | } |
| | | } |
| | | if (ObjectUtils.isNotEmpty(insProduct.getManHour()) && CollectionUtils.isEmpty(count2s) && CollectionUtils.isEmpty(count1s)) { |
| | | AuxiliaryOutputWorkingHours auxiliaryOutputWorkingHours = new AuxiliaryOutputWorkingHours(); |
| | | if (isWithinRange) { |
| | | //在时间内就是正常上班 |
| | |
| | | auxiliaryOutputWorkingHours.setWeek(String.valueOf(DateUtil.weekOfYear(DateUtil.offsetDay(parse, 1))));//周次 |
| | | auxiliaryOutputWorkingHours.setCheck(userId);//检测人 |
| | | } |
| | | if (ObjectUtils.isEmpty(insProductResult) && !result.getInsValue().equals("[]") || (ObjectUtils.isNotEmpty(insProductResult) && !insProductResult.getInsValue().equals(result.getInsValue()) && !insProductResult.getInsValue().equals("[]"))) { |
| | | auxiliaryOutputWorkingHoursMapper.insert(auxiliaryOutputWorkingHours); |
| | | try { |
| | | if (CollectionUtils.isEmpty(insProductResultss) && !result.getInsValue().equals("[]") || (CollectionUtils.isNotEmpty(insProductResultss) && !insProductResultss.get(0).getInsValue().equals(result.getInsValue()) && !insProductResultss.get(0).getInsValue().equals("[]"))) { |
| | | auxiliaryOutputWorkingHoursMapper.insert(auxiliaryOutputWorkingHours); |
| | | } |
| | | }catch (Exception e){ |
| | | System.out.println("工时新增不成功!!!"); |
| | | } |
| | | } |
| | | } |
| | |
| | | Long l1 = insProductMapper.selectCount(Wrappers.<InsProduct>lambdaQuery() |
| | | .eq(InsProduct::getInsSampleId, insSample.getId()) |
| | | .and(wrapper -> wrapper |
| | | .isNull(InsProduct::getInsResult) |
| | | .isNotNull(InsProduct::getInsResult) |
| | | .or() |
| | | .eq(InsProduct::getInsResult, 2) |
| | | .ne(InsProduct::getInsResult, 2) |
| | | )); |
| | | if (l == l1) { |
| | | insSample.setInsState(2); |
| | |
| | | textRenderData.setText("✔"); |
| | | break; |
| | | case 0: |
| | | resultCh.set(resultCh.get() + "、" + p.getInspectionItem() + (p.getInspectionItemSubclass().equals("") ? "" : " " + p.getInspectionItemSubclass())); |
| | | resultEn.set(resultEn.get() + "、" + p.getInspectionItemEn() + ((Objects.equals(p.getInspectionItemSubclassEn(), "") || Objects.equals(p.getInspectionItemSubclassEn(), null)) ? "" : " " + p.getInspectionItemSubclassEn())); |
| | | Set<String> uniqueItems1 = new HashSet<>(); |
| | | Set<String> uniqueItems2 = new HashSet<>(); |
| | | |
| | | String item1 = p.getInspectionItem() + (p.getInspectionItemSubclass().equals("") ? "" : " " + p.getInspectionItemSubclass()); |
| | | if (uniqueItems1.add(item1)) { |
| | | resultCh.set(resultCh.get() + "、" + item1); |
| | | } |
| | | //resultCh.set(resultCh.get() + "、" + p.getInspectionItem() + (p.getInspectionItemSubclass().equals("") ? "" : " " + p.getInspectionItemSubclass())); |
| | | String item2 = p.getInspectionItemEn() + ((Objects.equals(p.getInspectionItemSubclassEn(), "") || Objects.equals(p.getInspectionItemSubclassEn(), null)) ? "" : " " + p.getInspectionItemSubclassEn()); |
| | | if (uniqueItems2.add(item2)) { |
| | | resultEn.set(resultEn.get() + "、" + item2); |
| | | } |
| | | //resultEn.set(resultEn.get() + "、" + ); |
| | | textRenderData.setText("✖"); |
| | | break; |
| | | default: |
| | |
| | | put("createTime", now.format(DateTimeFormatter.ofPattern("yyyy年MM月dd日"))); |
| | | put("createTimeEn", monthNames[now.getMonthValue() - 1] + " " + now.getDayOfMonth() + ", " + now.getYear()); |
| | | put("insTime", insOrder.getInsTime().format(DateTimeFormatter.ofPattern("yyyy年MM月dd日"))); |
| | | put("insTimeEn", monthNames[insOrder.getInsTime().getMonthValue() - 1] + " " + now.getDayOfMonth() + ", " + now.getYear()); |
| | | put("insTimeEn", monthNames[insOrder.getInsTime().getMonthValue() - 1] + " " + insOrder.getInsTime().getDayOfMonth() + ", " + insOrder.getInsTime().getYear()); |
| | | put("writeUrl", null); |
| | | put("insUrl", Pictures.ofLocal(imgUrl + "/" + signatureUrl).create()); |
| | | put("images", images); |