| | |
| | | |
| | | @Resource |
| | | private InsOrderFileMapper insOrderFileMapper; |
| | | |
| | | @Override |
| | | public Map<String, Object> selectInsOrderPlanList(Page page, InsOrderPlanDTO insOrderPlanDTO) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("head", PrintChina.printChina(InsOrderPlanVO.class)); |
| | | Map<String, Integer> map1 = getLook.selectPowerByMethodAndUserId(null); |
| | | User user = userMapper.selectById(map1.get("userId"));//当前登录的人 |
| | | |
| | | //获取当前人所属实验室id |
| | | String departLimsId = user.getDepartLimsId(); |
| | | String laboratory = null; |
| | | if (ObjectUtils.isNotEmpty(departLimsId) && !departLimsId.equals("")) { |
| | | String[] split = departLimsId.split(","); |
| | | //查询对应架构名称(通信实验室,电力实验室,检测办) |
| | | String departLims = baseMapper.seldepLimsId(Integer.parseInt(split[split.length - 1])); |
| | | if (departLims.contains("实验室")) { |
| | | laboratory = departLims; |
| | | } |
| | | } |
| | | String userName = null; |
| | | Integer userId = null; |
| | | if (ObjectUtil.isNotEmpty(insOrderPlanDTO.getUserId()) ) { |
| | | Map<String, Integer> map1 = getLook.selectPowerByMethodAndUserId(null); |
| | | userId = map1.get("userId"); |
| | | insOrderPlanDTO.setUserId(userId.longValue()); |
| | | if (ObjectUtil.isNotEmpty(insOrderPlanDTO.getUserId())) { |
| | | userId = map1.get("userId"); |
| | | userName = userMapper.selectById(map1.get("userId")).getName(); |
| | | insOrderPlanDTO.setUserId(null); |
| | | } |
| | | String sonLaboratory = insOrderPlanDTO.getSonLaboratory();//试验室 |
| | | IPage<InsOrderPlanVO> insOrderPage = insSampleMapper.findInsSampleAndOrder(page, QueryWrappers.queryWrappers(insOrderPlanDTO), userId,sonLaboratory); |
| | | IPage<InsOrderPlanVO> insOrderPage = insSampleMapper.findInsSampleAndOrder(page, QueryWrappers.queryWrappers(insOrderPlanDTO), userName, sonLaboratory, laboratory); |
| | | map.put("body", insOrderPage); |
| | | return map; |
| | | } |
| | |
| | | map.put("head", PrintChina.printChina(InsOrderPlanTaskSwitchVo.class)); |
| | | Map<String, Integer> map1 = getLook.selectPowerByMethodAndUserId(null); |
| | | Integer userId = map1.get("userId"); |
| | | User user = userMapper.selectById(map1.get("userId"));//当前登录的人 |
| | | |
| | | //获取当前人所属实验室id |
| | | String departLimsId = user.getDepartLimsId(); |
| | | String laboratory = null; |
| | | if (ObjectUtils.isNotEmpty(departLimsId) && !departLimsId.equals("")) { |
| | | String[] split = departLimsId.split(","); |
| | | //查询对应架构名称(通信实验室,电力实验室,检测办) |
| | | String departLims = baseMapper.seldepLimsId(Integer.parseInt(split[split.length - 1])); |
| | | if (departLims.contains("实验室")) { |
| | | laboratory = departLims; |
| | | } |
| | | } |
| | | if (ObjectUtil.isNotEmpty(insOrderPlanDTO.getUserId())) { |
| | | insOrderPlanDTO.setUserId(userId.longValue()); |
| | | } |
| | | String sonLaboratory = insOrderPlanDTO.getSonLaboratory();//试验室 |
| | | IPage<InsOrderPlanTaskSwitchVo> insOrderPage = insSampleMapper.inspectionOrderDetailsTaskSwitching(page, QueryWrappers.queryWrappers(insOrderPlanDTO), userId,sonLaboratory); |
| | | IPage<InsOrderPlanTaskSwitchVo> insOrderPage = insSampleMapper.inspectionOrderDetailsTaskSwitching(page, QueryWrappers.queryWrappers(insOrderPlanDTO), userId, sonLaboratory, laboratory); |
| | | map.put("body", insOrderPage); |
| | | return map; |
| | | } |
| | |
| | | } |
| | | Map<String, Integer> map1 = getLook.selectPowerByMethodAndUserId(null); |
| | | Integer userId = map1.get("userId"); |
| | | InsSampleUser insSampleUser = new InsSampleUser(entity.getInsSampleId().intValue(), userId, 1,entity.getSonLaboratory()); |
| | | InsSampleUser insSampleUser = new InsSampleUser(entity.getInsSampleId().intValue(), userId, 0, entity.getSonLaboratory()); |
| | | return insSampleUserMapper.insert(insSampleUser) > 0; |
| | | } |
| | | |
| | |
| | | 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; |
| | | } |
| | | // 数采新增 |
| | | getDeviceMessage(insProducts, request); |
| | | |
| | | Set<Integer> set = new HashSet<>(); |
| | | Map<Integer, String> map2 = new HashMap<>(); |
| | |
| | | return insProducts; |
| | | } |
| | | |
| | | private List<InsProduct> getDeviceMessage(List<InsProduct> insProducts, HttpServletRequest request) { |
| | | String ipAddress = request.getRemoteAddr(); |
| | | // 防止回环地址变为IPv6 |
| | | String ip = ipAddress.equals("0:0:0:0:0:0:0:1") ? "127.0.0.1" : ipAddress; |
| | | insProducts.forEach(i -> { |
| | | Map<String, Object> devices = baseMapper.getDeviceMessage(ip, i.getInspectionItem(), i.getInspectionItemSubclass(), i.getSampleType()); |
| | | if (ObjectUtils.isNotEmpty(devices) && ObjectUtils.isNotEmpty(devices.get("file_type")) && ObjectUtils.isNotEmpty(devices.get("collect_url"))) { |
| | | InsProductResult insProductResult = i.getInsProductResult(); |
| | | if (ObjectUtils.isEmpty(insProductResult)) { |
| | | insProductResult = new InsProductResult(); |
| | | } |
| | | List<Object> list = new ArrayList<>(); |
| | | Map<Object, Object> hashMap = new HashMap<>(); |
| | | hashMap.put("v", devices.get("device_name")); |
| | | list.add(hashMap); |
| | | insProductResult.setEquipName(JSON.toJSON(list).toString()); |
| | | List<Object> listValue = new ArrayList<>(); |
| | | Map<Object, Object> hashMapValue = new HashMap<>(); |
| | | hashMapValue.put("v", devices.get("management_number")); |
| | | listValue.add(hashMapValue); |
| | | insProductResult.setEquipName(JSON.toJSON(list).toString()); |
| | | insProductResult.setEquipValue(JSON.toJSON(listValue).toString()); |
| | | i.setInsProductResult(insProductResult); |
| | | } |
| | | }); |
| | | return insProducts; |
| | | } |
| | | @Override |
| | | public List<String> checkSubmitPlan(Integer orderId, String laboratory) { |
| | | List<String> collect = new ArrayList<>(); |
| | |
| | | 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()); |
| | | if (insProducts.size()==collect.size()) { |
| | | 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 { |
| | | } else { |
| | | insFiber.setState(0);//未检验 |
| | | } |
| | | } |
| | |
| | | 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()); |
| | | if (insProducts.size()==collect.size()) { |
| | | 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 { |
| | | } else { |
| | | insFiber.setState(0);//未检验 |
| | | } |
| | | } |
| | | 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()); |
| | | if (insProducts.size()==collect.size()) { |
| | | 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 { |
| | | } else { |
| | | insFiber.setState(0);//未检验 |
| | | } |
| | | } |
| | | 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; |
| | | } |
| | | |
| | |
| | | //先查出这个样品下有哪些管色标,光纤带,光纤色标 |
| | | //先查出套管 |
| | | List<InsBushing> insBushings = insBushingMapper.selectList(Wrappers.<InsBushing>lambdaQuery().eq(InsBushing::getInsSampleId, sampleId)); |
| | | if (insBushings.size()>0) { |
| | | if (insBushings.size() > 0) { |
| | | //通信--温度循环 |
| | | for (InsBushing insBushing : insBushings) { |
| | | //再查询出所有的光纤带 |
| | |
| | | insProduct.setInsProductResult(insProductResult); |
| | | } |
| | | //求同等条件下1次循环20度常温的计算值 |
| | | InsProductResult insProductResult1 = insProductResultMapper.selectOne(Wrappers.<InsProductResult>lambdaQuery().eq(InsProductResult::getInsProductId,insProductMapper.selectOne(Wrappers.<InsProduct>lambdaQuery() |
| | | .eq(InsProduct::getInsSampleId,sampleId) |
| | | InsProductResult insProductResult1 = insProductResultMapper.selectOne(Wrappers.<InsProductResult>lambdaQuery().eq(InsProductResult::getInsProductId, insProductMapper.selectOne(Wrappers.<InsProduct>lambdaQuery() |
| | | .eq(InsProduct::getInsSampleId, sampleId) |
| | | .eq(InsProduct::getInspectionItem, "1") |
| | | .eq(InsProduct::getInspectionItemSubclass, "20℃(常温)") |
| | | .eq(InsProduct::getInspectionItemClass, insProduct.getInspectionItemClass()) |
| | | .eq(InsProduct::getInsFiberId, fiber.getId())).getId() )); |
| | | if (ObjectUtils.isNotEmpty(insProductResult1) &&!insProductResult1.getComValue().equals("[]")) { |
| | | .eq(InsProduct::getInsFiberId, fiber.getId())).getId())); |
| | | if (ObjectUtils.isNotEmpty(insProductResult1) && !insProductResult1.getComValue().equals("[]")) { |
| | | insProduct.setComplue(insProductResult1.getComValue().split(":")[1].split("\"")[1]); |
| | | } |
| | | productVo.setInsProduct(insProduct); |
| | |
| | | } |
| | | } |
| | | } |
| | | } |
| | | else { |
| | | } else { |
| | | //如果套管下没有光纤带就只有光纤了 |
| | | List<InsFiber> insFiberList = insFiberMapper.selectList(Wrappers.<InsFiber>lambdaQuery().eq(InsFiber::getInsBushingId, insBushing.getId())); |
| | | for (InsFiber fiber : insFiberList) { |
| | |
| | | productVo.setBushColor(fiber.getBushColor()); |
| | | insProduct.setInsProductResult(insProductResult); |
| | | //求同等条件下1次循环20度常温的计算值 |
| | | InsProductResult insProductResult1 = insProductResultMapper.selectOne(Wrappers.<InsProductResult>lambdaQuery().eq(InsProductResult::getInsProductId,insProductMapper.selectOne(Wrappers.<InsProduct>lambdaQuery() |
| | | .eq(InsProduct::getInsSampleId,sampleId) |
| | | InsProductResult insProductResult1 = insProductResultMapper.selectOne(Wrappers.<InsProductResult>lambdaQuery().eq(InsProductResult::getInsProductId, insProductMapper.selectOne(Wrappers.<InsProduct>lambdaQuery() |
| | | .eq(InsProduct::getInsSampleId, sampleId) |
| | | .eq(InsProduct::getInspectionItem, "1") |
| | | .eq(InsProduct::getInspectionItemSubclass, "20℃(常温)") |
| | | .eq(InsProduct::getInspectionItemClass, insProduct.getInspectionItemClass()) |
| | | .eq(InsProduct::getInsFiberId, fiber.getId())).getId() )); |
| | | .eq(InsProduct::getInsFiberId, fiber.getId())).getId())); |
| | | if (ObjectUtils.isNotEmpty(insProductResult1) && !insProductResult1.getComValue().equals("[]")) { |
| | | insProduct.setComplue(insProductResult1.getComValue().split(":")[1].split("\"")[1]); |
| | | } |
| | |
| | | } |
| | | } |
| | | productVos = productVos.stream().sorted(Comparator.comparing(productVo -> productVo.getInsProduct().getInspectionItemClass())).collect(Collectors.toList()); |
| | | } |
| | | else { |
| | | } else { |
| | | //电力--热循环和温升试验 |
| | | List<InsProduct> insProducts = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery() |
| | | .eq(InsProduct::getInsSampleId, sampleId) |
| | |
| | | JSONObject jo = JSON.parseObject(JSON.toJSONString(v)); |
| | | InsProduct insProduct = new InsProduct(); |
| | | insProduct.setId(Integer.parseInt(k)); |
| | | List<InsProductResult> results = insProductResultMapper.selectList(Wrappers.<InsProductResult>lambdaQuery().eq(InsProductResult::getInsProductId, insProduct.getId())); |
| | | List<InsProductResult> results = insProductResultMapper.selectList(Wrappers.<InsProductResult>lambdaQuery() |
| | | .eq(InsProductResult::getInsProductId, insProduct.getId())); |
| | | InsProductResult result; |
| | | if (CollectionUtils.isEmpty(results)) { |
| | | result = new InsProductResult(); |
| | |
| | | result = results.get(0); |
| | | } |
| | | result.setInsProductId(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) { |
| | |
| | | insProduct.setLastValue(o.equals("") ? null : (o.toString())); |
| | | } |
| | | } 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.setInsResult(Integer.parseInt(ir)); |
| | | } catch (Exception e) { |
| | | insProduct.setInsResult(2);//待定 |
| | | } |
| | | if (BeanUtil.isEmpty(result.getId())) { |
| | | result.setCreateUser(userId); |
| | |
| | | result.setUpdateTime(LocalDateTime.now()); |
| | | insProductResultMapper.updateById(result); |
| | | } |
| | | |
| | | /*如果是第一次选择设备信息,且还有其余样品也有同一个经验项目,那么所有样品的该项目都用这个设备信息*/ |
| | | //先查询是否还有其余样品 |
| | | 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 && !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::getState, 1) |
| | | .eq(InsProduct::getInsSampleId, sample.getId()) |
| | | .eq(InsProduct::getInspectionItem, product.getInspectionItem()) |
| | | .eq(InsProduct::getInspectionItemEn, product.getInspectionItemEn()) |
| | | .eq(InsProduct::getInspectionItemSubclass, product.getInspectionItemSubclass()) |
| | | .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)) { |
| | | //如果存在项目,查询是否有表 |
| | | InsProductResult productResult = insProductResultMapper.selectOne(Wrappers.<InsProductResult>lambdaQuery() |
| | | .eq(InsProductResult::getInsProductId, product1.getId())); |
| | | if (ObjectUtils.isEmpty(productResult)) { |
| | | //没有表新建表 |
| | | productResult = new InsProductResult(); |
| | | productResult.setInsProductId(product1.getId()); |
| | | productResult.setEquipValue(result.getEquipValue()); |
| | | productResult.setEquipName(result.getEquipValue()); |
| | | productResult.setCreateUser(userId); |
| | | productResult.setUpdateUser(userId); |
| | | insProductResultMapper.insert(productResult); |
| | | } else if (ObjectUtils.isEmpty(productResult.getEquipValue())) { |
| | | //有表判断是否有设备 |
| | | productResult.setEquipValue(result.getEquipValue()); |
| | | productResult.setEquipName(result.getEquipValue()); |
| | | productResult.setUpdateUser(userId); |
| | | productResult.setUpdateTime(LocalDateTime.now()); |
| | | insProductResultMapper.updateById(productResult); |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | insProduct.setUpdateUser(userId); |
| | | insProductMapper.updateById(insProduct); |
| | | insProductUserMapper.insert(new InsProductUser(null, userId, LocalDateTime.now(), insProduct.getId())); |
| | |
| | | PerformanceShift performanceShift = performanceShiftMapper.selectOne(Wrappers.<PerformanceShift>lambdaQuery() |
| | | .eq(PerformanceShift::getUserId, userId) |
| | | .eq(PerformanceShift::getWorkTime, today)); |
| | | if (ObjectUtils.isNotEmpty(performanceShift)){ |
| | | if (ObjectUtils.isNotEmpty(performanceShift)) { |
| | | ShiftTime shiftTime = shiftTimeMapper.selectOne(Wrappers.<ShiftTime>lambdaQuery().eq(ShiftTime::getShift, performanceShift.getShift())); |
| | | if (ObjectUtils.isNotEmpty(shiftTime)){ |
| | | if (ObjectUtils.isNotEmpty(shiftTime)) { |
| | | DateTimeFormatter forma = DateTimeFormatter.ofPattern("HH:mm"); |
| | | LocalTime now = LocalTime.now(); |
| | | LocalTime startTime = LocalTime.parse(shiftTime.getStartTime(), forma); |
| | | LocalTime endTime = LocalTime.parse(shiftTime.getEndTime(), forma); |
| | | // 检查当前时间是否在范围内(包括边界) |
| | | boolean isWithinRange = !now.isBefore(startTime) && !now.isAfter(endTime); |
| | | boolean isWithinRange; |
| | | if (endTime.isAfter(startTime)) { |
| | | // 不跨天的情况 |
| | | isWithinRange = !now.isBefore(startTime) && !now.isAfter(endTime); |
| | | } else { |
| | | // 跨天的情况 |
| | | isWithinRange = !now.isBefore(startTime) || !now.isAfter(endTime); |
| | | } |
| | | //加班 |
| | | AuxiliaryOutputWorkingHours count1 = auxiliaryOutputWorkingHoursMapper.selectOne(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())); |
| | | //非加班 |
| | | AuxiliaryOutputWorkingHours count2 = auxiliaryOutputWorkingHoursMapper.selectOne(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 (ObjectUtils.isNotEmpty(insProduct.getManHour()) && ObjectUtils.isEmpty(count2) && ObjectUtils.isEmpty(count1)) { |
| | | AuxiliaryOutputWorkingHours auxiliaryOutputWorkingHours = new AuxiliaryOutputWorkingHours(); |
| | | if (isWithinRange) { |
| | | //在时间内就是正常上班 |
| | |
| | | auxiliaryOutputWorkingHours.setOrderNo(insOrder.getEntrustCode());//非加班委托单号 |
| | | auxiliaryOutputWorkingHours.setWorkTime(insProduct.getManHour());//非加班工时 |
| | | auxiliaryOutputWorkingHours.setAmount(1);//非加班数量 |
| | | auxiliaryOutputWorkingHours.setOutputWorkTime((ObjectUtils.isNotEmpty(auxiliaryOutputWorkingHours.getOvertimeWorkTime())?auxiliaryOutputWorkingHours.getOvertimeWorkTime():0)+(ObjectUtils.isNotEmpty(auxiliaryOutputWorkingHours.getWorkTime())?auxiliaryOutputWorkingHours.getWorkTime():0));//产量工时 |
| | | auxiliaryOutputWorkingHours.setOutputWorkTime((ObjectUtils.isNotEmpty(auxiliaryOutputWorkingHours.getOvertimeWorkTime()) ? auxiliaryOutputWorkingHours.getOvertimeWorkTime() : 0) + (ObjectUtils.isNotEmpty(auxiliaryOutputWorkingHours.getWorkTime()) ? auxiliaryOutputWorkingHours.getWorkTime() : 0));//产量工时 |
| | | auxiliaryOutputWorkingHours.setManHourGroup(insProduct.getManHourGroup());//工时分组 |
| | | DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); |
| | | DateTimeFormatter formatters = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); |
| | |
| | | auxiliaryOutputWorkingHours.setOvertimeOrderNo(insOrder.getEntrustCode());//加班委托单号 |
| | | auxiliaryOutputWorkingHours.setOvertimeWorkTime(insProduct.getManHour());//加班工时 |
| | | auxiliaryOutputWorkingHours.setOvertimeAmount(1);//加班数量 |
| | | auxiliaryOutputWorkingHours.setOutputWorkTime((ObjectUtils.isNotEmpty(auxiliaryOutputWorkingHours.getOvertimeWorkTime())?auxiliaryOutputWorkingHours.getOvertimeWorkTime():0)+(ObjectUtils.isNotEmpty(auxiliaryOutputWorkingHours.getWorkTime())?auxiliaryOutputWorkingHours.getWorkTime():0));//产量工时 |
| | | auxiliaryOutputWorkingHours.setOutputWorkTime((ObjectUtils.isNotEmpty(auxiliaryOutputWorkingHours.getOvertimeWorkTime()) ? auxiliaryOutputWorkingHours.getOvertimeWorkTime() : 0) + (ObjectUtils.isNotEmpty(auxiliaryOutputWorkingHours.getWorkTime()) ? auxiliaryOutputWorkingHours.getWorkTime() : 0));//产量工时 |
| | | auxiliaryOutputWorkingHours.setManHourGroup(insProduct.getManHourGroup());//工时分组 |
| | | DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); |
| | | DateTimeFormatter formatters = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); |
| | |
| | | Long l = insProductMapper.selectCount(Wrappers.<InsProduct>lambdaQuery() |
| | | .eq(InsProduct::getInsSampleId, insSample.getId())); |
| | | Long l1 = insProductMapper.selectCount(Wrappers.<InsProduct>lambdaQuery() |
| | | .eq(InsProduct::getInsSampleId, insSample.getId()).isNotNull(InsProduct::getInsResult)); |
| | | .eq(InsProduct::getInsSampleId, insSample.getId()) |
| | | .and(wrapper -> wrapper |
| | | .isNull(InsProduct::getInsResult) |
| | | .or() |
| | | .eq(InsProduct::getInsResult, 2) |
| | | )); |
| | | if (l == l1) { |
| | | insSample.setInsState(2); |
| | | } |
| | | insSampleMapper.updateById(insSample); |
| | | /*校验一下result表*/ |
| | | List<InsProductResult> insProductResults = insProductResultMapper.selectList(Wrappers.<InsProductResult>lambdaQuery().eq(InsProductResult::getInsProductId, insProduct.getId()).orderByDesc(InsProductResult::getId)); |
| | | List<InsProductResult> insProductResults = insProductResultMapper.selectList(Wrappers.<InsProductResult>lambdaQuery() |
| | | .eq(InsProductResult::getInsProductId, insProduct.getId())); |
| | | if (insProductResults.size() > 1) { |
| | | insProductResultMapper.deleteById(insProductResults.get(0)); |
| | | for (int i = 1; i < insProductResults.size(); i++) { |
| | | insProductResultMapper.deleteById(insProductResults.get(i)); |
| | | } |
| | | } |
| | | }); |
| | | return insContext.keySet().stream().findFirst().orElse(null); |
| | |
| | | int orderId = insSampleMapper.selectById(sampleId).getInsOrderId(); |
| | | // 通过订单id查找所有样本id |
| | | List<Integer> sampleIds = insSampleMapper.selectList(Wrappers.<InsSample>lambdaQuery().eq(InsSample::getInsOrderId, orderId)).stream().map(InsSample::getId).collect(Collectors.toList()); |
| | | // 通过检查每一个样本id查到属于检验项结论 is null的数量 |
| | | Long count = insProductMapper.selectCount(Wrappers.<InsProduct>lambdaQuery().in(InsProduct::getInsSampleId, sampleIds).isNull(InsProduct::getInsResult).eq(InsProduct::getSonLaboratory, insProduct.getSonLaboratory()).eq(InsProduct::getState, 1)); |
| | | // 通过检查每一个样本id查到属于检验项结论 is null 或者 =2 的数量 |
| | | Long count = insProductMapper.selectCount(Wrappers.<InsProduct>lambdaQuery() |
| | | .in(InsProduct::getInsSampleId, sampleIds) |
| | | .and(wrapper -> wrapper |
| | | .isNull(InsProduct::getInsResult) |
| | | .or() |
| | | .eq(InsProduct::getInsResult, 2) |
| | | ) |
| | | //.isNull(InsProduct::getInsResult) |
| | | .eq(InsProduct::getSonLaboratory, insProduct.getSonLaboratory()) |
| | | .eq(InsProduct::getState, 1)); |
| | | if (count == 0) { |
| | | insOrderStateMapper.update(new InsOrderState(), Wrappers.<InsOrderState>lambdaUpdate() |
| | | .eq(InsOrderState::getInsOrderId, orderId) |
| | |
| | | |
| | | //交接 |
| | | @Override |
| | | public int upPlanUser(Integer userId, Integer orderId,String sonLaboratory) { |
| | | public int upPlanUser(Integer userId, Integer orderId, String sonLaboratory) { |
| | | InsSampleUser insSampleUser = new InsSampleUser(); |
| | | insSampleUser.setUserId(userId); |
| | | insSampleUser.setInsSampleId(orderId); |
| | |
| | | textRenderData.setText("√"); |
| | | break; |
| | | case 0: |
| | | resultCh.set(resultCh.get() + "、" + p.getInspectionItem() + (Objects.equals(p.getInspectionItemSubclass(), "") ? "" : " " + p.getInspectionItemSubclass())); |
| | | resultEn.set(resultEn.get() + "、" + p.getInspectionItemEn() + ((Objects.equals(p.getInspectionItemSubclassEn(), "") || Objects.equals(p.getInspectionItemSubclassEn(), null)) ? "" : " " + p.getInspectionItemSubclassEn())); |
| | | String current = resultCh.get(); |
| | | // 使用 Set 来保持唯一项 |
| | | Set<String> uniqueItems = new HashSet<>(); |
| | | if (!current.isEmpty()) { |
| | | // 分割当前字符串并加入到 Set 中 |
| | | String[] items = current.split("、"); |
| | | for (String item : items) { |
| | | if (!item.isEmpty()) { |
| | | uniqueItems.add(item); |
| | | } |
| | | } |
| | | } |
| | | // 处理新数据 |
| | | String newItem = p.getInspectionItem() + |
| | | (Objects.equals(p.getInspectionItemSubclass(), "") ? "" : " " + p.getInspectionItemSubclass()); |
| | | uniqueItems.add(newItem); |
| | | |
| | | // 连接唯一项并更新 AtomicReference |
| | | String result = String.join("、", uniqueItems); |
| | | resultCh.set(result); |
| | | //resultCh.set(resultCh.get() + "、" + p.getInspectionItem() + (Objects.equals(p.getInspectionItemSubclass(), "") ? "" : " " + p.getInspectionItemSubclass())); |
| | | |
| | | String current1 = resultEn.get(); |
| | | // 使用 Set 来保持唯一项 |
| | | Set<String> uniqueItems1 = new HashSet<>(); |
| | | if (!current1.isEmpty()) { |
| | | // 分割当前字符串并加入到 Set 中 |
| | | String[] items = current1.split("、"); |
| | | for (String item : items) { |
| | | if (!item.isEmpty()) { |
| | | uniqueItems1.add(item); |
| | | } |
| | | } |
| | | } |
| | | // 处理新数据 |
| | | String newItem1 = p.getInspectionItemEn() + |
| | | ((Objects.equals(p.getInspectionItemSubclassEn(), "") || Objects.equals(p.getInspectionItemSubclassEn(), null)) ? "" : " " + p.getInspectionItemSubclassEn()); |
| | | uniqueItems1.add(newItem1); |
| | | // 连接唯一项并更新 AtomicReference |
| | | String result1 = String.join("、", uniqueItems1); |
| | | resultEn.set(result1); |
| | | //resultEn.set(resultEn.get() + "、" + p.getInspectionItemEn() + ((Objects.equals(p.getInspectionItemSubclassEn(), "") || Objects.equals(p.getInspectionItemSubclassEn(), null)) ? "" : " " + p.getInspectionItemSubclassEn())); |
| | | textRenderData.setText("×"); |
| | | break; |
| | | default: |
| | |
| | | textRenderData.setText(v.get("v") == null ? "" : v.get("v") + ""); |
| | | } |
| | | } else { |
| | | textRenderData.setText(v.get("v") == null ? "" : v.get("v") + ""); |
| | | textRenderData.setText(v.get("v") == null ? "" : v.get("v") + "∑" + jo1.get("mc")); |
| | | } |
| | | if (jo1.get("mc") != null) { |
| | | textRenderData.setText(textRenderData.getText() + "∑" + jo1.get("mc")); |
| | |
| | | if (i % number == 0) { |
| | | List<RowRenderData> rows = new ArrayList<>(); |
| | | //表格的行数 × √ ✖ ✔ |
| | | long count1 = size-(index-1)*number < number ? size-(index-1)*number + 3 : number + 3; |
| | | for (int j = 0; j <count1 ; j++) { |
| | | long count1 = size - (index - 1) * number < number ? size - (index - 1) * number + 3 : number + 3; |
| | | for (int j = 0; j < count1; j++) { |
| | | RowRenderData rowRenderData = new RowRenderData(); |
| | | RowStyle rowStyle = new RowStyle(); |
| | | rowStyle.setHeight(40); |
| | |
| | | cellRenderData.setParagraphs(paragraphRenderDataList); |
| | | cells.add(cellRenderData); |
| | | } |
| | | } |
| | | else if (j == 1) { |
| | | } else if (j == 1) { |
| | | //第二行 |
| | | if (k == 0) { |
| | | //第一列 |
| | |
| | | cellRenderData.setParagraphs(paragraphRenderDataList); |
| | | cells.add(cellRenderData); |
| | | } |
| | | } |
| | | else if (j == count1-1) { |
| | | } else if (j == count1 - 1) { |
| | | //最后一行 |
| | | if (k == 0 || k == 1) { |
| | | //前两列 |
| | |
| | | cellRenderData.setParagraphs(paragraphRenderDataList); |
| | | cells.add(cellRenderData); |
| | | } |
| | | } |
| | | else { |
| | | } else { |
| | | if (k == 0) { |
| | | //第一列 |
| | | textRenderData.setText((j - 1) + ""); |
| | |
| | | if (i % 16 == 0) { |
| | | //样品数量超过16需要新增表格 |
| | | List<RowRenderData> rows = new ArrayList<>(); |
| | | int count2 = sampleList.size()-(index41-1)*16 < 16 ? (int) (sampleList.size() - (index41 - 1) * 16 + 1) : 17; |
| | | int count2 = sampleList.size() - (index41 - 1) * 16 < 16 ? (int) (sampleList.size() - (index41 - 1) * 16 + 1) : 17; |
| | | //表格的行数 |
| | | for (int j = 0; j < count2; j++) { |
| | | RowRenderData rowRenderData = new RowRenderData(); |
| | |
| | | cellRenderData.setParagraphs(paragraphRenderDataList); |
| | | cells.add(cellRenderData); |
| | | } |
| | | } |
| | | else { |
| | | } else { |
| | | if (k == 0) { |
| | | //第一列 |
| | | textRenderData.setText(sampleList.get(0).getModel() + "∑44"); |
| | |
| | | } catch (Exception e) { |
| | | throw new ErrorException("找不到检验人的签名"); |
| | | } |
| | | if (ObjectUtils.isEmpty(signatureUrl) || signatureUrl.equals("")) { |
| | | if (ObjectUtils.isEmpty(signatureUrl) || signatureUrl.equals("")) { |
| | | throw new ErrorException("找不到检验人的签名"); |
| | | } |
| | | //Custom custom = customMapper.selectById(user.get("company")); |
| | |
| | | } catch (IOException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | else { |
| | | } else { |
| | | //复核不通过将把复核的负责人去掉 |
| | | Integer id = insSampleUserMapper.selectOne(Wrappers.<InsSampleUser>lambdaQuery().eq(InsSampleUser::getInsSampleId, orderId).orderByDesc(InsSampleUser::getId).last("limit 1")).getId(); |
| | | insSampleUserMapper.deleteById(id); |
| | |
| | | .in(InsProduct::getInsSampleId, ids) |
| | | .eq(InsProduct::getSonLaboratory, laboratory) |
| | | .eq(InsProduct::getState, 1) |
| | | .isNull(InsProduct::getInsResult) |
| | | .and(wrapper -> wrapper |
| | | .isNull(InsProduct::getInsResult) |
| | | .or() |
| | | .eq(InsProduct::getInsResult, 2) |
| | | ) |
| | | .isNull(InsProduct::getInsFiberId) |
| | | .isNull(InsProduct::getInsFibersId)); |
| | | insProducts.addAll(insProductMapper.selectFiberInsProduct(ids, laboratory)); |
| | |
| | | insProductMapper.updateById(product); |
| | | } |
| | | //如果是热循环或者是温升试验 |
| | | else if (product.getInspectionItem().equals("热循环") || product.getInspectionItem().equals("温升试验")){ |
| | | else if (product.getInspectionItem().equals("热循环") || product.getInspectionItem().equals("温升试验")) { |
| | | //查询这些项目下的其他检验项目是否全部检验 |
| | | List<InsProduct> insProductList = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery() |
| | | .eq(InsProduct::getInsSampleId, product.getInsSampleId()) |
| | |
| | | product.setInsResult(1); |
| | | } |
| | | insProductMapper.updateById(product); |
| | | } |
| | | else { |
| | | } else { |
| | | count++; |
| | | str += "<br/>" + count + ":" + product.getInspectionItem() + " " + product.getInspectionItemSubclass() + "<br/>"; |
| | | } |
| | |
| | | InsSampleUser insSampleUser = new InsSampleUser(); |
| | | insSampleUser.setUserId(verifyUser); |
| | | insSampleUser.setInsSampleId(orderId); |
| | | insSampleUser.setState(0); |
| | | insSampleUser.setState(1); |
| | | insSampleUser.setSonLaboratory(laboratory); |
| | | insSampleUserMapper.insert(insSampleUser); |
| | | /*校验一下result表*/ |
| | | CompletableFuture.supplyAsync(() -> { |
| | | List<Integer> ips = insProducts.stream().map(InsProduct::getId).distinct().collect(Collectors.toList()); |
| | | for (Integer ip : ips) { |
| | | List<InsProductResult> insProductResults = insProductResultMapper.selectList(Wrappers.<InsProductResult>lambdaQuery().eq(InsProductResult::getInsProductId, ip).orderByDesc(InsProductResult::getId)); |
| | | List<InsProductResult> insProductResults = insProductResultMapper.selectList(Wrappers.<InsProductResult>lambdaQuery() |
| | | .eq(InsProductResult::getInsProductId, ip)); |
| | | if (insProductResults.size() > 1) { |
| | | insProductResultMapper.deleteById(insProductResults.get(0)); |
| | | for (int i = 1; i < insProductResults.size(); i++) { |
| | | insProductResultMapper.deleteById(insProductResults.get(i)); |
| | | } |
| | | } |
| | | } |
| | | return null; |