| | |
| | | List<InsProduct> insProducts = new ArrayList<>(); |
| | | switch (dto.getType()) { |
| | | case 0: |
| | | insProducts = insSampleMapper.getInsProduct1(dto.getId(), dto.getLaboratory(), dto.getCableTag(), dto.getRepetitionTag(), null); |
| | | //样品 |
| | | break; |
| | | case 4: |
| | | //电缆配置 |
| | | insProducts = insSampleMapper.getInsProduct1(dto.getId(), dto.getLaboratory(), dto.getCableTag(), dto.getRepetitionTag(), null); |
| | | //委托 |
| | | insProducts = insSampleMapper.getInsProduct1(dto.getId(), dto.getLaboratory(), dto.getCableTag(), dto.getRepetitionTag()); |
| | | break; |
| | | case 5: |
| | | //原材料下单 |
| | | insProducts = insSampleMapper.getInsProduct6(dto.getId(), dto.getLaboratory(), dto.getRawMaterialTag(), null); |
| | | insProducts = insSampleMapper.getInsProduct6(dto.getId(), dto.getLaboratory(), dto.getRawMaterialTag()); |
| | | break; |
| | | } |
| | | if (BeanUtil.isEmpty(insProducts)) { |
| | |
| | | } |
| | | |
| | | /** |
| | | * 获取不合格数据 |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<InsProduct> getInsProductUnqualified(InsOrderPlanProductDto dto) { |
| | | List<InsProduct> insProducts = new ArrayList<>(); |
| | | switch (dto.getType()) { |
| | | case 0: |
| | | //样品 |
| | | insProducts = insSampleMapper.getInsProduct1(dto.getId(), dto.getLaboratory(), dto.getCableTag(), dto.getRepetitionTag(), "1"); |
| | | break; |
| | | case 4: |
| | | //电缆配置 |
| | | insProducts = insSampleMapper.getInsProduct1(dto.getId(), dto.getLaboratory(), dto.getCableTag(), dto.getRepetitionTag(), "1"); |
| | | break; |
| | | case 5: |
| | | //原材料下单 |
| | | insProducts = insSampleMapper.getInsProduct6(dto.getId(), dto.getLaboratory(), dto.getRawMaterialTag(), "1"); |
| | | break; |
| | | } |
| | | return insProducts; |
| | | } |
| | | |
| | | /** |
| | | * 新增不合格复测内容 |
| | | * @param ids |
| | | * @return |
| | | */ |
| | | @Override |
| | | public boolean addDisqualificationRetest(List<Integer> ids) { |
| | | public boolean addDisqualificationRetest(List<InsProduct> insProductsList) { |
| | | List<Integer> ids = insProductsList.stream().map(InsProduct::getId).collect(Collectors.toList()); |
| | | |
| | | // 判断之前是否添加过 |
| | | Long count = insUnqualifiedRetestProductMapper.selectCount(Wrappers.<InsUnqualifiedRetestProduct>lambdaQuery() |
| | | .in(InsUnqualifiedRetestProduct::getInsProductId, ids)); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<InsProduct> getInsProductUnqualifiedRetest(Integer id, Integer type, String laboratory, String cableTag, String rawMaterialTag, String retestTag) { |
| | | public List<InsProduct> getInsProductUnqualifiedRetest(InsOrderPlanProductDto dto) { |
| | | |
| | | List<InsProduct> insProducts = new ArrayList<>(); |
| | | switch (type) { |
| | | switch (dto.getType()) { |
| | | case 0: |
| | | //样品 |
| | | insProducts = insUnqualifiedRetestProductMapper.getInsProductUnqualifiedRetest1(id, laboratory, retestTag); |
| | | break; |
| | | case 4: |
| | | //电缆配置 |
| | | insProducts = insUnqualifiedRetestProductMapper.getInsProductUnqualifiedRetest5(id, laboratory, cableTag, retestTag); |
| | | //委托 |
| | | insProducts = insUnqualifiedRetestProductMapper.getInsProductUnqualifiedRetest1(dto.getId(), dto.getLaboratory(), dto.getCableTag(), dto.getRepetitionTag(), dto.getRetestTag()); |
| | | break; |
| | | case 5: |
| | | //原材料下单 |
| | | insProducts = insUnqualifiedRetestProductMapper.getInsProductUnqualifiedRetest6(id, laboratory, rawMaterialTag, retestTag); |
| | | insProducts = insUnqualifiedRetestProductMapper.getInsProductUnqualifiedRetest6(dto.getId(), dto.getLaboratory(), dto.getRawMaterialTag(), dto.getRetestTag()); |
| | | break; |
| | | } |
| | | if (BeanUtil.isEmpty(insProducts)) { |
| | | return null; |
| | | } |
| | | InsOrder order = insOrderMapper.selectFirstSubmit(id); |
| | | InsOrder order = insOrderMapper.selectFirstSubmit(dto.getId()); |
| | | getTemplateThing(order, Collections.unmodifiableList(insProducts)); |
| | | return insProducts; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 保存不合格复测检验内容 |
| | | * @param currentTable |
| | | * @param orderId |
| | | * @param sonLaboratory |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void saveUnqualifiedContext(Map<String, Object> insContext, Integer currentTable, Integer currentSampleId, Integer orderId, String sonLaboratory) { |
| | |
| | | BeanUtil.copyProperties(oldResults.get(0), newResult); |
| | | } |
| | | newResult.setRetestProductId(Integer.parseInt(k)); |
| | | |
| | | /*校验一下result表*/ |
| | | if (oldResults.size() > 1) { |
| | | for (int i = 1; i < oldResults.size(); i++) { |
| | | insUnqualifiedRetestResultMapper.deleteById(oldResults.get(i)); |
| | | } |
| | | } |
| | | |
| | | //检验值 |
| | | if (jo.get("insValue") != null) { |
| | | JSONArray jsonArray = JSON.parseArray(JSON.toJSONString(jo.get("insValue"))); |
| | |
| | | for (Object o : jsonArray2) { |
| | | JSONObject comValue = JSON.parseObject(JSON.toJSONString(o)); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("r", JSON.toJSONString(comValue.get("r"))); |
| | | map.put("c", JSON.toJSONString(comValue.get("c"))); |
| | | map.put("v", JSON.parseObject(JSON.toJSONString(comValue.get("v"))).get("v")); |
| | | cv.add(map); |
| | | } |
| | |
| | | insProductUserMapper.insert(new InsProductUser(null, userId, LocalDateTime.now(), insProduct.getId())); |
| | | |
| | | |
| | | InsSample insSample = insSampleMapper.selectById(insProductMapper.selectById(insProduct.getId()).getInsSampleId()); |
| | | insSample.setInsState(1); |
| | | Long l = insProductMapper.selectCount(Wrappers.<InsProduct>lambdaQuery() |
| | | .eq(InsProduct::getInsSampleId, insSample.getId())); |
| | | Long l1 = insProductMapper.selectCount(Wrappers.<InsProduct>lambdaQuery() |
| | | .eq(InsProduct::getInsSampleId, insSample.getId()) |
| | | .and(wrapper -> wrapper |
| | | .isNotNull(InsProduct::getInsResult) |
| | | .or() |
| | | .ne(InsProduct::getInsResult, 2) |
| | | )); |
| | | if (Objects.equals(l, l1)) { |
| | | insSample.setInsState(2); |
| | | } |
| | | insSampleMapper.updateById(insSample); |
| | | /*校验一下result表*/ |
| | | List<InsUnqualifiedRetestResult> insProductResults = insUnqualifiedRetestResultMapper.selectList(Wrappers.<InsUnqualifiedRetestResult>lambdaQuery() |
| | | .eq(InsUnqualifiedRetestResult::getRetestProductId, insProduct.getId())); |
| | | .eq(InsUnqualifiedRetestResult::getRetestProductId, product.getId())); |
| | | if (insProductResults.size() > 1) { |
| | | for (int i = 1; i < insProductResults.size(); i++) { |
| | | insUnqualifiedRetestResultMapper.deleteById(insProductResults.get(i)); |
| | | } |
| | | } |
| | | |
| | | } |
| | | }); |
| | | String sampleIdStr = insContext.keySet().stream().findFirst().orElse(null); |
| | | if (sampleIdStr != null) { |
| | | int count = insProductMapper.selectInsProductCountByOrderId(orderId); |
| | | if (count == 0) { |
| | | insOrderStateMapper.update(new InsOrderState(), Wrappers.<InsOrderState>lambdaUpdate() |
| | | .eq(InsOrderState::getInsOrderId, orderId) |
| | | .eq(InsOrderState::getLaboratory, sonLaboratory) |
| | | .set(InsOrderState::getInsState, 2)); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |