|  |  |  | @ -33,8 +33,13 @@ import org.apache.poi.ss.usermodel.Cell; | 
		
	
		
			
				|  |  |  |  | import org.apache.poi.ss.usermodel.Row; | 
		
	
		
			
				|  |  |  |  | import org.apache.poi.ss.usermodel.Sheet; | 
		
	
		
			
				|  |  |  |  | import org.apache.poi.ss.usermodel.Workbook; | 
		
	
		
			
				|  |  |  |  | import org.apache.poi.xssf.streaming.SXSSFSheet; | 
		
	
		
			
				|  |  |  |  | import org.apache.poi.xssf.streaming.SXSSFWorkbook; | 
		
	
		
			
				|  |  |  |  | import org.apache.poi.xssf.usermodel.XSSFWorkbook; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | import com.alibaba.excel.EasyExcel; | 
		
	
		
			
				|  |  |  |  | import com.alibaba.excel.context.AnalysisContext; | 
		
	
		
			
				|  |  |  |  | import com.alibaba.excel.event.AnalysisEventListener; | 
		
	
		
			
				|  |  |  |  | import com.sq.customization.bean.CustRuleBean; | 
		
	
		
			
				|  |  |  |  | import com.sq.customization.bean.DesignPartBean; | 
		
	
		
			
				|  |  |  |  | import com.sq.customization.bean.SleeveBean; | 
		
	
	
		
			
				
					|  |  |  | @ -397,11 +402,11 @@ public class AutoTransToolDialog extends AbstractAIFDialog { | 
		
	
		
			
				|  |  |  |  | 							            headerRow.createCell(3).setCellValue("FCC"); | 
		
	
		
			
				|  |  |  |  | 							            headerRow.createCell(4).setCellValue("动态扭矩"); | 
		
	
		
			
				|  |  |  |  | 							            headerRow.createCell(5).setCellValue("KCDS"); | 
		
	
		
			
				|  |  |  |  | 							            headerRow.createCell(6).setCellValue("头部形式"); | 
		
	
		
			
				|  |  |  |  | 							            headerRow.createCell(7).setCellValue("头部尺寸"); | 
		
	
		
			
				|  |  |  |  | 							            headerRow.createCell(8).setCellValue("工具组合"); | 
		
	
		
			
				|  |  |  |  | 							            headerRow.createCell(9).setCellValue("工具"); | 
		
	
		
			
				|  |  |  |  | 							            headerRow.createCell(10).setCellValue("工具套筒"); | 
		
	
		
			
				|  |  |  |  | //							            headerRow.createCell(6).setCellValue("头部形式");
 | 
		
	
		
			
				|  |  |  |  | 							            headerRow.createCell(6).setCellValue("头部尺寸"); | 
		
	
		
			
				|  |  |  |  | 							            headerRow.createCell(7).setCellValue("工具组合"); | 
		
	
		
			
				|  |  |  |  | 							            headerRow.createCell(8).setCellValue("工具"); | 
		
	
		
			
				|  |  |  |  | 							            headerRow.createCell(9).setCellValue("工具套筒"); | 
		
	
		
			
				|  |  |  |  | 										//读取自定义的表
 | 
		
	
		
			
				|  |  |  |  | 										readRuleExcel(excelfile); | 
		
	
		
			
				|  |  |  |  | 										readElectricfile(electricfile,1); | 
		
	
	
		
			
				
					|  |  |  | @ -1309,7 +1314,7 @@ public class AutoTransToolDialog extends AbstractAIFDialog { | 
		
	
		
			
				|  |  |  |  | 							if(workline != null) { | 
		
	
		
			
				|  |  |  |  | 								Map<String,String> clause = new HashMap<>(); | 
		
	
		
			
				|  |  |  |  | 								clause.put("item_id", queryid); | 
		
	
		
			
				|  |  |  |  | 								 | 
		
	
		
			
				|  |  |  |  | 								System.out.println("获取到的工位id:"+queryid); | 
		
	
		
			
				|  |  |  |  | 								List<TCComponent> result2 = TCUtil.queryBOMStructObject(session,workline,"queryItem",clause); | 
		
	
		
			
				|  |  |  |  | 								if(result2 != null) { | 
		
	
		
			
				|  |  |  |  | 									for(TCComponent stationline:result2) { | 
		
	
	
		
			
				
					|  |  |  | @ -1335,23 +1340,28 @@ public class AutoTransToolDialog extends AbstractAIFDialog { | 
		
	
		
			
				|  |  |  |  | 												if(pipei_resource == null || pipei_resource.length() == 0) | 
		
	
		
			
				|  |  |  |  | 													continue; | 
		
	
		
			
				|  |  |  |  | 												//先判断工位下是否有此名称的资源,有的直接拿来用
 | 
		
	
		
			
				|  |  |  |  | 												System.out.println("先判断工位下是否有此名称的资源,有的直接拿来用"); | 
		
	
		
			
				|  |  |  |  | 												Map<String,String> clause3 = new HashMap<>(); | 
		
	
		
			
				|  |  |  |  | 												clause3.put("object_name", pipei_resource); | 
		
	
		
			
				|  |  |  |  | 												List<TCComponent> Resourceresult2 = TCUtil.queryBOMStructObject2(session,stationline,"queryItem",clause3); | 
		
	
		
			
				|  |  |  |  | 												if(Resourceresult2.size() > 0) { | 
		
	
		
			
				|  |  |  |  | 												if(Resourceresult2 != null && Resourceresult2.size() > 0) { | 
		
	
		
			
				|  |  |  |  | 													System.out.println("工位下直接拿来用"+pipei_resource); | 
		
	
		
			
				|  |  |  |  | 													TCUtil.connectObject(session, Resourceresult2.get(0), (TCComponent)op, "MEResource"); | 
		
	
		
			
				|  |  |  |  | 												} | 
		
	
		
			
				|  |  |  |  | 												else { | 
		
	
		
			
				|  |  |  |  | 													System.out.println("工位下没有资源:"+pipei_resource); | 
		
	
		
			
				|  |  |  |  | 													Map<String,String> clause22 = new HashMap<>(); | 
		
	
		
			
				|  |  |  |  | 													clause22.put("object_name", pipei_resource); | 
		
	
		
			
				|  |  |  |  | 													clause22.put("object_type", "Item"); | 
		
	
		
			
				|  |  |  |  | 													TCComponent[] query_items = TCUtil.Generalquery2(session, "queryItem", clause22); | 
		
	
		
			
				|  |  |  |  | 													if(query_items != null && query_items.length > 0) { | 
		
	
		
			
				|  |  |  |  | 														 | 
		
	
		
			
				|  |  |  |  | 														System.out.println("工位下没有资源:"+pipei_resource); | 
		
	
		
			
				|  |  |  |  | 														TCComponentBOMLine newResourceline = station.add((TCComponentItem) query_items[0],null, null, false); | 
		
	
		
			
				|  |  |  |  | 														TCUtil.connectObject(session, newResourceline, (TCComponent)op, "MEResource"); | 
		
	
		
			
				|  |  |  |  | 													} | 
		
	
		
			
				|  |  |  |  | 													else { | 
		
	
		
			
				|  |  |  |  | 														//创建新的item
 | 
		
	
		
			
				|  |  |  |  | 														System.out.println("工位下没有资源,创建新的资源:"+pipei_resource); | 
		
	
		
			
				|  |  |  |  | 														TCComponentItem item = TCUtil.createItem(session, "", "A", "Item", pipei_resource); | 
		
	
		
			
				|  |  |  |  | 														TCComponentBOMLine newResourceline = station.add(item,null, null, false); | 
		
	
		
			
				|  |  |  |  | 														TCUtil.connectObject(session, newResourceline, (TCComponent)op, "MEResource"); | 
		
	
	
		
			
				
					|  |  |  | @ -1361,7 +1371,9 @@ public class AutoTransToolDialog extends AbstractAIFDialog { | 
		
	
		
			
				|  |  |  |  | 														for(String split_value:split) { | 
		
	
		
			
				|  |  |  |  | 															clause2.clear(); | 
		
	
		
			
				|  |  |  |  | 															clause2.put("object_name", split_value); | 
		
	
		
			
				|  |  |  |  | 															TCComponent[] tool_resource = TCUtil.Generalquery2(session, "queryItem", clause); | 
		
	
		
			
				|  |  |  |  | 															clause2.put("object_type", "Design Part"); | 
		
	
		
			
				|  |  |  |  | 															System.out.println("资源添加工具或套筒:"+split_value); | 
		
	
		
			
				|  |  |  |  | 															TCComponent[] tool_resource = TCUtil.Generalquery2(session, "queryItem", clause2); | 
		
	
		
			
				|  |  |  |  | 															if(tool_resource != null && tool_resource.length > 0) { | 
		
	
		
			
				|  |  |  |  | 																newResourceline.add((TCComponentItem) tool_resource[0],null, null, false); | 
		
	
		
			
				|  |  |  |  | 															} | 
		
	
	
		
			
				
					|  |  |  | @ -2224,23 +2236,28 @@ public class AutoTransToolDialog extends AbstractAIFDialog { | 
		
	
		
			
				|  |  |  |  |     												if(pipei_resource == null || pipei_resource.length() == 0) | 
		
	
		
			
				|  |  |  |  |     													continue; | 
		
	
		
			
				|  |  |  |  |     												//先判断工位下是否有此名称的资源,有的直接拿来用
 | 
		
	
		
			
				|  |  |  |  |     												System.out.println("先判断工位下是否有此名称的资源,有的直接拿来用"); | 
		
	
		
			
				|  |  |  |  |     												Map<String,String> clause3 = new HashMap<>(); | 
		
	
		
			
				|  |  |  |  |     												clause3.put("object_name", pipei_resource); | 
		
	
		
			
				|  |  |  |  |     												List<TCComponent> Resourceresult2 = TCUtil.queryBOMStructObject2(session,stationline,"queryItem",clause3); | 
		
	
		
			
				|  |  |  |  |     												if(Resourceresult2.size() > 0) { | 
		
	
		
			
				|  |  |  |  |     												if(Resourceresult2 != null && Resourceresult2.size() > 0) { | 
		
	
		
			
				|  |  |  |  |     													System.out.println("工位下直接拿来用"+pipei_resource); | 
		
	
		
			
				|  |  |  |  |     													TCUtil.connectObject(session, Resourceresult2.get(0), (TCComponent)oldop, "MEResource"); | 
		
	
		
			
				|  |  |  |  |     												} | 
		
	
		
			
				|  |  |  |  |     												else { | 
		
	
		
			
				|  |  |  |  |     													System.out.println("工位下没有资源:"+pipei_resource); | 
		
	
		
			
				|  |  |  |  |     													Map<String,String> clause22 = new HashMap<>(); | 
		
	
		
			
				|  |  |  |  |     													clause22.put("object_name", pipei_resource); | 
		
	
		
			
				|  |  |  |  |     													clause22.put("object_type", "Item"); | 
		
	
		
			
				|  |  |  |  |     													TCComponent[] query_items = TCUtil.Generalquery2(session, "queryItem", clause22); | 
		
	
		
			
				|  |  |  |  |     													if(query_items != null && query_items.length > 0) { | 
		
	
		
			
				|  |  |  |  |     														 | 
		
	
		
			
				|  |  |  |  |     														System.out.println("工位下没有资源:"+pipei_resource); | 
		
	
		
			
				|  |  |  |  |     														TCComponentBOMLine newResourceline = station.add((TCComponentItem) query_items[0],null, null, false); | 
		
	
		
			
				|  |  |  |  |     														TCUtil.connectObject(session, newResourceline, (TCComponent)oldop, "MEResource"); | 
		
	
		
			
				|  |  |  |  |     													} | 
		
	
		
			
				|  |  |  |  |     													else { | 
		
	
		
			
				|  |  |  |  |     														//创建新的item
 | 
		
	
		
			
				|  |  |  |  |     														System.out.println("工位下没有资源,创建新的资源:"+pipei_resource); | 
		
	
		
			
				|  |  |  |  |     														TCComponentItem item = TCUtil.createItem(session, "", "A", "Item", pipei_resource); | 
		
	
		
			
				|  |  |  |  |     														TCComponentBOMLine newResourceline = station.add(item,null, null, false); | 
		
	
		
			
				|  |  |  |  |     														TCUtil.connectObject(session, newResourceline, (TCComponent)oldop, "MEResource"); | 
		
	
	
		
			
				
					|  |  |  | @ -2250,7 +2267,9 @@ public class AutoTransToolDialog extends AbstractAIFDialog { | 
		
	
		
			
				|  |  |  |  |     														for(String split_value:split) { | 
		
	
		
			
				|  |  |  |  |     															clause2.clear(); | 
		
	
		
			
				|  |  |  |  |     															clause2.put("object_name", split_value); | 
		
	
		
			
				|  |  |  |  |     															TCComponent[] tool_resource = TCUtil.Generalquery2(session, "queryItem", clause); | 
		
	
		
			
				|  |  |  |  |     															clause2.put("object_type", "Design Part"); | 
		
	
		
			
				|  |  |  |  |     															System.out.println("资源添加工具或套筒:"+split_value); | 
		
	
		
			
				|  |  |  |  |     															TCComponent[] tool_resource = TCUtil.Generalquery2(session, "queryItem", clause2); | 
		
	
		
			
				|  |  |  |  |     															if(tool_resource != null && tool_resource.length > 0) { | 
		
	
		
			
				|  |  |  |  |     																newResourceline.add((TCComponentItem) tool_resource[0],null, null, false); | 
		
	
		
			
				|  |  |  |  |     															} | 
		
	
	
		
			
				
					|  |  |  | @ -2264,6 +2283,7 @@ public class AutoTransToolDialog extends AbstractAIFDialog { | 
		
	
		
			
				|  |  |  |  |     											} | 
		
	
		
			
				|  |  |  |  |     										} | 
		
	
		
			
				|  |  |  |  |     										 | 
		
	
		
			
				|  |  |  |  |     										 | 
		
	
		
			
				|  |  |  |  |     									} | 
		
	
		
			
				|  |  |  |  |     								} | 
		
	
		
			
				|  |  |  |  |     								 | 
		
	
	
		
			
				
					|  |  |  | @ -2308,31 +2328,66 @@ public class AutoTransToolDialog extends AbstractAIFDialog { | 
		
	
		
			
				|  |  |  |  |      | 
		
	
		
			
				|  |  |  |  |      | 
		
	
		
			
				|  |  |  |  |     //读取BOM表
 | 
		
	
		
			
				|  |  |  |  | //	private void readExcel(File excelfile,int start_rownum,int idcol2,int svppscol2,int fcccol2
 | 
		
	
		
			
				|  |  |  |  | //			,int fccdescol2,int dongtaicol,int kcdscol2) {
 | 
		
	
		
			
				|  |  |  |  | //
 | 
		
	
		
			
				|  |  |  |  | //		Workbook work = null;
 | 
		
	
		
			
				|  |  |  |  | //		try(InputStream is = new FileInputStream(excelfile);){
 | 
		
	
		
			
				|  |  |  |  | //			if (excelfile.getAbsolutePath().endsWith(".xls"))
 | 
		
	
		
			
				|  |  |  |  | //				work = new HSSFWorkbook(is);
 | 
		
	
		
			
				|  |  |  |  | //			else {
 | 
		
	
		
			
				|  |  |  |  | //				work = new XSSFWorkbook(is);
 | 
		
	
		
			
				|  |  |  |  | //			}
 | 
		
	
		
			
				|  |  |  |  | //			Sheet sheet = work.getSheetAt(0);
 | 
		
	
		
			
				|  |  |  |  | //			int count = sheet.getPhysicalNumberOfRows();
 | 
		
	
		
			
				|  |  |  |  | //			for(int i = start_rownum; i < count ;i++) {
 | 
		
	
		
			
				|  |  |  |  | //				Row row = sheet.getRow(i);
 | 
		
	
		
			
				|  |  |  |  | //				String id = ExcelUtil.getStringCellValue(row.getCell(idcol2-1));
 | 
		
	
		
			
				|  |  |  |  | //				if(id == null || id.length() == 0)
 | 
		
	
		
			
				|  |  |  |  | //					break;
 | 
		
	
		
			
				|  |  |  |  | //				String svpps = ExcelUtil.getStringCellValue(row.getCell(svppscol2-1));
 | 
		
	
		
			
				|  |  |  |  | //				String fcc = ExcelUtil.getStringCellValue(row.getCell(fcccol2-1));
 | 
		
	
		
			
				|  |  |  |  | //				String fccdes = ExcelUtil.getStringCellValue(row.getCell(fccdescol2-1));
 | 
		
	
		
			
				|  |  |  |  | //				String dongtai = ExcelUtil.getStringCellValue(row.getCell(dongtaicol-1));
 | 
		
	
		
			
				|  |  |  |  | //				String kcds = ExcelUtil.getStringCellValue(row.getCell(kcdscol2-1));
 | 
		
	
		
			
				|  |  |  |  | //				System.out.println("id:"+id+" svpps:"+svpps+" fcc:"+fcc+" fccdes:"+fccdes+" dongtai:"+dongtai+" kcds:"+kcds);
 | 
		
	
		
			
				|  |  |  |  | //				String key = id;
 | 
		
	
		
			
				|  |  |  |  | //				if(!DesignPartBeanMap.containsKey(key)) {
 | 
		
	
		
			
				|  |  |  |  | //					DesignPartBean bean = new DesignPartBean();
 | 
		
	
		
			
				|  |  |  |  | //					bean.setDongtai(dongtai);
 | 
		
	
		
			
				|  |  |  |  | //					bean.setFCC(fcc);
 | 
		
	
		
			
				|  |  |  |  | //					bean.setFCCDES(fccdes);
 | 
		
	
		
			
				|  |  |  |  | //					bean.setKCDS(kcds);
 | 
		
	
		
			
				|  |  |  |  | //					bean.setSVPPS(svpps);
 | 
		
	
		
			
				|  |  |  |  | //					DesignPartBeanMap.put(key, bean);
 | 
		
	
		
			
				|  |  |  |  | //				}
 | 
		
	
		
			
				|  |  |  |  | //			}
 | 
		
	
		
			
				|  |  |  |  | //		} catch (FileNotFoundException e) {
 | 
		
	
		
			
				|  |  |  |  | //			// TODO Auto-generated catch block
 | 
		
	
		
			
				|  |  |  |  | //			e.printStackTrace();
 | 
		
	
		
			
				|  |  |  |  | //		} catch (IOException e) {
 | 
		
	
		
			
				|  |  |  |  | //			// TODO Auto-generated catch block
 | 
		
	
		
			
				|  |  |  |  | //			e.printStackTrace();
 | 
		
	
		
			
				|  |  |  |  | //		}
 | 
		
	
		
			
				|  |  |  |  | //	}
 | 
		
	
		
			
				|  |  |  |  |     private void readExcel(File excelfile,int start_rownum,int idcol2,int svppscol2,int fcccol2 | 
		
	
		
			
				|  |  |  |  | 			,int fccdescol2,int dongtaicol,int kcdscol2) { | 
		
	
		
			
				|  |  |  |  | 		Workbook work = null; | 
		
	
		
			
				|  |  |  |  | 		try(InputStream is = new FileInputStream(excelfile);){ | 
		
	
		
			
				|  |  |  |  | 			if (excelfile.getAbsolutePath().endsWith(".xls")) | 
		
	
		
			
				|  |  |  |  | 				work = new HSSFWorkbook(is); | 
		
	
		
			
				|  |  |  |  | 			else { | 
		
	
		
			
				|  |  |  |  | 				work = new XSSFWorkbook(is); | 
		
	
		
			
				|  |  |  |  | 			} | 
		
	
		
			
				|  |  |  |  | 			Sheet sheet = work.getSheetAt(0); | 
		
	
		
			
				|  |  |  |  | 			int count = sheet.getPhysicalNumberOfRows(); | 
		
	
		
			
				|  |  |  |  | 			for(int i = start_rownum; i < count ;i++) { | 
		
	
		
			
				|  |  |  |  | 				Row row = sheet.getRow(i); | 
		
	
		
			
				|  |  |  |  | 				String id = ExcelUtil.getStringCellValue(row.getCell(idcol2-1)); | 
		
	
		
			
				|  |  |  |  | 				if(id == null || id.length() == 0) | 
		
	
		
			
				|  |  |  |  | 					break; | 
		
	
		
			
				|  |  |  |  | 				String svpps = ExcelUtil.getStringCellValue(row.getCell(svppscol2-1)); | 
		
	
		
			
				|  |  |  |  | 				String fcc = ExcelUtil.getStringCellValue(row.getCell(fcccol2-1)); | 
		
	
		
			
				|  |  |  |  | 				String fccdes = ExcelUtil.getStringCellValue(row.getCell(fccdescol2-1)); | 
		
	
		
			
				|  |  |  |  | 				String dongtai = ExcelUtil.getStringCellValue(row.getCell(dongtaicol-1)); | 
		
	
		
			
				|  |  |  |  | 				String kcds = ExcelUtil.getStringCellValue(row.getCell(kcdscol2-1)); | 
		
	
		
			
				|  |  |  |  | 				System.out.println("id:"+id+" svpps:"+svpps+" fcc:"+fcc+" fccdes:"+fccdes+" dongtai:"+dongtai+" kcds:"+kcds); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     	// 自定义监听器
 | 
		
	
		
			
				|  |  |  |  |         AnalysisEventListener<Map<Integer, String>> listener = new AnalysisEventListener<Map<Integer, String>>() { | 
		
	
		
			
				|  |  |  |  |             @Override | 
		
	
		
			
				|  |  |  |  |             public void invoke(Map<Integer, String> rowData, AnalysisContext context) { | 
		
	
		
			
				|  |  |  |  |             	String id = rowData.get(idcol2-1) != null ? rowData.get(idcol2-1) : ""; | 
		
	
		
			
				|  |  |  |  |                 String dongtai = rowData.get(dongtaicol-1) != null ? rowData.get(dongtaicol-1) : ""; | 
		
	
		
			
				|  |  |  |  |                 String fcc = rowData.get(fcccol2-1) != null ? rowData.get(fcccol2-1) : ""; | 
		
	
		
			
				|  |  |  |  |                 String fccdes = rowData.get(fccdescol2-1) != null ? rowData.get(fccdescol2-1) : ""; | 
		
	
		
			
				|  |  |  |  |                 String kcds = rowData.get(kcdscol2-1) != null ? rowData.get(kcdscol2-1) : ""; | 
		
	
		
			
				|  |  |  |  |                 String svpps = rowData.get(svppscol2-1) != null ? rowData.get(svppscol2-1) : ""; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |                 String key = id; | 
		
	
		
			
				|  |  |  |  |                 if (!DesignPartBeanMap.containsKey(key)) { | 
		
	
		
			
				|  |  |  |  |                     DesignPartBean bean = new DesignPartBean(); | 
		
	
		
			
				|  |  |  |  |                     // 设置值,确保不会为 null
 | 
		
	
		
			
				|  |  |  |  |                     bean.setDongtai(dongtai); | 
		
	
		
			
				|  |  |  |  |                     bean.setFCC(fcc); | 
		
	
		
			
				|  |  |  |  |                     bean.setFCCDES(fccdes); | 
		
	
	
		
			
				
					|  |  |  | @ -2341,13 +2396,18 @@ public class AutoTransToolDialog extends AbstractAIFDialog { | 
		
	
		
			
				|  |  |  |  |                     DesignPartBeanMap.put(key, bean); | 
		
	
		
			
				|  |  |  |  |                 } | 
		
	
		
			
				|  |  |  |  |             } | 
		
	
		
			
				|  |  |  |  | 		} catch (FileNotFoundException e) { | 
		
	
		
			
				|  |  |  |  | 			// TODO Auto-generated catch block
 | 
		
	
		
			
				|  |  |  |  | 			e.printStackTrace(); | 
		
	
		
			
				|  |  |  |  | 		} catch (IOException e) { | 
		
	
		
			
				|  |  |  |  | 			// TODO Auto-generated catch block
 | 
		
	
		
			
				|  |  |  |  | 			e.printStackTrace(); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |             @Override | 
		
	
		
			
				|  |  |  |  |             public void doAfterAllAnalysed(AnalysisContext context) { | 
		
	
		
			
				|  |  |  |  |                 System.out.println("读取完成,共 " + DesignPartBeanMap.size() + " 行数据"); | 
		
	
		
			
				|  |  |  |  |             } | 
		
	
		
			
				|  |  |  |  |         }; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |         // 执行读取
 | 
		
	
		
			
				|  |  |  |  |         EasyExcel.read(excelfile, listener) | 
		
	
		
			
				|  |  |  |  |                 .sheet(0) // 指定 sheet 索引
 | 
		
	
		
			
				|  |  |  |  |                 .headRowNumber(start_rownum)  // 从第0行开始读取(包含标题行则设为1)
 | 
		
	
		
			
				|  |  |  |  |                 .doRead(); | 
		
	
		
			
				|  |  |  |  | 	} | 
		
	
		
			
				|  |  |  |  | 	//读取规则表
 | 
		
	
		
			
				|  |  |  |  | 	private void readRuleExcel(File excelfile) { | 
		
	
	
		
			
				
					|  |  |  | @ -2721,14 +2781,18 @@ public class AutoTransToolDialog extends AbstractAIFDialog { | 
		
	
		
			
				|  |  |  |  | 	 * 读取套筒表*/ | 
		
	
		
			
				|  |  |  |  | 	private void readsleevefile(File excelfile, int start_rownum) { | 
		
	
		
			
				|  |  |  |  | 	    Workbook work = null; | 
		
	
		
			
				|  |  |  |  | 		try(InputStream is = new FileInputStream(excelfile);){ | 
		
	
		
			
				|  |  |  |  | 			if (excelfile.getAbsolutePath().endsWith(".xls")) | 
		
	
		
			
				|  |  |  |  | 	    try (InputStream is = new FileInputStream(excelfile)) { | 
		
	
		
			
				|  |  |  |  | 	        if (excelfile.getAbsolutePath().endsWith(".xls")) { | 
		
	
		
			
				|  |  |  |  | 	            work = new HSSFWorkbook(is); | 
		
	
		
			
				|  |  |  |  | 			else { | 
		
	
		
			
				|  |  |  |  | 	        } else { | 
		
	
		
			
				|  |  |  |  | 	            work = new XSSFWorkbook(is); | 
		
	
		
			
				|  |  |  |  | 	        } | 
		
	
		
			
				|  |  |  |  | 	        Sheet sheet = work.getSheetAt(0); | 
		
	
		
			
				|  |  |  |  | 	        int count = sheet.getPhysicalNumberOfRows(); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | 	        // 临时存储所有 SleeveBean,按 outSize 分组
 | 
		
	
		
			
				|  |  |  |  | 	        Map<String, List<SleeveBean>> tempMap = new HashMap<>(); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | 	        for (int i = start_rownum; i < count; i++) { | 
		
	
		
			
				|  |  |  |  | 	            Row row = sheet.getRow(i); | 
		
	
		
			
				|  |  |  |  | 	            String resourceType = ExcelUtil.getStringCellValue(row.getCell(1)); | 
		
	
	
		
			
				
					|  |  |  | @ -2736,8 +2800,8 @@ public class AutoTransToolDialog extends AbstractAIFDialog { | 
		
	
		
			
				|  |  |  |  | 	            String outSize = ExcelUtil.getStringCellValue(row.getCell(7)); | 
		
	
		
			
				|  |  |  |  | 	            String length = ExcelUtil.getStringCellValue(row.getCell(11)); | 
		
	
		
			
				|  |  |  |  | 	            String headform = ExcelUtil.getStringCellValue(row.getCell(16)); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | 	            if (resourceType != null && resourceType.length() > 0) { | 
		
	
		
			
				|  |  |  |  | 					// 使用 computeIfAbsent 简化操作
 | 
		
	
		
			
				|  |  |  |  | 	                SleeveBean tool = new SleeveBean(); | 
		
	
		
			
				|  |  |  |  | 	                tool.setResourceType(resourceType); | 
		
	
		
			
				|  |  |  |  | 	                tool.setLength(length); | 
		
	
	
		
			
				
					|  |  |  | @ -2745,22 +2809,43 @@ public class AutoTransToolDialog extends AbstractAIFDialog { | 
		
	
		
			
				|  |  |  |  | 	                tool.setInputSize(inputSize); | 
		
	
		
			
				|  |  |  |  | 	                tool.setOutSize(outSize); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | 					SleeveMap.computeIfAbsent(outSize, key -> new ArrayList<>()).add(tool); | 
		
	
		
			
				|  |  |  |  | 					 | 
		
	
		
			
				|  |  |  |  | 				} | 
		
	
		
			
				|  |  |  |  | 				else { | 
		
	
		
			
				|  |  |  |  | 	                // 添加到临时 Map 中
 | 
		
	
		
			
				|  |  |  |  | 	                tempMap.computeIfAbsent(outSize, key -> new ArrayList<>()).add(tool); | 
		
	
		
			
				|  |  |  |  | 	            } else { | 
		
	
		
			
				|  |  |  |  | 	                break; | 
		
	
		
			
				|  |  |  |  | 	            } | 
		
	
		
			
				|  |  |  |  | 	        } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | 	        // 对每个 outSize 的 List 按 length 排序
 | 
		
	
		
			
				|  |  |  |  | 	        for (Map.Entry<String, List<SleeveBean>> entry : tempMap.entrySet()) { | 
		
	
		
			
				|  |  |  |  | 	            List<SleeveBean> sleeveList = entry.getValue(); | 
		
	
		
			
				|  |  |  |  | 	            sleeveList.sort((bean1, bean2) -> { | 
		
	
		
			
				|  |  |  |  | 	                // 将 length 转换为数字进行比较
 | 
		
	
		
			
				|  |  |  |  | 	                double length1 = parseLength(bean1.getLength()); | 
		
	
		
			
				|  |  |  |  | 	                double length2 = parseLength(bean2.getLength()); | 
		
	
		
			
				|  |  |  |  | 	                return Double.compare(length1, length2); | 
		
	
		
			
				|  |  |  |  | 	            }); | 
		
	
		
			
				|  |  |  |  | 	            // 将排序后的列表放入 SleeveMap
 | 
		
	
		
			
				|  |  |  |  | 	            SleeveMap.put(entry.getKey(), sleeveList); | 
		
	
		
			
				|  |  |  |  | 	        } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | 	    } catch (FileNotFoundException e) { | 
		
	
		
			
				|  |  |  |  | 			// TODO Auto-generated catch block
 | 
		
	
		
			
				|  |  |  |  | 	        e.printStackTrace(); | 
		
	
		
			
				|  |  |  |  | 	    } catch (IOException e) { | 
		
	
		
			
				|  |  |  |  | 			// TODO Auto-generated catch block
 | 
		
	
		
			
				|  |  |  |  | 	        e.printStackTrace(); | 
		
	
		
			
				|  |  |  |  | 	    } | 
		
	
		
			
				|  |  |  |  | 	} | 
		
	
		
			
				|  |  |  |  | 	private double parseLength(String length) { | 
		
	
		
			
				|  |  |  |  | 	    if (length == null || length.trim().isEmpty()) { | 
		
	
		
			
				|  |  |  |  | 	        return 0.0; // 默认值,可以根据需求调整
 | 
		
	
		
			
				|  |  |  |  | 	    } | 
		
	
		
			
				|  |  |  |  | 	    try { | 
		
	
		
			
				|  |  |  |  | 	        return Double.parseDouble(length.trim()); | 
		
	
		
			
				|  |  |  |  | 	    } catch (NumberFormatException e) { | 
		
	
		
			
				|  |  |  |  | 	        System.err.println("无法解析 length: " + length); | 
		
	
		
			
				|  |  |  |  | 	        return 0.0; // 解析失败时返回默认值
 | 
		
	
		
			
				|  |  |  |  | 	    } | 
		
	
		
			
				|  |  |  |  | 	} | 
		
	
		
			
				|  |  |  |  | 	private List<TCComponent> getStation(TCComponentBOMLine child){ | 
		
	
		
			
				|  |  |  |  | 		List<TCComponent> result = null; | 
		
	
		
			
				|  |  |  |  | 		Map<String,String> clause = new HashMap<>(); | 
		
	
	
		
			
				
					|  |  |  | 
 |