CAA Web Services Home

 

Source code for  CAAENOVWSProdStructConfigCppUseCaseCar

Use Case Source code dot net example

Methods

List of method in CAAENOVWSProdStructConfigCppUseCaseCar.

To go back to Consuming the ENOVWSProdStructConfigCpp CAA Web Service

 

// COPYRIGHT DASSAULT SYSTEMES 2006
// ============================================================================
// This class provides a sample use case scenario that illustrates the 
// ENOVWSChgMgmtCpp CAA Web service.
// ============================================================================
using System;
using System.Net;
using System.Text;
using enoposapplicationbinderimpl = com.dassault_systemes.caaplmsecurity.caaenoposappbinderdotnet1_1clientbase.enoposapplicationbinderimpl;
using enovwsquerycpp = com.dassault_systemes.caaenovws.caaenovwsdotnet1_1clientbase.enovwsquerycpp;
using enovwschgmgmtcpp = com.dassault_systemes.caaenovws.caaenovwsdotnet1_1clientbase.enovwschgmgmtcpp;
using enovwscntmgmtcpp = com.dassault_systemes.caaenovws.caaenovwsdotnet1_1clientbase.enovwscntmgmtcpp;
using enovwsprodstructcpp = com.dassault_systemes.caaenovws.caaenovwsdotnet1_1clientbase.enovwsprodstructcpp;
using enovwsprodstructconfigcpp = com.dassault_systemes.caaenovws.caaenovwsdotnet1_1clientbase.enovwsprodstructconfigcpp;
using com.dassault_systemes.caaenovws.caaenovwsdotnet1_1clientbase;
namespace com.dassault_systemes.caaenovws.caaenovwsdotnet1_1client 
{
	/// <summary>
	/// Class to demonstrate a sample usage scenario of the ENOVWSChgMgmtCpp CAA Web service.
	/// </summary>
	public class CAAENOVWSProdStructConfigCppUseCaseCar 
	{
		private String uKey = null;
		private String carPRC = null;
		
		//Unique identification (UUID) 
		//CPV = configured part version
		//PV unconfigured part version
		//II Item instance
		private String exhaustCPV = null;
		private String rearWDPV = null;	
		private String frontWDPV = null;
		private String allWDPV = null;
		private String fourWDPV = null;
		private String tailSmallPV = null;	
		private String tailLargePV = null;
		//document	
		private String ownerManualDOC = null;
	
		//item instance uuid
		private String exhaustCII = null;	
		private String rearWDII = null;	
		private String frontWDII = null;
		private String tailSmallII = null;	
		private String tailLargeII = null;
	
		//mods UUIDs
		private String rearWDMod = null;
		private String frontWDMod = null;
		private String allWDMod = null;
		private String fourWDMod = null;
		private String exhaustMod = null;
		private String tailSmallMod = null;	
		private String tailLargeMod = null;
		//configHandler UUIDs
		private String carConfgHUnit1 = null;
		private String carConfgHUnit40 = null;
		private String carConfgHUnit51 = null;
		private String carConfgHUnit80 = null;
		private String carConfgHUnit91 = null;	 
	
		//-V_ID of the parts.
		private	String rearWDPV_ID = null;
		private	String frontWDPV_ID = null;
		private String allWDPV_ID = null;
		private String fourWDPV_ID = null;
		private String tailSmallPV_ID = null;
		private String tailLargePV_ID = null;
		private String exhaustCPV_ID = null;
		private String carAction1 = null;
	
		public CAAENOVWSProdStructConfigCppUseCaseCar(String prc, String key) 
		{
			this.carPRC = prc;
			this.uKey = "-" + key;
					
			this.rearWDPV_ID = "rearWDPV" +uKey;
			this.frontWDPV_ID = "frontWDPV" +uKey;
			this.allWDPV_ID = "allWDPV" +uKey;
			this.fourWDPV_ID = "fourWDPV" +uKey;
			this.tailSmallPV_ID = "tailSmallPV" +uKey;
			this.tailLargePV_ID = "tailLargePV" +uKey;
			this.exhaustCPV_ID = "exhaustCPV" +uKey;
		}
		public String GetCarPRC()
		{
			return carPRC;
		}
		public String GetExhaustCII()
		{
			return exhaustCII;
		}	
		/// <summary>
		/// creatPartVersionObjects
		///		Create a configured PV : Exhaust
		///		Create the following un-configured PV:
		///			Rear Wheel Drive, Front Wheel Drive, All Wheel Drive,Four Wheel Drive,Tail Small,Tail Large
		/// </summary>
		public void CreatPartVersionObjects(enovwsprodstructcpp.CAAENOVWSProdStructCppWrapper psWrapper)  
		{
			Console.Out.WriteLine("->create car parts.");
			bool success = false;
			Exception exception = null;
			try {			
				//create configured PV Exhaust
				String envDomain = "PRODUCT";
				String configurable = "TRUE";
				String[] partNumbers = { exhaustCPV_ID};
				enovwsprodstructcpp.ENOVIA createPartRefResultSet = psWrapper.CreatePartRef(partNumbers,envDomain, configurable);
				String[] partRefUUIDs = psWrapper.GetENOVIA_VPMPartVersionUUIDs(createPartRefResultSet);
				if (partRefUUIDs.Length != 1) {
					throw new Exception("Failed to create the just 1 part references");
				}
				exhaustCPV = partRefUUIDs[0];
				//create unconfigured PVs
				configurable = "FALSE";
				String[] partCollection_ID = { rearWDPV_ID,frontWDPV_ID,allWDPV_ID,fourWDPV_ID,tailSmallPV_ID,tailLargePV_ID};
            
				enovwsprodstructcpp.ENOVIA createPartRefResultSetB = psWrapper.CreatePartRef(partCollection_ID,envDomain, configurable);
				String[] partRefUUIDsB = psWrapper.GetENOVIA_VPMPartVersionUUIDs(createPartRefResultSetB);
				if (partRefUUIDsB.Length != 6) {
					throw new Exception("Failed to create the just 6 part references");
				}
				rearWDPV = partRefUUIDsB[0];
				frontWDPV = partRefUUIDsB[1];
				allWDPV = partRefUUIDsB[2];
				fourWDPV = partRefUUIDsB[3];
				tailSmallPV = partRefUUIDsB[4];
				tailLargePV = partRefUUIDsB[5];
				
				success = true;	
			} catch (Exception e) {
				exception = e;
			}
			if (success)
				Console.Out.WriteLine("create car parts.- sucess.");	
			else
				throw new Exception("create car parts. - failure.");		
			
		}//[Top]
		/// <summary>
		/// Create car owner manual document
		/// </summary>
		public void CreatDocumentObjects(enovwscntmgmtcpp.CAAENOVWSCntMgmtCppWrapper cntWrapper) 
		{
			Console.Out.WriteLine("->create a document CAR owner manual.");
			bool success = false;
			Exception exception = null;
			
			try {
				String docId = "PSCWSDoc"+uKey;
				String docName = "carOwnerManual"+uKey;
				String domain = "DOCDIR";			
				enovwscntmgmtcpp.ENOVIA createDocResultSet1 = cntWrapper.CreateDocument(docId,docName,domain);
				String[] docUUIDs1 = cntWrapper.GetENOVIA_VPMDocumentRevisionUUIDs(createDocResultSet1);
				if (docUUIDs1.Length != 1) {
					throw new Exception("Failed to create the 1 document");
				}		
				ownerManualDOC = docUUIDs1[0];
				success = true;
			} catch (Exception e) {
				exception = e;
 			}
 			if (success)
				Console.Out.WriteLine("create a document CAR - sucess.");	
			else
				throw new Exception("create a document CAR - failure.");				
		}//[Top]
		/// <summary>
		/// buildProdStruct as follows
		///		- Add Child Part Service on	Exhaust
		///		  Pass in the following parts: Tail Small, Tail Large
		/// </summary>
		public void BuildProdStructExhaust(enovwsprodstructcpp.CAAENOVWSProdStructCppWrapper psWrapper) 
		{
			Console.Out.WriteLine("->BuildProdStructExhaust:");
			Exception exception = null;
			bool success = false;
			
			try {			
				//add Child Part Service on	Exhaust
				String[] partRefUUIDs2 = {tailSmallPV,tailLargePV};
				enovwsprodstructcpp.ENOVIA createPartInstResultSet2 = psWrapper.CreatePartInst(exhaustCII, partRefUUIDs2);
				String[] vpmBOPartInstanceUUIDArray2 = psWrapper.GetVPMBOPartInstanceUUIDs(createPartInstResultSet2);
				if (vpmBOPartInstanceUUIDArray2.Length != 2) {
					throw new Exception("Failed to create just the 2 part instances on the Exhaust");
				}
				tailSmallII = vpmBOPartInstanceUUIDArray2[0];
				tailLargeII = vpmBOPartInstanceUUIDArray2[1];
							
				success = true;
			} catch (Exception e) {
				exception = e;;
			}
			if (success)
				Console.Out.WriteLine("buildProdStruct - sucess.");	
			else
				throw new Exception("buildProdStruct - failure.");		
		}//[Top]
		/// <summary>
		/// buildProdStruct as follows
		///		- Add Child Part Service on CAR
		///		  Pass in the following parts: 
		///		  Rear Wheel Drive
		///		  Front Wheel Drive
		///		  TExhaust
		/// </summary>
		public void BuildProdStructCAR(enovwsprodstructcpp.CAAENOVWSProdStructCppWrapper psWrapper) 
		{
			Console.Out.WriteLine("->BuildProdStructCAR.");
			Exception exception = null;
			bool success = false;
			
			try {			
				// Add Child Parts on CAR 
				String[] partRefUUIDs1 = {rearWDPV,frontWDPV,exhaustCPV};
				enovwsprodstructcpp.ENOVIA createPartInstResultSet1 = psWrapper.CreatePartInst(carPRC, partRefUUIDs1);
				String[] vpmBOPartInstanceUUIDArray1 = psWrapper.GetVPMBOPartInstanceUUIDs(createPartInstResultSet1);
				if (vpmBOPartInstanceUUIDArray1.Length != 3) {
					throw new Exception("Failed to create just the 3 part instances on the Car");
				}
				rearWDII = vpmBOPartInstanceUUIDArray1[0];
				frontWDII = vpmBOPartInstanceUUIDArray1[1];
				exhaustCII = vpmBOPartInstanceUUIDArray1[2];
				success = true;
			} catch (Exception e) {
				exception = e;
			}
			if (success)
				Console.Out.WriteLine("buildProdStruct - sucess.");	
			else
				throw new Exception("buildProdStruct - failure.");		
		}//[Top]
		/// <summary>
		/// Create the following mods using Create Mod Service on CAR  configured object 
		///		Rear Wheel Drive(Engineering;unit 1-50)
		///		Front Wheel Drive(Engineering; unit 51-100 
		///		All Wheel Drive (Engineering; unit 35-50)
		///		Four Wheel Drive (Engineering unit 80-90)
		///		Exhaust(Engineering;unit 1-100)
		/// </summary>
		public void CreatModsForCar(enovwsprodstructconfigcpp.CAAENOVWSProdStructConfigCppWrapper pscWrapper)
			{
				Console.Out.WriteLine("->CreatModsForCar");
				bool success = false;
				Exception exception = null;
				try {
										
					String rearWheel_MOD = "MODRear Wheel"+uKey;
					String frontWheel_MOD = "MODFront Wheel"+uKey;
					String allWheel_MOD = "MODAll Wheel"+uKey;
					String fourWheel_MOD = "MODFour Wheel"+uKey;
					String exhaust_MOD = "exhaustMod"+uKey;				
						
					Console.Out.WriteLine("Creating Mod - Rear Wheel Drive(Engineering;unit 1-50) ");
					String iRearWheelExp = CAAENOVWSUtils.crtModConfigExp (rearWheel_MOD,"Engineering Effectivity","1","50");
					enovwsprodstructconfigcpp.ENOVIA rearWheelResultSet = pscWrapper.CreateModification(carPRC, iRearWheelExp);
					rearWDMod =  pscWrapper.GetENOVIA_EFF_MOD_UUID(rearWheelResultSet);
					
					Console.Out.WriteLine("Creating Mod - Rear Wheel Drive(Engineering;unit 51-100) ");
					String iFrontWheelExp = CAAENOVWSUtils.crtModConfigExp (frontWheel_MOD,"Engineering Effectivity","51","100");
					enovwsprodstructconfigcpp.ENOVIA frontWheelResultSet = pscWrapper.CreateModification(carPRC, iFrontWheelExp);
					frontWDMod =  pscWrapper.GetENOVIA_EFF_MOD_UUID(frontWheelResultSet);
									
					Console.Out.WriteLine("Creating Mod - Rear Wheel Drive(Engineering;unit 35-50) ");
					String iAllWheelExp = CAAENOVWSUtils.crtModConfigExp (allWheel_MOD,"Engineering Effectivity","35","50");
					enovwsprodstructconfigcpp.ENOVIA allWheelResultSet = pscWrapper.CreateModification(carPRC, iAllWheelExp);
					allWDMod =  pscWrapper.GetENOVIA_EFF_MOD_UUID(allWheelResultSet);
									
					Console.Out.WriteLine("Creating Mod - Rear Wheel Drive(Engineering;unit 80-90) ");
					String iFourWheelExp = CAAENOVWSUtils.crtModConfigExp (fourWheel_MOD,"Engineering Effectivity","80","90");
					enovwsprodstructconfigcpp.ENOVIA fourWheelResultSet = pscWrapper.CreateModification(carPRC, iFourWheelExp);
					fourWDMod =  pscWrapper.GetENOVIA_EFF_MOD_UUID(fourWheelResultSet);
					Console.Out.WriteLine("Creating Mod - Exhaust(Engineering;unit 1-100) ");
					String iExhaust = CAAENOVWSUtils.crtModConfigExp (exhaust_MOD,"Engineering Effectivity","1","100");
					enovwsprodstructconfigcpp.ENOVIA exhaustResultSet = pscWrapper.CreateModification(carPRC, iExhaust);
					exhaustMod =  pscWrapper.GetENOVIA_EFF_MOD_UUID(exhaustResultSet);
					success = true;
					
				} catch (Exception e) {
					exception = e;
				}
				
				if (success)
						Console.Out.WriteLine("creatModsForCar - sucess.");
				else
						throw new Exception("creatModsForCar - failure.");
						
							
		}//[Top]
		/// <summary>
		/// Create the following mods using Create Mod Service on Exhaust configured object
		///		Tail Small (Engineering; unit 1-25, unit 51-75)
		///		Tail Large (Engineering; unit 26-50, 76-100)
		/// </summary>
		
		public void CreatModsForExhaust(enovwsprodstructconfigcpp.CAAENOVWSProdStructConfigCppWrapper pscWrapper)
			{
				Console.Out.WriteLine("->CreatModsForExhaust.");
				bool success = false;
				Exception exception = null;
				try {
				
					String TailSmall = "MODTailSmall"+uKey;
					String TailLarge = "MODTailLarge"+uKey;
									
					StringBuilder iModConfigExpTailSmall = new StringBuilder();
					iModConfigExpTailSmall.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
					iModConfigExpTailSmall.Append("<ENOVIA_MODIFICATION NAME=\"");
					iModConfigExpTailSmall.Append(TailSmall); 
					iModConfigExpTailSmall.Append("\"xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"Configuration_Final.xsd\">");
					iModConfigExpTailSmall.Append("<MOD_DOMAIN>");
					iModConfigExpTailSmall.Append("<EFF_DOMAIN NAME=\"Engineering Effectivity\">");
					iModConfigExpTailSmall.Append("<MOD_EFFECTIVITY>");
					iModConfigExpTailSmall.Append("<EFF_TYPE>");
					iModConfigExpTailSmall.Append("<RANGE_RANGE END=\"25\" START=\"1\"/>");
					iModConfigExpTailSmall.Append("<RANGE_RANGE END=\"75\" START=\"51\"/>");
					iModConfigExpTailSmall.Append("</EFF_TYPE>");
					iModConfigExpTailSmall.Append("</MOD_EFFECTIVITY>");
					iModConfigExpTailSmall.Append("</EFF_DOMAIN>");
					iModConfigExpTailSmall.Append("</MOD_DOMAIN>");
					iModConfigExpTailSmall.Append("</ENOVIA_MODIFICATION>");
					String iTailSmallExp = iModConfigExpTailSmall.ToString();
					
		
					Console.Out.WriteLine("Creating Mod - Tail Small (Engineering; unit 1-25) ");
					enovwsprodstructconfigcpp.ENOVIA tailSmallResultSet = pscWrapper.CreateModification(exhaustCPV, iTailSmallExp);
					String tailSmall_MOD =  pscWrapper.GetENOVIA_EFF_MOD_UUID(tailSmallResultSet);
					
					StringBuilder iModConfigExpTailLarge = new StringBuilder();
					iModConfigExpTailLarge.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
					iModConfigExpTailLarge.Append("<ENOVIA_MODIFICATION NAME=\" ");
					iModConfigExpTailLarge.Append(TailLarge); 
					iModConfigExpTailLarge.Append("\"xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"Configuration_Final.xsd\"> ");
					iModConfigExpTailLarge.Append("<MOD_DOMAIN>");
					iModConfigExpTailLarge.Append("<EFF_DOMAIN NAME=\"Engineering Effectivity\">");
					iModConfigExpTailLarge.Append("<MOD_EFFECTIVITY>");
					iModConfigExpTailLarge.Append("<EFF_TYPE>");
					iModConfigExpTailLarge.Append("<RANGE_RANGE END=\"50\" START=\"26\"/>");
					iModConfigExpTailLarge.Append("<RANGE_RANGE END=\"100\" START=\"76\"/>");
					iModConfigExpTailLarge.Append("</EFF_TYPE>");
					iModConfigExpTailLarge.Append("</MOD_EFFECTIVITY>");
					iModConfigExpTailLarge.Append("</EFF_DOMAIN>");
					iModConfigExpTailLarge.Append("</MOD_DOMAIN>");
					iModConfigExpTailLarge.Append("</ENOVIA_MODIFICATION>");
					String iTailLargeExp = iModConfigExpTailLarge.ToString();
					Console.Out.WriteLine("Creating Mod - Tail Large (Engineering; unit 76-100) ");
					enovwsprodstructconfigcpp.ENOVIA tailLargeResultSet = pscWrapper.CreateModification(exhaustCPV, iTailLargeExp);
					String tailLarge_MOD =  pscWrapper.GetENOVIA_EFF_MOD_UUID(tailLargeResultSet);
					tailSmallMod = tailSmall_MOD;
					tailLargeMod = tailLarge_MOD;
					success = true;
				} catch (Exception e) {
					exception = e;
				}
				if (success)
					Console.Out.WriteLine("CreatModsForExhaust - sucess.");
				else
					throw new Exception("CreatModsForExhaust- failure.");
		}//[Top]
		/// <summary>
		/// Create the following config handlers:
		///		CAR 1(unit 1-1)	
		///		CAR 40(unit 40-40)
		///		CAR 51(unit 51-51)
		///		CAR 80(unit 80-80)
		///		CAR broken(unit 91-91)
		/// </summary>
	
		public void CreatConfigHandlers(enovwsprodstructconfigcpp.CAAENOVWSProdStructConfigCppWrapper pscWrapper)
			{
				Console.Out.WriteLine("->CreatConfigHandlers.");
				bool success = false;
				Exception exception = null;
				try {
				Console.Out.WriteLine("Creating CH - CAR 1 (Engineering; unit 1-1) ");
				String car1_Name = "CHCAR1"+uKey;
				String iCAR_1 = CAAENOVWSUtils.crtConfigHandlerExp(car1_Name,"CAR with Range1" ,"Engineering Effectivity","1","1");
				enovwsprodstructconfigcpp.ENOVIA carRS_1 = pscWrapper.CreateConfigHandler(carPRC, iCAR_1);
				String carCH_1 =  pscWrapper.GetENOVIA_CFHANDLER_UUID(carRS_1);
								
				String car40_Name = "CHCAR40"+uKey;
				Console.Out.WriteLine("Creating CH - CAR 40 (Engineering; unit 40-40) ");
				String iCAR_40 = CAAENOVWSUtils.crtConfigHandlerExp(car40_Name,"CAR with Range40" ,"Engineering Effectivity","40","40");
				enovwsprodstructconfigcpp.ENOVIA carRS_40 = pscWrapper.CreateConfigHandler(carPRC, iCAR_40);
				String carCH_40 =  pscWrapper.GetENOVIA_CFHANDLER_UUID(carRS_40);
					
				String car51_Name = "CHCAR51"+uKey;
				Console.Out.WriteLine("Creating CH - CAR 51 (Engineering; unit 51-51) ");
				String iCAR_51 = CAAENOVWSUtils.crtConfigHandlerExp(car51_Name,"CAR with Range51" ,"Engineering Effectivity","51","51");
				enovwsprodstructconfigcpp.ENOVIA carRS_51 = pscWrapper.CreateConfigHandler(carPRC, iCAR_51);
				String carCH_51 =  pscWrapper.GetENOVIA_CFHANDLER_UUID(carRS_51);
					
				String car80_Name = "CHCAR80"+uKey;
				Console.Out.WriteLine("Creating CH - CAR 80 (Engineering; unit 80-80) ");
				String iCAR_80 = CAAENOVWSUtils.crtConfigHandlerExp(car80_Name,"CAR with Range80" ,"Engineering Effectivity","80","80");
				enovwsprodstructconfigcpp.ENOVIA carRS_80 = pscWrapper.CreateConfigHandler(carPRC, iCAR_80);
				String carCH_80 =  pscWrapper.GetENOVIA_CFHANDLER_UUID(carRS_80);
				
				String car91_Name = "CHCAR91"+uKey;
				Console.Out.WriteLine("Creating CH - CAR broken (Engineering; unit 91-91) ");
				String iCAR_91 = CAAENOVWSUtils.crtConfigHandlerExp(car91_Name,"CAR with Range91" ,"Engineering Effectivity","91","91");
				enovwsprodstructconfigcpp.ENOVIA carRS_91 = pscWrapper.CreateConfigHandler(carPRC, iCAR_91);
				String carCH_91 =  pscWrapper.GetENOVIA_CFHANDLER_UUID(carRS_91);
				//configHandler UUIDIds
  				carConfgHUnit1 = carCH_1;
				carConfgHUnit40 = carCH_40;
				carConfgHUnit51 = carCH_51;
				carConfgHUnit80 = carCH_80;
				carConfgHUnit91 = carCH_91; 
				success = true;
					
				} catch (Exception e) {
					exception = e;
				}
 			if (success)
				Console.Out.WriteLine("CreatConfigHandlers - sucess.");
			else
				throw new Exception("CreatConfigHandlers - failure.");
		}//[Top]
		/// <summary>
		/// Change Management
		///		Create Action using Create Action Service Action make CAR	
		/// </summary>
		public void CreatAction(enovwschgmgmtcpp.CAAENOVWSChgMgmtCppWrapper chgWrapper)
			{
				Console.Out.WriteLine("->create a action CAR owner manual.");
				bool success = false;
				Exception exception = null;		
			
				try {
					String actionId = "PSCWSAction"+uKey;
					String[] actionsID = {actionId};
					String actionDomain = "APLAFL";
					String actionPriority = "Routine";
					
					enovwschgmgmtcpp.ENOVIA newAction = chgWrapper.CreateAction(	actionsID,
																actionDomain,
																actionPriority);
																
					String[] newActionUUIDs = chgWrapper.GetENOVIA_Action_DesignUUIDs(newAction);
					if (newActionUUIDs.Length != 1) {
						throw new Exception("Failed to create action" + newActionUUIDs);
					}
				
					carAction1 = newActionUUIDs[0];		
					success = true;
				} catch (Exception e) {
					exception = e;
				}
				if (success)
					Console.Out.WriteLine("create an action CAR - sucess.");	
				else
					throw new Exception("create an action CAR - failure.");				
		}//[Top]
		/// <summary>
		/// Add Associate Object Service  to Exhaust configured object on Action make CAR	
		///		Pass in the following mods: 
		///			Tail Small
		///			Tail Large
		/// </summary>
		public void AddAssociatedObjectsToExhaust(enovwschgmgmtcpp.CAAENOVWSChgMgmtCppWrapper chgWrapper)
		{
			Console.Out.WriteLine("->AddAssociatedObjectsToExhaus.");
			bool success = false;
			Exception exception = null;		
			
			try {
				
				String[] associateMods = {tailSmallMod,tailLargeMod};
				
				chgWrapper.AddAssociatedObject(carAction1,exhaustCPV,associateMods);		
				success = true;
			} catch (Exception e) {
				exception = e;
			}
			if (success)
				Console.Out.WriteLine("add associated object CAR PRC on action - sucess.");	
			else
				throw new Exception("add associated object CAR PRC on action - failure.");				
			
		}//[Top]	
		/// <summary>
		/// Add Associated Object Service CAR	configured object on Action make CAR
		///		Pass in the following mods:
		///			Rear Wheel Drive, Front Wheel Drive, All Wheel Drive and Four Wheel Drive
		/// </summary>
		public void AddAssociatedObjectsToCar(enovwschgmgmtcpp.CAAENOVWSChgMgmtCppWrapper chgWrapper)
		{
			Console.Out.WriteLine("->AddAssociatedObjectsToCar.");
			bool success = false;
			Exception exception = null;		
			
			try {
				
				String[] associateMods = {rearWDMod,frontWDMod,allWDMod,fourWDMod};
				
				chgWrapper.AddAssociatedObject(carAction1,carPRC,associateMods);		
				success = true;
			} catch (Exception e) {
				exception = e;
			}
			if (success)
				Console.Out.WriteLine("add associated object CAR Exhaust on action - sucess.");	
			else
				throw new Exception("add associated object CAR Exhaust on action - failure.");				
			
		}//[Top]
		/// <summary>
		/// Add Affected Object Service CAR Owner Manual
		/// </summary>
		public void AddAffectedObjects(enovwschgmgmtcpp.CAAENOVWSChgMgmtCppWrapper chgWrapper)
		{
			Console.Out.WriteLine("->add affected object CAR owner manual on action.");
			bool success = false;
			Exception exception = null;		
			
			try {
				
				String[] inputAO = {ownerManualDOC};
				String[] outputAO = {};
				
				chgWrapper.AddAffectedObject(carAction1,inputAO,outputAO);		
				success = true;
			} catch (Exception e) {
				exception = e;
			}
			if (success)
				Console.Out.WriteLine("add affected object CAR owner manual - sucess.");	
			else
				throw new Exception("add affected object CAR owner manual - failure.");				
		
		}//[Top]	
		
		/// <summary>
		//Get Affected Object S
		/// </summary>
		public void GetAffectedObjects(enovwschgmgmtcpp.CAAENOVWSChgMgmtCppWrapper chgWrapper) 
		{
			Console.Out.WriteLine("->get affected objects on action.");
			bool success = false;
			Exception exception = null;		
			
			try {
				
				String[] objTypes = null;
				enovwschgmgmtcpp.ENOVIA affectedObjectsResultSet = chgWrapper.GetAffectedObjects(carAction1,
																				objTypes,
																				null);
				// you need the size here ...	
				CAAENOVWSUtils.DisplayResults(affectedObjectsResultSet, 99);
				success = true;
			} catch (Exception e) {
				exception = e;
			}
			if (success)
				Console.Out.WriteLine("get affected objects on action - sucess.");	
			else
				throw new Exception("get affected objects on action - failure.");				
		
		}//[Top]	
		/// <summary>
		// GetAndResolveOperations
		/// </summary>
		/// 
	
		public void GetAndResolveOperationsExhaust(enovwsprodstructconfigcpp.CAAENOVWSProdStructConfigCppWrapper pscWrapper)
		{
				Console.Out.WriteLine("->GetAndResolveOperationsExhaust - Config product Structure.");
				bool success = false;
				Exception exception = null;
				try {
					Console.Out.WriteLine("Get All Operations on the input.");
					enovwsprodstructconfigcpp.OperationStructure  [] valOpers  = pscWrapper.GetOpers(exhaustCII);
												
					int lenOper = valOpers.Length;
					Console.Out.WriteLine("Number of Operations found "+ lenOper);
					for(int i=0;i<lenOper;i++)
					{
						String operStr=valOpers[i].Operation;
						Console.Out.WriteLine("Operation "+operStr);
						
						
						String partName = CAAENOVWSUtils.ParseOperation(operStr);
						enovwsprodstructconfigcpp.Identifier objID = valOpers[i].OperandObjId1;
						Console.Out.WriteLine("Operation "+operStr);
												
						//Console.Out.WriteLine("------The type of object------"+objStr);
						enovwsprodstructconfigcpp.OperationStructure[] resolveOperStruct = new enovwsprodstructconfigcpp.OperationStructure[1];
						enovwsprodstructconfigcpp.OperationStructure operStruct = new enovwsprodstructconfigcpp.OperationStructure();
						operStruct.OperandObjId1 = objID;
						operStruct.OperandObjId2 = valOpers[i].OperandObjId2;
						operStruct.ConfigViewId3 = valOpers[i].ConfigViewId3;
						operStruct.Operation = operStr;
						
						//Add the operStruct to the array
						resolveOperStruct[0]=operStruct;
						//Add the array to the holder
						enovwsprodstructconfigcpp.OperationStructure [] iOperations = resolveOperStruct;
						
						if((operStr.IndexOf(tailSmallPV_ID) > 0))
						{
							Console.Out.WriteLine("The Part Name = " +tailSmallPV_ID);
							pscWrapper.ResolveOpers(tailSmallMod, iOperations);
						}
						else if((operStr.IndexOf(tailLargePV_ID) > 0))
						{
							Console.Out.WriteLine("The Part Name = " +tailLargePV_ID);
							pscWrapper.ResolveOpers(tailLargeMod, iOperations);
						}
					}			
					
					success = true;
				} catch (Exception e) {
					exception = e;
				}
				if (success)
					Console.Out.WriteLine("GetAndResolveOperationsExhaust - sucess.");
				else
					throw new Exception("GetAndResolveOperationsExhaust - failure.");
		
		}//[Top]
		
		/// <summary>
		// GetAndResolveOperations
		/// </summary>
		/// 
		public void GetAndResolveOperationsCAR(enovwsprodstructconfigcpp.CAAENOVWSProdStructConfigCppWrapper pscWrapper)
		{
	
			Console.Out.WriteLine("->GetAndResolveOperationsCAR - Config product Structure.");
			bool success = false;
			Exception exception = null;
			try {
				Console.Out.WriteLine("Get All Operations on the input.");
				enovwsprodstructconfigcpp.OperationStructure [] valOpers = pscWrapper.GetOpers(carPRC);
				
				int lenOper = valOpers.Length;
				Console.Out.WriteLine("Number of Operations found "+ lenOper);
				for(int i=0;i<lenOper;i++)
				{
					String operStr=valOpers[i].Operation;
					Console.Out.WriteLine("Operation "+operStr);
					
					
					String partName = CAAENOVWSUtils.ParseOperation(operStr);
					enovwsprodstructconfigcpp.Identifier objID = valOpers[i].OperandObjId1;
					Console.Out.WriteLine("Operation "+operStr);
					Console.Out.WriteLine("The Part Name = " +partName);
					
					
					
					//Console.Out.WriteLine("------The type of object------"+objStr);
					enovwsprodstructconfigcpp.OperationStructure[] resolveOperStruct = new enovwsprodstructconfigcpp.OperationStructure[1];
					enovwsprodstructconfigcpp.OperationStructure operStruct = new enovwsprodstructconfigcpp.OperationStructure();
					operStruct.OperandObjId1 = objID;
					operStruct.OperandObjId2 = valOpers[i].OperandObjId2;
					operStruct.ConfigViewId3 = valOpers[i].ConfigViewId3;
					operStruct.Operation = operStr;
					
					//Add the operStruct to the array
					resolveOperStruct[0]=operStruct;
					//Add the array to the holder
					enovwsprodstructconfigcpp.OperationStructure [] iOperations = resolveOperStruct;
					
									
					if(partName.Equals(rearWDPV_ID))
					{
						pscWrapper.ResolveOpers(rearWDMod, iOperations);
					}
					else if(partName.Equals(frontWDPV_ID))
					{
						pscWrapper.ResolveOpers(frontWDMod, iOperations);
					}
					else if(partName.Equals(allWDPV_ID))
					{
						pscWrapper.ResolveOpers(allWDMod, iOperations);
					}
					else if(partName.Equals(fourWDPV_ID))
					{
						pscWrapper.ResolveOpers(fourWDMod, iOperations);
					}
					else if(partName.Equals(exhaustCPV_ID))
					{
						pscWrapper.ResolveOpers(exhaustMod, iOperations);
					}
				}
				success = true;
			} catch (Exception e) {
				exception = e;
			}
			if (success)
				Console.Out.WriteLine("GetAndResolveOperationsCAR - sucess.");
			else
				throw new Exception("GetAndResolveOperationsCAR - failure.");
	
	
		}//[Top]
		
		/// <summary>
		// Modify ProdStruct:
		//		Replace Child Rear Wheel Drive with All Wheel Drive
		//		Cut Child Front Wheel Drive
		//		Add Child Four Wheel Drive
		/// </ summary>
		
		public void ModifyCar(enovwsprodstructcpp.CAAENOVWSProdStructCppWrapper psWrapper)
			{
			Console.Out.WriteLine("->modify the car product Structure.");
			bool success = false;
			Exception exception = null;
			
			try {
				Console.Out.WriteLine("Replace Child Rear Wheel Drive with All Wheel Drive.");
				enovwsprodstructcpp.ENOVIA createDocResultSet = psWrapper.ReplacePart(rearWDII,allWDPV);
				
				Console.Out.WriteLine("Cut Child Front Wheel Drive.");
				String [] childInstIds = {frontWDII};
				psWrapper.CutPartInstance(carPRC,childInstIds);
				Console.Out.WriteLine("Add Child Four Wheel Drive.");
				String [] childRefIds = {fourWDPV};
				psWrapper.CreatePartInst(carPRC,childRefIds );
		
				success = true;
			} catch (Exception e) {
				exception = e;
			}		
			if (success)
				Console.Out.WriteLine("create a document CAR - sucess.");	
			else
			throw new Exception("create a document CAR - failure.");				
		}//[Top]
		
		/// <summary>
		// Report BOM as follows
		//   Expand all levels on CARPRC using the config handlers to retrieve:
		/// </summary>
		/// 
		public void ReportBOM(	enovwsprodstructcpp.CAAENOVWSProdStructCppWrapper psWrapper,
								enovwsquerycpp.CAAENOVWSQueryCppWrapper queryWrapper){	
			Console.Out.WriteLine("reportBOM.");
			bool success = false;
			Exception exception = null;
			
			try {
		
				Console.Out.WriteLine("->expand car by applying config handler CAR unit 1 ::");
				ExpandCarByApplyingConfigHandler(psWrapper,carConfgHUnit1,queryWrapper);
				Console.Out.WriteLine("->expand car by applying config handler CAR unit 40 ::");
				ExpandCarByApplyingConfigHandler(psWrapper,carConfgHUnit40,queryWrapper);
				Console.Out.WriteLine("->expand car by applying config handler CAR unit 51 ::");
				ExpandCarByApplyingConfigHandler(psWrapper,carConfgHUnit51,queryWrapper);
				Console.Out.WriteLine("->expand car by applying config handler CAR unit 80::");
				ExpandCarByApplyingConfigHandler(psWrapper,carConfgHUnit80,queryWrapper);
				Console.Out.WriteLine("->expand car by applying config handler CAR unit 91 ::");
				ExpandCarByApplyingConfigHandler(psWrapper,carConfgHUnit91,queryWrapper);			
				success = true;		
			} catch (Exception e) {
				exception = e;
			}		
			if (success)
				Console.Out.WriteLine("reportBOM - success.");	
			else
				throw new Exception("reportBOM - failure.");					
		}//[Top]
		public void ExpandCarByApplyingConfigHandler(enovwsprodstructcpp.CAAENOVWSProdStructCppWrapper psWrapper, 
														String configHandlerUUID,
													enovwsquerycpp.CAAENOVWSQueryCppWrapper queryWrapper){	
			Console.Out.WriteLine("--------------expandCarByApplyingConfigHandler --------------");	
			bool success = false;
			Exception exception = null;
			
			try { 
	
				String filter = CAAENOVWSUtils.BuildExpandConfigHandlerFilter(carPRC, configHandlerUUID);			
				enovwsprodstructcpp.ENOVIA expandResultSet = psWrapper.ExpandProductStructure(carPRC,1, filter);
				if (expandResultSet.ENOVIA_VPMProductRootClass == null || expandResultSet.ENOVIA_VPMProductRootClass.Length != 1) {
					throw new Exception("Failed to find product root class");
				} 
				CAAENOVWSUtils.DisplayResults(expandResultSet, 20);			
				success = true;		
			} catch (Exception e) {
				exception = e;
			}		
			if (success)
				Console.Out.WriteLine("expandCarByApplyingConfigHandler - sucess.");	
			else
				throw new Exception("expandCarByApplyingConfigHandler - failure.");					
		}	
		

	}
}

[Top]


History

Version: 1 [Feb 2006] Document created
[Top]

Copyright © 1994-2006, Dassault Systèmes. All rights reserved.