| | |
| | | } |
| | | } |
| | | |
| | | //查询检验单信息 |
| | | // 添加工时 |
| | | 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); |
| | | }); |
| | | } |
| | | |
| | | } |
| | | }); |
| | |
| | | // 查询ifs信息获取获取前10个供应商一样的, 检验项一样信息 |
| | | threadPoolTaskExecutor.execute(() -> { |
| | | // 添加分析数据 |
| | | addAnalysis(productList, ifsInventoryQuantity, order, userName); |
| | | addAnalysis(productList, ifsInventoryQuantity, order, sendUserAccount); |
| | | }); |
| | | |
| | | |
| | |
| | | * @param ifsInventoryQuantity |
| | | * @param order |
| | | */ |
| | | private void addAnalysis(List<InsProduct> productList, IfsInventoryQuantity ifsInventoryQuantity, InsOrder order, String userName) { |
| | | private void addAnalysis(List<InsProduct> productList, IfsInventoryQuantity ifsInventoryQuantity, InsOrder order, String sendUserAccount) { |
| | | for (InsProduct insProduct : productList) { |
| | | // 判断是否是数值类型 |
| | | if (insProduct.getInspectionValueType().equals("1") && insProduct.getInsResult().equals(1)) { |
| | | List<InsProductDeviationWarningDetail> insProductAnalysisDtoList = insProductMapper.selectAnalysis(insProduct, ifsInventoryQuantity.getSupplierName()); |
| | | |
| | | if (insProductAnalysisDtoList.size() < 5) { |
| | | if (insProductAnalysisDtoList.size() < 10) { |
| | | continue; |
| | | } |
| | | |
| | |
| | | message += "\n检验项: " + insProduct.getInspectionItem() + insProduct.getInspectionItemSubclass(); |
| | | message += "\n偏差超过了 10%"; |
| | | // 发送给提交人 |
| | | WxCpUtils.inform(userName, message, null); |
| | | |
| | | // todo: 发送给检测中心主任(固定死) |
| | | WxCpUtils.inform("ZT-004704", message, null); |
| | | // WxCpUtils.inform(sendUserAccount, message, null); |
| | | // |
| | | // // todo: 发送给检测中心主任(固定死) |
| | | // WxCpUtils.inform("ZT-004704", message, null); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | log.error("偏差预警企业微信通知报错"); |
| | |
| | | insReportMapper.delete(Wrappers.<InsReport>lambdaQuery() |
| | | .eq(InsReport::getInsOrderId, insOrder.getId())); |
| | | insReportMapper.insert(insReport); |
| | | |
| | | inputStream.close(); |
| | | } catch (IOException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | |
| | | insReportMapper.delete(Wrappers.<InsReport>lambdaQuery() |
| | | .eq(InsReport::getInsOrderId, insOrder.getId())); |
| | | insReportMapper.insert(insReport); |
| | | inputStream.close(); |
| | | } catch (IOException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | |
| | | |
| | | // 保存到附件里面 |
| | | uploadFile(insOrderId, multipartFile); |
| | | try { |
| | | inputStream.close(); |
| | | } catch (IOException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | |
| | | } |
| | | |