| | |
| | | @Resource |
| | | FuSheUtils fuSheUtils; |
| | | |
| | | @Resource |
| | | DianLuUtils dianLuUtils; |
| | | |
| | | @Override |
| | | public Map<String, Object> selectInsOrderPlanList(Page page, InsOrderPlanDTO insOrderPlanDTO) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | |
| | | if (BeanUtil.isEmpty(order.getInsTime())) { |
| | | insOrder.setInsTime(LocalDateTime.now());//订单的检验时间 |
| | | insOrderMapper.updateById(insOrder); |
| | | } |
| | | InsOrderState orderState = insOrderStateMapper.selectOne(Wrappers.<InsOrderState>lambdaQuery() |
| | | .eq(InsOrderState::getInsOrderId, insSample.getInsOrderId()) |
| | | .eq(InsOrderState::getInsSampleId, sampleId) |
| | | .eq(InsOrderState::getLaboratory, laboratory)); |
| | | if (ObjectUtils.isEmpty(orderState.getInsTime())) { |
| | | //更新检验任务表的检验时间 |
| | | insOrderStateMapper.update(null, Wrappers.<InsOrderState>lambdaUpdate() |
| | | .eq(InsOrderState::getInsOrderId, insSample.getInsOrderId()) |
| | |
| | | sampleId = insOrderFile.getInsSampleId(); |
| | | insOrderFile.setInsSampleId(null); |
| | | } |
| | | IPage<InsOrderFile> insOrderFileIPage = insOrderFileMapper.getFileList(page, QueryWrappers.queryWrappers(insOrderFile), insOrderId, sonLaboratory,sampleId); |
| | | IPage<InsOrderFile> insOrderFileIPage = insOrderFileMapper.getFileList(page, QueryWrappers.queryWrappers(insOrderFile), insOrderId, sonLaboratory, sampleId); |
| | | map.put("body", insOrderFileIPage); |
| | | return map; |
| | | } |
| | | |
| | | @Override |
| | | public int uploadFile(Integer orderId, MultipartFile file, String sonLaboratory, Integer sampleId) { |
| | | public Object uploadFile(Integer orderId, MultipartFile file, String sonLaboratory, Integer sampleId) { |
| | | String urlString; |
| | | String pathName; |
| | | String path; |
| | |
| | | if (!realpath.exists()) { |
| | | realpath.mkdirs(); |
| | | } |
| | | pathName = UUID.randomUUID() + "_"+file.getOriginalFilename().replace("#", "&"); |
| | | pathName = UUID.randomUUID() + "_" + file.getOriginalFilename().replace("#", "&"); |
| | | urlString = realpath + "/" + pathName; |
| | | file.transferTo(new File(urlString)); |
| | | insOrderFile.setFileUrl(pathName); |
| | | insOrderFileMapper.insert(insOrderFile); |
| | | //如果是辐射试验(近场/远程上传的csv文件) |
| | | String[] split = filename.split("\\."); |
| | | if (ObjectUtils.isNotEmpty(sonLaboratory) && (sonLaboratory.equals("近场") || sonLaboratory.equals("远场")) && |
| | | split[split.length - 1].equals("csv")) { |
| | | //判断是哪种csv文件,是否有—— |
| | | if (sonLaboratory.equals("近场")) { |
| | | fuSheUtils.getFuSheWord1(sonLaboratory, insOrderFile); |
| | | } else { |
| | | fuSheUtils.getFuSheWord2(sonLaboratory, insOrderFile); |
| | | } |
| | | if (ObjectUtils.isNotEmpty(sonLaboratory) && sonLaboratory.equals("近场") && split[split.length - 1].equals("csv")) { |
| | | fuSheUtils.getFuSheWord1(sonLaboratory, insOrderFile); |
| | | } else if (ObjectUtils.isNotEmpty(sonLaboratory) && sonLaboratory.equals("远场") && split[split.length - 1].equals("xlsx")) { |
| | | fuSheUtils.getFuSheWord2(sonLaboratory, insOrderFile); |
| | | }else if (ObjectUtils.isNotEmpty(sonLaboratory) && sonLaboratory.equals("电路试验") && split[split.length - 1].equals("xlsx") && filename.contains("交调")) { |
| | | dianLuUtils.readDianLuFile1(sampleId,insOrderFile); |
| | | } |
| | | } catch (Exception e) { |
| | | System.err.println("附件上传错误"); |
| | |
| | | |
| | | //扫码报检 |
| | | @Override |
| | | public int scanInsOrderState(String sonLaboratory, String sampleCode, String trees) { |
| | | public int scanInsOrderState(String sonLaboratory, String sampleCode, String trees, String entrustCode) { |
| | | /*样品入库*/ |
| | | warehouseService.inWarehouse(trees, sampleCode); |
| | | warehouseService.inWarehouse(trees, sampleCode, entrustCode); |
| | | /*新增检验任务*/ |
| | | //先判断该样品是否有这个站点的项目 |
| | | InsSample insSample = insSampleMapper.selectOne(Wrappers.<InsSample>lambdaQuery().eq(InsSample::getSampleCode, sampleCode)); |
| | | List<InsOrder> insOrders = insOrderMapper.selectList(Wrappers.<InsOrder>lambdaQuery().eq(InsOrder::getEntrustCode, entrustCode)); |
| | | InsSample insSample = insSampleMapper.selectOne(Wrappers.<InsSample>lambdaQuery() |
| | | .eq(InsSample::getSampleCode, sampleCode) |
| | | .eq(InsSample::getInsOrderId, insOrders.get(0).getId())); |
| | | List<String> collect = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery() |
| | | .eq(InsProduct::getState, 1) |
| | | .eq(InsProduct::getInsSampleId, insSample.getId())).stream().map(InsProduct::getSonLaboratory).collect(Collectors.toList()); |
| | |
| | | |
| | | //扫码出库 |
| | | @Override |
| | | public int outInsOrderState(String sonLaboratory, String sampleCode) { |
| | | public int outInsOrderState(String sonLaboratory, String sampleCode, String entrustCode) { |
| | | //判断该样品的检验任务是否已经结束(继续试验或者是结束试验) |
| | | //先判断该样品是否有这个站点的项目 |
| | | InsSample insSample = insSampleMapper.selectOne(Wrappers.<InsSample>lambdaQuery().eq(InsSample::getSampleCode, sampleCode)); |
| | | List<InsOrder> insOrders = insOrderMapper.selectList(Wrappers.<InsOrder>lambdaQuery().eq(InsOrder::getEntrustCode, entrustCode)); |
| | | InsSample insSample = insSampleMapper.selectOne(Wrappers.<InsSample>lambdaQuery() |
| | | .eq(InsSample::getSampleCode, sampleCode) |
| | | .eq(InsSample::getInsOrderId, insOrders.get(0).getId())); |
| | | List<String> collect = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery() |
| | | .eq(InsProduct::getState, 1) |
| | | .eq(InsProduct::getInsSampleId, insSample.getId())).stream().map(InsProduct::getSonLaboratory).collect(Collectors.toList()); |
| | |
| | | } |
| | | } |
| | | boolean a = true; |
| | | warehouseService.outWarehouse(sampleCode, a); |
| | | warehouseService.outWarehouse(sampleCode, a, entrustCode); |
| | | return 0; |
| | | } |
| | | |
| | |
| | | //结论 |
| | | int ressult = 1; |
| | | String valueStr = insProductResult2.getValue(); |
| | | String regex ="[\u4e00-\u9fa5]"; |
| | | String regex = "[\u4e00-\u9fa5]"; |
| | | if (!insProduct.getAsk().contains(",")) { |
| | | if (insProduct.getAsk().equals("/") || Pattern.compile(regex).matcher(insProduct.getAsk()).find()) { |
| | | ressult = 3; //不判定 |
| | |
| | | if (insOrder.getFormType().equals("原理样机")) { |
| | | //出库 |
| | | try { |
| | | outInsOrderState(laboratory, insSample.getSampleCode()); |
| | | List<InsSample> insSamples = insSampleMapper.selectList(Wrappers.<InsSample>lambdaQuery().eq(InsSample::getInsOrderId, insSample.getInsOrderId())); |
| | | for (InsSample sample : insSamples) { |
| | | outInsOrderState(laboratory, sample.getSampleCode(), insOrder.getEntrustCode()); |
| | | } |
| | | } catch (Exception e) { |
| | | |
| | | } |
| | |
| | | info.setCreateUser(insProductMapper.selectUserById(userId).get("name")); |
| | | info.setMessageType("2"); |
| | | info.setTheme("复核通知"); |
| | | info.setContent("您有一条检验任务待复核消息"); |
| | | info.setContent("您有一条检验任务待复核消息,订单号是:" + insOrder.getEntrustCode() + ",样品名称为:" + insSample.getSample()); |
| | | info.setSenderId(userId); |
| | | info.setConsigneeId(submitPlanDto.getVerifyUser()); |
| | | info.setViewStatus(false); |
| | |
| | | map.put("msgtype", "text");//消息类型 text:文本 |
| | | map.put("agentid", 1000517);//应用id |
| | | HashMap<String, Object> hashMap = new HashMap<>(); |
| | | hashMap.put("content", "您有一条检验任务待复核消息,订单号是:" + insOrder.getEntrustCode() + ",请前往LIMS系统查看。<a href=\"https://ztwxlims.ztt.cn:7443/enter\">中天通信LIMS系统 </a>"); |
| | | hashMap.put("content", "您有一条检验任务待复核消息,订单号是:" + insOrder.getEntrustCode() + ",样品名称为:" + insSample.getSample() + |
| | | ",请前往LIMS系统查看。请点击<a href=\"https://ztwxlims.ztt.cn:7443/enter\">中天通信LIMS系统 </a>"); |
| | | map.put("text", hashMap);//消息内容 |
| | | map.put("safe", 0);//是否保密消息.0否 |
| | | map.put("enable_id_trans", 0);//是否开启id转译.0否 |
| | | map.put("enable_duplicate_check", 0);//是否开启重复消息检查.0否 |
| | | //qywxApi.send(map); |
| | | qywxApi.send(map); |
| | | //复核人--检验单相关负责人 |
| | | InsSampleUser insSampleUser = new InsSampleUser(); |
| | | insSampleUser.setUserId(submitPlanDto.getVerifyUser()); |
| | |
| | | throw new ErrorException("电路试验的站点报告生成有误,请联系开发人员调整!"); |
| | | } |
| | | } |
| | | /*// 删除数采采集次数 |
| | | String key = "frequency" + ":" + submitPlanDto.getEntrustCode() + ":*"; |
| | | RedisUtil.delsLike(key);*/ |
| | | |
| | | /*生成产量工时*/ |
| | | //校验如果这个人这个检测项目已经添加过了则不需要再新增 |
| | |
| | | } |
| | | for (AuxiliaryOutputWorkingHours auxiliaryOutputWorkingHours : submitPlanDto.getAuxiliaryOutputWorkingHoursList()) { |
| | | InsProduct insProduct = insProductMapper.selectById(auxiliaryOutputWorkingHours.getInsProductId()); |
| | | if (isWithinRange) { |
| | | //在时间内就是正常上班 |
| | | auxiliaryOutputWorkingHours.setOrderNo(insOrder.getEntrustCode());//非加班委托单号 |
| | | auxiliaryOutputWorkingHours.setWorkTime(auxiliaryOutputWorkingHours.getOutputWorkTime());//非加班工时 |
| | | auxiliaryOutputWorkingHours.setAmount(1);//非加班数量 |
| | | } else { |
| | | //加班 |
| | | auxiliaryOutputWorkingHours.setOvertimeOrderNo(insOrder.getEntrustCode());//加班委托单号 |
| | | auxiliaryOutputWorkingHours.setOvertimeWorkTime(auxiliaryOutputWorkingHours.getOutputWorkTime());//加班工时 |
| | | auxiliaryOutputWorkingHours.setOvertimeAmount(1);//加班数量 |
| | | } |
| | | auxiliaryOutputWorkingHours.setManHourGroup(insProduct.getManHourGroup());//工时分组 |
| | | DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); |
| | | DateTimeFormatter formatters = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); |
| | | auxiliaryOutputWorkingHours.setDateTime(LocalDateTime.now().toLocalDate().atStartOfDay().format(formatters));//日期 |
| | | LocalDateTime localDateTime = LocalDateTime.now(); |
| | | DateTime parse = DateUtil.parse(localDateTime.format(formatter)); |
| | | auxiliaryOutputWorkingHours.setWeekDay(getWeek(localDateTime.format(formatters)));//星期 |
| | | auxiliaryOutputWorkingHours.setWeek(String.valueOf(DateUtil.weekOfYear(DateUtil.offsetDay(parse, 1))));//周次 |
| | | auxiliaryOutputWorkingHoursMapper.insert(auxiliaryOutputWorkingHours); |
| | | if (isWithinRange) { |
| | | //在时间内就是正常上班 |
| | | auxiliaryOutputWorkingHours.setOrderNo(insOrder.getEntrustCode());//非加班委托单号 |
| | | auxiliaryOutputWorkingHours.setWorkTime(auxiliaryOutputWorkingHours.getOutputWorkTime());//非加班工时 |
| | | auxiliaryOutputWorkingHours.setAmount(1);//非加班数量 |
| | | } else { |
| | | //加班 |
| | | auxiliaryOutputWorkingHours.setOvertimeOrderNo(insOrder.getEntrustCode());//加班委托单号 |
| | | auxiliaryOutputWorkingHours.setOvertimeWorkTime(auxiliaryOutputWorkingHours.getOutputWorkTime());//加班工时 |
| | | auxiliaryOutputWorkingHours.setOvertimeAmount(1);//加班数量 |
| | | } |
| | | auxiliaryOutputWorkingHours.setManHourGroup(insProduct.getManHourGroup());//工时分组 |
| | | DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); |
| | | DateTimeFormatter formatters = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); |
| | | auxiliaryOutputWorkingHours.setDateTime(LocalDateTime.now().toLocalDate().atStartOfDay().format(formatters));//日期 |
| | | LocalDateTime localDateTime = LocalDateTime.now(); |
| | | DateTime parse = DateUtil.parse(localDateTime.format(formatter)); |
| | | auxiliaryOutputWorkingHours.setWeekDay(getWeek(localDateTime.format(formatters)));//星期 |
| | | auxiliaryOutputWorkingHours.setWeek(String.valueOf(DateUtil.weekOfYear(DateUtil.offsetDay(parse, 1))));//周次 |
| | | auxiliaryOutputWorkingHoursMapper.insert(auxiliaryOutputWorkingHours); |
| | | } |
| | | } |
| | | } |