| | |
| | | * @param device |
| | | * @return |
| | | */ |
| | | public static Map<String, Object> dataAcquisitionEntrance(List<DataConfig> dataConfig, Device device, String entrustCode, String sampleCode, String ip, String cableTag, String dbUserName, String dbPassword,String dbTable) { |
| | | public static Map<String, Object> dataAcquisitionEntrance(List<DataConfig> dataConfig, Device device, String entrustCode,String lotBatchNo, String sampleCode, String ip, String cableTag, String dbUserName, String dbPassword,String dbTable) { |
| | | // 判断是否是影像测量仪 |
| | | if (device.getManagementNumber().equals("JCZX-ZB-OP07001")) { |
| | | if (device.getFileType().equals(".xlsx")) { |
| | |
| | | "&dbFileName=" + dbFileName + |
| | | "&dbUserName=" + dbUserName + |
| | | "&dbPassword=" + dbPassword + |
| | | "&lotBatchNo=" + lotBatchNo + |
| | | "&cableTag=" + cableTag + |
| | | "&dbTable=" + dbTable; |
| | | System.out.println("请求的 URL: " + http); |
| | | String result = null; |
| | |
| | | case ".docx": |
| | | map = analysisString(data, userMap, device, entrustCode, sampleCode); |
| | | break; |
| | | case ".xls": |
| | | case ".xlsx": |
| | | map = analysisList(data, userMap, device, entrustCode, sampleCode); |
| | | break; |
| | | case ".xls": |
| | | map = analysisTxt(data, userMap, device, entrustCode, sampleCode); |
| | | case ".pngInExcel": |
| | | map = analysisPngInExcel(data, userMap, device, entrustCode, sampleCode); |
| | | break; |
| | | case ".txt": |
| | | map = analysisTxt(data, userMap, device, entrustCode, sampleCode); |
| | |
| | | } |
| | | |
| | | /** |
| | | * 解析excel中识别到的图片内容 |
| | | * |
| | | * @param data 采集到的文件字符串 |
| | | * @param dataConfig 用户配置好的x,y轴定位数据与参照物 |
| | | * @return |
| | | */ |
| | | private static Map<String, Object> analysisPngInExcel(String data, Map<String, List<DataConfig>> dataConfig, |
| | | Device device, String entrustCode, String sampleCode) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | //处理data |
| | | Map<String,List<Object>> dataMap = new HashMap<>(); |
| | | String[] rows = data.split("\n"); |
| | | String[] headRow = rows[0].split(" ");//获取表头列表 |
| | | for (int i = 0; i < headRow.length; i++) { |
| | | //数据最多五条 |
| | | List<Object> vals = new ArrayList<>(); |
| | | for (int j = 1; j <= 5; j++) { |
| | | String[] cols = rows[j].split(" "); |
| | | vals.add(cols[i]); |
| | | } |
| | | dataMap.put(headRow[i],vals); |
| | | } |
| | | dataConfig.forEach((k, v) -> { |
| | | List<Object> list = new ArrayList<>(); |
| | | v.stream().sorted(Comparator.comparing(DataConfig::getX)).forEach(config->{ |
| | | for (Map.Entry<String, List<Object>> entry : dataMap.entrySet()) { |
| | | if(entry.getKey().contains(config.getReferx())){ |
| | | list.addAll(entry.getValue()); |
| | | } |
| | | } |
| | | }); |
| | | // 进行公式计算 |
| | | Object resultValue = calculationFormula(list, v.get(0), k, device); |
| | | map.put(k, resultValue); |
| | | }); |
| | | return map; |
| | | } |
| | | |
| | | /** |
| | | * @param data 采集到的文件字符串 |
| | | * @param dataConfig 用户配置好的x,y轴定位数据与参照物 |
| | | * @return |