|  |  |  | @ -47,6 +47,7 @@ import com.sq.customization.util.RangChecker; | 
		
	
		
			
				|  |  |  |  | import com.sq.customization.util.RangeAdjuster; | 
		
	
		
			
				|  |  |  |  | import com.sq.customization.util.RangeCalculator; | 
		
	
		
			
				|  |  |  |  | import com.sq.customization.util.StringConditionChecker; | 
		
	
		
			
				|  |  |  |  | import com.sq.customization.util.TCUtil; | 
		
	
		
			
				|  |  |  |  | import com.teamcenter.rac.aif.AbstractAIFDialog; | 
		
	
		
			
				|  |  |  |  | import com.teamcenter.rac.aif.kernel.AIFComponentContext; | 
		
	
		
			
				|  |  |  |  | import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent; | 
		
	
	
		
			
				
					|  |  |  | @ -57,7 +58,9 @@ import com.teamcenter.rac.cme.kernel.bvr.TCComponentMfgBvrProcessLine; | 
		
	
		
			
				|  |  |  |  | import com.teamcenter.rac.cme.kernel.bvr.TCComponentMfgBvrProcessStation; | 
		
	
		
			
				|  |  |  |  | import com.teamcenter.rac.kernel.TCComponent; | 
		
	
		
			
				|  |  |  |  | import com.teamcenter.rac.kernel.TCComponentBOMLine; | 
		
	
		
			
				|  |  |  |  | import com.teamcenter.rac.kernel.TCComponentBOMWindow; | 
		
	
		
			
				|  |  |  |  | import com.teamcenter.rac.kernel.TCComponentDataset; | 
		
	
		
			
				|  |  |  |  | import com.teamcenter.rac.kernel.TCComponentItem; | 
		
	
		
			
				|  |  |  |  | import com.teamcenter.rac.kernel.TCException; | 
		
	
		
			
				|  |  |  |  | import com.teamcenter.rac.kernel.TCPreferenceService; | 
		
	
		
			
				|  |  |  |  | import com.teamcenter.rac.kernel.TCSession; | 
		
	
	
		
			
				
					|  |  |  | @ -66,6 +69,7 @@ import com.teamcenter.rac.util.ButtonLayout; | 
		
	
		
			
				|  |  |  |  | import com.teamcenter.rac.util.MessageBox; | 
		
	
		
			
				|  |  |  |  | import com.teamcenter.rac.util.PropertyLayout; | 
		
	
		
			
				|  |  |  |  | import com.teamcenter.rac.util.Registry; | 
		
	
		
			
				|  |  |  |  | import com.teamcenter.schemas.soa._2006_03.exceptions.ServiceException; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | public class AutoTransToolDialog extends AbstractAIFDialog { | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
	
		
			
				
					|  |  |  | @ -102,10 +106,12 @@ public class AutoTransToolDialog extends AbstractAIFDialog { | 
		
	
		
			
				|  |  |  |  | 	private Map<String,List<SleeveBean>> SleeveMap = new HashMap<>();//excel套筒
 | 
		
	
		
			
				|  |  |  |  | //	private int times = 0;
 | 
		
	
		
			
				|  |  |  |  | 	private int row_num = 1; | 
		
	
		
			
				|  |  |  |  | 	public AutoTransToolDialog(Frame fm,InterfaceAIFComponent target,TCSession session) { | 
		
	
		
			
				|  |  |  |  | 	private TCComponentBOMLine workline; | 
		
	
		
			
				|  |  |  |  | 	public AutoTransToolDialog(Frame fm,InterfaceAIFComponent target,TCSession session,TCComponentBOMLine workline) { | 
		
	
		
			
				|  |  |  |  | 		super(fm); | 
		
	
		
			
				|  |  |  |  | 		this.target = target; | 
		
	
		
			
				|  |  |  |  | 		this.session = session; | 
		
	
		
			
				|  |  |  |  | 		this.workline = workline; | 
		
	
		
			
				|  |  |  |  | 		op_nodesignmap.clear(); | 
		
	
		
			
				|  |  |  |  | 		no_load.clear(); | 
		
	
		
			
				|  |  |  |  | 		DesignPartBeanMap.clear(); | 
		
	
	
		
			
				
					|  |  |  | @ -513,7 +519,22 @@ public class AutoTransToolDialog extends AbstractAIFDialog { | 
		
	
		
			
				|  |  |  |  | 			if(childcom instanceof TCComponentMfgBvrOperation) { | 
		
	
		
			
				|  |  |  |  | 				 | 
		
	
		
			
				|  |  |  |  | 				TCComponentMfgBvrOperation op = (TCComponentMfgBvrOperation) childcom; | 
		
	
		
			
				|  |  |  |  | 				 | 
		
	
		
			
				|  |  |  |  | 				String bl_rev_object_name = op.getProperty("bl_rev_object_name"); | 
		
	
		
			
				|  |  |  |  | 				//先查询是否有资源,没资源的跳过
 | 
		
	
		
			
				|  |  |  |  | 				boolean iscontinue = true; | 
		
	
		
			
				|  |  |  |  | 				AIFComponentContext[] design_children1 = op.getChildren(); | 
		
	
		
			
				|  |  |  |  | 				for(AIFComponentContext designchild:design_children1) { | 
		
	
		
			
				|  |  |  |  | 					InterfaceAIFComponent designchildcom = designchild.getComponent(); | 
		
	
		
			
				|  |  |  |  | 					String bl_occ_type = designchildcom.getProperty("bl_occ_type"); | 
		
	
		
			
				|  |  |  |  | 					if("MEResource".equalsIgnoreCase(bl_occ_type)) { | 
		
	
		
			
				|  |  |  |  | 						iscontinue = false; | 
		
	
		
			
				|  |  |  |  | 						break; | 
		
	
		
			
				|  |  |  |  | 					} | 
		
	
		
			
				|  |  |  |  | 				} | 
		
	
		
			
				|  |  |  |  | 				if(!iscontinue) { | 
		
	
		
			
				|  |  |  |  | 					continue; | 
		
	
		
			
				|  |  |  |  | 				} | 
		
	
		
			
				|  |  |  |  | 				 | 
		
	
		
			
				|  |  |  |  | 				if(bl_rev_object_name.contains("预紧") || bl_rev_object_name.contains("终紧") | 
		
	
		
			
				|  |  |  |  | 						|| bl_rev_object_name.contains("紧固")|| bl_rev_object_name.contains("拧紧") | 
		
	
	
		
			
				
					|  |  |  | @ -522,9 +543,16 @@ public class AutoTransToolDialog extends AbstractAIFDialog { | 
		
	
		
			
				|  |  |  |  | 					AIFComponentContext[] design_children = op.getChildren(); | 
		
	
		
			
				|  |  |  |  | 					boolean hasdesign = false; | 
		
	
		
			
				|  |  |  |  | 					Map<String,String> idmap = new HashMap<>(); | 
		
	
		
			
				|  |  |  |  | 					Map<String,String> pipei_resource_map = new HashMap<>(); | 
		
	
		
			
				|  |  |  |  | //					Map<String,List<InterfaceAIFComponent>> resource_map = new HashMap<>();//工序下挂接的资源
 | 
		
	
		
			
				|  |  |  |  | 					for(AIFComponentContext designchild:design_children) { | 
		
	
		
			
				|  |  |  |  | 						InterfaceAIFComponent designchildcom = designchild.getComponent(); | 
		
	
		
			
				|  |  |  |  | 						String bl_item_object_type = designchildcom.getProperty("bl_item_object_type"); | 
		
	
		
			
				|  |  |  |  | 						String bl_occ_type = designchildcom.getProperty("bl_occ_type"); | 
		
	
		
			
				|  |  |  |  | //						if("MEResource".equalsIgnoreCase(bl_occ_type)) {
 | 
		
	
		
			
				|  |  |  |  | //							String Resource_name = designchildcom.getProperty("bl_rev_object_name");
 | 
		
	
		
			
				|  |  |  |  | //							resource_map.computeIfAbsent(Resource_name, key2 -> new ArrayList<>()).add(designchildcom);
 | 
		
	
		
			
				|  |  |  |  | //						}
 | 
		
	
		
			
				|  |  |  |  | 						if("Design Part".equalsIgnoreCase(bl_item_object_type)) { | 
		
	
		
			
				|  |  |  |  | 							hasdesign = true; | 
		
	
		
			
				|  |  |  |  | 							//获取符合的数据
 | 
		
	
	
		
			
				
					|  |  |  | @ -1150,17 +1178,18 @@ public class AutoTransToolDialog extends AbstractAIFDialog { | 
		
	
		
			
				|  |  |  |  | 								System.out.println("匹配标准件designid:"+designid); | 
		
	
		
			
				|  |  |  |  | 								if(StandardPartMap.containsKey(designid)) { | 
		
	
		
			
				|  |  |  |  | 									StandardPartBean stdbean = StandardPartMap.get(designid); | 
		
	
		
			
				|  |  |  |  | 									String headform = stdbean.getHeadform(); | 
		
	
		
			
				|  |  |  |  | //									String headform = stdbean.getHeadform();
 | 
		
	
		
			
				|  |  |  |  | 									String headsize = stdbean.getHeadsize(); | 
		
	
		
			
				|  |  |  |  | 									Cell headform_cell = row.createCell(6); | 
		
	
		
			
				|  |  |  |  | 									headform_cell.setCellValue(headform); | 
		
	
		
			
				|  |  |  |  | 									Cell headsize_cell = row.createCell(7); | 
		
	
		
			
				|  |  |  |  | //									Cell headform_cell = row.createCell(6);
 | 
		
	
		
			
				|  |  |  |  | //									headform_cell.setCellValue(headform);
 | 
		
	
		
			
				|  |  |  |  | 									Cell headsize_cell = row.createCell(6); | 
		
	
		
			
				|  |  |  |  | 									headsize_cell.setCellValue(headsize); | 
		
	
		
			
				|  |  |  |  | 									String key2 = headsize+"|"+headform; | 
		
	
		
			
				|  |  |  |  | //									String key2 = headsize+"|"+headform;
 | 
		
	
		
			
				|  |  |  |  | 									String key2 = headsize; | 
		
	
		
			
				|  |  |  |  | 									System.out.println("寻找套筒  头部尺寸|头部形式:"+key2); | 
		
	
		
			
				|  |  |  |  | 									if(SleeveMap.containsKey(key2)) { | 
		
	
		
			
				|  |  |  |  | 										System.out.println("找到匹配"); | 
		
	
		
			
				|  |  |  |  | 										Cell all_cell = row.createCell(8); | 
		
	
		
			
				|  |  |  |  | 										Cell all_cell = row.createCell(7); | 
		
	
		
			
				|  |  |  |  | 										String all = ""; | 
		
	
		
			
				|  |  |  |  | 										List<SleeveBean> SleeveBeans = SleeveMap.get(key2); | 
		
	
		
			
				|  |  |  |  | 										for(SleeveBean sleevebean:SleeveBeans) { | 
		
	
	
		
			
				
					|  |  |  | @ -1184,14 +1213,14 @@ public class AutoTransToolDialog extends AbstractAIFDialog { | 
		
	
		
			
				|  |  |  |  | 														if(outsize.equals(inputsize)) { | 
		
	
		
			
				|  |  |  |  | 															System.out.println("工具匹配上套筒,工具的输出尺寸:"+outsize+" 套筒输入尺寸:"+inputsize+" 长度:"+length +" 资源类型:"+resourceType); | 
		
	
		
			
				|  |  |  |  | 															has = true; | 
		
	
		
			
				|  |  |  |  | 															all = all+resourcetype+"-"+resourceType; | 
		
	
		
			
				|  |  |  |  | 															all = all+resourcetype+"+"+resourceType; | 
		
	
		
			
				|  |  |  |  | 															break; | 
		
	
		
			
				|  |  |  |  | 														} | 
		
	
		
			
				|  |  |  |  | 													} | 
		
	
		
			
				|  |  |  |  | 													else if((outsize == null || outsize.length() == 0) && (inputsize == null || inputsize.length() == 0)){  | 
		
	
		
			
				|  |  |  |  | 														System.out.println("工具匹配上套筒,工具的输出尺寸:"+outsize+" 套筒输入尺寸:"+inputsize+" 长度:"+length +" 资源类型:"+resourceType); | 
		
	
		
			
				|  |  |  |  | 														 | 
		
	
		
			
				|  |  |  |  | 														all = all+resourcetype+"-"+resourceType; | 
		
	
		
			
				|  |  |  |  | 														all = all+resourcetype+"+"+resourceType; | 
		
	
		
			
				|  |  |  |  | 														has = true; | 
		
	
		
			
				|  |  |  |  | 														break; | 
		
	
		
			
				|  |  |  |  | 													} | 
		
	
	
		
			
				
					|  |  |  | @ -1208,6 +1237,10 @@ public class AutoTransToolDialog extends AbstractAIFDialog { | 
		
	
		
			
				|  |  |  |  | 											} | 
		
	
		
			
				|  |  |  |  | 										} | 
		
	
		
			
				|  |  |  |  | 										all_cell.setCellValue(all); | 
		
	
		
			
				|  |  |  |  | 										if(all != null && all.length() > 0) { | 
		
	
		
			
				|  |  |  |  | 											if(!pipei_resource_map.containsKey(all)) | 
		
	
		
			
				|  |  |  |  | 												pipei_resource_map.put(all, all); | 
		
	
		
			
				|  |  |  |  | 										} | 
		
	
		
			
				|  |  |  |  | 									} | 
		
	
		
			
				|  |  |  |  | 									else | 
		
	
		
			
				|  |  |  |  | 										System.out.println("没有找到匹配"); | 
		
	
	
		
			
				
					|  |  |  | @ -1230,12 +1263,133 @@ public class AutoTransToolDialog extends AbstractAIFDialog { | 
		
	
		
			
				|  |  |  |  | 						op_nodesignmap.put(bl_rev_object_name, op); | 
		
	
		
			
				|  |  |  |  | 						 | 
		
	
		
			
				|  |  |  |  | 					} | 
		
	
		
			
				|  |  |  |  | 					else { | 
		
	
		
			
				|  |  |  |  | 						 | 
		
	
		
			
				|  |  |  |  | 						 | 
		
	
		
			
				|  |  |  |  | 						 | 
		
	
		
			
				|  |  |  |  | //						List<String> newresources = new ArrayList<>();
 | 
		
	
		
			
				|  |  |  |  | //						for(String pipei_resource:pipei_resource_map.keySet()) {
 | 
		
	
		
			
				|  |  |  |  | //							if(resource_map.containsKey(pipei_resource)) {
 | 
		
	
		
			
				|  |  |  |  | //								resource_map.remove(pipei_resource);
 | 
		
	
		
			
				|  |  |  |  | //							}
 | 
		
	
		
			
				|  |  |  |  | //							else {
 | 
		
	
		
			
				|  |  |  |  | //								newresources.add(pipei_resource);
 | 
		
	
		
			
				|  |  |  |  | //							}
 | 
		
	
		
			
				|  |  |  |  | //						}
 | 
		
	
		
			
				|  |  |  |  | 						//将不能存在的资源移除掉
 | 
		
	
		
			
				|  |  |  |  | //						String resourceids = "";
 | 
		
	
		
			
				|  |  |  |  | //						for(String pipei_resource:resource_map.keySet()) {
 | 
		
	
		
			
				|  |  |  |  | //							List<InterfaceAIFComponent> bomline = resource_map.get(pipei_resource);
 | 
		
	
		
			
				|  |  |  |  | //							for(InterfaceAIFComponent com:bomline) {
 | 
		
	
		
			
				|  |  |  |  | //								if(com != null && com instanceof TCComponentBOMLine) {
 | 
		
	
		
			
				|  |  |  |  | //									TCComponentBOMLine line = (TCComponentBOMLine) com;
 | 
		
	
		
			
				|  |  |  |  | //									String resourceid = line.getProperty("bl_item_item_id");
 | 
		
	
		
			
				|  |  |  |  | //									resourceids = resourceids +resourceid+";";
 | 
		
	
		
			
				|  |  |  |  | //									line.cut();
 | 
		
	
		
			
				|  |  |  |  | //								}
 | 
		
	
		
			
				|  |  |  |  | //							}
 | 
		
	
		
			
				|  |  |  |  | //							
 | 
		
	
		
			
				|  |  |  |  | //						}
 | 
		
	
		
			
				|  |  |  |  | //						if(resourceids.endsWith(";")) {
 | 
		
	
		
			
				|  |  |  |  | //							resourceids = resourceids.substring(0,resourceids.length() - 1);
 | 
		
	
		
			
				|  |  |  |  | //						}
 | 
		
	
		
			
				|  |  |  |  | 						((TCComponentMfgBvrOperation) childcom).window().save(); | 
		
	
		
			
				|  |  |  |  | 						//获取工位
 | 
		
	
		
			
				|  |  |  |  | 						System.out.println(childcom+"获取工位"); | 
		
	
		
			
				|  |  |  |  | 						List<TCComponent> result = getStation((TCComponentBOMLine)childcom); | 
		
	
		
			
				|  |  |  |  | 						if(result.size() > 0) { | 
		
	
		
			
				|  |  |  |  | 							String queryid = ""; | 
		
	
		
			
				|  |  |  |  | 							for(TCComponent station:result) { | 
		
	
		
			
				|  |  |  |  | 								String stationid = station.getProperty("bl_item_item_id"); | 
		
	
		
			
				|  |  |  |  | 								queryid = queryid + stationid+";"; | 
		
	
		
			
				|  |  |  |  | 							} | 
		
	
		
			
				|  |  |  |  | 							if(queryid.endsWith(";")) { | 
		
	
		
			
				|  |  |  |  | 								queryid = queryid.substring(0, queryid.length()-1); | 
		
	
		
			
				|  |  |  |  | 							} | 
		
	
		
			
				|  |  |  |  | 							if(workline != null) { | 
		
	
		
			
				|  |  |  |  | 								Map<String,String> clause = new HashMap<>(); | 
		
	
		
			
				|  |  |  |  | 								clause.put("item_id", queryid); | 
		
	
		
			
				|  |  |  |  | 								 | 
		
	
		
			
				|  |  |  |  | 								List<TCComponent> result2 = TCUtil.queryBOMStructObject(session,workline,"queryItem",clause); | 
		
	
		
			
				|  |  |  |  | 								if(result2 != null) { | 
		
	
		
			
				|  |  |  |  | 									for(TCComponent stationline:result2) { | 
		
	
		
			
				|  |  |  |  | 										//工位下先去除资源
 | 
		
	
		
			
				|  |  |  |  | //										if(queryid.length() > 0) {
 | 
		
	
		
			
				|  |  |  |  | //											Map<String,String> clause2 = new HashMap<>();
 | 
		
	
		
			
				|  |  |  |  | //											clause2.put("object_name", queryid);
 | 
		
	
		
			
				|  |  |  |  | //											List<TCComponent> deleteResourceresult2 = TCUtil.queryBOMStructObject2(session,stationline,"queryItem",clause2);
 | 
		
	
		
			
				|  |  |  |  | //											if(deleteResourceresult2 != null)
 | 
		
	
		
			
				|  |  |  |  | //											for(TCComponent resourceline:deleteResourceresult2) {
 | 
		
	
		
			
				|  |  |  |  | //												if(resourceline instanceof TCComponentBOMLine) {
 | 
		
	
		
			
				|  |  |  |  | //													TCComponentBOMLine rs = (TCComponentBOMLine) resourceline;
 | 
		
	
		
			
				|  |  |  |  | //													rs.cut();
 | 
		
	
		
			
				|  |  |  |  | //												}
 | 
		
	
		
			
				|  |  |  |  | //												
 | 
		
	
		
			
				|  |  |  |  | //											}
 | 
		
	
		
			
				|  |  |  |  | //										}
 | 
		
	
		
			
				|  |  |  |  | 										if(stationline instanceof TCComponentBOMLine) { | 
		
	
		
			
				|  |  |  |  | 											TCComponentBOMLine station = (TCComponentBOMLine) stationline; | 
		
	
		
			
				|  |  |  |  | 											for(String pipei_resource:pipei_resource_map.keySet()) { | 
		
	
		
			
				|  |  |  |  | 												 | 
		
	
		
			
				|  |  |  |  | 												//要放的资源到工序下
 | 
		
	
		
			
				|  |  |  |  | 												if(pipei_resource == null || pipei_resource.length() == 0) | 
		
	
		
			
				|  |  |  |  | 													continue; | 
		
	
		
			
				|  |  |  |  | 												//先判断工位下是否有此名称的资源,有的直接拿来用
 | 
		
	
		
			
				|  |  |  |  | 												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) { | 
		
	
		
			
				|  |  |  |  | 													TCUtil.connectObject(session, Resourceresult2.get(0), (TCComponent)op, "MEResource"); | 
		
	
		
			
				|  |  |  |  | 												} | 
		
	
		
			
				|  |  |  |  | 												else { | 
		
	
		
			
				|  |  |  |  | 													Map<String,String> clause22 = new HashMap<>(); | 
		
	
		
			
				|  |  |  |  | 													clause22.put("object_name", pipei_resource); | 
		
	
		
			
				|  |  |  |  | 													TCComponent[] query_items = TCUtil.Generalquery2(session, "queryItem", clause22); | 
		
	
		
			
				|  |  |  |  | 													if(query_items != null && query_items.length > 0) { | 
		
	
		
			
				|  |  |  |  | 														 | 
		
	
		
			
				|  |  |  |  | 														TCComponentBOMLine newResourceline = station.add((TCComponentItem) query_items[0],null, null, false); | 
		
	
		
			
				|  |  |  |  | 														TCUtil.connectObject(session, newResourceline, (TCComponent)op, "MEResource"); | 
		
	
		
			
				|  |  |  |  | 													} | 
		
	
		
			
				|  |  |  |  | 													else { | 
		
	
		
			
				|  |  |  |  | 														//创建新的item
 | 
		
	
		
			
				|  |  |  |  | 														TCComponentItem item = TCUtil.createItem(session, "", "A", "Item", pipei_resource); | 
		
	
		
			
				|  |  |  |  | 														TCComponentBOMLine newResourceline = station.add(item,null, null, false); | 
		
	
		
			
				|  |  |  |  | 														TCUtil.connectObject(session, newResourceline, (TCComponent)op, "MEResource"); | 
		
	
		
			
				|  |  |  |  | 														String[] split = pipei_resource.split("\\+",-1); | 
		
	
		
			
				|  |  |  |  | 														Map<String,String> clause2 = new HashMap<>(); | 
		
	
		
			
				|  |  |  |  | 														 | 
		
	
		
			
				|  |  |  |  | 														for(String split_value:split) { | 
		
	
		
			
				|  |  |  |  | 															clause2.clear(); | 
		
	
		
			
				|  |  |  |  | 															clause2.put("object_name", split_value); | 
		
	
		
			
				|  |  |  |  | 															TCComponent[] tool_resource = TCUtil.Generalquery2(session, "queryItem", clause); | 
		
	
		
			
				|  |  |  |  | 															if(tool_resource != null && tool_resource.length > 0) { | 
		
	
		
			
				|  |  |  |  | 																newResourceline.add((TCComponentItem) tool_resource[0],null, null, false); | 
		
	
		
			
				|  |  |  |  | 															} | 
		
	
		
			
				|  |  |  |  | 															 | 
		
	
		
			
				|  |  |  |  | 														} | 
		
	
		
			
				|  |  |  |  | 														 | 
		
	
		
			
				|  |  |  |  | 														 | 
		
	
		
			
				|  |  |  |  | 													} | 
		
	
		
			
				|  |  |  |  | 												} | 
		
	
		
			
				|  |  |  |  | 												 | 
		
	
		
			
				|  |  |  |  | 											} | 
		
	
		
			
				|  |  |  |  | 										} | 
		
	
		
			
				|  |  |  |  | 										 | 
		
	
		
			
				|  |  |  |  | 									} | 
		
	
		
			
				|  |  |  |  | 								} | 
		
	
		
			
				|  |  |  |  | 								 | 
		
	
		
			
				|  |  |  |  | 							} | 
		
	
		
			
				|  |  |  |  | 							 | 
		
	
		
			
				|  |  |  |  | 							 | 
		
	
		
			
				|  |  |  |  | 						} | 
		
	
		
			
				|  |  |  |  | 					} | 
		
	
		
			
				|  |  |  |  | 					idmap.clear(); | 
		
	
		
			
				|  |  |  |  | 				} | 
		
	
		
			
				|  |  |  |  | 				//
 | 
		
	
		
			
				|  |  |  |  | 			} | 
		
	
		
			
				|  |  |  |  | 			else if(childcom instanceof TCComponentMfgBvrProcessStation || childcom instanceof TCComponentMfgBvrProcessLine | 
		
	
		
			
				|  |  |  |  | 					|| childcom instanceof TCComponentMfgBvrPlantBOP) { | 
		
	
		
			
				|  |  |  |  | 				 | 
		
	
		
			
				|  |  |  |  | 				opBOMLineData(childcom,sheet); | 
		
	
		
			
				|  |  |  |  | 			} | 
		
	
		
			
				|  |  |  |  | 			 | 
		
	
	
		
			
				
					|  |  |  | @ -1279,12 +1433,20 @@ public class AutoTransToolDialog extends AbstractAIFDialog { | 
		
	
		
			
				|  |  |  |  |     		            } | 
		
	
		
			
				|  |  |  |  |     		        } | 
		
	
		
			
				|  |  |  |  |     				if(found) { | 
		
	
		
			
				|  |  |  |  |     					TCComponentMfgBvrOperation oldop = op_nodesignmap.get(haskey); | 
		
	
		
			
				|  |  |  |  |     					AIFComponentContext[] design_children = op.getChildren(); | 
		
	
		
			
				|  |  |  |  |     					boolean hasdesign = false; | 
		
	
		
			
				|  |  |  |  |     					Map<String,String> idmap = new HashMap<>(); | 
		
	
		
			
				|  |  |  |  |     					Map<String,String> pipei_resource_map = new HashMap<>(); | 
		
	
		
			
				|  |  |  |  | //    					Map<String,List<InterfaceAIFComponent>> resource_map = new HashMap<>();//工序下挂接的资源
 | 
		
	
		
			
				|  |  |  |  |     					for(AIFComponentContext designchild:design_children) { | 
		
	
		
			
				|  |  |  |  |     						InterfaceAIFComponent designchildcom = designchild.getComponent(); | 
		
	
		
			
				|  |  |  |  |     						String bl_item_object_type = designchildcom.getProperty("bl_item_object_type"); | 
		
	
		
			
				|  |  |  |  |     						String bl_occ_type = designchildcom.getProperty("bl_occ_type"); | 
		
	
		
			
				|  |  |  |  | //    						if("MEResource".equalsIgnoreCase(bl_occ_type)) {
 | 
		
	
		
			
				|  |  |  |  | //    							String Resource_name = designchildcom.getProperty("bl_rev_object_name");
 | 
		
	
		
			
				|  |  |  |  | //    							resource_map.computeIfAbsent(Resource_name, key2 -> new ArrayList<>()).add(designchildcom);
 | 
		
	
		
			
				|  |  |  |  | //    						}
 | 
		
	
		
			
				|  |  |  |  |     						if("Design Part".equalsIgnoreCase(bl_item_object_type)) { | 
		
	
		
			
				|  |  |  |  |     							hasdesign = true; | 
		
	
		
			
				|  |  |  |  |     							//获取符合的数据
 | 
		
	
	
		
			
				
					|  |  |  | @ -1910,17 +2072,18 @@ public class AutoTransToolDialog extends AbstractAIFDialog { | 
		
	
		
			
				|  |  |  |  |     								System.out.println("匹配标准件designid:"+designid); | 
		
	
		
			
				|  |  |  |  |     								if(StandardPartMap.containsKey(designid)) { | 
		
	
		
			
				|  |  |  |  |     									StandardPartBean stdbean = StandardPartMap.get(designid); | 
		
	
		
			
				|  |  |  |  |     									String headform = stdbean.getHeadform(); | 
		
	
		
			
				|  |  |  |  | //    									String headform = stdbean.getHeadform();
 | 
		
	
		
			
				|  |  |  |  |     									String headsize = stdbean.getHeadsize(); | 
		
	
		
			
				|  |  |  |  |     									Cell headform_cell = row.createCell(6); | 
		
	
		
			
				|  |  |  |  |     									headform_cell.setCellValue(headform); | 
		
	
		
			
				|  |  |  |  |     									Cell headsize_cell = row.createCell(7); | 
		
	
		
			
				|  |  |  |  | //    									Cell headform_cell = row.createCell(6);
 | 
		
	
		
			
				|  |  |  |  | //    									headform_cell.setCellValue(headform);
 | 
		
	
		
			
				|  |  |  |  |     									Cell headsize_cell = row.createCell(6); | 
		
	
		
			
				|  |  |  |  |     									headsize_cell.setCellValue(headsize); | 
		
	
		
			
				|  |  |  |  |     									String key2 = headsize+"|"+headform; | 
		
	
		
			
				|  |  |  |  | //    									String key2 = headsize+"|"+headform;
 | 
		
	
		
			
				|  |  |  |  |     									String key2 = headsize; | 
		
	
		
			
				|  |  |  |  |     									System.out.println("寻找套筒  头部尺寸|头部形式:"+key2); | 
		
	
		
			
				|  |  |  |  |     									if(SleeveMap.containsKey(key2)) { | 
		
	
		
			
				|  |  |  |  |     										System.out.println("找到匹配"); | 
		
	
		
			
				|  |  |  |  |     										Cell all_cell = row.createCell(8); | 
		
	
		
			
				|  |  |  |  |     										Cell all_cell = row.createCell(7); | 
		
	
		
			
				|  |  |  |  |     										String all = ""; | 
		
	
		
			
				|  |  |  |  |     										List<SleeveBean> SleeveBeans = SleeveMap.get(key2); | 
		
	
		
			
				|  |  |  |  |     										for(SleeveBean sleevebean:SleeveBeans) { | 
		
	
	
		
			
				
					|  |  |  | @ -1944,14 +2107,14 @@ public class AutoTransToolDialog extends AbstractAIFDialog { | 
		
	
		
			
				|  |  |  |  |     														if(outsize.equals(inputsize)) { | 
		
	
		
			
				|  |  |  |  |     															System.out.println("工具匹配上套筒,工具的输出尺寸:"+outsize+" 套筒输入尺寸:"+inputsize+" 长度:"+length +" 资源类型:"+resourceType); | 
		
	
		
			
				|  |  |  |  |     															has = true; | 
		
	
		
			
				|  |  |  |  |     															all = all+resourcetype+"-"+resourceType; | 
		
	
		
			
				|  |  |  |  |     															all = all+resourcetype+"+"+resourceType; | 
		
	
		
			
				|  |  |  |  |     															break; | 
		
	
		
			
				|  |  |  |  |     														} | 
		
	
		
			
				|  |  |  |  |     													} | 
		
	
		
			
				|  |  |  |  |     													else if((outsize == null || outsize.length() == 0) && (inputsize == null || inputsize.length() == 0)){  | 
		
	
		
			
				|  |  |  |  |     														System.out.println("工具匹配上套筒,工具的输出尺寸:"+outsize+" 套筒输入尺寸:"+inputsize+" 长度:"+length +" 资源类型:"+resourceType); | 
		
	
		
			
				|  |  |  |  |     														 | 
		
	
		
			
				|  |  |  |  |     														all = all+resourcetype+"-"+resourceType; | 
		
	
		
			
				|  |  |  |  |     														all = all+resourcetype+"+"+resourceType; | 
		
	
		
			
				|  |  |  |  |     														has = true; | 
		
	
		
			
				|  |  |  |  |     														break; | 
		
	
		
			
				|  |  |  |  |     													} | 
		
	
	
		
			
				
					|  |  |  | @ -1968,6 +2131,10 @@ public class AutoTransToolDialog extends AbstractAIFDialog { | 
		
	
		
			
				|  |  |  |  |     											} | 
		
	
		
			
				|  |  |  |  |     										} | 
		
	
		
			
				|  |  |  |  |     										all_cell.setCellValue(all); | 
		
	
		
			
				|  |  |  |  |     										if(all != null && all.length() > 0) { | 
		
	
		
			
				|  |  |  |  |     											if(!pipei_resource_map.containsKey(all)) | 
		
	
		
			
				|  |  |  |  |     												pipei_resource_map.put(all, all); | 
		
	
		
			
				|  |  |  |  |     										} | 
		
	
		
			
				|  |  |  |  |     									} | 
		
	
		
			
				|  |  |  |  |     									else | 
		
	
		
			
				|  |  |  |  |     										System.out.println("没有找到匹配"); | 
		
	
	
		
			
				
					|  |  |  | @ -1985,6 +2152,126 @@ public class AutoTransToolDialog extends AbstractAIFDialog { | 
		
	
		
			
				|  |  |  |  |     						op_nodesignmap.remove(haskey); | 
		
	
		
			
				|  |  |  |  |     						 | 
		
	
		
			
				|  |  |  |  |     					} | 
		
	
		
			
				|  |  |  |  |     					else { | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     						 | 
		
	
		
			
				|  |  |  |  |     						 | 
		
	
		
			
				|  |  |  |  | //    						List<String> newresources = new ArrayList<>();
 | 
		
	
		
			
				|  |  |  |  | //    						for(String pipei_resource:pipei_resource_map.keySet()) {
 | 
		
	
		
			
				|  |  |  |  | //    							if(resource_map.containsKey(pipei_resource)) {
 | 
		
	
		
			
				|  |  |  |  | //    								resource_map.remove(pipei_resource);
 | 
		
	
		
			
				|  |  |  |  | //    							}
 | 
		
	
		
			
				|  |  |  |  | //    							else {
 | 
		
	
		
			
				|  |  |  |  | //    								newresources.add(pipei_resource);
 | 
		
	
		
			
				|  |  |  |  | //    							}
 | 
		
	
		
			
				|  |  |  |  | //    						}
 | 
		
	
		
			
				|  |  |  |  |     						//将不能存在的资源移除掉
 | 
		
	
		
			
				|  |  |  |  | //    						String resourceids = "";
 | 
		
	
		
			
				|  |  |  |  | //    						for(String pipei_resource:resource_map.keySet()) {
 | 
		
	
		
			
				|  |  |  |  | //    							List<InterfaceAIFComponent> bomline = resource_map.get(pipei_resource);
 | 
		
	
		
			
				|  |  |  |  | //    							for(InterfaceAIFComponent com:bomline) {
 | 
		
	
		
			
				|  |  |  |  | //    								if(com != null && com instanceof TCComponentBOMLine) {
 | 
		
	
		
			
				|  |  |  |  | //    									TCComponentBOMLine line = (TCComponentBOMLine) com;
 | 
		
	
		
			
				|  |  |  |  | //    									String resourceid = line.getProperty("bl_item_item_id");
 | 
		
	
		
			
				|  |  |  |  | //    									resourceids = resourceids +resourceid+";";
 | 
		
	
		
			
				|  |  |  |  | //    									line.cut();
 | 
		
	
		
			
				|  |  |  |  | //    								}
 | 
		
	
		
			
				|  |  |  |  | //    							}
 | 
		
	
		
			
				|  |  |  |  | //    							
 | 
		
	
		
			
				|  |  |  |  | //    						}
 | 
		
	
		
			
				|  |  |  |  | //    						if(resourceids.endsWith(";")) {
 | 
		
	
		
			
				|  |  |  |  | //    							resourceids = resourceids.substring(0,resourceids.length() - 1);
 | 
		
	
		
			
				|  |  |  |  | //    						}
 | 
		
	
		
			
				|  |  |  |  |     						((TCComponentMfgBvrOperation) childcom).window().save(); | 
		
	
		
			
				|  |  |  |  |     						//获取工位
 | 
		
	
		
			
				|  |  |  |  |     						System.out.println(childcom+"获取工位"); | 
		
	
		
			
				|  |  |  |  |     						List<TCComponent> result = getStation((TCComponentBOMLine)childcom); | 
		
	
		
			
				|  |  |  |  |     						if(result.size() > 0) { | 
		
	
		
			
				|  |  |  |  |     							String queryid = ""; | 
		
	
		
			
				|  |  |  |  |     							for(TCComponent station:result) { | 
		
	
		
			
				|  |  |  |  |     								String stationid = station.getProperty("bl_item_item_id"); | 
		
	
		
			
				|  |  |  |  |     								queryid = queryid + stationid+";"; | 
		
	
		
			
				|  |  |  |  |     							} | 
		
	
		
			
				|  |  |  |  |     							if(queryid.endsWith(";")) { | 
		
	
		
			
				|  |  |  |  |     								queryid = queryid.substring(0, queryid.length()-1); | 
		
	
		
			
				|  |  |  |  |     							} | 
		
	
		
			
				|  |  |  |  |     							if(workline != null) { | 
		
	
		
			
				|  |  |  |  |     								Map<String,String> clause = new HashMap<>(); | 
		
	
		
			
				|  |  |  |  |     								clause.put("item_id", queryid); | 
		
	
		
			
				|  |  |  |  |     								 | 
		
	
		
			
				|  |  |  |  |     								List<TCComponent> result2 = TCUtil.queryBOMStructObject(session,workline,"queryItem",clause); | 
		
	
		
			
				|  |  |  |  |     								if(result2 != null) { | 
		
	
		
			
				|  |  |  |  |     									for(TCComponent stationline:result2) { | 
		
	
		
			
				|  |  |  |  |     										//工位下先去除资源
 | 
		
	
		
			
				|  |  |  |  | //    										if(queryid.length() > 0) {
 | 
		
	
		
			
				|  |  |  |  | //    											Map<String,String> clause2 = new HashMap<>();
 | 
		
	
		
			
				|  |  |  |  | //    											clause2.put("object_name", queryid);
 | 
		
	
		
			
				|  |  |  |  | //    											List<TCComponent> deleteResourceresult2 = TCUtil.queryBOMStructObject2(session,stationline,"queryItem",clause2);
 | 
		
	
		
			
				|  |  |  |  | //    											if(deleteResourceresult2 != null)
 | 
		
	
		
			
				|  |  |  |  | //    											for(TCComponent resourceline:deleteResourceresult2) {
 | 
		
	
		
			
				|  |  |  |  | //    												if(resourceline instanceof TCComponentBOMLine) {
 | 
		
	
		
			
				|  |  |  |  | //    													TCComponentBOMLine rs = (TCComponentBOMLine) resourceline;
 | 
		
	
		
			
				|  |  |  |  | //    													rs.cut();
 | 
		
	
		
			
				|  |  |  |  | //    												}
 | 
		
	
		
			
				|  |  |  |  | //    												
 | 
		
	
		
			
				|  |  |  |  | //    											}
 | 
		
	
		
			
				|  |  |  |  | //    										}
 | 
		
	
		
			
				|  |  |  |  |     										if(stationline instanceof TCComponentBOMLine) { | 
		
	
		
			
				|  |  |  |  |     											TCComponentBOMLine station = (TCComponentBOMLine) stationline; | 
		
	
		
			
				|  |  |  |  |     											for(String pipei_resource:pipei_resource_map.keySet()) { | 
		
	
		
			
				|  |  |  |  |     												 | 
		
	
		
			
				|  |  |  |  |     												//要放的资源到工序下
 | 
		
	
		
			
				|  |  |  |  |     												if(pipei_resource == null || pipei_resource.length() == 0) | 
		
	
		
			
				|  |  |  |  |     													continue; | 
		
	
		
			
				|  |  |  |  |     												//先判断工位下是否有此名称的资源,有的直接拿来用
 | 
		
	
		
			
				|  |  |  |  |     												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) { | 
		
	
		
			
				|  |  |  |  |     													TCUtil.connectObject(session, Resourceresult2.get(0), (TCComponent)oldop, "MEResource"); | 
		
	
		
			
				|  |  |  |  |     												} | 
		
	
		
			
				|  |  |  |  |     												else { | 
		
	
		
			
				|  |  |  |  |     													Map<String,String> clause22 = new HashMap<>(); | 
		
	
		
			
				|  |  |  |  |     													clause22.put("object_name", pipei_resource); | 
		
	
		
			
				|  |  |  |  |     													TCComponent[] query_items = TCUtil.Generalquery2(session, "queryItem", clause22); | 
		
	
		
			
				|  |  |  |  |     													if(query_items != null && query_items.length > 0) { | 
		
	
		
			
				|  |  |  |  |     														 | 
		
	
		
			
				|  |  |  |  |     														TCComponentBOMLine newResourceline = station.add((TCComponentItem) query_items[0],null, null, false); | 
		
	
		
			
				|  |  |  |  |     														TCUtil.connectObject(session, newResourceline, (TCComponent)oldop, "MEResource"); | 
		
	
		
			
				|  |  |  |  |     													} | 
		
	
		
			
				|  |  |  |  |     													else { | 
		
	
		
			
				|  |  |  |  |     														//创建新的item
 | 
		
	
		
			
				|  |  |  |  |     														TCComponentItem item = TCUtil.createItem(session, "", "A", "Item", pipei_resource); | 
		
	
		
			
				|  |  |  |  |     														TCComponentBOMLine newResourceline = station.add(item,null, null, false); | 
		
	
		
			
				|  |  |  |  |     														TCUtil.connectObject(session, newResourceline, (TCComponent)oldop, "MEResource"); | 
		
	
		
			
				|  |  |  |  |     														String[] split = pipei_resource.split("\\+",-1); | 
		
	
		
			
				|  |  |  |  |     														Map<String,String> clause2 = new HashMap<>(); | 
		
	
		
			
				|  |  |  |  |     														 | 
		
	
		
			
				|  |  |  |  |     														for(String split_value:split) { | 
		
	
		
			
				|  |  |  |  |     															clause2.clear(); | 
		
	
		
			
				|  |  |  |  |     															clause2.put("object_name", split_value); | 
		
	
		
			
				|  |  |  |  |     															TCComponent[] tool_resource = TCUtil.Generalquery2(session, "queryItem", clause); | 
		
	
		
			
				|  |  |  |  |     															if(tool_resource != null && tool_resource.length > 0) { | 
		
	
		
			
				|  |  |  |  |     																newResourceline.add((TCComponentItem) tool_resource[0],null, null, false); | 
		
	
		
			
				|  |  |  |  |     															} | 
		
	
		
			
				|  |  |  |  |     															 | 
		
	
		
			
				|  |  |  |  |     														} | 
		
	
		
			
				|  |  |  |  |     														 | 
		
	
		
			
				|  |  |  |  |     														 | 
		
	
		
			
				|  |  |  |  |     													} | 
		
	
		
			
				|  |  |  |  |     												} | 
		
	
		
			
				|  |  |  |  |     												 | 
		
	
		
			
				|  |  |  |  |     											} | 
		
	
		
			
				|  |  |  |  |     										} | 
		
	
		
			
				|  |  |  |  |     										 | 
		
	
		
			
				|  |  |  |  |     									} | 
		
	
		
			
				|  |  |  |  |     								} | 
		
	
		
			
				|  |  |  |  |     								 | 
		
	
		
			
				|  |  |  |  |     							} | 
		
	
		
			
				|  |  |  |  |     							 | 
		
	
		
			
				|  |  |  |  |     							 | 
		
	
		
			
				|  |  |  |  |     						} | 
		
	
		
			
				|  |  |  |  |     					} | 
		
	
		
			
				|  |  |  |  |     					idmap.clear(); | 
		
	
		
			
				|  |  |  |  |     				} | 
		
	
		
			
				|  |  |  |  |     				 | 
		
	
	
		
			
				
					|  |  |  | @ -2458,7 +2745,7 @@ public class AutoTransToolDialog extends AbstractAIFDialog { | 
		
	
		
			
				|  |  |  |  | 					tool.setInputSize(inputSize); | 
		
	
		
			
				|  |  |  |  | 					tool.setOutSize(outSize); | 
		
	
		
			
				|  |  |  |  | 					 | 
		
	
		
			
				|  |  |  |  | 					SleeveMap.computeIfAbsent(outSize+"|"+headform, key -> new ArrayList<>()).add(tool); | 
		
	
		
			
				|  |  |  |  | 					SleeveMap.computeIfAbsent(outSize, key -> new ArrayList<>()).add(tool); | 
		
	
		
			
				|  |  |  |  | 					 | 
		
	
		
			
				|  |  |  |  | 				} | 
		
	
		
			
				|  |  |  |  | 				else { | 
		
	
	
		
			
				
					|  |  |  | @ -2474,4 +2761,22 @@ public class AutoTransToolDialog extends AbstractAIFDialog { | 
		
	
		
			
				|  |  |  |  | 			e.printStackTrace(); | 
		
	
		
			
				|  |  |  |  | 		} | 
		
	
		
			
				|  |  |  |  | 	} | 
		
	
		
			
				|  |  |  |  | 	private List<TCComponent> getStation(TCComponentBOMLine child){ | 
		
	
		
			
				|  |  |  |  | 		List<TCComponent> result = null; | 
		
	
		
			
				|  |  |  |  | 		Map<String,String> clause = new HashMap<>(); | 
		
	
		
			
				|  |  |  |  | 		clause.put("object_type", "MEStation"); | 
		
	
		
			
				|  |  |  |  | 		try { | 
		
	
		
			
				|  |  |  |  | 			result = TCUtil.queryBOMStructObject2(session,child,"queryItem",clause); | 
		
	
		
			
				|  |  |  |  | 			if((result == null || result.size() == 0 )&& child.parent() != null) { | 
		
	
		
			
				|  |  |  |  | 				result = getStation(child.parent()); | 
		
	
		
			
				|  |  |  |  | 			} | 
		
	
		
			
				|  |  |  |  | 		} catch (ServiceException e) { | 
		
	
		
			
				|  |  |  |  | 			// TODO Auto-generated catch block
 | 
		
	
		
			
				|  |  |  |  | 			e.printStackTrace(); | 
		
	
		
			
				|  |  |  |  | 		} catch (TCException e) { | 
		
	
		
			
				|  |  |  |  | 			// TODO Auto-generated catch block
 | 
		
	
		
			
				|  |  |  |  | 			e.printStackTrace(); | 
		
	
		
			
				|  |  |  |  | 		} | 
		
	
		
			
				|  |  |  |  | 		return result; | 
		
	
		
			
				|  |  |  |  | 	} | 
		
	
		
			
				|  |  |  |  | } | 
		
	
	
		
			
				
					|  |  |  | 
 |