| | |
| | | @Resource |
| | | private InsOrderFileMapper insOrderFileMapper; |
| | | |
| | | @Resource |
| | | FuSheUtils fuSheUtils; |
| | | |
| | | @Override |
| | | public Map<String, Object> selectInsOrderPlanList(Page page, InsOrderPlanDTO insOrderPlanDTO) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | |
| | | map.put("head", PrintChina.printChina(InsOrderFile.class)); |
| | | Integer insOrderId = insOrderFile.getInsOrderId(); |
| | | insOrderFile.setInsOrderId(null); |
| | | IPage<InsOrderFile> insOrderFileIPage = insOrderFileMapper.getFileList(page, QueryWrappers.queryWrappers(insOrderFile), insOrderId); |
| | | String sonLaboratory = null; |
| | | if (ObjectUtils.isNotEmpty(insOrderFile.getSonLaboratory())) { |
| | | sonLaboratory = insOrderFile.getSonLaboratory(); |
| | | insOrderFile.setSonLaboratory(null); |
| | | } |
| | | IPage<InsOrderFile> insOrderFileIPage = insOrderFileMapper.getFileList(page, QueryWrappers.queryWrappers(insOrderFile), insOrderId, sonLaboratory); |
| | | map.put("body", insOrderFileIPage); |
| | | return map; |
| | | } |
| | | |
| | | @Override |
| | | public int uploadFile(Integer orderId, MultipartFile file) { |
| | | public int uploadFile(Integer orderId, MultipartFile file, String sonLaboratory) { |
| | | String urlString; |
| | | String pathName; |
| | | String path; |
| | |
| | | if (!realpath.exists()) { |
| | | realpath.mkdirs(); |
| | | } |
| | | pathName = UUID.randomUUID() + "_" + file.getOriginalFilename(); |
| | | pathName = file.getOriginalFilename(); |
| | | urlString = realpath + "/" + pathName; |
| | | file.transferTo(new File(urlString)); |
| | | insOrderFile.setFileUrl(pathName); |
| | | return insOrderFileMapper.insert(insOrderFile); |
| | | if (ObjectUtils.isNotEmpty(sonLaboratory)) { |
| | | insOrderFile.setSonLaboratory(sonLaboratory); |
| | | //删除重复的数据 |
| | | insOrderFileMapper.delete(Wrappers.<InsOrderFile>lambdaQuery() |
| | | .eq(InsOrderFile::getInsOrderId, orderId) |
| | | .eq(InsOrderFile::getType, insOrderFile.getType()) |
| | | .eq(InsOrderFile::getFileName, insOrderFile.getFileName()) |
| | | .eq(InsOrderFile::getSonLaboratory, insOrderFile.getSonLaboratory()) |
| | | .eq(InsOrderFile::getFileUrl, insOrderFile.getFileUrl())); |
| | | } else { |
| | | //删除重复的数据 |
| | | insOrderFileMapper.delete(Wrappers.<InsOrderFile>lambdaQuery() |
| | | .eq(InsOrderFile::getInsOrderId, orderId) |
| | | .eq(InsOrderFile::getType, insOrderFile.getType()) |
| | | .eq(InsOrderFile::getFileName, insOrderFile.getFileName()) |
| | | .isNull(InsOrderFile::getSonLaboratory) |
| | | .eq(InsOrderFile::getFileUrl, insOrderFile.getFileUrl())); |
| | | } |
| | | insOrderFileMapper.insert(insOrderFile); |
| | | //如果是辐射试验(近场/远程上传的csv文件) |
| | | String[] split = filename.split("\\."); |
| | | if (ObjectUtils.isNotEmpty(sonLaboratory) && (sonLaboratory.equals("近场") || sonLaboratory.equals("远场")) && |
| | | split[split.length - 1].equals("csv")) { |
| | | fuSheUtils.getFuSheWord(sonLaboratory, insOrderFile); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | System.err.println("附件上传错误"); |
| | | return 0; |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | @Override |
| | |
| | | throw new ErrorException("该样品的检验任务还没有结束试验或继续试验,暂时无法出库!"); |
| | | } |
| | | } |
| | | warehouseService.outWarehouse(sampleCode); |
| | | boolean a = true; |
| | | warehouseService.outWarehouse(sampleCode, a); |
| | | return 0; |
| | | } |
| | | |
| | |
| | | if (insOrder.getFormType().equals("原理样机")) { |
| | | for (InsSample sample : samples) { |
| | | //出库 |
| | | try{ |
| | | outInsOrderState(laboratory,sample.getSampleCode()); |
| | | }catch (Exception e){ |
| | | try { |
| | | outInsOrderState(laboratory, sample.getSampleCode()); |
| | | } catch (Exception e) { |
| | | |
| | | } |
| | | } |
| | |
| | | insSampleUser.setState(1); |
| | | insSampleUser.setSonLaboratory(submitPlanDto.getLaboratory()); |
| | | 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::getNum, orderState.getNum()) |
| | | .eq(InsProductResult::getInsProductId, ip)); |
| | | if (insProductResults.size() > 1) { |
| | | for (int i = 1; i < insProductResults.size(); i++) { |
| | | insProductResultMapper.deleteById(insProductResults.get(i)); |
| | | } |
| | | } |
| | | } |
| | | return null; |
| | | });*/ |
| | | /*生成电路试验的站点报告并上传到附件中*/ |
| | | if (submitPlanDto.getLaboratory().equals("电路试验")) { |
| | | wordUtils.generateWord(submitPlanDto.getNote(), submitPlanDto.getTerm(), orderState); |
| | | wordUtils.generateWord(submitPlanDto.getTerm(), orderState); |
| | | // try { |
| | | // wordUtils.generateWord(submitPlanDto.getNote(), submitPlanDto.getTerm(), orderState); |
| | | // wordUtils.generateWord(submitPlanDto.getTerm(), orderState); |
| | | // } catch (Exception e) { |
| | | // throw new ErrorException("电路试验的站点报告生成有误,请联系开发人员调整!"); |
| | | // } |