//package com.pjb.springbootjjwt; // //import cn.hutool.core.io.FileUtil; //import cn.hutool.poi.excel.ExcelReader; //import cn.hutool.poi.excel.ExcelUtil; //import cn.hutool.poi.excel.ExcelWriter; //import com.pjb.springbootjjwt.utils.*; //import com.teamcenter.clientx.AppXSession; //import com.teamcenter.services.loose.core._2006_03.FileManagement; //import com.teamcenter.soa.client.FileManagementUtility; //import com.teamcenter.soa.client.model.ModelObject; //import com.teamcenter.soa.client.model.ServiceData; //import com.teamcenter.soa.client.model.strong.Dataset; //import org.apache.poi.ss.usermodel.*; // //import java.io.*; //import java.text.DecimalFormat; //import java.util.*; // //public class Test { // private static AppXSession session = new AppXSession("http://DHRC:8085/tc"); // private static DecimalFormat decimalFormat = new DecimalFormat("00"); // // public static void main(String[] args) { //// String docMlMinId = "JZ-0044-2214-01"; //// String docMlPrefix = docMlMinId.substring(0, docMlMinId.lastIndexOf("-") + 1); //// String docMlMinSuffix = docMlMinId.substring(docMlMinId.lastIndexOf("-") + 1); //// System.out.println("前缀:" + docMlPrefix + ",后缀:" + docMlMinSuffix); //// if (true)return; //// //// String str = "{\"projectApprovalTime\":\"2023-05-09 10:04:03\",\"projectStar\":\"5星\",\"productLevel\":\"S+\",\"skuList\":[{\"matterCode\":\"BC063102045144\",\"mainImg\":\"new-plm.oss-cn-hangzhou.aliyuncs.com/c3a7d398721e4d859d6e0230403c00bf外观手板图.jpg\",\"spuName\":\"全新品立项-辅食的产品名称\",\"needPush\":false,\"endProduct\":\"1\",\"skuBarCode\":\"6942053811018\",\"supplierCode\":\"CO00049450\",\"tryOutUsers\":\"AL\",\"skuZxbz\":\"GB21\",\"expiryUnit\":\"9999\",\"isRelease\":false,\"expiryDate\":9999,\"tryOutSeason\":\"DD\",\"isIteration\":\"2\",\"skuContrabandByAir\":\"2\",\"skuMctn\":1,\"skuHeight\":1,\"skuCtn\":1,\"mainPic\":\"new-plm.oss-cn-hangzhou.aliyuncs.com/c3a7d398721e4d859d6e0230403c00bf外观手板图.jpg\",\"proofOrigin\":\"贵州省-黔东南苗族侗族自治州\",\"spuCode\":\"BC2305354\",\"minOrderNumber\":1,\"skuRWeight\":1.0,\"tryOutSex\":\"AL\",\"skuRP\":1.0,\"skuUnit\":\"PN\",\"brandCode\":\"001\",\"productionCycle\":2,\"supplierName\":\"广东青艺智造文化有限公司\",\"skuRowHeight\":1,\"skuLength\":1,\"normsName\":\"111\",\"categoryCode\":\"310204\",\"skuColor\":\"11\",\"skuBP\":1.0,\"skuWidth\":1,\"skuBoxLength\":1,\"goodsType\":\"CP\",\"skuBoxWidth\":1,\"skuBoxHeight\":1,\"size\":\"1\",\"goodsStatus\":\"03\",\"skuRowLength\":1,\"isIncludeFreight\":\"2\",\"skuRowWidth\":1,\"skuWeight\":1.0}],\"projectManagerName\":\"刘紫倩-L5435\",\"projectManagerId\":\"L5435\",\"categoryOperateId\":\"L4718\",\"projectName\":\"20230509001--全新品-杨驰-标品--均已填1\",\"projectId\":\"BC202305223\",\"categoryOperateName\":\"吴正邦\"}"; //// //// //// //// System.out.println(str); //// //// JSONObject obj = new JSONObject(); //// String[] dd = {"t1","t2"}; //// obj.put("mx",dd); //// JSONArray array = obj.getJSONArray("mx"); //// for (Object a : array) { //// String str1 = (String) a; //// System.out.println("mx>" + str1); //// } // // // try { //// String number = "JZ-5114-05"; //// int count = 3; //// DecimalFormat df = new DecimalFormat("00"); //// String prefix = number.substring(0, number.lastIndexOf("-") + 1); //// String num = number.substring(number.lastIndexOf("-") + 1, number.length()); //// int lastNum = Integer.valueOf(num) + count - 1; //// System.out.println(prefix + "(" + num + "-" + df.format(lastNum) + ")"); // //// File file = new File("C:\\Users\\upaad\\Desktop\\113.xlsx"); //// File outFile = new File("C:\\Users\\upaad\\Desktop\\outFile-" + file.getName()); //// File cppyFile = copyFile(file); //// byte[] pictureData = FileUtil.readBytes("C:\\Users\\upaad\\Desktop\\公司图标.png"); //// ExcelReader reader = ExcelUtil.getReader(cppyFile); //// ExcelWriter writer = ExcelUtils.getWriter(reader); //// Workbook workbook = reader.getWorkbook(); //// Sheet sheet = reader.getSheet(); //// CellReference ref = ExcelUtils.findCellByName(workbook, sheet, "测试2"); ////// System.out.println("row=" + ref.getRow() + "col=" + ref.getCol()); ////// ExcelUtils.writePic(writer, ref.getCol(),ref.getRow(), pictureData, HSSFWorkbook.PICTURE_TYPE_JPEG); //// int col =ref.getCol(); //// int row =ref.getRow(); ////// col++; //// row++; //// writer.writeCellValue(col,row, "1111"); //// writer.setDestFile(outFile); //// if (writer != null) writer.close(); //// if (reader != null) reader.close(); //// cppyFile.delete(); // //// startCadexe("",""); //// System.out.println("运行结束111"); // // File outFile = new File("C:\\Users\\upaad\\Desktop\\工艺流程图1.xlsx"); // ExcelReader reader = ExcelUtil.getReader(outFile); // ExcelWriter writer = ExcelUtils.getWriter(reader); // // // }catch (Exception e) { // e.printStackTrace(); // LogUtil.info(e.getMessage()); // } // //// if (true) { //// return; //// } // //// int len = 5; //// int onePage = 19; //// int i = 0; //// int max = onePage; //// int count = len / onePage; ////// if(count >= 0 && len % onePage != 0) count = count + 1; //// if ((len - onePage * i) / onePage == 0) max = len - onePage * i; //// System.out.println(max); //// //// if(count >= 0 && len % onePage != 0) count = count + 1; //// if ((len - onePage * i) / onePage == 0) max = len - onePage * i; // //// session.login("gengj", "123", "test"); // try { // //// int num = 0; //// do { //// long size1 = 1064; //// long size = 1064; //// if (size == size1) System.out.println("相同"); //// else break; //// num++; //// } while (num < 10); //// System.out.println("结束"); //// String bh = "JZCQ926-6023-01"; //// for (int i = 0; i < 8; i++) { //// bh = getNewCode(bh, i); //// LogUtil.info("新编号:" + bh); //// } //// setSqlLsh(bh); // // } catch (Exception e) { // e.printStackTrace(); // } // } // // private static String getNewCode(String code, int num) { // String prefix = code.substring(0, code.lastIndexOf("-") + 1); // int add = num == 0 ? 0 : 1; // Integer number = Integer.valueOf(code.substring(code.lastIndexOf("-") + 1)) + add; // String newCode = getNewCode(prefix + decimalFormat.format(number)); // return newCode; // } // // private static String getNewCode(String code) { // String newCode = code; // boolean flag = queryDatasetByCode(code); // if (flag) { // String prefix = code.substring(0, code.lastIndexOf("-") + 1); // Integer number = Integer.valueOf(code.substring(code.lastIndexOf("-") + 1)); // newCode = getNewCode(prefix + decimalFormat.format(number + 1)); // } // return newCode; // } // // private static boolean queryDatasetByCode(String code) { // if(!code.endsWith("03")) return false; // return true; // } // // private static void setSqlLsh(String code) { // String prefix = code.substring(0, code.lastIndexOf("-") + 1); // Integer number = Integer.valueOf(code.substring(code.lastIndexOf("-") + 1)); // String lshstr = decimalFormat.format(number); // String lsh = ""; // if (!CommonlyUtils.isEmpty(lsh)) { // int ls = Integer.parseInt(lsh); // if (number > ls) System.out.println("前缀" + prefix + ",设置最新流水号:" + lshstr); // } else System.out.println("前缀" + prefix + ",新增流水号:" + lshstr); // } // // public static File copyFile (File file1) throws IOException { // String pathSufix = file1.getParent(); // String fileName = file1.getName(); // File file2 = new File(pathSufix + "\\" + 1 + "-" + fileName); // FileUtil.copyFile(file1,file2); // return file2; // } // // // public static String checkFileName(String name) { // return name.replaceAll("/","_") // .replaceAll("\\|","_") // .replaceAll("\\\\","_") // .replaceAll("\"","_") // .replaceAll(":","_") // .replaceAll("\\*","_") // .replaceAll("\\?","_") // .replaceAll("<","_") // .replaceAll(">","_"); // } // // private static String handleXH(String xh) { // String newXh = ""; // if (!CommonlyUtils.isEmpty(xh)) { // if (xh.contains("/")) { // newXh = xh.split("/")[0]; // } else if (xh.contains("\\")) { // newXh = xh.split("\\\\")[0]; // } else { // newXh = xh; // } // } // return newXh; // } // // private static void sortList(List list) { // Collections.sort(list, new Comparator() { // // @Override // public int compare(String lbjth1, String lbjth2) { // try { // if (lbjth1.contains("-B-") && lbjth2.contains("-L-")) return 1; // else if (lbjth1.contains("-L-") && lbjth2.contains("-B-")) return -1; // else if (lbjth1.contains("-W-") && lbjth2.contains("-B-")) return 1; // else if (lbjth1.contains("-B-") && lbjth2.contains("-W-")) return -1; // else if (lbjth1.contains("-W-") && lbjth2.contains("-L-")) return 1; // else if (lbjth1.contains("-L-") && lbjth2.contains("-W-")) return -1; // if (lbjth1.compareTo(lbjth2) >= 0) { // return 1; // } else { // return -1; // } // } catch (NumberFormatException e2) { // return -1; // } // } // }); // } // // private static void waitUpdat(File file) throws InterruptedException { // long lastModifiedDate = file.lastModified(); // while (true) { // if (lastModifiedDate != file.lastModified()) { // System.out.println("文件最后修改时间:" + file.lastModified() + ",已修改!"); // break; // } // System.out.println("文件最后修改时间:" + lastModifiedDate + ",未修改!"); // Thread.sleep(1000); // } // } // // private static String readTxtValue(File txtFile) { // cn.hutool.core.io.file.FileReader reader = new cn.hutool.core.io.file.FileReader(txtFile); // List list = reader.readLines(); // for (String str : list) { //// System.out.println(str); // } // if (CommonlyUtils.isEmptyList(list)) return ""; // else return list.get(0); // // } // // private static void createFIle() throws IOException { // String cmdStr = "CALL"; // FileWriter writer = null; // String now = CommonlyUtils.getNowDate(); // String filePath2 = "D:\\fcccache\\outFile" + now + ".bat"; // File data = new File(filePath2); // data.createNewFile(); // writer = new FileWriter(filePath2); // writer.write(cmdStr); // writer.close(); // } // // // // private static void testfile() throws Exception { // ModelObject object = TCUtils.getItemByPuid(session,"QXMAAYrsLZJleA"); // File file = new File("C:\\Users\\upaad\\Desktop\\大和石英PLM验收遗留问题沟通_202211(1).xlsx"); // updateDatasetSingleFile(session,(Dataset) object,file, // "excel"); // } // // private static void startCadexe(String filePath,String configPath) throws IOException { //// LogUtil.info(CreateOperationCardServiceImpl.class,"签名文件地址>>" + filePath + ",配置信息地址>>" + configPath); //// String cmdStr = "C:\\Users\\upaad\\Desktop\\Desktop\\acad_process.exe" + " " + filePath + " " + configPath; //// Process process = Runtime.getRuntime().exec("cmd /c " + cmdStr); //// BufferedReader input = new BufferedReader(new InputStreamReader(process.getErrorStream(), "UTF-8")); //// String line = null; //// while ((line = input.readLine()) != null) { //// System.out.println(line); //// } //// String newCmd="start /d D:\\Siemens\\Teamcenter12\\portal\\plugins/wait acad2pdf.exe dwgfile=C:\\Users\\upaad\\AppData\\Local\\Temp\\2022112210594704006847.dwg.dwg signtype=text pdfout=true model=pdf txtFile=C:\\Users\\upaad\\AppData\\Local\\Temp\\2022112210594704006847.txt.txt"; //// Process process = Runtime.getRuntime().exec("cmd /c " + newCmd); //// BufferedReader input = new BufferedReader(new InputStreamReader(pr.getInputStream(), "GBK")); //// String line = null; //// while ((line = input.readLine()) != null) { //// System.out.println(line); //// } //// BufferedReader input2 = new BufferedReader(new InputStreamReader(pr.getErrorStream(), "GBK")); //// String line2 = null; //// while ((line2 = input2.readLine()) != null) { //// System.out.println(line2); //// } // // String cmdStr = "call " + "\"C:\\Users\\upaad\\Desktop\\test.jar\""; // LogUtil.info(CreateDocServiceImpl.class, "命令>>" + cmdStr); // FileWriter writer = null; // String now = CommonlyUtils.getNowDate2(); // String filePath1 = "C:\\Users\\upaad\\Desktop\\test-20231103142626184.bat"; //// String filePath1 = "C:\\Users\\upaad\\Desktop\\test-" + now + ".bat"; //// File data = new File(filePath1); //// data.createNewFile(); //// writer = new FileWriter(filePath1); //// writer.write(cmdStr); //// writer.close(); // try { //// Process process = Runtime.getRuntime().exec(filePath1); //// process.waitFor(); // long l = 29000; // new Thread(new Runnable() { // @Override // public void run() { // int num = 0; // while (num < 29) { // System.out.println("当前" + num + ",等待1秒"); // num++; // try { // Thread.sleep(1000); // } catch (InterruptedException e) { // e.printStackTrace(); // } // } // } // }).start(); // ProcessUtils.executeProcess(filePath1, l); // } catch (Exception e) { // e.printStackTrace(); // } // // } // // public static Boolean updateDatasetSingleFile(AppXSession session, Dataset dataset, File file, // String reference) throws Exception { // if (CommonlyUtils.isEmpty(dataset)) return null; // TCUtils.setModelObjectValue(session, dataset, "ref_list"); // ModelObject[] objects = dataset.get_ref_list(); // TCUtils.setModelObjectValue(session, objects[0], "original_file_name"); // String filename = objects[0].getPropertyObject("original_file_name").getStringValue(); // file = new File(TCUtils.changeFileName(file,filename)); // FileManagementUtility fMSFileManagement = new FileManagementUtility(session.getConnection(), // null, // new String[]{"http://DHRC:4544"}, // new String[]{"http://DHRC:4544"}, // "D:/fcccache"); // FileManagement.DatasetFileInfo fileInfo = new FileManagement.DatasetFileInfo(); // fileInfo.fileName = file.getAbsolutePath(); // fileInfo.namedReferencedName = reference; // fileInfo.isText = false; // fileInfo.allowReplace = true; // FileManagement.GetDatasetWriteTicketsInputData input = new FileManagement.GetDatasetWriteTicketsInputData(); // input.dataset = dataset; // input.createNewVersion = false; // input.datasetFileInfos = new FileManagement.DatasetFileInfo[]{fileInfo}; // ServiceData serviceData = fMSFileManagement.putFiles(new FileManagement.GetDatasetWriteTicketsInputData[]{input}); // // TCUtils.checkPartialErrors(serviceData); // return true; // } // // private static void testExcel() { // File file = new File("C:\\Users\\upaad\\Desktop\\ccx.xlsx"); // String now = CommonlyUtils.getNowDate(); // File outFile = new File( "C:\\Users\\upaad\\Desktop\\outFile" + now + ".xlsx"); // ExcelReader reader = ExcelUtil.getReader(file); // ExcelWriter writer = reader.getWriter(); // try{ // Workbook workbook = reader.getWorkbook(); // String loc = getCellLocation(workbook,"value1"); // writer.writeCellValue(loc,"按照单元格名称设置属性"); // writer.setDestFile(outFile); // } finally { // if (writer != null) writer.close(); // if (reader != null) reader.close(); //// file.delete(); // } // } // // // private static String getCellLocation(Workbook workbook, String cellName){ // Name name = workbook.getName(cellName); // String formula = name.getRefersToFormula(); // String[] values = formula.split("!")[1].split("\\$"); // String loc = ""; // for (String value : values) { // loc = loc + value; // } // return loc; // } // // private static List loadBjxmConfig() throws IOException { // String json = CommonlyUtils.loadJson("C:/123/BjxmCreate.json"); // return CommonlyUtils.jsonToObj(json); // } // // private static void test() throws Exception { //// ModelObject object = TCUtils.getItemByPuid(session,"gZGAAY6HLZJleA"); //// File file = new File("C:\\Users\\upaad\\Desktop\\大和石英新材料CRM接口开发计划v2.xlsx"); //// System.out.println(file.getAbsolutePath()); //// TCUtils.createNewDatasetAndUploadSingleFile(session,object,"QZ2khtzgx",file, //// "数据集创建测试","MSExcelX","MSExcel","excel"); // // // List list = new ArrayList<>(); // CYProcess cyProcess = new CYProcess(); // cyProcess.setLbjth("JZ21-1115-001"); // cyProcess.setLbjName("1"); // CYProcess cyProcess2 = new CYProcess(); // cyProcess2.setLbjth("JZ21-1115-001"); // cyProcess2.setLbjName("2"); // CYProcess cyProcess3 = new CYProcess(); // cyProcess3.setLbjth("JZ21-1115-001"); // cyProcess3.setLbjName("3"); // list.add(cyProcess); // list.add(cyProcess2); // list.add(cyProcess3); // CommonlyUtils.sortList(list,"lbjth"); // list.forEach(item-> System.out.println(item.getLbjName())); // // } //}