commit f276cab94a8886b7d08de575e5d14d8e3e088ad1 Author: lijh Date: Tue Mar 10 16:54:07 2026 +0800 first commit diff --git a/.vs/HelloTeamcenter/v14/.suo b/.vs/HelloTeamcenter/v14/.suo new file mode 100644 index 0000000..9979ca7 Binary files /dev/null and b/.vs/HelloTeamcenter/v14/.suo differ diff --git a/.vs/HelloTeamcenter/v16/.suo b/.vs/HelloTeamcenter/v16/.suo new file mode 100644 index 0000000..8491bbd Binary files /dev/null and b/.vs/HelloTeamcenter/v16/.suo differ diff --git a/Backup/HelloTeamcenter.csproj b/Backup/HelloTeamcenter.csproj new file mode 100644 index 0000000..b709196 --- /dev/null +++ b/Backup/HelloTeamcenter.csproj @@ -0,0 +1,85 @@ + + + Debug + AnyCPU + 8.0.50727 + 2.0 + {5503038E-4D69-4703-9F79-90C8D9061A70} + Exe + Properties + HelloTeamcenter + HelloTeamcenter + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + False + ..\..\libs\TcSoaClient.dll + + + False + ..\..\libs\TcSoaCommon.dll + + + False + ..\..\libs\TcSoaCoreStrong.dll + + + False + ..\..\libs\TcSoaCoreTypes.dll + + + False + ..\..\libs\TcSoaQueryStrong.dll + + + False + ..\..\libs\TcSoaQueryTypes.dll + + + False + ..\..\libs\TcSoaStrongModel.dll + + + + + + + + + + + + + + + + + + + diff --git a/Backup/Properties/AssemblyInfo.cs b/Backup/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..ca720ce --- /dev/null +++ b/Backup/Properties/AssemblyInfo.cs @@ -0,0 +1,33 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("HelloTeamcenter")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Siemens Product Lifecycle Management Software Inc.")] +[assembly: AssemblyProduct("HelloTeamcenter")] +[assembly: AssemblyCopyright("Copyright 2008 Siemens Product Lifecycle Management Software Inc.")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("6ce4adbe-4247-464b-8d53-e3ecb88955fd")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Backup/clientx/AppXCredentialManager.cs b/Backup/clientx/AppXCredentialManager.cs new file mode 100644 index 0000000..6ad8fff --- /dev/null +++ b/Backup/clientx/AppXCredentialManager.cs @@ -0,0 +1,146 @@ +//================================================== +// +// @@ +// +//================================================== + + + +using System; +using System.IO; + +using Teamcenter.Schemas.Soa._2006_03.Exceptions; +using Teamcenter.Soa; +using Teamcenter.Soa.Common; +using Teamcenter.Soa.Client; +using Teamcenter.Soa.Exceptions; + +namespace Teamcenter.ClientX +{ + +/** + * The CredentialManager is used by the Teamcenter Services framework to get the + * user's credentials when challanged by the server. This can occur after a period + * of inactivity and the server has timed-out the user's session, at which time + * the client application will need to re-authenitcate. The framework will + * call one of the getCredentials methods (depending on circumstances) and will + * send the SessionService.login service request. Upon successfull completion of + * the login service request. The last service request (one that cuased the challange) + * will be resent. + * + * The framework will also call the setUserPassword setGroupRole methods when ever + * these credentials change, thus allowing this implementation of the CredentialManager + * to cache these values so prompting of the user is not requried for re-authentication. + * + */ +public class AppXCredentialManager : CredentialManager +{ + + private String name = null; + private String password = null; + private String group = ""; // default group + private String role = ""; // default role + private String discriminator = "SoaAppX"; // always connect same user + // to same instance of server + + /** + * Return the type of credentials this implementation provides, + * standard (user/password) or Single-Sign-On. In this case + * Standard credentials are returned. + * + * @see com.teamcenter.soa.client.CredentialManager#getCredentialType() + */ + public int CredentialType + { + get { return SoaConstants.CLIENT_CREDENTIAL_TYPE_STD; } + } + + /** + * Prompt's the user for credentials. + * This method will only be called by the framework when a login attempt has + * failed. + * + * @see com.teamcenter.soa.client.CredentialManager#getCredentials(com.teamcenter.schemas.soa._2006_03.exceptions.InvalidCredentialsException) + */ + public string[] GetCredentials(InvalidCredentialsException e) + //throws CanceledOperationException + { + Console.WriteLine(e.Message); + return PromptForCredentials(); + } + + /** + * Return the cached credentials. + * This method will be called when a service request is sent without a valid + * session ( session has expired on the server). + * + * @see com.teamcenter.soa.client.CredentialManager#getCredentials(com.teamcenter.schemas.soa._2006_03.exceptions.InvalidUserException) + */ + public String[] GetCredentials(InvalidUserException e) + //throws CanceledOperationException + { + // Have not logged in yet, shoult not happen but just in case + if (name == null) return PromptForCredentials(); + + // Return cached credentials + String[] tokens = { name, password, group, role, discriminator }; + return tokens; + } + + /** + * Cache the group and role + * This is called after the SessionService.setSessionGroupMember service + * operation is called. + * + * @see com.teamcenter.soa.client.CredentialManager#setGroupRole(java.lang.String, + * java.lang.String) + */ + public void SetGroupRole(String group, String role) + { + this.group = group; + this.role = role; + } + + /** + * Cache the User and Password + * This is called after the SessionService.login service operation is called. + * + * @see com.teamcenter.soa.client.CredentialManager#setUserPassword(java.lang.String, + * java.lang.String, java.lang.String) + */ + public void SetUserPassword(String user, String password, String discriminator) + { + this.name = user; + this.password = password; + this.discriminator = discriminator; + } + + + public String[] PromptForCredentials() + //throws CanceledOperationException + { + try + { + Console.WriteLine("Please enter user credentials (return to quit):"); + Console.Write("User Name: "); + name = Console.ReadLine(); + + if (name.Length == 0) + throw new CanceledOperationException(""); + + Console.Write("Password: "); + password = Console.ReadLine(); + } + catch (IOException e) + { + String message = "Failed to get the name and password.\n" + e.Message; + Console.WriteLine(message); + throw new CanceledOperationException(message); + } + + String[] tokens = { name, password, group, role, discriminator }; + return tokens; + } + +} +} diff --git a/Backup/clientx/AppXDeletedObjectListener.cs b/Backup/clientx/AppXDeletedObjectListener.cs new file mode 100644 index 0000000..d051a7f --- /dev/null +++ b/Backup/clientx/AppXDeletedObjectListener.cs @@ -0,0 +1,38 @@ +//================================================== +// +// @@ +// +//================================================== + +using System; + +using Teamcenter.Soa.Client.Model; + +namespace Teamcenter.ClientX +{ + +/** + * Implementation of the DeleteListener, simply prints out list of all objects + * that are deleted. + * + */ +public class AppXDeletedObjectListener : DeleteListener +{ + + public void ModelObjectDelete(string[] uids) + { + if (uids.Length == 0) + return; + + System.Console.WriteLine(""); + System.Console.WriteLine("Deleted Objects handled in com.teamcenter.clientx.AppXDeletedObjectListener.modelObjectDelete"); + System.Console.WriteLine("The following objects have been deleted from the server and removed from the client data model:"); + for (int i = 0; i < uids.Length; i++) + { + System.Console.WriteLine(" " + uids[i]); + } + + } + +} +} diff --git a/Backup/clientx/AppXExceptionHandler.cs b/Backup/clientx/AppXExceptionHandler.cs new file mode 100644 index 0000000..824c9ad --- /dev/null +++ b/Backup/clientx/AppXExceptionHandler.cs @@ -0,0 +1,101 @@ +//================================================== +// +// @@ +// +//================================================== + + +using System; +using System.IO; + +using Teamcenter.Schemas.Soa._2006_03.Exceptions; +using Teamcenter.Soa.Client; +using Teamcenter.Soa.Exceptions; + +namespace Teamcenter.ClientX +{ + + + /** + * Implementation of the ExceptionHandler. For ConnectionExceptions (server + * temporarily down .etc) prompts the user to retry the last request. For other + * exceptions convert to a RunTime exception. + */ + public class AppXExceptionHandler : ExceptionHandler + { + + /* + * (non-Javadoc) + * + * @see com.teamcenter.soa.client.ExceptionHandler#handleException(com.teamcenter.schemas.soa._2006_03.exceptions.InternalServerException) + */ + public void HandleException(InternalServerException ise) + { + Console.WriteLine(""); + Console.WriteLine("*****"); + Console.WriteLine("Exception caught in com.teamcenter.clientx.AppXExceptionHandler.handleException(InternalServerException)."); + + + if (ise is ConnectionException) + { + // ConnectionException are typically due to a network error (server + // down .etc) and can be recovered from (the last request can be sent again, + // after the problem is corrected). + Console.Write("\nThe server returned an connection error.\n" + ise.Message + + "\nDo you wish to retry the last service request?[y/n]"); + } + else if (ise is ProtocolException) + { + // ProtocolException are typically due to programming errors + // (content of HTTP + // request is incorrect). These are generally can not be + // recovered from. + Console.Write("\nThe server returned an protocol error.\n" + ise.Message + + "\nThis is most likely the result of a programming error." + + "\nDo you wish to retry the last service request?[y/n]"); + } + else + { + Console.WriteLine("\nThe server returned an internal server error.\n" + + ise.Message + + "\nThis is most likely the result of a programming error." + + "\nA RuntimeException will be thrown."); + throw new SystemException(ise.Message); + } + + try + { + String retry = Console.ReadLine(); + // If yes, return to the calling SOA client framework, where the + // last service request will be resent. + if (retry.ToLower().Equals("y") || retry.ToLower().Equals("yes")) + return; + + throw new SystemException("The user has opted not to retry the last request"); + } + catch (IOException e) + { + Console.Error.WriteLine("Failed to read user response.\nA RuntimeException will be thrown."); + throw new SystemException(e.Message); + } + } + + /* + * (non-Javadoc) + * + * @see com.teamcenter.soa.client.ExceptionHandler#handleException(com.teamcenter.soa.exceptions.CanceledOperationException) + */ + public void HandleException(CanceledOperationException coe) + { + Console.WriteLine(""); + Console.WriteLine("*****"); + Console.WriteLine("Exception caught in com.teamcenter.clientx.AppXExceptionHandler.handleException(CanceledOperationException)."); + + // Expecting this from the login tests with bad credentials, and the + // AnyUserCredentials class not + // prompting for different credentials + throw new SystemException(coe.Message); + } + + } +} diff --git a/Backup/clientx/AppXPartialErrorListener.cs b/Backup/clientx/AppXPartialErrorListener.cs new file mode 100644 index 0000000..644a63b --- /dev/null +++ b/Backup/clientx/AppXPartialErrorListener.cs @@ -0,0 +1,68 @@ +//================================================== +// +// @@ +// +//================================================== + +using System; + +using Teamcenter.Soa.Client.Model; + + +namespace Teamcenter.ClientX +{ + +/** + * Implementation of the PartialErrorListener. Print out any partial errors + * returned. + * + */ +public class AppXPartialErrorListener : PartialErrorListener +{ + + /* + * (non-Javadoc) + * + * @see com.teamcenter.soa.client.model.PartialErrorListener#handlePartialError(com.teamcenter.soa.client.model.ErrorStack[]) + */ + public void HandlePartialError(ErrorStack[] stacks) + { + if (stacks.Length == 0) return; + + Console.WriteLine(""); + Console.WriteLine("*****"); + Console.WriteLine("Partial Errors caught in com.teamcenter.clientx.AppXPartialErrorListener."); + + + for (int i = 0; i < stacks.Length; i++) + { + ErrorValue[] errors = stacks[i].ErrorValues; + Console.Write("Partial Error for "); + + // The different service implementation may optionally associate + // an ModelObject, client ID, or nothing, with each partial error + if (stacks[i].HasAssociatedObject() ) + { + Console.WriteLine("object "+ stacks[i].AssociatedObject.Uid); + } + else if (stacks[i].HasClientId()) + { + Console.WriteLine("client id "+ stacks[i].ClientId); + } + else if (stacks[i].HasClientIndex()) + { + Console.WriteLine("client index " + stacks[i].ClientIndex); + } + + // Each Partial Error will have one or more contributing error messages + for (int j = 0; j < errors.Length; j++) + { + Console.WriteLine(" Code: " + errors[j].Code + "\tSeverity: " + + errors[j].Level + "\t" + errors[j].Message); + } + } + + } + +} +} diff --git a/Backup/clientx/AppXRequestListener.cs b/Backup/clientx/AppXRequestListener.cs new file mode 100644 index 0000000..fe84a9a --- /dev/null +++ b/Backup/clientx/AppXRequestListener.cs @@ -0,0 +1,42 @@ +//================================================== +// +// @@ +// +//================================================== + +using System; + +using Teamcenter.Soa.Client; + + +namespace Teamcenter.ClientX +{ + + /** + * This implemenation of the RequestListener, logs each service request + * to the console. + * + */ + public class AppXRequestListener : RequestListener + { + + + /** + * Called before each request is sent to the server. + */ + public void ServiceRequest(ServiceInfo info) + { + // will log the service name when done + } + + /** + * Called after each response from the server. + * Log the service operation to the console. + */ + public void ServiceResponse(ServiceInfo info) + { + Console.WriteLine(info.Id + ": " + info.Service + "." + info.Operation); + } + + } +} diff --git a/Backup/clientx/AppXUpdateObjectListener.cs b/Backup/clientx/AppXUpdateObjectListener.cs new file mode 100644 index 0000000..5865ee6 --- /dev/null +++ b/Backup/clientx/AppXUpdateObjectListener.cs @@ -0,0 +1,48 @@ +//================================================== +// +// @@ +// +//================================================== + +using System; + +using Teamcenter.Soa.Client.Model; +using Teamcenter.Soa.Exceptions; + +namespace Teamcenter.ClientX +{ + + +/** + * Implementation of the ChangeListener. Print out all objects that have been updated. + * + */ +public class AppXUpdateObjectListener : ChangeListener +{ + + public void ModelObjectChange(ModelObject[] objects) + { + if (objects.Length == 0) return; + System.Console.WriteLine(""); + System.Console.WriteLine("Modified Objects handled in com.teamcenter.clientx.AppXUpdateObjectListener.modelObjectChange"); + System.Console.WriteLine("The following objects have been updated in the client data model:"); + for (int i = 0; i < objects.Length; i++) + { + String uid = objects[i].Uid; + String type = objects[i].GetType().Name; + String name = ""; + if (objects[i].GetType().Name.Equals("WorkspaceObject")) + { + ModelObject wo = objects[i]; + try + { + name = wo.GetProperty("object_string").StringValue; + } + catch (NotLoadedException /*e*/) {} // just ignore + } + System.Console.WriteLine(" " + uid + " " + type + " " + name); + } + } + +} +} diff --git a/Backup/clientx/Session.cs b/Backup/clientx/Session.cs new file mode 100644 index 0000000..ab62ccc --- /dev/null +++ b/Backup/clientx/Session.cs @@ -0,0 +1,247 @@ +//================================================== +// +// @@ +// +//================================================== + + + + +using System; +using System.Collections; +using System.Net; + +using Teamcenter.Schemas.Soa._2006_03.Exceptions; +using Teamcenter.Services.Strong.Core; +using Teamcenter.Services.Strong.Core._2006_03.Session; +using Teamcenter.Soa; +using Teamcenter.Soa.Client; +using Teamcenter.Soa.Client.Model; +using Teamcenter.Soa.Exceptions; + +using WorkspaceObject = Teamcenter.Soa.Client.Model.Strong.WorkspaceObject; +using User = Teamcenter.Soa.Client.Model.Strong.User; + +namespace Teamcenter.ClientX +{ + + + public class Session + { + /** + * Single instance of the Connection object that is shared throughtout + * the application. This Connection object is needed whenever a Service + * stub is instantiated. + */ + private static Connection connection; + + /** + * The credentialManager is used both by the Session class and the Teamcenter + * Services Framework to get user credentials. + * + */ + private static AppXCredentialManager credentialManager; + + /** + * Create an instance of the Session with a connection to the specified + * server. + * + * Add implementations of the ExceptionHandler, PartialErrorListener, + * ChangeListener, and DeleteListeners. + * + * @param host Address of the host to connect to, http://serverName:port/tc + */ + public Session(String host) + { + // Create an instance of the CredentialManager, this is used + // by the SOA Framework to get the user's credentials when + // challanged by the server (sesioin timeout on the web tier). + credentialManager = new AppXCredentialManager(); + + + + // Create the Connection object, no contact is made with the server + // until a service request is made + connection = new Connection(host, new CookieCollection(), credentialManager, SoaConstants.REST, + SoaConstants.HTTP, false); + + + // Add an ExceptionHandler to the Connection, this will handle any + // InternalServerException, communication errors, xml marshalling errors + // .etc + connection.ExceptionHandler = new AppXExceptionHandler(); + + // While the above ExceptionHandler is required, all of the following + // Listeners are optional. Client application can add as many or as few Listeners + // of each type that they want. + + // Add a Partial Error Listener, this will be notified when ever a + // a service returns partial errors. + connection.ModelManager.AddPartialErrorListener(new AppXPartialErrorListener()); + + // Add a Change Listener, this will be notified when ever a + // a service returns model objects that have been updated. + connection.ModelManager.AddChangeListener(new AppXUpdateObjectListener()); + + // Add a Delete Listener, this will be notified when ever a + // a service returns objects that have been deleted. + connection.ModelManager.AddDeleteListener(new AppXDeletedObjectListener()); + + // Add a Request Listener, this will be notified before and after each + // service request is sent to the server. + Connection.AddRequestListener(new AppXRequestListener()); + } + + /** + * Get the single Connection object for the application + * + * @return connection + */ + public static Connection getConnection() + { + return connection; + } + + /** + * Login to the Teamcenter Server + * + */ + public User login() + { + // Get the service stub + SessionService sessionService = SessionService.getService(connection); + + try + { + // Prompt for credentials until they are right, or until user + // cancels + String[] credentials = credentialManager.PromptForCredentials(); + while (true) + { + try + { + + // ***************************** + // Execute the service operation + // ***************************** + LoginResponse resp = sessionService.Login(credentials[0], credentials[1], + credentials[2], credentials[3],"",credentials[4]); + + return resp.User; + } + catch (InvalidCredentialsException e) + { + credentials = credentialManager.GetCredentials(e); + } + } + } + // User canceled the operation, don't need to tell him again + catch (CanceledOperationException /*e*/) {} + + // Exit the application + //System.exit(0); + return null; + } + + /** + * Terminate the session with the Teamcenter Server + * + */ + public void logout() + { + // Get the service stub + SessionService sessionService = SessionService.getService(connection); + try + { + // ***************************** + // Execute the service operation + // ***************************** + sessionService.Logout(); + } + catch (ServiceException /*e*/) { } + } + + /** + * Print some basic information for a list of objects + * + * @param objects + */ + public static void printObjects(ModelObject[] objects) + { + if(objects == null) + return; + + + // Ensure that the referenced User objects that we will use below are loaded + getUsers( objects ); + + Console.WriteLine("Name\t\tOwner\t\tLast Modified"); + Console.WriteLine("====\t\t=====\t\t============="); + for (int i = 0; i < objects.Length; i++) + { + if(!(objects[i] is WorkspaceObject )) + continue; + + WorkspaceObject wo = (WorkspaceObject)objects[i]; + try + { + String name = wo.Object_string; + User owner = (User) wo.Owning_user; + DateTime lastModified =wo.Last_mod_date; + + Console.WriteLine(name + "\t" + owner.User_name + "\t" + lastModified.ToString()); + } + catch (NotLoadedException e) + { + // Print out a message, and skip to the next item in the folder + // Could do a DataManagementService.getProperties call at this point + Console.WriteLine(e.Message); + Console.WriteLine("The Object Property Policy ($TC_DATA/soa/policies/Default.xml) is not configured with this property."); + } + } + + } + + + private static void getUsers(ModelObject[] objects) + { + if(objects == null) + return; + + DataManagementService dmService = DataManagementService.getService(Session.getConnection()); + ArrayList unKnownUsers = new ArrayList(); + for (int i = 0; i < objects.Length; i++) + { + if(!(objects[i] is WorkspaceObject )) + continue; + + WorkspaceObject wo = (WorkspaceObject)objects[i]; + + User owner = null; + try + { + owner = (User) wo.Owning_user; + String userName = owner.User_name; + } + catch (NotLoadedException /*e*/) + { + if(owner != null) + unKnownUsers.Add(owner); + } + } + User[] users = new User[unKnownUsers.Count]; + unKnownUsers.CopyTo( users ); + String[] attributes = { "user_name" }; + + + // ***************************** + // Execute the service operation + // ***************************** + dmService.GetProperties(users, attributes); + + + } + + + } +} diff --git a/Backup/hello/DataManagement.cs b/Backup/hello/DataManagement.cs new file mode 100644 index 0000000..7c67483 --- /dev/null +++ b/Backup/hello/DataManagement.cs @@ -0,0 +1,379 @@ +//================================================== +// +// @@ +// +//================================================== + + + + +using System; +using System.Collections; + +using Teamcenter.ClientX; +using Teamcenter.Schemas.Soa._2006_03.Exceptions; + +// Include the Data Management Service Interface +using Teamcenter.Services.Strong.Core; + +// Input and output structures for the service operations +// Note: the different namespace from the service interface +using Teamcenter.Services.Strong.Core._2006_03.DataManagement; +using Teamcenter.Services.Strong.Core._2007_01.DataManagement; +using Teamcenter.Soa.Client.Model; +using Teamcenter.Soa.Exceptions; + +using Item = Teamcenter.Soa.Client.Model.Strong.Item; +using ItemRevision = Teamcenter.Soa.Client.Model.Strong.ItemRevision; + +namespace Teamcenter.Hello +{ + +/** + * Perform different operations in the DataManamentService + * + */ +public class DataManagement +{ + + /** + * Perform a sequence of data management operations: Create Items, Revise + * the Items, and Delete the Items + * + */ + public void createReviseAndDelete() + { + try + { + int numberOfItems = 3; + + // Reserve Item IDs and Create Items with those IDs + ItemIdsAndInitialRevisionIds[] itemIds = generateItemIds(numberOfItems, "Item"); + CreateItemsOutput[] newItems = createItems(itemIds, "Item"); + + // Copy the Item and ItemRevision to separate arrays for further + // processing + Item[] items = new Item[newItems.Length]; + ItemRevision[] itemRevs = new ItemRevision[newItems.Length]; + for (int i = 0; i < items.Length; i++) + { + items[i] = newItems[i].Item; + itemRevs[i] = newItems[i].ItemRev; + } + + // Reserve revision IDs and revise the Items + Hashtable allRevIds = generateRevisionIds(items); + reviseItems(allRevIds, itemRevs); + + // Delete all objects created + deleteItems(items); + } + catch (ServiceException e) + { + System.Console.Out.WriteLine(e.Message ); + } + + } + + /** + * Reserve a number Item and Revision Ids + * + * @param numberOfIds Number of IDs to generate + * @param type Type of IDs to generate + * + * @return An array of Item and Revision IDs. The size of the array is equal + * to the input numberOfIds + * + * @throws ServiceException If any partial errors are returned + */ + public ItemIdsAndInitialRevisionIds[] generateItemIds(int numberOfIds, String type) + // throws ServiceException + { + // Get the service stub + DataManagementService dmService = DataManagementService.getService(Session.getConnection()); + + GenerateItemIdsAndInitialRevisionIdsProperties[] properties = new GenerateItemIdsAndInitialRevisionIdsProperties[1]; + GenerateItemIdsAndInitialRevisionIdsProperties property = new GenerateItemIdsAndInitialRevisionIdsProperties(); + + property.Count = numberOfIds; + property.ItemType = type; + property.Item = null; // Not used + properties[0] = property; + + // ***************************** + // Execute the service operation + // ***************************** + GenerateItemIdsAndInitialRevisionIdsResponse response = dmService.GenerateItemIdsAndInitialRevisionIds(properties); + + + + // The AppXPartialErrorListener is logging the partial errors returned + // In this simple example if any partial errors occur we will throw a + // ServiceException + if (response.ServiceData.sizeOfPartialErrors() > 0) + throw new ServiceException( "DataManagementService.generateItemIdsAndInitialRevisionIds returned a partial error."); + + // The return is a map of ItemIdsAndInitialRevisionIds keyed on the + // 0-based index of requested IDs. Since we only asked for IDs for one + // data type, the map key is '0' + Int32 bIkey = 0; + Hashtable allNewIds = response.OutputItemIdsAndInitialRevisionIds; + ItemIdsAndInitialRevisionIds[] myNewIds = (ItemIdsAndInitialRevisionIds[]) allNewIds[bIkey]; + + return myNewIds; + } + + /** + * Create Items + * + * @param itemIds Array of Item and Revision IDs + * @param itemType Type of item to create + * + * @return Set of Items and ItemRevisions + * + * @throws ServiceException If any partial errors are returned + */ + public CreateItemsOutput[] createItems(ItemIdsAndInitialRevisionIds[] itemIds, String itemType) + // throws ServiceException + { + // Get the service stub + DataManagementService dmService = DataManagementService.getService(Session.getConnection()); + // Populate form type + GetItemCreationRelatedInfoResponse relatedResponse = dmService.GetItemCreationRelatedInfo(itemType, null); + String[] formTypes = new String[0]; + if ( relatedResponse.ServiceData.sizeOfPartialErrors() > 0) + throw new ServiceException( "DataManagementService.getItemCretionRelatedInfo returned a partial error."); + + formTypes = new String[relatedResponse.FormAttrs.Length]; + for ( int i = 0; i < relatedResponse.FormAttrs.Length; i++ ) + { + FormAttributesInfo attrInfo = relatedResponse.FormAttrs[i]; + formTypes[i] = attrInfo.FormType; + } + + ItemProperties[] itemProps = new ItemProperties[itemIds.Length]; + for (int i = 0; i < itemIds.Length; i++) + { + // Create form in cache for form property population + ModelObject[] forms = createForms(itemIds[i].NewItemId, formTypes[0], + itemIds[i].NewRevId, formTypes[1], + null, false); + ItemProperties itemProperty = new ItemProperties(); + + itemProperty.ClientId = "AppX-Test"; + itemProperty.ItemId = itemIds[i].NewItemId; + itemProperty.RevId = itemIds[i].NewRevId; + itemProperty.Name = "AppX-Test"; + itemProperty.Type = itemType; + itemProperty.Description = "Test Item for the SOA AppX sample application."; + itemProperty.Uom = ""; + + // Retrieve one of form attribute value from Item master form. + ServiceData serviceData = dmService.GetProperties(forms, new String[]{"project_id"}); + if ( serviceData.sizeOfPartialErrors() > 0) + throw new ServiceException( "DataManagementService.getProperties returned a partial error."); + Property property = null; + try + { + property= forms[0].GetProperty("project_id"); + } + catch ( NotLoadedException /*ex*/){} + + + // Only if value is null, we set new value + if ( property == null || property.StringValue == null || property.StringValue.Length == 0) + { + itemProperty.ExtendedAttributes = new ExtendedAttributes[1]; + ExtendedAttributes theExtendedAttr = new ExtendedAttributes(); + theExtendedAttr.Attributes = new Hashtable(); + theExtendedAttr.ObjectType = formTypes[0]; + theExtendedAttr.Attributes["project_id"] = "project_id"; + itemProperty.ExtendedAttributes[0] = theExtendedAttr; + } + itemProps[i] = itemProperty; + } + + + // ***************************** + // Execute the service operation + // ***************************** + CreateItemsResponse response = dmService.CreateItems(itemProps, null, ""); + // before control is returned the ChangedHandler will be called with + // newly created Item and ItemRevisions + + + + // The AppXPartialErrorListener is logging the partial errors returned + // In this simple example if any partial errors occur we will throw a + // ServiceException + if (response.ServiceData.sizeOfPartialErrors() > 0) + throw new ServiceException( "DataManagementService.createItems returned a partial error."); + + return response.Output; + } + + /** + * Reserve Revision IDs + * + * @param items Array of Items to reserve Ids for + * + * @return Map of RevisionIds + * + * @throws ServiceException If any partial errors are returned + */ + public Hashtable generateRevisionIds(Item[] items) //throws ServiceException + { + // Get the service stub + DataManagementService dmService = DataManagementService.getService(Session.getConnection()); + + GenerateRevisionIdsResponse response = null; + GenerateRevisionIdsProperties[] input = null; + input = new GenerateRevisionIdsProperties[items.Length]; + for (int i = 0; i < items.Length; i++) + { + GenerateRevisionIdsProperties property = new GenerateRevisionIdsProperties(); + property.Item = items[i]; + property.ItemType = ""; + input[i] = property; + } + + // ***************************** + // Execute the service operation + // ***************************** + response = dmService.GenerateRevisionIds(input); + + // The AppXPartialErrorListener is logging the partial errors returned + // In this simple example if any partial errors occur we will throw a + // ServiceException + if (response.ServiceData.sizeOfPartialErrors() > 0) + throw new ServiceException( "DataManagementService.generateRevisionIds returned a partial error."); + + return response.OutputRevisionIds; + } + + /** + * Revise Items + * + * @param revisionIds Map of Revsion IDs + * @param itemRevs Array of ItemRevisons + * + * @return Map of Old ItemRevsion(key) to new ItemRevision(value) + * + * @throws ServiceException If any partial errors are returned + */ + public Hashtable reviseItems(Hashtable revisionIds, ItemRevision[] itemRevs) //throws ServiceException + { + // Get the service stub + DataManagementService dmService = DataManagementService.getService(Session.getConnection()); + + Hashtable revs = new Hashtable(); + for (int i = 0; i < itemRevs.Length; i++) + { + + + RevisionIds rev = (RevisionIds) revisionIds[i]; + + ReviseProperties revProps = new ReviseProperties(); + + revProps.RevId = rev.NewRevId; + revProps.Name = "testRevise"; + revProps.Description = "describe testRevise"; + + Hashtable attrs = new Hashtable(); + attrs["project_id"] = "project_id_val"; + revProps.ExtendedAttributes = attrs; + + revs[itemRevs[i]]= revProps; + } + + // ***************************** + // Execute the service operation + // ***************************** + ReviseResponse revised = dmService.Revise(revs); + // before control is returned the ChangedHandler will be called with + // newly created Item and ItemRevisions + + + + // The AppXPartialErrorListener is logging the partial errors returned + // In this simple example if any partial errors occur we will throw a + // ServiceException + if (revised.ServiceData.sizeOfPartialErrors() > 0) + throw new ServiceException("DataManagementService.revise returned a partial error."); + + return revised.OldItemRevToNewItemRev; + + } + + /** + * Delete the Items + * + * @param items Array of Items to delete + * + * @throws ServiceException If any partial errors are returned + */ + public void deleteItems(Item[] items) //throws ServiceException + { + // Get the service stub + DataManagementService dmService = DataManagementService.getService(Session.getConnection()); + + // ***************************** + // Execute the service operation + // ***************************** + ServiceData serviceData = dmService.DeleteObjects(items); + + // The AppXPartialErrorListener is logging the partial errors returned + // In this simple example if any partial errors occur we will throw a + // ServiceException + if (serviceData.sizeOfPartialErrors() > 0) + throw new ServiceException("DataManagementService.deleteObjects returned a partial error."); + + } + + /** + * Create ItemMasterForm and ItemRevisionMasterForm + * + * @param IMFormName Name of ItemMasterForm + * @param IMFormType Type of ItemMasterForm + * @param IRMFormName Name of ItemRevisionMasterForm + * @param IRMFormType Type of ItemRevisionMasterForm + * @param parent The container object that two + * newly-created forms will be added into. + * @return ModelObject[] Array of forms + * + * @throws ServiceException If any partial errors are returned + */ + public ModelObject[] createForms ( String IMFormName, String IMFormType, + String IRMFormName, String IRMFormType, + ModelObject parent, bool saveDB ) //throws ServiceException + { + //Get the service stub + DataManagementService dmService = DataManagementService.getService(Session.getConnection()); + FormInfo[] inputs = new FormInfo[2]; + inputs[0] = new FormInfo(); + inputs[0].ClientId = "1"; + inputs[0].Description=""; + inputs[0].Name = IMFormName; + inputs[0].FormType=IMFormType; + inputs[0].SaveDB = saveDB; + inputs[0].ParentObject = parent ; + inputs[1] = new FormInfo(); + inputs[1].ClientId = "2"; + inputs[1].Description=""; + inputs[1].Name = IRMFormName; + inputs[1].FormType=IRMFormType; + inputs[1].SaveDB = saveDB; + inputs[1].ParentObject = parent; + CreateOrUpdateFormsResponse response = dmService.CreateOrUpdateForms(inputs); + if ( response.ServiceData.sizeOfPartialErrors() > 0) + throw new ServiceException("DataManagementService.createForms returned a partial error."); + ModelObject[] forms = new ModelObject [inputs.Length]; + for (int i=0; i@ +// +//================================================== + + +using System; +using Teamcenter.ClientX; + +using User = Teamcenter.Soa.Client.Model.Strong.User; + +namespace Teamcenter.Hello +{ +/** + * This sample client application demonstrates some of the basic features of the + * Teamcenter Services framework and a few of the services. + * + * An instance of the Connection object is created with implementations of the + * ExceptionHandler, PartialErrorListener, ChangeListener, and DeleteListeners + * intefaces. This client application performs the following functions: + * 1. Establishes a session with the Teamcenter server + * 2. Display the contents of the Home Folder + * 3. Performs a simple query of the database + * 4. Create, revise, and delete an Item + * + */ +public class Hello +{ + + /** + * @param args -help or -h will print out a Usage statement + */ + public static void Main(string[] args) + { + String serverHost = "http://localhost:7001/tc"; + + if (args.Length > 0) + { + if (args[0].Equals("-help") || args[0].Equals("-h")) + { + System.Console.Out.WriteLine("usage: Hello [-host http://server:port/tc]"); + return; + } + if (args[0].Equals("-host") && args.Length > 1) + { + // Get optional host information + serverHost = args[1]; + } + } + + + + try + { + + Session session = new Session(serverHost); + HomeFolder home = new HomeFolder(); + Query query = new Query(); + DataManagement dm = new DataManagement(); + + + + + + // Establish a session with the Teamcenter Server + User user = session.login(); + + // Using the User object returned from the login service request + // display the contents of the Home Folder + home.listHomeFolder(user); + + // Perform a simple query of the database + query.queryItems(); + + // Perform some basic data management functions + dm.createReviseAndDelete(); + + // Terminate the session with the Teamcenter server + session.logout(); + } + catch (SystemException e) + { + Console.WriteLine(e.Message); + } + + } +} +} + + diff --git a/Backup/hello/HomeFolder.cs b/Backup/hello/HomeFolder.cs new file mode 100644 index 0000000..d597ace --- /dev/null +++ b/Backup/hello/HomeFolder.cs @@ -0,0 +1,79 @@ +//================================================== +// +// @@ +// +//================================================== + +using System; + +using Teamcenter.ClientX; +using Teamcenter.Services.Strong.Core; +using Teamcenter.Soa.Client.Model; +using Teamcenter.Soa.Exceptions; + +using User = Teamcenter.Soa.Client.Model.Strong.User; +using Folder = Teamcenter.Soa.Client.Model.Strong.Folder; +using WorkspaceObject = Teamcenter.Soa.Client.Model.Strong.WorkspaceObject; + +namespace Teamcenter.Hello +{ +public class HomeFolder +{ + + /** + * List the contents of the Home folder. + * + */ + public void listHomeFolder(User user) + { + Folder home = null; + WorkspaceObject[] contents = null; + + // Get the service stub + DataManagementService dmService = DataManagementService.getService(Session.getConnection()); + + try + { + // User was a primary object returned from the login command + // the Object Property Policy should be configured to include the + // 'home_folder' property. However the actuall 'home_folder' object + // was a secondary object returned from the login request and + // therefore does not have any properties associated with it. We will need to + // get those properties explicitly with a 'getProperties' service request. + home = user.Home_folder; + } + catch (NotLoadedException e) + { + Console.Out.WriteLine(e.Message); + Console.Out.WriteLine("The Object Property Policy ($TC_DATA/soa/policies/Default.xml) is not configured with this property."); + return; + } + + try + { + ModelObject[] objects = { home }; + String[] attributes = { "contents" }; + + // ***************************** + // Execute the service operation + // ***************************** + dmService.GetProperties(objects, attributes); + + + // The above getProperties call returns a ServiceData object, but it + // just has pointers to the same object we passed into the method, so the + // input object have been updated with new property values + contents = home.Contents; + } + // This should never be thrown, since we just explicitly asked for this + // property + catch (NotLoadedException /*e*/){} + + Console.Out.WriteLine(""); + Console.Out.WriteLine("Home Folder:"); + Session.printObjects( contents ); + + } + +} +} diff --git a/Backup/hello/Query.cs b/Backup/hello/Query.cs new file mode 100644 index 0000000..8ce01b8 --- /dev/null +++ b/Backup/hello/Query.cs @@ -0,0 +1,112 @@ +//================================================== +// +// @@ +// +//================================================== + +using System; + +using Teamcenter.ClientX; +using Teamcenter.Schemas.Soa._2006_03.Exceptions; + +//Include the Saved Query Service Interface +using Teamcenter.Services.Strong.Query; + +// Input and output structures for the service operations +// Note: the different namespace from the service interface +using Teamcenter.Services.Strong.Query._2006_03.SavedQuery; + +using ImanQuery = Teamcenter.Soa.Client.Model.Strong.ImanQuery; + + +namespace Teamcenter.Hello +{ +public class Query +{ + + /** + * Perform a simple query of the database + * + */ + public void queryItems() + { + + ImanQuery query = null; + + // Get the service stub + SavedQueryService queryService = SavedQueryService.getService(Session.getConnection()); + + try + { + + // ***************************** + // Execute the service operation + // ***************************** + GetSavedQueriesResponse savedQueries = queryService.GetSavedQueries(); + + + if (savedQueries.Queries.Length == 0) + { + Console.Out.WriteLine("There are no saved queries in the system."); + return; + } + + // Find one called 'Item Name' + for (int i = 0; i < savedQueries.Queries.Length; i++) + { + + if (savedQueries.Queries[i].Name.Equals("Item Name")) + { + query = savedQueries.Queries[i].Query; + break; + } + } + } + catch (ServiceException e) + { + Console.Out.WriteLine("GetSavedQueries service request failed."); + Console.Out.WriteLine(e.Message); + return; + } + + if (query == null) + { + Console.WriteLine("There is not an 'Item Name' query."); + return; + } + + try + { + // Search for all Items, returning a maximum of 25 objects + Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryInput[] savedQueryInput = new Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryInput[1]; + savedQueryInput[0] = new Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryInput(); + savedQueryInput[0].Query = query; + savedQueryInput[0].MaxNumToReturn = 25; + savedQueryInput[0].LimitListCount = 0; + savedQueryInput[0].LimitList = new Teamcenter.Soa.Client.Model.ModelObject[0]; + savedQueryInput[0].Entries = new String[] { "Item Name" }; + savedQueryInput[0].Values = new String[1]; + savedQueryInput[0].Values[0] = "*"; + savedQueryInput[0].MaxNumToInflate = 25; + + //***************************** + //Execute the service operation + //***************************** + Teamcenter.Services.Strong.Query._2007_06.SavedQuery.ExecuteSavedQueriesResponse savedQueryResult = queryService.ExecuteSavedQueries(savedQueryInput); + + Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryResults found = savedQueryResult.ArrayOfResults[0]; + + System.Console.Out.WriteLine(""); + System.Console.Out.WriteLine("Found Items:"); + Teamcenter.ClientX.Session.printObjects( found.Objects ); + } + catch (ServiceException e) + { + Console.Out.WriteLine("ExecuteSavedQuery service request failed."); + Console.Out.WriteLine(e.Message); + return; + } + + } +} +} diff --git a/Backup1/HelloTeamcenter.csproj b/Backup1/HelloTeamcenter.csproj new file mode 100644 index 0000000..07db822 --- /dev/null +++ b/Backup1/HelloTeamcenter.csproj @@ -0,0 +1,735 @@ + + + Debug + AnyCPU + 9.0.30729 + 2.0 + {5503038E-4D69-4703-9F79-90C8D9061A70} + Library + Properties + HelloTeamcenter + OriginAutocad + + + + + 2.0 + v3.0 + + + publish\ + true + Disk + false + Foreground + 7 + Days + false + false + true + 0 + 1.0.0.%2a + false + false + true + + + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + False + ..\..\..\..\ObjectARX2010\acdbmgd.dll + + + False + ..\..\..\..\ObjectARX2010\acmgd.dll + + + False + ..\..\..\..\ObjectARX2010\inc-win32\Autodesk.AutoCAD.Interop.dll + + + False + ..\..\..\..\ObjectARX2010\inc-win32\Autodesk.AutoCAD.Interop.Common.dll + + + False + ..\soa_client\net\libs\FCCNetClientProxyv80.dll + + + False + ..\soa_client\net\libs\FMSNetTicketv80.dll + + + False + ..\soa_client\net\libs\FSCNetClientProxyv80.dll + + + False + ..\soa_client\net\libs\log4net.dll + + + + + + + + False + ..\soa_client\net\libs\TcSoaAdministrationStrong.dll + + + False + ..\soa_client\net\libs\TcSoaAdministrationTypes.dll + + + False + ..\soa_client\net\libs\TcSoaAiStrong.dll + + + False + ..\soa_client\net\libs\TcSoaAiTypes.dll + + + False + ..\soa_client\net\libs\TcSoaAllocationsStrong.dll + + + False + ..\soa_client\net\libs\TcSoaAllocationsTypes.dll + + + False + ..\soa_client\net\libs\TcSoaAsbAsmAlignmentStrong.dll + + + False + ..\soa_client\net\libs\TcSoaAsbAsmAlignmentTypes.dll + + + False + ..\soa_client\net\libs\TcSoaAsBuiltStrong.dll + + + False + ..\soa_client\net\libs\TcSoaAsBuiltTypes.dll + + + False + ..\soa_client\net\libs\TcSoaAsMaintainedStrong.dll + + + False + ..\soa_client\net\libs\TcSoaAsMaintainedTypes.dll + + + False + ..\soa_client\net\libs\TcSoaAuthorizedDataAccessStrong.dll + + + False + ..\soa_client\net\libs\TcSoaAuthorizedDataAccessTypes.dll + + + False + ..\soa_client\net\libs\TcSoaBomStrong.dll + + + False + ..\soa_client\net\libs\TcSoaBomTypes.dll + + + False + ..\soa_client\net\libs\TcSoaBusinessModelerStrong.dll + + + False + ..\soa_client\net\libs\TcSoaBusinessModelerTypes.dll + + + False + ..\soa_client\net\libs\TcSoaCadBomAlignmentStrong.dll + + + False + ..\soa_client\net\libs\TcSoaCadBomAlignmentTypes.dll + + + False + ..\soa_client\net\libs\TcSoaCadStrong.dll + + + False + ..\soa_client\net\libs\TcSoaCadTypes.dll + + + False + ..\soa_client\net\libs\TcSoaCaeStrong.dll + + + False + ..\soa_client\net\libs\TcSoaCaeTypes.dll + + + False + ..\soa_client\net\libs\TcSoaCalendarManagementStrong.dll + + + False + ..\soa_client\net\libs\TcSoaCalendarManagementTypes.dll + + + False + ..\soa_client\net\libs\TcSoaChangeManagementStrong.dll + + + False + ..\soa_client\net\libs\TcSoaChangeManagementTypes.dll + + + False + ..\soa_client\net\libs\TcSoaClassificationStrong.dll + + + False + ..\soa_client\net\libs\TcSoaClassificationTypes.dll + + + False + ..\..\libs\TcSoaClient.dll + + + False + ..\..\libs\TcSoaCommon.dll + + + False + ..\soa_client\net\libs\TcSoaConfigurationStrong.dll + + + False + ..\soa_client\net\libs\TcSoaConfigurationTypes.dll + + + False + ..\..\libs\TcSoaCoreStrong.dll + + + False + ..\..\libs\TcSoaCoreTypes.dll + + + False + ..\soa_client\net\libs\TcSoaDocumentManagementStrong.dll + + + False + ..\soa_client\net\libs\TcSoaDocumentManagementTypes.dll + + + False + ..\soa_client\net\libs\TcSoaFMS.dll + + + False + ..\soa_client\net\libs\TcSoaGlobalMultiSiteStrong.dll + + + False + ..\soa_client\net\libs\TcSoaGlobalMultiSiteTypes.dll + + + False + ..\soa_client\net\libs\TcSoaImportExportStrong.dll + + + False + ..\soa_client\net\libs\TcSoaImportExportTypes.dll + + + False + ..\soa_client\net\libs\TcSoaIssueManagementStrong.dll + + + False + ..\soa_client\net\libs\TcSoaIssueManagementTypes.dll + + + False + ..\soa_client\net\libs\TcSoaManufacturingStrong.dll + + + False + ..\soa_client\net\libs\TcSoaManufacturingTypes.dll + + + False + ..\soa_client\net\libs\TcSoaMESStrong.dll + + + False + ..\soa_client\net\libs\TcSoaMESTypes.dll + + + False + ..\soa_client\net\libs\TcSoaMultisiteStrong.dll + + + False + ..\soa_client\net\libs\TcSoaMultisiteTypes.dll + + + False + ..\soa_client\net\libs\TcSoaParameterManagementStrong.dll + + + False + ..\soa_client\net\libs\TcSoaParameterManagementTypes.dll + + + False + ..\soa_client\net\libs\TcSoaProductionManagementStrong.dll + + + False + ..\soa_client\net\libs\TcSoaProductionManagementTypes.dll + + + False + ..\soa_client\net\libs\TcSoaProjectManagementStrong.dll + + + False + ..\soa_client\net\libs\TcSoaProjectManagementTypes.dll + + + False + ..\..\libs\TcSoaQueryStrong.dll + + + False + ..\..\libs\TcSoaQueryTypes.dll + + + False + ..\soa_client\net\libs\TcSoaRdvStrong.dll + + + False + ..\soa_client\net\libs\TcSoaRdvTypes.dll + + + False + ..\soa_client\net\libs\TcSoaReportsStrong.dll + + + False + ..\soa_client\net\libs\TcSoaReportsTypes.dll + + + False + ..\soa_client\net\libs\TcSoaRequirementsManagementStrong.dll + + + False + ..\soa_client\net\libs\TcSoaRequirementsManagementTypes.dll + + + False + ..\soa_client\net\libs\TcSoaSrmIntegrationStrong.dll + + + False + ..\soa_client\net\libs\TcSoaSrmIntegrationTypes.dll + + + False + ..\..\libs\TcSoaStrongModel.dll + + + False + ..\soa_client\net\libs\TcSoaStrongModelAcadGmo.dll + + + False + ..\soa_client\net\libs\TcSoaStrongModelAdsFoundation.dll + + + False + ..\soa_client\net\libs\TcSoaStrongModelAsBuilt.dll + + + False + ..\soa_client\net\libs\TcSoaStrongModelAsMaintained.dll + + + False + ..\soa_client\net\libs\TcSoaStrongModelBrndMgmt.dll + + + False + ..\soa_client\net\libs\TcSoaStrongModelCba.dll + + + False + ..\soa_client\net\libs\TcSoaStrongModelCcdm.dll + + + False + ..\soa_client\net\libs\TcSoaStrongModelCm.dll + + + False + ..\soa_client\net\libs\TcSoaStrongModelCmtEbop.dll + + + False + ..\soa_client\net\libs\TcSoaStrongModelCmtEmserver.dll + + + False + ..\soa_client\net\libs\TcSoaStrongModelCmtPadTwp.dll + + + False + ..\soa_client\net\libs\TcSoaStrongModelContmgmtBase.dll + + + False + ..\soa_client\net\libs\TcSoaStrongModelContmgmtDita.dll + + + False + ..\soa_client\net\libs\TcSoaStrongModelContmgmtS1000d.dll + + + False + ..\soa_client\net\libs\TcSoaStrongModelCpgMaterials.dll + + + False + ..\soa_client\net\libs\TcSoaStrongModelDpv.dll + + + False + ..\soa_client\net\libs\TcSoaStrongModelEdaLibrary.dll + + + False + ..\soa_client\net\libs\TcSoaStrongModelEdaServer.dll + + + False + ..\soa_client\net\libs\TcSoaStrongModelEmps.dll + + + False + ..\soa_client\net\libs\TcSoaStrongModelEsddm.dll + + + False + ..\soa_client\net\libs\TcSoaStrongModelEsddmScm.dll + + + False + ..\soa_client\net\libs\TcSoaStrongModelEsmBase.dll + + + False + ..\soa_client\net\libs\TcSoaStrongModelEsmProcessor.dll + + + False + ..\soa_client\net\libs\TcSoaStrongModelEsmSoftware.dll + + + False + ..\soa_client\net\libs\TcSoaStrongModelFpMgmt.dll + + + False + ..\soa_client\net\libs\TcSoaStrongModelGmdpv.dll + + + False + ..\soa_client\net\libs\TcSoaStrongModelGmo.dll + + + False + ..\soa_client\net\libs\TcSoaStrongModelHrn.dll + + + False + ..\soa_client\net\libs\TcSoaStrongModelIssueManagement.dll + + + False + ..\soa_client\net\libs\TcSoaStrongModelMES.dll + + + False + ..\soa_client\net\libs\TcSoaStrongModelMROCore.dll + + + False + ..\soa_client\net\libs\TcSoaStrongModelPkgArt.dll + + + False + ..\soa_client\net\libs\TcSoaStrongModelProductVariant.dll + + + False + ..\soa_client\net\libs\TcSoaStrongModelScdt.dll + + + False + ..\soa_client\net\libs\TcSoaStrongModelScmCc.dll + + + False + ..\soa_client\net\libs\TcSoaStrongModelServiceEventManagement.dll + + + False + ..\soa_client\net\libs\TcSoaStrongModelServiceProcessing.dll + + + False + ..\soa_client\net\libs\TcSoaStrongModelServiceRequest.dll + + + False + ..\soa_client\net\libs\TcSoaStrongModelSpecMgr.dll + + + False + ..\soa_client\net\libs\TcSoaStrongModelTcae.dll + + + False + ..\soa_client\net\libs\TcSoaStrongModelTransactionProcessing.dll + + + False + ..\soa_client\net\libs\TcSoaStrongModelVendorManagement.dll + + + False + ..\soa_client\net\libs\TcSoaStructureManagementStrong.dll + + + False + ..\soa_client\net\libs\TcSoaStructureManagementTypes.dll + + + False + ..\soa_client\net\libs\TcSoaSvcProcessingStrong.dll + + + False + ..\soa_client\net\libs\TcSoaSvcProcessingTypes.dll + + + False + ..\soa_client\net\libs\TcSoaSvcRequestStrong.dll + + + False + ..\soa_client\net\libs\TcSoaSvcRequestTypes.dll + + + False + ..\soa_client\net\libs\TcSoaTranslationStrong.dll + + + False + ..\soa_client\net\libs\TcSoaTranslationTypes.dll + + + False + ..\soa_client\net\libs\TcSoaValidationStrong.dll + + + False + ..\soa_client\net\libs\TcSoaValidationTypes.dll + + + False + ..\soa_client\net\libs\TcSoaVendorManagementStrong.dll + + + False + ..\soa_client\net\libs\TcSoaVendorManagementTypes.dll + + + False + ..\soa_client\net\libs\TcSoaWireHarnessStrong.dll + + + False + ..\soa_client\net\libs\TcSoaWireHarnessTypes.dll + + + False + ..\soa_client\net\libs\TcSoaWorkflowStrong.dll + + + False + ..\soa_client\net\libs\TcSoaWorkflowTypes.dll + + + False + ..\soa_client\net\libs\Teamcenter_SSO.dll + + + False + ..\soa_client\net\libs\Teamcenter_SSOloader.dll + + + + + + + + + + + + Form + + + Login.cs + + + Form + + + OpenFromTC.cs + + + Form + + + SaveToTC.cs + + + Form + + + Search.cs + + + + + + + + + + + + + + + + + + + True + True + Resources.resx + + + + + + + + False + .NET Framework Client Profile + false + + + False + .NET Framework 2.0 %28x86%29 + false + + + False + .NET Framework 3.0 %28x86%29 + true + + + False + .NET Framework 3.5 + false + + + False + .NET Framework 3.5 SP1 + false + + + False + Windows Installer 3.1 + true + + + + + Login.cs + + + OpenFromTC.cs + + + SaveToTC.cs + + + Search.cs + + + ResXFileCodeGenerator + Resources.Designer.cs + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Backup1/HelloTeamcenter.csproj.user b/Backup1/HelloTeamcenter.csproj.user new file mode 100644 index 0000000..2a88fb2 --- /dev/null +++ b/Backup1/HelloTeamcenter.csproj.user @@ -0,0 +1,17 @@ + + + publish\ + + + + + + + + + + + zh-CN + false + + \ No newline at end of file diff --git a/Backup1/HelloTeamcenter.sln b/Backup1/HelloTeamcenter.sln new file mode 100644 index 0000000..b27bc7d --- /dev/null +++ b/Backup1/HelloTeamcenter.sln @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual Studio 2008 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HelloTeamcenter", "HelloTeamcenter.csproj", "{5503038E-4D69-4703-9F79-90C8D9061A70}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {5503038E-4D69-4703-9F79-90C8D9061A70}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5503038E-4D69-4703-9F79-90C8D9061A70}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5503038E-4D69-4703-9F79-90C8D9061A70}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5503038E-4D69-4703-9F79-90C8D9061A70}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Backup1/HelloTeamcenter.suo b/Backup1/HelloTeamcenter.suo new file mode 100644 index 0000000..dc8f4d6 Binary files /dev/null and b/Backup1/HelloTeamcenter.suo differ diff --git a/Backup1/Properties/AssemblyInfo.cs b/Backup1/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..d8867fb --- /dev/null +++ b/Backup1/Properties/AssemblyInfo.cs @@ -0,0 +1,41 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using Autodesk.AutoCAD.DatabaseServices; +using Autodesk.AutoCAD.Runtime; +using Autodesk.AutoCAD.Geometry; +using Autodesk.AutoCAD.ApplicationServices; +using Autodesk.AutoCAD.EditorInput; +using Autodesk.AutoCAD.Windows; +using HelloTeamcenter.hello; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("HelloTeamcenter")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Siemens Product Lifecycle Management Software Inc.")] +[assembly: AssemblyProduct("HelloTeamcenter")] +[assembly: AssemblyCopyright("Copyright 2008 Siemens Product Lifecycle Management Software Inc.")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("6ce4adbe-4247-464b-8d53-e3ecb88955fd")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Backup1/Properties/Resources.Designer.cs b/Backup1/Properties/Resources.Designer.cs new file mode 100644 index 0000000..da50f60 --- /dev/null +++ b/Backup1/Properties/Resources.Designer.cs @@ -0,0 +1,119 @@ +//------------------------------------------------------------------------------ +// +// 此代码由工具生成。 +// 运行时版本:2.0.50727.3623 +// +// 对此文件的更改可能会导致不正确的行为,并且如果 +// 重新生成代码,这些更改将会丢失。 +// +//------------------------------------------------------------------------------ + +namespace HelloTeamcenter.Properties { + using System; + + + /// + /// 强类型资源类,用于查找本地化字符串等。 + /// + // 此类是由 StronglyTypedResourceBuilder + // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。 + // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen + // (以 /str 作为命令选项),或重新生成 VS 项目。 + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// 返回此类使用的缓存 ResourceManager 实例。 + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("HelloTeamcenter.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// 为使用此强类型资源类的所有资源查找 + /// 重写当前线程的 CurrentUICulture 属性。 + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + internal static System.Drawing.Bitmap autocad_01 { + get { + object obj = ResourceManager.GetObject("autocad_01", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + internal static System.Drawing.Bitmap FOLDER { + get { + object obj = ResourceManager.GetObject("FOLDER", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + internal static System.Drawing.Bitmap FOLDEROP { + get { + object obj = ResourceManager.GetObject("FOLDEROP", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + internal static System.Drawing.Bitmap item { + get { + object obj = ResourceManager.GetObject("item", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + internal static System.Drawing.Bitmap itemrev { + get { + object obj = ResourceManager.GetObject("itemrev", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + internal static System.Drawing.Bitmap login { + get { + object obj = ResourceManager.GetObject("login", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + internal static System.Drawing.Bitmap Newstuff_Folder { + get { + object obj = ResourceManager.GetObject("Newstuff_Folder", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + internal static System.Drawing.Bitmap tai { + get { + object obj = ResourceManager.GetObject("tai", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + } +} diff --git a/Backup1/Properties/Resources.resx b/Backup1/Properties/Resources.resx new file mode 100644 index 0000000..80582ff --- /dev/null +++ b/Backup1/Properties/Resources.resx @@ -0,0 +1,145 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + ..\res\autocad_01.ico;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\res\FOLDER.ICO;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\res\FOLDEROP.ICO;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\res\item.ico;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\res\itemrev.ico;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\res\login.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\res\Newstuff_Folder.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\res\tai.ico;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + \ No newline at end of file diff --git a/Backup1/app.config b/Backup1/app.config new file mode 100644 index 0000000..df20690 --- /dev/null +++ b/Backup1/app.config @@ -0,0 +1,3 @@ + + + diff --git a/Backup1/clientx/AppXCredentialManager.cs b/Backup1/clientx/AppXCredentialManager.cs new file mode 100644 index 0000000..6ad8fff --- /dev/null +++ b/Backup1/clientx/AppXCredentialManager.cs @@ -0,0 +1,146 @@ +//================================================== +// +// @@ +// +//================================================== + + + +using System; +using System.IO; + +using Teamcenter.Schemas.Soa._2006_03.Exceptions; +using Teamcenter.Soa; +using Teamcenter.Soa.Common; +using Teamcenter.Soa.Client; +using Teamcenter.Soa.Exceptions; + +namespace Teamcenter.ClientX +{ + +/** + * The CredentialManager is used by the Teamcenter Services framework to get the + * user's credentials when challanged by the server. This can occur after a period + * of inactivity and the server has timed-out the user's session, at which time + * the client application will need to re-authenitcate. The framework will + * call one of the getCredentials methods (depending on circumstances) and will + * send the SessionService.login service request. Upon successfull completion of + * the login service request. The last service request (one that cuased the challange) + * will be resent. + * + * The framework will also call the setUserPassword setGroupRole methods when ever + * these credentials change, thus allowing this implementation of the CredentialManager + * to cache these values so prompting of the user is not requried for re-authentication. + * + */ +public class AppXCredentialManager : CredentialManager +{ + + private String name = null; + private String password = null; + private String group = ""; // default group + private String role = ""; // default role + private String discriminator = "SoaAppX"; // always connect same user + // to same instance of server + + /** + * Return the type of credentials this implementation provides, + * standard (user/password) or Single-Sign-On. In this case + * Standard credentials are returned. + * + * @see com.teamcenter.soa.client.CredentialManager#getCredentialType() + */ + public int CredentialType + { + get { return SoaConstants.CLIENT_CREDENTIAL_TYPE_STD; } + } + + /** + * Prompt's the user for credentials. + * This method will only be called by the framework when a login attempt has + * failed. + * + * @see com.teamcenter.soa.client.CredentialManager#getCredentials(com.teamcenter.schemas.soa._2006_03.exceptions.InvalidCredentialsException) + */ + public string[] GetCredentials(InvalidCredentialsException e) + //throws CanceledOperationException + { + Console.WriteLine(e.Message); + return PromptForCredentials(); + } + + /** + * Return the cached credentials. + * This method will be called when a service request is sent without a valid + * session ( session has expired on the server). + * + * @see com.teamcenter.soa.client.CredentialManager#getCredentials(com.teamcenter.schemas.soa._2006_03.exceptions.InvalidUserException) + */ + public String[] GetCredentials(InvalidUserException e) + //throws CanceledOperationException + { + // Have not logged in yet, shoult not happen but just in case + if (name == null) return PromptForCredentials(); + + // Return cached credentials + String[] tokens = { name, password, group, role, discriminator }; + return tokens; + } + + /** + * Cache the group and role + * This is called after the SessionService.setSessionGroupMember service + * operation is called. + * + * @see com.teamcenter.soa.client.CredentialManager#setGroupRole(java.lang.String, + * java.lang.String) + */ + public void SetGroupRole(String group, String role) + { + this.group = group; + this.role = role; + } + + /** + * Cache the User and Password + * This is called after the SessionService.login service operation is called. + * + * @see com.teamcenter.soa.client.CredentialManager#setUserPassword(java.lang.String, + * java.lang.String, java.lang.String) + */ + public void SetUserPassword(String user, String password, String discriminator) + { + this.name = user; + this.password = password; + this.discriminator = discriminator; + } + + + public String[] PromptForCredentials() + //throws CanceledOperationException + { + try + { + Console.WriteLine("Please enter user credentials (return to quit):"); + Console.Write("User Name: "); + name = Console.ReadLine(); + + if (name.Length == 0) + throw new CanceledOperationException(""); + + Console.Write("Password: "); + password = Console.ReadLine(); + } + catch (IOException e) + { + String message = "Failed to get the name and password.\n" + e.Message; + Console.WriteLine(message); + throw new CanceledOperationException(message); + } + + String[] tokens = { name, password, group, role, discriminator }; + return tokens; + } + +} +} diff --git a/Backup1/clientx/AppXDeletedObjectListener.cs b/Backup1/clientx/AppXDeletedObjectListener.cs new file mode 100644 index 0000000..d051a7f --- /dev/null +++ b/Backup1/clientx/AppXDeletedObjectListener.cs @@ -0,0 +1,38 @@ +//================================================== +// +// @@ +// +//================================================== + +using System; + +using Teamcenter.Soa.Client.Model; + +namespace Teamcenter.ClientX +{ + +/** + * Implementation of the DeleteListener, simply prints out list of all objects + * that are deleted. + * + */ +public class AppXDeletedObjectListener : DeleteListener +{ + + public void ModelObjectDelete(string[] uids) + { + if (uids.Length == 0) + return; + + System.Console.WriteLine(""); + System.Console.WriteLine("Deleted Objects handled in com.teamcenter.clientx.AppXDeletedObjectListener.modelObjectDelete"); + System.Console.WriteLine("The following objects have been deleted from the server and removed from the client data model:"); + for (int i = 0; i < uids.Length; i++) + { + System.Console.WriteLine(" " + uids[i]); + } + + } + +} +} diff --git a/Backup1/clientx/AppXExceptionHandler.cs b/Backup1/clientx/AppXExceptionHandler.cs new file mode 100644 index 0000000..824c9ad --- /dev/null +++ b/Backup1/clientx/AppXExceptionHandler.cs @@ -0,0 +1,101 @@ +//================================================== +// +// @@ +// +//================================================== + + +using System; +using System.IO; + +using Teamcenter.Schemas.Soa._2006_03.Exceptions; +using Teamcenter.Soa.Client; +using Teamcenter.Soa.Exceptions; + +namespace Teamcenter.ClientX +{ + + + /** + * Implementation of the ExceptionHandler. For ConnectionExceptions (server + * temporarily down .etc) prompts the user to retry the last request. For other + * exceptions convert to a RunTime exception. + */ + public class AppXExceptionHandler : ExceptionHandler + { + + /* + * (non-Javadoc) + * + * @see com.teamcenter.soa.client.ExceptionHandler#handleException(com.teamcenter.schemas.soa._2006_03.exceptions.InternalServerException) + */ + public void HandleException(InternalServerException ise) + { + Console.WriteLine(""); + Console.WriteLine("*****"); + Console.WriteLine("Exception caught in com.teamcenter.clientx.AppXExceptionHandler.handleException(InternalServerException)."); + + + if (ise is ConnectionException) + { + // ConnectionException are typically due to a network error (server + // down .etc) and can be recovered from (the last request can be sent again, + // after the problem is corrected). + Console.Write("\nThe server returned an connection error.\n" + ise.Message + + "\nDo you wish to retry the last service request?[y/n]"); + } + else if (ise is ProtocolException) + { + // ProtocolException are typically due to programming errors + // (content of HTTP + // request is incorrect). These are generally can not be + // recovered from. + Console.Write("\nThe server returned an protocol error.\n" + ise.Message + + "\nThis is most likely the result of a programming error." + + "\nDo you wish to retry the last service request?[y/n]"); + } + else + { + Console.WriteLine("\nThe server returned an internal server error.\n" + + ise.Message + + "\nThis is most likely the result of a programming error." + + "\nA RuntimeException will be thrown."); + throw new SystemException(ise.Message); + } + + try + { + String retry = Console.ReadLine(); + // If yes, return to the calling SOA client framework, where the + // last service request will be resent. + if (retry.ToLower().Equals("y") || retry.ToLower().Equals("yes")) + return; + + throw new SystemException("The user has opted not to retry the last request"); + } + catch (IOException e) + { + Console.Error.WriteLine("Failed to read user response.\nA RuntimeException will be thrown."); + throw new SystemException(e.Message); + } + } + + /* + * (non-Javadoc) + * + * @see com.teamcenter.soa.client.ExceptionHandler#handleException(com.teamcenter.soa.exceptions.CanceledOperationException) + */ + public void HandleException(CanceledOperationException coe) + { + Console.WriteLine(""); + Console.WriteLine("*****"); + Console.WriteLine("Exception caught in com.teamcenter.clientx.AppXExceptionHandler.handleException(CanceledOperationException)."); + + // Expecting this from the login tests with bad credentials, and the + // AnyUserCredentials class not + // prompting for different credentials + throw new SystemException(coe.Message); + } + + } +} diff --git a/Backup1/clientx/AppXPartialErrorListener.cs b/Backup1/clientx/AppXPartialErrorListener.cs new file mode 100644 index 0000000..644a63b --- /dev/null +++ b/Backup1/clientx/AppXPartialErrorListener.cs @@ -0,0 +1,68 @@ +//================================================== +// +// @@ +// +//================================================== + +using System; + +using Teamcenter.Soa.Client.Model; + + +namespace Teamcenter.ClientX +{ + +/** + * Implementation of the PartialErrorListener. Print out any partial errors + * returned. + * + */ +public class AppXPartialErrorListener : PartialErrorListener +{ + + /* + * (non-Javadoc) + * + * @see com.teamcenter.soa.client.model.PartialErrorListener#handlePartialError(com.teamcenter.soa.client.model.ErrorStack[]) + */ + public void HandlePartialError(ErrorStack[] stacks) + { + if (stacks.Length == 0) return; + + Console.WriteLine(""); + Console.WriteLine("*****"); + Console.WriteLine("Partial Errors caught in com.teamcenter.clientx.AppXPartialErrorListener."); + + + for (int i = 0; i < stacks.Length; i++) + { + ErrorValue[] errors = stacks[i].ErrorValues; + Console.Write("Partial Error for "); + + // The different service implementation may optionally associate + // an ModelObject, client ID, or nothing, with each partial error + if (stacks[i].HasAssociatedObject() ) + { + Console.WriteLine("object "+ stacks[i].AssociatedObject.Uid); + } + else if (stacks[i].HasClientId()) + { + Console.WriteLine("client id "+ stacks[i].ClientId); + } + else if (stacks[i].HasClientIndex()) + { + Console.WriteLine("client index " + stacks[i].ClientIndex); + } + + // Each Partial Error will have one or more contributing error messages + for (int j = 0; j < errors.Length; j++) + { + Console.WriteLine(" Code: " + errors[j].Code + "\tSeverity: " + + errors[j].Level + "\t" + errors[j].Message); + } + } + + } + +} +} diff --git a/Backup1/clientx/AppXRequestListener.cs b/Backup1/clientx/AppXRequestListener.cs new file mode 100644 index 0000000..fe84a9a --- /dev/null +++ b/Backup1/clientx/AppXRequestListener.cs @@ -0,0 +1,42 @@ +//================================================== +// +// @@ +// +//================================================== + +using System; + +using Teamcenter.Soa.Client; + + +namespace Teamcenter.ClientX +{ + + /** + * This implemenation of the RequestListener, logs each service request + * to the console. + * + */ + public class AppXRequestListener : RequestListener + { + + + /** + * Called before each request is sent to the server. + */ + public void ServiceRequest(ServiceInfo info) + { + // will log the service name when done + } + + /** + * Called after each response from the server. + * Log the service operation to the console. + */ + public void ServiceResponse(ServiceInfo info) + { + Console.WriteLine(info.Id + ": " + info.Service + "." + info.Operation); + } + + } +} diff --git a/Backup1/clientx/AppXUpdateObjectListener.cs b/Backup1/clientx/AppXUpdateObjectListener.cs new file mode 100644 index 0000000..5865ee6 --- /dev/null +++ b/Backup1/clientx/AppXUpdateObjectListener.cs @@ -0,0 +1,48 @@ +//================================================== +// +// @@ +// +//================================================== + +using System; + +using Teamcenter.Soa.Client.Model; +using Teamcenter.Soa.Exceptions; + +namespace Teamcenter.ClientX +{ + + +/** + * Implementation of the ChangeListener. Print out all objects that have been updated. + * + */ +public class AppXUpdateObjectListener : ChangeListener +{ + + public void ModelObjectChange(ModelObject[] objects) + { + if (objects.Length == 0) return; + System.Console.WriteLine(""); + System.Console.WriteLine("Modified Objects handled in com.teamcenter.clientx.AppXUpdateObjectListener.modelObjectChange"); + System.Console.WriteLine("The following objects have been updated in the client data model:"); + for (int i = 0; i < objects.Length; i++) + { + String uid = objects[i].Uid; + String type = objects[i].GetType().Name; + String name = ""; + if (objects[i].GetType().Name.Equals("WorkspaceObject")) + { + ModelObject wo = objects[i]; + try + { + name = wo.GetProperty("object_string").StringValue; + } + catch (NotLoadedException /*e*/) {} // just ignore + } + System.Console.WriteLine(" " + uid + " " + type + " " + name); + } + } + +} +} diff --git a/Backup1/clientx/Session.cs b/Backup1/clientx/Session.cs new file mode 100644 index 0000000..4c75b49 --- /dev/null +++ b/Backup1/clientx/Session.cs @@ -0,0 +1,278 @@ +//================================================== +// +// @@ +// +//================================================== + + + + +using System; +using System.Collections; +using System.Net; + +using Teamcenter.Schemas.Soa._2006_03.Exceptions; +using Teamcenter.Services.Strong.Core; +using Teamcenter.Services.Strong.Core._2006_03.Session; +using Teamcenter.Soa; +using Teamcenter.Soa.Client; +using Teamcenter.Soa.Client.Model; +using Teamcenter.Soa.Exceptions; + +using WorkspaceObject = Teamcenter.Soa.Client.Model.Strong.WorkspaceObject; +using User = Teamcenter.Soa.Client.Model.Strong.User; + +namespace Teamcenter.ClientX +{ + + + public class Session + { + /** + * Single instance of the Connection object that is shared throughtout + * the application. This Connection object is needed whenever a Service + * stub is instantiated. + */ + private static Connection connection; + + /** + * The credentialManager is used both by the Session class and the Teamcenter + * Services Framework to get user credentials. + * + */ + private static AppXCredentialManager credentialManager; + + /** + * Create an instance of the Session with a connection to the specified + * server. + * + * Add implementations of the ExceptionHandler, PartialErrorListener, + * ChangeListener, and DeleteListeners. + * + * @param host Address of the host to connect to, http://serverName:port/tc + */ + public Session(String host) + { + // Create an instance of the CredentialManager, this is used + // by the SOA Framework to get the user's credentials when + // challanged by the server (sesioin timeout on the web tier). + credentialManager = new AppXCredentialManager(); + + + + // Create the Connection object, no contact is made with the server + // until a service request is made + connection = new Connection(host, new CookieCollection(), credentialManager, SoaConstants.REST, + SoaConstants.HTTP, false); + + + // Add an ExceptionHandler to the Connection, this will handle any + // InternalServerException, communication errors, xml marshalling errors + // .etc + connection.ExceptionHandler = new AppXExceptionHandler(); + + // While the above ExceptionHandler is required, all of the following + // Listeners are optional. Client application can add as many or as few Listeners + // of each type that they want. + + // Add a Partial Error Listener, this will be notified when ever a + // a service returns partial errors. + connection.ModelManager.AddPartialErrorListener(new AppXPartialErrorListener()); + + // Add a Change Listener, this will be notified when ever a + // a service returns model objects that have been updated. + connection.ModelManager.AddChangeListener(new AppXUpdateObjectListener()); + + // Add a Delete Listener, this will be notified when ever a + // a service returns objects that have been deleted. + connection.ModelManager.AddDeleteListener(new AppXDeletedObjectListener()); + + // Add a Request Listener, this will be notified before and after each + // service request is sent to the server. + Connection.AddRequestListener(new AppXRequestListener()); + } + + /** + * Get the single Connection object for the application + * + * @return connection + */ + public static Connection getConnection() + { + return connection; + } + + /** + * Login to the Teamcenter Server + * + */ + public User login() + { + // Get the service stub + SessionService sessionService = SessionService.getService(connection); + + try + { + // Prompt for credentials until they are right, or until user + // cancels + String[] credentials = credentialManager.PromptForCredentials(); + while (true) + { + try + { + + // ***************************** + // Execute the service operation + // ***************************** + LoginResponse resp = sessionService.Login(credentials[0], credentials[1], + credentials[2], credentials[3],"",credentials[4]); + + return resp.User; + } + catch (InvalidCredentialsException e) + { + credentials = credentialManager.GetCredentials(e); + } + } + } + // User canceled the operation, don't need to tell him again + catch (CanceledOperationException /*e*/) {} + + // Exit the application + //System.exit(0); + return null; + } + public User mylogin(string username,string password,string usergroup,string userrole) + { + // Get the service stub + SessionService sessionService = SessionService.getService(connection); + try + { + while (true) + { + try + { + + // ***************************** + // Execute the service operation + // ***************************** + LoginResponse resp = sessionService.Login(username, password, + usergroup, userrole, "", ""); + + return resp.User; + } + catch (InvalidCredentialsException e) + { + return null; + } + } + } + // User canceled the operation, don't need to tell him again + catch (CanceledOperationException /*e*/) { } + + // Exit the application + //System.exit(0); + return null; + } + /** + * Terminate the session with the Teamcenter Server + * + */ + public void logout() + { + // Get the service stub + SessionService sessionService = SessionService.getService(connection); + try + { + // ***************************** + // Execute the service operation + // ***************************** + sessionService.Logout(); + } + catch (ServiceException /*e*/) { } + } + + /** + * Print some basic information for a list of objects + * + * @param objects + */ + public static void printObjects(ModelObject[] objects) + { + if(objects == null) + return; + + + // Ensure that the referenced User objects that we will use below are loaded + getUsers( objects ); + + Console.WriteLine("Name\t\tOwner\t\tLast Modified"); + Console.WriteLine("====\t\t=====\t\t============="); + for (int i = 0; i < objects.Length; i++) + { + if(!(objects[i] is WorkspaceObject )) + continue; + + WorkspaceObject wo = (WorkspaceObject)objects[i]; + try + { + String name = wo.Object_string; + User owner = (User) wo.Owning_user; + DateTime lastModified =wo.Last_mod_date; + + Console.WriteLine(name + "\t" + owner.User_name + "\t" + lastModified.ToString()); + } + catch (NotLoadedException e) + { + // Print out a message, and skip to the next item in the folder + // Could do a DataManagementService.getProperties call at this point + Console.WriteLine(e.Message); + Console.WriteLine("The Object Property Policy ($TC_DATA/soa/policies/Default.xml) is not configured with this property."); + } + } + + } + + + private static void getUsers(ModelObject[] objects) + { + if(objects == null) + return; + + DataManagementService dmService = DataManagementService.getService(Session.getConnection()); + ArrayList unKnownUsers = new ArrayList(); + for (int i = 0; i < objects.Length; i++) + { + if(!(objects[i] is WorkspaceObject )) + continue; + + WorkspaceObject wo = (WorkspaceObject)objects[i]; + + User owner = null; + try + { + owner = (User) wo.Owning_user; + String userName = owner.User_name; + } + catch (NotLoadedException /*e*/) + { + if(owner != null) + unKnownUsers.Add(owner); + } + } + User[] users = new User[unKnownUsers.Count]; + unKnownUsers.CopyTo( users ); + String[] attributes = { "user_name" }; + + + // ***************************** + // Execute the service operation + // ***************************** + dmService.GetProperties(users, attributes); + + + } + + + } +} diff --git a/Backup1/form/Login.Designer.cs b/Backup1/form/Login.Designer.cs new file mode 100644 index 0000000..d467f34 --- /dev/null +++ b/Backup1/form/Login.Designer.cs @@ -0,0 +1,206 @@ +namespace HelloTeamcenter.form +{ + partial class Login + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Login)); + this.label1 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.label3 = new System.Windows.Forms.Label(); + this.label4 = new System.Windows.Forms.Label(); + this.label5 = new System.Windows.Forms.Label(); + this.textBox1 = new System.Windows.Forms.TextBox(); + this.textBox2 = new System.Windows.Forms.TextBox(); + this.textBox3 = new System.Windows.Forms.TextBox(); + this.textBox4 = new System.Windows.Forms.TextBox(); + this.textBox5 = new System.Windows.Forms.TextBox(); + this.button1 = new System.Windows.Forms.Button(); + this.button2 = new System.Windows.Forms.Button(); + this.pictureBox1 = new System.Windows.Forms.PictureBox(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); + this.SuspendLayout(); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(405, 31); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(58, 13); + this.label1.TabIndex = 1; + this.label1.Text = "连接到: "; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(405, 75); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(58, 13); + this.label2.TabIndex = 2; + this.label2.Text = "用户名: "; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(405, 114); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(52, 13); + this.label3.TabIndex = 3; + this.label3.Text = "密 码: "; + // + // label4 + // + this.label4.AutoSize = true; + this.label4.Location = new System.Drawing.Point(405, 154); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(58, 13); + this.label4.TabIndex = 4; + this.label4.Text = "所在组: "; + // + // label5 + // + this.label5.AutoSize = true; + this.label5.Location = new System.Drawing.Point(405, 191); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(52, 13); + this.label5.TabIndex = 5; + this.label5.Text = "角 色: "; + // + // textBox1 + // + this.textBox1.Location = new System.Drawing.Point(457, 27); + this.textBox1.Name = "textBox1"; + this.textBox1.Size = new System.Drawing.Size(120, 20); + this.textBox1.TabIndex = 6; + // + // textBox2 + // + this.textBox2.Location = new System.Drawing.Point(457, 68); + this.textBox2.Name = "textBox2"; + this.textBox2.Size = new System.Drawing.Size(120, 20); + this.textBox2.TabIndex = 7; + // + // textBox3 + // + this.textBox3.Location = new System.Drawing.Point(457, 107); + this.textBox3.Name = "textBox3"; + this.textBox3.PasswordChar = '*'; + this.textBox3.Size = new System.Drawing.Size(120, 20); + this.textBox3.TabIndex = 8; + // + // textBox4 + // + this.textBox4.Location = new System.Drawing.Point(457, 148); + this.textBox4.Name = "textBox4"; + this.textBox4.Size = new System.Drawing.Size(120, 20); + this.textBox4.TabIndex = 9; + // + // textBox5 + // + this.textBox5.Location = new System.Drawing.Point(457, 186); + this.textBox5.Name = "textBox5"; + this.textBox5.Size = new System.Drawing.Size(120, 20); + this.textBox5.TabIndex = 10; + // + // button1 + // + this.button1.Location = new System.Drawing.Point(407, 231); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(75, 25); + this.button1.TabIndex = 11; + this.button1.Text = "登录"; + this.button1.UseVisualStyleBackColor = true; + // + // button2 + // + this.button2.Location = new System.Drawing.Point(502, 231); + this.button2.Name = "button2"; + this.button2.Size = new System.Drawing.Size(75, 25); + this.button2.TabIndex = 12; + this.button2.Text = "取消"; + this.button2.UseVisualStyleBackColor = true; + // + // pictureBox1 + // + this.pictureBox1.Image = global::HelloTeamcenter.Properties.Resources.login; + this.pictureBox1.Location = new System.Drawing.Point(7, 13); + this.pictureBox1.Name = "pictureBox1"; + this.pictureBox1.Size = new System.Drawing.Size(383, 216); + this.pictureBox1.TabIndex = 0; + this.pictureBox1.TabStop = false; + // + // Login + // + this.AcceptButton = this.button1; + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(590, 269); + this.Controls.Add(this.button2); + this.Controls.Add(this.button1); + this.Controls.Add(this.textBox5); + this.Controls.Add(this.textBox4); + this.Controls.Add(this.textBox3); + this.Controls.Add(this.textBox2); + this.Controls.Add(this.textBox1); + this.Controls.Add(this.label5); + this.Controls.Add(this.label4); + this.Controls.Add(this.label3); + this.Controls.Add(this.label2); + this.Controls.Add(this.label1); + this.Controls.Add(this.pictureBox1); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; + this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "Login"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "登录"; + this.TopMost = true; + this.Load += new System.EventHandler(this.Login_Load); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + public System.Windows.Forms.PictureBox pictureBox1; + public System.Windows.Forms.Label label1; + public System.Windows.Forms.Label label2; + public System.Windows.Forms.Label label3; + public System.Windows.Forms.Label label4; + public System.Windows.Forms.Label label5; + public System.Windows.Forms.TextBox textBox1; + public System.Windows.Forms.TextBox textBox2; + public System.Windows.Forms.TextBox textBox3; + public System.Windows.Forms.TextBox textBox4; + public System.Windows.Forms.TextBox textBox5; + public System.Windows.Forms.Button button1; + public System.Windows.Forms.Button button2; + } +} \ No newline at end of file diff --git a/Backup1/form/Login.cs b/Backup1/form/Login.cs new file mode 100644 index 0000000..d3bc208 --- /dev/null +++ b/Backup1/form/Login.cs @@ -0,0 +1,70 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Text; +using System.Windows.Forms; + +using Autodesk.AutoCAD.DatabaseServices; +using Autodesk.AutoCAD.Runtime; +using Autodesk.AutoCAD.Geometry; +using Autodesk.AutoCAD.ApplicationServices; +using Autodesk.AutoCAD.EditorInput; +using System.IO; +using Teamcenter.Hello; +using Teamcenter.ClientX; + + +namespace HelloTeamcenter.form +{ + public partial class Login : Form + { + public Login() + { + InitializeComponent(); + } + + public string m_WebAddress = "http://localhost:7001/tc"; + public string username = ""; + public string password = ""; + public string usergroup = ""; + public string userrole = ""; + public Document appodc; + + private void Login_Load(object sender, EventArgs e) + { + string tempdir = System.Environment.GetEnvironmentVariable("TEMP").ToString(); + Editor ed = appodc.Editor; + ed.WriteMessage("login文件路径:" + tempdir + "\n"); + string loginfile = tempdir + "\\login.ini"; + if (File.Exists(loginfile)) + { + StreamReader sr = new StreamReader(loginfile); + string line; + if ((line = sr.ReadLine()) != null) + { + + string[] ans = line.Split('|'); + for (int i = 0; i < ans.Length; i++) + { + if (i == 0) + m_WebAddress = ans[i].ToString(); + if (i == 1) + username = ans[i].ToString(); + if (i == 3) + usergroup = ans[i].ToString(); + if (i == 4) + userrole = ans[i].ToString(); + } + } + sr.Close(); + } + textBox1.Text = m_WebAddress; + textBox2.Text = username; + textBox3.Text = password; + textBox4.Text = usergroup; + textBox4.Text = userrole; + } + } +} diff --git a/Backup1/form/Login.resx b/Backup1/form/Login.resx new file mode 100644 index 0000000..80d957a --- /dev/null +++ b/Backup1/form/Login.resx @@ -0,0 +1,134 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + True + + + + + AAABAAEAECAAAAEABAAoAQAAFgAAACgAAAAQAAAAIAAAAAEABAAAAAAAwAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAACAAACAAAAAgIAAgAAAAIAAgACAgAAAwMDAAICAgAAAAP8AAP8AAAD//wD/AAAA/wD/AP// + AAD///8A///////////0bm5ubm5ub/Rs6IjoiEzv9G6Pd4d3Tm/0bP/3f/dM7/Ru/45v905v9Gz/jO/3 + TO/0bn/2b/dOb/Rs5///90zv9G5ubm/3Tm/0bPeIf/bs7/Rub///fm5v9Gzs53zs7O/0xsbGxsbGz/RE + RERERERP//////////8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA + //8AAP//AAD//wAA//8AAP// + + + \ No newline at end of file diff --git a/Backup1/form/OpenFromTC.Designer.cs b/Backup1/form/OpenFromTC.Designer.cs new file mode 100644 index 0000000..64b5bce --- /dev/null +++ b/Backup1/form/OpenFromTC.Designer.cs @@ -0,0 +1,135 @@ +namespace HelloTeamcenter.form +{ + partial class OpenFromTC + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(OpenFromTC)); + this.label1 = new System.Windows.Forms.Label(); + this.textBox1 = new System.Windows.Forms.TextBox(); + this.button1 = new System.Windows.Forms.Button(); + this.button2 = new System.Windows.Forms.Button(); + this.imageList1 = new System.Windows.Forms.ImageList(this.components); + this.treeView1 = new System.Windows.Forms.TreeView(); + this.SuspendLayout(); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(12, 333); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(79, 13); + this.label1.TabIndex = 1; + this.label1.Text = "数据集名称:"; + // + // textBox1 + // + this.textBox1.Location = new System.Drawing.Point(105, 329); + this.textBox1.Name = "textBox1"; + this.textBox1.ReadOnly = true; + this.textBox1.Size = new System.Drawing.Size(197, 20); + this.textBox1.TabIndex = 2; + this.textBox1.TabStop = false; + // + // button1 + // + this.button1.Location = new System.Drawing.Point(446, 324); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(75, 25); + this.button1.TabIndex = 3; + this.button1.Tag = ""; + this.button1.Text = "确定"; + this.button1.UseVisualStyleBackColor = true; + // + // button2 + // + this.button2.Location = new System.Drawing.Point(446, 355); + this.button2.Name = "button2"; + this.button2.Size = new System.Drawing.Size(75, 25); + this.button2.TabIndex = 4; + this.button2.Text = "查找->"; + this.button2.UseVisualStyleBackColor = true; + // + // imageList1 + // + this.imageList1.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream"))); + this.imageList1.TransparentColor = System.Drawing.Color.Transparent; + this.imageList1.Images.SetKeyName(0, "autocad_01.ico"); + this.imageList1.Images.SetKeyName(1, "FOLDER.ICO"); + this.imageList1.Images.SetKeyName(2, "FOLDEROP.ICO"); + this.imageList1.Images.SetKeyName(3, "item.ico"); + this.imageList1.Images.SetKeyName(4, "itemrev.ico"); + this.imageList1.Images.SetKeyName(5, "mail.ico"); + this.imageList1.Images.SetKeyName(6, "Newstuff_Folder.png"); + this.imageList1.Images.SetKeyName(7, "tai.ico"); + // + // treeView1 + // + this.treeView1.ImageIndex = 7; + this.treeView1.ImageList = this.imageList1; + this.treeView1.Location = new System.Drawing.Point(14, 13); + this.treeView1.Name = "treeView1"; + this.treeView1.SelectedImageIndex = 7; + this.treeView1.Size = new System.Drawing.Size(509, 304); + this.treeView1.TabIndex = 5; + this.treeView1.NodeMouseDoubleClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(this.treeView1_NodeMouseDoubleClick); + // + // OpenFromTC + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(538, 386); + this.Controls.Add(this.treeView1); + this.Controls.Add(this.button2); + this.Controls.Add(this.button1); + this.Controls.Add(this.textBox1); + this.Controls.Add(this.label1); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; + this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "OpenFromTC"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "打开"; + this.TopMost = true; + this.Load += new System.EventHandler(this.OpenFromTC_Load); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + public System.Windows.Forms.Label label1; + public System.Windows.Forms.TextBox textBox1; + public System.Windows.Forms.Button button1; + public System.Windows.Forms.Button button2; + public System.Windows.Forms.ImageList imageList1; + public System.Windows.Forms.TreeView treeView1; + } +} \ No newline at end of file diff --git a/Backup1/form/OpenFromTC.cs b/Backup1/form/OpenFromTC.cs new file mode 100644 index 0000000..71dcf7f --- /dev/null +++ b/Backup1/form/OpenFromTC.cs @@ -0,0 +1,454 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Text; +using System.Windows.Forms; + +using Autodesk.AutoCAD.DatabaseServices; +using Autodesk.AutoCAD.Runtime; +using Autodesk.AutoCAD.Geometry; +using Autodesk.AutoCAD.ApplicationServices; +using Autodesk.AutoCAD.EditorInput; + +using Teamcenter.Hello; +using Teamcenter.Soa.Client; +using Teamcenter.ClientX; +using Teamcenter.Services.Strong.Core; +using Teamcenter.Soa.Client.Model; +using Teamcenter.Soa.Exceptions; +using Teamcenter.Services.Strong.Query; + +using Teamcenter.Services.Strong.Core._2007_06.DataManagement; + + +using User = Teamcenter.Soa.Client.Model.Strong.User; +using Folder = Teamcenter.Soa.Client.Model.Strong.Folder; +using WorkspaceObject = Teamcenter.Soa.Client.Model.Strong.WorkspaceObject; +using Item = Teamcenter.Soa.Client.Model.Strong.Item; +using ItemRevision = Teamcenter.Soa.Client.Model.Strong.ItemRevision; +using ImanQuery = Teamcenter.Soa.Client.Model.Strong.ImanQuery; +using DataSet = Teamcenter.Soa.Client.Model.Strong.Dataset; + + +public struct ALLOBJECT +{ + public TreeNode treenode; + public WorkspaceObject workobject; + public string name; + public string uid; +} + +namespace HelloTeamcenter.form +{ + public partial class OpenFromTC : Form + { + public List alllist = new List(); + public List folderlist = new List(); + public List itemlist = new List(); + public List itemvisionlist = new List(); + public List datasetlist = new List(); + public OpenFromTC() + { + InitializeComponent(); + } + public Document appodc; + public User user; + public bool first = true; + public Folder home = null; + Editor ed; + private void OpenFromTC_Load(object sender, EventArgs e) + { + ed = appodc.Editor; + treeView1.Nodes.Clear(); + TreeNode rootnode = new TreeNode("Home", 7, 7); + treeView1.Nodes.Add(rootnode); + + WorkspaceObject[] contents = null; + DataManagementService dmService = DataManagementService.getService(Session.getConnection()); + try + { + home = user.Home_folder; + } + catch (NotLoadedException ex) + { + ed.WriteMessage(ex.Message); + return; + } + try + { + ModelObject[] objects = { home }; + String[] attributes = { "contents" }; + dmService.RefreshObjects(objects); + dmService.GetProperties(objects, attributes); + contents = home.Contents; + } + catch (NotLoadedException ex) { ed.WriteMessage(ex.Message); } + //ALLOBJECT topobject = new ALLOBJECT(); + //topobject.treenode = rootnode; + //topobject.workobject = home; + //alllist.Add(topobject); + //folderlist.Add(topobject); + for (int i = 0; i < contents.Length; i++) + { + WorkspaceObject childobj = contents[i]; + ModelObject[] objects = { childobj }; + String[] attributes = { "object_string" ,"object_type" }; + dmService.RefreshObjects(objects); + dmService.GetProperties(objects, attributes); + string name = childobj.Object_string; + string type = childobj.Object_type; + if (type == "Folder" || type == "Newstuff Folder" || type == "Mail Folder") + { + ALLOBJECT perobject = new ALLOBJECT(); + perobject.workobject = childobj; + Folder fl = childobj as Folder; + if (type == "Folder") + { + TreeNode childnode = new TreeNode(name, 1, 1); + perobject.treenode = childnode; + perobject.name = name; + perobject.uid = childobj.Uid; + rootnode.Nodes.Add(childnode); + } + else if (type == "Newstuff Folder") + { + TreeNode childnode = new TreeNode(name, 6, 6); + perobject.treenode = childnode; + perobject.name = name; + perobject.uid = childobj.Uid; + rootnode.Nodes.Add(childnode); + } + else if (type == "Mail Folder") + { + TreeNode childnode = new TreeNode(name, 5, 5); + perobject.treenode = childnode; + perobject.name = name; + perobject.uid = childobj.Uid; + rootnode.Nodes.Add(childnode); + } + alllist.Add(perobject); + folderlist.Add(perobject); + } + else if (type == "Item" || type == "D5Product" + || type == "D5AsmPart" || type == "D5Part" + || type == "D5StdFasteners" || type == "D5CommonParts") + { + ALLOBJECT perobject = new ALLOBJECT(); + perobject.workobject = childobj; + Item item = childobj as Item; + TreeNode childnode = new TreeNode(name, 3, 3); + perobject.treenode = childnode; + perobject.name = name; + perobject.uid = childobj.Uid; + rootnode.Nodes.Add(childnode); + alllist.Add(perobject); + itemlist.Add(perobject); + } + } + foreach(TreeNode ch in rootnode.Nodes) + { + ch.EnsureVisible(); + } + } + + private void treeView1_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e) + { + //MessageBox.Show("获得"); + TreeNode nownode = this.treeView1.SelectedNode; + + getChild(nownode); + foreach (TreeNode ch in nownode.Nodes) + { + ch.EnsureVisible(); + } + } + + private void getChild(TreeNode nownode) + { + nownode.Nodes.Clear(); + DataManagementService dmService = DataManagementService.getService(Session.getConnection()); + WorkspaceObject[] contents = null; + //dmService.GetProperties(objects, attributes); + string nodetext = nownode.Text; + int imageindex = nownode.SelectedImageIndex; + List templist = new List(); + if (imageindex == 1) + { + foreach (ALLOBJECT perobject in folderlist) + { + if (perobject.treenode.Equals(nownode)) + { + Folder fl = perobject.workobject as Folder; + ModelObject[] objects = { fl }; + String[] attributes = { "contents" }; + dmService.RefreshObjects(objects); + dmService.GetProperties(objects, attributes); + contents = fl.Contents; + for (int i = 0; i < contents.Length; i++) + { + WorkspaceObject childobj = contents[i]; + ModelObject[] objects1 = { childobj }; + String[] attributes1 = { "object_string", "object_type" }; + dmService.RefreshObjects(objects1); + dmService.GetProperties(objects1, attributes1); + string name = childobj.Object_string; + string type = childobj.Object_type; + if (type == "Folder" || type == "Newstuff Folder" || type == "Mail Folder") + { + ALLOBJECT inperobject = new ALLOBJECT(); + inperobject.workobject = childobj; + Folder infl = childobj as Folder; + + if (type == "Folder") + { + TreeNode childnode = new TreeNode(name, 1, 1); + inperobject.treenode = childnode; + nownode.Nodes.Add(childnode); + } + else if (type == "Newstuff Folder") + { + TreeNode childnode = new TreeNode(name, 6, 6); + inperobject.treenode = childnode; + nownode.Nodes.Add(childnode); + } + else if (type == "Mail Folder") + { + TreeNode childnode = new TreeNode(name, 5, 5); + inperobject.treenode = childnode; + nownode.Nodes.Add(childnode); + } + templist.Add(inperobject); + folderlist.Add(inperobject); + } + else if (type == "Item" || type == "D5Product" + || type == "D5AsmPart" || type == "D5Part" + || type == "D5StdFasteners" || type == "D5CommonParts") + { + ALLOBJECT inperobject = new ALLOBJECT(); + inperobject.workobject = childobj; + Item item = childobj as Item; + TreeNode childnode = new TreeNode(name, 3, 3); + inperobject.treenode = childnode; + nownode.Nodes.Add(childnode); + templist.Add(inperobject); + itemlist.Add(inperobject); + } + } + break; + } + } + if (templist.Count > 0 && templist != null) + { + alllist.AddRange(templist); + templist.Clear(); + } + return; + + } + else if (imageindex == 3) + { + foreach (ALLOBJECT perobject in itemlist) + { + if (perobject.treenode.Equals(nownode)) + { + Item item = perobject.workobject as Item; + ModelObject[] itemrevisionlist = null; + ModelObject[] objects = { item }; + String[] attributes = { "revision_list" }; + dmService.RefreshObjects(objects); + dmService.GetProperties(objects, attributes); + itemrevisionlist = item.Revision_list; + for (int i = 0; i < itemrevisionlist.Length; i++) + { + ItemRevision itemrevision = itemrevisionlist[i] as ItemRevision; + ModelObject[] objects1 = { itemrevision }; + String[] attributes1 = { "object_string", "object_type" }; + dmService.RefreshObjects(objects1); + dmService.GetProperties(objects1, attributes1); + string name = itemrevision.Object_string; + string type = itemrevision.Object_type; + + ALLOBJECT inperobject = new ALLOBJECT(); + inperobject.workobject = itemrevision; + TreeNode childnode = new TreeNode(name, 4, 4); + inperobject.treenode = childnode; + nownode.Nodes.Add(childnode); + templist.Add(inperobject); + itemvisionlist.Add(inperobject); + } + break; + } + } + if (templist.Count > 0 && templist != null) + { + alllist.AddRange(templist); + templist.Clear(); + } + return; + } + else if (imageindex == 4) + { + foreach (ALLOBJECT perobject in itemvisionlist) + { + if (perobject.treenode.Equals(nownode)) + { + ItemRevision itemrevision = perobject.workobject as ItemRevision; + ExpandGRMRelationsPref myPref = new ExpandGRMRelationsPref(); + RelationAndTypesFilter2 myFilter = new RelationAndTypesFilter2(); + myFilter.RelationName = "IMAN_specification"; + String[] typeVec = { "D5DWG", "Folder" }; + myFilter.ObjectTypeNames = typeVec; + myPref.ExpItemRev = false; + RelationAndTypesFilter2[] myfilter = { myFilter }; + myPref.Info = myfilter; + ModelObject[] objects1 = { itemrevision }; + + ExpandGRMRelationsResponse myResp = dmService.ExpandGRMRelationsForPrimary(objects1,myPref); + ExpandGRMRelationsOutput[] myoutput = myResp.Output; + for (int i = 0; i < myoutput.Length; i++) + { + ExpandGRMRelationsOutput one_out = myoutput[i]; + for (int j = 0; j < one_out.OtherSideObjData.Length; j++) + { + ExpandGRMRelationsData otherSideData = one_out.OtherSideObjData[j]; + for (int k = 0; k < otherSideData.OtherSideObjects.Length; k++) + { + Type typeinfo = otherSideData.OtherSideObjects[k].GetType(); + string typename = typeinfo.Name; + if (typename == "Folder") + { + Folder infold = otherSideData.OtherSideObjects[k] as Folder; + + ModelObject[] objects = { infold }; + String[] attributes = { "object_string", "object_type" }; + dmService.RefreshObjects(objects); + dmService.GetProperties(objects, attributes); + string name = infold.Object_string; + string type = infold.Object_type; + + ALLOBJECT inperobject = new ALLOBJECT(); + inperobject.workobject = infold; + TreeNode childnode = new TreeNode(name, 1, 1); + inperobject.treenode = childnode; + nownode.Nodes.Add(childnode); + templist.Add(inperobject); + folderlist.Add(inperobject); + } + else + { + DataSet dateset = otherSideData.OtherSideObjects[k] as DataSet; + ModelObject[] objects = { dateset }; + String[] attributes = { "object_string" }; + dmService.RefreshObjects(objects); + dmService.GetProperties(objects, attributes); + string name = dateset.Object_string; + + ALLOBJECT inperobject = new ALLOBJECT(); + inperobject.workobject = dateset; + inperobject.name = name; + TreeNode childnode = new TreeNode(name, 0, 0); + inperobject.treenode = childnode; + nownode.Nodes.Add(childnode); + templist.Add(inperobject); + datasetlist.Add(inperobject); + } + } + } + } + break; + } + } + if (templist.Count > 0 && templist != null) + { + alllist.AddRange(templist); + templist.Clear(); + } + return; + } + else if (imageindex == 6) + { + + } + else if(imageindex == 7) + { + alllist.Clear(); + folderlist.Clear(); + itemlist.Clear(); + itemvisionlist.Clear(); + datasetlist.Clear(); + try + { + ModelObject[] objects = { home }; + String[] attributes = { "contents" }; + dmService.RefreshObjects(objects); + dmService.GetProperties(objects, attributes); + contents = home.Contents; + } + catch (NotLoadedException ex) { ed.WriteMessage(ex.Message); } + for (int i = 0; i < contents.Length; i++) + { + WorkspaceObject childobj = contents[i]; + ModelObject[] objects = { childobj }; + String[] attributes = { "object_string", "object_type" }; + dmService.RefreshObjects(objects); + dmService.GetProperties(objects, attributes); + string name = childobj.Object_string; + string type = childobj.Object_type; + if (type == "Folder" || type == "Newstuff Folder" || type == "Mail Folder") + { + ALLOBJECT perobject = new ALLOBJECT(); + perobject.workobject = childobj; + Folder fl = childobj as Folder; + if (type == "Folder") + { + TreeNode childnode = new TreeNode(name, 1, 1); + perobject.treenode = childnode; + perobject.name = name; + perobject.uid = childobj.Uid; + nownode.Nodes.Add(childnode); + } + else if (type == "Newstuff Folder") + { + TreeNode childnode = new TreeNode(name, 6, 6); + perobject.treenode = childnode; + perobject.name = name; + perobject.uid = childobj.Uid; + nownode.Nodes.Add(childnode); + } + else if (type == "Mail Folder") + { + TreeNode childnode = new TreeNode(name, 5, 5); + perobject.treenode = childnode; + perobject.name = name; + perobject.uid = childobj.Uid; + nownode.Nodes.Add(childnode); + } + alllist.Add(perobject); + folderlist.Add(perobject); + } + else if (type == "Item" || type == "D5Product" + || type == "D5AsmPart" || type == "D5Part" + || type == "D5StdFasteners" || type == "D5CommonParts") + { + ALLOBJECT perobject = new ALLOBJECT(); + perobject.workobject = childobj; + Item item = childobj as Item; + TreeNode childnode = new TreeNode(name, 3, 3); + perobject.treenode = childnode; + perobject.name = name; + perobject.uid = childobj.Uid; + nownode.Nodes.Add(childnode); + alllist.Add(perobject); + itemlist.Add(perobject); + } + } + foreach (TreeNode ch in nownode.Nodes) + { + ch.EnsureVisible(); + } + } + } + } +} diff --git a/Backup1/form/OpenFromTC.resx b/Backup1/form/OpenFromTC.resx new file mode 100644 index 0000000..afde822 --- /dev/null +++ b/Backup1/form/OpenFromTC.resx @@ -0,0 +1,212 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + + + AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj0yLjAuMC4w + LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 + ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAABq + EAAAAk1TRnQBSQFMAgEBCAEAARQBAAEUAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo + AwABQAMAATADAAEBAQABCAYAAQwYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA + AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5 + AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA + AWYDAAGZAwABzAIAATMDAAIzAgABMwFmAgABMwGZAgABMwHMAgABMwH/AgABZgMAAWYBMwIAAmYCAAFm + AZkCAAFmAcwCAAFmAf8CAAGZAwABmQEzAgABmQFmAgACmQIAAZkBzAIAAZkB/wIAAcwDAAHMATMCAAHM + AWYCAAHMAZkCAALMAgABzAH/AgAB/wFmAgAB/wGZAgAB/wHMAQABMwH/AgAB/wEAATMBAAEzAQABZgEA + ATMBAAGZAQABMwEAAcwBAAEzAQAB/wEAAf8BMwIAAzMBAAIzAWYBAAIzAZkBAAIzAcwBAAIzAf8BAAEz + AWYCAAEzAWYBMwEAATMCZgEAATMBZgGZAQABMwFmAcwBAAEzAWYB/wEAATMBmQIAATMBmQEzAQABMwGZ + AWYBAAEzApkBAAEzAZkBzAEAATMBmQH/AQABMwHMAgABMwHMATMBAAEzAcwBZgEAATMBzAGZAQABMwLM + AQABMwHMAf8BAAEzAf8BMwEAATMB/wFmAQABMwH/AZkBAAEzAf8BzAEAATMC/wEAAWYDAAFmAQABMwEA + AWYBAAFmAQABZgEAAZkBAAFmAQABzAEAAWYBAAH/AQABZgEzAgABZgIzAQABZgEzAWYBAAFmATMBmQEA + AWYBMwHMAQABZgEzAf8BAAJmAgACZgEzAQADZgEAAmYBmQEAAmYBzAEAAWYBmQIAAWYBmQEzAQABZgGZ + AWYBAAFmApkBAAFmAZkBzAEAAWYBmQH/AQABZgHMAgABZgHMATMBAAFmAcwBmQEAAWYCzAEAAWYBzAH/ + AQABZgH/AgABZgH/ATMBAAFmAf8BmQEAAWYB/wHMAQABzAEAAf8BAAH/AQABzAEAApkCAAGZATMBmQEA + AZkBAAGZAQABmQEAAcwBAAGZAwABmQIzAQABmQEAAWYBAAGZATMBzAEAAZkBAAH/AQABmQFmAgABmQFm + ATMBAAGZATMBZgEAAZkBZgGZAQABmQFmAcwBAAGZATMB/wEAApkBMwEAApkBZgEAA5kBAAKZAcwBAAKZ + Af8BAAGZAcwCAAGZAcwBMwEAAWYBzAFmAQABmQHMAZkBAAGZAswBAAGZAcwB/wEAAZkB/wIAAZkB/wEz + AQABmQHMAWYBAAGZAf8BmQEAAZkB/wHMAQABmQL/AQABzAMAAZkBAAEzAQABzAEAAWYBAAHMAQABmQEA + AcwBAAHMAQABmQEzAgABzAIzAQABzAEzAWYBAAHMATMBmQEAAcwBMwHMAQABzAEzAf8BAAHMAWYCAAHM + AWYBMwEAAZkCZgEAAcwBZgGZAQABzAFmAcwBAAGZAWYB/wEAAcwBmQIAAcwBmQEzAQABzAGZAWYBAAHM + ApkBAAHMAZkBzAEAAcwBmQH/AQACzAIAAswBMwEAAswBZgEAAswBmQEAA8wBAALMAf8BAAHMAf8CAAHM + Af8BMwEAAZkB/wFmAQABzAH/AZkBAAHMAf8BzAEAAcwC/wEAAcwBAAEzAQAB/wEAAWYBAAH/AQABmQEA + AcwBMwIAAf8CMwEAAf8BMwFmAQAB/wEzAZkBAAH/ATMBzAEAAf8BMwH/AQAB/wFmAgAB/wFmATMBAAHM + AmYBAAH/AWYBmQEAAf8BZgHMAQABzAFmAf8BAAH/AZkCAAH/AZkBMwEAAf8BmQFmAQAB/wKZAQAB/wGZ + AcwBAAH/AZkB/wEAAf8BzAIAAf8BzAEzAQAB/wHMAWYBAAH/AcwBmQEAAf8CzAEAAf8BzAH/AQAC/wEz + AQABzAH/AWYBAAL/AZkBAAL/AcwBAAJmAf8BAAFmAf8BZgEAAWYC/wEAAf8CZgEAAf8BZgH/AQAC/wFm + AQABIQEAAaUBAANfAQADdwEAA4YBAAOWAQADywEAA7IBAAPXAQAD3QEAA+MBAAPqAQAD8QEAA/gBAAHw + AfsB/wEAAaQCoAEAA4ADAAH/AgAB/wMAAv8BAAH/AwAB/wEAAf8BAAL/AgAD//8A/wD/AP8AFQAQ/ycA + AZoCGgHwBQAQ/wMAAvANAAEEEAABGgHwARoBmgHlAVkBUgF5AfAEABD/AgABtAGtAc8BtQHvAgcBvAgA + AuwCBwEAAQMB+wEAAwcEAAIaAcMBGgLDAaABeQFZATIBmQGYAbwB8AEAAf8OAAH/AgABzweLAa4B9wHv + AQcEAALsAv8BAAEDAfsBAAL/AQcEAAGaAsMBGgL2AcMBeQI4AVgBVgFQAZgB8AH/DewBAAH/AgABzwGL + CYoBkgQAAuwC/wEAAQMB+wEAAv8BBwQAAXoDoAEaAvYBmgJZAVgBeAJQAfAB/wHsCwcB7AEAAf8CAAHP + ArIBrAeKAa4EAALsAv8BAAEDAfsBAAL/AQcEAAF6AuUBegJSAZkBGgGaAVkBmQGYAVYBUAHwAf8B7AED + AwcDAwMHAQMB7AEAAf8CAAHPAawFsgSKAZEBvAMAAQQB7AL/BAAC/wEHAwAB8AGaAXoB5QF6ATECUgEc + AZkBmgEaAZgBVwFWAfAB/wHsAfsBAwEHAQMDAAEDAQcBAwEHAewBAAH/AgABtQGtBbMDsgGzAa4BBwQA + AewI/wHsAwAB8AHDAfYBwwF6AVkBOAFYAngBHAGYAZkBmAF4AfAB/wHsAv8BAwEAAv8B+wEAAQMCBwHs + AQAB/wIAAbUBtAG7AroGswGRAQcEAAEDAQAG/wHsAgMCAAHwAZoCwwF6AjgBWAFXAVABSgFyAXMBHAGZ + AfAB/wHsAfsBBwEAAf8B+wP/AQABAwEHAewBAAH/AgABBwG0Aa0CtAEJAbsEugG0Ae8FAAEDAQAE/wHs + AgMB7AIAAfABmgF6AZoBegJZAnkBVgFQAXIBBwMAAf8B7AEHAQAB+wP/AfsC/wEAAQMB7AEAAf8CAAG1 + AZkBkAGYAbMBtAEJAhkCCQG1AQcGAAEDAQAC/wHsAgMEAAHwARoBegF5AZkBoAFYAVkBmQJWARwEAAH/ + AewBAAP/AfsD/wH7Af8BAAHsAQAB/wEAAbsBtAF5AZkBeQG0AgkEtAG1CAABAwIAAgMHAAHwArwBmQF5 + AZkBeAJWAXgEAAH/AewC/wH7A/8B+wP/AfsCAAH/AgAB7wF+AV4BWAEcA7QB1gIJAQcJAAMDAewBAQcA + AbwB8AEIAZgBeAKYAZkBBwQAAf8N7AEAAf8CAAKZAnkBtQHvAwACtQEHDQABAQcAAfABvALwAbwBBwK8 + BQAQ/wIAAQcBGgGRArwRAAEEAgABAQgABLwB8AcAEP8EAAHvHAAO8CoAARoB8AG8AfAEAAHvCYEB/wOB + AfAmAAGZARoBegFTAVkBUgF0AQcDAAGyAbkD2gO5AdoBuQH0AtoBuQG8IwACkwFMAXoDoAHlATEBMgFS + AZkCAAGyAtoCswLZAbMBiwGzAfQBswHUAbkBvA7sBAAM7AIAAfACmQEbAf8BmgH2AsMCoAExATgBMgF0 + AgABsgOzBtkB9AHZArMBvAHsAf8B+wEHAfsBBwH7AQcB+wEHAfsBBwH7AewEAAHsAf8B+wEHAfsBBwH7 + AQcB+wEHAfsB7AIAAbwBGgHDAv8BmQH/AvYCwwE3AjgBeQIAAbIBswGyAtkBuAHbAbkB2wGyAfQB2QGy + AbkBvAHsAf8BBwH7AQcB+wEHAfsBBwH7AQcB+wEHAewDAAHsAf8B+wEHAfsBBwH7AQcB+wEHAfsBBwEA + AewBAAG8AZoBoALDAZoB9gP/AfYBNwI4AXkCAAGyAdkBsgG4AbIBuAGKAbIBgQGyAfQB2QGyAbkBvAHs + Af8B+wEHAfsBBwH7AQcB+wEHAfsBBwH7AewDAAHsAf8BBwH7AQcB+wEHAfsBBwH7AQcB7AEAAewBAAG8 + AXkDoAFSAZkCwwEaAZoBegI4AXkCAAGyAdkBuAK5AbgB2QGyAYoB2QH0AdkBsgG5AbwB7AH/AQcB+wEH + AfsBBwH7AQcB+wEHAfsBBwHsAgAB7AH/AQcB+wEHAfsBBwH7AQcB+wEHAfsBAALsAQAB8AF6AuUBegFT + AVIBcwF0AbwB9AH2AXoBWQGZAgABsgLaAbMC3AG5AbgB2QG7Af8BuwGzAdoBvAHsAf8B+wEHAfsBBwH7 + AQcB+wEHAfsBBwH7AewCAAHsCv8B7AEAAQcB7AEAARoBmQN6AVkBMQErAUsBUgKZAZoCegIAAYEDswGQ + AYoBgQKzAbsBigG6ArMBBwHsAf8BBwH7AQcB+wEHAfsBBwH7AQcB+wEHAewCAA3sAfsB7AEAAXQBwwH2 + AsMBegFZATgBMgFMAZkBGgUAAboB2wK6AdoBugKRAdoBuwS6AQcB7AH/AfsBBwH7AQcB+wEHAfsBBwH7 + AQcB+wHsAwAB7AH/AQcB+wEHAfsBBwH7AQcB+wEHAfsBBwHsAQABdAHDAfYC/wGaAzgBUgcAAbkC2wGz + BNkBuAHyAf8B8gHbAdoBvAHsDP8B7AMAAewB/wH7AQcB+wEHAfsBBwX/AewBAAF6AsMC9gEaAfsCOAFS + BwABswTbAQkC3AIJAfQC2wHaAbwB7AEHAfsBBwH7AQcB+wEHBuwDAAHsAf8BBwH7AQcB+wEHAf8G7AEA + AnoCoAJ6AVkB+wE4AXkHAAGzAdsB3AcJAfQBCQHcAdsBvAEAAewBBwH7AQcB+wEHAewKAAHsBf8B7AcA + AnoBWQLlAcMBegJZAZkHAAG5CRkB9AMZAfACAAXsDAAF7AkAAfABGgFSAlkCegFTAXkRAAHwKAAC8AoA + AUIBTQE+BwABPgMAASgDAAFAAwABMAMAAQEBAAEBBQABgAEBFgAD/4EAAv8CAAT/Af4BHwIAAecB/wHA + AQMB4AEPAgABwAE/AcABAwGAAQECAAHAAQMBwAEDAYADAAHAAQMBwAEDAYADAAHAAQMBwAEDAYADAAHA + AQEBwAEDBAABwAEBAYABAQQAAcABAQHAAQEEAAHAAQEB4AEDAQABBwIAAcABAQHwAQcBAAEPAgABgAED + AfgBBwHAAQ8CAAHAAQMB/AEHAeABDwIAAcAB4wH+AScB4AEfAgABwQL/AWcB8AF/AgAB9wP/AYABAQX/ + AYcBgAEABP8B/AEDAYABAAGAAQEB4AEAAeABAQGAAgABAQHAAgABAQGAAgABAQHAAgABAQGAAgABAQGA + AgABAQGAAgABAQGAAgABAQGAAgABAQMAAQEBgAIAAQEDAAEBAYACAAEBAwABDwGAAgABAQGAAgABPwGA + AgABAQGAAgABPwGAAgABAwGAAQEBAAE/AYABAAGAAf8BwAF/AQABPwGAAQABwQH/AeAB/wGAAT8B/wHv + BP8B8wH/Cw== + + + + + + AAABAAEAECAAAAEABAAoAQAAFgAAACgAAAAQAAAAIAAAAAEABAAAAAAAwAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAACAAACAAAAAgIAAgAAAAIAAgACAgAAAwMDAAICAgAAAAP8AAP8AAAD//wD/AAAA/wD/AP// + AAD///8A///////////0bm5ubm5ub/Rs6IjoiEzv9G6Pd4d3Tm/0bP/3f/dM7/Ru/45v905v9Gz/jO/3 + TO/0bn/2b/dOb/Rs5///90zv9G5ubm/3Tm/0bPeIf/bs7/Rub///fm5v9Gzs53zs7O/0xsbGxsbGz/RE + RERERERP//////////8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA + //8AAP//AAD//wAA//8AAP// + + + \ No newline at end of file diff --git a/Backup1/form/SaveToTC.Designer.cs b/Backup1/form/SaveToTC.Designer.cs new file mode 100644 index 0000000..4dbfe99 --- /dev/null +++ b/Backup1/form/SaveToTC.Designer.cs @@ -0,0 +1,120 @@ +namespace HelloTeamcenter.form +{ + partial class SaveToTC + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SaveToTC)); + this.treeView1 = new System.Windows.Forms.TreeView(); + this.imageList1 = new System.Windows.Forms.ImageList(this.components); + this.button1 = new System.Windows.Forms.Button(); + this.label1 = new System.Windows.Forms.Label(); + this.comboBox1 = new System.Windows.Forms.ComboBox(); + this.SuspendLayout(); + // + // treeView1 + // + this.treeView1.ImageIndex = 7; + this.treeView1.ImageList = this.imageList1; + this.treeView1.Location = new System.Drawing.Point(12, 13); + this.treeView1.Name = "treeView1"; + this.treeView1.SelectedImageIndex = 7; + this.treeView1.Size = new System.Drawing.Size(491, 323); + this.treeView1.TabIndex = 6; + this.treeView1.NodeMouseDoubleClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(this.treeView1_NodeMouseDoubleClick); + // + // imageList1 + // + this.imageList1.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream"))); + this.imageList1.TransparentColor = System.Drawing.Color.Transparent; + this.imageList1.Images.SetKeyName(0, "autocad_01.ico"); + this.imageList1.Images.SetKeyName(1, "FOLDER.ICO"); + this.imageList1.Images.SetKeyName(2, "FOLDEROP.ICO"); + this.imageList1.Images.SetKeyName(3, "item.ico"); + this.imageList1.Images.SetKeyName(4, "itemrev.ico"); + this.imageList1.Images.SetKeyName(5, "mail.ico"); + this.imageList1.Images.SetKeyName(6, "Newstuff_Folder.png"); + this.imageList1.Images.SetKeyName(7, "tai.ico"); + // + // button1 + // + this.button1.Location = new System.Drawing.Point(428, 342); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(75, 25); + this.button1.TabIndex = 7; + this.button1.Text = "保存"; + this.button1.UseVisualStyleBackColor = true; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(12, 348); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(63, 13); + this.label1.TabIndex = 8; + this.label1.Text = "Item类型:"; + // + // comboBox1 + // + this.comboBox1.FormattingEnabled = true; + this.comboBox1.Items.AddRange(new object[] { + "Item"}); + this.comboBox1.Location = new System.Drawing.Point(83, 345); + this.comboBox1.Name = "comboBox1"; + this.comboBox1.Size = new System.Drawing.Size(242, 21); + this.comboBox1.TabIndex = 9; + // + // SaveToTC + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(515, 385); + this.Controls.Add(this.comboBox1); + this.Controls.Add(this.label1); + this.Controls.Add(this.button1); + this.Controls.Add(this.treeView1); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; + this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); + this.Name = "SaveToTC"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "保存"; + this.Load += new System.EventHandler(this.SaveToTC_Load); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + public System.Windows.Forms.TreeView treeView1; + public System.Windows.Forms.ImageList imageList1; + public System.Windows.Forms.Button button1; + private System.Windows.Forms.Label label1; + public System.Windows.Forms.ComboBox comboBox1; + } +} \ No newline at end of file diff --git a/Backup1/form/SaveToTC.cs b/Backup1/form/SaveToTC.cs new file mode 100644 index 0000000..01daca2 --- /dev/null +++ b/Backup1/form/SaveToTC.cs @@ -0,0 +1,450 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Text; +using System.Windows.Forms; + + +using Autodesk.AutoCAD.DatabaseServices; +using Autodesk.AutoCAD.Runtime; +using Autodesk.AutoCAD.Geometry; +using Autodesk.AutoCAD.ApplicationServices; +using Autodesk.AutoCAD.EditorInput; + +using Teamcenter.Hello; +using Teamcenter.Soa.Client; +using Teamcenter.ClientX; +using Teamcenter.Services.Strong.Core; +using Teamcenter.Soa.Client.Model; +using Teamcenter.Soa.Exceptions; +using Teamcenter.Services.Strong.Query; + +using Teamcenter.Services.Strong.Core._2007_06.DataManagement; + + +using User = Teamcenter.Soa.Client.Model.Strong.User; +using Folder = Teamcenter.Soa.Client.Model.Strong.Folder; +using WorkspaceObject = Teamcenter.Soa.Client.Model.Strong.WorkspaceObject; +using Item = Teamcenter.Soa.Client.Model.Strong.Item; +using ItemRevision = Teamcenter.Soa.Client.Model.Strong.ItemRevision; +using ImanQuery = Teamcenter.Soa.Client.Model.Strong.ImanQuery; +using DataSet = Teamcenter.Soa.Client.Model.Strong.Dataset; + +using HelloTeamcenter.hello; + + +namespace HelloTeamcenter.form +{ + public partial class SaveToTC : Form + { + public Document appdoc; + public User user; + public bool first = true; + public Folder home = null; + Editor ed; + + public List folderlist = new List(); + public List itemlist = new List(); + public List itemvisionlist = new List(); + public List datasetlist = new List(); + + public OriginBTL btlinfo; + public List bomlist; + public Hashtable itemtypetable; + + public string xmlpath = ""; + + public SaveToTC() + { + InitializeComponent(); + } + + private void SaveToTC_Load(object sender, EventArgs e) + { + ed = appdoc.Editor; + treeView1.Nodes.Clear(); + + //读取Item类型.xml信息 + OriginItemType originitemtype = new OriginItemType(); + originitemtype.getType(this.xmlpath); + this.itemtypetable = originitemtype.Itemtypetable; + + foreach (DictionaryEntry de in itemtypetable) + { + this.comboBox1.Items.Add(de.Key.ToString()); + } + + OriginReadXml originreadxml = new OriginReadXml(); + OriginTypeRule origintyperule = originreadxml.OriginReadRuleXML(xmlpath); + OriginTool origintool = new OriginTool(); + string itemtype = origintool.getItemType(btlinfo, origintyperule); + + + if (this.comboBox1.Items.Contains(itemtype)) + this.comboBox1.SelectedText = itemtype; + else + { + this.comboBox1.Items.Add(itemtype); + this.comboBox1.SelectedText = itemtype; + } + + TreeNode rootnode = new TreeNode("Home", 7, 7); + treeView1.Nodes.Add(rootnode); + + WorkspaceObject[] contents = null; + DataManagementService dmService = DataManagementService.getService(Session.getConnection()); + try + { + home = user.Home_folder; + } + catch (NotLoadedException ex) + { + MessageBox.Show(ex.Message); + return; + } + try + { + ModelObject[] objects = { home }; + String[] attributes = { "contents" }; + dmService.RefreshObjects(objects); + dmService.GetProperties(objects, attributes); + contents = home.Contents; + } + catch (NotLoadedException ex) { MessageBox.Show(ex.Message); } + for (int i = 0; i < contents.Length; i++) + { + WorkspaceObject childobj = contents[i]; + ModelObject[] objects = { childobj }; + String[] attributes = { "object_string", "object_type" }; + dmService.RefreshObjects(objects); + dmService.GetProperties(objects, attributes); + string name = childobj.Object_string; + string type = childobj.Object_type; + if (type == "Folder" || type == "Newstuff Folder" || type == "Mail Folder") + { + ALLOBJECT perobject = new ALLOBJECT(); + perobject.workobject = childobj; + Folder fl = childobj as Folder; + if (type == "Folder") + { + TreeNode childnode = new TreeNode(name, 1, 1); + perobject.treenode = childnode; + perobject.name = name; + perobject.uid = childobj.Uid; + rootnode.Nodes.Add(childnode); + } + else if (type == "Newstuff Folder") + { + TreeNode childnode = new TreeNode(name, 6, 6); + perobject.treenode = childnode; + perobject.name = name; + perobject.uid = childobj.Uid; + rootnode.Nodes.Add(childnode); + } + else if (type == "Mail Folder") + { + TreeNode childnode = new TreeNode(name, 5, 5); + perobject.treenode = childnode; + perobject.name = name; + perobject.uid = childobj.Uid; + rootnode.Nodes.Add(childnode); + } + folderlist.Add(perobject); + } + else if (type == "Item" || this.itemtypetable.ContainsValue(type)) //需要替换类型 + { + ALLOBJECT perobject = new ALLOBJECT(); + perobject.workobject = childobj; + Item item = childobj as Item; + TreeNode childnode = new TreeNode(name, 3, 3); + perobject.treenode = childnode; + perobject.name = name; + perobject.uid = childobj.Uid; + rootnode.Nodes.Add(childnode); + itemlist.Add(perobject); + } + } + foreach (TreeNode ch in rootnode.Nodes) + { + ch.EnsureVisible(); + } + + //这边是加载Item类型.xml文件的信息 + ////Tool tool = new Tool(); + ////BTLClass btlinfo = tool.getBTL("DFHM_BTL"); + ////string itemtype = tool.initItemType(btlinfo.Item_id, btlinfo.Materialgrade); + ////this.comboBox1.SelectedText = itemtype; + } + + private void treeView1_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e) + { + TreeNode nownode = this.treeView1.SelectedNode; + + getChild(nownode); + foreach (TreeNode ch in nownode.Nodes) + { + ch.EnsureVisible(); + } + } + + private void getChild(TreeNode nownode) + { + nownode.Nodes.Clear(); + DataManagementService dmService = DataManagementService.getService(Session.getConnection()); + WorkspaceObject[] contents = null; + string nodetext = nownode.Text; + int imageindex = nownode.SelectedImageIndex; + if (imageindex == 1) + { + foreach (ALLOBJECT perobject in folderlist) + { + if (perobject.treenode.Equals(nownode)) + { + Folder fl = perobject.workobject as Folder; + ModelObject[] objects = { fl }; + String[] attributes = { "contents" }; + dmService.RefreshObjects(objects); + dmService.GetProperties(objects, attributes); + contents = fl.Contents; + for (int i = 0; i < contents.Length; i++) + { + WorkspaceObject childobj = contents[i]; + ModelObject[] objects1 = { childobj }; + String[] attributes1 = { "object_string", "object_type" }; + dmService.RefreshObjects(objects1); + dmService.GetProperties(objects1, attributes1); + string name = childobj.Object_string; + string type = childobj.Object_type; + if (type == "Folder" || type == "Newstuff Folder" || type == "Mail Folder") + { + ALLOBJECT inperobject = new ALLOBJECT(); + inperobject.workobject = childobj; + Folder infl = childobj as Folder; + + if (type == "Folder") + { + TreeNode childnode = new TreeNode(name, 1, 1); + inperobject.treenode = childnode; + nownode.Nodes.Add(childnode); + } + else if (type == "Newstuff Folder") + { + TreeNode childnode = new TreeNode(name, 6, 6); + inperobject.treenode = childnode; + nownode.Nodes.Add(childnode); + } + else if (type == "Mail Folder") + { + TreeNode childnode = new TreeNode(name, 5, 5); + inperobject.treenode = childnode; + nownode.Nodes.Add(childnode); + } + folderlist.Add(inperobject); + } + else if (type == "Item" || this.itemtypetable.ContainsValue(type))//需要替换类型 + { + ALLOBJECT inperobject = new ALLOBJECT(); + inperobject.workobject = childobj; + Item item = childobj as Item; + TreeNode childnode = new TreeNode(name, 3, 3); + inperobject.treenode = childnode; + nownode.Nodes.Add(childnode); + itemlist.Add(inperobject); + } + } + break; + } + } + return; + + } + else if (imageindex == 3) + { + foreach (ALLOBJECT perobject in itemlist) + { + if (perobject.treenode.Equals(nownode)) + { + Item item = perobject.workobject as Item; + ModelObject[] itemrevisionlist = null; + ModelObject[] objects = { item }; + String[] attributes = { "revision_list" }; + dmService.RefreshObjects(objects); + dmService.GetProperties(objects, attributes); + itemrevisionlist = item.Revision_list; + for (int i = 0; i < itemrevisionlist.Length; i++) + { + ItemRevision itemrevision = itemrevisionlist[i] as ItemRevision; + ModelObject[] objects1 = { itemrevision }; + String[] attributes1 = { "object_string", "object_type" }; + dmService.RefreshObjects(objects1); + dmService.GetProperties(objects1, attributes1); + string name = itemrevision.Object_string; + string type = itemrevision.Object_type; + + ALLOBJECT inperobject = new ALLOBJECT(); + inperobject.workobject = itemrevision; + TreeNode childnode = new TreeNode(name, 4, 4); + inperobject.treenode = childnode; + nownode.Nodes.Add(childnode); + itemvisionlist.Add(inperobject); + } + break; + } + } + return; + } + else if (imageindex == 4) + { + foreach (ALLOBJECT perobject in itemvisionlist) + { + if (perobject.treenode.Equals(nownode)) + { + ItemRevision itemrevision = perobject.workobject as ItemRevision; + ExpandGRMRelationsPref myPref = new ExpandGRMRelationsPref(); + RelationAndTypesFilter2 myFilter = new RelationAndTypesFilter2(); + myFilter.RelationName = "IMAN_specification"; + String[] typeVec = { "D5DWG", "Folder" }; + myFilter.ObjectTypeNames = typeVec; + myPref.ExpItemRev = false; + RelationAndTypesFilter2[] myfilter = { myFilter }; + myPref.Info = myfilter; + ModelObject[] objects1 = { itemrevision }; + + ExpandGRMRelationsResponse myResp = dmService.ExpandGRMRelationsForPrimary(objects1, myPref); + ExpandGRMRelationsOutput[] myoutput = myResp.Output; + for (int i = 0; i < myoutput.Length; i++) + { + ExpandGRMRelationsOutput one_out = myoutput[i]; + for (int j = 0; j < one_out.OtherSideObjData.Length; j++) + { + ExpandGRMRelationsData otherSideData = one_out.OtherSideObjData[j]; + for (int k = 0; k < otherSideData.OtherSideObjects.Length; k++) + { + Type typeinfo = otherSideData.OtherSideObjects[k].GetType(); + string typename = typeinfo.Name; + if (typename == "Folder") + { + Folder infold = otherSideData.OtherSideObjects[k] as Folder; + + ModelObject[] objects = { infold }; + String[] attributes = { "object_string", "object_type" }; + dmService.RefreshObjects(objects); + dmService.GetProperties(objects, attributes); + string name = infold.Object_string; + string type = infold.Object_type; + + ALLOBJECT inperobject = new ALLOBJECT(); + inperobject.workobject = infold; + TreeNode childnode = new TreeNode(name, 1, 1); + inperobject.treenode = childnode; + nownode.Nodes.Add(childnode); + folderlist.Add(inperobject); + } + else + { + DataSet dateset = otherSideData.OtherSideObjects[k] as DataSet; + ModelObject[] objects = { dateset }; + String[] attributes = { "object_string" }; + dmService.RefreshObjects(objects); + dmService.GetProperties(objects, attributes); + string name = dateset.Object_string; + + ALLOBJECT inperobject = new ALLOBJECT(); + inperobject.workobject = dateset; + inperobject.name = name; + TreeNode childnode = new TreeNode(name, 0, 0); + inperobject.treenode = childnode; + nownode.Nodes.Add(childnode); + datasetlist.Add(inperobject); + } + } + } + } + break; + } + } + return; + } + else if (imageindex == 6) + { + + } + else if (imageindex == 7) + { + folderlist.Clear(); + itemlist.Clear(); + itemvisionlist.Clear(); + datasetlist.Clear(); + try + { + ModelObject[] objects = { home }; + String[] attributes = { "contents" }; + dmService.RefreshObjects(objects); + dmService.GetProperties(objects, attributes); + contents = home.Contents; + } + catch (NotLoadedException ex) { MessageBox.Show(ex.Message); } + for (int i = 0; i < contents.Length; i++) + { + WorkspaceObject childobj = contents[i]; + ModelObject[] objects = { childobj }; + String[] attributes = { "object_string", "object_type" }; + dmService.RefreshObjects(objects); + dmService.GetProperties(objects, attributes); + string name = childobj.Object_string; + string type = childobj.Object_type; + if (type == "Folder" || type == "Newstuff Folder" || type == "Mail Folder") + { + ALLOBJECT perobject = new ALLOBJECT(); + perobject.workobject = childobj; + Folder fl = childobj as Folder; + if (type == "Folder") + { + TreeNode childnode = new TreeNode(name, 1, 1); + perobject.treenode = childnode; + perobject.name = name; + perobject.uid = childobj.Uid; + nownode.Nodes.Add(childnode); + } + else if (type == "Newstuff Folder") + { + TreeNode childnode = new TreeNode(name, 6, 6); + perobject.treenode = childnode; + perobject.name = name; + perobject.uid = childobj.Uid; + nownode.Nodes.Add(childnode); + } + else if (type == "Mail Folder") + { + TreeNode childnode = new TreeNode(name, 5, 5); + perobject.treenode = childnode; + perobject.name = name; + perobject.uid = childobj.Uid; + nownode.Nodes.Add(childnode); + } + folderlist.Add(perobject); + } + else if (type == "Item" || this.itemtypetable.ContainsValue(type)) + { + ALLOBJECT perobject = new ALLOBJECT(); + perobject.workobject = childobj; + Item item = childobj as Item; + TreeNode childnode = new TreeNode(name, 3, 3); + perobject.treenode = childnode; + perobject.name = name; + perobject.uid = childobj.Uid; + nownode.Nodes.Add(childnode); + itemlist.Add(perobject); + } + } + foreach (TreeNode ch in nownode.Nodes) + { + ch.EnsureVisible(); + } + } + } + } +} diff --git a/Backup1/form/SaveToTC.resx b/Backup1/form/SaveToTC.resx new file mode 100644 index 0000000..36e954d --- /dev/null +++ b/Backup1/form/SaveToTC.resx @@ -0,0 +1,212 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + + + AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj0yLjAuMC4w + LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 + ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAABq + EAAAAk1TRnQBSQFMAgEBCAEAARwBAAEcAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo + AwABQAMAATADAAEBAQABCAYAAQwYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA + AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5 + AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA + AWYDAAGZAwABzAIAATMDAAIzAgABMwFmAgABMwGZAgABMwHMAgABMwH/AgABZgMAAWYBMwIAAmYCAAFm + AZkCAAFmAcwCAAFmAf8CAAGZAwABmQEzAgABmQFmAgACmQIAAZkBzAIAAZkB/wIAAcwDAAHMATMCAAHM + AWYCAAHMAZkCAALMAgABzAH/AgAB/wFmAgAB/wGZAgAB/wHMAQABMwH/AgAB/wEAATMBAAEzAQABZgEA + ATMBAAGZAQABMwEAAcwBAAEzAQAB/wEAAf8BMwIAAzMBAAIzAWYBAAIzAZkBAAIzAcwBAAIzAf8BAAEz + AWYCAAEzAWYBMwEAATMCZgEAATMBZgGZAQABMwFmAcwBAAEzAWYB/wEAATMBmQIAATMBmQEzAQABMwGZ + AWYBAAEzApkBAAEzAZkBzAEAATMBmQH/AQABMwHMAgABMwHMATMBAAEzAcwBZgEAATMBzAGZAQABMwLM + AQABMwHMAf8BAAEzAf8BMwEAATMB/wFmAQABMwH/AZkBAAEzAf8BzAEAATMC/wEAAWYDAAFmAQABMwEA + AWYBAAFmAQABZgEAAZkBAAFmAQABzAEAAWYBAAH/AQABZgEzAgABZgIzAQABZgEzAWYBAAFmATMBmQEA + AWYBMwHMAQABZgEzAf8BAAJmAgACZgEzAQADZgEAAmYBmQEAAmYBzAEAAWYBmQIAAWYBmQEzAQABZgGZ + AWYBAAFmApkBAAFmAZkBzAEAAWYBmQH/AQABZgHMAgABZgHMATMBAAFmAcwBmQEAAWYCzAEAAWYBzAH/ + AQABZgH/AgABZgH/ATMBAAFmAf8BmQEAAWYB/wHMAQABzAEAAf8BAAH/AQABzAEAApkCAAGZATMBmQEA + AZkBAAGZAQABmQEAAcwBAAGZAwABmQIzAQABmQEAAWYBAAGZATMBzAEAAZkBAAH/AQABmQFmAgABmQFm + ATMBAAGZATMBZgEAAZkBZgGZAQABmQFmAcwBAAGZATMB/wEAApkBMwEAApkBZgEAA5kBAAKZAcwBAAKZ + Af8BAAGZAcwCAAGZAcwBMwEAAWYBzAFmAQABmQHMAZkBAAGZAswBAAGZAcwB/wEAAZkB/wIAAZkB/wEz + AQABmQHMAWYBAAGZAf8BmQEAAZkB/wHMAQABmQL/AQABzAMAAZkBAAEzAQABzAEAAWYBAAHMAQABmQEA + AcwBAAHMAQABmQEzAgABzAIzAQABzAEzAWYBAAHMATMBmQEAAcwBMwHMAQABzAEzAf8BAAHMAWYCAAHM + AWYBMwEAAZkCZgEAAcwBZgGZAQABzAFmAcwBAAGZAWYB/wEAAcwBmQIAAcwBmQEzAQABzAGZAWYBAAHM + ApkBAAHMAZkBzAEAAcwBmQH/AQACzAIAAswBMwEAAswBZgEAAswBmQEAA8wBAALMAf8BAAHMAf8CAAHM + Af8BMwEAAZkB/wFmAQABzAH/AZkBAAHMAf8BzAEAAcwC/wEAAcwBAAEzAQAB/wEAAWYBAAH/AQABmQEA + AcwBMwIAAf8CMwEAAf8BMwFmAQAB/wEzAZkBAAH/ATMBzAEAAf8BMwH/AQAB/wFmAgAB/wFmATMBAAHM + AmYBAAH/AWYBmQEAAf8BZgHMAQABzAFmAf8BAAH/AZkCAAH/AZkBMwEAAf8BmQFmAQAB/wKZAQAB/wGZ + AcwBAAH/AZkB/wEAAf8BzAIAAf8BzAEzAQAB/wHMAWYBAAH/AcwBmQEAAf8CzAEAAf8BzAH/AQAC/wEz + AQABzAH/AWYBAAL/AZkBAAL/AcwBAAJmAf8BAAFmAf8BZgEAAWYC/wEAAf8CZgEAAf8BZgH/AQAC/wFm + AQABIQEAAaUBAANfAQADdwEAA4YBAAOWAQADywEAA7IBAAPXAQAD3QEAA+MBAAPqAQAD8QEAA/gBAAHw + AfsB/wEAAaQCoAEAA4ADAAH/AgAB/wMAAv8BAAH/AwAB/wEAAf8BAAL/AgAD//8A/wD/AP8AFQAQ/ycA + AZoCGgHwBQAQ/wMAAvANAAEEEAABGgHwARoBmgHlAVkBUgF5AfAEABD/AgABtAGtAc8BtQHvAgcBvAgA + AuwCBwEAAQMB+wEAAwcEAAIaAcMBGgLDAaABeQFZATIBmQGYAbwB8AEAAf8OAAH/AgABzweLAa4B9wHv + AQcEAALsAv8BAAEDAfsBAAL/AQcEAAGaAsMBGgL2AcMBeQI4AVgBVgFQAZgB8AH/DewBAAH/AgABzwGL + CYoBkgQAAuwC/wEAAQMB+wEAAv8BBwQAAXoDoAEaAvYBmgJZAVgBeAJQAfAB/wHsCwcB7AEAAf8CAAHP + ArIBrAeKAa4EAALsAv8BAAEDAfsBAAL/AQcEAAF6AuUBegJSAZkBGgGaAVkBmQGYAVYBUAHwAf8B7AED + AwcDAwMHAQMB7AEAAf8CAAHPAawFsgSKAZEBvAMAAQQB7AL/BAAC/wEHAwAB8AGaAXoB5QF6ATECUgEc + AZkBmgEaAZgBVwFWAfAB/wHsAfsBAwEHAQMDAAEDAQcBAwEHAewBAAH/AgABtQGtBbMDsgGzAa4BBwQA + AewI/wHsAwAB8AHDAfYBwwF6AVkBOAFYAngBHAGYAZkBmAF4AfAB/wHsAv8BAwEAAv8B+wEAAQMCBwHs + AQAB/wIAAbUBtAG7AroGswGRAQcEAAEDAQAG/wHsAgMCAAHwAZoCwwF6AjgBWAFXAVABSgFyAXMBHAGZ + AfAB/wHsAfsBBwEAAf8B+wP/AQABAwEHAewBAAH/AgABBwG0Aa0CtAEJAbsEugG0Ae8FAAEDAQAE/wHs + AgMB7AIAAfABmgF6AZoBegJZAnkBVgFQAXIBBwMAAf8B7AEHAQAB+wP/AfsC/wEAAQMB7AEAAf8CAAG1 + AZkBkAGYAbMBtAEJAhkCCQG1AQcGAAEDAQAC/wHsAgMEAAHwARoBegF5AZkBoAFYAVkBmQJWARwEAAH/ + AewBAAP/AfsD/wH7Af8BAAHsAQAB/wEAAbsBtAF5AZkBeQG0AgkEtAG1CAABAwIAAgMHAAHwArwBmQF5 + AZkBeAJWAXgEAAH/AewC/wH7A/8B+wP/AfsCAAH/AgAB7wF+AV4BWAEcA7QB1gIJAQcJAAMDAewBAQcA + AbwB8AEIAZgBeAKYAZkBBwQAAf8N7AEAAf8CAAKZAnkBtQHvAwACtQEHDQABAQcAAfABvALwAbwBBwK8 + BQAQ/wIAAQcBGgGRArwRAAEEAgABAQgABLwB8AcAEP8EAAHvHAAO8CoAARoB8AG8AfAEAAHvCYEB/wOB + AfAmAAGZARoBegFTAVkBUgF0AQcDAAGyAbkD2gO5AdoBuQH0AtoBuQG8IwACkwFMAXoDoAHlATEBMgFS + AZkCAAGyAtoCswLZAbMBiwGzAfQBswHUAbkBvA7sBAAM7AIAAfACmQEbAf8BmgH2AsMCoAExATgBMgF0 + AgABsgOzBtkB9AHZArMBvAHsAf8B+wEHAfsBBwH7AQcB+wEHAfsBBwH7AewEAAHsAf8B+wEHAfsBBwH7 + AQcB+wEHAfsB7AIAAbwBGgHDAv8BmQH/AvYCwwE3AjgBeQIAAbIBswGyAtkBuAHbAbkB2wGyAfQB2QGy + AbkBvAHsAf8BBwH7AQcB+wEHAfsBBwH7AQcB+wEHAewDAAHsAf8B+wEHAfsBBwH7AQcB+wEHAfsBBwEA + AewBAAG8AZoBoALDAZoB9gP/AfYBNwI4AXkCAAGyAdkBsgG4AbIBuAGKAbIBgQGyAfQB2QGyAbkBvAHs + Af8B+wEHAfsBBwH7AQcB+wEHAfsBBwH7AewDAAHsAf8BBwH7AQcB+wEHAfsBBwH7AQcB7AEAAewBAAG8 + AXkDoAFSAZkCwwEaAZoBegI4AXkCAAGyAdkBuAK5AbgB2QGyAYoB2QH0AdkBsgG5AbwB7AH/AQcB+wEH + AfsBBwH7AQcB+wEHAfsBBwHsAgAB7AH/AQcB+wEHAfsBBwH7AQcB+wEHAfsBAALsAQAB8AF6AuUBegFT + AVIBcwF0AbwB9AH2AXoBWQGZAgABsgLaAbMC3AG5AbgB2QG7Af8BuwGzAdoBvAHsAf8B+wEHAfsBBwH7 + AQcB+wEHAfsBBwH7AewCAAHsCv8B7AEAAQcB7AEAARoBmQN6AVkBMQErAUsBUgKZAZoCegIAAYEDswGQ + AYoBgQKzAbsBigG6ArMBBwHsAf8BBwH7AQcB+wEHAfsBBwH7AQcB+wEHAewCAA3sAfsB7AEAAXQBwwH2 + AsMBegFZATgBMgFMAZkBGgUAAboB2wK6AdoBugKRAdoBuwS6AQcB7AH/AfsBBwH7AQcB+wEHAfsBBwH7 + AQcB+wHsAwAB7AH/AQcB+wEHAfsBBwH7AQcB+wEHAfsBBwHsAQABdAHDAfYC/wGaAzgBUgcAAbkC2wGz + BNkBuAHyAf8B8gHbAdoBvAHsDP8B7AMAAewB/wH7AQcB+wEHAfsBBwX/AewBAAF6AsMC9gEaAfsCOAFS + BwABswTbAQkC3AIJAfQC2wHaAbwB7AEHAfsBBwH7AQcB+wEHBuwDAAHsAf8BBwH7AQcB+wEHAf8G7AEA + AnoCoAJ6AVkB+wE4AXkHAAGzAdsB3AcJAfQBCQHcAdsBvAEAAewBBwH7AQcB+wEHAewKAAHsBf8B7AcA + AnoBWQLlAcMBegJZAZkHAAG5CRkB9AMZAfACAAXsDAAF7AkAAfABGgFSAlkCegFTAXkRAAHwKAAC8AoA + AUIBTQE+BwABPgMAASgDAAFAAwABMAMAAQEBAAEBBQABgAEBFgAD/4EAAv8CAAT/Af4BHwIAAecB/wHA + AQMB4AEPAgABwAE/AcABAwGAAQECAAHAAQMBwAEDAYADAAHAAQMBwAEDAYADAAHAAQMBwAEDAYADAAHA + AQEBwAEDBAABwAEBAYABAQQAAcABAQHAAQEEAAHAAQEB4AEDAQABBwIAAcABAQHwAQcBAAEPAgABgAED + AfgBBwHAAQ8CAAHAAQMB/AEHAeABDwIAAcAB4wH+AScB4AEfAgABwQL/AWcB8AF/AgAB9wP/AYABAQX/ + AYcBgAEABP8B/AEDAYABAAGAAQEB4AEAAeABAQGAAgABAQHAAgABAQGAAgABAQHAAgABAQGAAgABAQGA + AgABAQGAAgABAQGAAgABAQGAAgABAQMAAQEBgAIAAQEDAAEBAYACAAEBAwABDwGAAgABAQGAAgABPwGA + AgABAQGAAgABPwGAAgABAwGAAQEBAAE/AYABAAGAAf8BwAF/AQABPwGAAQABwQH/AeAB/wGAAT8B/wHv + BP8B8wH/Cw== + + + + + + AAABAAEAECAAAAEABAAoAQAAFgAAACgAAAAQAAAAIAAAAAEABAAAAAAAwAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAACAAACAAAAAgIAAgAAAAIAAgACAgAAAwMDAAICAgAAAAP8AAP8AAAD//wD/AAAA/wD/AP// + AAD///8A///////////0bm5ubm5ub/Rs6IjoiEzv9G6Pd4d3Tm/0bP/3f/dM7/Ru/45v905v9Gz/jO/3 + TO/0bn/2b/dOb/Rs5///90zv9G5ubm/3Tm/0bPeIf/bs7/Rub///fm5v9Gzs53zs7O/0xsbGxsbGz/RE + RERERERP//////////8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA + //8AAP//AAD//wAA//8AAP// + + + \ No newline at end of file diff --git a/Backup1/form/Search.Designer.cs b/Backup1/form/Search.Designer.cs new file mode 100644 index 0000000..d537286 --- /dev/null +++ b/Backup1/form/Search.Designer.cs @@ -0,0 +1,208 @@ +namespace HelloTeamcenter.form +{ + partial class Search + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Search)); + this.label1 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.label3 = new System.Windows.Forms.Label(); + this.label4 = new System.Windows.Forms.Label(); + this.textBox1 = new System.Windows.Forms.TextBox(); + this.textBox2 = new System.Windows.Forms.TextBox(); + this.comboBox1 = new System.Windows.Forms.ComboBox(); + this.comboBox2 = new System.Windows.Forms.ComboBox(); + this.treeView1 = new System.Windows.Forms.TreeView(); + this.imageList1 = new System.Windows.Forms.ImageList(this.components); + this.button1 = new System.Windows.Forms.Button(); + this.button2 = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(38, 36); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(43, 13); + this.label1.TabIndex = 0; + this.label1.Text = "名称:"; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(8, 75); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(69, 13); + this.label2.TabIndex = 1; + this.label2.Text = "零组件 ID:"; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(38, 114); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(43, 13); + this.label3.TabIndex = 2; + this.label3.Text = "类型:"; + // + // label4 + // + this.label4.AutoSize = true; + this.label4.Location = new System.Drawing.Point(26, 153); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(55, 13); + this.label4.TabIndex = 3; + this.label4.Text = "创建者:"; + // + // textBox1 + // + this.textBox1.Location = new System.Drawing.Point(85, 29); + this.textBox1.Name = "textBox1"; + this.textBox1.Size = new System.Drawing.Size(166, 20); + this.textBox1.TabIndex = 4; + // + // textBox2 + // + this.textBox2.Location = new System.Drawing.Point(85, 67); + this.textBox2.Name = "textBox2"; + this.textBox2.Size = new System.Drawing.Size(166, 20); + this.textBox2.TabIndex = 5; + // + // comboBox1 + // + this.comboBox1.FormattingEnabled = true; + this.comboBox1.Items.AddRange(new object[] { + "*"}); + this.comboBox1.Location = new System.Drawing.Point(85, 108); + this.comboBox1.Name = "comboBox1"; + this.comboBox1.Size = new System.Drawing.Size(166, 21); + this.comboBox1.TabIndex = 6; + // + // comboBox2 + // + this.comboBox2.FormattingEnabled = true; + this.comboBox2.Items.AddRange(new object[] { + "*"}); + this.comboBox2.Location = new System.Drawing.Point(85, 147); + this.comboBox2.Name = "comboBox2"; + this.comboBox2.Size = new System.Drawing.Size(166, 21); + this.comboBox2.TabIndex = 7; + this.comboBox2.Click += new System.EventHandler(this.comboBox2_Click); + // + // treeView1 + // + this.treeView1.ImageIndex = 7; + this.treeView1.ImageList = this.imageList1; + this.treeView1.Location = new System.Drawing.Point(280, 1); + this.treeView1.Name = "treeView1"; + this.treeView1.SelectedImageIndex = 0; + this.treeView1.Size = new System.Drawing.Size(401, 356); + this.treeView1.TabIndex = 8; + this.treeView1.NodeMouseDoubleClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(this.treeView1_NodeMouseDoubleClick); + // + // imageList1 + // + this.imageList1.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream"))); + this.imageList1.TransparentColor = System.Drawing.Color.Transparent; + this.imageList1.Images.SetKeyName(0, "autocad_01.ico"); + this.imageList1.Images.SetKeyName(1, "FOLDER.ICO"); + this.imageList1.Images.SetKeyName(2, "FOLDEROP.ICO"); + this.imageList1.Images.SetKeyName(3, "item.ico"); + this.imageList1.Images.SetKeyName(4, "itemrev.ico"); + this.imageList1.Images.SetKeyName(5, "mail.ico"); + this.imageList1.Images.SetKeyName(6, "Newstuff_Folder.png"); + this.imageList1.Images.SetKeyName(7, "tai.ico"); + // + // button1 + // + this.button1.Location = new System.Drawing.Point(59, 233); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(75, 25); + this.button1.TabIndex = 9; + this.button1.Text = "查找"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // button2 + // + this.button2.Location = new System.Drawing.Point(162, 233); + this.button2.Name = "button2"; + this.button2.Size = new System.Drawing.Size(75, 25); + this.button2.TabIndex = 10; + this.button2.Text = "打开"; + this.button2.UseVisualStyleBackColor = true; + this.button2.Click += new System.EventHandler(this.button2_Click); + // + // Search + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(693, 371); + this.Controls.Add(this.button2); + this.Controls.Add(this.button1); + this.Controls.Add(this.treeView1); + this.Controls.Add(this.comboBox2); + this.Controls.Add(this.comboBox1); + this.Controls.Add(this.textBox2); + this.Controls.Add(this.textBox1); + this.Controls.Add(this.label4); + this.Controls.Add(this.label3); + this.Controls.Add(this.label2); + this.Controls.Add(this.label1); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; + this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "Search"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "搜索"; + this.TopMost = true; + this.Load += new System.EventHandler(this.Search_Load); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + public System.Windows.Forms.Label label1; + public System.Windows.Forms.Label label2; + public System.Windows.Forms.Label label3; + public System.Windows.Forms.Label label4; + public System.Windows.Forms.TextBox textBox1; + public System.Windows.Forms.TextBox textBox2; + public System.Windows.Forms.ComboBox comboBox1; + public System.Windows.Forms.ComboBox comboBox2; + public System.Windows.Forms.TreeView treeView1; + public System.Windows.Forms.Button button1; + public System.Windows.Forms.Button button2; + public System.Windows.Forms.ImageList imageList1; + + } +} \ No newline at end of file diff --git a/Backup1/form/Search.cs b/Backup1/form/Search.cs new file mode 100644 index 0000000..3e70289 --- /dev/null +++ b/Backup1/form/Search.cs @@ -0,0 +1,481 @@ +using System; +using System.IO; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Text; +using System.Windows.Forms; +using System.Collections; + +using Autodesk.AutoCAD.DatabaseServices; +using Autodesk.AutoCAD.Runtime; +using Autodesk.AutoCAD.Geometry; +using Autodesk.AutoCAD.ApplicationServices; +using Autodesk.AutoCAD.EditorInput; + +using Teamcenter.Hello; +using Teamcenter.Soa.Client; +using Teamcenter.ClientX; +using Teamcenter.Services.Strong.Core; +using Teamcenter.Soa.Client.Model; +using Teamcenter.Soa.Exceptions; +using Teamcenter.Services.Strong.Query; + +using Teamcenter.Services.Strong.Core._2007_06.DataManagement; +using Teamcenter.Services.Strong.Core._2006_03.Reservation; + +using Teamcenter.Services.Strong.Core._2006_03.FileManagement; + +using Teamcenter.Soa.Internal.Client.Model; +using Teamcenter.Soa.Internal.Client; + +using HelloTeamcenter.hello; + + +using User = Teamcenter.Soa.Client.Model.Strong.User; +using Folder = Teamcenter.Soa.Client.Model.Strong.Folder; +using WorkspaceObject = Teamcenter.Soa.Client.Model.Strong.WorkspaceObject; +using Item = Teamcenter.Soa.Client.Model.Strong.Item; +using ItemRevision = Teamcenter.Soa.Client.Model.Strong.ItemRevision; +using ImanQuery = Teamcenter.Soa.Client.Model.Strong.ImanQuery; +using DataSet = Teamcenter.Soa.Client.Model.Strong.Dataset; +using SavedQueryResults = Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryResults; +using ImanFile = Teamcenter.Soa.Client.Model.Strong.ImanFile; + + + +namespace HelloTeamcenter.form +{ + public partial class Search : Form + { + public Search() + { + InitializeComponent(); + } + public List folderlist = new List(); + public List itemlist = new List(); + public List itemvisionlist = new List(); + public List datasetlist = new List(); + + public Document appdoc; + public User user; + public Editor ed; + public bool hasRight = true; + + public Hashtable itemtypetable; + + public string xmlpath = ""; + + private void Search_Load(object sender, EventArgs e) + { + this.textBox1.Text = ""; + this.textBox2.Text = ""; + //读取Item类型.xml信息 + OriginItemType originitemtype = new OriginItemType(); + originitemtype.getType(this.xmlpath); + this.itemtypetable = originitemtype.Itemtypetable; + + foreach (DictionaryEntry de in itemtypetable) + { + this.comboBox1.Items.Add(de.Key.ToString()); + } + } + + private void comboBox2_Click(object sender, EventArgs e) + { + DataManagementService dmService = DataManagementService.getService(Session.getConnection()); + this.comboBox2.Items.Clear(); + OriginTool tool = new OriginTool(); + SavedQueryResults found = tool.getSearchUser(); + if (found != null && found.NumOfObjects > 0) + { + for (int i = 0; i < found.NumOfObjects; i++) + { + User userobj = found.Objects[i] as User; + ModelObject[] objects = { userobj }; + String[] attributes = { "User ID", "Name" }; + dmService.RefreshObjects(objects); + dmService.GetProperties(objects, attributes); + string userid = userobj.User_id; + string username = userobj.User_name; + string tempname = userid + "(" + username + ")"; + if (this.comboBox2.Items.Contains(tempname)) + continue; + else + this.comboBox2.Items.Add(tempname); + } + } + } + + private void button1_Click(object sender, EventArgs e) + { + string name = textBox1.Text; + string item_id = textBox2.Text; + string type = comboBox1.Text; + //ed.WriteMessage("选择类型:"+ type +"\n"); + string owner = comboBox2.Text; + //ed.WriteMessage("选择用户:" + owner + "\n"); + if (name == "") + { + name = "*"; + } + if (item_id == "") + { + item_id = "*"; + } + if (type == "") + { + type = "*"; + } + if (owner == "") + { + owner = "*"; + } + else + { + int pos = owner.IndexOf('('); + owner = owner.Substring(0, pos); + //ed.WriteMessage("用户" + owner+"\n"); + } + DataManagementService dmService = DataManagementService.getService(Session.getConnection()); + OriginTool tool = new OriginTool(); + SavedQueryResults found = tool.getSearchItem(item_id, name, type, owner); + if (found != null && found.NumOfObjects > 0) + { + this.treeView1.Nodes.Clear(); + for (int i = 0; i < found.NumOfObjects; i++) + { + Item item = found.Objects[i] as Item; + ModelObject[] objects = { item }; + String[] attributes = { "object_string"}; + dmService.RefreshObjects(objects); + dmService.GetProperties(objects, attributes); + string inname = item.Object_string; + TreeNode childnode = new TreeNode(inname, 3, 3); + this.treeView1.Nodes.Add(childnode); + ALLOBJECT perobject = new ALLOBJECT(); + perobject.workobject = item; + perobject.treenode = childnode; + itemlist.Add(perobject); + } + foreach (TreeNode ch in treeView1.Nodes) + { + ch.EnsureVisible(); + } + } + } + + private void treeView1_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e) + { + TreeNode nownode = this.treeView1.SelectedNode; + getChild(nownode); + foreach (TreeNode ch in nownode.Nodes) + { + ch.EnsureVisible(); + } + } + + private void getChild(TreeNode nownode) + { + nownode.Nodes.Clear(); + DataManagementService dmService = DataManagementService.getService(Session.getConnection()); + WorkspaceObject[] contents = null; + string nodetext = nownode.Text; + int imageindex = nownode.SelectedImageIndex; + if (imageindex == 3) + { + foreach (ALLOBJECT perobject in itemlist) + { + if (perobject.treenode.Equals(nownode)) + { + Item item = perobject.workobject as Item; + ModelObject[] itemrevisionlist = null; + ModelObject[] objects = { item }; + String[] attributes = { "revision_list" }; + dmService.RefreshObjects(objects); + dmService.GetProperties(objects, attributes); + itemrevisionlist = item.Revision_list; + for (int i = 0; i < itemrevisionlist.Length; i++) + { + ItemRevision itemrevision = itemrevisionlist[i] as ItemRevision; + ModelObject[] objects1 = { itemrevision }; + String[] attributes1 = { "object_string", "object_type" }; + dmService.RefreshObjects(objects1); + dmService.GetProperties(objects1, attributes1); + string name = itemrevision.Object_string; + string type = itemrevision.Object_type; + + ALLOBJECT inperobject = new ALLOBJECT(); + inperobject.workobject = itemrevision; + TreeNode childnode = new TreeNode(name, 4, 4); + inperobject.treenode = childnode; + nownode.Nodes.Add(childnode); + itemvisionlist.Add(inperobject); + } + break; + } + } + } + else if (imageindex == 4) + { + foreach (ALLOBJECT perobject in itemvisionlist) + { + if (perobject.treenode.Equals(nownode)) + { + ItemRevision itemrevision = perobject.workobject as ItemRevision; + ExpandGRMRelationsPref myPref = new ExpandGRMRelationsPref(); + RelationAndTypesFilter2 myFilter = new RelationAndTypesFilter2(); + myFilter.RelationName = "IMAN_specification"; + String[] typeVec = { "D5DWG", "Folder" }; + myFilter.ObjectTypeNames = typeVec; + myPref.ExpItemRev = false; + RelationAndTypesFilter2[] myfilter = { myFilter }; + myPref.Info = myfilter; + ModelObject[] objects1 = { itemrevision }; + + ExpandGRMRelationsResponse myResp = dmService.ExpandGRMRelationsForPrimary(objects1, myPref); + ExpandGRMRelationsOutput[] myoutput = myResp.Output; + for (int i = 0; i < myoutput.Length; i++) + { + ExpandGRMRelationsOutput one_out = myoutput[i]; + for (int j = 0; j < one_out.OtherSideObjData.Length; j++) + { + ExpandGRMRelationsData otherSideData = one_out.OtherSideObjData[j]; + for (int k = 0; k < otherSideData.OtherSideObjects.Length; k++) + { + Type typeinfo = otherSideData.OtherSideObjects[k].GetType(); + string typename = typeinfo.Name; + if (typename == "Folder") + { + Folder infold = otherSideData.OtherSideObjects[k] as Folder; + + ModelObject[] objects = { infold }; + String[] attributes = { "object_string", "object_type" }; + dmService.RefreshObjects(objects); + dmService.GetProperties(objects, attributes); + string name = infold.Object_string; + string type = infold.Object_type; + + ALLOBJECT inperobject = new ALLOBJECT(); + inperobject.workobject = infold; + TreeNode childnode = new TreeNode(name, 1, 1); + inperobject.treenode = childnode; + nownode.Nodes.Add(childnode); + folderlist.Add(inperobject); + } + else + { + DataSet dateset = otherSideData.OtherSideObjects[k] as DataSet; + ModelObject[] objects = { dateset }; + String[] attributes = { "object_string" }; + dmService.RefreshObjects(objects); + dmService.GetProperties(objects, attributes); + string name = dateset.Object_string; + + ALLOBJECT inperobject = new ALLOBJECT(); + inperobject.workobject = dateset; + inperobject.name = name; + TreeNode childnode = new TreeNode(name, 0, 0); + inperobject.treenode = childnode; + nownode.Nodes.Add(childnode); + datasetlist.Add(inperobject); + } + } + } + } + break; + } + } + } + else if (imageindex == 1) + { + foreach (ALLOBJECT perobject in folderlist) + { + if (perobject.treenode.Equals(nownode)) + { + Folder fl = perobject.workobject as Folder; + ModelObject[] objects = { fl }; + String[] attributes = { "contents" }; + dmService.RefreshObjects(objects); + dmService.GetProperties(objects, attributes); + contents = fl.Contents; + for (int i = 0; i < contents.Length; i++) + { + WorkspaceObject childobj = contents[i]; + ModelObject[] objects1 = { childobj }; + String[] attributes1 = { "object_string", "object_type" }; + dmService.RefreshObjects(objects1); + dmService.GetProperties(objects1, attributes1); + string name = childobj.Object_string; + string type = childobj.Object_type; + if (type == "Folder" || type == "Newstuff Folder" || type == "Mail Folder") + { + ALLOBJECT inperobject = new ALLOBJECT(); + inperobject.workobject = childobj; + Folder infl = childobj as Folder; + + if (type == "Folder") + { + TreeNode childnode = new TreeNode(name, 1, 1); + inperobject.treenode = childnode; + nownode.Nodes.Add(childnode); + } + else if (type == "Newstuff Folder") + { + TreeNode childnode = new TreeNode(name, 6, 6); + inperobject.treenode = childnode; + nownode.Nodes.Add(childnode); + } + else if (type == "Mail Folder") + { + TreeNode childnode = new TreeNode(name, 5, 5); + inperobject.treenode = childnode; + nownode.Nodes.Add(childnode); + } + folderlist.Add(inperobject); + } + else if (type == "Item" || this.itemtypetable.ContainsValue(type)) + { + ALLOBJECT inperobject = new ALLOBJECT(); + inperobject.workobject = childobj; + Item item = childobj as Item; + TreeNode childnode = new TreeNode(name, 3, 3); + inperobject.treenode = childnode; + nownode.Nodes.Add(childnode); + itemlist.Add(inperobject); + } + } + break; + } + } + } + + } + + private void button2_Click(object sender, EventArgs e) + { + DataManagementService dmService = DataManagementService.getService(Session.getConnection()); + Reservation res = ReservationService.getService(Session.getConnection()); + TreeNode nownode = this.treeView1.SelectedNode; + if (nownode.SelectedImageIndex == 0) + { + foreach (ALLOBJECT perobject in this.datasetlist) + { + if (perobject.treenode.Equals(nownode)) + { + DialogResult isopen = MessageBox.Show("您是否确定打开该图纸?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question); + if (isopen == DialogResult.None || isopen == DialogResult.No) + { + return; + } + DataSet mydateset = perobject.workobject as DataSet; + ModelObject[] objects = { mydateset }; + String[] attributes = { "is_modifiable", "checked_out", "ref_list" }; + dmService.RefreshObjects(objects); + dmService.GetProperties(objects, attributes); + if (mydateset.Is_modifiable == false) + { + DialogResult result = MessageBox.Show("您没有修改权限,是否以只读方式打开?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question); + if (result == DialogResult.Yes) + { + hasRight = false; + } + else + { + return; + } + } + if (mydateset.Is_modifiable) + { + DialogResult result = MessageBox.Show("是否签出?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question); + if (result == DialogResult.Yes) + { + if (mydateset.Checked_out == "Y") + { + MessageBox.Show("对不起,文件已签出!请确认文件签入后执行此操作"); + return; + } + else + { + ModelObject[] dataobj = { mydateset }; + res.Checkout(dataobj, "", ""); + //ed.WriteMessage("文件已签出"); + //ed.WriteMessage("\n"); + } + } + } + + ModelObject[] dsfilevec = mydateset.Ref_list; + //ed.WriteMessage("长度:" + dsfilevec.Length); + //ed.WriteMessage(dsfilevec[0].GetType().ToString()); + ImanFile dsfile = dsfilevec[0] as ImanFile; + + ModelObject[] objects1 = { dsfile }; + String[] attributes1 = { "relative_directory_path", "original_file_name" }; + dmService.RefreshObjects(objects1); + dmService.GetProperties(objects1, attributes1); + + //ed.WriteMessage("路径:" + dsfile.Relative_directory_path + "\n"); + //ed.WriteMessage("文件名:" + dsfile.Original_file_name + "\n"); + string newfilename = dsfile.Original_file_name; + + string tempdir = System.Environment.GetEnvironmentVariable("TEMP").ToString(); + //ed.WriteMessage("TEMP:" + tempdir.ToString() + "\n"); + + FileManagementService fmService = FileManagementService.getService(Teamcenter.ClientX.Session.getConnection()); + ImanFile[] objects2 = { dsfile }; + FileTicketsResponse tickets = fmService.GetFileReadTickets(objects2); + //ed.WriteMessage("tickets : " + tickets.Tickets.Count + "\n"); + + //foreach (System.Collections.DictionaryEntry ticket in tickets.Tickets) + //{ + // ed.WriteMessage("键:" + ticket.Key + "\n" + "值:" + ticket.Value + "\n"); + //} + Teamcenter.Soa.Client.FileManagementUtility fmu = new Teamcenter.Soa.Client.FileManagementUtility(Teamcenter.ClientX.Session.getConnection()); + Teamcenter.Soa.Client.GetFileResponse getFileResponse = fmu.GetFiles(dsfilevec); + FileInfo[] fileinfovec = getFileResponse.GetFiles(); + + //ed.WriteMessage("文件个数:" + fileinfovec.Length + "\n"); + FileInfo file = fileinfovec[0]; + + string newtempfile = tempdir + "\\" + newfilename; + System.IO.File.Copy(file.FullName, newtempfile, true); + System.IO.File.SetAttributes(newtempfile, FileAttributes.Normal); + DocumentCollection acdocmgr = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager; + if (File.Exists(newtempfile)) + { + acdocmgr.Open(newtempfile,false); + //Object pdata = newtempfile; + //acdocmgr.ExecuteInApplicationContext(c_back, pdata); + //acdocmgr.Add(newtempfile); + } + else + { + MessageBox.Show("对不起,用户临时目录下不存在此文件\n"); + } + this.Hide(); + this.Dispose(); + break; + } + } + } + else + { + //ed.WriteMessage("请选择正确的数据集类型\n"); + MessageBox.Show("请选择正确的数据集类型"); + return; + } + } + + //private void c_back(Object data) + //{ + // DocumentCollection acdocmgr = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager; + // if (acdocmgr.IsApplicationContext) + // { + // acdocmgr.Open(Convert.ToString(data)); + // } + //} + + } +} diff --git a/Backup1/form/Search.resx b/Backup1/form/Search.resx new file mode 100644 index 0000000..36e954d --- /dev/null +++ b/Backup1/form/Search.resx @@ -0,0 +1,212 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + + + AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj0yLjAuMC4w + LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 + ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAABq + EAAAAk1TRnQBSQFMAgEBCAEAARwBAAEcAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo + AwABQAMAATADAAEBAQABCAYAAQwYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA + AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5 + AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA + AWYDAAGZAwABzAIAATMDAAIzAgABMwFmAgABMwGZAgABMwHMAgABMwH/AgABZgMAAWYBMwIAAmYCAAFm + AZkCAAFmAcwCAAFmAf8CAAGZAwABmQEzAgABmQFmAgACmQIAAZkBzAIAAZkB/wIAAcwDAAHMATMCAAHM + AWYCAAHMAZkCAALMAgABzAH/AgAB/wFmAgAB/wGZAgAB/wHMAQABMwH/AgAB/wEAATMBAAEzAQABZgEA + ATMBAAGZAQABMwEAAcwBAAEzAQAB/wEAAf8BMwIAAzMBAAIzAWYBAAIzAZkBAAIzAcwBAAIzAf8BAAEz + AWYCAAEzAWYBMwEAATMCZgEAATMBZgGZAQABMwFmAcwBAAEzAWYB/wEAATMBmQIAATMBmQEzAQABMwGZ + AWYBAAEzApkBAAEzAZkBzAEAATMBmQH/AQABMwHMAgABMwHMATMBAAEzAcwBZgEAATMBzAGZAQABMwLM + AQABMwHMAf8BAAEzAf8BMwEAATMB/wFmAQABMwH/AZkBAAEzAf8BzAEAATMC/wEAAWYDAAFmAQABMwEA + AWYBAAFmAQABZgEAAZkBAAFmAQABzAEAAWYBAAH/AQABZgEzAgABZgIzAQABZgEzAWYBAAFmATMBmQEA + AWYBMwHMAQABZgEzAf8BAAJmAgACZgEzAQADZgEAAmYBmQEAAmYBzAEAAWYBmQIAAWYBmQEzAQABZgGZ + AWYBAAFmApkBAAFmAZkBzAEAAWYBmQH/AQABZgHMAgABZgHMATMBAAFmAcwBmQEAAWYCzAEAAWYBzAH/ + AQABZgH/AgABZgH/ATMBAAFmAf8BmQEAAWYB/wHMAQABzAEAAf8BAAH/AQABzAEAApkCAAGZATMBmQEA + AZkBAAGZAQABmQEAAcwBAAGZAwABmQIzAQABmQEAAWYBAAGZATMBzAEAAZkBAAH/AQABmQFmAgABmQFm + ATMBAAGZATMBZgEAAZkBZgGZAQABmQFmAcwBAAGZATMB/wEAApkBMwEAApkBZgEAA5kBAAKZAcwBAAKZ + Af8BAAGZAcwCAAGZAcwBMwEAAWYBzAFmAQABmQHMAZkBAAGZAswBAAGZAcwB/wEAAZkB/wIAAZkB/wEz + AQABmQHMAWYBAAGZAf8BmQEAAZkB/wHMAQABmQL/AQABzAMAAZkBAAEzAQABzAEAAWYBAAHMAQABmQEA + AcwBAAHMAQABmQEzAgABzAIzAQABzAEzAWYBAAHMATMBmQEAAcwBMwHMAQABzAEzAf8BAAHMAWYCAAHM + AWYBMwEAAZkCZgEAAcwBZgGZAQABzAFmAcwBAAGZAWYB/wEAAcwBmQIAAcwBmQEzAQABzAGZAWYBAAHM + ApkBAAHMAZkBzAEAAcwBmQH/AQACzAIAAswBMwEAAswBZgEAAswBmQEAA8wBAALMAf8BAAHMAf8CAAHM + Af8BMwEAAZkB/wFmAQABzAH/AZkBAAHMAf8BzAEAAcwC/wEAAcwBAAEzAQAB/wEAAWYBAAH/AQABmQEA + AcwBMwIAAf8CMwEAAf8BMwFmAQAB/wEzAZkBAAH/ATMBzAEAAf8BMwH/AQAB/wFmAgAB/wFmATMBAAHM + AmYBAAH/AWYBmQEAAf8BZgHMAQABzAFmAf8BAAH/AZkCAAH/AZkBMwEAAf8BmQFmAQAB/wKZAQAB/wGZ + AcwBAAH/AZkB/wEAAf8BzAIAAf8BzAEzAQAB/wHMAWYBAAH/AcwBmQEAAf8CzAEAAf8BzAH/AQAC/wEz + AQABzAH/AWYBAAL/AZkBAAL/AcwBAAJmAf8BAAFmAf8BZgEAAWYC/wEAAf8CZgEAAf8BZgH/AQAC/wFm + AQABIQEAAaUBAANfAQADdwEAA4YBAAOWAQADywEAA7IBAAPXAQAD3QEAA+MBAAPqAQAD8QEAA/gBAAHw + AfsB/wEAAaQCoAEAA4ADAAH/AgAB/wMAAv8BAAH/AwAB/wEAAf8BAAL/AgAD//8A/wD/AP8AFQAQ/ycA + AZoCGgHwBQAQ/wMAAvANAAEEEAABGgHwARoBmgHlAVkBUgF5AfAEABD/AgABtAGtAc8BtQHvAgcBvAgA + AuwCBwEAAQMB+wEAAwcEAAIaAcMBGgLDAaABeQFZATIBmQGYAbwB8AEAAf8OAAH/AgABzweLAa4B9wHv + AQcEAALsAv8BAAEDAfsBAAL/AQcEAAGaAsMBGgL2AcMBeQI4AVgBVgFQAZgB8AH/DewBAAH/AgABzwGL + CYoBkgQAAuwC/wEAAQMB+wEAAv8BBwQAAXoDoAEaAvYBmgJZAVgBeAJQAfAB/wHsCwcB7AEAAf8CAAHP + ArIBrAeKAa4EAALsAv8BAAEDAfsBAAL/AQcEAAF6AuUBegJSAZkBGgGaAVkBmQGYAVYBUAHwAf8B7AED + AwcDAwMHAQMB7AEAAf8CAAHPAawFsgSKAZEBvAMAAQQB7AL/BAAC/wEHAwAB8AGaAXoB5QF6ATECUgEc + AZkBmgEaAZgBVwFWAfAB/wHsAfsBAwEHAQMDAAEDAQcBAwEHAewBAAH/AgABtQGtBbMDsgGzAa4BBwQA + AewI/wHsAwAB8AHDAfYBwwF6AVkBOAFYAngBHAGYAZkBmAF4AfAB/wHsAv8BAwEAAv8B+wEAAQMCBwHs + AQAB/wIAAbUBtAG7AroGswGRAQcEAAEDAQAG/wHsAgMCAAHwAZoCwwF6AjgBWAFXAVABSgFyAXMBHAGZ + AfAB/wHsAfsBBwEAAf8B+wP/AQABAwEHAewBAAH/AgABBwG0Aa0CtAEJAbsEugG0Ae8FAAEDAQAE/wHs + AgMB7AIAAfABmgF6AZoBegJZAnkBVgFQAXIBBwMAAf8B7AEHAQAB+wP/AfsC/wEAAQMB7AEAAf8CAAG1 + AZkBkAGYAbMBtAEJAhkCCQG1AQcGAAEDAQAC/wHsAgMEAAHwARoBegF5AZkBoAFYAVkBmQJWARwEAAH/ + AewBAAP/AfsD/wH7Af8BAAHsAQAB/wEAAbsBtAF5AZkBeQG0AgkEtAG1CAABAwIAAgMHAAHwArwBmQF5 + AZkBeAJWAXgEAAH/AewC/wH7A/8B+wP/AfsCAAH/AgAB7wF+AV4BWAEcA7QB1gIJAQcJAAMDAewBAQcA + AbwB8AEIAZgBeAKYAZkBBwQAAf8N7AEAAf8CAAKZAnkBtQHvAwACtQEHDQABAQcAAfABvALwAbwBBwK8 + BQAQ/wIAAQcBGgGRArwRAAEEAgABAQgABLwB8AcAEP8EAAHvHAAO8CoAARoB8AG8AfAEAAHvCYEB/wOB + AfAmAAGZARoBegFTAVkBUgF0AQcDAAGyAbkD2gO5AdoBuQH0AtoBuQG8IwACkwFMAXoDoAHlATEBMgFS + AZkCAAGyAtoCswLZAbMBiwGzAfQBswHUAbkBvA7sBAAM7AIAAfACmQEbAf8BmgH2AsMCoAExATgBMgF0 + AgABsgOzBtkB9AHZArMBvAHsAf8B+wEHAfsBBwH7AQcB+wEHAfsBBwH7AewEAAHsAf8B+wEHAfsBBwH7 + AQcB+wEHAfsB7AIAAbwBGgHDAv8BmQH/AvYCwwE3AjgBeQIAAbIBswGyAtkBuAHbAbkB2wGyAfQB2QGy + AbkBvAHsAf8BBwH7AQcB+wEHAfsBBwH7AQcB+wEHAewDAAHsAf8B+wEHAfsBBwH7AQcB+wEHAfsBBwEA + AewBAAG8AZoBoALDAZoB9gP/AfYBNwI4AXkCAAGyAdkBsgG4AbIBuAGKAbIBgQGyAfQB2QGyAbkBvAHs + Af8B+wEHAfsBBwH7AQcB+wEHAfsBBwH7AewDAAHsAf8BBwH7AQcB+wEHAfsBBwH7AQcB7AEAAewBAAG8 + AXkDoAFSAZkCwwEaAZoBegI4AXkCAAGyAdkBuAK5AbgB2QGyAYoB2QH0AdkBsgG5AbwB7AH/AQcB+wEH + AfsBBwH7AQcB+wEHAfsBBwHsAgAB7AH/AQcB+wEHAfsBBwH7AQcB+wEHAfsBAALsAQAB8AF6AuUBegFT + AVIBcwF0AbwB9AH2AXoBWQGZAgABsgLaAbMC3AG5AbgB2QG7Af8BuwGzAdoBvAHsAf8B+wEHAfsBBwH7 + AQcB+wEHAfsBBwH7AewCAAHsCv8B7AEAAQcB7AEAARoBmQN6AVkBMQErAUsBUgKZAZoCegIAAYEDswGQ + AYoBgQKzAbsBigG6ArMBBwHsAf8BBwH7AQcB+wEHAfsBBwH7AQcB+wEHAewCAA3sAfsB7AEAAXQBwwH2 + AsMBegFZATgBMgFMAZkBGgUAAboB2wK6AdoBugKRAdoBuwS6AQcB7AH/AfsBBwH7AQcB+wEHAfsBBwH7 + AQcB+wHsAwAB7AH/AQcB+wEHAfsBBwH7AQcB+wEHAfsBBwHsAQABdAHDAfYC/wGaAzgBUgcAAbkC2wGz + BNkBuAHyAf8B8gHbAdoBvAHsDP8B7AMAAewB/wH7AQcB+wEHAfsBBwX/AewBAAF6AsMC9gEaAfsCOAFS + BwABswTbAQkC3AIJAfQC2wHaAbwB7AEHAfsBBwH7AQcB+wEHBuwDAAHsAf8BBwH7AQcB+wEHAf8G7AEA + AnoCoAJ6AVkB+wE4AXkHAAGzAdsB3AcJAfQBCQHcAdsBvAEAAewBBwH7AQcB+wEHAewKAAHsBf8B7AcA + AnoBWQLlAcMBegJZAZkHAAG5CRkB9AMZAfACAAXsDAAF7AkAAfABGgFSAlkCegFTAXkRAAHwKAAC8AoA + AUIBTQE+BwABPgMAASgDAAFAAwABMAMAAQEBAAEBBQABgAEBFgAD/4EAAv8CAAT/Af4BHwIAAecB/wHA + AQMB4AEPAgABwAE/AcABAwGAAQECAAHAAQMBwAEDAYADAAHAAQMBwAEDAYADAAHAAQMBwAEDAYADAAHA + AQEBwAEDBAABwAEBAYABAQQAAcABAQHAAQEEAAHAAQEB4AEDAQABBwIAAcABAQHwAQcBAAEPAgABgAED + AfgBBwHAAQ8CAAHAAQMB/AEHAeABDwIAAcAB4wH+AScB4AEfAgABwQL/AWcB8AF/AgAB9wP/AYABAQX/ + AYcBgAEABP8B/AEDAYABAAGAAQEB4AEAAeABAQGAAgABAQHAAgABAQGAAgABAQHAAgABAQGAAgABAQGA + AgABAQGAAgABAQGAAgABAQGAAgABAQMAAQEBgAIAAQEDAAEBAYACAAEBAwABDwGAAgABAQGAAgABPwGA + AgABAQGAAgABPwGAAgABAwGAAQEBAAE/AYABAAGAAf8BwAF/AQABPwGAAQABwQH/AeAB/wGAAT8B/wHv + BP8B8wH/Cw== + + + + + + AAABAAEAECAAAAEABAAoAQAAFgAAACgAAAAQAAAAIAAAAAEABAAAAAAAwAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAACAAACAAAAAgIAAgAAAAIAAgACAgAAAwMDAAICAgAAAAP8AAP8AAAD//wD/AAAA/wD/AP// + AAD///8A///////////0bm5ubm5ub/Rs6IjoiEzv9G6Pd4d3Tm/0bP/3f/dM7/Ru/45v905v9Gz/jO/3 + TO/0bn/2b/dOb/Rs5///90zv9G5ubm/3Tm/0bPeIf/bs7/Rub///fm5v9Gzs53zs7O/0xsbGxsbGz/RE + RERERERP//////////8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA + //8AAP//AAD//wAA//8AAP// + + + \ No newline at end of file diff --git a/Backup1/hello/BTLClass.cs b/Backup1/hello/BTLClass.cs new file mode 100644 index 0000000..02ea841 --- /dev/null +++ b/Backup1/hello/BTLClass.cs @@ -0,0 +1,95 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace HelloTeamcenter.hello +{ + public class BTLClass + { + private string item_id; + + public string Item_id + { + get { return item_id; } + set { item_id = value; } + } + private string item_name; + + public string Item_name + { + get { return item_name; } + set { item_name = value; } + } + private string partnumber; + + public string Partnumber + { + get { return partnumber; } + set { partnumber = value; } + } + private string projectname; + + public string Projectname + { + get { return projectname; } + set { projectname = value; } + } + private string proportion; + + public string Proportion + { + get { return proportion; } + set { proportion = value; } + } + private string mapsheet; + + public string Mapsheet + { + get { return mapsheet; } + set { mapsheet = value; } + } + private string item_revision_id; + + public string Item_revision_id + { + get { return item_revision_id; } + set { item_revision_id = value; } + } + private string weight; + + public string Weight + { + get { return weight; } + set { weight = value; } + } + private string materialgrade; + + public string Materialgrade + { + get { return materialgrade; } + set { materialgrade = value; } + } + private string allpage; + + public string Allpage + { + get { return allpage; } + set { allpage = value; } + } + private string pagenumber = "1"; + + public string Pagenumber + { + get { return pagenumber; } + set { pagenumber = value; } + } + private string productType; + + public string ProductType + { + get { return productType; } + set { productType = value; } + } + + } +} diff --git a/Backup1/hello/DataManagement.cs b/Backup1/hello/DataManagement.cs new file mode 100644 index 0000000..7c67483 --- /dev/null +++ b/Backup1/hello/DataManagement.cs @@ -0,0 +1,379 @@ +//================================================== +// +// @@ +// +//================================================== + + + + +using System; +using System.Collections; + +using Teamcenter.ClientX; +using Teamcenter.Schemas.Soa._2006_03.Exceptions; + +// Include the Data Management Service Interface +using Teamcenter.Services.Strong.Core; + +// Input and output structures for the service operations +// Note: the different namespace from the service interface +using Teamcenter.Services.Strong.Core._2006_03.DataManagement; +using Teamcenter.Services.Strong.Core._2007_01.DataManagement; +using Teamcenter.Soa.Client.Model; +using Teamcenter.Soa.Exceptions; + +using Item = Teamcenter.Soa.Client.Model.Strong.Item; +using ItemRevision = Teamcenter.Soa.Client.Model.Strong.ItemRevision; + +namespace Teamcenter.Hello +{ + +/** + * Perform different operations in the DataManamentService + * + */ +public class DataManagement +{ + + /** + * Perform a sequence of data management operations: Create Items, Revise + * the Items, and Delete the Items + * + */ + public void createReviseAndDelete() + { + try + { + int numberOfItems = 3; + + // Reserve Item IDs and Create Items with those IDs + ItemIdsAndInitialRevisionIds[] itemIds = generateItemIds(numberOfItems, "Item"); + CreateItemsOutput[] newItems = createItems(itemIds, "Item"); + + // Copy the Item and ItemRevision to separate arrays for further + // processing + Item[] items = new Item[newItems.Length]; + ItemRevision[] itemRevs = new ItemRevision[newItems.Length]; + for (int i = 0; i < items.Length; i++) + { + items[i] = newItems[i].Item; + itemRevs[i] = newItems[i].ItemRev; + } + + // Reserve revision IDs and revise the Items + Hashtable allRevIds = generateRevisionIds(items); + reviseItems(allRevIds, itemRevs); + + // Delete all objects created + deleteItems(items); + } + catch (ServiceException e) + { + System.Console.Out.WriteLine(e.Message ); + } + + } + + /** + * Reserve a number Item and Revision Ids + * + * @param numberOfIds Number of IDs to generate + * @param type Type of IDs to generate + * + * @return An array of Item and Revision IDs. The size of the array is equal + * to the input numberOfIds + * + * @throws ServiceException If any partial errors are returned + */ + public ItemIdsAndInitialRevisionIds[] generateItemIds(int numberOfIds, String type) + // throws ServiceException + { + // Get the service stub + DataManagementService dmService = DataManagementService.getService(Session.getConnection()); + + GenerateItemIdsAndInitialRevisionIdsProperties[] properties = new GenerateItemIdsAndInitialRevisionIdsProperties[1]; + GenerateItemIdsAndInitialRevisionIdsProperties property = new GenerateItemIdsAndInitialRevisionIdsProperties(); + + property.Count = numberOfIds; + property.ItemType = type; + property.Item = null; // Not used + properties[0] = property; + + // ***************************** + // Execute the service operation + // ***************************** + GenerateItemIdsAndInitialRevisionIdsResponse response = dmService.GenerateItemIdsAndInitialRevisionIds(properties); + + + + // The AppXPartialErrorListener is logging the partial errors returned + // In this simple example if any partial errors occur we will throw a + // ServiceException + if (response.ServiceData.sizeOfPartialErrors() > 0) + throw new ServiceException( "DataManagementService.generateItemIdsAndInitialRevisionIds returned a partial error."); + + // The return is a map of ItemIdsAndInitialRevisionIds keyed on the + // 0-based index of requested IDs. Since we only asked for IDs for one + // data type, the map key is '0' + Int32 bIkey = 0; + Hashtable allNewIds = response.OutputItemIdsAndInitialRevisionIds; + ItemIdsAndInitialRevisionIds[] myNewIds = (ItemIdsAndInitialRevisionIds[]) allNewIds[bIkey]; + + return myNewIds; + } + + /** + * Create Items + * + * @param itemIds Array of Item and Revision IDs + * @param itemType Type of item to create + * + * @return Set of Items and ItemRevisions + * + * @throws ServiceException If any partial errors are returned + */ + public CreateItemsOutput[] createItems(ItemIdsAndInitialRevisionIds[] itemIds, String itemType) + // throws ServiceException + { + // Get the service stub + DataManagementService dmService = DataManagementService.getService(Session.getConnection()); + // Populate form type + GetItemCreationRelatedInfoResponse relatedResponse = dmService.GetItemCreationRelatedInfo(itemType, null); + String[] formTypes = new String[0]; + if ( relatedResponse.ServiceData.sizeOfPartialErrors() > 0) + throw new ServiceException( "DataManagementService.getItemCretionRelatedInfo returned a partial error."); + + formTypes = new String[relatedResponse.FormAttrs.Length]; + for ( int i = 0; i < relatedResponse.FormAttrs.Length; i++ ) + { + FormAttributesInfo attrInfo = relatedResponse.FormAttrs[i]; + formTypes[i] = attrInfo.FormType; + } + + ItemProperties[] itemProps = new ItemProperties[itemIds.Length]; + for (int i = 0; i < itemIds.Length; i++) + { + // Create form in cache for form property population + ModelObject[] forms = createForms(itemIds[i].NewItemId, formTypes[0], + itemIds[i].NewRevId, formTypes[1], + null, false); + ItemProperties itemProperty = new ItemProperties(); + + itemProperty.ClientId = "AppX-Test"; + itemProperty.ItemId = itemIds[i].NewItemId; + itemProperty.RevId = itemIds[i].NewRevId; + itemProperty.Name = "AppX-Test"; + itemProperty.Type = itemType; + itemProperty.Description = "Test Item for the SOA AppX sample application."; + itemProperty.Uom = ""; + + // Retrieve one of form attribute value from Item master form. + ServiceData serviceData = dmService.GetProperties(forms, new String[]{"project_id"}); + if ( serviceData.sizeOfPartialErrors() > 0) + throw new ServiceException( "DataManagementService.getProperties returned a partial error."); + Property property = null; + try + { + property= forms[0].GetProperty("project_id"); + } + catch ( NotLoadedException /*ex*/){} + + + // Only if value is null, we set new value + if ( property == null || property.StringValue == null || property.StringValue.Length == 0) + { + itemProperty.ExtendedAttributes = new ExtendedAttributes[1]; + ExtendedAttributes theExtendedAttr = new ExtendedAttributes(); + theExtendedAttr.Attributes = new Hashtable(); + theExtendedAttr.ObjectType = formTypes[0]; + theExtendedAttr.Attributes["project_id"] = "project_id"; + itemProperty.ExtendedAttributes[0] = theExtendedAttr; + } + itemProps[i] = itemProperty; + } + + + // ***************************** + // Execute the service operation + // ***************************** + CreateItemsResponse response = dmService.CreateItems(itemProps, null, ""); + // before control is returned the ChangedHandler will be called with + // newly created Item and ItemRevisions + + + + // The AppXPartialErrorListener is logging the partial errors returned + // In this simple example if any partial errors occur we will throw a + // ServiceException + if (response.ServiceData.sizeOfPartialErrors() > 0) + throw new ServiceException( "DataManagementService.createItems returned a partial error."); + + return response.Output; + } + + /** + * Reserve Revision IDs + * + * @param items Array of Items to reserve Ids for + * + * @return Map of RevisionIds + * + * @throws ServiceException If any partial errors are returned + */ + public Hashtable generateRevisionIds(Item[] items) //throws ServiceException + { + // Get the service stub + DataManagementService dmService = DataManagementService.getService(Session.getConnection()); + + GenerateRevisionIdsResponse response = null; + GenerateRevisionIdsProperties[] input = null; + input = new GenerateRevisionIdsProperties[items.Length]; + for (int i = 0; i < items.Length; i++) + { + GenerateRevisionIdsProperties property = new GenerateRevisionIdsProperties(); + property.Item = items[i]; + property.ItemType = ""; + input[i] = property; + } + + // ***************************** + // Execute the service operation + // ***************************** + response = dmService.GenerateRevisionIds(input); + + // The AppXPartialErrorListener is logging the partial errors returned + // In this simple example if any partial errors occur we will throw a + // ServiceException + if (response.ServiceData.sizeOfPartialErrors() > 0) + throw new ServiceException( "DataManagementService.generateRevisionIds returned a partial error."); + + return response.OutputRevisionIds; + } + + /** + * Revise Items + * + * @param revisionIds Map of Revsion IDs + * @param itemRevs Array of ItemRevisons + * + * @return Map of Old ItemRevsion(key) to new ItemRevision(value) + * + * @throws ServiceException If any partial errors are returned + */ + public Hashtable reviseItems(Hashtable revisionIds, ItemRevision[] itemRevs) //throws ServiceException + { + // Get the service stub + DataManagementService dmService = DataManagementService.getService(Session.getConnection()); + + Hashtable revs = new Hashtable(); + for (int i = 0; i < itemRevs.Length; i++) + { + + + RevisionIds rev = (RevisionIds) revisionIds[i]; + + ReviseProperties revProps = new ReviseProperties(); + + revProps.RevId = rev.NewRevId; + revProps.Name = "testRevise"; + revProps.Description = "describe testRevise"; + + Hashtable attrs = new Hashtable(); + attrs["project_id"] = "project_id_val"; + revProps.ExtendedAttributes = attrs; + + revs[itemRevs[i]]= revProps; + } + + // ***************************** + // Execute the service operation + // ***************************** + ReviseResponse revised = dmService.Revise(revs); + // before control is returned the ChangedHandler will be called with + // newly created Item and ItemRevisions + + + + // The AppXPartialErrorListener is logging the partial errors returned + // In this simple example if any partial errors occur we will throw a + // ServiceException + if (revised.ServiceData.sizeOfPartialErrors() > 0) + throw new ServiceException("DataManagementService.revise returned a partial error."); + + return revised.OldItemRevToNewItemRev; + + } + + /** + * Delete the Items + * + * @param items Array of Items to delete + * + * @throws ServiceException If any partial errors are returned + */ + public void deleteItems(Item[] items) //throws ServiceException + { + // Get the service stub + DataManagementService dmService = DataManagementService.getService(Session.getConnection()); + + // ***************************** + // Execute the service operation + // ***************************** + ServiceData serviceData = dmService.DeleteObjects(items); + + // The AppXPartialErrorListener is logging the partial errors returned + // In this simple example if any partial errors occur we will throw a + // ServiceException + if (serviceData.sizeOfPartialErrors() > 0) + throw new ServiceException("DataManagementService.deleteObjects returned a partial error."); + + } + + /** + * Create ItemMasterForm and ItemRevisionMasterForm + * + * @param IMFormName Name of ItemMasterForm + * @param IMFormType Type of ItemMasterForm + * @param IRMFormName Name of ItemRevisionMasterForm + * @param IRMFormType Type of ItemRevisionMasterForm + * @param parent The container object that two + * newly-created forms will be added into. + * @return ModelObject[] Array of forms + * + * @throws ServiceException If any partial errors are returned + */ + public ModelObject[] createForms ( String IMFormName, String IMFormType, + String IRMFormName, String IRMFormType, + ModelObject parent, bool saveDB ) //throws ServiceException + { + //Get the service stub + DataManagementService dmService = DataManagementService.getService(Session.getConnection()); + FormInfo[] inputs = new FormInfo[2]; + inputs[0] = new FormInfo(); + inputs[0].ClientId = "1"; + inputs[0].Description=""; + inputs[0].Name = IMFormName; + inputs[0].FormType=IMFormType; + inputs[0].SaveDB = saveDB; + inputs[0].ParentObject = parent ; + inputs[1] = new FormInfo(); + inputs[1].ClientId = "2"; + inputs[1].Description=""; + inputs[1].Name = IRMFormName; + inputs[1].FormType=IRMFormType; + inputs[1].SaveDB = saveDB; + inputs[1].ParentObject = parent; + CreateOrUpdateFormsResponse response = dmService.CreateOrUpdateForms(inputs); + if ( response.ServiceData.sizeOfPartialErrors() > 0) + throw new ServiceException("DataManagementService.createForms returned a partial error."); + ModelObject[] forms = new ModelObject [inputs.Length]; + for (int i=0; i@ +// +//================================================== + + +using System; +using System.Collections; +using Teamcenter.ClientX; +using Autodesk.AutoCAD.DatabaseServices; +using Autodesk.AutoCAD.Runtime; +using Autodesk.AutoCAD.Geometry; +using Autodesk.AutoCAD.ApplicationServices; +using Autodesk.AutoCAD.EditorInput; +using Autodesk.AutoCAD.Windows; +using HelloTeamcenter.hello; +using HelloTeamcenter.form; +using System.Windows.Forms; + + +using System.IO; +using System.Collections.Generic; + +using Teamcenter.Services.Strong.Core; +using Teamcenter.Soa.Client.Model; +using Teamcenter.Services.Strong.Core._2006_03.Reservation; +using Teamcenter.Services.Strong.Core._2006_03.FileManagement; +using Teamcenter.Services.Strong.Core._2006_03.DataManagement; +using Teamcenter.Services.Strong.Core._2007_01.DataManagement; +using Teamcenter.Services.Strong.Core._2007_06.DataManagement; + +using Teamcenter.Soa.Internal.Client.Model; +using Teamcenter.Soa.Internal.Client; +using Teamcenter.Soa.Client; +using Teamcenter.Services.Strong.Query; +//using Teamcenter.FMS.FCCProxy.ClientCache; +using Teamcenter.Schemas.Soa._2006_03.Exceptions; +using Teamcenter.Soa.Exceptions; + + +using User = Teamcenter.Soa.Client.Model.Strong.User; +using DataSet = Teamcenter.Soa.Client.Model.Strong.Dataset; +using ImanFile = Teamcenter.Soa.Client.Model.Strong.ImanFile; +using SavedQueryResults = Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryResults; +using Item = Teamcenter.Soa.Client.Model.Strong.Item; +using ItemRevision = Teamcenter.Soa.Client.Model.Strong.ItemRevision; +using ImanQuery = Teamcenter.Soa.Client.Model.Strong.ImanQuery; +using ReleaseStatus = Teamcenter.Soa.Client.Model.Strong.ReleaseStatus; +using Form = Teamcenter.Soa.Client.Model.Strong.Form; +using Dataset = Teamcenter.Soa.Client.Model.Strong.Dataset; +using Folder = Teamcenter.Soa.Client.Model.Strong.Folder; +using WorkspaceObject = Teamcenter.Soa.Client.Model.Strong.WorkspaceObject; + +[assembly: ExtensionApplication(typeof(Teamcenter.Hello.Hello))] +[assembly: CommandClass(typeof(Teamcenter.Hello.Hello))] + +namespace Teamcenter.Hello +{ + /** + * This sample client application demonstrates some of the basic features of the + * Teamcenter Services framework and a few of the services. + * + * An instance of the Connection object is created with implementations of the + * ExceptionHandler, PartialErrorListener, ChangeListener, and DeleteListeners + * intefaces. This client application performs the following functions: + * 1. Establishes a session with the Teamcenter server + * 2. Display the contents of the Home Folder + * 3. Performs a simple query of the database + * 4. Create, revise, and delete an Item + * + */ + + public class Hello : Autodesk.AutoCAD.Runtime.IExtensionApplication + { + static User loginuser; + Login loginfrom; + OpenFromTC openfrom; + Search searchfrom; + SaveToTC savefrom; + static Autodesk.AutoCAD.EditorInput.Editor ed; + static Autodesk.AutoCAD.ApplicationServices.Document appodc; + static DocumentCollection acdocmgr; + static Teamcenter.ClientX.Session session; + // + bool islogin = false; + bool hasRight = true; + string serveraddress; + string username; + string password; + string usergroup; + string userrole; + + //ڼ¼Item.xmlļжӦItem + static OriginItemType originitemtype; + + static string xmlpath = ""; + + + + + public void Initialize() + { + //addComtextMenu(); + } + public void Terminate() + { + + } + + [CommandMethod("LOGIN")] + public void login() + { + appodc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument; + acdocmgr = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager; + //acdocmgr.DocumentToBeDestroyed+=new DocumentCollectionEventHandler(acdocmgr_DocumentToBeDestroyed); + + appodc.Database.SaveAs(appodc.Name, true, DwgVersion.Current, appodc.Database.SecurityParameters); + //appodc.Database.Save(); + + ed = appodc.Editor; + ed.WriteMessage("==========login==========\n"); + //Tool tool = new Tool(); + //BTLClass titleinfo = tool.getBTL("DFHM_BTL",appodc); + //ed.WriteMessage("Ϣ:\n" + "ͼţ" + titleinfo.Item_id.ToString()); + + //ȡûļ + //OriginTool origintool = new OriginTool(); + //xmlpath = System.Environment.CurrentDirectory; + xmlpath = System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase; + ed.WriteMessage("ǰ·:" + xmlpath + "\n"); + //origintool.checkxml(xmlpath); + + + + loginfrom = new Login(); + loginfrom.appodc = appodc; + loginfrom.button1.Click += new System.EventHandler(this.loginbutton1_Click); + loginfrom.button2.Click += new System.EventHandler(this.loginbutton2_Click); + loginfrom.Activate(); + loginfrom.Show(); + + } + private void loginbutton1_Click(object sender, EventArgs e) + { + loginfrom.m_WebAddress = loginfrom.textBox1.Text.ToString(); + loginfrom.username = loginfrom.textBox2.Text.ToString(); + loginfrom.password = loginfrom.textBox3.Text.ToString(); + loginfrom.usergroup = loginfrom.textBox4.Text.ToString(); + loginfrom.userrole = loginfrom.textBox5.Text.ToString(); + session = new Teamcenter.ClientX.Session(loginfrom.m_WebAddress); + + loginuser = session.mylogin(loginfrom.username, loginfrom.password, loginfrom.usergroup, loginfrom.userrole); + + if (loginuser != null) + { + serveraddress = loginfrom.m_WebAddress; + username = loginfrom.username; + password = loginfrom.password; + usergroup = loginfrom.usergroup; + userrole = loginfrom.userrole; + OriginTool.Loginuser = loginuser; + ed.WriteMessage("¼ɹ\n"); + islogin = true; + string tempdir = System.Environment.GetEnvironmentVariable("TEMP").ToString(); + string loginfile = tempdir + "\\login.ini"; + loginfrom.Hide(); + + + //loginfrom.Dispose(); + if (File.Exists(loginfile)) + { + StreamWriter sw = new StreamWriter(loginfile, false); + sw.WriteLine(loginfrom.m_WebAddress + "|" + loginfrom.username + "|" + loginfrom.password + + "|" + loginfrom.usergroup + "|" + loginfrom.userrole + "||"); + sw.Close(); + } + else + { + FileStream fs = new FileStream(loginfile, FileMode.Create, FileAccess.Write); + StreamWriter sw = new StreamWriter(fs); + sw.WriteLine(loginfrom.m_WebAddress + "|" + loginfrom.username + "|" + loginfrom.password + + "|" + loginfrom.usergroup + "|" + loginfrom.userrole + "||"); + sw.Close(); + fs.Close(); + } + + //ӷ˻ȡxmlļ + OriginTool origintool = new OriginTool(); + + bool hasxmlfile = origintool.checkxml(xmlpath); + if (hasxmlfile) + { + DialogResult hasresult = MessageBox.Show("ǰĿ¼ѾXMLļǷͬ", "ʾ", MessageBoxButtons.YesNo, MessageBoxIcon.Question); + if (hasresult == DialogResult.No || hasresult == DialogResult.None) + { + ed.WriteMessage("XMLļͬ\n"); + } + if (hasresult == DialogResult.Yes) + { + Hashtable prevalues = origintool.getTCPreferences("OriginXMLFile"); + if (prevalues != null && prevalues.Count > 0) + { + foreach (DictionaryEntry de in prevalues) + { + List itemidlist = origintool.getCorrespondItemID((string[])de.Value); + for (int m = 0; m < itemidlist.Count; m++) + { + string item_id = itemidlist[m]; + SavedQueryResults found = origintool.getSearchItem(item_id); + if (found.NumOfObjects == 0) + { + ed.WriteMessage("TCϵͳѡȷ\n"); + return; + } + else + { + Item dmtitem = found.Objects[0] as Item; + if (!origintool.downloadfile(dmtitem, xmlpath)) + { + ed.WriteMessage("ģļ\n"); + return; + } + } + } + + } + + } + } + } + + } + else + { + MessageBox.Show("Բ𣬵¼ʧܣȷ"); + loginfrom.Dispose(); + } + ed.WriteMessage("\n"); + } + private void loginbutton2_Click(object sender, EventArgs e) + { + loginfrom.Hide(); + loginfrom.Dispose(); + } + bool hadlogin = false; + + [CommandMethod("OPEN_FROM_TC")] + public void openformtc() + { + if (loginuser != null) + { + hadlogin = true; + } + else + login(); + //if (hadlogin == false) + //{ + // string tempdir = System.Environment.GetEnvironmentVariable("TEMP").ToString(); + // string loginfile = tempdir + "\\login.ini"; + // if (File.Exists(loginfile)) + // { + // StreamReader sr = new StreamReader(loginfile); + // string line; + // if ((line = sr.ReadLine()) != null) + // { + // string[] ans = line.Split('|'); + // for (int i = 0; i < ans.Length; i++) + // { + // if (i == 0) + // serveraddress = ans[i].ToString(); + // if (i == 1) + // username = ans[i].ToString(); + // if (i == 2) + // password = ans[i].ToString(); + // if (i == 3) + // usergroup = ans[i].ToString(); + // if (i == 4) + // userrole = ans[i].ToString(); + // } + // if ((line = sr.ReadLine()) != null) + // { + // if (line == "#") + // { + // Teamcenter.ClientX.Session session = new Teamcenter.ClientX.Session(serveraddress); + // try + // { + // loginuser = session.mylogin(username, password, usergroup, userrole); + // } + // catch (InvalidCredentialsException e) + // { + // ed.WriteMessage("ûϢµ¼"); + // return; + // } + // if (loginuser != null) + // hadlogin = true; + // } + // } + + // } + // sr.Close(); + // } + // else + // { + // login(); + // } + //} + if (hadlogin == true) + { + openfrom = new OpenFromTC(); + openfrom.appodc = appodc; + openfrom.user = loginuser; + openfrom.button1.Click += new System.EventHandler(this.openbutton1_Click); + openfrom.button2.Click += new System.EventHandler(this.openbutton2_Click); + openfrom.Activate(); + openfrom.Show(); + } + } + + private void openbutton1_Click(object sender, EventArgs e) + { + DataManagementService dmService = DataManagementService.getService(Session.getConnection()); + Reservation res = ReservationService.getService(Session.getConnection()); + Editor ed1 = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; + TreeNode nownode = this.openfrom.treeView1.SelectedNode; + if (nownode.SelectedImageIndex == 0) + { + List datasetlist = this.openfrom.datasetlist; + foreach (ALLOBJECT perobject in datasetlist) + { + if (perobject.treenode.Equals(nownode)) + { + this.openfrom.textBox1.Text = perobject.name; + DialogResult isopen = MessageBox.Show("Ƿȷ򿪸ͼֽ", "ʾ", MessageBoxButtons.YesNo, MessageBoxIcon.Question); + if (isopen == DialogResult.None || isopen == DialogResult.No) + { + return; + } + DataSet mydateset = perobject.workobject as DataSet; + ModelObject[] objects = { mydateset }; + String[] attributes = { "is_modifiable", "checked_out", "ref_list" }; + dmService.RefreshObjects(objects); + dmService.GetProperties(objects, attributes); + if (mydateset.Is_modifiable == false) + { + DialogResult moresult = MessageBox.Show("û޸ȨޣǷֻʽ򿪣", "ʾ", MessageBoxButtons.YesNo, MessageBoxIcon.Question); + if (moresult == DialogResult.Yes) + { + hasRight = false; + } + else + { + return; + } + } + if (mydateset.Is_modifiable) + { + DialogResult moresult = MessageBox.Show("Ƿǩ", "ʾ", MessageBoxButtons.YesNo, MessageBoxIcon.Question); + if (moresult == DialogResult.Yes) + { + if (mydateset.Checked_out == "Y") + { + MessageBox.Show("Բļǩȷļǩִд˲"); + return; + } + else + { + ModelObject[] dataobj = { mydateset }; + res.Checkout(dataobj, "", ""); + ed1.WriteMessage("ļǩ"); + ed1.WriteMessage("\n"); + } + } + } + + ModelObject[] dsfilevec = mydateset.Ref_list; + + ed1.WriteMessage(":" + dsfilevec.Length); + ed1.WriteMessage(dsfilevec[0].GetType().ToString()); + ImanFile dsfile = dsfilevec[0] as ImanFile; + + ModelObject[] objects1 = { dsfile }; + String[] attributes1 = { "relative_directory_path", "original_file_name" }; + dmService.RefreshObjects(objects1); + dmService.GetProperties(objects1, attributes1); + + ed1.WriteMessage("·:" + dsfile.Relative_directory_path + "\n"); + ed1.WriteMessage("ļ:" + dsfile.Original_file_name + "\n"); + string newfilename = dsfile.Original_file_name; + + ed1.WriteMessage("Original_file_name : "+newfilename+"\n"); + string tempdir = System.Environment.GetEnvironmentVariable("TEMP").ToString(); + ed1.WriteMessage("TEMP:" + tempdir.ToString() + "\n"); + + FileManagementService fmService = FileManagementService.getService(Teamcenter.ClientX.Session.getConnection()); + ImanFile[] objects2 = { dsfile }; + FileTicketsResponse tickets = fmService.GetFileReadTickets(objects2); + ed1.WriteMessage("tickets : " + tickets.Tickets.Count + "\n"); + + foreach (System.Collections.DictionaryEntry ticket in tickets.Tickets) + { + ed1.WriteMessage("" + ticket.Key + "\n" + "ֵ" + ticket.Value + "\n"); + } + Teamcenter.Soa.Client.FileManagementUtility fmu = new Teamcenter.Soa.Client.FileManagementUtility(Teamcenter.ClientX.Session.getConnection()); + Teamcenter.Soa.Client.GetFileResponse getFileResponse = fmu.GetFiles(dsfilevec); + FileInfo[] fileinfovec = getFileResponse.GetFiles(); + + ed1.WriteMessage("ļ" + fileinfovec.Length + "\n"); + FileInfo file = fileinfovec[0]; + //ed.WriteMessage("file.DirectoryName:" + file.DirectoryName + "\n"); + //ed.WriteMessage("file.FullName" + file.FullName + "\n"); + //string datestring = ""; + //datestring = DateTime.Now.ToString("yyyy_MM_dd_hh_mm_ss");//19 + string newtempfile = tempdir + "\\" + newfilename; + ed1.WriteMessage("·" + newtempfile + "\n"); + + System.IO.File.Copy(file.FullName, newtempfile, true); + System.IO.File.SetAttributes(newtempfile, FileAttributes.Normal); + this.openfrom.Hide(); + this.openfrom.Dispose(); + if (File.Exists(newtempfile)) + { + DocumentCollection acdocmgr1 = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager; + acdocmgr1.Open(newtempfile, false); + //Object pdata = newtempfile; + //acdocmgr.ExecuteInApplicationContext(c_back,pdata); + //Teamcenter.ClientX.Session session = new Teamcenter.ClientX.Session(serveraddress); + //loginuser = session.mylogin(username, password, usergroup, userrole); + + } + else + { + ed1.WriteMessage("ԲûʱĿ¼²ڴļ\n"); + } + + break; + } + } + } + else + { + ed1.WriteMessage("ѡȷݼ\n"); + MessageBox.Show("ѡȷݼ"); + return; + } + } + + private void openbutton2_Click(object sender, EventArgs e) + { + this.openfrom.Hide(); + this.searchfrom = new Search(); + this.searchfrom.appdoc = appodc; + this.searchfrom.user = loginuser; + this.searchfrom.xmlpath = xmlpath; + this.searchfrom.Activate(); + this.searchfrom.Show(); + this.openfrom.Dispose(); + } + + private void c_back(Object data) + { + DocumentCollection acdocmgr = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager; + if (acdocmgr.IsApplicationContext) + { + acdocmgr.Open(Convert.ToString(data)); + } + } + + [CommandMethod("SAVE_AS")] + public void saveas() + { + savetotc(); + } + + + [CommandMethod("SAVE_TO_TC")] + public void savetotc() + { + + //Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.SendStringToExecute(string.Format("{0}", "QSAVE"), true, false, true); + + if (loginuser != null) + { + hadlogin = true; + } + else + login(); + if (hadlogin) + { + string filename = ""; + DataManagementService dmService = DataManagementService.getService(Session.getConnection()); + Editor ed1 = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; + OriginTool origintool = new OriginTool(); + + ed1.WriteMessage("\nʼȡϢ...\n"); + /************************************************************************/ + /* ȡݵĴ */ + /************************************************************************/ + ArrayList btllist = new ArrayList(); + OriginReadXml readxml = new OriginReadXml(); + btllist = readxml.OriginReadBTLXML(xmlpath); + + for (int i = 0; i < btllist.Count; i++) + { + OriginBTL onebtlinfo = (OriginBTL)btllist[i]; + ed1.WriteMessage("ƣ" + onebtlinfo.Btlname + "\n"); + ed1.WriteMessage("ϸϢ:" + "\n"); + foreach (DictionaryEntry de in onebtlinfo.Btldatatable) + { + ed1.WriteMessage("CAD"+de.Key + "\tCADֵ:"+de.Value+ + "\tTC:" + onebtlinfo.Btltctable[de.Key] + + "\tTCϵͳ:" + onebtlinfo.Btltypetable[de.Key] + + "\tд" + onebtlinfo.Btlwritetable[de.Key] + "\n"); + } + } + ed1.WriteMessage("ʼȡϸϢ...\n"); + List mxllist = new List(); + mxllist = readxml.OriginReadMXLXML(xmlpath); + + for (int i = 0; i < mxllist.Count;i++ ) + { + OriginMXL mxlinfo = mxllist[i]; + ed1.WriteMessage("ϸƣ" + mxlinfo.Mxlname + "\n"); + ed1.WriteMessage("ϸ"+i+"ϸϢ:" + "\n"); + foreach (DictionaryEntry de in mxlinfo.Mxldatatable) + { + ed1.WriteMessage("CAD" + de.Key + "\tCADֵ:"+de.Value+ + "\tTC:"+mxlinfo.Mxltctable[de.Key]+ + "\tis_bomline:"+mxlinfo.Mxlisbomtable[de.Key]+ + "\twritable:"+mxlinfo.Mxlupdatetable[de.Key]+"\n"); + } + } + ed1.WriteMessage("ϸΪ:" + mxllist.Count); + ed1.WriteMessage("ʼΪbomṹ\n"); + mxllist = origintool.sortbomlist(mxllist); + ed1.WriteMessage("ɹ...\n"); + + // + for (int btli = 0; btli < btllist.Count; btli++) + { + OriginBTL btlinfo = (OriginBTL)btllist[btli]; + //item_idӦcadͼֽϢ + object key = origintool.getKeyFromValue(btlinfo.Btltctable, "item_id"); + if (key == null) + { + ed1.WriteMessage("ϵͳûҵitem_idӦͼֽϢϵͳж\n"); + return; + } + SavedQueryResults found = origintool.getSearchItem(btlinfo.Btldatatable[key].ToString()); + if (found != null && found.NumOfObjects > 0) + { + DialogResult upresult = MessageBox.Show("ҵӦItemǷ£", "ʾ", MessageBoxButtons.YesNo, MessageBoxIcon.Question); + if (upresult == DialogResult.No || upresult == DialogResult.None) + { + ed1.WriteMessage("\n"); + return; + } + if (upresult == DialogResult.Yes) + { + for (int i = 0; i < found.NumOfObjects; i++) + { + Item item = found.Objects[i] as Item; + ModelObject[] objects = { item }; + String[] attributes = { "item_id", "object_name", "object_string" }; + dmService.RefreshObjects(objects); + dmService.GetProperties(objects, attributes); + string item_id = item.Item_id; + string object_name = item.Object_name; + + Dataset dataset = null; + GetItemFromIdInfo tempitem = new GetItemFromIdInfo(); + tempitem.ItemId = item_id; + GetItemFromIdInfo[] infos = new GetItemFromIdInfo[1]; + infos[0] = tempitem; + GetItemFromIdPref pref = new GetItemFromIdPref(); + //Ҫµķʽ + GetItemFromIdResponse infoResp = dmService.GetItemFromId(infos, 1, pref); + + + //㼶ҪӶItemԵĸ + if (btlinfo.Btltypetable.ContainsValue("Item")) + { + ed1.WriteMessage("ڸItem\n"); + Hashtable itemattrs = new Hashtable(); + foreach (DictionaryEntry de in btlinfo.Btltypetable) + { + if (de.Value.ToString() == "Item" && btlinfo.Btlwritetable[de.Key].ToString() == "1" && + btlinfo.Btlupdatetable[de.Key].ToString() == "1") + { + string cadstring = de.Key.ToString(); + string cadvalue = btlinfo.Btldatatable[cadstring].ToString(); + string tcstring = btlinfo.Btltctable[cadstring].ToString(); + itemattrs.Add(tcstring, cadvalue); + } + } + if (itemattrs.Count > 0) + { + ServiceData itemupdateresponse = dmService.SetDisplayProperties(objects, itemattrs); + if (itemupdateresponse.sizeOfPartialErrors() <= 0) + { + ed1.WriteMessage("ItemԳɹ\n"); + } + } + } + + + + + for (int j = 0; j < infoResp.Output.Length; j++) + { + ModelObject[] objects1 = { infoResp.Output[j].Item }; + String[] attributes1 = { "revision_list", "is_modifiable" }; + dmService.RefreshObjects(objects1); + dmService.GetProperties(objects1, attributes1); + ModelObject[] revlist = infoResp.Output[j].Item.Revision_list; + dmService.RefreshObjects(revlist); + ItemRevision itemRev = null; + string rev_id = ""; + for (int k = 0; k < revlist.Length; k++) + { + itemRev = revlist[k] as ItemRevision; + ModelObject[] objects2 = { itemRev }; + String[] attributes2 = { "item_revision_id", "is_modifiable" , + "checked_out","item_id","release_status_list", + "IMAN_master_form_rev"}; + dmService.RefreshObjects(objects2); + dmService.GetProperties(objects2, attributes2); + + //жͼֽǷ˰汾Ϣ˰汾Ϣָİ汾򣬴°汾 + if (btlinfo.Btltctable.ContainsValue("item_revision_id")) + { + if (itemRev.Item_revision_id == btlinfo.Btldatatable[origintool.getKeyFromValue(btlinfo.Btltctable, "item_revision_id")].ToString()) + { + break; + } + } + } + if (itemRev == null) + { + ed1.WriteMessage("ItemûжӦ汾\n"); + return; + } + rev_id = itemRev.Item_revision_id; + ReleaseStatus[] releaselist = itemRev.Release_status_list; + if (!itemRev.Is_modifiable) + { + MessageBox.Show("ItemRevisionΪֻ,ûбȨ!"); + return; + } + if (releaselist.Length > 0) + { + string message = "Item IDΪ" + itemRev.Item_id + "°汾ѷ"; + MessageBox.Show(message); + return; + } + + //㼶ҪӶ԰汾Եĸ + if (btlinfo.Btltypetable.ContainsValue("ItemRevision")) + { + ed1.WriteMessage("ڸItemRevision\n"); + Hashtable itemRevattrs = new Hashtable(); + ModelObject[] olditemRev = new ModelObject[1]; + olditemRev[0] = itemRev; + foreach (DictionaryEntry de in btlinfo.Btltypetable) + { + if (de.Value.ToString() == "ItemRevision" && btlinfo.Btlwritetable[de.Key].ToString() == "1" && + btlinfo.Btlupdatetable[de.Key].ToString() == "1") + { + string cadstring = de.Key.ToString(); + string cadvalue = btlinfo.Btldatatable[cadstring].ToString(); + string tcstring = btlinfo.Btltctable[cadstring].ToString(); + itemRevattrs.Add(tcstring, cadvalue); + } + } + if (itemRevattrs.Count > 0) + { + ServiceData itemupdateresponse = dmService.SetDisplayProperties(olditemRev, itemRevattrs); + if (itemupdateresponse.sizeOfPartialErrors() <= 0) + { + ed1.WriteMessage("ItemRevisionԳɹ\n"); + } + } + } + + + + + //±Ϣ + FormInfo forminfo = new FormInfo(); + FormInfo[] forminfo_vec = new FormInfo[1]; + ModelObject[] form_vec; + + form_vec = itemRev.IMAN_master_form_rev; + + + + for (int k = 0; k < form_vec.Length; k++) + { + //Type myType = form_vec[k].GetType(); + //string fType = myType.Name; + Form form = form_vec[k] as Form; + bool frash = false; + string[] props = new string[1]; + + Hashtable formAttrs = new Hashtable(); + + //Formԣִ´ + if (btlinfo.Btltypetable.ContainsValue("Form")) + { + foreach (DictionaryEntry de in btlinfo.Btltypetable) + { + if (de.Value.ToString() == "Form" && btlinfo.Btlwritetable[de.Key].ToString() == "1" && + btlinfo.Btlupdatetable[de.Key].ToString() == "1") + { + string cadstring = de.Key.ToString(); + string cadvalue = btlinfo.Btldatatable[cadstring].ToString(); + string tcstring = btlinfo.Btltctable[cadstring].ToString(); + string writestring = btlinfo.Btlwritetable[cadstring].ToString(); + + ed1.WriteMessage("ȡ" + tcstring + "\n"); + props[0] = tcstring; + ServiceData serviceData = dmService.GetProperties(form_vec, props); + if (serviceData.sizeOfPartialErrors() > 0) + { + continue; + } + Property my_prop = form_vec[k].GetProperty(tcstring); + if (cadvalue != my_prop.StringValue) + { + if (my_prop.StringValue == "") + frash = true; + else + { + string message = "ǰͼֽ:" + cadstring + "ֵ" + cadvalue + "ϵͳ:" + tcstring + "ֵ" + my_prop.StringValue + "һ,Ƿ񸲸ϵͳ?"; + DialogResult updateresult = MessageBox.Show(message, "ʾ", MessageBoxButtons.YesNo, MessageBoxIcon.Question); + if (updateresult == DialogResult.Yes) + { + frash = true; + } + } + string[] formAttrValue = new string[1]; + formAttrValue[0] = ""; + if (frash) + formAttrValue[0] = cadvalue; + else + formAttrValue[0] = my_prop.StringValue; + ed1.WriteMessage(tcstring + ":" + formAttrValue[0] + "\n"); + formAttrs.Add(tcstring, formAttrValue); + props[0] = ""; + } + + } + } + } + + ed1.WriteMessage("formAttrs:" + formAttrs.Count + "\n"); + + foreach (DictionaryEntry hash in formAttrs) + { + ed1.WriteMessage(hash.Key + ":" + Convert.ToString(hash.Value) + "\n"); + } + + + forminfo.AttributesMap = formAttrs; + forminfo.ClientId = "1"; + forminfo.Description = ""; + forminfo.FormObject = (Form)form; + forminfo.Name = item_id + "/" + rev_id; + forminfo.ParentObject = null; + forminfo.RelationName = "IMAN_master_form"; + forminfo.SaveDB = true; + forminfo.FormType = "ItemRevision Master"; + forminfo_vec[0] = forminfo; + try + { + ed1.WriteMessage("ʼ\n"); + Teamcenter.Services.Strong.Core._2007_01.DataManagement.CreateOrUpdateFormsResponse formResp = + dmService.CreateOrUpdateForms(forminfo_vec); + ModelObject[] respon = { formResp.ServiceData.GetUpdatedObject(0) }; + dmService.RefreshObjects(respon); + ed1.WriteMessage("\n"); + break; + } + catch (ServiceException ex) + { + ed1.WriteMessage(ex.Message); + } + } + + ed1.WriteMessage("=======ݼ=========\n"); + //ݼƵɴ,type refname separator + + OriginReadXml originreadxml = new OriginReadXml(); + OriginDataSet datasetinfo = originreadxml.OriginReadDataSetXML(xmlpath); + datasetinfo = origintool.GetDataSetInfo(datasetinfo, btlinfo); + + ed1.WriteMessage("׼ݼ\n"); + + + bool findDateset = false; + bool neworupdate = false; + Teamcenter.Services.Strong.Core._2007_06.DataManagement.ExpandGRMRelationsPref + myPref = new Teamcenter.Services.Strong.Core._2007_06.DataManagement.ExpandGRMRelationsPref(); + Teamcenter.Services.Strong.Core._2007_06.DataManagement.RelationAndTypesFilter2 + myFilter = new Teamcenter.Services.Strong.Core._2007_06.DataManagement.RelationAndTypesFilter2(); + myFilter.RelationName = "IMAN_specification"; + string[] typeVec = new string[1]; + typeVec[0] = datasetinfo.Datatype; + myFilter.ObjectTypeNames = typeVec; + myPref.ExpItemRev = false; + Teamcenter.Services.Strong.Core._2007_06.DataManagement.RelationAndTypesFilter2[] myFilterVec = { myFilter }; + myPref.Info = myFilterVec; + + ModelObject[] primaryObjects = { itemRev }; + Teamcenter.Services.Strong.Core._2007_06.DataManagement.ExpandGRMRelationsResponse + myResp = dmService.ExpandGRMRelationsForPrimary(primaryObjects, myPref); + + if (myResp.Output.Length > 0) + { + for (int k = 0; k < myResp.Output.Length; k++) + { + Teamcenter.Services.Strong.Core._2007_06.DataManagement.ExpandGRMRelationsOutput + grmOutput = myResp.Output[k]; + for (int l = 0; l < grmOutput.OtherSideObjData.Length; l++) + { + ExpandGRMRelationsData otherSideData = grmOutput.OtherSideObjData[l]; + if (otherSideData.OtherSideObjects.Length > 0) + { + for (int m = 0; m < otherSideData.OtherSideObjects.Length; m++) + { + Dataset tempDataset; + //Teamcenter.Soa.Client.Model.ServiceData sData; + tempDataset = otherSideData.OtherSideObjects[m] as Dataset; + + string ds_name = tempDataset.Object_string; + if (ds_name == datasetinfo.Ds_name) + { + findDateset = true; + dataset = otherSideData.OtherSideObjects[m] as Dataset; + ed1.WriteMessage("ҵݼ!\n"); + break; + } + } + //if (!findDateset) + //{ + // DialogResult updateornewdialog = MessageBox.Show("ItemѴݼ", "ʾ", MessageBoxButtons.YesNo, MessageBoxIcon.Question); + // if (updateornewdialog == DialogResult.Yes) + // { + + // } + //} + } + } + } + } + + //½ݼ + if (findDateset) + { + bool ischeckout = false; + try + { + ModelObject[] objects2 = { dataset }; + String[] attributes2 = { "is_modifiable", "checked_out", "checked_out_user" }; + dmService.RefreshObjects(objects2); + dmService.GetProperties(objects2, attributes2); + if (!dataset.Is_modifiable) + { + MessageBox.Show("򿪵ͼֽ״̬Ϊֻ,޷浽ϵͳ!"); + return; + } + User checkuserinfo = dataset.Checked_out_user as User; + if (checkuserinfo != null) + { + if (checkuserinfo.Uid != loginuser.Uid) + { + MessageBox.Show("ͼֽѱûǩ,޷浽ϵͳ!"); + return; + } + } + if (dataset.Checked_out == "Y") + ischeckout = true; + + } + catch (NotLoadedException ex) + { + ed1.WriteMessage(ex.Message); + } + + Reservation res = ReservationService.getService(Session.getConnection()); + //string comment = "", changeId = ""; + //ModelObject[] ds_object = new ModelObject[1]; + //ds_object[0] = dataset; + ModelObject[] dsFileVec = null; + //ed1.WriteMessage("=======22ݼ22========="); + try + { + ModelObject[] objects2 = { dataset }; + String[] attributes2 = { "ref_list" }; + dmService.RefreshObjects(objects2); + dmService.GetProperties(objects2, attributes2); + dsFileVec = dataset.Ref_list; + } + catch (NotLoadedException ex) + { + ed1.WriteMessage(ex.Message); + } + ImanFile dsfile = dsFileVec[0] as ImanFile; + + ModelObject[] objects3 = { dsfile }; + String[] attributes3 = { "relative_directory_path", "original_file_name" }; + dmService.RefreshObjects(objects3); + dmService.GetProperties(objects3, attributes3); + filename = dsfile.Original_file_name; + //ed1.WriteMessage("=======33ݼ33=========\n"); + Teamcenter.Services.Loose.Core._2006_03.FileManagement.DatasetFileInfo[] fileInfos = new Teamcenter.Services.Loose.Core._2006_03.FileManagement.DatasetFileInfo[1]; + + Teamcenter.Services.Loose.Core._2006_03.FileManagement.DatasetFileInfo fileInfo = new Teamcenter.Services.Loose.Core._2006_03.FileManagement.DatasetFileInfo(); + + DocumentCollection inacdocmgr = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager; + ed1.WriteMessage("ǰļ" + inacdocmgr.MdiActiveDocument.Name + "\n"); + //inacdocmgr.MdiActiveDocument.Database.SaveAs(inacdocmgr.MdiActiveDocument.Name, DwgVersion.Current); + //inacdocmgr.MdiActiveDocument.SendStringToExecute("QSAVE", true, false, true); + //string tempdir = System.Environment.GetEnvironmentVariable("TEMP").ToString(); + //string tempfilename = ""; + //if (inacdocmgr.MdiActiveDocument.Name.IndexOf("temp") == 0) + //{ + // tempfilename = inacdocmgr.MdiActiveDocument.Name.Substring(23); + //} + //else + //{ + // tempfilename = inacdocmgr.MdiActiveDocument.Name; + //} + Document acdoc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument; + acdoc.Database.SaveAs(acdoc.Name, true, DwgVersion.Current, acdoc.Database.SecurityParameters); + + + string mdiactivefile = acdoc.Name; + fileInfo.FileName = mdiactivefile; + fileInfo.AllowReplace = true; + fileInfo.IsText = false; + fileInfo.NamedReferencedName = datasetinfo.Refname; + fileInfos[0] = fileInfo; + Teamcenter.Services.Loose.Core._2006_03.FileManagement.GetDatasetWriteTicketsInputData inputData = new Teamcenter.Services.Loose.Core._2006_03.FileManagement.GetDatasetWriteTicketsInputData(); + inputData.Dataset = dataset; + inputData.CreateNewVersion = false; + inputData.DatasetFileInfos = fileInfos; + //ed1.WriteMessage("=======44ݼ44========="); + Teamcenter.Services.Loose.Core._2006_03.FileManagement.GetDatasetWriteTicketsInputData[] inputs = new Teamcenter.Services.Loose.Core._2006_03.FileManagement.GetDatasetWriteTicketsInputData[1]; + inputs[0] = inputData; + FileManagementUtility fMSFileManagement = new FileManagementUtility(Session.getConnection()); + ServiceData response = fMSFileManagement.PutFiles(inputs); + if (response.sizeOfPartialErrors() > 0) + ed1.WriteMessage("FileManagementService upload returned partial errors:" + response.sizeOfPartialErrors()); + ModelObject[] datasets = new ModelObject[1]; + datasets[0] = dataset; + if (ischeckout) + res.Checkin(datasets); + dmService.RefreshObjects(datasets); + //datasets[0] = inputs[0].Dataset; + //dmService.DeleteObjects(datasets); + //fMSFileManagement.Term(); + ed1.WriteMessage("DateSet check in successful\n"); + } + else + { + Teamcenter.Services.Strong.Core._2006_03.DataManagement.DatasetProperties + oneDatasetProp = new Teamcenter.Services.Strong.Core._2006_03.DataManagement.DatasetProperties(); + Teamcenter.Services.Strong.Core._2006_03.DataManagement.DatasetProperties[] + dataset_vec = new Teamcenter.Services.Strong.Core._2006_03.DataManagement.DatasetProperties[1]; + oneDatasetProp.ClientId = "datasetWriteTixTestClientId"; + oneDatasetProp.Type = datasetinfo.Datatype; + oneDatasetProp.Name = datasetinfo.Ds_name; + oneDatasetProp.Description = ""; + oneDatasetProp.Container = null; + dataset_vec[0] = oneDatasetProp; + Teamcenter.Services.Strong.Core._2006_03.DataManagement.CreateDatasetsResponse + dsResp = dmService.CreateDatasets(dataset_vec); + Dataset createdataset = dsResp.Output[0].Dataset; + + //create relationship + Teamcenter.Services.Strong.Core._2006_03.DataManagement.Relationship[] + rela_vec = new Teamcenter.Services.Strong.Core._2006_03.DataManagement.Relationship[1]; + Teamcenter.Services.Strong.Core._2006_03.DataManagement.Relationship + one_rela = new Teamcenter.Services.Strong.Core._2006_03.DataManagement.Relationship(); + one_rela.ClientId = ""; + one_rela.PrimaryObject = itemRev; + one_rela.SecondaryObject = createdataset; + one_rela.RelationType = "IMAN_specification"; + one_rela.UserData = null; + rela_vec[0] = one_rela; + Teamcenter.Services.Strong.Core._2006_03.DataManagement.CreateRelationsResponse + reResp = dmService.CreateRelations(rela_vec); + ed1.WriteMessage("ݼϵɹ!\n"); + + Teamcenter.Services.Loose.Core._2006_03.FileManagement.DatasetFileInfo[] fileInfos = new Teamcenter.Services.Loose.Core._2006_03.FileManagement.DatasetFileInfo[1]; + + Teamcenter.Services.Loose.Core._2006_03.FileManagement.DatasetFileInfo fileInfo = new Teamcenter.Services.Loose.Core._2006_03.FileManagement.DatasetFileInfo(); + + DocumentCollection inacdocmgr = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager; + //inacdocmgr.MdiActiveDocument.Database.SaveAs(inacdocmgr.MdiActiveDocument.Name, DwgVersion.Current); + //inacdocmgr.MdiActiveDocument.SendStringToExecute("QSAVE", true, false, true); + + ed1.WriteMessage("ǰļ" + inacdocmgr.MdiActiveDocument.Name + "\n"); + + Document acdoc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument; + acdoc.Database.SaveAs(acdoc.Name, true, DwgVersion.Current, acdoc.Database.SecurityParameters); + + string mdiactivefile = acdoc.Name; + fileInfo.FileName = mdiactivefile; + fileInfo.AllowReplace = true; + fileInfo.IsText = false; + fileInfo.NamedReferencedName = datasetinfo.Refname; + fileInfos[0] = fileInfo; + Teamcenter.Services.Loose.Core._2006_03.FileManagement.GetDatasetWriteTicketsInputData inputData = new Teamcenter.Services.Loose.Core._2006_03.FileManagement.GetDatasetWriteTicketsInputData(); + inputData.Dataset = createdataset; + inputData.CreateNewVersion = false; + inputData.DatasetFileInfos = fileInfos; + Teamcenter.Services.Loose.Core._2006_03.FileManagement.GetDatasetWriteTicketsInputData[] inputs = new Teamcenter.Services.Loose.Core._2006_03.FileManagement.GetDatasetWriteTicketsInputData[1]; + inputs[0] = inputData; + FileManagementUtility fMSFileManagement = new FileManagementUtility(Session.getConnection()); + ServiceData response = fMSFileManagement.PutFiles(inputs); + if (response.sizeOfPartialErrors() > 0) + ed1.WriteMessage("FileManagementService upload returned partial errors:" + response.sizeOfPartialErrors()); + ed1.WriteMessage("DateSet check in successful\n"); + ModelObject[] datasets = new ModelObject[1]; + datasets[0] = createdataset; + dmService.RefreshObjects(datasets); + dataset = createdataset; + } + + //BOM + if (mxllist.Count > 0) + { + DialogResult flushbomresult = MessageBox.Show("ǷˢBOM", "ʾ", MessageBoxButtons.YesNo, MessageBoxIcon.Question); + if (flushbomresult == DialogResult.Yes) + { + Folder aimFolder = null; + WorkspaceObject[] object_vec = new WorkspaceObject[1]; + object_vec[0] = item; + Teamcenter.Services.Strong.Core._2007_01.DataManagement.WhereReferencedResponse + refResp = dmService.WhereReferenced(object_vec, 1); + Teamcenter.Services.Strong.Core._2007_01.DataManagement.WhereReferencedOutput[] + refOutput = refResp.Output; + + for (int u = 0; u < refOutput.Length; u++) + { + Teamcenter.Services.Strong.Core._2007_01.DataManagement.WhereReferencedInfo[] + info = refOutput[u].Info; + for (int p = 0; p < info.Length; p++) + { + Teamcenter.Services.Strong.Core._2007_01.DataManagement.WhereReferencedInfo + it_info = info[p]; + string type = it_info.Referencer.Object_type; + if (type.Contains("Folder")) + { + aimFolder = it_info.Referencer as Folder; + ed1.WriteMessage("ҵĿļ\n"); + break; + } + } + } + + if (aimFolder == null) + CreateBomStructure(itemRev, dataset, mxllist, null); + else + CreateBomStructure(itemRev, dataset, mxllist, aimFolder); + } + } + + + }//for + } + } + } + else + { + this.savefrom = new SaveToTC(); + this.savefrom.appdoc = appodc; + this.savefrom.user = loginuser; + this.savefrom.btlinfo = btlinfo; + this.savefrom.bomlist = mxllist; + this.savefrom.xmlpath = xmlpath; + this.savefrom.button1.Click += new EventHandler(savebutton1_Click); + this.savefrom.Activate(); + this.savefrom.Show(); + } + } + } + } + + + + /************************************************************************ + * 2012-7-3 + * add by raywei + * function used by savetotc + * ߼ + * ITEMʱݼݼԴϵͳжӦģitemµݼ + * 1ѡ ļ=ģID ַָ + * 2ñitemͣöӦģIDݴIDҵϵͳITEM + * 3ҵItemݼ + * 4ݼļ + * 5ITEM + * 6µݼ + * 7 + ************************************************************************/ + + public void updateItemDataSet( Editor ed1, BTLClass btlinfo, + ItemRevision itemrevision, DataManagementService dmService, string rev_id) + { + //ȡѡ + Tool tool = new Tool(); + Hashtable pre = tool.getTCPreferences("DFHM_dstype"); + string[] prevalues = (string[])pre["DFHM_dstype"]; + + if (prevalues.Length <= 0) + { + ed1.WriteMessage("ѡDFHM_dstype\n"); + } + + for (int i = 0; i < prevalues.Length; i++) + { + ed1.WriteMessage(prevalues[i].ToString() + "\n"); + } + + //ǷWORDݼ + ed1.WriteMessage("ItemǷWORDݼ\n"); + bool hasWordDS = checkHasWord(itemrevision, dmService); + if (hasWordDS) + { + ed1.WriteMessage("ItemѾWORDݼ\n"); + } + else + { + ed1.WriteMessage("ItemWORDݼ\n"); + //ȡӦģID + ed1.WriteMessage("ڷͶӦģID\n"); + string DMTitemid = tool.getCorrespondItemID(tool.initItemType(btlinfo.Item_id, btlinfo.Materialgrade).Trim(), prevalues); + string DMTFilepath = ""; + if (DMTitemid != null && DMTitemid != "") + { + SavedQueryResults found = tool.getSearchItem(DMTitemid); + //ҵģitem + ed1.WriteMessage("ҵģ\n"); + if (found.NumOfObjects > 0 && found != null) + { + Item DMTItem = found.Objects[0] as Item; + DMTFilepath = downloadfile(DMTItem); + ed1.WriteMessage("ģļɣ·" + DMTFilepath + "\n"); + } + } + //ݼļģ + if (DMTFilepath != "") + { + bool uploadresult = uploadfile(DMTFilepath, btlinfo.Item_id + "/" + rev_id, itemrevision); + if (uploadresult) + ed1.WriteMessage("Ӧݼģɹ\n"); + } + } + + + + } + + //ǷMSWORDݼ + public bool checkHasWord(ItemRevision itemrevision,DataManagementService dmService) + { + bool hasWordDS = false; + Teamcenter.Services.Strong.Core._2007_06.DataManagement.ExpandGRMRelationsPref + myPref = new Teamcenter.Services.Strong.Core._2007_06.DataManagement.ExpandGRMRelationsPref(); + Teamcenter.Services.Strong.Core._2007_06.DataManagement.RelationAndTypesFilter2 + myFilter = new Teamcenter.Services.Strong.Core._2007_06.DataManagement.RelationAndTypesFilter2(); + myFilter.RelationName = "IMAN_specification"; + string[] typeVec = new string[1]; + typeVec[0] = "MSWord"; + myFilter.ObjectTypeNames = typeVec; + myPref.ExpItemRev = false; + Teamcenter.Services.Strong.Core._2007_06.DataManagement.RelationAndTypesFilter2[] myFilterVec = { myFilter }; + myPref.Info = myFilterVec; + ModelObject[] primaryObjects = { itemrevision }; + Teamcenter.Services.Strong.Core._2007_06.DataManagement.ExpandGRMRelationsResponse + myResp = dmService.ExpandGRMRelationsForPrimary(primaryObjects, myPref); + ExpandGRMRelationsOutput[] myoutput = myResp.Output; + for (int i = 0; i < myoutput.Length; i++) + { + ExpandGRMRelationsOutput one_out = myoutput[i]; + for (int j = 0; j < one_out.OtherSideObjData.Length; j++) + { + ExpandGRMRelationsData otherSideData = one_out.OtherSideObjData[j]; + for (int k = 0; k < otherSideData.OtherSideObjects.Length; k++) + { + Type typeinfo = otherSideData.OtherSideObjects[k].GetType(); + string typename = typeinfo.Name; + if (typename == "MSWord") + { + hasWordDS = true; + } + } + } + } + return hasWordDS; + } + + + + /************************************************************************ + * 2012-2-13 + * add by raywei + * function used by savebutton1_Click + * ߼ + * ½ITEMʱݼݼԴϵͳжӦģitemµݼ + * 1ѡ ļ=ģID ַָ + * 2ñitemͣöӦģIDݴIDҵϵͳITEM + * 3ҵItemݼ + * 4ݼļ + * 5µITEM + * 6µݼ + * 7 + ************************************************************************/ + + /************************************************************************ + * 2012-2-13 + * add by raywei + * ÷ݼļصأļ· + ************************************************************************/ + + public string downloadfile(Item DMTItem) + { + string DMTFilepath = ""; + DataManagementService dmService = DataManagementService.getService(Session.getConnection()); + Editor ed1 = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; + ModelObject[] itemrevisionlist = null; + ModelObject[] objects = { DMTItem }; + String[] attributes = { "revision_list" }; + dmService.RefreshObjects(objects); + dmService.GetProperties(objects, attributes); + itemrevisionlist = DMTItem.Revision_list; + ItemRevision itemrevision = itemrevisionlist[itemrevisionlist.Length-1] as ItemRevision; + ExpandGRMRelationsPref myPref = new ExpandGRMRelationsPref(); + RelationAndTypesFilter2 myFilter = new RelationAndTypesFilter2(); + myFilter.RelationName = "IMAN_specification"; + String[] typeVec = { "MSWord" }; + myFilter.ObjectTypeNames = typeVec; + myPref.ExpItemRev = false; + RelationAndTypesFilter2[] myfilter = { myFilter }; + myPref.Info = myfilter; + ModelObject[] objects1 = { itemrevision }; + ExpandGRMRelationsResponse myResp = dmService.ExpandGRMRelationsForPrimary(objects1, myPref); + ExpandGRMRelationsOutput[] myoutput = myResp.Output; + for (int i = 0; i < myoutput.Length; i++) + { + ExpandGRMRelationsOutput one_out = myoutput[i]; + for (int j = 0; j < one_out.OtherSideObjData.Length; j++) + { + ExpandGRMRelationsData otherSideData = one_out.OtherSideObjData[j]; + for (int k = 0; k < otherSideData.OtherSideObjects.Length; k++) + { + Type typeinfo = otherSideData.OtherSideObjects[k].GetType(); + string typename = typeinfo.Name; + if (typename == "MSWord") + { + DataSet dateset = otherSideData.OtherSideObjects[k] as DataSet; + ModelObject[] objects2 = { dateset }; + String[] attributes2 = { "is_modifiable", "checked_out", "ref_list" }; + dmService.RefreshObjects(objects2); + dmService.GetProperties(objects2, attributes2); + ModelObject[] dsfilevec = dateset.Ref_list; + ImanFile dsfile = dsfilevec[0] as ImanFile; + + ModelObject[] objects3 = { dsfile }; + String[] attributes3 = { "relative_directory_path", "original_file_name" }; + dmService.RefreshObjects(objects3); + dmService.GetProperties(objects3, attributes3); + + string newfilename = dsfile.Original_file_name; + ed1.WriteMessage("Original_file_name : " + newfilename + "\n"); + string tempdir = System.Environment.GetEnvironmentVariable("TEMP").ToString(); + ed1.WriteMessage("TEMP:" + tempdir.ToString() + "\n"); + + Teamcenter.Soa.Client.FileManagementUtility fmu = new Teamcenter.Soa.Client.FileManagementUtility(Teamcenter.ClientX.Session.getConnection()); + Teamcenter.Soa.Client.GetFileResponse getFileResponse = fmu.GetFiles(dsfilevec); + FileInfo[] fileinfovec = getFileResponse.GetFiles(); + + FileInfo file = fileinfovec[0]; + DMTFilepath = tempdir + "\\" + newfilename; + ed1.WriteMessage("·" + DMTFilepath + "\n"); + System.IO.File.Copy(file.FullName, DMTFilepath, true); + System.IO.File.SetAttributes(DMTFilepath, FileAttributes.Normal); + + } + } + } + } + + return DMTFilepath; + } + + //½ݼϴļ + public bool uploadfile(string DMTFilepath, string ds_name, ItemRevision rev) + { + bool result = false; + DataManagementService dmService = DataManagementService.getService(Session.getConnection()); + Editor ed1 = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; + Teamcenter.Services.Strong.Core._2006_03.DataManagement.DatasetProperties + oneDatasetProp = new Teamcenter.Services.Strong.Core._2006_03.DataManagement.DatasetProperties(); + Teamcenter.Services.Strong.Core._2006_03.DataManagement.DatasetProperties[] + dataset_vec = new Teamcenter.Services.Strong.Core._2006_03.DataManagement.DatasetProperties[1]; + oneDatasetProp.ClientId = "datasetWriteTixTestClientId"; + oneDatasetProp.Type = "MSWord"; + oneDatasetProp.Name = ds_name; + ed1.WriteMessage("ds_name===="+ds_name+"\n"); + oneDatasetProp.Description = ""; + oneDatasetProp.Container = null; + dataset_vec[0] = oneDatasetProp; + Teamcenter.Services.Strong.Core._2006_03.DataManagement.CreateDatasetsResponse + dsResp = dmService.CreateDatasets(dataset_vec); + Dataset createdataset = dsResp.Output[0].Dataset; + + //create relationship + Teamcenter.Services.Strong.Core._2006_03.DataManagement.Relationship[] + rela_vec = new Teamcenter.Services.Strong.Core._2006_03.DataManagement.Relationship[1]; + Teamcenter.Services.Strong.Core._2006_03.DataManagement.Relationship + one_rela = new Teamcenter.Services.Strong.Core._2006_03.DataManagement.Relationship(); + one_rela.ClientId = "AppX-myTest"; + one_rela.PrimaryObject = rev; + one_rela.SecondaryObject = createdataset; + one_rela.RelationType = "IMAN_specification"; + one_rela.UserData = null; + rela_vec[0] = one_rela; + Teamcenter.Services.Strong.Core._2006_03.DataManagement.CreateRelationsResponse + reResp = dmService.CreateRelations(rela_vec); + ed1.WriteMessage("ݼϵɹ!\n"); + + Teamcenter.Services.Loose.Core._2006_03.FileManagement.DatasetFileInfo[] fileInfos = new Teamcenter.Services.Loose.Core._2006_03.FileManagement.DatasetFileInfo[1]; + + Teamcenter.Services.Loose.Core._2006_03.FileManagement.DatasetFileInfo fileInfo = new Teamcenter.Services.Loose.Core._2006_03.FileManagement.DatasetFileInfo(); + + fileInfo.FileName = DMTFilepath; + ed1.WriteMessage("fileInfo.FileName===" + fileInfo.FileName+"\n"); + fileInfo.AllowReplace = true; + fileInfo.IsText = false; + fileInfo.NamedReferencedName = "word"; + fileInfos[0] = fileInfo; + Teamcenter.Services.Loose.Core._2006_03.FileManagement.GetDatasetWriteTicketsInputData inputData = new Teamcenter.Services.Loose.Core._2006_03.FileManagement.GetDatasetWriteTicketsInputData(); + inputData.Dataset = createdataset; + inputData.CreateNewVersion = false; + inputData.DatasetFileInfos = fileInfos; + Teamcenter.Services.Loose.Core._2006_03.FileManagement.GetDatasetWriteTicketsInputData[] inputs = new Teamcenter.Services.Loose.Core._2006_03.FileManagement.GetDatasetWriteTicketsInputData[1]; + inputs[0] = inputData; + FileManagementUtility fMSFileManagement = new FileManagementUtility(Session.getConnection()); + ServiceData response = fMSFileManagement.PutFiles(inputs); + + if (response.sizeOfPartialErrors() > 0) + ed1.WriteMessage("FileManagementService upload returned partial errors:" + response.sizeOfPartialErrors()); + if (response.sizeOfPartialErrors() <= 0) + { + ed1.WriteMessage("DateSet check in successful\n"); + result = true; + } + + ModelObject[] datasets = new ModelObject[1]; + datasets[0] = createdataset; + dmService.RefreshObjects(datasets); + + return result; + } + + + + /************************************************************************ + * savetotcڱ水¼ + ************************************************************************/ + public void savebutton1_Click(object sender, EventArgs e) + { + DataManagementService dmService = DataManagementService.getService(Session.getConnection()); + Reservation res = ReservationService.getService(Session.getConnection()); + Editor ed1 = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; + ed1.WriteMessage("==============\n"); + OriginTool origintool = new OriginTool(); + OriginBTL btlinfo = this.savefrom.btlinfo; + List bomlist = this.savefrom.bomlist; + ed1.WriteMessage("ITEM" + btlinfo.Btldatatable[origintool.getKeyFromValue(btlinfo.Btltctable, "item_id")].ToString()); + ed1.WriteMessage("ϸ:"+bomlist.Count+"\n"); + + + TreeNode nownode = this.savefrom.treeView1.SelectedNode; + if(nownode.SelectedImageIndex == 1) + { + foreach (ALLOBJECT perobject in this.savefrom.folderlist) + { + if (perobject.treenode.Equals(nownode)) + { + ed1.WriteMessage("ҵָļ\n"); + + Folder folder = perobject.workobject as Folder; + ModelObject[] objects = { folder }; + String[] attributes = { "is_modifiable"}; + dmService.RefreshObjects(objects); + dmService.GetProperties(objects, attributes); + if (!folder.Is_modifiable) + { + MessageBox.Show("Ŀ¼ûдȨޣѡ"); + return; + } + + ItemProperties oneItemProp = new ItemProperties(); + CreateItemsResponse itemResp = new CreateItemsResponse(); + + Teamcenter.Hello.DataManagement hellomanagement = new Teamcenter.Hello.DataManagement(); + string itemtype = this.savefrom.comboBox1.Text; + ItemIdsAndInitialRevisionIds[] itemIds = hellomanagement.generateItemIds(1, itemtype); + GetItemCreationRelatedInfoResponse relatedResponse = dmService.GetItemCreationRelatedInfo(itemtype, null); + string[] formTypes = new string[relatedResponse.FormAttrs.Length]; + for (int j = 0; j < relatedResponse.FormAttrs.Length; j++) + { + FormAttributesInfo attrInfo = relatedResponse.FormAttrs[j]; + formTypes[j] = attrInfo.FormType; + } + ItemProperties[] itemProps = new ItemProperties[itemIds.Length]; + ItemProperties itemProperty = new ItemProperties(); + for (int j = 0; j < itemIds.Length; j++) + { + ed1.WriteMessage("start Create form in cache!\n"); + ModelObject[] forms = hellomanagement.createForms(itemIds[j].NewItemId, + formTypes[0], itemIds[j].NewRevId, formTypes[1], null, false); + ed1.WriteMessage("Create form in cache sucessful!\n"); + ed1.WriteMessage("set item properties!\n"); + + itemProperty.ClientId = "AppX-Test"; + itemProperty.ItemId = btlinfo.Btldatatable[origintool.getKeyFromValue(btlinfo.Btltctable, "item_id")].ToString(); + if (btlinfo.Btltctable.ContainsValue("item_revision_id")) + itemProperty.RevId = btlinfo.Btldatatable[origintool.getKeyFromValue(btlinfo.Btltctable, "item_revision_id")].ToString(); + else + itemProperty.RevId = itemIds[j].NewRevId; + + if (btlinfo.Btltctable.ContainsValue("object_name")) + itemProperty.Name = btlinfo.Btldatatable[origintool.getKeyFromValue(btlinfo.Btltctable, "object_name")].ToString(); + else + itemProperty.Name = ""; + itemProperty.Type = itemtype; + itemProperty.Description = ""; + itemProperty.Uom = "EA"; + + itemProps[j] = itemProperty; + } + + try + { + ed1.WriteMessage("start item create!\n"); + + itemResp = dmService.CreateItems(itemProps, folder, ""); + + ed1.WriteMessage("create Items: " + btlinfo.Btldatatable[origintool.getKeyFromValue(btlinfo.Btltctable, "item_id")].ToString() + "sucessful!\n"); + ItemRevision rev = null; + Item newitem = null; + for (int j = 0; j < itemResp.Output.Length; j++) + { + rev = itemResp.Output[j].ItemRev; + newitem = itemResp.Output[j].Item; + } + //ӶItemԵĸ + if (btlinfo.Btltypetable.ContainsValue("Item")) + { + ed1.WriteMessage("ڸItem\n"); + Hashtable itemattrs = new Hashtable(); + ModelObject[] newitemOBJ = new ModelObject[1]; + newitemOBJ[0] = newitem; + foreach (DictionaryEntry de in btlinfo.Btltypetable) + { + if (de.Value.ToString() == "Item" && btlinfo.Btlwritetable[de.Key].ToString() == "1" && + btlinfo.Btlupdatetable[de.Key].ToString() == "1") + { + string cadstring = de.Key.ToString(); + string cadvalue = btlinfo.Btldatatable[cadstring].ToString(); + string tcstring = btlinfo.Btltctable[cadstring].ToString(); + itemattrs.Add(tcstring, cadvalue); + } + } + if (itemattrs.Count > 0) + { + ServiceData itemupdateresponse = dmService.SetDisplayProperties(newitemOBJ, itemattrs); + if (itemupdateresponse.sizeOfPartialErrors() <= 0) + { + ed1.WriteMessage("ItemԳɹ\n"); + } + } + } + + //Ӷ԰汾Եĸ + if (btlinfo.Btltypetable.ContainsValue("ItemRevision")) + { + ed1.WriteMessage("ڸItemRevision\n"); + Hashtable itemRevattrs = new Hashtable(); + ModelObject[] newitemRev = new ModelObject[1]; + newitemRev[0] = rev; + foreach (DictionaryEntry de in btlinfo.Btltypetable) + { + if (de.Value.ToString() == "ItemRevision" && btlinfo.Btlwritetable[de.Key].ToString() == "1" && + btlinfo.Btlupdatetable[de.Key].ToString() == "1") + { + string cadstring = de.Key.ToString(); + string cadvalue = btlinfo.Btldatatable[cadstring].ToString(); + string tcstring = btlinfo.Btltctable[cadstring].ToString(); + itemRevattrs.Add(tcstring, cadvalue); + } + } + if (itemRevattrs.Count > 0) + { + ServiceData itemupdateresponse = dmService.SetDisplayProperties(newitemRev, itemRevattrs); + if (itemupdateresponse.sizeOfPartialErrors() <= 0) + { + ed1.WriteMessage("ItemRevisionԳɹ\n"); + } + } + } + + + + + //дform + FormInfo forminfo = new FormInfo(); + FormInfo[] forminfo_vec; + ModelObject[] form_vec = null; + + ModelObject[] objects1 = { rev }; + String[] attributes1 = { "IMAN_master_form_rev", + "is_modifiable","item_revision_id","item_id"}; + dmService.RefreshObjects(objects1); + dmService.GetProperties(objects1, attributes1); + + try + { + form_vec = rev.IMAN_master_form_rev; + ed1.WriteMessage("get_IMAN_master_form_rev sucessful!\n"); + } + catch (NotLoadedException ex) + { + ed1.WriteMessage(ex.Message); + } + forminfo_vec = new FormInfo[form_vec.Length]; + for (int j = 0; j < form_vec.Length; j++) + { + Form form = form_vec[j] as Form; + + Hashtable formAttrs = new Hashtable(); + + + //Formԣִ´ + if (btlinfo.Btltypetable.ContainsValue("Form")) + { + foreach (DictionaryEntry de in btlinfo.Btltypetable) + { + if (de.Value.ToString() == "Form" && btlinfo.Btlwritetable[de.Key].ToString() == "1" && + btlinfo.Btlupdatetable[de.Key].ToString() == "1") + { + string cadstring = de.Key.ToString(); + string cadvalue = btlinfo.Btldatatable[cadstring].ToString(); + string tcstring = btlinfo.Btltctable[cadstring].ToString(); + string writestring = btlinfo.Btlwritetable[cadstring].ToString(); + + string[] formAttrValue = new string[1]; + formAttrValue[0] = ""; + formAttrValue[0] = cadvalue; + formAttrs.Add(tcstring, formAttrValue); + } + } + } + + forminfo.AttributesMap = formAttrs; + forminfo.ClientId = "1"; + forminfo.Description = ""; + forminfo.FormObject = form; + forminfo.Name = rev.Item_id + "/" + rev.Item_revision_id; + forminfo.ParentObject = null; + forminfo.RelationName = "IMAN_master_form"; + forminfo.SaveDB = true; + forminfo.FormType = "ItemRevision Master"; + + forminfo_vec[j] = forminfo; + + try + { + CreateOrUpdateFormsResponse formResp + = dmService.CreateOrUpdateForms(forminfo_vec); + ed1.WriteMessage("update form attributes sucessful!\n"); + } + catch (ServiceException ex) + { + ed1.WriteMessage(ex.Message); + } + } + //string ds_name; + string rev_id = rev.Item_revision_id; + + //ݼƵɴ,type refname separator + + OriginReadXml originreadxml = new OriginReadXml(); + OriginDataSet datasetinfo = originreadxml.OriginReadDataSetXML(xmlpath); + datasetinfo = origintool.GetDataSetInfo(datasetinfo, btlinfo); + + ed1.WriteMessage("׼ݼ\n"); + + Teamcenter.Services.Strong.Core._2006_03.DataManagement.DatasetProperties + oneDatasetProp = new Teamcenter.Services.Strong.Core._2006_03.DataManagement.DatasetProperties(); + Teamcenter.Services.Strong.Core._2006_03.DataManagement.DatasetProperties[] + dataset_vec = new Teamcenter.Services.Strong.Core._2006_03.DataManagement.DatasetProperties[1]; + + + oneDatasetProp.ClientId = "datasetWriteTixTestClientId"; + oneDatasetProp.Type = datasetinfo.Datatype; + oneDatasetProp.Name = datasetinfo.Ds_name; + oneDatasetProp.Description = ""; + oneDatasetProp.Container = null; + dataset_vec[0] = oneDatasetProp; + ed1.WriteMessage("׼ݼ\n"); + Teamcenter.Services.Strong.Core._2006_03.DataManagement.CreateDatasetsResponse + dsResp = dmService.CreateDatasets(dataset_vec); + if (dsResp.Output.Length == 0) + { + ed1.WriteMessage("ݼʧܣݼ.xmlļϢ"); + return; + } + Dataset createdataset = dsResp.Output[0].Dataset; + ed1.WriteMessage("ݼ\n"); + //create relationship + Teamcenter.Services.Strong.Core._2006_03.DataManagement.Relationship[] + rela_vec = new Teamcenter.Services.Strong.Core._2006_03.DataManagement.Relationship[1]; + Teamcenter.Services.Strong.Core._2006_03.DataManagement.Relationship + one_rela = new Teamcenter.Services.Strong.Core._2006_03.DataManagement.Relationship(); + one_rela.ClientId = ""; + one_rela.PrimaryObject = rev; + one_rela.SecondaryObject = createdataset; + one_rela.RelationType = "IMAN_specification"; + one_rela.UserData = null; + rela_vec[0] = one_rela; + Teamcenter.Services.Strong.Core._2006_03.DataManagement.CreateRelationsResponse + reResp = dmService.CreateRelations(rela_vec); + ed1.WriteMessage("ݼϵɹ!\n"); + + Teamcenter.Services.Loose.Core._2006_03.FileManagement.DatasetFileInfo[] fileInfos = new Teamcenter.Services.Loose.Core._2006_03.FileManagement.DatasetFileInfo[1]; + + Teamcenter.Services.Loose.Core._2006_03.FileManagement.DatasetFileInfo fileInfo = new Teamcenter.Services.Loose.Core._2006_03.FileManagement.DatasetFileInfo(); + + DocumentCollection inacdocmgr = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager; + ed1.WriteMessage("ǰļ" + inacdocmgr.MdiActiveDocument.Name + "\n"); + + Document acdoc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument; + acdoc.Database.SaveAs(acdoc.Name, true, DwgVersion.Current, acdoc.Database.SecurityParameters); + + + string mdiactivefile = acdoc.Name; + fileInfo.FileName = mdiactivefile; + fileInfo.AllowReplace = true; + fileInfo.IsText = false; + fileInfo.NamedReferencedName = datasetinfo.Refname; + fileInfos[0] = fileInfo; + Teamcenter.Services.Loose.Core._2006_03.FileManagement.GetDatasetWriteTicketsInputData inputData = new Teamcenter.Services.Loose.Core._2006_03.FileManagement.GetDatasetWriteTicketsInputData(); + inputData.Dataset = createdataset; + inputData.CreateNewVersion = false; + inputData.DatasetFileInfos = fileInfos; + Teamcenter.Services.Loose.Core._2006_03.FileManagement.GetDatasetWriteTicketsInputData[] inputs = new Teamcenter.Services.Loose.Core._2006_03.FileManagement.GetDatasetWriteTicketsInputData[1]; + inputs[0] = inputData; + FileManagementUtility fMSFileManagement = new FileManagementUtility(Session.getConnection()); + ServiceData response = fMSFileManagement.PutFiles(inputs); + if (response.sizeOfPartialErrors() > 0) + ed1.WriteMessage("FileManagementService upload returned partial errors:" + response.sizeOfPartialErrors()); + ed1.WriteMessage("DateSet check in successful\n"); + ModelObject[] datasets = new ModelObject[1]; + datasets[0] = createdataset; + dmService.RefreshObjects(datasets); + + + //ˢbom + + if(bomlist.Count > 0) + { + DialogResult updateresult = MessageBox.Show("ǷˢBOM", "ʾ", MessageBoxButtons.YesNo, MessageBoxIcon.Question); + if (updateresult == DialogResult.No || updateresult == DialogResult.None) + { + ed1.WriteMessage("ˢBOM\n"); + } + else + { + CreateBomStructure(rev, createdataset, bomlist, folder); + } + } + + + this.savefrom.Hide(); + this.savefrom.Dispose(); + } + catch (ServiceException ex) + { + ed1.WriteMessage(ex.Message); + } + + + } + } + } + else + { + MessageBox.Show("ѡʵļУ"); + return; + } + + } + + + [CommandMethod("LOGOUT")] + public void layout() + { + DialogResult updateresult = MessageBox.Show("ȷѾļ棡ݶʧǷ񱣴棿", "ʾ", MessageBoxButtons.YesNo, MessageBoxIcon.Question); + if (updateresult == DialogResult.Yes) + { + savetotc(); + } + else + { + loginuser = null; + hadlogin = false; + } + + } + + [CommandMethod("UPDATE_FROM_TC")] + public void updateFromTc() + { + if (loginuser != null) + { + hadlogin = true; + } + else + login(); + if (hadlogin) + { + DataManagementService dmService = DataManagementService.getService(Session.getConnection()); + Editor ed1 = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; + OriginTool origintool = new OriginTool(); + + ed1.WriteMessage("\nʼȡϢ...\n"); + /************************************************************************/ + /* ȡݵĴ */ + /************************************************************************/ + ArrayList btllist = new ArrayList(); + OriginReadXml readxml = new OriginReadXml(); + btllist = readxml.OriginReadBTLXML(xmlpath); + + for (int i = 0; i < btllist.Count; i++) + { + OriginBTL onebtlinfo = (OriginBTL)btllist[i]; + ed1.WriteMessage("ƣ" + onebtlinfo.Btlname + "\n"); + ed1.WriteMessage("ϸϢ:" + "\n"); + foreach (DictionaryEntry de in onebtlinfo.Btldatatable) + { + ed1.WriteMessage("CAD" + de.Key + "\tCADֵ:" + de.Value + + "\tTC:" + onebtlinfo.Btltctable[de.Key] + + "\tTCϵͳ:" + onebtlinfo.Btltypetable[de.Key] + + "\tд" + onebtlinfo.Btlwritetable[de.Key] + + "\tͬ:"+onebtlinfo.Btlfromtctable[de.Key] +"\n"); + } + } + + for (int btli = 0; btli < btllist.Count; btli++) + { + OriginBTL btlinfo = (OriginBTL)btllist[btli]; + //item_idӦcadͼֽϢ + object key = origintool.getKeyFromValue(btlinfo.Btltctable, "item_id"); + if (key == null) + { + ed1.WriteMessage("ϵͳûҵitem_idӦͼֽϢϵͳж\n"); + return; + } + SavedQueryResults found = origintool.getSearchItem(btlinfo.Btldatatable[key].ToString()); + if (found != null && found.NumOfObjects > 0) + { + DialogResult upresult = MessageBox.Show("ҵӦItemǷͬ", "ʾ", MessageBoxButtons.YesNo, MessageBoxIcon.Question); + if (upresult == DialogResult.No || upresult == DialogResult.None) + { + ed1.WriteMessage("ͬ\n"); + return; + } + if (upresult == DialogResult.Yes) + { + for (int i = 0; i < found.NumOfObjects; i++) + { + Item item = found.Objects[i] as Item; + ModelObject[] objects = { item }; + String[] attributes = { "item_id", "object_name", "object_string" }; + dmService.RefreshObjects(objects); + dmService.GetProperties(objects, attributes); + string item_id = item.Item_id; + GetItemFromIdInfo tempitem = new GetItemFromIdInfo(); + tempitem.ItemId = item_id; + GetItemFromIdInfo[] infos = new GetItemFromIdInfo[1]; + infos[0] = tempitem; + GetItemFromIdPref pref = new GetItemFromIdPref(); + //Ҫµķʽ + GetItemFromIdResponse infoResp = dmService.GetItemFromId(infos, 1, pref); + + //׼дCADͼֽϵϢ + Hashtable tempvaluetable = new Hashtable(); + + //ȡItemϵ + if (btlinfo.Btltypetable.ContainsValue("Item")) + { + ed1.WriteMessage("ͬItem\n"); + + foreach (DictionaryEntry de in btlinfo.Btltypetable) + { + if (de.Value.ToString() == "Item" && btlinfo.Btlfromtctable[de.Key].ToString() == "1") + { + string cadstring = de.Key.ToString(); + string cadvalue = btlinfo.Btldatatable[cadstring].ToString(); + string tcstring = btlinfo.Btltctable[cadstring].ToString(); + + ed1.WriteMessage("ȡ" + tcstring + "\n"); + string[] props = new string[1]; + props[0] = tcstring; + ServiceData serviceData = dmService.GetProperties(objects, props); + if (serviceData.sizeOfPartialErrors() > 0) + { + continue; + } + Property my_prop = item.GetProperty(tcstring); + string tempcadvalue = my_prop.StringValue.ToString(); + ed1.WriteMessage("TCϵͳе" + tcstring + "ֵΪ " + tempcadvalue + "\n"); + if (cadvalue != tempcadvalue) + { + origintool.TableHasKey(tempvaluetable, cadstring, tempcadvalue); + } + } + } + } + + //ð汾ϵ + for (int j = 0; j < infoResp.Output.Length; j++) + { + ModelObject[] objects1 = { infoResp.Output[j].Item }; + String[] attributes1 = { "revision_list", "is_modifiable" }; + dmService.RefreshObjects(objects1); + dmService.GetProperties(objects1, attributes1); + ModelObject[] revlist = infoResp.Output[j].Item.Revision_list; + dmService.RefreshObjects(revlist); + ItemRevision itemRev = null; + string rev_id = ""; + for (int k = 0; k < revlist.Length; k++) + { + itemRev = revlist[k] as ItemRevision; + + } + if (itemRev == null) + { + ed1.WriteMessage("ItemûжӦ汾\n"); + return; + } + ModelObject[] objects2 = { itemRev }; + String[] attributes2 = { "item_revision_id", "is_modifiable" , + "checked_out","item_id","release_status_list", + "IMAN_master_form_rev"}; + dmService.RefreshObjects(objects2); + dmService.GetProperties(objects2, attributes2); + rev_id = itemRev.Item_revision_id; + + ReleaseStatus[] releaselist = itemRev.Release_status_list; + if (!itemRev.Is_modifiable) + { + MessageBox.Show("ItemRevisionΪֻ,ûбȨ!"); + return; + } + if (releaselist.Length > 0) + { + string message = "Item IDΪ" + itemRev.Item_id + "°汾ѷ"; + MessageBox.Show(message); + return; + } + + if (btlinfo.Btltypetable.ContainsValue("ItemRevision")) + { + ed1.WriteMessage("ͬItemRevision\n"); + + foreach (DictionaryEntry de in btlinfo.Btltypetable) + { + if (de.Value.ToString() == "ItemRevision" && btlinfo.Btlfromtctable[de.Key].ToString() == "1") + { + string cadstring = de.Key.ToString(); + string cadvalue = btlinfo.Btldatatable[cadstring].ToString(); + string tcstring = btlinfo.Btltctable[cadstring].ToString(); + + ed1.WriteMessage("ȡ" + tcstring + "\n"); + string[] props = new string[1]; + props[0] = tcstring; + ServiceData serviceData = dmService.GetProperties(objects2, props); + if (serviceData.sizeOfPartialErrors() > 0) + { + continue; + } + Property my_prop = itemRev.GetProperty(tcstring); + string tempcadvalue = my_prop.StringValue.ToString(); + ed1.WriteMessage("TCϵͳе" + tcstring + "ֵΪ " + tempcadvalue+"\n"); + if (cadvalue != tempcadvalue) + { + origintool.TableHasKey(tempvaluetable, cadstring, tempcadvalue); + } + } + } + } + + //ð汾ϵ + FormInfo forminfo = new FormInfo(); + FormInfo[] forminfo_vec = new FormInfo[1]; + ModelObject[] form_vec; + + form_vec = itemRev.IMAN_master_form_rev; + dmService.RefreshObjects(form_vec); + for (int k = 0; k < form_vec.Length; k++) + { + Form form = form_vec[k] as Form; + if (btlinfo.Btltypetable.ContainsValue("Form")) + { + ed1.WriteMessage("ͬItemRevision\n"); + + foreach (DictionaryEntry de in btlinfo.Btltypetable) + { + if (de.Value.ToString() == "Form" && btlinfo.Btlfromtctable[de.Key].ToString() == "1") + { + string cadstring = de.Key.ToString(); + string cadvalue = btlinfo.Btldatatable[cadstring].ToString(); + string tcstring = btlinfo.Btltctable[cadstring].ToString(); + + ed1.WriteMessage("ȡ" + tcstring + "\n"); + string[] props = new string[1]; + props[0] = tcstring; + ServiceData serviceData = dmService.GetProperties(form_vec, props); + if (serviceData.sizeOfPartialErrors() > 0) + { + continue; + } + Property my_prop = form.GetProperty(tcstring); + string tempcadvalue = my_prop.StringValue.ToString(); + ed1.WriteMessage("TCϵͳе" + tcstring + "ֵΪ " + tempcadvalue + "\n"); + if (cadvalue != tempcadvalue) + { + origintool.TableHasKey(tempvaluetable, cadstring, tempcadvalue); + } + } + } + } + } + } + + + //ѾҪͬռ + + foreach (DictionaryEntry de in tempvaluetable) + { + ed1.WriteMessage("CAD:"+de.Key.ToString()+"\tֵ:"+de.Value.ToString() +"\n"); + } + + //дCADͼֽ + origintool.SetTitleInfo(btlinfo.Btlname, tempvaluetable); + + } + } + } + } + + + + } + } + + + + public bool CreateBomStructure(ItemRevision parentRev, Dataset parent_ds, List bom_Vec, Folder folder) + { + + DataManagementService dmService = DataManagementService.getService(Session.getConnection()); + Reservation res = ReservationService.getService(Session.getConnection()); + Editor ed1 = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; + ed1.WriteMessage("bom_Vec size:" + bom_Vec.Count.ToString() + "\n"); + //͹ + OriginReadXml originreadxml = new OriginReadXml(); + OriginTypeRule origintyperule = originreadxml.OriginReadRuleXML(xmlpath); + + + ItemRevision[] revVec = new ItemRevision[bom_Vec.Count]; + ed1.WriteMessage("revVec size:" + revVec.Length.ToString() + "\n"); + for (int i = 0; i < bom_Vec.Count; i++) + { + OriginMXL it_bom = bom_Vec[i]; + OriginTool origintool = new OriginTool(); + if (origintool.getKeyFromValue(it_bom.Mxltctable, "item_id") == null) + { + ed1.WriteMessage("ϸûitem_id\n"); + return false; + } + string item_id = it_bom.Mxldatatable[origintool.getKeyFromValue(it_bom.Mxltctable,"item_id")].ToString(); + SavedQueryResults found = origintool.getSearchItem(item_id); + if (found.NumOfObjects == 0) + { + //ItemProperties[] item_vec; + //DatasetProperties[] dataset_vec; + ItemProperties oneItemProp = new ItemProperties(); + CreateItemsResponse itemResp = new CreateItemsResponse(); + + Teamcenter.Hello.DataManagement hellomanagement = new Teamcenter.Hello.DataManagement(); + + //Item + string tempitemtype = origintool.getItemType(it_bom, origintyperule); + ItemIdsAndInitialRevisionIds[] itemIds = hellomanagement.generateItemIds(1, tempitemtype); + GetItemCreationRelatedInfoResponse relatedResponse = dmService.GetItemCreationRelatedInfo(tempitemtype, null); + string[] formTypes = new string[relatedResponse.FormAttrs.Length]; + + for (int j = 0; j < relatedResponse.FormAttrs.Length; j++) + { + FormAttributesInfo attrInfo = relatedResponse.FormAttrs[j]; + formTypes[j] = attrInfo.FormType; + } + ItemProperties[] itemProps = new ItemProperties[itemIds.Length]; + ItemProperties itemProperty = new ItemProperties(); + for (int j = 0; j < itemIds.Length; j++) + { + ed1.WriteMessage("start Create form in cache!\n"); + ModelObject[] forms = hellomanagement.createForms(itemIds[j].NewItemId, + formTypes[0], itemIds[j].NewRevId, formTypes[1],null,false); + ed1.WriteMessage("Create form in cache sucessful!\n"); + ed1.WriteMessage("set item properties!\n"); + + itemProperty.ClientId = ""; + itemProperty.ItemId = item_id; + itemProperty.RevId = itemIds[j].NewRevId; + if (it_bom.Mxltctable.ContainsValue("object_name")) + itemProperty.Name = it_bom.Mxldatatable[origintool.getKeyFromValue(it_bom.Mxltctable, "object_name")].ToString(); + else + itemProperty.Name = ""; + itemProperty.Type = tempitemtype; + itemProperty.Description = ""; + itemProperty.Uom = "EA"; + + itemProps[j] = itemProperty; + } + try + { + ed1.WriteMessage("start item create!\n"); + if (folder == null) + itemResp = dmService.CreateItems(itemProps, null, ""); + else + itemResp = dmService.CreateItems(itemProps, folder, ""); + ed1.WriteMessage("create Items: " + item_id + "sucessful!\n"); + ItemRevision rev = null; + Item newitem = null; + for (int j = 0; j < itemResp.Output.Length;j++ ) + { + rev = itemResp.Output[j].ItemRev; + newitem = itemResp.Output[j].Item; + } + revVec[i] = rev; + + + //дform + FormInfo forminfo = new FormInfo(); + FormInfo[] forminfo_vec; + ModelObject[] form_vec = null; + + ModelObject[] objects = { rev }; + String[] attributes = { "IMAN_master_form_rev", + "is_modifiable","item_revision_id"}; + dmService.RefreshObjects(objects); + dmService.GetProperties(objects, attributes); + if (rev.Is_modifiable) + { + try + { + form_vec = rev.IMAN_master_form_rev; + ed1.WriteMessage("get_IMAN_master_form_rev sucessful!\n"); + } + catch (NotLoadedException ex) + { + ed1.WriteMessage(ex.Message); + } + forminfo_vec = new FormInfo[form_vec.Length]; + for (int j = 0; j < form_vec.Length; j++) + { + Form form = form_vec[j] as Form; + + Hashtable formAttrs = new Hashtable(); + + + //Formԣִ´ + if (it_bom.Mxltypetable.ContainsValue("Form")) + { + foreach (DictionaryEntry de in it_bom.Mxltypetable) + { + if (de.Value.ToString() == "Form" && it_bom.Mxlisbomtable[de.Key].ToString() == "0" && + it_bom.Mxlupdatetable[de.Key].ToString() == "1") + { + string cadstring = de.Key.ToString(); + string cadvalue = it_bom.Mxldatatable[cadstring].ToString(); + string tcstring = it_bom.Mxltctable[cadstring].ToString(); + + + string[] formAttrValue = new string[1]; + formAttrValue[0] = ""; + formAttrValue[0] = cadvalue; + formAttrs.Add(tcstring, formAttrValue); + } + } + } + + forminfo.AttributesMap = formAttrs; + forminfo.ClientId = "1"; + forminfo.Description = ""; + forminfo.FormObject = form; + forminfo.Name = item_id + "/" +rev.Item_revision_id; + forminfo.ParentObject = null; + forminfo.RelationName = "IMAN_master_form"; + forminfo.SaveDB = true; + forminfo.FormType = "ItemRevision Master"; + + forminfo_vec[j] = forminfo; + + try + { + CreateOrUpdateFormsResponse formResp + =dmService.CreateOrUpdateForms(forminfo_vec); + ed1.WriteMessage("update form attributes sucessful!\n"); + } + catch (ServiceException ex) + { + ed1.WriteMessage(ex.Message); + } + } + } + /*if (it_bom.Memo == "ͼ") + { + if (parent_ds != null) + { + ExpandGRMRelationsPref myPref = new ExpandGRMRelationsPref(); + RelationAndTypesFilter2 myFilter = new RelationAndTypesFilter2(); + myFilter.RelationName = "IMAN_reference"; + string[] typeVec = new string[1]; + typeVec[0] = "D5DWG"; + myFilter.ObjectTypeNames = typeVec; + myPref.ExpItemRev = false; + RelationAndTypesFilter2[] myFilterVec = { myFilter }; + myPref.Info = myFilterVec; + + + ModelObject[] primaryObjects = { rev }; + Teamcenter.Services.Strong.Core._2007_06.DataManagement.ExpandGRMRelationsResponse + myResp = dmService.ExpandGRMRelationsForPrimary(primaryObjects, myPref); + if (myResp.Output.Length > 0) + { + for (int k = 0; k < myResp.Output.Length; k++) + { + Teamcenter.Services.Strong.Core._2007_06.DataManagement.ExpandGRMRelationsOutput + grmOutput = myResp.Output[k]; + for (int l = 0; l < grmOutput.OtherSideObjData.Length; l++) + { + ExpandGRMRelationsData otherSideData = grmOutput.OtherSideObjData[l]; + if (otherSideData.OtherSideObjects.Length == 0) + { + Relationship[] rela_vec = new Relationship[1]; + Relationship one_rela = new Relationship(); + one_rela.ClientId = ""; + one_rela.PrimaryObject = rev; + one_rela.SecondaryObject = parent_ds; + one_rela.RelationType = "IMAN_reference"; + one_rela.UserData = null; + rela_vec[0] = one_rela; + CreateRelationsResponse reResp = + dmService.CreateRelations(rela_vec); + ed1.WriteMessage("create IMAN_reference sucessful!\n"); + } + } + } + } + } + }*/ + } + catch (ServiceException ex) + { + ed1.WriteMessage(ex.Message); + } + } + else//found + { + ItemRevision itemRev = null; + for (int j = 0; j < found.NumOfObjects; j++) + { + GetItemFromIdInfo[] infos = new GetItemFromIdInfo[1]; + GetItemFromIdInfo oneItem = new GetItemFromIdInfo(); + oneItem.ItemId = item_id; + infos[0] = oneItem; + GetItemFromIdPref pref = new GetItemFromIdPref(); + GetItemFromIdResponse infoResp = + dmService.GetItemFromId(infos, 1, pref); + for (int n = 0; n < infoResp.Output.Length; n++) + { + ModelObject[] objects = { infoResp.Output[n].Item }; + String[] attributes = { "revision_list", + "object_name","item_revision"}; + dmService.RefreshObjects(objects); + dmService.GetProperties(objects, attributes); + ModelObject[] revList = infoResp.Output[n].Item.Revision_list; + dmService.RefreshObjects(revList); + for (int l = 0; l < revList.Length; l++) + { + itemRev = revList[l] as ItemRevision; + } + } + } + revVec[i] = itemRev; + //дform + FormInfo forminfo = new FormInfo(); + FormInfo[] forminfo_vec = new FormInfo[1]; + ModelObject[] form_vec; + ModelObject[] objects1 = {itemRev }; + String[] attributes1 = { "IMAN_master_form_rev", + "is_modifiable","item_revision_id", + "date_released","item_id", + "release_status_list"}; + dmService.RefreshObjects(objects1); + dmService.GetProperties(objects1, attributes1); + + ReleaseStatus[] releaselist = itemRev.Release_status_list; + if (releaselist.Length > 0) + { + MessageBox.Show("Item IDΪ" + itemRev.Item_id + "°汾ѷ"); + continue; + } + if (!itemRev.Is_modifiable) + { + MessageBox.Show("ǰûItem IDΪ" + itemRev.Item_id + "Ȩ޸ĻItem°汾ѷ"); + continue; + } + else if (itemRev.Is_modifiable) + { + ed1.WriteMessage("is_modifiable!\n"); + + form_vec = itemRev.IMAN_master_form_rev; + ed1.WriteMessage("get_IMAN_master_form_rev sucessful!\n"); + + for (int j = 0; j < form_vec.Length; j++) + { + Form form = form_vec[j] as Form; + bool frash = false; + string[] props = new string[1]; + string revId = itemRev.Object_string; + Hashtable formAttrs = new Hashtable(); + + + //Formԣִ´ + if (it_bom.Mxltypetable.ContainsValue("Form")) + { + foreach (DictionaryEntry de in it_bom.Mxltypetable) + { + if (de.Value.ToString() == "Form" && it_bom.Mxlisbomtable[de.Key].ToString() == "0" && + it_bom.Mxlupdatetable[de.Key].ToString() == "1") + { + string cadstring = de.Key.ToString(); + string cadvalue = it_bom.Mxldatatable[cadstring].ToString(); + string tcstring = it_bom.Mxltctable[cadstring].ToString(); + + ed1.WriteMessage("ȡ" + tcstring + "\n"); + props[0] = tcstring; + ServiceData serviceData = dmService.GetProperties(form_vec, props); + if (serviceData.sizeOfPartialErrors() > 0) + { + continue; + } + Property my_prop = form_vec[j].GetProperty(tcstring); + if (cadvalue != my_prop.StringValue) + { + if (my_prop.StringValue == "") + frash = true; + else + { + string message = "ǰϸͼֽ:" + cadstring + "ֵ" + cadvalue + "ϵͳ:" + tcstring + "ֵ" + my_prop.StringValue + "һ,Ƿ񸲸ϵͳ?"; + DialogResult updateresult = MessageBox.Show(message, "ʾ", MessageBoxButtons.YesNo, MessageBoxIcon.Question); + if (updateresult == DialogResult.Yes) + { + frash = true; + } + } + string[] formAttrValue = new string[1]; + formAttrValue[0] = ""; + if (frash) + formAttrValue[0] = cadvalue; + else + formAttrValue[0] = my_prop.StringValue; + ed1.WriteMessage(tcstring + ":" + formAttrValue[0] + "\n"); + formAttrs.Add(tcstring, formAttrValue); + props[0] = ""; + } + + } + } + } + + forminfo.AttributesMap = formAttrs; + forminfo.ClientId = ""; + forminfo.Description = ""; + forminfo.FormObject = form; + forminfo.Name = item_id + "/" + itemRev.Item_revision_id; + forminfo.ParentObject = null; + forminfo.RelationName = "IMAN_master_form"; + forminfo.SaveDB = true; + forminfo.FormType = "ItemRevision Master"; + + forminfo_vec[0] = forminfo; + try + { + CreateOrUpdateFormsResponse formResp + = dmService.CreateOrUpdateForms(forminfo_vec); + } + catch (SoaException ex) + { + ed1.WriteMessage(ex.Message); + } + } + } + ////if (it_bom.Memo == "ͼ") + ////{ + //// if (parent_ds != null) + //// { + //// ExpandGRMRelationsPref myPref = new ExpandGRMRelationsPref(); + //// RelationAndTypesFilter2 myFilter = new RelationAndTypesFilter2(); + //// myFilter.RelationName = "IMAN_reference"; + //// string[] typeVec = new string[1]; + //// typeVec[0] = "D5DWG"; + //// myFilter.ObjectTypeNames = typeVec; + //// myPref.ExpItemRev = false; + //// RelationAndTypesFilter2[] myFilterVec = { myFilter }; + //// myPref.Info = myFilterVec; + + + //// ModelObject[] primaryObjects = { itemRev }; + //// Teamcenter.Services.Strong.Core._2007_06.DataManagement.ExpandGRMRelationsResponse + //// myResp = dmService.ExpandGRMRelationsForPrimary(primaryObjects, myPref); + //// if (myResp.Output.Length > 0) + //// { + //// for (int k = 0; k < myResp.Output.Length; k++) + //// { + //// Teamcenter.Services.Strong.Core._2007_06.DataManagement.ExpandGRMRelationsOutput + //// grmOutput = myResp.Output[k]; + //// for (int l = 0; l < grmOutput.OtherSideObjData.Length; l++) + //// { + //// ExpandGRMRelationsData otherSideData = grmOutput.OtherSideObjData[l]; + //// if (otherSideData.OtherSideObjects.Length == 0) + //// { + //// Relationship[] rela_vec = new Relationship[1]; + //// Relationship one_rela = new Relationship(); + //// one_rela.ClientId = ""; + //// one_rela.PrimaryObject = itemRev; + //// one_rela.SecondaryObject = parent_ds; + //// one_rela.RelationType = "IMAN_reference"; + //// one_rela.UserData = null; + //// rela_vec[0] = one_rela; + //// CreateRelationsResponse reResp = + //// dmService.CreateRelations(rela_vec); + //// ed1.WriteMessage("create IMAN_reference sucessful!\n"); + //// } + //// } + //// } + //// } + //// } + ////} + } + }//for + //BOM + Teamcenter.Services.Strong.Cad.StructureManagementService ssService = + Teamcenter.Services.Strong.Cad.StructureManagementService.getService(Session.getConnection()); + Teamcenter.Services.Strong.Cad._2007_12.StructureManagement.CreateOrUpdateRelativeStructureInfo2 + structInfo = new Teamcenter.Services.Strong.Cad._2007_12.StructureManagement.CreateOrUpdateRelativeStructureInfo2(); + + Teamcenter.Services.Strong.Cad._2007_12.StructureManagement.CreateOrUpdateRelativeStructureInfo2[] + structInfoVec = new Teamcenter.Services.Strong.Cad._2007_12.StructureManagement.CreateOrUpdateRelativeStructureInfo2[1]; + + //Teamcenter.Services.Strong.Cad._2007_01.StructureManagement.RelativeStructureChildInfo + // childInfo = new Teamcenter.Services.Strong.Cad._2007_01.StructureManagement.RelativeStructureChildInfo(); + + Teamcenter.Services.Strong.Cad._2007_01.StructureManagement.RelativeStructureChildInfo[] + childInfoVec; + + //Teamcenter.Services.Strong.Cad._2007_01.StructureManagement.RelOccInfo + // occInfo = new Teamcenter.Services.Strong.Cad._2007_01.StructureManagement.RelOccInfo(); + + //Teamcenter.Services.Strong.Cad._2007_01.StructureManagement.AttributesInfo + // attrsInfo = new Teamcenter.Services.Strong.Cad._2007_01.StructureManagement.AttributesInfo(); + + + Teamcenter.Services.Strong.Cad._2007_12.StructureManagement.CreateOrUpdateRelativeStructurePref2 + sPref = new Teamcenter.Services.Strong.Cad._2007_12.StructureManagement.CreateOrUpdateRelativeStructurePref2(); + + //ItemRevision childRev; + ed1.WriteMessage("ʼ׼pse\n"); + childInfoVec = new Teamcenter.Services.Strong.Cad._2007_01.StructureManagement.RelativeStructureChildInfo[revVec.Length]; + ed1.WriteMessage("childInfoVec size:"+childInfoVec.Length+"\n"); + Teamcenter.Services.Strong.Cad._2007_01.StructureManagement.AttributesInfo[] + attrsToSet = new Teamcenter.Services.Strong.Cad._2007_01.StructureManagement.AttributesInfo[4]; + for (int i = 0; i < revVec.Length; i++) + { + OriginMXL bomv = bom_Vec[i]; + OriginTool origintool = new OriginTool(); + string item_id = bomv.Mxldatatable[origintool.getKeyFromValue(bomv.Mxltctable, "item_id")].ToString(); + ed1.WriteMessage("" + item_id + "...\n"); + int updatenum = 0; + if (bomv.Mxltypetable.ContainsValue("bomline")) + { + foreach (DictionaryEntry de in bomv.Mxltypetable) + { + if (de.Value.ToString() == "bomline" && bomv.Mxlisbomtable[de.Key].ToString() == "1" && bomv.Mxlupdatetable[de.Key].ToString() =="1") + { + updatenum = updatenum + 1; + } + } + + } + + Teamcenter.Services.Strong.Cad._2007_01.StructureManagement.RelativeStructureChildInfo + childInfo = new Teamcenter.Services.Strong.Cad._2007_01.StructureManagement.RelativeStructureChildInfo(); + Teamcenter.Services.Strong.Cad._2007_01.StructureManagement.RelOccInfo + occInfo = new Teamcenter.Services.Strong.Cad._2007_01.StructureManagement.RelOccInfo(); + attrsToSet = new Teamcenter.Services.Strong.Cad._2007_01.StructureManagement.AttributesInfo[updatenum]; + + + + if (bomv.Mxltypetable.ContainsValue("bomline")) + { + int stepnum = 0; + foreach (DictionaryEntry de in bomv.Mxltypetable) + { + if (de.Value.ToString() == "bomline" && bomv.Mxlisbomtable[de.Key].ToString() == "1" && + bomv.Mxlupdatetable[de.Key].ToString() == "1") + { + string cadstring = de.Key.ToString(); + string cadvalue = bomv.Mxldatatable[cadstring].ToString(); + string tcstring = bomv.Mxltctable[cadstring].ToString(); + Teamcenter.Services.Strong.Cad._2007_01.StructureManagement.AttributesInfo + attrsInfo = new Teamcenter.Services.Strong.Cad._2007_01.StructureManagement.AttributesInfo(); + attrsInfo.Name = tcstring; + attrsInfo.Value = cadvalue; + attrsToSet[stepnum] = attrsInfo; + stepnum = stepnum + 1; + } + } + } + + occInfo.AttrsToSet = attrsToSet; + + childInfo.Child = revVec[i]; + childInfo.OccInfo = occInfo; + + childInfoVec[i] = childInfo; + + } + for (int j = 0; j < childInfoVec.Length; j++) + { + for(int k=0;k 0) + { + ed1.WriteMessage("checkout bom returned a partial error."); + return false; + } + } + } + catch (ServiceException ex) + { + ed1.WriteMessage(ex.Message); + } + + ed1.WriteMessage("ʼBom\n"); + try + { + Teamcenter.Services.Strong.Cad._2007_01.StructureManagement.CreateOrUpdateRelativeStructureResponse + cursResp = ssService.CreateOrUpdateRelativeStructure(structInfoVec, "view", true, sPref); + ed1.WriteMessage("Bomɹ\n"); + } + catch (System.Exception ex) + { + ed1.WriteMessage(ex.Message); + return false; + } + + if (bvr != null) + { + ModelObject[] checkIn_vec = new ModelObject[1]; + checkIn_vec[0] = bvr; + try + { + res.Checkin(checkIn_vec); + ed1.WriteMessage("Bomview ǩɹ!\n"); + } + catch (ServiceException ex) + { + ed1.WriteMessage(ex.Message); + } + } + return true; + } + + private void loginbuttonclick(object Sender,EventArgs e) + { + login(); + } + + private void openbuttonclick(object Sender, EventArgs e) + { + openformtc(); + } + + private void savebuttonclick(object Sender, EventArgs e) + { + savetotc(); + } + + private void logoutbuttonclick(object Sender, EventArgs e) + { + layout(); + } + + + //private void addComtextMenu() + //{ + // ContextMenuExtension m_contextmenu = new ContextMenuExtension(); + // m_contextmenu.Title = "MyTeamCenter"; + // Autodesk.AutoCAD.Windows.MenuItem mi = new Autodesk.AutoCAD.Windows.MenuItem("¼"); + // Autodesk.AutoCAD.Windows.MenuItem mi1 = new Autodesk.AutoCAD.Windows.MenuItem(""); + // Autodesk.AutoCAD.Windows.MenuItem mi2 = new Autodesk.AutoCAD.Windows.MenuItem(""); + // Autodesk.AutoCAD.Windows.MenuItem mi3 = new Autodesk.AutoCAD.Windows.MenuItem("˳"); + + // mi.Click += new EventHandler (loginbuttonclick); + // mi1.Click += new EventHandler(openbuttonclick); + // mi2.Click += new EventHandler(savebuttonclick); + // mi3.Click += new EventHandler(logoutbuttonclick); + + + // m_contextmenu.MenuItems.Add(mi); + // m_contextmenu.MenuItems.Add(mi1); + // m_contextmenu.MenuItems.Add(mi2); + // m_contextmenu.MenuItems.Add(mi3); + + // Autodesk.AutoCAD.ApplicationServices.Application.AddDefaultContextMenuExtension(m_contextmenu); + //} + + ////˳ʱ + //public void acdocmgr_DocumentToBeDestroyed(object sender, DocumentCollectionEventArgs e) + //{ + // DialogResult updateresult = MessageBox.Show("ȷѾļ棡ݶʧǷ񱣴棿", "ʾ", MessageBoxButtons.YesNo, MessageBoxIcon.Question); + // if (updateresult == DialogResult.Yes) + // { + // savetotc(); + // } + // else + // { + // loginuser = null; + // hadlogin = false; + // } + //} + + } +} \ No newline at end of file diff --git a/Backup1/hello/HomeFolder.cs b/Backup1/hello/HomeFolder.cs new file mode 100644 index 0000000..d597ace --- /dev/null +++ b/Backup1/hello/HomeFolder.cs @@ -0,0 +1,79 @@ +//================================================== +// +// @@ +// +//================================================== + +using System; + +using Teamcenter.ClientX; +using Teamcenter.Services.Strong.Core; +using Teamcenter.Soa.Client.Model; +using Teamcenter.Soa.Exceptions; + +using User = Teamcenter.Soa.Client.Model.Strong.User; +using Folder = Teamcenter.Soa.Client.Model.Strong.Folder; +using WorkspaceObject = Teamcenter.Soa.Client.Model.Strong.WorkspaceObject; + +namespace Teamcenter.Hello +{ +public class HomeFolder +{ + + /** + * List the contents of the Home folder. + * + */ + public void listHomeFolder(User user) + { + Folder home = null; + WorkspaceObject[] contents = null; + + // Get the service stub + DataManagementService dmService = DataManagementService.getService(Session.getConnection()); + + try + { + // User was a primary object returned from the login command + // the Object Property Policy should be configured to include the + // 'home_folder' property. However the actuall 'home_folder' object + // was a secondary object returned from the login request and + // therefore does not have any properties associated with it. We will need to + // get those properties explicitly with a 'getProperties' service request. + home = user.Home_folder; + } + catch (NotLoadedException e) + { + Console.Out.WriteLine(e.Message); + Console.Out.WriteLine("The Object Property Policy ($TC_DATA/soa/policies/Default.xml) is not configured with this property."); + return; + } + + try + { + ModelObject[] objects = { home }; + String[] attributes = { "contents" }; + + // ***************************** + // Execute the service operation + // ***************************** + dmService.GetProperties(objects, attributes); + + + // The above getProperties call returns a ServiceData object, but it + // just has pointers to the same object we passed into the method, so the + // input object have been updated with new property values + contents = home.Contents; + } + // This should never be thrown, since we just explicitly asked for this + // property + catch (NotLoadedException /*e*/){} + + Console.Out.WriteLine(""); + Console.Out.WriteLine("Home Folder:"); + Session.printObjects( contents ); + + } + +} +} diff --git a/Backup1/hello/MXLClass.cs b/Backup1/hello/MXLClass.cs new file mode 100644 index 0000000..ae2cd73 --- /dev/null +++ b/Backup1/hello/MXLClass.cs @@ -0,0 +1,101 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace HelloTeamcenter.hello +{ + public class MXLClass + { + private string index; + + public string Index + { + get { return index; } + set { index = value; } + } + private string item_id; + + public string Item_id + { + get { return item_id; } + set { item_id = value; } + } + private string partnumber; + + public string Partnumber + { + get { return partnumber; } + set { partnumber = value; } + } + private string name; + + public string Name + { + get { return name; } + set { name = value; } + } + private string object_desc; + + public string Object_desc + { + get { return object_desc; } + set { object_desc = value; } + } + private string count; + + public string Count + { + get { return count; } + set { count = value; } + } + private string material; + + public string Material + { + get { return material; } + set { material = value; } + } + private string tolweight; + + public string Tolweight + { + get { return tolweight; } + set { tolweight = value; } + } + private string perweight; + + public string Perweight + { + get { return perweight; } + set { perweight = value; } + } + private string memo; + + public string Memo + { + get { return memo; } + set { memo = value; } + } + private string itemtype; + + public string Itemtype + { + get { return itemtype; } + set { itemtype = value; } + } + private int index_num; + + public int Index_num + { + get { return index_num; } + set { index_num = value; } + } + private string producttype; + + public string Producttype + { + get { return producttype; } + set { producttype = value; } + } + } +} diff --git a/Backup1/hello/MyExtension.cs b/Backup1/hello/MyExtension.cs new file mode 100644 index 0000000..3192bed --- /dev/null +++ b/Backup1/hello/MyExtension.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Text; + +using Autodesk.AutoCAD.DatabaseServices; +using Autodesk.AutoCAD.Runtime; +using Autodesk.AutoCAD.Geometry; +using Autodesk.AutoCAD.ApplicationServices; +using Autodesk.AutoCAD.EditorInput; +using Autodesk.AutoCAD.Windows; + +namespace HelloTeamcenter.hello +{ + class MyExtension:Autodesk.AutoCAD.Runtime.IExtensionApplication + { + public void Initialize() + { + + } + public void Terminate() + { + + } + } +} diff --git a/Backup1/hello/OriginBTL.cs b/Backup1/hello/OriginBTL.cs new file mode 100644 index 0000000..719c16c --- /dev/null +++ b/Backup1/hello/OriginBTL.cs @@ -0,0 +1,87 @@ +using System; +using System.Collections.Generic; +using System.Collections; +using System.Text; + +namespace HelloTeamcenter.hello +{ + public class OriginBTL + { + private Hashtable btlinfotable = null; // 块参照上所有信息 + + public Hashtable Btlinfotable + { + get { return btlinfotable; } + set { btlinfotable = value; } + } + + + public OriginBTL() + { + this.btlname = ""; + this.btlinfotable = new Hashtable(); + this.btldatatable = new Hashtable(); + this.btltctable = new Hashtable(); + this.btltypetable = new Hashtable(); + this.btlwritetable = new Hashtable(); + this.Btlupdatetable = new Hashtable(); + this.Btlfromtctable = new Hashtable(); + } + + private string btlname; //标题栏块参照名 + + public string Btlname + { + get { return btlname; } + set { btlname = value; } + } + private Hashtable btldatatable = null; // + + public Hashtable Btldatatable + { + get { return btldatatable; } + set { btldatatable = value; } + } + private Hashtable btltctable = null; // + + public Hashtable Btltctable + { + get { return btltctable; } + set { btltctable = value; } + } + private Hashtable btltypetable = null; // + + public Hashtable Btltypetable + { + get { return btltypetable; } + set { btltypetable = value; } + } + + private Hashtable btlwritetable = null; // + + public Hashtable Btlwritetable + { + get { return btlwritetable; } + set { btlwritetable = value; } + } + + + private Hashtable btlupdatetable = null; // + + public Hashtable Btlupdatetable + { + get { return btlupdatetable; } + set { btlupdatetable = value; } + } + + private Hashtable btlfromtctable = null; // + + public Hashtable Btlfromtctable + { + get { return btlfromtctable; } + set { btlfromtctable = value; } + } + + + } +} diff --git a/Backup1/hello/OriginDataSet.cs b/Backup1/hello/OriginDataSet.cs new file mode 100644 index 0000000..155e3eb --- /dev/null +++ b/Backup1/hello/OriginDataSet.cs @@ -0,0 +1,58 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.Collections; + +namespace HelloTeamcenter.hello +{ + class OriginDataSet + { + private string datatype = null; + + public string Datatype + { + get { return datatype; } + set { datatype = value; } + } + private string refname = null; + + public string Refname + { + get { return refname; } + set { refname = value; } + } + private string separator = null; + + public string Separator + { + get { return separator; } + set { separator = value; } + } + private string ds_name = null; + + public string Ds_name + { + get { return ds_name; } + set { ds_name = value; } + } + + public OriginDataSet() + { + this.datatype = ""; + this.refname = ""; + this.separator = ""; + this.ds_name = ""; + this.dsnametable = new Hashtable(); + } + + private Hashtable dsnametable = null; + + public Hashtable Dsnametable + { + get { return dsnametable; } + set { dsnametable = value; } + } + + + } +} diff --git a/Backup1/hello/OriginItemType.cs b/Backup1/hello/OriginItemType.cs new file mode 100644 index 0000000..90f110e --- /dev/null +++ b/Backup1/hello/OriginItemType.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.Collections; + +namespace HelloTeamcenter.hello +{ + class OriginItemType + { + private Hashtable itemtypetable = null; //记录Item类型.xml文件的信息 + + public Hashtable Itemtypetable + { + get { return itemtypetable; } + set { itemtypetable = value; } + } + + public OriginItemType() + { + itemtypetable = new Hashtable(); + } + + public void getType(string xmlpath) + { + OriginReadXml originreadxml = new OriginReadXml(); + itemtypetable = originreadxml.OriginReadTypeXML(xmlpath, itemtypetable); + } + + } +} diff --git a/Backup1/hello/OriginMXL.cs b/Backup1/hello/OriginMXL.cs new file mode 100644 index 0000000..9ac3f02 --- /dev/null +++ b/Backup1/hello/OriginMXL.cs @@ -0,0 +1,77 @@ +using System; +using System.Collections.Generic; +using System.Collections; +using System.Text; + + +namespace HelloTeamcenter.hello +{ + public class OriginMXL + { + + public OriginMXL() + { + this.mxlname = ""; + this.Mxlinfotable = new Hashtable(); + this.Mxldatatable = new Hashtable(); + this.Mxltctable = new Hashtable(); + this.Mxlisbomtable = new Hashtable(); + this.Mxlupdatetable = new Hashtable(); + this.Mxltypetable = new Hashtable(); + } + + + private string mxlname; //明细栏块参照名 + + public string Mxlname + { + get { return mxlname; } + set { mxlname = value; } + } + + private Hashtable mxlinfotable = null; //块参照上所有信息 + + public Hashtable Mxlinfotable + { + get { return mxlinfotable; } + set { mxlinfotable = value; } + } + + private Hashtable mxldatatable = null; // + + public Hashtable Mxldatatable + { + get { return mxldatatable; } + set { mxldatatable = value; } + } + private Hashtable mxltctable = null; // + + public Hashtable Mxltctable + { + get { return mxltctable; } + set { mxltctable = value; } + } + private Hashtable mxlisbomtable = null; // + + public Hashtable Mxlisbomtable + { + get { return mxlisbomtable; } + set { mxlisbomtable = value; } + } + private Hashtable mxlupdatetable = null;// + + public Hashtable Mxlupdatetable + { + get { return mxlupdatetable; } + set { mxlupdatetable = value; } + } + + private Hashtable mxltypetable = null; // + + public Hashtable Mxltypetable + { + get { return mxltypetable; } + set { mxltypetable = value; } + } + } +} diff --git a/Backup1/hello/OriginReadXml.cs b/Backup1/hello/OriginReadXml.cs new file mode 100644 index 0000000..b5456ed --- /dev/null +++ b/Backup1/hello/OriginReadXml.cs @@ -0,0 +1,622 @@ +using System; +using System.Collections.Generic; +using System.Collections; +using System.Text; +using System.Xml; + + +using Autodesk.AutoCAD.DatabaseServices; +using Autodesk.AutoCAD.Runtime; +using Autodesk.AutoCAD.Geometry; +using Autodesk.AutoCAD.ApplicationServices; +using Autodesk.AutoCAD.EditorInput; + + + +namespace HelloTeamcenter.hello +{ + class OriginReadXml + { + private Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; + + + + public OriginBTL OriginReadBTL(string filepath,string btlname) + { + OriginBTL btlinfo = new OriginBTL(); + XmlReaderSettings settings = null; + XmlDocument xmldocument = null; + XmlReader xmlreader = null; + try + { + ed.WriteMessage("XML路径:" + filepath + "\n"); + + settings = new XmlReaderSettings(); + settings.IgnoreComments = true; ;//忽略文档里面的注释 + xmldocument = new XmlDocument(); + xmlreader = XmlReader.Create(filepath, settings); + xmldocument.Load(xmlreader); + //得到根节点的子节点title + XmlNodeList xmltitlelist = xmldocument.SelectSingleNode("Titles").ChildNodes; + + OriginTool origintool = new OriginTool(); + + + foreach (XmlNode title in xmltitlelist) + { + //获得一个title + XmlElement xeonetitle = (XmlElement)title; + + if (xeonetitle.HasAttribute("blockname")) + { + ed.WriteMessage("标题栏块名称:" + xeonetitle.GetAttribute("blockname").ToString() + "\n"); + } + else + { + ed.WriteMessage("请确认标题栏.xml文件配置含有blockname属性\n"); + return null; + } + string tempbtlname = xeonetitle.GetAttribute("blockname").ToString(); + ed.WriteMessage("标题栏块名称:" + tempbtlname + "\n"); + + if (tempbtlname == btlname) + { + //获得title子节点 + XmlNodeList onetitleinfo = xeonetitle.ChildNodes; + + btlinfo.Btlname = btlname; + foreach (XmlNode node in onetitleinfo) + { + XmlElement xeone = (XmlElement)node; + string titletype = ""; + string titlecad = ""; + string titletc = ""; + string titlewriteable = ""; + string titleupdateable = ""; + string titlefromtc = ""; + if (xeone.HasAttribute("type")) + { + titletype = xeone.GetAttribute("type").ToString(); + } + if (xeone.HasAttribute("cad")) + { + titlecad = xeone.GetAttribute("cad").ToString(); + } + if (xeone.HasAttribute("tc")) + { + titletc = xeone.GetAttribute("tc").ToString(); + } + if (xeone.HasAttribute("writeable")) + { + titlewriteable = xeone.GetAttribute("writeable").ToString(); + } + if (xeone.HasAttribute("updateable")) + { + titleupdateable = xeone.GetAttribute("updateable").ToString(); + } + if (xeone.HasAttribute("fromtc")) + { + titlefromtc = xeone.GetAttribute("fromtc").ToString(); + } + /*ed.WriteMessage(xeone.GetAttribute("type").ToString() + " " + + xeone.GetAttribute("cad").ToString() + " " + + xeone.GetAttribute("tc").ToString() +"\n");*/ + + btlinfo.Btldatatable = origintool.TableHasKey(btlinfo.Btldatatable, titlecad, ""); + btlinfo.Btltctable = origintool.TableHasKey(btlinfo.Btltctable, titlecad, titletc); + btlinfo.Btltypetable = origintool.TableHasKey(btlinfo.Btltypetable, titlecad, titletype); + btlinfo.Btlwritetable = origintool.TableHasKey(btlinfo.Btlwritetable, titlecad, titlewriteable); + btlinfo.Btlupdatetable = origintool.TableHasKey(btlinfo.Btlupdatetable, titlecad, titleupdateable); + btlinfo.Btlfromtctable = origintool.TableHasKey(btlinfo.Btlfromtctable,titlecad,titlefromtc); + } + } + + + } + + } + catch (System.Exception ex) + { + xmlreader.Close(); + ed.WriteMessage(ex.Message + "\n"); + } + finally + { + xmlreader.Close(); + } + return btlinfo; + } + + + //获取标题栏.XML信息,将信息与OriginBTL对应 + public ArrayList OriginReadBTLXML(string filepath) + { + ArrayList listbtl = new ArrayList(); + XmlReaderSettings settings = null; + XmlDocument xmldocument = null; + XmlReader xmlreader = null; + filepath = filepath + "标题栏.xml"; + try + { + ed.WriteMessage("XML路径:" + filepath + "\n"); + + settings = new XmlReaderSettings(); + settings.IgnoreComments = true; ;//忽略文档里面的注释 + xmldocument = new XmlDocument(); + xmlreader = XmlReader.Create(filepath, settings); + xmldocument.Load(xmlreader); + //得到根节点的子节点title + XmlNodeList xmltitlelist = xmldocument.SelectSingleNode("Titles").ChildNodes; + + OriginTool origintool = new OriginTool(); + + + foreach (XmlNode title in xmltitlelist) + { + //获得一个title + XmlElement xeonetitle = (XmlElement)title; + + if (xeonetitle.HasAttribute("blockname")) + { + ed.WriteMessage("标题栏块名称:" + xeonetitle.GetAttribute("blockname").ToString() + "\n"); + } + else + { + ed.WriteMessage("请确认标题栏.xml文件配置含有blockname属性\n"); + return listbtl; + } + string btlname = xeonetitle.GetAttribute("blockname").ToString(); + ed.WriteMessage("标题栏块名称:" + btlname + "\n"); + + OriginBTL btlinfo = origintool.GetTitleInfo(filepath, btlname); + if (btlinfo != null) + listbtl.Add(btlinfo); + } + + } + catch (System.Exception ex) + { + xmlreader.Close(); + ed.WriteMessage(ex.Message+"\n"); + } + finally + { + xmlreader.Close(); + } + + return listbtl; + + } + + + public OriginMXL OriginReadMXL(string filepath) + { + OriginMXL mxlinfo = new OriginMXL(); + XmlReaderSettings settings = null; + XmlDocument xmldocument = null; + XmlReader xmlreader = null; + try + { + ed.WriteMessage("XML路径:" + filepath + "\n"); + + settings = new XmlReaderSettings(); + settings.IgnoreComments = true; ;//忽略文档里面的注释 + xmldocument = new XmlDocument(); + xmlreader = XmlReader.Create(filepath, settings); + xmldocument.Load(xmlreader); + //得到根节点的子节点bomline + XmlNodeList xmlmxllist = xmldocument.SelectSingleNode("BomLines").ChildNodes; + + OriginTool origintool = new OriginTool(); + + + foreach (XmlNode bomline in xmlmxllist) + { + //获得一个bomline + XmlElement xeonebomline = (XmlElement)bomline; + if (xeonebomline.HasAttribute("blockname")) + { + ed.WriteMessage("明细栏块名称:" + xeonebomline.GetAttribute("blockname").ToString() + "\n"); + } + else + { + ed.WriteMessage("请确认明细表.xml文件配置含有blockname属性\n"); + return null; + } + //获得bomline子节点 + XmlNodeList onebomlineinfo = xeonebomline.ChildNodes; + + mxlinfo.Mxlname = xeonebomline.GetAttribute("blockname").ToString(); + foreach (XmlNode node in onebomlineinfo) + { + XmlElement xeone = (XmlElement)node; + + /*ed.WriteMessage(xeone.GetAttribute("cad").ToString() + " " + + xeone.GetAttribute("tc").ToString() + " " + + xeone.GetAttribute("is_bomline").ToString() + " " + + xeone.GetAttribute("overwrite").ToString() + "\n");*/ + string bomlinetype = ""; + string bomlinecad = ""; + string bomlinetc = ""; + string isbomline = ""; + string updatebomline = ""; + + if (xeone.HasAttribute("type")) + { + bomlinetype = xeone.GetAttribute("type").ToString(); + } + if (xeone.HasAttribute("cad")) + { + bomlinecad = xeone.GetAttribute("cad").ToString(); + } + if (xeone.HasAttribute("tc")) + { + bomlinetc = xeone.GetAttribute("tc").ToString(); + } + if (xeone.HasAttribute("is_bomline")) + { + isbomline = xeone.GetAttribute("is_bomline").ToString(); + } + if (xeone.HasAttribute("overwrite")) + { + updatebomline = xeone.GetAttribute("overwrite").ToString(); + } + mxlinfo.Mxltypetable = origintool.TableHasKey(mxlinfo.Mxltypetable, bomlinecad, bomlinetype); + mxlinfo.Mxldatatable = origintool.TableHasKey(mxlinfo.Mxldatatable, bomlinecad, ""); + mxlinfo.Mxltctable = origintool.TableHasKey(mxlinfo.Mxltctable, bomlinecad, bomlinetc); + mxlinfo.Mxlisbomtable = origintool.TableHasKey(mxlinfo.Mxlisbomtable, bomlinecad, isbomline); + mxlinfo.Mxlupdatetable = origintool.TableHasKey(mxlinfo.Mxlupdatetable, bomlinecad, updatebomline); + + ed.WriteMessage("==================================\n"); + } + } + + } + catch (System.Exception ex) + { + xmlreader.Close(); + ed.WriteMessage(ex.Message + "\n"); + } + finally + { + xmlreader.Close(); + } + return mxlinfo; + } + + + + //获取明细表.XML信息,将信息与OriginMXL对应 + public List OriginReadMXLXML(string filepath) + { + List listmxl = new List(); + XmlReaderSettings settings = null; + XmlDocument xmldocument = null; + XmlReader xmlreader = null; + filepath = filepath + "明细表.xml"; + try + { + ed.WriteMessage("XML路径:" + filepath + "\n"); + + settings = new XmlReaderSettings(); + settings.IgnoreComments = true; ;//忽略文档里面的注释 + xmldocument = new XmlDocument(); + xmlreader = XmlReader.Create(filepath, settings); + xmldocument.Load(xmlreader); + //得到根节点的子节点bomline + XmlNodeList xmlmxllist = xmldocument.SelectSingleNode("BomLines").ChildNodes; + + OriginTool origintool = new OriginTool(); + string mxlname = ""; + + foreach (XmlNode bomline in xmlmxllist) + { + //获得一个bomline + XmlElement xeonebomline = (XmlElement)bomline; + if (xeonebomline.HasAttribute("blockname")) + { + ed.WriteMessage("明细栏块名称:" + xeonebomline.GetAttribute("blockname").ToString() + "\n"); + mxlname = xeonebomline.GetAttribute("blockname").ToString(); + } + else + { + ed.WriteMessage("请确认明细表.xml文件配置含有blockname属性\n"); + return null; + } + } + + listmxl = origintool.GetMXLInfo(filepath, mxlname); + + + } + catch (System.Exception ex) + { + xmlreader.Close(); + ed.WriteMessage(ex.Message + "\n"); + } + finally + { + xmlreader.Close(); + } + + return listmxl; + } + + + + //获取Item类型.xml文件信息 + public Hashtable OriginReadTypeXML(string filepath,Hashtable itemtypetable) + { + + XmlReaderSettings settings = null; + XmlDocument xmldocument = null; + XmlReader xmlreader = null; + filepath = filepath + "Item类型.xml"; + try + { + ed.WriteMessage("XML路径:" + filepath + "\n"); + + settings = new XmlReaderSettings(); + settings.IgnoreComments = true; ;//忽略文档里面的注释 + xmldocument = new XmlDocument(); + xmlreader = XmlReader.Create(filepath, settings); + xmldocument.Load(xmlreader); + //得到根节点的子节点ItemTypes + XmlNodeList xmltypelist = xmldocument.SelectSingleNode("ItemTypes").ChildNodes; + + OriginTool origintool = new OriginTool(); + + + foreach (XmlNode onetype in xmltypelist) + { + //获得一个ItemType + XmlElement xeonetype = (XmlElement)onetype; + //获得ItemType子节点 + XmlNodeList onetypeinfo = xeonetype.ChildNodes; + foreach (XmlNode node in onetypeinfo) + { + XmlElement xeone = (XmlElement)node; + //string typecad = ""; + string typetc = ""; + + //if (xeone.HasAttribute("cad")) + //{ + // typecad = xeone.GetAttribute("cad").ToString(); + //} + //else + // ed.WriteMessage("Item类型.xml文件配置不符合规范\n"); + if (xeone.HasAttribute("tc")) + { + typetc = xeone.GetAttribute("tc").ToString(); + } + else + ed.WriteMessage("Item类型.xml文件配置不符合规范\n"); + /*ed.WriteMessage(xeone.GetAttribute("type").ToString() + " " + + xeone.GetAttribute("cad").ToString() + " " + + xeone.GetAttribute("tc").ToString() +"\n");*/ + itemtypetable = origintool.TableHasKey(itemtypetable, typetc, typetc); + } + } + + } + catch (System.Exception ex) + { + xmlreader.Close(); + ed.WriteMessage(ex.Message + "\n"); + } + finally + { + xmlreader.Close(); + } + + return itemtypetable; + } + + + //获取Item类型.xml文件信息 + public OriginDataSet OriginReadDataSetXML(string filepath) + { + OriginDataSet dataset = new OriginDataSet(); + XmlReaderSettings settings = null; + XmlDocument xmldocument = null; + XmlReader xmlreader = null; + filepath = filepath + "数据集.xml"; + try + { + ed.WriteMessage("XML路径:" + filepath + "\n"); + + settings = new XmlReaderSettings(); + settings.IgnoreComments = true; ;//忽略文档里面的注释 + xmldocument = new XmlDocument(); + xmlreader = XmlReader.Create(filepath, settings); + xmldocument.Load(xmlreader); + //得到根节点的子节点ItemTypes + XmlNodeList xmldatalist = xmldocument.SelectSingleNode("DataSets").ChildNodes; + + OriginTool origintool = new OriginTool(); + + + foreach (XmlNode onedata in xmldatalist) + { + //获得一个data + XmlElement xeonedata = (XmlElement)onedata; + if (xeonedata.HasAttribute("type") && xeonedata.HasAttribute("refname") && xeonedata.HasAttribute("separator")) + { + dataset.Datatype = xeonedata.GetAttribute("type").ToString(); + dataset.Refname = xeonedata.GetAttribute("refname").ToString(); + dataset.Separator = xeonedata.GetAttribute("separator").ToString(); + ed.WriteMessage(dataset.Datatype + "\t" + dataset.Refname + "\t" + dataset.Separator + "\n"); + } + else + { + ed.WriteMessage("数据集.xml文件配置有误,请确认!\n"); + return null; + } + + //获得dataset子节点 + XmlNodeList onedatainfo = xeonedata.ChildNodes; + foreach (XmlNode node in onedatainfo) + { + XmlElement xeone = (XmlElement)node; + if (xeone.HasAttribute("seq") && xeone.HasAttribute("from")) + { + int seq = Convert.ToInt32(xeone.GetAttribute("seq").ToString()); + string from = xeone.GetAttribute("from").ToString(); + dataset.Dsnametable = origintool.TableHasKey(dataset.Dsnametable, seq, from); + ed.WriteMessage(seq+"\t"+from+"\n"); + } + } + } + + } + catch (System.Exception ex) + { + xmlreader.Close(); + ed.WriteMessage(ex.Message + "\n"); + } + finally + { + xmlreader.Close(); + } + + return dataset; + } + + + //获取规则.xml文件信息 + public OriginTypeRule OriginReadRuleXML(string filepath) + { + OriginTypeRule origintyperule = new OriginTypeRule(); + XmlReaderSettings settings = null; + XmlDocument xmldocument = null; + XmlReader xmlreader = null; + filepath = filepath + "规则.xml"; + try + { + ed.WriteMessage("XML路径:" + filepath + "\n"); + + settings = new XmlReaderSettings(); + settings.IgnoreComments = true; ;//忽略文档里面的注释 + xmldocument = new XmlDocument(); + xmlreader = XmlReader.Create(filepath, settings); + xmldocument.Load(xmlreader); + //得到根节点的子节点Rule + XmlNodeList xmlrulelist = xmldocument.SelectSingleNode("Rules").ChildNodes; + + OriginTool origintool = new OriginTool(); + + + foreach (XmlNode onerule in xmlrulelist) + { + //获得一个rule + XmlElement xeonerule = (XmlElement)onerule; + if (xeonerule.HasAttribute("default")) + { + origintyperule.Defaulttype = xeonerule.GetAttribute("default").ToString(); + ed.WriteMessage("默认类型:"+origintyperule.Defaulttype + "\n"); + } + else + { + origintyperule.Defaulttype = "Item"; + } + + //获得rule子节点 + XmlNodeList oneruleinfo = xeonerule.ChildNodes; + foreach (XmlNode node in oneruleinfo) + { + XmlElement xeone = (XmlElement)node; + if (xeone.HasAttribute("seq")) + { + int seq = Convert.ToInt32(xeone.GetAttribute("seq").ToString()); + ed.WriteMessage("序号" + seq + "\n"); + } + else + { + ed.WriteMessage("规则.xml文件中没有配置seq属性列,请检查配置\n"); + return null; + } + string seqstring = xeone.GetAttribute("seq").ToString(); + if (xeone.HasAttribute("source")) + { + string sourcestring = xeone.GetAttribute("source").ToString(); + ed.WriteMessage("序号:"+seqstring+"要处理的对象:" + sourcestring + "\n"); + origintyperule.Sourcetable = origintool.TableHasKey(origintyperule.Sourcetable, seqstring, sourcestring); + } + else + origintyperule.Sourcetable = origintool.TableHasKey(origintyperule.Sourcetable, seqstring, ""); + if (xeone.HasAttribute("startwith")) + { + string startstring = xeone.GetAttribute("startwith").ToString(); + ed.WriteMessage("序号:" + seqstring + "startwith:" + startstring + "\n"); + origintyperule.Starttable = origintool.TableHasKey(origintyperule.Starttable, seqstring, startstring); + } + else + origintyperule.Starttable = origintool.TableHasKey(origintyperule.Starttable, seqstring, ""); + if (xeone.HasAttribute("endwith")) + { + string endstring = xeone.GetAttribute("endwith").ToString(); + ed.WriteMessage("序号:" + seqstring + "endwith:" + endstring + "\n"); + origintyperule.Endtable = origintool.TableHasKey(origintyperule.Endtable, seqstring, endstring); + } + else + origintyperule.Endtable = origintool.TableHasKey(origintyperule.Endtable, seqstring, ""); + if (xeone.HasAttribute("contain")) + { + string containstring = xeone.GetAttribute("contain").ToString(); + ed.WriteMessage("序号:" + seqstring + "contain:" + containstring + "\n"); + origintyperule.Containtable = origintool.TableHasKey(origintyperule.Containtable,seqstring,containstring); + } + else + origintyperule.Containtable = origintool.TableHasKey(origintyperule.Containtable, seqstring, ""); + if (xeone.HasAttribute("equal")) + { + string equalstring = xeone.GetAttribute("equal").ToString(); + ed.WriteMessage("序号:" + seqstring + "equal:" + equalstring + "\n"); + origintyperule.Equaltable = origintool.TableHasKey(origintyperule.Equaltable,seqstring,equalstring); + } + else + origintyperule.Equaltable = origintool.TableHasKey(origintyperule.Equaltable, seqstring, ""); + if (xeone.HasAttribute("type")) + { + string typestring = xeone.GetAttribute("type").ToString(); + ed.WriteMessage("序号:" + seqstring + "type:" + typestring + "\n"); + origintyperule.Typetable = origintool.TableHasKey(origintyperule.Typetable,seqstring,typestring); + } + else + origintyperule.Typetable = origintool.TableHasKey(origintyperule.Typetable, seqstring, ""); + if (xeone.HasAttribute("true")) + { + string truestring = xeone.GetAttribute("true").ToString(); + ed.WriteMessage("序号:" + seqstring + "true:" + truestring + "\n"); + origintyperule.Truetable = origintool.TableHasKey(origintyperule.Truetable,seqstring,truestring); + } + else + origintyperule.Truetable = origintool.TableHasKey(origintyperule.Truetable, seqstring, ""); + if (xeone.HasAttribute("false")) + { + string falsestring = xeone.GetAttribute("false").ToString(); + ed.WriteMessage("序号:" + seqstring + "false:" + falsestring + "\n"); + origintyperule.Falsetable = origintool.TableHasKey(origintyperule.Falsetable,seqstring,falsestring); + } + else + origintyperule.Falsetable = origintool.TableHasKey(origintyperule.Falsetable, seqstring, ""); + } + } + + } + catch (System.Exception ex) + { + xmlreader.Close(); + ed.WriteMessage(ex.Message + "\n"); + } + finally + { + xmlreader.Close(); + } + return origintyperule; + } + + } + + +} diff --git a/Backup1/hello/OriginTool.cs b/Backup1/hello/OriginTool.cs new file mode 100644 index 0000000..0abb537 --- /dev/null +++ b/Backup1/hello/OriginTool.cs @@ -0,0 +1,801 @@ +using System; +using System.Collections.Generic; +using System.Collections; +using System.Text; +using System.IO; +using System.Data; + +using Autodesk.AutoCAD.DatabaseServices; +using Autodesk.AutoCAD.Runtime; +using Autodesk.AutoCAD.Geometry; +using Autodesk.AutoCAD.ApplicationServices; +using Autodesk.AutoCAD.EditorInput; + +using Teamcenter.Services.Strong.Query._2007_06.SavedQuery; +using Teamcenter.Hello; +using Teamcenter.Soa.Client; +using Teamcenter.ClientX; +using Teamcenter.Services.Strong.Core; +using Teamcenter.Soa.Client.Model; +using Teamcenter.Soa.Exceptions; +using Teamcenter.Services.Strong.Query; + +using Teamcenter.Services.Strong.Core._2007_06.DataManagement; +using Teamcenter.Schemas.Soa._2006_03.Exceptions; +using Teamcenter.Services.Strong.Query._2006_03.SavedQuery; + +using User = Teamcenter.Soa.Client.Model.Strong.User; +using Folder = Teamcenter.Soa.Client.Model.Strong.Folder; +using WorkspaceObject = Teamcenter.Soa.Client.Model.Strong.WorkspaceObject; +using ImanFile = Teamcenter.Soa.Client.Model.Strong.ImanFile; +using Item = Teamcenter.Soa.Client.Model.Strong.Item; +using ItemRevision = Teamcenter.Soa.Client.Model.Strong.ItemRevision; +using ImanQuery = Teamcenter.Soa.Client.Model.Strong.ImanQuery; +using DataSet = Teamcenter.Soa.Client.Model.Strong.Dataset; + +using SavedQueryResults = Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryResults; +namespace HelloTeamcenter.hello +{ + public class SortMXL1 : IComparer + { + public int Compare(OriginMXL one, OriginMXL two) + { + return (Convert.ToInt32(one.Mxldatatable["序号"].ToString())).CompareTo((Convert.ToInt32(two.Mxldatatable["序号"].ToString()))); + } + } + + + class OriginTool + { + + private Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; + private static User loginuser; + + public static User Loginuser + { + get { return OriginTool.loginuser; } + set { OriginTool.loginuser = value; } + } + + //获取标题栏信息 + public OriginBTL GetTitleInfo(string filepath,string btlname) + { + //OriginTool origintool = new OriginTool(); + OriginBTL btlinfo = new OriginBTL(); + OriginReadXml originreadxml = new OriginReadXml(); + btlinfo = originreadxml.OriginReadBTL(filepath,btlname); + if(btlinfo ==null) + return null; + + Database db = HostApplicationServices.WorkingDatabase; + using (Transaction tran = db.TransactionManager.StartTransaction()) + { + BlockTable blt = tran.GetObject(db.BlockTableId, OpenMode.ForRead) as BlockTable; + if (blt.Has(btlname)) + { + BlockTableRecord bltr = tran.GetObject(db.CurrentSpaceId, OpenMode.ForRead) as BlockTableRecord; + foreach (ObjectId item in bltr) + { + Entity ent = tran.GetObject(item, OpenMode.ForRead) as Entity; + if (ent.GetType().Name == "BlockReference") + { + BlockReference bref = (BlockReference)ent; + if (bref.Name == btlname) + { + ed.WriteMessage("块名称:" + bref.Name + "\n"); + if (bref.AttributeCollection.Count != 0) + { + System.Collections.IEnumerator bRefEnum = bref.AttributeCollection.GetEnumerator(); + while (bRefEnum.MoveNext()) + { + ObjectId aId = (ObjectId)bRefEnum.Current;//这一句极其关键 + + AttributeReference aRef = (AttributeReference)tran.GetObject(aId, OpenMode.ForRead); + if (btlinfo.Btldatatable.ContainsKey(aRef.Tag)) + { + btlinfo.Btldatatable = this.TableHasKey(btlinfo.Btldatatable, aRef.Tag, aRef.TextString); + } + + btlinfo.Btlinfotable = this.TableHasKey(btlinfo.Btlinfotable, aRef.Tag, aRef.TextString); + + } + } + } + } + } + } + tran.Commit(); + } + return btlinfo; + } + + + + public void SetTitleInfo(string btlname, Hashtable tempvaluetable) + { + Database db = HostApplicationServices.WorkingDatabase; + using (Transaction tran = db.TransactionManager.StartTransaction()) + { + BlockTable blt = tran.GetObject(db.BlockTableId, OpenMode.ForWrite) as BlockTable; + if (blt.Has(btlname)) + { + BlockTableRecord bltr = tran.GetObject(db.CurrentSpaceId, OpenMode.ForWrite) as BlockTableRecord; + foreach (ObjectId item in bltr) + { + Entity ent = tran.GetObject(item, OpenMode.ForWrite) as Entity; + if (ent.GetType().Name == "BlockReference") + { + BlockReference bref = (BlockReference)ent; + if (bref.Name == btlname) + { + ed.WriteMessage("块名称:" + bref.Name + "\n"); + if (bref.AttributeCollection.Count != 0) + { + System.Collections.IEnumerator bRefEnum = bref.AttributeCollection.GetEnumerator(); + while (bRefEnum.MoveNext()) + { + ObjectId aId = (ObjectId)bRefEnum.Current;//这一句极其关键 + + AttributeReference aRef = (AttributeReference)tran.GetObject(aId, OpenMode.ForWrite); + if (tempvaluetable.Contains(aRef.Tag.ToString())) + { + ed.WriteMessage("设置" + aRef.Tag.ToString() + "\t" + tempvaluetable[aRef.Tag.ToString()].ToString() + "\n"); + aRef.TextString = tempvaluetable[aRef.Tag.ToString()].ToString(); + } + } + } + + } + } + } + } + tran.Commit(); + } + } + + + //判断当前table是否还有指定key值,如果有,则用新的value值替换 + public Hashtable TableHasKey(Hashtable target, object key, object value) + { + if(target.Contains(key)) + { + target.Remove(key); + } + target.Add(key, value); + + return target; + } + + + //获取明细栏信息 + public List GetMXLInfo(string filepath, string mxlname) + { + //OriginTool origintool = new OriginTool(); + List mxllist = new List(); + Database db = HostApplicationServices.WorkingDatabase; + using (Transaction tran = db.TransactionManager.StartTransaction()) + { + BlockTable blt = tran.GetObject(db.BlockTableId, OpenMode.ForRead) as BlockTable; + //string mxlname = mxlinfo.Mxlname; + if (blt.Has(mxlname)) + { + BlockTableRecord bltr = tran.GetObject(db.CurrentSpaceId, OpenMode.ForRead) as BlockTableRecord; + foreach (ObjectId item in bltr) + { + Entity ent = tran.GetObject(item, OpenMode.ForRead) as Entity; + if (ent.GetType().Name == "BlockReference") + { + BlockReference bref = (BlockReference)ent; + if (bref.Name == mxlname) + { + ed.WriteMessage("块名称:" + bref.Name + "\n"); + if (bref.AttributeCollection.Count != 0) + { + System.Collections.IEnumerator bRefEnum = bref.AttributeCollection.GetEnumerator(); + OriginMXL onemxlinfo = new OriginMXL(); + OriginReadXml originreadxml = new OriginReadXml(); + onemxlinfo = originreadxml.OriginReadMXL(filepath); + + + while (bRefEnum.MoveNext()) + { + ObjectId aId = (ObjectId)bRefEnum.Current;//这一句极其关键 + + AttributeReference aRef = (AttributeReference)tran.GetObject(aId, OpenMode.ForRead); + if (onemxlinfo.Mxldatatable.ContainsKey(aRef.Tag)) + { + onemxlinfo.Mxldatatable = this.TableHasKey(onemxlinfo.Mxldatatable, aRef.Tag, aRef.TextString); + } + + onemxlinfo.Mxlinfotable = this.TableHasKey(onemxlinfo.Mxlinfotable, aRef.Tag, aRef.TextString); + + } + + mxllist.Add(onemxlinfo); + } + } + } + } + } + tran.Commit(); + } + return mxllist; + } + + //获取指定块参照名称中对应的属性值 + public string GetValueByBlock(string blockname,string attributename) + { + + string attrvalue = ""; + Database db = HostApplicationServices.WorkingDatabase; + using (Transaction tran = db.TransactionManager.StartTransaction()) + { + BlockTable block = tran.GetObject(db.BlockTableId, OpenMode.ForRead) as BlockTable; + //string mxlname = mxlinfo.Mxlname; + if (block.Has(blockname)) + { + BlockTableRecord bltr = tran.GetObject(db.CurrentSpaceId, OpenMode.ForRead) as BlockTableRecord; + foreach (ObjectId item in bltr) + { + Entity ent = tran.GetObject(item, OpenMode.ForRead) as Entity; + if (ent.GetType().Name == "BlockReference") + { + BlockReference bref = (BlockReference)ent; + if (bref.Name == blockname) + { + ed.WriteMessage("块名称:" + bref.Name + "\n"); + if (bref.AttributeCollection.Count != 0) + { + System.Collections.IEnumerator bRefEnum = bref.AttributeCollection.GetEnumerator(); + + while (bRefEnum.MoveNext()) + { + ObjectId aId = (ObjectId)bRefEnum.Current;//这一句极其关键 + + AttributeReference aRef = (AttributeReference)tran.GetObject(aId, OpenMode.ForRead); + if (aRef.Tag.ToString() == attributename) + { + attrvalue = aRef.TextString; + return attrvalue; + } + } + } + } + } + } + } + tran.Commit(); + } + return attrvalue; + } + + + //获取数据集.xml文件配置信息 + public OriginDataSet GetDataSetInfo(OriginDataSet dataset, OriginBTL btlinfo) + { + string ds_name = ""; + + for (int i = 1; i < dataset.Dsnametable.Count+1; i++) + { + string[] tempstring = dataset.Dsnametable[i].ToString().Split('.'); + string blockname = tempstring[0]; + string attributename = tempstring[1]; + if (blockname == btlinfo.Btlname) + { + if (btlinfo.Btlinfotable.ContainsKey(attributename)) + { + ds_name = ds_name + btlinfo.Btlinfotable[attributename].ToString(); + } + } + else + { + ds_name = ds_name + this.GetValueByBlock(blockname, attributename); + } + + } + ed.WriteMessage(ds_name+"\n"); + dataset.Ds_name = ds_name; + + return dataset; + } + + //对bomline进行排序 + public List sortbomlist(List sortbomlist) + { + sortbomlist.Sort(new SortMXL1()); + return sortbomlist; + } + + + //根据item_id搜索 + public SavedQueryResults getSearchItem(string item_id) + { + ImanQuery query = null; + SavedQueryService queryService = SavedQueryService.getService(Session.getConnection()); + try + { + GetSavedQueriesResponse savedQueries = queryService.GetSavedQueries(); + if (savedQueries.Queries.Length == 0) + { + ed.WriteMessage("There are no saved queries in the system.\n"); + } + for (int i = 0; i < savedQueries.Queries.Length; i++) + { + + if (savedQueries.Queries[i].Name.Equals("OriginSearchItemID")) + { + query = savedQueries.Queries[i].Query; + break; + } + } + } + catch (ServiceException e) + { + ed.WriteMessage("GetSavedQueries service request failed.\n"); + ed.WriteMessage(e.Message); + return null; + } + + if (query == null) + { + ed.WriteMessage("There is not an 'OriginSearchItemID' query.\n"); + } + + try + { + // Search for all Items, returning a maximum of 25 objects + Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryInput[] savedQueryInput = new Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryInput[1]; + savedQueryInput[0] = new Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryInput(); + savedQueryInput[0].Query = query; + //savedQueryInput[0].Entries = new String[] { "Item ID" }; + savedQueryInput[0].Entries = new String[] { "零组件 ID" }; + savedQueryInput[0].Values = new String[1]; + savedQueryInput[0].Values[0] = item_id; + + Teamcenter.Services.Strong.Query._2007_06.SavedQuery.ExecuteSavedQueriesResponse savedQueryResult = queryService.ExecuteSavedQueries(savedQueryInput); + + Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryResults found = savedQueryResult.ArrayOfResults[0]; + + ed.WriteMessage("Found Items:" + found.NumOfObjects + "\n"); + return found; + } + catch (ServiceException e) + { + ed.WriteMessage("ExecuteSavedQuery service request failed.\n"); + ed.WriteMessage(e.Message); + return null; + } + } + + + //根据item_id,name,type,owner搜索 + public SavedQueryResults getSearchItem(string item_id, string name, string type, string owner) + { + ImanQuery query = null; + SavedQueryService queryService = SavedQueryService.getService(Session.getConnection()); + try + { + GetSavedQueriesResponse savedQueries = queryService.GetSavedQueries(); + if (savedQueries.Queries.Length == 0) + { + ed.WriteMessage("There are no saved queries in the system.\n"); + } + for (int i = 0; i < savedQueries.Queries.Length; i++) + { + + if (savedQueries.Queries[i].Name.Equals("OriginSearchForItem")) + { + query = savedQueries.Queries[i].Query; + break; + } + } + } + catch (ServiceException e) + { + ed.WriteMessage("GetSavedQueries service request failed.\n"); + ed.WriteMessage(e.Message); + return null; + } + + if (query == null) + { + ed.WriteMessage("There is not an 'OriginSearchForItem' query.\n"); + } + + try + { + Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryInput[] savedQueryInput = new Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryInput[1]; + savedQueryInput[0] = new Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryInput(); + savedQueryInput[0].Query = query; + //savedQueryInput[0].Entries = new String[] { "Name", "Item ID", "Type", "Owning User" }; + savedQueryInput[0].Entries = new String[] { "名称", "零组件 ID", "类型", "所有权用户" }; + savedQueryInput[0].Values = new String[4]; + savedQueryInput[0].Values[0] = name; + savedQueryInput[0].Values[1] = item_id; + savedQueryInput[0].Values[2] = type; + savedQueryInput[0].Values[3] = owner; + + Teamcenter.Services.Strong.Query._2007_06.SavedQuery.ExecuteSavedQueriesResponse savedQueryResult = queryService.ExecuteSavedQueries(savedQueryInput); + + Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryResults found = savedQueryResult.ArrayOfResults[0]; + + ed.WriteMessage("Found Items:" + found.NumOfObjects + "\n"); + return found; + } + catch (ServiceException e) + { + ed.WriteMessage("ExecuteSavedQuery service request failed.\n"); + ed.WriteMessage(e.Message); + return null; + } + } + + //查询所有用户 + public SavedQueryResults getSearchUser() + { + ImanQuery query = null; + SavedQueryService queryService = SavedQueryService.getService(Session.getConnection()); + try + { + GetSavedQueriesResponse savedQueries = queryService.GetSavedQueries(); + if (savedQueries.Queries.Length == 0) + { + ed.WriteMessage("There are no saved queries in the system.\n"); + } + for (int i = 0; i < savedQueries.Queries.Length; i++) + { + + if (savedQueries.Queries[i].Name.Equals("OriginSearchForUser")) + { + query = savedQueries.Queries[i].Query; + break; + } + } + } + catch (ServiceException e) + { + ed.WriteMessage("GetSavedQueries service request failed.\n"); + ed.WriteMessage(e.Message); + return null; + } + + if (query == null) + { + ed.WriteMessage("There is not an 'OriginSearchForUser' query.\n"); + } + + try + { + // Search for all Items, returning a maximum of 25 objects + Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryInput[] savedQueryInput = new Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryInput[1]; + savedQueryInput[0] = new Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryInput(); + savedQueryInput[0].Query = query; + //savedQueryInput[0].Entries = new String[] { "User Id" }; + savedQueryInput[0].Entries = new String[] { "用户 ID" }; + savedQueryInput[0].Values = new String[1]; + savedQueryInput[0].Values[0] = "*"; + + Teamcenter.Services.Strong.Query._2007_06.SavedQuery.ExecuteSavedQueriesResponse savedQueryResult = queryService.ExecuteSavedQueries(savedQueryInput); + + Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryResults found = savedQueryResult.ArrayOfResults[0]; + + ed.WriteMessage("Found Users:" + found.NumOfObjects + "\n"); + return found; + } + catch (ServiceException e) + { + ed.WriteMessage("ExecuteSavedQuery service request failed.\n"); + ed.WriteMessage(e.Message); + return null; + } + } + + + //获得指定名称首选项:站点类型 + public Hashtable getTCPreferences(string prefername) + { + Hashtable prefValues = new Hashtable(); + SessionService sessionservice = SessionService.getService(Session.getConnection()); + Teamcenter.Services.Strong.Core._2007_01.Session.ScopedPreferenceNames[] prefNames = new Teamcenter.Services.Strong.Core._2007_01.Session.ScopedPreferenceNames[1]; + Teamcenter.Services.Strong.Core._2007_01.Session.ScopedPreferenceNames scopedPref = new Teamcenter.Services.Strong.Core._2007_01.Session.ScopedPreferenceNames(); + scopedPref.Names = new String[] { prefername }; + scopedPref.Scope = "site"; + prefNames[0] = scopedPref; + + + Teamcenter.Services.Strong.Core._2007_01.Session.MultiPreferencesResponse resp = sessionservice.GetPreferences(prefNames); + Teamcenter.Services.Strong.Core._2007_01.Session.ReturnedPreferences[] preferenceResp = resp.Preferences; + prefValues.Add(preferenceResp[0].Name, preferenceResp[0].Values); + //string temp = preferenceResp[0].Name.ToString(); + //string[] value = (string[])prefValues[preferenceResp[0].Name.ToString()]; + + return prefValues; + } + + + public bool checkxml(string xmlpath) + { + if (File.Exists(xmlpath + "标题栏.xml")) + ed.WriteMessage("标题栏.xml准备就绪\n"); + else + { + ed.WriteMessage("系统路径下不存在标题栏.xml文件\n"); + return false; + } + if (File.Exists(xmlpath + "明细表.xml")) + ed.WriteMessage("明细表.xml准备就绪\n"); + else + { + ed.WriteMessage("系统路径下不存在明细表.xml文件\n"); + return false; + } + if (File.Exists(xmlpath + "Item类型.xml")) + ed.WriteMessage("Item类型.xml准备就绪\n"); + else + { + ed.WriteMessage("系统路径下不存在Item类型.xml文件\n"); + return false; + } + if (File.Exists(xmlpath + "数据集.xml")) + ed.WriteMessage("数据集.xml准备就绪\n"); + else + { + ed.WriteMessage("系统路径下不存在数据集.xml文件\n"); + return false; + } + if (File.Exists(xmlpath + "规则.xml")) + ed.WriteMessage("规则.xml准备就绪\n"); + else + { + ed.WriteMessage("系统路径下不存在规则.xml文件\n"); + return false; + } + return true; + } + + + //通过value值找key值 + public object getKeyFromValue(Hashtable table,object value) + { + if (table.ContainsValue(value)) + { + foreach (DictionaryEntry de in table) + { + if (de.Value.Equals(value)) + { + return de.Key; + } + } + } + return null; + } + + + //获得标题栏Item类型 + public string getItemType(OriginBTL btlinfo, OriginTypeRule origintyperule) + { + if (origintyperule == null) + return "Item"; + this.itemtype = origintyperule.Defaulttype.ToString(); + + this.getTypeByRule(btlinfo.Btlinfotable, origintyperule, "1", ""); + + return this.itemtype; + } + + + private string itemtype = ""; + + //获得明细栏Item类型 + public string getItemType(OriginMXL mxlinfo, OriginTypeRule origintyperule) + { + if (origintyperule == null) + return "Item"; + this.itemtype = origintyperule.Defaulttype.ToString(); + + this.getTypeByRule(mxlinfo.Mxlinfotable, origintyperule, "1",""); + + return this.itemtype; + } + + + //通过规则获得需要的Item类型 + private void getTypeByRule(Hashtable infotable, OriginTypeRule origintyperule, + string pos,string usestringvalue) + { + ed.WriteMessage("当前source" + usestringvalue + "\n"); + ed.WriteMessage("当前pos" + pos + "\n"); + //获得source对应的数据 + string sourcestring = origintyperule.Sourcetable[pos].ToString(); + string sourcevalue = ""; + if (sourcestring == "") + { + sourcevalue = usestringvalue; + } + else + { + ed.WriteMessage("source值:"+sourcestring+"\n"); + sourcevalue = infotable[sourcestring].ToString(); + } + //检查是否存在type,如果有,则直接返回 + string typestring = origintyperule.Typetable[pos].ToString(); + if (typestring != "") + { + this.itemtype = typestring; + return; + } + //处理判断条件 + string startstring = origintyperule.Starttable[pos].ToString(); + string endstring = origintyperule.Endtable[pos].ToString(); + string containstring = origintyperule.Containtable[pos].ToString(); + string equalstring = origintyperule.Equaltable[pos].ToString(); + + if (startstring != "") + { + if (sourcevalue.StartsWith(startstring)) + { + string truestring = origintyperule.Truetable[pos].ToString(); + if (truestring != "") + { + this.getTypeByRule(infotable, origintyperule, truestring, sourcevalue); + } + } + else + { + string falsestring = origintyperule.Falsetable[pos].ToString(); + if (falsestring != "") + { + this.getTypeByRule(infotable, origintyperule, falsestring, sourcevalue); + } + } + } + else if (endstring != "") + { + if (sourcevalue.EndsWith(endstring)) + { + string truestring = origintyperule.Truetable[pos].ToString(); + if (truestring != "") + { + this.getTypeByRule(infotable, origintyperule, truestring, sourcevalue); + } + } + else + { + string falsestring = origintyperule.Falsetable[pos].ToString(); + if (falsestring != "") + { + this.getTypeByRule(infotable, origintyperule, falsestring, sourcevalue); + } + } + } + else if (containstring != "") + { + if (sourcevalue.Contains(containstring)) + { + string truestring = origintyperule.Truetable[pos].ToString(); + if (truestring != "") + { + this.getTypeByRule(infotable, origintyperule, truestring, sourcevalue); + } + } + else + { + string falsestring = origintyperule.Falsetable[pos].ToString(); + if (falsestring != "") + { + this.getTypeByRule(infotable, origintyperule, falsestring, sourcevalue); + } + } + } + else if (equalstring !="") + { + if (sourcevalue.Equals(equalstring)) + { + string truestring = origintyperule.Truetable[pos].ToString(); + if (truestring != "") + { + this.getTypeByRule(infotable, origintyperule, truestring, sourcevalue); + } + } + else + { + string falsestring = origintyperule.Falsetable[pos].ToString(); + if (falsestring != "") + { + this.getTypeByRule(infotable, origintyperule, falsestring, sourcevalue); + } + } + } + } + + + //分割字符串,取出对应xml文件的的Item的ID + public List getCorrespondItemID(string[] tempprevalues) + { + List itemidlist = new List(); + Hashtable temptable = new Hashtable(); + for (int i = 0; i < tempprevalues.Length; i++) + { + string tempvalueline = tempprevalues[i]; + string[] tempvalue = tempvalueline.Split('='); + itemidlist.Add(tempvalue[1].ToString()); + } + + return itemidlist; + } + + + public bool downloadfile(Item DMTItem,string xmlpath) + { + bool result = false; + string DMTFilepath = ""; + DataManagementService dmService = DataManagementService.getService(Session.getConnection()); + Editor ed1 = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; + ModelObject[] itemrevisionlist = null; + ModelObject[] objects = { DMTItem }; + String[] attributes = { "revision_list" }; + dmService.RefreshObjects(objects); + dmService.GetProperties(objects, attributes); + itemrevisionlist = DMTItem.Revision_list; + ItemRevision itemrevision = itemrevisionlist[itemrevisionlist.Length - 1] as ItemRevision; + ExpandGRMRelationsPref myPref = new ExpandGRMRelationsPref(); + RelationAndTypesFilter2 myFilter = new RelationAndTypesFilter2(); + myFilter.RelationName = "IMAN_specification"; + String[] typeVec = { "Text" }; + myFilter.ObjectTypeNames = typeVec; + myPref.ExpItemRev = false; + RelationAndTypesFilter2[] myfilter = { myFilter }; + myPref.Info = myfilter; + ModelObject[] objects1 = { itemrevision }; + ExpandGRMRelationsResponse myResp = dmService.ExpandGRMRelationsForPrimary(objects1, myPref); + ExpandGRMRelationsOutput[] myoutput = myResp.Output; + for (int i = 0; i < myoutput.Length; i++) + { + ExpandGRMRelationsOutput one_out = myoutput[i]; + for (int j = 0; j < one_out.OtherSideObjData.Length; j++) + { + ExpandGRMRelationsData otherSideData = one_out.OtherSideObjData[j]; + for (int k = 0; k < otherSideData.OtherSideObjects.Length; k++) + { + Type typeinfo = otherSideData.OtherSideObjects[k].GetType(); + string typename = typeinfo.Name; + if (typename == "Text") + { + DataSet dateset = otherSideData.OtherSideObjects[k] as DataSet; + ModelObject[] objects2 = { dateset }; + String[] attributes2 = { "is_modifiable", "checked_out", "ref_list" }; + dmService.RefreshObjects(objects2); + dmService.GetProperties(objects2, attributes2); + ModelObject[] dsfilevec = dateset.Ref_list; + ImanFile dsfile = dsfilevec[0] as ImanFile; + + ModelObject[] objects3 = { dsfile }; + String[] attributes3 = { "relative_directory_path", "original_file_name" }; + dmService.RefreshObjects(objects3); + dmService.GetProperties(objects3, attributes3); + + string newfilename = dsfile.Original_file_name; + ed1.WriteMessage("Original_file_name : " + newfilename + "\n"); + //string tempdir = System.Environment.GetEnvironmentVariable("TEMP").ToString(); + //ed1.WriteMessage("TEMP:" + tempdir.ToString() + "\n"); + + Teamcenter.Soa.Client.FileManagementUtility fmu = new Teamcenter.Soa.Client.FileManagementUtility(Teamcenter.ClientX.Session.getConnection()); + Teamcenter.Soa.Client.GetFileResponse getFileResponse = fmu.GetFiles(dsfilevec); + FileInfo[] fileinfovec = getFileResponse.GetFiles(); + + FileInfo file = fileinfovec[0]; + DMTFilepath = xmlpath + newfilename; + ed1.WriteMessage("拷贝路径:" + DMTFilepath + "\n"); + System.IO.File.Copy(file.FullName, DMTFilepath, true); + System.IO.File.SetAttributes(DMTFilepath, FileAttributes.Normal); + if (DMTFilepath != "") + result = true; + } + } + } + } + return result; + } + + } +} diff --git a/Backup1/hello/OriginTypeRule.cs b/Backup1/hello/OriginTypeRule.cs new file mode 100644 index 0000000..0d8a524 --- /dev/null +++ b/Backup1/hello/OriginTypeRule.cs @@ -0,0 +1,98 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.Collections; + +namespace HelloTeamcenter.hello +{ + class OriginTypeRule + { + private string defaulttype = ""; //属性default + + public string Defaulttype + { + get { return defaulttype; } + set { defaulttype = value; } + } + + private Hashtable sourcetable = null; //用于存放需要的cad图纸信息 + + public Hashtable Sourcetable + { + get { return sourcetable; } + set { sourcetable = value; } + } + + private Hashtable starttable = null; //用于存放startwith判断条件 + + public Hashtable Starttable + { + get { return starttable; } + set { starttable = value; } + } + + private Hashtable endtable = null; //用于存放endwith判断条件 + + public Hashtable Endtable + { + get { return endtable; } + set { endtable = value; } + } + + private Hashtable containtable = null; //用于存放contain的判断条件 + + public Hashtable Containtable + { + get { return containtable; } + set { containtable = value; } + } + + private Hashtable equaltable = null; //用于存放equal的判断条件 + + public Hashtable Equaltable + { + get { return equaltable; } + set { equaltable = value; } + } + + private Hashtable truetable = null; //用于存放判断后成功走向 + + public Hashtable Truetable + { + get { return truetable; } + set { truetable = value; } + } + + private Hashtable falsetable = null;//用于存放判断后失败走向 + + public Hashtable Falsetable + { + get { return falsetable; } + set { falsetable = value; } + } + + private Hashtable typetable = null; //用于存放返回的type类型 + + public Hashtable Typetable + { + get { return typetable; } + set { typetable = value; } + } + + + public OriginTypeRule() + { + this.defaulttype = ""; + this.sourcetable = new Hashtable(); + this.starttable = new Hashtable(); + this.endtable = new Hashtable(); + this.containtable = new Hashtable(); + this.equaltable = new Hashtable(); + this.truetable = new Hashtable(); + this.falsetable = new Hashtable(); + this.typetable = new Hashtable(); + } + + + } +} diff --git a/Backup1/hello/Query.cs b/Backup1/hello/Query.cs new file mode 100644 index 0000000..8ce01b8 --- /dev/null +++ b/Backup1/hello/Query.cs @@ -0,0 +1,112 @@ +//================================================== +// +// @@ +// +//================================================== + +using System; + +using Teamcenter.ClientX; +using Teamcenter.Schemas.Soa._2006_03.Exceptions; + +//Include the Saved Query Service Interface +using Teamcenter.Services.Strong.Query; + +// Input and output structures for the service operations +// Note: the different namespace from the service interface +using Teamcenter.Services.Strong.Query._2006_03.SavedQuery; + +using ImanQuery = Teamcenter.Soa.Client.Model.Strong.ImanQuery; + + +namespace Teamcenter.Hello +{ +public class Query +{ + + /** + * Perform a simple query of the database + * + */ + public void queryItems() + { + + ImanQuery query = null; + + // Get the service stub + SavedQueryService queryService = SavedQueryService.getService(Session.getConnection()); + + try + { + + // ***************************** + // Execute the service operation + // ***************************** + GetSavedQueriesResponse savedQueries = queryService.GetSavedQueries(); + + + if (savedQueries.Queries.Length == 0) + { + Console.Out.WriteLine("There are no saved queries in the system."); + return; + } + + // Find one called 'Item Name' + for (int i = 0; i < savedQueries.Queries.Length; i++) + { + + if (savedQueries.Queries[i].Name.Equals("Item Name")) + { + query = savedQueries.Queries[i].Query; + break; + } + } + } + catch (ServiceException e) + { + Console.Out.WriteLine("GetSavedQueries service request failed."); + Console.Out.WriteLine(e.Message); + return; + } + + if (query == null) + { + Console.WriteLine("There is not an 'Item Name' query."); + return; + } + + try + { + // Search for all Items, returning a maximum of 25 objects + Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryInput[] savedQueryInput = new Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryInput[1]; + savedQueryInput[0] = new Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryInput(); + savedQueryInput[0].Query = query; + savedQueryInput[0].MaxNumToReturn = 25; + savedQueryInput[0].LimitListCount = 0; + savedQueryInput[0].LimitList = new Teamcenter.Soa.Client.Model.ModelObject[0]; + savedQueryInput[0].Entries = new String[] { "Item Name" }; + savedQueryInput[0].Values = new String[1]; + savedQueryInput[0].Values[0] = "*"; + savedQueryInput[0].MaxNumToInflate = 25; + + //***************************** + //Execute the service operation + //***************************** + Teamcenter.Services.Strong.Query._2007_06.SavedQuery.ExecuteSavedQueriesResponse savedQueryResult = queryService.ExecuteSavedQueries(savedQueryInput); + + Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryResults found = savedQueryResult.ArrayOfResults[0]; + + System.Console.Out.WriteLine(""); + System.Console.Out.WriteLine("Found Items:"); + Teamcenter.ClientX.Session.printObjects( found.Objects ); + } + catch (ServiceException e) + { + Console.Out.WriteLine("ExecuteSavedQuery service request failed."); + Console.Out.WriteLine(e.Message); + return; + } + + } +} +} diff --git a/Backup1/hello/Tool.cs b/Backup1/hello/Tool.cs new file mode 100644 index 0000000..974178b --- /dev/null +++ b/Backup1/hello/Tool.cs @@ -0,0 +1,691 @@ +using System; +using System.Collections.Generic; +using System.Collections; +using System.Text; +using Autodesk.AutoCAD.DatabaseServices; +using Autodesk.AutoCAD.Runtime; +using Autodesk.AutoCAD.Geometry; +using Autodesk.AutoCAD.ApplicationServices; +using Autodesk.AutoCAD.EditorInput; + +using Teamcenter.Services.Strong.Query._2007_06.SavedQuery; +using Teamcenter.Hello; +using Teamcenter.Soa.Client; +using Teamcenter.ClientX; +using Teamcenter.Services.Strong.Core; +using Teamcenter.Soa.Client.Model; +using Teamcenter.Soa.Exceptions; +using Teamcenter.Services.Strong.Query; + +using Teamcenter.Services.Strong.Core._2007_06.DataManagement; +using Teamcenter.Schemas.Soa._2006_03.Exceptions; +using Teamcenter.Services.Strong.Query._2006_03.SavedQuery; + +using User = Teamcenter.Soa.Client.Model.Strong.User; +using Folder = Teamcenter.Soa.Client.Model.Strong.Folder; +using WorkspaceObject = Teamcenter.Soa.Client.Model.Strong.WorkspaceObject; +using Item = Teamcenter.Soa.Client.Model.Strong.Item; +using ItemRevision = Teamcenter.Soa.Client.Model.Strong.ItemRevision; +using ImanQuery = Teamcenter.Soa.Client.Model.Strong.ImanQuery; +using DataSet = Teamcenter.Soa.Client.Model.Strong.Dataset; + +using SavedQueryResults = Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryResults; + +namespace HelloTeamcenter.hello +{ + public class SortMXL:IComparer + { + public int Compare(MXLClass one, MXLClass two) + { + return one.Index_num.CompareTo(two.Index_num); + } + } + + class Tool + { + private BTLClass btlinfo; + private List bomlist = new List(); + private static User loginuser; + + public static User Loginuser + { + get { return Tool.loginuser; } + set { Tool.loginuser = value; } + } + + Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; + + public BTLClass getBTL(string btlname) + { + btlinfo = new BTLClass(); + Database db = HostApplicationServices.WorkingDatabase; + using (Transaction tran = db.TransactionManager.StartTransaction()) + { + BlockTable blt = tran.GetObject(db.BlockTableId, OpenMode.ForRead) as BlockTable; + //ed.WriteMessage("名称"+blt.GetType().Name); + + if (blt.Has(btlname)) + { + BlockTableRecord bltr = tran.GetObject(db.CurrentSpaceId, OpenMode.ForRead) as BlockTableRecord; + foreach (ObjectId item in bltr) + { + Entity ent = tran.GetObject(item, OpenMode.ForRead) as Entity; + //ed.WriteMessage(ent.GetType().Name + "\n"); + if (ent.GetType().Name == "BlockReference") + { + BlockReference bref = (BlockReference)ent; + //ed.WriteMessage(bref.GetType().Name + "====\n"); + //ed.WriteMessage(bref.Name + "====\n"); + if (bref.Name == btlname) + { + ed.WriteMessage("块名称:" + bref.Name + "\n"); + if (bref.AttributeCollection.Count != 0) + { + System.Collections.IEnumerator bRefEnum = bref.AttributeCollection.GetEnumerator(); + + while (bRefEnum.MoveNext()) + { + ObjectId aId = (ObjectId)bRefEnum.Current;//这一句极其关键 + + AttributeReference aRef = (AttributeReference)tran.GetObject(aId, OpenMode.ForRead); + //ed.WriteMessage("属性:" + aRef.Tag + "属性值:" + aRef.TextString + "\n"); + if(aRef.Tag == "图号") + { + btlinfo.Item_id = aRef.TextString; + } + else if (aRef.Tag == "零/部件名称") + { + btlinfo.Item_name = aRef.TextString; + } + else if (aRef.Tag == "项目-产品名称") + { + btlinfo.Projectname = aRef.TextString; + } + else if (aRef.Tag == "代号") + { + btlinfo.Partnumber = aRef.TextString; + } + else if (aRef.Tag == "比例") + { + btlinfo.Proportion = aRef.TextString; + } + else if (aRef.Tag == "图幅") + { + btlinfo.Mapsheet = aRef.TextString; + } + else if (aRef.Tag == "版本") + { + btlinfo.Item_revision_id = aRef.TextString; + } + else if (aRef.Tag == "重量") + { + btlinfo.Weight = aRef.TextString; + } + else if (aRef.Tag == "材料牌号") + { + btlinfo.Materialgrade = aRef.TextString; + } + else if (aRef.Tag == "共几页") + { + btlinfo.Allpage = aRef.TextString; + if (btlinfo.Allpage == "") + btlinfo.Allpage = "1"; + } + else if (aRef.Tag == "第几页") + { + btlinfo.Pagenumber = aRef.TextString; + if (btlinfo.Pagenumber == "") + btlinfo.Pagenumber = "1"; + } + } + } + } + } + + } + + } + tran.Commit(); + } + return btlinfo; + } + + public string getQZL(string qzlname) + { + string hedao = ""; + Database db = HostApplicationServices.WorkingDatabase; + using (Transaction tran = db.TransactionManager.StartTransaction()) + { + BlockTable blt = tran.GetObject(db.BlockTableId, OpenMode.ForRead) as BlockTable; + //ed.WriteMessage("名称"+blt.GetType().Name); + + if (blt.Has(qzlname)) + { + BlockTableRecord bltr = tran.GetObject(db.CurrentSpaceId, OpenMode.ForRead) as BlockTableRecord; + foreach (ObjectId item in bltr) + { + Entity ent = tran.GetObject(item, OpenMode.ForRead) as Entity; + //ed.WriteMessage(ent.GetType().Name + "\n"); + if (ent.GetType().Name == "BlockReference") + { + BlockReference bref = (BlockReference)ent; + //ed.WriteMessage(bref.GetType().Name + "====\n"); + //ed.WriteMessage(bref.Name + "====\n"); + if (bref.Name == qzlname) + { + ed.WriteMessage("块名称:" + bref.Name + "\n"); + if (bref.AttributeCollection.Count != 0) + { + System.Collections.IEnumerator bRefEnum = bref.AttributeCollection.GetEnumerator(); + + while (bRefEnum.MoveNext()) + { + ObjectId aId = (ObjectId)bRefEnum.Current;//这一句极其关键 + + AttributeReference aRef = (AttributeReference)tran.GetObject(aId, OpenMode.ForRead); + //ed.WriteMessage("属性:" + aRef.Tag + "属性值:" + aRef.TextString + "\n"); + if (aRef.Tag == "校核") + { + hedao = "非核岛"; + } + } + } + } + } + + } + + } + tran.Commit(); + } + return hedao; + } + + + public List getMXL(string mxlname) + { + bomlist.Clear(); + + Database db = HostApplicationServices.WorkingDatabase; + using (Transaction tran = db.TransactionManager.StartTransaction()) + { + BlockTable blt = tran.GetObject(db.BlockTableId, OpenMode.ForRead) as BlockTable; + //ed.WriteMessage("名称"+blt.GetType().Name); + + if (blt.Has(mxlname)) + { + BlockTableRecord bltr = tran.GetObject(db.CurrentSpaceId, OpenMode.ForRead) as BlockTableRecord; + foreach (ObjectId item in bltr) + { + Entity ent = tran.GetObject(item, OpenMode.ForRead) as Entity; + //ed.WriteMessage(ent.GetType().Name + "\n"); + if (ent.GetType().Name == "BlockReference") + { + BlockReference bref = (BlockReference)ent; + //ed.WriteMessage(bref.GetType().Name + "====\n"); + //ed.WriteMessage(bref.Name + "====\n"); + if (bref.Name == mxlname) + { + ed.WriteMessage("块名称:" + bref.Name + "\n"); + if (bref.AttributeCollection.Count != 0) + { + System.Collections.IEnumerator bRefEnum = bref.AttributeCollection.GetEnumerator(); + MXLClass mxlinfo = new MXLClass(); + while (bRefEnum.MoveNext()) + { + ObjectId aId = (ObjectId)bRefEnum.Current;//这一句极其关键 + + AttributeReference aRef = (AttributeReference)tran.GetObject(aId, OpenMode.ForRead); + //ed.WriteMessage("属性:" + aRef.Tag + "属性值:" + aRef.TextString + "\n"); + if (aRef.Tag == "序号") + { + mxlinfo.Index = aRef.TextString; + mxlinfo.Index_num = Convert.ToInt32(mxlinfo.Index); + } + else if (aRef.Tag == "图号") + { + mxlinfo.Item_id = aRef.TextString; + } + else if (aRef.Tag == "代号") + { + mxlinfo.Partnumber = aRef.TextString; + } + else if (aRef.Tag == "名称") + { + mxlinfo.Name = aRef.TextString; + } + else if (aRef.Tag == "DESCRIPTION") + { + mxlinfo.Object_desc = aRef.TextString; + } + else if (aRef.Tag == "数量") + { + mxlinfo.Count = aRef.TextString; + } + else if (aRef.Tag == "材料") + { + mxlinfo.Material = aRef.TextString; + } + else if (aRef.Tag == "单重") + { + mxlinfo.Perweight = aRef.TextString; + } + else if (aRef.Tag == "总重") + { + mxlinfo.Tolweight = aRef.TextString; + } + else if (aRef.Tag == "备注") + { + mxlinfo.Memo = aRef.TextString; + } + } + bomlist.Add(mxlinfo); + } + } + } + + } + + } + tran.Commit(); + } + return bomlist; + } + + public List sortbomlist(List sortbomlist) + { + for (int i = 0; i < sortbomlist.Count; i++) + { + sortbomlist[i].Itemtype = initItemType(sortbomlist[i].Item_id, sortbomlist[i].Material); + } + sortbomlist.Sort(new SortMXL()); + return sortbomlist; + } + + public string initItemType(string item_id, string material) + { + string type = ""; + int pos = item_id.IndexOf("DR"); + ed.WriteMessage("pos: " + pos + "\n"); + if (pos >= 0) + { + string sub = item_id.Substring(pos + 2); + ed.WriteMessage("sub :" + sub + "\n"); + char[] subchar = sub.ToCharArray(); + int i = 0; + if (subchar[i].ToString() == "8") + { + ed.WriteMessage("是否含有CG-:" + item_id.Contains("CG-").ToString()); + if (item_id.Contains("CG-")) + { + type = "D5PruchasePart"; + return type; + } + } + for (; i < subchar.Length; i++) + { + if (subchar[i].ToString() == "0") + continue; + else + { + if (material == "装配件") + { + type = "D5AsmPart"; + return type; + } + else + { + type = "D5Part"; + return type; + } + } + } + if (material == "装配件" && i == subchar.Length) + { + type = "D5Product"; + } + } + else + { + if(item_id.StartsWith("104") || item_id.StartsWith("105")) + type = "D5StdFasteners"; + else if(item_id.StartsWith("TC")) + type = "D5CommonParts"; + else + type = "D5Part"; + } + + return type; + } + + + public string getLOVProductType(string item_id,string itemtype,string hedao) + { + string productTypes = ""; + if (itemtype == "D5Product") + { + if (hedao == "非核岛") + productTypes = "117"; + else + productTypes = "116"; + } + else if (itemtype == "D5AsmPart") + { + if (hedao == "非核岛") + productTypes = "115"; + else + productTypes = "114"; + } + else if (itemtype == "D5Part") + { + if (hedao == "非核岛") + productTypes = "113"; + else + productTypes = "112"; + } + else if (itemtype == "D5StdFasteners") + { + if(item_id.StartsWith("104")) + productTypes = "104"; + else + productTypes = "105"; + } + else if (itemtype == "D5CommonPartss") + { + if (item_id.StartsWith("120")) + productTypes = "120"; + else + productTypes = "121"; + }//此处需要增加D5PruchasePart类型的核岛判断 + return productTypes; + } + + + + public SavedQueryResults getSearchItem(string item_id) + { + ImanQuery query = null; + SavedQueryService queryService = SavedQueryService.getService(Session.getConnection()); + try + { + GetSavedQueriesResponse savedQueries = queryService.GetSavedQueries(); + if (savedQueries.Queries.Length == 0) + { + ed.WriteMessage("There are no saved queries in the system.\n"); + } + for (int i = 0; i < savedQueries.Queries.Length; i++) + { + + if (savedQueries.Queries[i].Name.Equals("D5Item ID")) + { + query = savedQueries.Queries[i].Query; + break; + } + } + } + catch (ServiceException e) + { + ed.WriteMessage("GetSavedQueries service request failed.\n"); + ed.WriteMessage(e.Message); + return null; + } + + if (query == null) + { + ed.WriteMessage("There is not an 'D5Item ID' query.\n"); + } + + try + { + // Search for all Items, returning a maximum of 25 objects + Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryInput[] savedQueryInput = new Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryInput[1]; + savedQueryInput[0] = new Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryInput(); + savedQueryInput[0].Query = query; + //savedQueryInput[0].Entries = new String[] { "Item ID" }; + savedQueryInput[0].Entries = new String[] { "零组件 ID" }; + savedQueryInput[0].Values = new String[1]; + savedQueryInput[0].Values[0] = item_id; + + Teamcenter.Services.Strong.Query._2007_06.SavedQuery.ExecuteSavedQueriesResponse savedQueryResult = queryService.ExecuteSavedQueries(savedQueryInput); + + Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryResults found = savedQueryResult.ArrayOfResults[0]; + + ed.WriteMessage("Found Items:"+ found.NumOfObjects +"\n"); + return found; + } + catch (ServiceException e) + { + ed.WriteMessage("ExecuteSavedQuery service request failed.\n"); + ed.WriteMessage(e.Message); + return null; + } + } + + public SavedQueryResults getSearchItem(string item_id,string name,string type,string owner) + { + ImanQuery query = null; + SavedQueryService queryService = SavedQueryService.getService(Session.getConnection()); + try + { + GetSavedQueriesResponse savedQueries = queryService.GetSavedQueries(); + if (savedQueries.Queries.Length == 0) + { + ed.WriteMessage("There are no saved queries in the system.\n"); + } + for (int i = 0; i < savedQueries.Queries.Length; i++) + { + + if (savedQueries.Queries[i].Name.Equals("D5SearchForItem")) + { + query = savedQueries.Queries[i].Query; + break; + } + } + } + catch (ServiceException e) + { + ed.WriteMessage("GetSavedQueries service request failed.\n"); + ed.WriteMessage(e.Message); + return null; + } + + if (query == null) + { + ed.WriteMessage("There is not an 'D5SearchForItem' query.\n"); + } + + try + { + Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryInput[] savedQueryInput = new Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryInput[1]; + savedQueryInput[0] = new Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryInput(); + savedQueryInput[0].Query = query; + //savedQueryInput[0].Entries = new String[] { "Name", "Item ID", "Type", "Owning User" }; + savedQueryInput[0].Entries = new String[] { "名称", "零组件 ID", "类型", "所有权用户" }; + savedQueryInput[0].Values = new String[4]; + savedQueryInput[0].Values[0] = name; + savedQueryInput[0].Values[1] = item_id; + savedQueryInput[0].Values[2] = type; + savedQueryInput[0].Values[3] = owner; + + Teamcenter.Services.Strong.Query._2007_06.SavedQuery.ExecuteSavedQueriesResponse savedQueryResult = queryService.ExecuteSavedQueries(savedQueryInput); + + Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryResults found = savedQueryResult.ArrayOfResults[0]; + + ed.WriteMessage("Found Items:" + found.NumOfObjects + "\n"); + return found; + } + catch (ServiceException e) + { + ed.WriteMessage("ExecuteSavedQuery service request failed.\n"); + ed.WriteMessage(e.Message); + return null; + } + } + + public SavedQueryResults getSearchUser() + { + ImanQuery query = null; + SavedQueryService queryService = SavedQueryService.getService(Session.getConnection()); + try + { + GetSavedQueriesResponse savedQueries = queryService.GetSavedQueries(); + if (savedQueries.Queries.Length == 0) + { + ed.WriteMessage("There are no saved queries in the system.\n"); + } + for (int i = 0; i < savedQueries.Queries.Length; i++) + { + + if (savedQueries.Queries[i].Name.Equals("D5SearchForUser")) + { + query = savedQueries.Queries[i].Query; + break; + } + } + } + catch (ServiceException e) + { + ed.WriteMessage("GetSavedQueries service request failed.\n"); + ed.WriteMessage(e.Message); + return null; + } + + if (query == null) + { + ed.WriteMessage("There is not an 'D5SearchForUser' query.\n"); + } + + try + { + // Search for all Items, returning a maximum of 25 objects + Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryInput[] savedQueryInput = new Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryInput[1]; + savedQueryInput[0] = new Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryInput(); + savedQueryInput[0].Query = query; + //savedQueryInput[0].Entries = new String[] { "User Id" }; + savedQueryInput[0].Entries = new String[] { "用户 ID" }; + savedQueryInput[0].Values = new String[1]; + savedQueryInput[0].Values[0] = "*"; + + Teamcenter.Services.Strong.Query._2007_06.SavedQuery.ExecuteSavedQueriesResponse savedQueryResult = queryService.ExecuteSavedQueries(savedQueryInput); + + Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryResults found = savedQueryResult.ArrayOfResults[0]; + + ed.WriteMessage("Found Users:" + found.NumOfObjects + "\n"); + return found; + } + catch (ServiceException e) + { + ed.WriteMessage("ExecuteSavedQuery service request failed.\n"); + ed.WriteMessage(e.Message); + return null; + } + } + + + public SavedQueryResults getSearchType(string d5MaterialGrades) + { + ImanQuery query = null; + SavedQueryService queryService = SavedQueryService.getService(Session.getConnection()); + try + { + GetSavedQueriesResponse savedQueries = queryService.GetSavedQueries(); + if (savedQueries.Queries.Length == 0) + { + ed.WriteMessage("There are no saved queries in the system.\n"); + } + for (int i = 0; i < savedQueries.Queries.Length; i++) + { + + if (savedQueries.Queries[i].Name.Equals("D5SearchForType")) + { + query = savedQueries.Queries[i].Query; + break; + } + } + } + catch (ServiceException e) + { + ed.WriteMessage("GetSavedQueries service request failed.\n"); + ed.WriteMessage(e.Message); + return null; + } + + if (query == null) + { + ed.WriteMessage("There is not an 'D5SearchForType' query.\n"); + } + + try + { + // Search for all Items, returning a maximum of 25 objects + Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryInput[] savedQueryInput = new Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryInput[1]; + savedQueryInput[0] = new Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryInput(); + savedQueryInput[0].Query = query; + //savedQueryInput[0].Entries = new String[] { "Name", "Type" }; + savedQueryInput[0].Entries = new String[] { "名称", "类型" }; + savedQueryInput[0].Values = new String[2]; + savedQueryInput[0].Values[0] = d5MaterialGrades; + savedQueryInput[0].Values[1] = "D5MaterialGrade"; + + Teamcenter.Services.Strong.Query._2007_06.SavedQuery.ExecuteSavedQueriesResponse savedQueryResult = queryService.ExecuteSavedQueries(savedQueryInput); + + Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryResults found = savedQueryResult.ArrayOfResults[0]; + + ed.WriteMessage("Found Type:" + found.NumOfObjects + "\n"); + return found; + } + catch (ServiceException e) + { + ed.WriteMessage("ExecuteSavedQuery service request failed.\n"); + ed.WriteMessage(e.Message); + return null; + } + } + + public Hashtable getTCPreferences(string prefername) + { + Hashtable prefValues = new Hashtable(); + SessionService sessionservice = SessionService.getService(Session.getConnection()); + Teamcenter.Services.Strong.Core._2007_01.Session.ScopedPreferenceNames[] prefNames = new Teamcenter.Services.Strong.Core._2007_01.Session.ScopedPreferenceNames[1]; + Teamcenter.Services.Strong.Core._2007_01.Session.ScopedPreferenceNames scopedPref = new Teamcenter.Services.Strong.Core._2007_01.Session.ScopedPreferenceNames(); + scopedPref.Names = new String[]{ prefername }; + scopedPref.Scope = "site"; + prefNames[0] = scopedPref; + + + Teamcenter.Services.Strong.Core._2007_01.Session.MultiPreferencesResponse resp = sessionservice.GetPreferences(prefNames); + Teamcenter.Services.Strong.Core._2007_01.Session.ReturnedPreferences[] preferenceResp = resp.Preferences; + prefValues.Add(preferenceResp[0].Name, preferenceResp[0].Values); + //string temp = preferenceResp[0].Name.ToString(); + //string[] value = (string[])prefValues[preferenceResp[0].Name.ToString()]; + + return prefValues; + } + + //分割字符串,取出对应类型的Item的ID + public string getCorrespondItemID(string type,string[] tempprevalues) + { + string itemid = ""; + Hashtable temptable = new Hashtable(); + for (int i = 0; i < tempprevalues.Length; i++) + { + string tempvalueline = tempprevalues[i]; + string[] tempvalue = tempvalueline.Split('='); + temptable.Add(tempvalue[0].ToString(), tempvalue[1].ToString()); + } + + if (temptable.Count <= 0) + itemid = ""; + else + { + if (temptable.ContainsKey(type)) + { + itemid = (string)temptable[type]; + } + } + return itemid; + } + + } + +} diff --git a/Backup1/res/FOLDER.ICO b/Backup1/res/FOLDER.ICO new file mode 100644 index 0000000..5ef86b9 Binary files /dev/null and b/Backup1/res/FOLDER.ICO differ diff --git a/Backup1/res/FOLDEROP.ICO b/Backup1/res/FOLDEROP.ICO new file mode 100644 index 0000000..33123f5 Binary files /dev/null and b/Backup1/res/FOLDEROP.ICO differ diff --git a/Backup1/res/Newstuff_Folder.png b/Backup1/res/Newstuff_Folder.png new file mode 100644 index 0000000..55c4ba5 Binary files /dev/null and b/Backup1/res/Newstuff_Folder.png differ diff --git a/Backup1/res/autocad_01.ico b/Backup1/res/autocad_01.ico new file mode 100644 index 0000000..60e932a Binary files /dev/null and b/Backup1/res/autocad_01.ico differ diff --git a/Backup1/res/item.ico b/Backup1/res/item.ico new file mode 100644 index 0000000..ef9ef7e Binary files /dev/null and b/Backup1/res/item.ico differ diff --git a/Backup1/res/itemrev.ico b/Backup1/res/itemrev.ico new file mode 100644 index 0000000..31f1b57 Binary files /dev/null and b/Backup1/res/itemrev.ico differ diff --git a/Backup1/res/login.bmp b/Backup1/res/login.bmp new file mode 100644 index 0000000..ce81366 Binary files /dev/null and b/Backup1/res/login.bmp differ diff --git a/Backup1/res/mail.ico b/Backup1/res/mail.ico new file mode 100644 index 0000000..39fdbcd Binary files /dev/null and b/Backup1/res/mail.ico differ diff --git a/Backup1/res/tai.ico b/Backup1/res/tai.ico new file mode 100644 index 0000000..aa14181 Binary files /dev/null and b/Backup1/res/tai.ico differ diff --git a/HelloTeamcenter.csproj b/HelloTeamcenter.csproj new file mode 100644 index 0000000..73c4169 --- /dev/null +++ b/HelloTeamcenter.csproj @@ -0,0 +1,356 @@ + + + + Debug + AnyCPU + 9.0.30729 + 2.0 + {5503038E-4D69-4703-9F79-90C8D9061A70} + Library + Properties + HelloTeamcenter + ConnorAutocad + + + + + 3.5 + v4.7.2 + false + + + publish\ + true + Disk + false + Foreground + 7 + Days + false + false + true + 0 + 1.0.0.%2a + false + true + + + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + AllRules.ruleset + false + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + AllRules.ruleset + false + + + true + bin\x64\Debug\ + DEBUG;TRACE + full + x64 + prompt + AllRules.ruleset + false + + + bin\x64\Release\ + TRACE + true + pdbonly + x64 + prompt + AllRules.ruleset + false + + + + False + bin\Debug\FCCNetClientProxy40.dll + + + False + bin\Debug\FCCNetClientProxy4064.dll + + + False + bin\Debug\FMSNetTicket40.dll + + + False + bin\Debug\FSCNetClientProxy40.dll + + + False + bin\Debug\itextsharp.dll + + + False + bin\Debug\S8SoaBypassStrong.dll + + + False + bin\Debug\S8SoaBypassTypes.dll + + + False + bin\Debug\Spire.License.dll + + + False + bin\Debug\Spire.pdf.dll + + + + + + + + False + bin\Debug\TcMemNetBinding40.dll + + + False + bin\Debug\TcMemNetBinding4064.dll + + + False + bin\Debug\TcMemNetBindingInterface40.dll + + + False + bin\Debug\TcServerNetBinding40.dll + + + False + bin\Debug\TcServerNetBinding4064.dll + + + False + bin\Debug\TcServerNetBindingInterface40.dll + + + False + bin\Debug\TcSoaCadBomAlignmentStrong.dll + + + False + bin\Debug\TcSoaCadBomAlignmentTypes.dll + + + False + bin\Debug\TcSoaCadStrong.dll + + + False + bin\Debug\TcSoaCadTypes.dll + + + False + bin\Debug\TcSoaClient.dll + + + False + bin\Debug\TcSoaCommon.dll + + + False + bin\Debug\TcSoaCoreLoose.dll + + + False + bin\Debug\TcSoaCoreStrong.dll + + + False + bin\Debug\TcSoaCoreTypes.dll + + + False + bin\Debug\TcSoaFMS.dll + + + False + bin\Debug\TcSoaFMS64.dll + + + False + bin\Debug\TcSoaQueryStrong.dll + + + False + bin\Debug\TcSoaQueryTypes.dll + + + False + bin\Debug\TcSoaStrongModel.dll + + + False + ..\..\部署\ZW2024\安装目录\2024\ZwDatabaseMgd.dll + + + False + ..\..\部署\ZW2024\安装目录\2024\ZwManaged.dll + + + + + + + + + + + + Form + + + Login.cs + + + Form + + + OpenFromTC.cs + + + Form + + + SaveToTC.cs + + + Form + + + Search1.cs + + + Form + + + Search.cs + + + + + + + + + + + + + + + + + + + + + + + True + True + Resources.resx + + + + + Designer + + + + + False + .NET Framework 3.5 SP1 Client Profile + false + + + False + .NET Framework 2.0 %28x86%29 + false + + + False + .NET Framework 3.0 %28x86%29 + true + + + False + .NET Framework 3.5 + false + + + False + .NET Framework 3.5 SP1 + false + + + False + Windows Installer 3.1 + true + + + + + Login.cs + + + OpenFromTC.cs + + + SaveToTC.cs + + + Search1.cs + + + Search.cs + + + ResXFileCodeGenerator + Resources.Designer.cs + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/HelloTeamcenter.csproj.user b/HelloTeamcenter.csproj.user new file mode 100644 index 0000000..3a224a9 --- /dev/null +++ b/HelloTeamcenter.csproj.user @@ -0,0 +1,18 @@ + + + + publish\ + + + + + + + + + + + zh-CN + false + + \ No newline at end of file diff --git a/HelloTeamcenter.sln b/HelloTeamcenter.sln new file mode 100644 index 0000000..47a8529 --- /dev/null +++ b/HelloTeamcenter.sln @@ -0,0 +1,26 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HelloTeamcenter", "HelloTeamcenter.csproj", "{5503038E-4D69-4703-9F79-90C8D9061A70}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|x64 = Debug|x64 + Release|Any CPU = Release|Any CPU + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {5503038E-4D69-4703-9F79-90C8D9061A70}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5503038E-4D69-4703-9F79-90C8D9061A70}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5503038E-4D69-4703-9F79-90C8D9061A70}.Debug|x64.ActiveCfg = Debug|x64 + {5503038E-4D69-4703-9F79-90C8D9061A70}.Debug|x64.Build.0 = Debug|x64 + {5503038E-4D69-4703-9F79-90C8D9061A70}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5503038E-4D69-4703-9F79-90C8D9061A70}.Release|Any CPU.Build.0 = Release|Any CPU + {5503038E-4D69-4703-9F79-90C8D9061A70}.Release|x64.ActiveCfg = Release|x64 + {5503038E-4D69-4703-9F79-90C8D9061A70}.Release|x64.Build.0 = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/HelloTeamcenter.suo b/HelloTeamcenter.suo new file mode 100644 index 0000000..2e637c7 Binary files /dev/null and b/HelloTeamcenter.suo differ diff --git a/HelloTeamcenter.v11.suo b/HelloTeamcenter.v11.suo new file mode 100644 index 0000000..0d7b519 Binary files /dev/null and b/HelloTeamcenter.v11.suo differ diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..8cd0617 --- /dev/null +++ b/Properties/AssemblyInfo.cs @@ -0,0 +1,41 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using ZwSoft.ZwCAD.DatabaseServices; +using ZwSoft.ZwCAD.Runtime; +using ZwSoft.ZwCAD.Geometry; +using ZwSoft.ZwCAD.ApplicationServices; +using ZwSoft.ZwCAD.EditorInput; +using ZwSoft.ZwCAD.Windows; +using HelloTeamcenter.hello; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("HelloTeamcenter")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Siemens Product Lifecycle Management Software Inc.")] +[assembly: AssemblyProduct("HelloTeamcenter")] +[assembly: AssemblyCopyright("Copyright 2008 Siemens Product Lifecycle Management Software Inc.")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("6ce4adbe-4247-464b-8d53-e3ecb88955fd")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Properties/Resources.Designer.cs b/Properties/Resources.Designer.cs new file mode 100644 index 0000000..39327d4 --- /dev/null +++ b/Properties/Resources.Designer.cs @@ -0,0 +1,153 @@ +//------------------------------------------------------------------------------ +// +// 此代码由工具生成。 +// 运行时版本:4.0.30319.42000 +// +// 对此文件的更改可能会导致不正确的行为,并且如果 +// 重新生成代码,这些更改将会丢失。 +// +//------------------------------------------------------------------------------ + +namespace HelloTeamcenter.Properties { + using System; + + + /// + /// 一个强类型的资源类,用于查找本地化的字符串等。 + /// + // 此类是由 StronglyTypedResourceBuilder + // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。 + // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen + // (以 /str 作为命令选项),或重新生成 VS 项目。 + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// 返回此类使用的缓存的 ResourceManager 实例。 + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("HelloTeamcenter.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// 使用此强类型资源类,为所有资源查找 + /// 重写当前线程的 CurrentUICulture 属性。 + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// 查找 System.Drawing.Bitmap 类型的本地化资源。 + /// + internal static System.Drawing.Bitmap autocad_01 { + get { + object obj = ResourceManager.GetObject("autocad_01", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// 查找 System.Drawing.Bitmap 类型的本地化资源。 + /// + internal static System.Drawing.Bitmap FOLDER { + get { + object obj = ResourceManager.GetObject("FOLDER", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// 查找 System.Drawing.Bitmap 类型的本地化资源。 + /// + internal static System.Drawing.Bitmap FOLDEROP { + get { + object obj = ResourceManager.GetObject("FOLDEROP", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// 查找 System.Drawing.Bitmap 类型的本地化资源。 + /// + internal static System.Drawing.Bitmap item { + get { + object obj = ResourceManager.GetObject("item", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// 查找 System.Drawing.Bitmap 类型的本地化资源。 + /// + internal static System.Drawing.Bitmap itemrev { + get { + object obj = ResourceManager.GetObject("itemrev", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// 查找 System.Drawing.Bitmap 类型的本地化资源。 + /// + internal static System.Drawing.Bitmap login { + get { + object obj = ResourceManager.GetObject("login", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// 查找 System.Drawing.Bitmap 类型的本地化资源。 + /// + internal static System.Drawing.Bitmap Newstuff_Folder { + get { + object obj = ResourceManager.GetObject("Newstuff_Folder", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// 查找 System.Drawing.Bitmap 类型的本地化资源。 + /// + internal static System.Drawing.Bitmap SY { + get { + object obj = ResourceManager.GetObject("SY", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// 查找 System.Drawing.Bitmap 类型的本地化资源。 + /// + internal static System.Drawing.Bitmap tai { + get { + object obj = ResourceManager.GetObject("tai", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + } +} diff --git a/Properties/Resources.resx b/Properties/Resources.resx new file mode 100644 index 0000000..7232d82 --- /dev/null +++ b/Properties/Resources.resx @@ -0,0 +1,148 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + ..\res\autocad_01.ico;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\res\FOLDER.ICO;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\res\FOLDEROP.ICO;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\res\item.ico;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\res\itemrev.ico;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\res\login.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\res\Newstuff_Folder.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\res\tai.ico;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\SY.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + \ No newline at end of file diff --git a/ReadMe.txt b/ReadMe.txt new file mode 100644 index 0000000..91596c5 --- /dev/null +++ b/ReadMe.txt @@ -0,0 +1,61 @@ + +This sample demonstrates the basic functionality of the Teamcenter Services. + + + +Before running the sample application, you must have a Teamcenter Web Tier server +and Pool Manager up and running. + +To build this project from Visual Studio 2005(8.0). +1. Load the project + Open the Open dialog ( File --> Open --> Project... ) + Browse to .../soa_clients/net/samples/HelloTeamcenter/HelloTeamcenter.csproj +3. Compile the project +4. Execute the client application + To connect to a server other than http://localhost:7001/tc, change this URI + on Project Properties dialog ( Project --> Properties). On the Debug tab + modify the In the 'Command line arguments' field add '-host http://server:port/tc'. + + + + + The source file Hello.cxx has the main function for the application. This is the + best place to start browsing the code. There are serveral classes prefixed with + the name AppX (AppXCredentialManager), these classes are implemenations of + Teamcenter Services framework interfaces. Each client application is responsible + for providing an implemenation to these interfaces: + + CredentialManager Used by the framework to re-authenticate as user. + ExceptionHandler Provide a mechanism for the client application to + handle low level exception in the communication framework. + PartialErrorListener Optional listener for notification when a service operation + has returned partial errors. + ChangeListener Optional listener for notification when a service operation + has returned ModelObject with updated property values. + DeleteListener Optional listener for notification when a service operation + has returned ModelObject that have been deleted from + the database and from the client data model. + + The remaining classes in this sample show the use of a few of the service operations + to demonstrate some basic features of Teamcenter Services. + + Session This class shows how to establish a session with the + Teamcenter Server using the SessionService login and + logout methods. A session must be established before + any other service operation are called. + HomeFolder This class lists the contents of the user's home folder + Query This class performs a simple query. + DataManagement This class creates, revises, and deletes a set of Items + + Each of these examples performs the same basic steps + 1. Construct the desired service stub. + 2. Gather the data for the opeation's input arguments, + 3. Call the service operation + 4. Process the results. + + A few of the service operations will make use of the Change and Delete listeners. + Under normal circomstances the ExeptionHandler and PartialErrorListner will not + be called. + + + diff --git a/Resources/SY.png b/Resources/SY.png new file mode 100644 index 0000000..6b65fd6 Binary files /dev/null and b/Resources/SY.png differ diff --git a/UpgradeLog.XML b/UpgradeLog.XML new file mode 100644 index 0000000..6720e48 --- /dev/null +++ b/UpgradeLog.XML @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/UpgradeLog2.XML b/UpgradeLog2.XML new file mode 100644 index 0000000..c28ed45 --- /dev/null +++ b/UpgradeLog2.XML @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/_UpgradeReport_Files/UpgradeReport.css b/_UpgradeReport_Files/UpgradeReport.css new file mode 100644 index 0000000..fae98af --- /dev/null +++ b/_UpgradeReport_Files/UpgradeReport.css @@ -0,0 +1,207 @@ +BODY +{ + BACKGROUND-COLOR: white; + FONT-FAMILY: "Verdana", sans-serif; + FONT-SIZE: 100%; + MARGIN-LEFT: 0px; + MARGIN-TOP: 0px +} +P +{ + FONT-FAMILY: "Verdana", sans-serif; + FONT-SIZE: 70%; + LINE-HEIGHT: 12pt; + MARGIN-BOTTOM: 0px; + MARGIN-LEFT: 10px; + MARGIN-TOP: 10px +} +.note +{ + BACKGROUND-COLOR: #ffffff; + COLOR: #336699; + FONT-FAMILY: "Verdana", sans-serif; + FONT-SIZE: 100%; + MARGIN-BOTTOM: 0px; + MARGIN-LEFT: 0px; + MARGIN-TOP: 0px; + PADDING-RIGHT: 10px +} +.infotable +{ + BACKGROUND-COLOR: #f0f0e0; + BORDER-BOTTOM: #ffffff 0px solid; + BORDER-COLLAPSE: collapse; + BORDER-LEFT: #ffffff 0px solid; + BORDER-RIGHT: #ffffff 0px solid; + BORDER-TOP: #ffffff 0px solid; + FONT-SIZE: 70%; + MARGIN-LEFT: 10px +} +.issuetable +{ + BACKGROUND-COLOR: #ffffe8; + BORDER-COLLAPSE: collapse; + COLOR: #000000; + FONT-SIZE: 100%; + MARGIN-BOTTOM: 10px; + MARGIN-LEFT: 13px; + MARGIN-TOP: 0px +} +.issuetitle +{ + BACKGROUND-COLOR: #ffffff; + BORDER-BOTTOM: #dcdcdc 1px solid; + BORDER-TOP: #dcdcdc 1px; + COLOR: #003366; + FONT-WEIGHT: normal +} +.header +{ + BACKGROUND-COLOR: #cecf9c; + BORDER-BOTTOM: #ffffff 1px solid; + BORDER-LEFT: #ffffff 1px solid; + BORDER-RIGHT: #ffffff 1px solid; + BORDER-TOP: #ffffff 1px solid; + COLOR: #000000; + FONT-WEIGHT: bold +} +.issuehdr +{ + BACKGROUND-COLOR: #E0EBF5; + BORDER-BOTTOM: #dcdcdc 1px solid; + BORDER-TOP: #dcdcdc 1px solid; + COLOR: #000000; + FONT-WEIGHT: normal +} +.issuenone +{ + BACKGROUND-COLOR: #ffffff; + BORDER-BOTTOM: 0px; + BORDER-LEFT: 0px; + BORDER-RIGHT: 0px; + BORDER-TOP: 0px; + COLOR: #000000; + FONT-WEIGHT: normal +} +.content +{ + BACKGROUND-COLOR: #e7e7ce; + BORDER-BOTTOM: #ffffff 1px solid; + BORDER-LEFT: #ffffff 1px solid; + BORDER-RIGHT: #ffffff 1px solid; + BORDER-TOP: #ffffff 1px solid; + PADDING-LEFT: 3px +} +.issuecontent +{ + BACKGROUND-COLOR: #ffffff; + BORDER-BOTTOM: #dcdcdc 1px solid; + BORDER-TOP: #dcdcdc 1px solid; + PADDING-LEFT: 3px +} +A:link +{ + COLOR: #cc6633; + TEXT-DECORATION: underline +} +A:visited +{ + COLOR: #cc6633; +} +A:active +{ + COLOR: #cc6633; +} +A:hover +{ + COLOR: #cc3300; + TEXT-DECORATION: underline +} +H1 +{ + BACKGROUND-COLOR: #003366; + BORDER-BOTTOM: #336699 6px solid; + COLOR: #ffffff; + FONT-SIZE: 130%; + FONT-WEIGHT: normal; + MARGIN: 0em 0em 0em -20px; + PADDING-BOTTOM: 8px; + PADDING-LEFT: 30px; + PADDING-TOP: 16px +} +H2 +{ + COLOR: #000000; + FONT-SIZE: 80%; + FONT-WEIGHT: bold; + MARGIN-BOTTOM: 3px; + MARGIN-LEFT: 10px; + MARGIN-TOP: 20px; + PADDING-LEFT: 0px +} +H3 +{ + COLOR: #000000; + FONT-SIZE: 80%; + FONT-WEIGHT: bold; + MARGIN-BOTTOM: -5px; + MARGIN-LEFT: 10px; + MARGIN-TOP: 20px +} +H4 +{ + COLOR: #000000; + FONT-SIZE: 70%; + FONT-WEIGHT: bold; + MARGIN-BOTTOM: 0px; + MARGIN-TOP: 15px; + PADDING-BOTTOM: 0px +} +UL +{ + COLOR: #000000; + FONT-SIZE: 70%; + LIST-STYLE: square; + MARGIN-BOTTOM: 0pt; + MARGIN-TOP: 0pt +} +OL +{ + COLOR: #000000; + FONT-SIZE: 70%; + LIST-STYLE: square; + MARGIN-BOTTOM: 0pt; + MARGIN-TOP: 0pt +} +LI +{ + LIST-STYLE: square; + MARGIN-LEFT: 0px +} +.expandable +{ + CURSOR: hand +} +.expanded +{ + color: black +} +.collapsed +{ + DISPLAY: none +} +.foot +{ +BACKGROUND-COLOR: #ffffff; +BORDER-BOTTOM: #cecf9c 1px solid; +BORDER-TOP: #cecf9c 2px solid +} +.settings +{ +MARGIN-LEFT: 25PX; +} +.help +{ +TEXT-ALIGN: right; +margin-right: 10px; +} diff --git a/_UpgradeReport_Files/UpgradeReport.xslt b/_UpgradeReport_Files/UpgradeReport.xslt new file mode 100644 index 0000000..f65c00a --- /dev/null +++ b/_UpgradeReport_Files/UpgradeReport.xslt @@ -0,0 +1,232 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+ 解决方案: + 项目: + + + + + + + +

+ + + + + + + + + + + + + + + + + + + + + + + + src + + + + + + + + + + + + +
文件名状态错误警告
+ javascript:document.images[''].click()src + + + + 已转换 + + + + 已转换 + +
+ + 个文件 + + + 1 个文件 + + + 已转换:
+ 未转换: +
+
+
+ + + + : + + + + + + + + + 转换报告 + <xsl:if test="Properties/Property[@Name='LogNumber']"> + <xsl:value-of select="Properties/Property[@Name='LogNumber']/@Value"/> + </xsl:if> + + + + +

转换报告 -

+ +

+ 转换时间:
+

+ + + + + + + + + + + + + + + + + + + + + + + + +

+ + + + + +
+ 转换设置 +

+ + +
+
diff --git a/_UpgradeReport_Files/UpgradeReport_Minus.gif b/_UpgradeReport_Files/UpgradeReport_Minus.gif new file mode 100644 index 0000000..17751cb Binary files /dev/null and b/_UpgradeReport_Files/UpgradeReport_Minus.gif differ diff --git a/_UpgradeReport_Files/UpgradeReport_Plus.gif b/_UpgradeReport_Files/UpgradeReport_Plus.gif new file mode 100644 index 0000000..f6009ca Binary files /dev/null and b/_UpgradeReport_Files/UpgradeReport_Plus.gif differ diff --git a/app.config b/app.config new file mode 100644 index 0000000..f134b70 --- /dev/null +++ b/app.config @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/bin/Debug/AcCui.dll b/bin/Debug/AcCui.dll new file mode 100644 index 0000000..91d259b Binary files /dev/null and b/bin/Debug/AcCui.dll differ diff --git a/bin/Debug/Autodesk.AutoCAD.Interop.Common.dll b/bin/Debug/Autodesk.AutoCAD.Interop.Common.dll new file mode 100644 index 0000000..9c07294 Binary files /dev/null and b/bin/Debug/Autodesk.AutoCAD.Interop.Common.dll differ diff --git a/bin/Debug/Autodesk.AutoCAD.Interop.dll b/bin/Debug/Autodesk.AutoCAD.Interop.dll new file mode 100644 index 0000000..7e4dcc1 Binary files /dev/null and b/bin/Debug/Autodesk.AutoCAD.Interop.dll differ diff --git a/bin/Debug/CAD2009.zip b/bin/Debug/CAD2009.zip new file mode 100644 index 0000000..d603f92 Binary files /dev/null and b/bin/Debug/CAD2009.zip differ diff --git a/bin/Debug/CAD2013.zip b/bin/Debug/CAD2013.zip new file mode 100644 index 0000000..9ef0261 Binary files /dev/null and b/bin/Debug/CAD2013.zip differ diff --git a/bin/Debug/ConnorAutocad.dll b/bin/Debug/ConnorAutocad.dll new file mode 100644 index 0000000..1869bef Binary files /dev/null and b/bin/Debug/ConnorAutocad.dll differ diff --git a/bin/Debug/ConnorAutocad.dll.config b/bin/Debug/ConnorAutocad.dll.config new file mode 100644 index 0000000..f134b70 --- /dev/null +++ b/bin/Debug/ConnorAutocad.dll.config @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/bin/Debug/ConnorAutocad.pdb b/bin/Debug/ConnorAutocad.pdb new file mode 100644 index 0000000..2d0751b Binary files /dev/null and b/bin/Debug/ConnorAutocad.pdb differ diff --git a/bin/Debug/DFHMAutoCAD.rar b/bin/Debug/DFHMAutoCAD.rar new file mode 100644 index 0000000..76f3d4d Binary files /dev/null and b/bin/Debug/DFHMAutoCAD.rar differ diff --git a/bin/Debug/DFHMAutocad.dll b/bin/Debug/DFHMAutocad.dll new file mode 100644 index 0000000..3dd701a Binary files /dev/null and b/bin/Debug/DFHMAutocad.dll differ diff --git a/bin/Debug/DFHMAutocad.dll.config b/bin/Debug/DFHMAutocad.dll.config new file mode 100644 index 0000000..df20690 --- /dev/null +++ b/bin/Debug/DFHMAutocad.dll.config @@ -0,0 +1,3 @@ + + + diff --git a/bin/Debug/DFHMAutocad.pdb b/bin/Debug/DFHMAutocad.pdb new file mode 100644 index 0000000..4aa2a10 Binary files /dev/null and b/bin/Debug/DFHMAutocad.pdb differ diff --git a/bin/Debug/DFHMAutocad.vshost.exe b/bin/Debug/DFHMAutocad.vshost.exe new file mode 100644 index 0000000..69ed6c0 Binary files /dev/null and b/bin/Debug/DFHMAutocad.vshost.exe differ diff --git a/bin/Debug/DFHMAutocad.vshost.exe.config b/bin/Debug/DFHMAutocad.vshost.exe.config new file mode 100644 index 0000000..df20690 --- /dev/null +++ b/bin/Debug/DFHMAutocad.vshost.exe.config @@ -0,0 +1,3 @@ + + + diff --git a/bin/Debug/DFHMDebug.rar b/bin/Debug/DFHMDebug.rar new file mode 100644 index 0000000..7fe78f0 Binary files /dev/null and b/bin/Debug/DFHMDebug.rar differ diff --git a/bin/Debug/Debug.rar b/bin/Debug/Debug.rar new file mode 100644 index 0000000..529bcb6 Binary files /dev/null and b/bin/Debug/Debug.rar differ diff --git a/bin/Debug/Debug.zip b/bin/Debug/Debug.zip new file mode 100644 index 0000000..5f8c590 Binary files /dev/null and b/bin/Debug/Debug.zip differ diff --git a/bin/Debug/FCCNetClientProxy40.dll b/bin/Debug/FCCNetClientProxy40.dll new file mode 100644 index 0000000..3a53a0f Binary files /dev/null and b/bin/Debug/FCCNetClientProxy40.dll differ diff --git a/bin/Debug/FCCNetClientProxy4064.dll b/bin/Debug/FCCNetClientProxy4064.dll new file mode 100644 index 0000000..1f11fb5 Binary files /dev/null and b/bin/Debug/FCCNetClientProxy4064.dll differ diff --git a/bin/Debug/FMSNetTicket40.dll b/bin/Debug/FMSNetTicket40.dll new file mode 100644 index 0000000..9d09163 Binary files /dev/null and b/bin/Debug/FMSNetTicket40.dll differ diff --git a/bin/Debug/FSCNetClientProxy40.dll b/bin/Debug/FSCNetClientProxy40.dll new file mode 100644 index 0000000..65cfd7b Binary files /dev/null and b/bin/Debug/FSCNetClientProxy40.dll differ diff --git a/bin/Debug/HelloTeamcenter.rar b/bin/Debug/HelloTeamcenter.rar new file mode 100644 index 0000000..4e21971 Binary files /dev/null and b/bin/Debug/HelloTeamcenter.rar differ diff --git a/bin/Debug/HelloTeamcenter.vshost.exe b/bin/Debug/HelloTeamcenter.vshost.exe new file mode 100644 index 0000000..69ed6c0 Binary files /dev/null and b/bin/Debug/HelloTeamcenter.vshost.exe differ diff --git a/bin/Debug/HelloTeamcenter.vshost.exe.config b/bin/Debug/HelloTeamcenter.vshost.exe.config new file mode 100644 index 0000000..df20690 --- /dev/null +++ b/bin/Debug/HelloTeamcenter.vshost.exe.config @@ -0,0 +1,3 @@ + + + diff --git a/bin/Debug/HelloTeamcenter.vshost.exe.manifest b/bin/Debug/HelloTeamcenter.vshost.exe.manifest new file mode 100644 index 0000000..061c9ca --- /dev/null +++ b/bin/Debug/HelloTeamcenter.vshost.exe.manifest @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/bin/Debug/Microsoft.mshtml.dll b/bin/Debug/Microsoft.mshtml.dll new file mode 100644 index 0000000..da0768b Binary files /dev/null and b/bin/Debug/Microsoft.mshtml.dll differ diff --git a/bin/Debug/OriginAutocad.dll b/bin/Debug/OriginAutocad.dll new file mode 100644 index 0000000..486cb17 Binary files /dev/null and b/bin/Debug/OriginAutocad.dll differ diff --git a/bin/Debug/OriginAutocad.dll.config b/bin/Debug/OriginAutocad.dll.config new file mode 100644 index 0000000..87ebee5 --- /dev/null +++ b/bin/Debug/OriginAutocad.dll.config @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/bin/Debug/OriginAutocad.pdb b/bin/Debug/OriginAutocad.pdb new file mode 100644 index 0000000..903cf34 Binary files /dev/null and b/bin/Debug/OriginAutocad.pdb differ diff --git a/bin/Debug/OriginAutocad.zip b/bin/Debug/OriginAutocad.zip new file mode 100644 index 0000000..91cfb23 Binary files /dev/null and b/bin/Debug/OriginAutocad.zip differ diff --git a/bin/Debug/S8SoaBypassStrong.dll b/bin/Debug/S8SoaBypassStrong.dll new file mode 100644 index 0000000..38a29c8 Binary files /dev/null and b/bin/Debug/S8SoaBypassStrong.dll differ diff --git a/bin/Debug/S8SoaBypassTypes.dll b/bin/Debug/S8SoaBypassTypes.dll new file mode 100644 index 0000000..d7485be Binary files /dev/null and b/bin/Debug/S8SoaBypassTypes.dll differ diff --git a/bin/Debug/Spire.License.dll b/bin/Debug/Spire.License.dll new file mode 100644 index 0000000..cabe712 Binary files /dev/null and b/bin/Debug/Spire.License.dll differ diff --git a/bin/Debug/Spire.pdf.dll b/bin/Debug/Spire.pdf.dll new file mode 100644 index 0000000..5900418 Binary files /dev/null and b/bin/Debug/Spire.pdf.dll differ diff --git a/bin/Debug/TcMemNetBinding40.dll b/bin/Debug/TcMemNetBinding40.dll new file mode 100644 index 0000000..782498b Binary files /dev/null and b/bin/Debug/TcMemNetBinding40.dll differ diff --git a/bin/Debug/TcMemNetBinding4064.dll b/bin/Debug/TcMemNetBinding4064.dll new file mode 100644 index 0000000..a464fe4 Binary files /dev/null and b/bin/Debug/TcMemNetBinding4064.dll differ diff --git a/bin/Debug/TcMemNetBindingInterface40.dll b/bin/Debug/TcMemNetBindingInterface40.dll new file mode 100644 index 0000000..0e8f2f9 Binary files /dev/null and b/bin/Debug/TcMemNetBindingInterface40.dll differ diff --git a/bin/Debug/TcServerNetBinding40.dll b/bin/Debug/TcServerNetBinding40.dll new file mode 100644 index 0000000..7a748df Binary files /dev/null and b/bin/Debug/TcServerNetBinding40.dll differ diff --git a/bin/Debug/TcServerNetBinding4064.dll b/bin/Debug/TcServerNetBinding4064.dll new file mode 100644 index 0000000..edcbe6e Binary files /dev/null and b/bin/Debug/TcServerNetBinding4064.dll differ diff --git a/bin/Debug/TcServerNetBindingInterface40.dll b/bin/Debug/TcServerNetBindingInterface40.dll new file mode 100644 index 0000000..bf39025 Binary files /dev/null and b/bin/Debug/TcServerNetBindingInterface40.dll differ diff --git a/bin/Debug/TcSoaCadBomAlignmentStrong.dll b/bin/Debug/TcSoaCadBomAlignmentStrong.dll new file mode 100644 index 0000000..858af56 Binary files /dev/null and b/bin/Debug/TcSoaCadBomAlignmentStrong.dll differ diff --git a/bin/Debug/TcSoaCadBomAlignmentTypes.dll b/bin/Debug/TcSoaCadBomAlignmentTypes.dll new file mode 100644 index 0000000..94761db Binary files /dev/null and b/bin/Debug/TcSoaCadBomAlignmentTypes.dll differ diff --git a/bin/Debug/TcSoaCadStrong.dll b/bin/Debug/TcSoaCadStrong.dll new file mode 100644 index 0000000..8b24c65 Binary files /dev/null and b/bin/Debug/TcSoaCadStrong.dll differ diff --git a/bin/Debug/TcSoaCadTypes.dll b/bin/Debug/TcSoaCadTypes.dll new file mode 100644 index 0000000..8f01987 Binary files /dev/null and b/bin/Debug/TcSoaCadTypes.dll differ diff --git a/bin/Debug/TcSoaClient.dll b/bin/Debug/TcSoaClient.dll new file mode 100644 index 0000000..57b0428 Binary files /dev/null and b/bin/Debug/TcSoaClient.dll differ diff --git a/bin/Debug/TcSoaCommon.dll b/bin/Debug/TcSoaCommon.dll new file mode 100644 index 0000000..71e3ce5 Binary files /dev/null and b/bin/Debug/TcSoaCommon.dll differ diff --git a/bin/Debug/TcSoaCoreLoose.dll b/bin/Debug/TcSoaCoreLoose.dll new file mode 100644 index 0000000..c367e61 Binary files /dev/null and b/bin/Debug/TcSoaCoreLoose.dll differ diff --git a/bin/Debug/TcSoaCoreStrong.dll b/bin/Debug/TcSoaCoreStrong.dll new file mode 100644 index 0000000..29e8d5f Binary files /dev/null and b/bin/Debug/TcSoaCoreStrong.dll differ diff --git a/bin/Debug/TcSoaCoreTypes.dll b/bin/Debug/TcSoaCoreTypes.dll new file mode 100644 index 0000000..367381d Binary files /dev/null and b/bin/Debug/TcSoaCoreTypes.dll differ diff --git a/bin/Debug/TcSoaFMS.dll b/bin/Debug/TcSoaFMS.dll new file mode 100644 index 0000000..bb09642 Binary files /dev/null and b/bin/Debug/TcSoaFMS.dll differ diff --git a/bin/Debug/TcSoaFMS64.dll b/bin/Debug/TcSoaFMS64.dll new file mode 100644 index 0000000..02270fe Binary files /dev/null and b/bin/Debug/TcSoaFMS64.dll differ diff --git a/bin/Debug/TcSoaQueryStrong.dll b/bin/Debug/TcSoaQueryStrong.dll new file mode 100644 index 0000000..618b1e6 Binary files /dev/null and b/bin/Debug/TcSoaQueryStrong.dll differ diff --git a/bin/Debug/TcSoaQueryTypes.dll b/bin/Debug/TcSoaQueryTypes.dll new file mode 100644 index 0000000..cf577fb Binary files /dev/null and b/bin/Debug/TcSoaQueryTypes.dll differ diff --git a/bin/Debug/TcSoaStrongModel.dll b/bin/Debug/TcSoaStrongModel.dll new file mode 100644 index 0000000..8cfdb67 Binary files /dev/null and b/bin/Debug/TcSoaStrongModel.dll differ diff --git a/bin/Debug/ZW2020/FCCNetClientProxy40.dll b/bin/Debug/ZW2020/FCCNetClientProxy40.dll new file mode 100644 index 0000000..3a53a0f Binary files /dev/null and b/bin/Debug/ZW2020/FCCNetClientProxy40.dll differ diff --git a/bin/Debug/ZW2020/FCCNetClientProxy4064.dll b/bin/Debug/ZW2020/FCCNetClientProxy4064.dll new file mode 100644 index 0000000..1f11fb5 Binary files /dev/null and b/bin/Debug/ZW2020/FCCNetClientProxy4064.dll differ diff --git a/bin/Debug/ZW2020/FMSNetTicket40.dll b/bin/Debug/ZW2020/FMSNetTicket40.dll new file mode 100644 index 0000000..9d09163 Binary files /dev/null and b/bin/Debug/ZW2020/FMSNetTicket40.dll differ diff --git a/bin/Debug/ZW2020/FSCNetClientProxy40.dll b/bin/Debug/ZW2020/FSCNetClientProxy40.dll new file mode 100644 index 0000000..65cfd7b Binary files /dev/null and b/bin/Debug/ZW2020/FSCNetClientProxy40.dll differ diff --git a/bin/Debug/ZW2020/OriginAutocad.dll b/bin/Debug/ZW2020/OriginAutocad.dll new file mode 100644 index 0000000..e95a7c7 Binary files /dev/null and b/bin/Debug/ZW2020/OriginAutocad.dll differ diff --git a/bin/Debug/ZW2020/S8SoaBypassStrong.dll b/bin/Debug/ZW2020/S8SoaBypassStrong.dll new file mode 100644 index 0000000..38a29c8 Binary files /dev/null and b/bin/Debug/ZW2020/S8SoaBypassStrong.dll differ diff --git a/bin/Debug/ZW2020/S8SoaBypassTypes.dll b/bin/Debug/ZW2020/S8SoaBypassTypes.dll new file mode 100644 index 0000000..d7485be Binary files /dev/null and b/bin/Debug/ZW2020/S8SoaBypassTypes.dll differ diff --git a/bin/Debug/ZW2020/Spire.License.dll b/bin/Debug/ZW2020/Spire.License.dll new file mode 100644 index 0000000..cabe712 Binary files /dev/null and b/bin/Debug/ZW2020/Spire.License.dll differ diff --git a/bin/Debug/ZW2020/Spire.pdf.dll b/bin/Debug/ZW2020/Spire.pdf.dll new file mode 100644 index 0000000..5900418 Binary files /dev/null and b/bin/Debug/ZW2020/Spire.pdf.dll differ diff --git a/bin/Debug/ZW2020/TcMemNetBinding40.dll b/bin/Debug/ZW2020/TcMemNetBinding40.dll new file mode 100644 index 0000000..782498b Binary files /dev/null and b/bin/Debug/ZW2020/TcMemNetBinding40.dll differ diff --git a/bin/Debug/ZW2020/TcMemNetBinding4064.dll b/bin/Debug/ZW2020/TcMemNetBinding4064.dll new file mode 100644 index 0000000..a464fe4 Binary files /dev/null and b/bin/Debug/ZW2020/TcMemNetBinding4064.dll differ diff --git a/bin/Debug/ZW2020/TcMemNetBindingInterface40.dll b/bin/Debug/ZW2020/TcMemNetBindingInterface40.dll new file mode 100644 index 0000000..0e8f2f9 Binary files /dev/null and b/bin/Debug/ZW2020/TcMemNetBindingInterface40.dll differ diff --git a/bin/Debug/ZW2020/TcServerNetBinding40.dll b/bin/Debug/ZW2020/TcServerNetBinding40.dll new file mode 100644 index 0000000..7a748df Binary files /dev/null and b/bin/Debug/ZW2020/TcServerNetBinding40.dll differ diff --git a/bin/Debug/ZW2020/TcServerNetBinding4064.dll b/bin/Debug/ZW2020/TcServerNetBinding4064.dll new file mode 100644 index 0000000..edcbe6e Binary files /dev/null and b/bin/Debug/ZW2020/TcServerNetBinding4064.dll differ diff --git a/bin/Debug/ZW2020/TcServerNetBindingInterface40.dll b/bin/Debug/ZW2020/TcServerNetBindingInterface40.dll new file mode 100644 index 0000000..bf39025 Binary files /dev/null and b/bin/Debug/ZW2020/TcServerNetBindingInterface40.dll differ diff --git a/bin/Debug/ZW2020/TcSoaCadBomAlignmentStrong.dll b/bin/Debug/ZW2020/TcSoaCadBomAlignmentStrong.dll new file mode 100644 index 0000000..858af56 Binary files /dev/null and b/bin/Debug/ZW2020/TcSoaCadBomAlignmentStrong.dll differ diff --git a/bin/Debug/ZW2020/TcSoaCadBomAlignmentTypes.dll b/bin/Debug/ZW2020/TcSoaCadBomAlignmentTypes.dll new file mode 100644 index 0000000..94761db Binary files /dev/null and b/bin/Debug/ZW2020/TcSoaCadBomAlignmentTypes.dll differ diff --git a/bin/Debug/ZW2020/TcSoaCadStrong.dll b/bin/Debug/ZW2020/TcSoaCadStrong.dll new file mode 100644 index 0000000..8b24c65 Binary files /dev/null and b/bin/Debug/ZW2020/TcSoaCadStrong.dll differ diff --git a/bin/Debug/ZW2020/TcSoaCadTypes.dll b/bin/Debug/ZW2020/TcSoaCadTypes.dll new file mode 100644 index 0000000..8f01987 Binary files /dev/null and b/bin/Debug/ZW2020/TcSoaCadTypes.dll differ diff --git a/bin/Debug/ZW2020/TcSoaClient.dll b/bin/Debug/ZW2020/TcSoaClient.dll new file mode 100644 index 0000000..57b0428 Binary files /dev/null and b/bin/Debug/ZW2020/TcSoaClient.dll differ diff --git a/bin/Debug/ZW2020/TcSoaCommon.dll b/bin/Debug/ZW2020/TcSoaCommon.dll new file mode 100644 index 0000000..71e3ce5 Binary files /dev/null and b/bin/Debug/ZW2020/TcSoaCommon.dll differ diff --git a/bin/Debug/ZW2020/TcSoaCoreLoose.dll b/bin/Debug/ZW2020/TcSoaCoreLoose.dll new file mode 100644 index 0000000..c367e61 Binary files /dev/null and b/bin/Debug/ZW2020/TcSoaCoreLoose.dll differ diff --git a/bin/Debug/ZW2020/TcSoaCoreStrong.dll b/bin/Debug/ZW2020/TcSoaCoreStrong.dll new file mode 100644 index 0000000..29e8d5f Binary files /dev/null and b/bin/Debug/ZW2020/TcSoaCoreStrong.dll differ diff --git a/bin/Debug/ZW2020/TcSoaCoreTypes.dll b/bin/Debug/ZW2020/TcSoaCoreTypes.dll new file mode 100644 index 0000000..367381d Binary files /dev/null and b/bin/Debug/ZW2020/TcSoaCoreTypes.dll differ diff --git a/bin/Debug/ZW2020/TcSoaFMS.dll b/bin/Debug/ZW2020/TcSoaFMS.dll new file mode 100644 index 0000000..bb09642 Binary files /dev/null and b/bin/Debug/ZW2020/TcSoaFMS.dll differ diff --git a/bin/Debug/ZW2020/TcSoaFMS64.dll b/bin/Debug/ZW2020/TcSoaFMS64.dll new file mode 100644 index 0000000..02270fe Binary files /dev/null and b/bin/Debug/ZW2020/TcSoaFMS64.dll differ diff --git a/bin/Debug/ZW2020/TcSoaQueryStrong.dll b/bin/Debug/ZW2020/TcSoaQueryStrong.dll new file mode 100644 index 0000000..618b1e6 Binary files /dev/null and b/bin/Debug/ZW2020/TcSoaQueryStrong.dll differ diff --git a/bin/Debug/ZW2020/TcSoaQueryTypes.dll b/bin/Debug/ZW2020/TcSoaQueryTypes.dll new file mode 100644 index 0000000..cf577fb Binary files /dev/null and b/bin/Debug/ZW2020/TcSoaQueryTypes.dll differ diff --git a/bin/Debug/ZW2020/TcSoaStrongModel.dll b/bin/Debug/ZW2020/TcSoaStrongModel.dll new file mode 100644 index 0000000..8cfdb67 Binary files /dev/null and b/bin/Debug/ZW2020/TcSoaStrongModel.dll differ diff --git a/bin/Debug/ZW2020/ZwDatabaseMgd.dll b/bin/Debug/ZW2020/ZwDatabaseMgd.dll new file mode 100644 index 0000000..5c28b03 Binary files /dev/null and b/bin/Debug/ZW2020/ZwDatabaseMgd.dll differ diff --git a/bin/Debug/ZW2020/ZwManaged.dll b/bin/Debug/ZW2020/ZwManaged.dll new file mode 100644 index 0000000..e439ed6 Binary files /dev/null and b/bin/Debug/ZW2020/ZwManaged.dll differ diff --git a/bin/Debug/ZwDatabaseMgd.dll b/bin/Debug/ZwDatabaseMgd.dll new file mode 100644 index 0000000..ec0578c Binary files /dev/null and b/bin/Debug/ZwDatabaseMgd.dll differ diff --git a/bin/Debug/ZwManaged.dll b/bin/Debug/ZwManaged.dll new file mode 100644 index 0000000..7e2e29b Binary files /dev/null and b/bin/Debug/ZwManaged.dll differ diff --git a/bin/Debug/ZwmSuperEditRes.dll b/bin/Debug/ZwmSuperEditRes.dll new file mode 100644 index 0000000..462621d Binary files /dev/null and b/bin/Debug/ZwmSuperEditRes.dll differ diff --git a/bin/Debug/accoremgd.dll b/bin/Debug/accoremgd.dll new file mode 100644 index 0000000..e371e88 Binary files /dev/null and b/bin/Debug/accoremgd.dll differ diff --git a/bin/Debug/acdbmgd.dll b/bin/Debug/acdbmgd.dll new file mode 100644 index 0000000..d7779f2 Binary files /dev/null and b/bin/Debug/acdbmgd.dll differ diff --git a/bin/Debug/acmgd.dll b/bin/Debug/acmgd.dll new file mode 100644 index 0000000..2aed103 Binary files /dev/null and b/bin/Debug/acmgd.dll differ diff --git a/bin/Debug/itextsharp.dll b/bin/Debug/itextsharp.dll new file mode 100644 index 0000000..2979de0 Binary files /dev/null and b/bin/Debug/itextsharp.dll differ diff --git a/bin/Release/ConnorAutocad.dll b/bin/Release/ConnorAutocad.dll new file mode 100644 index 0000000..e5bd64c Binary files /dev/null and b/bin/Release/ConnorAutocad.dll differ diff --git a/bin/Release/ConnorAutocad.dll.config b/bin/Release/ConnorAutocad.dll.config new file mode 100644 index 0000000..f134b70 --- /dev/null +++ b/bin/Release/ConnorAutocad.dll.config @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/bin/Release/ConnorAutocad.pdb b/bin/Release/ConnorAutocad.pdb new file mode 100644 index 0000000..60dc38b Binary files /dev/null and b/bin/Release/ConnorAutocad.pdb differ diff --git a/bin/Release/FCCNetClientProxy40.dll b/bin/Release/FCCNetClientProxy40.dll new file mode 100644 index 0000000..3a53a0f Binary files /dev/null and b/bin/Release/FCCNetClientProxy40.dll differ diff --git a/bin/Release/FCCNetClientProxy4064.dll b/bin/Release/FCCNetClientProxy4064.dll new file mode 100644 index 0000000..1f11fb5 Binary files /dev/null and b/bin/Release/FCCNetClientProxy4064.dll differ diff --git a/bin/Release/FMSNetTicket40.dll b/bin/Release/FMSNetTicket40.dll new file mode 100644 index 0000000..9d09163 Binary files /dev/null and b/bin/Release/FMSNetTicket40.dll differ diff --git a/bin/Release/FSCNetClientProxy40.dll b/bin/Release/FSCNetClientProxy40.dll new file mode 100644 index 0000000..65cfd7b Binary files /dev/null and b/bin/Release/FSCNetClientProxy40.dll differ diff --git a/bin/Release/S8SoaBypassStrong.dll b/bin/Release/S8SoaBypassStrong.dll new file mode 100644 index 0000000..38a29c8 Binary files /dev/null and b/bin/Release/S8SoaBypassStrong.dll differ diff --git a/bin/Release/S8SoaBypassTypes.dll b/bin/Release/S8SoaBypassTypes.dll new file mode 100644 index 0000000..d7485be Binary files /dev/null and b/bin/Release/S8SoaBypassTypes.dll differ diff --git a/bin/Release/Spire.License.dll b/bin/Release/Spire.License.dll new file mode 100644 index 0000000..cabe712 Binary files /dev/null and b/bin/Release/Spire.License.dll differ diff --git a/bin/Release/Spire.pdf.dll b/bin/Release/Spire.pdf.dll new file mode 100644 index 0000000..5900418 Binary files /dev/null and b/bin/Release/Spire.pdf.dll differ diff --git a/bin/Release/TcMemNetBinding40.dll b/bin/Release/TcMemNetBinding40.dll new file mode 100644 index 0000000..782498b Binary files /dev/null and b/bin/Release/TcMemNetBinding40.dll differ diff --git a/bin/Release/TcMemNetBinding4064.dll b/bin/Release/TcMemNetBinding4064.dll new file mode 100644 index 0000000..a464fe4 Binary files /dev/null and b/bin/Release/TcMemNetBinding4064.dll differ diff --git a/bin/Release/TcMemNetBindingInterface40.dll b/bin/Release/TcMemNetBindingInterface40.dll new file mode 100644 index 0000000..0e8f2f9 Binary files /dev/null and b/bin/Release/TcMemNetBindingInterface40.dll differ diff --git a/bin/Release/TcServerNetBinding40.dll b/bin/Release/TcServerNetBinding40.dll new file mode 100644 index 0000000..7a748df Binary files /dev/null and b/bin/Release/TcServerNetBinding40.dll differ diff --git a/bin/Release/TcServerNetBinding4064.dll b/bin/Release/TcServerNetBinding4064.dll new file mode 100644 index 0000000..edcbe6e Binary files /dev/null and b/bin/Release/TcServerNetBinding4064.dll differ diff --git a/bin/Release/TcServerNetBindingInterface40.dll b/bin/Release/TcServerNetBindingInterface40.dll new file mode 100644 index 0000000..bf39025 Binary files /dev/null and b/bin/Release/TcServerNetBindingInterface40.dll differ diff --git a/bin/Release/TcSoaCadBomAlignmentStrong.dll b/bin/Release/TcSoaCadBomAlignmentStrong.dll new file mode 100644 index 0000000..858af56 Binary files /dev/null and b/bin/Release/TcSoaCadBomAlignmentStrong.dll differ diff --git a/bin/Release/TcSoaCadBomAlignmentTypes.dll b/bin/Release/TcSoaCadBomAlignmentTypes.dll new file mode 100644 index 0000000..94761db Binary files /dev/null and b/bin/Release/TcSoaCadBomAlignmentTypes.dll differ diff --git a/bin/Release/TcSoaCadStrong.dll b/bin/Release/TcSoaCadStrong.dll new file mode 100644 index 0000000..8b24c65 Binary files /dev/null and b/bin/Release/TcSoaCadStrong.dll differ diff --git a/bin/Release/TcSoaCadTypes.dll b/bin/Release/TcSoaCadTypes.dll new file mode 100644 index 0000000..8f01987 Binary files /dev/null and b/bin/Release/TcSoaCadTypes.dll differ diff --git a/bin/Release/TcSoaClient.dll b/bin/Release/TcSoaClient.dll new file mode 100644 index 0000000..57b0428 Binary files /dev/null and b/bin/Release/TcSoaClient.dll differ diff --git a/bin/Release/TcSoaCommon.dll b/bin/Release/TcSoaCommon.dll new file mode 100644 index 0000000..71e3ce5 Binary files /dev/null and b/bin/Release/TcSoaCommon.dll differ diff --git a/bin/Release/TcSoaCoreLoose.dll b/bin/Release/TcSoaCoreLoose.dll new file mode 100644 index 0000000..c367e61 Binary files /dev/null and b/bin/Release/TcSoaCoreLoose.dll differ diff --git a/bin/Release/TcSoaCoreStrong.dll b/bin/Release/TcSoaCoreStrong.dll new file mode 100644 index 0000000..29e8d5f Binary files /dev/null and b/bin/Release/TcSoaCoreStrong.dll differ diff --git a/bin/Release/TcSoaCoreTypes.dll b/bin/Release/TcSoaCoreTypes.dll new file mode 100644 index 0000000..367381d Binary files /dev/null and b/bin/Release/TcSoaCoreTypes.dll differ diff --git a/bin/Release/TcSoaFMS.dll b/bin/Release/TcSoaFMS.dll new file mode 100644 index 0000000..bb09642 Binary files /dev/null and b/bin/Release/TcSoaFMS.dll differ diff --git a/bin/Release/TcSoaFMS64.dll b/bin/Release/TcSoaFMS64.dll new file mode 100644 index 0000000..02270fe Binary files /dev/null and b/bin/Release/TcSoaFMS64.dll differ diff --git a/bin/Release/TcSoaQueryStrong.dll b/bin/Release/TcSoaQueryStrong.dll new file mode 100644 index 0000000..618b1e6 Binary files /dev/null and b/bin/Release/TcSoaQueryStrong.dll differ diff --git a/bin/Release/TcSoaQueryTypes.dll b/bin/Release/TcSoaQueryTypes.dll new file mode 100644 index 0000000..cf577fb Binary files /dev/null and b/bin/Release/TcSoaQueryTypes.dll differ diff --git a/bin/Release/TcSoaStrongModel.dll b/bin/Release/TcSoaStrongModel.dll new file mode 100644 index 0000000..8cfdb67 Binary files /dev/null and b/bin/Release/TcSoaStrongModel.dll differ diff --git a/bin/Release/ZwDatabaseMgd.dll b/bin/Release/ZwDatabaseMgd.dll new file mode 100644 index 0000000..ec0578c Binary files /dev/null and b/bin/Release/ZwDatabaseMgd.dll differ diff --git a/bin/Release/ZwManaged.dll b/bin/Release/ZwManaged.dll new file mode 100644 index 0000000..7e2e29b Binary files /dev/null and b/bin/Release/ZwManaged.dll differ diff --git a/bin/Release/itextsharp.dll b/bin/Release/itextsharp.dll new file mode 100644 index 0000000..2979de0 Binary files /dev/null and b/bin/Release/itextsharp.dll differ diff --git a/bin/log4net.dll b/bin/log4net.dll new file mode 100644 index 0000000..ffc57e1 Binary files /dev/null and b/bin/log4net.dll differ diff --git a/bin/x64/Debug/FCCNetClientProxy40.dll b/bin/x64/Debug/FCCNetClientProxy40.dll new file mode 100644 index 0000000..3a53a0f Binary files /dev/null and b/bin/x64/Debug/FCCNetClientProxy40.dll differ diff --git a/bin/x64/Debug/FCCNetClientProxy4064.dll b/bin/x64/Debug/FCCNetClientProxy4064.dll new file mode 100644 index 0000000..1f11fb5 Binary files /dev/null and b/bin/x64/Debug/FCCNetClientProxy4064.dll differ diff --git a/bin/x64/Debug/FMSNetTicket40.dll b/bin/x64/Debug/FMSNetTicket40.dll new file mode 100644 index 0000000..9d09163 Binary files /dev/null and b/bin/x64/Debug/FMSNetTicket40.dll differ diff --git a/bin/x64/Debug/FSCNetClientProxy40.dll b/bin/x64/Debug/FSCNetClientProxy40.dll new file mode 100644 index 0000000..65cfd7b Binary files /dev/null and b/bin/x64/Debug/FSCNetClientProxy40.dll differ diff --git a/bin/x64/Debug/OriginAutocad.dll b/bin/x64/Debug/OriginAutocad.dll new file mode 100644 index 0000000..a26a0a7 Binary files /dev/null and b/bin/x64/Debug/OriginAutocad.dll differ diff --git a/bin/x64/Debug/OriginAutocad.dll.config b/bin/x64/Debug/OriginAutocad.dll.config new file mode 100644 index 0000000..87ebee5 --- /dev/null +++ b/bin/x64/Debug/OriginAutocad.dll.config @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/bin/x64/Debug/OriginAutocad.pdb b/bin/x64/Debug/OriginAutocad.pdb new file mode 100644 index 0000000..2985a6a Binary files /dev/null and b/bin/x64/Debug/OriginAutocad.pdb differ diff --git a/bin/x64/Debug/S8SoaBypassStrong.dll b/bin/x64/Debug/S8SoaBypassStrong.dll new file mode 100644 index 0000000..38a29c8 Binary files /dev/null and b/bin/x64/Debug/S8SoaBypassStrong.dll differ diff --git a/bin/x64/Debug/S8SoaBypassTypes.dll b/bin/x64/Debug/S8SoaBypassTypes.dll new file mode 100644 index 0000000..d7485be Binary files /dev/null and b/bin/x64/Debug/S8SoaBypassTypes.dll differ diff --git a/bin/x64/Debug/Spire.License.dll b/bin/x64/Debug/Spire.License.dll new file mode 100644 index 0000000..cabe712 Binary files /dev/null and b/bin/x64/Debug/Spire.License.dll differ diff --git a/bin/x64/Debug/Spire.pdf.dll b/bin/x64/Debug/Spire.pdf.dll new file mode 100644 index 0000000..5900418 Binary files /dev/null and b/bin/x64/Debug/Spire.pdf.dll differ diff --git a/bin/x64/Debug/TcMemNetBinding40.dll b/bin/x64/Debug/TcMemNetBinding40.dll new file mode 100644 index 0000000..782498b Binary files /dev/null and b/bin/x64/Debug/TcMemNetBinding40.dll differ diff --git a/bin/x64/Debug/TcMemNetBinding4064.dll b/bin/x64/Debug/TcMemNetBinding4064.dll new file mode 100644 index 0000000..a464fe4 Binary files /dev/null and b/bin/x64/Debug/TcMemNetBinding4064.dll differ diff --git a/bin/x64/Debug/TcMemNetBindingInterface40.dll b/bin/x64/Debug/TcMemNetBindingInterface40.dll new file mode 100644 index 0000000..0e8f2f9 Binary files /dev/null and b/bin/x64/Debug/TcMemNetBindingInterface40.dll differ diff --git a/bin/x64/Debug/TcServerNetBinding40.dll b/bin/x64/Debug/TcServerNetBinding40.dll new file mode 100644 index 0000000..7a748df Binary files /dev/null and b/bin/x64/Debug/TcServerNetBinding40.dll differ diff --git a/bin/x64/Debug/TcServerNetBinding4064.dll b/bin/x64/Debug/TcServerNetBinding4064.dll new file mode 100644 index 0000000..edcbe6e Binary files /dev/null and b/bin/x64/Debug/TcServerNetBinding4064.dll differ diff --git a/bin/x64/Debug/TcServerNetBindingInterface40.dll b/bin/x64/Debug/TcServerNetBindingInterface40.dll new file mode 100644 index 0000000..bf39025 Binary files /dev/null and b/bin/x64/Debug/TcServerNetBindingInterface40.dll differ diff --git a/bin/x64/Debug/TcSoaCadBomAlignmentStrong.dll b/bin/x64/Debug/TcSoaCadBomAlignmentStrong.dll new file mode 100644 index 0000000..858af56 Binary files /dev/null and b/bin/x64/Debug/TcSoaCadBomAlignmentStrong.dll differ diff --git a/bin/x64/Debug/TcSoaCadBomAlignmentTypes.dll b/bin/x64/Debug/TcSoaCadBomAlignmentTypes.dll new file mode 100644 index 0000000..94761db Binary files /dev/null and b/bin/x64/Debug/TcSoaCadBomAlignmentTypes.dll differ diff --git a/bin/x64/Debug/TcSoaCadStrong.dll b/bin/x64/Debug/TcSoaCadStrong.dll new file mode 100644 index 0000000..8b24c65 Binary files /dev/null and b/bin/x64/Debug/TcSoaCadStrong.dll differ diff --git a/bin/x64/Debug/TcSoaCadTypes.dll b/bin/x64/Debug/TcSoaCadTypes.dll new file mode 100644 index 0000000..8f01987 Binary files /dev/null and b/bin/x64/Debug/TcSoaCadTypes.dll differ diff --git a/bin/x64/Debug/TcSoaClient.dll b/bin/x64/Debug/TcSoaClient.dll new file mode 100644 index 0000000..57b0428 Binary files /dev/null and b/bin/x64/Debug/TcSoaClient.dll differ diff --git a/bin/x64/Debug/TcSoaCommon.dll b/bin/x64/Debug/TcSoaCommon.dll new file mode 100644 index 0000000..71e3ce5 Binary files /dev/null and b/bin/x64/Debug/TcSoaCommon.dll differ diff --git a/bin/x64/Debug/TcSoaCoreLoose.dll b/bin/x64/Debug/TcSoaCoreLoose.dll new file mode 100644 index 0000000..c367e61 Binary files /dev/null and b/bin/x64/Debug/TcSoaCoreLoose.dll differ diff --git a/bin/x64/Debug/TcSoaCoreStrong.dll b/bin/x64/Debug/TcSoaCoreStrong.dll new file mode 100644 index 0000000..29e8d5f Binary files /dev/null and b/bin/x64/Debug/TcSoaCoreStrong.dll differ diff --git a/bin/x64/Debug/TcSoaCoreTypes.dll b/bin/x64/Debug/TcSoaCoreTypes.dll new file mode 100644 index 0000000..367381d Binary files /dev/null and b/bin/x64/Debug/TcSoaCoreTypes.dll differ diff --git a/bin/x64/Debug/TcSoaFMS.dll b/bin/x64/Debug/TcSoaFMS.dll new file mode 100644 index 0000000..bb09642 Binary files /dev/null and b/bin/x64/Debug/TcSoaFMS.dll differ diff --git a/bin/x64/Debug/TcSoaFMS64.dll b/bin/x64/Debug/TcSoaFMS64.dll new file mode 100644 index 0000000..02270fe Binary files /dev/null and b/bin/x64/Debug/TcSoaFMS64.dll differ diff --git a/bin/x64/Debug/TcSoaQueryStrong.dll b/bin/x64/Debug/TcSoaQueryStrong.dll new file mode 100644 index 0000000..618b1e6 Binary files /dev/null and b/bin/x64/Debug/TcSoaQueryStrong.dll differ diff --git a/bin/x64/Debug/TcSoaQueryTypes.dll b/bin/x64/Debug/TcSoaQueryTypes.dll new file mode 100644 index 0000000..cf577fb Binary files /dev/null and b/bin/x64/Debug/TcSoaQueryTypes.dll differ diff --git a/bin/x64/Debug/TcSoaStrongModel.dll b/bin/x64/Debug/TcSoaStrongModel.dll new file mode 100644 index 0000000..8cfdb67 Binary files /dev/null and b/bin/x64/Debug/TcSoaStrongModel.dll differ diff --git a/bin/x64/Debug/ZwDatabaseMgd.dll b/bin/x64/Debug/ZwDatabaseMgd.dll new file mode 100644 index 0000000..3728e6e Binary files /dev/null and b/bin/x64/Debug/ZwDatabaseMgd.dll differ diff --git a/bin/x64/Debug/ZwManaged.dll b/bin/x64/Debug/ZwManaged.dll new file mode 100644 index 0000000..7527c5f Binary files /dev/null and b/bin/x64/Debug/ZwManaged.dll differ diff --git a/bin/x64/Debug/itextsharp.dll b/bin/x64/Debug/itextsharp.dll new file mode 100644 index 0000000..2979de0 Binary files /dev/null and b/bin/x64/Debug/itextsharp.dll differ diff --git a/clientx/AppXCredentialManager.cs b/clientx/AppXCredentialManager.cs new file mode 100644 index 0000000..aa43ef3 --- /dev/null +++ b/clientx/AppXCredentialManager.cs @@ -0,0 +1,146 @@ +//================================================== +// +// Copyright 2012 Siemens Product Lifecycle Management Software Inc. All Rights Reserved. +// +//================================================== + + + +using System; +using System.IO; + +using Teamcenter.Schemas.Soa._2006_03.Exceptions; +using Teamcenter.Soa; +using Teamcenter.Soa.Common; +using Teamcenter.Soa.Client; +using Teamcenter.Soa.Exceptions; + +namespace Teamcenter.ClientX +{ + + /** + * The CredentialManager is used by the Teamcenter Services framework to get the + * user's credentials when challanged by the server. This can occur after a period + * of inactivity and the server has timed-out the user's session, at which time + * the client application will need to re-authenitcate. The framework will + * call one of the getCredentials methods (depending on circumstances) and will + * send the SessionService.login service request. Upon successfull completion of + * the login service request. The last service request (one that cuased the challange) + * will be resent. + * + * The framework will also call the setUserPassword setGroupRole methods when ever + * these credentials change, thus allowing this implementation of the CredentialManager + * to cache these values so prompting of the user is not requried for re-authentication. + * + */ + public class AppXCredentialManager : CredentialManager + { + + private String name = null; + private String password = null; + private String group = ""; // default group + private String role = ""; // default role + private String discriminator = "SoaAppX"; // always connect same user + // to same instance of server + + /** + * Return the type of credentials this implementation provides, + * standard (user/password) or Single-Sign-On. In this case + * Standard credentials are returned. + * + * @see com.teamcenter.soa.client.CredentialManager#getCredentialType() + */ + public int CredentialType + { + get { return SoaConstants.CLIENT_CREDENTIAL_TYPE_STD; } + } + + /** + * Prompt's the user for credentials. + * This method will only be called by the framework when a login attempt has + * failed. + * + * @see com.teamcenter.soa.client.CredentialManager#getCredentials(com.teamcenter.schemas.soa._2006_03.exceptions.InvalidCredentialsException) + */ + public string[] GetCredentials(InvalidCredentialsException e) + //throws CanceledOperationException + { + Console.WriteLine(e.Message); + return PromptForCredentials(); + } + + /** + * Return the cached credentials. + * This method will be called when a service request is sent without a valid + * session ( session has expired on the server). + * + * @see com.teamcenter.soa.client.CredentialManager#getCredentials(com.teamcenter.schemas.soa._2006_03.exceptions.InvalidUserException) + */ + public String[] GetCredentials(InvalidUserException e) + //throws CanceledOperationException + { + // Have not logged in yet, shoult not happen but just in case + if (name == null) return PromptForCredentials(); + + // Return cached credentials + String[] tokens = { name, password, group, role, discriminator }; + return tokens; + } + + /** + * Cache the group and role + * This is called after the SessionService.setSessionGroupMember service + * operation is called. + * + * @see com.teamcenter.soa.client.CredentialManager#setGroupRole(java.lang.String, + * java.lang.String) + */ + public void SetGroupRole(String group, String role) + { + this.group = group; + this.role = role; + } + + /** + * Cache the User and Password + * This is called after the SessionService.login service operation is called. + * + * @see com.teamcenter.soa.client.CredentialManager#setUserPassword(java.lang.String, + * java.lang.String, java.lang.String) + */ + public void SetUserPassword(String user, String password, String discriminator) + { + this.name = user; + this.password = password; + this.discriminator = discriminator; + } + + + public String[] PromptForCredentials() + //throws CanceledOperationException + { + try + { + Console.WriteLine("Please enter user credentials (return to quit):"); + Console.Write("User Name: "); + name = Console.ReadLine(); + + if (name.Length == 0) + throw new CanceledOperationException(""); + + Console.Write("Password: "); + password = Console.ReadLine(); + } + catch (IOException e) + { + String message = "Failed to get the name and password.\n" + e.Message; + Console.WriteLine(message); + throw new CanceledOperationException(message); + } + + String[] tokens = { name, password, group, role, discriminator }; + return tokens; + } + + } +} diff --git a/clientx/AppXDeletedObjectListener.cs b/clientx/AppXDeletedObjectListener.cs new file mode 100644 index 0000000..b3e7244 --- /dev/null +++ b/clientx/AppXDeletedObjectListener.cs @@ -0,0 +1,38 @@ +//================================================== +// +// @@ +// +//================================================== + +using System; + +using Teamcenter.Soa.Client.Model; + +namespace Teamcenter.ClientX +{ + + /** + * Implementation of the DeleteListener, simply prints out list of all objects + * that are deleted. + * + */ + public class AppXDeletedObjectListener : DeleteListener + { + + public void ModelObjectDelete(string[] uids) + { + if (uids.Length == 0) + return; + + System.Console.WriteLine(""); + System.Console.WriteLine("Deleted Objects handled in com.teamcenter.clientx.AppXDeletedObjectListener.modelObjectDelete"); + System.Console.WriteLine("The following objects have been deleted from the server and removed from the client data model:"); + for (int i = 0; i < uids.Length; i++) + { + System.Console.WriteLine(" " + uids[i]); + } + + } + + } +} diff --git a/clientx/AppXExceptionHandler.cs b/clientx/AppXExceptionHandler.cs new file mode 100644 index 0000000..d90e664 --- /dev/null +++ b/clientx/AppXExceptionHandler.cs @@ -0,0 +1,101 @@ +//================================================== +// +// Copyright 2012 Siemens Product Lifecycle Management Software Inc. All Rights Reserved. +// +//================================================== + + +using System; +using System.IO; + +using Teamcenter.Schemas.Soa._2006_03.Exceptions; +using Teamcenter.Soa.Client; +using Teamcenter.Soa.Exceptions; + +namespace Teamcenter.ClientX +{ + + + /** + * Implementation of the ExceptionHandler. For ConnectionExceptions (server + * temporarily down .etc) prompts the user to retry the last request. For other + * exceptions convert to a RunTime exception. + */ + public class AppXExceptionHandler : ExceptionHandler + { + + /* + * (non-Javadoc) + * + * @see com.teamcenter.soa.client.ExceptionHandler#handleException(com.teamcenter.schemas.soa._2006_03.exceptions.InternalServerException) + */ + public void HandleException(InternalServerException ise) + { + Console.WriteLine(""); + Console.WriteLine("*****"); + Console.WriteLine("Exception caught in com.teamcenter.clientx.AppXExceptionHandler.handleException(InternalServerException)."); + + + if (ise is ConnectionException) + { + // ConnectionException are typically due to a network error (server + // down .etc) and can be recovered from (the last request can be sent again, + // after the problem is corrected). + Console.Write("\nThe server returned an connection error.\n" + ise.Message + + "\nDo you wish to retry the last service request?[y/n]"); + } + else if (ise is ProtocolException) + { + // ProtocolException are typically due to programming errors + // (content of HTTP + // request is incorrect). These are generally can not be + // recovered from. + Console.Write("\nThe server returned an protocol error.\n" + ise.Message + + "\nThis is most likely the result of a programming error." + + "\nDo you wish to retry the last service request?[y/n]"); + } + else + { + Console.WriteLine("\nThe server returned an internal server error.\n" + + ise.Message + + "\nThis is most likely the result of a programming error." + + "\nA RuntimeException will be thrown."); + throw new SystemException(ise.Message); + } + + try + { + String retry = Console.ReadLine(); + // If yes, return to the calling SOA client framework, where the + // last service request will be resent. + if (retry.ToLower().Equals("y") || retry.ToLower().Equals("yes")) + return; + + throw new SystemException("The user has opted not to retry the last request"); + } + catch (IOException e) + { + Console.Error.WriteLine("Failed to read user response.\nA RuntimeException will be thrown."); + throw new SystemException(e.Message); + } + } + + /* + * (non-Javadoc) + * + * @see com.teamcenter.soa.client.ExceptionHandler#handleException(com.teamcenter.soa.exceptions.CanceledOperationException) + */ + public void HandleException(CanceledOperationException coe) + { + Console.WriteLine(""); + Console.WriteLine("*****"); + Console.WriteLine("Exception caught in com.teamcenter.clientx.AppXExceptionHandler.handleException(CanceledOperationException)."); + + // Expecting this from the login tests with bad credentials, and the + // AnyUserCredentials class not + // prompting for different credentials + throw new SystemException(coe.Message); + } + + } +} diff --git a/clientx/AppXPartialErrorListener.cs b/clientx/AppXPartialErrorListener.cs new file mode 100644 index 0000000..a010b9d --- /dev/null +++ b/clientx/AppXPartialErrorListener.cs @@ -0,0 +1,68 @@ +//================================================== +// +// Copyright 2012 Siemens Product Lifecycle Management Software Inc. All Rights Reserved. +// +//================================================== + +using System; + +using Teamcenter.Soa.Client.Model; + + +namespace Teamcenter.ClientX +{ + + /** + * Implementation of the PartialErrorListener. Print out any partial errors + * returned. + * + */ + public class AppXPartialErrorListener : PartialErrorListener + { + + /* + * (non-Javadoc) + * + * @see com.teamcenter.soa.client.model.PartialErrorListener#handlePartialError(com.teamcenter.soa.client.model.ErrorStack[]) + */ + public void HandlePartialError(ErrorStack[] stacks) + { + if (stacks.Length == 0) return; + + Console.WriteLine(""); + Console.WriteLine("*****"); + Console.WriteLine("Partial Errors caught in com.teamcenter.clientx.AppXPartialErrorListener."); + + + for (int i = 0; i < stacks.Length; i++) + { + ErrorValue[] errors = stacks[i].ErrorValues; + Console.Write("Partial Error for "); + + // The different service implementation may optionally associate + // an ModelObject, client ID, or nothing, with each partial error + if (stacks[i].HasAssociatedObject()) + { + Console.WriteLine("object " + stacks[i].AssociatedObject.Uid); + } + else if (stacks[i].HasClientId()) + { + Console.WriteLine("client id " + stacks[i].ClientId); + } + else if (stacks[i].HasClientIndex()) + { + Console.WriteLine("client index " + stacks[i].ClientIndex); + } + + // Each Partial Error will have one or more contributing error messages + for (int j = 0; j < errors.Length; j++) + { + Console.WriteLine(" Code: " + errors[j].Code + "\tSeverity: " + + errors[j].Level + "\t" + errors[j].Message); + } + } + + } + + } +} diff --git a/clientx/AppXRequestListener.cs b/clientx/AppXRequestListener.cs new file mode 100644 index 0000000..4d1c8ae --- /dev/null +++ b/clientx/AppXRequestListener.cs @@ -0,0 +1,42 @@ +//================================================== +// +// Copyright 2012 Siemens Product Lifecycle Management Software Inc. All Rights Reserved. +// +//================================================== + +using System; + +using Teamcenter.Soa.Client; + + +namespace Teamcenter.ClientX +{ + + /** + * This implemenation of the RequestListener, logs each service request + * to the console. + * + */ + public class AppXRequestListener : RequestListener + { + + + /** + * Called before each request is sent to the server. + */ + public void ServiceRequest(ServiceInfo info) + { + // will log the service name when done + } + + /** + * Called after each response from the server. + * Log the service operation to the console. + */ + public void ServiceResponse(ServiceInfo info) + { + Console.WriteLine(info.Id + ": " + info.Service + "." + info.Operation); + } + + } +} diff --git a/clientx/AppXUpdateObjectListener.cs b/clientx/AppXUpdateObjectListener.cs new file mode 100644 index 0000000..52f3c05 --- /dev/null +++ b/clientx/AppXUpdateObjectListener.cs @@ -0,0 +1,48 @@ +//================================================== +// +// @@ +// +//================================================== + +using System; + +using Teamcenter.Soa.Client.Model; +using Teamcenter.Soa.Exceptions; + +namespace Teamcenter.ClientX +{ + + + /** + * Implementation of the ChangeListener. Print out all objects that have been updated. + * + */ + public class AppXUpdateObjectListener : ChangeListener + { + + public void ModelObjectChange(ModelObject[] objects) + { + if (objects.Length == 0) return; + System.Console.WriteLine(""); + System.Console.WriteLine("Modified Objects handled in com.teamcenter.clientx.AppXUpdateObjectListener.modelObjectChange"); + System.Console.WriteLine("The following objects have been updated in the client data model:"); + for (int i = 0; i < objects.Length; i++) + { + String uid = objects[i].Uid; + String type = objects[i].GetType().Name; + String name = ""; + if (objects[i].GetType().Name.Equals("WorkspaceObject")) + { + ModelObject wo = objects[i]; + try + { + name = wo.GetProperty("object_string").StringValue; + } + catch (NotLoadedException /*e*/) { } // just ignore + } + System.Console.WriteLine(" " + uid + " " + type + " " + name); + } + } + + } +} diff --git a/clientx/Session.cs b/clientx/Session.cs new file mode 100644 index 0000000..5c50f02 --- /dev/null +++ b/clientx/Session.cs @@ -0,0 +1,285 @@ +//================================================== +// +// @@ +// +//================================================== + + + + +using System; +using System.Collections; +using System.Net; + +using Teamcenter.Schemas.Soa._2006_03.Exceptions; +using Teamcenter.Services.Strong.Core; +using Teamcenter.Services.Strong.Core._2006_03.Session; +using Teamcenter.Soa; +using Teamcenter.Soa.Client; +using Teamcenter.Soa.Client.Model; +using Teamcenter.Soa.Exceptions; + +using WorkspaceObject = Teamcenter.Soa.Client.Model.Strong.WorkspaceObject; +using User = Teamcenter.Soa.Client.Model.Strong.User; + +namespace Teamcenter.ClientX +{ + + + public class Session + { + /** + * Single instance of the Connection object that is shared throughtout + * the application. This Connection object is needed whenever a Service + * stub is instantiated. + */ + private static Connection connection; + + /** + * The credentialManager is used both by the Session class and the Teamcenter + * Services Framework to get user credentials. + * + */ + private static AppXCredentialManager credentialManager; + + /** + * Create an instance of the Session with a connection to the specified + * server. + * + * Add implementations of the ExceptionHandler, PartialErrorListener, + * ChangeListener, and DeleteListeners. + * + * @param host Address of the host to connect to, http://serverName:port/tc + */ + public Session(String host) + { + + ZwSoft.ZwCAD.ApplicationServices.Document appodcTemp = ZwSoft.ZwCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument; + ZwSoft.ZwCAD.EditorInput.Editor ed = appodcTemp.Editor; + ed.WriteMessage("host=" + host + "\n"); + // Create an instance of the CredentialManager, this is used + // by the SOA Framework to get the user's credentials when + // challanged by the server (sesioin timeout on the web tier). + credentialManager = new AppXCredentialManager(); + + // ed.WriteMessage("1111\n"); + + // Create the Connection object, no contact is made with the server + // until a service request is made + connection = new Connection(host, new System.Net.CookieCollection(), credentialManager, SoaConstants.REST, + SoaConstants.HTTP, false); + + // ed.WriteMessage("2222\n"); + // Add an ExceptionHandler to the Connection, this will handle any + // InternalServerException, communication errors, xml marshalling errors + // .etc + connection.ExceptionHandler = new AppXExceptionHandler(); + // ed.WriteMessage("3333\n"); + // While the above ExceptionHandler is required, all of the following + // Listeners are optional. Client application can add as many or as few Listeners + // of each type that they want. + + // Add a Partial Error Listener, this will be notified when ever a + // a service returns partial errors. + connection.ModelManager.AddPartialErrorListener(new AppXPartialErrorListener()); + //ed.WriteMessage("4444\n"); + // Add a Change Listener, this will be notified when ever a + // a service returns model objects that have been updated. + connection.ModelManager.AddChangeListener(new AppXUpdateObjectListener()); + + // ed.WriteMessage("5555\n"); + // Add a Delete Listener, this will be notified when ever a + // a service returns objects that have been deleted. + connection.ModelManager.AddDeleteListener(new AppXDeletedObjectListener()); + + // ed.WriteMessage("6666\n"); + // Add a Request Listener, this will be notified before and after each + // service request is sent to the server. + Connection.AddRequestListener(new AppXRequestListener()); + // ed.WriteMessage("7777\n"); + } + + /** + * Get the single Connection object for the application + * + * @return connection + */ + public static Connection getConnection() + { + return connection; + } + + /** + * Login to the Teamcenter Server + * + */ + public User login() + { + // Get the service stub + SessionService sessionService = SessionService.getService(connection); + + try + { + // Prompt for credentials until they are right, or until user + // cancels + String[] credentials = credentialManager.PromptForCredentials(); + while (true) + { + try + { + + // ***************************** + // Execute the service operation + // ***************************** + LoginResponse resp = sessionService.Login(credentials[0], credentials[1], + credentials[2], credentials[3],"",credentials[4]); + + return resp.User; + } + catch (InvalidCredentialsException e) + { + credentials = credentialManager.GetCredentials(e); + } + } + } + // User canceled the operation, don't need to tell him again + catch (CanceledOperationException /*e*/) {} + + // Exit the application + //System.exit(0); + return null; + } + public User mylogin(string username,string password,string usergroup,string userrole) + { + // Get the service stub + SessionService sessionService = SessionService.getService(connection); + try + { + while (true) + { + try + { + + // ***************************** + // Execute the service operation + // ***************************** + LoginResponse resp = sessionService.Login(username, password, + usergroup, userrole, "", ""); + + return resp.User; + } + catch (InvalidCredentialsException e) + { + return null; + } + } + } + // User canceled the operation, don't need to tell him again + catch (CanceledOperationException /*e*/) { } + + // Exit the application + //System.exit(0); + return null; + } + /** + * Terminate the session with the Teamcenter Server + * + */ + public void logout() + { + // Get the service stub + SessionService sessionService = SessionService.getService(connection); + try + { + // ***************************** + // Execute the service operation + // ***************************** + sessionService.Logout(); + } + catch (ServiceException /*e*/) { } + } + + /** + * Print some basic information for a list of objects + * + * @param objects + */ + public static void printObjects(ModelObject[] objects) + { + if(objects == null) + return; + + + // Ensure that the referenced User objects that we will use below are loaded + getUsers( objects ); + + Console.WriteLine("Name\t\tOwner\t\tLast Modified"); + Console.WriteLine("====\t\t=====\t\t============="); + for (int i = 0; i < objects.Length; i++) + { + if(!(objects[i] is WorkspaceObject )) + continue; + + WorkspaceObject wo = (WorkspaceObject)objects[i]; + try + { + String name = wo.Object_string; + User owner = (User) wo.Owning_user; + DateTime lastModified =wo.Last_mod_date; + + Console.WriteLine(name + "\t" + owner.User_name + "\t" + lastModified.ToString()); + } + catch (NotLoadedException e) + { + // Print out a message, and skip to the next item in the folder + // Could do a DataManagementService.getProperties call at this point + Console.WriteLine(e.Message); + Console.WriteLine("The Object Property Policy ($TC_DATA/soa/policies/Default.xml) is not configured with this property."); + } + } + + } + + + private static void getUsers(ModelObject[] objects) + { + if(objects == null) + return; + + DataManagementService dmService = DataManagementService.getService(Session.getConnection()); + ArrayList unKnownUsers = new ArrayList(); + for (int i = 0; i < objects.Length; i++) + { + if(!(objects[i] is WorkspaceObject )) + continue; + + WorkspaceObject wo = (WorkspaceObject)objects[i]; + + User owner = null; + try + { + owner = (User) wo.Owning_user; + String userName = owner.User_name; + } + catch (NotLoadedException /*e*/) + { + if(owner != null) + unKnownUsers.Add(owner); + } + } + User[] users = new User[unKnownUsers.Count]; + unKnownUsers.CopyTo( users ); + String[] attributes = { "user_name" }; + + + // ***************************** + // Execute the service operation + // ***************************** + dmService.GetProperties(users, attributes); + + + } + + + } +} diff --git a/connorCAD.cuix b/connorCAD.cuix new file mode 100644 index 0000000..7aa3c19 Binary files /dev/null and b/connorCAD.cuix differ diff --git a/dll截图.png b/dll截图.png new file mode 100644 index 0000000..c270391 Binary files /dev/null and b/dll截图.png differ diff --git a/form/Login.Designer.cs b/form/Login.Designer.cs new file mode 100644 index 0000000..d467f34 --- /dev/null +++ b/form/Login.Designer.cs @@ -0,0 +1,206 @@ +namespace HelloTeamcenter.form +{ + partial class Login + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Login)); + this.label1 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.label3 = new System.Windows.Forms.Label(); + this.label4 = new System.Windows.Forms.Label(); + this.label5 = new System.Windows.Forms.Label(); + this.textBox1 = new System.Windows.Forms.TextBox(); + this.textBox2 = new System.Windows.Forms.TextBox(); + this.textBox3 = new System.Windows.Forms.TextBox(); + this.textBox4 = new System.Windows.Forms.TextBox(); + this.textBox5 = new System.Windows.Forms.TextBox(); + this.button1 = new System.Windows.Forms.Button(); + this.button2 = new System.Windows.Forms.Button(); + this.pictureBox1 = new System.Windows.Forms.PictureBox(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); + this.SuspendLayout(); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(405, 31); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(58, 13); + this.label1.TabIndex = 1; + this.label1.Text = "连接到: "; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(405, 75); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(58, 13); + this.label2.TabIndex = 2; + this.label2.Text = "用户名: "; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(405, 114); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(52, 13); + this.label3.TabIndex = 3; + this.label3.Text = "密 码: "; + // + // label4 + // + this.label4.AutoSize = true; + this.label4.Location = new System.Drawing.Point(405, 154); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(58, 13); + this.label4.TabIndex = 4; + this.label4.Text = "所在组: "; + // + // label5 + // + this.label5.AutoSize = true; + this.label5.Location = new System.Drawing.Point(405, 191); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(52, 13); + this.label5.TabIndex = 5; + this.label5.Text = "角 色: "; + // + // textBox1 + // + this.textBox1.Location = new System.Drawing.Point(457, 27); + this.textBox1.Name = "textBox1"; + this.textBox1.Size = new System.Drawing.Size(120, 20); + this.textBox1.TabIndex = 6; + // + // textBox2 + // + this.textBox2.Location = new System.Drawing.Point(457, 68); + this.textBox2.Name = "textBox2"; + this.textBox2.Size = new System.Drawing.Size(120, 20); + this.textBox2.TabIndex = 7; + // + // textBox3 + // + this.textBox3.Location = new System.Drawing.Point(457, 107); + this.textBox3.Name = "textBox3"; + this.textBox3.PasswordChar = '*'; + this.textBox3.Size = new System.Drawing.Size(120, 20); + this.textBox3.TabIndex = 8; + // + // textBox4 + // + this.textBox4.Location = new System.Drawing.Point(457, 148); + this.textBox4.Name = "textBox4"; + this.textBox4.Size = new System.Drawing.Size(120, 20); + this.textBox4.TabIndex = 9; + // + // textBox5 + // + this.textBox5.Location = new System.Drawing.Point(457, 186); + this.textBox5.Name = "textBox5"; + this.textBox5.Size = new System.Drawing.Size(120, 20); + this.textBox5.TabIndex = 10; + // + // button1 + // + this.button1.Location = new System.Drawing.Point(407, 231); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(75, 25); + this.button1.TabIndex = 11; + this.button1.Text = "登录"; + this.button1.UseVisualStyleBackColor = true; + // + // button2 + // + this.button2.Location = new System.Drawing.Point(502, 231); + this.button2.Name = "button2"; + this.button2.Size = new System.Drawing.Size(75, 25); + this.button2.TabIndex = 12; + this.button2.Text = "取消"; + this.button2.UseVisualStyleBackColor = true; + // + // pictureBox1 + // + this.pictureBox1.Image = global::HelloTeamcenter.Properties.Resources.login; + this.pictureBox1.Location = new System.Drawing.Point(7, 13); + this.pictureBox1.Name = "pictureBox1"; + this.pictureBox1.Size = new System.Drawing.Size(383, 216); + this.pictureBox1.TabIndex = 0; + this.pictureBox1.TabStop = false; + // + // Login + // + this.AcceptButton = this.button1; + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(590, 269); + this.Controls.Add(this.button2); + this.Controls.Add(this.button1); + this.Controls.Add(this.textBox5); + this.Controls.Add(this.textBox4); + this.Controls.Add(this.textBox3); + this.Controls.Add(this.textBox2); + this.Controls.Add(this.textBox1); + this.Controls.Add(this.label5); + this.Controls.Add(this.label4); + this.Controls.Add(this.label3); + this.Controls.Add(this.label2); + this.Controls.Add(this.label1); + this.Controls.Add(this.pictureBox1); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; + this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "Login"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "登录"; + this.TopMost = true; + this.Load += new System.EventHandler(this.Login_Load); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + public System.Windows.Forms.PictureBox pictureBox1; + public System.Windows.Forms.Label label1; + public System.Windows.Forms.Label label2; + public System.Windows.Forms.Label label3; + public System.Windows.Forms.Label label4; + public System.Windows.Forms.Label label5; + public System.Windows.Forms.TextBox textBox1; + public System.Windows.Forms.TextBox textBox2; + public System.Windows.Forms.TextBox textBox3; + public System.Windows.Forms.TextBox textBox4; + public System.Windows.Forms.TextBox textBox5; + public System.Windows.Forms.Button button1; + public System.Windows.Forms.Button button2; + } +} \ No newline at end of file diff --git a/form/Login.cs b/form/Login.cs new file mode 100644 index 0000000..211bd4d --- /dev/null +++ b/form/Login.cs @@ -0,0 +1,74 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Text; +using System.Windows.Forms; + +using ZwSoft.ZwCAD.DatabaseServices; +using ZwSoft.ZwCAD.Runtime; +using ZwSoft.ZwCAD.Geometry; +using ZwSoft.ZwCAD.ApplicationServices; +using ZwSoft.ZwCAD.EditorInput; +using System.IO; +using Teamcenter.Hello; +using Teamcenter.ClientX; + + +namespace HelloTeamcenter.form +{ + public partial class Login : Form + { + public Login() + { + InitializeComponent(); + } + +// public string m_WebAddress = "http://192.168.10.147:7001/tc";//测试系统 +// public string m_WebAddress = "http://192.168.10.86:7001/tc";//正式系统(新,以此为准) + public string m_WebAddress = "http://192.168.10.91:7001/tc";//正式系统 + public string username = ""; + public string password = ""; + public string usergroup = ""; + public string userrole = ""; + public Document appodc; + + private void Login_Load(object sender, EventArgs e) + { + string tempdir = System.Environment.GetEnvironmentVariable("TEMP").ToString(); + Editor ed = appodc.Editor; + ed.WriteMessage("login文件路径:" + tempdir + "\n"); + string loginfile = tempdir + "\\login.ini"; + if (File.Exists(loginfile)) + { + StreamReader sr = new StreamReader(loginfile); + string line; + if ((line = sr.ReadLine()) != null) + { + + string[] ans = line.Split('|'); + for (int i = 0; i < ans.Length; i++) + { + if (i == 0) + m_WebAddress = ans[i].ToString(); + if (i == 1) + username = ans[i].ToString(); + if(i==2) + password = ans[i].ToString(); + if (i == 3) + usergroup = ans[i].ToString(); + if (i == 4) + userrole = ans[i].ToString(); + } + } + sr.Close(); + } + textBox1.Text = m_WebAddress; + textBox2.Text = username; + textBox3.Text = password; + textBox4.Text = usergroup; + textBox4.Text = userrole; + } + } +} diff --git a/form/Login.resx b/form/Login.resx new file mode 100644 index 0000000..80d957a --- /dev/null +++ b/form/Login.resx @@ -0,0 +1,134 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + True + + + + + AAABAAEAECAAAAEABAAoAQAAFgAAACgAAAAQAAAAIAAAAAEABAAAAAAAwAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAACAAACAAAAAgIAAgAAAAIAAgACAgAAAwMDAAICAgAAAAP8AAP8AAAD//wD/AAAA/wD/AP// + AAD///8A///////////0bm5ubm5ub/Rs6IjoiEzv9G6Pd4d3Tm/0bP/3f/dM7/Ru/45v905v9Gz/jO/3 + TO/0bn/2b/dOb/Rs5///90zv9G5ubm/3Tm/0bPeIf/bs7/Rub///fm5v9Gzs53zs7O/0xsbGxsbGz/RE + RERERERP//////////8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA + //8AAP//AAD//wAA//8AAP// + + + \ No newline at end of file diff --git a/form/OpenFromTC.Designer.cs b/form/OpenFromTC.Designer.cs new file mode 100644 index 0000000..64b5bce --- /dev/null +++ b/form/OpenFromTC.Designer.cs @@ -0,0 +1,135 @@ +namespace HelloTeamcenter.form +{ + partial class OpenFromTC + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(OpenFromTC)); + this.label1 = new System.Windows.Forms.Label(); + this.textBox1 = new System.Windows.Forms.TextBox(); + this.button1 = new System.Windows.Forms.Button(); + this.button2 = new System.Windows.Forms.Button(); + this.imageList1 = new System.Windows.Forms.ImageList(this.components); + this.treeView1 = new System.Windows.Forms.TreeView(); + this.SuspendLayout(); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(12, 333); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(79, 13); + this.label1.TabIndex = 1; + this.label1.Text = "数据集名称:"; + // + // textBox1 + // + this.textBox1.Location = new System.Drawing.Point(105, 329); + this.textBox1.Name = "textBox1"; + this.textBox1.ReadOnly = true; + this.textBox1.Size = new System.Drawing.Size(197, 20); + this.textBox1.TabIndex = 2; + this.textBox1.TabStop = false; + // + // button1 + // + this.button1.Location = new System.Drawing.Point(446, 324); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(75, 25); + this.button1.TabIndex = 3; + this.button1.Tag = ""; + this.button1.Text = "确定"; + this.button1.UseVisualStyleBackColor = true; + // + // button2 + // + this.button2.Location = new System.Drawing.Point(446, 355); + this.button2.Name = "button2"; + this.button2.Size = new System.Drawing.Size(75, 25); + this.button2.TabIndex = 4; + this.button2.Text = "查找->"; + this.button2.UseVisualStyleBackColor = true; + // + // imageList1 + // + this.imageList1.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream"))); + this.imageList1.TransparentColor = System.Drawing.Color.Transparent; + this.imageList1.Images.SetKeyName(0, "autocad_01.ico"); + this.imageList1.Images.SetKeyName(1, "FOLDER.ICO"); + this.imageList1.Images.SetKeyName(2, "FOLDEROP.ICO"); + this.imageList1.Images.SetKeyName(3, "item.ico"); + this.imageList1.Images.SetKeyName(4, "itemrev.ico"); + this.imageList1.Images.SetKeyName(5, "mail.ico"); + this.imageList1.Images.SetKeyName(6, "Newstuff_Folder.png"); + this.imageList1.Images.SetKeyName(7, "tai.ico"); + // + // treeView1 + // + this.treeView1.ImageIndex = 7; + this.treeView1.ImageList = this.imageList1; + this.treeView1.Location = new System.Drawing.Point(14, 13); + this.treeView1.Name = "treeView1"; + this.treeView1.SelectedImageIndex = 7; + this.treeView1.Size = new System.Drawing.Size(509, 304); + this.treeView1.TabIndex = 5; + this.treeView1.NodeMouseDoubleClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(this.treeView1_NodeMouseDoubleClick); + // + // OpenFromTC + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(538, 386); + this.Controls.Add(this.treeView1); + this.Controls.Add(this.button2); + this.Controls.Add(this.button1); + this.Controls.Add(this.textBox1); + this.Controls.Add(this.label1); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; + this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "OpenFromTC"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "打开"; + this.TopMost = true; + this.Load += new System.EventHandler(this.OpenFromTC_Load); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + public System.Windows.Forms.Label label1; + public System.Windows.Forms.TextBox textBox1; + public System.Windows.Forms.Button button1; + public System.Windows.Forms.Button button2; + public System.Windows.Forms.ImageList imageList1; + public System.Windows.Forms.TreeView treeView1; + } +} \ No newline at end of file diff --git a/form/OpenFromTC.cs b/form/OpenFromTC.cs new file mode 100644 index 0000000..67cb8e4 --- /dev/null +++ b/form/OpenFromTC.cs @@ -0,0 +1,454 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Text; +using System.Windows.Forms; + +using ZwSoft.ZwCAD.DatabaseServices; +using ZwSoft.ZwCAD.Runtime; +using ZwSoft.ZwCAD.Geometry; +using ZwSoft.ZwCAD.ApplicationServices; +using ZwSoft.ZwCAD.EditorInput; + +using Teamcenter.Hello; +using Teamcenter.Soa.Client; +using Teamcenter.ClientX; +using Teamcenter.Services.Strong.Core; +using Teamcenter.Soa.Client.Model; +using Teamcenter.Soa.Exceptions; +using Teamcenter.Services.Strong.Query; + +using Teamcenter.Services.Strong.Core._2007_06.DataManagement; + + +using User = Teamcenter.Soa.Client.Model.Strong.User; +using Folder = Teamcenter.Soa.Client.Model.Strong.Folder; +using WorkspaceObject = Teamcenter.Soa.Client.Model.Strong.WorkspaceObject; +using Item = Teamcenter.Soa.Client.Model.Strong.Item; +using ItemRevision = Teamcenter.Soa.Client.Model.Strong.ItemRevision; +using ImanQuery = Teamcenter.Soa.Client.Model.Strong.ImanQuery; +using DataSet = Teamcenter.Soa.Client.Model.Strong.Dataset; + + +public struct ALLOBJECT +{ + public TreeNode treenode; + public WorkspaceObject workobject; + public string name; + public string uid; +} + +namespace HelloTeamcenter.form +{ + public partial class OpenFromTC : Form + { + public List alllist = new List(); + public List folderlist = new List(); + public List itemlist = new List(); + public List itemvisionlist = new List(); + public List datasetlist = new List(); + public OpenFromTC() + { + InitializeComponent(); + } + public Document appodc; + public User user; + public bool first = true; + public Folder home = null; + Editor ed; + private void OpenFromTC_Load(object sender, EventArgs e) + { + ed = appodc.Editor; + treeView1.Nodes.Clear(); + TreeNode rootnode = new TreeNode("Home", 7, 7); + treeView1.Nodes.Add(rootnode); + + WorkspaceObject[] contents = null; + DataManagementService dmService = DataManagementService.getService(Session.getConnection()); + try + { + home = user.Home_folder; + } + catch (NotLoadedException ex) + { + ed.WriteMessage(ex.Message); + return; + } + try + { + ModelObject[] objects = { home }; + String[] attributes = { "contents" }; + dmService.RefreshObjects(objects); + dmService.GetProperties(objects, attributes); + contents = home.Contents; + } + catch (NotLoadedException ex) { ed.WriteMessage(ex.Message); } + //ALLOBJECT topobject = new ALLOBJECT(); + //topobject.treenode = rootnode; + //topobject.workobject = home; + //alllist.Add(topobject); + //folderlist.Add(topobject); + for (int i = 0; i < contents.Length; i++) + { + WorkspaceObject childobj = contents[i]; + ModelObject[] objects = { childobj }; + String[] attributes = { "object_string" ,"object_type" }; + dmService.RefreshObjects(objects); + dmService.GetProperties(objects, attributes); + string name = childobj.Object_string; + string type = childobj.Object_type; + if (type == "Folder" || type == "Newstuff Folder" || type == "Mail Folder") + { + ALLOBJECT perobject = new ALLOBJECT(); + perobject.workobject = childobj; + Folder fl = childobj as Folder; + if (type == "Folder") + { + TreeNode childnode = new TreeNode(name, 1, 1); + perobject.treenode = childnode; + perobject.name = name; + perobject.uid = childobj.Uid; + rootnode.Nodes.Add(childnode); + } + else if (type == "Newstuff Folder") + { + TreeNode childnode = new TreeNode(name, 6, 6); + perobject.treenode = childnode; + perobject.name = name; + perobject.uid = childobj.Uid; + rootnode.Nodes.Add(childnode); + } + else if (type == "Mail Folder") + { + TreeNode childnode = new TreeNode(name, 5, 5); + perobject.treenode = childnode; + perobject.name = name; + perobject.uid = childobj.Uid; + rootnode.Nodes.Add(childnode); + } + alllist.Add(perobject); + folderlist.Add(perobject); + } + else if (type == "Item" || type == "D5Product" + || type == "D5AsmPart" || type == "D5Part" + || type == "D5StdFasteners" || type == "D5CommonParts") + { + ALLOBJECT perobject = new ALLOBJECT(); + perobject.workobject = childobj; + Item item = childobj as Item; + TreeNode childnode = new TreeNode(name, 3, 3); + perobject.treenode = childnode; + perobject.name = name; + perobject.uid = childobj.Uid; + rootnode.Nodes.Add(childnode); + alllist.Add(perobject); + itemlist.Add(perobject); + } + } + foreach(TreeNode ch in rootnode.Nodes) + { + ch.EnsureVisible(); + } + } + + private void treeView1_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e) + { + //MessageBox.Show("获得"); + TreeNode nownode = this.treeView1.SelectedNode; + + getChild(nownode); + foreach (TreeNode ch in nownode.Nodes) + { + ch.EnsureVisible(); + } + } + + private void getChild(TreeNode nownode) + { + nownode.Nodes.Clear(); + DataManagementService dmService = DataManagementService.getService(Session.getConnection()); + WorkspaceObject[] contents = null; + //dmService.GetProperties(objects, attributes); + string nodetext = nownode.Text; + int imageindex = nownode.SelectedImageIndex; + List templist = new List(); + if (imageindex == 1) + { + foreach (ALLOBJECT perobject in folderlist) + { + if (perobject.treenode.Equals(nownode)) + { + Folder fl = perobject.workobject as Folder; + ModelObject[] objects = { fl }; + String[] attributes = { "contents" }; + dmService.RefreshObjects(objects); + dmService.GetProperties(objects, attributes); + contents = fl.Contents; + for (int i = 0; i < contents.Length; i++) + { + WorkspaceObject childobj = contents[i]; + ModelObject[] objects1 = { childobj }; + String[] attributes1 = { "object_string", "object_type" }; + dmService.RefreshObjects(objects1); + dmService.GetProperties(objects1, attributes1); + string name = childobj.Object_string; + string type = childobj.Object_type; + if (type == "Folder" || type == "Newstuff Folder" || type == "Mail Folder") + { + ALLOBJECT inperobject = new ALLOBJECT(); + inperobject.workobject = childobj; + Folder infl = childobj as Folder; + + if (type == "Folder") + { + TreeNode childnode = new TreeNode(name, 1, 1); + inperobject.treenode = childnode; + nownode.Nodes.Add(childnode); + } + else if (type == "Newstuff Folder") + { + TreeNode childnode = new TreeNode(name, 6, 6); + inperobject.treenode = childnode; + nownode.Nodes.Add(childnode); + } + else if (type == "Mail Folder") + { + TreeNode childnode = new TreeNode(name, 5, 5); + inperobject.treenode = childnode; + nownode.Nodes.Add(childnode); + } + templist.Add(inperobject); + folderlist.Add(inperobject); + } + else if (type == "Item" || type == "D5Product" + || type == "D5AsmPart" || type == "D5Part" + || type == "D5StdFasteners" || type == "D5CommonParts") + { + ALLOBJECT inperobject = new ALLOBJECT(); + inperobject.workobject = childobj; + Item item = childobj as Item; + TreeNode childnode = new TreeNode(name, 3, 3); + inperobject.treenode = childnode; + nownode.Nodes.Add(childnode); + templist.Add(inperobject); + itemlist.Add(inperobject); + } + } + break; + } + } + if (templist.Count > 0 && templist != null) + { + alllist.AddRange(templist); + templist.Clear(); + } + return; + + } + else if (imageindex == 3) + { + foreach (ALLOBJECT perobject in itemlist) + { + if (perobject.treenode.Equals(nownode)) + { + Item item = perobject.workobject as Item; + ModelObject[] itemrevisionlist = null; + ModelObject[] objects = { item }; + String[] attributes = { "revision_list" }; + dmService.RefreshObjects(objects); + dmService.GetProperties(objects, attributes); + itemrevisionlist = item.Revision_list; + for (int i = 0; i < itemrevisionlist.Length; i++) + { + ItemRevision itemrevision = itemrevisionlist[i] as ItemRevision; + ModelObject[] objects1 = { itemrevision }; + String[] attributes1 = { "object_string", "object_type" }; + dmService.RefreshObjects(objects1); + dmService.GetProperties(objects1, attributes1); + string name = itemrevision.Object_string; + string type = itemrevision.Object_type; + + ALLOBJECT inperobject = new ALLOBJECT(); + inperobject.workobject = itemrevision; + TreeNode childnode = new TreeNode(name, 4, 4); + inperobject.treenode = childnode; + nownode.Nodes.Add(childnode); + templist.Add(inperobject); + itemvisionlist.Add(inperobject); + } + break; + } + } + if (templist.Count > 0 && templist != null) + { + alllist.AddRange(templist); + templist.Clear(); + } + return; + } + else if (imageindex == 4) + { + foreach (ALLOBJECT perobject in itemvisionlist) + { + if (perobject.treenode.Equals(nownode)) + { + ItemRevision itemrevision = perobject.workobject as ItemRevision; + ExpandGRMRelationsPref myPref = new ExpandGRMRelationsPref(); + RelationAndTypesFilter2 myFilter = new RelationAndTypesFilter2(); + myFilter.RelationName = "IMAN_specification"; + String[] typeVec = { "D5DWG", "Folder" }; + myFilter.ObjectTypeNames = typeVec; + myPref.ExpItemRev = false; + RelationAndTypesFilter2[] myfilter = { myFilter }; + myPref.Info = myfilter; + ModelObject[] objects1 = { itemrevision }; + + ExpandGRMRelationsResponse myResp = dmService.ExpandGRMRelationsForPrimary(objects1,myPref); + ExpandGRMRelationsOutput[] myoutput = myResp.Output; + for (int i = 0; i < myoutput.Length; i++) + { + ExpandGRMRelationsOutput one_out = myoutput[i]; + for (int j = 0; j < one_out.OtherSideObjData.Length; j++) + { + ExpandGRMRelationsData otherSideData = one_out.OtherSideObjData[j]; + for (int k = 0; k < otherSideData.OtherSideObjects.Length; k++) + { + Type typeinfo = otherSideData.OtherSideObjects[k].GetType(); + string typename = typeinfo.Name; + if (typename == "Folder") + { + Folder infold = otherSideData.OtherSideObjects[k] as Folder; + + ModelObject[] objects = { infold }; + String[] attributes = { "object_string", "object_type" }; + dmService.RefreshObjects(objects); + dmService.GetProperties(objects, attributes); + string name = infold.Object_string; + string type = infold.Object_type; + + ALLOBJECT inperobject = new ALLOBJECT(); + inperobject.workobject = infold; + TreeNode childnode = new TreeNode(name, 1, 1); + inperobject.treenode = childnode; + nownode.Nodes.Add(childnode); + templist.Add(inperobject); + folderlist.Add(inperobject); + } + else + { + DataSet dateset = otherSideData.OtherSideObjects[k] as DataSet; + ModelObject[] objects = { dateset }; + String[] attributes = { "object_string" }; + dmService.RefreshObjects(objects); + dmService.GetProperties(objects, attributes); + string name = dateset.Object_string; + + ALLOBJECT inperobject = new ALLOBJECT(); + inperobject.workobject = dateset; + inperobject.name = name; + TreeNode childnode = new TreeNode(name, 0, 0); + inperobject.treenode = childnode; + nownode.Nodes.Add(childnode); + templist.Add(inperobject); + datasetlist.Add(inperobject); + } + } + } + } + break; + } + } + if (templist.Count > 0 && templist != null) + { + alllist.AddRange(templist); + templist.Clear(); + } + return; + } + else if (imageindex == 6) + { + + } + else if(imageindex == 7) + { + alllist.Clear(); + folderlist.Clear(); + itemlist.Clear(); + itemvisionlist.Clear(); + datasetlist.Clear(); + try + { + ModelObject[] objects = { home }; + String[] attributes = { "contents" }; + dmService.RefreshObjects(objects); + dmService.GetProperties(objects, attributes); + contents = home.Contents; + } + catch (NotLoadedException ex) { ed.WriteMessage(ex.Message); } + for (int i = 0; i < contents.Length; i++) + { + WorkspaceObject childobj = contents[i]; + ModelObject[] objects = { childobj }; + String[] attributes = { "object_string", "object_type" }; + dmService.RefreshObjects(objects); + dmService.GetProperties(objects, attributes); + string name = childobj.Object_string; + string type = childobj.Object_type; + if (type == "Folder" || type == "Newstuff Folder" || type == "Mail Folder") + { + ALLOBJECT perobject = new ALLOBJECT(); + perobject.workobject = childobj; + Folder fl = childobj as Folder; + if (type == "Folder") + { + TreeNode childnode = new TreeNode(name, 1, 1); + perobject.treenode = childnode; + perobject.name = name; + perobject.uid = childobj.Uid; + nownode.Nodes.Add(childnode); + } + else if (type == "Newstuff Folder") + { + TreeNode childnode = new TreeNode(name, 6, 6); + perobject.treenode = childnode; + perobject.name = name; + perobject.uid = childobj.Uid; + nownode.Nodes.Add(childnode); + } + else if (type == "Mail Folder") + { + TreeNode childnode = new TreeNode(name, 5, 5); + perobject.treenode = childnode; + perobject.name = name; + perobject.uid = childobj.Uid; + nownode.Nodes.Add(childnode); + } + alllist.Add(perobject); + folderlist.Add(perobject); + } + else if (type == "Item" || type == "D5Product" + || type == "D5AsmPart" || type == "D5Part" + || type == "D5StdFasteners" || type == "D5CommonParts") + { + ALLOBJECT perobject = new ALLOBJECT(); + perobject.workobject = childobj; + Item item = childobj as Item; + TreeNode childnode = new TreeNode(name, 3, 3); + perobject.treenode = childnode; + perobject.name = name; + perobject.uid = childobj.Uid; + nownode.Nodes.Add(childnode); + alllist.Add(perobject); + itemlist.Add(perobject); + } + } + foreach (TreeNode ch in nownode.Nodes) + { + ch.EnsureVisible(); + } + } + } + } +} diff --git a/form/OpenFromTC.resx b/form/OpenFromTC.resx new file mode 100644 index 0000000..afde822 --- /dev/null +++ b/form/OpenFromTC.resx @@ -0,0 +1,212 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + + + AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj0yLjAuMC4w + LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 + ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAABq + EAAAAk1TRnQBSQFMAgEBCAEAARQBAAEUAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo + AwABQAMAATADAAEBAQABCAYAAQwYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA + AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5 + AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA + AWYDAAGZAwABzAIAATMDAAIzAgABMwFmAgABMwGZAgABMwHMAgABMwH/AgABZgMAAWYBMwIAAmYCAAFm + AZkCAAFmAcwCAAFmAf8CAAGZAwABmQEzAgABmQFmAgACmQIAAZkBzAIAAZkB/wIAAcwDAAHMATMCAAHM + AWYCAAHMAZkCAALMAgABzAH/AgAB/wFmAgAB/wGZAgAB/wHMAQABMwH/AgAB/wEAATMBAAEzAQABZgEA + ATMBAAGZAQABMwEAAcwBAAEzAQAB/wEAAf8BMwIAAzMBAAIzAWYBAAIzAZkBAAIzAcwBAAIzAf8BAAEz + AWYCAAEzAWYBMwEAATMCZgEAATMBZgGZAQABMwFmAcwBAAEzAWYB/wEAATMBmQIAATMBmQEzAQABMwGZ + AWYBAAEzApkBAAEzAZkBzAEAATMBmQH/AQABMwHMAgABMwHMATMBAAEzAcwBZgEAATMBzAGZAQABMwLM + AQABMwHMAf8BAAEzAf8BMwEAATMB/wFmAQABMwH/AZkBAAEzAf8BzAEAATMC/wEAAWYDAAFmAQABMwEA + AWYBAAFmAQABZgEAAZkBAAFmAQABzAEAAWYBAAH/AQABZgEzAgABZgIzAQABZgEzAWYBAAFmATMBmQEA + AWYBMwHMAQABZgEzAf8BAAJmAgACZgEzAQADZgEAAmYBmQEAAmYBzAEAAWYBmQIAAWYBmQEzAQABZgGZ + AWYBAAFmApkBAAFmAZkBzAEAAWYBmQH/AQABZgHMAgABZgHMATMBAAFmAcwBmQEAAWYCzAEAAWYBzAH/ + AQABZgH/AgABZgH/ATMBAAFmAf8BmQEAAWYB/wHMAQABzAEAAf8BAAH/AQABzAEAApkCAAGZATMBmQEA + AZkBAAGZAQABmQEAAcwBAAGZAwABmQIzAQABmQEAAWYBAAGZATMBzAEAAZkBAAH/AQABmQFmAgABmQFm + ATMBAAGZATMBZgEAAZkBZgGZAQABmQFmAcwBAAGZATMB/wEAApkBMwEAApkBZgEAA5kBAAKZAcwBAAKZ + Af8BAAGZAcwCAAGZAcwBMwEAAWYBzAFmAQABmQHMAZkBAAGZAswBAAGZAcwB/wEAAZkB/wIAAZkB/wEz + AQABmQHMAWYBAAGZAf8BmQEAAZkB/wHMAQABmQL/AQABzAMAAZkBAAEzAQABzAEAAWYBAAHMAQABmQEA + AcwBAAHMAQABmQEzAgABzAIzAQABzAEzAWYBAAHMATMBmQEAAcwBMwHMAQABzAEzAf8BAAHMAWYCAAHM + AWYBMwEAAZkCZgEAAcwBZgGZAQABzAFmAcwBAAGZAWYB/wEAAcwBmQIAAcwBmQEzAQABzAGZAWYBAAHM + ApkBAAHMAZkBzAEAAcwBmQH/AQACzAIAAswBMwEAAswBZgEAAswBmQEAA8wBAALMAf8BAAHMAf8CAAHM + Af8BMwEAAZkB/wFmAQABzAH/AZkBAAHMAf8BzAEAAcwC/wEAAcwBAAEzAQAB/wEAAWYBAAH/AQABmQEA + AcwBMwIAAf8CMwEAAf8BMwFmAQAB/wEzAZkBAAH/ATMBzAEAAf8BMwH/AQAB/wFmAgAB/wFmATMBAAHM + AmYBAAH/AWYBmQEAAf8BZgHMAQABzAFmAf8BAAH/AZkCAAH/AZkBMwEAAf8BmQFmAQAB/wKZAQAB/wGZ + AcwBAAH/AZkB/wEAAf8BzAIAAf8BzAEzAQAB/wHMAWYBAAH/AcwBmQEAAf8CzAEAAf8BzAH/AQAC/wEz + AQABzAH/AWYBAAL/AZkBAAL/AcwBAAJmAf8BAAFmAf8BZgEAAWYC/wEAAf8CZgEAAf8BZgH/AQAC/wFm + AQABIQEAAaUBAANfAQADdwEAA4YBAAOWAQADywEAA7IBAAPXAQAD3QEAA+MBAAPqAQAD8QEAA/gBAAHw + AfsB/wEAAaQCoAEAA4ADAAH/AgAB/wMAAv8BAAH/AwAB/wEAAf8BAAL/AgAD//8A/wD/AP8AFQAQ/ycA + AZoCGgHwBQAQ/wMAAvANAAEEEAABGgHwARoBmgHlAVkBUgF5AfAEABD/AgABtAGtAc8BtQHvAgcBvAgA + AuwCBwEAAQMB+wEAAwcEAAIaAcMBGgLDAaABeQFZATIBmQGYAbwB8AEAAf8OAAH/AgABzweLAa4B9wHv + AQcEAALsAv8BAAEDAfsBAAL/AQcEAAGaAsMBGgL2AcMBeQI4AVgBVgFQAZgB8AH/DewBAAH/AgABzwGL + CYoBkgQAAuwC/wEAAQMB+wEAAv8BBwQAAXoDoAEaAvYBmgJZAVgBeAJQAfAB/wHsCwcB7AEAAf8CAAHP + ArIBrAeKAa4EAALsAv8BAAEDAfsBAAL/AQcEAAF6AuUBegJSAZkBGgGaAVkBmQGYAVYBUAHwAf8B7AED + AwcDAwMHAQMB7AEAAf8CAAHPAawFsgSKAZEBvAMAAQQB7AL/BAAC/wEHAwAB8AGaAXoB5QF6ATECUgEc + AZkBmgEaAZgBVwFWAfAB/wHsAfsBAwEHAQMDAAEDAQcBAwEHAewBAAH/AgABtQGtBbMDsgGzAa4BBwQA + AewI/wHsAwAB8AHDAfYBwwF6AVkBOAFYAngBHAGYAZkBmAF4AfAB/wHsAv8BAwEAAv8B+wEAAQMCBwHs + AQAB/wIAAbUBtAG7AroGswGRAQcEAAEDAQAG/wHsAgMCAAHwAZoCwwF6AjgBWAFXAVABSgFyAXMBHAGZ + AfAB/wHsAfsBBwEAAf8B+wP/AQABAwEHAewBAAH/AgABBwG0Aa0CtAEJAbsEugG0Ae8FAAEDAQAE/wHs + AgMB7AIAAfABmgF6AZoBegJZAnkBVgFQAXIBBwMAAf8B7AEHAQAB+wP/AfsC/wEAAQMB7AEAAf8CAAG1 + AZkBkAGYAbMBtAEJAhkCCQG1AQcGAAEDAQAC/wHsAgMEAAHwARoBegF5AZkBoAFYAVkBmQJWARwEAAH/ + AewBAAP/AfsD/wH7Af8BAAHsAQAB/wEAAbsBtAF5AZkBeQG0AgkEtAG1CAABAwIAAgMHAAHwArwBmQF5 + AZkBeAJWAXgEAAH/AewC/wH7A/8B+wP/AfsCAAH/AgAB7wF+AV4BWAEcA7QB1gIJAQcJAAMDAewBAQcA + AbwB8AEIAZgBeAKYAZkBBwQAAf8N7AEAAf8CAAKZAnkBtQHvAwACtQEHDQABAQcAAfABvALwAbwBBwK8 + BQAQ/wIAAQcBGgGRArwRAAEEAgABAQgABLwB8AcAEP8EAAHvHAAO8CoAARoB8AG8AfAEAAHvCYEB/wOB + AfAmAAGZARoBegFTAVkBUgF0AQcDAAGyAbkD2gO5AdoBuQH0AtoBuQG8IwACkwFMAXoDoAHlATEBMgFS + AZkCAAGyAtoCswLZAbMBiwGzAfQBswHUAbkBvA7sBAAM7AIAAfACmQEbAf8BmgH2AsMCoAExATgBMgF0 + AgABsgOzBtkB9AHZArMBvAHsAf8B+wEHAfsBBwH7AQcB+wEHAfsBBwH7AewEAAHsAf8B+wEHAfsBBwH7 + AQcB+wEHAfsB7AIAAbwBGgHDAv8BmQH/AvYCwwE3AjgBeQIAAbIBswGyAtkBuAHbAbkB2wGyAfQB2QGy + AbkBvAHsAf8BBwH7AQcB+wEHAfsBBwH7AQcB+wEHAewDAAHsAf8B+wEHAfsBBwH7AQcB+wEHAfsBBwEA + AewBAAG8AZoBoALDAZoB9gP/AfYBNwI4AXkCAAGyAdkBsgG4AbIBuAGKAbIBgQGyAfQB2QGyAbkBvAHs + Af8B+wEHAfsBBwH7AQcB+wEHAfsBBwH7AewDAAHsAf8BBwH7AQcB+wEHAfsBBwH7AQcB7AEAAewBAAG8 + AXkDoAFSAZkCwwEaAZoBegI4AXkCAAGyAdkBuAK5AbgB2QGyAYoB2QH0AdkBsgG5AbwB7AH/AQcB+wEH + AfsBBwH7AQcB+wEHAfsBBwHsAgAB7AH/AQcB+wEHAfsBBwH7AQcB+wEHAfsBAALsAQAB8AF6AuUBegFT + AVIBcwF0AbwB9AH2AXoBWQGZAgABsgLaAbMC3AG5AbgB2QG7Af8BuwGzAdoBvAHsAf8B+wEHAfsBBwH7 + AQcB+wEHAfsBBwH7AewCAAHsCv8B7AEAAQcB7AEAARoBmQN6AVkBMQErAUsBUgKZAZoCegIAAYEDswGQ + AYoBgQKzAbsBigG6ArMBBwHsAf8BBwH7AQcB+wEHAfsBBwH7AQcB+wEHAewCAA3sAfsB7AEAAXQBwwH2 + AsMBegFZATgBMgFMAZkBGgUAAboB2wK6AdoBugKRAdoBuwS6AQcB7AH/AfsBBwH7AQcB+wEHAfsBBwH7 + AQcB+wHsAwAB7AH/AQcB+wEHAfsBBwH7AQcB+wEHAfsBBwHsAQABdAHDAfYC/wGaAzgBUgcAAbkC2wGz + BNkBuAHyAf8B8gHbAdoBvAHsDP8B7AMAAewB/wH7AQcB+wEHAfsBBwX/AewBAAF6AsMC9gEaAfsCOAFS + BwABswTbAQkC3AIJAfQC2wHaAbwB7AEHAfsBBwH7AQcB+wEHBuwDAAHsAf8BBwH7AQcB+wEHAf8G7AEA + AnoCoAJ6AVkB+wE4AXkHAAGzAdsB3AcJAfQBCQHcAdsBvAEAAewBBwH7AQcB+wEHAewKAAHsBf8B7AcA + AnoBWQLlAcMBegJZAZkHAAG5CRkB9AMZAfACAAXsDAAF7AkAAfABGgFSAlkCegFTAXkRAAHwKAAC8AoA + AUIBTQE+BwABPgMAASgDAAFAAwABMAMAAQEBAAEBBQABgAEBFgAD/4EAAv8CAAT/Af4BHwIAAecB/wHA + AQMB4AEPAgABwAE/AcABAwGAAQECAAHAAQMBwAEDAYADAAHAAQMBwAEDAYADAAHAAQMBwAEDAYADAAHA + AQEBwAEDBAABwAEBAYABAQQAAcABAQHAAQEEAAHAAQEB4AEDAQABBwIAAcABAQHwAQcBAAEPAgABgAED + AfgBBwHAAQ8CAAHAAQMB/AEHAeABDwIAAcAB4wH+AScB4AEfAgABwQL/AWcB8AF/AgAB9wP/AYABAQX/ + AYcBgAEABP8B/AEDAYABAAGAAQEB4AEAAeABAQGAAgABAQHAAgABAQGAAgABAQHAAgABAQGAAgABAQGA + AgABAQGAAgABAQGAAgABAQGAAgABAQMAAQEBgAIAAQEDAAEBAYACAAEBAwABDwGAAgABAQGAAgABPwGA + AgABAQGAAgABPwGAAgABAwGAAQEBAAE/AYABAAGAAf8BwAF/AQABPwGAAQABwQH/AeAB/wGAAT8B/wHv + BP8B8wH/Cw== + + + + + + AAABAAEAECAAAAEABAAoAQAAFgAAACgAAAAQAAAAIAAAAAEABAAAAAAAwAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAACAAACAAAAAgIAAgAAAAIAAgACAgAAAwMDAAICAgAAAAP8AAP8AAAD//wD/AAAA/wD/AP// + AAD///8A///////////0bm5ubm5ub/Rs6IjoiEzv9G6Pd4d3Tm/0bP/3f/dM7/Ru/45v905v9Gz/jO/3 + TO/0bn/2b/dOb/Rs5///90zv9G5ubm/3Tm/0bPeIf/bs7/Rub///fm5v9Gzs53zs7O/0xsbGxsbGz/RE + RERERERP//////////8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA + //8AAP//AAD//wAA//8AAP// + + + \ No newline at end of file diff --git a/form/SaveToTC.Designer.cs b/form/SaveToTC.Designer.cs new file mode 100644 index 0000000..4dbfe99 --- /dev/null +++ b/form/SaveToTC.Designer.cs @@ -0,0 +1,120 @@ +namespace HelloTeamcenter.form +{ + partial class SaveToTC + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SaveToTC)); + this.treeView1 = new System.Windows.Forms.TreeView(); + this.imageList1 = new System.Windows.Forms.ImageList(this.components); + this.button1 = new System.Windows.Forms.Button(); + this.label1 = new System.Windows.Forms.Label(); + this.comboBox1 = new System.Windows.Forms.ComboBox(); + this.SuspendLayout(); + // + // treeView1 + // + this.treeView1.ImageIndex = 7; + this.treeView1.ImageList = this.imageList1; + this.treeView1.Location = new System.Drawing.Point(12, 13); + this.treeView1.Name = "treeView1"; + this.treeView1.SelectedImageIndex = 7; + this.treeView1.Size = new System.Drawing.Size(491, 323); + this.treeView1.TabIndex = 6; + this.treeView1.NodeMouseDoubleClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(this.treeView1_NodeMouseDoubleClick); + // + // imageList1 + // + this.imageList1.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream"))); + this.imageList1.TransparentColor = System.Drawing.Color.Transparent; + this.imageList1.Images.SetKeyName(0, "autocad_01.ico"); + this.imageList1.Images.SetKeyName(1, "FOLDER.ICO"); + this.imageList1.Images.SetKeyName(2, "FOLDEROP.ICO"); + this.imageList1.Images.SetKeyName(3, "item.ico"); + this.imageList1.Images.SetKeyName(4, "itemrev.ico"); + this.imageList1.Images.SetKeyName(5, "mail.ico"); + this.imageList1.Images.SetKeyName(6, "Newstuff_Folder.png"); + this.imageList1.Images.SetKeyName(7, "tai.ico"); + // + // button1 + // + this.button1.Location = new System.Drawing.Point(428, 342); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(75, 25); + this.button1.TabIndex = 7; + this.button1.Text = "保存"; + this.button1.UseVisualStyleBackColor = true; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(12, 348); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(63, 13); + this.label1.TabIndex = 8; + this.label1.Text = "Item类型:"; + // + // comboBox1 + // + this.comboBox1.FormattingEnabled = true; + this.comboBox1.Items.AddRange(new object[] { + "Item"}); + this.comboBox1.Location = new System.Drawing.Point(83, 345); + this.comboBox1.Name = "comboBox1"; + this.comboBox1.Size = new System.Drawing.Size(242, 21); + this.comboBox1.TabIndex = 9; + // + // SaveToTC + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(515, 385); + this.Controls.Add(this.comboBox1); + this.Controls.Add(this.label1); + this.Controls.Add(this.button1); + this.Controls.Add(this.treeView1); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; + this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); + this.Name = "SaveToTC"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "保存"; + this.Load += new System.EventHandler(this.SaveToTC_Load); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + public System.Windows.Forms.TreeView treeView1; + public System.Windows.Forms.ImageList imageList1; + public System.Windows.Forms.Button button1; + private System.Windows.Forms.Label label1; + public System.Windows.Forms.ComboBox comboBox1; + } +} \ No newline at end of file diff --git a/form/SaveToTC.cs b/form/SaveToTC.cs new file mode 100644 index 0000000..47e554a --- /dev/null +++ b/form/SaveToTC.cs @@ -0,0 +1,450 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Text; +using System.Windows.Forms; + + +using ZwSoft.ZwCAD.DatabaseServices; +using ZwSoft.ZwCAD.Runtime; +using ZwSoft.ZwCAD.Geometry; +using ZwSoft.ZwCAD.ApplicationServices; +using ZwSoft.ZwCAD.EditorInput; + +using Teamcenter.Hello; +using Teamcenter.Soa.Client; +using Teamcenter.ClientX; +using Teamcenter.Services.Strong.Core; +using Teamcenter.Soa.Client.Model; +using Teamcenter.Soa.Exceptions; +using Teamcenter.Services.Strong.Query; + +using Teamcenter.Services.Strong.Core._2007_06.DataManagement; + + +using User = Teamcenter.Soa.Client.Model.Strong.User; +using Folder = Teamcenter.Soa.Client.Model.Strong.Folder; +using WorkspaceObject = Teamcenter.Soa.Client.Model.Strong.WorkspaceObject; +using Item = Teamcenter.Soa.Client.Model.Strong.Item; +using ItemRevision = Teamcenter.Soa.Client.Model.Strong.ItemRevision; +using ImanQuery = Teamcenter.Soa.Client.Model.Strong.ImanQuery; +using DataSet = Teamcenter.Soa.Client.Model.Strong.Dataset; + +using HelloTeamcenter.hello; + + +namespace HelloTeamcenter.form +{ + public partial class SaveToTC : Form + { + public Document appdoc; + public User user; + public bool first = true; + public Folder home = null; + Editor ed; + + public List folderlist = new List(); + public List itemlist = new List(); + public List itemvisionlist = new List(); + public List datasetlist = new List(); + + public OriginBTL btlinfo; + public List bomlist; + public Hashtable itemtypetable; + + public string xmlpath = ""; + + public SaveToTC() + { + InitializeComponent(); + } + + private void SaveToTC_Load(object sender, EventArgs e) + { + ed = appdoc.Editor; + treeView1.Nodes.Clear(); + + //读取Item类型.xml信息 + OriginItemType originitemtype = new OriginItemType(); + originitemtype.getType(this.xmlpath); + this.itemtypetable = originitemtype.Itemtypetable; + + foreach (DictionaryEntry de in itemtypetable) + { + this.comboBox1.Items.Add(de.Key.ToString()); + } + + OriginReadXml originreadxml = new OriginReadXml(); + OriginTypeRule origintyperule = originreadxml.OriginReadRuleXML(xmlpath); + OriginTool origintool = new OriginTool(); + string itemtype = origintool.getItemType(btlinfo, origintyperule); + + + if (this.comboBox1.Items.Contains(itemtype)) + this.comboBox1.SelectedText = itemtype; + else + { + this.comboBox1.Items.Add(itemtype); + this.comboBox1.SelectedText = itemtype; + } + + TreeNode rootnode = new TreeNode("Home", 7, 7); + treeView1.Nodes.Add(rootnode); + + WorkspaceObject[] contents = null; + DataManagementService dmService = DataManagementService.getService(Session.getConnection()); + try + { + home = user.Home_folder; + } + catch (NotLoadedException ex) + { + MessageBox.Show(ex.Message); + return; + } + try + { + ModelObject[] objects = { home }; + String[] attributes = { "contents" }; + dmService.RefreshObjects(objects); + dmService.GetProperties(objects, attributes); + contents = home.Contents; + } + catch (NotLoadedException ex) { MessageBox.Show(ex.Message); } + for (int i = 0; i < contents.Length; i++) + { + WorkspaceObject childobj = contents[i]; + ModelObject[] objects = { childobj }; + String[] attributes = { "object_string", "object_type" }; + dmService.RefreshObjects(objects); + dmService.GetProperties(objects, attributes); + string name = childobj.Object_string; + string type = childobj.Object_type; + if (type == "Folder" || type == "Newstuff Folder" || type == "Mail Folder") + { + ALLOBJECT perobject = new ALLOBJECT(); + perobject.workobject = childobj; + Folder fl = childobj as Folder; + if (type == "Folder") + { + TreeNode childnode = new TreeNode(name, 1, 1); + perobject.treenode = childnode; + perobject.name = name; + perobject.uid = childobj.Uid; + rootnode.Nodes.Add(childnode); + } + else if (type == "Newstuff Folder") + { + TreeNode childnode = new TreeNode(name, 6, 6); + perobject.treenode = childnode; + perobject.name = name; + perobject.uid = childobj.Uid; + rootnode.Nodes.Add(childnode); + } + else if (type == "Mail Folder") + { + TreeNode childnode = new TreeNode(name, 5, 5); + perobject.treenode = childnode; + perobject.name = name; + perobject.uid = childobj.Uid; + rootnode.Nodes.Add(childnode); + } + folderlist.Add(perobject); + } + else if (type == "Item" || this.itemtypetable.ContainsValue(type)) //需要替换类型 + { + ALLOBJECT perobject = new ALLOBJECT(); + perobject.workobject = childobj; + Item item = childobj as Item; + TreeNode childnode = new TreeNode(name, 3, 3); + perobject.treenode = childnode; + perobject.name = name; + perobject.uid = childobj.Uid; + rootnode.Nodes.Add(childnode); + itemlist.Add(perobject); + } + } + foreach (TreeNode ch in rootnode.Nodes) + { + ch.EnsureVisible(); + } + + //这边是加载Item类型.xml文件的信息 + ////Tool tool = new Tool(); + ////BTLClass btlinfo = tool.getBTL("DFHM_BTL"); + ////string itemtype = tool.initItemType(btlinfo.Item_id, btlinfo.Materialgrade); + ////this.comboBox1.SelectedText = itemtype; + } + + private void treeView1_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e) + { + TreeNode nownode = this.treeView1.SelectedNode; + + getChild(nownode); + foreach (TreeNode ch in nownode.Nodes) + { + ch.EnsureVisible(); + } + } + + private void getChild(TreeNode nownode) + { + nownode.Nodes.Clear(); + DataManagementService dmService = DataManagementService.getService(Session.getConnection()); + WorkspaceObject[] contents = null; + string nodetext = nownode.Text; + int imageindex = nownode.SelectedImageIndex; + if (imageindex == 1) + { + foreach (ALLOBJECT perobject in folderlist) + { + if (perobject.treenode.Equals(nownode)) + { + Folder fl = perobject.workobject as Folder; + ModelObject[] objects = { fl }; + String[] attributes = { "contents" }; + dmService.RefreshObjects(objects); + dmService.GetProperties(objects, attributes); + contents = fl.Contents; + for (int i = 0; i < contents.Length; i++) + { + WorkspaceObject childobj = contents[i]; + ModelObject[] objects1 = { childobj }; + String[] attributes1 = { "object_string", "object_type" }; + dmService.RefreshObjects(objects1); + dmService.GetProperties(objects1, attributes1); + string name = childobj.Object_string; + string type = childobj.Object_type; + if (type == "Folder" || type == "Newstuff Folder" || type == "Mail Folder") + { + ALLOBJECT inperobject = new ALLOBJECT(); + inperobject.workobject = childobj; + Folder infl = childobj as Folder; + + if (type == "Folder") + { + TreeNode childnode = new TreeNode(name, 1, 1); + inperobject.treenode = childnode; + nownode.Nodes.Add(childnode); + } + else if (type == "Newstuff Folder") + { + TreeNode childnode = new TreeNode(name, 6, 6); + inperobject.treenode = childnode; + nownode.Nodes.Add(childnode); + } + else if (type == "Mail Folder") + { + TreeNode childnode = new TreeNode(name, 5, 5); + inperobject.treenode = childnode; + nownode.Nodes.Add(childnode); + } + folderlist.Add(inperobject); + } + else if (type == "Item" || this.itemtypetable.ContainsValue(type))//需要替换类型 + { + ALLOBJECT inperobject = new ALLOBJECT(); + inperobject.workobject = childobj; + Item item = childobj as Item; + TreeNode childnode = new TreeNode(name, 3, 3); + inperobject.treenode = childnode; + nownode.Nodes.Add(childnode); + itemlist.Add(inperobject); + } + } + break; + } + } + return; + + } + else if (imageindex == 3) + { + foreach (ALLOBJECT perobject in itemlist) + { + if (perobject.treenode.Equals(nownode)) + { + Item item = perobject.workobject as Item; + ModelObject[] itemrevisionlist = null; + ModelObject[] objects = { item }; + String[] attributes = { "revision_list" }; + dmService.RefreshObjects(objects); + dmService.GetProperties(objects, attributes); + itemrevisionlist = item.Revision_list; + for (int i = 0; i < itemrevisionlist.Length; i++) + { + ItemRevision itemrevision = itemrevisionlist[i] as ItemRevision; + ModelObject[] objects1 = { itemrevision }; + String[] attributes1 = { "object_string", "object_type" }; + dmService.RefreshObjects(objects1); + dmService.GetProperties(objects1, attributes1); + string name = itemrevision.Object_string; + string type = itemrevision.Object_type; + + ALLOBJECT inperobject = new ALLOBJECT(); + inperobject.workobject = itemrevision; + TreeNode childnode = new TreeNode(name, 4, 4); + inperobject.treenode = childnode; + nownode.Nodes.Add(childnode); + itemvisionlist.Add(inperobject); + } + break; + } + } + return; + } + else if (imageindex == 4) + { + foreach (ALLOBJECT perobject in itemvisionlist) + { + if (perobject.treenode.Equals(nownode)) + { + ItemRevision itemrevision = perobject.workobject as ItemRevision; + ExpandGRMRelationsPref myPref = new ExpandGRMRelationsPref(); + RelationAndTypesFilter2 myFilter = new RelationAndTypesFilter2(); + myFilter.RelationName = "IMAN_specification"; + String[] typeVec = { "D5DWG", "Folder" }; + myFilter.ObjectTypeNames = typeVec; + myPref.ExpItemRev = false; + RelationAndTypesFilter2[] myfilter = { myFilter }; + myPref.Info = myfilter; + ModelObject[] objects1 = { itemrevision }; + + ExpandGRMRelationsResponse myResp = dmService.ExpandGRMRelationsForPrimary(objects1, myPref); + ExpandGRMRelationsOutput[] myoutput = myResp.Output; + for (int i = 0; i < myoutput.Length; i++) + { + ExpandGRMRelationsOutput one_out = myoutput[i]; + for (int j = 0; j < one_out.OtherSideObjData.Length; j++) + { + ExpandGRMRelationsData otherSideData = one_out.OtherSideObjData[j]; + for (int k = 0; k < otherSideData.OtherSideObjects.Length; k++) + { + Type typeinfo = otherSideData.OtherSideObjects[k].GetType(); + string typename = typeinfo.Name; + if (typename == "Folder") + { + Folder infold = otherSideData.OtherSideObjects[k] as Folder; + + ModelObject[] objects = { infold }; + String[] attributes = { "object_string", "object_type" }; + dmService.RefreshObjects(objects); + dmService.GetProperties(objects, attributes); + string name = infold.Object_string; + string type = infold.Object_type; + + ALLOBJECT inperobject = new ALLOBJECT(); + inperobject.workobject = infold; + TreeNode childnode = new TreeNode(name, 1, 1); + inperobject.treenode = childnode; + nownode.Nodes.Add(childnode); + folderlist.Add(inperobject); + } + else + { + DataSet dateset = otherSideData.OtherSideObjects[k] as DataSet; + ModelObject[] objects = { dateset }; + String[] attributes = { "object_string" }; + dmService.RefreshObjects(objects); + dmService.GetProperties(objects, attributes); + string name = dateset.Object_string; + + ALLOBJECT inperobject = new ALLOBJECT(); + inperobject.workobject = dateset; + inperobject.name = name; + TreeNode childnode = new TreeNode(name, 0, 0); + inperobject.treenode = childnode; + nownode.Nodes.Add(childnode); + datasetlist.Add(inperobject); + } + } + } + } + break; + } + } + return; + } + else if (imageindex == 6) + { + + } + else if (imageindex == 7) + { + folderlist.Clear(); + itemlist.Clear(); + itemvisionlist.Clear(); + datasetlist.Clear(); + try + { + ModelObject[] objects = { home }; + String[] attributes = { "contents" }; + dmService.RefreshObjects(objects); + dmService.GetProperties(objects, attributes); + contents = home.Contents; + } + catch (NotLoadedException ex) { MessageBox.Show(ex.Message); } + for (int i = 0; i < contents.Length; i++) + { + WorkspaceObject childobj = contents[i]; + ModelObject[] objects = { childobj }; + String[] attributes = { "object_string", "object_type" }; + dmService.RefreshObjects(objects); + dmService.GetProperties(objects, attributes); + string name = childobj.Object_string; + string type = childobj.Object_type; + if (type == "Folder" || type == "Newstuff Folder" || type == "Mail Folder") + { + ALLOBJECT perobject = new ALLOBJECT(); + perobject.workobject = childobj; + Folder fl = childobj as Folder; + if (type == "Folder") + { + TreeNode childnode = new TreeNode(name, 1, 1); + perobject.treenode = childnode; + perobject.name = name; + perobject.uid = childobj.Uid; + nownode.Nodes.Add(childnode); + } + else if (type == "Newstuff Folder") + { + TreeNode childnode = new TreeNode(name, 6, 6); + perobject.treenode = childnode; + perobject.name = name; + perobject.uid = childobj.Uid; + nownode.Nodes.Add(childnode); + } + else if (type == "Mail Folder") + { + TreeNode childnode = new TreeNode(name, 5, 5); + perobject.treenode = childnode; + perobject.name = name; + perobject.uid = childobj.Uid; + nownode.Nodes.Add(childnode); + } + folderlist.Add(perobject); + } + else if (type == "Item" || this.itemtypetable.ContainsValue(type)) + { + ALLOBJECT perobject = new ALLOBJECT(); + perobject.workobject = childobj; + Item item = childobj as Item; + TreeNode childnode = new TreeNode(name, 3, 3); + perobject.treenode = childnode; + perobject.name = name; + perobject.uid = childobj.Uid; + nownode.Nodes.Add(childnode); + itemlist.Add(perobject); + } + } + foreach (TreeNode ch in nownode.Nodes) + { + ch.EnsureVisible(); + } + } + } + } +} diff --git a/form/SaveToTC.resx b/form/SaveToTC.resx new file mode 100644 index 0000000..36e954d --- /dev/null +++ b/form/SaveToTC.resx @@ -0,0 +1,212 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + + + AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj0yLjAuMC4w + LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 + ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAABq + EAAAAk1TRnQBSQFMAgEBCAEAARwBAAEcAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo + AwABQAMAATADAAEBAQABCAYAAQwYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA + AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5 + AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA + AWYDAAGZAwABzAIAATMDAAIzAgABMwFmAgABMwGZAgABMwHMAgABMwH/AgABZgMAAWYBMwIAAmYCAAFm + AZkCAAFmAcwCAAFmAf8CAAGZAwABmQEzAgABmQFmAgACmQIAAZkBzAIAAZkB/wIAAcwDAAHMATMCAAHM + AWYCAAHMAZkCAALMAgABzAH/AgAB/wFmAgAB/wGZAgAB/wHMAQABMwH/AgAB/wEAATMBAAEzAQABZgEA + ATMBAAGZAQABMwEAAcwBAAEzAQAB/wEAAf8BMwIAAzMBAAIzAWYBAAIzAZkBAAIzAcwBAAIzAf8BAAEz + AWYCAAEzAWYBMwEAATMCZgEAATMBZgGZAQABMwFmAcwBAAEzAWYB/wEAATMBmQIAATMBmQEzAQABMwGZ + AWYBAAEzApkBAAEzAZkBzAEAATMBmQH/AQABMwHMAgABMwHMATMBAAEzAcwBZgEAATMBzAGZAQABMwLM + AQABMwHMAf8BAAEzAf8BMwEAATMB/wFmAQABMwH/AZkBAAEzAf8BzAEAATMC/wEAAWYDAAFmAQABMwEA + AWYBAAFmAQABZgEAAZkBAAFmAQABzAEAAWYBAAH/AQABZgEzAgABZgIzAQABZgEzAWYBAAFmATMBmQEA + AWYBMwHMAQABZgEzAf8BAAJmAgACZgEzAQADZgEAAmYBmQEAAmYBzAEAAWYBmQIAAWYBmQEzAQABZgGZ + AWYBAAFmApkBAAFmAZkBzAEAAWYBmQH/AQABZgHMAgABZgHMATMBAAFmAcwBmQEAAWYCzAEAAWYBzAH/ + AQABZgH/AgABZgH/ATMBAAFmAf8BmQEAAWYB/wHMAQABzAEAAf8BAAH/AQABzAEAApkCAAGZATMBmQEA + AZkBAAGZAQABmQEAAcwBAAGZAwABmQIzAQABmQEAAWYBAAGZATMBzAEAAZkBAAH/AQABmQFmAgABmQFm + ATMBAAGZATMBZgEAAZkBZgGZAQABmQFmAcwBAAGZATMB/wEAApkBMwEAApkBZgEAA5kBAAKZAcwBAAKZ + Af8BAAGZAcwCAAGZAcwBMwEAAWYBzAFmAQABmQHMAZkBAAGZAswBAAGZAcwB/wEAAZkB/wIAAZkB/wEz + AQABmQHMAWYBAAGZAf8BmQEAAZkB/wHMAQABmQL/AQABzAMAAZkBAAEzAQABzAEAAWYBAAHMAQABmQEA + AcwBAAHMAQABmQEzAgABzAIzAQABzAEzAWYBAAHMATMBmQEAAcwBMwHMAQABzAEzAf8BAAHMAWYCAAHM + AWYBMwEAAZkCZgEAAcwBZgGZAQABzAFmAcwBAAGZAWYB/wEAAcwBmQIAAcwBmQEzAQABzAGZAWYBAAHM + ApkBAAHMAZkBzAEAAcwBmQH/AQACzAIAAswBMwEAAswBZgEAAswBmQEAA8wBAALMAf8BAAHMAf8CAAHM + Af8BMwEAAZkB/wFmAQABzAH/AZkBAAHMAf8BzAEAAcwC/wEAAcwBAAEzAQAB/wEAAWYBAAH/AQABmQEA + AcwBMwIAAf8CMwEAAf8BMwFmAQAB/wEzAZkBAAH/ATMBzAEAAf8BMwH/AQAB/wFmAgAB/wFmATMBAAHM + AmYBAAH/AWYBmQEAAf8BZgHMAQABzAFmAf8BAAH/AZkCAAH/AZkBMwEAAf8BmQFmAQAB/wKZAQAB/wGZ + AcwBAAH/AZkB/wEAAf8BzAIAAf8BzAEzAQAB/wHMAWYBAAH/AcwBmQEAAf8CzAEAAf8BzAH/AQAC/wEz + AQABzAH/AWYBAAL/AZkBAAL/AcwBAAJmAf8BAAFmAf8BZgEAAWYC/wEAAf8CZgEAAf8BZgH/AQAC/wFm + AQABIQEAAaUBAANfAQADdwEAA4YBAAOWAQADywEAA7IBAAPXAQAD3QEAA+MBAAPqAQAD8QEAA/gBAAHw + AfsB/wEAAaQCoAEAA4ADAAH/AgAB/wMAAv8BAAH/AwAB/wEAAf8BAAL/AgAD//8A/wD/AP8AFQAQ/ycA + AZoCGgHwBQAQ/wMAAvANAAEEEAABGgHwARoBmgHlAVkBUgF5AfAEABD/AgABtAGtAc8BtQHvAgcBvAgA + AuwCBwEAAQMB+wEAAwcEAAIaAcMBGgLDAaABeQFZATIBmQGYAbwB8AEAAf8OAAH/AgABzweLAa4B9wHv + AQcEAALsAv8BAAEDAfsBAAL/AQcEAAGaAsMBGgL2AcMBeQI4AVgBVgFQAZgB8AH/DewBAAH/AgABzwGL + CYoBkgQAAuwC/wEAAQMB+wEAAv8BBwQAAXoDoAEaAvYBmgJZAVgBeAJQAfAB/wHsCwcB7AEAAf8CAAHP + ArIBrAeKAa4EAALsAv8BAAEDAfsBAAL/AQcEAAF6AuUBegJSAZkBGgGaAVkBmQGYAVYBUAHwAf8B7AED + AwcDAwMHAQMB7AEAAf8CAAHPAawFsgSKAZEBvAMAAQQB7AL/BAAC/wEHAwAB8AGaAXoB5QF6ATECUgEc + AZkBmgEaAZgBVwFWAfAB/wHsAfsBAwEHAQMDAAEDAQcBAwEHAewBAAH/AgABtQGtBbMDsgGzAa4BBwQA + AewI/wHsAwAB8AHDAfYBwwF6AVkBOAFYAngBHAGYAZkBmAF4AfAB/wHsAv8BAwEAAv8B+wEAAQMCBwHs + AQAB/wIAAbUBtAG7AroGswGRAQcEAAEDAQAG/wHsAgMCAAHwAZoCwwF6AjgBWAFXAVABSgFyAXMBHAGZ + AfAB/wHsAfsBBwEAAf8B+wP/AQABAwEHAewBAAH/AgABBwG0Aa0CtAEJAbsEugG0Ae8FAAEDAQAE/wHs + AgMB7AIAAfABmgF6AZoBegJZAnkBVgFQAXIBBwMAAf8B7AEHAQAB+wP/AfsC/wEAAQMB7AEAAf8CAAG1 + AZkBkAGYAbMBtAEJAhkCCQG1AQcGAAEDAQAC/wHsAgMEAAHwARoBegF5AZkBoAFYAVkBmQJWARwEAAH/ + AewBAAP/AfsD/wH7Af8BAAHsAQAB/wEAAbsBtAF5AZkBeQG0AgkEtAG1CAABAwIAAgMHAAHwArwBmQF5 + AZkBeAJWAXgEAAH/AewC/wH7A/8B+wP/AfsCAAH/AgAB7wF+AV4BWAEcA7QB1gIJAQcJAAMDAewBAQcA + AbwB8AEIAZgBeAKYAZkBBwQAAf8N7AEAAf8CAAKZAnkBtQHvAwACtQEHDQABAQcAAfABvALwAbwBBwK8 + BQAQ/wIAAQcBGgGRArwRAAEEAgABAQgABLwB8AcAEP8EAAHvHAAO8CoAARoB8AG8AfAEAAHvCYEB/wOB + AfAmAAGZARoBegFTAVkBUgF0AQcDAAGyAbkD2gO5AdoBuQH0AtoBuQG8IwACkwFMAXoDoAHlATEBMgFS + AZkCAAGyAtoCswLZAbMBiwGzAfQBswHUAbkBvA7sBAAM7AIAAfACmQEbAf8BmgH2AsMCoAExATgBMgF0 + AgABsgOzBtkB9AHZArMBvAHsAf8B+wEHAfsBBwH7AQcB+wEHAfsBBwH7AewEAAHsAf8B+wEHAfsBBwH7 + AQcB+wEHAfsB7AIAAbwBGgHDAv8BmQH/AvYCwwE3AjgBeQIAAbIBswGyAtkBuAHbAbkB2wGyAfQB2QGy + AbkBvAHsAf8BBwH7AQcB+wEHAfsBBwH7AQcB+wEHAewDAAHsAf8B+wEHAfsBBwH7AQcB+wEHAfsBBwEA + AewBAAG8AZoBoALDAZoB9gP/AfYBNwI4AXkCAAGyAdkBsgG4AbIBuAGKAbIBgQGyAfQB2QGyAbkBvAHs + Af8B+wEHAfsBBwH7AQcB+wEHAfsBBwH7AewDAAHsAf8BBwH7AQcB+wEHAfsBBwH7AQcB7AEAAewBAAG8 + AXkDoAFSAZkCwwEaAZoBegI4AXkCAAGyAdkBuAK5AbgB2QGyAYoB2QH0AdkBsgG5AbwB7AH/AQcB+wEH + AfsBBwH7AQcB+wEHAfsBBwHsAgAB7AH/AQcB+wEHAfsBBwH7AQcB+wEHAfsBAALsAQAB8AF6AuUBegFT + AVIBcwF0AbwB9AH2AXoBWQGZAgABsgLaAbMC3AG5AbgB2QG7Af8BuwGzAdoBvAHsAf8B+wEHAfsBBwH7 + AQcB+wEHAfsBBwH7AewCAAHsCv8B7AEAAQcB7AEAARoBmQN6AVkBMQErAUsBUgKZAZoCegIAAYEDswGQ + AYoBgQKzAbsBigG6ArMBBwHsAf8BBwH7AQcB+wEHAfsBBwH7AQcB+wEHAewCAA3sAfsB7AEAAXQBwwH2 + AsMBegFZATgBMgFMAZkBGgUAAboB2wK6AdoBugKRAdoBuwS6AQcB7AH/AfsBBwH7AQcB+wEHAfsBBwH7 + AQcB+wHsAwAB7AH/AQcB+wEHAfsBBwH7AQcB+wEHAfsBBwHsAQABdAHDAfYC/wGaAzgBUgcAAbkC2wGz + BNkBuAHyAf8B8gHbAdoBvAHsDP8B7AMAAewB/wH7AQcB+wEHAfsBBwX/AewBAAF6AsMC9gEaAfsCOAFS + BwABswTbAQkC3AIJAfQC2wHaAbwB7AEHAfsBBwH7AQcB+wEHBuwDAAHsAf8BBwH7AQcB+wEHAf8G7AEA + AnoCoAJ6AVkB+wE4AXkHAAGzAdsB3AcJAfQBCQHcAdsBvAEAAewBBwH7AQcB+wEHAewKAAHsBf8B7AcA + AnoBWQLlAcMBegJZAZkHAAG5CRkB9AMZAfACAAXsDAAF7AkAAfABGgFSAlkCegFTAXkRAAHwKAAC8AoA + AUIBTQE+BwABPgMAASgDAAFAAwABMAMAAQEBAAEBBQABgAEBFgAD/4EAAv8CAAT/Af4BHwIAAecB/wHA + AQMB4AEPAgABwAE/AcABAwGAAQECAAHAAQMBwAEDAYADAAHAAQMBwAEDAYADAAHAAQMBwAEDAYADAAHA + AQEBwAEDBAABwAEBAYABAQQAAcABAQHAAQEEAAHAAQEB4AEDAQABBwIAAcABAQHwAQcBAAEPAgABgAED + AfgBBwHAAQ8CAAHAAQMB/AEHAeABDwIAAcAB4wH+AScB4AEfAgABwQL/AWcB8AF/AgAB9wP/AYABAQX/ + AYcBgAEABP8B/AEDAYABAAGAAQEB4AEAAeABAQGAAgABAQHAAgABAQGAAgABAQHAAgABAQGAAgABAQGA + AgABAQGAAgABAQGAAgABAQGAAgABAQMAAQEBgAIAAQEDAAEBAYACAAEBAwABDwGAAgABAQGAAgABPwGA + AgABAQGAAgABPwGAAgABAwGAAQEBAAE/AYABAAGAAf8BwAF/AQABPwGAAQABwQH/AeAB/wGAAT8B/wHv + BP8B8wH/Cw== + + + + + + AAABAAEAECAAAAEABAAoAQAAFgAAACgAAAAQAAAAIAAAAAEABAAAAAAAwAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAACAAACAAAAAgIAAgAAAAIAAgACAgAAAwMDAAICAgAAAAP8AAP8AAAD//wD/AAAA/wD/AP// + AAD///8A///////////0bm5ubm5ub/Rs6IjoiEzv9G6Pd4d3Tm/0bP/3f/dM7/Ru/45v905v9Gz/jO/3 + TO/0bn/2b/dOb/Rs5///90zv9G5ubm/3Tm/0bPeIf/bs7/Rub///fm5v9Gzs53zs7O/0xsbGxsbGz/RE + RERERERP//////////8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA + //8AAP//AAD//wAA//8AAP// + + + \ No newline at end of file diff --git a/form/Search.Designer.cs b/form/Search.Designer.cs new file mode 100644 index 0000000..d537286 --- /dev/null +++ b/form/Search.Designer.cs @@ -0,0 +1,208 @@ +namespace HelloTeamcenter.form +{ + partial class Search + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Search)); + this.label1 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.label3 = new System.Windows.Forms.Label(); + this.label4 = new System.Windows.Forms.Label(); + this.textBox1 = new System.Windows.Forms.TextBox(); + this.textBox2 = new System.Windows.Forms.TextBox(); + this.comboBox1 = new System.Windows.Forms.ComboBox(); + this.comboBox2 = new System.Windows.Forms.ComboBox(); + this.treeView1 = new System.Windows.Forms.TreeView(); + this.imageList1 = new System.Windows.Forms.ImageList(this.components); + this.button1 = new System.Windows.Forms.Button(); + this.button2 = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(38, 36); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(43, 13); + this.label1.TabIndex = 0; + this.label1.Text = "名称:"; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(8, 75); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(69, 13); + this.label2.TabIndex = 1; + this.label2.Text = "零组件 ID:"; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(38, 114); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(43, 13); + this.label3.TabIndex = 2; + this.label3.Text = "类型:"; + // + // label4 + // + this.label4.AutoSize = true; + this.label4.Location = new System.Drawing.Point(26, 153); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(55, 13); + this.label4.TabIndex = 3; + this.label4.Text = "创建者:"; + // + // textBox1 + // + this.textBox1.Location = new System.Drawing.Point(85, 29); + this.textBox1.Name = "textBox1"; + this.textBox1.Size = new System.Drawing.Size(166, 20); + this.textBox1.TabIndex = 4; + // + // textBox2 + // + this.textBox2.Location = new System.Drawing.Point(85, 67); + this.textBox2.Name = "textBox2"; + this.textBox2.Size = new System.Drawing.Size(166, 20); + this.textBox2.TabIndex = 5; + // + // comboBox1 + // + this.comboBox1.FormattingEnabled = true; + this.comboBox1.Items.AddRange(new object[] { + "*"}); + this.comboBox1.Location = new System.Drawing.Point(85, 108); + this.comboBox1.Name = "comboBox1"; + this.comboBox1.Size = new System.Drawing.Size(166, 21); + this.comboBox1.TabIndex = 6; + // + // comboBox2 + // + this.comboBox2.FormattingEnabled = true; + this.comboBox2.Items.AddRange(new object[] { + "*"}); + this.comboBox2.Location = new System.Drawing.Point(85, 147); + this.comboBox2.Name = "comboBox2"; + this.comboBox2.Size = new System.Drawing.Size(166, 21); + this.comboBox2.TabIndex = 7; + this.comboBox2.Click += new System.EventHandler(this.comboBox2_Click); + // + // treeView1 + // + this.treeView1.ImageIndex = 7; + this.treeView1.ImageList = this.imageList1; + this.treeView1.Location = new System.Drawing.Point(280, 1); + this.treeView1.Name = "treeView1"; + this.treeView1.SelectedImageIndex = 0; + this.treeView1.Size = new System.Drawing.Size(401, 356); + this.treeView1.TabIndex = 8; + this.treeView1.NodeMouseDoubleClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(this.treeView1_NodeMouseDoubleClick); + // + // imageList1 + // + this.imageList1.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream"))); + this.imageList1.TransparentColor = System.Drawing.Color.Transparent; + this.imageList1.Images.SetKeyName(0, "autocad_01.ico"); + this.imageList1.Images.SetKeyName(1, "FOLDER.ICO"); + this.imageList1.Images.SetKeyName(2, "FOLDEROP.ICO"); + this.imageList1.Images.SetKeyName(3, "item.ico"); + this.imageList1.Images.SetKeyName(4, "itemrev.ico"); + this.imageList1.Images.SetKeyName(5, "mail.ico"); + this.imageList1.Images.SetKeyName(6, "Newstuff_Folder.png"); + this.imageList1.Images.SetKeyName(7, "tai.ico"); + // + // button1 + // + this.button1.Location = new System.Drawing.Point(59, 233); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(75, 25); + this.button1.TabIndex = 9; + this.button1.Text = "查找"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // button2 + // + this.button2.Location = new System.Drawing.Point(162, 233); + this.button2.Name = "button2"; + this.button2.Size = new System.Drawing.Size(75, 25); + this.button2.TabIndex = 10; + this.button2.Text = "打开"; + this.button2.UseVisualStyleBackColor = true; + this.button2.Click += new System.EventHandler(this.button2_Click); + // + // Search + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(693, 371); + this.Controls.Add(this.button2); + this.Controls.Add(this.button1); + this.Controls.Add(this.treeView1); + this.Controls.Add(this.comboBox2); + this.Controls.Add(this.comboBox1); + this.Controls.Add(this.textBox2); + this.Controls.Add(this.textBox1); + this.Controls.Add(this.label4); + this.Controls.Add(this.label3); + this.Controls.Add(this.label2); + this.Controls.Add(this.label1); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; + this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "Search"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "搜索"; + this.TopMost = true; + this.Load += new System.EventHandler(this.Search_Load); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + public System.Windows.Forms.Label label1; + public System.Windows.Forms.Label label2; + public System.Windows.Forms.Label label3; + public System.Windows.Forms.Label label4; + public System.Windows.Forms.TextBox textBox1; + public System.Windows.Forms.TextBox textBox2; + public System.Windows.Forms.ComboBox comboBox1; + public System.Windows.Forms.ComboBox comboBox2; + public System.Windows.Forms.TreeView treeView1; + public System.Windows.Forms.Button button1; + public System.Windows.Forms.Button button2; + public System.Windows.Forms.ImageList imageList1; + + } +} \ No newline at end of file diff --git a/form/Search.cs b/form/Search.cs new file mode 100644 index 0000000..f2b6740 --- /dev/null +++ b/form/Search.cs @@ -0,0 +1,483 @@ +using System; +using System.IO; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Text; +using System.Windows.Forms; +using System.Collections; + +using ZwSoft.ZwCAD.DatabaseServices; +using ZwSoft.ZwCAD.Runtime; +using ZwSoft.ZwCAD.Geometry; +using ZwSoft.ZwCAD.ApplicationServices; +using ZwSoft.ZwCAD.EditorInput; + + + +using Teamcenter.Hello; +using Teamcenter.Soa.Client; +using Teamcenter.ClientX; +using Teamcenter.Services.Strong.Core; +using Teamcenter.Soa.Client.Model; +using Teamcenter.Soa.Exceptions; +using Teamcenter.Services.Strong.Query; + +using Teamcenter.Services.Strong.Core._2007_06.DataManagement; +using Teamcenter.Services.Strong.Core._2006_03.Reservation; + +using Teamcenter.Services.Strong.Core._2006_03.FileManagement; + +using Teamcenter.Soa.Internal.Client.Model; +using Teamcenter.Soa.Internal.Client; + +using HelloTeamcenter.hello; + + +using User = Teamcenter.Soa.Client.Model.Strong.User; +using Folder = Teamcenter.Soa.Client.Model.Strong.Folder; +using WorkspaceObject = Teamcenter.Soa.Client.Model.Strong.WorkspaceObject; +using Item = Teamcenter.Soa.Client.Model.Strong.Item; +using ItemRevision = Teamcenter.Soa.Client.Model.Strong.ItemRevision; +using ImanQuery = Teamcenter.Soa.Client.Model.Strong.ImanQuery; +using DataSet = Teamcenter.Soa.Client.Model.Strong.Dataset; +using SavedQueryResults = Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryResults; +using ImanFile = Teamcenter.Soa.Client.Model.Strong.ImanFile; + + + +namespace HelloTeamcenter.form +{ + public partial class Search : Form + { + public Search() + { + InitializeComponent(); + } + public List folderlist = new List(); + public List itemlist = new List(); + public List itemvisionlist = new List(); + public List datasetlist = new List(); + + public Document appdoc; + public User user; + public Editor ed; + public bool hasRight = true; + + public Hashtable itemtypetable; + + public string xmlpath = ""; + + private void Search_Load(object sender, EventArgs e) + { + this.textBox1.Text = ""; + this.textBox2.Text = ""; + //读取Item类型.xml信息 + OriginItemType originitemtype = new OriginItemType(); + originitemtype.getType(this.xmlpath); + this.itemtypetable = originitemtype.Itemtypetable; + + foreach (DictionaryEntry de in itemtypetable) + { + this.comboBox1.Items.Add(de.Key.ToString()); + } + } + + private void comboBox2_Click(object sender, EventArgs e) + { + DataManagementService dmService = DataManagementService.getService(Session.getConnection()); + this.comboBox2.Items.Clear(); + OriginTool tool = new OriginTool(); + SavedQueryResults found = tool.getSearchUser(); + if (found != null && found.NumOfObjects > 0) + { + for (int i = 0; i < found.NumOfObjects; i++) + { + User userobj = found.Objects[i] as User; + ModelObject[] objects = { userobj }; + String[] attributes = { "User ID", "Name" }; + dmService.RefreshObjects(objects); + dmService.GetProperties(objects, attributes); + string userid = userobj.User_id; + string username = userobj.User_name; + string tempname = userid + "(" + username + ")"; + if (this.comboBox2.Items.Contains(tempname)) + continue; + else + this.comboBox2.Items.Add(tempname); + } + } + } + + private void button1_Click(object sender, EventArgs e) + { + string name = textBox1.Text; + string item_id = textBox2.Text; + string type = comboBox1.Text; + //ed.WriteMessage("选择类型:"+ type +"\n"); + string owner = comboBox2.Text; + //ed.WriteMessage("选择用户:" + owner + "\n"); + if (name == "") + { + name = "*"; + } + if (item_id == "") + { + item_id = "*"; + } + if (type == "") + { + type = "*"; + } + if (owner == "") + { + owner = "*"; + } + else + { + int pos = owner.IndexOf('('); + owner = owner.Substring(0, pos); + //ed.WriteMessage("用户" + owner+"\n"); + } + DataManagementService dmService = DataManagementService.getService(Session.getConnection()); + OriginTool tool = new OriginTool(); + SavedQueryResults found = tool.getSearchItem(item_id, name, type, owner); + if (found != null && found.NumOfObjects > 0) + { + this.treeView1.Nodes.Clear(); + for (int i = 0; i < found.NumOfObjects; i++) + { + Item item = found.Objects[i] as Item; + ModelObject[] objects = { item }; + String[] attributes = { "object_string"}; + dmService.RefreshObjects(objects); + dmService.GetProperties(objects, attributes); + string inname = item.Object_string; + TreeNode childnode = new TreeNode(inname, 3, 3); + this.treeView1.Nodes.Add(childnode); + ALLOBJECT perobject = new ALLOBJECT(); + perobject.workobject = item; + perobject.treenode = childnode; + itemlist.Add(perobject); + } + foreach (TreeNode ch in treeView1.Nodes) + { + ch.EnsureVisible(); + } + } + } + + private void treeView1_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e) + { + TreeNode nownode = this.treeView1.SelectedNode; + getChild(nownode); + foreach (TreeNode ch in nownode.Nodes) + { + ch.EnsureVisible(); + } + } + + private void getChild(TreeNode nownode) + { + nownode.Nodes.Clear(); + DataManagementService dmService = DataManagementService.getService(Session.getConnection()); + WorkspaceObject[] contents = null; + string nodetext = nownode.Text; + int imageindex = nownode.SelectedImageIndex; + if (imageindex == 3) + { + foreach (ALLOBJECT perobject in itemlist) + { + if (perobject.treenode.Equals(nownode)) + { + Item item = perobject.workobject as Item; + ModelObject[] itemrevisionlist = null; + ModelObject[] objects = { item }; + String[] attributes = { "revision_list" }; + dmService.RefreshObjects(objects); + dmService.GetProperties(objects, attributes); + itemrevisionlist = item.Revision_list; + for (int i = 0; i < itemrevisionlist.Length; i++) + { + ItemRevision itemrevision = itemrevisionlist[i] as ItemRevision; + ModelObject[] objects1 = { itemrevision }; + String[] attributes1 = { "object_string", "object_type" }; + dmService.RefreshObjects(objects1); + dmService.GetProperties(objects1, attributes1); + string name = itemrevision.Object_string; + string type = itemrevision.Object_type; + + ALLOBJECT inperobject = new ALLOBJECT(); + inperobject.workobject = itemrevision; + TreeNode childnode = new TreeNode(name, 4, 4); + inperobject.treenode = childnode; + nownode.Nodes.Add(childnode); + itemvisionlist.Add(inperobject); + } + break; + } + } + } + else if (imageindex == 4) + { + foreach (ALLOBJECT perobject in itemvisionlist) + { + if (perobject.treenode.Equals(nownode)) + { + ItemRevision itemrevision = perobject.workobject as ItemRevision; + ExpandGRMRelationsPref myPref = new ExpandGRMRelationsPref(); + RelationAndTypesFilter2 myFilter = new RelationAndTypesFilter2(); + myFilter.RelationName = "IMAN_specification"; + String[] typeVec = { "D5DWG", "Folder" }; + myFilter.ObjectTypeNames = typeVec; + myPref.ExpItemRev = false; + RelationAndTypesFilter2[] myfilter = { myFilter }; + myPref.Info = myfilter; + ModelObject[] objects1 = { itemrevision }; + + ExpandGRMRelationsResponse myResp = dmService.ExpandGRMRelationsForPrimary(objects1, myPref); + ExpandGRMRelationsOutput[] myoutput = myResp.Output; + for (int i = 0; i < myoutput.Length; i++) + { + ExpandGRMRelationsOutput one_out = myoutput[i]; + for (int j = 0; j < one_out.OtherSideObjData.Length; j++) + { + ExpandGRMRelationsData otherSideData = one_out.OtherSideObjData[j]; + for (int k = 0; k < otherSideData.OtherSideObjects.Length; k++) + { + Type typeinfo = otherSideData.OtherSideObjects[k].GetType(); + string typename = typeinfo.Name; + if (typename == "Folder") + { + Folder infold = otherSideData.OtherSideObjects[k] as Folder; + + ModelObject[] objects = { infold }; + String[] attributes = { "object_string", "object_type" }; + dmService.RefreshObjects(objects); + dmService.GetProperties(objects, attributes); + string name = infold.Object_string; + string type = infold.Object_type; + + ALLOBJECT inperobject = new ALLOBJECT(); + inperobject.workobject = infold; + TreeNode childnode = new TreeNode(name, 1, 1); + inperobject.treenode = childnode; + nownode.Nodes.Add(childnode); + folderlist.Add(inperobject); + } + else + { + DataSet dateset = otherSideData.OtherSideObjects[k] as DataSet; + ModelObject[] objects = { dateset }; + String[] attributes = { "object_string" }; + dmService.RefreshObjects(objects); + dmService.GetProperties(objects, attributes); + string name = dateset.Object_string; + + ALLOBJECT inperobject = new ALLOBJECT(); + inperobject.workobject = dateset; + inperobject.name = name; + TreeNode childnode = new TreeNode(name, 0, 0); + inperobject.treenode = childnode; + nownode.Nodes.Add(childnode); + datasetlist.Add(inperobject); + } + } + } + } + break; + } + } + } + else if (imageindex == 1) + { + foreach (ALLOBJECT perobject in folderlist) + { + if (perobject.treenode.Equals(nownode)) + { + Folder fl = perobject.workobject as Folder; + ModelObject[] objects = { fl }; + String[] attributes = { "contents" }; + dmService.RefreshObjects(objects); + dmService.GetProperties(objects, attributes); + contents = fl.Contents; + for (int i = 0; i < contents.Length; i++) + { + WorkspaceObject childobj = contents[i]; + ModelObject[] objects1 = { childobj }; + String[] attributes1 = { "object_string", "object_type" }; + dmService.RefreshObjects(objects1); + dmService.GetProperties(objects1, attributes1); + string name = childobj.Object_string; + string type = childobj.Object_type; + if (type == "Folder" || type == "Newstuff Folder" || type == "Mail Folder") + { + ALLOBJECT inperobject = new ALLOBJECT(); + inperobject.workobject = childobj; + Folder infl = childobj as Folder; + + if (type == "Folder") + { + TreeNode childnode = new TreeNode(name, 1, 1); + inperobject.treenode = childnode; + nownode.Nodes.Add(childnode); + } + else if (type == "Newstuff Folder") + { + TreeNode childnode = new TreeNode(name, 6, 6); + inperobject.treenode = childnode; + nownode.Nodes.Add(childnode); + } + else if (type == "Mail Folder") + { + TreeNode childnode = new TreeNode(name, 5, 5); + inperobject.treenode = childnode; + nownode.Nodes.Add(childnode); + } + folderlist.Add(inperobject); + } + else if (type == "Item" || this.itemtypetable.ContainsValue(type)) + { + ALLOBJECT inperobject = new ALLOBJECT(); + inperobject.workobject = childobj; + Item item = childobj as Item; + TreeNode childnode = new TreeNode(name, 3, 3); + inperobject.treenode = childnode; + nownode.Nodes.Add(childnode); + itemlist.Add(inperobject); + } + } + break; + } + } + } + + } + + private void button2_Click(object sender, EventArgs e) + { + DataManagementService dmService = DataManagementService.getService(Session.getConnection()); + Reservation res = ReservationService.getService(Session.getConnection()); + TreeNode nownode = this.treeView1.SelectedNode; + if (nownode.SelectedImageIndex == 0) + { + foreach (ALLOBJECT perobject in this.datasetlist) + { + if (perobject.treenode.Equals(nownode)) + { + DialogResult isopen = MessageBox.Show("您是否确定打开该图纸?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question); + if (isopen == DialogResult.None || isopen == DialogResult.No) + { + return; + } + DataSet mydateset = perobject.workobject as DataSet; + ModelObject[] objects = { mydateset }; + String[] attributes = { "is_modifiable", "checked_out", "ref_list" }; + dmService.RefreshObjects(objects); + dmService.GetProperties(objects, attributes); + if (mydateset.Is_modifiable == false) + { + DialogResult result = MessageBox.Show("您没有修改权限,是否以只读方式打开?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question); + if (result == DialogResult.Yes) + { + hasRight = false; + } + else + { + return; + } + } + if (mydateset.Is_modifiable) + { + DialogResult result = MessageBox.Show("是否签出?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question); + if (result == DialogResult.Yes) + { + if (mydateset.Checked_out == "Y") + { + MessageBox.Show("对不起,文件已签出!请确认文件签入后执行此操作"); + return; + } + else + { + ModelObject[] dataobj = { mydateset }; + res.Checkout(dataobj, "", ""); + //ed.WriteMessage("文件已签出"); + //ed.WriteMessage("\n"); + } + } + } + + ModelObject[] dsfilevec = mydateset.Ref_list; + //ed.WriteMessage("长度:" + dsfilevec.Length); + //ed.WriteMessage(dsfilevec[0].GetType().ToString()); + ImanFile dsfile = dsfilevec[0] as ImanFile; + + ModelObject[] objects1 = { dsfile }; + String[] attributes1 = { "relative_directory_path", "original_file_name" }; + dmService.RefreshObjects(objects1); + dmService.GetProperties(objects1, attributes1); + + //ed.WriteMessage("路径:" + dsfile.Relative_directory_path + "\n"); + //ed.WriteMessage("文件名:" + dsfile.Original_file_name + "\n"); + string newfilename = dsfile.Original_file_name; + + string tempdir = System.Environment.GetEnvironmentVariable("TEMP").ToString(); + //ed.WriteMessage("TEMP:" + tempdir.ToString() + "\n"); + + FileManagementService fmService = FileManagementService.getService(Teamcenter.ClientX.Session.getConnection()); + ImanFile[] objects2 = { dsfile }; + FileTicketsResponse tickets = fmService.GetFileReadTickets(objects2); + //ed.WriteMessage("tickets : " + tickets.Tickets.Count + "\n"); + + //foreach (System.Collections.DictionaryEntry ticket in tickets.Tickets) + //{ + // ed.WriteMessage("键:" + ticket.Key + "\n" + "值:" + ticket.Value + "\n"); + //} + Teamcenter.Soa.Client.FileManagementUtility fmu = new Teamcenter.Soa.Client.FileManagementUtility(Teamcenter.ClientX.Session.getConnection()); + Teamcenter.Soa.Client.GetFileResponse getFileResponse = fmu.GetFiles(dsfilevec); + FileInfo[] fileinfovec = getFileResponse.GetFiles(); + + //ed.WriteMessage("文件个数:" + fileinfovec.Length + "\n"); + FileInfo file = fileinfovec[0]; + + string newtempfile = tempdir + "\\" + newfilename; + System.IO.File.Copy(file.FullName, newtempfile, true); + System.IO.File.SetAttributes(newtempfile, FileAttributes.Normal); + DocumentCollection acdocmgr = ZwSoft.ZwCAD.ApplicationServices.Application.DocumentManager; + if (File.Exists(newtempfile)) + { + acdocmgr.Open(newtempfile,false); + //Object pdata = newtempfile; + //acdocmgr.ExecuteInApplicationContext(c_back, pdata); + //acdocmgr.Add(newtempfile); + } + else + { + MessageBox.Show("对不起,用户临时目录下不存在此文件\n"); + } + this.Hide(); + this.Dispose(); + break; + } + } + } + else + { + //ed.WriteMessage("请选择正确的数据集类型\n"); + MessageBox.Show("请选择正确的数据集类型"); + return; + } + } + + //private void c_back(Object data) + //{ + // DocumentCollection acdocmgr = ZwSoft.ZwCAD.ApplicationServices.Application.DocumentManager; + // if (acdocmgr.IsApplicationContext) + // { + // acdocmgr.Open(Convert.ToString(data)); + // } + //} + + } +} diff --git a/form/Search.resx b/form/Search.resx new file mode 100644 index 0000000..36e954d --- /dev/null +++ b/form/Search.resx @@ -0,0 +1,212 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + + + AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj0yLjAuMC4w + LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 + ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAABq + EAAAAk1TRnQBSQFMAgEBCAEAARwBAAEcAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo + AwABQAMAATADAAEBAQABCAYAAQwYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA + AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5 + AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA + AWYDAAGZAwABzAIAATMDAAIzAgABMwFmAgABMwGZAgABMwHMAgABMwH/AgABZgMAAWYBMwIAAmYCAAFm + AZkCAAFmAcwCAAFmAf8CAAGZAwABmQEzAgABmQFmAgACmQIAAZkBzAIAAZkB/wIAAcwDAAHMATMCAAHM + AWYCAAHMAZkCAALMAgABzAH/AgAB/wFmAgAB/wGZAgAB/wHMAQABMwH/AgAB/wEAATMBAAEzAQABZgEA + ATMBAAGZAQABMwEAAcwBAAEzAQAB/wEAAf8BMwIAAzMBAAIzAWYBAAIzAZkBAAIzAcwBAAIzAf8BAAEz + AWYCAAEzAWYBMwEAATMCZgEAATMBZgGZAQABMwFmAcwBAAEzAWYB/wEAATMBmQIAATMBmQEzAQABMwGZ + AWYBAAEzApkBAAEzAZkBzAEAATMBmQH/AQABMwHMAgABMwHMATMBAAEzAcwBZgEAATMBzAGZAQABMwLM + AQABMwHMAf8BAAEzAf8BMwEAATMB/wFmAQABMwH/AZkBAAEzAf8BzAEAATMC/wEAAWYDAAFmAQABMwEA + AWYBAAFmAQABZgEAAZkBAAFmAQABzAEAAWYBAAH/AQABZgEzAgABZgIzAQABZgEzAWYBAAFmATMBmQEA + AWYBMwHMAQABZgEzAf8BAAJmAgACZgEzAQADZgEAAmYBmQEAAmYBzAEAAWYBmQIAAWYBmQEzAQABZgGZ + AWYBAAFmApkBAAFmAZkBzAEAAWYBmQH/AQABZgHMAgABZgHMATMBAAFmAcwBmQEAAWYCzAEAAWYBzAH/ + AQABZgH/AgABZgH/ATMBAAFmAf8BmQEAAWYB/wHMAQABzAEAAf8BAAH/AQABzAEAApkCAAGZATMBmQEA + AZkBAAGZAQABmQEAAcwBAAGZAwABmQIzAQABmQEAAWYBAAGZATMBzAEAAZkBAAH/AQABmQFmAgABmQFm + ATMBAAGZATMBZgEAAZkBZgGZAQABmQFmAcwBAAGZATMB/wEAApkBMwEAApkBZgEAA5kBAAKZAcwBAAKZ + Af8BAAGZAcwCAAGZAcwBMwEAAWYBzAFmAQABmQHMAZkBAAGZAswBAAGZAcwB/wEAAZkB/wIAAZkB/wEz + AQABmQHMAWYBAAGZAf8BmQEAAZkB/wHMAQABmQL/AQABzAMAAZkBAAEzAQABzAEAAWYBAAHMAQABmQEA + AcwBAAHMAQABmQEzAgABzAIzAQABzAEzAWYBAAHMATMBmQEAAcwBMwHMAQABzAEzAf8BAAHMAWYCAAHM + AWYBMwEAAZkCZgEAAcwBZgGZAQABzAFmAcwBAAGZAWYB/wEAAcwBmQIAAcwBmQEzAQABzAGZAWYBAAHM + ApkBAAHMAZkBzAEAAcwBmQH/AQACzAIAAswBMwEAAswBZgEAAswBmQEAA8wBAALMAf8BAAHMAf8CAAHM + Af8BMwEAAZkB/wFmAQABzAH/AZkBAAHMAf8BzAEAAcwC/wEAAcwBAAEzAQAB/wEAAWYBAAH/AQABmQEA + AcwBMwIAAf8CMwEAAf8BMwFmAQAB/wEzAZkBAAH/ATMBzAEAAf8BMwH/AQAB/wFmAgAB/wFmATMBAAHM + AmYBAAH/AWYBmQEAAf8BZgHMAQABzAFmAf8BAAH/AZkCAAH/AZkBMwEAAf8BmQFmAQAB/wKZAQAB/wGZ + AcwBAAH/AZkB/wEAAf8BzAIAAf8BzAEzAQAB/wHMAWYBAAH/AcwBmQEAAf8CzAEAAf8BzAH/AQAC/wEz + AQABzAH/AWYBAAL/AZkBAAL/AcwBAAJmAf8BAAFmAf8BZgEAAWYC/wEAAf8CZgEAAf8BZgH/AQAC/wFm + AQABIQEAAaUBAANfAQADdwEAA4YBAAOWAQADywEAA7IBAAPXAQAD3QEAA+MBAAPqAQAD8QEAA/gBAAHw + AfsB/wEAAaQCoAEAA4ADAAH/AgAB/wMAAv8BAAH/AwAB/wEAAf8BAAL/AgAD//8A/wD/AP8AFQAQ/ycA + AZoCGgHwBQAQ/wMAAvANAAEEEAABGgHwARoBmgHlAVkBUgF5AfAEABD/AgABtAGtAc8BtQHvAgcBvAgA + AuwCBwEAAQMB+wEAAwcEAAIaAcMBGgLDAaABeQFZATIBmQGYAbwB8AEAAf8OAAH/AgABzweLAa4B9wHv + AQcEAALsAv8BAAEDAfsBAAL/AQcEAAGaAsMBGgL2AcMBeQI4AVgBVgFQAZgB8AH/DewBAAH/AgABzwGL + CYoBkgQAAuwC/wEAAQMB+wEAAv8BBwQAAXoDoAEaAvYBmgJZAVgBeAJQAfAB/wHsCwcB7AEAAf8CAAHP + ArIBrAeKAa4EAALsAv8BAAEDAfsBAAL/AQcEAAF6AuUBegJSAZkBGgGaAVkBmQGYAVYBUAHwAf8B7AED + AwcDAwMHAQMB7AEAAf8CAAHPAawFsgSKAZEBvAMAAQQB7AL/BAAC/wEHAwAB8AGaAXoB5QF6ATECUgEc + AZkBmgEaAZgBVwFWAfAB/wHsAfsBAwEHAQMDAAEDAQcBAwEHAewBAAH/AgABtQGtBbMDsgGzAa4BBwQA + AewI/wHsAwAB8AHDAfYBwwF6AVkBOAFYAngBHAGYAZkBmAF4AfAB/wHsAv8BAwEAAv8B+wEAAQMCBwHs + AQAB/wIAAbUBtAG7AroGswGRAQcEAAEDAQAG/wHsAgMCAAHwAZoCwwF6AjgBWAFXAVABSgFyAXMBHAGZ + AfAB/wHsAfsBBwEAAf8B+wP/AQABAwEHAewBAAH/AgABBwG0Aa0CtAEJAbsEugG0Ae8FAAEDAQAE/wHs + AgMB7AIAAfABmgF6AZoBegJZAnkBVgFQAXIBBwMAAf8B7AEHAQAB+wP/AfsC/wEAAQMB7AEAAf8CAAG1 + AZkBkAGYAbMBtAEJAhkCCQG1AQcGAAEDAQAC/wHsAgMEAAHwARoBegF5AZkBoAFYAVkBmQJWARwEAAH/ + AewBAAP/AfsD/wH7Af8BAAHsAQAB/wEAAbsBtAF5AZkBeQG0AgkEtAG1CAABAwIAAgMHAAHwArwBmQF5 + AZkBeAJWAXgEAAH/AewC/wH7A/8B+wP/AfsCAAH/AgAB7wF+AV4BWAEcA7QB1gIJAQcJAAMDAewBAQcA + AbwB8AEIAZgBeAKYAZkBBwQAAf8N7AEAAf8CAAKZAnkBtQHvAwACtQEHDQABAQcAAfABvALwAbwBBwK8 + BQAQ/wIAAQcBGgGRArwRAAEEAgABAQgABLwB8AcAEP8EAAHvHAAO8CoAARoB8AG8AfAEAAHvCYEB/wOB + AfAmAAGZARoBegFTAVkBUgF0AQcDAAGyAbkD2gO5AdoBuQH0AtoBuQG8IwACkwFMAXoDoAHlATEBMgFS + AZkCAAGyAtoCswLZAbMBiwGzAfQBswHUAbkBvA7sBAAM7AIAAfACmQEbAf8BmgH2AsMCoAExATgBMgF0 + AgABsgOzBtkB9AHZArMBvAHsAf8B+wEHAfsBBwH7AQcB+wEHAfsBBwH7AewEAAHsAf8B+wEHAfsBBwH7 + AQcB+wEHAfsB7AIAAbwBGgHDAv8BmQH/AvYCwwE3AjgBeQIAAbIBswGyAtkBuAHbAbkB2wGyAfQB2QGy + AbkBvAHsAf8BBwH7AQcB+wEHAfsBBwH7AQcB+wEHAewDAAHsAf8B+wEHAfsBBwH7AQcB+wEHAfsBBwEA + AewBAAG8AZoBoALDAZoB9gP/AfYBNwI4AXkCAAGyAdkBsgG4AbIBuAGKAbIBgQGyAfQB2QGyAbkBvAHs + Af8B+wEHAfsBBwH7AQcB+wEHAfsBBwH7AewDAAHsAf8BBwH7AQcB+wEHAfsBBwH7AQcB7AEAAewBAAG8 + AXkDoAFSAZkCwwEaAZoBegI4AXkCAAGyAdkBuAK5AbgB2QGyAYoB2QH0AdkBsgG5AbwB7AH/AQcB+wEH + AfsBBwH7AQcB+wEHAfsBBwHsAgAB7AH/AQcB+wEHAfsBBwH7AQcB+wEHAfsBAALsAQAB8AF6AuUBegFT + AVIBcwF0AbwB9AH2AXoBWQGZAgABsgLaAbMC3AG5AbgB2QG7Af8BuwGzAdoBvAHsAf8B+wEHAfsBBwH7 + AQcB+wEHAfsBBwH7AewCAAHsCv8B7AEAAQcB7AEAARoBmQN6AVkBMQErAUsBUgKZAZoCegIAAYEDswGQ + AYoBgQKzAbsBigG6ArMBBwHsAf8BBwH7AQcB+wEHAfsBBwH7AQcB+wEHAewCAA3sAfsB7AEAAXQBwwH2 + AsMBegFZATgBMgFMAZkBGgUAAboB2wK6AdoBugKRAdoBuwS6AQcB7AH/AfsBBwH7AQcB+wEHAfsBBwH7 + AQcB+wHsAwAB7AH/AQcB+wEHAfsBBwH7AQcB+wEHAfsBBwHsAQABdAHDAfYC/wGaAzgBUgcAAbkC2wGz + BNkBuAHyAf8B8gHbAdoBvAHsDP8B7AMAAewB/wH7AQcB+wEHAfsBBwX/AewBAAF6AsMC9gEaAfsCOAFS + BwABswTbAQkC3AIJAfQC2wHaAbwB7AEHAfsBBwH7AQcB+wEHBuwDAAHsAf8BBwH7AQcB+wEHAf8G7AEA + AnoCoAJ6AVkB+wE4AXkHAAGzAdsB3AcJAfQBCQHcAdsBvAEAAewBBwH7AQcB+wEHAewKAAHsBf8B7AcA + AnoBWQLlAcMBegJZAZkHAAG5CRkB9AMZAfACAAXsDAAF7AkAAfABGgFSAlkCegFTAXkRAAHwKAAC8AoA + AUIBTQE+BwABPgMAASgDAAFAAwABMAMAAQEBAAEBBQABgAEBFgAD/4EAAv8CAAT/Af4BHwIAAecB/wHA + AQMB4AEPAgABwAE/AcABAwGAAQECAAHAAQMBwAEDAYADAAHAAQMBwAEDAYADAAHAAQMBwAEDAYADAAHA + AQEBwAEDBAABwAEBAYABAQQAAcABAQHAAQEEAAHAAQEB4AEDAQABBwIAAcABAQHwAQcBAAEPAgABgAED + AfgBBwHAAQ8CAAHAAQMB/AEHAeABDwIAAcAB4wH+AScB4AEfAgABwQL/AWcB8AF/AgAB9wP/AYABAQX/ + AYcBgAEABP8B/AEDAYABAAGAAQEB4AEAAeABAQGAAgABAQHAAgABAQGAAgABAQHAAgABAQGAAgABAQGA + AgABAQGAAgABAQGAAgABAQGAAgABAQMAAQEBgAIAAQEDAAEBAYACAAEBAwABDwGAAgABAQGAAgABPwGA + AgABAQGAAgABPwGAAgABAwGAAQEBAAE/AYABAAGAAf8BwAF/AQABPwGAAQABwQH/AeAB/wGAAT8B/wHv + BP8B8wH/Cw== + + + + + + AAABAAEAECAAAAEABAAoAQAAFgAAACgAAAAQAAAAIAAAAAEABAAAAAAAwAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAACAAACAAAAAgIAAgAAAAIAAgACAgAAAwMDAAICAgAAAAP8AAP8AAAD//wD/AAAA/wD/AP// + AAD///8A///////////0bm5ubm5ub/Rs6IjoiEzv9G6Pd4d3Tm/0bP/3f/dM7/Ru/45v905v9Gz/jO/3 + TO/0bn/2b/dOb/Rs5///90zv9G5ubm/3Tm/0bPeIf/bs7/Rub///fm5v9Gzs53zs7O/0xsbGxsbGz/RE + RERERERP//////////8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA + //8AAP//AAD//wAA//8AAP// + + + \ No newline at end of file diff --git a/form/Search1.Designer.cs b/form/Search1.Designer.cs new file mode 100644 index 0000000..02e79d1 --- /dev/null +++ b/form/Search1.Designer.cs @@ -0,0 +1,170 @@ +namespace HelloTeamcenter.form +{ + partial class Search1 + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Search1)); + this.label1 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.textBox1 = new System.Windows.Forms.TextBox(); + this.textBox2 = new System.Windows.Forms.TextBox(); + this.treeView1 = new System.Windows.Forms.TreeView(); + this.imageList1 = new System.Windows.Forms.ImageList(this.components); + this.button1 = new System.Windows.Forms.Button(); + this.button2 = new System.Windows.Forms.Button(); + this.checkBox1 = new System.Windows.Forms.CheckBox(); + this.SuspendLayout(); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(39, 71); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(41, 12); + this.label1.TabIndex = 1; + this.label1.Text = "名称:"; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(39, 36); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(29, 12); + this.label2.TabIndex = 0; + this.label2.Text = "ID:"; + // + // textBox1 + // + this.textBox1.Location = new System.Drawing.Point(85, 68); + this.textBox1.Name = "textBox1"; + this.textBox1.Size = new System.Drawing.Size(166, 21); + this.textBox1.TabIndex = 4; + // + // textBox2 + // + this.textBox2.Location = new System.Drawing.Point(85, 33); + this.textBox2.Name = "textBox2"; + this.textBox2.Size = new System.Drawing.Size(166, 21); + this.textBox2.TabIndex = 5; + // + // treeView1 + // + this.treeView1.ImageIndex = 7; + this.treeView1.ImageList = this.imageList1; + this.treeView1.Location = new System.Drawing.Point(280, 1); + this.treeView1.Name = "treeView1"; + this.treeView1.SelectedImageIndex = 0; + this.treeView1.Size = new System.Drawing.Size(401, 329); + this.treeView1.TabIndex = 8; + this.treeView1.NodeMouseDoubleClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(this.treeView1_NodeMouseDoubleClick); + // + // imageList1 + // + this.imageList1.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream"))); + this.imageList1.TransparentColor = System.Drawing.Color.Transparent; + this.imageList1.Images.SetKeyName(0, "autocad_01.ico"); + this.imageList1.Images.SetKeyName(1, "FOLDER.ICO"); + this.imageList1.Images.SetKeyName(2, "FOLDEROP.ICO"); + this.imageList1.Images.SetKeyName(3, "item.ico"); + this.imageList1.Images.SetKeyName(4, "itemrev.ico"); + this.imageList1.Images.SetKeyName(5, "mail.ico"); + this.imageList1.Images.SetKeyName(6, "Newstuff_Folder.png"); + this.imageList1.Images.SetKeyName(7, "tai.ico"); + // + // button1 + // + this.button1.Location = new System.Drawing.Point(59, 215); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(75, 23); + this.button1.TabIndex = 9; + this.button1.Text = "查找"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // button2 + // + this.button2.Location = new System.Drawing.Point(162, 215); + this.button2.Name = "button2"; + this.button2.Size = new System.Drawing.Size(75, 23); + this.button2.TabIndex = 10; + this.button2.Text = "确认"; + this.button2.UseVisualStyleBackColor = true; + // + // checkBox1 + // + this.checkBox1.AutoSize = true; + this.checkBox1.Checked = true; + this.checkBox1.CheckState = System.Windows.Forms.CheckState.Checked; + this.checkBox1.Location = new System.Drawing.Point(41, 104); + this.checkBox1.Name = "checkBox1"; + this.checkBox1.Size = new System.Drawing.Size(96, 16); + this.checkBox1.TabIndex = 11; + this.checkBox1.Text = "默认最新版本"; + this.checkBox1.UseVisualStyleBackColor = true; + // + // Search1 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(693, 342); + this.Controls.Add(this.button2); + this.Controls.Add(this.button1); + this.Controls.Add(this.treeView1); + this.Controls.Add(this.textBox2); + this.Controls.Add(this.textBox1); + this.Controls.Add(this.label2); + this.Controls.Add(this.label1); + this.Controls.Add(this.checkBox1); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; + this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "Search1"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "搜索"; + this.TopMost = true; + this.Load += new System.EventHandler(this.Search1_Load); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + public System.Windows.Forms.Label label1; + public System.Windows.Forms.Label label2; + public System.Windows.Forms.TextBox textBox1; + public System.Windows.Forms.TextBox textBox2; + public System.Windows.Forms.TreeView treeView1; + public System.Windows.Forms.Button button1; + public System.Windows.Forms.Button button2; + public System.Windows.Forms.ImageList imageList1; + private System.Windows.Forms.CheckBox checkBox1; + } +} \ No newline at end of file diff --git a/form/Search1.cs b/form/Search1.cs new file mode 100644 index 0000000..68fe038 --- /dev/null +++ b/form/Search1.cs @@ -0,0 +1,162 @@ +using System; +using System.IO; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Text; +using System.Windows.Forms; +using System.Collections; + +using ZwSoft.ZwCAD.DatabaseServices; +using ZwSoft.ZwCAD.Runtime; +using ZwSoft.ZwCAD.Geometry; +using ZwSoft.ZwCAD.ApplicationServices; +using ZwSoft.ZwCAD.EditorInput; + + + +using Teamcenter.Hello; +using Teamcenter.Soa.Client; +using Teamcenter.ClientX; +using Teamcenter.Services.Strong.Core; +using Teamcenter.Soa.Client.Model; +using Teamcenter.Soa.Exceptions; +using Teamcenter.Services.Strong.Query; + +using Teamcenter.Services.Strong.Core._2007_06.DataManagement; +using Teamcenter.Services.Strong.Core._2006_03.Reservation; + +using Teamcenter.Services.Strong.Core._2006_03.FileManagement; + +using Teamcenter.Soa.Internal.Client.Model; +using Teamcenter.Soa.Internal.Client; + +using HelloTeamcenter.hello; + + +using User = Teamcenter.Soa.Client.Model.Strong.User; +using Folder = Teamcenter.Soa.Client.Model.Strong.Folder; +using WorkspaceObject = Teamcenter.Soa.Client.Model.Strong.WorkspaceObject; +using Item = Teamcenter.Soa.Client.Model.Strong.Item; +using ItemRevision = Teamcenter.Soa.Client.Model.Strong.ItemRevision; +using ImanQuery = Teamcenter.Soa.Client.Model.Strong.ImanQuery; +using DataSet = Teamcenter.Soa.Client.Model.Strong.Dataset; +using SavedQueryResults = Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryResults; +using ImanFile = Teamcenter.Soa.Client.Model.Strong.ImanFile; + + + +namespace HelloTeamcenter.form +{ + public partial class Search1 : Form + { + public Search1() + { + InitializeComponent(); + } + + public List itemlist = new List(); + + + public Document appdoc; + public User user; + public Editor ed; + public bool hasRight = true; + + public Hashtable itemtypetable; + + public string xmlpath = ""; + + private void Search1_Load(object sender, EventArgs e) + { + this.textBox1.Text = ""; + this.textBox2.Text = ""; + + } + + + private void button1_Click(object sender, EventArgs e) + { + string name = textBox1.Text; + string item_id = textBox2.Text; + + if (name == "") + { + name = "*"; + } + if (item_id == "") + { + item_id = "*"; + } + + + DataManagementService dmService = DataManagementService.getService(Session.getConnection()); + OriginTool tool = new OriginTool(); + SavedQueryResults found = tool.getSearchItem(item_id, name, "*", "*"); + if (found != null && found.NumOfObjects > 0) + { + this.treeView1.Nodes.Clear(); + for (int i = 0; i < found.NumOfObjects; i++) + { + Item item = found.Objects[i] as Item; + ModelObject[] objects = { item }; + String[] attributes = { "object_string", "revision_list" }; + dmService.RefreshObjects(objects); + dmService.GetProperties(objects, attributes); + + ModelObject[] revlist = item.Revision_list; + + dmService.RefreshObjects(revlist); + + bool isCheck = this.checkBox1.Checked; + if (isCheck) + { + revlist = new ModelObject[] { revlist[revlist.Length - 1] }; + } + + for (int k = 0; k < revlist.Length; k++) + { + String[] attr = { "object_string" }; + + ItemRevision itemRev = revlist[k] as ItemRevision; + ModelObject[] obj2 = { itemRev }; + + dmService.RefreshObjects(obj2); + + dmService.GetProperties(obj2, attr); + + string inname = itemRev.Object_string; + TreeNode childnode = new TreeNode(inname, 3, 3); + this.treeView1.Nodes.Add(childnode); + ALLOBJECT perobject = new ALLOBJECT(); + perobject.workobject = itemRev; + perobject.treenode = childnode; + itemlist.Add(perobject); + + } + + // + + + } + foreach (TreeNode ch in treeView1.Nodes) + { + ch.EnsureVisible(); + } + } + } + + private void treeView1_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e) + { + TreeNode nownode = this.treeView1.SelectedNode; + + foreach (TreeNode ch in nownode.Nodes) + { + ch.EnsureVisible(); + } + } + + + } +} diff --git a/form/Search1.resx b/form/Search1.resx new file mode 100644 index 0000000..2c60e92 --- /dev/null +++ b/form/Search1.resx @@ -0,0 +1,212 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + + + AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w + LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 + ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAABq + EAAAAk1TRnQBSQFMAgEBCAEAAVQBAAFUAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo + AwABQAMAATADAAEBAQABCAYAAQwYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA + AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5 + AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA + AWYDAAGZAwABzAIAATMDAAIzAgABMwFmAgABMwGZAgABMwHMAgABMwH/AgABZgMAAWYBMwIAAmYCAAFm + AZkCAAFmAcwCAAFmAf8CAAGZAwABmQEzAgABmQFmAgACmQIAAZkBzAIAAZkB/wIAAcwDAAHMATMCAAHM + AWYCAAHMAZkCAALMAgABzAH/AgAB/wFmAgAB/wGZAgAB/wHMAQABMwH/AgAB/wEAATMBAAEzAQABZgEA + ATMBAAGZAQABMwEAAcwBAAEzAQAB/wEAAf8BMwIAAzMBAAIzAWYBAAIzAZkBAAIzAcwBAAIzAf8BAAEz + AWYCAAEzAWYBMwEAATMCZgEAATMBZgGZAQABMwFmAcwBAAEzAWYB/wEAATMBmQIAATMBmQEzAQABMwGZ + AWYBAAEzApkBAAEzAZkBzAEAATMBmQH/AQABMwHMAgABMwHMATMBAAEzAcwBZgEAATMBzAGZAQABMwLM + AQABMwHMAf8BAAEzAf8BMwEAATMB/wFmAQABMwH/AZkBAAEzAf8BzAEAATMC/wEAAWYDAAFmAQABMwEA + AWYBAAFmAQABZgEAAZkBAAFmAQABzAEAAWYBAAH/AQABZgEzAgABZgIzAQABZgEzAWYBAAFmATMBmQEA + AWYBMwHMAQABZgEzAf8BAAJmAgACZgEzAQADZgEAAmYBmQEAAmYBzAEAAWYBmQIAAWYBmQEzAQABZgGZ + AWYBAAFmApkBAAFmAZkBzAEAAWYBmQH/AQABZgHMAgABZgHMATMBAAFmAcwBmQEAAWYCzAEAAWYBzAH/ + AQABZgH/AgABZgH/ATMBAAFmAf8BmQEAAWYB/wHMAQABzAEAAf8BAAH/AQABzAEAApkCAAGZATMBmQEA + AZkBAAGZAQABmQEAAcwBAAGZAwABmQIzAQABmQEAAWYBAAGZATMBzAEAAZkBAAH/AQABmQFmAgABmQFm + ATMBAAGZATMBZgEAAZkBZgGZAQABmQFmAcwBAAGZATMB/wEAApkBMwEAApkBZgEAA5kBAAKZAcwBAAKZ + Af8BAAGZAcwCAAGZAcwBMwEAAWYBzAFmAQABmQHMAZkBAAGZAswBAAGZAcwB/wEAAZkB/wIAAZkB/wEz + AQABmQHMAWYBAAGZAf8BmQEAAZkB/wHMAQABmQL/AQABzAMAAZkBAAEzAQABzAEAAWYBAAHMAQABmQEA + AcwBAAHMAQABmQEzAgABzAIzAQABzAEzAWYBAAHMATMBmQEAAcwBMwHMAQABzAEzAf8BAAHMAWYCAAHM + AWYBMwEAAZkCZgEAAcwBZgGZAQABzAFmAcwBAAGZAWYB/wEAAcwBmQIAAcwBmQEzAQABzAGZAWYBAAHM + ApkBAAHMAZkBzAEAAcwBmQH/AQACzAIAAswBMwEAAswBZgEAAswBmQEAA8wBAALMAf8BAAHMAf8CAAHM + Af8BMwEAAZkB/wFmAQABzAH/AZkBAAHMAf8BzAEAAcwC/wEAAcwBAAEzAQAB/wEAAWYBAAH/AQABmQEA + AcwBMwIAAf8CMwEAAf8BMwFmAQAB/wEzAZkBAAH/ATMBzAEAAf8BMwH/AQAB/wFmAgAB/wFmATMBAAHM + AmYBAAH/AWYBmQEAAf8BZgHMAQABzAFmAf8BAAH/AZkCAAH/AZkBMwEAAf8BmQFmAQAB/wKZAQAB/wGZ + AcwBAAH/AZkB/wEAAf8BzAIAAf8BzAEzAQAB/wHMAWYBAAH/AcwBmQEAAf8CzAEAAf8BzAH/AQAC/wEz + AQABzAH/AWYBAAL/AZkBAAL/AcwBAAJmAf8BAAFmAf8BZgEAAWYC/wEAAf8CZgEAAf8BZgH/AQAC/wFm + AQABIQEAAaUBAANfAQADdwEAA4YBAAOWAQADywEAA7IBAAPXAQAD3QEAA+MBAAPqAQAD8QEAA/gBAAHw + AfsB/wEAAaQCoAEAA4ADAAH/AgAB/wMAAv8BAAH/AwAB/wEAAf8BAAL/AgAD//8A/wD/AP8AFQAQ/ycA + AZoCGgHwBQAQ/wMAAvANAAEEEAABGgHwARoBmgHlAVkBUgF5AfAEABD/AgABtAGtAc8BtQHvAgcBvAgA + AuwCBwEAAQMB+wEAAwcEAAIaAcMBGgLDAaABeQFZATIBmQGYAbwB8AEAAf8OAAH/AgABzweLAa4B9wHv + AQcEAALsAv8BAAEDAfsBAAL/AQcEAAGaAsMBGgL2AcMBeQI4AVgBVgFQAZgB8AH/DewBAAH/AgABzwGL + CYoBkgQAAuwC/wEAAQMB+wEAAv8BBwQAAXoDoAEaAvYBmgJZAVgBeAJQAfAB/wHsCwcB7AEAAf8CAAHP + ArIBrAeKAa4EAALsAv8BAAEDAfsBAAL/AQcEAAF6AuUBegJSAZkBGgGaAVkBmQGYAVYBUAHwAf8B7AED + AwcDAwMHAQMB7AEAAf8CAAHPAawFsgSKAZEBvAMAAQQB7AL/BAAC/wEHAwAB8AGaAXoB5QF6ATECUgEc + AZkBmgEaAZgBVwFWAfAB/wHsAfsBAwEHAQMDAAEDAQcBAwEHAewBAAH/AgABtQGtBbMDsgGzAa4BBwQA + AewI/wHsAwAB8AHDAfYBwwF6AVkBOAFYAngBHAGYAZkBmAF4AfAB/wHsAv8BAwEAAv8B+wEAAQMCBwHs + AQAB/wIAAbUBtAG7AroGswGRAQcEAAEDAQAG/wHsAgMCAAHwAZoCwwF6AjgBWAFXAVABSgFyAXMBHAGZ + AfAB/wHsAfsBBwEAAf8B+wP/AQABAwEHAewBAAH/AgABBwG0Aa0CtAEJAbsEugG0Ae8FAAEDAQAE/wHs + AgMB7AIAAfABmgF6AZoBegJZAnkBVgFQAXIBBwMAAf8B7AEHAQAB+wP/AfsC/wEAAQMB7AEAAf8CAAG1 + AZkBkAGYAbMBtAEJAhkCCQG1AQcGAAEDAQAC/wHsAgMEAAHwARoBegF5AZkBoAFYAVkBmQJWARwEAAH/ + AewBAAP/AfsD/wH7Af8BAAHsAQAB/wEAAbsBtAF5AZkBeQG0AgkEtAG1CAABAwIAAgMHAAHwArwBmQF5 + AZkBeAJWAXgEAAH/AewC/wH7A/8B+wP/AfsCAAH/AgAB7wF+AV4BWAEcA7QB1gIJAQcJAAMDAewBAQcA + AbwB8AEIAZgBeAKYAZkBBwQAAf8N7AEAAf8CAAKZAnkBtQHvAwACtQEHDQABAQcAAfABvALwAbwBBwK8 + BQAQ/wIAAQcBGgGRArwRAAEEAgABAQgABLwB8AcAEP8EAAHvHAAO8CoAARoB8AG8AfAEAAHvCYEB/wOB + AfAmAAGZARoBegFTAVkBUgF0AQcDAAGyAbkD2gO5AdoBuQH0AtoBuQG8IwACkwFMAXoDoAHlATEBMgFS + AZkCAAGyAtoCswLZAbMBiwGzAfQBswHUAbkBvA7sBAAM7AIAAfACmQEbAf8BmgH2AsMCoAExATgBMgF0 + AgABsgOzBtkB9AHZArMBvAHsAf8B+wEHAfsBBwH7AQcB+wEHAfsBBwH7AewEAAHsAf8B+wEHAfsBBwH7 + AQcB+wEHAfsB7AIAAbwBGgHDAv8BmQH/AvYCwwE3AjgBeQIAAbIBswGyAtkBuAHbAbkB2wGyAfQB2QGy + AbkBvAHsAf8BBwH7AQcB+wEHAfsBBwH7AQcB+wEHAewDAAHsAf8B+wEHAfsBBwH7AQcB+wEHAfsBBwEA + AewBAAG8AZoBoALDAZoB9gP/AfYBNwI4AXkCAAGyAdkBsgG4AbIBuAGKAbIBgQGyAfQB2QGyAbkBvAHs + Af8B+wEHAfsBBwH7AQcB+wEHAfsBBwH7AewDAAHsAf8BBwH7AQcB+wEHAfsBBwH7AQcB7AEAAewBAAG8 + AXkDoAFSAZkCwwEaAZoBegI4AXkCAAGyAdkBuAK5AbgB2QGyAYoB2QH0AdkBsgG5AbwB7AH/AQcB+wEH + AfsBBwH7AQcB+wEHAfsBBwHsAgAB7AH/AQcB+wEHAfsBBwH7AQcB+wEHAfsBAALsAQAB8AF6AuUBegFT + AVIBcwF0AbwB9AH2AXoBWQGZAgABsgLaAbMC3AG5AbgB2QG7Af8BuwGzAdoBvAHsAf8B+wEHAfsBBwH7 + AQcB+wEHAfsBBwH7AewCAAHsCv8B7AEAAQcB7AEAARoBmQN6AVkBMQErAUsBUgKZAZoCegIAAYEDswGQ + AYoBgQKzAbsBigG6ArMBBwHsAf8BBwH7AQcB+wEHAfsBBwH7AQcB+wEHAewCAA3sAfsB7AEAAXQBwwH2 + AsMBegFZATgBMgFMAZkBGgUAAboB2wK6AdoBugKRAdoBuwS6AQcB7AH/AfsBBwH7AQcB+wEHAfsBBwH7 + AQcB+wHsAwAB7AH/AQcB+wEHAfsBBwH7AQcB+wEHAfsBBwHsAQABdAHDAfYC/wGaAzgBUgcAAbkC2wGz + BNkBuAHyAf8B8gHbAdoBvAHsDP8B7AMAAewB/wH7AQcB+wEHAfsBBwX/AewBAAF6AsMC9gEaAfsCOAFS + BwABswTbAQkC3AIJAfQC2wHaAbwB7AEHAfsBBwH7AQcB+wEHBuwDAAHsAf8BBwH7AQcB+wEHAf8G7AEA + AnoCoAJ6AVkB+wE4AXkHAAGzAdsB3AcJAfQBCQHcAdsBvAEAAewBBwH7AQcB+wEHAewKAAHsBf8B7AcA + AnoBWQLlAcMBegJZAZkHAAG5CRkB9AMZAfACAAXsDAAF7AkAAfABGgFSAlkCegFTAXkRAAHwKAAC8AoA + AUIBTQE+BwABPgMAASgDAAFAAwABMAMAAQEBAAEBBQABgAEBFgAD/4EAAv8CAAT/Af4BHwIAAecB/wHA + AQMB4AEPAgABwAE/AcABAwGAAQECAAHAAQMBwAEDAYADAAHAAQMBwAEDAYADAAHAAQMBwAEDAYADAAHA + AQEBwAEDBAABwAEBAYABAQQAAcABAQHAAQEEAAHAAQEB4AEDAQABBwIAAcABAQHwAQcBAAEPAgABgAED + AfgBBwHAAQ8CAAHAAQMB/AEHAeABDwIAAcAB4wH+AScB4AEfAgABwQL/AWcB8AF/AgAB9wP/AYABAQX/ + AYcBgAEABP8B/AEDAYABAAGAAQEB4AEAAeABAQGAAgABAQHAAgABAQGAAgABAQHAAgABAQGAAgABAQGA + AgABAQGAAgABAQGAAgABAQGAAgABAQMAAQEBgAIAAQEDAAEBAYACAAEBAwABDwGAAgABAQGAAgABPwGA + AgABAQGAAgABPwGAAgABAwGAAQEBAAE/AYABAAGAAf8BwAF/AQABPwGAAQABwQH/AeAB/wGAAT8B/wHv + BP8B8wH/Cw== + + + + + + AAABAAEAECAAAAEABAAoAQAAFgAAACgAAAAQAAAAIAAAAAEABAAAAAAAwAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAACAAACAAAAAgIAAgAAAAIAAgACAgAAAwMDAAICAgAAAAP8AAP8AAAD//wD/AAAA/wD/AP// + AAD///8A///////////0bm5ubm5ub/Rs6IjoiEzv9G6Pd4d3Tm/0bP/3f/dM7/Ru/45v905v9Gz/jO/3 + TO/0bn/2b/dOb/Rs5///90zv9G5ubm/3Tm/0bPeIf/bs7/Rub///fm5v9Gzs53zs7O/0xsbGxsbGz/RE + RERERERP//////////8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA + //8AAP//AAD//wAA//8AAP// + + + \ No newline at end of file diff --git a/hello/BTLClass.cs b/hello/BTLClass.cs new file mode 100644 index 0000000..02ea841 --- /dev/null +++ b/hello/BTLClass.cs @@ -0,0 +1,95 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace HelloTeamcenter.hello +{ + public class BTLClass + { + private string item_id; + + public string Item_id + { + get { return item_id; } + set { item_id = value; } + } + private string item_name; + + public string Item_name + { + get { return item_name; } + set { item_name = value; } + } + private string partnumber; + + public string Partnumber + { + get { return partnumber; } + set { partnumber = value; } + } + private string projectname; + + public string Projectname + { + get { return projectname; } + set { projectname = value; } + } + private string proportion; + + public string Proportion + { + get { return proportion; } + set { proportion = value; } + } + private string mapsheet; + + public string Mapsheet + { + get { return mapsheet; } + set { mapsheet = value; } + } + private string item_revision_id; + + public string Item_revision_id + { + get { return item_revision_id; } + set { item_revision_id = value; } + } + private string weight; + + public string Weight + { + get { return weight; } + set { weight = value; } + } + private string materialgrade; + + public string Materialgrade + { + get { return materialgrade; } + set { materialgrade = value; } + } + private string allpage; + + public string Allpage + { + get { return allpage; } + set { allpage = value; } + } + private string pagenumber = "1"; + + public string Pagenumber + { + get { return pagenumber; } + set { pagenumber = value; } + } + private string productType; + + public string ProductType + { + get { return productType; } + set { productType = value; } + } + + } +} diff --git a/hello/BomMsgBean.cs b/hello/BomMsgBean.cs new file mode 100644 index 0000000..f102315 --- /dev/null +++ b/hello/BomMsgBean.cs @@ -0,0 +1,144 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace HelloTeamcenter.hello +{ + class BomMsgBean + { + String index;//序号 + String codeNo;//代号 + String name;//名称 + String quantity;//数量 + String material;//材料 + String note;//备注 + String zhongliang ; + String zongzhong ; + + /// + /// 返回信息 + /// + /// + public String toString() { + return "index =" + index + " | codeNo=" + codeNo + " | name=" + name + " | quantity=" + quantity + " | material=" + material+" | note="+note +"\n"; + + } + + + /// + /// 设置和得到序号 + /// + public String Zongzhong + { + set + { + zongzhong = value; + } + get + { + return zongzhong; + } + } + + /// + /// 设置和得到序号 + /// + public String Zhongliang + { + set + { + zhongliang = value; + } + get + { + return zhongliang; + } + } + + /// + /// 设置和得到序号 + /// + public String Index { + set { + index = value; + } + get { + return index; + } + } + /// + /// 设置和得到代号 + /// + public String CodeNo + { + set + { + codeNo = value; + } + get + { + return codeNo; + } + } + /// + /// 设置和得到名称 + /// + public String Name + { + set + { + name = value; + } + get + { + return name; + } + } + /// + /// 设置和得到数量 + /// + public String Quantity + { + set + { + quantity = value; + } + get + { + return quantity; + } + } + /// + /// 设置和得到材料 + /// + public String Material + { + set + { + material = value; + } + get + { + return material; + } + } + /// + /// 设置和得到备注 + /// + public String Note + { + set + { + note = value; + } + get + { + return note; + } + } + + + + } +} diff --git a/hello/DataManagement.cs b/hello/DataManagement.cs new file mode 100644 index 0000000..7c67483 --- /dev/null +++ b/hello/DataManagement.cs @@ -0,0 +1,379 @@ +//================================================== +// +// @@ +// +//================================================== + + + + +using System; +using System.Collections; + +using Teamcenter.ClientX; +using Teamcenter.Schemas.Soa._2006_03.Exceptions; + +// Include the Data Management Service Interface +using Teamcenter.Services.Strong.Core; + +// Input and output structures for the service operations +// Note: the different namespace from the service interface +using Teamcenter.Services.Strong.Core._2006_03.DataManagement; +using Teamcenter.Services.Strong.Core._2007_01.DataManagement; +using Teamcenter.Soa.Client.Model; +using Teamcenter.Soa.Exceptions; + +using Item = Teamcenter.Soa.Client.Model.Strong.Item; +using ItemRevision = Teamcenter.Soa.Client.Model.Strong.ItemRevision; + +namespace Teamcenter.Hello +{ + +/** + * Perform different operations in the DataManamentService + * + */ +public class DataManagement +{ + + /** + * Perform a sequence of data management operations: Create Items, Revise + * the Items, and Delete the Items + * + */ + public void createReviseAndDelete() + { + try + { + int numberOfItems = 3; + + // Reserve Item IDs and Create Items with those IDs + ItemIdsAndInitialRevisionIds[] itemIds = generateItemIds(numberOfItems, "Item"); + CreateItemsOutput[] newItems = createItems(itemIds, "Item"); + + // Copy the Item and ItemRevision to separate arrays for further + // processing + Item[] items = new Item[newItems.Length]; + ItemRevision[] itemRevs = new ItemRevision[newItems.Length]; + for (int i = 0; i < items.Length; i++) + { + items[i] = newItems[i].Item; + itemRevs[i] = newItems[i].ItemRev; + } + + // Reserve revision IDs and revise the Items + Hashtable allRevIds = generateRevisionIds(items); + reviseItems(allRevIds, itemRevs); + + // Delete all objects created + deleteItems(items); + } + catch (ServiceException e) + { + System.Console.Out.WriteLine(e.Message ); + } + + } + + /** + * Reserve a number Item and Revision Ids + * + * @param numberOfIds Number of IDs to generate + * @param type Type of IDs to generate + * + * @return An array of Item and Revision IDs. The size of the array is equal + * to the input numberOfIds + * + * @throws ServiceException If any partial errors are returned + */ + public ItemIdsAndInitialRevisionIds[] generateItemIds(int numberOfIds, String type) + // throws ServiceException + { + // Get the service stub + DataManagementService dmService = DataManagementService.getService(Session.getConnection()); + + GenerateItemIdsAndInitialRevisionIdsProperties[] properties = new GenerateItemIdsAndInitialRevisionIdsProperties[1]; + GenerateItemIdsAndInitialRevisionIdsProperties property = new GenerateItemIdsAndInitialRevisionIdsProperties(); + + property.Count = numberOfIds; + property.ItemType = type; + property.Item = null; // Not used + properties[0] = property; + + // ***************************** + // Execute the service operation + // ***************************** + GenerateItemIdsAndInitialRevisionIdsResponse response = dmService.GenerateItemIdsAndInitialRevisionIds(properties); + + + + // The AppXPartialErrorListener is logging the partial errors returned + // In this simple example if any partial errors occur we will throw a + // ServiceException + if (response.ServiceData.sizeOfPartialErrors() > 0) + throw new ServiceException( "DataManagementService.generateItemIdsAndInitialRevisionIds returned a partial error."); + + // The return is a map of ItemIdsAndInitialRevisionIds keyed on the + // 0-based index of requested IDs. Since we only asked for IDs for one + // data type, the map key is '0' + Int32 bIkey = 0; + Hashtable allNewIds = response.OutputItemIdsAndInitialRevisionIds; + ItemIdsAndInitialRevisionIds[] myNewIds = (ItemIdsAndInitialRevisionIds[]) allNewIds[bIkey]; + + return myNewIds; + } + + /** + * Create Items + * + * @param itemIds Array of Item and Revision IDs + * @param itemType Type of item to create + * + * @return Set of Items and ItemRevisions + * + * @throws ServiceException If any partial errors are returned + */ + public CreateItemsOutput[] createItems(ItemIdsAndInitialRevisionIds[] itemIds, String itemType) + // throws ServiceException + { + // Get the service stub + DataManagementService dmService = DataManagementService.getService(Session.getConnection()); + // Populate form type + GetItemCreationRelatedInfoResponse relatedResponse = dmService.GetItemCreationRelatedInfo(itemType, null); + String[] formTypes = new String[0]; + if ( relatedResponse.ServiceData.sizeOfPartialErrors() > 0) + throw new ServiceException( "DataManagementService.getItemCretionRelatedInfo returned a partial error."); + + formTypes = new String[relatedResponse.FormAttrs.Length]; + for ( int i = 0; i < relatedResponse.FormAttrs.Length; i++ ) + { + FormAttributesInfo attrInfo = relatedResponse.FormAttrs[i]; + formTypes[i] = attrInfo.FormType; + } + + ItemProperties[] itemProps = new ItemProperties[itemIds.Length]; + for (int i = 0; i < itemIds.Length; i++) + { + // Create form in cache for form property population + ModelObject[] forms = createForms(itemIds[i].NewItemId, formTypes[0], + itemIds[i].NewRevId, formTypes[1], + null, false); + ItemProperties itemProperty = new ItemProperties(); + + itemProperty.ClientId = "AppX-Test"; + itemProperty.ItemId = itemIds[i].NewItemId; + itemProperty.RevId = itemIds[i].NewRevId; + itemProperty.Name = "AppX-Test"; + itemProperty.Type = itemType; + itemProperty.Description = "Test Item for the SOA AppX sample application."; + itemProperty.Uom = ""; + + // Retrieve one of form attribute value from Item master form. + ServiceData serviceData = dmService.GetProperties(forms, new String[]{"project_id"}); + if ( serviceData.sizeOfPartialErrors() > 0) + throw new ServiceException( "DataManagementService.getProperties returned a partial error."); + Property property = null; + try + { + property= forms[0].GetProperty("project_id"); + } + catch ( NotLoadedException /*ex*/){} + + + // Only if value is null, we set new value + if ( property == null || property.StringValue == null || property.StringValue.Length == 0) + { + itemProperty.ExtendedAttributes = new ExtendedAttributes[1]; + ExtendedAttributes theExtendedAttr = new ExtendedAttributes(); + theExtendedAttr.Attributes = new Hashtable(); + theExtendedAttr.ObjectType = formTypes[0]; + theExtendedAttr.Attributes["project_id"] = "project_id"; + itemProperty.ExtendedAttributes[0] = theExtendedAttr; + } + itemProps[i] = itemProperty; + } + + + // ***************************** + // Execute the service operation + // ***************************** + CreateItemsResponse response = dmService.CreateItems(itemProps, null, ""); + // before control is returned the ChangedHandler will be called with + // newly created Item and ItemRevisions + + + + // The AppXPartialErrorListener is logging the partial errors returned + // In this simple example if any partial errors occur we will throw a + // ServiceException + if (response.ServiceData.sizeOfPartialErrors() > 0) + throw new ServiceException( "DataManagementService.createItems returned a partial error."); + + return response.Output; + } + + /** + * Reserve Revision IDs + * + * @param items Array of Items to reserve Ids for + * + * @return Map of RevisionIds + * + * @throws ServiceException If any partial errors are returned + */ + public Hashtable generateRevisionIds(Item[] items) //throws ServiceException + { + // Get the service stub + DataManagementService dmService = DataManagementService.getService(Session.getConnection()); + + GenerateRevisionIdsResponse response = null; + GenerateRevisionIdsProperties[] input = null; + input = new GenerateRevisionIdsProperties[items.Length]; + for (int i = 0; i < items.Length; i++) + { + GenerateRevisionIdsProperties property = new GenerateRevisionIdsProperties(); + property.Item = items[i]; + property.ItemType = ""; + input[i] = property; + } + + // ***************************** + // Execute the service operation + // ***************************** + response = dmService.GenerateRevisionIds(input); + + // The AppXPartialErrorListener is logging the partial errors returned + // In this simple example if any partial errors occur we will throw a + // ServiceException + if (response.ServiceData.sizeOfPartialErrors() > 0) + throw new ServiceException( "DataManagementService.generateRevisionIds returned a partial error."); + + return response.OutputRevisionIds; + } + + /** + * Revise Items + * + * @param revisionIds Map of Revsion IDs + * @param itemRevs Array of ItemRevisons + * + * @return Map of Old ItemRevsion(key) to new ItemRevision(value) + * + * @throws ServiceException If any partial errors are returned + */ + public Hashtable reviseItems(Hashtable revisionIds, ItemRevision[] itemRevs) //throws ServiceException + { + // Get the service stub + DataManagementService dmService = DataManagementService.getService(Session.getConnection()); + + Hashtable revs = new Hashtable(); + for (int i = 0; i < itemRevs.Length; i++) + { + + + RevisionIds rev = (RevisionIds) revisionIds[i]; + + ReviseProperties revProps = new ReviseProperties(); + + revProps.RevId = rev.NewRevId; + revProps.Name = "testRevise"; + revProps.Description = "describe testRevise"; + + Hashtable attrs = new Hashtable(); + attrs["project_id"] = "project_id_val"; + revProps.ExtendedAttributes = attrs; + + revs[itemRevs[i]]= revProps; + } + + // ***************************** + // Execute the service operation + // ***************************** + ReviseResponse revised = dmService.Revise(revs); + // before control is returned the ChangedHandler will be called with + // newly created Item and ItemRevisions + + + + // The AppXPartialErrorListener is logging the partial errors returned + // In this simple example if any partial errors occur we will throw a + // ServiceException + if (revised.ServiceData.sizeOfPartialErrors() > 0) + throw new ServiceException("DataManagementService.revise returned a partial error."); + + return revised.OldItemRevToNewItemRev; + + } + + /** + * Delete the Items + * + * @param items Array of Items to delete + * + * @throws ServiceException If any partial errors are returned + */ + public void deleteItems(Item[] items) //throws ServiceException + { + // Get the service stub + DataManagementService dmService = DataManagementService.getService(Session.getConnection()); + + // ***************************** + // Execute the service operation + // ***************************** + ServiceData serviceData = dmService.DeleteObjects(items); + + // The AppXPartialErrorListener is logging the partial errors returned + // In this simple example if any partial errors occur we will throw a + // ServiceException + if (serviceData.sizeOfPartialErrors() > 0) + throw new ServiceException("DataManagementService.deleteObjects returned a partial error."); + + } + + /** + * Create ItemMasterForm and ItemRevisionMasterForm + * + * @param IMFormName Name of ItemMasterForm + * @param IMFormType Type of ItemMasterForm + * @param IRMFormName Name of ItemRevisionMasterForm + * @param IRMFormType Type of ItemRevisionMasterForm + * @param parent The container object that two + * newly-created forms will be added into. + * @return ModelObject[] Array of forms + * + * @throws ServiceException If any partial errors are returned + */ + public ModelObject[] createForms ( String IMFormName, String IMFormType, + String IRMFormName, String IRMFormType, + ModelObject parent, bool saveDB ) //throws ServiceException + { + //Get the service stub + DataManagementService dmService = DataManagementService.getService(Session.getConnection()); + FormInfo[] inputs = new FormInfo[2]; + inputs[0] = new FormInfo(); + inputs[0].ClientId = "1"; + inputs[0].Description=""; + inputs[0].Name = IMFormName; + inputs[0].FormType=IMFormType; + inputs[0].SaveDB = saveDB; + inputs[0].ParentObject = parent ; + inputs[1] = new FormInfo(); + inputs[1].ClientId = "2"; + inputs[1].Description=""; + inputs[1].Name = IRMFormName; + inputs[1].FormType=IRMFormType; + inputs[1].SaveDB = saveDB; + inputs[1].ParentObject = parent; + CreateOrUpdateFormsResponse response = dmService.CreateOrUpdateForms(inputs); + if ( response.ServiceData.sizeOfPartialErrors() > 0) + throw new ServiceException("DataManagementService.createForms returned a partial error."); + ModelObject[] forms = new ModelObject [inputs.Length]; + for (int i=0; i@ +// +//================================================== + + +using System; +using System.Collections; +using Teamcenter.ClientX; +using ZwSoft.ZwCAD.DatabaseServices; +using ZwSoft.ZwCAD.Runtime; +using ZwSoft.ZwCAD.Geometry; +using ZwSoft.ZwCAD.ApplicationServices; +using ZwSoft.ZwCAD.EditorInput; +using ZwSoft.ZwCAD.Windows; +using HelloTeamcenter.hello; +using HelloTeamcenter.form; +using System.Windows.Forms; +using System.IO; +using System.Collections.Generic; +using Teamcenter.Services.Strong.Core; +using Teamcenter.Soa.Client.Model; +using Teamcenter.Services.Strong.Core._2006_03.Reservation; +using Teamcenter.Services.Strong.Core._2006_03.FileManagement; +using Teamcenter.Services.Strong.Core._2006_03.DataManagement; +using Teamcenter.Services.Strong.Core._2007_01.DataManagement; +using Teamcenter.Services.Strong.Core._2007_06.DataManagement; +using Teamcenter.Soa.Internal.Client.Model; +using Teamcenter.Soa.Internal.Client; +using Teamcenter.Soa.Client; +using Teamcenter.Services.Strong.Query; +//using Teamcenter.FMS.FCCProxy.ClientCache; +using Teamcenter.Schemas.Soa._2006_03.Exceptions; +using Teamcenter.Soa.Exceptions; +using System.Text; +using AcAp = ZwSoft.ZwCAD.ApplicationServices.Application; +using User = Teamcenter.Soa.Client.Model.Strong.User; +using DataSet = Teamcenter.Soa.Client.Model.Strong.Dataset; +using ImanFile = Teamcenter.Soa.Client.Model.Strong.ImanFile; +using SavedQueryResults = Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryResults; +using Item = Teamcenter.Soa.Client.Model.Strong.Item; +using ItemRevision = Teamcenter.Soa.Client.Model.Strong.ItemRevision; +using ImanQuery = Teamcenter.Soa.Client.Model.Strong.ImanQuery; +using ReleaseStatus = Teamcenter.Soa.Client.Model.Strong.ReleaseStatus; +using Form = Teamcenter.Soa.Client.Model.Strong.Form; +using Dataset = Teamcenter.Soa.Client.Model.Strong.Dataset; +using Folder = Teamcenter.Soa.Client.Model.Strong.Folder; +using WorkspaceObject = Teamcenter.Soa.Client.Model.Strong.WorkspaceObject; +using KCad; + +[assembly: ExtensionApplication(typeof(Teamcenter.Hello.Hello))] +[assembly: CommandClass(typeof(Teamcenter.Hello.Hello))] + +namespace Teamcenter.Hello +{ + /** + * This sample client application demonstrates some of the basic features of the + * Teamcenter Services framework and a few of the services. + * + * An instance of the Connection object is created with implementations of the + * ExceptionHandler, PartialErrorListener, ChangeListener, and DeleteListeners + * intefaces. This client application performs the following functions: + * 1. Establishes a session with the Teamcenter server + * 2. Display the contents of the Home Folder + * 3. Performs a simple query of the database + * 4. Create, revise, and delete an Item + * + */ + + public class Hello : ZwSoft.ZwCAD.Runtime.IExtensionApplication + { + static User loginuser; + Login loginfrom; + OpenFromTC openfrom; + Search searchfrom; + Search1 searchfrom1; + SaveToTC savefrom; + static ZwSoft.ZwCAD.EditorInput.Editor ed; + static ZwSoft.ZwCAD.ApplicationServices.Document appodc; + static DocumentCollection acdocmgr; + static Teamcenter.ClientX.Session session; + static ItemMsgBean itemBean; + // + bool islogin = false; + bool hasRight = true; + string serveraddress; + string username; + string password; + string usergroup; + string userrole; + + //ڼ¼Item.xmlļжӦItem + static OriginItemType originitemtype; + + static string xmlpath = ""; + + public static Dictionary pathType; + public static List puidList; + + public void getFilePuid() + { + if (puidList == null) + { + puidList = new List(); + + } + Document appodcTemp = ZwSoft.ZwCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument; + appodcTemp.ToString(); + ed = appodcTemp.Editor; + DateTime now = DateTime.Now; + string tempPath = System.Environment.GetEnvironmentVariable("TEMP"); + if (tempPath != null) + { + String path = tempPath + "\\" + now.Year + "-" + now.Month + "-" + now.Day; + if (Directory.Exists(path)) + { + ed.WriteMessage("" + path); + DirectoryInfo folderInfo = new DirectoryInfo(path); + FileInfo[] fileInfos = folderInfo.GetFiles(); + if (fileInfos != null) + { + ed.WriteMessage("ļ=" + fileInfos.Length); + foreach (FileInfo fileInfo in fileInfos) + { + StreamReader sr = new StreamReader(fileInfo.FullName, Encoding.GetEncoding("UTF-8"), true); + + string dwgType = sr.ReadLine(); + if (!puidList.Contains(dwgType)) + { + puidList.Add(dwgType); + ed.WriteMessage(puidList.Count + ""); + ed.WriteMessage(" " + dwgType); + } + else + { + ed.WriteMessage(puidList.Count + ""); + ed.WriteMessage(" " + dwgType); + } + sr.Close(); + File.Delete(fileInfo.FullName); + + } + } + else + { + ed.WriteMessage("ļNULL"); + } + + } + else + { + ed.WriteMessage("" + path); + } + } + + + + } + + + public void Initialize() + { + //addComtextMenu(); + } + public void Terminate() + { + + } + [CommandMethod("SET_PATH_TYPE")] + public void setPathType() + { + if (pathType == null) + { + pathType = new Dictionary(); + } + string tempPath = System.Environment.GetEnvironmentVariable("TEMP").ToString(); + string filePath = tempPath + "\\" + "dwg_type.txt"; + if (File.Exists(filePath)) + { + Document appodcTemp = ZwSoft.ZwCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument; + appodcTemp.ToString(); + ed = appodcTemp.Editor; + ed.WriteMessage("NAME =" + appodcTemp.Name); + StreamReader sr = new StreamReader(filePath, false); + string dwgType = sr.ReadLine(); + ed.WriteMessage("Type Count =" + pathType.Count); + pathType.Add(appodcTemp.Name, dwgType); + ed.WriteMessage("Type Count =" + pathType.Count); + sr.Close(); + File.Delete(filePath); + } + } + + /** + *¼ + */ + [CommandMethod("LOGIN")] + public void login() + { + + + + appodc = ZwSoft.ZwCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument; + acdocmgr = ZwSoft.ZwCAD.ApplicationServices.Application.DocumentManager; + //acdocmgr.DocumentToBeDestroyed+=new DocumentCollectionEventHandler(acdocmgr_DocumentToBeDestroyed); + + //appodc.Database.SaveAs(appodc.Name, true, DwgVersion.Current, appodc.Database.SecurityParameters); + //appodc.Database.Save(); + ed = appodc.Editor; + ed.WriteMessage("==========login==========\n"); + //Tool tool = new Tool(); + //BTLClass titleinfo = tool.getBTL("DFHM_BTL",appodc); + //ed.WriteMessage("Ϣ:\n" + "ͼţ" + titleinfo.Item_id.ToString()); + + //ȡûļ + //OriginTool origintool = new OriginTool(); + //xmlpath = System.Environment.CurrentDirectory; + xmlpath = System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase; + ed.WriteMessage("ǰ·:" + xmlpath + "\n"); + //origintool.checkxml(xmlpath); + loginfrom = new Login(); + loginfrom.appodc = appodc; + loginfrom.button1.Click += new System.EventHandler(this.loginbutton1_Click); + loginfrom.button2.Click += new System.EventHandler(this.loginbutton2_Click); + loginfrom.Activate(); + loginfrom.Show(); + + } + private void loginbutton1_Click(object sender, EventArgs e) + { + loginfrom.m_WebAddress = loginfrom.textBox1.Text.ToString(); + loginfrom.username = loginfrom.textBox2.Text.ToString(); + loginfrom.password = loginfrom.textBox3.Text.ToString(); + loginfrom.usergroup = loginfrom.textBox4.Text.ToString(); + loginfrom.userrole = loginfrom.textBox5.Text.ToString(); + //ed.WriteMessage("¼:" + loginfrom.m_WebAddress + "--" + loginfrom.username + "---" + loginfrom.password + "\n"); + string address = loginfrom.m_WebAddress; + session = new Session(address); + ed.WriteMessage("ӷɹ\n"); + // session = new Teamcenter.ClientX.Session(loginfrom.m_WebAddress); + + loginuser = session.mylogin(loginfrom.username, loginfrom.password, loginfrom.usergroup, loginfrom.userrole); + + if (loginuser != null) + { + serveraddress = loginfrom.m_WebAddress; + username = loginfrom.username; + password = loginfrom.password; + usergroup = loginfrom.usergroup; + userrole = loginfrom.userrole; + OriginTool.Loginuser = loginuser; + ed.WriteMessage("¼ɹ\n"); + islogin = true; + string tempdir = System.Environment.GetEnvironmentVariable("TEMP").ToString(); + string loginfile = tempdir + "\\login.ini"; + loginfrom.Hide(); + + + //loginfrom.Dispose(); + if (File.Exists(loginfile)) + { + StreamWriter sw = new StreamWriter(loginfile, false); + sw.WriteLine(loginfrom.m_WebAddress + "|" + loginfrom.username + "|" + loginfrom.password + + "|" + loginfrom.usergroup + "|" + loginfrom.userrole + "||"); + sw.Close(); + } + else + { + FileStream fs = new FileStream(loginfile, FileMode.Create, FileAccess.Write); + StreamWriter sw = new StreamWriter(fs); + sw.WriteLine(loginfrom.m_WebAddress + "|" + loginfrom.username + "|" + loginfrom.password + + "|" + loginfrom.usergroup + "|" + loginfrom.userrole + "||"); + sw.Close(); + fs.Close(); + } + + //ӷ˻ȡxmlļ + OriginTool origintool = new OriginTool(); + + // bool hasxmlfile = origintool.checkxml(xmlpath); + bool hasxmlfile = true; + if (hasxmlfile)// + { + //DialogResult hasresult = MessageBox.Show("ǰĿ¼ѾXMLļǷͬ", "ʾ", MessageBoxButtons.YesNo, MessageBoxIcon.Question); + //if (hasresult == DialogResult.No || hasresult == DialogResult.None) + //{ + // ed.WriteMessage("XMLļͬ\n"); + //} + //if (hasresult == DialogResult.Yes) + //{ + // Hashtable prevalues = origintool.getTCPreferences("OriginXMLFile"); + // if (prevalues != null && prevalues.Count > 0) + // { + // foreach (DictionaryEntry de in prevalues) + // { + // List itemidlist = origintool.getCorrespondItemID((string[])de.Value); + // for (int m = 0; m < itemidlist.Count; m++) + // { + // string item_id = itemidlist[m]; + // SavedQueryResults found = origintool.getSearchItem(item_id); + // if (found.NumOfObjects == 0) + // { + // ed.WriteMessage("TCϵͳѡȷ\n"); + // return; + // } + // else + // { + // Item dmtitem = found.Objects[0] as Item; + // if (!origintool.downloadfile(dmtitem, xmlpath)) + // { + // ed.WriteMessage("ģļ\n"); + // return; + // } + // } + // } + + // } + + // } + //} + } + + } + else + { + MessageBox.Show("Բ𣬵¼ʧܣȷ"); + loginfrom.Dispose(); + } + ed.WriteMessage("\n"); + } + private void loginbutton2_Click(object sender, EventArgs e) + { + loginfrom.Hide(); + loginfrom.Dispose(); + } + bool hadlogin = false; + + [CommandMethod("OPEN_FROM_TC")] + public void openformtc() + { + if (loginuser != null) + { + hadlogin = true; + } + else + login(); + //if (hadlogin == false) + //{ + // string tempdir = System.Environment.GetEnvironmentVariable("TEMP").ToString(); + // string loginfile = tempdir + "\\login.ini"; + // if (File.Exists(loginfile)) + // { + // StreamReader sr = new StreamReader(loginfile); + // string line; + // if ((line = sr.ReadLine()) != null) + // { + // string[] ans = line.Split('|'); + // for (int i = 0; i < ans.Length; i++) + // { + // if (i == 0) + // serveraddress = ans[i].ToString(); + // if (i == 1) + // username = ans[i].ToString(); + // if (i == 2) + // password = ans[i].ToString(); + // if (i == 3) + // usergroup = ans[i].ToString(); + // if (i == 4) + // userrole = ans[i].ToString(); + // } + // if ((line = sr.ReadLine()) != null) + // { + // if (line == "#") + // { + // Teamcenter.ClientX.Session session = new Teamcenter.ClientX.Session(serveraddress); + // try + // { + // loginuser = session.mylogin(username, password, usergroup, userrole); + // } + // catch (InvalidCredentialsException e) + // { + // ed.WriteMessage("ûϢµ¼"); + // return; + // } + // if (loginuser != null) + // hadlogin = true; + // } + // } + + // } + // sr.Close(); + // } + // else + // { + // login(); + // } + //} + if (hadlogin == true) + { + openfrom = new OpenFromTC(); + openfrom.appodc = appodc; + openfrom.user = loginuser; + openfrom.button1.Click += new System.EventHandler(this.openbutton1_Click); + openfrom.button2.Click += new System.EventHandler(this.openbutton2_Click); + openfrom.Activate(); + openfrom.Show(); + } + } + + private void openbutton1_Click(object sender, EventArgs e) + { + DataManagementService dmService = DataManagementService.getService(Session.getConnection()); + Reservation res = ReservationService.getService(Session.getConnection()); + Editor ed1 = ZwSoft.ZwCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; + TreeNode nownode = this.openfrom.treeView1.SelectedNode; + if (nownode.SelectedImageIndex == 0) + { + List datasetlist = this.openfrom.datasetlist; + foreach (ALLOBJECT perobject in datasetlist) + { + if (perobject.treenode.Equals(nownode)) + { + this.openfrom.textBox1.Text = perobject.name; + DialogResult isopen = MessageBox.Show("Ƿȷ򿪸ͼֽ", "ʾ", MessageBoxButtons.YesNo, MessageBoxIcon.Question); + if (isopen == DialogResult.None || isopen == DialogResult.No) + { + return; + } + DataSet mydateset = perobject.workobject as DataSet; + ModelObject[] objects = { mydateset }; + String[] attributes = { "is_modifiable", "checked_out", "ref_list" }; + dmService.RefreshObjects(objects); + dmService.GetProperties(objects, attributes); + if (mydateset.Is_modifiable == false) + { + DialogResult moresult = MessageBox.Show("û޸ȨޣǷֻʽ򿪣", "ʾ", MessageBoxButtons.YesNo, MessageBoxIcon.Question); + if (moresult == DialogResult.Yes) + { + hasRight = false; + } + else + { + return; + } + } + if (mydateset.Is_modifiable) + { + DialogResult moresult = MessageBox.Show("Ƿǩ", "ʾ", MessageBoxButtons.YesNo, MessageBoxIcon.Question); + if (moresult == DialogResult.Yes) + { + if (mydateset.Checked_out == "Y") + { + MessageBox.Show("Բļǩȷļǩִд˲"); + return; + } + else + { + ModelObject[] dataobj = { mydateset }; + res.Checkout(dataobj, "", ""); + ed1.WriteMessage("ļǩ"); + ed1.WriteMessage("\n"); + } + } + } + + ModelObject[] dsfilevec = mydateset.Ref_list; + + ed1.WriteMessage(":" + dsfilevec.Length); + ed1.WriteMessage(dsfilevec[0].GetType().ToString()); + ImanFile dsfile = dsfilevec[0] as ImanFile; + + ModelObject[] objects1 = { dsfile }; + String[] attributes1 = { "relative_directory_path", "original_file_name" }; + dmService.RefreshObjects(objects1); + dmService.GetProperties(objects1, attributes1); + + ed1.WriteMessage("·:" + dsfile.Relative_directory_path + "\n"); + ed1.WriteMessage("ļ:" + dsfile.Original_file_name + "\n"); + string newfilename = dsfile.Original_file_name; + + ed1.WriteMessage("Original_file_name : " + newfilename + "\n"); + string tempdir = System.Environment.GetEnvironmentVariable("TEMP").ToString(); + ed1.WriteMessage("TEMP:" + tempdir.ToString() + "\n"); + + FileManagementService fmService = FileManagementService.getService(Teamcenter.ClientX.Session.getConnection()); + ImanFile[] objects2 = { dsfile }; + FileTicketsResponse tickets = fmService.GetFileReadTickets(objects2); + ed1.WriteMessage("tickets : " + tickets.Tickets.Count + "\n"); + + foreach (System.Collections.DictionaryEntry ticket in tickets.Tickets) + { + ed1.WriteMessage("" + ticket.Key + "\n" + "ֵ" + ticket.Value + "\n"); + } + Teamcenter.Soa.Client.FileManagementUtility fmu = new Teamcenter.Soa.Client.FileManagementUtility(Teamcenter.ClientX.Session.getConnection()); + Teamcenter.Soa.Client.GetFileResponse getFileResponse = fmu.GetFiles(dsfilevec); + FileInfo[] fileinfovec = getFileResponse.GetFiles(); + + ed1.WriteMessage("ļ" + fileinfovec.Length + "\n"); + FileInfo file = fileinfovec[0]; + //ed.WriteMessage("file.DirectoryName:" + file.DirectoryName + "\n"); + //ed.WriteMessage("file.FullName" + file.FullName + "\n"); + //string datestring = ""; + //datestring = DateTime.Now.ToString("yyyy_MM_dd_hh_mm_ss");//19 + string newtempfile = tempdir + "\\" + newfilename; + ed1.WriteMessage("·" + newtempfile + "\n"); + + System.IO.File.Copy(file.FullName, newtempfile, true); + System.IO.File.SetAttributes(newtempfile, FileAttributes.Normal); + this.openfrom.Hide(); + this.openfrom.Dispose(); + if (File.Exists(newtempfile)) + { + DocumentCollection acdocmgr1 = ZwSoft.ZwCAD.ApplicationServices.Application.DocumentManager; + acdocmgr1.Open(newtempfile, false); + //Object pdata = newtempfile; + //acdocmgr.ExecuteInApplicationContext(c_back,pdata); + //Teamcenter.ClientX.Session session = new Teamcenter.ClientX.Session(serveraddress); + //loginuser = session.mylogin(username, password, usergroup, userrole); + + } + else + { + ed1.WriteMessage("ԲûʱĿ¼²ڴļ\n"); + } + + break; + } + } + } + else + { + ed1.WriteMessage("ѡȷݼ\n"); + MessageBox.Show("ѡȷݼ"); + return; + } + } + + private void openbutton2_Click(object sender, EventArgs e) + { + this.openfrom.Hide(); + this.searchfrom = new Search(); + this.searchfrom.appdoc = appodc; + this.searchfrom.user = loginuser; + this.searchfrom.xmlpath = xmlpath; + this.searchfrom.Activate(); + this.searchfrom.Show(); + this.openfrom.Dispose(); + } + + private void c_back(Object data) + { + DocumentCollection acdocmgr = ZwSoft.ZwCAD.ApplicationServices.Application.DocumentManager; + if (acdocmgr.IsApplicationContext) + { + acdocmgr.Open(Convert.ToString(data)); + } + } + + /** + * + */ + [CommandMethod("SAVE_AS")] + public void saveas() + { + savetotc(); + } + /// + /// ϴPDFTC + /// + /// + /// + /// 汾 + /// PDF· + /// PDFݼ + /// PDFݼ + public void savePDFToTC(ItemRevision itemRev, String pdfPath, String pdfName, String pdfDatasetType, String pdfDatasetReferenceName) + { + DataManagementService dmService = DataManagementService.getService(Session.getConnection()); + //CAD̨ + Editor cadEditor = ZwSoft.ZwCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; + //PDFݼ + Dataset pdfDataset = null; + Dataset dwgDataset = null; + String filename = null; + bool findDateset = false; + bool findDwgDataset = false; + bool neworupdate = false; + //dwgݼ + cadEditor.WriteMessage("ʼҵDWGݼ\n"); + Teamcenter.Services.Strong.Core._2007_06.DataManagement.ExpandGRMRelationsPref + myPref2 = new Teamcenter.Services.Strong.Core._2007_06.DataManagement.ExpandGRMRelationsPref(); + Teamcenter.Services.Strong.Core._2007_06.DataManagement.RelationAndTypesFilter2 + myFilter2 = new Teamcenter.Services.Strong.Core._2007_06.DataManagement.RelationAndTypesFilter2(); + myFilter2.RelationName = "IMAN_specification"; + string[] typeVec2 = new string[1]; + //ݼ + typeVec2[0] = "JK8_AutoCAD";//"PDF";//datasetinfo.Datatype; + myFilter2.ObjectTypeNames = typeVec2; + myPref2.ExpItemRev = false; + Teamcenter.Services.Strong.Core._2007_06.DataManagement.RelationAndTypesFilter2[] myFilterVec2 = { myFilter2 }; + myPref2.Info = myFilterVec2; + ModelObject[] primaryObjects2 = { itemRev }; + Teamcenter.Services.Strong.Core._2007_06.DataManagement.ExpandGRMRelationsResponse + myResp2 = dmService.ExpandGRMRelationsForPrimary(primaryObjects2, myPref2); + + if (myResp2.Output.Length > 0) + { + for (int k = 0; k < myResp2.Output.Length; k++) + { + Teamcenter.Services.Strong.Core._2007_06.DataManagement.ExpandGRMRelationsOutput + grmOutput2 = myResp2.Output[k]; + for (int l = 0; l < grmOutput2.OtherSideObjData.Length; l++) + { + ExpandGRMRelationsData otherSideData = grmOutput2.OtherSideObjData[l]; + if (otherSideData.OtherSideObjects.Length > 0) + { + for (int m = 0; m < otherSideData.OtherSideObjects.Length; m++) + { + Dataset tempDataset; + //Teamcenter.Soa.Client.Model.ServiceData sData; + tempDataset = otherSideData.OtherSideObjects[m] as Dataset; + ModelObject[] tObj = { tempDataset }; + String[] tAttr = { "ref_list" }; + dmService.RefreshObjects(tObj); + dmService.GetProperties(tObj, tAttr); + ModelObject[] refs = tempDataset.Ref_list; + if (refs.Length == 0) + { + continue; + } + for (int w = 0; w < refs.Length; w++) + { + ImanFile file = refs[w] as ImanFile; + ModelObject[] tObj2 = { file }; + String[] tAttr2 = { "Original_file_name" }; + dmService.RefreshObjects(tObj2); + dmService.GetProperties(tObj2, tAttr2); + string ds_name = file.Original_file_name; + cadEditor.WriteMessage("ļƣ" + ds_name + "\n"); + if (ds_name == pdfName) + { + findDwgDataset = true; + dwgDataset = otherSideData.OtherSideObjects[m] as Dataset; + cadEditor.WriteMessage("ҵDWGݼ!\n"); + pdfName = tempDataset.Object_name; + if (pdfName.EndsWith(".dwg")) + { + pdfName = pdfName.Substring(0, pdfName.Length - 4) + ".pdf"; + } + else if (pdfName.EndsWith(".DWG")) + { + pdfName = pdfName.Substring(0, pdfName.Length - 4) + ".PDF"; + } + break; + } + } + if (findDwgDataset) + { + break; + } + } + } + if (findDwgDataset) + { + break; + } + } + if (findDwgDataset) + { + break; + } + } + } + + + + cadEditor.WriteMessage("=======ϴPDFݼ=========\n"); + + Teamcenter.Services.Strong.Core._2007_06.DataManagement.ExpandGRMRelationsPref + myPref = new Teamcenter.Services.Strong.Core._2007_06.DataManagement.ExpandGRMRelationsPref(); + Teamcenter.Services.Strong.Core._2007_06.DataManagement.RelationAndTypesFilter2 + myFilter = new Teamcenter.Services.Strong.Core._2007_06.DataManagement.RelationAndTypesFilter2(); + myFilter.RelationName = "JK8PdfFileRelation"; + string[] typeVec = new string[1]; + //ݼ + typeVec[0] = pdfDatasetType;//"PDF";//datasetinfo.Datatype; + myFilter.ObjectTypeNames = typeVec; + myPref.ExpItemRev = false; + Teamcenter.Services.Strong.Core._2007_06.DataManagement.RelationAndTypesFilter2[] myFilterVec = { myFilter }; + myPref.Info = myFilterVec; + ModelObject[] primaryObjects = { itemRev }; + Teamcenter.Services.Strong.Core._2007_06.DataManagement.ExpandGRMRelationsResponse + myResp = dmService.ExpandGRMRelationsForPrimary(primaryObjects, myPref); + + if (myResp.Output.Length > 0) + { + for (int k = 0; k < myResp.Output.Length; k++) + { + Teamcenter.Services.Strong.Core._2007_06.DataManagement.ExpandGRMRelationsOutput + grmOutput = myResp.Output[k]; + for (int l = 0; l < grmOutput.OtherSideObjData.Length; l++) + { + ExpandGRMRelationsData otherSideData = grmOutput.OtherSideObjData[l]; + if (otherSideData.OtherSideObjects.Length > 0) + { + for (int m = 0; m < otherSideData.OtherSideObjects.Length; m++) + { + Dataset tempDataset; + //Teamcenter.Soa.Client.Model.ServiceData sData; + tempDataset = otherSideData.OtherSideObjects[m] as Dataset; + + string ds_name = tempDataset.Object_string; + if (ds_name == pdfName) + { + findDateset = true; + pdfDataset = otherSideData.OtherSideObjects[m] as Dataset; + cadEditor.WriteMessage("ҵPDFݼ!\n"); + break; + } + } + + } + } + } + } + + + + //½ݼ + if (findDateset) + { + bool ischeckout = false; + try + { + ModelObject[] objects2 = { pdfDataset }; + String[] attributes2 = { "is_modifiable", "checked_out", "checked_out_user" }; + dmService.RefreshObjects(objects2); + dmService.GetProperties(objects2, attributes2); + // if (!pdfDataset.Is_modifiable) + // { + // MessageBox.Show("򿪵PDFͼֽ״̬Ϊֻ,޷浽ϵͳ!"); + // return; + // } + User checkuserinfo = pdfDataset.Checked_out_user as User; + if (checkuserinfo != null) + { + if (checkuserinfo.Uid != loginuser.Uid) + { + MessageBox.Show("PDFͼֽѱûǩ,޷浽ϵͳ!"); + return; + } + } + if (pdfDataset.Checked_out == "Y") + ischeckout = true; + } + catch (NotLoadedException ex) + { + cadEditor.WriteMessage(ex.Message); + } + + Reservation res = ReservationService.getService(Session.getConnection()); + + ModelObject[] dsFileVec = null; + try + { + ModelObject[] objects2 = { pdfDataset }; + String[] attributes2 = { "ref_list" }; + dmService.RefreshObjects(objects2); + dmService.GetProperties(objects2, attributes2); + dsFileVec = pdfDataset.Ref_list; + } + catch (NotLoadedException ex) + { + cadEditor.WriteMessage(ex.Message); + } + ImanFile dsfile = dsFileVec[0] as ImanFile; + + ModelObject[] objects3 = { dsfile }; + String[] attributes3 = { "relative_directory_path", "original_file_name" }; + dmService.RefreshObjects(objects3); + dmService.GetProperties(objects3, attributes3); + filename = dsfile.Original_file_name; + Teamcenter.Services.Loose.Core._2006_03.FileManagement.DatasetFileInfo[] fileInfos = new Teamcenter.Services.Loose.Core._2006_03.FileManagement.DatasetFileInfo[1]; + Teamcenter.Services.Loose.Core._2006_03.FileManagement.DatasetFileInfo fileInfo = new Teamcenter.Services.Loose.Core._2006_03.FileManagement.DatasetFileInfo(); + //DocumentCollection inacdocmgr = ZwSoft.ZwCAD.ApplicationServices.Application.DocumentManager; + //cadEditor.WriteMessage("ǰļ" + inacdocmgr.MdiActiveDocument.Name + "\n"); + + //Document acdoc = ZwSoft.ZwCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument; + //acdoc.Database.SaveAs(acdoc.Name, true, DwgVersion.Current, acdoc.Database.SecurityParameters); + + //string mdiactivefile = acdoc.Name; + fileInfo.FileName = pdfPath;//mdiactivefile; + fileInfo.AllowReplace = true; + fileInfo.IsText = false; + //ݼ + fileInfo.NamedReferencedName = pdfDatasetReferenceName;//"PDF";//datasetinfo.Refname; + fileInfos[0] = fileInfo; + Teamcenter.Services.Loose.Core._2006_03.FileManagement.GetDatasetWriteTicketsInputData inputData = new Teamcenter.Services.Loose.Core._2006_03.FileManagement.GetDatasetWriteTicketsInputData(); + inputData.Dataset = pdfDataset; + inputData.CreateNewVersion = false; + inputData.DatasetFileInfos = fileInfos; + ModelObject[] datasets = new ModelObject[1]; + datasets[0] = pdfDataset; + //д + + + if (ischeckout) + res.Checkin(datasets); + dmService.RefreshObjects(datasets); + //datasets[0] = inputs[0].Dataset; + //dmService.DeleteObjects(datasets); + Teamcenter.Services.Loose.Core._2006_03.FileManagement.GetDatasetWriteTicketsInputData[] inputs = new Teamcenter.Services.Loose.Core._2006_03.FileManagement.GetDatasetWriteTicketsInputData[1]; + inputs[0] = inputData; + FileManagementUtility fMSFileManagement = new FileManagementUtility(Session.getConnection()); + + ServiceData response = fMSFileManagement.PutFiles(inputs); + if (response.sizeOfPartialErrors() > 0) + { + cadEditor.WriteMessage("FileManagementServiceϴݼ" + response.sizeOfPartialErrors()); + MessageBox.Show("ϴPDFʧܣ"); + return; + } + dmService.RefreshObjects(datasets); + MessageBox.Show("ϴPDFɹ"); + + } + else + { + Teamcenter.Services.Strong.Core._2006_03.DataManagement.DatasetProperties + oneDatasetProp = new Teamcenter.Services.Strong.Core._2006_03.DataManagement.DatasetProperties(); + Teamcenter.Services.Strong.Core._2006_03.DataManagement.DatasetProperties[] + dataset_vec = new Teamcenter.Services.Strong.Core._2006_03.DataManagement.DatasetProperties[1]; + oneDatasetProp.ClientId = "datasetWriteTixTestClientId"; + oneDatasetProp.Type = pdfDatasetType;//datasetinfo.Datatype; + oneDatasetProp.Name = pdfName;//datasetinfo.Ds_name; + oneDatasetProp.Description = ""; + oneDatasetProp.Container = null; + dataset_vec[0] = oneDatasetProp; + Teamcenter.Services.Strong.Core._2006_03.DataManagement.CreateDatasetsResponse + dsResp = dmService.CreateDatasets(dataset_vec); + Dataset createdataset = dsResp.Output[0].Dataset; + + //create relationship + Teamcenter.Services.Strong.Core._2006_03.DataManagement.Relationship[] + rela_vec = new Teamcenter.Services.Strong.Core._2006_03.DataManagement.Relationship[1]; + Teamcenter.Services.Strong.Core._2006_03.DataManagement.Relationship + one_rela = new Teamcenter.Services.Strong.Core._2006_03.DataManagement.Relationship(); + one_rela.ClientId = ""; + one_rela.PrimaryObject = itemRev; + one_rela.SecondaryObject = createdataset; + one_rela.RelationType = "JK8PdfFileRelation"; + one_rela.UserData = null; + rela_vec[0] = one_rela; + Teamcenter.Services.Strong.Core._2006_03.DataManagement.CreateRelationsResponse + reResp = dmService.CreateRelations(rela_vec); + cadEditor.WriteMessage("ݼϵɹ!\n"); + + Teamcenter.Services.Loose.Core._2006_03.FileManagement.DatasetFileInfo[] fileInfos = new Teamcenter.Services.Loose.Core._2006_03.FileManagement.DatasetFileInfo[1]; + + Teamcenter.Services.Loose.Core._2006_03.FileManagement.DatasetFileInfo fileInfo = new Teamcenter.Services.Loose.Core._2006_03.FileManagement.DatasetFileInfo(); + + //DocumentCollection inacdocmgr = ZwSoft.ZwCAD.ApplicationServices.Application.DocumentManager; + //inacdocmgr.MdiActiveDocument.Database.SaveAs(inacdocmgr.MdiActiveDocument.Name, DwgVersion.Current); + //inacdocmgr.MdiActiveDocument.SendStringToExecute("QSAVE", true, false, true); + //cadEditor.WriteMessage("ǰļ" + inacdocmgr.MdiActiveDocument.Name + "\n"); + //Document acdoc = ZwSoft.ZwCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument; + //acdoc.Database.SaveAs(acdoc.Name, true, DwgVersion.Current, acdoc.Database.SecurityParameters); + //string mdiactivefile = acdoc.Name; + + fileInfo.FileName = pdfPath;//mdiactivefile; + fileInfo.AllowReplace = true; + fileInfo.IsText = false; + fileInfo.NamedReferencedName = pdfDatasetReferenceName;//datasetinfo.Refname; + fileInfos[0] = fileInfo; + Teamcenter.Services.Loose.Core._2006_03.FileManagement.GetDatasetWriteTicketsInputData inputData = new Teamcenter.Services.Loose.Core._2006_03.FileManagement.GetDatasetWriteTicketsInputData(); + inputData.Dataset = createdataset; + inputData.CreateNewVersion = false; + inputData.DatasetFileInfos = fileInfos; + Teamcenter.Services.Loose.Core._2006_03.FileManagement.GetDatasetWriteTicketsInputData[] inputs = new Teamcenter.Services.Loose.Core._2006_03.FileManagement.GetDatasetWriteTicketsInputData[1]; + inputs[0] = inputData; + FileManagementUtility fMSFileManagement = new FileManagementUtility(Session.getConnection()); + ServiceData response = fMSFileManagement.PutFiles(inputs); + if (response.sizeOfPartialErrors() > 0) + { + cadEditor.WriteMessage("FileManagementServiceϴݼ" + response.sizeOfPartialErrors()); + MessageBox.Show("ϴPDFʧܣ"); + return; + } + cadEditor.WriteMessage("ϴݼɹ\n"); + ModelObject[] datasets = new ModelObject[1]; + datasets[0] = createdataset; + + dmService.RefreshObjects(datasets); + MessageBox.Show("ϴPDFɹ"); + } + } + + + [CommandMethod("SAVE_PDF_TO_TC_TEST")] + public void savePDFToTcTest() + { + PrintDwg pdfdwg = new PrintDwg(AcAp.DocumentManager.MdiActiveDocument); + + string tempPDFPath = pdfdwg.MultiSheetPlot2("TEST"); + + // KCad2.PrintDwg dwg2 = new KCad2.PrintDwg(AcAp.DocumentManager.MdiActiveDocument); + + //dwg2.MultiSheetPlot(); + } + + /// + /// Զ쳣Ϣ + /// + /// 쳣 + /// 쳣ϢexΪnullʱЧ + /// 쳣ַı + static string GetExceptionMsg(System.Exception ex, string backStr) + { + StringBuilder sb = new StringBuilder(); + sb.AppendLine("****************************쳣ı****************************"); + sb.AppendLine("ʱ䡿" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss")); + if (ex != null) + { + sb.AppendLine("쳣͡" + ex.GetType().Name); + sb.AppendLine("쳣Ϣ" + ex.Message); + sb.AppendLine("ջá" + ex.StackTrace); + sb.AppendLine("쳣" + ex.TargetSite); + } + else + { + sb.AppendLine("δ쳣" + backStr); + } + sb.AppendLine("***************************************************************"); + + + //Update.Updated(); // 쳣󣬼Ƿа汾 + + return sb.ToString(); + } + + /// + /// ȡPDFݼ + /// + /// + /// + public string getPDFName(ItemRevision dwgRev) + { + DataManagementService dmService = DataManagementService.getService(Session.getConnection()); + + if (dwgRev == null) + { + return ""; + } + //string pdfName = null; + string u8Name = ""; + string materialName = ""; + string productIdentityNO = ""; + string userName = ""; + string release = ""; + + ModelObject[] objects = { dwgRev }; + String[] attributes = { "representation_for", "jk8ProductIdentifyNO", + "owning_user","date_released","object_type" }; + dmService.RefreshObjects(objects); + dmService.GetProperties(objects, attributes); + if (dwgRev.Object_type.Equals("JK8PartDraw_CADRevision")) + { + productIdentityNO = dwgRev.GetProperty("jk8ProductIdentifyNO").StringValue; + } + + + + ModelObject[] materials = dwgRev.Representation_for; + if (materials != null && materials.Length > 0) + { + String[] attributes1 = { "item_id", "object_name" }; + dmService.RefreshObjects(materials); + dmService.GetProperties(materials, attributes1); + ItemRevision mRev = materials[0] as ItemRevision; + u8Name = mRev.Item_id; + materialName = mRev.Object_name; + + } + + ModelObject owningUser = dwgRev.Owning_user; + if (owningUser != null) + { + User ouser = owningUser as User; + ModelObject[] objects1 = { ouser }; + String[] attributes1 = { "user_name" }; + dmService.RefreshObjects(objects1); + dmService.GetProperties(objects1, attributes1); + + userName = ouser.User_name; + + } + DateTime dateReleased = dwgRev.Date_released; + if (dateReleased != null) + { + release = dateReleased.ToString("yyyyMMdd"); + } + + return String.Format("TZ-{0}-{1}-{2}-{3}-{4}", + u8Name, materialName, productIdentityNO, userName, release); + } + + + [CommandMethod("SAVE_PDF_TO_TC")] + public void savePDFToTc() + { + if (loginuser != null) + { + hadlogin = true; + } + else + { + login(); + return; + } + Editor ed1 = ZwSoft.ZwCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; + S8.Services.Strong.Bypass.S8SoaBypassServiceService byPassService = S8.Services.Strong.Bypass.S8SoaBypassServiceService.getService(Session.getConnection()); + try + { + if (!byPassService.AskBypass()) + { + byPassService.SetBypass(true); + + } + + if (hadlogin) + { + + getFilePuid(); + + String itemID = null; + String itemRev2 = null; + DataManagementService dmService = DataManagementService.getService(Session.getConnection()); + Document document2 = ZwSoft.ZwCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument; + + + + + OriginTool origintool = new OriginTool(); + + ed1.WriteMessage("\nʼȡϢ...\n"); + ArrayList btllist = new ArrayList(); + OriginReadXml readxml = new OriginReadXml(); + btllist = readxml.OriginReadBTLXML(xmlpath); + + for (int i = 0; i < btllist.Count; i++) + { + OriginBTL onebtlinfo = (OriginBTL)btllist[i]; + ed1.WriteMessage("ƣ" + onebtlinfo.Btlname + "\n"); + ed1.WriteMessage("ϸϢ:" + "\n"); + foreach (DictionaryEntry de in onebtlinfo.Btldatatable) + { + ed1.WriteMessage("CAD" + de.Key + "\tCADֵ:" + de.Value + + "\tTC:" + onebtlinfo.Btltctable[de.Key] + + "\tTCϵͳ:" + onebtlinfo.Btltypetable[de.Key] + + "\tд" + onebtlinfo.Btlwritetable[de.Key] + + "\tͬ:" + onebtlinfo.Btlfromtctable[de.Key] + "\n"); + } + } + + for (int btli = 0; btli < btllist.Count; btli++) + { + OriginBTL btlinfo = (OriginBTL)btllist[btli]; + //item_idӦcadͼֽϢ + object key = origintool.getKeyFromValue(btlinfo.Btltctable, "item_id"); + object key_rev = origintool.getKeyFromValue(btlinfo.Btltctable, "item_revision_id"); + if (key == null) + { + ed1.WriteMessage("ϵͳûҵitem_idӦͼֽϢϵͳж\n"); + return; + } + if (key_rev == null) + { + ed1.WriteMessage("ϵͳûҵitem_revision_idӦͼֽϢϵͳж\n"); + return; + } + itemID = btlinfo.Btldatatable[key].ToString(); + if (itemID == null || itemID.Trim().Equals("")) + { + ed1.WriteMessage("ȡItemϢΪգϵͳѭ\n"); + continue; + } + itemRev2 = btlinfo.Btldatatable[key_rev].ToString(); + // SavedQueryResults found = origintool.getSearchItem(btlinfo.Btldatatable[key].ToString()); + ed1.WriteMessage(string.Format("ID=>{0} REV=>{1}", itemID, itemRev2)); + SavedQueryResults found = origintool.getSearchItem(itemID); + if (found != null && found.NumOfObjects > 0) + { + ed1.WriteMessage("\n>>\n"); + // DialogResult upresult = MessageBox.Show("ҵӦItemǷͬ", "ʾ", MessageBoxButtons.YesNo, MessageBoxIcon.Question); + // if (upresult == DialogResult.No || upresult == DialogResult.None) + // { + // ed1.WriteMessage("ͬ\n"); + // return; + // } + if (true) + { + for (int i = 0; i < found.NumOfObjects; i++) + { + Item item = found.Objects[i] as Item; + + + //ð汾ϵ + + + ModelObject[] objects1 = { item }; + String[] attributes1 = { "revision_list", "is_modifiable" }; + ed1.WriteMessage("\n>>1\n"); + dmService.RefreshObjects(objects1); + ed1.WriteMessage("\n>>2\n"); + + dmService.GetProperties(objects1, attributes1); + + ModelObject[] revlist = item.Revision_list; + + dmService.RefreshObjects(revlist); + + ItemRevision itemRev = null; + string rev_id = ""; + //= new ModelObject[] + + for (int k = 0; k < revlist.Length; k++) + { + String[] attr = { "item_revision_id" }; + + itemRev = revlist[k] as ItemRevision; + ModelObject[] obj2 = { itemRev }; + + dmService.RefreshObjects(obj2); + + dmService.GetProperties(obj2, attr); + + rev_id = itemRev.Item_revision_id; + if (rev_id.Equals(itemRev2)) + { + break; + } + + } + if (itemRev == null) + { + ed1.WriteMessage("ItemûжӦ汾\n"); + return; + } + string myPdfName = getPDFName(itemRev); + PrintDwg pdfdwg = new PrintDwg(AcAp.DocumentManager.MdiActiveDocument); + + string tempPDFPath = pdfdwg.MultiSheetPlot2(myPdfName); + + if (File.Exists(tempPDFPath)) + { + ed1.WriteMessage("ļ·" + tempPDFPath + "\n"); + if (tempPDFPath.Length > 0) + { + + //String secondPdfName = System.Environment.GetEnvironmentVariable("TEMP").ToString()+"\\" + myPdfName + ".pdf"; + //ed1.WriteMessage("PDF=>" + secondPdfName); + // File.Copy(tempPDFPath, secondPdfName,true); + savePDFToTC(itemRev, tempPDFPath, myPdfName, "PDF", "PDF_Reference"); + + //File.Delete(tempPDFPath); + //File.Delete(tempPDFPath.Replace(".pdf","1.PDF")); + } + } + else + { + ed1.WriteMessage("ļ·\n"); + + } + + } + } + } + } + } + } + catch (System.Exception ex_1) + { + string str = GetExceptionMsg(ex_1, string.Empty); + MessageBox.Show(str, "ϵͳ", MessageBoxButtons.OK, MessageBoxIcon.Error); + //ed1.WriteMessage(ex_1.Message+"\n"+ex_1.ToString()); + } + finally + { + if (byPassService.AskBypass()) + { + byPassService.SetBypass(false); + + } + } + } + + /* + *ϸϢ + */ + [CommandMethod("SAVE_TO_TC")] + public void savetotc() + { + + //ZwSoft.ZwCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.SendStringToExecute(string.Format("{0}", "QSAVE"), true, false, true); + + if (loginuser != null) + { + hadlogin = true; + } + else + login(); + if (hadlogin) + { + string filename = ""; + DataManagementService dmService = DataManagementService.getService(Session.getConnection()); + Editor ed1 = ZwSoft.ZwCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; + OriginTool origintool = new OriginTool(); + + ed1.WriteMessage("\nʼȡϢ...\n"); + /************************************************************************/ + /* ȡݵĴ */ + /************************************************************************/ + ArrayList btllist = new ArrayList(); + OriginReadXml readxml = new OriginReadXml(); + btllist = readxml.OriginReadBTLXML(xmlpath); + + for (int i = 0; i < btllist.Count; i++) + { + OriginBTL onebtlinfo = (OriginBTL)btllist[i]; + ed1.WriteMessage("ƣ" + onebtlinfo.Btlname + "\n"); + ed1.WriteMessage("ϸϢ:" + "\n"); + foreach (DictionaryEntry de in onebtlinfo.Btldatatable) + { + ed1.WriteMessage("CAD" + de.Key + "\tCADֵ:" + de.Value + + "\tTC:" + onebtlinfo.Btltctable[de.Key] + + "\tTCϵͳ:" + onebtlinfo.Btltypetable[de.Key] + + "\tд" + onebtlinfo.Btlwritetable[de.Key] + "\n"); + } + } + ed1.WriteMessage("ʼȡϸϢ...\n"); + List mxllist = new List(); + mxllist = readxml.OriginReadMXLXML(xmlpath); + + for (int i = 0; i < mxllist.Count; i++) + { + OriginMXL mxlinfo = mxllist[i]; + ed1.WriteMessage("ϸƣ" + mxlinfo.Mxlname + "\n"); + ed1.WriteMessage("ϸ" + i + "ϸϢ:" + "\n"); + foreach (DictionaryEntry de in mxlinfo.Mxldatatable) + { + ed1.WriteMessage("CAD" + de.Key + "\tCADֵ:" + de.Value + + "\tTC:" + mxlinfo.Mxltctable[de.Key] + + "\tis_bomline:" + mxlinfo.Mxlisbomtable[de.Key] + + "\twritable:" + mxlinfo.Mxlupdatetable[de.Key] + "\n"); + } + } + ed1.WriteMessage("ϸΪ:" + mxllist.Count); + ed1.WriteMessage("ʼΪbomṹ\n"); + // mxllist = origintool.sortbomlist(mxllist); + ed1.WriteMessage("ɹ...\n"); + + // + for (int btli = 0; btli < btllist.Count; btli++) + { + OriginBTL btlinfo = (OriginBTL)btllist[btli]; + //item_idӦcadͼֽϢ + object key = origintool.getKeyFromValue(btlinfo.Btltctable, "item_id"); + if (key == null) + { + ed1.WriteMessage("ϵͳûҵitem_idӦͼֽϢϵͳж\n"); + return; + } + SavedQueryResults found = origintool.getSearchItem(btlinfo.Btldatatable[key].ToString()); + if (found != null && found.NumOfObjects > 0) + { + DialogResult upresult = MessageBox.Show("ҵӦItemǷ£", "ʾ", MessageBoxButtons.YesNo, MessageBoxIcon.Question); + if (upresult == DialogResult.No || upresult == DialogResult.None) + { + ed1.WriteMessage("\n"); + return; + } + if (upresult == DialogResult.Yes) + { + for (int i = 0; i < found.NumOfObjects; i++) + { + Item item = found.Objects[i] as Item; + ModelObject[] objects = { item }; + String[] attributes = { "item_id", "object_name", "object_string" }; + dmService.RefreshObjects(objects); + dmService.GetProperties(objects, attributes); + string item_id = item.Item_id; + string object_name = item.Object_name; + + Dataset dataset = null; + GetItemFromIdInfo tempitem = new GetItemFromIdInfo(); + tempitem.ItemId = item_id; + GetItemFromIdInfo[] infos = new GetItemFromIdInfo[1]; + infos[0] = tempitem; + GetItemFromIdPref pref = new GetItemFromIdPref(); + //Ҫµķʽ + GetItemFromIdResponse infoResp = dmService.GetItemFromId(infos, 1, pref); + + + //㼶ҪӶItemԵĸ + if (btlinfo.Btltypetable.ContainsValue("Item")) + { + ed1.WriteMessage("ڸItem\n"); + Hashtable itemattrs = new Hashtable(); + foreach (DictionaryEntry de in btlinfo.Btltypetable) + { + if (de.Value.ToString() == "Item" && btlinfo.Btlwritetable[de.Key].ToString() == "1" && + btlinfo.Btlupdatetable[de.Key].ToString() == "1") + { + string cadstring = de.Key.ToString(); + string cadvalue = btlinfo.Btldatatable[cadstring].ToString(); + string tcstring = btlinfo.Btltctable[cadstring].ToString(); + itemattrs.Add(tcstring, cadvalue); + } + } + if (itemattrs.Count > 0) + { + ServiceData itemupdateresponse = dmService.SetDisplayProperties(objects, itemattrs); + if (itemupdateresponse.sizeOfPartialErrors() <= 0) + { + ed1.WriteMessage("ItemԳɹ\n"); + } + } + } + + + + + for (int j = 0; j < infoResp.Output.Length; j++) + { + ModelObject[] objects1 = { infoResp.Output[j].Item }; + String[] attributes1 = { "revision_list", "is_modifiable" }; + dmService.RefreshObjects(objects1); + dmService.GetProperties(objects1, attributes1); + ModelObject[] revlist = infoResp.Output[j].Item.Revision_list; + dmService.RefreshObjects(revlist); + ItemRevision itemRev = null; + string rev_id = ""; + for (int k = 0; k < revlist.Length; k++) + { + itemRev = revlist[k] as ItemRevision; + ModelObject[] objects2 = { itemRev }; + String[] attributes2 = { "item_revision_id", "is_modifiable" , + "checked_out","item_id","release_status_list", + "IMAN_master_form_rev"}; + dmService.RefreshObjects(objects2); + dmService.GetProperties(objects2, attributes2); + + //жͼֽǷ˰汾Ϣ˰汾Ϣָİ汾򣬴°汾 + if (btlinfo.Btltctable.ContainsValue("item_revision_id")) + { + if (itemRev.Item_revision_id == btlinfo.Btldatatable[origintool.getKeyFromValue(btlinfo.Btltctable, "item_revision_id")].ToString()) + { + break; + } + } + } + if (itemRev == null) + { + ed1.WriteMessage("ItemûжӦ汾\n"); + return; + } + rev_id = itemRev.Item_revision_id; + ReleaseStatus[] releaselist = itemRev.Release_status_list; + if (!itemRev.Is_modifiable) + { + MessageBox.Show("ItemRevisionΪֻ,ûбȨ!"); + return; + } + if (releaselist.Length > 0) + { + string message = "Item IDΪ" + itemRev.Item_id + "°汾ѷ"; + MessageBox.Show(message); + return; + } + + //㼶ҪӶ԰汾Եĸ + if (btlinfo.Btltypetable.ContainsValue("ItemRevision")) + { + ed1.WriteMessage("ڸItemRevision\n"); + Hashtable itemRevattrs = new Hashtable(); + ModelObject[] olditemRev = new ModelObject[1]; + olditemRev[0] = itemRev; + foreach (DictionaryEntry de in btlinfo.Btltypetable) + { + if (de.Value.ToString() == "ItemRevision" && btlinfo.Btlwritetable[de.Key].ToString() == "1" && + btlinfo.Btlupdatetable[de.Key].ToString() == "1") + { + string cadstring = de.Key.ToString(); + string cadvalue = btlinfo.Btldatatable[cadstring].ToString(); + string tcstring = btlinfo.Btltctable[cadstring].ToString(); + itemRevattrs.Add(tcstring, cadvalue); + } + } + if (itemRevattrs.Count > 0) + { + ServiceData itemupdateresponse = dmService.SetDisplayProperties(olditemRev, itemRevattrs); + if (itemupdateresponse.sizeOfPartialErrors() <= 0) + { + ed1.WriteMessage("ItemRevisionԳɹ\n"); + } + } + } + + + + + //±Ϣ + FormInfo forminfo = new FormInfo(); + FormInfo[] forminfo_vec = new FormInfo[1]; + ModelObject[] form_vec; + + form_vec = itemRev.IMAN_master_form_rev; + + + + for (int k = 0; k < form_vec.Length; k++) + { + //Type myType = form_vec[k].GetType(); + //string fType = myType.Name; + Form form = form_vec[k] as Form; + bool frash = false; + string[] props = new string[1]; + + Hashtable formAttrs = new Hashtable(); + + //Formԣִ´ + if (btlinfo.Btltypetable.ContainsValue("Form")) + { + foreach (DictionaryEntry de in btlinfo.Btltypetable) + { + if (de.Value.ToString() == "Form" && btlinfo.Btlwritetable[de.Key].ToString() == "1" && + btlinfo.Btlupdatetable[de.Key].ToString() == "1") + { + string cadstring = de.Key.ToString(); + string cadvalue = btlinfo.Btldatatable[cadstring].ToString(); + string tcstring = btlinfo.Btltctable[cadstring].ToString(); + string writestring = btlinfo.Btlwritetable[cadstring].ToString(); + + ed1.WriteMessage("ȡ" + tcstring + "\n"); + props[0] = tcstring; + ServiceData serviceData = dmService.GetProperties(form_vec, props); + if (serviceData.sizeOfPartialErrors() > 0) + { + continue; + } + Property my_prop = form_vec[k].GetProperty(tcstring); + if (cadvalue != my_prop.StringValue) + { + if (my_prop.StringValue == "") + frash = true; + else + { + string message = "ǰͼֽ:" + cadstring + "ֵ" + cadvalue + "ϵͳ:" + tcstring + "ֵ" + my_prop.StringValue + "һ,Ƿ񸲸ϵͳ?"; + DialogResult updateresult = MessageBox.Show(message, "ʾ", MessageBoxButtons.YesNo, MessageBoxIcon.Question); + if (updateresult == DialogResult.Yes) + { + frash = true; + } + } + string[] formAttrValue = new string[1]; + formAttrValue[0] = ""; + if (frash) + formAttrValue[0] = cadvalue; + else + formAttrValue[0] = my_prop.StringValue; + ed1.WriteMessage(tcstring + ":" + formAttrValue[0] + "\n"); + formAttrs.Add(tcstring, formAttrValue); + props[0] = ""; + } + + } + } + } + + ed1.WriteMessage("formAttrs:" + formAttrs.Count + "\n"); + + foreach (DictionaryEntry hash in formAttrs) + { + ed1.WriteMessage(hash.Key + ":" + Convert.ToString(hash.Value) + "\n"); + } + + + forminfo.AttributesMap = formAttrs; + forminfo.ClientId = "1"; + forminfo.Description = ""; + forminfo.FormObject = (Form)form; + forminfo.Name = item_id + "/" + rev_id; + forminfo.ParentObject = null; + forminfo.RelationName = "IMAN_master_form"; + forminfo.SaveDB = true; + forminfo.FormType = "ItemRevision Master"; + forminfo_vec[0] = forminfo; + try + { + ed1.WriteMessage("ʼ\n"); + Teamcenter.Services.Strong.Core._2007_01.DataManagement.CreateOrUpdateFormsResponse formResp = + dmService.CreateOrUpdateForms(forminfo_vec); + ModelObject[] respon = { formResp.ServiceData.GetUpdatedObject(0) }; + dmService.RefreshObjects(respon); + ed1.WriteMessage("\n"); + break; + } + catch (ServiceException ex) + { + ed1.WriteMessage(ex.Message); + } + } + + /* + ed1.WriteMessage("=======ݼ=========\n"); + //ݼƵɴ,type refname separator + + OriginReadXml originreadxml = new OriginReadXml(); + OriginDataSet datasetinfo = originreadxml.OriginReadDataSetXML(xmlpath); + datasetinfo = origintool.GetDataSetInfo(datasetinfo, btlinfo); + + ed1.WriteMessage("׼ݼ\n"); + + + bool findDateset = false; + bool neworupdate = false; + Teamcenter.Services.Strong.Core._2007_06.DataManagement.ExpandGRMRelationsPref + myPref = new Teamcenter.Services.Strong.Core._2007_06.DataManagement.ExpandGRMRelationsPref(); + Teamcenter.Services.Strong.Core._2007_06.DataManagement.RelationAndTypesFilter2 + myFilter = new Teamcenter.Services.Strong.Core._2007_06.DataManagement.RelationAndTypesFilter2(); + myFilter.RelationName = "IMAN_specification"; + string[] typeVec = new string[1]; + typeVec[0] = datasetinfo.Datatype; + myFilter.ObjectTypeNames = typeVec; + myPref.ExpItemRev = false; + Teamcenter.Services.Strong.Core._2007_06.DataManagement.RelationAndTypesFilter2[] myFilterVec = { myFilter }; + myPref.Info = myFilterVec; + ModelObject[] primaryObjects = { itemRev }; + Teamcenter.Services.Strong.Core._2007_06.DataManagement.ExpandGRMRelationsResponse + myResp = dmService.ExpandGRMRelationsForPrimary(primaryObjects, myPref); + + if (myResp.Output.Length > 0) + { + for (int k = 0; k < myResp.Output.Length; k++) + { + Teamcenter.Services.Strong.Core._2007_06.DataManagement.ExpandGRMRelationsOutput + grmOutput = myResp.Output[k]; + for (int l = 0; l < grmOutput.OtherSideObjData.Length; l++) + { + ExpandGRMRelationsData otherSideData = grmOutput.OtherSideObjData[l]; + if (otherSideData.OtherSideObjects.Length > 0) + { + for (int m = 0; m < otherSideData.OtherSideObjects.Length; m++) + { + Dataset tempDataset; + //Teamcenter.Soa.Client.Model.ServiceData sData; + tempDataset = otherSideData.OtherSideObjects[m] as Dataset; + + string ds_name = tempDataset.Object_string; + if (ds_name == datasetinfo.Ds_name) + { + findDateset = true; + dataset = otherSideData.OtherSideObjects[m] as Dataset; + ed1.WriteMessage("ҵݼ!\n"); + break; + } + } + //if (!findDateset) + //{ + // DialogResult updateornewdialog = MessageBox.Show("ItemѴݼ", "ʾ", MessageBoxButtons.YesNo, MessageBoxIcon.Question); + // if (updateornewdialog == DialogResult.Yes) + // { + + // } + //} + } + } + } + } + + //½ݼ + if (findDateset) + { + bool ischeckout = false; + try + { + ModelObject[] objects2 = { dataset }; + String[] attributes2 = { "is_modifiable", "checked_out", "checked_out_user" }; + dmService.RefreshObjects(objects2); + dmService.GetProperties(objects2, attributes2); + if (!dataset.Is_modifiable) + { + MessageBox.Show("򿪵ͼֽ״̬Ϊֻ,޷浽ϵͳ!"); + return; + } + User checkuserinfo = dataset.Checked_out_user as User; + if (checkuserinfo != null) + { + if (checkuserinfo.Uid != loginuser.Uid) + { + MessageBox.Show("ͼֽѱûǩ,޷浽ϵͳ!"); + return; + } + } + if (dataset.Checked_out == "Y") + ischeckout = true; + } + catch (NotLoadedException ex) + { + ed1.WriteMessage(ex.Message); + } + + Reservation res = ReservationService.getService(Session.getConnection()); + //string comment = "", changeId = ""; + //ModelObject[] ds_object = new ModelObject[1]; + //ds_object[0] = dataset; + ModelObject[] dsFileVec = null; + //ed1.WriteMessage("=======22ݼ22========="); + try + { + ModelObject[] objects2 = { dataset }; + String[] attributes2 = { "ref_list" }; + dmService.RefreshObjects(objects2); + dmService.GetProperties(objects2, attributes2); + dsFileVec = dataset.Ref_list; + } + catch (NotLoadedException ex) + { + ed1.WriteMessage(ex.Message); + } + ImanFile dsfile = dsFileVec[0] as ImanFile; + + ModelObject[] objects3 = { dsfile }; + String[] attributes3 = { "relative_directory_path", "original_file_name" }; + dmService.RefreshObjects(objects3); + dmService.GetProperties(objects3, attributes3); + filename = dsfile.Original_file_name; + //ed1.WriteMessage("=======33ݼ33=========\n"); + Teamcenter.Services.Loose.Core._2006_03.FileManagement.DatasetFileInfo[] fileInfos = new Teamcenter.Services.Loose.Core._2006_03.FileManagement.DatasetFileInfo[1]; + + Teamcenter.Services.Loose.Core._2006_03.FileManagement.DatasetFileInfo fileInfo = new Teamcenter.Services.Loose.Core._2006_03.FileManagement.DatasetFileInfo(); + + DocumentCollection inacdocmgr = ZwSoft.ZwCAD.ApplicationServices.Application.DocumentManager; + ed1.WriteMessage("ǰļ" + inacdocmgr.MdiActiveDocument.Name + "\n"); + //inacdocmgr.MdiActiveDocument.Database.SaveAs(inacdocmgr.MdiActiveDocument.Name, DwgVersion.Current); + //inacdocmgr.MdiActiveDocument.SendStringToExecute("QSAVE", true, false, true); + //string tempdir = System.Environment.GetEnvironmentVariable("TEMP").ToString(); + //string tempfilename = ""; + //if (inacdocmgr.MdiActiveDocument.Name.IndexOf("temp") == 0) + //{ + // tempfilename = inacdocmgr.MdiActiveDocument.Name.Substring(23); + //} + //else + //{ + // tempfilename = inacdocmgr.MdiActiveDocument.Name; + //} + Document acdoc = ZwSoft.ZwCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument; + acdoc.Database.SaveAs(acdoc.Name, true, DwgVersion.Current, acdoc.Database.SecurityParameters); + + + string mdiactivefile = acdoc.Name; + fileInfo.FileName = mdiactivefile; + fileInfo.AllowReplace = true; + fileInfo.IsText = false; + fileInfo.NamedReferencedName = datasetinfo.Refname; + fileInfos[0] = fileInfo; + Teamcenter.Services.Loose.Core._2006_03.FileManagement.GetDatasetWriteTicketsInputData inputData = new Teamcenter.Services.Loose.Core._2006_03.FileManagement.GetDatasetWriteTicketsInputData(); + inputData.Dataset = dataset; + inputData.CreateNewVersion = false; + inputData.DatasetFileInfos = fileInfos; + //ed1.WriteMessage("=======44ݼ44========="); + // Teamcenter.Services.Loose.Core._2006_03.FileManagement.GetDatasetWriteTicketsInputData[] inputs = new Teamcenter.Services.Loose.Core._2006_03.FileManagement.GetDatasetWriteTicketsInputData[1]; + // inputs[0] = inputData; + // FileManagementUtility fMSFileManagement = new FileManagementUtility(Session.getConnection()); + // ServiceData response = fMSFileManagement.PutFiles(inputs); + // if (response.sizeOfPartialErrors() > 0) + // ed1.WriteMessage("FileManagementService upload returned partial errors:" + response.sizeOfPartialErrors()); + ModelObject[] datasets = new ModelObject[1]; + datasets[0] = dataset; + if (ischeckout) + res.Checkin(datasets); + dmService.RefreshObjects(datasets); + //datasets[0] = inputs[0].Dataset; + //dmService.DeleteObjects(datasets); + //fMSFileManagement.Term(); + ed1.WriteMessage("DateSet check in successful\n"); + } + else + { + Teamcenter.Services.Strong.Core._2006_03.DataManagement.DatasetProperties + oneDatasetProp = new Teamcenter.Services.Strong.Core._2006_03.DataManagement.DatasetProperties(); + Teamcenter.Services.Strong.Core._2006_03.DataManagement.DatasetProperties[] + dataset_vec = new Teamcenter.Services.Strong.Core._2006_03.DataManagement.DatasetProperties[1]; + oneDatasetProp.ClientId = "datasetWriteTixTestClientId"; + oneDatasetProp.Type = datasetinfo.Datatype; + oneDatasetProp.Name = datasetinfo.Ds_name; + oneDatasetProp.Description = ""; + oneDatasetProp.Container = null; + dataset_vec[0] = oneDatasetProp; + Teamcenter.Services.Strong.Core._2006_03.DataManagement.CreateDatasetsResponse + dsResp = dmService.CreateDatasets(dataset_vec); + Dataset createdataset = dsResp.Output[0].Dataset; + + //create relationship + Teamcenter.Services.Strong.Core._2006_03.DataManagement.Relationship[] + rela_vec = new Teamcenter.Services.Strong.Core._2006_03.DataManagement.Relationship[1]; + Teamcenter.Services.Strong.Core._2006_03.DataManagement.Relationship + one_rela = new Teamcenter.Services.Strong.Core._2006_03.DataManagement.Relationship(); + one_rela.ClientId = ""; + one_rela.PrimaryObject = itemRev; + one_rela.SecondaryObject = createdataset; + one_rela.RelationType = "IMAN_specification"; + one_rela.UserData = null; + rela_vec[0] = one_rela; + Teamcenter.Services.Strong.Core._2006_03.DataManagement.CreateRelationsResponse + reResp = dmService.CreateRelations(rela_vec); + ed1.WriteMessage("ݼϵɹ!\n"); + + Teamcenter.Services.Loose.Core._2006_03.FileManagement.DatasetFileInfo[] fileInfos = new Teamcenter.Services.Loose.Core._2006_03.FileManagement.DatasetFileInfo[1]; + + Teamcenter.Services.Loose.Core._2006_03.FileManagement.DatasetFileInfo fileInfo = new Teamcenter.Services.Loose.Core._2006_03.FileManagement.DatasetFileInfo(); + + DocumentCollection inacdocmgr = ZwSoft.ZwCAD.ApplicationServices.Application.DocumentManager; + //inacdocmgr.MdiActiveDocument.Database.SaveAs(inacdocmgr.MdiActiveDocument.Name, DwgVersion.Current); + //inacdocmgr.MdiActiveDocument.SendStringToExecute("QSAVE", true, false, true); + + ed1.WriteMessage("ǰļ" + inacdocmgr.MdiActiveDocument.Name + "\n"); + + Document acdoc = ZwSoft.ZwCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument; + acdoc.Database.SaveAs(acdoc.Name, true, DwgVersion.Current, acdoc.Database.SecurityParameters); + + string mdiactivefile = acdoc.Name; + fileInfo.FileName = mdiactivefile; + fileInfo.AllowReplace = true; + fileInfo.IsText = false; + fileInfo.NamedReferencedName = datasetinfo.Refname; + fileInfos[0] = fileInfo; + Teamcenter.Services.Loose.Core._2006_03.FileManagement.GetDatasetWriteTicketsInputData inputData = new Teamcenter.Services.Loose.Core._2006_03.FileManagement.GetDatasetWriteTicketsInputData(); + inputData.Dataset = createdataset; + inputData.CreateNewVersion = false; + inputData.DatasetFileInfos = fileInfos; + // Teamcenter.Services.Loose.Core._2006_03.FileManagement.GetDatasetWriteTicketsInputData[] inputs = new Teamcenter.Services.Loose.Core._2006_03.FileManagement.GetDatasetWriteTicketsInputData[1]; + // inputs[0] = inputData; + // FileManagementUtility fMSFileManagement = new FileManagementUtility(Session.getConnection()); + // ServiceData response = fMSFileManagement.PutFiles(inputs); + // if (response.sizeOfPartialErrors() > 0) + // ed1.WriteMessage("FileManagementService upload returned partial errors:" + response.sizeOfPartialErrors()); + ed1.WriteMessage("DateSet check in successful\n"); + ModelObject[] datasets = new ModelObject[1]; + datasets[0] = createdataset; + dmService.RefreshObjects(datasets); + dataset = createdataset; + } + */ + //BOM + if (mxllist.Count > 0) + { + DialogResult flushbomresult = MessageBox.Show("ǷˢBOM", "ʾ", MessageBoxButtons.YesNo, MessageBoxIcon.Question); + if (flushbomresult == DialogResult.Yes) + { + Folder aimFolder = null; + WorkspaceObject[] object_vec = new WorkspaceObject[1]; + object_vec[0] = item; + Teamcenter.Services.Strong.Core._2007_01.DataManagement.WhereReferencedResponse + refResp = dmService.WhereReferenced(object_vec, 1); + Teamcenter.Services.Strong.Core._2007_01.DataManagement.WhereReferencedOutput[] + refOutput = refResp.Output; + + for (int u = 0; u < refOutput.Length; u++) + { + Teamcenter.Services.Strong.Core._2007_01.DataManagement.WhereReferencedInfo[] + info = refOutput[u].Info; + for (int p = 0; p < info.Length; p++) + { + Teamcenter.Services.Strong.Core._2007_01.DataManagement.WhereReferencedInfo + it_info = info[p]; + string type = it_info.Referencer.Object_type; + if (type.Contains("Folder")) + { + aimFolder = it_info.Referencer as Folder; + ed1.WriteMessage("ҵĿļ\n"); + break; + } + } + } + + if (aimFolder == null) + CreateBomStructure(itemRev, dataset, mxllist, null); + else + CreateBomStructure(itemRev, dataset, mxllist, aimFolder); + } + } + + + }//for + } + } + } + else + { + this.savefrom = new SaveToTC(); + this.savefrom.appdoc = appodc; + this.savefrom.user = loginuser; + this.savefrom.btlinfo = btlinfo; + this.savefrom.bomlist = mxllist; + this.savefrom.xmlpath = xmlpath; + this.savefrom.button1.Click += new EventHandler(savebutton1_Click); + this.savefrom.Activate(); + this.savefrom.Show(); + } + } + } + } + + /************************************************************************ + * 2012-7-3 + * add by raywei + * function used by savetotc + * ߼ + * ITEMʱݼݼԴϵͳжӦģitemµݼ + * 1ѡ ļ=ģID ַָ + * 2ñitemͣöӦģIDݴIDҵϵͳITEM + * 3ҵItemݼ + * 4ݼļ + * 5ITEM + * 6µݼ + * 7 + ************************************************************************/ + + public void updateItemDataSet(Editor ed1, BTLClass btlinfo, + ItemRevision itemrevision, DataManagementService dmService, string rev_id) + { + //ȡѡ + HelloTeamcenter.hello.Tool tool = new HelloTeamcenter.hello.Tool(); + Hashtable pre = tool.getTCPreferences("DFHM_dstype"); + string[] prevalues = (string[])pre["DFHM_dstype"]; + + if (prevalues.Length <= 0) + { + ed1.WriteMessage("ѡDFHM_dstype\n"); + } + + for (int i = 0; i < prevalues.Length; i++) + { + ed1.WriteMessage(prevalues[i].ToString() + "\n"); + } + + //ǷWORDݼ + ed1.WriteMessage("ItemǷWORDݼ\n"); + bool hasWordDS = checkHasWord(itemrevision, dmService); + if (hasWordDS) + { + ed1.WriteMessage("ItemѾWORDݼ\n"); + } + else + { + ed1.WriteMessage("ItemWORDݼ\n"); + //ȡӦģID + ed1.WriteMessage("ڷͶӦģID\n"); + string DMTitemid = tool.getCorrespondItemID(tool.initItemType(btlinfo.Item_id, btlinfo.Materialgrade).Trim(), prevalues); + string DMTFilepath = ""; + if (DMTitemid != null && DMTitemid != "") + { + SavedQueryResults found = tool.getSearchItem(DMTitemid); + //ҵģitem + ed1.WriteMessage("ҵģ\n"); + if (found.NumOfObjects > 0 && found != null) + { + Item DMTItem = found.Objects[0] as Item; + DMTFilepath = downloadfile(DMTItem); + ed1.WriteMessage("ģļɣ·" + DMTFilepath + "\n"); + } + } + //ݼļģ + if (DMTFilepath != "") + { + bool uploadresult = uploadfile(DMTFilepath, btlinfo.Item_id + "/" + rev_id, itemrevision); + if (uploadresult) + ed1.WriteMessage("Ӧݼģɹ\n"); + } + } + + + + } + + //ǷMSWORDݼ + public bool checkHasWord(ItemRevision itemrevision, DataManagementService dmService) + { + bool hasWordDS = false; + Teamcenter.Services.Strong.Core._2007_06.DataManagement.ExpandGRMRelationsPref + myPref = new Teamcenter.Services.Strong.Core._2007_06.DataManagement.ExpandGRMRelationsPref(); + Teamcenter.Services.Strong.Core._2007_06.DataManagement.RelationAndTypesFilter2 + myFilter = new Teamcenter.Services.Strong.Core._2007_06.DataManagement.RelationAndTypesFilter2(); + myFilter.RelationName = "IMAN_specification"; + string[] typeVec = new string[1]; + typeVec[0] = "MSWord"; + myFilter.ObjectTypeNames = typeVec; + myPref.ExpItemRev = false; + Teamcenter.Services.Strong.Core._2007_06.DataManagement.RelationAndTypesFilter2[] myFilterVec = { myFilter }; + myPref.Info = myFilterVec; + ModelObject[] primaryObjects = { itemrevision }; + Teamcenter.Services.Strong.Core._2007_06.DataManagement.ExpandGRMRelationsResponse + myResp = dmService.ExpandGRMRelationsForPrimary(primaryObjects, myPref); + ExpandGRMRelationsOutput[] myoutput = myResp.Output; + for (int i = 0; i < myoutput.Length; i++) + { + ExpandGRMRelationsOutput one_out = myoutput[i]; + for (int j = 0; j < one_out.OtherSideObjData.Length; j++) + { + ExpandGRMRelationsData otherSideData = one_out.OtherSideObjData[j]; + for (int k = 0; k < otherSideData.OtherSideObjects.Length; k++) + { + Type typeinfo = otherSideData.OtherSideObjects[k].GetType(); + string typename = typeinfo.Name; + if (typename == "MSWord") + { + hasWordDS = true; + } + } + } + } + return hasWordDS; + } + + + + /************************************************************************ + * 2012-2-13 + * add by raywei + * function used by savebutton1_Click + * ߼ + * ½ITEMʱݼݼԴϵͳжӦģitemµݼ + * 1ѡ ļ=ģID ַָ + * 2ñitemͣöӦģIDݴIDҵϵͳITEM + * 3ҵItemݼ + * 4ݼļ + * 5µITEM + * 6µݼ + * 7 + ************************************************************************/ + + /************************************************************************ + * 2012-2-13 + * add by raywei + * ÷ݼļصأļ· + ************************************************************************/ + + public string downloadfile(Item DMTItem) + { + string DMTFilepath = ""; + DataManagementService dmService = DataManagementService.getService(Session.getConnection()); + Editor ed1 = ZwSoft.ZwCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; + ModelObject[] itemrevisionlist = null; + ModelObject[] objects = { DMTItem }; + String[] attributes = { "revision_list" }; + dmService.RefreshObjects(objects); + dmService.GetProperties(objects, attributes); + itemrevisionlist = DMTItem.Revision_list; + ItemRevision itemrevision = itemrevisionlist[itemrevisionlist.Length - 1] as ItemRevision; + ExpandGRMRelationsPref myPref = new ExpandGRMRelationsPref(); + RelationAndTypesFilter2 myFilter = new RelationAndTypesFilter2(); + myFilter.RelationName = "IMAN_specification"; + String[] typeVec = { "MSWord" }; + myFilter.ObjectTypeNames = typeVec; + myPref.ExpItemRev = false; + RelationAndTypesFilter2[] myfilter = { myFilter }; + myPref.Info = myfilter; + ModelObject[] objects1 = { itemrevision }; + ExpandGRMRelationsResponse myResp = dmService.ExpandGRMRelationsForPrimary(objects1, myPref); + ExpandGRMRelationsOutput[] myoutput = myResp.Output; + for (int i = 0; i < myoutput.Length; i++) + { + ExpandGRMRelationsOutput one_out = myoutput[i]; + for (int j = 0; j < one_out.OtherSideObjData.Length; j++) + { + ExpandGRMRelationsData otherSideData = one_out.OtherSideObjData[j]; + for (int k = 0; k < otherSideData.OtherSideObjects.Length; k++) + { + Type typeinfo = otherSideData.OtherSideObjects[k].GetType(); + string typename = typeinfo.Name; + if (typename == "MSWord") + { + DataSet dateset = otherSideData.OtherSideObjects[k] as DataSet; + ModelObject[] objects2 = { dateset }; + String[] attributes2 = { "is_modifiable", "checked_out", "ref_list" }; + dmService.RefreshObjects(objects2); + dmService.GetProperties(objects2, attributes2); + ModelObject[] dsfilevec = dateset.Ref_list; + ImanFile dsfile = dsfilevec[0] as ImanFile; + + ModelObject[] objects3 = { dsfile }; + String[] attributes3 = { "relative_directory_path", "original_file_name" }; + dmService.RefreshObjects(objects3); + dmService.GetProperties(objects3, attributes3); + + string newfilename = dsfile.Original_file_name; + ed1.WriteMessage("Original_file_name : " + newfilename + "\n"); + string tempdir = System.Environment.GetEnvironmentVariable("TEMP").ToString(); + ed1.WriteMessage("TEMP:" + tempdir.ToString() + "\n"); + + Teamcenter.Soa.Client.FileManagementUtility fmu = new Teamcenter.Soa.Client.FileManagementUtility(Teamcenter.ClientX.Session.getConnection()); + Teamcenter.Soa.Client.GetFileResponse getFileResponse = fmu.GetFiles(dsfilevec); + FileInfo[] fileinfovec = getFileResponse.GetFiles(); + + FileInfo file = fileinfovec[0]; + DMTFilepath = tempdir + "\\" + newfilename; + ed1.WriteMessage("·" + DMTFilepath + "\n"); + System.IO.File.Copy(file.FullName, DMTFilepath, true); + System.IO.File.SetAttributes(DMTFilepath, FileAttributes.Normal); + + } + } + } + } + + return DMTFilepath; + } + + //½ݼϴļ + public bool uploadfile(string DMTFilepath, string ds_name, ItemRevision rev) + { + bool result = false; + DataManagementService dmService = DataManagementService.getService(Session.getConnection()); + Editor ed1 = ZwSoft.ZwCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; + Teamcenter.Services.Strong.Core._2006_03.DataManagement.DatasetProperties + oneDatasetProp = new Teamcenter.Services.Strong.Core._2006_03.DataManagement.DatasetProperties(); + Teamcenter.Services.Strong.Core._2006_03.DataManagement.DatasetProperties[] + dataset_vec = new Teamcenter.Services.Strong.Core._2006_03.DataManagement.DatasetProperties[1]; + oneDatasetProp.ClientId = "datasetWriteTixTestClientId"; + oneDatasetProp.Type = "MSWord"; + oneDatasetProp.Name = ds_name; + ed1.WriteMessage("ds_name====" + ds_name + "\n"); + oneDatasetProp.Description = ""; + oneDatasetProp.Container = null; + dataset_vec[0] = oneDatasetProp; + Teamcenter.Services.Strong.Core._2006_03.DataManagement.CreateDatasetsResponse + dsResp = dmService.CreateDatasets(dataset_vec); + Dataset createdataset = dsResp.Output[0].Dataset; + + //create relationship + Teamcenter.Services.Strong.Core._2006_03.DataManagement.Relationship[] + rela_vec = new Teamcenter.Services.Strong.Core._2006_03.DataManagement.Relationship[1]; + Teamcenter.Services.Strong.Core._2006_03.DataManagement.Relationship + one_rela = new Teamcenter.Services.Strong.Core._2006_03.DataManagement.Relationship(); + one_rela.ClientId = "AppX-myTest"; + one_rela.PrimaryObject = rev; + one_rela.SecondaryObject = createdataset; + one_rela.RelationType = "IMAN_specification"; + one_rela.UserData = null; + rela_vec[0] = one_rela; + Teamcenter.Services.Strong.Core._2006_03.DataManagement.CreateRelationsResponse + reResp = dmService.CreateRelations(rela_vec); + ed1.WriteMessage("ݼϵɹ!\n"); + + Teamcenter.Services.Loose.Core._2006_03.FileManagement.DatasetFileInfo[] fileInfos = new Teamcenter.Services.Loose.Core._2006_03.FileManagement.DatasetFileInfo[1]; + + Teamcenter.Services.Loose.Core._2006_03.FileManagement.DatasetFileInfo fileInfo = new Teamcenter.Services.Loose.Core._2006_03.FileManagement.DatasetFileInfo(); + + fileInfo.FileName = DMTFilepath; + ed1.WriteMessage("fileInfo.FileName===" + fileInfo.FileName + "\n"); + fileInfo.AllowReplace = true; + fileInfo.IsText = false; + fileInfo.NamedReferencedName = "word"; + fileInfos[0] = fileInfo; + Teamcenter.Services.Loose.Core._2006_03.FileManagement.GetDatasetWriteTicketsInputData inputData = new Teamcenter.Services.Loose.Core._2006_03.FileManagement.GetDatasetWriteTicketsInputData(); + inputData.Dataset = createdataset; + inputData.CreateNewVersion = false; + inputData.DatasetFileInfos = fileInfos; + //Teamcenter.Services.Loose.Core._2006_03.FileManagement.GetDatasetWriteTicketsInputData[] inputs = new Teamcenter.Services.Loose.Core._2006_03.FileManagement.GetDatasetWriteTicketsInputData[1]; + // inputs[0] = inputData; + // FileManagementUtility fMSFileManagement = new FileManagementUtility(Session.getConnection()); + // ServiceData response = fMSFileManagement.PutFiles(inputs); + // + // if (response.sizeOfPartialErrors() > 0) + // ed1.WriteMessage("FileManagementService upload returned partial errors:" + response.sizeOfPartialErrors()); + // if (response.sizeOfPartialErrors() <= 0) + // { + // ed1.WriteMessage("DateSet check in successful\n"); + result = true; + // } + + ModelObject[] datasets = new ModelObject[1]; + datasets[0] = createdataset; + dmService.RefreshObjects(datasets); + + return result; + } + + + + /************************************************************************ + * savetotcڱ水¼ + ************************************************************************/ + public void savebutton1_Click(object sender, EventArgs e) + { + String itemIDTemp = ""; + String itemRevIDTemp = ""; + DataManagementService dmService = DataManagementService.getService(Session.getConnection()); + Reservation res = ReservationService.getService(Session.getConnection()); + Editor ed1 = ZwSoft.ZwCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; + ed1.WriteMessage("==============\n"); + OriginTool origintool = new OriginTool(); + OriginBTL btlinfo = this.savefrom.btlinfo; + List bomlist = this.savefrom.bomlist; + ed1.WriteMessage("ITEM" + btlinfo.Btldatatable[origintool.getKeyFromValue(btlinfo.Btltctable, "item_id")].ToString()); + ed1.WriteMessage("ϸ:" + bomlist.Count + "\n"); + + + TreeNode nownode = this.savefrom.treeView1.SelectedNode; + if (nownode.SelectedImageIndex == 1) + { + foreach (ALLOBJECT perobject in this.savefrom.folderlist) + { + if (perobject.treenode.Equals(nownode)) + { + ed1.WriteMessage("ҵָļ\n"); + + Folder folder = perobject.workobject as Folder; + ModelObject[] objects = { folder }; + String[] attributes = { "is_modifiable" }; + dmService.RefreshObjects(objects); + dmService.GetProperties(objects, attributes); + if (!folder.Is_modifiable) + { + MessageBox.Show("Ŀ¼ûдȨޣѡ"); + return; + } + + ItemProperties oneItemProp = new ItemProperties(); + CreateItemsResponse itemResp = new CreateItemsResponse(); + + Teamcenter.Hello.DataManagement hellomanagement = new Teamcenter.Hello.DataManagement(); + string itemtype = this.savefrom.comboBox1.Text; + ItemIdsAndInitialRevisionIds[] itemIds = hellomanagement.generateItemIds(1, itemtype); + GetItemCreationRelatedInfoResponse relatedResponse = dmService.GetItemCreationRelatedInfo(itemtype, null); + string[] formTypes = new string[relatedResponse.FormAttrs.Length]; + for (int j = 0; j < relatedResponse.FormAttrs.Length; j++) + { + FormAttributesInfo attrInfo = relatedResponse.FormAttrs[j]; + formTypes[j] = attrInfo.FormType; + } + ItemProperties[] itemProps = new ItemProperties[itemIds.Length]; + ItemProperties itemProperty = new ItemProperties(); + for (int j = 0; j < itemIds.Length; j++) + { + ed1.WriteMessage("start Create form in cache!\n"); + ModelObject[] forms = hellomanagement.createForms(itemIds[j].NewItemId, + formTypes[0], itemIds[j].NewRevId, formTypes[1], null, false); + ed1.WriteMessage("Create form in cache sucessful!\n"); + ed1.WriteMessage("set item properties!\n"); + + itemProperty.ClientId = "AppX-Test"; + itemProperty.ItemId = btlinfo.Btldatatable[origintool.getKeyFromValue(btlinfo.Btltctable, "item_id")].ToString(); + itemIDTemp = itemProperty.ItemId; + if (btlinfo.Btltctable.ContainsValue("item_revision_id")) + { + itemProperty.RevId = btlinfo.Btldatatable[origintool.getKeyFromValue(btlinfo.Btltctable, "item_revision_id")].ToString(); + } + else + { + itemProperty.RevId = itemIds[j].NewRevId; + } + itemRevIDTemp = itemProperty.RevId; + if (btlinfo.Btltctable.ContainsValue("object_name")) + itemProperty.Name = btlinfo.Btldatatable[origintool.getKeyFromValue(btlinfo.Btltctable, "object_name")].ToString(); + else + itemProperty.Name = ""; + itemProperty.Type = itemtype; + itemProperty.Description = ""; + itemProperty.Uom = "EA"; + + itemProps[j] = itemProperty; + } + + try + { + ed1.WriteMessage("start item create!\n"); + + itemResp = dmService.CreateItems(itemProps, folder, ""); + + ed1.WriteMessage("create Items: " + btlinfo.Btldatatable[origintool.getKeyFromValue(btlinfo.Btltctable, "item_id")].ToString() + "sucessful!\n"); + ItemRevision rev = null; + Item newitem = null; + for (int j = 0; j < itemResp.Output.Length; j++) + { + rev = itemResp.Output[j].ItemRev; + newitem = itemResp.Output[j].Item; + } + + + if (rev == null) + { + //ed1.WriteMessage("rev is null\n"); + rev = (ItemRevision)Query.queryItemRevByID(itemIDTemp, itemRevIDTemp); + if (rev == null) + { + ed1.WriteMessage("汾Ҳʧ" + itemIDTemp + "/" + itemRevIDTemp); + return; + } + } + if (newitem == null) + { + //ed1.WriteMessage("item is null\n"); + newitem = (Item)Query.queryItemByID(itemIDTemp); + if (newitem == null) + { + ed1.WriteMessage("Ҳʧ" + itemIDTemp); + return; + } + + } + //ӶItemԵĸ + if (btlinfo.Btltypetable.ContainsValue("Item")) + { + ed1.WriteMessage("ڸItem\n"); + Hashtable itemattrs = new Hashtable(); + ModelObject[] newitemOBJ = new ModelObject[1]; + newitemOBJ[0] = newitem; + foreach (DictionaryEntry de in btlinfo.Btltypetable) + { + if (de.Value.ToString() == "Item" && btlinfo.Btlwritetable[de.Key].ToString() == "1" && + btlinfo.Btlupdatetable[de.Key].ToString() == "1") + { + string cadstring = de.Key.ToString(); + string cadvalue = btlinfo.Btldatatable[cadstring].ToString(); + string tcstring = btlinfo.Btltctable[cadstring].ToString(); + itemattrs.Add(tcstring, cadvalue); + } + } + if (itemattrs.Count > 0) + { + ServiceData itemupdateresponse = dmService.SetDisplayProperties(newitemOBJ, itemattrs); + if (itemupdateresponse.sizeOfPartialErrors() <= 0) + { + ed1.WriteMessage("ItemԳɹ\n"); + } + } + } + + //Ӷ԰汾Եĸ + if (btlinfo.Btltypetable.ContainsValue("ItemRevision")) + { + ed1.WriteMessage("ڸItemRevision\n"); + Hashtable itemRevattrs = new Hashtable(); + ModelObject[] newitemRev = new ModelObject[1]; + newitemRev[0] = rev; + foreach (DictionaryEntry de in btlinfo.Btltypetable) + { + if (de.Value.ToString() == "ItemRevision" && btlinfo.Btlwritetable[de.Key].ToString() == "1" && + btlinfo.Btlupdatetable[de.Key].ToString() == "1") + { + string cadstring = de.Key.ToString(); + string cadvalue = btlinfo.Btldatatable[cadstring].ToString(); + string tcstring = btlinfo.Btltctable[cadstring].ToString(); + itemRevattrs.Add(tcstring, cadvalue); + } + } + if (itemRevattrs.Count > 0) + { + ServiceData itemupdateresponse = dmService.SetDisplayProperties(newitemRev, itemRevattrs); + if (itemupdateresponse.sizeOfPartialErrors() <= 0) + { + ed1.WriteMessage("ItemRevisionԳɹ\n"); + } + } + } + + + + + //дform + FormInfo forminfo = new FormInfo(); + FormInfo[] forminfo_vec; + ModelObject[] form_vec = null; + + ModelObject[] objects1 = { rev }; + String[] attributes1 = { "IMAN_master_form_rev", + "is_modifiable","item_revision_id","item_id"}; + dmService.RefreshObjects(objects1); + dmService.GetProperties(objects1, attributes1); + + try + { + form_vec = rev.IMAN_master_form_rev; + ed1.WriteMessage("get_IMAN_master_form_rev sucessful!\n"); + } + catch (NotLoadedException ex) + { + ed1.WriteMessage(ex.Message); + } + forminfo_vec = new FormInfo[form_vec.Length]; + for (int j = 0; j < form_vec.Length; j++) + { + Form form = form_vec[j] as Form; + + Hashtable formAttrs = new Hashtable(); + + + //Formԣִ´ + if (btlinfo.Btltypetable.ContainsValue("Form")) + { + foreach (DictionaryEntry de in btlinfo.Btltypetable) + { + if (de.Value.ToString() == "Form" && btlinfo.Btlwritetable[de.Key].ToString() == "1" && + btlinfo.Btlupdatetable[de.Key].ToString() == "1") + { + string cadstring = de.Key.ToString(); + string cadvalue = btlinfo.Btldatatable[cadstring].ToString(); + string tcstring = btlinfo.Btltctable[cadstring].ToString(); + string writestring = btlinfo.Btlwritetable[cadstring].ToString(); + + string[] formAttrValue = new string[1]; + formAttrValue[0] = ""; + formAttrValue[0] = cadvalue; + formAttrs.Add(tcstring, formAttrValue); + } + } + } + + forminfo.AttributesMap = formAttrs; + forminfo.ClientId = "1"; + forminfo.Description = ""; + forminfo.FormObject = form; + forminfo.Name = rev.Item_id + "/" + rev.Item_revision_id; + forminfo.ParentObject = null; + forminfo.RelationName = "IMAN_master_form"; + forminfo.SaveDB = true; + forminfo.FormType = "ItemRevision Master"; + + forminfo_vec[j] = forminfo; + + try + { + CreateOrUpdateFormsResponse formResp + = dmService.CreateOrUpdateForms(forminfo_vec); + ed1.WriteMessage("update form attributes sucessful!\n"); + } + catch (ServiceException ex) + { + ed1.WriteMessage(ex.Message); + } + } + //string ds_name; + string rev_id = rev.Item_revision_id; + + //ݼƵɴ,type refname separator + + OriginReadXml originreadxml = new OriginReadXml(); + OriginDataSet datasetinfo = originreadxml.OriginReadDataSetXML(xmlpath); + datasetinfo = origintool.GetDataSetInfo(datasetinfo, btlinfo); + + ed1.WriteMessage("׼ݼ\n"); + + Teamcenter.Services.Strong.Core._2006_03.DataManagement.DatasetProperties + oneDatasetProp = new Teamcenter.Services.Strong.Core._2006_03.DataManagement.DatasetProperties(); + Teamcenter.Services.Strong.Core._2006_03.DataManagement.DatasetProperties[] + dataset_vec = new Teamcenter.Services.Strong.Core._2006_03.DataManagement.DatasetProperties[1]; + + + oneDatasetProp.ClientId = "datasetWriteTixTestClientId"; + oneDatasetProp.Type = datasetinfo.Datatype; + oneDatasetProp.Name = datasetinfo.Ds_name; + oneDatasetProp.Description = ""; + oneDatasetProp.Container = null; + dataset_vec[0] = oneDatasetProp; + ed1.WriteMessage("׼ݼ\n"); + Teamcenter.Services.Strong.Core._2006_03.DataManagement.CreateDatasetsResponse + dsResp = dmService.CreateDatasets(dataset_vec); + if (dsResp.Output.Length == 0) + { + ed1.WriteMessage("ݼʧܣݼ.xmlļϢ"); + return; + } + Dataset createdataset = dsResp.Output[0].Dataset; + ed1.WriteMessage("ݼ\n"); + //create relationship + Teamcenter.Services.Strong.Core._2006_03.DataManagement.Relationship[] + rela_vec = new Teamcenter.Services.Strong.Core._2006_03.DataManagement.Relationship[1]; + Teamcenter.Services.Strong.Core._2006_03.DataManagement.Relationship + one_rela = new Teamcenter.Services.Strong.Core._2006_03.DataManagement.Relationship(); + one_rela.ClientId = ""; + one_rela.PrimaryObject = rev; + one_rela.SecondaryObject = createdataset; + one_rela.RelationType = "IMAN_specification"; + one_rela.UserData = null; + rela_vec[0] = one_rela; + Teamcenter.Services.Strong.Core._2006_03.DataManagement.CreateRelationsResponse + reResp = dmService.CreateRelations(rela_vec); + ed1.WriteMessage("ݼϵɹ!\n"); + + Teamcenter.Services.Loose.Core._2006_03.FileManagement.DatasetFileInfo[] fileInfos = new Teamcenter.Services.Loose.Core._2006_03.FileManagement.DatasetFileInfo[1]; + + Teamcenter.Services.Loose.Core._2006_03.FileManagement.DatasetFileInfo fileInfo = new Teamcenter.Services.Loose.Core._2006_03.FileManagement.DatasetFileInfo(); + + DocumentCollection inacdocmgr = ZwSoft.ZwCAD.ApplicationServices.Application.DocumentManager; + ed1.WriteMessage("ǰļ" + inacdocmgr.MdiActiveDocument.Name + "\n"); + + Document acdoc = ZwSoft.ZwCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument; + acdoc.Database.SaveAs(acdoc.Name, true, DwgVersion.Current, acdoc.Database.SecurityParameters); + + + string mdiactivefile = acdoc.Name; + fileInfo.FileName = mdiactivefile; + fileInfo.AllowReplace = true; + fileInfo.IsText = false; + fileInfo.NamedReferencedName = datasetinfo.Refname; + fileInfos[0] = fileInfo; + Teamcenter.Services.Loose.Core._2006_03.FileManagement.GetDatasetWriteTicketsInputData inputData = new Teamcenter.Services.Loose.Core._2006_03.FileManagement.GetDatasetWriteTicketsInputData(); + inputData.Dataset = createdataset; + inputData.CreateNewVersion = false; + inputData.DatasetFileInfos = fileInfos; + // Teamcenter.Services.Loose.Core._2006_03.FileManagement.GetDatasetWriteTicketsInputData[] inputs = new Teamcenter.Services.Loose.Core._2006_03.FileManagement.GetDatasetWriteTicketsInputData[1]; + // inputs[0] = inputData; + // FileManagementUtility fMSFileManagement = new FileManagementUtility(Session.getConnection()); + // ServiceData response = fMSFileManagement.PutFiles(inputs); + // if (response.sizeOfPartialErrors() > 0) + // ed1.WriteMessage("FileManagementService upload returned partial errors:" + response.sizeOfPartialErrors()); + ed1.WriteMessage("DateSet check in successful\n"); + ModelObject[] datasets = new ModelObject[1]; + datasets[0] = createdataset; + dmService.RefreshObjects(datasets); + + + //ˢbom + + if (bomlist.Count > 0) + { + DialogResult updateresult = MessageBox.Show("ǷˢBOM", "ʾ", MessageBoxButtons.YesNo, MessageBoxIcon.Question); + if (updateresult == DialogResult.No || updateresult == DialogResult.None) + { + ed1.WriteMessage("ˢBOM\n"); + } + else + { + CreateBomStructure(rev, createdataset, bomlist, folder); + } + } + + + this.savefrom.Hide(); + this.savefrom.Dispose(); + } + catch (ServiceException ex) + { + ed1.WriteMessage(ex.Message); + } + + + } + } + } + else + { + MessageBox.Show("ѡʵļУ"); + return; + } + + } + + + /** + *˳ + */ + [CommandMethod("LOGOUT")] + public void layout() + { + DialogResult updateresult = MessageBox.Show("ȷѾļ棡ݶʧǷ񱣴棿", "ʾ", MessageBoxButtons.YesNo, MessageBoxIcon.Question); + if (updateresult == DialogResult.Yes) + { + savetotc(); + } + else + { + loginuser = null; + hadlogin = false; + } + + } + + /** + * ȡTC:ȡTCϸдֻ + */ + [CommandMethod("UPDATE_FROM_TC")] + public void updateFromTc() + { + if (loginuser != null) + { + hadlogin = true; + } + else + { + login(); + //hadlogin = true; + } + if (hadlogin) + { + getFilePuid(); + + String itemID = null; + String itemRev2 = null; + DataManagementService dmService = DataManagementService.getService(Session.getConnection()); + Editor ed1 = ZwSoft.ZwCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; + Document document2 = ZwSoft.ZwCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument; + if (document2.IsReadOnly) + { + MessageBox.Show("ļΪֻܸ!"); + return; + } + + + + OriginTool origintool = new OriginTool(); + // if (itemBean == null) + // { + // ed1.WriteMessage("ûҵItemϢ\n"); + // return; + // } + // else + // { + // itemID = itemBean.ItemId; + // itemRev2 = itemBean.ItemRev; + // } + + + + + ed1.WriteMessage("\nʼȡϢ...\n"); + /************************************************************************/ + /* ȡݵĴ */ + /************************************************************************/ + ArrayList btllist = new ArrayList(); + OriginReadXml readxml = new OriginReadXml(); + btllist = readxml.OriginReadBTLXML(xmlpath); + + for (int i = 0; i < btllist.Count; i++) + { + OriginBTL onebtlinfo = (OriginBTL)btllist[i]; + ed1.WriteMessage("ƣ" + onebtlinfo.Btlname + "\n"); + ed1.WriteMessage("ϸϢ:" + "\n"); + foreach (DictionaryEntry de in onebtlinfo.Btldatatable) + { + ed1.WriteMessage("CAD" + de.Key + "\tCADֵ:" + de.Value + + "\tTC:" + onebtlinfo.Btltctable[de.Key] + + "\tTCϵͳ:" + onebtlinfo.Btltypetable[de.Key] + + "\tд" + onebtlinfo.Btlwritetable[de.Key] + + "\tͬ:" + onebtlinfo.Btlfromtctable[de.Key] + "\n"); + } + } + + for (int btli = 0; btli < btllist.Count; btli++) + { + OriginBTL btlinfo = (OriginBTL)btllist[btli]; + //item_idӦcadͼֽϢ + object key = origintool.getKeyFromValue(btlinfo.Btltctable, "item_id"); + object key_rev = origintool.getKeyFromValue(btlinfo.Btltctable, "item_revision_id"); + if (key == null) + { + ed1.WriteMessage("ϵͳûҵitem_idӦͼֽϢϵͳж\n"); + return; + } + if (key_rev == null) + { + ed1.WriteMessage("ϵͳûҵitem_revision_idӦͼֽϢϵͳж\n"); + return; + } + itemID = btlinfo.Btldatatable[key].ToString(); + if (itemID == null || itemID.Trim().Equals("")) + { + ed1.WriteMessage("ȡItemϢΪգϵͳѭ\n"); + continue; + } + itemRev2 = btlinfo.Btldatatable[key_rev].ToString(); + // SavedQueryResults found = origintool.getSearchItem(btlinfo.Btldatatable[key].ToString()); + Console.Out.WriteLine(string.Format("ID=>{0} REV=>{1}", itemID, itemRev2)); + SavedQueryResults found = origintool.getSearchItem(itemID); + if (found != null && found.NumOfObjects > 0) + { + // DialogResult upresult = MessageBox.Show("ҵӦItemǷͬ", "ʾ", MessageBoxButtons.YesNo, MessageBoxIcon.Question); + // if (upresult == DialogResult.No || upresult == DialogResult.None) + // { + // ed1.WriteMessage("ͬ\n"); + // return; + // } + if (true) + { + for (int i = 0; i < found.NumOfObjects; i++) + { + Item item = found.Objects[i] as Item; + + ModelObject[] objects = { item }; + String[] attributes = { "item_id", "object_name", "object_string", "object_type", "Uid" }; + dmService.RefreshObjects(objects); + dmService.GetProperties(objects, attributes); + string object_type = item.Object_type; + if (puidList != null) + { + ed1.WriteMessage("puidList.count =" + puidList.Count); + foreach (String nameId in puidList) + { + String[] nameIds = nameId.Split("|".ToCharArray()); + if (nameIds != null && nameIds.Length == 2) + { + if (document2.Name.Contains(nameIds[0])) + { + if (!itemID.Equals(nameIds[1])) + { + MessageBox.Show("ǰΪͼֽܸ!"); + return; + } + } + // document2.Name + + } + } + } + + if (object_type.Equals("TM2_TEdrawing")) + { + MessageBox.Show("ǰΪͼֽܸ!"); + return; + + } + string item_id = item.Item_id; + GetItemFromIdInfo tempitem = new GetItemFromIdInfo(); + tempitem.ItemId = itemID; + GetItemFromIdInfo[] infos = new GetItemFromIdInfo[1]; + infos[0] = tempitem; + GetItemFromIdPref pref = new GetItemFromIdPref(); + //Ҫµķʽ + GetItemFromIdResponse infoResp = dmService.GetItemFromId(infos, 1, pref); + + //׼дCADͼֽϵϢ + Hashtable tempvaluetable = new Hashtable(); + + //׼дU8뵽CADͼֽϵ + Hashtable u8valuetable = new Hashtable(); + + //ȡItemϵ + if (btlinfo.Btltypetable.ContainsValue("Item")) + { + ed1.WriteMessage("ͬItem\n"); + + foreach (DictionaryEntry de in btlinfo.Btltypetable) + { + if (de.Value.ToString() == "Item" && btlinfo.Btlfromtctable[de.Key].ToString() == "1") + { + string cadstring = de.Key.ToString(); + string cadvalue = btlinfo.Btldatatable[cadstring].ToString(); + string tcstring = btlinfo.Btltctable[cadstring].ToString(); + + ed1.WriteMessage("ȡ" + tcstring + "\n"); + string[] props = new string[1]; + props[0] = tcstring; + ServiceData serviceData = dmService.GetProperties(objects, props); + if (serviceData.sizeOfPartialErrors() > 0) + { + continue; + } + Property my_prop = item.GetProperty(tcstring); + string tempcadvalue = my_prop.StringValue.ToString(); + ed1.WriteMessage("TCϵͳе" + tcstring + "ֵΪ " + tempcadvalue + "\n"); + if (cadvalue != tempcadvalue) + { + origintool.TableHasKey(tempvaluetable, cadstring, tempcadvalue); + } + } + } + } + + //ð汾ϵ + for (int j = 0; j < infoResp.Output.Length; j++) + { + ModelObject[] objects1 = { infoResp.Output[j].Item }; + String[] attributes1 = { "revision_list", "is_modifiable" }; + dmService.RefreshObjects(objects1); + dmService.GetProperties(objects1, attributes1); + ModelObject[] revlist = infoResp.Output[j].Item.Revision_list; + dmService.RefreshObjects(revlist); + ItemRevision itemRev = null; + string rev_id = ""; + //= new ModelObject[] + for (int k = 0; k < revlist.Length; k++) + { + String[] attr = { "item_revision_id" }; + + itemRev = revlist[k] as ItemRevision; + ModelObject[] obj2 = { itemRev }; + dmService.RefreshObjects(obj2); + dmService.GetProperties(obj2, attr); + rev_id = itemRev.Item_revision_id; + if (rev_id.Equals(itemRev2)) + { + break; + } + + } + if (itemRev == null) + { + ed1.WriteMessage("ItemûжӦ汾\n"); + return; + } + ModelObject[] objects2 = { itemRev }; + String[] attributes2 = { "item_revision_id", "is_modifiable" , + "checked_out","item_id","release_status_list", + "IMAN_master_form_rev"}; + dmService.RefreshObjects(objects2); + dmService.GetProperties(objects2, attributes2); + rev_id = itemRev.Item_revision_id; + if (!rev_id.Equals(itemRev2)) + { + ed1.WriteMessage("Item[" + rev_id + "]ûжӦ[" + itemRev2 + "]汾\n"); + continue; + } + ed1.WriteMessage("Item[" + rev_id + "]ҵӦ[" + itemRev2 + "]汾\n"); + + ReleaseStatus[] releaselist = itemRev.Release_status_list; + // if (!itemRev.Is_modifiable) + // { + // MessageBox.Show("ItemRevisionΪֻ,ûбȨ!"); + // return; + // } + if (releaselist.Length > 0) + { + string message = "Item IDΪ" + itemRev.Item_id + "°汾ѷ"; + MessageBox.Show(message); + return; + } + + if (btlinfo.Btltypetable.ContainsValue("ItemRevision")) + { + ed1.WriteMessage("ͬItemRevision\n"); + + foreach (DictionaryEntry de in btlinfo.Btltypetable) + { + if (de.Value.ToString() == "ItemRevision" && btlinfo.Btlfromtctable[de.Key].ToString() == "1") + { + string cadstring = de.Key.ToString(); + string cadvalue = btlinfo.Btldatatable[cadstring].ToString(); + string tcstring = btlinfo.Btltctable[cadstring].ToString(); + + ed1.WriteMessage("ȡ" + tcstring + "\n"); + string[] props = new string[1]; + props[0] = tcstring; + ServiceData serviceData = dmService.GetProperties(objects2, props); + if (serviceData.sizeOfPartialErrors() > 0) + { + continue; + } + Property my_prop = itemRev.GetProperty(tcstring); + string tempcadvalue = my_prop.StringValue.ToString(); + ed1.WriteMessage("TCϵͳе" + tcstring + "ֵΪ " + tempcadvalue + "\n"); + if (cadvalue != tempcadvalue) + { + if (!cadstring.Equals("U8")) + { + origintool.TableHasKey(tempvaluetable, cadstring, tempcadvalue); + } + else + { + origintool.TableHasKey(u8valuetable, cadstring, tempcadvalue); + } + } + } + } + } + + //ð汾ϵ + FormInfo forminfo = new FormInfo(); + FormInfo[] forminfo_vec = new FormInfo[1]; + ModelObject[] form_vec; + + form_vec = itemRev.IMAN_master_form_rev; + dmService.RefreshObjects(form_vec); + for (int k = 0; k < form_vec.Length; k++) + { + Form form = form_vec[k] as Form; + if (btlinfo.Btltypetable.ContainsValue("Form")) + { + ed1.WriteMessage("ͬItemRevision\n"); + + foreach (DictionaryEntry de in btlinfo.Btltypetable) + { + if (de.Value.ToString() == "Form" && btlinfo.Btlfromtctable[de.Key].ToString() == "1") + { + string cadstring = de.Key.ToString(); + string cadvalue = btlinfo.Btldatatable[cadstring].ToString(); + string tcstring = btlinfo.Btltctable[cadstring].ToString(); + + ed1.WriteMessage("ȡ" + tcstring + "\n"); + string[] props = new string[1]; + props[0] = tcstring; + ServiceData serviceData = dmService.GetProperties(form_vec, props); + if (serviceData.sizeOfPartialErrors() > 0) + { + continue; + } + Property my_prop = form.GetProperty(tcstring); + string tempcadvalue = my_prop.StringValue.ToString(); + ed1.WriteMessage("TCϵͳе" + tcstring + "ֵΪ " + tempcadvalue + "\n"); + if (cadvalue != tempcadvalue) + { + origintool.TableHasKey(tempvaluetable, cadstring, tempcadvalue); + } + } + } + } + } + } + //ѾҪͬռ + foreach (DictionaryEntry de in tempvaluetable) + { + ed1.WriteMessage("CAD:" + de.Key.ToString() + "\tֵ:" + de.Value.ToString() + "\n"); + } + //дCADͼֽ + origintool.SetTitleInfo(btlinfo.Btlname, tempvaluetable);// + origintool.SetTitleInfo_v1("1-U8", u8valuetable); + break; + } + } + } + } + } + } + /// + /// ˫ݼʱͻitemϢд뵽 + /// ȡitemϢ + /// + /// + public void getItemInfo() + { + // ItemMsgBean bean = null; + String[] itemInfoMsg = null; + String tempPath = System.Environment.GetEnvironmentVariable("TEMP"); + if (tempPath != null) + { + tempPath = tempPath + "\\open_cad_info.txt"; + if (!File.Exists(tempPath)) + { + return; + } + FileStream fs = null; + StreamReader sr = null; + fs = new FileStream(tempPath, FileMode.Open, FileAccess.Read); + if (fs != null) + { + sr = new StreamReader(fs); + if (sr != null) + { + String tcMsg = sr.ReadLine(); + itemInfoMsg = tcMsg.Split('|'); + if (itemInfoMsg != null && itemInfoMsg.Length == 2) + { + itemBean = new ItemMsgBean(); + itemBean.ItemId = itemInfoMsg[0]; + itemBean.ItemRev = itemInfoMsg[1]; + } + sr.Close(); + } + fs.Close(); + } + } + //ȡļļɾ֤ļ֮һ + try + { + if (File.Exists(tempPath)) + File.Delete(tempPath); + } + catch (System.Exception ex) + { + ed.WriteMessage(ex.Message); + } + return; + } + + [CommandMethod("SET_READ_ONLY")] + public void setReadOnly() + { + //DocumentCollection acDocMgr = ZwSoft.ZwCAD.ApplicationServices.Application.DocumentManager; + Editor ed1 = ZwSoft.ZwCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; + try + { + DocumentCollection acDocMgr = ZwSoft.ZwCAD.ApplicationServices.Application.DocumentManager; + Document acNewDoc = ZwSoft.ZwCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument; + // DocumentLock docLock = acNewDoc.LockDocument(); + + Database acDbNewDoc = acNewDoc.Database; + + // ĵ Lock the new document + using (DocumentLock acLckDoc = acNewDoc.LockDocument()) + { + // ݿ Start a transaction in the new database + using (Transaction acTrans = acDbNewDoc.TransactionManager.StartTransaction()) + { + //acTrans.GetObject(acDbNewDoc., OpenMode.ForRead); + } + } + ed1.WriteMessage("ǰĵ"); + + + } + catch (SystemException ex) + { + ed1.WriteMessage("ĵ쳣"); + } + + } + + + /* + *ȡTCBOMϸԣȡTCBOMдϸ + */ + /// + /// BOMCAD + /// + [CommandMethod("UPDATE_BOM_FROM_TC")] + public void updateBomFromTc() + { + if (loginuser != null) + { + hadlogin = true; + } + else + { + login(); + return; + //hadlogin = true; + } + + Document document2 = ZwSoft.ZwCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument; + //20240513 + // if (document2.IsReadOnly) + // { + // MessageBox.Show("ļΪֻܸBOM!"); + // return; + // } + //20240408 ѡǾڵĬϹܣɾϸѡ㣬ѡ񣬲ɾϸѡ + Boolean eraseBOM = true; + DialogResult AF = MessageBox.Show("Ƿɾϸ飿", "ϸ", MessageBoxButtons.YesNo, MessageBoxIcon.Question); + if (AF == DialogResult.Yes) + { + //ûȷϺִеĴ + eraseBOM = true; + } + else + { + //ûȡ߹رնԻִеĴ + eraseBOM = false; + } + + + String itemID = null; + String itemRev = null; + Editor ed1 = ZwSoft.ZwCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; + // getItemInfo(); + // if(itemBean ==null){ + // ed1.WriteMessage("ûҵBOMϢ\n"); + // return; + // + // }else{ + // itemID = itemBean.ItemId; + // itemRev = itemBean.ItemRev; + // } + + //======================= + + ArrayList btllist = new ArrayList(); + OriginReadXml readxml = new OriginReadXml(); + btllist = readxml.OriginReadBTLXML(xmlpath); + + OriginTool origintool = new OriginTool(); + for (int i = 0; i < btllist.Count; i++) + { + OriginBTL onebtlinfo = (OriginBTL)btllist[i]; + ed1.WriteMessage("ƣ" + onebtlinfo.Btlname + "\n"); + ed1.WriteMessage("ϸϢ:" + "\n"); + foreach (DictionaryEntry de in onebtlinfo.Btldatatable) + { + ed1.WriteMessage("CAD" + de.Key + "\tCADֵ:" + de.Value + + "\tTC:" + onebtlinfo.Btltctable[de.Key] + + "\tTCϵͳ:" + onebtlinfo.Btltypetable[de.Key] + + "\tд" + onebtlinfo.Btlwritetable[de.Key] + + "\tͬ:" + onebtlinfo.Btlfromtctable[de.Key] + "\n"); + } + } + + for (int btli = 0; btli < btllist.Count; btli++) + { + OriginBTL btlinfo = (OriginBTL)btllist[btli]; + //item_idӦcadͼֽϢ + object key = origintool.getKeyFromValue(btlinfo.Btltctable, "item_id"); + object key_rev = origintool.getKeyFromValue(btlinfo.Btltctable, "item_revision_id"); + if (key == null) + { + ed1.WriteMessage("ϵͳûҵitem_idӦͼֽϢϵͳж\n"); + continue; + } + if (key_rev == null) + { + ed1.WriteMessage("ϵͳûҵitem_revision_idӦͼֽϢϵͳж\n"); + continue; + } + if (!btlinfo.Btldatatable[key].ToString().Trim().Equals("")) + itemID = btlinfo.Btldatatable[key].ToString(); + if (!btlinfo.Btldatatable[key_rev].ToString().Trim().Equals("")) + itemRev = btlinfo.Btldatatable[key_rev].ToString(); + } + + if (itemID == null || itemRev == null) + { + MessageBox.Show("ûҵϢBOM£", "ʾ"); + return; + + } + + if (!hadlogin) + { + ed1.WriteMessage("µ¼\n"); + // return; + } + else + { + OriginTool tool = new OriginTool(); + SavedQueryResults found = origintool.getSearchItem(itemID); //origintool.getSearchItem(itemID);tool.getSearchItemRev(itemID, itemRev); + if (found == null || found.NumOfObjects < 1) + { + ed1.WriteMessage("ûҵӦ[ ItemID = " + itemID + " ItemRevsionID = " + itemRev + " ]汾\n"); + return; + } + ed1.WriteMessage("ҵΪ = " + found.NumOfObjects + "\n"); + DataManagementService dmService = DataManagementService.getService(Session.getConnection()); + GetItemFromIdInfo tempitem = new GetItemFromIdInfo(); + tempitem.ItemId = itemID; + GetItemFromIdInfo[] infos = new GetItemFromIdInfo[1]; + infos[0] = tempitem; + GetItemFromIdPref pref = new GetItemFromIdPref(); + //Ҫµķʽ + GetItemFromIdResponse infoResp = dmService.GetItemFromId(infos, 1, pref); + ItemRevision revision = null; + //ð汾ϵ + for (int j = 0; j < infoResp.Output.Length; j++) + { + ModelObject[] objects1 = { infoResp.Output[j].Item }; + String[] attributes1 = { "revision_list", "is_modifiable" }; + dmService.RefreshObjects(objects1); + dmService.GetProperties(objects1, attributes1); + ModelObject[] revlist = infoResp.Output[j].Item.Revision_list; + dmService.RefreshObjects(revlist); + // ItemRevision itemRev = null; + string rev_id = ""; + //= new ModelObject[] + for (int k = 0; k < revlist.Length; k++) + { + String[] attr = { "item_revision_id" }; + + revision = revlist[k] as ItemRevision; + ModelObject[] obj2 = { revision }; + dmService.RefreshObjects(obj2); + dmService.GetProperties(obj2, attr); + rev_id = revision.Item_revision_id; + if (rev_id.Equals(itemRev)) + { + break; + } + + } + } + + + if (revision != null) + { + DataManagementService dmservice = DataManagementService.getService(Session.getConnection()); + List qryObjList = new List(); + // qryObjList.Add(); + qryObjList.Add(revision); + dmservice.RefreshObjects(qryObjList.ToArray()); + dmservice.GetProperties(qryObjList.ToArray(), new String[] { "items_tag", "object_type" }); + Item item = revision.Items_tag; + string object_type = revision.Object_type; + if (object_type.Equals("TM2_TEdrawingRevision")) + { + return; + } + qryObjList.Clear(); + qryObjList.Add(item); + dmservice.GetProperties(qryObjList.ToArray(), new String[] { "bom_view_tags" }); + ModelObject[] boms = item.Bom_view_tags;//ȡBOMVIEW + if (boms == null || boms.Length < 1)//bomviewΪջΪ0˳ + { + ed1.WriteMessage("ûҵBOMVIEW \n"); + MessageBox.Show("ûҵBOMVIEWBOM£", "ʾ"); + return; + } + + + Teamcenter.Services.Strong.Cad.StructureManagementService service = Teamcenter.Services.Strong.Cad.StructureManagementService.getService(Session.getConnection()); + + Teamcenter.Services.Strong.Cad._2007_01.StructureManagement.RevisionRuleInfo latestRevRuleInfo = null; + Teamcenter.Services.Strong.Cad._2007_01.StructureManagement.GetRevisionRulesResponse grrrResp = service.GetRevisionRules(); + if (grrrResp == null || grrrResp.Output.Length < 1) + { + ed1.WriteMessage("ûҵ汾 \n"); + return; + } + qryObjList.Clear(); + for (int i = 0; i < grrrResp.Output.Length; i++) + { + qryObjList.Add(grrrResp.Output[i].RevRule); + + } + dmservice.RefreshObjects(qryObjList.ToArray()); + dmservice.GetProperties(qryObjList.ToArray(), new String[] { "object_name" }); + for (int i = 0; i < grrrResp.Output.Length; i++) + { + Teamcenter.Services.Strong.Cad._2007_01.StructureManagement.RevisionRuleInfo oneRRInfo = grrrResp.Output[i]; + if (oneRRInfo.RevRule.Object_name.Equals("Latest Working")) + { + latestRevRuleInfo = oneRRInfo; + } + } + if (latestRevRuleInfo == null) + { + ed1.WriteMessage("ûҵlatestRevRuleInfo \n"); + return; + } + Soa.Client.Model.Strong.PSBOMView bomView = boms[0] as Soa.Client.Model.Strong.PSBOMView; + dmService.RefreshObjects(new ModelObject[] { bomView, item, revision }); + Teamcenter.Services.Strong.Cad._2007_01.StructureManagement.CreateBOMWindowsInfo[] bomInfos = new Services.Strong.Cad._2007_01.StructureManagement.CreateBOMWindowsInfo[1]; + Teamcenter.Services.Strong.Cad._2007_01.StructureManagement.CreateBOMWindowsInfo oneBom = new Services.Strong.Cad._2007_01.StructureManagement.CreateBOMWindowsInfo(); + oneBom.ActiveAssemblyArrangement = null; + oneBom.BomView = bomView; + oneBom.Item = item; + oneBom.ItemRev = revision; + oneBom.ObjectForConfigure = null; + oneBom.RevRuleConfigInfo.Props.Date = new DateTime(); + oneBom.RevRuleConfigInfo.Props.EndItem = null; + oneBom.RevRuleConfigInfo.Props.EndItemRevision = null; + Teamcenter.Services.Strong.Cad._2007_01.StructureManagement.OverrideInfo overrideInfo = new Services.Strong.Cad._2007_01.StructureManagement.OverrideInfo(); + overrideInfo.Folder = null; + overrideInfo.RuleEntry = null; + oneBom.RevRuleConfigInfo.Props.OverrideFolders = new Services.Strong.Cad._2007_01.StructureManagement.OverrideInfo[] { overrideInfo }; + + oneBom.RevRuleConfigInfo.Props.Today = false; + oneBom.RevRuleConfigInfo.Props.UnitNo = 0; + oneBom.RevRuleConfigInfo.RevRule = latestRevRuleInfo.RevRule; + bomInfos[0] = oneBom; + + Teamcenter.Services.Strong.Cad._2007_01.StructureManagement.CreateBOMWindowsResponse cbomCreateResp = service.CreateBOMWindows(bomInfos); + if (cbomCreateResp == null || cbomCreateResp.Output.Length < 1) + { + ed1.WriteMessage("BOMʧ\n"); + MessageBox.Show("BOMʧܣBOM£", "ʾ"); + return; + } + Teamcenter.Soa.Client.Model.Strong.BOMWindow[] bomwindows = new Soa.Client.Model.Strong.BOMWindow[1]; + + Teamcenter.Soa.Client.Model.Strong.BOMWindow bomwindow = cbomCreateResp.Output[0].BomWindow; + bomwindows[0] = bomwindow; + Teamcenter.Soa.Client.Model.Strong.BOMLine topBomline = cbomCreateResp.Output[0].BomLine; + qryObjList.Clear(); + qryObjList.Add(topBomline); + dmService.RefreshObjects(new ModelObject[] { topBomline }); + dmservice.GetProperties(qryObjList.ToArray(), new String[] { "bl_child_lines", "bl_child_item", "bl_all_child_lines", "bl_line_object" }); + + ModelObject[] allChildLines = topBomline.Bl_child_lines; + dmService.RefreshObjects(allChildLines); + if (allChildLines == null || allChildLines.Length < 1) + { + ed1.WriteMessage("ûBOMṹ\n"); + MessageBox.Show("ûBOMṹBOM£", "ʾ"); + return; + } + List bomMsgList = new List(); + + // + // + ed1.WriteMessage("õChildLines=" + allChildLines.Length + "\n"); + getBomStruct(dmService, 1, topBomline, bomMsgList); + + /* dmService.RefreshObjects(allChildLines); + // bomMsgList.Add(titleMsg); + dmservice.GetProperties(allChildLines, new String[] { "bl_item_item_id", "bl_rev_object_name", "bl_quantity"}); + for (int i = 0; i < allChildLines.Length; i++) + { + String blIndex =""; + String blItemID =""; + String blRevName =""; + String blQuantity =""; + String blMaterial =""; + String blZhongliang = ""; + String blZongZhong = ""; + String blNote = ""; + Teamcenter.Soa.Client.Model.Strong.BOMLine bomLine = allChildLines[i] as Teamcenter.Soa.Client.Model.Strong.BOMLine; + blIndex = (i + 1) + ""; + blItemID = bomLine.Bl_item_item_id; + blRevName = bomLine.Bl_rev_object_name; + blQuantity = bomLine.GetPropertyDisplayableValue("bl_quantity");// + //blMaterial = bomLine.Bl_item_uom_tag;jk8U8Number + //blMaterial = bomLine.GetPropertyDisplayableValue("tm2_material_bomline");// + //blNote = bomLine.GetPropertyDisplayableValue("TM2_remark");//ע + // blNote = bomLine.Bl_all_notes; + BomMsgBean chidLineMsg = new BomMsgBean(); + chidLineMsg.Index = blIndex; + chidLineMsg.CodeNo = blItemID; + chidLineMsg.Name = blRevName; + chidLineMsg.Quantity = blQuantity; + chidLineMsg.Material = blMaterial; + chidLineMsg.Note = blNote; + chidLineMsg.Zhongliang = blZhongliang; + chidLineMsg.Zongzhong = blZongZhong; + bomMsgList.Add(chidLineMsg); + + + }*/ + for (int i = 0; i < bomMsgList.Count; i++) + { + BomMsgBean chidLineMsg = bomMsgList[i]; + ed1.WriteMessage(chidLineMsg.toString()); + + } + service.CloseBOMWindows(bomwindows); + // OriginTool tool = new OriginTool(); + //20240408 ѡǾڵĬϹܣɾϸѡ㣬ѡ񣬲ɾϸѡ + tool.insertBomMXL(bomMsgList, eraseBOM); + ed1.WriteMessage("ϸṹ\n"); + MessageBox.Show("ϸṹϣBOMɣ", "ʾ"); + + } + } + } + + + /// + /// + /// + /// + /// + /// + /// + private void getBomStruct(DataManagementService dmService, int index, Teamcenter.Soa.Client.Model.Strong.BOMLine topBomline, List bomMsgList) + { + dmService.RefreshObjects(new ModelObject[] { topBomline }); + dmService.GetProperties(new ModelObject[] { topBomline }, new String[] { "bl_child_lines", "bl_child_item", "bl_all_child_lines", "bl_line_object" }); + + ModelObject[] allChildLines = topBomline.Bl_child_lines; + if (allChildLines == null || allChildLines.Length < 1) + { + return; + } + dmService.RefreshObjects(allChildLines); + //List bomMsgList = new List(); + // bomMsgList.Add(titleMsg); + //dmService.GetProperties(allChildLines, new String[] { "bl_item_item_id", "bl_rev_object_name", "bl_quantity", "JK8Remark", "JK8Remark", "bl_child_lines" }); + + HelloTeamcenter.hello.Tool tool = new HelloTeamcenter.hello.Tool(); + String kws_bomline_remark = tool.getTCRemarkPreferences("KWC_bomlineRemark"); + ed.WriteMessage("KWC_bomline_remark :"); + ed.WriteMessage(kws_bomline_remark + "\n"); + String[] normalValues = new String[] + { + "bl_item_item_id", "bl_rev_object_name", "bl_quantity", "bl_child_lines", "DesignRemark", + "bl_line_object", "XYMaterials", "XYPartWeight","bl_occ_kwc6_denominator" + }; + String[] values = kws_bomline_remark.Split(';'); + List allPropertyList = new List(); + for (int i = 0; i < normalValues.Length; i++) + { + if (!allPropertyList.Contains(normalValues[i])) + { + allPropertyList.Add(normalValues[i]); + } + } + for (int i = 0; i < values.Length; i++) + { + if (!allPropertyList.Contains(values[i])) + { + allPropertyList.Add(values[i]); + } + } + + dmService.GetProperties(allChildLines, allPropertyList.ToArray());//ţƣϣأأעDesignRemark + for (int i = 0; i < allChildLines.Length; i++) + { + String blIndex = ""; + String blItemID = ""; + String blRevName = ""; + String blQuantity = ""; + String blMaterial = ""; + String blSingleWeight = ""; + String blZongZhong = ""; + String blNote = ""; + String kwc6_denominator = "";//עͷĸעͲΪʱʾ/ĸ + Teamcenter.Soa.Client.Model.Strong.BOMLine bomLine = allChildLines[i] as Teamcenter.Soa.Client.Model.Strong.BOMLine; + //dmService.RefreshObjects(new ModelObject[] {bomLine}); + blIndex = string.Format("{0}", (index++)); + //ItemRevision bomlineItemRevision = bomLine.Bl_line_object as ItemRevision; + //dmService.RefreshObjects(new ModelObject[] { bomlineItemRevision }); + //String[] attr = new string[] { "IMAN_master_form_rev"}; + //String[] formAttr = new string[] { "XYMaterials", "XYPartWeight"}; + //dmService.GetProperties(new ModelObject[] { bomlineItemRevision }, attr); + //ModelObject[] form_vec = null; + //form_vec= bomlineItemRevision.IMAN_master_form_rev; + //dmService.RefreshObjects(form_vec); + + //dmService.GetProperties(form_vec, formAttr); + //Form form = form_vec[0] as Form; + //blRevName = bomLine.Bl_rev_object_name; + blRevName = bomLine.GetPropertyDisplayableValue("bl_rev_object_name"); + blItemID = bomLine.GetPropertyDisplayableValue("bl_item_item_id");//id + blQuantity = bomLine.GetPropertyDisplayableValue("bl_quantity");// + //blMaterial = bomLine.Bl_item_uom_tag;jk8U8Number + blMaterial = bomLine.GetPropertyDisplayableValue("XYMaterials");// + blSingleWeight = bomLine.GetPropertyDisplayableValue("XYPartWeight");// + kwc6_denominator = bomLine.GetPropertyDisplayableValue("bl_occ_kwc6_denominator");//ע + ed.WriteMessage("kwc6_denominator:" + kwc6_denominator + "\n"); + + //*= + if (blSingleWeight.Length > 0 && blQuantity.Length > 0) + { + Double blSingleWeightDouble = Double.Parse(blSingleWeight); + Double blQuantityblQuantityDouble = Double.Parse(blQuantity); + Double allWeight = blQuantityblQuantityDouble * blSingleWeightDouble; + blZongZhong = Convert.ToString(allWeight); + } + + + // blNote = bomLine.GetPropertyDisplayableValue("DesignRemark");//ע + blNote = ""; + for (int j = 0; j < values.Length; j++) + { + blNote = blNote + bomLine.GetPropertyDisplayableValue(values[j]);//ע + + } + //20240409עͷĸעͲΪʱʾ/ĸ + blQuantity = blQuantity.Replace(".0000", ""); + if (kwc6_denominator.Length > 0) + { + blQuantity = blQuantity + "/" + kwc6_denominator; + } + ed.WriteMessage("blQuantity:" + blQuantity + "\n"); ; + // blNote = bomLine.Bl_all_notes; + BomMsgBean chidLineMsg = new BomMsgBean(); + chidLineMsg.Index = blIndex; + chidLineMsg.CodeNo = blItemID; + chidLineMsg.Name = blRevName; + chidLineMsg.Quantity = blQuantity; + chidLineMsg.Material = blMaterial; + chidLineMsg.Note = blNote; + chidLineMsg.Zhongliang = blSingleWeight; + chidLineMsg.Zongzhong = blZongZhong; + bomMsgList.Add(chidLineMsg); + //20240304ȡBOMʱij²ṹϸΪնȡID + // if (bomLine.Bl_child_lines == null || bomLine.Bl_child_lines.Length < 1) + // { + // chidLineMsg.CodeNo = bomLine.Bl_item_item_id; + // } + // else + // { + // //20240222Ҫչʾв㼶ֻ赥 + //// chidLineMsg.CodeNo = ""; + //// getBomStruct(dmService, index, bomLine, bomMsgList); + // } + } + + } + + /// + /// + /// + /// + /// + /// + [CommandMethod("MXL_TEST")] + public Boolean insertBomMXL() + { + Boolean isOk = false; + String blockname = "mxl"; + String btlBlockName = "mxn"; + Database db = HostApplicationServices.WorkingDatabase; + using (Transaction tran = db.TransactionManager.StartTransaction()) + { + BlockTable block = tran.GetObject(db.BlockTableId, OpenMode.ForRead) as BlockTable; + ed.WriteMessage("ȡϸ mxl \n"); + //ɾеϸ + if (block.Has(blockname)) + { + BlockTableRecord bltr = tran.GetObject(db.CurrentSpaceId, OpenMode.ForRead) as BlockTableRecord; + foreach (ObjectId item in bltr) + { + Entity ent = tran.GetObject(item, OpenMode.ForRead) as Entity; + if (ent.GetType().Name == "BlockReference") + { + BlockReference bref = (BlockReference)ent; + if (bref.Name == blockname) + { + Point3d point = bref.Position; + ed.WriteMessage("X=" + point.X + " | Y=" + point.Y + " | Z=" + point.Z + "\n"); + bref.RemoveField(); + } + } + } + } + ed.WriteMessage("ȡϸ mxn \n"); + //Ҵϸͼ + if (block.Has(btlBlockName)) + { + BlockTableRecord bltr = tran.GetObject(db.CurrentSpaceId, OpenMode.ForRead) as BlockTableRecord; + foreach (ObjectId item in bltr) + { + Entity ent = tran.GetObject(item, OpenMode.ForRead) as Entity; + if (ent.GetType().Name == "BlockReference") + { + BlockReference bref = (BlockReference)ent; + if (bref.Name == btlBlockName) + { + Point3d point = bref.Position; + ed.WriteMessage("X=" + point.X + " | Y=" + point.Y + " | Z=" + point.Z + "\n"); + + } + } + } + } + //ϸ + + + + } + return isOk; + } + public bool CreateBomStructure(ItemRevision parentRev, Dataset parent_ds, List bom_Vec, Folder folder) + { + + DataManagementService dmService = DataManagementService.getService(Session.getConnection()); + Reservation res = ReservationService.getService(Session.getConnection()); + Editor ed1 = ZwSoft.ZwCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; + ed1.WriteMessage("bom_Vec size:" + bom_Vec.Count.ToString() + "\n"); + //͹ + OriginReadXml originreadxml = new OriginReadXml(); + OriginTypeRule origintyperule = originreadxml.OriginReadRuleXML(xmlpath); + + + ItemRevision[] revVec = new ItemRevision[bom_Vec.Count]; + ed1.WriteMessage("revVec size:" + revVec.Length.ToString() + "\n"); + for (int i = 0; i < bom_Vec.Count; i++) + { + OriginMXL it_bom = bom_Vec[i]; + OriginTool origintool = new OriginTool(); + if (origintool.getKeyFromValue(it_bom.Mxltctable, "item_id") == null) + { + ed1.WriteMessage("ϸûitem_id\n"); + return false; + } + string item_id = it_bom.Mxldatatable[origintool.getKeyFromValue(it_bom.Mxltctable, "item_id")].ToString(); + SavedQueryResults found = origintool.getSearchItem(item_id); + if (found.NumOfObjects == 0) + { + //ItemProperties[] item_vec; + //DatasetProperties[] dataset_vec; + ItemProperties oneItemProp = new ItemProperties(); + CreateItemsResponse itemResp = new CreateItemsResponse(); + + Teamcenter.Hello.DataManagement hellomanagement = new Teamcenter.Hello.DataManagement(); + + //Item + string tempitemtype = origintool.getItemType(it_bom, origintyperule); + ItemIdsAndInitialRevisionIds[] itemIds = hellomanagement.generateItemIds(1, tempitemtype); + GetItemCreationRelatedInfoResponse relatedResponse = dmService.GetItemCreationRelatedInfo(tempitemtype, null); + string[] formTypes = new string[relatedResponse.FormAttrs.Length]; + for (int j = 0; j < relatedResponse.FormAttrs.Length; j++) + { + FormAttributesInfo attrInfo = relatedResponse.FormAttrs[j]; + formTypes[j] = attrInfo.FormType; + } + ItemProperties[] itemProps = new ItemProperties[itemIds.Length]; + ItemProperties itemProperty = new ItemProperties(); + for (int j = 0; j < itemIds.Length; j++) + { + ed1.WriteMessage("start Create form in cache!\n"); + ModelObject[] forms = hellomanagement.createForms(itemIds[j].NewItemId, + formTypes[0], itemIds[j].NewRevId, formTypes[1], null, false); + ed1.WriteMessage("Create form in cache sucessful!\n"); + ed1.WriteMessage("set item properties!\n"); + + itemProperty.ClientId = ""; + itemProperty.ItemId = item_id; + itemProperty.RevId = itemIds[j].NewRevId; + if (it_bom.Mxltctable.ContainsValue("object_name")) + itemProperty.Name = it_bom.Mxldatatable[origintool.getKeyFromValue(it_bom.Mxltctable, "object_name")].ToString(); + else + itemProperty.Name = ""; + itemProperty.Type = tempitemtype; + itemProperty.Description = ""; + itemProperty.Uom = "EA"; + + itemProps[j] = itemProperty; + } + try + { + ed1.WriteMessage("start item create!\n"); + if (folder == null) + itemResp = dmService.CreateItems(itemProps, null, ""); + else + itemResp = dmService.CreateItems(itemProps, folder, ""); + ed1.WriteMessage("create Items: " + item_id + "sucessful!\n"); + ItemRevision rev = null; + Item newitem = null; + for (int j = 0; j < itemResp.Output.Length; j++) + { + rev = itemResp.Output[j].ItemRev; + newitem = itemResp.Output[j].Item; + } + revVec[i] = rev; + + + //дform + FormInfo forminfo = new FormInfo(); + FormInfo[] forminfo_vec; + ModelObject[] form_vec = null; + + ModelObject[] objects = { rev }; + String[] attributes = { "IMAN_master_form_rev", + "is_modifiable","item_revision_id"}; + dmService.RefreshObjects(objects); + dmService.GetProperties(objects, attributes); + if (rev.Is_modifiable) + { + try + { + form_vec = rev.IMAN_master_form_rev; + ed1.WriteMessage("get_IMAN_master_form_rev sucessful!\n"); + } + catch (NotLoadedException ex) + { + ed1.WriteMessage(ex.Message); + } + forminfo_vec = new FormInfo[form_vec.Length]; + for (int j = 0; j < form_vec.Length; j++) + { + Form form = form_vec[j] as Form; + + Hashtable formAttrs = new Hashtable(); + + + //Formԣִ´ + if (it_bom.Mxltypetable.ContainsValue("Form")) + { + foreach (DictionaryEntry de in it_bom.Mxltypetable) + { + if (de.Value.ToString() == "Form" && it_bom.Mxlisbomtable[de.Key].ToString() == "0" && + it_bom.Mxlupdatetable[de.Key].ToString() == "1") + { + string cadstring = de.Key.ToString(); + string cadvalue = it_bom.Mxldatatable[cadstring].ToString(); + string tcstring = it_bom.Mxltctable[cadstring].ToString(); + + + string[] formAttrValue = new string[1]; + formAttrValue[0] = ""; + formAttrValue[0] = cadvalue; + formAttrs.Add(tcstring, formAttrValue); + } + } + } + + forminfo.AttributesMap = formAttrs; + forminfo.ClientId = "1"; + forminfo.Description = ""; + forminfo.FormObject = form; + forminfo.Name = item_id + "/" + rev.Item_revision_id; + forminfo.ParentObject = null; + forminfo.RelationName = "IMAN_master_form"; + forminfo.SaveDB = true; + forminfo.FormType = "ItemRevision Master"; + + forminfo_vec[j] = forminfo; + + try + { + CreateOrUpdateFormsResponse formResp + = dmService.CreateOrUpdateForms(forminfo_vec); + ed1.WriteMessage("update form attributes sucessful!\n"); + } + catch (ServiceException ex) + { + ed1.WriteMessage(ex.Message); + } + } + } + /*if (it_bom.Memo == "ͼ") + { + if (parent_ds != null) + { + ExpandGRMRelationsPref myPref = new ExpandGRMRelationsPref(); + RelationAndTypesFilter2 myFilter = new RelationAndTypesFilter2(); + myFilter.RelationName = "IMAN_reference"; + string[] typeVec = new string[1]; + typeVec[0] = "D5DWG"; + myFilter.ObjectTypeNames = typeVec; + myPref.ExpItemRev = false; + RelationAndTypesFilter2[] myFilterVec = { myFilter }; + myPref.Info = myFilterVec; + + + ModelObject[] primaryObjects = { rev }; + Teamcenter.Services.Strong.Core._2007_06.DataManagement.ExpandGRMRelationsResponse + myResp = dmService.ExpandGRMRelationsForPrimary(primaryObjects, myPref); + if (myResp.Output.Length > 0) + { + for (int k = 0; k < myResp.Output.Length; k++) + { + Teamcenter.Services.Strong.Core._2007_06.DataManagement.ExpandGRMRelationsOutput + grmOutput = myResp.Output[k]; + for (int l = 0; l < grmOutput.OtherSideObjData.Length; l++) + { + ExpandGRMRelationsData otherSideData = grmOutput.OtherSideObjData[l]; + if (otherSideData.OtherSideObjects.Length == 0) + { + Relationship[] rela_vec = new Relationship[1]; + Relationship one_rela = new Relationship(); + one_rela.ClientId = ""; + one_rela.PrimaryObject = rev; + one_rela.SecondaryObject = parent_ds; + one_rela.RelationType = "IMAN_reference"; + one_rela.UserData = null; + rela_vec[0] = one_rela; + CreateRelationsResponse reResp = + dmService.CreateRelations(rela_vec); + ed1.WriteMessage("create IMAN_reference sucessful!\n"); + } + } + } + } + } + }*/ + } + catch (ServiceException ex) + { + ed1.WriteMessage(ex.Message); + } + } + else//found + { + ItemRevision itemRev = null; + for (int j = 0; j < found.NumOfObjects; j++) + { + GetItemFromIdInfo[] infos = new GetItemFromIdInfo[1]; + GetItemFromIdInfo oneItem = new GetItemFromIdInfo(); + + oneItem.ItemId = item_id; + infos[0] = oneItem; + GetItemFromIdPref pref = new GetItemFromIdPref(); + GetItemFromIdResponse infoResp = + dmService.GetItemFromId(infos, 1, pref); + for (int n = 0; n < infoResp.Output.Length; n++) + { + ModelObject[] objects = { infoResp.Output[n].Item }; + String[] attributes = { "revision_list", + "object_name","item_revision"}; + dmService.RefreshObjects(objects); + dmService.GetProperties(objects, attributes); + ModelObject[] revList = infoResp.Output[n].Item.Revision_list; + dmService.RefreshObjects(revList); + for (int l = 0; l < revList.Length; l++) + { + itemRev = revList[l] as ItemRevision; + } + } + } + revVec[i] = itemRev; + //дform + FormInfo forminfo = new FormInfo(); + FormInfo[] forminfo_vec = new FormInfo[1]; + ModelObject[] form_vec; + ModelObject[] objects1 = { itemRev }; + String[] attributes1 = { "IMAN_master_form_rev", + "is_modifiable","item_revision_id", + "date_released","item_id", + "release_status_list"}; + dmService.RefreshObjects(objects1); + dmService.GetProperties(objects1, attributes1); + + ReleaseStatus[] releaselist = itemRev.Release_status_list; + if (releaselist.Length > 0) + { + MessageBox.Show("Item IDΪ" + itemRev.Item_id + "°汾ѷ"); + continue; + } + if (!itemRev.Is_modifiable) + { + MessageBox.Show("ǰûItem IDΪ" + itemRev.Item_id + "Ȩ޸ĻItem°汾ѷ"); + continue; + } + else if (itemRev.Is_modifiable) + { + ed1.WriteMessage("is_modifiable!\n"); + + form_vec = itemRev.IMAN_master_form_rev; + ed1.WriteMessage("get_IMAN_master_form_rev sucessful!\n"); + + for (int j = 0; j < form_vec.Length; j++) + { + Form form = form_vec[j] as Form; + bool frash = false; + string[] props = new string[1]; + string revId = itemRev.Object_string; + Hashtable formAttrs = new Hashtable(); + + + //Formԣִ´ + if (it_bom.Mxltypetable.ContainsValue("Form")) + { + foreach (DictionaryEntry de in it_bom.Mxltypetable) + { + if (de.Value.ToString() == "Form" && it_bom.Mxlisbomtable[de.Key].ToString() == "0" && + it_bom.Mxlupdatetable[de.Key].ToString() == "1") + { + string cadstring = de.Key.ToString(); + string cadvalue = it_bom.Mxldatatable[cadstring].ToString(); + string tcstring = it_bom.Mxltctable[cadstring].ToString(); + + ed1.WriteMessage("ȡ" + tcstring + "\n"); + props[0] = tcstring; + ServiceData serviceData = dmService.GetProperties(form_vec, props); + if (serviceData.sizeOfPartialErrors() > 0) + { + continue; + } + Property my_prop = form_vec[j].GetProperty(tcstring); + if (cadvalue != my_prop.StringValue) + { + if (my_prop.StringValue == "") + frash = true; + else + { + string message = "ǰϸͼֽ:" + cadstring + "ֵ" + cadvalue + "ϵͳ:" + tcstring + "ֵ" + my_prop.StringValue + "һ,Ƿ񸲸ϵͳ?"; + DialogResult updateresult = MessageBox.Show(message, "ʾ", MessageBoxButtons.YesNo, MessageBoxIcon.Question); + if (updateresult == DialogResult.Yes) + { + frash = true; + } + } + string[] formAttrValue = new string[1]; + formAttrValue[0] = ""; + if (frash) + formAttrValue[0] = cadvalue; + else + formAttrValue[0] = my_prop.StringValue; + ed1.WriteMessage(tcstring + ":" + formAttrValue[0] + "\n"); + formAttrs.Add(tcstring, formAttrValue); + props[0] = ""; + } + + } + } + } + + forminfo.AttributesMap = formAttrs; + forminfo.ClientId = ""; + forminfo.Description = ""; + forminfo.FormObject = form; + forminfo.Name = item_id + "/" + itemRev.Item_revision_id; + forminfo.ParentObject = null; + forminfo.RelationName = "IMAN_master_form"; + forminfo.SaveDB = true; + forminfo.FormType = "ItemRevision Master"; + + forminfo_vec[0] = forminfo; + try + { + CreateOrUpdateFormsResponse formResp + = dmService.CreateOrUpdateForms(forminfo_vec); + } + catch (SoaException ex) + { + ed1.WriteMessage(ex.Message); + } + } + } + ////if (it_bom.Memo == "ͼ") + ////{ + //// if (parent_ds != null) + //// { + //// ExpandGRMRelationsPref myPref = new ExpandGRMRelationsPref(); + //// RelationAndTypesFilter2 myFilter = new RelationAndTypesFilter2(); + //// myFilter.RelationName = "IMAN_reference"; + //// string[] typeVec = new string[1]; + //// typeVec[0] = "D5DWG"; + //// myFilter.ObjectTypeNames = typeVec; + //// myPref.ExpItemRev = false; + //// RelationAndTypesFilter2[] myFilterVec = { myFilter }; + //// myPref.Info = myFilterVec; + + + //// ModelObject[] primaryObjects = { itemRev }; + //// Teamcenter.Services.Strong.Core._2007_06.DataManagement.ExpandGRMRelationsResponse + //// myResp = dmService.ExpandGRMRelationsForPrimary(primaryObjects, myPref); + //// if (myResp.Output.Length > 0) + //// { + //// for (int k = 0; k < myResp.Output.Length; k++) + //// { + //// Teamcenter.Services.Strong.Core._2007_06.DataManagement.ExpandGRMRelationsOutput + //// grmOutput = myResp.Output[k]; + //// for (int l = 0; l < grmOutput.OtherSideObjData.Length; l++) + //// { + //// ExpandGRMRelationsData otherSideData = grmOutput.OtherSideObjData[l]; + //// if (otherSideData.OtherSideObjects.Length == 0) + //// { + //// Relationship[] rela_vec = new Relationship[1]; + //// Relationship one_rela = new Relationship(); + //// one_rela.ClientId = ""; + //// one_rela.PrimaryObject = itemRev; + //// one_rela.SecondaryObject = parent_ds; + //// one_rela.RelationType = "IMAN_reference"; + //// one_rela.UserData = null; + //// rela_vec[0] = one_rela; + //// CreateRelationsResponse reResp = + //// dmService.CreateRelations(rela_vec); + //// ed1.WriteMessage("create IMAN_reference sucessful!\n"); + //// } + //// } + //// } + //// } + //// } + ////} + } + }//for + //BOM + Teamcenter.Services.Strong.Cad.StructureManagementService ssService = + Teamcenter.Services.Strong.Cad.StructureManagementService.getService(Session.getConnection()); + Teamcenter.Services.Strong.Cad._2007_12.StructureManagement.CreateOrUpdateRelativeStructureInfo2 + structInfo = new Teamcenter.Services.Strong.Cad._2007_12.StructureManagement.CreateOrUpdateRelativeStructureInfo2(); + + Teamcenter.Services.Strong.Cad._2007_12.StructureManagement.CreateOrUpdateRelativeStructureInfo2[] + structInfoVec = new Teamcenter.Services.Strong.Cad._2007_12.StructureManagement.CreateOrUpdateRelativeStructureInfo2[1]; + + //Teamcenter.Services.Strong.Cad._2007_01.StructureManagement.RelativeStructureChildInfo + // childInfo = new Teamcenter.Services.Strong.Cad._2007_01.StructureManagement.RelativeStructureChildInfo(); + + Teamcenter.Services.Strong.Cad._2007_01.StructureManagement.RelativeStructureChildInfo[] + childInfoVec; + + //Teamcenter.Services.Strong.Cad._2007_01.StructureManagement.RelOccInfo + // occInfo = new Teamcenter.Services.Strong.Cad._2007_01.StructureManagement.RelOccInfo(); + + //Teamcenter.Services.Strong.Cad._2007_01.StructureManagement.AttributesInfo + // attrsInfo = new Teamcenter.Services.Strong.Cad._2007_01.StructureManagement.AttributesInfo(); + + + Teamcenter.Services.Strong.Cad._2007_12.StructureManagement.CreateOrUpdateRelativeStructurePref2 + sPref = new Teamcenter.Services.Strong.Cad._2007_12.StructureManagement.CreateOrUpdateRelativeStructurePref2(); + + //ItemRevision childRev; + ed1.WriteMessage("ʼ׼pse\n"); + childInfoVec = new Teamcenter.Services.Strong.Cad._2007_01.StructureManagement.RelativeStructureChildInfo[revVec.Length]; + ed1.WriteMessage("childInfoVec size:" + childInfoVec.Length + "\n"); + Teamcenter.Services.Strong.Cad._2007_01.StructureManagement.AttributesInfo[] + attrsToSet = new Teamcenter.Services.Strong.Cad._2007_01.StructureManagement.AttributesInfo[4]; + for (int i = 0; i < revVec.Length; i++) + { + OriginMXL bomv = bom_Vec[i]; + OriginTool origintool = new OriginTool(); + string item_id = bomv.Mxldatatable[origintool.getKeyFromValue(bomv.Mxltctable, "item_id")].ToString(); + ed1.WriteMessage("" + item_id + "...\n"); + int updatenum = 0; + if (bomv.Mxltypetable.ContainsValue("bomline")) + { + foreach (DictionaryEntry de in bomv.Mxltypetable) + { + if (de.Value.ToString() == "bomline" && bomv.Mxlisbomtable[de.Key].ToString() == "1" && bomv.Mxlupdatetable[de.Key].ToString() == "1") + { + updatenum = updatenum + 1; + } + } + + } + + Teamcenter.Services.Strong.Cad._2007_01.StructureManagement.RelativeStructureChildInfo + childInfo = new Teamcenter.Services.Strong.Cad._2007_01.StructureManagement.RelativeStructureChildInfo(); + Teamcenter.Services.Strong.Cad._2007_01.StructureManagement.RelOccInfo + occInfo = new Teamcenter.Services.Strong.Cad._2007_01.StructureManagement.RelOccInfo(); + attrsToSet = new Teamcenter.Services.Strong.Cad._2007_01.StructureManagement.AttributesInfo[updatenum]; + + + + if (bomv.Mxltypetable.ContainsValue("bomline")) + { + int stepnum = 0; + foreach (DictionaryEntry de in bomv.Mxltypetable) + { + if (de.Value.ToString() == "bomline" && bomv.Mxlisbomtable[de.Key].ToString() == "1" && + bomv.Mxlupdatetable[de.Key].ToString() == "1") + { + string cadstring = de.Key.ToString(); + string cadvalue = bomv.Mxldatatable[cadstring].ToString(); + string tcstring = bomv.Mxltctable[cadstring].ToString(); + Teamcenter.Services.Strong.Cad._2007_01.StructureManagement.AttributesInfo + attrsInfo = new Teamcenter.Services.Strong.Cad._2007_01.StructureManagement.AttributesInfo(); + attrsInfo.Name = tcstring; + attrsInfo.Value = cadvalue; + attrsToSet[stepnum] = attrsInfo; + stepnum = stepnum + 1; + } + } + } + + occInfo.AttrsToSet = attrsToSet; + + childInfo.Child = revVec[i]; + childInfo.OccInfo = occInfo; + + childInfoVec[i] = childInfo; + + } + for (int j = 0; j < childInfoVec.Length; j++) + { + for (int k = 0; k < childInfoVec[j].OccInfo.AttrsToSet.Length; k++) + { + ed1.WriteMessage("====" + childInfoVec[j].OccInfo.AttrsToSet[k].Name + ":" + childInfoVec[j].OccInfo.AttrsToSet[k].Value + "====\n"); + } + + } + structInfo.ChildInfo = childInfoVec; + structInfo.Parent = parentRev; + structInfo.Precise = false; + structInfoVec[0] = structInfo; + + ServiceData sData; + + ModelObject[] objects2 = { parentRev }; + String[] attributes2 = { "structure_revisions" }; + dmService.RefreshObjects(objects2); + sData = dmService.GetProperties(objects2, attributes2); + + Teamcenter.Soa.Client.Model.Strong.PSBOMViewRevision bvr = null; + Teamcenter.Soa.Client.Model.Strong.PSBOMView bv = null; + try + { + for (int i = 0; i < parentRev.Structure_revisions.Length; i++) + { + ed1.WriteMessage("ʼǩBomview revision\n"); + bvr = parentRev.Structure_revisions[i]; + + ModelObject[] objects3 = { bvr }; + String[] attributes3 = { "is_modifiable", + "object_string","checkde_out"}; + dmService.RefreshObjects(objects3); + dmService.GetProperties(objects3, attributes3); + if (!bvr.Is_modifiable) + { + MessageBox.Show("Ȩ޸BOM"); + return false; + } + if (bvr.Checked_out == "Y") + { + MessageBox.Show("BOMѾǩȷǩִб"); + return false; + } + string bvr_name = bvr.Object_string; + ed1.WriteMessage("bvr_name=" + bvr_name + "\n"); + + ModelObject[] bvr_vec = new ModelObject[1]; + bvr_vec[0] = bvr; + sData = res.Checkout(bvr_vec, "", ""); + if (sData.sizeOfPartialErrors() > 0) + { + ed1.WriteMessage("checkout bom returned a partial error."); + return false; + } + } + } + catch (ServiceException ex) + { + ed1.WriteMessage(ex.Message); + } + + ed1.WriteMessage("ʼBom\n"); + try + { + Teamcenter.Services.Strong.Cad._2007_01.StructureManagement.CreateOrUpdateRelativeStructureResponse + cursResp = ssService.CreateOrUpdateRelativeStructure(structInfoVec, "view", true, sPref); + ed1.WriteMessage("Bomɹ\n"); + } + catch (System.Exception ex) + { + ed1.WriteMessage(ex.Message); + return false; + } + + if (bvr != null) + { + ModelObject[] checkIn_vec = new ModelObject[1]; + checkIn_vec[0] = bvr; + try + { + res.Checkin(checkIn_vec); + ed1.WriteMessage("Bomview ǩɹ!\n"); + } + catch (ServiceException ex) + { + ed1.WriteMessage(ex.Message); + } + } + return true; + } + + private void loginbuttonclick(object Sender, EventArgs e) + { + login(); + } + + private void openbuttonclick(object Sender, EventArgs e) + { + openformtc(); + } + + private void savebuttonclick(object Sender, EventArgs e) + { + savetotc(); + } + + private void logoutbuttonclick(object Sender, EventArgs e) + { + layout(); + } + + //tcItemԼصǰͼֽ + [CommandMethod("OPEN_ITEM_PROP_FROM_TC")] + public void openItemPropFromTc() + { + if (loginuser != null) + { + hadlogin = true; + } + else + login(); + + if (hadlogin == true) + { + + searchfrom1 = new Search1(); + searchfrom1.appdoc = appodc; + searchfrom1.button2.Click += new System.EventHandler(this.search1Button2_Click); + searchfrom1.Activate(); + searchfrom1.Show(); + + } + } + + public void search1Button2_Click(object sender, EventArgs e) + { + Editor ed1 = ZwSoft.ZwCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; + DataManagementService dmService = DataManagementService.getService(Session.getConnection()); + Reservation res = ReservationService.getService(Session.getConnection()); + TreeNode nownode = this.searchfrom1.treeView1.SelectedNode; + if (nownode.SelectedImageIndex != 0) + { + foreach (ALLOBJECT perobject in this.searchfrom1.itemlist) + { + if (perobject.treenode.Equals(nownode)) + { + DialogResult isopen = MessageBox.Show("Ƿȷȡð汾ԣ", "ʾ", MessageBoxButtons.YesNo, MessageBoxIcon.Question); + if (isopen == DialogResult.None || isopen == DialogResult.No) + { + return; + } + ItemRevision myrev = perobject.workobject as ItemRevision; + ModelObject[] objects = { myrev }; + String[] attributes = { "item_id", "item_revision_id" }; + dmService.RefreshObjects(objects); + dmService.GetProperties(objects, attributes); + + String item_id = myrev.Item_id; + String item_revision_id = myrev.Item_revision_id; + this.searchfrom1.Hide(); + this.searchfrom1.Dispose(); + + ed1.WriteMessage("\nitem_id=" + item_id + " item_revision_id=" + item_revision_id + "\n"); + updateFromSearch(item_id, item_revision_id); + break; + } + } + } + else + { + //ed.WriteMessage("ѡȷݼ\n"); + MessageBox.Show("ѡȷİ汾"); + return; + } + } + + + //tcItemԼصǰͼֽ ȷϺķͬƣ + // public async void updateFromSearch(String itemID, String itemRev2) + public void updateFromSearch(String itemID, String itemRev2) + { + + if (loginuser != null) + { + hadlogin = true; + } + else + { + login(); + //hadlogin = true; + } + if (hadlogin) + { + getFilePuid(); + + + DataManagementService dmService = DataManagementService.getService(Session.getConnection()); + Editor ed1 = ZwSoft.ZwCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; + Document document2 = ZwSoft.ZwCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument; + if (document2.IsReadOnly) + { + MessageBox.Show("ļΪֻܸ!"); + return; + } + + + + OriginTool origintool = new OriginTool(); + + + ed1.WriteMessage("\nʼȡϢ...\n"); + /************************************************************************/ + /* ȡݵĴ */ + /************************************************************************/ + ArrayList btllist = new ArrayList(); + OriginReadXml readxml = new OriginReadXml(); + btllist = readxml.OriginReadBTLXML(xmlpath); + + for (int i = 0; i < btllist.Count; i++) + { + OriginBTL onebtlinfo = (OriginBTL)btllist[i]; + ed1.WriteMessage("ƣ" + onebtlinfo.Btlname + "\n"); + ed1.WriteMessage("ϸϢ:" + "\n"); + foreach (DictionaryEntry de in onebtlinfo.Btldatatable) + { + ed1.WriteMessage("CAD" + de.Key + "\tCADֵ:" + de.Value + + "\tTC:" + onebtlinfo.Btltctable[de.Key] + + "\tTCϵͳ:" + onebtlinfo.Btltypetable[de.Key] + + "\tд" + onebtlinfo.Btlwritetable[de.Key] + + "\tͬ:" + onebtlinfo.Btlfromtctable[de.Key] + "\n"); + } + } + + for (int btli = 0; btli < btllist.Count; btli++) + { + OriginBTL btlinfo = (OriginBTL)btllist[btli]; + //item_idӦcadͼֽϢ + object key = origintool.getKeyFromValue(btlinfo.Btltctable, "item_id"); + object key_rev = origintool.getKeyFromValue(btlinfo.Btltctable, "item_revision_id"); + if (key == null) + { + ed1.WriteMessage("ϵͳûҵitem_idӦͼֽϢϵͳж\n"); + return; + } + if (key_rev == null) + { + ed1.WriteMessage("ϵͳûҵitem_revision_idӦͼֽϢϵͳж\n"); + return; + } + //itemID = btlinfo.Btldatatable[key].ToString(); + //if (itemID == null || itemID.Trim().Equals("")) + //{ + // ed1.WriteMessage("ȡItemϢΪգϵͳѭ\n"); + // continue; + //} + //itemRev2 = btlinfo.Btldatatable[key_rev].ToString(); + // SavedQueryResults found = origintool.getSearchItem(btlinfo.Btldatatable[key].ToString()); + ed1.WriteMessage(string.Format("ID=>{0} REV=>{1}", itemID, itemRev2)); + SavedQueryResults found = origintool.getSearchItem(itemID); + if (found != null && found.NumOfObjects > 0) + { + // DialogResult upresult = MessageBox.Show("ҵӦItemǷͬ", "ʾ", MessageBoxButtons.YesNo, MessageBoxIcon.Question); + // if (upresult == DialogResult.No || upresult == DialogResult.None) + // { + // ed1.WriteMessage("ͬ\n"); + // return; + // } + if (true) + { + for (int i = 0; i < found.NumOfObjects; i++) + { + Item item = found.Objects[i] as Item; + + ModelObject[] objects = { item }; + String[] attributes = { "item_id", "object_name", "object_string", "object_type", "Uid" }; + dmService.RefreshObjects(objects); + dmService.GetProperties(objects, attributes); + string object_type = item.Object_type; + if (puidList != null) + { + ed1.WriteMessage("puidList.count =" + puidList.Count); + foreach (String nameId in puidList) + { + String[] nameIds = nameId.Split("|".ToCharArray()); + if (nameIds != null && nameIds.Length == 2) + { + if (document2.Name.Contains(nameIds[0])) + { + if (!itemID.Equals(nameIds[1])) + { + MessageBox.Show("ǰΪͼֽܸ!"); + return; + } + } + // document2.Name + + } + } + } + + if (object_type.Equals("TM2_TEdrawing")) + { + MessageBox.Show("ǰΪͼֽܸ!"); + return; + + } + string item_id = item.Item_id; + GetItemFromIdInfo tempitem = new GetItemFromIdInfo(); + tempitem.ItemId = itemID; + GetItemFromIdInfo[] infos = new GetItemFromIdInfo[1]; + infos[0] = tempitem; + GetItemFromIdPref pref = new GetItemFromIdPref(); + //Ҫµķʽ + GetItemFromIdResponse infoResp = dmService.GetItemFromId(infos, 1, pref); + + //׼дCADͼֽϵϢ + Hashtable tempvaluetable = new Hashtable(); + + //׼дU8뵽CADͼֽϵ + Hashtable u8valuetable = new Hashtable(); + + //ȡItemϵ + if (btlinfo.Btltypetable.ContainsValue("Item")) + { + ed1.WriteMessage("ͬItem\n"); + + foreach (DictionaryEntry de in btlinfo.Btltypetable) + { + if (de.Value.ToString() == "Item" && btlinfo.Btlfromtctable[de.Key].ToString() == "1") + { + string cadstring = de.Key.ToString(); + string cadvalue = btlinfo.Btldatatable[cadstring].ToString(); + string tcstring = btlinfo.Btltctable[cadstring].ToString(); + + ed1.WriteMessage("ȡ" + tcstring + "\n"); + string[] props = new string[1]; + props[0] = tcstring; + ServiceData serviceData = dmService.GetProperties(objects, props); + if (serviceData.sizeOfPartialErrors() > 0) + { + continue; + } + Property my_prop = item.GetProperty(tcstring); + string tempcadvalue = my_prop.StringValue.ToString(); + ed1.WriteMessage("TCϵͳе" + tcstring + "ֵΪ " + tempcadvalue + "\n"); + if (cadvalue != tempcadvalue) + { + origintool.TableHasKey(tempvaluetable, cadstring, tempcadvalue); + } + } + } + } + + //ð汾ϵ + for (int j = 0; j < infoResp.Output.Length; j++) + { + ModelObject[] objects1 = { infoResp.Output[j].Item }; + String[] attributes1 = { "revision_list", "is_modifiable" }; + dmService.RefreshObjects(objects1); + dmService.GetProperties(objects1, attributes1); + ModelObject[] revlist = infoResp.Output[j].Item.Revision_list; + dmService.RefreshObjects(revlist); + ItemRevision itemRev = null; + string rev_id = ""; + //= new ModelObject[] + for (int k = 0; k < revlist.Length; k++) + { + String[] attr = { "item_revision_id" }; + + itemRev = revlist[k] as ItemRevision; + ModelObject[] obj2 = { itemRev }; + dmService.RefreshObjects(obj2); + dmService.GetProperties(obj2, attr); + rev_id = itemRev.Item_revision_id; + if (rev_id.Equals(itemRev2)) + { + break; + } + + } + if (itemRev == null) + { + ed1.WriteMessage("ItemûжӦ汾\n"); + return; + } + ModelObject[] objects2 = { itemRev }; + String[] attributes2 = { "item_revision_id", "is_modifiable" , + "checked_out","item_id","release_status_list", + "IMAN_master_form_rev"}; + dmService.RefreshObjects(objects2); + dmService.GetProperties(objects2, attributes2); + rev_id = itemRev.Item_revision_id; + if (!rev_id.Equals(itemRev2)) + { + ed1.WriteMessage("Item[" + itemID + "]ûжӦ[" + itemRev2 + "]汾\n"); + continue; + } + ed1.WriteMessage("Item[" + itemID + "]ҵӦ[" + itemRev2 + "]汾\n"); + + ReleaseStatus[] releaselist = itemRev.Release_status_list; + // if (!itemRev.Is_modifiable) + // { + // MessageBox.Show("ItemRevisionΪֻ,ûбȨ!"); + // return; + // } + //if (releaselist.Length > 0) + //{ + // string message = "Item IDΪ" + itemRev.Item_id + "°汾ѷ"; + // MessageBox.Show(message); + // return; + //} + + if (btlinfo.Btltypetable.ContainsValue("ItemRevision")) + { + ed1.WriteMessage("ͬItemRevision\n"); + + foreach (DictionaryEntry de in btlinfo.Btltypetable) + { + if (de.Value.ToString() == "ItemRevision" && btlinfo.Btlfromtctable[de.Key].ToString() == "1") + { + string cadstring = de.Key.ToString(); + string cadvalue = btlinfo.Btldatatable[cadstring].ToString(); + string tcstring = btlinfo.Btltctable[cadstring].ToString(); + + ed1.WriteMessage("ȡ" + tcstring + "\n"); + string[] props = new string[1]; + props[0] = tcstring; + ServiceData serviceData = dmService.GetProperties(objects2, props); + if (serviceData.sizeOfPartialErrors() > 0) + { + continue; + } + Property my_prop = itemRev.GetProperty(tcstring); + string tempcadvalue = my_prop.StringValue.ToString(); + ed1.WriteMessage("TCϵͳе" + tcstring + "ֵΪ " + tempcadvalue + "\n"); + if (cadvalue != tempcadvalue) + { + if (!cadstring.Equals("U8")) + { + origintool.TableHasKey(tempvaluetable, cadstring, tempcadvalue); + } + else + { + origintool.TableHasKey(u8valuetable, cadstring, tempcadvalue); + } + } + } + } + } + + //ð汾ϵ + FormInfo forminfo = new FormInfo(); + FormInfo[] forminfo_vec = new FormInfo[1]; + ModelObject[] form_vec; + + form_vec = itemRev.IMAN_master_form_rev; + dmService.RefreshObjects(form_vec); + for (int k = 0; k < form_vec.Length; k++) + { + Form form = form_vec[k] as Form; + if (btlinfo.Btltypetable.ContainsValue("Form")) + { + ed1.WriteMessage("ͬItemRevision\n"); + + foreach (DictionaryEntry de in btlinfo.Btltypetable) + { + if (de.Value.ToString() == "Form" && btlinfo.Btlfromtctable[de.Key].ToString() == "1") + { + string cadstring = de.Key.ToString(); + string cadvalue = btlinfo.Btldatatable[cadstring].ToString(); + string tcstring = btlinfo.Btltctable[cadstring].ToString(); + + ed1.WriteMessage("ȡ" + tcstring + "\n"); + string[] props = new string[1]; + props[0] = tcstring; + ServiceData serviceData = dmService.GetProperties(form_vec, props); + if (serviceData.sizeOfPartialErrors() > 0) + { + continue; + } + Property my_prop = form.GetProperty(tcstring); + string tempcadvalue = my_prop.StringValue.ToString(); + ed1.WriteMessage("TCϵͳе" + tcstring + "ֵΪ " + tempcadvalue + "\n"); + if (cadvalue != tempcadvalue) + { + origintool.TableHasKey(tempvaluetable, cadstring, tempcadvalue); + } + } + } + } + } + } + //ѾҪͬռ + foreach (DictionaryEntry de in tempvaluetable) + { + ed1.WriteMessage("CAD:" + de.Key.ToString() + "\tֵ:" + de.Value.ToString() + "\n"); + } + ed1.WriteMessage("Btlname=" + btlinfo.Btlname + "\n"); + string btlname = btlinfo.Btlname; + //дCADͼֽ + origintool.SetTitleInfo_open(btlinfo.Btlname, tempvaluetable);// + + break; + } + } + } + } + } + } + + + + } +} \ No newline at end of file diff --git a/hello/HomeFolder.cs b/hello/HomeFolder.cs new file mode 100644 index 0000000..d597ace --- /dev/null +++ b/hello/HomeFolder.cs @@ -0,0 +1,79 @@ +//================================================== +// +// @@ +// +//================================================== + +using System; + +using Teamcenter.ClientX; +using Teamcenter.Services.Strong.Core; +using Teamcenter.Soa.Client.Model; +using Teamcenter.Soa.Exceptions; + +using User = Teamcenter.Soa.Client.Model.Strong.User; +using Folder = Teamcenter.Soa.Client.Model.Strong.Folder; +using WorkspaceObject = Teamcenter.Soa.Client.Model.Strong.WorkspaceObject; + +namespace Teamcenter.Hello +{ +public class HomeFolder +{ + + /** + * List the contents of the Home folder. + * + */ + public void listHomeFolder(User user) + { + Folder home = null; + WorkspaceObject[] contents = null; + + // Get the service stub + DataManagementService dmService = DataManagementService.getService(Session.getConnection()); + + try + { + // User was a primary object returned from the login command + // the Object Property Policy should be configured to include the + // 'home_folder' property. However the actuall 'home_folder' object + // was a secondary object returned from the login request and + // therefore does not have any properties associated with it. We will need to + // get those properties explicitly with a 'getProperties' service request. + home = user.Home_folder; + } + catch (NotLoadedException e) + { + Console.Out.WriteLine(e.Message); + Console.Out.WriteLine("The Object Property Policy ($TC_DATA/soa/policies/Default.xml) is not configured with this property."); + return; + } + + try + { + ModelObject[] objects = { home }; + String[] attributes = { "contents" }; + + // ***************************** + // Execute the service operation + // ***************************** + dmService.GetProperties(objects, attributes); + + + // The above getProperties call returns a ServiceData object, but it + // just has pointers to the same object we passed into the method, so the + // input object have been updated with new property values + contents = home.Contents; + } + // This should never be thrown, since we just explicitly asked for this + // property + catch (NotLoadedException /*e*/){} + + Console.Out.WriteLine(""); + Console.Out.WriteLine("Home Folder:"); + Session.printObjects( contents ); + + } + +} +} diff --git a/hello/ItemMsgBean.cs b/hello/ItemMsgBean.cs new file mode 100644 index 0000000..2d7a089 --- /dev/null +++ b/hello/ItemMsgBean.cs @@ -0,0 +1,44 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace HelloTeamcenter.hello +{ + class ItemMsgBean + { + + private String itemId ;//零组件id + private String itemRev ;//零组件版本 + /// + /// 获取和得到id的方法 + /// + public String ItemId { + set { + itemId = value; + } + get { + return itemId; + } + + } + + /// + /// 获取和得到版本的方法 + /// + public String ItemRev { + + set + { + itemRev = value; + } + get + { + return itemRev; + } + } + } + + + +} diff --git a/hello/MXLClass.cs b/hello/MXLClass.cs new file mode 100644 index 0000000..ae2cd73 --- /dev/null +++ b/hello/MXLClass.cs @@ -0,0 +1,101 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace HelloTeamcenter.hello +{ + public class MXLClass + { + private string index; + + public string Index + { + get { return index; } + set { index = value; } + } + private string item_id; + + public string Item_id + { + get { return item_id; } + set { item_id = value; } + } + private string partnumber; + + public string Partnumber + { + get { return partnumber; } + set { partnumber = value; } + } + private string name; + + public string Name + { + get { return name; } + set { name = value; } + } + private string object_desc; + + public string Object_desc + { + get { return object_desc; } + set { object_desc = value; } + } + private string count; + + public string Count + { + get { return count; } + set { count = value; } + } + private string material; + + public string Material + { + get { return material; } + set { material = value; } + } + private string tolweight; + + public string Tolweight + { + get { return tolweight; } + set { tolweight = value; } + } + private string perweight; + + public string Perweight + { + get { return perweight; } + set { perweight = value; } + } + private string memo; + + public string Memo + { + get { return memo; } + set { memo = value; } + } + private string itemtype; + + public string Itemtype + { + get { return itemtype; } + set { itemtype = value; } + } + private int index_num; + + public int Index_num + { + get { return index_num; } + set { index_num = value; } + } + private string producttype; + + public string Producttype + { + get { return producttype; } + set { producttype = value; } + } + } +} diff --git a/hello/MyExtension.cs b/hello/MyExtension.cs new file mode 100644 index 0000000..41f37d8 --- /dev/null +++ b/hello/MyExtension.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Text; + +using ZwSoft.ZwCAD.DatabaseServices; +using ZwSoft.ZwCAD.Runtime; +using ZwSoft.ZwCAD.Geometry; +using ZwSoft.ZwCAD.ApplicationServices; +using ZwSoft.ZwCAD.EditorInput; +using ZwSoft.ZwCAD.Windows; + +namespace HelloTeamcenter.hello +{ + class MyExtension:ZwSoft.ZwCAD.Runtime.IExtensionApplication + { + public void Initialize() + { + + } + public void Terminate() + { + + } + } +} diff --git a/hello/OriginBTL.cs b/hello/OriginBTL.cs new file mode 100644 index 0000000..719c16c --- /dev/null +++ b/hello/OriginBTL.cs @@ -0,0 +1,87 @@ +using System; +using System.Collections.Generic; +using System.Collections; +using System.Text; + +namespace HelloTeamcenter.hello +{ + public class OriginBTL + { + private Hashtable btlinfotable = null; // 块参照上所有信息 + + public Hashtable Btlinfotable + { + get { return btlinfotable; } + set { btlinfotable = value; } + } + + + public OriginBTL() + { + this.btlname = ""; + this.btlinfotable = new Hashtable(); + this.btldatatable = new Hashtable(); + this.btltctable = new Hashtable(); + this.btltypetable = new Hashtable(); + this.btlwritetable = new Hashtable(); + this.Btlupdatetable = new Hashtable(); + this.Btlfromtctable = new Hashtable(); + } + + private string btlname; //标题栏块参照名 + + public string Btlname + { + get { return btlname; } + set { btlname = value; } + } + private Hashtable btldatatable = null; // + + public Hashtable Btldatatable + { + get { return btldatatable; } + set { btldatatable = value; } + } + private Hashtable btltctable = null; // + + public Hashtable Btltctable + { + get { return btltctable; } + set { btltctable = value; } + } + private Hashtable btltypetable = null; // + + public Hashtable Btltypetable + { + get { return btltypetable; } + set { btltypetable = value; } + } + + private Hashtable btlwritetable = null; // + + public Hashtable Btlwritetable + { + get { return btlwritetable; } + set { btlwritetable = value; } + } + + + private Hashtable btlupdatetable = null; // + + public Hashtable Btlupdatetable + { + get { return btlupdatetable; } + set { btlupdatetable = value; } + } + + private Hashtable btlfromtctable = null; // + + public Hashtable Btlfromtctable + { + get { return btlfromtctable; } + set { btlfromtctable = value; } + } + + + } +} diff --git a/hello/OriginDataSet.cs b/hello/OriginDataSet.cs new file mode 100644 index 0000000..155e3eb --- /dev/null +++ b/hello/OriginDataSet.cs @@ -0,0 +1,58 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.Collections; + +namespace HelloTeamcenter.hello +{ + class OriginDataSet + { + private string datatype = null; + + public string Datatype + { + get { return datatype; } + set { datatype = value; } + } + private string refname = null; + + public string Refname + { + get { return refname; } + set { refname = value; } + } + private string separator = null; + + public string Separator + { + get { return separator; } + set { separator = value; } + } + private string ds_name = null; + + public string Ds_name + { + get { return ds_name; } + set { ds_name = value; } + } + + public OriginDataSet() + { + this.datatype = ""; + this.refname = ""; + this.separator = ""; + this.ds_name = ""; + this.dsnametable = new Hashtable(); + } + + private Hashtable dsnametable = null; + + public Hashtable Dsnametable + { + get { return dsnametable; } + set { dsnametable = value; } + } + + + } +} diff --git a/hello/OriginItemType.cs b/hello/OriginItemType.cs new file mode 100644 index 0000000..90f110e --- /dev/null +++ b/hello/OriginItemType.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.Collections; + +namespace HelloTeamcenter.hello +{ + class OriginItemType + { + private Hashtable itemtypetable = null; //记录Item类型.xml文件的信息 + + public Hashtable Itemtypetable + { + get { return itemtypetable; } + set { itemtypetable = value; } + } + + public OriginItemType() + { + itemtypetable = new Hashtable(); + } + + public void getType(string xmlpath) + { + OriginReadXml originreadxml = new OriginReadXml(); + itemtypetable = originreadxml.OriginReadTypeXML(xmlpath, itemtypetable); + } + + } +} diff --git a/hello/OriginMXL.cs b/hello/OriginMXL.cs new file mode 100644 index 0000000..9ac3f02 --- /dev/null +++ b/hello/OriginMXL.cs @@ -0,0 +1,77 @@ +using System; +using System.Collections.Generic; +using System.Collections; +using System.Text; + + +namespace HelloTeamcenter.hello +{ + public class OriginMXL + { + + public OriginMXL() + { + this.mxlname = ""; + this.Mxlinfotable = new Hashtable(); + this.Mxldatatable = new Hashtable(); + this.Mxltctable = new Hashtable(); + this.Mxlisbomtable = new Hashtable(); + this.Mxlupdatetable = new Hashtable(); + this.Mxltypetable = new Hashtable(); + } + + + private string mxlname; //明细栏块参照名 + + public string Mxlname + { + get { return mxlname; } + set { mxlname = value; } + } + + private Hashtable mxlinfotable = null; //块参照上所有信息 + + public Hashtable Mxlinfotable + { + get { return mxlinfotable; } + set { mxlinfotable = value; } + } + + private Hashtable mxldatatable = null; // + + public Hashtable Mxldatatable + { + get { return mxldatatable; } + set { mxldatatable = value; } + } + private Hashtable mxltctable = null; // + + public Hashtable Mxltctable + { + get { return mxltctable; } + set { mxltctable = value; } + } + private Hashtable mxlisbomtable = null; // + + public Hashtable Mxlisbomtable + { + get { return mxlisbomtable; } + set { mxlisbomtable = value; } + } + private Hashtable mxlupdatetable = null;// + + public Hashtable Mxlupdatetable + { + get { return mxlupdatetable; } + set { mxlupdatetable = value; } + } + + private Hashtable mxltypetable = null; // + + public Hashtable Mxltypetable + { + get { return mxltypetable; } + set { mxltypetable = value; } + } + } +} diff --git a/hello/OriginReadXml.cs b/hello/OriginReadXml.cs new file mode 100644 index 0000000..264d27a --- /dev/null +++ b/hello/OriginReadXml.cs @@ -0,0 +1,605 @@ +using System; +using System.Collections.Generic; +using System.Collections; +using System.Text; +using System.Xml; +using ZwSoft.ZwCAD.DatabaseServices; +using ZwSoft.ZwCAD.Runtime; +using ZwSoft.ZwCAD.Geometry; +using ZwSoft.ZwCAD.ApplicationServices; +using ZwSoft.ZwCAD.EditorInput; + +namespace HelloTeamcenter.hello +{ + class OriginReadXml + { + private Editor ed = ZwSoft.ZwCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; + + public OriginBTL OriginReadBTL(string filepath,string btlname) + { + OriginBTL btlinfo = new OriginBTL(); + XmlReaderSettings settings = null; + XmlDocument xmldocument = null; + XmlReader xmlreader = null; + try + { + ed.WriteMessage("XML路径:" + filepath + "\n"); + + settings = new XmlReaderSettings(); + settings.IgnoreComments = true; ;//忽略文档里面的注释 + xmldocument = new XmlDocument(); + xmlreader = XmlReader.Create(filepath, settings); + xmldocument.Load(xmlreader); + //得到根节点的子节点title + XmlNodeList xmltitlelist = xmldocument.SelectSingleNode("Titles").ChildNodes; + + OriginTool origintool = new OriginTool(); + + foreach (XmlNode title in xmltitlelist) + { + //获得一个title + XmlElement xeonetitle = (XmlElement)title; + + if (xeonetitle.HasAttribute("blockname")) + { + ed.WriteMessage("标题栏块名称:" + xeonetitle.GetAttribute("blockname").ToString() + "\n"); + } + else + { + ed.WriteMessage("请确认标题栏.xml文件配置含有blockname属性\n"); + return null; + } + string tempbtlname = xeonetitle.GetAttribute("blockname").ToString(); + ed.WriteMessage("标题栏块名称:" + tempbtlname + "\n"); + + if (tempbtlname == btlname) + { + //获得title子节点 + XmlNodeList onetitleinfo = xeonetitle.ChildNodes; + + btlinfo.Btlname = btlname; + foreach (XmlNode node in onetitleinfo) + { + XmlElement xeone = (XmlElement)node; + string titletype = ""; + string titlecad = ""; + string titletc = ""; + string titlewriteable = ""; + string titleupdateable = ""; + string titlefromtc = ""; + if (xeone.HasAttribute("type")) + { + titletype = xeone.GetAttribute("type").ToString(); + } + if (xeone.HasAttribute("cad")) + { + titlecad = xeone.GetAttribute("cad").ToString(); + ed.WriteMessage("CAD ATTR =" + titlecad + "\n"); + } + if (xeone.HasAttribute("tc")) + { + titletc = xeone.GetAttribute("tc").ToString(); + } + if (xeone.HasAttribute("writeable")) + { + titlewriteable = xeone.GetAttribute("writeable").ToString(); + } + if (xeone.HasAttribute("updateable")) + { + titleupdateable = xeone.GetAttribute("updateable").ToString(); + } + if (xeone.HasAttribute("fromtc")) + { + titlefromtc = xeone.GetAttribute("fromtc").ToString(); + } + /*ed.WriteMessage(xeone.GetAttribute("type").ToString() + " " + + xeone.GetAttribute("cad").ToString() + " " + + xeone.GetAttribute("tc").ToString() +"\n");*/ + btlinfo.Btldatatable = origintool.TableHasKey(btlinfo.Btldatatable, titlecad, ""); + btlinfo.Btltctable = origintool.TableHasKey(btlinfo.Btltctable, titlecad, titletc); + btlinfo.Btltypetable = origintool.TableHasKey(btlinfo.Btltypetable, titlecad, titletype); + btlinfo.Btlwritetable = origintool.TableHasKey(btlinfo.Btlwritetable, titlecad, titlewriteable); + btlinfo.Btlupdatetable = origintool.TableHasKey(btlinfo.Btlupdatetable, titlecad, titleupdateable); + btlinfo.Btlfromtctable = origintool.TableHasKey(btlinfo.Btlfromtctable,titlecad,titlefromtc); + } + } + } + } + catch (System.Exception ex) + { + xmlreader.Close(); + ed.WriteMessage(ex.Message + "\n"); + } + finally + { + xmlreader.Close(); + } + return btlinfo; + } + + //获取标题栏.XML信息,将信息与OriginBTL对应 + public ArrayList OriginReadBTLXML(string filepath) + { + ArrayList listbtl = new ArrayList(); + XmlReaderSettings settings = null; + XmlDocument xmldocument = null; + XmlReader xmlreader = null; + filepath = filepath + "标题栏.xml"; + try + { + ed.WriteMessage("XML路径:" + filepath + "\n"); + + settings = new XmlReaderSettings(); + settings.IgnoreComments = true; ;//忽略文档里面的注释 + xmldocument = new XmlDocument(); + xmlreader = XmlReader.Create(filepath, settings); + xmldocument.Load(xmlreader); + //得到根节点的子节点title + XmlNodeList xmltitlelist = xmldocument.SelectSingleNode("Titles").ChildNodes; + + OriginTool origintool = new OriginTool(); + + foreach (XmlNode title in xmltitlelist) + { + //获得一个title + XmlElement xeonetitle = (XmlElement)title; + + if (xeonetitle.HasAttribute("blockname")) + { + ed.WriteMessage("标题栏块名称:" + xeonetitle.GetAttribute("blockname").ToString() + "\n"); + } + else + { + ed.WriteMessage("请确认标题栏.xml文件配置含有blockname属性\n"); + return listbtl; + } + string btlname = xeonetitle.GetAttribute("blockname").ToString(); + ed.WriteMessage("标题栏块名称:" + btlname + "\n"); + + OriginBTL btlinfo = origintool.GetTitleInfo(filepath, btlname); + if (btlinfo != null) + listbtl.Add(btlinfo); + } + + } + catch (System.Exception ex) + { + xmlreader.Close(); + ed.WriteMessage(ex.Message+"\n"); + } + finally + { + xmlreader.Close(); + } + return listbtl; + } + + + public OriginMXL OriginReadMXL(string filepath) + { + OriginMXL mxlinfo = new OriginMXL(); + XmlReaderSettings settings = null; + XmlDocument xmldocument = null; + XmlReader xmlreader = null; + try + { + ed.WriteMessage("XML路径:" + filepath + "\n"); + + settings = new XmlReaderSettings(); + settings.IgnoreComments = true; ;//忽略文档里面的注释 + xmldocument = new XmlDocument(); + xmlreader = XmlReader.Create(filepath, settings); + xmldocument.Load(xmlreader); + //得到根节点的子节点bomline + XmlNodeList xmlmxllist = xmldocument.SelectSingleNode("BomLines").ChildNodes; + OriginTool origintool = new OriginTool(); + foreach (XmlNode bomline in xmlmxllist) + { + //获得一个bomline + XmlElement xeonebomline = (XmlElement)bomline; + if (xeonebomline.HasAttribute("blockname")) + { + ed.WriteMessage("明细栏块名称:" + xeonebomline.GetAttribute("blockname").ToString() + "\n"); + } + else + { + ed.WriteMessage("请确认明细表.xml文件配置含有blockname属性\n"); + return null; + } + //获得bomline子节点 + XmlNodeList onebomlineinfo = xeonebomline.ChildNodes; + + mxlinfo.Mxlname = xeonebomline.GetAttribute("blockname").ToString(); + foreach (XmlNode node in onebomlineinfo) + { + XmlElement xeone = (XmlElement)node; + + /*ed.WriteMessage(xeone.GetAttribute("cad").ToString() + " " + + xeone.GetAttribute("tc").ToString() + " " + + xeone.GetAttribute("is_bomline").ToString() + " " + + xeone.GetAttribute("overwrite").ToString() + "\n");*/ + string bomlinetype = ""; + string bomlinecad = ""; + string bomlinetc = ""; + string isbomline = ""; + string updatebomline = ""; + + if (xeone.HasAttribute("type")) + { + bomlinetype = xeone.GetAttribute("type").ToString(); + } + if (xeone.HasAttribute("cad")) + { + bomlinecad = xeone.GetAttribute("cad").ToString(); + } + if (xeone.HasAttribute("tc")) + { + bomlinetc = xeone.GetAttribute("tc").ToString(); + } + if (xeone.HasAttribute("is_bomline")) + { + isbomline = xeone.GetAttribute("is_bomline").ToString(); + } + if (xeone.HasAttribute("overwrite")) + { + updatebomline = xeone.GetAttribute("overwrite").ToString(); + } + mxlinfo.Mxltypetable = origintool.TableHasKey(mxlinfo.Mxltypetable, bomlinecad, bomlinetype); + mxlinfo.Mxldatatable = origintool.TableHasKey(mxlinfo.Mxldatatable, bomlinecad, ""); + mxlinfo.Mxltctable = origintool.TableHasKey(mxlinfo.Mxltctable, bomlinecad, bomlinetc); + mxlinfo.Mxlisbomtable = origintool.TableHasKey(mxlinfo.Mxlisbomtable, bomlinecad, isbomline); + mxlinfo.Mxlupdatetable = origintool.TableHasKey(mxlinfo.Mxlupdatetable, bomlinecad, updatebomline); + + ed.WriteMessage("==================================\n"); + } + } + + } + catch (System.Exception ex) + { + xmlreader.Close(); + ed.WriteMessage(ex.Message + "\n"); + } + finally + { + xmlreader.Close(); + } + return mxlinfo; + } + + + + //获取明细表.XML信息,将信息与OriginMXL对应 + public List OriginReadMXLXML(string filepath) + { + List listmxl = new List(); + XmlReaderSettings settings = null; + XmlDocument xmldocument = null; + XmlReader xmlreader = null; + filepath = filepath + "明细表.xml"; + try + { + ed.WriteMessage("XML路径:" + filepath + "\n"); + + settings = new XmlReaderSettings(); + settings.IgnoreComments = true; ;//忽略文档里面的注释 + xmldocument = new XmlDocument(); + xmlreader = XmlReader.Create(filepath, settings); + xmldocument.Load(xmlreader); + //得到根节点的子节点bomline + XmlNodeList xmlmxllist = xmldocument.SelectSingleNode("BomLines").ChildNodes; + + OriginTool origintool = new OriginTool(); + string mxlname = ""; + + foreach (XmlNode bomline in xmlmxllist) + { + //获得一个bomline + XmlElement xeonebomline = (XmlElement)bomline; + if (xeonebomline.HasAttribute("blockname")) + { + ed.WriteMessage("明细栏块名称:" + xeonebomline.GetAttribute("blockname").ToString() + "\n"); + mxlname = xeonebomline.GetAttribute("blockname").ToString(); + } + else + { + ed.WriteMessage("请确认明细表.xml文件配置含有blockname属性\n"); + return null; + } + } + + listmxl = origintool.GetMXLInfo(filepath, mxlname); + + + } + catch (System.Exception ex) + { + xmlreader.Close(); + ed.WriteMessage(ex.Message + "\n"); + } + finally + { + xmlreader.Close(); + } + + return listmxl; + } + + + + //获取Item类型.xml文件信息 + public Hashtable OriginReadTypeXML(string filepath,Hashtable itemtypetable) + { + + XmlReaderSettings settings = null; + XmlDocument xmldocument = null; + XmlReader xmlreader = null; + filepath = filepath + "Item类型.xml"; + try + { + ed.WriteMessage("XML路径:" + filepath + "\n"); + + settings = new XmlReaderSettings(); + settings.IgnoreComments = true; ;//忽略文档里面的注释 + xmldocument = new XmlDocument(); + xmlreader = XmlReader.Create(filepath, settings); + xmldocument.Load(xmlreader); + //得到根节点的子节点ItemTypes + XmlNodeList xmltypelist = xmldocument.SelectSingleNode("ItemTypes").ChildNodes; + + OriginTool origintool = new OriginTool(); + + + foreach (XmlNode onetype in xmltypelist) + { + //获得一个ItemType + XmlElement xeonetype = (XmlElement)onetype; + //获得ItemType子节点 + XmlNodeList onetypeinfo = xeonetype.ChildNodes; + foreach (XmlNode node in onetypeinfo) + { + XmlElement xeone = (XmlElement)node; + //string typecad = ""; + string typetc = ""; + + //if (xeone.HasAttribute("cad")) + //{ + // typecad = xeone.GetAttribute("cad").ToString(); + //} + //else + // ed.WriteMessage("Item类型.xml文件配置不符合规范\n"); + if (xeone.HasAttribute("tc")) + { + typetc = xeone.GetAttribute("tc").ToString(); + } + else + ed.WriteMessage("Item类型.xml文件配置不符合规范\n"); + /*ed.WriteMessage(xeone.GetAttribute("type").ToString() + " " + + xeone.GetAttribute("cad").ToString() + " " + + xeone.GetAttribute("tc").ToString() +"\n");*/ + itemtypetable = origintool.TableHasKey(itemtypetable, typetc, typetc); + } + } + + } + catch (System.Exception ex) + { + xmlreader.Close(); + ed.WriteMessage(ex.Message + "\n"); + } + finally + { + xmlreader.Close(); + } + + return itemtypetable; + } + + + //获取Item类型.xml文件信息 + public OriginDataSet OriginReadDataSetXML(string filepath) + { + OriginDataSet dataset = new OriginDataSet(); + XmlReaderSettings settings = null; + XmlDocument xmldocument = null; + XmlReader xmlreader = null; + filepath = filepath + "数据集.xml"; + try + { + ed.WriteMessage("XML路径:" + filepath + "\n"); + + settings = new XmlReaderSettings(); + settings.IgnoreComments = true; ;//忽略文档里面的注释 + xmldocument = new XmlDocument(); + xmlreader = XmlReader.Create(filepath, settings); + xmldocument.Load(xmlreader); + //得到根节点的子节点ItemTypes + XmlNodeList xmldatalist = xmldocument.SelectSingleNode("DataSets").ChildNodes; + + OriginTool origintool = new OriginTool(); + + + foreach (XmlNode onedata in xmldatalist) + { + //获得一个data + XmlElement xeonedata = (XmlElement)onedata; + if (xeonedata.HasAttribute("type") && xeonedata.HasAttribute("refname") && xeonedata.HasAttribute("separator")) + { + dataset.Datatype = xeonedata.GetAttribute("type").ToString(); + dataset.Refname = xeonedata.GetAttribute("refname").ToString(); + dataset.Separator = xeonedata.GetAttribute("separator").ToString(); + ed.WriteMessage(dataset.Datatype + "\t" + dataset.Refname + "\t" + dataset.Separator + "\n"); + } + else + { + ed.WriteMessage("数据集.xml文件配置有误,请确认!\n"); + return null; + } + + //获得dataset子节点 + XmlNodeList onedatainfo = xeonedata.ChildNodes; + foreach (XmlNode node in onedatainfo) + { + XmlElement xeone = (XmlElement)node; + if (xeone.HasAttribute("seq") && xeone.HasAttribute("from")) + { + int seq = Convert.ToInt32(xeone.GetAttribute("seq").ToString()); + string from = xeone.GetAttribute("from").ToString(); + dataset.Dsnametable = origintool.TableHasKey(dataset.Dsnametable, seq, from); + ed.WriteMessage(seq+"\t"+from+"\n"); + } + } + } + + } + catch (System.Exception ex) + { + xmlreader.Close(); + ed.WriteMessage(ex.Message + "\n"); + } + finally + { + xmlreader.Close(); + } + + return dataset; + } + + + //获取规则.xml文件信息 + public OriginTypeRule OriginReadRuleXML(string filepath) + { + OriginTypeRule origintyperule = new OriginTypeRule(); + XmlReaderSettings settings = null; + XmlDocument xmldocument = null; + XmlReader xmlreader = null; + filepath = filepath + "规则.xml"; + try + { + ed.WriteMessage("XML路径:" + filepath + "\n"); + + settings = new XmlReaderSettings(); + settings.IgnoreComments = true; ;//忽略文档里面的注释 + xmldocument = new XmlDocument(); + xmlreader = XmlReader.Create(filepath, settings); + xmldocument.Load(xmlreader); + //得到根节点的子节点Rule + XmlNodeList xmlrulelist = xmldocument.SelectSingleNode("Rules").ChildNodes; + + OriginTool origintool = new OriginTool(); + + + foreach (XmlNode onerule in xmlrulelist) + { + //获得一个rule + XmlElement xeonerule = (XmlElement)onerule; + if (xeonerule.HasAttribute("default")) + { + origintyperule.Defaulttype = xeonerule.GetAttribute("default").ToString(); + ed.WriteMessage("默认类型:"+origintyperule.Defaulttype + "\n"); + } + else + { + origintyperule.Defaulttype = "Item"; + } + + //获得rule子节点 + XmlNodeList oneruleinfo = xeonerule.ChildNodes; + foreach (XmlNode node in oneruleinfo) + { + XmlElement xeone = (XmlElement)node; + if (xeone.HasAttribute("seq")) + { + int seq = Convert.ToInt32(xeone.GetAttribute("seq").ToString()); + ed.WriteMessage("序号" + seq + "\n"); + } + else + { + ed.WriteMessage("规则.xml文件中没有配置seq属性列,请检查配置\n"); + return null; + } + string seqstring = xeone.GetAttribute("seq").ToString(); + if (xeone.HasAttribute("source")) + { + string sourcestring = xeone.GetAttribute("source").ToString(); + ed.WriteMessage("序号:"+seqstring+"要处理的对象:" + sourcestring + "\n"); + origintyperule.Sourcetable = origintool.TableHasKey(origintyperule.Sourcetable, seqstring, sourcestring); + } + else + origintyperule.Sourcetable = origintool.TableHasKey(origintyperule.Sourcetable, seqstring, ""); + if (xeone.HasAttribute("startwith")) + { + string startstring = xeone.GetAttribute("startwith").ToString(); + ed.WriteMessage("序号:" + seqstring + "startwith:" + startstring + "\n"); + origintyperule.Starttable = origintool.TableHasKey(origintyperule.Starttable, seqstring, startstring); + } + else + origintyperule.Starttable = origintool.TableHasKey(origintyperule.Starttable, seqstring, ""); + if (xeone.HasAttribute("endwith")) + { + string endstring = xeone.GetAttribute("endwith").ToString(); + ed.WriteMessage("序号:" + seqstring + "endwith:" + endstring + "\n"); + origintyperule.Endtable = origintool.TableHasKey(origintyperule.Endtable, seqstring, endstring); + } + else + origintyperule.Endtable = origintool.TableHasKey(origintyperule.Endtable, seqstring, ""); + if (xeone.HasAttribute("contain")) + { + string containstring = xeone.GetAttribute("contain").ToString(); + ed.WriteMessage("序号:" + seqstring + "contain:" + containstring + "\n"); + origintyperule.Containtable = origintool.TableHasKey(origintyperule.Containtable,seqstring,containstring); + } + else + origintyperule.Containtable = origintool.TableHasKey(origintyperule.Containtable, seqstring, ""); + if (xeone.HasAttribute("equal")) + { + string equalstring = xeone.GetAttribute("equal").ToString(); + ed.WriteMessage("序号:" + seqstring + "equal:" + equalstring + "\n"); + origintyperule.Equaltable = origintool.TableHasKey(origintyperule.Equaltable,seqstring,equalstring); + } + else + origintyperule.Equaltable = origintool.TableHasKey(origintyperule.Equaltable, seqstring, ""); + if (xeone.HasAttribute("type")) + { + string typestring = xeone.GetAttribute("type").ToString(); + ed.WriteMessage("序号:" + seqstring + "type:" + typestring + "\n"); + origintyperule.Typetable = origintool.TableHasKey(origintyperule.Typetable,seqstring,typestring); + } + else + origintyperule.Typetable = origintool.TableHasKey(origintyperule.Typetable, seqstring, ""); + if (xeone.HasAttribute("true")) + { + string truestring = xeone.GetAttribute("true").ToString(); + ed.WriteMessage("序号:" + seqstring + "true:" + truestring + "\n"); + origintyperule.Truetable = origintool.TableHasKey(origintyperule.Truetable,seqstring,truestring); + } + else + origintyperule.Truetable = origintool.TableHasKey(origintyperule.Truetable, seqstring, ""); + if (xeone.HasAttribute("false")) + { + string falsestring = xeone.GetAttribute("false").ToString(); + ed.WriteMessage("序号:" + seqstring + "false:" + falsestring + "\n"); + origintyperule.Falsetable = origintool.TableHasKey(origintyperule.Falsetable,seqstring,falsestring); + } + else + origintyperule.Falsetable = origintool.TableHasKey(origintyperule.Falsetable, seqstring, ""); + } + } + + } + catch (System.Exception ex) + { + xmlreader.Close(); + ed.WriteMessage(ex.Message + "\n"); + } + finally + { + xmlreader.Close(); + } + return origintyperule; + } + + } + + +} diff --git a/hello/OriginTool.cs b/hello/OriginTool.cs new file mode 100644 index 0000000..689ca8a --- /dev/null +++ b/hello/OriginTool.cs @@ -0,0 +1,1689 @@ +using System; +using System.Collections.Generic; +using System.Collections; +using System.Text; +using System.IO; +using System.Data; +//using System.Windows.Forms; + +using ZwSoft.ZwCAD.DatabaseServices; +using ZwSoft.ZwCAD.Runtime; +using ZwSoft.ZwCAD.Geometry; +using ZwSoft.ZwCAD.ApplicationServices; +using ZwSoft.ZwCAD.EditorInput; + +using Teamcenter.Services.Strong.Query._2007_06.SavedQuery; +using Teamcenter.Hello; +using Teamcenter.Soa.Client; +using Teamcenter.ClientX; +using Teamcenter.Services.Strong.Core; +using Teamcenter.Soa.Client.Model; +using Teamcenter.Soa.Exceptions; +using Teamcenter.Services.Strong.Query; + +using Teamcenter.Services.Strong.Core._2007_06.DataManagement; +using Teamcenter.Schemas.Soa._2006_03.Exceptions; +using Teamcenter.Services.Strong.Query._2006_03.SavedQuery; + +using User = Teamcenter.Soa.Client.Model.Strong.User; +using Folder = Teamcenter.Soa.Client.Model.Strong.Folder; +using WorkspaceObject = Teamcenter.Soa.Client.Model.Strong.WorkspaceObject; +using ImanFile = Teamcenter.Soa.Client.Model.Strong.ImanFile; +using Item = Teamcenter.Soa.Client.Model.Strong.Item; +using ItemRevision = Teamcenter.Soa.Client.Model.Strong.ItemRevision; +using ImanQuery = Teamcenter.Soa.Client.Model.Strong.ImanQuery; +using DataSet = Teamcenter.Soa.Client.Model.Strong.Dataset; + +using SavedQueryResults = Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryResults; +namespace HelloTeamcenter.hello +{ + public class SortMXL1 : IComparer + { + public int Compare(OriginMXL one, OriginMXL two) + { + return (Convert.ToInt32(one.Mxldatatable["序号"].ToString())).CompareTo((Convert.ToInt32(two.Mxldatatable["序号"].ToString()))); + } + } + + + class OriginTool + { + + private Editor ed = ZwSoft.ZwCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; + private static User loginuser; + + public static User Loginuser + { + get { return OriginTool.loginuser; } + set { OriginTool.loginuser = value; } + } + + //获取标题栏信息 + public OriginBTL GetTitleInfo(string filepath,string btlname) + { + //OriginTool origintool = new OriginTool(); + OriginBTL btlinfo = new OriginBTL(); + OriginReadXml originreadxml = new OriginReadXml(); + btlinfo = originreadxml.OriginReadBTL(filepath,btlname); + if(btlinfo ==null) + return null; + + Database db = HostApplicationServices.WorkingDatabase; + using (Transaction tran = db.TransactionManager.StartTransaction()) + { + BlockTable blt = tran.GetObject(db.BlockTableId, OpenMode.ForRead) as BlockTable; + if (blt.Has(btlname)) + { + BlockTableRecord bltr = tran.GetObject(db.CurrentSpaceId, OpenMode.ForRead) as BlockTableRecord; + foreach (ObjectId item in bltr) + { + Entity ent = tran.GetObject(item, OpenMode.ForRead) as Entity; + if (ent.GetType().Name == "BlockReference") + { + BlockReference bref = (BlockReference)ent; + if (bref.Name == btlname) + { + ed.WriteMessage("块名称:" + bref.Name + "\n"); + if (bref.AttributeCollection.Count != 0) + { + System.Collections.IEnumerator bRefEnum = bref.AttributeCollection.GetEnumerator(); + while (bRefEnum.MoveNext()) + { + ObjectId aId = (ObjectId)bRefEnum.Current;//这一句极其关键 + + AttributeReference aRef = (AttributeReference)tran.GetObject(aId, OpenMode.ForRead); + if (btlinfo.Btldatatable.ContainsKey(aRef.Tag)) + { + btlinfo.Btldatatable = this.TableHasKey(btlinfo.Btldatatable, aRef.Tag, aRef.TextString); + } + + btlinfo.Btlinfotable = this.TableHasKey(btlinfo.Btlinfotable, aRef.Tag, aRef.TextString); + + } + } + } + } + } + } + tran.Commit(); + } + return btlinfo; + } + + + + public void SetTitleInfo(string btlname, Hashtable tempvaluetable) + { + Database db = HostApplicationServices.WorkingDatabase; + using (Transaction tran = db.TransactionManager.StartTransaction()) + { + BlockTable blt = tran.GetObject(db.BlockTableId, OpenMode.ForWrite) as BlockTable; + if (blt.Has(btlname)) + { + BlockTableRecord bltr = tran.GetObject(db.CurrentSpaceId, OpenMode.ForWrite) as BlockTableRecord; + foreach (ObjectId item in bltr) + { + Entity ent = tran.GetObject(item, OpenMode.ForWrite) as Entity; + if (ent.GetType().Name == "BlockReference") + { + BlockReference bref = (BlockReference)ent; + if (bref.Name == btlname) + { + ed.WriteMessage("块名称:" + bref.Name + "\n"); + if (bref.AttributeCollection.Count != 0) + { + System.Collections.IEnumerator bRefEnum = bref.AttributeCollection.GetEnumerator(); + while (bRefEnum.MoveNext()) + { + ObjectId aId = (ObjectId)bRefEnum.Current;//这一句极其关键 + + AttributeReference aRef = (AttributeReference)tran.GetObject(aId, OpenMode.ForWrite); + if (tempvaluetable.Contains(aRef.Tag.ToString())) + { + ed.WriteMessage("设置" + aRef.Tag.ToString() + "\t" + tempvaluetable[aRef.Tag.ToString()].ToString() + "\n"); + aRef.TextString = tempvaluetable[aRef.Tag.ToString()].ToString();//aRef.Tag.ToString().ToString(); + } + } + + } + + } + } + } + System.Windows.Forms.MessageBox.Show("属性同步结束!", "提示"); + } + tran.Commit(); + } + + } + + + public void SetTitleInfo_open(string btlname, Hashtable tempvaluetable) + { + ed.WriteMessage("1111\n"); + Document appodcTemp = ZwSoft.ZwCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument; + ZwSoft.ZwCAD.EditorInput.Editor cadEdit = appodcTemp.Editor; + using (appodcTemp.LockDocument()) + { + Database db = appodcTemp.Database; + using (Transaction tran = db.TransactionManager.StartTransaction()) + { + ed.WriteMessage("222\n"); + ed.WriteMessage("btlname:" + btlname + "\n"); + BlockTable blt = tran.GetObject(db.BlockTableId, OpenMode.ForWrite) as BlockTable; + ed.WriteMessage("btlname1:" + btlname + "\n"); + if (blt.Has(btlname)) + { + ed.WriteMessage("333\n"); + BlockTableRecord bltr = tran.GetObject(db.CurrentSpaceId, OpenMode.ForWrite) as BlockTableRecord; + foreach (ObjectId item in bltr) + { + ed.WriteMessage("444\n"); + Entity ent = tran.GetObject(item, OpenMode.ForWrite) as Entity; + if (ent.GetType().Name == "BlockReference") + { + ed.WriteMessage("555\n"); + BlockReference bref = (BlockReference)ent; + ed.WriteMessage("块名称1:" + bref.Name + "\n"); + if (bref.Name == btlname) + { + ed.WriteMessage("块名称:" + bref.Name + "\n"); + if (bref.AttributeCollection.Count != 0) + { + System.Collections.IEnumerator bRefEnum = bref.AttributeCollection.GetEnumerator(); + while (bRefEnum.MoveNext()) + { + ObjectId aId = (ObjectId)bRefEnum.Current;//这一句极其关键 + + AttributeReference aRef = (AttributeReference)tran.GetObject(aId, OpenMode.ForWrite); + if (tempvaluetable.Contains(aRef.Tag.ToString())) + { + ed.WriteMessage("设置" + aRef.Tag.ToString() + "\t" + tempvaluetable[aRef.Tag.ToString()].ToString() + "\n"); + aRef.TextString = tempvaluetable[aRef.Tag.ToString()].ToString();//aRef.Tag.ToString().ToString(); + } + } + + } + + } + } + } + System.Windows.Forms.MessageBox.Show("属性同步结束!", "提示"); + } + tran.Commit(); + } + } + + + } + + + public void SetTitleInfo_v1(string btlname, Hashtable tempvaluetable) + { + Database db = HostApplicationServices.WorkingDatabase; + using (Transaction tran = db.TransactionManager.StartTransaction()) + { + BlockTable blt = tran.GetObject(db.BlockTableId, OpenMode.ForWrite) as BlockTable; + if (blt.Has(btlname)) + { + BlockTableRecord bltr = tran.GetObject(db.CurrentSpaceId, OpenMode.ForWrite) as BlockTableRecord; + foreach (ObjectId item in bltr) + { + Entity ent = tran.GetObject(item, OpenMode.ForWrite) as Entity; + if (ent.GetType().Name == "BlockReference") + { + BlockReference bref = (BlockReference)ent; + if (bref.Name == btlname) + { + ed.WriteMessage("块名称:" + bref.Name + "\n"); + if (bref.AttributeCollection.Count != 0) + { + System.Collections.IEnumerator bRefEnum = bref.AttributeCollection.GetEnumerator(); + while (bRefEnum.MoveNext()) + { + ObjectId aId = (ObjectId)bRefEnum.Current;//这一句极其关键 + + AttributeReference aRef = (AttributeReference)tran.GetObject(aId, OpenMode.ForWrite); + if (tempvaluetable.Contains(aRef.Tag.ToString())) + { + ed.WriteMessage("设置" + aRef.Tag.ToString() + "\t" + tempvaluetable[aRef.Tag.ToString()].ToString() + "\n"); + aRef.TextString = tempvaluetable[aRef.Tag.ToString()].ToString();//aRef.Tag.ToString().ToString(); + } + } + } + } + } + } + //System.Windows.Forms.MessageBox.Show("属性同步结束!", "提示"); + } + tran.Commit(); + } + + } + + //判断当前table是否还有指定key值,如果有,则用新的value值替换 + public Hashtable TableHasKey(Hashtable target, object key, object value) + { + if(target.Contains(key)) + { + target.Remove(key); + } + target.Add(key, value); + + return target; + } + + + //获取明细栏信息 + public List GetMXLInfo(string filepath, string mxlname) + { + //OriginTool origintool = new OriginTool(); + List mxllist = new List(); + Database db = HostApplicationServices.WorkingDatabase; + using (Transaction tran = db.TransactionManager.StartTransaction()) + { + BlockTable blt = tran.GetObject(db.BlockTableId, OpenMode.ForRead) as BlockTable; + //string mxlname = mxlinfo.Mxlname; + if (blt.Has(mxlname)) + { + BlockTableRecord bltr = tran.GetObject(db.CurrentSpaceId, OpenMode.ForRead) as BlockTableRecord; + foreach (ObjectId item in bltr) + { + Entity ent = tran.GetObject(item, OpenMode.ForRead) as Entity; + if (ent.GetType().Name == "BlockReference") + { + BlockReference bref = (BlockReference)ent; + if (bref.Name == mxlname) + { + ed.WriteMessage("块名称:" + bref.Name + "\n"); + if (bref.AttributeCollection.Count != 0) + { + System.Collections.IEnumerator bRefEnum = bref.AttributeCollection.GetEnumerator(); + OriginMXL onemxlinfo = new OriginMXL(); + OriginReadXml originreadxml = new OriginReadXml(); + onemxlinfo = originreadxml.OriginReadMXL(filepath); + + + while (bRefEnum.MoveNext()) + { + ObjectId aId = (ObjectId)bRefEnum.Current;//这一句极其关键 + + AttributeReference aRef = (AttributeReference)tran.GetObject(aId, OpenMode.ForRead); + if (onemxlinfo.Mxldatatable.ContainsKey(aRef.Tag)) + { + onemxlinfo.Mxldatatable = this.TableHasKey(onemxlinfo.Mxldatatable, aRef.Tag, aRef.TextString); + } + + onemxlinfo.Mxlinfotable = this.TableHasKey(onemxlinfo.Mxlinfotable, aRef.Tag, aRef.TextString); + + } + + mxllist.Add(onemxlinfo); + } + } + } + } + } + tran.Commit(); + } + return mxllist; + } + + /// + /// + /// + /// + /// + public Boolean insertBomMXL(List bomMsgBeanList,Boolean eraseBOM) { + Boolean isOk = false; + String blockname = "XY_MXB"; + String btlBlockName = "XY_MXB1"; + // Database db = HostApplicationServices.WorkingDatabase; + Document acDoc = Application.DocumentManager.MdiActiveDocument; + Database acCurDb = acDoc.Database; + Editor ed = acDoc.Editor; + List pointList = new List(); + //删除所有的明细栏 + if (eraseBOM == true) + { + using (Transaction tran = acCurDb.TransactionManager.StartTransaction()) + { + ed.WriteMessage("删除明细栏 mxl \n"); + TypedValue[] typedValue = new TypedValue[1]; + typedValue.SetValue(new TypedValue((int)DxfCode.BlockName, blockname), 0); + SelectionFilter filter = new SelectionFilter(typedValue); + PromptSelectionResult result = ed.SelectAll(filter); + if (result.Status == PromptStatus.OK) + { + SelectionSet acSSet = result.Value; + foreach (ObjectId id in acSSet.GetObjectIds()) + { + Entity hatchobj = tran.GetObject(id, OpenMode.ForWrite) as Entity; + hatchobj.Erase();//删除 + } + } + typedValue.SetValue(new TypedValue((int)DxfCode.BlockName, btlBlockName), 0); + filter = new SelectionFilter(typedValue); + result = ed.SelectAll(filter); + if (result.Status == PromptStatus.OK) + { + SelectionSet acSSet = result.Value; + foreach (ObjectId id in acSSet.GetObjectIds()) + { + Entity hatchobj = tran.GetObject(id, OpenMode.ForWrite) as Entity; + hatchobj.Erase();//删除 + } + } + tran.Commit(); + } + } + + //获取存放明细表的块的位置 + using (Transaction tran = acCurDb.TransactionManager.StartTransaction()) + { + BlockTable block = tran.GetObject(acCurDb.BlockTableId, OpenMode.ForRead) as BlockTable; + ed.WriteMessage("获取明细栏 mxn \n"); + //查找存放明细栏的图框 + if (block.Has(btlBlockName)) + { + BlockTableRecord bltr = tran.GetObject(acCurDb.CurrentSpaceId, OpenMode.ForRead) as BlockTableRecord; + foreach (ObjectId item in bltr) + { + Entity ent = tran.GetObject(item, OpenMode.ForRead) as Entity; + if (ent.GetType().Name == "BlockReference") + { + BlockReference bref = (BlockReference)ent; + if (bref.Name == btlBlockName) + { + Point3d point = bref.Position; + pointList.Add(point); + ed.WriteMessage("X="+point.X+" | Y="+point.Y+" | Z="+point.Z +"\n"); + } + } + } + } + tran.Commit(); + } + //插入明细表 + //锁定文件 + using (acDoc.LockDocument()) + { + int lineCount = 0; + for (int i = 0; ; i++) + { + // ed.WriteMessage("================================================\n"); + // ed.WriteMessage("bomMsgBeanList.Count=====" + bomMsgBeanList.Count + "\n"); + // ed.WriteMessage("pointList.Count=====" + pointList.Count + "\n"); + // ed.WriteMessage("lineCount1=====" + lineCount + "\n"); + if (lineCount >= bomMsgBeanList.Count) + { + break; + } + + Point3d pointOrigin = new Point3d(0,0,0); + if (i >= pointList.Count) + { + + //pointList[i]; + PromptPointResult pPtRes = null; + PromptPointOptions pPtOpts = new PromptPointOptions(""); + pPtOpts.Message = "选取插入的点:"; + pPtRes = ed.GetPoint(pPtOpts); + + pointOrigin = pPtRes.Value; + ed.WriteMessage(" x=" + pointOrigin.X + " y=" + pointOrigin.Y + " z=" + pointOrigin.Z); + using (Transaction tran = acCurDb.TransactionManager.StartTransaction()) + { + BlockTable block = tran.GetObject(acCurDb.BlockTableId, OpenMode.ForRead) as BlockTable; + if (block.Has(btlBlockName)) + { + Point3d InsertPt = pointOrigin; + BlockTableRecord tableRec = tran.GetObject(acCurDb.CurrentSpaceId, OpenMode.ForWrite, false) as BlockTableRecord; + BlockTableRecord modelSpace = tran.GetObject(block[btlBlockName], OpenMode.ForRead, false) as BlockTableRecord; + BlockReference blockRef = new BlockReference(InsertPt, modelSpace.ObjectId); + + tableRec.AppendEntity(blockRef); + tran.AddNewlyCreatedDBObject(blockRef, true); + insertAttri(blockRef, tran, acCurDb, null); + ed.Regen(); + tran.Commit(); + } + } + } + else { + pointOrigin = pointList[i]; + //20240409如果选了否,需要选取插入点 + if (eraseBOM == false) + { + PromptPointResult pPtRes = null; + PromptPointOptions pPtOpts = new PromptPointOptions(""); + pPtOpts.Message = "选取插入的点2:"; + pPtRes = ed.GetPoint(pPtOpts); + + pointOrigin = pPtRes.Value; + pointOrigin = new Point3d(pointOrigin.X, pointOrigin.Y-12, pointOrigin.Z); + ed.WriteMessage(" x=" + pointOrigin.X + " y=" + pointOrigin.Y + " z=" + pointOrigin.Z); + } + + + + + } + //记录最大的明细栏的个数 + int maxCount = 0; + // ed.WriteMessage("lineCount3=====" + lineCount + "\n"); + for (int j = (lineCount==0?0:(lineCount + 1)); j < bomMsgBeanList.Count; j++) + { + lineCount = j+1; + // ed.WriteMessage("lineCount2=====" + lineCount + "\n"); + + using (Transaction tran = acCurDb.TransactionManager.StartTransaction()) + { + BlockTable block = tran.GetObject(acCurDb.BlockTableId, OpenMode.ForRead) as BlockTable; + if (block.Has(blockname)) + { + maxCount++; + //Point3d InsertPt = new Point3d((pointOrigin.X + 0.0331 ), (pointOrigin.Y + 14 -0.0224 + (maxCount-1) * 7), pointOrigin.Z); + Point3d InsertPt = new Point3d((pointOrigin.X + 0.0331 ), (pointOrigin.Y + 12 -0.0224 + (maxCount-1) * 7), pointOrigin.Z); + + BlockTableRecord tableRec = tran.GetObject(acCurDb.CurrentSpaceId, OpenMode.ForWrite,false) as BlockTableRecord; + BlockTableRecord modelSpace = tran.GetObject(block[blockname], OpenMode.ForRead,false) as BlockTableRecord; + + BlockReference blockRef = new BlockReference(InsertPt, modelSpace.ObjectId); + + tableRec.AppendEntity(blockRef); + tran.AddNewlyCreatedDBObject(blockRef, true); + insertAttri(blockRef,tran,acCurDb,bomMsgBeanList[j]); + ed.Regen(); + tran.Commit(); + } + } + if (maxCount == 929) {//20240319明细表读取到CAD直接一张表显示,不要分表分段; + break; + } + } + } + } + return isOk; + } + + /// + /// 设置块的属性 + /// + /// + /// + /// + /// + /* public void insertAttri(BlockReference br, Transaction tran,Database db,BomMsgBean bean) { + //TextStyleTableRecord textStyle=getTextStyle("明细栏短字体"); + BlockTableRecord btrec = tran.GetObject(br.BlockTableRecord, OpenMode.ForRead) as BlockTableRecord; + if (btrec.HasAttributeDefinitions) + { + // ed.WriteMessage("ppppp\n"); + AttributeCollection atcoll = br.AttributeCollection; + foreach(ObjectId id in btrec){ + DBObject obj = id.GetObject(OpenMode.ForRead) ; + if(obj is Entity){ + Entity ent = obj as Entity; + if (ent is AttributeDefinition) { + + AttributeDefinition attdef = ent as AttributeDefinition; + if (attdef!=null) + { + Boolean isChange = false; + double w = 100; + AttributeReference attref = new AttributeReference(); + attref.SetDatabaseDefaults(); + attref.SetAttributeFromBlock(attdef, br.BlockTransform); + attref.Position = attdef.Position.TransformBy(br.BlockTransform); + attref.Tag = attdef.Tag; + if (bean != null) + { + if (attref.Tag.Equals("序号")) + { + attref.TextString = bean.Index; + } + else if (attref.Tag.Equals("代号")) + { + String str= bean.CodeNo; + attref.TextString = str; + if (str.Length<17) + { + // w = str.Length * 20; + // isChange = true; + + attref.HorizontalMode = TextHorizontalMode.TextLeft; + + } + + } + else if (attref.Tag.Equals("名称")) + { + String str = bean.Name; + attref.TextString = str; + if (str.Length < 9) + { + w = str.Length * 20; + isChange = true; + attref.HorizontalMode = TextHorizontalMode.TextLeft; + } + } + else if (attref.Tag.Equals("数量")) + { + String str = bean.Quantity; + attref.TextString = str; + if (str.Length < 5) + { + w = str.Length * 20; + isChange = true; + attref.HorizontalMode = TextHorizontalMode.TextLeft; + } + + } + else if (attref.Tag.Equals("材料")) + { + + String str = bean.Material; + attref.TextString = str; + if (str.Length < 9) + { + w = str.Length * 20; + isChange = true; + attref.HorizontalMode = TextHorizontalMode.TextLeft; + } + } + else if (attref.Tag.Equals("单重")) + { + + String str = bean.Zhongliang; + attref.TextString = str; + if (str.Length < 5) + { + w = str.Length * 20; + isChange = true; + attref.HorizontalMode = TextHorizontalMode.TextLeft; + } + } + else if (attref.Tag.Equals("总重")) + { + + String str = bean.Zongzhong; + attref.TextString = str; + if (str.Length < 5) + { + w = str.Length * 20; + isChange = true; + attref.HorizontalMode = TextHorizontalMode.TextLeft; + } + + } + else if (attref.Tag.Equals("备注")) + { + String str = bean.Note; + attref.TextString = str; + if (str.Length < 6) + { + w = str.Length * 20; + isChange = true; + attref.HorizontalMode = TextHorizontalMode.TextLeft; + } + } + *//*else + { + attref.TextString = attdef.TextString; + } + *//* + } + else { + attref.TextString = attdef.TextString; + } + + + attref.AdjustAlignment(db);//20240515 + + + if (isChange) + { + //double aw = Math.Abs(attref.GeometricExtents.MaxPoint.X - attref.GeometricExtents.MinPoint.X); + //double factor = w / aw; + //ed.WriteMessage("w:" + w + "\n"); + //ed.WriteMessage("aw:" + aw + "\n"); + //ed.WriteMessage("factor:" + factor + "\n"); + attref.WidthFactor = 1; + } + atcoll.AppendAttribute(attref); + tran.AddNewlyCreatedDBObject(attref, true); + + + //ObjectId textStyleId = attref.TextStyle; + //TextStyleTableRecord textStyle = (TextStyleTableRecord)textStyleId.GetObject(OpenMode.ForWrite); + //textStyle.XScale = 1; + //textStyle.UpgradeOpen(); + //textStyle.DowngradeOpen(); + + + } + } + } + } + } + }*/ + + + + public void insertAttri(BlockReference br, Transaction tran, Database db, BomMsgBean bean) + { + //TextStyleTableRecord textStyle=getTextStyle("明细栏短字体"); + BlockTableRecord btrec = tran.GetObject(br.BlockTableRecord, OpenMode.ForRead) as BlockTableRecord; + if (btrec.HasAttributeDefinitions) + { + // ed.WriteMessage("ppppp\n"); + AttributeCollection atcoll = br.AttributeCollection; + foreach (ObjectId id in btrec) + { + DBObject obj = id.GetObject(OpenMode.ForRead); + if (obj is Entity) + { + Entity ent = obj as Entity; + if (ent is AttributeDefinition) + { + + AttributeDefinition attdef = ent as AttributeDefinition; + if (attdef != null) + { + Boolean isChange = false; + double w = 100; + AttributeReference attref = new AttributeReference(); + attref.SetDatabaseDefaults(); + attref.SetAttributeFromBlock(attdef, br.BlockTransform); + attref.Position = attdef.Position.TransformBy(br.BlockTransform); + attref.Tag = attdef.Tag; + if (bean != null) + { + if (attref.Tag.Equals("序号")) + { + attref.TextString = bean.Index; + } + else if (attref.Tag.Equals("代号")) + { + String str = bean.CodeNo; + attref.TextString = str; + if (str.Length < 17) + { + w = str.Length * 20; + isChange = true; + + attref.HorizontalMode = TextHorizontalMode.TextLeft; + + } + + } + else if (attref.Tag.Equals("名称")) + { + String str = bean.Name; + attref.TextString = str; + if (str.Length < 9) + { + w = str.Length * 20; + isChange = true; + attref.HorizontalMode = TextHorizontalMode.TextLeft; + } + } + else if (attref.Tag.Equals("数量")) + { + String str = bean.Quantity; + attref.TextString = str; + if (str.Length < 5) + { + w = str.Length * 20; + isChange = true; + attref.HorizontalMode = TextHorizontalMode.TextLeft; + } + + } + else if (attref.Tag.Equals("材料")) + { + + String str = bean.Material; + attref.TextString = str; + if (str.Length < 9) + { + w = str.Length * 20; + isChange = true; + attref.HorizontalMode = TextHorizontalMode.TextLeft; + } + } + else if (attref.Tag.Equals("单重")) + { + + String str = bean.Zhongliang; + attref.TextString = str; + if (str.Length < 5) + { + w = str.Length * 20; + isChange = true; + attref.HorizontalMode = TextHorizontalMode.TextLeft; + } + } + else if (attref.Tag.Equals("总重")) + { + + String str = bean.Zongzhong; + attref.TextString = str; + if (str.Length < 5) + { + w = str.Length * 20; + isChange = true; + attref.HorizontalMode = TextHorizontalMode.TextLeft; + } + + } + else if (attref.Tag.Equals("备注")) + { + String str = bean.Note; + attref.TextString = str; + if (str.Length < 6) + { + w = str.Length * 20; + isChange = true; + attref.HorizontalMode = TextHorizontalMode.TextLeft; + } + } + /*else + { + attref.TextString = attdef.TextString; + } + */ + } + else + { + attref.TextString = attdef.TextString; + } + + + attref.AdjustAlignment(db);//20240515 + + + if (isChange) + { + //double aw = Math.Abs(attref.GeometricExtents.MaxPoint.X - attref.GeometricExtents.MinPoint.X); + //double factor = w / aw; + //ed.WriteMessage("w:" + w + "\n"); + //ed.WriteMessage("aw:" + aw + "\n"); + //ed.WriteMessage("factor:" + factor + "\n"); + attref.WidthFactor = 1; + } + atcoll.AppendAttribute(attref); + tran.AddNewlyCreatedDBObject(attref, true); + + + //ObjectId textStyleId = attref.TextStyle; + //TextStyleTableRecord textStyle = (TextStyleTableRecord)textStyleId.GetObject(OpenMode.ForWrite); + //textStyle.XScale = 1; + //textStyle.UpgradeOpen(); + //textStyle.DowngradeOpen(); + + + } + } + } + } + } + } + + + + + + /// + /// 设置块的属性 + /// + /// + /// + /// + /// + /*public void insertAttri2(BlockReference br, Transaction tran, Database db, BomMsgBean bean) + { + BlockTableRecord btrec = tran.GetObject(br.BlockTableRecord, OpenMode.ForRead) as BlockTableRecord; + + if (btrec.HasAttributeDefinitions) + { + AttributeCollection atcoll = br.AttributeCollection; + + foreach (ObjectId id in btrec) + { + DBObject obj = id.GetObject(OpenMode.ForRead); + if (obj is Entity ent && ent is AttributeDefinition attdef) + { + // 创建属性引用 + AttributeReference attref = new AttributeReference(); + attref.SetDatabaseDefaults(); + attref.SetAttributeFromBlock(attdef, br.BlockTransform); + attref.Position = attdef.Position.TransformBy(br.BlockTransform); + attref.Tag = attdef.Tag; + + // 设置文本内容 + if (bean != null) + { + switch (attdef.Tag.ToUpper()) + { + case "序号": + attref.TextString = bean.Index; + break; + case "代号": + attref.TextString = bean.CodeNo; + break; + case "名称": + attref.TextString = bean.Name; + break; + case "数量": + attref.TextString = bean.Quantity; + break; + case "材料": + attref.TextString = bean.Material; + break; + case "单重": + attref.TextString = bean.Zhongliang; + break; + case "总重": + attref.TextString = bean.Zongzhong; + break; + case "备注": + attref.TextString = bean.Note; + break; + default: + attref.TextString = attdef.TextString; + break; + } + + // 强制设置宽度比例为1,防止缩放 + attref.WidthFactor = 1; + + // 可选:设置固定文字高度(单位由当前样式决定) + // attref.Height = 5.0; // 比如设置为5个图形单位 + + // 设置对齐方式(左对齐) + attref.HorizontalMode = TextHorizontalMode.TextLeft; + + // 注释掉这行以避免自动调整对齐导致缩放 + // attref.AdjustAlignment(db); + + // 添加属性引用到集合中 + atcoll.AppendAttribute(attref); + tran.AddNewlyCreatedDBObject(attref, true); + } + else + { + attref.TextString = attdef.TextString; + attref.WidthFactor = 1; + + attref.HorizontalMode = TextHorizontalMode.TextLeft; + // attref.AdjustAlignment(db); + + atcoll.AppendAttribute(attref); + tran.AddNewlyCreatedDBObject(attref, true); + } + } + } + } + }*/ + + + //获得当前图纸中已有字体样式 + public TextStyleTableRecord getTextStyle(string styleName) + { + ed.WriteMessage("获得当前图纸中已有字体样式\n"); + Database db = HostApplicationServices.WorkingDatabase; + using (Transaction trans = db.TransactionManager.StartTransaction()) + { + TextStyleTable tat = (TextStyleTable)db.TextStyleTableId.GetObject(OpenMode.ForRead); + foreach (ObjectId item in tat) + { + TextStyleTableRecord textStyle = (TextStyleTableRecord)item.GetObject(OpenMode.ForRead); + string name= textStyle.Name; + ed.WriteMessage("图纸中的字体:" + name + "\n"); + if (styleName.Equals(name)) + { + ed.WriteMessage("找到图纸中的字体:" + name + "\n"); + return textStyle; + } + } + } + return null; + + } + + + /// + /// + /// + /// + /// + /// + public void setBlockRefAttribute(BlockTableRecord modelSpace, Transaction tran,BomMsgBean bean) + { + ed.WriteMessage("aaaaaa\n"); + foreach (ObjectId id in modelSpace) + { + Entity ent = tran.GetObject(id, OpenMode.ForRead, false) as Entity; + if(ent is AttributeDefinition){ + ed.WriteMessage("bbbbb\n"); + //AttributeReference attriRef = new AttributeReference(); + AttributeDefinition attriDef = ent as AttributeDefinition; + ed.WriteMessage("Name = "+attriDef.TextStyleName + "\n"); + + + } + + } + + + } + + + //获取指定块参照名称中对应的属性值 + public string GetValueByBlock(string blockname,string attributename) + { + + string attrvalue = ""; + Database db = HostApplicationServices.WorkingDatabase; + using (Transaction tran = db.TransactionManager.StartTransaction()) + { + BlockTable block = tran.GetObject(db.BlockTableId, OpenMode.ForRead) as BlockTable; + //string mxlname = mxlinfo.Mxlname; + if (block.Has(blockname)) + { + BlockTableRecord bltr = tran.GetObject(db.CurrentSpaceId, OpenMode.ForRead) as BlockTableRecord; + foreach (ObjectId item in bltr) + { + Entity ent = tran.GetObject(item, OpenMode.ForRead) as Entity; + if (ent.GetType().Name == "BlockReference") + { + BlockReference bref = (BlockReference)ent; + if (bref.Name == blockname) + { + ed.WriteMessage("块名称:" + bref.Name + "\n"); + if (bref.AttributeCollection.Count != 0) + { + System.Collections.IEnumerator bRefEnum = bref.AttributeCollection.GetEnumerator(); + + while (bRefEnum.MoveNext()) + { + ObjectId aId = (ObjectId)bRefEnum.Current;//这一句极其关键 + + AttributeReference aRef = (AttributeReference)tran.GetObject(aId, OpenMode.ForRead); + if (aRef.Tag.ToString() == attributename) + { + attrvalue = aRef.TextString; + return attrvalue; + } + } + } + } + } + } + } + tran.Commit(); + } + return attrvalue; + } + + + //获取数据集.xml文件配置信息 + public OriginDataSet GetDataSetInfo(OriginDataSet dataset, OriginBTL btlinfo) + { + string ds_name = ""; + + for (int i = 1; i < dataset.Dsnametable.Count+1; i++) + { + string[] tempstring = dataset.Dsnametable[i].ToString().Split('.'); + string blockname = tempstring[0]; + string attributename = tempstring[1]; + if (blockname == btlinfo.Btlname) + { + if (btlinfo.Btlinfotable.ContainsKey(attributename)) + { + ds_name = ds_name + btlinfo.Btlinfotable[attributename].ToString(); + } + } + else + { + ds_name = ds_name + this.GetValueByBlock(blockname, attributename); + } + + } + ed.WriteMessage(ds_name+"\n"); + dataset.Ds_name = ds_name; + + return dataset; + } + + //对bomline进行排序 + public List sortbomlist(List sortbomlist) + { + sortbomlist.Sort(new SortMXL1()); + return sortbomlist; + } + + + /// + /// 搜索ItemRevision + /// + /// + /// + /// + public SavedQueryResults getSearchItemRev(String itemId ,String itemRev) { + ImanQuery query = null; + SavedQueryService queryService = SavedQueryService.getService(Session.getConnection()); + try + { + GetSavedQueriesResponse savedQueries = queryService.GetSavedQueries(); + if (savedQueries.Queries.Length == 0) + { + ed.WriteMessage("There are no saved queries in the system.\n"); + } + for (int i = 0; i < savedQueries.Queries.Length; i++) + { + + if (savedQueries.Queries[i].Name.Equals("OriginSearchItemRevID")) + { + query = savedQueries.Queries[i].Query; + break; + } + } + } + catch (ServiceException e) + { + ed.WriteMessage("GetSavedQueries service request failed.\n"); + ed.WriteMessage(e.Message); + return null; + } + + if (query == null) + { + ed.WriteMessage("There is not an 'OriginSearchItemRevID' query.\n"); + return null; + } + + try + { + ed.WriteMessage(" 'OriginSearchItemRevID' Item ID =" + itemId + " Item Rev = "+ itemRev+ ".\n"); + // Search for all Items, returning a maximum of 25 objects + Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryInput[] savedQueryInput = new Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryInput[1]; + savedQueryInput[0] = new Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryInput(); + savedQueryInput[0].Query = query; + savedQueryInput[0].Entries = new String[] { "Item ID","Revision ID" ,"active_sqe"}; + //savedQueryInput[0].Entries = new String[] { "零组件 ID" }; + savedQueryInput[0].Values = new String[3]; + savedQueryInput[0].Values[0] = itemId; + savedQueryInput[0].Values[1] = itemRev; + savedQueryInput[0].Values[2] = "0"; + Teamcenter.Services.Strong.Query._2007_06.SavedQuery.ExecuteSavedQueriesResponse savedQueryResult = queryService.ExecuteSavedQueries(savedQueryInput); + + Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryResults found = savedQueryResult.ArrayOfResults[0]; + + ed.WriteMessage("Found ItemRevs:" + found.NumOfObjects + "\n"); + return found; + } + catch (ServiceException e) + { + ed.WriteMessage("ExecuteSavedQuery service request failed.\n"); + ed.WriteMessage(e.Message); + return null; + } + } + + //根据item_id搜索 + public SavedQueryResults getSearchItem(string item_id) + { + ImanQuery query = null; + SavedQueryService queryService = SavedQueryService.getService(Session.getConnection()); + try + { + GetSavedQueriesResponse savedQueries = queryService.GetSavedQueries(); + if (savedQueries.Queries.Length == 0) + { + ed.WriteMessage("There are no saved queries in the system.\n"); + } + for (int i = 0; i < savedQueries.Queries.Length; i++) + { + + if (savedQueries.Queries[i].Name.Equals("OriginSearchItemID")) + { + query = savedQueries.Queries[i].Query; + break; + } + } + } + catch (ServiceException e) + { + ed.WriteMessage("GetSavedQueries service request failed.\n"); + ed.WriteMessage(e.Message); + return null; + } + + if (query == null) + { + ed.WriteMessage("There is not an 'OriginSearchItemID' query.\n"); + } + + try + { + ed.WriteMessage(" 'OriginSearchItemID' Item ID ="+item_id+".\n"); + // Search for all Items, returning a maximum of 25 objects + Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryInput[] savedQueryInput = new Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryInput[1]; + savedQueryInput[0] = new Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryInput(); + savedQueryInput[0].Query = query; + savedQueryInput[0].Entries = new String[] { "Item ID" }; + //savedQueryInput[0].Entries = new String[] { "零组件 ID" }; + savedQueryInput[0].Values = new String[1]; + savedQueryInput[0].Values[0] = item_id; + + Teamcenter.Services.Strong.Query._2007_06.SavedQuery.ExecuteSavedQueriesResponse savedQueryResult = queryService.ExecuteSavedQueries(savedQueryInput); + + Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryResults found = savedQueryResult.ArrayOfResults[0]; + + ed.WriteMessage("Found Items:" + found.NumOfObjects + "\n"); + return found; + } + catch (ServiceException e) + { + ed.WriteMessage("ExecuteSavedQuery service request failed.\n"); + ed.WriteMessage(e.Message); + return null; + } + } + + + //根据item_id,name,type,owner搜索 + public SavedQueryResults getSearchItem(string item_id, string name, string type, string owner) + { + ImanQuery query = null; + SavedQueryService queryService = SavedQueryService.getService(Session.getConnection()); + try + { + GetSavedQueriesResponse savedQueries = queryService.GetSavedQueries(); + if (savedQueries.Queries.Length == 0) + { + ed.WriteMessage("There are no saved queries in the system.\n"); + } + for (int i = 0; i < savedQueries.Queries.Length; i++) + { + + if (savedQueries.Queries[i].Name.Equals("OriginSearchForItem")) + { + query = savedQueries.Queries[i].Query; + break; + } + } + } + catch (ServiceException e) + { + ed.WriteMessage("GetSavedQueries service request failed.\n"); + ed.WriteMessage(e.Message); + return null; + } + + if (query == null) + { + ed.WriteMessage("There is not an 'OriginSearchForItem' query.\n"); + } + + try + { + Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryInput[] savedQueryInput = new Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryInput[1]; + savedQueryInput[0] = new Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryInput(); + savedQueryInput[0].Query = query; + savedQueryInput[0].Entries = new String[] { "Name", "Item ID", "Type", "Owning User" }; + //savedQueryInput[0].Entries = new String[] { "名称", "零组件 ID", "类型", "所有权用户" }; + savedQueryInput[0].Values = new String[4]; + savedQueryInput[0].Values[0] = name; + savedQueryInput[0].Values[1] = item_id; + savedQueryInput[0].Values[2] = type; + savedQueryInput[0].Values[3] = owner; + + Teamcenter.Services.Strong.Query._2007_06.SavedQuery.ExecuteSavedQueriesResponse savedQueryResult = queryService.ExecuteSavedQueries(savedQueryInput); + + Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryResults found = savedQueryResult.ArrayOfResults[0]; + + ed.WriteMessage("Found Items:" + found.NumOfObjects + "\n"); + return found; + } + catch (ServiceException e) + { + ed.WriteMessage("ExecuteSavedQuery service request failed.\n"); + ed.WriteMessage(e.Message); + return null; + } + } + + //根据item_id,name,type,owner搜索 + public SavedQueryResults getSearchItem(string item_id, string name) + { + ImanQuery query = null; + SavedQueryService queryService = SavedQueryService.getService(Session.getConnection()); + try + { + GetSavedQueriesResponse savedQueries = queryService.GetSavedQueries(); + if (savedQueries.Queries.Length == 0) + { + ed.WriteMessage("There are no saved queries in the system.\n"); + } + for (int i = 0; i < savedQueries.Queries.Length; i++) + { + + if (savedQueries.Queries[i].Name.Equals("OriginSearchForItem")) + { + query = savedQueries.Queries[i].Query; + break; + } + } + } + catch (ServiceException e) + { + ed.WriteMessage("GetSavedQueries service request failed.\n"); + ed.WriteMessage(e.Message); + return null; + } + + if (query == null) + { + ed.WriteMessage("There is not an 'OriginSearchForItem' query.\n"); + } + + try + { + Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryInput[] savedQueryInput = new Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryInput[1]; + savedQueryInput[0] = new Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryInput(); + savedQueryInput[0].Query = query; + savedQueryInput[0].Entries = new String[] { "Name", "Item ID" }; + //savedQueryInput[0].Entries = new String[] { "名称", "零组件 ID" }; + savedQueryInput[0].Values = new String[2]; + savedQueryInput[0].Values[0] = name; + savedQueryInput[0].Values[1] = item_id; + + + Teamcenter.Services.Strong.Query._2007_06.SavedQuery.ExecuteSavedQueriesResponse savedQueryResult = queryService.ExecuteSavedQueries(savedQueryInput); + + Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryResults found = savedQueryResult.ArrayOfResults[0]; + + ed.WriteMessage("Found Items:" + found.NumOfObjects + "\n"); + return found; + } + catch (ServiceException e) + { + ed.WriteMessage("ExecuteSavedQuery service request failed.\n"); + ed.WriteMessage(e.Message); + return null; + } + } + + //查询所有用户 + public SavedQueryResults getSearchUser() + { + ImanQuery query = null; + SavedQueryService queryService = SavedQueryService.getService(Session.getConnection()); + try + { + GetSavedQueriesResponse savedQueries = queryService.GetSavedQueries(); + if (savedQueries.Queries.Length == 0) + { + ed.WriteMessage("There are no saved queries in the system.\n"); + } + for (int i = 0; i < savedQueries.Queries.Length; i++) + { + + if (savedQueries.Queries[i].Name.Equals("OriginSearchForUser")) + { + query = savedQueries.Queries[i].Query; + break; + } + } + } + catch (ServiceException e) + { + ed.WriteMessage("GetSavedQueries service request failed.\n"); + ed.WriteMessage(e.Message); + return null; + } + + if (query == null) + { + ed.WriteMessage("There is not an 'OriginSearchForUser' query.\n"); + } + + try + { + // Search for all Items, returning a maximum of 25 objects + Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryInput[] savedQueryInput = new Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryInput[1]; + savedQueryInput[0] = new Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryInput(); + savedQueryInput[0].Query = query; + //savedQueryInput[0].Entries = new String[] { "User Id" }; + savedQueryInput[0].Entries = new String[] { "用户 ID" }; + savedQueryInput[0].Values = new String[1]; + savedQueryInput[0].Values[0] = "*"; + + Teamcenter.Services.Strong.Query._2007_06.SavedQuery.ExecuteSavedQueriesResponse savedQueryResult = queryService.ExecuteSavedQueries(savedQueryInput); + + Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryResults found = savedQueryResult.ArrayOfResults[0]; + + ed.WriteMessage("Found Users:" + found.NumOfObjects + "\n"); + return found; + } + catch (ServiceException e) + { + ed.WriteMessage("ExecuteSavedQuery service request failed.\n"); + ed.WriteMessage(e.Message); + return null; + } + } + + + //获得指定名称首选项:站点类型 + public Hashtable getTCPreferences(string prefername) + { + Hashtable prefValues = new Hashtable(); + SessionService sessionservice = SessionService.getService(Session.getConnection()); + Teamcenter.Services.Strong.Core._2007_01.Session.ScopedPreferenceNames[] prefNames = new Teamcenter.Services.Strong.Core._2007_01.Session.ScopedPreferenceNames[1]; + Teamcenter.Services.Strong.Core._2007_01.Session.ScopedPreferenceNames scopedPref = new Teamcenter.Services.Strong.Core._2007_01.Session.ScopedPreferenceNames(); + scopedPref.Names = new String[] { prefername }; + scopedPref.Scope = "site"; + prefNames[0] = scopedPref; + + + Teamcenter.Services.Strong.Core._2007_01.Session.MultiPreferencesResponse resp = sessionservice.GetPreferences(prefNames); + Teamcenter.Services.Strong.Core._2007_01.Session.ReturnedPreferences[] preferenceResp = resp.Preferences; + prefValues.Add(preferenceResp[0].Name, preferenceResp[0].Values); + //string temp = preferenceResp[0].Name.ToString(); + //string[] value = (string[])prefValues[preferenceResp[0].Name.ToString()]; + + return prefValues; + } + + + public bool checkxml(string xmlpath) + { + if (File.Exists(xmlpath + "标题栏.xml")) + ed.WriteMessage("标题栏.xml准备就绪\n"); + else + { + ed.WriteMessage("系统路径下不存在标题栏.xml文件\n"); + return false; + } + if (File.Exists(xmlpath + "明细表.xml")) + ed.WriteMessage("明细表.xml准备就绪\n"); + else + { + ed.WriteMessage("系统路径下不存在明细表.xml文件\n"); + return false; + } + if (File.Exists(xmlpath + "Item类型.xml")) + ed.WriteMessage("Item类型.xml准备就绪\n"); + else + { + ed.WriteMessage("系统路径下不存在Item类型.xml文件\n"); + return false; + } + if (File.Exists(xmlpath + "数据集.xml")) + ed.WriteMessage("数据集.xml准备就绪\n"); + else + { + ed.WriteMessage("系统路径下不存在数据集.xml文件\n"); + return false; + } + if (File.Exists(xmlpath + "规则.xml")) + ed.WriteMessage("规则.xml准备就绪\n"); + else + { + ed.WriteMessage("系统路径下不存在规则.xml文件\n"); + return false; + } + return true; + } + + + //通过value值找key值 + public object getKeyFromValue(Hashtable table,object value) + { + if (table.ContainsValue(value)) + { + foreach (DictionaryEntry de in table) + { + if (de.Value.Equals(value)) + { + return de.Key; + } + } + } + return null; + } + + + //获得标题栏Item类型 + public string getItemType(OriginBTL btlinfo, OriginTypeRule origintyperule) + { + if (origintyperule == null) + return "Item"; + this.itemtype = origintyperule.Defaulttype.ToString(); + + this.getTypeByRule(btlinfo.Btlinfotable, origintyperule, "1", ""); + + return this.itemtype; + } + + + private string itemtype = ""; + + //获得明细栏Item类型 + public string getItemType(OriginMXL mxlinfo, OriginTypeRule origintyperule) + { + if (origintyperule == null) + return "Item"; + this.itemtype = origintyperule.Defaulttype.ToString(); + + this.getTypeByRule(mxlinfo.Mxlinfotable, origintyperule, "1",""); + + return this.itemtype; + } + + + //通过规则获得需要的Item类型 + private void getTypeByRule(Hashtable infotable, OriginTypeRule origintyperule, + string pos,string usestringvalue) + { + ed.WriteMessage("当前source" + usestringvalue + "\n"); + ed.WriteMessage("当前pos" + pos + "\n"); + //获得source对应的数据 + string sourcestring = origintyperule.Sourcetable[pos].ToString(); + string sourcevalue = ""; + if (sourcestring == "") + { + sourcevalue = usestringvalue; + } + else + { + ed.WriteMessage("source值:"+sourcestring+"\n"); + sourcevalue = infotable[sourcestring].ToString(); + } + //检查是否存在type,如果有,则直接返回 + string typestring = origintyperule.Typetable[pos].ToString(); + if (typestring != "") + { + this.itemtype = typestring; + return; + } + //处理判断条件 + string startstring = origintyperule.Starttable[pos].ToString(); + string endstring = origintyperule.Endtable[pos].ToString(); + string containstring = origintyperule.Containtable[pos].ToString(); + string equalstring = origintyperule.Equaltable[pos].ToString(); + + if (startstring != "") + { + if (sourcevalue.StartsWith(startstring)) + { + string truestring = origintyperule.Truetable[pos].ToString(); + if (truestring != "") + { + this.getTypeByRule(infotable, origintyperule, truestring, sourcevalue); + } + } + else + { + string falsestring = origintyperule.Falsetable[pos].ToString(); + if (falsestring != "") + { + this.getTypeByRule(infotable, origintyperule, falsestring, sourcevalue); + } + } + } + else if (endstring != "") + { + if (sourcevalue.EndsWith(endstring)) + { + string truestring = origintyperule.Truetable[pos].ToString(); + if (truestring != "") + { + this.getTypeByRule(infotable, origintyperule, truestring, sourcevalue); + } + } + else + { + string falsestring = origintyperule.Falsetable[pos].ToString(); + if (falsestring != "") + { + this.getTypeByRule(infotable, origintyperule, falsestring, sourcevalue); + } + } + } + else if (containstring != "") + { + if (sourcevalue.Contains(containstring)) + { + string truestring = origintyperule.Truetable[pos].ToString(); + if (truestring != "") + { + this.getTypeByRule(infotable, origintyperule, truestring, sourcevalue); + } + } + else + { + string falsestring = origintyperule.Falsetable[pos].ToString(); + if (falsestring != "") + { + this.getTypeByRule(infotable, origintyperule, falsestring, sourcevalue); + } + } + } + else if (equalstring !="") + { + if (sourcevalue.Equals(equalstring)) + { + string truestring = origintyperule.Truetable[pos].ToString(); + if (truestring != "") + { + this.getTypeByRule(infotable, origintyperule, truestring, sourcevalue); + } + } + else + { + string falsestring = origintyperule.Falsetable[pos].ToString(); + if (falsestring != "") + { + this.getTypeByRule(infotable, origintyperule, falsestring, sourcevalue); + } + } + } + } + + + //分割字符串,取出对应xml文件的的Item的ID + public List getCorrespondItemID(string[] tempprevalues) + { + List itemidlist = new List(); + Hashtable temptable = new Hashtable(); + for (int i = 0; i < tempprevalues.Length; i++) + { + string tempvalueline = tempprevalues[i]; + string[] tempvalue = tempvalueline.Split('='); + itemidlist.Add(tempvalue[1].ToString()); + } + + return itemidlist; + } + + + public bool downloadfile(Item DMTItem,string xmlpath) + { + bool result = false; + string DMTFilepath = ""; + DataManagementService dmService = DataManagementService.getService(Session.getConnection()); + Editor ed1 = ZwSoft.ZwCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; + ModelObject[] itemrevisionlist = null; + ModelObject[] objects = { DMTItem }; + String[] attributes = { "revision_list" }; + dmService.RefreshObjects(objects); + dmService.GetProperties(objects, attributes); + itemrevisionlist = DMTItem.Revision_list; + ItemRevision itemrevision = itemrevisionlist[itemrevisionlist.Length - 1] as ItemRevision; + ExpandGRMRelationsPref myPref = new ExpandGRMRelationsPref(); + RelationAndTypesFilter2 myFilter = new RelationAndTypesFilter2(); + myFilter.RelationName = "IMAN_specification"; + String[] typeVec = { "Text" }; + myFilter.ObjectTypeNames = typeVec; + myPref.ExpItemRev = false; + RelationAndTypesFilter2[] myfilter = { myFilter }; + myPref.Info = myfilter; + ModelObject[] objects1 = { itemrevision }; + ExpandGRMRelationsResponse myResp = dmService.ExpandGRMRelationsForPrimary(objects1, myPref); + ExpandGRMRelationsOutput[] myoutput = myResp.Output; + for (int i = 0; i < myoutput.Length; i++) + { + ExpandGRMRelationsOutput one_out = myoutput[i]; + for (int j = 0; j < one_out.OtherSideObjData.Length; j++) + { + ExpandGRMRelationsData otherSideData = one_out.OtherSideObjData[j]; + for (int k = 0; k < otherSideData.OtherSideObjects.Length; k++) + { + Type typeinfo = otherSideData.OtherSideObjects[k].GetType(); + string typename = typeinfo.Name; + if (typename == "Text") + { + DataSet dateset = otherSideData.OtherSideObjects[k] as DataSet; + ModelObject[] objects2 = { dateset }; + String[] attributes2 = { "is_modifiable", "checked_out", "ref_list" }; + dmService.RefreshObjects(objects2); + dmService.GetProperties(objects2, attributes2); + ModelObject[] dsfilevec = dateset.Ref_list; + ImanFile dsfile = dsfilevec[0] as ImanFile; + + ModelObject[] objects3 = { dsfile }; + String[] attributes3 = { "relative_directory_path", "original_file_name" }; + dmService.RefreshObjects(objects3); + dmService.GetProperties(objects3, attributes3); + + string newfilename = dsfile.Original_file_name; + ed1.WriteMessage("Original_file_name : " + newfilename + "\n"); + //string tempdir = System.Environment.GetEnvironmentVariable("TEMP").ToString(); + //ed1.WriteMessage("TEMP:" + tempdir.ToString() + "\n"); + + Teamcenter.Soa.Client.FileManagementUtility fmu = new Teamcenter.Soa.Client.FileManagementUtility(Teamcenter.ClientX.Session.getConnection()); + Teamcenter.Soa.Client.GetFileResponse getFileResponse = fmu.GetFiles(dsfilevec); + FileInfo[] fileinfovec = getFileResponse.GetFiles(); + + FileInfo file = fileinfovec[0]; + DMTFilepath = xmlpath + newfilename; + ed1.WriteMessage("拷贝路径:" + DMTFilepath + "\n"); + System.IO.File.Copy(file.FullName, DMTFilepath, true); + System.IO.File.SetAttributes(DMTFilepath, FileAttributes.Normal); + if (DMTFilepath != "") + result = true; + } + } + } + } + return result; + } + + } +} diff --git a/hello/OriginTypeRule.cs b/hello/OriginTypeRule.cs new file mode 100644 index 0000000..0d8a524 --- /dev/null +++ b/hello/OriginTypeRule.cs @@ -0,0 +1,98 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.Collections; + +namespace HelloTeamcenter.hello +{ + class OriginTypeRule + { + private string defaulttype = ""; //属性default + + public string Defaulttype + { + get { return defaulttype; } + set { defaulttype = value; } + } + + private Hashtable sourcetable = null; //用于存放需要的cad图纸信息 + + public Hashtable Sourcetable + { + get { return sourcetable; } + set { sourcetable = value; } + } + + private Hashtable starttable = null; //用于存放startwith判断条件 + + public Hashtable Starttable + { + get { return starttable; } + set { starttable = value; } + } + + private Hashtable endtable = null; //用于存放endwith判断条件 + + public Hashtable Endtable + { + get { return endtable; } + set { endtable = value; } + } + + private Hashtable containtable = null; //用于存放contain的判断条件 + + public Hashtable Containtable + { + get { return containtable; } + set { containtable = value; } + } + + private Hashtable equaltable = null; //用于存放equal的判断条件 + + public Hashtable Equaltable + { + get { return equaltable; } + set { equaltable = value; } + } + + private Hashtable truetable = null; //用于存放判断后成功走向 + + public Hashtable Truetable + { + get { return truetable; } + set { truetable = value; } + } + + private Hashtable falsetable = null;//用于存放判断后失败走向 + + public Hashtable Falsetable + { + get { return falsetable; } + set { falsetable = value; } + } + + private Hashtable typetable = null; //用于存放返回的type类型 + + public Hashtable Typetable + { + get { return typetable; } + set { typetable = value; } + } + + + public OriginTypeRule() + { + this.defaulttype = ""; + this.sourcetable = new Hashtable(); + this.starttable = new Hashtable(); + this.endtable = new Hashtable(); + this.containtable = new Hashtable(); + this.equaltable = new Hashtable(); + this.truetable = new Hashtable(); + this.falsetable = new Hashtable(); + this.typetable = new Hashtable(); + } + + + } +} diff --git a/hello/PrintDwg.cs b/hello/PrintDwg.cs new file mode 100644 index 0000000..76a19b0 --- /dev/null +++ b/hello/PrintDwg.cs @@ -0,0 +1,848 @@ + +/************************************************************************************ + + * Copyright (c) 2018 All Rights Reserved. + + * CLR版本: 4.0.30319.36399 + + *机器名称:HUBING + + *公司名称:杭州康勒科技有限公司 + + *命名空间:HelloTeamcenter.hello + + *文件名: PrintDwg + + *版本号: V1.0.0.0 + + *唯一标识:0679f0a0-c63f-454a-8a8f-b7db7cb9cfc6 + + *当前的用户域:HUBING + + *创建人: hub + + *电子邮箱:hub@connor.net.cn + + *创建时间:2018/5/28 16:26:39 + + *描述: + + * + + *===================================================================== + + *修改标记 + + *修改时间:2018/5/28 16:26:39 + + *修改人: hub + + *版本号: V1.0.0.0 + + *描述: + + * + +/************************************************************************************/ + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +//*******************************************// +// Type Library // +//*******************************************// +//using ZwSoft.ZwCAD.Customization; //accui.dll + +//*******************************************// +// acdbmgd.dll // +//*******************************************// + +using ZwSoft.ZwCAD.Runtime; +using ZwSoft.ZwCAD.LayerManager; +using ZwSoft.ZwCAD.GraphicsSystem; +using ZwSoft.ZwCAD.GraphicsInterface; +using ZwSoft.ZwCAD.Geometry; +using ZwSoft.ZwCAD.DatabaseServices.Filters; +using ZwSoft.ZwCAD.DatabaseServices; +using ZwSoft.ZwCAD.Colors; +//******************************************// + +//--------------------------------------------// + +// acmgd.dll // + +//------------------------------------------*// +//using ZwSoft.ZwCAD.Windows.ToolPalette; +using ZwSoft.ZwCAD.Windows; +using ZwSoft.ZwCAD.Publishing; +using ZwSoft.ZwCAD.PlottingServices; +using ZwSoft.ZwCAD.EditorInput; +using ZwSoft.ZwCAD.ApplicationServices; +using AcAp = ZwSoft.ZwCAD.ApplicationServices.Application; +using DataSvr = ZwSoft.ZwCAD.DatabaseServices; +using System.Collections; +using System.Threading; +using System.Collections.Specialized; +using HelloTeamcenter.hello; +using iTextSharp.text.pdf; +using System.IO; +using iTextSharp.text; +namespace KCad +{ + + public class FrameCompare : IComparer + { + // Calls CaseInsensitiveComparer.Compare with the parameters reversed. + int IComparer.Compare(Object x, Object y) + { + if (string.Compare((x as PrintFrame).BKName, (y as PrintFrame).BKName, true) == 0) + { + return 0; + } + return -1; + } + } + public class PrintFrame + { + public string BKName + { + get; + set; + } + public string MediaName + { + get; + set; + } + public Extents2d PrintBound + { + get; + set; + + } + public DataSvr.PlotRotation Rotation + { + get; + set; + } + public void Clone(PrintFrame obj) + { + BKName = obj.BKName; + MediaName = obj.MediaName; + PrintBound = obj.PrintBound; + Rotation = obj.Rotation; + BlockF = obj.BlockF; + } + public string BlockF + { + get; + set; + } + + public double _X + { + get; + set; + } + public double _Y + { + get; + set; + } + + } + + + public class PrintDwg + { + + private ArrayList m_Frame = null; + private string CAD_BLOCK_SIZE_MAPPING = "CN_cad_block_size_mapping"; + public PrintDwg(ZwSoft.ZwCAD.ApplicationServices.Document doc) + { + m_Frame = new ArrayList(); + // m_Frame.Add(new PrintFrame() { BKName = "KHGY-TH", MediaName = "ISO_expand_A4_(297.00_x_210.00_MM)", Rotation = DataSvr.PlotRotation.Degrees000 }); + // m_Frame.Add(new PrintFrame() { BKName = "KHGY-TK", MediaName = "ISO_expand_A4_(297.00_x_210.00_MM)", Rotation = DataSvr.PlotRotation.Degrees000 }); + // m_Frame.Add(new PrintFrame() { BKName = "KHTH-H", MediaName = "ISO_expand_A4_(297.00_x_210.00_MM)", Rotation = DataSvr.PlotRotation.Degrees000 }); + // m_Frame.Add(new PrintFrame() { BKName = "KHTH-H-A3", MediaName = "ISO_expand_A3_(420.00_x_297.00_MM)", Rotation = DataSvr.PlotRotation.Degrees000 }); + // m_Frame.Add(new PrintFrame() { BKName = "KHTH-Z", MediaName = "ISO_expand_A4_(297.00_x_210.00_MM)", Rotation = DataSvr.PlotRotation.Degrees090 }); + // m_Frame.Add(new PrintFrame() { BKName = "KHTH-Z-A3", MediaName = "ISO_expand_A3_(420.00_x_297.00_MM)", Rotation = DataSvr.PlotRotation.Degrees090 }); + // m_Frame.Add(new PrintFrame() { BKName = "a3n", MediaName = "ISO_expand_A3_(420.00_x_297.00_MM)", Rotation = DataSvr.PlotRotation.Degrees090 }); + Editor ed1 = ZwSoft.ZwCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; + try + { + Tool tool = new Tool(); + Hashtable pre = tool.getTCPreferences(CAD_BLOCK_SIZE_MAPPING); + string[] prevalues = (string[])pre[CAD_BLOCK_SIZE_MAPPING]; + //string[] prevalues = new String[] { "A0-H=A0=841.00_x_1189.00=W", "A1-H=A1=841.00_x_594.00=W","A2-H=A2=594.00_x_420.00=W", "A4-S=A4=297.00_x_210.00=H" };//{ "A0-H=A0=841.00_x_1189.00=W"}; + if (prevalues != null && prevalues.Length > 0) + { + + foreach (string value in prevalues) + { + ed1.WriteMessage("REF=>" + value+"\n"); + string[] values = value.Split("=".ToCharArray()); + if (values.Length == 4) + { //a3n=A3=420.00_x_297.00 + if (values[3].Equals("W")) + { + ed1.WriteMessage("REF=90=>\n"); + m_Frame.Add(new PrintFrame() { BKName = values[0], MediaName = String.Format("ISO_expand_{0}_({1}_MM)", values[1], values[2]), Rotation = DataSvr.PlotRotation.Degrees090, BlockF = values[3] }); + }else{ + ed1.WriteMessage("REF=00=>\n"); + m_Frame.Add(new PrintFrame() { BKName = values[0], MediaName = String.Format("ISO_expand_{0}_({1}_MM)", values[1], values[2]), Rotation = DataSvr.PlotRotation.Degrees090, BlockF = values[3] }); + } + } + } + } + }catch(System.Exception e){ + ed1.WriteMessage(e.StackTrace); + + } + + + PrintDoc = doc; + } + + /// + /// PDF旋转90度 + /// + /// + public string PdfTo90(string inputfilepath, PrintFrame frame) + { + string pdfNewPath =null; + + if (frame.BlockF.Equals("W")) + { + pdfNewPath = inputfilepath.Replace("DWG_PDF", "DWG_PDF_M"); + }else{ + pdfNewPath = inputfilepath.Replace("DWG_PDF", "DWG_PDF_M"); + //pdfNewPath = inputfilepath; + //return pdfNewPath; + } + + PdfReader pdfReader = null; + PdfStamper pdfStamper = null; + Editor cadEditor = ZwSoft.ZwCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; + try + { + pdfReader = new PdfReader(inputfilepath); + pdfStamper = new PdfStamper(pdfReader, new FileStream(pdfNewPath, FileMode.Create)); + + int numberOfPages = pdfReader.NumberOfPages; + for (int i = 1; i <= numberOfPages; i++) + { + //转换角度 + if (frame.BlockF.Equals("W")) + { + PdfDictionary page = pdfReader.GetPageN(i); + PdfNumber rotate = page.GetAsNumber(PdfName.ROTATE); + int rotation = rotate == null ? 90 : (rotate.IntValue + 90) % 360; + page.Put(PdfName.ROTATE, new PdfNumber(rotation)); + } + //获取PDFsize + iTextSharp.text.Rectangle psize = pdfReader.GetPageSize(1); + float width = psize.Width; + float height = psize.Height; + iTextSharp.text.Image image = iTextSharp.text.Image.GetInstance(global::HelloTeamcenter.Properties.Resources.SY, iTextSharp.text.BaseColor.WHITE); + image.GrayFill = 20;//透明度,灰色填充 + //水印的位置 + image.SetAbsolutePosition((width - image.Width )/2, (height - image.Height )/2 ); + PdfContentByte waterMarkContent = pdfStamper.GetUnderContent(i); + waterMarkContent.AddImage(image); + + pdfStamper.Close(); + pdfReader.Close(); + } + }catch(System.Exception){ + + cadEditor.WriteMessage("转换PDF出现异常"); + } + + return pdfNewPath; + + } + /// + /// 合成pdf文件 + /// + /// 文件名list + /// 输出路径 + public static void mergePDFFiles(PrintFrame[] frames ,List fileList, string outMergeFile) + { + if (fileList.Count == 1 ) + { + File.Copy(fileList[0], outMergeFile,true); + return; + } + + Spire.Pdf.PdfDocument outPdf = new Spire.Pdf.PdfDocument(); + for (int i = 0; i < fileList.Count;i++ ) + { + Spire.Pdf.PdfDocument inPdf = new Spire.Pdf.PdfDocument(); + inPdf.LoadFromFile(fileList[i]); + + Spire.Pdf.PdfPageBase page = outPdf.Pages.Add(inPdf.Pages[0].Size, new Spire.Pdf.Graphics.PdfMargins(0)); + inPdf.Pages[0].CreateTemplate().Draw(page, new System.Drawing.PointF(0, 0)); + + } + outPdf.SaveToFile(outMergeFile); + + /* + + + PdfReader reader; + // Rectangle rec = new Rectangle(1660, 1000); + iTextSharp.text.Document document = new iTextSharp.text.Document(); + PdfWriter writer = PdfWriter.GetInstance(document, new FileStream(outMergeFile, FileMode.Create)); + document.Open(); + PdfContentByte cb = writer.DirectContent; + PdfImportedPage newPage; + for (int i = 0; i < fileList.Count; i++) + { + reader = new PdfReader(fileList[i]); + iTextSharp.text.Rectangle psize = reader.GetPageSize(1); + float width = psize.Width; + float height = psize.Height; + + int iPageNum = reader.NumberOfPages; + for (int j = 1; j <= iPageNum; j++) + { + document.NewPage(); + + newPage = writer.GetImportedPage(reader, j); + page = pdf2.Pages.Add(pdf.Pages[i].Size, newPdfMargins(0)); + + cb.AddTemplate(newPage, 0,0);//,width, height); + } + } + document.Close(); + * */ + } + + + /// + /// 导出PDF + /// + /// PDF路径 + /// + public string CreatePdf(PrintFrame frame,int index) { + string pdfPath = ""; + Database database = PrintDoc.Database; + //; + Editor cadEditor = ZwSoft.ZwCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; + using (Transaction transaction = database.TransactionManager.StartTransaction()) + { + short backgroundPlot = (short)Application.GetSystemVariable("BACKGROUNDPLOT"); + Application.SetSystemVariable("BACKGROUNDPLOT", 0); + + BlockTable blockTable = (BlockTable)transaction.GetObject(database.BlockTableId, OpenMode.ForRead); + PlotInfo plotInfo = new PlotInfo(); + PlotInfoValidator plotInfoValidator = new PlotInfoValidator(); + + plotInfoValidator.MediaMatchingPolicy = MatchingPolicy.MatchEnabled; + + if (PlotFactory.ProcessPlotState == ProcessPlotState.NotPlotting) + { + + + using (PlotEngine plotEngine = PlotFactory.CreatePublishEngine()) + { + // Create a Progrel.ass Dialog to provide info + // and allow thej user to cancel + using (PlotProgressDialog plotProcessDialog = new PlotProgressDialog(false, 1, true)) + { + + BlockTableRecord acBlkTblRec = transaction.GetObject(blockTable[BlockTableRecord.ModelSpace], + OpenMode.ForWrite) as BlockTableRecord; + Layout layout = (Layout)transaction.GetObject(acBlkTblRec.LayoutId, OpenMode.ForRead); + // We need a PlotSettings object + // based on the layout settings + // which we then customize + PlotSettings plotSetting= new PlotSettings(layout.ModelType); + plotSetting.CopyFrom(layout); + + // The PlotSettingsValidator helps + // create a valid PlotSettings object + PlotSettingsValidator plotSettingValidator = PlotSettingsValidator.Current; + + // We'll plot the extents, centered and + // scaled to fit + StringCollection stringCollection = plotSettingValidator.GetPlotStyleSheetList(); + bool StyleSheetCheck = false; + foreach (string s in stringCollection) + { + if (string.Compare(s, "monochrome.ctb", true) == 0) + { + StyleSheetCheck = true; + } + } + plotSettingValidator.SetPlotConfigurationName(plotSetting, "DWG To PDF.pc5", frame.MediaName); + plotSettingValidator.SetPlotWindowArea(plotSetting, frame.PrintBound); + plotSettingValidator.SetPlotType(plotSetting, ZwSoft.ZwCAD.DatabaseServices.PlotType.Window); + + if (!StyleSheetCheck) + { + plotSettingValidator.SetCurrentStyleSheet(plotSetting, "monochrome.stb"); + } + else + { + plotSettingValidator.SetCurrentStyleSheet(plotSetting, "monochrome.ctb"); + } + plotSettingValidator.SetPlotCentered(plotSetting, true); + if(frame.BKName.ToUpper().Equals("A4-S")){ + plotSettingValidator.SetPlotRotation(plotSetting, PlotRotation.Degrees090); + cadEditor.WriteMessage("IS A4-S SET Degrees090 "); + } + + plotSettingValidator.SetUseStandardScale(plotSetting, true); + plotSettingValidator.SetStdScaleType(plotSetting, StdScaleType.ScaleToFit); + // We need a PlotInfo object + // linked to the layout + plotInfo.Layout = acBlkTblRec.LayoutId; + // Make the layout we're plotting current + LayoutManager.Current.CurrentLayout = layout.LayoutName; + // We need to link the PlotInfo to the + // PlotSettings and then validate it + + plotInfo.OverrideSettings = plotSetting; + plotInfoValidator.Validate(plotInfo); + plotProcessDialog.set_PlotMsgString(PlotMessageIndex.DialogTitle, "Custom Plot Progress"); + plotProcessDialog.set_PlotMsgString(PlotMessageIndex.CancelJobButtonMessage, "Cancel Job"); + plotProcessDialog.set_PlotMsgString(PlotMessageIndex.CancelSheetButtonMessage, "Cancel Sheet"); + plotProcessDialog.set_PlotMsgString(PlotMessageIndex.SheetSetProgressCaption, "Sheet Set Progress"); + plotProcessDialog.set_PlotMsgString(PlotMessageIndex.SheetProgressCaption, "Sheet Progress"); + plotProcessDialog.LowerPlotProgressRange = 0; + plotProcessDialog.UpperPlotProgressRange = 100; + plotProcessDialog.PlotProgressPos = 0; + // Let's start the plot, at last + plotProcessDialog.OnBeginPlot(); + plotProcessDialog.IsVisible = true; + plotEngine.BeginPlot(plotProcessDialog, null); + pdfPath = String.Format("{0}\\{1}_{2}.pdf", System.Environment.GetEnvironmentVariable("TEMP").ToString(),"DWG_PDF_",index); + plotEngine.BeginDocument(plotInfo, PrintDoc.Name, null, 1, true, pdfPath); + // psv.SetPlotRotation(ps, DataSvr.PlotRotation.Degrees090); + // Which may contain multiple sheets + plotProcessDialog.StatusMsgString = "Plotting " + PrintDoc.Name.Substring(PrintDoc.Name.LastIndexOf("\\") + 1) + + " - sheet 1 of 1" ; + plotProcessDialog.OnBeginSheet(); + plotProcessDialog.LowerSheetProgressRange = 0; + plotProcessDialog.UpperSheetProgressRange = 100; + plotProcessDialog.SheetProgressPos = 0; + PlotPageInfo ppi = new PlotPageInfo(); + plotEngine.BeginPage(ppi, plotInfo, true, null); + plotEngine.BeginGenerateGraphics(null); + plotProcessDialog.SheetProgressPos = 50; + plotEngine.EndGenerateGraphics(null); + // Finish the sheet + plotEngine.EndPage(null); + plotProcessDialog.SheetProgressPos = 100; + plotProcessDialog.OnEndSheet(); + // Finish the document + plotEngine.EndDocument(null); + // And finish the plot + plotProcessDialog.PlotProgressPos = 100; + plotProcessDialog.OnEndPlot(); + plotEngine.EndPlot(null); + plotProcessDialog.Dispose(); + } + + + if (File.Exists(pdfPath)) + { + pdfPath = PdfTo90(pdfPath, frame); + } + + } + } + else + { + PrintDoc.Editor.WriteMessage("\nAnother plot is in progress."); + } + + Application.SetSystemVariable("BACKGROUNDPLOT", backgroundPlot); + transaction.Commit(); + + + } + + return pdfPath; + } + + /// + /// 生成多个PDF + /// + /// + /// + public string MultiSheetPlot2(String pdfName) { + string path = ""; + Editor cadEditor = ZwSoft.ZwCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; + PrintFrame[] frames = CheckModelSpaceTitle(); + + if (frames.Length < 1) + return ""; + List pdfNameList = new List(); + for (int i =0;i< frames.Length;i++) + { + PrintFrame frame =frames[i]; + string pdfPath = CreatePdf(frame, i); + cadEditor.WriteMessage("pdfPath =>" + pdfPath + "\n"); + pdfNameList.Add(pdfPath); + + } + + path = String.Format("{0}\\{1}.pdf", System.Environment.GetEnvironmentVariable("TEMP").ToString(), pdfName); + cadEditor.WriteMessage("pdfName =>" + path + "\n"); + //合并PDF + mergePDFFiles( frames,pdfNameList,path); + + return path; + } + + + + public string MultiSheetPlot(String pdfName) + { + string path = ""; + Database database = PrintDoc.Database; + //; + Editor cadEditor = ZwSoft.ZwCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; + + using (Transaction transaction = database.TransactionManager.StartTransaction()) + { + short backgroundPlot = (short)Application.GetSystemVariable("BACKGROUNDPLOT"); + Application.SetSystemVariable("BACKGROUNDPLOT", 0); + + BlockTable blockTable = (BlockTable)transaction.GetObject(database.BlockTableId, OpenMode.ForRead); + PlotInfo plotInfo = new PlotInfo(); + PlotInfoValidator plotInfoValidator = new PlotInfoValidator(); + + plotInfoValidator.MediaMatchingPolicy = MatchingPolicy.MatchEnabled; + + // A PlotEngine does the actual plotting + // (can also create one for Preview) + + if (PlotFactory.ProcessPlotState == ProcessPlotState.NotPlotting) + { + + + using (PlotEngine plotEngine = PlotFactory.CreatePublishEngine()) + { + PrintFrame[] frames = CheckModelSpaceTitle(); + // Create a Progrel.ass Dialog to provide info + // and allow thej user to cancel + + using (PlotProgressDialog plotProcessDialog = new PlotProgressDialog(false, frames.Length, true)) + { + + int numSheet = 1; + + if (frames.Length < 1) + return ""; + + foreach (PrintFrame frame in frames) + { + BlockTableRecord acBlkTblRec = transaction.GetObject(blockTable[BlockTableRecord.ModelSpace], + OpenMode.ForWrite) as BlockTableRecord; + + Layout lo = (Layout)transaction.GetObject(acBlkTblRec.LayoutId, OpenMode.ForRead); + + // We need a PlotSettings object + // based on the layout settings + // which we then customize + PlotSettings ps = new PlotSettings(lo.ModelType); + ps.CopyFrom(lo); + + // The PlotSettingsValidator helps + // create a valid PlotSettings object + PlotSettingsValidator psv = PlotSettingsValidator.Current; + + // We'll plot the extents, centered and + // scaled to fit + StringCollection cols = psv.GetPlotStyleSheetList(); + bool StyleSheetCheck = false; + foreach (string s in cols) + { + if (string.Compare(s, "monochrome.ctb", true) == 0) + { + StyleSheetCheck = true; + } + } + psv.SetPlotConfigurationName(ps, "DWG To PDF.pc3", frame.MediaName); + psv.SetPlotWindowArea(ps, frame.PrintBound); + psv.SetPlotType(ps, ZwSoft.ZwCAD.DatabaseServices.PlotType.Window); + + psv.SetPlotRotation(ps, DataSvr.PlotRotation.Degrees090); + + if (!StyleSheetCheck) + psv.SetCurrentStyleSheet(ps, "monochrome.stb"); + else + psv.SetCurrentStyleSheet(ps, "monochrome.ctb"); + psv.SetPlotCentered(ps, true); + psv.SetUseStandardScale(ps, true); + psv.SetStdScaleType(ps, StdScaleType.ScaleToFit); + + // cadEditor.WriteMessage("Rooation=>>" + frame.Rotation); + // psv.SetPlotRotation(ps, DataSvr.PlotRotation.Degrees090);// frame.Rotation); + + // We need a PlotInfo object + // linked to the layout + plotInfo.Layout = acBlkTblRec.LayoutId; + + // Make the layout we're plotting current + LayoutManager.Current.CurrentLayout = lo.LayoutName; + // We need to link the PlotInfo to the + // PlotSettings and then validate it + + plotInfo.OverrideSettings = ps; + + plotInfoValidator.Validate(plotInfo); + + if (numSheet == 1) + { + plotProcessDialog.set_PlotMsgString(PlotMessageIndex.DialogTitle, "Custom Plot Progress"); + plotProcessDialog.set_PlotMsgString(PlotMessageIndex.CancelJobButtonMessage, "Cancel Job"); + plotProcessDialog.set_PlotMsgString(PlotMessageIndex.CancelSheetButtonMessage, "Cancel Sheet"); + plotProcessDialog.set_PlotMsgString(PlotMessageIndex.SheetSetProgressCaption, "Sheet Set Progress"); + plotProcessDialog.set_PlotMsgString(PlotMessageIndex.SheetProgressCaption, "Sheet Progress"); + + plotProcessDialog.LowerPlotProgressRange = 0; + plotProcessDialog.UpperPlotProgressRange = 100; + plotProcessDialog.PlotProgressPos = 0; + + // Let's start the plot, at last + plotProcessDialog.OnBeginPlot(); + plotProcessDialog.IsVisible = true; + plotEngine.BeginPlot(plotProcessDialog, null); + // We'll be plotting a single document // Let's plot to file + path = PrintDoc.Name.ToUpper().Replace(".DWG", string.Format("{0}{1}", frame.BKName, ".PDF")); + //myPdfName + path = path.Substring(0, path.LastIndexOf('\\') + 1) + pdfName+"1.PDF"; + plotEngine.BeginDocument(plotInfo, PrintDoc.Name, null, 1, true, path); + } + // psv.SetPlotRotation(ps, DataSvr.PlotRotation.Degrees090); + // Which may contain multiple sheets + plotProcessDialog.StatusMsgString = "Plotting " + PrintDoc.Name.Substring(PrintDoc.Name.LastIndexOf("\\") + 1) + + " - sheet " + numSheet.ToString() + + " of " + frames.Length.ToString(); + + plotProcessDialog.OnBeginSheet(); + plotProcessDialog.LowerSheetProgressRange = 0; + plotProcessDialog.UpperSheetProgressRange = 100; + plotProcessDialog.SheetProgressPos = 0; + PlotPageInfo ppi = new PlotPageInfo(); + + plotEngine.BeginPage(ppi, plotInfo, frames.Length == numSheet, null); + plotEngine.BeginGenerateGraphics(null); + plotProcessDialog.SheetProgressPos = 50; + plotEngine.EndGenerateGraphics(null); + + // Finish the sheet + plotEngine.EndPage(null); + plotProcessDialog.SheetProgressPos = 100; + plotProcessDialog.OnEndSheet(); + numSheet++; + //Thread.Sleep(30000); + } + + // Finish the document + plotEngine.EndDocument(null); + // And finish the plot + plotProcessDialog.PlotProgressPos = 100; + plotProcessDialog.OnEndPlot(); + + plotEngine.EndPlot(null); + plotProcessDialog.Dispose(); + + + + + } + + + if (File.Exists(path)) + { + if (PDFWatermark(path, path.Replace("1.PDF", ".pdf"), 0, 0, frames)) + { + return path.Replace("1.PDF", ".pdf"); + } + } + + } + } + else + { + PrintDoc.Editor.WriteMessage("\nAnother plot is in progress."); + } + + Application.SetSystemVariable("BACKGROUNDPLOT", backgroundPlot); + transaction.Commit(); + + + } + + + return path; + } + + // 检查是否存在边框 + private PrintFrame[] CheckModelSpaceTitle() + { + Database acCurDb = PrintDoc.Database; + List lstFrame = new List(); + Editor cadEditor = ZwSoft.ZwCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; + + using (Transaction acTrans = acCurDb.TransactionManager.StartTransaction()) + { + BlockTable acBlkTbl; + acBlkTbl = acTrans.GetObject(acCurDb.BlockTableId, + OpenMode.ForRead) as BlockTable; + + // Open the Block table record for read + BlockTableRecord acBlkTblRec; + + acBlkTblRec = acTrans.GetObject(acBlkTbl[BlockTableRecord.ModelSpace], + OpenMode.ForWrite) as BlockTableRecord; + BlockReference reference; + BlockTableRecordEnumerator enumbtr = acBlkTblRec.GetEnumerator(); + while (enumbtr.MoveNext()) + { + Entity entity = acTrans.GetObject(enumbtr.Current, OpenMode.ForRead) as Entity; + + if (entity is BlockReference) + { + + reference = entity as BlockReference; + + + //int i = m_Frame.BinarySearch(new PrintFrame() { BKName = reference.Name }, new FrameCompare()); + int i = -1; + for (int j = 0; j < m_Frame.Count; j++) + { + if (string.Compare((m_Frame[j] as PrintFrame).BKName, reference.Name, true) == 0) + { + i = j; + break; + } + } + + + if (i > -1) + { + Extents2d e2dBound = new Extents2d(reference.Bounds.Value.MinPoint.X, reference.Bounds.Value.MinPoint.Y, reference.Bounds.Value.MaxPoint.X, reference.Bounds.Value.MaxPoint.Y); + (m_Frame[i] as PrintFrame).PrintBound = e2dBound; + PrintFrame frm = new PrintFrame(); + frm.Clone((m_Frame[i] as PrintFrame)); + cadEditor.WriteMessage("MinPoint=>" + reference.Bounds.Value.MinPoint.X + "|" + reference.Bounds.Value.MinPoint.Y); + cadEditor.WriteMessage("MaxPoint=>" + reference.Bounds.Value.MaxPoint.X + "|" + reference.Bounds.Value.MaxPoint.Y); + frm._X = reference.Bounds.Value.MaxPoint.X - reference.Bounds.Value.MinPoint.X; + frm._Y = reference.Bounds.Value.MaxPoint.Y - reference.Bounds.Value.MinPoint.Y; + + lstFrame.Add(frm); + } + + } + } + + acTrans.Commit(); + } + + return lstFrame.ToArray(); + } + + public ZwSoft.ZwCAD.ApplicationServices.Document PrintDoc + { + get; + set; + } + + + + public bool PDFWatermark(string inputfilepath, string outputfilepath, float top, float left,PrintFrame[] frames) + { + //throw new NotImplementedException(); + PdfReader pdfReader = null; + PdfStamper pdfStamper = null; + Editor cadEditor = ZwSoft.ZwCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; + + try + { + pdfReader = new PdfReader(inputfilepath); + + int numberOfPages = pdfReader.NumberOfPages; + + iTextSharp.text.Rectangle psize = pdfReader.GetPageSize(1); + + float width = psize.Width; + + float height = psize.Height; + + cadEditor.WriteMessage(String.Format("\nwidth = {0}/height = {1}\n",width, height)); + + pdfStamper = new PdfStamper(pdfReader, new FileStream(outputfilepath, FileMode.Create)); + + PdfContentByte waterMarkContent; + //global::HelloTeamcenter.Properties.Resources.SY.; + iTextSharp.text.Image image = iTextSharp.text.Image.GetInstance(global::HelloTeamcenter.Properties.Resources.SY,iTextSharp.text.BaseColor.WHITE); + //iTextSharp.text.Image image = iTextSharp.text.Image.GetInstance(ModelPicName); + + image.GrayFill = 20;//透明度,灰色填充 + //image.Rotation//旋转 + //image.RotationDegrees//旋转角度 + //水印的位置 + if (left <= 0) + { + left = (width /2- image.Width/2) + left; + } + + image.SetAbsolutePosition(left, (height/2 - image.Height/2) - top); + + + //每一页加水印,也可以设置某一页加水印 + for (int i = 1; i <= numberOfPages; i++) + { + + + + + PdfDictionary page = pdfReader.GetPageN(i); //reader.getPageN(i); + + //iTextSharp.text.Rectangle pageSize = pdfReader.GetPageSize(i); + + // float myW = pageSize.Right - pageSize.Left; + // float myH = pageSize.Top - pageSize.Bottom; + // cadEditor.WriteMessage(String.Format("W={0}/H={1}\n", myW, myH)); + if (frames != null && frames.Length == numberOfPages && frames[i].BlockF.Equals("W")) + { + PdfNumber rotate = page.GetAsNumber(PdfName.ROTATE); + int rotation = rotate == null ? 90 : (rotate.IntValue + 90) % 360; + page.Put(PdfName.ROTATE, new PdfNumber(rotation)); + } + + waterMarkContent = pdfStamper.GetUnderContent(i); + + waterMarkContent.AddImage(image); + } + //strMsg = "success"; + return true; + } + catch (System.Exception ex) + { + ex.Message.Trim(); + return false; + } + finally + { + + if (pdfStamper != null) + pdfStamper.Close(); + + if (pdfReader != null) + pdfReader.Close(); + } + } + + } +} diff --git a/hello/PrintDwg2.cs b/hello/PrintDwg2.cs new file mode 100644 index 0000000..b72c0e1 --- /dev/null +++ b/hello/PrintDwg2.cs @@ -0,0 +1,385 @@ + +/************************************************************************************ + + * Copyright (c) 2018 All Rights Reserved. + + * CLR版本: 4.0.30319.36399 + + *机器名称:HUBING + + *公司名称:杭州康勒科技有限公司 + + *命名空间:HelloTeamcenter.hello + + *文件名: PrintDwg2 + + *版本号: V1.0.0.0 + + *唯一标识:fd6d1fc7-779a-4ab6-8136-3c5bc87fbd75 + + *当前的用户域:HUBING + + *创建人: hub + + *电子邮箱:hub@connor.net.cn + + *创建时间:2018/6/29 14:25:02 + + *描述: + + * + + *===================================================================== + + *修改标记 + + *修改时间:2018/6/29 14:25:02 + + *修改人: hub + + *版本号: V1.0.0.0 + + *描述: + + * + +/************************************************************************************/ + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +//*******************************************// +// Type Library // +//*******************************************// +//using ZwSoft.ZwCAD.Customization; //accui.dll + +//*******************************************// +// acdbmgd.dll // +//*******************************************// + +using ZwSoft.ZwCAD.Runtime; +using ZwSoft.ZwCAD.LayerManager; +using ZwSoft.ZwCAD.GraphicsSystem; +using ZwSoft.ZwCAD.GraphicsInterface; +using ZwSoft.ZwCAD.Geometry; +using ZwSoft.ZwCAD.DatabaseServices.Filters; +using ZwSoft.ZwCAD.DatabaseServices; +using ZwSoft.ZwCAD.Colors; +//******************************************// + +//--------------------------------------------// + +// acmgd.dll // + +//------------------------------------------*// +//using ZwSoft.ZwCAD.Windows.ToolPalette; +using ZwSoft.ZwCAD.Windows; +using ZwSoft.ZwCAD.Publishing; +using ZwSoft.ZwCAD.PlottingServices; +using ZwSoft.ZwCAD.EditorInput; +using ZwSoft.ZwCAD.ApplicationServices; +using AcAp = ZwSoft.ZwCAD.ApplicationServices.Application; +using DataSvr = ZwSoft.ZwCAD.DatabaseServices; +using System.Collections; +using System.Threading; +using System.Collections.Specialized; +namespace KCad2 +{ + + public class FrameCompare : IComparer + { + // Calls CaseInsensitiveComparer.Compare with the parameters reversed. + int IComparer.Compare(Object x, Object y) + { + if (string.Compare((x as PrintFrame).BKName, (y as PrintFrame).BKName, true) == 0) + { + return 0; + } + return -1; + } + } + public class PrintFrame + { + public string BKName + { + get; + set; + } + public string MediaName + { + get; + set; + } + public Extents2d PrintBound + { + get; + set; + + } + public DataSvr.PlotRotation Rotation + { + get; + set; + } + public void Clone(PrintFrame obj) + { + BKName = obj.BKName; + MediaName = obj.MediaName; + PrintBound = obj.PrintBound; + Rotation = obj.Rotation; + } + + } + + + public class PrintDwg + { + + private ArrayList m_Frame = null; + public PrintDwg(Document doc) + { + m_Frame = new ArrayList(); + m_Frame.Add(new PrintFrame() { BKName = "KHGY-TH", MediaName = "ISO_expand_A4_(297.00_x_210.00_MM)", Rotation = DataSvr.PlotRotation.Degrees000 }); + m_Frame.Add(new PrintFrame() { BKName = "KHGY-TK", MediaName = "ISO_expand_A4_(297.00_x_210.00_MM)", Rotation = DataSvr.PlotRotation.Degrees000 }); + m_Frame.Add(new PrintFrame() { BKName = "KHTH-H", MediaName = "ISO_expand_A4_(297.00_x_210.00_MM)", Rotation = DataSvr.PlotRotation.Degrees000 }); + m_Frame.Add(new PrintFrame() { BKName = "KHTH-H-A3", MediaName = "ISO_expand_A3_(420.00_x_297.00_MM)", Rotation = DataSvr.PlotRotation.Degrees000 }); + m_Frame.Add(new PrintFrame() { BKName = "KHTH-Z", MediaName = "ISO_expand_A4_(297.00_x_210.00_MM)", Rotation = DataSvr.PlotRotation.Degrees090 }); + m_Frame.Add(new PrintFrame() { BKName = "KHTH-Z-A3", MediaName = "ISO_expand_A3_(420.00_x_297.00_MM)", Rotation = DataSvr.PlotRotation.Degrees090 }); + PrintDoc = doc; + } + + public string MultiSheetPlot() + { + // DocumentLock m_DocumentLock = ZwSoft.ZwCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.LockDocument(); + string path = ""; + Database db = PrintDoc.Database; + //; + + using (Transaction tr = db.TransactionManager.StartTransaction()) + { + short bgPlot = (short)Application.GetSystemVariable("BACKGROUNDPLOT"); + Application.SetSystemVariable("BACKGROUNDPLOT", 0); + + BlockTable bt = (BlockTable)tr.GetObject(db.BlockTableId, OpenMode.ForRead); + PlotInfo pi = new PlotInfo(); + PlotInfoValidator piv = new PlotInfoValidator(); + + piv.MediaMatchingPolicy = MatchingPolicy.MatchEnabled; + + // A PlotEngine does the actual plotting + // (can also create one for Preview) + + if (PlotFactory.ProcessPlotState == ProcessPlotState.NotPlotting) + { + + + using (PlotEngine pe = PlotFactory.CreatePublishEngine()) + { + PrintFrame[] frames = CheckModelSpaceTitle(); + // Create a Progrel.ass Dialog to provide info + // and allow thej user to cancel + + using (PlotProgressDialog ppd = new PlotProgressDialog(false, frames.Length, true)) + { + + int numSheet = 1; + + if (frames.Length < 1) + return ""; + + foreach (PrintFrame frame in frames) + { + BlockTableRecord acBlkTblRec = tr.GetObject(bt[BlockTableRecord.ModelSpace], + OpenMode.ForWrite) as BlockTableRecord; + + Layout lo = (Layout)tr.GetObject(acBlkTblRec.LayoutId, OpenMode.ForRead); + + // We need a PlotSettings object + // based on the layout settings + // which we then customize + PlotSettings ps = new PlotSettings(lo.ModelType); + ps.CopyFrom(lo); + + // The PlotSettingsValidator helps + // create a valid PlotSettings object + PlotSettingsValidator psv = PlotSettingsValidator.Current; + + // We'll plot the extents, centered and + // scaled to fit + StringCollection cols = psv.GetPlotStyleSheetList(); + bool StyleSheetCheck = false; + foreach (string s in cols) + { + if (string.Compare(s, "monochrome.ctb", true) == 0) + { + StyleSheetCheck = true; + } + } + psv.SetPlotConfigurationName(ps, "DWG To PDF.pc3", frame.MediaName); + psv.SetPlotWindowArea(ps, frame.PrintBound); + psv.SetPlotType(ps, ZwSoft.ZwCAD.DatabaseServices.PlotType.Window); + if (!StyleSheetCheck) + psv.SetCurrentStyleSheet(ps, "monochrome.stb"); + else + psv.SetCurrentStyleSheet(ps, "monochrome.ctb"); + psv.SetPlotCentered(ps, true); + psv.SetUseStandardScale(ps, true); + psv.SetStdScaleType(ps, StdScaleType.ScaleToFit); + psv.SetPlotRotation(ps, frame.Rotation); + + // We need a PlotInfo object + // linked to the layout + pi.Layout = acBlkTblRec.LayoutId; + + // Make the layout we're plotting current + LayoutManager.Current.CurrentLayout = lo.LayoutName; + // We need to link the PlotInfo to the + // PlotSettings and then validate it + + pi.OverrideSettings = ps; + + piv.Validate(pi); + + if (numSheet == 1) + { + ppd.set_PlotMsgString(PlotMessageIndex.DialogTitle, "Custom Plot Progress"); + ppd.set_PlotMsgString(PlotMessageIndex.CancelJobButtonMessage, "Cancel Job"); + ppd.set_PlotMsgString(PlotMessageIndex.CancelSheetButtonMessage, "Cancel Sheet"); + ppd.set_PlotMsgString(PlotMessageIndex.SheetSetProgressCaption, "Sheet Set Progress"); + ppd.set_PlotMsgString(PlotMessageIndex.SheetProgressCaption, "Sheet Progress"); + + ppd.LowerPlotProgressRange = 0; + ppd.UpperPlotProgressRange = 100; + ppd.PlotProgressPos = 0; + + // Let's start the plot, at last + ppd.OnBeginPlot(); + ppd.IsVisible = true; + pe.BeginPlot(ppd, null); + // We'll be plotting a single document // Let's plot to file + path = PrintDoc.Name.ToUpper().Replace(".DWG", string.Format("{0}{1}", frame.BKName, ".PDF")); + pe.BeginDocument(pi, PrintDoc.Name, null, 1, true, path); + } + + // Which may contain multiple sheets + ppd.StatusMsgString = "Plotting " + PrintDoc.Name.Substring(PrintDoc.Name.LastIndexOf("\\") + 1) + + " - sheet " + numSheet.ToString() + + " of " + frames.Length.ToString(); + + ppd.OnBeginSheet(); + ppd.LowerSheetProgressRange = 0; + ppd.UpperSheetProgressRange = 100; + ppd.SheetProgressPos = 0; + PlotPageInfo ppi = new PlotPageInfo(); + + pe.BeginPage(ppi, pi, frames.Length == numSheet, null); + pe.BeginGenerateGraphics(null); + ppd.SheetProgressPos = 50; + pe.EndGenerateGraphics(null); + + // Finish the sheet + pe.EndPage(null); + ppd.SheetProgressPos = 100; + + + ppd.OnEndSheet(); + numSheet++; + } + + // Finish the document + pe.EndDocument(null); + // And finish the plot + ppd.PlotProgressPos = 100; + ppd.OnEndPlot(); + + pe.EndPlot(null); + ppd.Dispose(); + + } + + + } + } + else + { + PrintDoc.Editor.WriteMessage("\nAnother plot is in progress."); + } + // Thread.Sleep(30000); + Application.SetSystemVariable("BACKGROUNDPLOT", bgPlot); + tr.Commit(); + + + } + //m_DocumentLock.Dispose(); + return path; + } + + // 检查是否存在边框 + private PrintFrame[] CheckModelSpaceTitle() + { + //DocumentLock m_DocumentLock = ZwSoft.ZwCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.LockDocument(); + Database acCurDb = PrintDoc.Database; + List lstFrame = new List(); + using (Transaction acTrans = acCurDb.TransactionManager.StartTransaction()) + { + BlockTable acBlkTbl; + acBlkTbl = acTrans.GetObject(acCurDb.BlockTableId, + OpenMode.ForRead) as BlockTable; + + // Open the Block table record for read + BlockTableRecord acBlkTblRec; + + acBlkTblRec = acTrans.GetObject(acBlkTbl[BlockTableRecord.ModelSpace], + OpenMode.ForRead) as BlockTableRecord; + BlockReference reference; + BlockTableRecordEnumerator enumbtr = acBlkTblRec.GetEnumerator(); + while (enumbtr.MoveNext()) + { + Entity entity = acTrans.GetObject(enumbtr.Current, OpenMode.ForRead) as Entity; + + if (entity is BlockReference) + { + + reference = entity as BlockReference; + //int i = m_Frame.BinarySearch(new PrintFrame() { BKName = reference.Name }, new FrameCompare()); + int i = -1; + for (int j = 0; j < m_Frame.Count; j++) + { + if (string.Compare((m_Frame[j] as PrintFrame).BKName, reference.Name, true) == 0) + { + i = j; + break; + } + } + + + if (i > -1) + { + Extents2d e2dBound = new Extents2d(reference.Bounds.Value.MinPoint.X, reference.Bounds.Value.MinPoint.Y, reference.Bounds.Value.MaxPoint.X, reference.Bounds.Value.MaxPoint.Y); + (m_Frame[i] as PrintFrame).PrintBound = e2dBound; + PrintFrame frm = new PrintFrame(); + frm.Clone((m_Frame[i] as PrintFrame)); + lstFrame.Add(frm); + } + + } + } + + acTrans.Commit(); + } + //m_DocumentLock.Dispose(); + return lstFrame.ToArray(); + } + + public Document PrintDoc + { + get; + set; + } + + + } +} diff --git a/hello/Query.cs b/hello/Query.cs new file mode 100644 index 0000000..a7bdcf5 --- /dev/null +++ b/hello/Query.cs @@ -0,0 +1,288 @@ +//================================================== +// +// @@ +// +//================================================== + +using System; + +using Teamcenter.ClientX; +using Teamcenter.Schemas.Soa._2006_03.Exceptions; + +//Include the Saved Query Service Interface +using Teamcenter.Services.Strong.Query; + +// Input and output structures for the service operations +// Note: the different namespace from the service interface +using Teamcenter.Services.Strong.Query._2006_03.SavedQuery; + +using ImanQuery = Teamcenter.Soa.Client.Model.Strong.ImanQuery; + + +namespace Teamcenter.Hello +{ +public class Query +{ + public static ZwSoft.ZwCAD.EditorInput.Editor ed1 = ZwSoft.ZwCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; + public static Soa.Client.Model.ModelObject queryItemRevByID(String itemId,String revId) + { + ImanQuery query = null; + Soa.Client.Model.ModelObject obj = null; + Soa.Client.Model.ModelObject[] objs = null; + // Get the service stub + SavedQueryService queryService = SavedQueryService.getService(Session.getConnection()); + + try + { + + // ***************************** + // Execute the service operation + // ***************************** + GetSavedQueriesResponse savedQueries = queryService.GetSavedQueries(); + + + if (savedQueries.Queries.Length == 0) + { + ed1.WriteMessage("There are no saved queries in the system."); + return null; + } + + // Find one called 'Item Name' + for (int i = 0; i < savedQueries.Queries.Length; i++) + { + + if (savedQueries.Queries[i].Name.Equals("ConnorItemRevQuery")) + { + query = savedQueries.Queries[i].Query; + break; + } + } + } + catch (ServiceException e) + { + ed1.WriteMessage("GetSavedQueries service request failed."); + ed1.WriteMessage(e.Message); + return null; + } + + if (query == null) + { + ed1.WriteMessage("There is not an 'ConnorItemRevQuery' query."); + return null; + + try + { + // Search for all Items, returning a maximum of 25 objects + Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryInput[] savedQueryInput = new Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryInput[1]; + savedQueryInput[0] = new Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryInput(); + savedQueryInput[0].Query = query; + savedQueryInput[0].MaxNumToReturn = 25; + savedQueryInput[0].LimitListCount = 0; + savedQueryInput[0].LimitList = new Teamcenter.Soa.Client.Model.ModelObject[0]; + savedQueryInput[0].Entries = new String[] { "ConnorItemID", "ConnorItemRevID" }; + savedQueryInput[0].Values = new String[2]; + savedQueryInput[0].Values[0] = itemId; + savedQueryInput[0].Values[1] = revId; + savedQueryInput[0].MaxNumToInflate = 25; + + //***************************** + //Execute the service operation + //***************************** + Teamcenter.Services.Strong.Query._2007_06.SavedQuery.ExecuteSavedQueriesResponse savedQueryResult = queryService.ExecuteSavedQueries(savedQueryInput); + + Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryResults found = savedQueryResult.ArrayOfResults[0]; + objs = found.Objects; + if (found.NumOfObjects > 0) + obj = found.Objects[0]; + ed1.WriteMessage("Found count "+found.NumOfObjects); + ed1.WriteMessage("Found Items:"); + // Teamcenter.ClientX.Session.printObjects(found.Objects); + } + catch (ServiceException e) + { + ed1.WriteMessage("ExecuteSavedQuery service request failed."); + ed1.WriteMessage(e.Message); + return null; + } + + + + } + return obj; + } + /// + /// query Item by id + /// + /// + /// + public static Soa.Client.Model.ModelObject queryItemByID(String itemId) + { + ImanQuery query = null; + Soa.Client.Model.ModelObject obj = null; + Soa.Client.Model.ModelObject[] objs = null; + // Get the service stub + SavedQueryService queryService = SavedQueryService.getService(Session.getConnection()); + + try + { + + // ***************************** + // Execute the service operation + // ***************************** + GetSavedQueriesResponse savedQueries = queryService.GetSavedQueries(); + + + if (savedQueries.Queries.Length == 0) + { + ed1.WriteMessage("There are no saved queries in the system."); + return null; + } + + // Find one called 'Item Name' + for (int i = 0; i < savedQueries.Queries.Length; i++) + { + + if (savedQueries.Queries[i].Name.Equals("ConnorItemQuery")) + { + query = savedQueries.Queries[i].Query; + break; + } + } + } + catch (ServiceException e) + { + ed1.WriteMessage("GetSavedQueries service request failed."); + ed1.WriteMessage(e.Message); + return null; + } + + if (query == null) + { + ed1.WriteMessage("There is not an 'ConnorItemQuery' query."); + return null; + + try + { + // Search for all Items, returning a maximum of 25 objects + Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryInput[] savedQueryInput = new Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryInput[1]; + savedQueryInput[0] = new Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryInput(); + savedQueryInput[0].Query = query; + savedQueryInput[0].MaxNumToReturn = 25; + savedQueryInput[0].LimitListCount = 0; + savedQueryInput[0].LimitList = new Teamcenter.Soa.Client.Model.ModelObject[0]; + savedQueryInput[0].Entries = new String[] { "ConnorItemID" }; + savedQueryInput[0].Values = new String[1]; + savedQueryInput[0].Values[0] = itemId; + savedQueryInput[0].MaxNumToInflate = 25; + + //***************************** + //Execute the service operation + //***************************** + Teamcenter.Services.Strong.Query._2007_06.SavedQuery.ExecuteSavedQueriesResponse savedQueryResult = queryService.ExecuteSavedQueries(savedQueryInput); + + Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryResults found = savedQueryResult.ArrayOfResults[0]; + objs = found.Objects; + if (found.NumOfObjects > 0) + obj = found.Objects[0]; + ed1.WriteMessage("Found count ="+found.NumOfObjects); + ed1.WriteMessage("Found Items:"); + // Teamcenter.ClientX.Session.printObjects(found.Objects); + } + catch (ServiceException e) + { + ed1.WriteMessage("ExecuteSavedQuery service request failed."); + ed1.WriteMessage(e.Message); + return null; + } + + + + } + return obj; + } + /** + * Perform a simple query of the database + * + */ + public void queryItems() + { + + ImanQuery query = null; + + // Get the service stub + SavedQueryService queryService = SavedQueryService.getService(Session.getConnection()); + + try + { + + // ***************************** + // Execute the service operation + // ***************************** + GetSavedQueriesResponse savedQueries = queryService.GetSavedQueries(); + + + if (savedQueries.Queries.Length == 0) + { + Console.Out.WriteLine("There are no saved queries in the system."); + return; + } + + // Find one called 'Item Name' + for (int i = 0; i < savedQueries.Queries.Length; i++) + { + + if (savedQueries.Queries[i].Name.Equals("Item Name")) + { + query = savedQueries.Queries[i].Query; + break; + } + } + } + catch (ServiceException e) + { + Console.Out.WriteLine("GetSavedQueries service request failed."); + Console.Out.WriteLine(e.Message); + return; + } + + if (query == null) + { + ed1.WriteMessage("There is not an 'Item Name' query."); + return; + } + + try + { + // Search for all Items, returning a maximum of 25 objects + Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryInput[] savedQueryInput = new Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryInput[1]; + savedQueryInput[0] = new Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryInput(); + savedQueryInput[0].Query = query; + savedQueryInput[0].MaxNumToReturn = 25; + savedQueryInput[0].LimitListCount = 0; + savedQueryInput[0].LimitList = new Teamcenter.Soa.Client.Model.ModelObject[0]; + savedQueryInput[0].Entries = new String[] { "Item Name" }; + savedQueryInput[0].Values = new String[1]; + savedQueryInput[0].Values[0] = "*"; + savedQueryInput[0].MaxNumToInflate = 25; + + //***************************** + //Execute the service operation + //***************************** + Teamcenter.Services.Strong.Query._2007_06.SavedQuery.ExecuteSavedQueriesResponse savedQueryResult = queryService.ExecuteSavedQueries(savedQueryInput); + + Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryResults found = savedQueryResult.ArrayOfResults[0]; + + System.Console.Out.WriteLine(""); + System.Console.Out.WriteLine("Found Items:"); + Teamcenter.ClientX.Session.printObjects( found.Objects ); + } + catch (ServiceException e) + { + Console.Out.WriteLine("ExecuteSavedQuery service request failed."); + Console.Out.WriteLine(e.Message); + return; + } + + } +} +} diff --git a/hello/Tool.cs b/hello/Tool.cs new file mode 100644 index 0000000..46df565 --- /dev/null +++ b/hello/Tool.cs @@ -0,0 +1,712 @@ +using System; +using System.Collections.Generic; +using System.Collections; +using System.Text; +using ZwSoft.ZwCAD.DatabaseServices; +using ZwSoft.ZwCAD.Runtime; +using ZwSoft.ZwCAD.Geometry; +using ZwSoft.ZwCAD.ApplicationServices; +using ZwSoft.ZwCAD.EditorInput; + +using Teamcenter.Services.Strong.Query._2007_06.SavedQuery; +using Teamcenter.Hello; +using Teamcenter.Soa.Client; +using Teamcenter.ClientX; +using Teamcenter.Services.Strong.Core; +using Teamcenter.Soa.Client.Model; +using Teamcenter.Soa.Exceptions; +using Teamcenter.Services.Strong.Query; + +using Teamcenter.Services.Strong.Core._2007_06.DataManagement; +using Teamcenter.Schemas.Soa._2006_03.Exceptions; +using Teamcenter.Services.Strong.Query._2006_03.SavedQuery; + +using User = Teamcenter.Soa.Client.Model.Strong.User; +using Folder = Teamcenter.Soa.Client.Model.Strong.Folder; +using WorkspaceObject = Teamcenter.Soa.Client.Model.Strong.WorkspaceObject; +using Item = Teamcenter.Soa.Client.Model.Strong.Item; +using ItemRevision = Teamcenter.Soa.Client.Model.Strong.ItemRevision; +using ImanQuery = Teamcenter.Soa.Client.Model.Strong.ImanQuery; +using DataSet = Teamcenter.Soa.Client.Model.Strong.Dataset; + +using SavedQueryResults = Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryResults; + +namespace HelloTeamcenter.hello +{ + public class SortMXL:IComparer + { + public int Compare(MXLClass one, MXLClass two) + { + return one.Index_num.CompareTo(two.Index_num); + } + } + + class Tool + { + private BTLClass btlinfo; + private List bomlist = new List(); + private static User loginuser; + + public static User Loginuser + { + get { return Tool.loginuser; } + set { Tool.loginuser = value; } + } + + Editor ed = ZwSoft.ZwCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; + + public BTLClass getBTL(string btlname) + { + btlinfo = new BTLClass(); + Database db = HostApplicationServices.WorkingDatabase; + using (Transaction tran = db.TransactionManager.StartTransaction()) + { + BlockTable blt = tran.GetObject(db.BlockTableId, OpenMode.ForRead) as BlockTable; + //ed.WriteMessage("名称"+blt.GetType().Name); + + if (blt.Has(btlname)) + { + BlockTableRecord bltr = tran.GetObject(db.CurrentSpaceId, OpenMode.ForRead) as BlockTableRecord; + foreach (ObjectId item in bltr) + { + Entity ent = tran.GetObject(item, OpenMode.ForRead) as Entity; + //ed.WriteMessage(ent.GetType().Name + "\n"); + if (ent.GetType().Name == "BlockReference") + { + BlockReference bref = (BlockReference)ent; + //ed.WriteMessage(bref.GetType().Name + "====\n"); + //ed.WriteMessage(bref.Name + "====\n"); + if (bref.Name == btlname) + { + ed.WriteMessage("块名称:" + bref.Name + "\n"); + if (bref.AttributeCollection.Count != 0) + { + System.Collections.IEnumerator bRefEnum = bref.AttributeCollection.GetEnumerator(); + + while (bRefEnum.MoveNext()) + { + ObjectId aId = (ObjectId)bRefEnum.Current;//这一句极其关键 + + AttributeReference aRef = (AttributeReference)tran.GetObject(aId, OpenMode.ForRead); + //ed.WriteMessage("属性:" + aRef.Tag + "属性值:" + aRef.TextString + "\n"); + if(aRef.Tag == "图号") + { + btlinfo.Item_id = aRef.TextString; + } + else if (aRef.Tag == "零/部件名称") + { + btlinfo.Item_name = aRef.TextString; + } + else if (aRef.Tag == "项目-产品名称") + { + btlinfo.Projectname = aRef.TextString; + } + else if (aRef.Tag == "代号") + { + btlinfo.Partnumber = aRef.TextString; + } + else if (aRef.Tag == "比例") + { + btlinfo.Proportion = aRef.TextString; + } + else if (aRef.Tag == "图幅") + { + btlinfo.Mapsheet = aRef.TextString; + } + else if (aRef.Tag == "版本") + { + btlinfo.Item_revision_id = aRef.TextString; + } + else if (aRef.Tag == "重量") + { + btlinfo.Weight = aRef.TextString; + } + else if (aRef.Tag == "材料牌号") + { + btlinfo.Materialgrade = aRef.TextString; + } + else if (aRef.Tag == "共几页") + { + btlinfo.Allpage = aRef.TextString; + if (btlinfo.Allpage == "") + btlinfo.Allpage = "1"; + } + else if (aRef.Tag == "第几页") + { + btlinfo.Pagenumber = aRef.TextString; + if (btlinfo.Pagenumber == "") + btlinfo.Pagenumber = "1"; + } + } + } + } + } + + } + + } + tran.Commit(); + } + return btlinfo; + } + + public string getQZL(string qzlname) + { + string hedao = ""; + Database db = HostApplicationServices.WorkingDatabase; + using (Transaction tran = db.TransactionManager.StartTransaction()) + { + BlockTable blt = tran.GetObject(db.BlockTableId, OpenMode.ForRead) as BlockTable; + //ed.WriteMessage("名称"+blt.GetType().Name); + + if (blt.Has(qzlname)) + { + BlockTableRecord bltr = tran.GetObject(db.CurrentSpaceId, OpenMode.ForRead) as BlockTableRecord; + foreach (ObjectId item in bltr) + { + Entity ent = tran.GetObject(item, OpenMode.ForRead) as Entity; + //ed.WriteMessage(ent.GetType().Name + "\n"); + if (ent.GetType().Name == "BlockReference") + { + BlockReference bref = (BlockReference)ent; + //ed.WriteMessage(bref.GetType().Name + "====\n"); + //ed.WriteMessage(bref.Name + "====\n"); + if (bref.Name == qzlname) + { + ed.WriteMessage("块名称:" + bref.Name + "\n"); + if (bref.AttributeCollection.Count != 0) + { + System.Collections.IEnumerator bRefEnum = bref.AttributeCollection.GetEnumerator(); + + while (bRefEnum.MoveNext()) + { + ObjectId aId = (ObjectId)bRefEnum.Current;//这一句极其关键 + + AttributeReference aRef = (AttributeReference)tran.GetObject(aId, OpenMode.ForRead); + //ed.WriteMessage("属性:" + aRef.Tag + "属性值:" + aRef.TextString + "\n"); + if (aRef.Tag == "校核") + { + hedao = "非核岛"; + } + } + } + } + } + + } + + } + tran.Commit(); + } + return hedao; + } + + + public List getMXL(string mxlname) + { + bomlist.Clear(); + + Database db = HostApplicationServices.WorkingDatabase; + using (Transaction tran = db.TransactionManager.StartTransaction()) + { + BlockTable blt = tran.GetObject(db.BlockTableId, OpenMode.ForRead) as BlockTable; + //ed.WriteMessage("名称"+blt.GetType().Name); + + if (blt.Has(mxlname)) + { + BlockTableRecord bltr = tran.GetObject(db.CurrentSpaceId, OpenMode.ForRead) as BlockTableRecord; + foreach (ObjectId item in bltr) + { + Entity ent = tran.GetObject(item, OpenMode.ForRead) as Entity; + //ed.WriteMessage(ent.GetType().Name + "\n"); + if (ent.GetType().Name == "BlockReference") + { + BlockReference bref = (BlockReference)ent; + //ed.WriteMessage(bref.GetType().Name + "====\n"); + //ed.WriteMessage(bref.Name + "====\n"); + if (bref.Name == mxlname) + { + ed.WriteMessage("块名称:" + bref.Name + "\n"); + if (bref.AttributeCollection.Count != 0) + { + System.Collections.IEnumerator bRefEnum = bref.AttributeCollection.GetEnumerator(); + MXLClass mxlinfo = new MXLClass(); + while (bRefEnum.MoveNext()) + { + ObjectId aId = (ObjectId)bRefEnum.Current;//这一句极其关键 + + AttributeReference aRef = (AttributeReference)tran.GetObject(aId, OpenMode.ForRead); + //ed.WriteMessage("属性:" + aRef.Tag + "属性值:" + aRef.TextString + "\n"); + if (aRef.Tag == "序号") + { + mxlinfo.Index = aRef.TextString; + mxlinfo.Index_num = Convert.ToInt32(mxlinfo.Index); + } + else if (aRef.Tag == "图号") + { + mxlinfo.Item_id = aRef.TextString; + } + else if (aRef.Tag == "代号") + { + mxlinfo.Partnumber = aRef.TextString; + } + else if (aRef.Tag == "名称") + { + mxlinfo.Name = aRef.TextString; + } + else if (aRef.Tag == "DESCRIPTION") + { + mxlinfo.Object_desc = aRef.TextString; + } + else if (aRef.Tag == "数量") + { + mxlinfo.Count = aRef.TextString; + } + else if (aRef.Tag == "材料") + { + mxlinfo.Material = aRef.TextString; + } + else if (aRef.Tag == "单重") + { + mxlinfo.Perweight = aRef.TextString; + } + else if (aRef.Tag == "总重") + { + mxlinfo.Tolweight = aRef.TextString; + } + else if (aRef.Tag == "备注") + { + mxlinfo.Memo = aRef.TextString; + } + } + bomlist.Add(mxlinfo); + } + } + } + + } + + } + tran.Commit(); + } + return bomlist; + } + + public List sortbomlist(List sortbomlist) + { + for (int i = 0; i < sortbomlist.Count; i++) + { + sortbomlist[i].Itemtype = initItemType(sortbomlist[i].Item_id, sortbomlist[i].Material); + } + sortbomlist.Sort(new SortMXL()); + return sortbomlist; + } + + public string initItemType(string item_id, string material) + { + string type = ""; + int pos = item_id.IndexOf("DR"); + ed.WriteMessage("pos: " + pos + "\n"); + if (pos >= 0) + { + string sub = item_id.Substring(pos + 2); + ed.WriteMessage("sub :" + sub + "\n"); + char[] subchar = sub.ToCharArray(); + int i = 0; + if (subchar[i].ToString() == "8") + { + ed.WriteMessage("是否含有CG-:" + item_id.Contains("CG-").ToString()); + if (item_id.Contains("CG-")) + { + type = "D5PruchasePart"; + return type; + } + } + for (; i < subchar.Length; i++) + { + if (subchar[i].ToString() == "0") + continue; + else + { + if (material == "装配件") + { + type = "D5AsmPart"; + return type; + } + else + { + type = "D5Part"; + return type; + } + } + } + if (material == "装配件" && i == subchar.Length) + { + type = "D5Product"; + } + } + else + { + if(item_id.StartsWith("104") || item_id.StartsWith("105")) + type = "D5StdFasteners"; + else if(item_id.StartsWith("TC")) + type = "D5CommonParts"; + else + type = "D5Part"; + } + + return type; + } + + + public string getLOVProductType(string item_id,string itemtype,string hedao) + { + string productTypes = ""; + if (itemtype == "D5Product") + { + if (hedao == "非核岛") + productTypes = "117"; + else + productTypes = "116"; + } + else if (itemtype == "D5AsmPart") + { + if (hedao == "非核岛") + productTypes = "115"; + else + productTypes = "114"; + } + else if (itemtype == "D5Part") + { + if (hedao == "非核岛") + productTypes = "113"; + else + productTypes = "112"; + } + else if (itemtype == "D5StdFasteners") + { + if(item_id.StartsWith("104")) + productTypes = "104"; + else + productTypes = "105"; + } + else if (itemtype == "D5CommonPartss") + { + if (item_id.StartsWith("120")) + productTypes = "120"; + else + productTypes = "121"; + }//此处需要增加D5PruchasePart类型的核岛判断 + return productTypes; + } + + + + public SavedQueryResults getSearchItem(string item_id) + { + ImanQuery query = null; + SavedQueryService queryService = SavedQueryService.getService(Session.getConnection()); + try + { + GetSavedQueriesResponse savedQueries = queryService.GetSavedQueries(); + if (savedQueries.Queries.Length == 0) + { + ed.WriteMessage("There are no saved queries in the system.\n"); + } + for (int i = 0; i < savedQueries.Queries.Length; i++) + { + + if (savedQueries.Queries[i].Name.Equals("D5Item ID")) + { + query = savedQueries.Queries[i].Query; + break; + } + } + } + catch (ServiceException e) + { + ed.WriteMessage("GetSavedQueries service request failed.\n"); + ed.WriteMessage(e.Message); + return null; + } + + if (query == null) + { + ed.WriteMessage("There is not an 'D5Item ID' query.\n"); + } + + try + { + // Search for all Items, returning a maximum of 25 objects + Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryInput[] savedQueryInput = new Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryInput[1]; + savedQueryInput[0] = new Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryInput(); + savedQueryInput[0].Query = query; + //savedQueryInput[0].Entries = new String[] { "Item ID" }; + savedQueryInput[0].Entries = new String[] { "零组件 ID" }; + savedQueryInput[0].Values = new String[1]; + savedQueryInput[0].Values[0] = item_id; + + Teamcenter.Services.Strong.Query._2007_06.SavedQuery.ExecuteSavedQueriesResponse savedQueryResult = queryService.ExecuteSavedQueries(savedQueryInput); + + Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryResults found = savedQueryResult.ArrayOfResults[0]; + + ed.WriteMessage("Found Items:"+ found.NumOfObjects +"\n"); + return found; + } + catch (ServiceException e) + { + ed.WriteMessage("ExecuteSavedQuery service request failed.\n"); + ed.WriteMessage(e.Message); + return null; + } + } + + public SavedQueryResults getSearchItem(string item_id,string name,string type,string owner) + { + ImanQuery query = null; + SavedQueryService queryService = SavedQueryService.getService(Session.getConnection()); + try + { + GetSavedQueriesResponse savedQueries = queryService.GetSavedQueries(); + if (savedQueries.Queries.Length == 0) + { + ed.WriteMessage("There are no saved queries in the system.\n"); + } + for (int i = 0; i < savedQueries.Queries.Length; i++) + { + + if (savedQueries.Queries[i].Name.Equals("D5SearchForItem")) + { + query = savedQueries.Queries[i].Query; + break; + } + } + } + catch (ServiceException e) + { + ed.WriteMessage("GetSavedQueries service request failed.\n"); + ed.WriteMessage(e.Message); + return null; + } + + if (query == null) + { + ed.WriteMessage("There is not an 'D5SearchForItem' query.\n"); + } + + try + { + Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryInput[] savedQueryInput = new Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryInput[1]; + savedQueryInput[0] = new Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryInput(); + savedQueryInput[0].Query = query; + //savedQueryInput[0].Entries = new String[] { "Name", "Item ID", "Type", "Owning User" }; + savedQueryInput[0].Entries = new String[] { "名称", "零组件 ID", "类型", "所有权用户" }; + savedQueryInput[0].Values = new String[4]; + savedQueryInput[0].Values[0] = name; + savedQueryInput[0].Values[1] = item_id; + savedQueryInput[0].Values[2] = type; + savedQueryInput[0].Values[3] = owner; + + Teamcenter.Services.Strong.Query._2007_06.SavedQuery.ExecuteSavedQueriesResponse savedQueryResult = queryService.ExecuteSavedQueries(savedQueryInput); + + Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryResults found = savedQueryResult.ArrayOfResults[0]; + + ed.WriteMessage("Found Items:" + found.NumOfObjects + "\n"); + return found; + } + catch (ServiceException e) + { + ed.WriteMessage("ExecuteSavedQuery service request failed.\n"); + ed.WriteMessage(e.Message); + return null; + } + } + + public SavedQueryResults getSearchUser() + { + ImanQuery query = null; + SavedQueryService queryService = SavedQueryService.getService(Session.getConnection()); + try + { + GetSavedQueriesResponse savedQueries = queryService.GetSavedQueries(); + if (savedQueries.Queries.Length == 0) + { + ed.WriteMessage("There are no saved queries in the system.\n"); + } + for (int i = 0; i < savedQueries.Queries.Length; i++) + { + + if (savedQueries.Queries[i].Name.Equals("D5SearchForUser")) + { + query = savedQueries.Queries[i].Query; + break; + } + } + } + catch (ServiceException e) + { + ed.WriteMessage("GetSavedQueries service request failed.\n"); + ed.WriteMessage(e.Message); + return null; + } + + if (query == null) + { + ed.WriteMessage("There is not an 'D5SearchForUser' query.\n"); + } + + try + { + // Search for all Items, returning a maximum of 25 objects + Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryInput[] savedQueryInput = new Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryInput[1]; + savedQueryInput[0] = new Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryInput(); + savedQueryInput[0].Query = query; + //savedQueryInput[0].Entries = new String[] { "User Id" }; + savedQueryInput[0].Entries = new String[] { "用户 ID" }; + savedQueryInput[0].Values = new String[1]; + savedQueryInput[0].Values[0] = "*"; + + Teamcenter.Services.Strong.Query._2007_06.SavedQuery.ExecuteSavedQueriesResponse savedQueryResult = queryService.ExecuteSavedQueries(savedQueryInput); + + Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryResults found = savedQueryResult.ArrayOfResults[0]; + + ed.WriteMessage("Found Users:" + found.NumOfObjects + "\n"); + return found; + } + catch (ServiceException e) + { + ed.WriteMessage("ExecuteSavedQuery service request failed.\n"); + ed.WriteMessage(e.Message); + return null; + } + } + + + public SavedQueryResults getSearchType(string d5MaterialGrades) + { + ImanQuery query = null; + SavedQueryService queryService = SavedQueryService.getService(Session.getConnection()); + try + { + GetSavedQueriesResponse savedQueries = queryService.GetSavedQueries(); + if (savedQueries.Queries.Length == 0) + { + ed.WriteMessage("There are no saved queries in the system.\n"); + } + for (int i = 0; i < savedQueries.Queries.Length; i++) + { + + if (savedQueries.Queries[i].Name.Equals("D5SearchForType")) + { + query = savedQueries.Queries[i].Query; + break; + } + } + } + catch (ServiceException e) + { + ed.WriteMessage("GetSavedQueries service request failed.\n"); + ed.WriteMessage(e.Message); + return null; + } + + if (query == null) + { + ed.WriteMessage("There is not an 'D5SearchForType' query.\n"); + } + + try + { + // Search for all Items, returning a maximum of 25 objects + Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryInput[] savedQueryInput = new Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryInput[1]; + savedQueryInput[0] = new Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryInput(); + savedQueryInput[0].Query = query; + //savedQueryInput[0].Entries = new String[] { "Name", "Type" }; + savedQueryInput[0].Entries = new String[] { "名称", "类型" }; + savedQueryInput[0].Values = new String[2]; + savedQueryInput[0].Values[0] = d5MaterialGrades; + savedQueryInput[0].Values[1] = "D5MaterialGrade"; + + Teamcenter.Services.Strong.Query._2007_06.SavedQuery.ExecuteSavedQueriesResponse savedQueryResult = queryService.ExecuteSavedQueries(savedQueryInput); + + Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryResults found = savedQueryResult.ArrayOfResults[0]; + + ed.WriteMessage("Found Type:" + found.NumOfObjects + "\n"); + return found; + } + catch (ServiceException e) + { + ed.WriteMessage("ExecuteSavedQuery service request failed.\n"); + ed.WriteMessage(e.Message); + return null; + } + } + + public Hashtable getTCPreferences(string prefername) + { + Hashtable prefValues = new Hashtable(); + SessionService sessionservice = SessionService.getService(Session.getConnection()); + Teamcenter.Services.Strong.Core._2007_01.Session.ScopedPreferenceNames[] prefNames = new Teamcenter.Services.Strong.Core._2007_01.Session.ScopedPreferenceNames[1]; + Teamcenter.Services.Strong.Core._2007_01.Session.ScopedPreferenceNames scopedPref = new Teamcenter.Services.Strong.Core._2007_01.Session.ScopedPreferenceNames(); + scopedPref.Names = new String[]{ prefername }; + scopedPref.Scope = "site"; + prefNames[0] = scopedPref; + + + Teamcenter.Services.Strong.Core._2007_01.Session.MultiPreferencesResponse resp = sessionservice.GetPreferences(prefNames); + Teamcenter.Services.Strong.Core._2007_01.Session.ReturnedPreferences[] preferenceResp = resp.Preferences; + prefValues.Add(preferenceResp[0].Name, preferenceResp[0].Values); + //string temp = preferenceResp[0].Name.ToString(); + //string[] value = (string[])prefValues[preferenceResp[0].Name.ToString()]; + + + + return prefValues; + } + + /* + *20240313首选项来获取bom备注列的拼接属性 + * + */ + public String getTCRemarkPreferences(string prefername) + { + SessionService sessionservice = SessionService.getService(Session.getConnection()); + Teamcenter.Services.Strong.Core._2007_01.Session.ScopedPreferenceNames[] prefNames = new Teamcenter.Services.Strong.Core._2007_01.Session.ScopedPreferenceNames[1]; + Teamcenter.Services.Strong.Core._2007_01.Session.ScopedPreferenceNames scopedPref = new Teamcenter.Services.Strong.Core._2007_01.Session.ScopedPreferenceNames(); + scopedPref.Names = new String[] { prefername }; + scopedPref.Scope = "site"; + prefNames[0] = scopedPref; + + + Teamcenter.Services.Strong.Core._2007_01.Session.MultiPreferencesResponse resp = sessionservice.GetPreferences(prefNames); + Teamcenter.Services.Strong.Core._2007_01.Session.ReturnedPreferences[] preferenceResp = resp.Preferences; + return preferenceResp[0].Values[0]; + } + + //分割字符串,取出对应类型的Item的ID + public string getCorrespondItemID(string type,string[] tempprevalues) + { + string itemid = ""; + Hashtable temptable = new Hashtable(); + for (int i = 0; i < tempprevalues.Length; i++) + { + string tempvalueline = tempprevalues[i]; + string[] tempvalue = tempvalueline.Split('='); + temptable.Add(tempvalue[0].ToString(), tempvalue[1].ToString()); + } + + if (temptable.Count <= 0) + itemid = ""; + else + { + if (temptable.ContainsKey(type)) + { + itemid = (string)temptable[type]; + } + } + return itemid; + } + + } + +} diff --git a/logo[1].jpg b/logo[1].jpg new file mode 100644 index 0000000..0e302f2 Binary files /dev/null and b/logo[1].jpg differ diff --git a/obj/Debug/.NETFramework,Version=v4.7.2.AssemblyAttributes.cs b/obj/Debug/.NETFramework,Version=v4.7.2.AssemblyAttributes.cs new file mode 100644 index 0000000..3871b18 --- /dev/null +++ b/obj/Debug/.NETFramework,Version=v4.7.2.AssemblyAttributes.cs @@ -0,0 +1,4 @@ +// +using System; +using System.Reflection; +[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] diff --git a/obj/Debug/ConnorAutocad.dll b/obj/Debug/ConnorAutocad.dll new file mode 100644 index 0000000..1869bef Binary files /dev/null and b/obj/Debug/ConnorAutocad.dll differ diff --git a/obj/Debug/ConnorAutocad.pdb b/obj/Debug/ConnorAutocad.pdb new file mode 100644 index 0000000..2d0751b Binary files /dev/null and b/obj/Debug/ConnorAutocad.pdb differ diff --git a/obj/Debug/DFHMAutocad.dll b/obj/Debug/DFHMAutocad.dll new file mode 100644 index 0000000..3dd701a Binary files /dev/null and b/obj/Debug/DFHMAutocad.dll differ diff --git a/obj/Debug/DFHMAutocad.pdb b/obj/Debug/DFHMAutocad.pdb new file mode 100644 index 0000000..4aa2a10 Binary files /dev/null and b/obj/Debug/DFHMAutocad.pdb differ diff --git a/obj/Debug/DesignTimeResolveAssemblyReferences.cache b/obj/Debug/DesignTimeResolveAssemblyReferences.cache new file mode 100644 index 0000000..59336bb Binary files /dev/null and b/obj/Debug/DesignTimeResolveAssemblyReferences.cache differ diff --git a/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache b/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache new file mode 100644 index 0000000..538f32b Binary files /dev/null and b/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache differ diff --git a/obj/Debug/HelloTeamcenter.Properties.Resources.resources b/obj/Debug/HelloTeamcenter.Properties.Resources.resources new file mode 100644 index 0000000..2b1170b Binary files /dev/null and b/obj/Debug/HelloTeamcenter.Properties.Resources.resources differ diff --git a/obj/Debug/HelloTeamcenter.csproj.AssemblyReference.cache b/obj/Debug/HelloTeamcenter.csproj.AssemblyReference.cache new file mode 100644 index 0000000..8a4cd5f Binary files /dev/null and b/obj/Debug/HelloTeamcenter.csproj.AssemblyReference.cache differ diff --git a/obj/Debug/HelloTeamcenter.csproj.CopyComplete b/obj/Debug/HelloTeamcenter.csproj.CopyComplete new file mode 100644 index 0000000..e69de29 diff --git a/obj/Debug/HelloTeamcenter.csproj.CoreCompileInputs.cache b/obj/Debug/HelloTeamcenter.csproj.CoreCompileInputs.cache new file mode 100644 index 0000000..c619f7a --- /dev/null +++ b/obj/Debug/HelloTeamcenter.csproj.CoreCompileInputs.cache @@ -0,0 +1 @@ +f15e8b09343181f6728c1e8dcc49489045ef21aa diff --git a/obj/Debug/HelloTeamcenter.csproj.FileListAbsolute.txt b/obj/Debug/HelloTeamcenter.csproj.FileListAbsolute.txt new file mode 100644 index 0000000..2b6fbdb --- /dev/null +++ b/obj/Debug/HelloTeamcenter.csproj.FileListAbsolute.txt @@ -0,0 +1,553 @@ +D:\soa_client\net\samples\HelloTeamcenter\bin\Debug\HelloTeamcenter.pdb +D:\soa_client\net\samples\HelloTeamcenter\bin\Debug\TcSoaClient.dll +D:\soa_client\net\samples\HelloTeamcenter\bin\Debug\TcSoaCommon.dll +D:\soa_client\net\samples\HelloTeamcenter\bin\Debug\TcSoaCoreStrong.dll +D:\soa_client\net\samples\HelloTeamcenter\bin\Debug\TcSoaCoreTypes.dll +D:\soa_client\net\samples\HelloTeamcenter\bin\Debug\TcSoaQueryStrong.dll +D:\soa_client\net\samples\HelloTeamcenter\bin\Debug\TcSoaQueryTypes.dll +D:\soa_client\net\samples\HelloTeamcenter\bin\Debug\TcSoaStrongModel.dll +D:\soa_client\net\samples\HelloTeamcenter\bin\Debug\Teamcenter_SSOloader.dll +D:\soa_client\net\samples\HelloTeamcenter\obj\Debug\ResolveAssemblyReference.cache +D:\soa_client\net\samples\HelloTeamcenter\obj\Debug\HelloTeamcenter.pdb +D:\soa_client\net\samples\HelloTeamcenter\bin\Debug\HelloTeamcenter.dll.config +D:\soa_client\net\samples\HelloTeamcenter\bin\Debug\HelloTeamcenter.dll +D:\soa_client\net\samples\HelloTeamcenter\bin\Debug\acdbmgd.dll +D:\soa_client\net\samples\HelloTeamcenter\bin\Debug\acmgd.dll +D:\soa_client\net\samples\HelloTeamcenter\bin\Debug\Autodesk.AutoCAD.Interop.Common.dll +D:\soa_client\net\samples\HelloTeamcenter\bin\Debug\Autodesk.AutoCAD.Interop.dll +D:\soa_client\net\samples\HelloTeamcenter\obj\Debug\HelloTeamcenter.dll +D:\HelloTeamcenter\bin\Debug\acdbmgd.dll +D:\HelloTeamcenter\bin\Debug\acmgd.dll +D:\HelloTeamcenter\bin\Debug\Autodesk.AutoCAD.Interop.Common.dll +D:\HelloTeamcenter\bin\Debug\Autodesk.AutoCAD.Interop.dll +D:\HelloTeamcenter\obj\Debug\ResolveAssemblyReference.cache +D:\HelloTeamcenter\obj\Debug\HelloTeamcenter.form.Login.resources +D:\HelloTeamcenter\obj\Debug\HelloTeamcenter.Properties.Resources.resources +D:\HelloTeamcenter\obj\Debug\HelloTeamcenter.csproj.GenerateResource.Cache +D:\HelloTeamcenter\obj\Debug\HelloTeamcenter.form.OpenFromTC.resources +D:\HelloTeamcenter\bin\Debug\TcSoaDocumentManagementStrong.dll +D:\HelloTeamcenter\bin\Debug\TcSoaDocumentManagementTypes.dll +D:\HelloTeamcenter\bin\Debug\log4net.dll +D:\HelloTeamcenter\bin\Debug\FCCNetClientProxyv80.dll +D:\HelloTeamcenter\bin\Debug\FMSNetTicketv80.dll +D:\HelloTeamcenter\bin\Debug\FSCNetClientProxyv80.dll +D:\HelloTeamcenter\bin\Debug\TcSoaFMS.dll +D:\HelloTeamcenter\bin\Debug\TcSoaAdministrationStrong.dll +D:\HelloTeamcenter\bin\Debug\TcSoaAdministrationTypes.dll +D:\HelloTeamcenter\bin\Debug\TcSoaAiStrong.dll +D:\HelloTeamcenter\bin\Debug\TcSoaAiTypes.dll +D:\HelloTeamcenter\bin\Debug\TcSoaAllocationsStrong.dll +D:\HelloTeamcenter\bin\Debug\TcSoaAllocationsTypes.dll +D:\HelloTeamcenter\bin\Debug\TcSoaAsbAsmAlignmentStrong.dll +D:\HelloTeamcenter\bin\Debug\TcSoaAsbAsmAlignmentTypes.dll +D:\HelloTeamcenter\bin\Debug\TcSoaAsBuiltStrong.dll +D:\HelloTeamcenter\bin\Debug\TcSoaAsBuiltTypes.dll +D:\HelloTeamcenter\bin\Debug\TcSoaAsMaintainedStrong.dll +D:\HelloTeamcenter\bin\Debug\TcSoaAsMaintainedTypes.dll +D:\HelloTeamcenter\bin\Debug\TcSoaAuthorizedDataAccessStrong.dll +D:\HelloTeamcenter\bin\Debug\TcSoaAuthorizedDataAccessTypes.dll +D:\HelloTeamcenter\bin\Debug\TcSoaBomStrong.dll +D:\HelloTeamcenter\bin\Debug\TcSoaBomTypes.dll +D:\HelloTeamcenter\bin\Debug\TcSoaBusinessModelerStrong.dll +D:\HelloTeamcenter\bin\Debug\TcSoaBusinessModelerTypes.dll +D:\HelloTeamcenter\bin\Debug\TcSoaCadBomAlignmentStrong.dll +D:\HelloTeamcenter\bin\Debug\TcSoaCadBomAlignmentTypes.dll +D:\HelloTeamcenter\bin\Debug\TcSoaCadStrong.dll +D:\HelloTeamcenter\bin\Debug\TcSoaCadTypes.dll +D:\HelloTeamcenter\bin\Debug\TcSoaCaeStrong.dll +D:\HelloTeamcenter\bin\Debug\TcSoaCaeTypes.dll +D:\HelloTeamcenter\bin\Debug\TcSoaCalendarManagementStrong.dll +D:\HelloTeamcenter\bin\Debug\TcSoaCalendarManagementTypes.dll +D:\HelloTeamcenter\bin\Debug\TcSoaChangeManagementStrong.dll +D:\HelloTeamcenter\bin\Debug\TcSoaChangeManagementTypes.dll +D:\HelloTeamcenter\bin\Debug\TcSoaClassificationStrong.dll +D:\HelloTeamcenter\bin\Debug\TcSoaClassificationTypes.dll +D:\HelloTeamcenter\bin\Debug\TcSoaConfigurationStrong.dll +D:\HelloTeamcenter\bin\Debug\TcSoaConfigurationTypes.dll +D:\HelloTeamcenter\bin\Debug\TcSoaGlobalMultiSiteStrong.dll +D:\HelloTeamcenter\bin\Debug\TcSoaGlobalMultiSiteTypes.dll +D:\HelloTeamcenter\bin\Debug\TcSoaImportExportStrong.dll +D:\HelloTeamcenter\bin\Debug\TcSoaImportExportTypes.dll +D:\HelloTeamcenter\bin\Debug\TcSoaIssueManagementStrong.dll +D:\HelloTeamcenter\bin\Debug\TcSoaIssueManagementTypes.dll +D:\HelloTeamcenter\bin\Debug\TcSoaManufacturingStrong.dll +D:\HelloTeamcenter\bin\Debug\TcSoaManufacturingTypes.dll +D:\HelloTeamcenter\bin\Debug\TcSoaMESStrong.dll +D:\HelloTeamcenter\bin\Debug\TcSoaMESTypes.dll +D:\HelloTeamcenter\bin\Debug\TcSoaMultisiteStrong.dll +D:\HelloTeamcenter\bin\Debug\TcSoaMultisiteTypes.dll +D:\HelloTeamcenter\bin\Debug\TcSoaParameterManagementStrong.dll +D:\HelloTeamcenter\bin\Debug\TcSoaParameterManagementTypes.dll +D:\HelloTeamcenter\bin\Debug\TcSoaProductionManagementStrong.dll +D:\HelloTeamcenter\bin\Debug\TcSoaProductionManagementTypes.dll +D:\HelloTeamcenter\bin\Debug\TcSoaProjectManagementStrong.dll +D:\HelloTeamcenter\bin\Debug\TcSoaProjectManagementTypes.dll +D:\HelloTeamcenter\bin\Debug\TcSoaRdvStrong.dll +D:\HelloTeamcenter\bin\Debug\TcSoaRdvTypes.dll +D:\HelloTeamcenter\bin\Debug\TcSoaReportsStrong.dll +D:\HelloTeamcenter\bin\Debug\TcSoaReportsTypes.dll +D:\HelloTeamcenter\bin\Debug\TcSoaRequirementsManagementStrong.dll +D:\HelloTeamcenter\bin\Debug\TcSoaRequirementsManagementTypes.dll +D:\HelloTeamcenter\bin\Debug\TcSoaSrmIntegrationStrong.dll +D:\HelloTeamcenter\bin\Debug\TcSoaSrmIntegrationTypes.dll +D:\HelloTeamcenter\bin\Debug\TcSoaStrongModelAcadGmo.dll +D:\HelloTeamcenter\bin\Debug\TcSoaStrongModelAdsFoundation.dll +D:\HelloTeamcenter\bin\Debug\TcSoaStrongModelAsBuilt.dll +D:\HelloTeamcenter\bin\Debug\TcSoaStrongModelAsMaintained.dll +D:\HelloTeamcenter\bin\Debug\TcSoaStrongModelBrndMgmt.dll +D:\HelloTeamcenter\bin\Debug\TcSoaStrongModelCba.dll +D:\HelloTeamcenter\bin\Debug\TcSoaStrongModelCcdm.dll +D:\HelloTeamcenter\bin\Debug\TcSoaStrongModelCm.dll +D:\HelloTeamcenter\bin\Debug\TcSoaStrongModelCmtEbop.dll +D:\HelloTeamcenter\bin\Debug\TcSoaStrongModelCmtEmserver.dll +D:\HelloTeamcenter\bin\Debug\TcSoaStrongModelCmtPadTwp.dll +D:\HelloTeamcenter\bin\Debug\TcSoaStrongModelContmgmtBase.dll +D:\HelloTeamcenter\bin\Debug\TcSoaStrongModelContmgmtDita.dll +D:\HelloTeamcenter\bin\Debug\TcSoaStrongModelContmgmtS1000d.dll +D:\HelloTeamcenter\bin\Debug\TcSoaStrongModelCpgMaterials.dll +D:\HelloTeamcenter\bin\Debug\TcSoaStrongModelDpv.dll +D:\HelloTeamcenter\bin\Debug\TcSoaStrongModelEdaLibrary.dll +D:\HelloTeamcenter\bin\Debug\TcSoaStrongModelEdaServer.dll +D:\HelloTeamcenter\bin\Debug\TcSoaStrongModelEmps.dll +D:\HelloTeamcenter\bin\Debug\TcSoaStrongModelEsddm.dll +D:\HelloTeamcenter\bin\Debug\TcSoaStrongModelEsddmScm.dll +D:\HelloTeamcenter\bin\Debug\TcSoaStrongModelEsmBase.dll +D:\HelloTeamcenter\bin\Debug\TcSoaStrongModelEsmProcessor.dll +D:\HelloTeamcenter\bin\Debug\TcSoaStrongModelEsmSoftware.dll +D:\HelloTeamcenter\bin\Debug\TcSoaStrongModelFpMgmt.dll +D:\HelloTeamcenter\bin\Debug\TcSoaStrongModelGmdpv.dll +D:\HelloTeamcenter\bin\Debug\TcSoaStrongModelGmo.dll +D:\HelloTeamcenter\bin\Debug\TcSoaStrongModelHrn.dll +D:\HelloTeamcenter\bin\Debug\TcSoaStrongModelIssueManagement.dll +D:\HelloTeamcenter\bin\Debug\TcSoaStrongModelMES.dll +D:\HelloTeamcenter\bin\Debug\TcSoaStrongModelMROCore.dll +D:\HelloTeamcenter\bin\Debug\TcSoaStrongModelPkgArt.dll +D:\HelloTeamcenter\bin\Debug\TcSoaStrongModelProductVariant.dll +D:\HelloTeamcenter\bin\Debug\TcSoaStrongModelScdt.dll +D:\HelloTeamcenter\bin\Debug\TcSoaStrongModelScmCc.dll +D:\HelloTeamcenter\bin\Debug\TcSoaStrongModelServiceEventManagement.dll +D:\HelloTeamcenter\bin\Debug\TcSoaStrongModelServiceProcessing.dll +D:\HelloTeamcenter\bin\Debug\TcSoaStrongModelServiceRequest.dll +D:\HelloTeamcenter\bin\Debug\TcSoaStrongModelSpecMgr.dll +D:\HelloTeamcenter\bin\Debug\TcSoaStrongModelTcae.dll +D:\HelloTeamcenter\bin\Debug\TcSoaStrongModelTransactionProcessing.dll +D:\HelloTeamcenter\bin\Debug\TcSoaStrongModelVendorManagement.dll +D:\HelloTeamcenter\bin\Debug\TcSoaStructureManagementStrong.dll +D:\HelloTeamcenter\bin\Debug\TcSoaStructureManagementTypes.dll +D:\HelloTeamcenter\bin\Debug\TcSoaSvcProcessingStrong.dll +D:\HelloTeamcenter\bin\Debug\TcSoaSvcProcessingTypes.dll +D:\HelloTeamcenter\bin\Debug\TcSoaSvcRequestStrong.dll +D:\HelloTeamcenter\bin\Debug\TcSoaSvcRequestTypes.dll +D:\HelloTeamcenter\bin\Debug\TcSoaTranslationStrong.dll +D:\HelloTeamcenter\bin\Debug\TcSoaTranslationTypes.dll +D:\HelloTeamcenter\bin\Debug\TcSoaValidationStrong.dll +D:\HelloTeamcenter\bin\Debug\TcSoaValidationTypes.dll +D:\HelloTeamcenter\bin\Debug\TcSoaVendorManagementStrong.dll +D:\HelloTeamcenter\bin\Debug\TcSoaVendorManagementTypes.dll +D:\HelloTeamcenter\bin\Debug\TcSoaWireHarnessStrong.dll +D:\HelloTeamcenter\bin\Debug\TcSoaWireHarnessTypes.dll +D:\HelloTeamcenter\bin\Debug\TcSoaWorkflowStrong.dll +D:\HelloTeamcenter\bin\Debug\TcSoaWorkflowTypes.dll +D:\HelloTeamcenter\bin\Debug\Teamcenter_SSO.dll +D:\HelloTeamcenter\bin\Debug\Teamcenter_SSOloader.dll +D:\HelloTeamcenter\obj\Debug\HelloTeamcenter.form.Search.resources +D:\HelloTeamcenter\obj\Debug\HelloTeamcenter.form.SaveToTC.resources +D:\HelloTeamcenter\bin\Debug\DFHMAutocad.dll.config +D:\HelloTeamcenter\bin\Debug\DFHMAutocad.dll +D:\HelloTeamcenter\bin\Debug\DFHMAutocad.pdb +D:\HelloTeamcenter\obj\Debug\DFHMAutocad.dll +D:\HelloTeamcenter\obj\Debug\DFHMAutocad.pdb +E:\新建文件夹\HelloTeamcenter\bin\Debug\DFHMAutocad.dll.config +E:\新建文件夹\HelloTeamcenter\bin\Debug\DFHMAutocad.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\DFHMAutocad.pdb +E:\新建文件夹\HelloTeamcenter\bin\Debug\FCCNetClientProxyv80.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\FMSNetTicketv80.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\FSCNetClientProxyv80.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\log4net.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaAdministrationStrong.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaAdministrationTypes.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaAiStrong.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaAiTypes.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaAllocationsStrong.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaAllocationsTypes.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaAsbAsmAlignmentStrong.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaAsbAsmAlignmentTypes.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaAsBuiltStrong.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaAsBuiltTypes.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaAsMaintainedStrong.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaAsMaintainedTypes.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaAuthorizedDataAccessStrong.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaAuthorizedDataAccessTypes.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaBomStrong.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaBomTypes.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaBusinessModelerStrong.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaBusinessModelerTypes.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaCadBomAlignmentStrong.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaCadBomAlignmentTypes.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaCadStrong.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaCadTypes.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaCaeStrong.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaCaeTypes.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaCalendarManagementStrong.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaCalendarManagementTypes.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaChangeManagementStrong.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaChangeManagementTypes.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaClassificationStrong.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaClassificationTypes.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaConfigurationStrong.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaConfigurationTypes.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaDocumentManagementStrong.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaDocumentManagementTypes.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaFMS.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaGlobalMultiSiteStrong.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaGlobalMultiSiteTypes.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaImportExportStrong.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaImportExportTypes.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaIssueManagementStrong.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaIssueManagementTypes.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaManufacturingStrong.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaManufacturingTypes.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaMESStrong.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaMESTypes.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaMultisiteStrong.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaMultisiteTypes.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaParameterManagementStrong.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaParameterManagementTypes.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaProductionManagementStrong.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaProductionManagementTypes.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaProjectManagementStrong.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaProjectManagementTypes.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaRdvStrong.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaRdvTypes.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaReportsStrong.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaReportsTypes.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaRequirementsManagementStrong.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaRequirementsManagementTypes.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaSrmIntegrationStrong.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaSrmIntegrationTypes.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaStrongModelAcadGmo.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaStrongModelAdsFoundation.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaStrongModelAsBuilt.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaStrongModelAsMaintained.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaStrongModelBrndMgmt.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaStrongModelCba.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaStrongModelCcdm.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaStrongModelCm.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaStrongModelCmtEbop.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaStrongModelCmtEmserver.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaStrongModelCmtPadTwp.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaStrongModelContmgmtBase.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaStrongModelContmgmtDita.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaStrongModelContmgmtS1000d.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaStrongModelCpgMaterials.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaStrongModelDpv.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaStrongModelEdaLibrary.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaStrongModelEdaServer.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaStrongModelEmps.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaStrongModelEsddm.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaStrongModelEsddmScm.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaStrongModelEsmBase.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaStrongModelEsmProcessor.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaStrongModelEsmSoftware.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaStrongModelFpMgmt.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaStrongModelGmdpv.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaStrongModelGmo.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaStrongModelHrn.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaStrongModelIssueManagement.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaStrongModelMES.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaStrongModelMROCore.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaStrongModelPkgArt.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaStrongModelProductVariant.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaStrongModelScdt.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaStrongModelScmCc.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaStrongModelServiceEventManagement.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaStrongModelServiceProcessing.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaStrongModelServiceRequest.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaStrongModelSpecMgr.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaStrongModelTcae.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaStrongModelTransactionProcessing.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaStrongModelVendorManagement.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaStructureManagementStrong.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaStructureManagementTypes.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaSvcProcessingStrong.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaSvcProcessingTypes.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaSvcRequestStrong.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaSvcRequestTypes.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaTranslationStrong.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaTranslationTypes.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaValidationStrong.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaValidationTypes.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaVendorManagementStrong.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaVendorManagementTypes.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaWireHarnessStrong.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaWireHarnessTypes.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaWorkflowStrong.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\TcSoaWorkflowTypes.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\Teamcenter_SSO.dll +E:\新建文件夹\HelloTeamcenter\bin\Debug\Teamcenter_SSOloader.dll +E:\新建文件夹\HelloTeamcenter\obj\Debug\ResolveAssemblyReference.cache +E:\新建文件夹\HelloTeamcenter\obj\Debug\HelloTeamcenter.form.Login.resources +E:\新建文件夹\HelloTeamcenter\obj\Debug\HelloTeamcenter.form.OpenFromTC.resources +E:\新建文件夹\HelloTeamcenter\obj\Debug\HelloTeamcenter.form.SaveToTC.resources +E:\新建文件夹\HelloTeamcenter\obj\Debug\HelloTeamcenter.form.Search.resources +E:\新建文件夹\HelloTeamcenter\obj\Debug\HelloTeamcenter.Properties.Resources.resources +E:\新建文件夹\HelloTeamcenter\obj\Debug\HelloTeamcenter.csproj.GenerateResource.Cache +E:\新建文件夹\HelloTeamcenter\obj\Debug\DFHMAutocad.dll +E:\新建文件夹\HelloTeamcenter\obj\Debug\DFHMAutocad.pdb +E:\新建文件夹\OriginAutoCAD\bin\Debug\FCCNetClientProxyv80.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\FMSNetTicketv80.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\FSCNetClientProxyv80.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\log4net.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaAdministrationStrong.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaAdministrationTypes.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaAiStrong.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaAiTypes.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaAllocationsStrong.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaAllocationsTypes.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaAsbAsmAlignmentStrong.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaAsbAsmAlignmentTypes.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaAsBuiltStrong.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaAsBuiltTypes.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaAsMaintainedStrong.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaAsMaintainedTypes.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaAuthorizedDataAccessStrong.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaAuthorizedDataAccessTypes.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaBomStrong.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaBomTypes.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaBusinessModelerStrong.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaBusinessModelerTypes.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaCadBomAlignmentStrong.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaCadBomAlignmentTypes.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaCadStrong.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaCadTypes.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaCaeStrong.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaCaeTypes.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaCalendarManagementStrong.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaCalendarManagementTypes.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaChangeManagementStrong.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaChangeManagementTypes.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaClassificationStrong.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaClassificationTypes.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaConfigurationStrong.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaConfigurationTypes.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaDocumentManagementStrong.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaDocumentManagementTypes.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaFMS.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaGlobalMultiSiteStrong.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaGlobalMultiSiteTypes.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaImportExportStrong.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaImportExportTypes.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaIssueManagementStrong.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaIssueManagementTypes.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaManufacturingStrong.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaManufacturingTypes.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaMESStrong.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaMESTypes.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaMultisiteStrong.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaMultisiteTypes.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaParameterManagementStrong.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaParameterManagementTypes.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaProductionManagementStrong.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaProductionManagementTypes.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaProjectManagementStrong.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaProjectManagementTypes.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaRdvStrong.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaRdvTypes.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaReportsStrong.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaReportsTypes.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaRequirementsManagementStrong.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaRequirementsManagementTypes.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaSrmIntegrationStrong.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaSrmIntegrationTypes.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaStrongModelAcadGmo.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaStrongModelAdsFoundation.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaStrongModelAsBuilt.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaStrongModelAsMaintained.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaStrongModelBrndMgmt.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaStrongModelCba.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaStrongModelCcdm.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaStrongModelCm.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaStrongModelCmtEbop.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaStrongModelCmtEmserver.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaStrongModelCmtPadTwp.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaStrongModelContmgmtBase.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaStrongModelContmgmtDita.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaStrongModelContmgmtS1000d.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaStrongModelCpgMaterials.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaStrongModelDpv.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaStrongModelEdaLibrary.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaStrongModelEdaServer.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaStrongModelEmps.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaStrongModelEsddm.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaStrongModelEsddmScm.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaStrongModelEsmBase.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaStrongModelEsmProcessor.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaStrongModelEsmSoftware.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaStrongModelFpMgmt.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaStrongModelGmdpv.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaStrongModelGmo.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaStrongModelHrn.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaStrongModelIssueManagement.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaStrongModelMES.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaStrongModelMROCore.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaStrongModelPkgArt.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaStrongModelProductVariant.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaStrongModelScdt.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaStrongModelScmCc.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaStrongModelServiceEventManagement.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaStrongModelServiceProcessing.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaStrongModelServiceRequest.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaStrongModelSpecMgr.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaStrongModelTcae.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaStrongModelTransactionProcessing.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaStrongModelVendorManagement.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaStructureManagementStrong.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaStructureManagementTypes.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaSvcProcessingStrong.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaSvcProcessingTypes.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaSvcRequestStrong.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaSvcRequestTypes.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaTranslationStrong.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaTranslationTypes.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaValidationStrong.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaValidationTypes.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaVendorManagementStrong.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaVendorManagementTypes.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaWireHarnessStrong.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaWireHarnessTypes.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaWorkflowStrong.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\TcSoaWorkflowTypes.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\Teamcenter_SSO.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\Teamcenter_SSOloader.dll +E:\新建文件夹\OriginAutoCAD\obj\Debug\ResolveAssemblyReference.cache +E:\新建文件夹\OriginAutoCAD\obj\Debug\HelloTeamcenter.form.Login.resources +E:\新建文件夹\OriginAutoCAD\obj\Debug\HelloTeamcenter.form.OpenFromTC.resources +E:\新建文件夹\OriginAutoCAD\obj\Debug\HelloTeamcenter.form.SaveToTC.resources +E:\新建文件夹\OriginAutoCAD\obj\Debug\HelloTeamcenter.form.Search.resources +E:\新建文件夹\OriginAutoCAD\obj\Debug\HelloTeamcenter.Properties.Resources.resources +E:\新建文件夹\OriginAutoCAD\obj\Debug\HelloTeamcenter.csproj.GenerateResource.Cache +E:\新建文件夹\OriginAutoCAD\bin\Debug\OriginAutocad.dll.config +E:\新建文件夹\OriginAutoCAD\bin\Debug\OriginAutocad.dll +E:\新建文件夹\OriginAutoCAD\bin\Debug\OriginAutocad.pdb +E:\新建文件夹\OriginAutoCAD\obj\Debug\OriginAutocad.dll +E:\新建文件夹\OriginAutoCAD\obj\Debug\OriginAutocad.pdb +F:\Connor(项目管理)\东睦项目\OriginAutoCAD\obj\Debug\HelloTeamcenter.form.Login.resources +F:\Connor(项目管理)\东睦项目\OriginAutoCAD\obj\Debug\HelloTeamcenter.form.OpenFromTC.resources +F:\Connor(项目管理)\东睦项目\OriginAutoCAD\obj\Debug\HelloTeamcenter.form.SaveToTC.resources +F:\Connor(项目管理)\东睦项目\OriginAutoCAD\obj\Debug\HelloTeamcenter.form.Search.resources +F:\Connor(项目管理)\东睦项目\OriginAutoCAD\obj\Debug\HelloTeamcenter.Properties.Resources.resources +F:\Connor(项目管理)\东睦项目\OriginAutoCAD\obj\Debug\HelloTeamcenter.csproj.GenerateResource.Cache +F:\Connor(项目管理)\东睦项目\OriginAutoCAD\obj\Debug\OriginAutocad.dll +F:\Connor(项目管理)\东睦项目\OriginAutoCAD\obj\Debug\OriginAutocad.pdb +F:\Connor(项目管理)\东睦项目\OriginAutoCAD\bin\Debug\OriginAutocad.dll.config +F:\Connor(项目管理)\东睦项目\OriginAutoCAD\bin\Debug\OriginAutocad.dll +F:\Connor(项目管理)\东睦项目\OriginAutoCAD\bin\Debug\OriginAutocad.pdb +F:\Connor(项目管理)\东睦项目\OriginAutoCAD\bin\Debug\accoremgd.dll +F:\Connor(项目管理)\东睦项目\OriginAutoCAD\bin\Debug\acdbmgd.dll +F:\Connor(项目管理)\东睦项目\OriginAutoCAD\bin\Debug\acmgd.dll +F:\Connor(项目管理)\东睦项目\OriginAutoCAD\bin\Debug\AcDx.dll +F:\Connor(项目管理)\东睦项目\OriginAutoCAD\bin\Debug\AcDxPublishUi.dll +F:\Connor(项目管理)\东睦项目\OriginAutoCAD\bin\Debug\AdWindows.dll +F:\Connor(项目管理)\东睦项目\OriginAutoCAD\bin\Debug\AcWelcomeScreen.dll +F:\Connor(项目管理)\东睦项目\OriginAutoCAD\bin\Debug\AcMr.dll +F:\Connor(项目管理)\东睦项目\OriginAutoCAD\bin\Debug\AcWindows.dll +F:\Connor(项目管理)\东睦项目\OriginAutoCAD\bin\Debug\AcTcMgd.dll +F:\Connor(项目管理)\东睦项目\OriginAutoCAD\bin\Debug\AcCui.dll +F:\Connor(项目管理)\东睦项目\OriginAutoCAD\bin\Debug\ManagedMC3.dll +F:\Connor(项目管理)\东睦项目\OriginAutoCAD\bin\Debug\AcMNUParser.dll +F:\Connor(项目管理)\金卡项目\AutoCad集成\OriginAutoCAD\obj\Debug\HelloTeamcenter.form.Login.resources +F:\Connor(项目管理)\金卡项目\AutoCad集成\OriginAutoCAD\obj\Debug\HelloTeamcenter.form.OpenFromTC.resources +F:\Connor(项目管理)\金卡项目\AutoCad集成\OriginAutoCAD\obj\Debug\HelloTeamcenter.form.SaveToTC.resources +F:\Connor(项目管理)\金卡项目\AutoCad集成\OriginAutoCAD\obj\Debug\HelloTeamcenter.form.Search.resources +F:\Connor(项目管理)\金卡项目\AutoCad集成\OriginAutoCAD\obj\Debug\HelloTeamcenter.Properties.Resources.resources +F:\Connor(项目管理)\金卡项目\AutoCad集成\OriginAutoCAD\obj\Debug\HelloTeamcenter.csproj.GenerateResource.Cache +F:\Connor(项目管理)\金卡项目\AutoCad集成\OriginAutoCAD\bin\Debug\OriginAutocad.dll.config +F:\Connor(项目管理)\金卡项目\AutoCad集成\OriginAutoCAD\bin\Debug\OriginAutocad.dll +F:\Connor(项目管理)\金卡项目\AutoCad集成\OriginAutoCAD\bin\Debug\OriginAutocad.pdb +F:\Connor(项目管理)\金卡项目\AutoCad集成\OriginAutoCAD\obj\Debug\OriginAutocad.dll +F:\Connor(项目管理)\金卡项目\AutoCad集成\OriginAutoCAD\obj\Debug\OriginAutocad.pdb +D:\最新代码\金卡最新代码\金卡项目\AutoCad集成\OriginAutoCAD\bin\Debug\OriginAutocad.dll.config +D:\最新代码\金卡最新代码\金卡项目\AutoCad集成\OriginAutoCAD\bin\Debug\OriginAutocad.dll +D:\最新代码\金卡最新代码\金卡项目\AutoCad集成\OriginAutoCAD\bin\Debug\OriginAutocad.pdb +D:\最新代码\金卡最新代码\金卡项目\AutoCad集成\OriginAutoCAD\obj\Debug\HelloTeamcenter.form.Login.resources +D:\最新代码\金卡最新代码\金卡项目\AutoCad集成\OriginAutoCAD\obj\Debug\HelloTeamcenter.form.OpenFromTC.resources +D:\最新代码\金卡最新代码\金卡项目\AutoCad集成\OriginAutoCAD\obj\Debug\HelloTeamcenter.form.SaveToTC.resources +D:\最新代码\金卡最新代码\金卡项目\AutoCad集成\OriginAutoCAD\obj\Debug\HelloTeamcenter.form.Search.resources +D:\最新代码\金卡最新代码\金卡项目\AutoCad集成\OriginAutoCAD\obj\Debug\HelloTeamcenter.Properties.Resources.resources +D:\最新代码\金卡最新代码\金卡项目\AutoCad集成\OriginAutoCAD\obj\Debug\HelloTeamcenter.csproj.GenerateResource.Cache +D:\最新代码\金卡最新代码\金卡项目\AutoCad集成\OriginAutoCAD\obj\Debug\OriginAutocad.dll +D:\最新代码\金卡最新代码\金卡项目\AutoCad集成\OriginAutoCAD\obj\Debug\OriginAutocad.pdb +D:\最新代码\金卡最新代码\金卡项目\AutoCad集成\OriginAutoCAD\obj\Debug\HelloTeamcenter.csprojResolveAssemblyReference.cache +D:\最新代码\金卡最新代码\金卡项目\AutoCad集成\OriginAutoCAD\bin\Debug\log4net.dll +C:\git\TC-COMMON-APPS\TC-ZWCAD-Integration\源码\ConnorZWCAD\bin\Debug\ConnorAutocad.dll.config +C:\git\TC-COMMON-APPS\TC-ZWCAD-Integration\源码\ConnorZWCAD\bin\Debug\ConnorAutocad.dll +C:\git\TC-COMMON-APPS\TC-ZWCAD-Integration\源码\ConnorZWCAD\bin\Debug\ConnorAutocad.pdb +C:\git\TC-COMMON-APPS\TC-ZWCAD-Integration\源码\ConnorZWCAD\bin\Debug\log4net.dll +C:\git\TC-COMMON-APPS\TC-ZWCAD-Integration\源码\ConnorZWCAD\obj\Debug\HelloTeamcenter.csprojResolveAssemblyReference.cache +C:\git\TC-COMMON-APPS\TC-ZWCAD-Integration\源码\ConnorZWCAD\obj\Debug\HelloTeamcenter.form.Login.resources +C:\git\TC-COMMON-APPS\TC-ZWCAD-Integration\源码\ConnorZWCAD\obj\Debug\HelloTeamcenter.form.OpenFromTC.resources +C:\git\TC-COMMON-APPS\TC-ZWCAD-Integration\源码\ConnorZWCAD\obj\Debug\HelloTeamcenter.form.SaveToTC.resources +C:\git\TC-COMMON-APPS\TC-ZWCAD-Integration\源码\ConnorZWCAD\obj\Debug\HelloTeamcenter.form.Search.resources +C:\git\TC-COMMON-APPS\TC-ZWCAD-Integration\源码\ConnorZWCAD\obj\Debug\HelloTeamcenter.Properties.Resources.resources +C:\git\TC-COMMON-APPS\TC-ZWCAD-Integration\源码\ConnorZWCAD\obj\Debug\HelloTeamcenter.csproj.GenerateResource.Cache +C:\git\TC-COMMON-APPS\TC-ZWCAD-Integration\源码\ConnorZWCAD\obj\Debug\ConnorAutocad.dll +C:\git\TC-COMMON-APPS\TC-ZWCAD-Integration\源码\ConnorZWCAD\obj\Debug\ConnorAutocad.pdb +C:\PROJECTS\中信戴卡\中望CAD集成\源码\ConnorZWCAD\bin\Debug\ConnorAutocad.dll.config +C:\PROJECTS\中信戴卡\中望CAD集成\源码\ConnorZWCAD\bin\Debug\ConnorAutocad.dll +C:\PROJECTS\中信戴卡\中望CAD集成\源码\ConnorZWCAD\bin\Debug\ConnorAutocad.pdb +C:\PROJECTS\中信戴卡\中望CAD集成\源码\ConnorZWCAD\bin\Debug\ZwDatabaseMgd.dll +C:\PROJECTS\中信戴卡\中望CAD集成\源码\ConnorZWCAD\bin\Debug\ZwManaged.dll +C:\PROJECTS\中信戴卡\中望CAD集成\源码\ConnorZWCAD\obj\Debug\HelloTeamcenter.csprojResolveAssemblyReference.cache +C:\PROJECTS\中信戴卡\中望CAD集成\源码\ConnorZWCAD\obj\Debug\HelloTeamcenter.form.Login.resources +C:\PROJECTS\中信戴卡\中望CAD集成\源码\ConnorZWCAD\obj\Debug\HelloTeamcenter.form.OpenFromTC.resources +C:\PROJECTS\中信戴卡\中望CAD集成\源码\ConnorZWCAD\obj\Debug\HelloTeamcenter.form.SaveToTC.resources +C:\PROJECTS\中信戴卡\中望CAD集成\源码\ConnorZWCAD\obj\Debug\HelloTeamcenter.form.Search.resources +C:\PROJECTS\中信戴卡\中望CAD集成\源码\ConnorZWCAD\obj\Debug\HelloTeamcenter.Properties.Resources.resources +C:\PROJECTS\中信戴卡\中望CAD集成\源码\ConnorZWCAD\obj\Debug\HelloTeamcenter.csproj.GenerateResource.Cache +C:\PROJECTS\中信戴卡\中望CAD集成\源码\ConnorZWCAD\obj\Debug\ConnorAutocad.dll +C:\PROJECTS\中信戴卡\中望CAD集成\源码\ConnorZWCAD\obj\Debug\ConnorAutocad.pdb +C:\PROJECTS\无锡神钢锡压\中望CAD集成-xml形式\源码\ConnorZWCAD\bin\Debug\ConnorAutocad.dll.config +C:\PROJECTS\无锡神钢锡压\中望CAD集成-xml形式\源码\ConnorZWCAD\bin\Debug\ConnorAutocad.dll +C:\PROJECTS\无锡神钢锡压\中望CAD集成-xml形式\源码\ConnorZWCAD\bin\Debug\ConnorAutocad.pdb +C:\PROJECTS\无锡神钢锡压\中望CAD集成-xml形式\源码\ConnorZWCAD\bin\Debug\ZwDatabaseMgd.dll +C:\PROJECTS\无锡神钢锡压\中望CAD集成-xml形式\源码\ConnorZWCAD\bin\Debug\ZwManaged.dll +C:\PROJECTS\无锡神钢锡压\中望CAD集成-xml形式\源码\ConnorZWCAD\obj\Debug\HelloTeamcenter.form.Login.resources +C:\PROJECTS\无锡神钢锡压\中望CAD集成-xml形式\源码\ConnorZWCAD\obj\Debug\HelloTeamcenter.form.OpenFromTC.resources +C:\PROJECTS\无锡神钢锡压\中望CAD集成-xml形式\源码\ConnorZWCAD\obj\Debug\HelloTeamcenter.form.SaveToTC.resources +C:\PROJECTS\无锡神钢锡压\中望CAD集成-xml形式\源码\ConnorZWCAD\obj\Debug\HelloTeamcenter.form.Search.resources +C:\PROJECTS\无锡神钢锡压\中望CAD集成-xml形式\源码\ConnorZWCAD\obj\Debug\HelloTeamcenter.Properties.Resources.resources +C:\PROJECTS\无锡神钢锡压\中望CAD集成-xml形式\源码\ConnorZWCAD\obj\Debug\HelloTeamcenter.csproj.GenerateResource.cache +C:\PROJECTS\无锡神钢锡压\中望CAD集成-xml形式\源码\ConnorZWCAD\obj\Debug\ConnorAutocad.dll +C:\PROJECTS\无锡神钢锡压\中望CAD集成-xml形式\源码\ConnorZWCAD\obj\Debug\ConnorAutocad.pdb +C:\PROJECTS\无锡神钢锡压\中望CAD集成-xml形式\源码\ConnorZWCAD\obj\Debug\HelloTeamcenter.csprojResolveAssemblyReference.cache +C:\Users\Administrator\Desktop\CAD\中望CAD集成-xml形式\源码\ConnorZWCAD\bin\Debug\ConnorAutocad.dll.config +C:\Users\Administrator\Desktop\CAD\中望CAD集成-xml形式\源码\ConnorZWCAD\bin\Debug\ConnorAutocad.dll +C:\Users\Administrator\Desktop\CAD\中望CAD集成-xml形式\源码\ConnorZWCAD\bin\Debug\ConnorAutocad.pdb +C:\Users\Administrator\Desktop\CAD\中望CAD集成-xml形式\源码\ConnorZWCAD\bin\Debug\ZwDatabaseMgd.dll +C:\Users\Administrator\Desktop\CAD\中望CAD集成-xml形式\源码\ConnorZWCAD\bin\Debug\ZwManaged.dll +C:\Users\Administrator\Desktop\CAD\中望CAD集成-xml形式\源码\ConnorZWCAD\obj\Debug\HelloTeamcenter.form.Login.resources +C:\Users\Administrator\Desktop\CAD\中望CAD集成-xml形式\源码\ConnorZWCAD\obj\Debug\HelloTeamcenter.form.OpenFromTC.resources +C:\Users\Administrator\Desktop\CAD\中望CAD集成-xml形式\源码\ConnorZWCAD\obj\Debug\HelloTeamcenter.form.SaveToTC.resources +C:\Users\Administrator\Desktop\CAD\中望CAD集成-xml形式\源码\ConnorZWCAD\obj\Debug\HelloTeamcenter.form.Search1.resources +C:\Users\Administrator\Desktop\CAD\中望CAD集成-xml形式\源码\ConnorZWCAD\obj\Debug\HelloTeamcenter.form.Search.resources +C:\Users\Administrator\Desktop\CAD\中望CAD集成-xml形式\源码\ConnorZWCAD\obj\Debug\HelloTeamcenter.Properties.Resources.resources +C:\Users\Administrator\Desktop\CAD\中望CAD集成-xml形式\源码\ConnorZWCAD\obj\Debug\HelloTeamcenter.csproj.GenerateResource.Cache +C:\Users\Administrator\Desktop\CAD\中望CAD集成-xml形式\源码\ConnorZWCAD\obj\Debug\ConnorAutocad.dll +C:\Users\Administrator\Desktop\CAD\中望CAD集成-xml形式\源码\ConnorZWCAD\obj\Debug\ConnorAutocad.pdb +C:\Users\Administrator\Desktop\CAD\中望CAD集成-xml形式\源码\ConnorZWCAD\obj\Debug\HelloTeamcenter.csprojResolveAssemblyReference.cache +D:\source\锡压\ConnorZWCAD\bin\Debug\ConnorAutocad.dll.config +D:\source\锡压\ConnorZWCAD\bin\Debug\ConnorAutocad.dll +D:\source\锡压\ConnorZWCAD\bin\Debug\ConnorAutocad.pdb +D:\source\锡压\ConnorZWCAD\bin\Debug\Microsoft.mshtml.dll +D:\source\锡压\ConnorZWCAD\obj\Debug\HelloTeamcenter.form.Login.resources +D:\source\锡压\ConnorZWCAD\obj\Debug\HelloTeamcenter.form.OpenFromTC.resources +D:\source\锡压\ConnorZWCAD\obj\Debug\HelloTeamcenter.form.SaveToTC.resources +D:\source\锡压\ConnorZWCAD\obj\Debug\HelloTeamcenter.form.Search1.resources +D:\source\锡压\ConnorZWCAD\obj\Debug\HelloTeamcenter.form.Search.resources +D:\source\锡压\ConnorZWCAD\obj\Debug\HelloTeamcenter.Properties.Resources.resources +D:\source\锡压\ConnorZWCAD\obj\Debug\HelloTeamcenter.csproj.GenerateResource.cache +D:\source\锡压\ConnorZWCAD\obj\Debug\HelloTeamcenter.csproj.CoreCompileInputs.cache +D:\source\锡压\ConnorZWCAD\obj\Debug\HelloTeamcenter.csproj.CopyComplete +D:\source\锡压\ConnorZWCAD\obj\Debug\ConnorAutocad.dll +D:\source\锡压\ConnorZWCAD\obj\Debug\ConnorAutocad.pdb +D:\source\锡压\ConnorZWCAD\obj\Debug\HelloTeamcenter.csproj.AssemblyReference.cache diff --git a/obj/Debug/HelloTeamcenter.csproj.GenerateResource.cache b/obj/Debug/HelloTeamcenter.csproj.GenerateResource.cache new file mode 100644 index 0000000..db551f6 Binary files /dev/null and b/obj/Debug/HelloTeamcenter.csproj.GenerateResource.cache differ diff --git a/obj/Debug/HelloTeamcenter.csprojResolveAssemblyReference.cache b/obj/Debug/HelloTeamcenter.csprojResolveAssemblyReference.cache new file mode 100644 index 0000000..a9a5995 Binary files /dev/null and b/obj/Debug/HelloTeamcenter.csprojResolveAssemblyReference.cache differ diff --git a/obj/Debug/HelloTeamcenter.form.Login.resources b/obj/Debug/HelloTeamcenter.form.Login.resources new file mode 100644 index 0000000..b3874b5 Binary files /dev/null and b/obj/Debug/HelloTeamcenter.form.Login.resources differ diff --git a/obj/Debug/HelloTeamcenter.form.OpenFromTC.resources b/obj/Debug/HelloTeamcenter.form.OpenFromTC.resources new file mode 100644 index 0000000..908fdaa Binary files /dev/null and b/obj/Debug/HelloTeamcenter.form.OpenFromTC.resources differ diff --git a/obj/Debug/HelloTeamcenter.form.SaveToTC.resources b/obj/Debug/HelloTeamcenter.form.SaveToTC.resources new file mode 100644 index 0000000..698d22e Binary files /dev/null and b/obj/Debug/HelloTeamcenter.form.SaveToTC.resources differ diff --git a/obj/Debug/HelloTeamcenter.form.Search.resources b/obj/Debug/HelloTeamcenter.form.Search.resources new file mode 100644 index 0000000..698d22e Binary files /dev/null and b/obj/Debug/HelloTeamcenter.form.Search.resources differ diff --git a/obj/Debug/HelloTeamcenter.form.Search1.resources b/obj/Debug/HelloTeamcenter.form.Search1.resources new file mode 100644 index 0000000..f215109 Binary files /dev/null and b/obj/Debug/HelloTeamcenter.form.Search1.resources differ diff --git a/obj/Debug/OriginAutocad.dll b/obj/Debug/OriginAutocad.dll new file mode 100644 index 0000000..486cb17 Binary files /dev/null and b/obj/Debug/OriginAutocad.dll differ diff --git a/obj/Debug/OriginAutocad.pdb b/obj/Debug/OriginAutocad.pdb new file mode 100644 index 0000000..903cf34 Binary files /dev/null and b/obj/Debug/OriginAutocad.pdb differ diff --git a/obj/Debug/ResolveAssemblyReference.cache b/obj/Debug/ResolveAssemblyReference.cache new file mode 100644 index 0000000..1c7cb02 Binary files /dev/null and b/obj/Debug/ResolveAssemblyReference.cache differ diff --git a/obj/Debug/TempPE/Properties.Resources.Designer.cs.dll b/obj/Debug/TempPE/Properties.Resources.Designer.cs.dll new file mode 100644 index 0000000..3a064a3 Binary files /dev/null and b/obj/Debug/TempPE/Properties.Resources.Designer.cs.dll differ diff --git a/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs b/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs new file mode 100644 index 0000000..e69de29 diff --git a/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs b/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs new file mode 100644 index 0000000..e69de29 diff --git a/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs b/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs new file mode 100644 index 0000000..e69de29 diff --git a/obj/Release/ConnorAutocad.dll b/obj/Release/ConnorAutocad.dll new file mode 100644 index 0000000..e5bd64c Binary files /dev/null and b/obj/Release/ConnorAutocad.dll differ diff --git a/obj/Release/ConnorAutocad.pdb b/obj/Release/ConnorAutocad.pdb new file mode 100644 index 0000000..60dc38b Binary files /dev/null and b/obj/Release/ConnorAutocad.pdb differ diff --git a/obj/Release/DesignTimeResolveAssemblyReferences.cache b/obj/Release/DesignTimeResolveAssemblyReferences.cache new file mode 100644 index 0000000..8f93bf5 Binary files /dev/null and b/obj/Release/DesignTimeResolveAssemblyReferences.cache differ diff --git a/obj/Release/DesignTimeResolveAssemblyReferencesInput.cache b/obj/Release/DesignTimeResolveAssemblyReferencesInput.cache new file mode 100644 index 0000000..16bc8ef Binary files /dev/null and b/obj/Release/DesignTimeResolveAssemblyReferencesInput.cache differ diff --git a/obj/Release/HelloTeamcenter.Properties.Resources.resources b/obj/Release/HelloTeamcenter.Properties.Resources.resources new file mode 100644 index 0000000..2b1170b Binary files /dev/null and b/obj/Release/HelloTeamcenter.Properties.Resources.resources differ diff --git a/obj/Release/HelloTeamcenter.csproj.FileListAbsolute.txt b/obj/Release/HelloTeamcenter.csproj.FileListAbsolute.txt new file mode 100644 index 0000000..41b1d9e --- /dev/null +++ b/obj/Release/HelloTeamcenter.csproj.FileListAbsolute.txt @@ -0,0 +1,44 @@ +C:\Users\Administrator\Desktop\CAD\中望CAD集成-xml形式\源码\ConnorZWCAD\bin\Release\ConnorAutocad.dll.config +C:\Users\Administrator\Desktop\CAD\中望CAD集成-xml形式\源码\ConnorZWCAD\bin\Release\ConnorAutocad.dll +C:\Users\Administrator\Desktop\CAD\中望CAD集成-xml形式\源码\ConnorZWCAD\bin\Release\ConnorAutocad.pdb +C:\Users\Administrator\Desktop\CAD\中望CAD集成-xml形式\源码\ConnorZWCAD\bin\Release\FCCNetClientProxy40.dll +C:\Users\Administrator\Desktop\CAD\中望CAD集成-xml形式\源码\ConnorZWCAD\bin\Release\FCCNetClientProxy4064.dll +C:\Users\Administrator\Desktop\CAD\中望CAD集成-xml形式\源码\ConnorZWCAD\bin\Release\FMSNetTicket40.dll +C:\Users\Administrator\Desktop\CAD\中望CAD集成-xml形式\源码\ConnorZWCAD\bin\Release\FSCNetClientProxy40.dll +C:\Users\Administrator\Desktop\CAD\中望CAD集成-xml形式\源码\ConnorZWCAD\bin\Release\itextsharp.dll +C:\Users\Administrator\Desktop\CAD\中望CAD集成-xml形式\源码\ConnorZWCAD\bin\Release\S8SoaBypassStrong.dll +C:\Users\Administrator\Desktop\CAD\中望CAD集成-xml形式\源码\ConnorZWCAD\bin\Release\S8SoaBypassTypes.dll +C:\Users\Administrator\Desktop\CAD\中望CAD集成-xml形式\源码\ConnorZWCAD\bin\Release\Spire.License.dll +C:\Users\Administrator\Desktop\CAD\中望CAD集成-xml形式\源码\ConnorZWCAD\bin\Release\Spire.pdf.dll +C:\Users\Administrator\Desktop\CAD\中望CAD集成-xml形式\源码\ConnorZWCAD\bin\Release\TcMemNetBinding40.dll +C:\Users\Administrator\Desktop\CAD\中望CAD集成-xml形式\源码\ConnorZWCAD\bin\Release\TcMemNetBinding4064.dll +C:\Users\Administrator\Desktop\CAD\中望CAD集成-xml形式\源码\ConnorZWCAD\bin\Release\TcMemNetBindingInterface40.dll +C:\Users\Administrator\Desktop\CAD\中望CAD集成-xml形式\源码\ConnorZWCAD\bin\Release\TcServerNetBinding40.dll +C:\Users\Administrator\Desktop\CAD\中望CAD集成-xml形式\源码\ConnorZWCAD\bin\Release\TcServerNetBinding4064.dll +C:\Users\Administrator\Desktop\CAD\中望CAD集成-xml形式\源码\ConnorZWCAD\bin\Release\TcServerNetBindingInterface40.dll +C:\Users\Administrator\Desktop\CAD\中望CAD集成-xml形式\源码\ConnorZWCAD\bin\Release\TcSoaCadBomAlignmentStrong.dll +C:\Users\Administrator\Desktop\CAD\中望CAD集成-xml形式\源码\ConnorZWCAD\bin\Release\TcSoaCadBomAlignmentTypes.dll +C:\Users\Administrator\Desktop\CAD\中望CAD集成-xml形式\源码\ConnorZWCAD\bin\Release\TcSoaCadStrong.dll +C:\Users\Administrator\Desktop\CAD\中望CAD集成-xml形式\源码\ConnorZWCAD\bin\Release\TcSoaCadTypes.dll +C:\Users\Administrator\Desktop\CAD\中望CAD集成-xml形式\源码\ConnorZWCAD\bin\Release\TcSoaClient.dll +C:\Users\Administrator\Desktop\CAD\中望CAD集成-xml形式\源码\ConnorZWCAD\bin\Release\TcSoaCommon.dll +C:\Users\Administrator\Desktop\CAD\中望CAD集成-xml形式\源码\ConnorZWCAD\bin\Release\TcSoaCoreLoose.dll +C:\Users\Administrator\Desktop\CAD\中望CAD集成-xml形式\源码\ConnorZWCAD\bin\Release\TcSoaCoreStrong.dll +C:\Users\Administrator\Desktop\CAD\中望CAD集成-xml形式\源码\ConnorZWCAD\bin\Release\TcSoaCoreTypes.dll +C:\Users\Administrator\Desktop\CAD\中望CAD集成-xml形式\源码\ConnorZWCAD\bin\Release\TcSoaFMS.dll +C:\Users\Administrator\Desktop\CAD\中望CAD集成-xml形式\源码\ConnorZWCAD\bin\Release\TcSoaFMS64.dll +C:\Users\Administrator\Desktop\CAD\中望CAD集成-xml形式\源码\ConnorZWCAD\bin\Release\TcSoaQueryStrong.dll +C:\Users\Administrator\Desktop\CAD\中望CAD集成-xml形式\源码\ConnorZWCAD\bin\Release\TcSoaQueryTypes.dll +C:\Users\Administrator\Desktop\CAD\中望CAD集成-xml形式\源码\ConnorZWCAD\bin\Release\TcSoaStrongModel.dll +C:\Users\Administrator\Desktop\CAD\中望CAD集成-xml形式\源码\ConnorZWCAD\bin\Release\ZwDatabaseMgd.dll +C:\Users\Administrator\Desktop\CAD\中望CAD集成-xml形式\源码\ConnorZWCAD\bin\Release\ZwManaged.dll +C:\Users\Administrator\Desktop\CAD\中望CAD集成-xml形式\源码\ConnorZWCAD\obj\Release\HelloTeamcenter.form.Login.resources +C:\Users\Administrator\Desktop\CAD\中望CAD集成-xml形式\源码\ConnorZWCAD\obj\Release\HelloTeamcenter.form.OpenFromTC.resources +C:\Users\Administrator\Desktop\CAD\中望CAD集成-xml形式\源码\ConnorZWCAD\obj\Release\HelloTeamcenter.form.SaveToTC.resources +C:\Users\Administrator\Desktop\CAD\中望CAD集成-xml形式\源码\ConnorZWCAD\obj\Release\HelloTeamcenter.form.Search1.resources +C:\Users\Administrator\Desktop\CAD\中望CAD集成-xml形式\源码\ConnorZWCAD\obj\Release\HelloTeamcenter.form.Search.resources +C:\Users\Administrator\Desktop\CAD\中望CAD集成-xml形式\源码\ConnorZWCAD\obj\Release\HelloTeamcenter.Properties.Resources.resources +C:\Users\Administrator\Desktop\CAD\中望CAD集成-xml形式\源码\ConnorZWCAD\obj\Release\HelloTeamcenter.csproj.GenerateResource.Cache +C:\Users\Administrator\Desktop\CAD\中望CAD集成-xml形式\源码\ConnorZWCAD\obj\Release\ConnorAutocad.dll +C:\Users\Administrator\Desktop\CAD\中望CAD集成-xml形式\源码\ConnorZWCAD\obj\Release\ConnorAutocad.pdb +C:\Users\Administrator\Desktop\CAD\中望CAD集成-xml形式\源码\ConnorZWCAD\obj\Release\HelloTeamcenter.csprojResolveAssemblyReference.cache diff --git a/obj/Release/HelloTeamcenter.csproj.GenerateResource.Cache b/obj/Release/HelloTeamcenter.csproj.GenerateResource.Cache new file mode 100644 index 0000000..506f134 Binary files /dev/null and b/obj/Release/HelloTeamcenter.csproj.GenerateResource.Cache differ diff --git a/obj/Release/HelloTeamcenter.csprojResolveAssemblyReference.cache b/obj/Release/HelloTeamcenter.csprojResolveAssemblyReference.cache new file mode 100644 index 0000000..a9a5995 Binary files /dev/null and b/obj/Release/HelloTeamcenter.csprojResolveAssemblyReference.cache differ diff --git a/obj/Release/HelloTeamcenter.form.Login.resources b/obj/Release/HelloTeamcenter.form.Login.resources new file mode 100644 index 0000000..b3874b5 Binary files /dev/null and b/obj/Release/HelloTeamcenter.form.Login.resources differ diff --git a/obj/Release/HelloTeamcenter.form.OpenFromTC.resources b/obj/Release/HelloTeamcenter.form.OpenFromTC.resources new file mode 100644 index 0000000..908fdaa Binary files /dev/null and b/obj/Release/HelloTeamcenter.form.OpenFromTC.resources differ diff --git a/obj/Release/HelloTeamcenter.form.SaveToTC.resources b/obj/Release/HelloTeamcenter.form.SaveToTC.resources new file mode 100644 index 0000000..698d22e Binary files /dev/null and b/obj/Release/HelloTeamcenter.form.SaveToTC.resources differ diff --git a/obj/Release/HelloTeamcenter.form.Search.resources b/obj/Release/HelloTeamcenter.form.Search.resources new file mode 100644 index 0000000..698d22e Binary files /dev/null and b/obj/Release/HelloTeamcenter.form.Search.resources differ diff --git a/obj/Release/HelloTeamcenter.form.Search1.resources b/obj/Release/HelloTeamcenter.form.Search1.resources new file mode 100644 index 0000000..f215109 Binary files /dev/null and b/obj/Release/HelloTeamcenter.form.Search1.resources differ diff --git a/obj/Release/TempPE/Properties.Resources.Designer.cs.dll b/obj/Release/TempPE/Properties.Resources.Designer.cs.dll new file mode 100644 index 0000000..311753b Binary files /dev/null and b/obj/Release/TempPE/Properties.Resources.Designer.cs.dll differ diff --git a/obj/Release/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs b/obj/Release/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs new file mode 100644 index 0000000..e69de29 diff --git a/obj/Release/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs b/obj/Release/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs new file mode 100644 index 0000000..e69de29 diff --git a/obj/Release/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs b/obj/Release/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs new file mode 100644 index 0000000..e69de29 diff --git a/obj/x64/Debug/DesignTimeResolveAssemblyReferencesInput.cache b/obj/x64/Debug/DesignTimeResolveAssemblyReferencesInput.cache new file mode 100644 index 0000000..4db275a Binary files /dev/null and b/obj/x64/Debug/DesignTimeResolveAssemblyReferencesInput.cache differ diff --git a/obj/x64/Debug/HelloTeamcenter.Properties.Resources.resources b/obj/x64/Debug/HelloTeamcenter.Properties.Resources.resources new file mode 100644 index 0000000..4769079 Binary files /dev/null and b/obj/x64/Debug/HelloTeamcenter.Properties.Resources.resources differ diff --git a/obj/x64/Debug/HelloTeamcenter.csproj.FileListAbsolute.txt b/obj/x64/Debug/HelloTeamcenter.csproj.FileListAbsolute.txt new file mode 100644 index 0000000..c08f5d8 --- /dev/null +++ b/obj/x64/Debug/HelloTeamcenter.csproj.FileListAbsolute.txt @@ -0,0 +1,43 @@ +D:\最新代码\金卡最新代码\金卡项目\AutoCad集成\OriginAutoCAD\bin\x64\Debug\OriginAutocad.dll.config +D:\最新代码\金卡最新代码\金卡项目\AutoCad集成\OriginAutoCAD\bin\x64\Debug\OriginAutocad.dll +D:\最新代码\金卡最新代码\金卡项目\AutoCad集成\OriginAutoCAD\bin\x64\Debug\OriginAutocad.pdb +D:\最新代码\金卡最新代码\金卡项目\AutoCad集成\OriginAutoCAD\bin\x64\Debug\FCCNetClientProxy40.dll +D:\最新代码\金卡最新代码\金卡项目\AutoCad集成\OriginAutoCAD\bin\x64\Debug\FCCNetClientProxy4064.dll +D:\最新代码\金卡最新代码\金卡项目\AutoCad集成\OriginAutoCAD\bin\x64\Debug\FMSNetTicket40.dll +D:\最新代码\金卡最新代码\金卡项目\AutoCad集成\OriginAutoCAD\bin\x64\Debug\FSCNetClientProxy40.dll +D:\最新代码\金卡最新代码\金卡项目\AutoCad集成\OriginAutoCAD\bin\x64\Debug\itextsharp.dll +D:\最新代码\金卡最新代码\金卡项目\AutoCad集成\OriginAutoCAD\bin\x64\Debug\S8SoaBypassStrong.dll +D:\最新代码\金卡最新代码\金卡项目\AutoCad集成\OriginAutoCAD\bin\x64\Debug\S8SoaBypassTypes.dll +D:\最新代码\金卡最新代码\金卡项目\AutoCad集成\OriginAutoCAD\bin\x64\Debug\Spire.License.dll +D:\最新代码\金卡最新代码\金卡项目\AutoCad集成\OriginAutoCAD\bin\x64\Debug\Spire.pdf.dll +D:\最新代码\金卡最新代码\金卡项目\AutoCad集成\OriginAutoCAD\bin\x64\Debug\TcMemNetBinding40.dll +D:\最新代码\金卡最新代码\金卡项目\AutoCad集成\OriginAutoCAD\bin\x64\Debug\TcMemNetBinding4064.dll +D:\最新代码\金卡最新代码\金卡项目\AutoCad集成\OriginAutoCAD\bin\x64\Debug\TcMemNetBindingInterface40.dll +D:\最新代码\金卡最新代码\金卡项目\AutoCad集成\OriginAutoCAD\bin\x64\Debug\TcServerNetBinding40.dll +D:\最新代码\金卡最新代码\金卡项目\AutoCad集成\OriginAutoCAD\bin\x64\Debug\TcServerNetBinding4064.dll +D:\最新代码\金卡最新代码\金卡项目\AutoCad集成\OriginAutoCAD\bin\x64\Debug\TcServerNetBindingInterface40.dll +D:\最新代码\金卡最新代码\金卡项目\AutoCad集成\OriginAutoCAD\bin\x64\Debug\TcSoaCadBomAlignmentStrong.dll +D:\最新代码\金卡最新代码\金卡项目\AutoCad集成\OriginAutoCAD\bin\x64\Debug\TcSoaCadBomAlignmentTypes.dll +D:\最新代码\金卡最新代码\金卡项目\AutoCad集成\OriginAutoCAD\bin\x64\Debug\TcSoaCadStrong.dll +D:\最新代码\金卡最新代码\金卡项目\AutoCad集成\OriginAutoCAD\bin\x64\Debug\TcSoaCadTypes.dll +D:\最新代码\金卡最新代码\金卡项目\AutoCad集成\OriginAutoCAD\bin\x64\Debug\TcSoaClient.dll +D:\最新代码\金卡最新代码\金卡项目\AutoCad集成\OriginAutoCAD\bin\x64\Debug\TcSoaCommon.dll +D:\最新代码\金卡最新代码\金卡项目\AutoCad集成\OriginAutoCAD\bin\x64\Debug\TcSoaCoreLoose.dll +D:\最新代码\金卡最新代码\金卡项目\AutoCad集成\OriginAutoCAD\bin\x64\Debug\TcSoaCoreStrong.dll +D:\最新代码\金卡最新代码\金卡项目\AutoCad集成\OriginAutoCAD\bin\x64\Debug\TcSoaCoreTypes.dll +D:\最新代码\金卡最新代码\金卡项目\AutoCad集成\OriginAutoCAD\bin\x64\Debug\TcSoaFMS.dll +D:\最新代码\金卡最新代码\金卡项目\AutoCad集成\OriginAutoCAD\bin\x64\Debug\TcSoaFMS64.dll +D:\最新代码\金卡最新代码\金卡项目\AutoCad集成\OriginAutoCAD\bin\x64\Debug\TcSoaQueryStrong.dll +D:\最新代码\金卡最新代码\金卡项目\AutoCad集成\OriginAutoCAD\bin\x64\Debug\TcSoaQueryTypes.dll +D:\最新代码\金卡最新代码\金卡项目\AutoCad集成\OriginAutoCAD\bin\x64\Debug\TcSoaStrongModel.dll +D:\最新代码\金卡最新代码\金卡项目\AutoCad集成\OriginAutoCAD\bin\x64\Debug\ZwDatabaseMgd.dll +D:\最新代码\金卡最新代码\金卡项目\AutoCad集成\OriginAutoCAD\bin\x64\Debug\ZwManaged.dll +D:\最新代码\金卡最新代码\金卡项目\AutoCad集成\OriginAutoCAD\obj\x64\Debug\HelloTeamcenter.csprojResolveAssemblyReference.cache +D:\最新代码\金卡最新代码\金卡项目\AutoCad集成\OriginAutoCAD\obj\x64\Debug\HelloTeamcenter.form.Login.resources +D:\最新代码\金卡最新代码\金卡项目\AutoCad集成\OriginAutoCAD\obj\x64\Debug\HelloTeamcenter.form.OpenFromTC.resources +D:\最新代码\金卡最新代码\金卡项目\AutoCad集成\OriginAutoCAD\obj\x64\Debug\HelloTeamcenter.form.SaveToTC.resources +D:\最新代码\金卡最新代码\金卡项目\AutoCad集成\OriginAutoCAD\obj\x64\Debug\HelloTeamcenter.form.Search.resources +D:\最新代码\金卡最新代码\金卡项目\AutoCad集成\OriginAutoCAD\obj\x64\Debug\HelloTeamcenter.Properties.Resources.resources +D:\最新代码\金卡最新代码\金卡项目\AutoCad集成\OriginAutoCAD\obj\x64\Debug\HelloTeamcenter.csproj.GenerateResource.Cache +D:\最新代码\金卡最新代码\金卡项目\AutoCad集成\OriginAutoCAD\obj\x64\Debug\OriginAutocad.dll +D:\最新代码\金卡最新代码\金卡项目\AutoCad集成\OriginAutoCAD\obj\x64\Debug\OriginAutocad.pdb diff --git a/obj/x64/Debug/HelloTeamcenter.csproj.GenerateResource.Cache b/obj/x64/Debug/HelloTeamcenter.csproj.GenerateResource.Cache new file mode 100644 index 0000000..2b3aa3b Binary files /dev/null and b/obj/x64/Debug/HelloTeamcenter.csproj.GenerateResource.Cache differ diff --git a/obj/x64/Debug/HelloTeamcenter.csprojResolveAssemblyReference.cache b/obj/x64/Debug/HelloTeamcenter.csprojResolveAssemblyReference.cache new file mode 100644 index 0000000..4909ea1 Binary files /dev/null and b/obj/x64/Debug/HelloTeamcenter.csprojResolveAssemblyReference.cache differ diff --git a/obj/x64/Debug/HelloTeamcenter.form.Login.resources b/obj/x64/Debug/HelloTeamcenter.form.Login.resources new file mode 100644 index 0000000..b3874b5 Binary files /dev/null and b/obj/x64/Debug/HelloTeamcenter.form.Login.resources differ diff --git a/obj/x64/Debug/HelloTeamcenter.form.OpenFromTC.resources b/obj/x64/Debug/HelloTeamcenter.form.OpenFromTC.resources new file mode 100644 index 0000000..908fdaa Binary files /dev/null and b/obj/x64/Debug/HelloTeamcenter.form.OpenFromTC.resources differ diff --git a/obj/x64/Debug/HelloTeamcenter.form.SaveToTC.resources b/obj/x64/Debug/HelloTeamcenter.form.SaveToTC.resources new file mode 100644 index 0000000..698d22e Binary files /dev/null and b/obj/x64/Debug/HelloTeamcenter.form.SaveToTC.resources differ diff --git a/obj/x64/Debug/HelloTeamcenter.form.Search.resources b/obj/x64/Debug/HelloTeamcenter.form.Search.resources new file mode 100644 index 0000000..698d22e Binary files /dev/null and b/obj/x64/Debug/HelloTeamcenter.form.Search.resources differ diff --git a/obj/x64/Debug/OriginAutocad.dll b/obj/x64/Debug/OriginAutocad.dll new file mode 100644 index 0000000..a26a0a7 Binary files /dev/null and b/obj/x64/Debug/OriginAutocad.dll differ diff --git a/obj/x64/Debug/OriginAutocad.pdb b/obj/x64/Debug/OriginAutocad.pdb new file mode 100644 index 0000000..2985a6a Binary files /dev/null and b/obj/x64/Debug/OriginAutocad.pdb differ diff --git a/obj/x64/Debug/TempPE/Properties.Resources.Designer.cs.dll b/obj/x64/Debug/TempPE/Properties.Resources.Designer.cs.dll new file mode 100644 index 0000000..e5bccd6 Binary files /dev/null and b/obj/x64/Debug/TempPE/Properties.Resources.Designer.cs.dll differ diff --git a/res/FOLDER.ICO b/res/FOLDER.ICO new file mode 100644 index 0000000..5ef86b9 Binary files /dev/null and b/res/FOLDER.ICO differ diff --git a/res/FOLDEROP.ICO b/res/FOLDEROP.ICO new file mode 100644 index 0000000..33123f5 Binary files /dev/null and b/res/FOLDEROP.ICO differ diff --git a/res/Newstuff_Folder.png b/res/Newstuff_Folder.png new file mode 100644 index 0000000..55c4ba5 Binary files /dev/null and b/res/Newstuff_Folder.png differ diff --git a/res/autocad_01.ico b/res/autocad_01.ico new file mode 100644 index 0000000..60e932a Binary files /dev/null and b/res/autocad_01.ico differ diff --git a/res/cad.ico b/res/cad.ico new file mode 100644 index 0000000..bf6bc10 Binary files /dev/null and b/res/cad.ico differ diff --git a/res/item.ico b/res/item.ico new file mode 100644 index 0000000..ef9ef7e Binary files /dev/null and b/res/item.ico differ diff --git a/res/itemrev.ico b/res/itemrev.ico new file mode 100644 index 0000000..31f1b57 Binary files /dev/null and b/res/itemrev.ico differ diff --git a/res/login.bmp b/res/login.bmp new file mode 100644 index 0000000..724a134 Binary files /dev/null and b/res/login.bmp differ diff --git a/res/mail.ico b/res/mail.ico new file mode 100644 index 0000000..39fdbcd Binary files /dev/null and b/res/mail.ico differ diff --git a/res/tai.ico b/res/tai.ico new file mode 100644 index 0000000..aa14181 Binary files /dev/null and b/res/tai.ico differ diff --git a/模块化/12312.xml b/模块化/12312.xml new file mode 100644 index 0000000..16033be --- /dev/null +++ b/模块化/12312.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/模块化/Item类型.xml b/模块化/Item类型.xml new file mode 100644 index 0000000..5054c73 --- /dev/null +++ b/模块化/Item类型.xml @@ -0,0 +1,18 @@ + + + + + <_1 tc="D5PruchasePart" /> + <_2 tc="D5AsmPart" /> + <_3 tc="D5Part" /> + <_4 tc="D5Product" /> + <_5 tc="D5StdFasteners" /> + <_6 tc="D5CommonParts" /> + + \ No newline at end of file diff --git a/模块化/MyTeamcenter_3/Backup/HelloTeamcenter.csproj b/模块化/MyTeamcenter_3/Backup/HelloTeamcenter.csproj new file mode 100644 index 0000000..b709196 --- /dev/null +++ b/模块化/MyTeamcenter_3/Backup/HelloTeamcenter.csproj @@ -0,0 +1,85 @@ + + + Debug + AnyCPU + 8.0.50727 + 2.0 + {5503038E-4D69-4703-9F79-90C8D9061A70} + Exe + Properties + HelloTeamcenter + HelloTeamcenter + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + False + ..\..\libs\TcSoaClient.dll + + + False + ..\..\libs\TcSoaCommon.dll + + + False + ..\..\libs\TcSoaCoreStrong.dll + + + False + ..\..\libs\TcSoaCoreTypes.dll + + + False + ..\..\libs\TcSoaQueryStrong.dll + + + False + ..\..\libs\TcSoaQueryTypes.dll + + + False + ..\..\libs\TcSoaStrongModel.dll + + + + + + + + + + + + + + + + + + + diff --git a/模块化/MyTeamcenter_3/Backup/Properties/AssemblyInfo.cs b/模块化/MyTeamcenter_3/Backup/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..ca720ce --- /dev/null +++ b/模块化/MyTeamcenter_3/Backup/Properties/AssemblyInfo.cs @@ -0,0 +1,33 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("HelloTeamcenter")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Siemens Product Lifecycle Management Software Inc.")] +[assembly: AssemblyProduct("HelloTeamcenter")] +[assembly: AssemblyCopyright("Copyright 2008 Siemens Product Lifecycle Management Software Inc.")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("6ce4adbe-4247-464b-8d53-e3ecb88955fd")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/模块化/MyTeamcenter_3/Backup/clientx/AppXCredentialManager.cs b/模块化/MyTeamcenter_3/Backup/clientx/AppXCredentialManager.cs new file mode 100644 index 0000000..6ad8fff --- /dev/null +++ b/模块化/MyTeamcenter_3/Backup/clientx/AppXCredentialManager.cs @@ -0,0 +1,146 @@ +//================================================== +// +// @@ +// +//================================================== + + + +using System; +using System.IO; + +using Teamcenter.Schemas.Soa._2006_03.Exceptions; +using Teamcenter.Soa; +using Teamcenter.Soa.Common; +using Teamcenter.Soa.Client; +using Teamcenter.Soa.Exceptions; + +namespace Teamcenter.ClientX +{ + +/** + * The CredentialManager is used by the Teamcenter Services framework to get the + * user's credentials when challanged by the server. This can occur after a period + * of inactivity and the server has timed-out the user's session, at which time + * the client application will need to re-authenitcate. The framework will + * call one of the getCredentials methods (depending on circumstances) and will + * send the SessionService.login service request. Upon successfull completion of + * the login service request. The last service request (one that cuased the challange) + * will be resent. + * + * The framework will also call the setUserPassword setGroupRole methods when ever + * these credentials change, thus allowing this implementation of the CredentialManager + * to cache these values so prompting of the user is not requried for re-authentication. + * + */ +public class AppXCredentialManager : CredentialManager +{ + + private String name = null; + private String password = null; + private String group = ""; // default group + private String role = ""; // default role + private String discriminator = "SoaAppX"; // always connect same user + // to same instance of server + + /** + * Return the type of credentials this implementation provides, + * standard (user/password) or Single-Sign-On. In this case + * Standard credentials are returned. + * + * @see com.teamcenter.soa.client.CredentialManager#getCredentialType() + */ + public int CredentialType + { + get { return SoaConstants.CLIENT_CREDENTIAL_TYPE_STD; } + } + + /** + * Prompt's the user for credentials. + * This method will only be called by the framework when a login attempt has + * failed. + * + * @see com.teamcenter.soa.client.CredentialManager#getCredentials(com.teamcenter.schemas.soa._2006_03.exceptions.InvalidCredentialsException) + */ + public string[] GetCredentials(InvalidCredentialsException e) + //throws CanceledOperationException + { + Console.WriteLine(e.Message); + return PromptForCredentials(); + } + + /** + * Return the cached credentials. + * This method will be called when a service request is sent without a valid + * session ( session has expired on the server). + * + * @see com.teamcenter.soa.client.CredentialManager#getCredentials(com.teamcenter.schemas.soa._2006_03.exceptions.InvalidUserException) + */ + public String[] GetCredentials(InvalidUserException e) + //throws CanceledOperationException + { + // Have not logged in yet, shoult not happen but just in case + if (name == null) return PromptForCredentials(); + + // Return cached credentials + String[] tokens = { name, password, group, role, discriminator }; + return tokens; + } + + /** + * Cache the group and role + * This is called after the SessionService.setSessionGroupMember service + * operation is called. + * + * @see com.teamcenter.soa.client.CredentialManager#setGroupRole(java.lang.String, + * java.lang.String) + */ + public void SetGroupRole(String group, String role) + { + this.group = group; + this.role = role; + } + + /** + * Cache the User and Password + * This is called after the SessionService.login service operation is called. + * + * @see com.teamcenter.soa.client.CredentialManager#setUserPassword(java.lang.String, + * java.lang.String, java.lang.String) + */ + public void SetUserPassword(String user, String password, String discriminator) + { + this.name = user; + this.password = password; + this.discriminator = discriminator; + } + + + public String[] PromptForCredentials() + //throws CanceledOperationException + { + try + { + Console.WriteLine("Please enter user credentials (return to quit):"); + Console.Write("User Name: "); + name = Console.ReadLine(); + + if (name.Length == 0) + throw new CanceledOperationException(""); + + Console.Write("Password: "); + password = Console.ReadLine(); + } + catch (IOException e) + { + String message = "Failed to get the name and password.\n" + e.Message; + Console.WriteLine(message); + throw new CanceledOperationException(message); + } + + String[] tokens = { name, password, group, role, discriminator }; + return tokens; + } + +} +} diff --git a/模块化/MyTeamcenter_3/Backup/clientx/AppXDeletedObjectListener.cs b/模块化/MyTeamcenter_3/Backup/clientx/AppXDeletedObjectListener.cs new file mode 100644 index 0000000..d051a7f --- /dev/null +++ b/模块化/MyTeamcenter_3/Backup/clientx/AppXDeletedObjectListener.cs @@ -0,0 +1,38 @@ +//================================================== +// +// @@ +// +//================================================== + +using System; + +using Teamcenter.Soa.Client.Model; + +namespace Teamcenter.ClientX +{ + +/** + * Implementation of the DeleteListener, simply prints out list of all objects + * that are deleted. + * + */ +public class AppXDeletedObjectListener : DeleteListener +{ + + public void ModelObjectDelete(string[] uids) + { + if (uids.Length == 0) + return; + + System.Console.WriteLine(""); + System.Console.WriteLine("Deleted Objects handled in com.teamcenter.clientx.AppXDeletedObjectListener.modelObjectDelete"); + System.Console.WriteLine("The following objects have been deleted from the server and removed from the client data model:"); + for (int i = 0; i < uids.Length; i++) + { + System.Console.WriteLine(" " + uids[i]); + } + + } + +} +} diff --git a/模块化/MyTeamcenter_3/Backup/clientx/AppXExceptionHandler.cs b/模块化/MyTeamcenter_3/Backup/clientx/AppXExceptionHandler.cs new file mode 100644 index 0000000..824c9ad --- /dev/null +++ b/模块化/MyTeamcenter_3/Backup/clientx/AppXExceptionHandler.cs @@ -0,0 +1,101 @@ +//================================================== +// +// @@ +// +//================================================== + + +using System; +using System.IO; + +using Teamcenter.Schemas.Soa._2006_03.Exceptions; +using Teamcenter.Soa.Client; +using Teamcenter.Soa.Exceptions; + +namespace Teamcenter.ClientX +{ + + + /** + * Implementation of the ExceptionHandler. For ConnectionExceptions (server + * temporarily down .etc) prompts the user to retry the last request. For other + * exceptions convert to a RunTime exception. + */ + public class AppXExceptionHandler : ExceptionHandler + { + + /* + * (non-Javadoc) + * + * @see com.teamcenter.soa.client.ExceptionHandler#handleException(com.teamcenter.schemas.soa._2006_03.exceptions.InternalServerException) + */ + public void HandleException(InternalServerException ise) + { + Console.WriteLine(""); + Console.WriteLine("*****"); + Console.WriteLine("Exception caught in com.teamcenter.clientx.AppXExceptionHandler.handleException(InternalServerException)."); + + + if (ise is ConnectionException) + { + // ConnectionException are typically due to a network error (server + // down .etc) and can be recovered from (the last request can be sent again, + // after the problem is corrected). + Console.Write("\nThe server returned an connection error.\n" + ise.Message + + "\nDo you wish to retry the last service request?[y/n]"); + } + else if (ise is ProtocolException) + { + // ProtocolException are typically due to programming errors + // (content of HTTP + // request is incorrect). These are generally can not be + // recovered from. + Console.Write("\nThe server returned an protocol error.\n" + ise.Message + + "\nThis is most likely the result of a programming error." + + "\nDo you wish to retry the last service request?[y/n]"); + } + else + { + Console.WriteLine("\nThe server returned an internal server error.\n" + + ise.Message + + "\nThis is most likely the result of a programming error." + + "\nA RuntimeException will be thrown."); + throw new SystemException(ise.Message); + } + + try + { + String retry = Console.ReadLine(); + // If yes, return to the calling SOA client framework, where the + // last service request will be resent. + if (retry.ToLower().Equals("y") || retry.ToLower().Equals("yes")) + return; + + throw new SystemException("The user has opted not to retry the last request"); + } + catch (IOException e) + { + Console.Error.WriteLine("Failed to read user response.\nA RuntimeException will be thrown."); + throw new SystemException(e.Message); + } + } + + /* + * (non-Javadoc) + * + * @see com.teamcenter.soa.client.ExceptionHandler#handleException(com.teamcenter.soa.exceptions.CanceledOperationException) + */ + public void HandleException(CanceledOperationException coe) + { + Console.WriteLine(""); + Console.WriteLine("*****"); + Console.WriteLine("Exception caught in com.teamcenter.clientx.AppXExceptionHandler.handleException(CanceledOperationException)."); + + // Expecting this from the login tests with bad credentials, and the + // AnyUserCredentials class not + // prompting for different credentials + throw new SystemException(coe.Message); + } + + } +} diff --git a/模块化/MyTeamcenter_3/Backup/clientx/AppXPartialErrorListener.cs b/模块化/MyTeamcenter_3/Backup/clientx/AppXPartialErrorListener.cs new file mode 100644 index 0000000..644a63b --- /dev/null +++ b/模块化/MyTeamcenter_3/Backup/clientx/AppXPartialErrorListener.cs @@ -0,0 +1,68 @@ +//================================================== +// +// @@ +// +//================================================== + +using System; + +using Teamcenter.Soa.Client.Model; + + +namespace Teamcenter.ClientX +{ + +/** + * Implementation of the PartialErrorListener. Print out any partial errors + * returned. + * + */ +public class AppXPartialErrorListener : PartialErrorListener +{ + + /* + * (non-Javadoc) + * + * @see com.teamcenter.soa.client.model.PartialErrorListener#handlePartialError(com.teamcenter.soa.client.model.ErrorStack[]) + */ + public void HandlePartialError(ErrorStack[] stacks) + { + if (stacks.Length == 0) return; + + Console.WriteLine(""); + Console.WriteLine("*****"); + Console.WriteLine("Partial Errors caught in com.teamcenter.clientx.AppXPartialErrorListener."); + + + for (int i = 0; i < stacks.Length; i++) + { + ErrorValue[] errors = stacks[i].ErrorValues; + Console.Write("Partial Error for "); + + // The different service implementation may optionally associate + // an ModelObject, client ID, or nothing, with each partial error + if (stacks[i].HasAssociatedObject() ) + { + Console.WriteLine("object "+ stacks[i].AssociatedObject.Uid); + } + else if (stacks[i].HasClientId()) + { + Console.WriteLine("client id "+ stacks[i].ClientId); + } + else if (stacks[i].HasClientIndex()) + { + Console.WriteLine("client index " + stacks[i].ClientIndex); + } + + // Each Partial Error will have one or more contributing error messages + for (int j = 0; j < errors.Length; j++) + { + Console.WriteLine(" Code: " + errors[j].Code + "\tSeverity: " + + errors[j].Level + "\t" + errors[j].Message); + } + } + + } + +} +} diff --git a/模块化/MyTeamcenter_3/Backup/clientx/AppXRequestListener.cs b/模块化/MyTeamcenter_3/Backup/clientx/AppXRequestListener.cs new file mode 100644 index 0000000..fe84a9a --- /dev/null +++ b/模块化/MyTeamcenter_3/Backup/clientx/AppXRequestListener.cs @@ -0,0 +1,42 @@ +//================================================== +// +// @@ +// +//================================================== + +using System; + +using Teamcenter.Soa.Client; + + +namespace Teamcenter.ClientX +{ + + /** + * This implemenation of the RequestListener, logs each service request + * to the console. + * + */ + public class AppXRequestListener : RequestListener + { + + + /** + * Called before each request is sent to the server. + */ + public void ServiceRequest(ServiceInfo info) + { + // will log the service name when done + } + + /** + * Called after each response from the server. + * Log the service operation to the console. + */ + public void ServiceResponse(ServiceInfo info) + { + Console.WriteLine(info.Id + ": " + info.Service + "." + info.Operation); + } + + } +} diff --git a/模块化/MyTeamcenter_3/Backup/clientx/AppXUpdateObjectListener.cs b/模块化/MyTeamcenter_3/Backup/clientx/AppXUpdateObjectListener.cs new file mode 100644 index 0000000..5865ee6 --- /dev/null +++ b/模块化/MyTeamcenter_3/Backup/clientx/AppXUpdateObjectListener.cs @@ -0,0 +1,48 @@ +//================================================== +// +// @@ +// +//================================================== + +using System; + +using Teamcenter.Soa.Client.Model; +using Teamcenter.Soa.Exceptions; + +namespace Teamcenter.ClientX +{ + + +/** + * Implementation of the ChangeListener. Print out all objects that have been updated. + * + */ +public class AppXUpdateObjectListener : ChangeListener +{ + + public void ModelObjectChange(ModelObject[] objects) + { + if (objects.Length == 0) return; + System.Console.WriteLine(""); + System.Console.WriteLine("Modified Objects handled in com.teamcenter.clientx.AppXUpdateObjectListener.modelObjectChange"); + System.Console.WriteLine("The following objects have been updated in the client data model:"); + for (int i = 0; i < objects.Length; i++) + { + String uid = objects[i].Uid; + String type = objects[i].GetType().Name; + String name = ""; + if (objects[i].GetType().Name.Equals("WorkspaceObject")) + { + ModelObject wo = objects[i]; + try + { + name = wo.GetProperty("object_string").StringValue; + } + catch (NotLoadedException /*e*/) {} // just ignore + } + System.Console.WriteLine(" " + uid + " " + type + " " + name); + } + } + +} +} diff --git a/模块化/MyTeamcenter_3/Backup/clientx/Session.cs b/模块化/MyTeamcenter_3/Backup/clientx/Session.cs new file mode 100644 index 0000000..ab62ccc --- /dev/null +++ b/模块化/MyTeamcenter_3/Backup/clientx/Session.cs @@ -0,0 +1,247 @@ +//================================================== +// +// @@ +// +//================================================== + + + + +using System; +using System.Collections; +using System.Net; + +using Teamcenter.Schemas.Soa._2006_03.Exceptions; +using Teamcenter.Services.Strong.Core; +using Teamcenter.Services.Strong.Core._2006_03.Session; +using Teamcenter.Soa; +using Teamcenter.Soa.Client; +using Teamcenter.Soa.Client.Model; +using Teamcenter.Soa.Exceptions; + +using WorkspaceObject = Teamcenter.Soa.Client.Model.Strong.WorkspaceObject; +using User = Teamcenter.Soa.Client.Model.Strong.User; + +namespace Teamcenter.ClientX +{ + + + public class Session + { + /** + * Single instance of the Connection object that is shared throughtout + * the application. This Connection object is needed whenever a Service + * stub is instantiated. + */ + private static Connection connection; + + /** + * The credentialManager is used both by the Session class and the Teamcenter + * Services Framework to get user credentials. + * + */ + private static AppXCredentialManager credentialManager; + + /** + * Create an instance of the Session with a connection to the specified + * server. + * + * Add implementations of the ExceptionHandler, PartialErrorListener, + * ChangeListener, and DeleteListeners. + * + * @param host Address of the host to connect to, http://serverName:port/tc + */ + public Session(String host) + { + // Create an instance of the CredentialManager, this is used + // by the SOA Framework to get the user's credentials when + // challanged by the server (sesioin timeout on the web tier). + credentialManager = new AppXCredentialManager(); + + + + // Create the Connection object, no contact is made with the server + // until a service request is made + connection = new Connection(host, new CookieCollection(), credentialManager, SoaConstants.REST, + SoaConstants.HTTP, false); + + + // Add an ExceptionHandler to the Connection, this will handle any + // InternalServerException, communication errors, xml marshalling errors + // .etc + connection.ExceptionHandler = new AppXExceptionHandler(); + + // While the above ExceptionHandler is required, all of the following + // Listeners are optional. Client application can add as many or as few Listeners + // of each type that they want. + + // Add a Partial Error Listener, this will be notified when ever a + // a service returns partial errors. + connection.ModelManager.AddPartialErrorListener(new AppXPartialErrorListener()); + + // Add a Change Listener, this will be notified when ever a + // a service returns model objects that have been updated. + connection.ModelManager.AddChangeListener(new AppXUpdateObjectListener()); + + // Add a Delete Listener, this will be notified when ever a + // a service returns objects that have been deleted. + connection.ModelManager.AddDeleteListener(new AppXDeletedObjectListener()); + + // Add a Request Listener, this will be notified before and after each + // service request is sent to the server. + Connection.AddRequestListener(new AppXRequestListener()); + } + + /** + * Get the single Connection object for the application + * + * @return connection + */ + public static Connection getConnection() + { + return connection; + } + + /** + * Login to the Teamcenter Server + * + */ + public User login() + { + // Get the service stub + SessionService sessionService = SessionService.getService(connection); + + try + { + // Prompt for credentials until they are right, or until user + // cancels + String[] credentials = credentialManager.PromptForCredentials(); + while (true) + { + try + { + + // ***************************** + // Execute the service operation + // ***************************** + LoginResponse resp = sessionService.Login(credentials[0], credentials[1], + credentials[2], credentials[3],"",credentials[4]); + + return resp.User; + } + catch (InvalidCredentialsException e) + { + credentials = credentialManager.GetCredentials(e); + } + } + } + // User canceled the operation, don't need to tell him again + catch (CanceledOperationException /*e*/) {} + + // Exit the application + //System.exit(0); + return null; + } + + /** + * Terminate the session with the Teamcenter Server + * + */ + public void logout() + { + // Get the service stub + SessionService sessionService = SessionService.getService(connection); + try + { + // ***************************** + // Execute the service operation + // ***************************** + sessionService.Logout(); + } + catch (ServiceException /*e*/) { } + } + + /** + * Print some basic information for a list of objects + * + * @param objects + */ + public static void printObjects(ModelObject[] objects) + { + if(objects == null) + return; + + + // Ensure that the referenced User objects that we will use below are loaded + getUsers( objects ); + + Console.WriteLine("Name\t\tOwner\t\tLast Modified"); + Console.WriteLine("====\t\t=====\t\t============="); + for (int i = 0; i < objects.Length; i++) + { + if(!(objects[i] is WorkspaceObject )) + continue; + + WorkspaceObject wo = (WorkspaceObject)objects[i]; + try + { + String name = wo.Object_string; + User owner = (User) wo.Owning_user; + DateTime lastModified =wo.Last_mod_date; + + Console.WriteLine(name + "\t" + owner.User_name + "\t" + lastModified.ToString()); + } + catch (NotLoadedException e) + { + // Print out a message, and skip to the next item in the folder + // Could do a DataManagementService.getProperties call at this point + Console.WriteLine(e.Message); + Console.WriteLine("The Object Property Policy ($TC_DATA/soa/policies/Default.xml) is not configured with this property."); + } + } + + } + + + private static void getUsers(ModelObject[] objects) + { + if(objects == null) + return; + + DataManagementService dmService = DataManagementService.getService(Session.getConnection()); + ArrayList unKnownUsers = new ArrayList(); + for (int i = 0; i < objects.Length; i++) + { + if(!(objects[i] is WorkspaceObject )) + continue; + + WorkspaceObject wo = (WorkspaceObject)objects[i]; + + User owner = null; + try + { + owner = (User) wo.Owning_user; + String userName = owner.User_name; + } + catch (NotLoadedException /*e*/) + { + if(owner != null) + unKnownUsers.Add(owner); + } + } + User[] users = new User[unKnownUsers.Count]; + unKnownUsers.CopyTo( users ); + String[] attributes = { "user_name" }; + + + // ***************************** + // Execute the service operation + // ***************************** + dmService.GetProperties(users, attributes); + + + } + + + } +} diff --git a/模块化/MyTeamcenter_3/Backup/hello/DataManagement.cs b/模块化/MyTeamcenter_3/Backup/hello/DataManagement.cs new file mode 100644 index 0000000..7c67483 --- /dev/null +++ b/模块化/MyTeamcenter_3/Backup/hello/DataManagement.cs @@ -0,0 +1,379 @@ +//================================================== +// +// @@ +// +//================================================== + + + + +using System; +using System.Collections; + +using Teamcenter.ClientX; +using Teamcenter.Schemas.Soa._2006_03.Exceptions; + +// Include the Data Management Service Interface +using Teamcenter.Services.Strong.Core; + +// Input and output structures for the service operations +// Note: the different namespace from the service interface +using Teamcenter.Services.Strong.Core._2006_03.DataManagement; +using Teamcenter.Services.Strong.Core._2007_01.DataManagement; +using Teamcenter.Soa.Client.Model; +using Teamcenter.Soa.Exceptions; + +using Item = Teamcenter.Soa.Client.Model.Strong.Item; +using ItemRevision = Teamcenter.Soa.Client.Model.Strong.ItemRevision; + +namespace Teamcenter.Hello +{ + +/** + * Perform different operations in the DataManamentService + * + */ +public class DataManagement +{ + + /** + * Perform a sequence of data management operations: Create Items, Revise + * the Items, and Delete the Items + * + */ + public void createReviseAndDelete() + { + try + { + int numberOfItems = 3; + + // Reserve Item IDs and Create Items with those IDs + ItemIdsAndInitialRevisionIds[] itemIds = generateItemIds(numberOfItems, "Item"); + CreateItemsOutput[] newItems = createItems(itemIds, "Item"); + + // Copy the Item and ItemRevision to separate arrays for further + // processing + Item[] items = new Item[newItems.Length]; + ItemRevision[] itemRevs = new ItemRevision[newItems.Length]; + for (int i = 0; i < items.Length; i++) + { + items[i] = newItems[i].Item; + itemRevs[i] = newItems[i].ItemRev; + } + + // Reserve revision IDs and revise the Items + Hashtable allRevIds = generateRevisionIds(items); + reviseItems(allRevIds, itemRevs); + + // Delete all objects created + deleteItems(items); + } + catch (ServiceException e) + { + System.Console.Out.WriteLine(e.Message ); + } + + } + + /** + * Reserve a number Item and Revision Ids + * + * @param numberOfIds Number of IDs to generate + * @param type Type of IDs to generate + * + * @return An array of Item and Revision IDs. The size of the array is equal + * to the input numberOfIds + * + * @throws ServiceException If any partial errors are returned + */ + public ItemIdsAndInitialRevisionIds[] generateItemIds(int numberOfIds, String type) + // throws ServiceException + { + // Get the service stub + DataManagementService dmService = DataManagementService.getService(Session.getConnection()); + + GenerateItemIdsAndInitialRevisionIdsProperties[] properties = new GenerateItemIdsAndInitialRevisionIdsProperties[1]; + GenerateItemIdsAndInitialRevisionIdsProperties property = new GenerateItemIdsAndInitialRevisionIdsProperties(); + + property.Count = numberOfIds; + property.ItemType = type; + property.Item = null; // Not used + properties[0] = property; + + // ***************************** + // Execute the service operation + // ***************************** + GenerateItemIdsAndInitialRevisionIdsResponse response = dmService.GenerateItemIdsAndInitialRevisionIds(properties); + + + + // The AppXPartialErrorListener is logging the partial errors returned + // In this simple example if any partial errors occur we will throw a + // ServiceException + if (response.ServiceData.sizeOfPartialErrors() > 0) + throw new ServiceException( "DataManagementService.generateItemIdsAndInitialRevisionIds returned a partial error."); + + // The return is a map of ItemIdsAndInitialRevisionIds keyed on the + // 0-based index of requested IDs. Since we only asked for IDs for one + // data type, the map key is '0' + Int32 bIkey = 0; + Hashtable allNewIds = response.OutputItemIdsAndInitialRevisionIds; + ItemIdsAndInitialRevisionIds[] myNewIds = (ItemIdsAndInitialRevisionIds[]) allNewIds[bIkey]; + + return myNewIds; + } + + /** + * Create Items + * + * @param itemIds Array of Item and Revision IDs + * @param itemType Type of item to create + * + * @return Set of Items and ItemRevisions + * + * @throws ServiceException If any partial errors are returned + */ + public CreateItemsOutput[] createItems(ItemIdsAndInitialRevisionIds[] itemIds, String itemType) + // throws ServiceException + { + // Get the service stub + DataManagementService dmService = DataManagementService.getService(Session.getConnection()); + // Populate form type + GetItemCreationRelatedInfoResponse relatedResponse = dmService.GetItemCreationRelatedInfo(itemType, null); + String[] formTypes = new String[0]; + if ( relatedResponse.ServiceData.sizeOfPartialErrors() > 0) + throw new ServiceException( "DataManagementService.getItemCretionRelatedInfo returned a partial error."); + + formTypes = new String[relatedResponse.FormAttrs.Length]; + for ( int i = 0; i < relatedResponse.FormAttrs.Length; i++ ) + { + FormAttributesInfo attrInfo = relatedResponse.FormAttrs[i]; + formTypes[i] = attrInfo.FormType; + } + + ItemProperties[] itemProps = new ItemProperties[itemIds.Length]; + for (int i = 0; i < itemIds.Length; i++) + { + // Create form in cache for form property population + ModelObject[] forms = createForms(itemIds[i].NewItemId, formTypes[0], + itemIds[i].NewRevId, formTypes[1], + null, false); + ItemProperties itemProperty = new ItemProperties(); + + itemProperty.ClientId = "AppX-Test"; + itemProperty.ItemId = itemIds[i].NewItemId; + itemProperty.RevId = itemIds[i].NewRevId; + itemProperty.Name = "AppX-Test"; + itemProperty.Type = itemType; + itemProperty.Description = "Test Item for the SOA AppX sample application."; + itemProperty.Uom = ""; + + // Retrieve one of form attribute value from Item master form. + ServiceData serviceData = dmService.GetProperties(forms, new String[]{"project_id"}); + if ( serviceData.sizeOfPartialErrors() > 0) + throw new ServiceException( "DataManagementService.getProperties returned a partial error."); + Property property = null; + try + { + property= forms[0].GetProperty("project_id"); + } + catch ( NotLoadedException /*ex*/){} + + + // Only if value is null, we set new value + if ( property == null || property.StringValue == null || property.StringValue.Length == 0) + { + itemProperty.ExtendedAttributes = new ExtendedAttributes[1]; + ExtendedAttributes theExtendedAttr = new ExtendedAttributes(); + theExtendedAttr.Attributes = new Hashtable(); + theExtendedAttr.ObjectType = formTypes[0]; + theExtendedAttr.Attributes["project_id"] = "project_id"; + itemProperty.ExtendedAttributes[0] = theExtendedAttr; + } + itemProps[i] = itemProperty; + } + + + // ***************************** + // Execute the service operation + // ***************************** + CreateItemsResponse response = dmService.CreateItems(itemProps, null, ""); + // before control is returned the ChangedHandler will be called with + // newly created Item and ItemRevisions + + + + // The AppXPartialErrorListener is logging the partial errors returned + // In this simple example if any partial errors occur we will throw a + // ServiceException + if (response.ServiceData.sizeOfPartialErrors() > 0) + throw new ServiceException( "DataManagementService.createItems returned a partial error."); + + return response.Output; + } + + /** + * Reserve Revision IDs + * + * @param items Array of Items to reserve Ids for + * + * @return Map of RevisionIds + * + * @throws ServiceException If any partial errors are returned + */ + public Hashtable generateRevisionIds(Item[] items) //throws ServiceException + { + // Get the service stub + DataManagementService dmService = DataManagementService.getService(Session.getConnection()); + + GenerateRevisionIdsResponse response = null; + GenerateRevisionIdsProperties[] input = null; + input = new GenerateRevisionIdsProperties[items.Length]; + for (int i = 0; i < items.Length; i++) + { + GenerateRevisionIdsProperties property = new GenerateRevisionIdsProperties(); + property.Item = items[i]; + property.ItemType = ""; + input[i] = property; + } + + // ***************************** + // Execute the service operation + // ***************************** + response = dmService.GenerateRevisionIds(input); + + // The AppXPartialErrorListener is logging the partial errors returned + // In this simple example if any partial errors occur we will throw a + // ServiceException + if (response.ServiceData.sizeOfPartialErrors() > 0) + throw new ServiceException( "DataManagementService.generateRevisionIds returned a partial error."); + + return response.OutputRevisionIds; + } + + /** + * Revise Items + * + * @param revisionIds Map of Revsion IDs + * @param itemRevs Array of ItemRevisons + * + * @return Map of Old ItemRevsion(key) to new ItemRevision(value) + * + * @throws ServiceException If any partial errors are returned + */ + public Hashtable reviseItems(Hashtable revisionIds, ItemRevision[] itemRevs) //throws ServiceException + { + // Get the service stub + DataManagementService dmService = DataManagementService.getService(Session.getConnection()); + + Hashtable revs = new Hashtable(); + for (int i = 0; i < itemRevs.Length; i++) + { + + + RevisionIds rev = (RevisionIds) revisionIds[i]; + + ReviseProperties revProps = new ReviseProperties(); + + revProps.RevId = rev.NewRevId; + revProps.Name = "testRevise"; + revProps.Description = "describe testRevise"; + + Hashtable attrs = new Hashtable(); + attrs["project_id"] = "project_id_val"; + revProps.ExtendedAttributes = attrs; + + revs[itemRevs[i]]= revProps; + } + + // ***************************** + // Execute the service operation + // ***************************** + ReviseResponse revised = dmService.Revise(revs); + // before control is returned the ChangedHandler will be called with + // newly created Item and ItemRevisions + + + + // The AppXPartialErrorListener is logging the partial errors returned + // In this simple example if any partial errors occur we will throw a + // ServiceException + if (revised.ServiceData.sizeOfPartialErrors() > 0) + throw new ServiceException("DataManagementService.revise returned a partial error."); + + return revised.OldItemRevToNewItemRev; + + } + + /** + * Delete the Items + * + * @param items Array of Items to delete + * + * @throws ServiceException If any partial errors are returned + */ + public void deleteItems(Item[] items) //throws ServiceException + { + // Get the service stub + DataManagementService dmService = DataManagementService.getService(Session.getConnection()); + + // ***************************** + // Execute the service operation + // ***************************** + ServiceData serviceData = dmService.DeleteObjects(items); + + // The AppXPartialErrorListener is logging the partial errors returned + // In this simple example if any partial errors occur we will throw a + // ServiceException + if (serviceData.sizeOfPartialErrors() > 0) + throw new ServiceException("DataManagementService.deleteObjects returned a partial error."); + + } + + /** + * Create ItemMasterForm and ItemRevisionMasterForm + * + * @param IMFormName Name of ItemMasterForm + * @param IMFormType Type of ItemMasterForm + * @param IRMFormName Name of ItemRevisionMasterForm + * @param IRMFormType Type of ItemRevisionMasterForm + * @param parent The container object that two + * newly-created forms will be added into. + * @return ModelObject[] Array of forms + * + * @throws ServiceException If any partial errors are returned + */ + public ModelObject[] createForms ( String IMFormName, String IMFormType, + String IRMFormName, String IRMFormType, + ModelObject parent, bool saveDB ) //throws ServiceException + { + //Get the service stub + DataManagementService dmService = DataManagementService.getService(Session.getConnection()); + FormInfo[] inputs = new FormInfo[2]; + inputs[0] = new FormInfo(); + inputs[0].ClientId = "1"; + inputs[0].Description=""; + inputs[0].Name = IMFormName; + inputs[0].FormType=IMFormType; + inputs[0].SaveDB = saveDB; + inputs[0].ParentObject = parent ; + inputs[1] = new FormInfo(); + inputs[1].ClientId = "2"; + inputs[1].Description=""; + inputs[1].Name = IRMFormName; + inputs[1].FormType=IRMFormType; + inputs[1].SaveDB = saveDB; + inputs[1].ParentObject = parent; + CreateOrUpdateFormsResponse response = dmService.CreateOrUpdateForms(inputs); + if ( response.ServiceData.sizeOfPartialErrors() > 0) + throw new ServiceException("DataManagementService.createForms returned a partial error."); + ModelObject[] forms = new ModelObject [inputs.Length]; + for (int i=0; i@ +// +//================================================== + + +using System; +using Teamcenter.ClientX; + +using User = Teamcenter.Soa.Client.Model.Strong.User; + +namespace Teamcenter.Hello +{ +/** + * This sample client application demonstrates some of the basic features of the + * Teamcenter Services framework and a few of the services. + * + * An instance of the Connection object is created with implementations of the + * ExceptionHandler, PartialErrorListener, ChangeListener, and DeleteListeners + * intefaces. This client application performs the following functions: + * 1. Establishes a session with the Teamcenter server + * 2. Display the contents of the Home Folder + * 3. Performs a simple query of the database + * 4. Create, revise, and delete an Item + * + */ +public class Hello +{ + + /** + * @param args -help or -h will print out a Usage statement + */ + public static void Main(string[] args) + { + String serverHost = "http://localhost:7001/tc"; + + if (args.Length > 0) + { + if (args[0].Equals("-help") || args[0].Equals("-h")) + { + System.Console.Out.WriteLine("usage: Hello [-host http://server:port/tc]"); + return; + } + if (args[0].Equals("-host") && args.Length > 1) + { + // Get optional host information + serverHost = args[1]; + } + } + + + + try + { + + Session session = new Session(serverHost); + HomeFolder home = new HomeFolder(); + Query query = new Query(); + DataManagement dm = new DataManagement(); + + + + + + // Establish a session with the Teamcenter Server + User user = session.login(); + + // Using the User object returned from the login service request + // display the contents of the Home Folder + home.listHomeFolder(user); + + // Perform a simple query of the database + query.queryItems(); + + // Perform some basic data management functions + dm.createReviseAndDelete(); + + // Terminate the session with the Teamcenter server + session.logout(); + } + catch (SystemException e) + { + Console.WriteLine(e.Message); + } + + } +} +} + + diff --git a/模块化/MyTeamcenter_3/Backup/hello/HomeFolder.cs b/模块化/MyTeamcenter_3/Backup/hello/HomeFolder.cs new file mode 100644 index 0000000..d597ace --- /dev/null +++ b/模块化/MyTeamcenter_3/Backup/hello/HomeFolder.cs @@ -0,0 +1,79 @@ +//================================================== +// +// @@ +// +//================================================== + +using System; + +using Teamcenter.ClientX; +using Teamcenter.Services.Strong.Core; +using Teamcenter.Soa.Client.Model; +using Teamcenter.Soa.Exceptions; + +using User = Teamcenter.Soa.Client.Model.Strong.User; +using Folder = Teamcenter.Soa.Client.Model.Strong.Folder; +using WorkspaceObject = Teamcenter.Soa.Client.Model.Strong.WorkspaceObject; + +namespace Teamcenter.Hello +{ +public class HomeFolder +{ + + /** + * List the contents of the Home folder. + * + */ + public void listHomeFolder(User user) + { + Folder home = null; + WorkspaceObject[] contents = null; + + // Get the service stub + DataManagementService dmService = DataManagementService.getService(Session.getConnection()); + + try + { + // User was a primary object returned from the login command + // the Object Property Policy should be configured to include the + // 'home_folder' property. However the actuall 'home_folder' object + // was a secondary object returned from the login request and + // therefore does not have any properties associated with it. We will need to + // get those properties explicitly with a 'getProperties' service request. + home = user.Home_folder; + } + catch (NotLoadedException e) + { + Console.Out.WriteLine(e.Message); + Console.Out.WriteLine("The Object Property Policy ($TC_DATA/soa/policies/Default.xml) is not configured with this property."); + return; + } + + try + { + ModelObject[] objects = { home }; + String[] attributes = { "contents" }; + + // ***************************** + // Execute the service operation + // ***************************** + dmService.GetProperties(objects, attributes); + + + // The above getProperties call returns a ServiceData object, but it + // just has pointers to the same object we passed into the method, so the + // input object have been updated with new property values + contents = home.Contents; + } + // This should never be thrown, since we just explicitly asked for this + // property + catch (NotLoadedException /*e*/){} + + Console.Out.WriteLine(""); + Console.Out.WriteLine("Home Folder:"); + Session.printObjects( contents ); + + } + +} +} diff --git a/模块化/MyTeamcenter_3/Backup/hello/Query.cs b/模块化/MyTeamcenter_3/Backup/hello/Query.cs new file mode 100644 index 0000000..8ce01b8 --- /dev/null +++ b/模块化/MyTeamcenter_3/Backup/hello/Query.cs @@ -0,0 +1,112 @@ +//================================================== +// +// @@ +// +//================================================== + +using System; + +using Teamcenter.ClientX; +using Teamcenter.Schemas.Soa._2006_03.Exceptions; + +//Include the Saved Query Service Interface +using Teamcenter.Services.Strong.Query; + +// Input and output structures for the service operations +// Note: the different namespace from the service interface +using Teamcenter.Services.Strong.Query._2006_03.SavedQuery; + +using ImanQuery = Teamcenter.Soa.Client.Model.Strong.ImanQuery; + + +namespace Teamcenter.Hello +{ +public class Query +{ + + /** + * Perform a simple query of the database + * + */ + public void queryItems() + { + + ImanQuery query = null; + + // Get the service stub + SavedQueryService queryService = SavedQueryService.getService(Session.getConnection()); + + try + { + + // ***************************** + // Execute the service operation + // ***************************** + GetSavedQueriesResponse savedQueries = queryService.GetSavedQueries(); + + + if (savedQueries.Queries.Length == 0) + { + Console.Out.WriteLine("There are no saved queries in the system."); + return; + } + + // Find one called 'Item Name' + for (int i = 0; i < savedQueries.Queries.Length; i++) + { + + if (savedQueries.Queries[i].Name.Equals("Item Name")) + { + query = savedQueries.Queries[i].Query; + break; + } + } + } + catch (ServiceException e) + { + Console.Out.WriteLine("GetSavedQueries service request failed."); + Console.Out.WriteLine(e.Message); + return; + } + + if (query == null) + { + Console.WriteLine("There is not an 'Item Name' query."); + return; + } + + try + { + // Search for all Items, returning a maximum of 25 objects + Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryInput[] savedQueryInput = new Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryInput[1]; + savedQueryInput[0] = new Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryInput(); + savedQueryInput[0].Query = query; + savedQueryInput[0].MaxNumToReturn = 25; + savedQueryInput[0].LimitListCount = 0; + savedQueryInput[0].LimitList = new Teamcenter.Soa.Client.Model.ModelObject[0]; + savedQueryInput[0].Entries = new String[] { "Item Name" }; + savedQueryInput[0].Values = new String[1]; + savedQueryInput[0].Values[0] = "*"; + savedQueryInput[0].MaxNumToInflate = 25; + + //***************************** + //Execute the service operation + //***************************** + Teamcenter.Services.Strong.Query._2007_06.SavedQuery.ExecuteSavedQueriesResponse savedQueryResult = queryService.ExecuteSavedQueries(savedQueryInput); + + Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryResults found = savedQueryResult.ArrayOfResults[0]; + + System.Console.Out.WriteLine(""); + System.Console.Out.WriteLine("Found Items:"); + Teamcenter.ClientX.Session.printObjects( found.Objects ); + } + catch (ServiceException e) + { + Console.Out.WriteLine("ExecuteSavedQuery service request failed."); + Console.Out.WriteLine(e.Message); + return; + } + + } +} +} diff --git a/模块化/MyTeamcenter_3/MyTeamcenter.csproj b/模块化/MyTeamcenter_3/MyTeamcenter.csproj new file mode 100644 index 0000000..fb23abb --- /dev/null +++ b/模块化/MyTeamcenter_3/MyTeamcenter.csproj @@ -0,0 +1,731 @@ + + + Debug + AnyCPU + 9.0.21022 + 2.0 + {5503038E-4D69-4703-9F79-90C8D9061A70} + Library + Properties + HelloTeamcenter + DFHMAutocad + + + + + 2.0 + v3.0 + + + publish\ + true + Disk + false + Foreground + 7 + Days + false + false + true + 0 + 1.0.0.%2a + false + false + true + + + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + False + ..\..\..\..\ObjectARX2010\acdbmgd.dll + + + False + ..\..\..\..\ObjectARX2010\acmgd.dll + + + False + ..\..\..\..\ObjectARX2010\inc-win32\Autodesk.AutoCAD.Interop.dll + + + False + ..\..\..\..\ObjectARX2010\inc-win32\Autodesk.AutoCAD.Interop.Common.dll + + + False + ..\soa_client\net\libs\FCCNetClientProxyv80.dll + + + False + ..\soa_client\net\libs\FMSNetTicketv80.dll + + + False + ..\soa_client\net\libs\FSCNetClientProxyv80.dll + + + False + ..\soa_client\net\libs\log4net.dll + + + + + + + + False + ..\soa_client\net\libs\TcSoaAdministrationStrong.dll + + + False + ..\soa_client\net\libs\TcSoaAdministrationTypes.dll + + + False + ..\soa_client\net\libs\TcSoaAiStrong.dll + + + False + ..\soa_client\net\libs\TcSoaAiTypes.dll + + + False + ..\soa_client\net\libs\TcSoaAllocationsStrong.dll + + + False + ..\soa_client\net\libs\TcSoaAllocationsTypes.dll + + + False + ..\soa_client\net\libs\TcSoaAsbAsmAlignmentStrong.dll + + + False + ..\soa_client\net\libs\TcSoaAsbAsmAlignmentTypes.dll + + + False + ..\soa_client\net\libs\TcSoaAsBuiltStrong.dll + + + False + ..\soa_client\net\libs\TcSoaAsBuiltTypes.dll + + + False + ..\soa_client\net\libs\TcSoaAsMaintainedStrong.dll + + + False + ..\soa_client\net\libs\TcSoaAsMaintainedTypes.dll + + + False + ..\soa_client\net\libs\TcSoaAuthorizedDataAccessStrong.dll + + + False + ..\soa_client\net\libs\TcSoaAuthorizedDataAccessTypes.dll + + + False + ..\soa_client\net\libs\TcSoaBomStrong.dll + + + False + ..\soa_client\net\libs\TcSoaBomTypes.dll + + + False + ..\soa_client\net\libs\TcSoaBusinessModelerStrong.dll + + + False + ..\soa_client\net\libs\TcSoaBusinessModelerTypes.dll + + + False + ..\soa_client\net\libs\TcSoaCadBomAlignmentStrong.dll + + + False + ..\soa_client\net\libs\TcSoaCadBomAlignmentTypes.dll + + + False + ..\soa_client\net\libs\TcSoaCadStrong.dll + + + False + ..\soa_client\net\libs\TcSoaCadTypes.dll + + + False + ..\soa_client\net\libs\TcSoaCaeStrong.dll + + + False + ..\soa_client\net\libs\TcSoaCaeTypes.dll + + + False + ..\soa_client\net\libs\TcSoaCalendarManagementStrong.dll + + + False + ..\soa_client\net\libs\TcSoaCalendarManagementTypes.dll + + + False + ..\soa_client\net\libs\TcSoaChangeManagementStrong.dll + + + False + ..\soa_client\net\libs\TcSoaChangeManagementTypes.dll + + + False + ..\soa_client\net\libs\TcSoaClassificationStrong.dll + + + False + ..\soa_client\net\libs\TcSoaClassificationTypes.dll + + + False + ..\..\libs\TcSoaClient.dll + + + False + ..\..\libs\TcSoaCommon.dll + + + False + ..\soa_client\net\libs\TcSoaConfigurationStrong.dll + + + False + ..\soa_client\net\libs\TcSoaConfigurationTypes.dll + + + False + ..\..\libs\TcSoaCoreStrong.dll + + + False + ..\..\libs\TcSoaCoreTypes.dll + + + False + ..\soa_client\net\libs\TcSoaDocumentManagementStrong.dll + + + False + ..\soa_client\net\libs\TcSoaDocumentManagementTypes.dll + + + False + ..\soa_client\net\libs\TcSoaFMS.dll + + + False + ..\soa_client\net\libs\TcSoaGlobalMultiSiteStrong.dll + + + False + ..\soa_client\net\libs\TcSoaGlobalMultiSiteTypes.dll + + + False + ..\soa_client\net\libs\TcSoaImportExportStrong.dll + + + False + ..\soa_client\net\libs\TcSoaImportExportTypes.dll + + + False + ..\soa_client\net\libs\TcSoaIssueManagementStrong.dll + + + False + ..\soa_client\net\libs\TcSoaIssueManagementTypes.dll + + + False + ..\soa_client\net\libs\TcSoaManufacturingStrong.dll + + + False + ..\soa_client\net\libs\TcSoaManufacturingTypes.dll + + + False + ..\soa_client\net\libs\TcSoaMESStrong.dll + + + False + ..\soa_client\net\libs\TcSoaMESTypes.dll + + + False + ..\soa_client\net\libs\TcSoaMultisiteStrong.dll + + + False + ..\soa_client\net\libs\TcSoaMultisiteTypes.dll + + + False + ..\soa_client\net\libs\TcSoaParameterManagementStrong.dll + + + False + ..\soa_client\net\libs\TcSoaParameterManagementTypes.dll + + + False + ..\soa_client\net\libs\TcSoaProductionManagementStrong.dll + + + False + ..\soa_client\net\libs\TcSoaProductionManagementTypes.dll + + + False + ..\soa_client\net\libs\TcSoaProjectManagementStrong.dll + + + False + ..\soa_client\net\libs\TcSoaProjectManagementTypes.dll + + + False + ..\..\libs\TcSoaQueryStrong.dll + + + False + ..\..\libs\TcSoaQueryTypes.dll + + + False + ..\soa_client\net\libs\TcSoaRdvStrong.dll + + + False + ..\soa_client\net\libs\TcSoaRdvTypes.dll + + + False + ..\soa_client\net\libs\TcSoaReportsStrong.dll + + + False + ..\soa_client\net\libs\TcSoaReportsTypes.dll + + + False + ..\soa_client\net\libs\TcSoaRequirementsManagementStrong.dll + + + False + ..\soa_client\net\libs\TcSoaRequirementsManagementTypes.dll + + + False + ..\soa_client\net\libs\TcSoaSrmIntegrationStrong.dll + + + False + ..\soa_client\net\libs\TcSoaSrmIntegrationTypes.dll + + + False + ..\..\libs\TcSoaStrongModel.dll + + + False + ..\soa_client\net\libs\TcSoaStrongModelAcadGmo.dll + + + False + ..\soa_client\net\libs\TcSoaStrongModelAdsFoundation.dll + + + False + ..\soa_client\net\libs\TcSoaStrongModelAsBuilt.dll + + + False + ..\soa_client\net\libs\TcSoaStrongModelAsMaintained.dll + + + False + ..\soa_client\net\libs\TcSoaStrongModelBrndMgmt.dll + + + False + ..\soa_client\net\libs\TcSoaStrongModelCba.dll + + + False + ..\soa_client\net\libs\TcSoaStrongModelCcdm.dll + + + False + ..\soa_client\net\libs\TcSoaStrongModelCm.dll + + + False + ..\soa_client\net\libs\TcSoaStrongModelCmtEbop.dll + + + False + ..\soa_client\net\libs\TcSoaStrongModelCmtEmserver.dll + + + False + ..\soa_client\net\libs\TcSoaStrongModelCmtPadTwp.dll + + + False + ..\soa_client\net\libs\TcSoaStrongModelContmgmtBase.dll + + + False + ..\soa_client\net\libs\TcSoaStrongModelContmgmtDita.dll + + + False + ..\soa_client\net\libs\TcSoaStrongModelContmgmtS1000d.dll + + + False + ..\soa_client\net\libs\TcSoaStrongModelCpgMaterials.dll + + + False + ..\soa_client\net\libs\TcSoaStrongModelDpv.dll + + + False + ..\soa_client\net\libs\TcSoaStrongModelEdaLibrary.dll + + + False + ..\soa_client\net\libs\TcSoaStrongModelEdaServer.dll + + + False + ..\soa_client\net\libs\TcSoaStrongModelEmps.dll + + + False + ..\soa_client\net\libs\TcSoaStrongModelEsddm.dll + + + False + ..\soa_client\net\libs\TcSoaStrongModelEsddmScm.dll + + + False + ..\soa_client\net\libs\TcSoaStrongModelEsmBase.dll + + + False + ..\soa_client\net\libs\TcSoaStrongModelEsmProcessor.dll + + + False + ..\soa_client\net\libs\TcSoaStrongModelEsmSoftware.dll + + + False + ..\soa_client\net\libs\TcSoaStrongModelFpMgmt.dll + + + False + ..\soa_client\net\libs\TcSoaStrongModelGmdpv.dll + + + False + ..\soa_client\net\libs\TcSoaStrongModelGmo.dll + + + False + ..\soa_client\net\libs\TcSoaStrongModelHrn.dll + + + False + ..\soa_client\net\libs\TcSoaStrongModelIssueManagement.dll + + + False + ..\soa_client\net\libs\TcSoaStrongModelMES.dll + + + False + ..\soa_client\net\libs\TcSoaStrongModelMROCore.dll + + + False + ..\soa_client\net\libs\TcSoaStrongModelPkgArt.dll + + + False + ..\soa_client\net\libs\TcSoaStrongModelProductVariant.dll + + + False + ..\soa_client\net\libs\TcSoaStrongModelScdt.dll + + + False + ..\soa_client\net\libs\TcSoaStrongModelScmCc.dll + + + False + ..\soa_client\net\libs\TcSoaStrongModelServiceEventManagement.dll + + + False + ..\soa_client\net\libs\TcSoaStrongModelServiceProcessing.dll + + + False + ..\soa_client\net\libs\TcSoaStrongModelServiceRequest.dll + + + False + ..\soa_client\net\libs\TcSoaStrongModelSpecMgr.dll + + + False + ..\soa_client\net\libs\TcSoaStrongModelTcae.dll + + + False + ..\soa_client\net\libs\TcSoaStrongModelTransactionProcessing.dll + + + False + ..\soa_client\net\libs\TcSoaStrongModelVendorManagement.dll + + + False + ..\soa_client\net\libs\TcSoaStructureManagementStrong.dll + + + False + ..\soa_client\net\libs\TcSoaStructureManagementTypes.dll + + + False + ..\soa_client\net\libs\TcSoaSvcProcessingStrong.dll + + + False + ..\soa_client\net\libs\TcSoaSvcProcessingTypes.dll + + + False + ..\soa_client\net\libs\TcSoaSvcRequestStrong.dll + + + False + ..\soa_client\net\libs\TcSoaSvcRequestTypes.dll + + + False + ..\soa_client\net\libs\TcSoaTranslationStrong.dll + + + False + ..\soa_client\net\libs\TcSoaTranslationTypes.dll + + + False + ..\soa_client\net\libs\TcSoaValidationStrong.dll + + + False + ..\soa_client\net\libs\TcSoaValidationTypes.dll + + + False + ..\soa_client\net\libs\TcSoaVendorManagementStrong.dll + + + False + ..\soa_client\net\libs\TcSoaVendorManagementTypes.dll + + + False + ..\soa_client\net\libs\TcSoaWireHarnessStrong.dll + + + False + ..\soa_client\net\libs\TcSoaWireHarnessTypes.dll + + + False + ..\soa_client\net\libs\TcSoaWorkflowStrong.dll + + + False + ..\soa_client\net\libs\TcSoaWorkflowTypes.dll + + + False + ..\soa_client\net\libs\Teamcenter_SSO.dll + + + False + ..\soa_client\net\libs\Teamcenter_SSOloader.dll + + + + + + + + + + + + Form + + + Login.cs + + + Form + + + OpenFromTC.cs + + + Form + + + SaveToTC.cs + + + Form + + + Search.cs + + + + + + + + + + + + + True + True + Resources.resx + + + + + + + + False + .NET Framework Client Profile + false + + + False + .NET Framework 2.0 %28x86%29 + false + + + False + .NET Framework 3.0 %28x86%29 + true + + + False + .NET Framework 3.5 + false + + + False + .NET Framework 3.5 SP1 + false + + + False + Windows Installer 3.1 + true + + + + + Login.cs + Designer + + + OpenFromTC.cs + Designer + + + SaveToTC.cs + Designer + + + Search.cs + Designer + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/模块化/MyTeamcenter_3/MyTeamcenter.csproj.user b/模块化/MyTeamcenter_3/MyTeamcenter.csproj.user new file mode 100644 index 0000000..2a88fb2 --- /dev/null +++ b/模块化/MyTeamcenter_3/MyTeamcenter.csproj.user @@ -0,0 +1,17 @@ + + + publish\ + + + + + + + + + + + zh-CN + false + + \ No newline at end of file diff --git a/模块化/MyTeamcenter_3/MyTeamcenter.sln b/模块化/MyTeamcenter_3/MyTeamcenter.sln new file mode 100644 index 0000000..2af7f22 --- /dev/null +++ b/模块化/MyTeamcenter_3/MyTeamcenter.sln @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual Studio 2008 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MyTeamcenter", "MyTeamcenter.csproj", "{5503038E-4D69-4703-9F79-90C8D9061A70}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {5503038E-4D69-4703-9F79-90C8D9061A70}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5503038E-4D69-4703-9F79-90C8D9061A70}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5503038E-4D69-4703-9F79-90C8D9061A70}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5503038E-4D69-4703-9F79-90C8D9061A70}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/模块化/MyTeamcenter_3/MyTeamcenter.suo b/模块化/MyTeamcenter_3/MyTeamcenter.suo new file mode 100644 index 0000000..0a8586c Binary files /dev/null and b/模块化/MyTeamcenter_3/MyTeamcenter.suo differ diff --git a/模块化/MyTeamcenter_3/Properties/AssemblyInfo.cs b/模块化/MyTeamcenter_3/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..d8867fb --- /dev/null +++ b/模块化/MyTeamcenter_3/Properties/AssemblyInfo.cs @@ -0,0 +1,41 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using Autodesk.AutoCAD.DatabaseServices; +using Autodesk.AutoCAD.Runtime; +using Autodesk.AutoCAD.Geometry; +using Autodesk.AutoCAD.ApplicationServices; +using Autodesk.AutoCAD.EditorInput; +using Autodesk.AutoCAD.Windows; +using HelloTeamcenter.hello; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("HelloTeamcenter")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Siemens Product Lifecycle Management Software Inc.")] +[assembly: AssemblyProduct("HelloTeamcenter")] +[assembly: AssemblyCopyright("Copyright 2008 Siemens Product Lifecycle Management Software Inc.")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("6ce4adbe-4247-464b-8d53-e3ecb88955fd")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/模块化/MyTeamcenter_3/Properties/Resources.Designer.cs b/模块化/MyTeamcenter_3/Properties/Resources.Designer.cs new file mode 100644 index 0000000..da50f60 --- /dev/null +++ b/模块化/MyTeamcenter_3/Properties/Resources.Designer.cs @@ -0,0 +1,119 @@ +//------------------------------------------------------------------------------ +// +// 此代码由工具生成。 +// 运行时版本:2.0.50727.3623 +// +// 对此文件的更改可能会导致不正确的行为,并且如果 +// 重新生成代码,这些更改将会丢失。 +// +//------------------------------------------------------------------------------ + +namespace HelloTeamcenter.Properties { + using System; + + + /// + /// 强类型资源类,用于查找本地化字符串等。 + /// + // 此类是由 StronglyTypedResourceBuilder + // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。 + // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen + // (以 /str 作为命令选项),或重新生成 VS 项目。 + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// 返回此类使用的缓存 ResourceManager 实例。 + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("HelloTeamcenter.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// 为使用此强类型资源类的所有资源查找 + /// 重写当前线程的 CurrentUICulture 属性。 + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + internal static System.Drawing.Bitmap autocad_01 { + get { + object obj = ResourceManager.GetObject("autocad_01", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + internal static System.Drawing.Bitmap FOLDER { + get { + object obj = ResourceManager.GetObject("FOLDER", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + internal static System.Drawing.Bitmap FOLDEROP { + get { + object obj = ResourceManager.GetObject("FOLDEROP", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + internal static System.Drawing.Bitmap item { + get { + object obj = ResourceManager.GetObject("item", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + internal static System.Drawing.Bitmap itemrev { + get { + object obj = ResourceManager.GetObject("itemrev", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + internal static System.Drawing.Bitmap login { + get { + object obj = ResourceManager.GetObject("login", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + internal static System.Drawing.Bitmap Newstuff_Folder { + get { + object obj = ResourceManager.GetObject("Newstuff_Folder", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + internal static System.Drawing.Bitmap tai { + get { + object obj = ResourceManager.GetObject("tai", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + } +} diff --git a/模块化/MyTeamcenter_3/Properties/Resources.resx b/模块化/MyTeamcenter_3/Properties/Resources.resx new file mode 100644 index 0000000..80582ff --- /dev/null +++ b/模块化/MyTeamcenter_3/Properties/Resources.resx @@ -0,0 +1,145 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + ..\res\autocad_01.ico;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\res\FOLDER.ICO;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\res\FOLDEROP.ICO;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\res\item.ico;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\res\itemrev.ico;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\res\login.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\res\Newstuff_Folder.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\res\tai.ico;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + \ No newline at end of file diff --git a/模块化/MyTeamcenter_3/ReadMe.txt b/模块化/MyTeamcenter_3/ReadMe.txt new file mode 100644 index 0000000..91596c5 --- /dev/null +++ b/模块化/MyTeamcenter_3/ReadMe.txt @@ -0,0 +1,61 @@ + +This sample demonstrates the basic functionality of the Teamcenter Services. + + + +Before running the sample application, you must have a Teamcenter Web Tier server +and Pool Manager up and running. + +To build this project from Visual Studio 2005(8.0). +1. Load the project + Open the Open dialog ( File --> Open --> Project... ) + Browse to .../soa_clients/net/samples/HelloTeamcenter/HelloTeamcenter.csproj +3. Compile the project +4. Execute the client application + To connect to a server other than http://localhost:7001/tc, change this URI + on Project Properties dialog ( Project --> Properties). On the Debug tab + modify the In the 'Command line arguments' field add '-host http://server:port/tc'. + + + + + The source file Hello.cxx has the main function for the application. This is the + best place to start browsing the code. There are serveral classes prefixed with + the name AppX (AppXCredentialManager), these classes are implemenations of + Teamcenter Services framework interfaces. Each client application is responsible + for providing an implemenation to these interfaces: + + CredentialManager Used by the framework to re-authenticate as user. + ExceptionHandler Provide a mechanism for the client application to + handle low level exception in the communication framework. + PartialErrorListener Optional listener for notification when a service operation + has returned partial errors. + ChangeListener Optional listener for notification when a service operation + has returned ModelObject with updated property values. + DeleteListener Optional listener for notification when a service operation + has returned ModelObject that have been deleted from + the database and from the client data model. + + The remaining classes in this sample show the use of a few of the service operations + to demonstrate some basic features of Teamcenter Services. + + Session This class shows how to establish a session with the + Teamcenter Server using the SessionService login and + logout methods. A session must be established before + any other service operation are called. + HomeFolder This class lists the contents of the user's home folder + Query This class performs a simple query. + DataManagement This class creates, revises, and deletes a set of Items + + Each of these examples performs the same basic steps + 1. Construct the desired service stub. + 2. Gather the data for the opeation's input arguments, + 3. Call the service operation + 4. Process the results. + + A few of the service operations will make use of the Change and Delete listeners. + Under normal circomstances the ExeptionHandler and PartialErrorListner will not + be called. + + + diff --git a/模块化/MyTeamcenter_3/UpgradeLog.XML b/模块化/MyTeamcenter_3/UpgradeLog.XML new file mode 100644 index 0000000..6720e48 --- /dev/null +++ b/模块化/MyTeamcenter_3/UpgradeLog.XML @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/模块化/MyTeamcenter_3/UpgradeLog2.XML b/模块化/MyTeamcenter_3/UpgradeLog2.XML new file mode 100644 index 0000000..5cca06d --- /dev/null +++ b/模块化/MyTeamcenter_3/UpgradeLog2.XML @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/模块化/MyTeamcenter_3/_UpgradeReport_Files/UpgradeReport.css b/模块化/MyTeamcenter_3/_UpgradeReport_Files/UpgradeReport.css new file mode 100644 index 0000000..fae98af --- /dev/null +++ b/模块化/MyTeamcenter_3/_UpgradeReport_Files/UpgradeReport.css @@ -0,0 +1,207 @@ +BODY +{ + BACKGROUND-COLOR: white; + FONT-FAMILY: "Verdana", sans-serif; + FONT-SIZE: 100%; + MARGIN-LEFT: 0px; + MARGIN-TOP: 0px +} +P +{ + FONT-FAMILY: "Verdana", sans-serif; + FONT-SIZE: 70%; + LINE-HEIGHT: 12pt; + MARGIN-BOTTOM: 0px; + MARGIN-LEFT: 10px; + MARGIN-TOP: 10px +} +.note +{ + BACKGROUND-COLOR: #ffffff; + COLOR: #336699; + FONT-FAMILY: "Verdana", sans-serif; + FONT-SIZE: 100%; + MARGIN-BOTTOM: 0px; + MARGIN-LEFT: 0px; + MARGIN-TOP: 0px; + PADDING-RIGHT: 10px +} +.infotable +{ + BACKGROUND-COLOR: #f0f0e0; + BORDER-BOTTOM: #ffffff 0px solid; + BORDER-COLLAPSE: collapse; + BORDER-LEFT: #ffffff 0px solid; + BORDER-RIGHT: #ffffff 0px solid; + BORDER-TOP: #ffffff 0px solid; + FONT-SIZE: 70%; + MARGIN-LEFT: 10px +} +.issuetable +{ + BACKGROUND-COLOR: #ffffe8; + BORDER-COLLAPSE: collapse; + COLOR: #000000; + FONT-SIZE: 100%; + MARGIN-BOTTOM: 10px; + MARGIN-LEFT: 13px; + MARGIN-TOP: 0px +} +.issuetitle +{ + BACKGROUND-COLOR: #ffffff; + BORDER-BOTTOM: #dcdcdc 1px solid; + BORDER-TOP: #dcdcdc 1px; + COLOR: #003366; + FONT-WEIGHT: normal +} +.header +{ + BACKGROUND-COLOR: #cecf9c; + BORDER-BOTTOM: #ffffff 1px solid; + BORDER-LEFT: #ffffff 1px solid; + BORDER-RIGHT: #ffffff 1px solid; + BORDER-TOP: #ffffff 1px solid; + COLOR: #000000; + FONT-WEIGHT: bold +} +.issuehdr +{ + BACKGROUND-COLOR: #E0EBF5; + BORDER-BOTTOM: #dcdcdc 1px solid; + BORDER-TOP: #dcdcdc 1px solid; + COLOR: #000000; + FONT-WEIGHT: normal +} +.issuenone +{ + BACKGROUND-COLOR: #ffffff; + BORDER-BOTTOM: 0px; + BORDER-LEFT: 0px; + BORDER-RIGHT: 0px; + BORDER-TOP: 0px; + COLOR: #000000; + FONT-WEIGHT: normal +} +.content +{ + BACKGROUND-COLOR: #e7e7ce; + BORDER-BOTTOM: #ffffff 1px solid; + BORDER-LEFT: #ffffff 1px solid; + BORDER-RIGHT: #ffffff 1px solid; + BORDER-TOP: #ffffff 1px solid; + PADDING-LEFT: 3px +} +.issuecontent +{ + BACKGROUND-COLOR: #ffffff; + BORDER-BOTTOM: #dcdcdc 1px solid; + BORDER-TOP: #dcdcdc 1px solid; + PADDING-LEFT: 3px +} +A:link +{ + COLOR: #cc6633; + TEXT-DECORATION: underline +} +A:visited +{ + COLOR: #cc6633; +} +A:active +{ + COLOR: #cc6633; +} +A:hover +{ + COLOR: #cc3300; + TEXT-DECORATION: underline +} +H1 +{ + BACKGROUND-COLOR: #003366; + BORDER-BOTTOM: #336699 6px solid; + COLOR: #ffffff; + FONT-SIZE: 130%; + FONT-WEIGHT: normal; + MARGIN: 0em 0em 0em -20px; + PADDING-BOTTOM: 8px; + PADDING-LEFT: 30px; + PADDING-TOP: 16px +} +H2 +{ + COLOR: #000000; + FONT-SIZE: 80%; + FONT-WEIGHT: bold; + MARGIN-BOTTOM: 3px; + MARGIN-LEFT: 10px; + MARGIN-TOP: 20px; + PADDING-LEFT: 0px +} +H3 +{ + COLOR: #000000; + FONT-SIZE: 80%; + FONT-WEIGHT: bold; + MARGIN-BOTTOM: -5px; + MARGIN-LEFT: 10px; + MARGIN-TOP: 20px +} +H4 +{ + COLOR: #000000; + FONT-SIZE: 70%; + FONT-WEIGHT: bold; + MARGIN-BOTTOM: 0px; + MARGIN-TOP: 15px; + PADDING-BOTTOM: 0px +} +UL +{ + COLOR: #000000; + FONT-SIZE: 70%; + LIST-STYLE: square; + MARGIN-BOTTOM: 0pt; + MARGIN-TOP: 0pt +} +OL +{ + COLOR: #000000; + FONT-SIZE: 70%; + LIST-STYLE: square; + MARGIN-BOTTOM: 0pt; + MARGIN-TOP: 0pt +} +LI +{ + LIST-STYLE: square; + MARGIN-LEFT: 0px +} +.expandable +{ + CURSOR: hand +} +.expanded +{ + color: black +} +.collapsed +{ + DISPLAY: none +} +.foot +{ +BACKGROUND-COLOR: #ffffff; +BORDER-BOTTOM: #cecf9c 1px solid; +BORDER-TOP: #cecf9c 2px solid +} +.settings +{ +MARGIN-LEFT: 25PX; +} +.help +{ +TEXT-ALIGN: right; +margin-right: 10px; +} diff --git a/模块化/MyTeamcenter_3/_UpgradeReport_Files/UpgradeReport.xslt b/模块化/MyTeamcenter_3/_UpgradeReport_Files/UpgradeReport.xslt new file mode 100644 index 0000000..68d617e --- /dev/null +++ b/模块化/MyTeamcenter_3/_UpgradeReport_Files/UpgradeReport.xslt @@ -0,0 +1,232 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+ 解决方案: + 项目: + + + + + + + +

+ + + + + + + + + + + + + + + + + + + + + + + + src + + + + + + + + + + + + +
文件名状态错误警告
+ javascript:document.images[''].click()src + + + + 已转换 + + + + 已转换 + +
+ + 个文件 + + + 1 个文件 + + + 已转换:
+ 未转换: +
+
+
+ + + + : + + + + + + + + + 转换报告 + <xsl:if test="Properties/Property[@Name='LogNumber']"> + <xsl:value-of select="Properties/Property[@Name='LogNumber']/@Value"/> + </xsl:if> + + + + +

转换报告 -

+ +

+ 转换时间:
+

+ + + + + + + + + + + + + + + + + + + + + + + + +

+ + + + + +
+ 转换设置 +

+ + +
+
diff --git a/模块化/MyTeamcenter_3/_UpgradeReport_Files/UpgradeReport_Minus.gif b/模块化/MyTeamcenter_3/_UpgradeReport_Files/UpgradeReport_Minus.gif new file mode 100644 index 0000000..17751cb Binary files /dev/null and b/模块化/MyTeamcenter_3/_UpgradeReport_Files/UpgradeReport_Minus.gif differ diff --git a/模块化/MyTeamcenter_3/_UpgradeReport_Files/UpgradeReport_Plus.gif b/模块化/MyTeamcenter_3/_UpgradeReport_Files/UpgradeReport_Plus.gif new file mode 100644 index 0000000..f6009ca Binary files /dev/null and b/模块化/MyTeamcenter_3/_UpgradeReport_Files/UpgradeReport_Plus.gif differ diff --git a/模块化/MyTeamcenter_3/app.config b/模块化/MyTeamcenter_3/app.config new file mode 100644 index 0000000..df20690 --- /dev/null +++ b/模块化/MyTeamcenter_3/app.config @@ -0,0 +1,3 @@ + + + diff --git a/模块化/MyTeamcenter_3/bin/Debug/Autodesk.AutoCAD.Interop.Common.dll b/模块化/MyTeamcenter_3/bin/Debug/Autodesk.AutoCAD.Interop.Common.dll new file mode 100644 index 0000000..8032e24 Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/Autodesk.AutoCAD.Interop.Common.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/Autodesk.AutoCAD.Interop.dll b/模块化/MyTeamcenter_3/bin/Debug/Autodesk.AutoCAD.Interop.dll new file mode 100644 index 0000000..6caa90d Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/Autodesk.AutoCAD.Interop.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/DFHMAutocad.dll b/模块化/MyTeamcenter_3/bin/Debug/DFHMAutocad.dll new file mode 100644 index 0000000..6fcc86e Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/DFHMAutocad.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/DFHMAutocad.dll.config b/模块化/MyTeamcenter_3/bin/Debug/DFHMAutocad.dll.config new file mode 100644 index 0000000..df20690 --- /dev/null +++ b/模块化/MyTeamcenter_3/bin/Debug/DFHMAutocad.dll.config @@ -0,0 +1,3 @@ + + + diff --git a/模块化/MyTeamcenter_3/bin/Debug/DFHMAutocad.pdb b/模块化/MyTeamcenter_3/bin/Debug/DFHMAutocad.pdb new file mode 100644 index 0000000..e91da71 Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/DFHMAutocad.pdb differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/DFHMAutocad.rar b/模块化/MyTeamcenter_3/bin/Debug/DFHMAutocad.rar new file mode 100644 index 0000000..31bebcc Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/DFHMAutocad.rar differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/Debug.rar b/模块化/MyTeamcenter_3/bin/Debug/Debug.rar new file mode 100644 index 0000000..f2d213b Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/Debug.rar differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/FCCNetClientProxyv80.dll b/模块化/MyTeamcenter_3/bin/Debug/FCCNetClientProxyv80.dll new file mode 100644 index 0000000..ea91b37 Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/FCCNetClientProxyv80.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/FMSNetTicketv80.dll b/模块化/MyTeamcenter_3/bin/Debug/FMSNetTicketv80.dll new file mode 100644 index 0000000..93b9342 Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/FMSNetTicketv80.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/FSCNetClientProxyv80.dll b/模块化/MyTeamcenter_3/bin/Debug/FSCNetClientProxyv80.dll new file mode 100644 index 0000000..cec2cc8 Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/FSCNetClientProxyv80.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/HelloTeamcenter.rar b/模块化/MyTeamcenter_3/bin/Debug/HelloTeamcenter.rar new file mode 100644 index 0000000..4e21971 Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/HelloTeamcenter.rar differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/HelloTeamcenter.vshost.exe b/模块化/MyTeamcenter_3/bin/Debug/HelloTeamcenter.vshost.exe new file mode 100644 index 0000000..69ed6c0 Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/HelloTeamcenter.vshost.exe differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/HelloTeamcenter.vshost.exe.config b/模块化/MyTeamcenter_3/bin/Debug/HelloTeamcenter.vshost.exe.config new file mode 100644 index 0000000..df20690 --- /dev/null +++ b/模块化/MyTeamcenter_3/bin/Debug/HelloTeamcenter.vshost.exe.config @@ -0,0 +1,3 @@ + + + diff --git a/模块化/MyTeamcenter_3/bin/Debug/HelloTeamcenter.vshost.exe.manifest b/模块化/MyTeamcenter_3/bin/Debug/HelloTeamcenter.vshost.exe.manifest new file mode 100644 index 0000000..061c9ca --- /dev/null +++ b/模块化/MyTeamcenter_3/bin/Debug/HelloTeamcenter.vshost.exe.manifest @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaAdministrationStrong.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaAdministrationStrong.dll new file mode 100644 index 0000000..2ccc59d Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaAdministrationStrong.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaAdministrationTypes.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaAdministrationTypes.dll new file mode 100644 index 0000000..6857864 Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaAdministrationTypes.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaAiStrong.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaAiStrong.dll new file mode 100644 index 0000000..29bc31e Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaAiStrong.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaAiTypes.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaAiTypes.dll new file mode 100644 index 0000000..e60a035 Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaAiTypes.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaAllocationsStrong.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaAllocationsStrong.dll new file mode 100644 index 0000000..8f8bb98 Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaAllocationsStrong.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaAllocationsTypes.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaAllocationsTypes.dll new file mode 100644 index 0000000..91e28b7 Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaAllocationsTypes.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaAsBuiltStrong.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaAsBuiltStrong.dll new file mode 100644 index 0000000..bcb8ca8 Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaAsBuiltStrong.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaAsBuiltTypes.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaAsBuiltTypes.dll new file mode 100644 index 0000000..5eca32c Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaAsBuiltTypes.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaAsMaintainedStrong.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaAsMaintainedStrong.dll new file mode 100644 index 0000000..906837a Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaAsMaintainedStrong.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaAsMaintainedTypes.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaAsMaintainedTypes.dll new file mode 100644 index 0000000..15e6d49 Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaAsMaintainedTypes.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaAsbAsmAlignmentStrong.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaAsbAsmAlignmentStrong.dll new file mode 100644 index 0000000..3fa7cf1 Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaAsbAsmAlignmentStrong.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaAsbAsmAlignmentTypes.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaAsbAsmAlignmentTypes.dll new file mode 100644 index 0000000..c0e7bb6 Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaAsbAsmAlignmentTypes.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaAuthorizedDataAccessStrong.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaAuthorizedDataAccessStrong.dll new file mode 100644 index 0000000..e0fda8a Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaAuthorizedDataAccessStrong.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaAuthorizedDataAccessTypes.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaAuthorizedDataAccessTypes.dll new file mode 100644 index 0000000..29ff010 Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaAuthorizedDataAccessTypes.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaBomStrong.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaBomStrong.dll new file mode 100644 index 0000000..f1e05fb Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaBomStrong.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaBomTypes.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaBomTypes.dll new file mode 100644 index 0000000..2332007 Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaBomTypes.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaBusinessModelerStrong.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaBusinessModelerStrong.dll new file mode 100644 index 0000000..6874e68 Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaBusinessModelerStrong.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaBusinessModelerTypes.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaBusinessModelerTypes.dll new file mode 100644 index 0000000..af0d68d Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaBusinessModelerTypes.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaCadBomAlignmentStrong.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaCadBomAlignmentStrong.dll new file mode 100644 index 0000000..dfc5dbf Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaCadBomAlignmentStrong.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaCadBomAlignmentTypes.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaCadBomAlignmentTypes.dll new file mode 100644 index 0000000..f7ce054 Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaCadBomAlignmentTypes.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaCadStrong.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaCadStrong.dll new file mode 100644 index 0000000..81419ea Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaCadStrong.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaCadTypes.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaCadTypes.dll new file mode 100644 index 0000000..0162d95 Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaCadTypes.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaCaeStrong.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaCaeStrong.dll new file mode 100644 index 0000000..2618a76 Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaCaeStrong.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaCaeTypes.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaCaeTypes.dll new file mode 100644 index 0000000..8d8c41f Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaCaeTypes.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaCalendarManagementStrong.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaCalendarManagementStrong.dll new file mode 100644 index 0000000..8861d63 Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaCalendarManagementStrong.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaCalendarManagementTypes.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaCalendarManagementTypes.dll new file mode 100644 index 0000000..71946f4 Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaCalendarManagementTypes.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaChangeManagementStrong.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaChangeManagementStrong.dll new file mode 100644 index 0000000..e606fec Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaChangeManagementStrong.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaChangeManagementTypes.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaChangeManagementTypes.dll new file mode 100644 index 0000000..80a0562 Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaChangeManagementTypes.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaClassificationStrong.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaClassificationStrong.dll new file mode 100644 index 0000000..ce5ef4e Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaClassificationStrong.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaClassificationTypes.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaClassificationTypes.dll new file mode 100644 index 0000000..7968976 Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaClassificationTypes.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaClient.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaClient.dll new file mode 100644 index 0000000..e6915c0 Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaClient.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaCommon.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaCommon.dll new file mode 100644 index 0000000..b712e30 Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaCommon.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaConfigurationStrong.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaConfigurationStrong.dll new file mode 100644 index 0000000..fd21d7d Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaConfigurationStrong.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaConfigurationTypes.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaConfigurationTypes.dll new file mode 100644 index 0000000..c26b865 Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaConfigurationTypes.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaCoreStrong.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaCoreStrong.dll new file mode 100644 index 0000000..ae91feb Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaCoreStrong.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaCoreTypes.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaCoreTypes.dll new file mode 100644 index 0000000..0c941e3 Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaCoreTypes.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaDocumentManagementStrong.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaDocumentManagementStrong.dll new file mode 100644 index 0000000..80fa38b Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaDocumentManagementStrong.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaDocumentManagementTypes.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaDocumentManagementTypes.dll new file mode 100644 index 0000000..0109f12 Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaDocumentManagementTypes.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaFMS.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaFMS.dll new file mode 100644 index 0000000..bf186bd Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaFMS.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaGlobalMultiSiteStrong.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaGlobalMultiSiteStrong.dll new file mode 100644 index 0000000..865a2ac Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaGlobalMultiSiteStrong.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaGlobalMultiSiteTypes.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaGlobalMultiSiteTypes.dll new file mode 100644 index 0000000..7c643ff Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaGlobalMultiSiteTypes.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaImportExportStrong.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaImportExportStrong.dll new file mode 100644 index 0000000..858c6ca Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaImportExportStrong.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaImportExportTypes.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaImportExportTypes.dll new file mode 100644 index 0000000..34d2098 Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaImportExportTypes.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaIssueManagementStrong.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaIssueManagementStrong.dll new file mode 100644 index 0000000..bee8926 Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaIssueManagementStrong.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaIssueManagementTypes.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaIssueManagementTypes.dll new file mode 100644 index 0000000..a107a4e Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaIssueManagementTypes.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaMESStrong.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaMESStrong.dll new file mode 100644 index 0000000..9bf61b2 Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaMESStrong.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaMESTypes.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaMESTypes.dll new file mode 100644 index 0000000..7c3a5f7 Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaMESTypes.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaManufacturingStrong.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaManufacturingStrong.dll new file mode 100644 index 0000000..1e7444a Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaManufacturingStrong.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaManufacturingTypes.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaManufacturingTypes.dll new file mode 100644 index 0000000..31f04a0 Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaManufacturingTypes.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaMultisiteStrong.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaMultisiteStrong.dll new file mode 100644 index 0000000..20656b4 Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaMultisiteStrong.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaMultisiteTypes.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaMultisiteTypes.dll new file mode 100644 index 0000000..9aeaf25 Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaMultisiteTypes.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaParameterManagementStrong.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaParameterManagementStrong.dll new file mode 100644 index 0000000..d8b33c3 Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaParameterManagementStrong.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaParameterManagementTypes.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaParameterManagementTypes.dll new file mode 100644 index 0000000..1683222 Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaParameterManagementTypes.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaProductionManagementStrong.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaProductionManagementStrong.dll new file mode 100644 index 0000000..65c42bf Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaProductionManagementStrong.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaProductionManagementTypes.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaProductionManagementTypes.dll new file mode 100644 index 0000000..085a8b9 Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaProductionManagementTypes.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaProjectManagementStrong.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaProjectManagementStrong.dll new file mode 100644 index 0000000..78a03f3 Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaProjectManagementStrong.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaProjectManagementTypes.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaProjectManagementTypes.dll new file mode 100644 index 0000000..5bcb240 Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaProjectManagementTypes.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaQueryStrong.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaQueryStrong.dll new file mode 100644 index 0000000..fa074a7 Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaQueryStrong.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaQueryTypes.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaQueryTypes.dll new file mode 100644 index 0000000..5dae3ed Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaQueryTypes.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaRdvStrong.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaRdvStrong.dll new file mode 100644 index 0000000..622604d Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaRdvStrong.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaRdvTypes.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaRdvTypes.dll new file mode 100644 index 0000000..c4294cf Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaRdvTypes.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaReportsStrong.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaReportsStrong.dll new file mode 100644 index 0000000..15c1cb2 Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaReportsStrong.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaReportsTypes.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaReportsTypes.dll new file mode 100644 index 0000000..c7b5ab3 Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaReportsTypes.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaRequirementsManagementStrong.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaRequirementsManagementStrong.dll new file mode 100644 index 0000000..333d512 Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaRequirementsManagementStrong.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaRequirementsManagementTypes.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaRequirementsManagementTypes.dll new file mode 100644 index 0000000..f9e1a2f Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaRequirementsManagementTypes.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaSrmIntegrationStrong.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaSrmIntegrationStrong.dll new file mode 100644 index 0000000..47d022d Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaSrmIntegrationStrong.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaSrmIntegrationTypes.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaSrmIntegrationTypes.dll new file mode 100644 index 0000000..fa42c30 Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaSrmIntegrationTypes.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModel.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModel.dll new file mode 100644 index 0000000..0efb9aa Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModel.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelAcadGmo.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelAcadGmo.dll new file mode 100644 index 0000000..f36684a Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelAcadGmo.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelAdsFoundation.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelAdsFoundation.dll new file mode 100644 index 0000000..2116f06 Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelAdsFoundation.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelAsBuilt.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelAsBuilt.dll new file mode 100644 index 0000000..955bc73 Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelAsBuilt.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelAsMaintained.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelAsMaintained.dll new file mode 100644 index 0000000..f1811e2 Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelAsMaintained.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelBrndMgmt.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelBrndMgmt.dll new file mode 100644 index 0000000..89d57b8 Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelBrndMgmt.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelCba.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelCba.dll new file mode 100644 index 0000000..ebee5ca Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelCba.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelCcdm.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelCcdm.dll new file mode 100644 index 0000000..297a0ca Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelCcdm.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelCm.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelCm.dll new file mode 100644 index 0000000..792f3ea Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelCm.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelCmtEbop.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelCmtEbop.dll new file mode 100644 index 0000000..80ad48c Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelCmtEbop.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelCmtEmserver.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelCmtEmserver.dll new file mode 100644 index 0000000..9c4962d Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelCmtEmserver.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelCmtPadTwp.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelCmtPadTwp.dll new file mode 100644 index 0000000..0e4aa8e Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelCmtPadTwp.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelContmgmtBase.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelContmgmtBase.dll new file mode 100644 index 0000000..dd3e74d Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelContmgmtBase.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelContmgmtDita.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelContmgmtDita.dll new file mode 100644 index 0000000..0009592 Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelContmgmtDita.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelContmgmtS1000d.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelContmgmtS1000d.dll new file mode 100644 index 0000000..9e2f456 Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelContmgmtS1000d.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelCpgMaterials.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelCpgMaterials.dll new file mode 100644 index 0000000..2a2386b Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelCpgMaterials.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelDpv.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelDpv.dll new file mode 100644 index 0000000..6a6c250 Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelDpv.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelEdaLibrary.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelEdaLibrary.dll new file mode 100644 index 0000000..ebdb6c0 Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelEdaLibrary.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelEdaServer.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelEdaServer.dll new file mode 100644 index 0000000..0aeee5a Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelEdaServer.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelEmps.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelEmps.dll new file mode 100644 index 0000000..e0e5c66 Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelEmps.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelEsddm.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelEsddm.dll new file mode 100644 index 0000000..5585a0e Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelEsddm.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelEsddmScm.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelEsddmScm.dll new file mode 100644 index 0000000..711098a Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelEsddmScm.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelEsmBase.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelEsmBase.dll new file mode 100644 index 0000000..033c816 Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelEsmBase.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelEsmProcessor.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelEsmProcessor.dll new file mode 100644 index 0000000..670e3ef Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelEsmProcessor.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelEsmSoftware.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelEsmSoftware.dll new file mode 100644 index 0000000..b6bc987 Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelEsmSoftware.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelFpMgmt.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelFpMgmt.dll new file mode 100644 index 0000000..6429955 Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelFpMgmt.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelGmdpv.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelGmdpv.dll new file mode 100644 index 0000000..c2dbc02 Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelGmdpv.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelGmo.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelGmo.dll new file mode 100644 index 0000000..9b73504 Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelGmo.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelHrn.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelHrn.dll new file mode 100644 index 0000000..a7d33e5 Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelHrn.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelIssueManagement.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelIssueManagement.dll new file mode 100644 index 0000000..79e28a3 Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelIssueManagement.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelMES.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelMES.dll new file mode 100644 index 0000000..0f1ce96 Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelMES.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelMROCore.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelMROCore.dll new file mode 100644 index 0000000..25fc6cb Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelMROCore.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelPkgArt.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelPkgArt.dll new file mode 100644 index 0000000..3cc8dd7 Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelPkgArt.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelProductVariant.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelProductVariant.dll new file mode 100644 index 0000000..220531c Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelProductVariant.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelScdt.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelScdt.dll new file mode 100644 index 0000000..f21e422 Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelScdt.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelScmCc.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelScmCc.dll new file mode 100644 index 0000000..20d3e1a Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelScmCc.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelServiceEventManagement.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelServiceEventManagement.dll new file mode 100644 index 0000000..9a84bd7 Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelServiceEventManagement.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelServiceProcessing.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelServiceProcessing.dll new file mode 100644 index 0000000..1e8f794 Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelServiceProcessing.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelServiceRequest.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelServiceRequest.dll new file mode 100644 index 0000000..46420be Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelServiceRequest.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelSpecMgr.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelSpecMgr.dll new file mode 100644 index 0000000..6f63621 Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelSpecMgr.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelTcae.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelTcae.dll new file mode 100644 index 0000000..6894d3c Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelTcae.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelTransactionProcessing.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelTransactionProcessing.dll new file mode 100644 index 0000000..38f7098 Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelTransactionProcessing.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelVendorManagement.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelVendorManagement.dll new file mode 100644 index 0000000..2225b5a Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaStrongModelVendorManagement.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaStructureManagementStrong.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaStructureManagementStrong.dll new file mode 100644 index 0000000..a6b57a7 Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaStructureManagementStrong.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaStructureManagementTypes.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaStructureManagementTypes.dll new file mode 100644 index 0000000..b453f2c Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaStructureManagementTypes.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaSvcProcessingStrong.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaSvcProcessingStrong.dll new file mode 100644 index 0000000..a733447 Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaSvcProcessingStrong.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaSvcProcessingTypes.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaSvcProcessingTypes.dll new file mode 100644 index 0000000..b75d139 Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaSvcProcessingTypes.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaSvcRequestStrong.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaSvcRequestStrong.dll new file mode 100644 index 0000000..ef49449 Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaSvcRequestStrong.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaSvcRequestTypes.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaSvcRequestTypes.dll new file mode 100644 index 0000000..d3d35f1 Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaSvcRequestTypes.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaTranslationStrong.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaTranslationStrong.dll new file mode 100644 index 0000000..8bba079 Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaTranslationStrong.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaTranslationTypes.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaTranslationTypes.dll new file mode 100644 index 0000000..6b1605d Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaTranslationTypes.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaValidationStrong.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaValidationStrong.dll new file mode 100644 index 0000000..abb0c1b Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaValidationStrong.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaValidationTypes.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaValidationTypes.dll new file mode 100644 index 0000000..347b966 Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaValidationTypes.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaVendorManagementStrong.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaVendorManagementStrong.dll new file mode 100644 index 0000000..1f27852 Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaVendorManagementStrong.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaVendorManagementTypes.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaVendorManagementTypes.dll new file mode 100644 index 0000000..ffc9194 Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaVendorManagementTypes.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaWireHarnessStrong.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaWireHarnessStrong.dll new file mode 100644 index 0000000..06bfec3 Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaWireHarnessStrong.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaWireHarnessTypes.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaWireHarnessTypes.dll new file mode 100644 index 0000000..d7506da Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaWireHarnessTypes.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaWorkflowStrong.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaWorkflowStrong.dll new file mode 100644 index 0000000..a31792b Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaWorkflowStrong.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/TcSoaWorkflowTypes.dll b/模块化/MyTeamcenter_3/bin/Debug/TcSoaWorkflowTypes.dll new file mode 100644 index 0000000..085b589 Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/TcSoaWorkflowTypes.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/Teamcenter_SSO.dll b/模块化/MyTeamcenter_3/bin/Debug/Teamcenter_SSO.dll new file mode 100644 index 0000000..70b3b1c Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/Teamcenter_SSO.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/Teamcenter_SSOloader.dll b/模块化/MyTeamcenter_3/bin/Debug/Teamcenter_SSOloader.dll new file mode 100644 index 0000000..38f8b46 Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/Teamcenter_SSOloader.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/acad.err b/模块化/MyTeamcenter_3/bin/Debug/acad.err new file mode 100644 index 0000000..eab7408 --- /dev/null +++ b/模块化/MyTeamcenter_3/bin/Debug/acad.err @@ -0,0 +1,12 @@ + + +: Unhandled Access Violation Reading 0x0000 Exception at f629d68h + +05/15/2012 at 10:24:27.785 ͼ: Drawing1.dwg +------------- + + +: Unhandled Access Violation Reading 0x0000 Exception at 23b0aa78h + +05/15/2012 at 11:15:51.082 ͼ: Drawing1.dwg +------------- diff --git a/模块化/MyTeamcenter_3/bin/Debug/acdbmgd.dll b/模块化/MyTeamcenter_3/bin/Debug/acdbmgd.dll new file mode 100644 index 0000000..5232456 Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/acdbmgd.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/acmgd.dll b/模块化/MyTeamcenter_3/bin/Debug/acmgd.dll new file mode 100644 index 0000000..54628c5 Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/acmgd.dll differ diff --git a/模块化/MyTeamcenter_3/bin/Debug/log4net.dll b/模块化/MyTeamcenter_3/bin/Debug/log4net.dll new file mode 100644 index 0000000..ffc57e1 Binary files /dev/null and b/模块化/MyTeamcenter_3/bin/Debug/log4net.dll differ diff --git a/模块化/MyTeamcenter_3/clientx/AppXCredentialManager.cs b/模块化/MyTeamcenter_3/clientx/AppXCredentialManager.cs new file mode 100644 index 0000000..6ad8fff --- /dev/null +++ b/模块化/MyTeamcenter_3/clientx/AppXCredentialManager.cs @@ -0,0 +1,146 @@ +//================================================== +// +// @@ +// +//================================================== + + + +using System; +using System.IO; + +using Teamcenter.Schemas.Soa._2006_03.Exceptions; +using Teamcenter.Soa; +using Teamcenter.Soa.Common; +using Teamcenter.Soa.Client; +using Teamcenter.Soa.Exceptions; + +namespace Teamcenter.ClientX +{ + +/** + * The CredentialManager is used by the Teamcenter Services framework to get the + * user's credentials when challanged by the server. This can occur after a period + * of inactivity and the server has timed-out the user's session, at which time + * the client application will need to re-authenitcate. The framework will + * call one of the getCredentials methods (depending on circumstances) and will + * send the SessionService.login service request. Upon successfull completion of + * the login service request. The last service request (one that cuased the challange) + * will be resent. + * + * The framework will also call the setUserPassword setGroupRole methods when ever + * these credentials change, thus allowing this implementation of the CredentialManager + * to cache these values so prompting of the user is not requried for re-authentication. + * + */ +public class AppXCredentialManager : CredentialManager +{ + + private String name = null; + private String password = null; + private String group = ""; // default group + private String role = ""; // default role + private String discriminator = "SoaAppX"; // always connect same user + // to same instance of server + + /** + * Return the type of credentials this implementation provides, + * standard (user/password) or Single-Sign-On. In this case + * Standard credentials are returned. + * + * @see com.teamcenter.soa.client.CredentialManager#getCredentialType() + */ + public int CredentialType + { + get { return SoaConstants.CLIENT_CREDENTIAL_TYPE_STD; } + } + + /** + * Prompt's the user for credentials. + * This method will only be called by the framework when a login attempt has + * failed. + * + * @see com.teamcenter.soa.client.CredentialManager#getCredentials(com.teamcenter.schemas.soa._2006_03.exceptions.InvalidCredentialsException) + */ + public string[] GetCredentials(InvalidCredentialsException e) + //throws CanceledOperationException + { + Console.WriteLine(e.Message); + return PromptForCredentials(); + } + + /** + * Return the cached credentials. + * This method will be called when a service request is sent without a valid + * session ( session has expired on the server). + * + * @see com.teamcenter.soa.client.CredentialManager#getCredentials(com.teamcenter.schemas.soa._2006_03.exceptions.InvalidUserException) + */ + public String[] GetCredentials(InvalidUserException e) + //throws CanceledOperationException + { + // Have not logged in yet, shoult not happen but just in case + if (name == null) return PromptForCredentials(); + + // Return cached credentials + String[] tokens = { name, password, group, role, discriminator }; + return tokens; + } + + /** + * Cache the group and role + * This is called after the SessionService.setSessionGroupMember service + * operation is called. + * + * @see com.teamcenter.soa.client.CredentialManager#setGroupRole(java.lang.String, + * java.lang.String) + */ + public void SetGroupRole(String group, String role) + { + this.group = group; + this.role = role; + } + + /** + * Cache the User and Password + * This is called after the SessionService.login service operation is called. + * + * @see com.teamcenter.soa.client.CredentialManager#setUserPassword(java.lang.String, + * java.lang.String, java.lang.String) + */ + public void SetUserPassword(String user, String password, String discriminator) + { + this.name = user; + this.password = password; + this.discriminator = discriminator; + } + + + public String[] PromptForCredentials() + //throws CanceledOperationException + { + try + { + Console.WriteLine("Please enter user credentials (return to quit):"); + Console.Write("User Name: "); + name = Console.ReadLine(); + + if (name.Length == 0) + throw new CanceledOperationException(""); + + Console.Write("Password: "); + password = Console.ReadLine(); + } + catch (IOException e) + { + String message = "Failed to get the name and password.\n" + e.Message; + Console.WriteLine(message); + throw new CanceledOperationException(message); + } + + String[] tokens = { name, password, group, role, discriminator }; + return tokens; + } + +} +} diff --git a/模块化/MyTeamcenter_3/clientx/AppXDeletedObjectListener.cs b/模块化/MyTeamcenter_3/clientx/AppXDeletedObjectListener.cs new file mode 100644 index 0000000..d051a7f --- /dev/null +++ b/模块化/MyTeamcenter_3/clientx/AppXDeletedObjectListener.cs @@ -0,0 +1,38 @@ +//================================================== +// +// @@ +// +//================================================== + +using System; + +using Teamcenter.Soa.Client.Model; + +namespace Teamcenter.ClientX +{ + +/** + * Implementation of the DeleteListener, simply prints out list of all objects + * that are deleted. + * + */ +public class AppXDeletedObjectListener : DeleteListener +{ + + public void ModelObjectDelete(string[] uids) + { + if (uids.Length == 0) + return; + + System.Console.WriteLine(""); + System.Console.WriteLine("Deleted Objects handled in com.teamcenter.clientx.AppXDeletedObjectListener.modelObjectDelete"); + System.Console.WriteLine("The following objects have been deleted from the server and removed from the client data model:"); + for (int i = 0; i < uids.Length; i++) + { + System.Console.WriteLine(" " + uids[i]); + } + + } + +} +} diff --git a/模块化/MyTeamcenter_3/clientx/AppXExceptionHandler.cs b/模块化/MyTeamcenter_3/clientx/AppXExceptionHandler.cs new file mode 100644 index 0000000..824c9ad --- /dev/null +++ b/模块化/MyTeamcenter_3/clientx/AppXExceptionHandler.cs @@ -0,0 +1,101 @@ +//================================================== +// +// @@ +// +//================================================== + + +using System; +using System.IO; + +using Teamcenter.Schemas.Soa._2006_03.Exceptions; +using Teamcenter.Soa.Client; +using Teamcenter.Soa.Exceptions; + +namespace Teamcenter.ClientX +{ + + + /** + * Implementation of the ExceptionHandler. For ConnectionExceptions (server + * temporarily down .etc) prompts the user to retry the last request. For other + * exceptions convert to a RunTime exception. + */ + public class AppXExceptionHandler : ExceptionHandler + { + + /* + * (non-Javadoc) + * + * @see com.teamcenter.soa.client.ExceptionHandler#handleException(com.teamcenter.schemas.soa._2006_03.exceptions.InternalServerException) + */ + public void HandleException(InternalServerException ise) + { + Console.WriteLine(""); + Console.WriteLine("*****"); + Console.WriteLine("Exception caught in com.teamcenter.clientx.AppXExceptionHandler.handleException(InternalServerException)."); + + + if (ise is ConnectionException) + { + // ConnectionException are typically due to a network error (server + // down .etc) and can be recovered from (the last request can be sent again, + // after the problem is corrected). + Console.Write("\nThe server returned an connection error.\n" + ise.Message + + "\nDo you wish to retry the last service request?[y/n]"); + } + else if (ise is ProtocolException) + { + // ProtocolException are typically due to programming errors + // (content of HTTP + // request is incorrect). These are generally can not be + // recovered from. + Console.Write("\nThe server returned an protocol error.\n" + ise.Message + + "\nThis is most likely the result of a programming error." + + "\nDo you wish to retry the last service request?[y/n]"); + } + else + { + Console.WriteLine("\nThe server returned an internal server error.\n" + + ise.Message + + "\nThis is most likely the result of a programming error." + + "\nA RuntimeException will be thrown."); + throw new SystemException(ise.Message); + } + + try + { + String retry = Console.ReadLine(); + // If yes, return to the calling SOA client framework, where the + // last service request will be resent. + if (retry.ToLower().Equals("y") || retry.ToLower().Equals("yes")) + return; + + throw new SystemException("The user has opted not to retry the last request"); + } + catch (IOException e) + { + Console.Error.WriteLine("Failed to read user response.\nA RuntimeException will be thrown."); + throw new SystemException(e.Message); + } + } + + /* + * (non-Javadoc) + * + * @see com.teamcenter.soa.client.ExceptionHandler#handleException(com.teamcenter.soa.exceptions.CanceledOperationException) + */ + public void HandleException(CanceledOperationException coe) + { + Console.WriteLine(""); + Console.WriteLine("*****"); + Console.WriteLine("Exception caught in com.teamcenter.clientx.AppXExceptionHandler.handleException(CanceledOperationException)."); + + // Expecting this from the login tests with bad credentials, and the + // AnyUserCredentials class not + // prompting for different credentials + throw new SystemException(coe.Message); + } + + } +} diff --git a/模块化/MyTeamcenter_3/clientx/AppXPartialErrorListener.cs b/模块化/MyTeamcenter_3/clientx/AppXPartialErrorListener.cs new file mode 100644 index 0000000..644a63b --- /dev/null +++ b/模块化/MyTeamcenter_3/clientx/AppXPartialErrorListener.cs @@ -0,0 +1,68 @@ +//================================================== +// +// @@ +// +//================================================== + +using System; + +using Teamcenter.Soa.Client.Model; + + +namespace Teamcenter.ClientX +{ + +/** + * Implementation of the PartialErrorListener. Print out any partial errors + * returned. + * + */ +public class AppXPartialErrorListener : PartialErrorListener +{ + + /* + * (non-Javadoc) + * + * @see com.teamcenter.soa.client.model.PartialErrorListener#handlePartialError(com.teamcenter.soa.client.model.ErrorStack[]) + */ + public void HandlePartialError(ErrorStack[] stacks) + { + if (stacks.Length == 0) return; + + Console.WriteLine(""); + Console.WriteLine("*****"); + Console.WriteLine("Partial Errors caught in com.teamcenter.clientx.AppXPartialErrorListener."); + + + for (int i = 0; i < stacks.Length; i++) + { + ErrorValue[] errors = stacks[i].ErrorValues; + Console.Write("Partial Error for "); + + // The different service implementation may optionally associate + // an ModelObject, client ID, or nothing, with each partial error + if (stacks[i].HasAssociatedObject() ) + { + Console.WriteLine("object "+ stacks[i].AssociatedObject.Uid); + } + else if (stacks[i].HasClientId()) + { + Console.WriteLine("client id "+ stacks[i].ClientId); + } + else if (stacks[i].HasClientIndex()) + { + Console.WriteLine("client index " + stacks[i].ClientIndex); + } + + // Each Partial Error will have one or more contributing error messages + for (int j = 0; j < errors.Length; j++) + { + Console.WriteLine(" Code: " + errors[j].Code + "\tSeverity: " + + errors[j].Level + "\t" + errors[j].Message); + } + } + + } + +} +} diff --git a/模块化/MyTeamcenter_3/clientx/AppXRequestListener.cs b/模块化/MyTeamcenter_3/clientx/AppXRequestListener.cs new file mode 100644 index 0000000..fe84a9a --- /dev/null +++ b/模块化/MyTeamcenter_3/clientx/AppXRequestListener.cs @@ -0,0 +1,42 @@ +//================================================== +// +// @@ +// +//================================================== + +using System; + +using Teamcenter.Soa.Client; + + +namespace Teamcenter.ClientX +{ + + /** + * This implemenation of the RequestListener, logs each service request + * to the console. + * + */ + public class AppXRequestListener : RequestListener + { + + + /** + * Called before each request is sent to the server. + */ + public void ServiceRequest(ServiceInfo info) + { + // will log the service name when done + } + + /** + * Called after each response from the server. + * Log the service operation to the console. + */ + public void ServiceResponse(ServiceInfo info) + { + Console.WriteLine(info.Id + ": " + info.Service + "." + info.Operation); + } + + } +} diff --git a/模块化/MyTeamcenter_3/clientx/AppXUpdateObjectListener.cs b/模块化/MyTeamcenter_3/clientx/AppXUpdateObjectListener.cs new file mode 100644 index 0000000..5865ee6 --- /dev/null +++ b/模块化/MyTeamcenter_3/clientx/AppXUpdateObjectListener.cs @@ -0,0 +1,48 @@ +//================================================== +// +// @@ +// +//================================================== + +using System; + +using Teamcenter.Soa.Client.Model; +using Teamcenter.Soa.Exceptions; + +namespace Teamcenter.ClientX +{ + + +/** + * Implementation of the ChangeListener. Print out all objects that have been updated. + * + */ +public class AppXUpdateObjectListener : ChangeListener +{ + + public void ModelObjectChange(ModelObject[] objects) + { + if (objects.Length == 0) return; + System.Console.WriteLine(""); + System.Console.WriteLine("Modified Objects handled in com.teamcenter.clientx.AppXUpdateObjectListener.modelObjectChange"); + System.Console.WriteLine("The following objects have been updated in the client data model:"); + for (int i = 0; i < objects.Length; i++) + { + String uid = objects[i].Uid; + String type = objects[i].GetType().Name; + String name = ""; + if (objects[i].GetType().Name.Equals("WorkspaceObject")) + { + ModelObject wo = objects[i]; + try + { + name = wo.GetProperty("object_string").StringValue; + } + catch (NotLoadedException /*e*/) {} // just ignore + } + System.Console.WriteLine(" " + uid + " " + type + " " + name); + } + } + +} +} diff --git a/模块化/MyTeamcenter_3/clientx/Session.cs b/模块化/MyTeamcenter_3/clientx/Session.cs new file mode 100644 index 0000000..4c75b49 --- /dev/null +++ b/模块化/MyTeamcenter_3/clientx/Session.cs @@ -0,0 +1,278 @@ +//================================================== +// +// @@ +// +//================================================== + + + + +using System; +using System.Collections; +using System.Net; + +using Teamcenter.Schemas.Soa._2006_03.Exceptions; +using Teamcenter.Services.Strong.Core; +using Teamcenter.Services.Strong.Core._2006_03.Session; +using Teamcenter.Soa; +using Teamcenter.Soa.Client; +using Teamcenter.Soa.Client.Model; +using Teamcenter.Soa.Exceptions; + +using WorkspaceObject = Teamcenter.Soa.Client.Model.Strong.WorkspaceObject; +using User = Teamcenter.Soa.Client.Model.Strong.User; + +namespace Teamcenter.ClientX +{ + + + public class Session + { + /** + * Single instance of the Connection object that is shared throughtout + * the application. This Connection object is needed whenever a Service + * stub is instantiated. + */ + private static Connection connection; + + /** + * The credentialManager is used both by the Session class and the Teamcenter + * Services Framework to get user credentials. + * + */ + private static AppXCredentialManager credentialManager; + + /** + * Create an instance of the Session with a connection to the specified + * server. + * + * Add implementations of the ExceptionHandler, PartialErrorListener, + * ChangeListener, and DeleteListeners. + * + * @param host Address of the host to connect to, http://serverName:port/tc + */ + public Session(String host) + { + // Create an instance of the CredentialManager, this is used + // by the SOA Framework to get the user's credentials when + // challanged by the server (sesioin timeout on the web tier). + credentialManager = new AppXCredentialManager(); + + + + // Create the Connection object, no contact is made with the server + // until a service request is made + connection = new Connection(host, new CookieCollection(), credentialManager, SoaConstants.REST, + SoaConstants.HTTP, false); + + + // Add an ExceptionHandler to the Connection, this will handle any + // InternalServerException, communication errors, xml marshalling errors + // .etc + connection.ExceptionHandler = new AppXExceptionHandler(); + + // While the above ExceptionHandler is required, all of the following + // Listeners are optional. Client application can add as many or as few Listeners + // of each type that they want. + + // Add a Partial Error Listener, this will be notified when ever a + // a service returns partial errors. + connection.ModelManager.AddPartialErrorListener(new AppXPartialErrorListener()); + + // Add a Change Listener, this will be notified when ever a + // a service returns model objects that have been updated. + connection.ModelManager.AddChangeListener(new AppXUpdateObjectListener()); + + // Add a Delete Listener, this will be notified when ever a + // a service returns objects that have been deleted. + connection.ModelManager.AddDeleteListener(new AppXDeletedObjectListener()); + + // Add a Request Listener, this will be notified before and after each + // service request is sent to the server. + Connection.AddRequestListener(new AppXRequestListener()); + } + + /** + * Get the single Connection object for the application + * + * @return connection + */ + public static Connection getConnection() + { + return connection; + } + + /** + * Login to the Teamcenter Server + * + */ + public User login() + { + // Get the service stub + SessionService sessionService = SessionService.getService(connection); + + try + { + // Prompt for credentials until they are right, or until user + // cancels + String[] credentials = credentialManager.PromptForCredentials(); + while (true) + { + try + { + + // ***************************** + // Execute the service operation + // ***************************** + LoginResponse resp = sessionService.Login(credentials[0], credentials[1], + credentials[2], credentials[3],"",credentials[4]); + + return resp.User; + } + catch (InvalidCredentialsException e) + { + credentials = credentialManager.GetCredentials(e); + } + } + } + // User canceled the operation, don't need to tell him again + catch (CanceledOperationException /*e*/) {} + + // Exit the application + //System.exit(0); + return null; + } + public User mylogin(string username,string password,string usergroup,string userrole) + { + // Get the service stub + SessionService sessionService = SessionService.getService(connection); + try + { + while (true) + { + try + { + + // ***************************** + // Execute the service operation + // ***************************** + LoginResponse resp = sessionService.Login(username, password, + usergroup, userrole, "", ""); + + return resp.User; + } + catch (InvalidCredentialsException e) + { + return null; + } + } + } + // User canceled the operation, don't need to tell him again + catch (CanceledOperationException /*e*/) { } + + // Exit the application + //System.exit(0); + return null; + } + /** + * Terminate the session with the Teamcenter Server + * + */ + public void logout() + { + // Get the service stub + SessionService sessionService = SessionService.getService(connection); + try + { + // ***************************** + // Execute the service operation + // ***************************** + sessionService.Logout(); + } + catch (ServiceException /*e*/) { } + } + + /** + * Print some basic information for a list of objects + * + * @param objects + */ + public static void printObjects(ModelObject[] objects) + { + if(objects == null) + return; + + + // Ensure that the referenced User objects that we will use below are loaded + getUsers( objects ); + + Console.WriteLine("Name\t\tOwner\t\tLast Modified"); + Console.WriteLine("====\t\t=====\t\t============="); + for (int i = 0; i < objects.Length; i++) + { + if(!(objects[i] is WorkspaceObject )) + continue; + + WorkspaceObject wo = (WorkspaceObject)objects[i]; + try + { + String name = wo.Object_string; + User owner = (User) wo.Owning_user; + DateTime lastModified =wo.Last_mod_date; + + Console.WriteLine(name + "\t" + owner.User_name + "\t" + lastModified.ToString()); + } + catch (NotLoadedException e) + { + // Print out a message, and skip to the next item in the folder + // Could do a DataManagementService.getProperties call at this point + Console.WriteLine(e.Message); + Console.WriteLine("The Object Property Policy ($TC_DATA/soa/policies/Default.xml) is not configured with this property."); + } + } + + } + + + private static void getUsers(ModelObject[] objects) + { + if(objects == null) + return; + + DataManagementService dmService = DataManagementService.getService(Session.getConnection()); + ArrayList unKnownUsers = new ArrayList(); + for (int i = 0; i < objects.Length; i++) + { + if(!(objects[i] is WorkspaceObject )) + continue; + + WorkspaceObject wo = (WorkspaceObject)objects[i]; + + User owner = null; + try + { + owner = (User) wo.Owning_user; + String userName = owner.User_name; + } + catch (NotLoadedException /*e*/) + { + if(owner != null) + unKnownUsers.Add(owner); + } + } + User[] users = new User[unKnownUsers.Count]; + unKnownUsers.CopyTo( users ); + String[] attributes = { "user_name" }; + + + // ***************************** + // Execute the service operation + // ***************************** + dmService.GetProperties(users, attributes); + + + } + + + } +} diff --git a/模块化/MyTeamcenter_3/form/Login.Designer.cs b/模块化/MyTeamcenter_3/form/Login.Designer.cs new file mode 100644 index 0000000..f4baab6 --- /dev/null +++ b/模块化/MyTeamcenter_3/form/Login.Designer.cs @@ -0,0 +1,204 @@ +namespace HelloTeamcenter.form +{ + partial class Login + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.pictureBox1 = new System.Windows.Forms.PictureBox(); + this.label1 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.label3 = new System.Windows.Forms.Label(); + this.label4 = new System.Windows.Forms.Label(); + this.label5 = new System.Windows.Forms.Label(); + this.textBox1 = new System.Windows.Forms.TextBox(); + this.textBox2 = new System.Windows.Forms.TextBox(); + this.textBox3 = new System.Windows.Forms.TextBox(); + this.textBox4 = new System.Windows.Forms.TextBox(); + this.textBox5 = new System.Windows.Forms.TextBox(); + this.button1 = new System.Windows.Forms.Button(); + this.button2 = new System.Windows.Forms.Button(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); + this.SuspendLayout(); + // + // pictureBox1 + // + this.pictureBox1.Image = global::HelloTeamcenter.Properties.Resources.login; + this.pictureBox1.Location = new System.Drawing.Point(7, 12); + this.pictureBox1.Name = "pictureBox1"; + this.pictureBox1.Size = new System.Drawing.Size(383, 199); + this.pictureBox1.TabIndex = 0; + this.pictureBox1.TabStop = false; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(405, 29); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(59, 12); + this.label1.TabIndex = 1; + this.label1.Text = "连接到: "; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(405, 69); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(59, 12); + this.label2.TabIndex = 2; + this.label2.Text = "用户名: "; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(405, 105); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(59, 12); + this.label3.TabIndex = 3; + this.label3.Text = "密 码: "; + // + // label4 + // + this.label4.AutoSize = true; + this.label4.Location = new System.Drawing.Point(405, 142); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(59, 12); + this.label4.TabIndex = 4; + this.label4.Text = "所在组: "; + // + // label5 + // + this.label5.AutoSize = true; + this.label5.Location = new System.Drawing.Point(405, 176); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(59, 12); + this.label5.TabIndex = 5; + this.label5.Text = "角 色: "; + // + // textBox1 + // + this.textBox1.Location = new System.Drawing.Point(457, 25); + this.textBox1.Name = "textBox1"; + this.textBox1.Size = new System.Drawing.Size(120, 21); + this.textBox1.TabIndex = 6; + // + // textBox2 + // + this.textBox2.Location = new System.Drawing.Point(457, 63); + this.textBox2.Name = "textBox2"; + this.textBox2.Size = new System.Drawing.Size(120, 21); + this.textBox2.TabIndex = 7; + // + // textBox3 + // + this.textBox3.Location = new System.Drawing.Point(457, 99); + this.textBox3.Name = "textBox3"; + this.textBox3.PasswordChar = '*'; + this.textBox3.Size = new System.Drawing.Size(120, 21); + this.textBox3.TabIndex = 8; + // + // textBox4 + // + this.textBox4.Location = new System.Drawing.Point(457, 137); + this.textBox4.Name = "textBox4"; + this.textBox4.Size = new System.Drawing.Size(120, 21); + this.textBox4.TabIndex = 9; + // + // textBox5 + // + this.textBox5.Location = new System.Drawing.Point(457, 172); + this.textBox5.Name = "textBox5"; + this.textBox5.Size = new System.Drawing.Size(120, 21); + this.textBox5.TabIndex = 10; + // + // button1 + // + this.button1.Location = new System.Drawing.Point(407, 213); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(75, 23); + this.button1.TabIndex = 11; + this.button1.Text = "登录"; + this.button1.UseVisualStyleBackColor = true; + // + // button2 + // + this.button2.Location = new System.Drawing.Point(502, 213); + this.button2.Name = "button2"; + this.button2.Size = new System.Drawing.Size(75, 23); + this.button2.TabIndex = 12; + this.button2.Text = "取消"; + this.button2.UseVisualStyleBackColor = true; + // + // Login + // + this.AcceptButton = this.button1; + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(590, 248); + this.Controls.Add(this.button2); + this.Controls.Add(this.button1); + this.Controls.Add(this.textBox5); + this.Controls.Add(this.textBox4); + this.Controls.Add(this.textBox3); + this.Controls.Add(this.textBox2); + this.Controls.Add(this.textBox1); + this.Controls.Add(this.label5); + this.Controls.Add(this.label4); + this.Controls.Add(this.label3); + this.Controls.Add(this.label2); + this.Controls.Add(this.label1); + this.Controls.Add(this.pictureBox1); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "Login"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "登录"; + this.TopMost = true; + this.Load += new System.EventHandler(this.Login_Load); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + public System.Windows.Forms.PictureBox pictureBox1; + public System.Windows.Forms.Label label1; + public System.Windows.Forms.Label label2; + public System.Windows.Forms.Label label3; + public System.Windows.Forms.Label label4; + public System.Windows.Forms.Label label5; + public System.Windows.Forms.TextBox textBox1; + public System.Windows.Forms.TextBox textBox2; + public System.Windows.Forms.TextBox textBox3; + public System.Windows.Forms.TextBox textBox4; + public System.Windows.Forms.TextBox textBox5; + public System.Windows.Forms.Button button1; + public System.Windows.Forms.Button button2; + } +} \ No newline at end of file diff --git a/模块化/MyTeamcenter_3/form/Login.cs b/模块化/MyTeamcenter_3/form/Login.cs new file mode 100644 index 0000000..a560ab5 --- /dev/null +++ b/模块化/MyTeamcenter_3/form/Login.cs @@ -0,0 +1,72 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Text; +using System.Windows.Forms; + +using Autodesk.AutoCAD.DatabaseServices; +using Autodesk.AutoCAD.Runtime; +using Autodesk.AutoCAD.Geometry; +using Autodesk.AutoCAD.ApplicationServices; +using Autodesk.AutoCAD.EditorInput; +using System.IO; +using Teamcenter.Hello; +using Teamcenter.ClientX; + + +namespace HelloTeamcenter.form +{ + public partial class Login : Form + { + public Login() + { + InitializeComponent(); + } + + public string m_WebAddress = "http://localhost:7001/tc"; + public string username = ""; + public string password = ""; + public string usergroup = ""; + public string userrole = ""; + public Document appodc; + + private void Login_Load(object sender, EventArgs e) + { + string tempdir = System.Environment.GetEnvironmentVariable("TEMP").ToString(); + Editor ed = appodc.Editor; + ed.WriteMessage("login文件路径:" + tempdir + "\n"); + string loginfile = tempdir + "\\login.ini"; + if (File.Exists(loginfile)) + { + StreamReader sr = new StreamReader(loginfile); + string line; + if ((line = sr.ReadLine()) != null) + { + + string[] ans = line.Split('|'); + for (int i = 0; i < ans.Length; i++) + { + if (i == 0) + m_WebAddress = ans[i].ToString(); + if (i == 1) + username = ans[i].ToString(); + if (i == 3) + usergroup = ans[i].ToString(); + if (i == 4) + userrole = ans[i].ToString(); + } + } + sr.Close(); + } + else + ed.WriteMessage("Nothing!"); + textBox1.Text = m_WebAddress; + textBox2.Text = username; + textBox3.Text = password; + textBox4.Text = usergroup; + textBox4.Text = userrole; + } + } +} diff --git a/模块化/MyTeamcenter_3/form/Login.resx b/模块化/MyTeamcenter_3/form/Login.resx new file mode 100644 index 0000000..9857e86 --- /dev/null +++ b/模块化/MyTeamcenter_3/form/Login.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + True + + \ No newline at end of file diff --git a/模块化/MyTeamcenter_3/form/OpenFromTC.Designer.cs b/模块化/MyTeamcenter_3/form/OpenFromTC.Designer.cs new file mode 100644 index 0000000..c5951b2 --- /dev/null +++ b/模块化/MyTeamcenter_3/form/OpenFromTC.Designer.cs @@ -0,0 +1,135 @@ +namespace HelloTeamcenter.form +{ + partial class OpenFromTC + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(OpenFromTC)); + this.label1 = new System.Windows.Forms.Label(); + this.textBox1 = new System.Windows.Forms.TextBox(); + this.button1 = new System.Windows.Forms.Button(); + this.button2 = new System.Windows.Forms.Button(); + this.imageList1 = new System.Windows.Forms.ImageList(this.components); + this.treeView1 = new System.Windows.Forms.TreeView(); + this.SuspendLayout(); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(12, 331); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(77, 12); + this.label1.TabIndex = 1; + this.label1.Text = "数据集名称:"; + // + // textBox1 + // + this.textBox1.Location = new System.Drawing.Point(95, 327); + this.textBox1.Name = "textBox1"; + this.textBox1.ReadOnly = true; + this.textBox1.Size = new System.Drawing.Size(197, 21); + this.textBox1.TabIndex = 2; + this.textBox1.TabStop = false; + // + // button1 + // + this.button1.Location = new System.Drawing.Point(399, 326); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(75, 23); + this.button1.TabIndex = 3; + this.button1.Tag = ""; + this.button1.Text = "确定"; + this.button1.UseVisualStyleBackColor = true; + // + // button2 + // + this.button2.Location = new System.Drawing.Point(308, 326); + this.button2.Name = "button2"; + this.button2.Size = new System.Drawing.Size(75, 23); + this.button2.TabIndex = 4; + this.button2.Text = "查找->"; + this.button2.UseVisualStyleBackColor = true; + // + // imageList1 + // + this.imageList1.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream"))); + this.imageList1.TransparentColor = System.Drawing.Color.Transparent; + this.imageList1.Images.SetKeyName(0, "autocad_01.ico"); + this.imageList1.Images.SetKeyName(1, "FOLDER.ICO"); + this.imageList1.Images.SetKeyName(2, "FOLDEROP.ICO"); + this.imageList1.Images.SetKeyName(3, "item.ico"); + this.imageList1.Images.SetKeyName(4, "itemrev.ico"); + this.imageList1.Images.SetKeyName(5, "login.bmp"); + this.imageList1.Images.SetKeyName(6, "mail.ico"); + this.imageList1.Images.SetKeyName(7, "Newstuff_Folder.png"); + this.imageList1.Images.SetKeyName(8, "tai.ico"); + // + // treeView1 + // + this.treeView1.ImageIndex = 7; + this.treeView1.ImageList = this.imageList1; + this.treeView1.Location = new System.Drawing.Point(14, 12); + this.treeView1.Name = "treeView1"; + this.treeView1.SelectedImageIndex = 7; + this.treeView1.Size = new System.Drawing.Size(470, 304); + this.treeView1.TabIndex = 5; + this.treeView1.NodeMouseDoubleClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(this.treeView1_NodeMouseDoubleClick); + // + // OpenFromTC + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(496, 379); + this.Controls.Add(this.treeView1); + this.Controls.Add(this.button2); + this.Controls.Add(this.button1); + this.Controls.Add(this.textBox1); + this.Controls.Add(this.label1); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "OpenFromTC"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "打开"; + this.TopMost = true; + this.Load += new System.EventHandler(this.OpenFromTC_Load); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + public System.Windows.Forms.Label label1; + public System.Windows.Forms.TextBox textBox1; + public System.Windows.Forms.Button button1; + public System.Windows.Forms.Button button2; + public System.Windows.Forms.ImageList imageList1; + public System.Windows.Forms.TreeView treeView1; + } +} \ No newline at end of file diff --git a/模块化/MyTeamcenter_3/form/OpenFromTC.cs b/模块化/MyTeamcenter_3/form/OpenFromTC.cs new file mode 100644 index 0000000..6b252b5 --- /dev/null +++ b/模块化/MyTeamcenter_3/form/OpenFromTC.cs @@ -0,0 +1,501 @@ +using System; +using System.Collections.Generic; +using System.Collections; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Text; +using System.Windows.Forms; + +using Autodesk.AutoCAD.DatabaseServices; +using Autodesk.AutoCAD.Runtime; +using Autodesk.AutoCAD.Geometry; +using Autodesk.AutoCAD.ApplicationServices; +using Autodesk.AutoCAD.EditorInput; + +using Teamcenter.Hello; +using Teamcenter.Soa.Client; +using Teamcenter.ClientX; +using Teamcenter.Services.Strong.Core; +using Teamcenter.Soa.Client.Model; +using Teamcenter.Soa.Exceptions; +using Teamcenter.Services.Strong.Query; + +using Teamcenter.Services.Strong.Core._2007_06.DataManagement; + +using User = Teamcenter.Soa.Client.Model.Strong.User; +using Folder = Teamcenter.Soa.Client.Model.Strong.Folder; +using Newstuff = Teamcenter.Soa.Client.Model.Strong.Newstuff_Folder; +using DataSet = Teamcenter.Soa.Client.Model.Strong.Dataset; +using WorkspaceObject = Teamcenter.Soa.Client.Model.Strong.WorkspaceObject; +using Item = Teamcenter.Soa.Client.Model.Strong.Item; +using ItemRevision = Teamcenter.Soa.Client.Model.Strong.ItemRevision; +using ImanQuery = Teamcenter.Soa.Client.Model.Strong.ImanQuery; + +public struct ALLOBJECT +{ + public TreeNode treenode; + public WorkspaceObject workobject; + public string name; + public string uid; +} + +namespace HelloTeamcenter.form +{ + public partial class OpenFromTC : Form + { + public List alllist = new List(); + public List folderlist = new List(); + public List itemlist = new List(); + public List itemvisionlist = new List(); + public List datasetlist = new List(); + protected ArrayList datasetTypes; + public string[] enableTypes; + public OpenFromTC() + { + InitializeComponent(); + } + public Document appodc; + public User user; + public bool first = true; + public Folder home = null; + public Folder newstuff = null; + Editor ed; + + private void getTypes() + { + string path = "c:\\dataset_types.xml"; + string root = "dataset"; + string nodeName = "types"; + ReaderCusXML xml = new ReaderCusXML(path, appodc); + xml.GetALL(root, nodeName); + xml.close(); + datasetTypes = xml.list; + //showList(); + } + + private void showList() + { + ed.WriteMessage("-----------------------\n"); + foreach (object o in datasetTypes) + { + ed.WriteMessage((string)o + "\n"); + } + ed.WriteMessage("-----------------------\n"); + } + + private void OpenFromTC_Load(object sender, EventArgs e) + { + ed = appodc.Editor; + + getTypes(); + int length = datasetTypes.Count; + //ed.WriteMessage(); + enableTypes = new string[length + 1]; + int t = 0; + foreach (object o in datasetTypes) + { + enableTypes[t] = (string)o; + t++; + } + enableTypes[length] = "Folder"; + + ed.WriteMessage("enableTypes.Length =" + enableTypes.Length+"\n"); + treeView1.Nodes.Clear(); + TreeNode rootnode = new TreeNode("Home", 8, 8); + treeView1.Nodes.Add(rootnode); + + WorkspaceObject[] contents = null; + DataManagementService dmService = DataManagementService.getService(Session.getConnection()); + try + { + home = user.Home_folder; + newstuff = user.Newstuff_folder; + } + catch (NotLoadedException ex) + { + ed.WriteMessage(ex.Message); + return; + } + try + { + ModelObject[] objects = { home }; + String[] attributes = { "contents" }; + dmService.RefreshObjects(objects); + dmService.GetProperties(objects, attributes); + contents = home.Contents; + } + catch (NotLoadedException ex) { ed.WriteMessage(ex.Message); } + //ALLOBJECT topobject = new ALLOBJECT(); + //topobject.treenode = rootnode; + //topobject.workobject = home; + //alllist.Add(topobject); + //folderlist.Add(topobject); + for (int i = 0; i < contents.Length; i++) + { + WorkspaceObject childobj = contents[i]; + ModelObject[] objects = { childobj }; + String[] attributes = { "object_string" ,"object_type" }; + dmService.RefreshObjects(objects); + dmService.GetProperties(objects, attributes); + string name = childobj.Object_string; + string type = childobj.Object_type; + ed.WriteMessage("选择的对象类型是:" + type+"\n"); + if (childobj is Folder){ + ALLOBJECT perobject = new ALLOBJECT(); + perobject.workobject = childobj; + Folder fl = childobj as Folder; + if (type == "Newstuff Folder") + { + TreeNode childnode = new TreeNode(name, 7, 7); + perobject.treenode = childnode; + perobject.name = name; + perobject.uid = childobj.Uid; + rootnode.Nodes.Add(childnode); + } + else if (type == "Mail Folder") + { + TreeNode childnode = new TreeNode(name, 6, 6); + perobject.treenode = childnode; + perobject.name = name; + perobject.uid = childobj.Uid; + rootnode.Nodes.Add(childnode); + } + else + { + TreeNode childnode = new TreeNode(name, 1, 1); + perobject.treenode = childnode; + perobject.name = name; + perobject.uid = childobj.Uid; + rootnode.Nodes.Add(childnode); + } + alllist.Add(perobject); + folderlist.Add(perobject); + } + else if (childobj is Item) + { + ALLOBJECT perobject = new ALLOBJECT(); + perobject.workobject = childobj; + Item item = childobj as Item; + TreeNode childnode = new TreeNode(name, 3, 3); + perobject.treenode = childnode; + perobject.name = name; + perobject.uid = childobj.Uid; + rootnode.Nodes.Add(childnode); + alllist.Add(perobject); + itemlist.Add(perobject); + } + } + foreach(TreeNode ch in rootnode.Nodes) + { + ch.EnsureVisible(); + } + } + + private void treeView1_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e) + { + //MessageBox.Show("获得"); + ed.WriteMessage("tree view 双击事件...\n"); + TreeNode nownode = this.treeView1.SelectedNode; + + getChild(nownode); + foreach (TreeNode ch in nownode.Nodes) + { + ch.EnsureVisible(); + } + } + + private void getChild(TreeNode nownode) + { + nownode.Nodes.Clear(); + DataManagementService dmService = DataManagementService.getService(Session.getConnection()); + WorkspaceObject[] contents = null; + //dmService.GetProperties(objects, attributes); + string nodetext = nownode.Text; + int imageindex = nownode.SelectedImageIndex; + List templist = new List(); + if (imageindex == 1) //处理文件夹对象 + { + ed.WriteMessage("文件夹类型:\n"); + foreach (ALLOBJECT perobject in folderlist) + { + if (perobject.treenode.Equals(nownode)) + { + Folder fl = perobject.workobject as Folder; + ModelObject[] objects = { fl }; + String[] attributes = { "contents" }; + dmService.RefreshObjects(objects); + dmService.GetProperties(objects, attributes); + contents = fl.Contents; + for (int i = 0; i < contents.Length; i++) + { + WorkspaceObject childobj = contents[i]; + ModelObject[] objects1 = { childobj }; + String[] attributes1 = { "object_string", "object_type" }; + dmService.RefreshObjects(objects1); + dmService.GetProperties(objects1, attributes1); + string name = childobj.Object_string; + string type = childobj.Object_type; + if (childobj is Folder) + { + ALLOBJECT inperobject = new ALLOBJECT(); + inperobject.workobject = childobj; + Folder infl = childobj as Folder; + + if (type == "Newstuff Folder") + { + TreeNode childnode = new TreeNode(name, 7, 7); + inperobject.treenode = childnode; + nownode.Nodes.Add(childnode); + } + else if (type == "Mail Folder") + { + TreeNode childnode = new TreeNode(name, 6, 6); + inperobject.treenode = childnode; + nownode.Nodes.Add(childnode); + } + else + { + TreeNode childnode = new TreeNode(name, 1, 1); + inperobject.treenode = childnode; + nownode.Nodes.Add(childnode); + } + templist.Add(inperobject); + folderlist.Add(inperobject); + } + else if (childobj is Item) + { + ALLOBJECT inperobject = new ALLOBJECT(); + inperobject.workobject = childobj; + Item item = childobj as Item; + TreeNode childnode = new TreeNode(name, 3, 3); + inperobject.treenode = childnode; + nownode.Nodes.Add(childnode); + templist.Add(inperobject); + itemlist.Add(inperobject); + } + } + break; + } + } + if (templist.Count > 0 && templist != null) + { + alllist.AddRange(templist); + templist.Clear(); + } + return; + + } + else if (imageindex == 3) //处理Item对象 + { + ed.WriteMessage("Item类型:\n"); + foreach (ALLOBJECT perobject in itemlist) + { + if (perobject.treenode.Equals(nownode)) + { + Item item = perobject.workobject as Item; + ModelObject[] itemrevisionlist = null; + ModelObject[] objects = { item }; + String[] attributes = { "revision_list" }; + dmService.RefreshObjects(objects); + dmService.GetProperties(objects, attributes); + itemrevisionlist = item.Revision_list; + for (int i = 0; i < itemrevisionlist.Length; i++) + { + ItemRevision itemrevision = itemrevisionlist[i] as ItemRevision; + ModelObject[] objects1 = { itemrevision }; + String[] attributes1 = { "object_string", "object_type" }; + dmService.RefreshObjects(objects1); + dmService.GetProperties(objects1, attributes1); + string name = itemrevision.Object_string; + string type = itemrevision.Object_type; + + ALLOBJECT inperobject = new ALLOBJECT(); + inperobject.workobject = itemrevision; + TreeNode childnode = new TreeNode(name, 4, 4); + inperobject.treenode = childnode; + nownode.Nodes.Add(childnode); + templist.Add(inperobject); + itemvisionlist.Add(inperobject); + } + break; + } + } + if (templist.Count > 0 && templist != null) + { + alllist.AddRange(templist); + templist.Clear(); + } + return; + } + else if (imageindex == 4) //处理Item版本对象 + { + ed.WriteMessage("ItemRevision类型:\n"); + foreach (ALLOBJECT perobject in itemvisionlist) + { + if (perobject.treenode.Equals(nownode)) + { + ItemRevision itemrevision = perobject.workobject as ItemRevision; + ExpandGRMRelationsPref myPref = new ExpandGRMRelationsPref(); + RelationAndTypesFilter2 myFilter = new RelationAndTypesFilter2(); + myFilter.RelationName = "IMAN_specification"; + //String[] typeVec = { "D5DWG", "Folder" }; + myFilter.ObjectTypeNames = enableTypes; + myPref.ExpItemRev = false; + RelationAndTypesFilter2[] myfilter = { myFilter }; + myPref.Info = myfilter; + ModelObject[] objects1 = { itemrevision }; + + ExpandGRMRelationsResponse myResp = dmService.ExpandGRMRelationsForPrimary(objects1,myPref); + ExpandGRMRelationsOutput[] myoutput = myResp.Output; + for (int i = 0; i < myoutput.Length; i++) + { + ExpandGRMRelationsOutput one_out = myoutput[i]; + for (int j = 0; j < one_out.OtherSideObjData.Length; j++) + { + ExpandGRMRelationsData otherSideData = one_out.OtherSideObjData[j]; + for (int k = 0; k < otherSideData.OtherSideObjects.Length; k++) + { + Type typeinfo = otherSideData.OtherSideObjects[k].GetType(); + string typename = typeinfo.Name; + ModelObject temp = otherSideData.OtherSideObjects[k]; + //if (typename == "Folder") + if (temp is Folder) + { + Folder infold = temp as Folder; + + ModelObject[] objects = { infold }; + String[] attributes = { "object_string", "object_type" }; + dmService.RefreshObjects(objects); + dmService.GetProperties(objects, attributes); + string name = infold.Object_string; + string type = infold.Object_type; + + ALLOBJECT inperobject = new ALLOBJECT(); + inperobject.workobject = infold; + TreeNode childnode = new TreeNode(name, 1, 1); + inperobject.treenode = childnode; + nownode.Nodes.Add(childnode); + templist.Add(inperobject); + folderlist.Add(inperobject); + } + else if (temp is DataSet) + { + DataSet dateset = temp as DataSet; + ModelObject[] objects = { dateset }; + String[] attributes = { "object_string" ,"object_type"}; + dmService.RefreshObjects(objects); + dmService.GetProperties(objects, attributes); + string name = dateset.Object_string; + string type = dateset.Object_type; + ed.WriteMessage("类型是:"+type); + ALLOBJECT inperobject = new ALLOBJECT(); + inperobject.workobject = dateset; + inperobject.name = name; + TreeNode childnode = new TreeNode(name, 0, 0); + inperobject.treenode = childnode; + nownode.Nodes.Add(childnode); + templist.Add(inperobject); + datasetlist.Add(inperobject); + } + } + } + } + break; + } + } + if (templist.Count > 0 && templist != null) + { + alllist.AddRange(templist); + templist.Clear(); + } + return; + } + else if (imageindex == 6) + { + ed.WriteMessage("Mail类型:\n"); + } + else if (imageindex == 8) + { + ed.WriteMessage("Home类型:\n"); + } + else if(imageindex == 7) //new stuffer foler 处理 + { + alllist.Clear(); + folderlist.Clear(); + itemlist.Clear(); + itemvisionlist.Clear(); + datasetlist.Clear(); + ed.WriteMessage("Newstuff类型:\n"); + try + { + ModelObject[] objects = { newstuff }; + String[] attributes = { "contents" }; + dmService.RefreshObjects(objects); + dmService.GetProperties(objects, attributes); + contents = newstuff.Contents; + } + catch (NotLoadedException ex) { ed.WriteMessage(ex.Message); } + for (int i = 0; i < contents.Length; i++) + { + WorkspaceObject childobj = contents[i]; + ModelObject[] objects = { childobj }; + String[] attributes = { "object_string", "object_type" }; + dmService.RefreshObjects(objects); + dmService.GetProperties(objects, attributes); + string name = childobj.Object_string; + string type = childobj.Object_type; + if (childobj is Folder) + { + ALLOBJECT perobject = new ALLOBJECT(); + perobject.workobject = childobj; + Folder fl = childobj as Folder; + if (type == "Newstuff Folder") + { + TreeNode childnode = new TreeNode(name, 7, 7); + perobject.treenode = childnode; + perobject.name = name; + perobject.uid = childobj.Uid; + nownode.Nodes.Add(childnode); + } + else if (type == "Mail Folder") + { + TreeNode childnode = new TreeNode(name, 6, 6); + perobject.treenode = childnode; + perobject.name = name; + perobject.uid = childobj.Uid; + nownode.Nodes.Add(childnode); + } + else + { + TreeNode childnode = new TreeNode(name, 1, 1); + perobject.treenode = childnode; + perobject.name = name; + perobject.uid = childobj.Uid; + nownode.Nodes.Add(childnode); + } + alllist.Add(perobject); + folderlist.Add(perobject); + } + else if (childobj is Item) + { + ALLOBJECT perobject = new ALLOBJECT(); + perobject.workobject = childobj; + Item item = childobj as Item; + TreeNode childnode = new TreeNode(name, 3, 3); + perobject.treenode = childnode; + perobject.name = name; + perobject.uid = childobj.Uid; + nownode.Nodes.Add(childnode); + alllist.Add(perobject); + itemlist.Add(perobject); + } + } + foreach (TreeNode ch in nownode.Nodes) + { + ch.EnsureVisible(); + } + } + } + } +} diff --git a/模块化/MyTeamcenter_3/form/OpenFromTC.resx b/模块化/MyTeamcenter_3/form/OpenFromTC.resx new file mode 100644 index 0000000..4c4b5fb --- /dev/null +++ b/模块化/MyTeamcenter_3/form/OpenFromTC.resx @@ -0,0 +1,209 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + + + AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj0yLjAuMC4w + LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 + ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAABK + EgAAAk1TRnQBSQFMAgEBCQEAAQwBAAEMAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo + AwABQAMAATADAAEBAQABCAYAAQwYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA + AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5 + AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA + AWYDAAGZAwABzAIAATMDAAIzAgABMwFmAgABMwGZAgABMwHMAgABMwH/AgABZgMAAWYBMwIAAmYCAAFm + AZkCAAFmAcwCAAFmAf8CAAGZAwABmQEzAgABmQFmAgACmQIAAZkBzAIAAZkB/wIAAcwDAAHMATMCAAHM + AWYCAAHMAZkCAALMAgABzAH/AgAB/wFmAgAB/wGZAgAB/wHMAQABMwH/AgAB/wEAATMBAAEzAQABZgEA + ATMBAAGZAQABMwEAAcwBAAEzAQAB/wEAAf8BMwIAAzMBAAIzAWYBAAIzAZkBAAIzAcwBAAIzAf8BAAEz + AWYCAAEzAWYBMwEAATMCZgEAATMBZgGZAQABMwFmAcwBAAEzAWYB/wEAATMBmQIAATMBmQEzAQABMwGZ + AWYBAAEzApkBAAEzAZkBzAEAATMBmQH/AQABMwHMAgABMwHMATMBAAEzAcwBZgEAATMBzAGZAQABMwLM + AQABMwHMAf8BAAEzAf8BMwEAATMB/wFmAQABMwH/AZkBAAEzAf8BzAEAATMC/wEAAWYDAAFmAQABMwEA + AWYBAAFmAQABZgEAAZkBAAFmAQABzAEAAWYBAAH/AQABZgEzAgABZgIzAQABZgEzAWYBAAFmATMBmQEA + AWYBMwHMAQABZgEzAf8BAAJmAgACZgEzAQADZgEAAmYBmQEAAmYBzAEAAWYBmQIAAWYBmQEzAQABZgGZ + AWYBAAFmApkBAAFmAZkBzAEAAWYBmQH/AQABZgHMAgABZgHMATMBAAFmAcwBmQEAAWYCzAEAAWYBzAH/ + AQABZgH/AgABZgH/ATMBAAFmAf8BmQEAAWYB/wHMAQABzAEAAf8BAAH/AQABzAEAApkCAAGZATMBmQEA + AZkBAAGZAQABmQEAAcwBAAGZAwABmQIzAQABmQEAAWYBAAGZATMBzAEAAZkBAAH/AQABmQFmAgABmQFm + ATMBAAGZATMBZgEAAZkBZgGZAQABmQFmAcwBAAGZATMB/wEAApkBMwEAApkBZgEAA5kBAAKZAcwBAAKZ + Af8BAAGZAcwCAAGZAcwBMwEAAWYBzAFmAQABmQHMAZkBAAGZAswBAAGZAcwB/wEAAZkB/wIAAZkB/wEz + AQABmQHMAWYBAAGZAf8BmQEAAZkB/wHMAQABmQL/AQABzAMAAZkBAAEzAQABzAEAAWYBAAHMAQABmQEA + AcwBAAHMAQABmQEzAgABzAIzAQABzAEzAWYBAAHMATMBmQEAAcwBMwHMAQABzAEzAf8BAAHMAWYCAAHM + AWYBMwEAAZkCZgEAAcwBZgGZAQABzAFmAcwBAAGZAWYB/wEAAcwBmQIAAcwBmQEzAQABzAGZAWYBAAHM + ApkBAAHMAZkBzAEAAcwBmQH/AQACzAIAAswBMwEAAswBZgEAAswBmQEAA8wBAALMAf8BAAHMAf8CAAHM + Af8BMwEAAZkB/wFmAQABzAH/AZkBAAHMAf8BzAEAAcwC/wEAAcwBAAEzAQAB/wEAAWYBAAH/AQABmQEA + AcwBMwIAAf8CMwEAAf8BMwFmAQAB/wEzAZkBAAH/ATMBzAEAAf8BMwH/AQAB/wFmAgAB/wFmATMBAAHM + AmYBAAH/AWYBmQEAAf8BZgHMAQABzAFmAf8BAAH/AZkCAAH/AZkBMwEAAf8BmQFmAQAB/wKZAQAB/wGZ + AcwBAAH/AZkB/wEAAf8BzAIAAf8BzAEzAQAB/wHMAWYBAAH/AcwBmQEAAf8CzAEAAf8BzAH/AQAC/wEz + AQABzAH/AWYBAAL/AZkBAAL/AcwBAAJmAf8BAAFmAf8BZgEAAWYC/wEAAf8CZgEAAf8BZgH/AQAC/wFm + AQABIQEAAaUBAANfAQADdwEAA4YBAAOWAQADywEAA7IBAAPXAQAD3QEAA+MBAAPqAQAD8QEAA/gBAAHw + AfsB/wEAAaQCoAEAA4ADAAH/AgAB/wMAAv8BAAH/AwAB/wEAAf8BAAL/AgAD/0MAAQQ/AALsAgcBAAED + AfsBAAMHNQAC7AL/AQABAwH7AQAC/wEHNQAC7AL/AQABAwH7AQAC/wEHNQAC7AL/AQABAwH7AQAC/wEH + NQABBAHsAv8EAAL/AQc2AAHsCP8B7DYAAQMBAAb/AewCAzYAAQMBAAT/AewCAwHsNwABAwEAAv8B7AID + OgABAwIAAgM8AAMDAewBAT8AAQE8AAEEAgABAYQAAf8B8wK8AQcBtwFGAg4BEwFuAb0BSwEAAUQBABD/ + FwABmgIaAfAFAAH/AUYBbgEOAewCRgFFAZMBRQHrAQ8BUgMAEP8DAALwDgABGgHwARoBmgHlAVkBUgF5 + AfAEAAH/ARUB7wERAQ4BmgFFAkQBIwFFARABdAEPAUUBIhD/AgABtAGtAc8BtQHvAgcBvAcAAhoBwwEa + AsMBoAF5AVkBMgGZAZgBvAHwAQAB/wFtARwBDgEPAbwBRQHvAhoBTAGTAUwBmgEOARAB/w4AAf8CAAHP + B4sBrgH3Ae8BBwMAAZoCwwEaAvYBwwF5AjgBWAFWAVABmAHwAf8B7QH3ARIBSQG8AW4BRQJGAZkBkwFL + AXQBIgFLAf8N7AEAAf8CAAHPAYsJigGSAwABegOgARoC9gGaAlkBWAF4AlAB8AH/Ae0B9wEVAUkBBwHt + A0QCkwFLAVIBJAFMAf8B7AsHAewBAAH/AgABzwKyAawHigGuAwABegLlAXoCUgGZARoBmgFZAZkBmAFW + AVAB8AH/AUMB9wHrAUMB7AEPAQ4BtAFDAW4BAAEPARUCDgH/AewBAwMHAwMDBwEDAewBAAH/AgABzwGs + BbIEigGRAbwBAAHwAZoBegHlAXoBMQJSARwBmQGaARoBmAFXAVYB8AH/Ae0B7AFDAeoBQwETAQ4BuwES + AQ8BSwERAQ4BAAFsAf8B7AH7AQMBBwEDAwABAwEHAQMBBwHsAQAB/wIAAbUBrQWzA7IBswGuAQcBAAHw + AcMB9gHDAXoBWQE4AVgCeAEcAZgBmQGYAXgB8AH/AewB6wFJAREBDQHqAQABtAEQAZIBbQEVAQ4BAAHx + Af8B7AL/AQMBAAL/AfsBAAEDAgcB7AEAAf8CAAG1AbQBuwK6BrMBkQEHAQAB8AGaAsMBegI4AVgBVwFQ + AUoBcgFzARwBmQHwAf8BbAKuARUBbAEOAUsBtAHtARAB9wHsAUMCDQH/AewB+wEHAQAB/wH7A/8BAAED + AQcB7AEAAf8CAAEHAbQBrQK0AQkBuwS6AbQB7wEAAfABmgF6AZoBegJZAnkBVgFQAXIBBwMAAf8BZgEP + AQ4BQwEVAUQB6wGRAe0B8AFmAQ4B6wEVAQ0B/wHsAQcBAAH7A/8B+wL/AQABAwHsAQAB/wIAAbUBmQGQ + AZgBswG0AQkCGQIJAbUBBwEAAfABGgF6AXkBmQGgAVgBWQGZAlYBHAQAAf8BDgERAQ4BEQF0AbQB6wG0 + AfcBuwG8AQkBuwFDAQ0B/wHsAQAD/wH7A/8B+wH/AQAB7AEAAf8BAAG7AbQBeQGZAXkBtAIJBLQBtQQA + AfACvAGZAXkBmQF4AlYBeAQAAf8BvAEOAQcBvAF0AbQBZgG0Ae0BBwHyAQkCtQEHAf8B7AL/AfsD/wH7 + A/8B+wIAAf8CAAHvAX4BXgFYARwDtAHWAgkBBwUAAbwB8AEIAZgBeAKYAZkBBwQAAf8BvAHwAQcBvAS0 + AQ4BHAH/AfMBvAEHAbUB/w3sAQAB/wIAApkCeQG1Ae8DAAK1AQcFAAHwAbwC8AG8AQcCvAUAAf8B8QHv + AZEBiwNlAf8B8wEKAWYB7wJmAfQQ/wIAAQcBGgGRArwNAAS8AfAHAAH/AfABtQGRAWwLZRD/BAAB7wwA + DvAqAAEaAfABvAHwBAAB7wmBAf8DgQHwJgABmQEaAXoBUwFZAVIBdAEHAwABsgG5A9oDuQHaAbkB9ALa + AbkBvCMAApMBTAF6A6AB5QExATIBUgGZAgABsgLaArMC2QGzAYsBswH0AbMB1AG5AbwO7AQADOwCAAHw + ApkBGwH/AZoB9gLDAqABMQE4ATIBdAIAAbIDswbZAfQB2QKzAbwB7AH/AfsBBwH7AQcB+wEHAfsBBwH7 + AQcB+wHsBAAB7AH/AfsBBwH7AQcB+wEHAfsBBwH7AewCAAG8ARoBwwL/AZkB/wL2AsMBNwI4AXkCAAGy + AbMBsgLZAbgB2wG5AdsBsgH0AdkBsgG5AbwB7AH/AQcB+wEHAfsBBwH7AQcB+wEHAfsBBwHsAwAB7AH/ + AfsBBwH7AQcB+wEHAfsBBwH7AQcBAAHsAQABvAGaAaACwwGaAfYD/wH2ATcCOAF5AgABsgHZAbIBuAGy + AbgBigGyAYEBsgH0AdkBsgG5AbwB7AH/AfsBBwH7AQcB+wEHAfsBBwH7AQcB+wHsAwAB7AH/AQcB+wEH + AfsBBwH7AQcB+wEHAewBAAHsAQABvAF5A6ABUgGZAsMBGgGaAXoCOAF5AgABsgHZAbgCuQG4AdkBsgGK + AdkB9AHZAbIBuQG8AewB/wEHAfsBBwH7AQcB+wEHAfsBBwH7AQcB7AIAAewB/wEHAfsBBwH7AQcB+wEH + AfsBBwH7AQAC7AEAAfABegLlAXoBUwFSAXMBdAG8AfQB9gF6AVkBmQIAAbIC2gGzAtwBuQG4AdkBuwH/ + AbsBswHaAbwB7AH/AfsBBwH7AQcB+wEHAfsBBwH7AQcB+wHsAgAB7Ar/AewBAAEHAewBAAEaAZkDegFZ + ATEBKwFLAVICmQGaAnoCAAGBA7MBkAGKAYECswG7AYoBugKzAQcB7AH/AQcB+wEHAfsBBwH7AQcB+wEH + AfsBBwHsAgAN7AH7AewBAAF0AcMB9gLDAXoBWQE4ATIBTAGZARoFAAG6AdsCugHaAboCkQHaAbsEugEH + AewB/wH7AQcB+wEHAfsBBwH7AQcB+wEHAfsB7AMAAewB/wEHAfsBBwH7AQcB+wEHAfsBBwH7AQcB7AEA + AXQBwwH2Av8BmgM4AVIHAAG5AtsBswTZAbgB8gH/AfIB2wHaAbwB7Az/AewDAAHsAf8B+wEHAfsBBwH7 + AQcF/wHsAQABegLDAvYBGgH7AjgBUgcAAbME2wEJAtwCCQH0AtsB2gG8AewBBwH7AQcB+wEHAfsBBwbs + AwAB7AH/AQcB+wEHAfsBBwH/BuwBAAJ6AqACegFZAfsBOAF5BwABswHbAdwHCQH0AQkB3AHbAbwBAAHs + AQcB+wEHAfsBBwHsCgAB7AX/AewHAAJ6AVkC5QHDAXoCWQGZBwABuQkZAfQDGQHwAgAF7AwABewJAAHw + ARoBUgJZAnoBUwF5EQAB8CgAAvAKAAFCAU0BPgcAAT4DAAEoAwABQAMAATADAAEBAQABAQUAAYABARYA + A/8BAAL/BgABwAEDBgABwAEDBgABwAEDBgABwAEDBgABwAEDBgABwAEDBgABgAEBBgABwAEBBgAB4AED + BgAB8AEHBgAB+AEHBgAB/AEHBgAB/gEnBgAB/wFnBgAC/wYAAv8EAAL/Af4BHwQAAecB/wHgAQ8EAAHA + AT8BgAEBBAABwAEDAYAFAAHAAQMBgAUAAcABAwGABQABwAEBBgABwAEBBgABwAEBBgABwAEBAQABBwQA + AcABAQEAAQ8EAAGAAQMBwAEPBAABwAEDAeABDwQAAcAB4wHgAR8EAAHBAf8B8AF/BAAB9wH/AYABAQX/ + AYcBgAEABP8B/AEDAYABAAGAAQEB4AEAAeABAQGAAgABAQHAAgABAQGAAgABAQHAAgABAQGAAgABAQGA + AgABAQGAAgABAQGAAgABAQGAAgABAQMAAQEBgAIAAQEDAAEBAYACAAEBAwABDwGAAgABAQGAAgABPwGA + AgABAQGAAgABPwGAAgABAwGAAQEBAAE/AYABAAGAAf8BwAF/AQABPwGAAQABwQH/AeAB/wGAAT8B/wHv + BP8B8wH/Cw== + + + \ No newline at end of file diff --git a/模块化/MyTeamcenter_3/form/SaveToTC.Designer.cs b/模块化/MyTeamcenter_3/form/SaveToTC.Designer.cs new file mode 100644 index 0000000..1029f4d --- /dev/null +++ b/模块化/MyTeamcenter_3/form/SaveToTC.Designer.cs @@ -0,0 +1,119 @@ +namespace HelloTeamcenter.form +{ + partial class SaveToTC + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SaveToTC)); + this.treeView1 = new System.Windows.Forms.TreeView(); + this.imageList1 = new System.Windows.Forms.ImageList(this.components); + this.button1 = new System.Windows.Forms.Button(); + this.label1 = new System.Windows.Forms.Label(); + this.comboBox1 = new System.Windows.Forms.ComboBox(); + this.SuspendLayout(); + // + // treeView1 + // + this.treeView1.ImageIndex = 7; + this.treeView1.ImageList = this.imageList1; + this.treeView1.Location = new System.Drawing.Point(6, 9); + this.treeView1.Name = "treeView1"; + this.treeView1.SelectedImageIndex = 7; + this.treeView1.Size = new System.Drawing.Size(369, 260); + this.treeView1.TabIndex = 6; + this.treeView1.NodeMouseDoubleClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(this.treeView1_NodeMouseDoubleClick); + // + // imageList1 + // + this.imageList1.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream"))); + this.imageList1.TransparentColor = System.Drawing.Color.Transparent; + this.imageList1.Images.SetKeyName(0, "autocad_01.ico"); + this.imageList1.Images.SetKeyName(1, "FOLDER.ICO"); + this.imageList1.Images.SetKeyName(2, "FOLDEROP.ICO"); + this.imageList1.Images.SetKeyName(3, "item.ico"); + this.imageList1.Images.SetKeyName(4, "itemrev.ico"); + this.imageList1.Images.SetKeyName(5, "mail.ico"); + this.imageList1.Images.SetKeyName(6, "Newstuff_Folder.png"); + this.imageList1.Images.SetKeyName(7, "tai.ico"); + // + // button1 + // + this.button1.Location = new System.Drawing.Point(299, 279); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(75, 23); + this.button1.TabIndex = 7; + this.button1.Text = "保存"; + this.button1.UseVisualStyleBackColor = true; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(50, 284); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(65, 12); + this.label1.TabIndex = 8; + this.label1.Text = "Item类型:"; + // + // comboBox1 + // + this.comboBox1.FormattingEnabled = true; + this.comboBox1.Items.AddRange(new object[] { + "Item"}); + this.comboBox1.Location = new System.Drawing.Point(117, 279); + this.comboBox1.Name = "comboBox1"; + this.comboBox1.Size = new System.Drawing.Size(162, 20); + this.comboBox1.TabIndex = 9; + // + // SaveToTC + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(381, 313); + this.Controls.Add(this.comboBox1); + this.Controls.Add(this.label1); + this.Controls.Add(this.button1); + this.Controls.Add(this.treeView1); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; + this.Name = "SaveToTC"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "保存"; + this.Load += new System.EventHandler(this.SaveToTC_Load); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + public System.Windows.Forms.TreeView treeView1; + public System.Windows.Forms.ImageList imageList1; + public System.Windows.Forms.Button button1; + private System.Windows.Forms.Label label1; + public System.Windows.Forms.ComboBox comboBox1; + } +} \ No newline at end of file diff --git a/模块化/MyTeamcenter_3/form/SaveToTC.cs b/模块化/MyTeamcenter_3/form/SaveToTC.cs new file mode 100644 index 0000000..53dd098 --- /dev/null +++ b/模块化/MyTeamcenter_3/form/SaveToTC.cs @@ -0,0 +1,460 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Text; +using System.Windows.Forms; + + +using Autodesk.AutoCAD.DatabaseServices; +using Autodesk.AutoCAD.Runtime; +using Autodesk.AutoCAD.Geometry; +using Autodesk.AutoCAD.ApplicationServices; +using Autodesk.AutoCAD.EditorInput; + +using Teamcenter.Hello; +using Teamcenter.Soa.Client; +using Teamcenter.ClientX; +using Teamcenter.Services.Strong.Core; +using Teamcenter.Soa.Client.Model; +using Teamcenter.Soa.Exceptions; +using Teamcenter.Services.Strong.Query; + +using Teamcenter.Services.Strong.Core._2007_06.DataManagement; + + +using User = Teamcenter.Soa.Client.Model.Strong.User; +using Folder = Teamcenter.Soa.Client.Model.Strong.Folder; +using WorkspaceObject = Teamcenter.Soa.Client.Model.Strong.WorkspaceObject; +using Item = Teamcenter.Soa.Client.Model.Strong.Item; +using ItemRevision = Teamcenter.Soa.Client.Model.Strong.ItemRevision; +using ImanQuery = Teamcenter.Soa.Client.Model.Strong.ImanQuery; +using DataSet = Teamcenter.Soa.Client.Model.Strong.Dataset; + +using HelloTeamcenter.hello; + + +namespace HelloTeamcenter.form +{ + public partial class SaveToTC : Form + { + public Document appdoc; + public User user; + public bool first = true; + public Folder home = null; + public Editor ed; + + public List folderlist = new List(); + public List itemlist = new List(); + public List itemvisionlist = new List(); + public List datasetlist = new List(); + + protected ArrayList datasetTypes; + public string[] enableTypes; + + public Hashtable properties; + + public Dictionary btlinfo; + public List> bomlist; + + public SaveToTC() + { + InitializeComponent(); + } + + private void getTypes() + { + string path = "c:\\dataset_types.xml"; + string root = "dataset"; + string nodeName = "types"; + ReaderCusXML xml = new ReaderCusXML(path, appdoc); + ed.WriteMessage("我是一只小小小鸟。\n"); + xml.GetALL(root, nodeName); + datasetTypes = xml.list; + xml.close(); + //showList(); + } + + private void SaveToTC_Load(object sender, EventArgs e) + { + ed = appdoc.Editor; + + //////////////////// 获取类型 //////////////// + + getTypes(); + int length = datasetTypes.Count; + //ed.WriteMessage(); + enableTypes = new string[length + 1]; + int t = 0; + foreach (object o in datasetTypes) + { + enableTypes[t] = (string)o; + t++; + } + enableTypes[length] = "Folder"; + + ed.WriteMessage("enableTypes.Length =" + enableTypes.Length + "\n"); + + //////////////////////////////////// + + treeView1.Nodes.Clear(); + TreeNode rootnode = new TreeNode("Home", 7, 7); + treeView1.Nodes.Add(rootnode); + + WorkspaceObject[] contents = null; + DataManagementService dmService = DataManagementService.getService(Session.getConnection()); + try + { + home = user.Home_folder; + } + catch (NotLoadedException ex) + { + MessageBox.Show(ex.Message); + return; + } + try + { + ModelObject[] objects = { home }; + String[] attributes = { "contents" }; + dmService.RefreshObjects(objects); + dmService.GetProperties(objects, attributes); + contents = home.Contents; + } + catch (NotLoadedException ex) { MessageBox.Show(ex.Message); } + for (int i = 0; i < contents.Length; i++) + { + WorkspaceObject childobj = contents[i]; + ModelObject[] objects = { childobj }; + String[] attributes = { "object_string" ,"object_type" }; + dmService.RefreshObjects(objects); + dmService.GetProperties(objects, attributes); + string name = childobj.Object_string; + string type = childobj.Object_type; + ed.WriteMessage("选择的对象类型是:" + type+"\n"); + if (childobj is Folder){ + ALLOBJECT perobject = new ALLOBJECT(); + perobject.workobject = childobj; + Folder fl = childobj as Folder; + if (type == "Newstuff Folder") + { + TreeNode childnode = new TreeNode(name, 7, 7); + perobject.treenode = childnode; + perobject.name = name; + perobject.uid = childobj.Uid; + rootnode.Nodes.Add(childnode); + } + else if (type == "Mail Folder") + { + TreeNode childnode = new TreeNode(name, 6, 6); + perobject.treenode = childnode; + perobject.name = name; + perobject.uid = childobj.Uid; + rootnode.Nodes.Add(childnode); + } + else + { + TreeNode childnode = new TreeNode(name, 1, 1); + perobject.treenode = childnode; + perobject.name = name; + perobject.uid = childobj.Uid; + rootnode.Nodes.Add(childnode); + } + folderlist.Add(perobject); + } + else if (childobj is Item) + { + ALLOBJECT perobject = new ALLOBJECT(); + perobject.workobject = childobj; + Item item = childobj as Item; + TreeNode childnode = new TreeNode(name, 3, 3); + perobject.treenode = childnode; + perobject.name = name; + perobject.uid = childobj.Uid; + rootnode.Nodes.Add(childnode); + itemlist.Add(perobject); + } + } + foreach(TreeNode ch in rootnode.Nodes) + { + ch.EnsureVisible(); + } + + //Tool tool = new Tool(); + //BTLClass btlinfo = tool.getBTL(); + //string itemtype = tool.initItemType(btlinfo.Item_id, btlinfo.Materialgrade); + //this.comboBox1.SelectedText = itemtype; + } + + private void treeView1_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e) + { + TreeNode nownode = this.treeView1.SelectedNode; + + getChild(nownode); + foreach (TreeNode ch in nownode.Nodes) + { + ch.EnsureVisible(); + } + } + + private void getChild(TreeNode nownode) + { + nownode.Nodes.Clear(); + DataManagementService dmService = DataManagementService.getService(Session.getConnection()); + WorkspaceObject[] contents = null; + string nodetext = nownode.Text; + int imageindex = nownode.SelectedImageIndex; + if (imageindex == 1) + { + foreach (ALLOBJECT perobject in folderlist) + { + if (perobject.treenode.Equals(nownode)) + { + Folder fl = perobject.workobject as Folder; + ModelObject[] objects = { fl }; + String[] attributes = { "contents" }; + dmService.RefreshObjects(objects); + dmService.GetProperties(objects, attributes); + contents = fl.Contents; + for (int i = 0; i < contents.Length; i++) + { + WorkspaceObject childobj = contents[i]; + ModelObject[] objects1 = { childobj }; + String[] attributes1 = { "object_string", "object_type" }; + dmService.RefreshObjects(objects1); + dmService.GetProperties(objects1, attributes1); + string name = childobj.Object_string; + string type = childobj.Object_type; + if (childobj is Folder) + { + ALLOBJECT inperobject = new ALLOBJECT(); + inperobject.workobject = childobj; + Folder infl = childobj as Folder; + + if (type == "Newstuff Folder") + { + TreeNode childnode = new TreeNode(name, 6, 6); + inperobject.treenode = childnode; + nownode.Nodes.Add(childnode); + } + else if (type == "Mail Folder") + { + TreeNode childnode = new TreeNode(name, 5, 5); + inperobject.treenode = childnode; + nownode.Nodes.Add(childnode); + } + else + { + TreeNode childnode = new TreeNode(name, 1, 1); + inperobject.treenode = childnode; + nownode.Nodes.Add(childnode); + } + folderlist.Add(inperobject); + } + else if (childobj is Item) + { + ALLOBJECT inperobject = new ALLOBJECT(); + inperobject.workobject = childobj; + Item item = childobj as Item; + TreeNode childnode = new TreeNode(name, 3, 3); + inperobject.treenode = childnode; + nownode.Nodes.Add(childnode); + itemlist.Add(inperobject); + } + } + break; + } + } + return; + + } + else if (imageindex == 3) + { + foreach (ALLOBJECT perobject in itemlist) + { + if (perobject.treenode.Equals(nownode)) + { + Item item = perobject.workobject as Item; + ModelObject[] itemrevisionlist = null; + ModelObject[] objects = { item }; + String[] attributes = { "revision_list" }; + dmService.RefreshObjects(objects); + dmService.GetProperties(objects, attributes); + itemrevisionlist = item.Revision_list; + for (int i = 0; i < itemrevisionlist.Length; i++) + { + ItemRevision itemrevision = itemrevisionlist[i] as ItemRevision; + ModelObject[] objects1 = { itemrevision }; + String[] attributes1 = { "object_string", "object_type" }; + dmService.RefreshObjects(objects1); + dmService.GetProperties(objects1, attributes1); + string name = itemrevision.Object_string; + string type = itemrevision.Object_type; + + ALLOBJECT inperobject = new ALLOBJECT(); + inperobject.workobject = itemrevision; + TreeNode childnode = new TreeNode(name, 4, 4); + inperobject.treenode = childnode; + nownode.Nodes.Add(childnode); + itemvisionlist.Add(inperobject); + } + break; + } + } + return; + } + else if (imageindex == 4) + { + foreach (ALLOBJECT perobject in itemvisionlist) + { + if (perobject.treenode.Equals(nownode)) + { + ItemRevision itemrevision = perobject.workobject as ItemRevision; + ExpandGRMRelationsPref myPref = new ExpandGRMRelationsPref(); + RelationAndTypesFilter2 myFilter = new RelationAndTypesFilter2(); + myFilter.RelationName = "IMAN_specification"; + //String[] typeVec = { "D5DWG", "Folder" }; + myFilter.ObjectTypeNames = enableTypes; + myPref.ExpItemRev = false; + RelationAndTypesFilter2[] myfilter = { myFilter }; + myPref.Info = myfilter; + ModelObject[] objects1 = { itemrevision }; + + ExpandGRMRelationsResponse myResp = dmService.ExpandGRMRelationsForPrimary(objects1, myPref); + ExpandGRMRelationsOutput[] myoutput = myResp.Output; + for (int i = 0; i < myoutput.Length; i++) + { + ExpandGRMRelationsOutput one_out = myoutput[i]; + for (int j = 0; j < one_out.OtherSideObjData.Length; j++) + { + ExpandGRMRelationsData otherSideData = one_out.OtherSideObjData[j]; + for (int k = 0; k < otherSideData.OtherSideObjects.Length; k++) + { + Type typeinfo = otherSideData.OtherSideObjects[k].GetType(); + string typename = typeinfo.Name; + ModelObject temp = otherSideData.OtherSideObjects[k]; + //if (typename == "Folder") + if (temp is Folder) + { + Folder infold = otherSideData.OtherSideObjects[k] as Folder; + + ModelObject[] objects = { infold }; + String[] attributes = { "object_string", "object_type" }; + dmService.RefreshObjects(objects); + dmService.GetProperties(objects, attributes); + string name = infold.Object_string; + string type = infold.Object_type; + + ALLOBJECT inperobject = new ALLOBJECT(); + inperobject.workobject = infold; + TreeNode childnode = new TreeNode(name, 1, 1); + inperobject.treenode = childnode; + nownode.Nodes.Add(childnode); + folderlist.Add(inperobject); + } + else if (temp is DataSet) + { + DataSet dateset = otherSideData.OtherSideObjects[k] as DataSet; + ModelObject[] objects = { dateset }; + String[] attributes = { "object_string" }; + dmService.RefreshObjects(objects); + dmService.GetProperties(objects, attributes); + string name = dateset.Object_string; + + ALLOBJECT inperobject = new ALLOBJECT(); + inperobject.workobject = dateset; + inperobject.name = name; + TreeNode childnode = new TreeNode(name, 0, 0); + inperobject.treenode = childnode; + nownode.Nodes.Add(childnode); + datasetlist.Add(inperobject); + } + } + } + } + break; + } + } + return; + } + else if (imageindex == 6) + { + + } + else if (imageindex == 7) + { + folderlist.Clear(); + itemlist.Clear(); + itemvisionlist.Clear(); + datasetlist.Clear(); + try + { + ModelObject[] objects = { home }; + String[] attributes = { "contents" }; + dmService.RefreshObjects(objects); + dmService.GetProperties(objects, attributes); + contents = home.Contents; + } + catch (NotLoadedException ex) { MessageBox.Show(ex.Message); } + for (int i = 0; i < contents.Length; i++) + { + WorkspaceObject childobj = contents[i]; + ModelObject[] objects = { childobj }; + String[] attributes = { "object_string", "object_type" }; + dmService.RefreshObjects(objects); + dmService.GetProperties(objects, attributes); + string name = childobj.Object_string; + string type = childobj.Object_type; + if (childobj is Folder) + { + ALLOBJECT perobject = new ALLOBJECT(); + perobject.workobject = childobj; + Folder fl = childobj as Folder; + if (type == "Newstuff Folder") + { + TreeNode childnode = new TreeNode(name, 6, 6); + perobject.treenode = childnode; + perobject.name = name; + perobject.uid = childobj.Uid; + nownode.Nodes.Add(childnode); + } + else if (type == "Mail Folder") + { + TreeNode childnode = new TreeNode(name, 5, 5); + perobject.treenode = childnode; + perobject.name = name; + perobject.uid = childobj.Uid; + nownode.Nodes.Add(childnode); + } + else + { + TreeNode childnode = new TreeNode(name, 1, 1); + perobject.treenode = childnode; + perobject.name = name; + perobject.uid = childobj.Uid; + nownode.Nodes.Add(childnode); + } + folderlist.Add(perobject); + } + else if (childobj is Item) + { + ALLOBJECT perobject = new ALLOBJECT(); + perobject.workobject = childobj; + Item item = childobj as Item; + TreeNode childnode = new TreeNode(name, 3, 3); + perobject.treenode = childnode; + perobject.name = name; + perobject.uid = childobj.Uid; + nownode.Nodes.Add(childnode); + itemlist.Add(perobject); + } + } + foreach (TreeNode ch in nownode.Nodes) + { + ch.EnsureVisible(); + } + } + } + } +} diff --git a/模块化/MyTeamcenter_3/form/SaveToTC.resx b/模块化/MyTeamcenter_3/form/SaveToTC.resx new file mode 100644 index 0000000..f99f78e --- /dev/null +++ b/模块化/MyTeamcenter_3/form/SaveToTC.resx @@ -0,0 +1,201 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + + + AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj0yLjAuMC4w + LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 + ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAABq + EAAAAk1TRnQBSQFMAgEBCAEAAQkBAAEEAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo + AwABQAMAATADAAEBAQABCAYAAQwYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA + AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5 + AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA + AWYDAAGZAwABzAIAATMDAAIzAgABMwFmAgABMwGZAgABMwHMAgABMwH/AgABZgMAAWYBMwIAAmYCAAFm + AZkCAAFmAcwCAAFmAf8CAAGZAwABmQEzAgABmQFmAgACmQIAAZkBzAIAAZkB/wIAAcwDAAHMATMCAAHM + AWYCAAHMAZkCAALMAgABzAH/AgAB/wFmAgAB/wGZAgAB/wHMAQABMwH/AgAB/wEAATMBAAEzAQABZgEA + ATMBAAGZAQABMwEAAcwBAAEzAQAB/wEAAf8BMwIAAzMBAAIzAWYBAAIzAZkBAAIzAcwBAAIzAf8BAAEz + AWYCAAEzAWYBMwEAATMCZgEAATMBZgGZAQABMwFmAcwBAAEzAWYB/wEAATMBmQIAATMBmQEzAQABMwGZ + AWYBAAEzApkBAAEzAZkBzAEAATMBmQH/AQABMwHMAgABMwHMATMBAAEzAcwBZgEAATMBzAGZAQABMwLM + AQABMwHMAf8BAAEzAf8BMwEAATMB/wFmAQABMwH/AZkBAAEzAf8BzAEAATMC/wEAAWYDAAFmAQABMwEA + AWYBAAFmAQABZgEAAZkBAAFmAQABzAEAAWYBAAH/AQABZgEzAgABZgIzAQABZgEzAWYBAAFmATMBmQEA + AWYBMwHMAQABZgEzAf8BAAJmAgACZgEzAQADZgEAAmYBmQEAAmYBzAEAAWYBmQIAAWYBmQEzAQABZgGZ + AWYBAAFmApkBAAFmAZkBzAEAAWYBmQH/AQABZgHMAgABZgHMATMBAAFmAcwBmQEAAWYCzAEAAWYBzAH/ + AQABZgH/AgABZgH/ATMBAAFmAf8BmQEAAWYB/wHMAQABzAEAAf8BAAH/AQABzAEAApkCAAGZATMBmQEA + AZkBAAGZAQABmQEAAcwBAAGZAwABmQIzAQABmQEAAWYBAAGZATMBzAEAAZkBAAH/AQABmQFmAgABmQFm + ATMBAAGZATMBZgEAAZkBZgGZAQABmQFmAcwBAAGZATMB/wEAApkBMwEAApkBZgEAA5kBAAKZAcwBAAKZ + Af8BAAGZAcwCAAGZAcwBMwEAAWYBzAFmAQABmQHMAZkBAAGZAswBAAGZAcwB/wEAAZkB/wIAAZkB/wEz + AQABmQHMAWYBAAGZAf8BmQEAAZkB/wHMAQABmQL/AQABzAMAAZkBAAEzAQABzAEAAWYBAAHMAQABmQEA + AcwBAAHMAQABmQEzAgABzAIzAQABzAEzAWYBAAHMATMBmQEAAcwBMwHMAQABzAEzAf8BAAHMAWYCAAHM + AWYBMwEAAZkCZgEAAcwBZgGZAQABzAFmAcwBAAGZAWYB/wEAAcwBmQIAAcwBmQEzAQABzAGZAWYBAAHM + ApkBAAHMAZkBzAEAAcwBmQH/AQACzAIAAswBMwEAAswBZgEAAswBmQEAA8wBAALMAf8BAAHMAf8CAAHM + Af8BMwEAAZkB/wFmAQABzAH/AZkBAAHMAf8BzAEAAcwC/wEAAcwBAAEzAQAB/wEAAWYBAAH/AQABmQEA + AcwBMwIAAf8CMwEAAf8BMwFmAQAB/wEzAZkBAAH/ATMBzAEAAf8BMwH/AQAB/wFmAgAB/wFmATMBAAHM + AmYBAAH/AWYBmQEAAf8BZgHMAQABzAFmAf8BAAH/AZkCAAH/AZkBMwEAAf8BmQFmAQAB/wKZAQAB/wGZ + AcwBAAH/AZkB/wEAAf8BzAIAAf8BzAEzAQAB/wHMAWYBAAH/AcwBmQEAAf8CzAEAAf8BzAH/AQAC/wEz + AQABzAH/AWYBAAL/AZkBAAL/AcwBAAJmAf8BAAFmAf8BZgEAAWYC/wEAAf8CZgEAAf8BZgH/AQAC/wFm + AQABIQEAAaUBAANfAQADdwEAA4YBAAOWAQADywEAA7IBAAPXAQAD3QEAA+MBAAPqAQAD8QEAA/gBAAHw + AfsB/wEAAaQCoAEAA4ADAAH/AgAB/wMAAv8BAAH/AwAB/wEAAf8BAAL/AgAD//8A/wD/AP8AFQAQ/ycA + AZoCGgHwBQAQ/wMAAvANAAEEEAABGgHwARoBmgHlAVkBUgF5AfAEABD/AgABtAGtAc8BtQHvAgcBvAgA + AuwCBwEAAQMB+wEAAwcEAAIaAcMBGgLDAaABeQFZATIBmQGYAbwB8AEAAf8OAAH/AgABzweLAa4B9wHv + AQcEAALsAv8BAAEDAfsBAAL/AQcEAAGaAsMBGgL2AcMBeQI4AVgBVgFQAZgB8AH/DewBAAH/AgABzwGL + CYoBkgQAAuwC/wEAAQMB+wEAAv8BBwQAAXoDoAEaAvYBmgJZAVgBeAJQAfAB/wHsCwcB7AEAAf8CAAHP + ArIBrAeKAa4EAALsAv8BAAEDAfsBAAL/AQcEAAF6AuUBegJSAZkBGgGaAVkBmQGYAVYBUAHwAf8B7AED + AwcDAwMHAQMB7AEAAf8CAAHPAawFsgSKAZEBvAMAAQQB7AL/BAAC/wEHAwAB8AGaAXoB5QF6ATECUgEc + AZkBmgEaAZgBVwFWAfAB/wHsAfsBAwEHAQMDAAEDAQcBAwEHAewBAAH/AgABtQGtBbMDsgGzAa4BBwQA + AewI/wHsAwAB8AHDAfYBwwF6AVkBOAFYAngBHAGYAZkBmAF4AfAB/wHsAv8BAwEAAv8B+wEAAQMCBwHs + AQAB/wIAAbUBtAG7AroGswGRAQcEAAEDAQAG/wHsAgMCAAHwAZoCwwF6AjgBWAFXAVABSgFyAXMBHAGZ + AfAB/wHsAfsBBwEAAf8B+wP/AQABAwEHAewBAAH/AgABBwG0Aa0CtAEJAbsEugG0Ae8FAAEDAQAE/wHs + AgMB7AIAAfABmgF6AZoBegJZAnkBVgFQAXIBBwMAAf8B7AEHAQAB+wP/AfsC/wEAAQMB7AEAAf8CAAG1 + AZkBkAGYAbMBtAEJAhkCCQG1AQcGAAEDAQAC/wHsAgMEAAHwARoBegF5AZkBoAFYAVkBmQJWARwEAAH/ + AewBAAP/AfsD/wH7Af8BAAHsAQAB/wEAAbsBtAF5AZkBeQG0AgkEtAG1CAABAwIAAgMHAAHwArwBmQF5 + AZkBeAJWAXgEAAH/AewC/wH7A/8B+wP/AfsCAAH/AgAB7wF+AV4BWAEcA7QB1gIJAQcJAAMDAewBAQcA + AbwB8AEIAZgBeAKYAZkBBwQAAf8N7AEAAf8CAAKZAnkBtQHvAwACtQEHDQABAQcAAfABvALwAbwBBwK8 + BQAQ/wIAAQcBGgGRArwRAAEEAgABAQgABLwB8AcAEP8EAAHvHAAO8CoAARoB8AG8AfAEAAHvCYEB/wOB + AfAmAAGZARoBegFTAVkBUgF0AQcDAAGyAbkD2gO5AdoBuQH0AtoBuQG8IwACkwFMAXoDoAHlATEBMgFS + AZkCAAGyAtoCswLZAbMBiwGzAfQBswHUAbkBvA7sBAAM7AIAAfACmQEbAf8BmgH2AsMCoAExATgBMgF0 + AgABsgOzBtkB9AHZArMBvAHsAf8B+wEHAfsBBwH7AQcB+wEHAfsBBwH7AewEAAHsAf8B+wEHAfsBBwH7 + AQcB+wEHAfsB7AIAAbwBGgHDAv8BmQH/AvYCwwE3AjgBeQIAAbIBswGyAtkBuAHbAbkB2wGyAfQB2QGy + AbkBvAHsAf8BBwH7AQcB+wEHAfsBBwH7AQcB+wEHAewDAAHsAf8B+wEHAfsBBwH7AQcB+wEHAfsBBwEA + AewBAAG8AZoBoALDAZoB9gP/AfYBNwI4AXkCAAGyAdkBsgG4AbIBuAGKAbIBgQGyAfQB2QGyAbkBvAHs + Af8B+wEHAfsBBwH7AQcB+wEHAfsBBwH7AewDAAHsAf8BBwH7AQcB+wEHAfsBBwH7AQcB7AEAAewBAAG8 + AXkDoAFSAZkCwwEaAZoBegI4AXkCAAGyAdkBuAK5AbgB2QGyAYoB2QH0AdkBsgG5AbwB7AH/AQcB+wEH + AfsBBwH7AQcB+wEHAfsBBwHsAgAB7AH/AQcB+wEHAfsBBwH7AQcB+wEHAfsBAALsAQAB8AF6AuUBegFT + AVIBcwF0AbwB9AH2AXoBWQGZAgABsgLaAbMC3AG5AbgB2QG7Af8BuwGzAdoBvAHsAf8B+wEHAfsBBwH7 + AQcB+wEHAfsBBwH7AewCAAHsCv8B7AEAAQcB7AEAARoBmQN6AVkBMQErAUsBUgKZAZoCegIAAYEDswGQ + AYoBgQKzAbsBigG6ArMBBwHsAf8BBwH7AQcB+wEHAfsBBwH7AQcB+wEHAewCAA3sAfsB7AEAAXQBwwH2 + AsMBegFZATgBMgFMAZkBGgUAAboB2wK6AdoBugKRAdoBuwS6AQcB7AH/AfsBBwH7AQcB+wEHAfsBBwH7 + AQcB+wHsAwAB7AH/AQcB+wEHAfsBBwH7AQcB+wEHAfsBBwHsAQABdAHDAfYC/wGaAzgBUgcAAbkC2wGz + BNkBuAHyAf8B8gHbAdoBvAHsDP8B7AMAAewB/wH7AQcB+wEHAfsBBwX/AewBAAF6AsMC9gEaAfsCOAFS + BwABswTbAQkC3AIJAfQC2wHaAbwB7AEHAfsBBwH7AQcB+wEHBuwDAAHsAf8BBwH7AQcB+wEHAf8G7AEA + AnoCoAJ6AVkB+wE4AXkHAAGzAdsB3AcJAfQBCQHcAdsBvAEAAewBBwH7AQcB+wEHAewKAAHsBf8B7AcA + AnoBWQLlAcMBegJZAZkHAAG5CRkB9AMZAfACAAXsDAAF7AkAAfABGgFSAlkCegFTAXkRAAHwKAAC8AoA + AUIBTQE+BwABPgMAASgDAAFAAwABMAMAAQEBAAEBBQABgAEBFgAD/4EAAv8CAAT/Af4BHwIAAecB/wHA + AQMB4AEPAgABwAE/AcABAwGAAQECAAHAAQMBwAEDAYADAAHAAQMBwAEDAYADAAHAAQMBwAEDAYADAAHA + AQEBwAEDBAABwAEBAYABAQQAAcABAQHAAQEEAAHAAQEB4AEDAQABBwIAAcABAQHwAQcBAAEPAgABgAED + AfgBBwHAAQ8CAAHAAQMB/AEHAeABDwIAAcAB4wH+AScB4AEfAgABwQL/AWcB8AF/AgAB9wP/AYABAQX/ + AYcBgAEABP8B/AEDAYABAAGAAQEB4AEAAeABAQGAAgABAQHAAgABAQGAAgABAQHAAgABAQGAAgABAQGA + AgABAQGAAgABAQGAAgABAQGAAgABAQMAAQEBgAIAAQEDAAEBAYACAAEBAwABDwGAAgABAQGAAgABPwGA + AgABAQGAAgABPwGAAgABAwGAAQEBAAE/AYABAAGAAf8BwAF/AQABPwGAAQABwQH/AeAB/wGAAT8B/wHv + BP8B8wH/Cw== + + + \ No newline at end of file diff --git a/模块化/MyTeamcenter_3/form/Search.Designer.cs b/模块化/MyTeamcenter_3/form/Search.Designer.cs new file mode 100644 index 0000000..da0471c --- /dev/null +++ b/模块化/MyTeamcenter_3/form/Search.Designer.cs @@ -0,0 +1,207 @@ +namespace HelloTeamcenter.form +{ + partial class Search + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Search)); + this.label1 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.label3 = new System.Windows.Forms.Label(); + this.label4 = new System.Windows.Forms.Label(); + this.textBox1 = new System.Windows.Forms.TextBox(); + this.textBox2 = new System.Windows.Forms.TextBox(); + this.comboBox1 = new System.Windows.Forms.ComboBox(); + this.comboBox2 = new System.Windows.Forms.ComboBox(); + this.treeView1 = new System.Windows.Forms.TreeView(); + this.imageList1 = new System.Windows.Forms.ImageList(this.components); + this.button1 = new System.Windows.Forms.Button(); + this.button2 = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(38, 33); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(41, 12); + this.label1.TabIndex = 0; + this.label1.Text = "名称:"; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(8, 69); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(71, 12); + this.label2.TabIndex = 1; + this.label2.Text = "零组件 ID:"; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(38, 105); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(41, 12); + this.label3.TabIndex = 2; + this.label3.Text = "类型:"; + // + // label4 + // + this.label4.AutoSize = true; + this.label4.Location = new System.Drawing.Point(26, 141); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(53, 12); + this.label4.TabIndex = 3; + this.label4.Text = "所有者:"; + // + // textBox1 + // + this.textBox1.Location = new System.Drawing.Point(85, 27); + this.textBox1.Name = "textBox1"; + this.textBox1.Size = new System.Drawing.Size(166, 21); + this.textBox1.TabIndex = 4; + // + // textBox2 + // + this.textBox2.Location = new System.Drawing.Point(85, 62); + this.textBox2.Name = "textBox2"; + this.textBox2.Size = new System.Drawing.Size(166, 21); + this.textBox2.TabIndex = 5; + // + // comboBox1 + // + this.comboBox1.FormattingEnabled = true; + this.comboBox1.Items.AddRange(new object[] { + "*", + "Item"}); + this.comboBox1.Location = new System.Drawing.Point(85, 100); + this.comboBox1.Name = "comboBox1"; + this.comboBox1.Size = new System.Drawing.Size(166, 20); + this.comboBox1.TabIndex = 6; + // + // comboBox2 + // + this.comboBox2.FormattingEnabled = true; + this.comboBox2.Items.AddRange(new object[] { + "*"}); + this.comboBox2.Location = new System.Drawing.Point(85, 136); + this.comboBox2.Name = "comboBox2"; + this.comboBox2.Size = new System.Drawing.Size(166, 20); + this.comboBox2.TabIndex = 7; + // + // treeView1 + // + this.treeView1.ImageIndex = 7; + this.treeView1.ImageList = this.imageList1; + this.treeView1.Location = new System.Drawing.Point(280, 1); + this.treeView1.Name = "treeView1"; + this.treeView1.SelectedImageIndex = 0; + this.treeView1.Size = new System.Drawing.Size(330, 271); + this.treeView1.TabIndex = 8; + this.treeView1.NodeMouseDoubleClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(this.treeView1_NodeMouseDoubleClick); + // + // imageList1 + // + this.imageList1.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream"))); + this.imageList1.TransparentColor = System.Drawing.Color.Transparent; + this.imageList1.Images.SetKeyName(0, "autocad_01.ico"); + this.imageList1.Images.SetKeyName(1, "FOLDER.ICO"); + this.imageList1.Images.SetKeyName(2, "FOLDEROP.ICO"); + this.imageList1.Images.SetKeyName(3, "item.ico"); + this.imageList1.Images.SetKeyName(4, "itemrev.ico"); + this.imageList1.Images.SetKeyName(5, "mail.ico"); + this.imageList1.Images.SetKeyName(6, "Newstuff_Folder.png"); + this.imageList1.Images.SetKeyName(7, "tai.ico"); + // + // button1 + // + this.button1.Location = new System.Drawing.Point(59, 215); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(75, 23); + this.button1.TabIndex = 9; + this.button1.Text = "查找"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // button2 + // + this.button2.Location = new System.Drawing.Point(162, 215); + this.button2.Name = "button2"; + this.button2.Size = new System.Drawing.Size(75, 23); + this.button2.TabIndex = 10; + this.button2.Text = "打开"; + this.button2.UseVisualStyleBackColor = true; + this.button2.Click += new System.EventHandler(this.button2_Click); + // + // Search + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(611, 275); + this.Controls.Add(this.button2); + this.Controls.Add(this.button1); + this.Controls.Add(this.treeView1); + this.Controls.Add(this.comboBox2); + this.Controls.Add(this.comboBox1); + this.Controls.Add(this.textBox2); + this.Controls.Add(this.textBox1); + this.Controls.Add(this.label4); + this.Controls.Add(this.label3); + this.Controls.Add(this.label2); + this.Controls.Add(this.label1); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "Search"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "搜索"; + this.TopMost = true; + this.Load += new System.EventHandler(this.Search_Load); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + public System.Windows.Forms.Label label1; + public System.Windows.Forms.Label label2; + public System.Windows.Forms.Label label3; + public System.Windows.Forms.Label label4; + public System.Windows.Forms.TextBox textBox1; + public System.Windows.Forms.TextBox textBox2; + public System.Windows.Forms.ComboBox comboBox1; + public System.Windows.Forms.ComboBox comboBox2; + public System.Windows.Forms.TreeView treeView1; + public System.Windows.Forms.Button button1; + public System.Windows.Forms.Button button2; + public System.Windows.Forms.ImageList imageList1; + + } +} \ No newline at end of file diff --git a/模块化/MyTeamcenter_3/form/Search.cs b/模块化/MyTeamcenter_3/form/Search.cs new file mode 100644 index 0000000..f0468f1 --- /dev/null +++ b/模块化/MyTeamcenter_3/form/Search.cs @@ -0,0 +1,470 @@ +using System; +using System.IO; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Text; +using System.Windows.Forms; +using System.Collections; + +using Autodesk.AutoCAD.DatabaseServices; +using Autodesk.AutoCAD.Runtime; +using Autodesk.AutoCAD.Geometry; +using Autodesk.AutoCAD.ApplicationServices; +using Autodesk.AutoCAD.EditorInput; + +using Teamcenter.Hello; +using Teamcenter.Soa.Client; +using Teamcenter.ClientX; +using Teamcenter.Services.Strong.Core; +using Teamcenter.Soa.Client.Model; +using Teamcenter.Soa.Exceptions; +using Teamcenter.Services.Strong.Query; + +using Teamcenter.Services.Strong.Core._2007_06.DataManagement; +using Teamcenter.Services.Strong.Core._2006_03.Reservation; + +using Teamcenter.Services.Strong.Core._2006_03.FileManagement; + +using Teamcenter.Soa.Internal.Client.Model; +using Teamcenter.Soa.Internal.Client; + +using HelloTeamcenter.hello; + + +using User = Teamcenter.Soa.Client.Model.Strong.User; +using Folder = Teamcenter.Soa.Client.Model.Strong.Folder; +using WorkspaceObject = Teamcenter.Soa.Client.Model.Strong.WorkspaceObject; +using Item = Teamcenter.Soa.Client.Model.Strong.Item; +using ItemRevision = Teamcenter.Soa.Client.Model.Strong.ItemRevision; +using ImanQuery = Teamcenter.Soa.Client.Model.Strong.ImanQuery; +using DataSet = Teamcenter.Soa.Client.Model.Strong.Dataset; +using SavedQueryResults = Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryResults; +using ImanFile = Teamcenter.Soa.Client.Model.Strong.ImanFile; +using BaseClassInput = Teamcenter.Services.Strong.Core._2007_06.DataManagement.BaseClassInput; +//using Teamcenter.Services.Strong.Businessmodeler._2007_06. + + +namespace HelloTeamcenter.form +{ + public partial class Search : Form + { + public Search() + { + InitializeComponent(); + } + public List folderlist = new List(); + public List itemlist = new List(); + public List itemvisionlist = new List(); + public List datasetlist = new List(); + + public Document appdoc; + public User user; + public Editor ed; + public bool hasRight = true; + public string[] enableTypes; + + private void getTypes(string rootType) + { + BaseClassInput[] input =new BaseClassInput[1]; + input[0] = new BaseClassInput(); + input[0].BaseClass = rootType; + } + + private void Search_Load(object sender, EventArgs e) + { + ed = appdoc.Editor; + //comboBox2 + DataManagementService dmService = DataManagementService.getService(Session.getConnection()); + this.comboBox2.Items.Clear(); + Tool tool = new Tool(); + SavedQueryResults found = tool.getSearchUser(); + if (found != null && found.NumOfObjects > 0) + { + for (int i = 0; i < found.NumOfObjects; i++) + { + User userobj = found.Objects[i] as User; + ModelObject[] objects = { userobj }; + String[] attributes = { "User ID", "Name" }; + dmService.RefreshObjects(objects); + dmService.GetProperties(objects, attributes); + string userid = userobj.User_id; + string username = userobj.User_name; + string tempname = userid + "(" + username + ")"; + if (this.comboBox2.Items.Contains(tempname)) + continue; + else + this.comboBox2.Items.Add(tempname); + } + } + else + ed.WriteMessage("没有查找到用户的信息。\n"); + this.textBox1.Text = ""; + this.textBox2.Text = ""; + } + + //查找 + private void button1_Click(object sender, EventArgs e) + { + string name = textBox1.Text; + string item_id = textBox2.Text; + string type = comboBox1.Text; + //ed.WriteMessage("选择类型:"+ type +"\n"); + string owner = comboBox2.Text; + //ed.WriteMessage("选择用户:" + owner + "\n"); + if (name == "") + { + name = "*"; + } + if (item_id == "") + { + item_id = "*"; + } + if (type == "") + { + type = "*"; + } + if (owner == "") + { + owner = "*"; + } + else + { + int pos = owner.IndexOf('('); + owner = owner.Substring(0, pos); + ed.WriteMessage("用户" + owner + "\n"); + } + DataManagementService dmService = DataManagementService.getService(Session.getConnection()); + Tool tool = new Tool(); + SavedQueryResults found = tool.getSearchItem(item_id, name, type, owner); + if (found != null && found.NumOfObjects > 0) + { + this.treeView1.Nodes.Clear(); + for (int i = 0; i < found.NumOfObjects; i++) + { + Item item = found.Objects[i] as Item; + ModelObject[] objects = { item }; + String[] attributes = { "object_string"}; + dmService.RefreshObjects(objects); + dmService.GetProperties(objects, attributes); + string inname = item.Object_string; + TreeNode childnode = new TreeNode(inname, 3, 3); + this.treeView1.Nodes.Add(childnode); + ALLOBJECT perobject = new ALLOBJECT(); + perobject.workobject = item; + perobject.treenode = childnode; + itemlist.Add(perobject); + } + foreach (TreeNode ch in treeView1.Nodes) + { + ch.EnsureVisible(); + } + } + } + + private void treeView1_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e) + { + TreeNode nownode = this.treeView1.SelectedNode; + getChild(nownode); + foreach (TreeNode ch in nownode.Nodes) + { + ch.EnsureVisible(); + } + } + + private void getChild(TreeNode nownode) + { + nownode.Nodes.Clear(); + DataManagementService dmService = DataManagementService.getService(Session.getConnection()); + WorkspaceObject[] contents = null; + string nodetext = nownode.Text; + int imageindex = nownode.SelectedImageIndex; + if (imageindex == 3) + { + foreach (ALLOBJECT perobject in itemlist) + { + if (perobject.treenode.Equals(nownode)) + { + Item item = perobject.workobject as Item; + ModelObject[] itemrevisionlist = null; + ModelObject[] objects = { item }; + String[] attributes = { "revision_list" }; + dmService.RefreshObjects(objects); + dmService.GetProperties(objects, attributes); + itemrevisionlist = item.Revision_list; + for (int i = 0; i < itemrevisionlist.Length; i++) + { + ItemRevision itemrevision = itemrevisionlist[i] as ItemRevision; + ModelObject[] objects1 = { itemrevision }; + String[] attributes1 = { "object_string", "object_type" }; + dmService.RefreshObjects(objects1); + dmService.GetProperties(objects1, attributes1); + string name = itemrevision.Object_string; + string type = itemrevision.Object_type; + + ALLOBJECT inperobject = new ALLOBJECT(); + inperobject.workobject = itemrevision; + TreeNode childnode = new TreeNode(name, 4, 4); + inperobject.treenode = childnode; + nownode.Nodes.Add(childnode); + itemvisionlist.Add(inperobject); + } + break; + } + } + } + else if (imageindex == 4) + { + foreach (ALLOBJECT perobject in itemvisionlist) + { + if (perobject.treenode.Equals(nownode)) + { + ItemRevision itemrevision = perobject.workobject as ItemRevision; + ExpandGRMRelationsPref myPref = new ExpandGRMRelationsPref(); + RelationAndTypesFilter2 myFilter = new RelationAndTypesFilter2(); + myFilter.RelationName = "IMAN_specification"; + //String[] typeVec = { "D5DWG", "Folder" }; + myFilter.ObjectTypeNames = enableTypes; + myPref.ExpItemRev = false; + RelationAndTypesFilter2[] myfilter = { myFilter }; + myPref.Info = myfilter; + ModelObject[] objects1 = { itemrevision }; + + ExpandGRMRelationsResponse myResp = dmService.ExpandGRMRelationsForPrimary(objects1, myPref); + ExpandGRMRelationsOutput[] myoutput = myResp.Output; + for (int i = 0; i < myoutput.Length; i++) + { + ExpandGRMRelationsOutput one_out = myoutput[i]; + for (int j = 0; j < one_out.OtherSideObjData.Length; j++) + { + ExpandGRMRelationsData otherSideData = one_out.OtherSideObjData[j]; + for (int k = 0; k < otherSideData.OtherSideObjects.Length; k++) + { + Type typeinfo = otherSideData.OtherSideObjects[k].GetType(); + string typename = typeinfo.Name; + if (typename == "Folder") + { + Folder infold = otherSideData.OtherSideObjects[k] as Folder; + + ModelObject[] objects = { infold }; + String[] attributes = { "object_string", "object_type" }; + dmService.RefreshObjects(objects); + dmService.GetProperties(objects, attributes); + string name = infold.Object_string; + string type = infold.Object_type; + + ALLOBJECT inperobject = new ALLOBJECT(); + inperobject.workobject = infold; + TreeNode childnode = new TreeNode(name, 1, 1); + inperobject.treenode = childnode; + nownode.Nodes.Add(childnode); + folderlist.Add(inperobject); + } + else + { + DataSet dateset = otherSideData.OtherSideObjects[k] as DataSet; + ModelObject[] objects = { dateset }; + String[] attributes = { "object_string" }; + dmService.RefreshObjects(objects); + dmService.GetProperties(objects, attributes); + string name = dateset.Object_string; + + ALLOBJECT inperobject = new ALLOBJECT(); + inperobject.workobject = dateset; + inperobject.name = name; + TreeNode childnode = new TreeNode(name, 0, 0); + inperobject.treenode = childnode; + nownode.Nodes.Add(childnode); + datasetlist.Add(inperobject); + } + } + } + } + break; + } + } + } + else if (imageindex == 1) + { + foreach (ALLOBJECT perobject in folderlist) + { + if (perobject.treenode.Equals(nownode)) + { + Folder fl = perobject.workobject as Folder; + ModelObject[] objects = { fl }; + String[] attributes = { "contents" }; + dmService.RefreshObjects(objects); + dmService.GetProperties(objects, attributes); + contents = fl.Contents; + for (int i = 0; i < contents.Length; i++) + { + WorkspaceObject childobj = contents[i]; + ModelObject[] objects1 = { childobj }; + String[] attributes1 = { "object_string", "object_type" }; + dmService.RefreshObjects(objects1); + dmService.GetProperties(objects1, attributes1); + string name = childobj.Object_string; + string type = childobj.Object_type; + if (childobj is Folder) + { + ALLOBJECT inperobject = new ALLOBJECT(); + inperobject.workobject = childobj; + Folder infl = childobj as Folder; + + if (type == "Newstuff Folder") + { + TreeNode childnode = new TreeNode(name, 6, 6); + inperobject.treenode = childnode; + nownode.Nodes.Add(childnode); + } + else if (type == "Mail Folder") + { + TreeNode childnode = new TreeNode(name, 5, 5); + inperobject.treenode = childnode; + nownode.Nodes.Add(childnode); + } + else{ + TreeNode childnode = new TreeNode(name, 1, 1); + inperobject.treenode = childnode; + nownode.Nodes.Add(childnode); + } + folderlist.Add(inperobject); + } + else if (childobj is Item) + { + ALLOBJECT inperobject = new ALLOBJECT(); + inperobject.workobject = childobj; + Item item = childobj as Item; + TreeNode childnode = new TreeNode(name, 3, 3); + inperobject.treenode = childnode; + nownode.Nodes.Add(childnode); + itemlist.Add(inperobject); + } + } + break; + } + } + } + + } + + //打开 + private void button2_Click(object sender, EventArgs e) + { + DataManagementService dmService = DataManagementService.getService(Session.getConnection()); + Reservation res = ReservationService.getService(Session.getConnection()); + TreeNode nownode = this.treeView1.SelectedNode; + if (nownode.SelectedImageIndex == 0) + { + foreach (ALLOBJECT perobject in this.datasetlist) + { + if (perobject.treenode.Equals(nownode)) + { + DialogResult isopen = MessageBox.Show("您是否确定打开该图纸?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question); + if (isopen == DialogResult.None || isopen == DialogResult.No) + { + return; + } + DataSet mydateset = perobject.workobject as DataSet; + ModelObject[] objects = { mydateset }; + String[] attributes = { "is_modifiable", "checked_out", "ref_list" }; + dmService.RefreshObjects(objects); + dmService.GetProperties(objects, attributes); + if (mydateset.Is_modifiable == false || (mydateset.Checked_out == "Y")) + { + DialogResult moresult = MessageBox.Show("您没有修改权限或文件已经签出,是否以只读方式打开?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question); + if (moresult == DialogResult.Yes) + { + hasRight = false; + } + else + { + return; + } + } + else if (mydateset.Is_modifiable) + { + DialogResult moresult = MessageBox.Show("是否签出?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question); + if (moresult == DialogResult.Yes) + { + //加锁安全机制,同步 + ModelObject[] dataobj = { mydateset }; + res.Checkout(dataobj, "", ""); + ed.WriteMessage("文件已签出\n"); + } + } + + ModelObject[] dsfilevec = mydateset.Ref_list; + //ed.WriteMessage("长度:" + dsfilevec.Length); + //ed.WriteMessage(dsfilevec[0].GetType().ToString()); + ImanFile dsfile = dsfilevec[0] as ImanFile; + + ModelObject[] objects1 = { dsfile }; + String[] attributes1 = { "relative_directory_path", "original_file_name" }; + dmService.RefreshObjects(objects1); + dmService.GetProperties(objects1, attributes1); + + //ed.WriteMessage("路径:" + dsfile.Relative_directory_path + "\n"); + //ed.WriteMessage("文件名:" + dsfile.Original_file_name + "\n"); + string newfilename = dsfile.Original_file_name; + + string tempdir = System.Environment.GetEnvironmentVariable("TEMP").ToString(); + //ed.WriteMessage("TEMP:" + tempdir.ToString() + "\n"); + + FileManagementService fmService = FileManagementService.getService(Teamcenter.ClientX.Session.getConnection()); + ImanFile[] objects2 = { dsfile }; + FileTicketsResponse tickets = fmService.GetFileReadTickets(objects2); + //ed.WriteMessage("tickets : " + tickets.Tickets.Count + "\n"); + + //foreach (System.Collections.DictionaryEntry ticket in tickets.Tickets) + //{ + // ed.WriteMessage("键:" + ticket.Key + "\n" + "值:" + ticket.Value + "\n"); + //} + Teamcenter.Soa.Client.FileManagementUtility fmu = new Teamcenter.Soa.Client.FileManagementUtility(Teamcenter.ClientX.Session.getConnection()); + Teamcenter.Soa.Client.GetFileResponse getFileResponse = fmu.GetFiles(dsfilevec); + FileInfo[] fileinfovec = getFileResponse.GetFiles(); + + //ed.WriteMessage("文件个数:" + fileinfovec.Length + "\n"); + FileInfo file = fileinfovec[0]; + + string newtempfile = tempdir + "\\" + newfilename; + System.IO.File.Copy(file.FullName, newtempfile, true); + System.IO.File.SetAttributes(newtempfile, FileAttributes.Normal); + DocumentCollection acdocmgr = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager; + if (File.Exists(newtempfile)) + { + acdocmgr.Open(newtempfile,false); + //Object pdata = newtempfile; + //acdocmgr.ExecuteInApplicationContext(c_back, pdata); + //acdocmgr.Add(newtempfile); + } + else + { + MessageBox.Show("对不起,用户临时目录下不存在此文件\n"); + } + this.Hide(); + this.Dispose(); + break; + } + } + } + else + { + //ed.WriteMessage("请选择正确的数据集类型\n"); + MessageBox.Show("请选择正确的数据集类型"); + return; + } + } + + //private void c_back(Object data) + //{ + // DocumentCollection acdocmgr = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager; + // if (acdocmgr.IsApplicationContext) + // { + // acdocmgr.Open(Convert.ToString(data)); + // } + //} + + } +} diff --git a/模块化/MyTeamcenter_3/form/Search.resx b/模块化/MyTeamcenter_3/form/Search.resx new file mode 100644 index 0000000..f99f78e --- /dev/null +++ b/模块化/MyTeamcenter_3/form/Search.resx @@ -0,0 +1,201 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + + + AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj0yLjAuMC4w + LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 + ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAABq + EAAAAk1TRnQBSQFMAgEBCAEAAQkBAAEEAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo + AwABQAMAATADAAEBAQABCAYAAQwYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA + AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5 + AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA + AWYDAAGZAwABzAIAATMDAAIzAgABMwFmAgABMwGZAgABMwHMAgABMwH/AgABZgMAAWYBMwIAAmYCAAFm + AZkCAAFmAcwCAAFmAf8CAAGZAwABmQEzAgABmQFmAgACmQIAAZkBzAIAAZkB/wIAAcwDAAHMATMCAAHM + AWYCAAHMAZkCAALMAgABzAH/AgAB/wFmAgAB/wGZAgAB/wHMAQABMwH/AgAB/wEAATMBAAEzAQABZgEA + ATMBAAGZAQABMwEAAcwBAAEzAQAB/wEAAf8BMwIAAzMBAAIzAWYBAAIzAZkBAAIzAcwBAAIzAf8BAAEz + AWYCAAEzAWYBMwEAATMCZgEAATMBZgGZAQABMwFmAcwBAAEzAWYB/wEAATMBmQIAATMBmQEzAQABMwGZ + AWYBAAEzApkBAAEzAZkBzAEAATMBmQH/AQABMwHMAgABMwHMATMBAAEzAcwBZgEAATMBzAGZAQABMwLM + AQABMwHMAf8BAAEzAf8BMwEAATMB/wFmAQABMwH/AZkBAAEzAf8BzAEAATMC/wEAAWYDAAFmAQABMwEA + AWYBAAFmAQABZgEAAZkBAAFmAQABzAEAAWYBAAH/AQABZgEzAgABZgIzAQABZgEzAWYBAAFmATMBmQEA + AWYBMwHMAQABZgEzAf8BAAJmAgACZgEzAQADZgEAAmYBmQEAAmYBzAEAAWYBmQIAAWYBmQEzAQABZgGZ + AWYBAAFmApkBAAFmAZkBzAEAAWYBmQH/AQABZgHMAgABZgHMATMBAAFmAcwBmQEAAWYCzAEAAWYBzAH/ + AQABZgH/AgABZgH/ATMBAAFmAf8BmQEAAWYB/wHMAQABzAEAAf8BAAH/AQABzAEAApkCAAGZATMBmQEA + AZkBAAGZAQABmQEAAcwBAAGZAwABmQIzAQABmQEAAWYBAAGZATMBzAEAAZkBAAH/AQABmQFmAgABmQFm + ATMBAAGZATMBZgEAAZkBZgGZAQABmQFmAcwBAAGZATMB/wEAApkBMwEAApkBZgEAA5kBAAKZAcwBAAKZ + Af8BAAGZAcwCAAGZAcwBMwEAAWYBzAFmAQABmQHMAZkBAAGZAswBAAGZAcwB/wEAAZkB/wIAAZkB/wEz + AQABmQHMAWYBAAGZAf8BmQEAAZkB/wHMAQABmQL/AQABzAMAAZkBAAEzAQABzAEAAWYBAAHMAQABmQEA + AcwBAAHMAQABmQEzAgABzAIzAQABzAEzAWYBAAHMATMBmQEAAcwBMwHMAQABzAEzAf8BAAHMAWYCAAHM + AWYBMwEAAZkCZgEAAcwBZgGZAQABzAFmAcwBAAGZAWYB/wEAAcwBmQIAAcwBmQEzAQABzAGZAWYBAAHM + ApkBAAHMAZkBzAEAAcwBmQH/AQACzAIAAswBMwEAAswBZgEAAswBmQEAA8wBAALMAf8BAAHMAf8CAAHM + Af8BMwEAAZkB/wFmAQABzAH/AZkBAAHMAf8BzAEAAcwC/wEAAcwBAAEzAQAB/wEAAWYBAAH/AQABmQEA + AcwBMwIAAf8CMwEAAf8BMwFmAQAB/wEzAZkBAAH/ATMBzAEAAf8BMwH/AQAB/wFmAgAB/wFmATMBAAHM + AmYBAAH/AWYBmQEAAf8BZgHMAQABzAFmAf8BAAH/AZkCAAH/AZkBMwEAAf8BmQFmAQAB/wKZAQAB/wGZ + AcwBAAH/AZkB/wEAAf8BzAIAAf8BzAEzAQAB/wHMAWYBAAH/AcwBmQEAAf8CzAEAAf8BzAH/AQAC/wEz + AQABzAH/AWYBAAL/AZkBAAL/AcwBAAJmAf8BAAFmAf8BZgEAAWYC/wEAAf8CZgEAAf8BZgH/AQAC/wFm + AQABIQEAAaUBAANfAQADdwEAA4YBAAOWAQADywEAA7IBAAPXAQAD3QEAA+MBAAPqAQAD8QEAA/gBAAHw + AfsB/wEAAaQCoAEAA4ADAAH/AgAB/wMAAv8BAAH/AwAB/wEAAf8BAAL/AgAD//8A/wD/AP8AFQAQ/ycA + AZoCGgHwBQAQ/wMAAvANAAEEEAABGgHwARoBmgHlAVkBUgF5AfAEABD/AgABtAGtAc8BtQHvAgcBvAgA + AuwCBwEAAQMB+wEAAwcEAAIaAcMBGgLDAaABeQFZATIBmQGYAbwB8AEAAf8OAAH/AgABzweLAa4B9wHv + AQcEAALsAv8BAAEDAfsBAAL/AQcEAAGaAsMBGgL2AcMBeQI4AVgBVgFQAZgB8AH/DewBAAH/AgABzwGL + CYoBkgQAAuwC/wEAAQMB+wEAAv8BBwQAAXoDoAEaAvYBmgJZAVgBeAJQAfAB/wHsCwcB7AEAAf8CAAHP + ArIBrAeKAa4EAALsAv8BAAEDAfsBAAL/AQcEAAF6AuUBegJSAZkBGgGaAVkBmQGYAVYBUAHwAf8B7AED + AwcDAwMHAQMB7AEAAf8CAAHPAawFsgSKAZEBvAMAAQQB7AL/BAAC/wEHAwAB8AGaAXoB5QF6ATECUgEc + AZkBmgEaAZgBVwFWAfAB/wHsAfsBAwEHAQMDAAEDAQcBAwEHAewBAAH/AgABtQGtBbMDsgGzAa4BBwQA + AewI/wHsAwAB8AHDAfYBwwF6AVkBOAFYAngBHAGYAZkBmAF4AfAB/wHsAv8BAwEAAv8B+wEAAQMCBwHs + AQAB/wIAAbUBtAG7AroGswGRAQcEAAEDAQAG/wHsAgMCAAHwAZoCwwF6AjgBWAFXAVABSgFyAXMBHAGZ + AfAB/wHsAfsBBwEAAf8B+wP/AQABAwEHAewBAAH/AgABBwG0Aa0CtAEJAbsEugG0Ae8FAAEDAQAE/wHs + AgMB7AIAAfABmgF6AZoBegJZAnkBVgFQAXIBBwMAAf8B7AEHAQAB+wP/AfsC/wEAAQMB7AEAAf8CAAG1 + AZkBkAGYAbMBtAEJAhkCCQG1AQcGAAEDAQAC/wHsAgMEAAHwARoBegF5AZkBoAFYAVkBmQJWARwEAAH/ + AewBAAP/AfsD/wH7Af8BAAHsAQAB/wEAAbsBtAF5AZkBeQG0AgkEtAG1CAABAwIAAgMHAAHwArwBmQF5 + AZkBeAJWAXgEAAH/AewC/wH7A/8B+wP/AfsCAAH/AgAB7wF+AV4BWAEcA7QB1gIJAQcJAAMDAewBAQcA + AbwB8AEIAZgBeAKYAZkBBwQAAf8N7AEAAf8CAAKZAnkBtQHvAwACtQEHDQABAQcAAfABvALwAbwBBwK8 + BQAQ/wIAAQcBGgGRArwRAAEEAgABAQgABLwB8AcAEP8EAAHvHAAO8CoAARoB8AG8AfAEAAHvCYEB/wOB + AfAmAAGZARoBegFTAVkBUgF0AQcDAAGyAbkD2gO5AdoBuQH0AtoBuQG8IwACkwFMAXoDoAHlATEBMgFS + AZkCAAGyAtoCswLZAbMBiwGzAfQBswHUAbkBvA7sBAAM7AIAAfACmQEbAf8BmgH2AsMCoAExATgBMgF0 + AgABsgOzBtkB9AHZArMBvAHsAf8B+wEHAfsBBwH7AQcB+wEHAfsBBwH7AewEAAHsAf8B+wEHAfsBBwH7 + AQcB+wEHAfsB7AIAAbwBGgHDAv8BmQH/AvYCwwE3AjgBeQIAAbIBswGyAtkBuAHbAbkB2wGyAfQB2QGy + AbkBvAHsAf8BBwH7AQcB+wEHAfsBBwH7AQcB+wEHAewDAAHsAf8B+wEHAfsBBwH7AQcB+wEHAfsBBwEA + AewBAAG8AZoBoALDAZoB9gP/AfYBNwI4AXkCAAGyAdkBsgG4AbIBuAGKAbIBgQGyAfQB2QGyAbkBvAHs + Af8B+wEHAfsBBwH7AQcB+wEHAfsBBwH7AewDAAHsAf8BBwH7AQcB+wEHAfsBBwH7AQcB7AEAAewBAAG8 + AXkDoAFSAZkCwwEaAZoBegI4AXkCAAGyAdkBuAK5AbgB2QGyAYoB2QH0AdkBsgG5AbwB7AH/AQcB+wEH + AfsBBwH7AQcB+wEHAfsBBwHsAgAB7AH/AQcB+wEHAfsBBwH7AQcB+wEHAfsBAALsAQAB8AF6AuUBegFT + AVIBcwF0AbwB9AH2AXoBWQGZAgABsgLaAbMC3AG5AbgB2QG7Af8BuwGzAdoBvAHsAf8B+wEHAfsBBwH7 + AQcB+wEHAfsBBwH7AewCAAHsCv8B7AEAAQcB7AEAARoBmQN6AVkBMQErAUsBUgKZAZoCegIAAYEDswGQ + AYoBgQKzAbsBigG6ArMBBwHsAf8BBwH7AQcB+wEHAfsBBwH7AQcB+wEHAewCAA3sAfsB7AEAAXQBwwH2 + AsMBegFZATgBMgFMAZkBGgUAAboB2wK6AdoBugKRAdoBuwS6AQcB7AH/AfsBBwH7AQcB+wEHAfsBBwH7 + AQcB+wHsAwAB7AH/AQcB+wEHAfsBBwH7AQcB+wEHAfsBBwHsAQABdAHDAfYC/wGaAzgBUgcAAbkC2wGz + BNkBuAHyAf8B8gHbAdoBvAHsDP8B7AMAAewB/wH7AQcB+wEHAfsBBwX/AewBAAF6AsMC9gEaAfsCOAFS + BwABswTbAQkC3AIJAfQC2wHaAbwB7AEHAfsBBwH7AQcB+wEHBuwDAAHsAf8BBwH7AQcB+wEHAf8G7AEA + AnoCoAJ6AVkB+wE4AXkHAAGzAdsB3AcJAfQBCQHcAdsBvAEAAewBBwH7AQcB+wEHAewKAAHsBf8B7AcA + AnoBWQLlAcMBegJZAZkHAAG5CRkB9AMZAfACAAXsDAAF7AkAAfABGgFSAlkCegFTAXkRAAHwKAAC8AoA + AUIBTQE+BwABPgMAASgDAAFAAwABMAMAAQEBAAEBBQABgAEBFgAD/4EAAv8CAAT/Af4BHwIAAecB/wHA + AQMB4AEPAgABwAE/AcABAwGAAQECAAHAAQMBwAEDAYADAAHAAQMBwAEDAYADAAHAAQMBwAEDAYADAAHA + AQEBwAEDBAABwAEBAYABAQQAAcABAQHAAQEEAAHAAQEB4AEDAQABBwIAAcABAQHwAQcBAAEPAgABgAED + AfgBBwHAAQ8CAAHAAQMB/AEHAeABDwIAAcAB4wH+AScB4AEfAgABwQL/AWcB8AF/AgAB9wP/AYABAQX/ + AYcBgAEABP8B/AEDAYABAAGAAQEB4AEAAeABAQGAAgABAQHAAgABAQGAAgABAQHAAgABAQGAAgABAQGA + AgABAQGAAgABAQGAAgABAQGAAgABAQMAAQEBgAIAAQEDAAEBAYACAAEBAwABDwGAAgABAQGAAgABPwGA + AgABAQGAAgABPwGAAgABAwGAAQEBAAE/AYABAAGAAf8BwAF/AQABPwGAAQABwQH/AeAB/wGAAT8B/wHv + BP8B8wH/Cw== + + + \ No newline at end of file diff --git a/模块化/MyTeamcenter_3/hello/BTLClass.cs b/模块化/MyTeamcenter_3/hello/BTLClass.cs new file mode 100644 index 0000000..02ea841 --- /dev/null +++ b/模块化/MyTeamcenter_3/hello/BTLClass.cs @@ -0,0 +1,95 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace HelloTeamcenter.hello +{ + public class BTLClass + { + private string item_id; + + public string Item_id + { + get { return item_id; } + set { item_id = value; } + } + private string item_name; + + public string Item_name + { + get { return item_name; } + set { item_name = value; } + } + private string partnumber; + + public string Partnumber + { + get { return partnumber; } + set { partnumber = value; } + } + private string projectname; + + public string Projectname + { + get { return projectname; } + set { projectname = value; } + } + private string proportion; + + public string Proportion + { + get { return proportion; } + set { proportion = value; } + } + private string mapsheet; + + public string Mapsheet + { + get { return mapsheet; } + set { mapsheet = value; } + } + private string item_revision_id; + + public string Item_revision_id + { + get { return item_revision_id; } + set { item_revision_id = value; } + } + private string weight; + + public string Weight + { + get { return weight; } + set { weight = value; } + } + private string materialgrade; + + public string Materialgrade + { + get { return materialgrade; } + set { materialgrade = value; } + } + private string allpage; + + public string Allpage + { + get { return allpage; } + set { allpage = value; } + } + private string pagenumber = "1"; + + public string Pagenumber + { + get { return pagenumber; } + set { pagenumber = value; } + } + private string productType; + + public string ProductType + { + get { return productType; } + set { productType = value; } + } + + } +} diff --git a/模块化/MyTeamcenter_3/hello/DataManagement.cs b/模块化/MyTeamcenter_3/hello/DataManagement.cs new file mode 100644 index 0000000..7c67483 --- /dev/null +++ b/模块化/MyTeamcenter_3/hello/DataManagement.cs @@ -0,0 +1,379 @@ +//================================================== +// +// @@ +// +//================================================== + + + + +using System; +using System.Collections; + +using Teamcenter.ClientX; +using Teamcenter.Schemas.Soa._2006_03.Exceptions; + +// Include the Data Management Service Interface +using Teamcenter.Services.Strong.Core; + +// Input and output structures for the service operations +// Note: the different namespace from the service interface +using Teamcenter.Services.Strong.Core._2006_03.DataManagement; +using Teamcenter.Services.Strong.Core._2007_01.DataManagement; +using Teamcenter.Soa.Client.Model; +using Teamcenter.Soa.Exceptions; + +using Item = Teamcenter.Soa.Client.Model.Strong.Item; +using ItemRevision = Teamcenter.Soa.Client.Model.Strong.ItemRevision; + +namespace Teamcenter.Hello +{ + +/** + * Perform different operations in the DataManamentService + * + */ +public class DataManagement +{ + + /** + * Perform a sequence of data management operations: Create Items, Revise + * the Items, and Delete the Items + * + */ + public void createReviseAndDelete() + { + try + { + int numberOfItems = 3; + + // Reserve Item IDs and Create Items with those IDs + ItemIdsAndInitialRevisionIds[] itemIds = generateItemIds(numberOfItems, "Item"); + CreateItemsOutput[] newItems = createItems(itemIds, "Item"); + + // Copy the Item and ItemRevision to separate arrays for further + // processing + Item[] items = new Item[newItems.Length]; + ItemRevision[] itemRevs = new ItemRevision[newItems.Length]; + for (int i = 0; i < items.Length; i++) + { + items[i] = newItems[i].Item; + itemRevs[i] = newItems[i].ItemRev; + } + + // Reserve revision IDs and revise the Items + Hashtable allRevIds = generateRevisionIds(items); + reviseItems(allRevIds, itemRevs); + + // Delete all objects created + deleteItems(items); + } + catch (ServiceException e) + { + System.Console.Out.WriteLine(e.Message ); + } + + } + + /** + * Reserve a number Item and Revision Ids + * + * @param numberOfIds Number of IDs to generate + * @param type Type of IDs to generate + * + * @return An array of Item and Revision IDs. The size of the array is equal + * to the input numberOfIds + * + * @throws ServiceException If any partial errors are returned + */ + public ItemIdsAndInitialRevisionIds[] generateItemIds(int numberOfIds, String type) + // throws ServiceException + { + // Get the service stub + DataManagementService dmService = DataManagementService.getService(Session.getConnection()); + + GenerateItemIdsAndInitialRevisionIdsProperties[] properties = new GenerateItemIdsAndInitialRevisionIdsProperties[1]; + GenerateItemIdsAndInitialRevisionIdsProperties property = new GenerateItemIdsAndInitialRevisionIdsProperties(); + + property.Count = numberOfIds; + property.ItemType = type; + property.Item = null; // Not used + properties[0] = property; + + // ***************************** + // Execute the service operation + // ***************************** + GenerateItemIdsAndInitialRevisionIdsResponse response = dmService.GenerateItemIdsAndInitialRevisionIds(properties); + + + + // The AppXPartialErrorListener is logging the partial errors returned + // In this simple example if any partial errors occur we will throw a + // ServiceException + if (response.ServiceData.sizeOfPartialErrors() > 0) + throw new ServiceException( "DataManagementService.generateItemIdsAndInitialRevisionIds returned a partial error."); + + // The return is a map of ItemIdsAndInitialRevisionIds keyed on the + // 0-based index of requested IDs. Since we only asked for IDs for one + // data type, the map key is '0' + Int32 bIkey = 0; + Hashtable allNewIds = response.OutputItemIdsAndInitialRevisionIds; + ItemIdsAndInitialRevisionIds[] myNewIds = (ItemIdsAndInitialRevisionIds[]) allNewIds[bIkey]; + + return myNewIds; + } + + /** + * Create Items + * + * @param itemIds Array of Item and Revision IDs + * @param itemType Type of item to create + * + * @return Set of Items and ItemRevisions + * + * @throws ServiceException If any partial errors are returned + */ + public CreateItemsOutput[] createItems(ItemIdsAndInitialRevisionIds[] itemIds, String itemType) + // throws ServiceException + { + // Get the service stub + DataManagementService dmService = DataManagementService.getService(Session.getConnection()); + // Populate form type + GetItemCreationRelatedInfoResponse relatedResponse = dmService.GetItemCreationRelatedInfo(itemType, null); + String[] formTypes = new String[0]; + if ( relatedResponse.ServiceData.sizeOfPartialErrors() > 0) + throw new ServiceException( "DataManagementService.getItemCretionRelatedInfo returned a partial error."); + + formTypes = new String[relatedResponse.FormAttrs.Length]; + for ( int i = 0; i < relatedResponse.FormAttrs.Length; i++ ) + { + FormAttributesInfo attrInfo = relatedResponse.FormAttrs[i]; + formTypes[i] = attrInfo.FormType; + } + + ItemProperties[] itemProps = new ItemProperties[itemIds.Length]; + for (int i = 0; i < itemIds.Length; i++) + { + // Create form in cache for form property population + ModelObject[] forms = createForms(itemIds[i].NewItemId, formTypes[0], + itemIds[i].NewRevId, formTypes[1], + null, false); + ItemProperties itemProperty = new ItemProperties(); + + itemProperty.ClientId = "AppX-Test"; + itemProperty.ItemId = itemIds[i].NewItemId; + itemProperty.RevId = itemIds[i].NewRevId; + itemProperty.Name = "AppX-Test"; + itemProperty.Type = itemType; + itemProperty.Description = "Test Item for the SOA AppX sample application."; + itemProperty.Uom = ""; + + // Retrieve one of form attribute value from Item master form. + ServiceData serviceData = dmService.GetProperties(forms, new String[]{"project_id"}); + if ( serviceData.sizeOfPartialErrors() > 0) + throw new ServiceException( "DataManagementService.getProperties returned a partial error."); + Property property = null; + try + { + property= forms[0].GetProperty("project_id"); + } + catch ( NotLoadedException /*ex*/){} + + + // Only if value is null, we set new value + if ( property == null || property.StringValue == null || property.StringValue.Length == 0) + { + itemProperty.ExtendedAttributes = new ExtendedAttributes[1]; + ExtendedAttributes theExtendedAttr = new ExtendedAttributes(); + theExtendedAttr.Attributes = new Hashtable(); + theExtendedAttr.ObjectType = formTypes[0]; + theExtendedAttr.Attributes["project_id"] = "project_id"; + itemProperty.ExtendedAttributes[0] = theExtendedAttr; + } + itemProps[i] = itemProperty; + } + + + // ***************************** + // Execute the service operation + // ***************************** + CreateItemsResponse response = dmService.CreateItems(itemProps, null, ""); + // before control is returned the ChangedHandler will be called with + // newly created Item and ItemRevisions + + + + // The AppXPartialErrorListener is logging the partial errors returned + // In this simple example if any partial errors occur we will throw a + // ServiceException + if (response.ServiceData.sizeOfPartialErrors() > 0) + throw new ServiceException( "DataManagementService.createItems returned a partial error."); + + return response.Output; + } + + /** + * Reserve Revision IDs + * + * @param items Array of Items to reserve Ids for + * + * @return Map of RevisionIds + * + * @throws ServiceException If any partial errors are returned + */ + public Hashtable generateRevisionIds(Item[] items) //throws ServiceException + { + // Get the service stub + DataManagementService dmService = DataManagementService.getService(Session.getConnection()); + + GenerateRevisionIdsResponse response = null; + GenerateRevisionIdsProperties[] input = null; + input = new GenerateRevisionIdsProperties[items.Length]; + for (int i = 0; i < items.Length; i++) + { + GenerateRevisionIdsProperties property = new GenerateRevisionIdsProperties(); + property.Item = items[i]; + property.ItemType = ""; + input[i] = property; + } + + // ***************************** + // Execute the service operation + // ***************************** + response = dmService.GenerateRevisionIds(input); + + // The AppXPartialErrorListener is logging the partial errors returned + // In this simple example if any partial errors occur we will throw a + // ServiceException + if (response.ServiceData.sizeOfPartialErrors() > 0) + throw new ServiceException( "DataManagementService.generateRevisionIds returned a partial error."); + + return response.OutputRevisionIds; + } + + /** + * Revise Items + * + * @param revisionIds Map of Revsion IDs + * @param itemRevs Array of ItemRevisons + * + * @return Map of Old ItemRevsion(key) to new ItemRevision(value) + * + * @throws ServiceException If any partial errors are returned + */ + public Hashtable reviseItems(Hashtable revisionIds, ItemRevision[] itemRevs) //throws ServiceException + { + // Get the service stub + DataManagementService dmService = DataManagementService.getService(Session.getConnection()); + + Hashtable revs = new Hashtable(); + for (int i = 0; i < itemRevs.Length; i++) + { + + + RevisionIds rev = (RevisionIds) revisionIds[i]; + + ReviseProperties revProps = new ReviseProperties(); + + revProps.RevId = rev.NewRevId; + revProps.Name = "testRevise"; + revProps.Description = "describe testRevise"; + + Hashtable attrs = new Hashtable(); + attrs["project_id"] = "project_id_val"; + revProps.ExtendedAttributes = attrs; + + revs[itemRevs[i]]= revProps; + } + + // ***************************** + // Execute the service operation + // ***************************** + ReviseResponse revised = dmService.Revise(revs); + // before control is returned the ChangedHandler will be called with + // newly created Item and ItemRevisions + + + + // The AppXPartialErrorListener is logging the partial errors returned + // In this simple example if any partial errors occur we will throw a + // ServiceException + if (revised.ServiceData.sizeOfPartialErrors() > 0) + throw new ServiceException("DataManagementService.revise returned a partial error."); + + return revised.OldItemRevToNewItemRev; + + } + + /** + * Delete the Items + * + * @param items Array of Items to delete + * + * @throws ServiceException If any partial errors are returned + */ + public void deleteItems(Item[] items) //throws ServiceException + { + // Get the service stub + DataManagementService dmService = DataManagementService.getService(Session.getConnection()); + + // ***************************** + // Execute the service operation + // ***************************** + ServiceData serviceData = dmService.DeleteObjects(items); + + // The AppXPartialErrorListener is logging the partial errors returned + // In this simple example if any partial errors occur we will throw a + // ServiceException + if (serviceData.sizeOfPartialErrors() > 0) + throw new ServiceException("DataManagementService.deleteObjects returned a partial error."); + + } + + /** + * Create ItemMasterForm and ItemRevisionMasterForm + * + * @param IMFormName Name of ItemMasterForm + * @param IMFormType Type of ItemMasterForm + * @param IRMFormName Name of ItemRevisionMasterForm + * @param IRMFormType Type of ItemRevisionMasterForm + * @param parent The container object that two + * newly-created forms will be added into. + * @return ModelObject[] Array of forms + * + * @throws ServiceException If any partial errors are returned + */ + public ModelObject[] createForms ( String IMFormName, String IMFormType, + String IRMFormName, String IRMFormType, + ModelObject parent, bool saveDB ) //throws ServiceException + { + //Get the service stub + DataManagementService dmService = DataManagementService.getService(Session.getConnection()); + FormInfo[] inputs = new FormInfo[2]; + inputs[0] = new FormInfo(); + inputs[0].ClientId = "1"; + inputs[0].Description=""; + inputs[0].Name = IMFormName; + inputs[0].FormType=IMFormType; + inputs[0].SaveDB = saveDB; + inputs[0].ParentObject = parent ; + inputs[1] = new FormInfo(); + inputs[1].ClientId = "2"; + inputs[1].Description=""; + inputs[1].Name = IRMFormName; + inputs[1].FormType=IRMFormType; + inputs[1].SaveDB = saveDB; + inputs[1].ParentObject = parent; + CreateOrUpdateFormsResponse response = dmService.CreateOrUpdateForms(inputs); + if ( response.ServiceData.sizeOfPartialErrors() > 0) + throw new ServiceException("DataManagementService.createForms returned a partial error."); + ModelObject[] forms = new ModelObject [inputs.Length]; + for (int i=0; i@ +// +//================================================== + +using System; +using System.Collections; +using Teamcenter.ClientX; +using Autodesk.AutoCAD.DatabaseServices; +using Autodesk.AutoCAD.Runtime; +using Autodesk.AutoCAD.Geometry; +using Autodesk.AutoCAD.ApplicationServices; +using Autodesk.AutoCAD.EditorInput; +using Autodesk.AutoCAD.Windows; +using HelloTeamcenter.hello; +using HelloTeamcenter.form; +using System.Windows.Forms; + +using System.IO; +using System.Collections.Generic; + +using Teamcenter.Services.Strong.Core; +using Teamcenter.Soa.Client.Model; +using Teamcenter.Services.Strong.Core._2006_03.Reservation; +using Teamcenter.Services.Strong.Core._2006_03.FileManagement; +using Teamcenter.Services.Strong.Core._2006_03.DataManagement; +using Teamcenter.Services.Strong.Core._2007_01.DataManagement; +using Teamcenter.Services.Strong.Core._2007_06.DataManagement; + +using Teamcenter.Soa.Internal.Client.Model; +using Teamcenter.Soa.Internal.Client; +using Teamcenter.Soa.Client; +using Teamcenter.Services.Strong.Query; +//using Teamcenter.FMS.FCCProxy.ClientCache; +using Teamcenter.Schemas.Soa._2006_03.Exceptions; +using Teamcenter.Soa.Exceptions; + + +using User = Teamcenter.Soa.Client.Model.Strong.User; +using DataSet = Teamcenter.Soa.Client.Model.Strong.Dataset; +using ImanFile = Teamcenter.Soa.Client.Model.Strong.ImanFile; +using SavedQueryResults = Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryResults; +using Item = Teamcenter.Soa.Client.Model.Strong.Item; +using ItemRevision = Teamcenter.Soa.Client.Model.Strong.ItemRevision; +using ImanQuery = Teamcenter.Soa.Client.Model.Strong.ImanQuery; +using ReleaseStatus = Teamcenter.Soa.Client.Model.Strong.ReleaseStatus; +using Form = Teamcenter.Soa.Client.Model.Strong.Form; +using Dataset = Teamcenter.Soa.Client.Model.Strong.Dataset; +using Folder = Teamcenter.Soa.Client.Model.Strong.Folder; +using WorkspaceObject = Teamcenter.Soa.Client.Model.Strong.WorkspaceObject; + +[assembly: ExtensionApplication(typeof(Teamcenter.Hello.Hello))] +[assembly: CommandClass(typeof(Teamcenter.Hello.Hello))] + +namespace Teamcenter.Hello +{ + /** + * + */ + + public class Hello : Autodesk.AutoCAD.Runtime.IExtensionApplication + { + static User loginuser; + Login loginfrom; + OpenFromTC openfrom; + Search searchfrom; + SaveToTC savefrom; + static Autodesk.AutoCAD.EditorInput.Editor ed; + static Autodesk.AutoCAD.ApplicationServices.Document appodc; + static DocumentCollection acdocmgr; + static Teamcenter.ClientX.Session session; + // + bool islogin = false; + bool hasRight = true; + string serveraddress; + string username; + string password; + string usergroup; + string userrole; + // + + public void Initialize() + { + //addComtextMenu(); + } + public void Terminate() + { + + } + + [CommandMethod("LOGIN")] + public void login() + { + appodc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument; + acdocmgr = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager; + //acdocmgr.DocumentToBeDestroyed+=new DocumentCollectionEventHandler(acdocmgr_DocumentToBeDestroyed); + + ed = appodc.Editor; + ed.WriteMessage("==========login==========\n"); + loginfrom = new Login(); + loginfrom.appodc = appodc; + loginfrom.button1.Click += new System.EventHandler(this.loginbutton1_Click); + loginfrom.button2.Click += new System.EventHandler(this.loginbutton2_Click); + loginfrom.Activate(); + loginfrom.Show(); + //ed.WriteMessage("==========here===========\n"); + + + } + //½ + private void loginbutton1_Click(object sender, EventArgs e) + { + loginfrom.m_WebAddress = loginfrom.textBox1.Text.ToString(); + loginfrom.username = loginfrom.textBox2.Text.ToString(); + loginfrom.password = loginfrom.textBox3.Text.ToString(); + loginfrom.usergroup = loginfrom.textBox4.Text.ToString(); + loginfrom.userrole = loginfrom.textBox5.Text.ToString(); + session = new Teamcenter.ClientX.Session(loginfrom.m_WebAddress); + loginuser = session.mylogin(loginfrom.username, loginfrom.password, loginfrom.usergroup, loginfrom.userrole); + if (loginuser != null) + { + serveraddress = loginfrom.m_WebAddress; + username = loginfrom.username; + password = loginfrom.password; + usergroup = loginfrom.usergroup; + userrole = loginfrom.userrole; + Tool.Loginuser = loginuser; + islogin = true; + string tempdir = System.Environment.GetEnvironmentVariable("TEMP").ToString(); + string loginfile = tempdir + "\\login.ini"; + loginfrom.Hide(); + //loginfrom.Dispose(); + if (File.Exists(loginfile)) + { + StreamWriter sw = new StreamWriter(loginfile, false); + sw.WriteLine(loginfrom.m_WebAddress + "|" + loginfrom.username + "|" + loginfrom.password + + "|" + loginfrom.usergroup + "|" + loginfrom.userrole + "||"); + sw.Close(); + } + else + { + FileStream fs = new FileStream(loginfile, FileMode.Create, FileAccess.Write); + StreamWriter sw = new StreamWriter(fs); + sw.WriteLine(loginfrom.m_WebAddress + "|" + loginfrom.username + "|" + loginfrom.password + + "|" + loginfrom.usergroup + "|" + loginfrom.userrole + "||"); + sw.Close(); + fs.Close(); + } + } + else + { + MessageBox.Show("Բ𣬵¼ʧܣȷ"); + //*************** Modified by Samsara May/03/2012 *************** + //loginfrom.Dispose(); + //ԭ룬ౣ + loginfrom.textBox3.Text = ""; + } + ed.WriteMessage("\n"); + } + //ȡ + private void loginbutton2_Click(object sender, EventArgs e) + { + loginfrom.Hide(); + loginfrom.Dispose(); + } + bool hadlogin = false; + + [CommandMethod("OPEN_FROM_TC")] + public void openformtc() + { + if (loginuser != null) + hadlogin = true; + else + login(); + + if (hadlogin == true) + { + openfrom = new OpenFromTC(); + openfrom.appodc = appodc; + openfrom.user = loginuser; + openfrom.button1.Click += new System.EventHandler(this.openbutton1_Click); + openfrom.button2.Click += new System.EventHandler(this.openbutton2_Click); + openfrom.Activate(); + openfrom.Show(); + } + } + + private void openbutton1_Click(object sender, EventArgs e) + { + DataManagementService dmService = DataManagementService.getService(Session.getConnection()); + Reservation res = ReservationService.getService(Session.getConnection()); + Editor ed1 = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; + TreeNode nownode = this.openfrom.treeView1.SelectedNode; + if (nownode.SelectedImageIndex == 0) + { + List datasetlist = this.openfrom.datasetlist; + foreach (ALLOBJECT perobject in datasetlist) + { + if (perobject.treenode.Equals(nownode)) + { + this.openfrom.textBox1.Text = perobject.name; + DialogResult isopen = MessageBox.Show("Ƿȷ򿪸ͼֽ", "ʾ", MessageBoxButtons.YesNo, MessageBoxIcon.Question); + if (isopen == DialogResult.None || isopen == DialogResult.No) + { + return; + } + DataSet mydateset = perobject.workobject as DataSet; + ModelObject[] objects = { mydateset }; + String[] attributes = { "is_modifiable", "checked_out", "ref_list" }; + dmService.RefreshObjects(objects); + dmService.GetProperties(objects, attributes); + if (mydateset.Is_modifiable == false || (mydateset.Checked_out == "Y")) + { + DialogResult moresult = MessageBox.Show("û޸Ȩ޻ļѾǩǷֻʽ򿪣", "ʾ", MessageBoxButtons.YesNo, MessageBoxIcon.Question); + if (moresult == DialogResult.Yes) + { + hasRight = false; + } + else + { + return; + } + } + else if (mydateset.Is_modifiable) + { + DialogResult moresult = MessageBox.Show("Ƿǩ", "ʾ", MessageBoxButtons.YesNo, MessageBoxIcon.Question); + if (moresult == DialogResult.Yes) + { + //ȫ,ͬ + ModelObject[] dataobj = { mydateset }; + res.Checkout(dataobj, "", ""); + ed1.WriteMessage("ļǩ\n"); + } + } + + ModelObject[] dsfilevec = mydateset.Ref_list; + //ü + if ((dsfilevec == null) || (dsfilevec.Length == 0)) + { + MessageBox.Show("òڣȷϣ", "ͼֽ", MessageBoxButtons.OK); + return; + } + ed1.WriteMessage(":" + dsfilevec.Length); + ed1.WriteMessage(dsfilevec[0].GetType().ToString()); + ImanFile dsfile = dsfilevec[0] as ImanFile; + + ModelObject[] objects1 = { dsfile }; + String[] attributes1 = { "relative_directory_path", "original_file_name" }; + dmService.RefreshObjects(objects1); + dmService.GetProperties(objects1, attributes1); + + ed1.WriteMessage("·:" + dsfile.Relative_directory_path + "\n"); + ed1.WriteMessage("ļ:" + dsfile.Original_file_name + "\n"); + string newfilename = dsfile.Original_file_name; + ed1.WriteMessage("Original_file_name : "+newfilename+"\n"); + string tempdir = System.Environment.GetEnvironmentVariable("TEMP").ToString(); + ed1.WriteMessage("TEMP:" + tempdir.ToString() + "\n"); + + FileManagementService fmService = FileManagementService.getService(Teamcenter.ClientX.Session.getConnection()); + ImanFile[] objects2 = { dsfile }; + FileTicketsResponse tickets = fmService.GetFileReadTickets(objects2); + ed1.WriteMessage("tickets : " + tickets.Tickets.Count + "\n"); + + foreach (System.Collections.DictionaryEntry ticket in tickets.Tickets) + { + ed1.WriteMessage("" + ticket.Key + "\n" + "ֵ" + ticket.Value + "\n"); + } + Teamcenter.Soa.Client.FileManagementUtility fmu = new Teamcenter.Soa.Client.FileManagementUtility(Teamcenter.ClientX.Session.getConnection()); + Teamcenter.Soa.Client.GetFileResponse getFileResponse = fmu.GetFiles(dsfilevec); + FileInfo[] fileinfovec = getFileResponse.GetFiles(); + + ed1.WriteMessage("ļ" + fileinfovec.Length + "\n"); + FileInfo file = fileinfovec[0]; + //ed.WriteMessage("file.DirectoryName:" + file.DirectoryName + "\n"); + //ed.WriteMessage("file.FullName" + file.FullName + "\n"); + //string datestring = ""; + //datestring = DateTime.Now.ToString("yyyy_MM_dd_hh_mm_ss");//19 + string newtempfile = tempdir + "\\" + newfilename; + ed1.WriteMessage("·" + newtempfile + "\n"); + + System.IO.File.Copy(file.FullName, newtempfile, true); + System.IO.File.SetAttributes(newtempfile, FileAttributes.Normal); + this.openfrom.Hide(); + this.openfrom.Dispose(); + if (File.Exists(newtempfile)) + { + DocumentCollection acdocmgr1 = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager; + acdocmgr1.Open(newtempfile, false); + //Object pdata = newtempfile; + //acdocmgr.ExecuteInApplicationContext(c_back,pdata); + //Teamcenter.ClientX.Session session = new Teamcenter.ClientX.Session(serveraddress); + //loginuser = session.mylogin(username, password, usergroup, userrole); + + } + else + { + ed1.WriteMessage("ԲûʱĿ¼²ڴļ\n"); + } + + break; + } + } + } + else + { + ed1.WriteMessage("ѡȷݼ\n"); + MessageBox.Show("ѡȷݼ"); + return; + } + } + + private void openbutton2_Click(object sender, EventArgs e) + { + string[] enableTypes = this.openfrom.enableTypes; + this.openfrom.Hide(); + this.searchfrom = new Search(); + this.searchfrom.appdoc = appodc; + this.searchfrom.user = loginuser; + this.searchfrom.enableTypes = enableTypes; + this.searchfrom.Activate(); + this.searchfrom.Show(); + this.openfrom.Dispose(); + } + + private void c_back(Object data) + { + DocumentCollection acdocmgr = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager; + if (acdocmgr.IsApplicationContext) + { + acdocmgr.Open(Convert.ToString(data)); + } + } + + [CommandMethod("SAVE_AS")] + public void saveas() + { + savetotc(); + } + + + [CommandMethod("SAVE_TO_TC")] + public void savetotc() + { + + //Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.SendStringToExecute(string.Format("{0}", "QSAVE"), true, false, true); + + if (loginuser != null) + { + hadlogin = true; + } + else + login(); + if (hadlogin) + { + //ȡͼֽϢ + string titleName = "DFHM_CHS"; + string detailName = "DFHM_CHS"; + string filename = ""; + + DataManagementService dmService = DataManagementService.getService(Session.getConnection()); + Editor ed1 = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; + + Tool tool = new Tool(); + + //---------------------- -------------------- + ed1.WriteMessage("\nʼȡϢ...\n"); + Dictionary titleInfo = new Dictionary(); + titleInfo =tool.getBTL(titleName); + showMap(titleInfo,ed1); + + //ȡxmlϢ + string path = "c:\\title.xml"; + string root = "titles"; + string nodeName = "types"; + Dictionary formInfo = new Dictionary(); + ReaderCusXML xml = new ReaderCusXML(path, appodc); + // 2012-05-16 ʱȡڲԡ + //formInfo = xml.GetTitleInfo(root, titleName, titleInfo[""]); + formInfo = xml.GetTitleInfo(root, titleName, "Item"); + xml.close(); + showMap(formInfo,ed1); + + //---------------------- ϸ -------------------- + + ed1.WriteMessage("ʼȡϸϢ...\n"); + List> bomlist = new List>(); + bomlist = tool.getMXL(detailName); + ed1.WriteMessage("ϸΪ:" + bomlist.Count); + showMap(bomlist[0], ed1); + + // 2012-05-16 ʱȡڲԡ + //SavedQueryResults found = tool.getSearchItem(titleInfo["ͼ"]); + SavedQueryResults found = tool.getSearchItem("000126"); + if ((found == null) || (found.NumOfObjects == 0)) //򴴽 + { + DialogResult upresult = MessageBox.Show("ûҵӦItemǷ񴴽", "ʾ", MessageBoxButtons.YesNo, MessageBoxIcon.Question); + if (upresult == DialogResult.No || upresult == DialogResult.None) + { + ed1.WriteMessage("\n"); + } + if (upresult == DialogResult.Yes) + { + ed1.WriteMessage("============== ʼItem ===================\n"); + this.savefrom = new SaveToTC(); + this.savefrom.appdoc = appodc; + //this.savefrom.ed = ed1; + this.savefrom.user = loginuser; + this.savefrom.btlinfo = formInfo; + this.savefrom.bomlist = bomlist; + this.savefrom.button1.Click += new EventHandler(savebutton1_Click); + this.savefrom.Activate(); + this.savefrom.Show(); + } + } + else + { + if (found.NumOfObjects != 1) + { + ed.WriteMessage("ItemΨһ\n"); + } + DialogResult upresult = MessageBox.Show("ҵӦItemǷ£", "ʾ", MessageBoxButtons.YesNo, MessageBoxIcon.Question); + if (upresult == DialogResult.No || upresult == DialogResult.None) + { + ed1.WriteMessage("\n"); + } + if (upresult == DialogResult.Yes) + { + for (int i = 0; i < found.NumOfObjects; i++) + { + Item item = found.Objects[i] as Item; + ModelObject[] objects = { item }; + String[] attributes = { "item_id", "object_name", "object_string" }; + dmService.RefreshObjects(objects); + dmService.GetProperties(objects, attributes); + string item_id = item.Item_id; + string object_name = item.Object_name; + + Dataset dataset = null; + GetItemFromIdInfo tempitem = new GetItemFromIdInfo(); + tempitem.ItemId = item_id; + GetItemFromIdInfo[] infos = new GetItemFromIdInfo[1]; + infos[0] = tempitem; + GetItemFromIdPref pref = new GetItemFromIdPref(); + //Ҫµķʽ + GetItemFromIdResponse infoResp = dmService.GetItemFromId(infos, 1, pref); + for (int j = 0; j < infoResp.Output.Length; j++) + { + + //------------------------- ItemRevision ----------------------- + + ModelObject[] objects1 = { infoResp.Output[j].Item }; + String[] attributes1 = { "revision_list", "is_modifiable" }; + dmService.RefreshObjects(objects1); + dmService.GetProperties(objects1, attributes1); + ModelObject[] revlist = infoResp.Output[j].Item.Revision_list; + dmService.RefreshObjects(revlist); + ItemRevision itemRev = null; + string rev_id = ""; + + //ȡ°汾 + itemRev = revlist[revlist.Length - 1] as ItemRevision; + { + ModelObject[] objects2 = { itemRev }; + String[] attributes2 = { "item_revision_id", "is_modifiable" , + "checked_out","item_id","release_status_list", + "IMAN_master_form_rev"}; + dmService.RefreshObjects(objects2); + dmService.GetProperties(objects2, attributes2); + //ReleaseStatus[] status =itemRev.reRelease_status_list; + //if((status !=null)&&(status.Length>0)) + //{ + // MessageBox.Show("°汾Ѿܽ޸ġ"); + // return ; + //} + } + + rev_id = itemRev.Item_revision_id; + ReleaseStatus[] releaselist = itemRev.Release_status_list; + if (!itemRev.Is_modifiable) + { + MessageBox.Show("ItemRevisionΪֻ,ûбȨ!"); + return; + } + if (releaselist.Length > 0) + { + string message = "Item IDΪ" + itemRev.Item_id + "°汾ѷ"; + MessageBox.Show(message); + return; + } + + //------------------------- Form ----------------------- + + FormInfo forminfo = new FormInfo(); + FormInfo[] forminfo_vec = new FormInfo[1]; + ModelObject[] form_vec; + Form masterForm; + form_vec = itemRev.IMAN_master_form_rev; + masterForm = form_vec[0] as Form; + { + Hashtable formAttrs = new Hashtable(); + + formAttrs =updateFormProp(formInfo, titleInfo); + + ed1.WriteMessage("formAttrs:" + formAttrs.Count + "\n"); + + foreach (DictionaryEntry hash in formAttrs) + { + ed1.WriteMessage(hash.Key + ":" + Convert.ToString(hash.Value) + "\n"); + } + + //forminfo.AttributesMap = formAttrs; + //forminfo.ClientId = "1"; + //forminfo.Description = ""; + //forminfo.FormObject = (Form)masterForm; + //forminfo.Name = item_id + "/" + rev_id; + //forminfo.ParentObject = null; + //forminfo.RelationName = "IMAN_master_form"; + //forminfo.SaveDB = true; + //forminfo.FormType = "ItemRevision Master"; + //forminfo_vec[0] = forminfo; + //try + //{ + // ed1.WriteMessage("ʼ\n"); + // Teamcenter.Services.Strong.Core._2007_01.DataManagement.CreateOrUpdateFormsResponse formResp = + // dmService.CreateOrUpdateForms(forminfo_vec); + // ModelObject[] respon = { formResp.ServiceData.GetUpdatedObject(0) }; + // dmService.RefreshObjects(respon); + // ed1.WriteMessage("\n"); + // break; + //} + //catch (ServiceException ex) + //{ + // ed1.WriteMessage(ex.Message); + //} + } + + //-------------------- ȡݼ ------------------------- + + //ȡxmlϢ + + bool findDateset = false; + //ʹ + string tempName = "ͼֽ"; + string dsType = "Sun7ThCAD"; + string dsRefName = "Sun7SunThCAD"; + Teamcenter.Services.Strong.Core._2007_06.DataManagement.ExpandGRMRelationsPref + myPref = new Teamcenter.Services.Strong.Core._2007_06.DataManagement.ExpandGRMRelationsPref(); + Teamcenter.Services.Strong.Core._2007_06.DataManagement.RelationAndTypesFilter2 + myFilter = new Teamcenter.Services.Strong.Core._2007_06.DataManagement.RelationAndTypesFilter2(); + myFilter.RelationName = "IMAN_specification"; + string[] typeVec = new string[1]; + //ʹ + typeVec[0] = dsType; + myFilter.ObjectTypeNames = typeVec; + myPref.ExpItemRev = false; + Teamcenter.Services.Strong.Core._2007_06.DataManagement.RelationAndTypesFilter2[] myFilterVec = { myFilter }; + myPref.Info = myFilterVec; + //ed1.WriteMessage("=======&&ݼ&&========="); + ModelObject[] primaryObjects = { itemRev }; + Teamcenter.Services.Strong.Core._2007_06.DataManagement.ExpandGRMRelationsResponse + myResp = dmService.ExpandGRMRelationsForPrimary(primaryObjects, myPref); + if (myResp.Output.Length > 0) + { + for (int k = 0; k < myResp.Output.Length; k++) + { + Teamcenter.Services.Strong.Core._2007_06.DataManagement.ExpandGRMRelationsOutput + grmOutput = myResp.Output[k]; + for (int l = 0; l < grmOutput.OtherSideObjData.Length; l++) + { + ExpandGRMRelationsData otherSideData = grmOutput.OtherSideObjData[l]; + if (otherSideData.OtherSideObjects.Length > 0) + { + for (int m = 0; m < otherSideData.OtherSideObjects.Length; m++) + { + Dataset tempDataset; + //Teamcenter.Soa.Client.Model.ServiceData sData; + tempDataset = otherSideData.OtherSideObjects[m] as Dataset; + + string ds_name = tempDataset.Object_string; + if (ds_name == tempName) + { + findDateset = true; + dataset = otherSideData.OtherSideObjects[m] as Dataset; + ed1.WriteMessage("ҵݼ!\n"); + break; + } + } + } + } + } + } + + if (findDateset) //ݼ + { + bool ischeckout = false; + try + { + ModelObject[] objects2 = { dataset }; + String[] attributes2 = { "is_modifiable", "checked_out", "checked_out_user" }; + dmService.RefreshObjects(objects2); + dmService.GetProperties(objects2, attributes2); + if (!dataset.Is_modifiable) + { + MessageBox.Show("򿪵ͼֽ״̬Ϊֻ,޷浽ϵͳ!"); + return; + } + User checkuserinfo = dataset.Checked_out_user as User; + if (checkuserinfo != null) + { + if (checkuserinfo.Uid != loginuser.Uid) + { + MessageBox.Show("ͼֽѱûǩ,޷浽ϵͳ!"); + return; + } + } + if (dataset.Checked_out == "Y") + ischeckout = true; + + } + catch (NotLoadedException ex) + { + ed1.WriteMessage(ex.Message); + } + + Reservation res = ReservationService.getService(Session.getConnection()); + //string comment = "", changeId = ""; + //ModelObject[] ds_object = new ModelObject[1]; + //ds_object[0] = dataset; + ModelObject[] dsFileVec = null; + //ed1.WriteMessage("=======22ݼ22========="); + try + { + ModelObject[] objects2 = { dataset }; + String[] attributes2 = { "ref_list" }; + dmService.RefreshObjects(objects2); + dmService.GetProperties(objects2, attributes2); + dsFileVec = dataset.Ref_list; + } + catch (NotLoadedException ex) + { + ed1.WriteMessage(ex.Message); + } + ImanFile dsfile = dsFileVec[0] as ImanFile; + + ModelObject[] objects3 = { dsfile }; + String[] attributes3 = { "relative_directory_path", "original_file_name" }; + dmService.RefreshObjects(objects3); + dmService.GetProperties(objects3, attributes3); + filename = dsfile.Original_file_name; + //ed1.WriteMessage("=======33ݼ33=========\n"); + Teamcenter.Services.Loose.Core._2006_03.FileManagement.DatasetFileInfo[] fileInfos = new Teamcenter.Services.Loose.Core._2006_03.FileManagement.DatasetFileInfo[1]; + + Teamcenter.Services.Loose.Core._2006_03.FileManagement.DatasetFileInfo fileInfo = new Teamcenter.Services.Loose.Core._2006_03.FileManagement.DatasetFileInfo(); + + DocumentCollection inacdocmgr = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager; + ed1.WriteMessage("ǰļ" + inacdocmgr.MdiActiveDocument.Name + "\n"); + + Document acdoc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument; + acdoc.Database.SaveAs(acdoc.Name, true, DwgVersion.Current, acdoc.Database.SecurityParameters); + + string mdiactivefile = acdoc.Name; + fileInfo.FileName = mdiactivefile; + fileInfo.AllowReplace = true; + fileInfo.IsText = false; + fileInfo.NamedReferencedName = dsRefName; + fileInfos[0] = fileInfo; + Teamcenter.Services.Loose.Core._2006_03.FileManagement.GetDatasetWriteTicketsInputData inputData = new Teamcenter.Services.Loose.Core._2006_03.FileManagement.GetDatasetWriteTicketsInputData(); + inputData.Dataset = dataset; + inputData.CreateNewVersion = false; + inputData.DatasetFileInfos = fileInfos; + + Teamcenter.Services.Loose.Core._2006_03.FileManagement.GetDatasetWriteTicketsInputData[] inputs = new Teamcenter.Services.Loose.Core._2006_03.FileManagement.GetDatasetWriteTicketsInputData[1]; + inputs[0] = inputData; + FileManagementUtility fMSFileManagement = new FileManagementUtility(Session.getConnection()); + ServiceData response = fMSFileManagement.PutFiles(inputs); + if (response.sizeOfPartialErrors() > 0) + ed1.WriteMessage("FileManagementService upload returned partial errors:" + response.sizeOfPartialErrors()); + ModelObject[] datasets = new ModelObject[1]; + datasets[0] = dataset; + if (ischeckout) + res.Checkin(datasets); + dmService.RefreshObjects(datasets); + + ed1.WriteMessage("DateSet check in successful\n"); + + } + else //ݼ + { + Teamcenter.Services.Strong.Core._2006_03.DataManagement.DatasetProperties + oneDatasetProp = new Teamcenter.Services.Strong.Core._2006_03.DataManagement.DatasetProperties(); + Teamcenter.Services.Strong.Core._2006_03.DataManagement.DatasetProperties[] + dataset_vec = new Teamcenter.Services.Strong.Core._2006_03.DataManagement.DatasetProperties[1]; + oneDatasetProp.ClientId = "datasetWriteTixTestClientId"; + oneDatasetProp.Type = dsType; + oneDatasetProp.Name = tempName; + oneDatasetProp.Description = ""; + oneDatasetProp.Container = null; + dataset_vec[0] = oneDatasetProp; + Teamcenter.Services.Strong.Core._2006_03.DataManagement.CreateDatasetsResponse + dsResp = dmService.CreateDatasets(dataset_vec); + Dataset createdataset = dsResp.Output[0].Dataset; + + //create relationship + Teamcenter.Services.Strong.Core._2006_03.DataManagement.Relationship[] + rela_vec = new Teamcenter.Services.Strong.Core._2006_03.DataManagement.Relationship[1]; + Teamcenter.Services.Strong.Core._2006_03.DataManagement.Relationship + one_rela = new Teamcenter.Services.Strong.Core._2006_03.DataManagement.Relationship(); + one_rela.ClientId = ""; + one_rela.PrimaryObject = itemRev; + one_rela.SecondaryObject = createdataset; + one_rela.RelationType = "IMAN_specification"; + one_rela.UserData = null; + rela_vec[0] = one_rela; + Teamcenter.Services.Strong.Core._2006_03.DataManagement.CreateRelationsResponse + reResp = dmService.CreateRelations(rela_vec); + ed1.WriteMessage("ݼϵɹ!\n"); + + Teamcenter.Services.Loose.Core._2006_03.FileManagement.DatasetFileInfo[] fileInfos = new Teamcenter.Services.Loose.Core._2006_03.FileManagement.DatasetFileInfo[1]; + + Teamcenter.Services.Loose.Core._2006_03.FileManagement.DatasetFileInfo fileInfo = new Teamcenter.Services.Loose.Core._2006_03.FileManagement.DatasetFileInfo(); + + DocumentCollection inacdocmgr = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager; + //inacdocmgr.MdiActiveDocument.Database.SaveAs(inacdocmgr.MdiActiveDocument.Name, DwgVersion.Current); + //inacdocmgr.MdiActiveDocument.SendStringToExecute("QSAVE", true, false, true); + + ed1.WriteMessage("ǰļ" + inacdocmgr.MdiActiveDocument.Name + "\n"); + + Document acdoc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument; + acdoc.Database.SaveAs(acdoc.Name, true, DwgVersion.Current, acdoc.Database.SecurityParameters); + + string mdiactivefile = acdoc.Name; + fileInfo.FileName = mdiactivefile; + fileInfo.AllowReplace = true; + fileInfo.IsText = false; + fileInfo.NamedReferencedName = dsRefName; + fileInfos[0] = fileInfo; + Teamcenter.Services.Loose.Core._2006_03.FileManagement.GetDatasetWriteTicketsInputData inputData = new Teamcenter.Services.Loose.Core._2006_03.FileManagement.GetDatasetWriteTicketsInputData(); + inputData.Dataset = createdataset; + inputData.CreateNewVersion = false; + inputData.DatasetFileInfos = fileInfos; + Teamcenter.Services.Loose.Core._2006_03.FileManagement.GetDatasetWriteTicketsInputData[] inputs = new Teamcenter.Services.Loose.Core._2006_03.FileManagement.GetDatasetWriteTicketsInputData[1]; + inputs[0] = inputData; + FileManagementUtility fMSFileManagement = new FileManagementUtility(Session.getConnection()); + ServiceData response = fMSFileManagement.PutFiles(inputs); + if (response.sizeOfPartialErrors() > 0) + ed1.WriteMessage("FileManagementService upload returned partial errors:" + response.sizeOfPartialErrors()); + ed1.WriteMessage("DateSet check in successful\n"); + ModelObject[] datasets = new ModelObject[1]; + datasets[0] = createdataset; + dmService.RefreshObjects(datasets); + dataset = createdataset; + } + + if (bomlist.Count > 0) + { + //ʹ + if (true) + { + DialogResult flushbomresult = MessageBox.Show("ǷˢBOM", "ʾ", MessageBoxButtons.YesNo, MessageBoxIcon.Question); + if (flushbomresult == DialogResult.Yes) + { + Folder aimFolder = null; + WorkspaceObject[] object_vec = new WorkspaceObject[1]; + object_vec[0] = item; + Teamcenter.Services.Strong.Core._2007_01.DataManagement.WhereReferencedResponse + refResp = dmService.WhereReferenced(object_vec, 1); + Teamcenter.Services.Strong.Core._2007_01.DataManagement.WhereReferencedOutput[] + refOutput = refResp.Output; + + for (int u = 0; u < refOutput.Length; u++) + { + Teamcenter.Services.Strong.Core._2007_01.DataManagement.WhereReferencedInfo[] + info = refOutput[u].Info; + for (int p = 0; p < info.Length; p++) + { + Teamcenter.Services.Strong.Core._2007_01.DataManagement.WhereReferencedInfo + it_info = info[p]; + string type = it_info.Referencer.Object_type; + if (type.Contains("Folder")) + { + aimFolder = it_info.Referencer as Folder; + ed1.WriteMessage("ҵĿļ\n"); + break; + } + } + } + + if (aimFolder == null) + CreateBomStructure(itemRev, dataset, bomlist, null); + else + CreateBomStructure(itemRev, dataset, bomlist, aimFolder); + } + } + } + + } + } + } + } + } + else + { + MessageBox.Show("ѡʵļУ"); + return; + } + + } + + public void savebutton1_Click(object sender, EventArgs e) + { + DataManagementService dmService = DataManagementService.getService(Session.getConnection()); + Reservation res = ReservationService.getService(Session.getConnection()); + Editor ed1 = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; + ed1.WriteMessage("==============\n"); + Dictionary btlinfo = this.savefrom.btlinfo; + List> bomlist = this.savefrom.bomlist; + //ed1.WriteMessage("ITEMͼţ" + btlinfo.Item_id + "\n"); + //ed1.WriteMessage("ϸ:" + bomlist.Count + "\n"); + Tool tool = new Tool(); + + TreeNode nownode = this.savefrom.treeView1.SelectedNode; + if (nownode.SelectedImageIndex == 1) + { + foreach (ALLOBJECT perobject in this.savefrom.folderlist) + { + if (perobject.treenode.Equals(nownode)) + { + + Folder folder = perobject.workobject as Folder; + ModelObject[] objects = { folder }; + String[] attributes = { "is_modifiable" }; + dmService.RefreshObjects(objects); + dmService.GetProperties(objects, attributes); + if (!folder.Is_modifiable) + { + MessageBox.Show("Ŀ¼ûдȨޣѡ"); + return; + } + + ItemProperties oneItemProp = new ItemProperties(); + CreateItemsResponse itemResp = new CreateItemsResponse(); + + Teamcenter.Hello.DataManagement hellomanagement = new Teamcenter.Hello.DataManagement(); + string itemtype = this.savefrom.comboBox1.Text; + ItemIdsAndInitialRevisionIds[] itemIds = hellomanagement.generateItemIds(1, itemtype); + GetItemCreationRelatedInfoResponse relatedResponse = dmService.GetItemCreationRelatedInfo(itemtype, null); + string[] formTypes = new string[relatedResponse.FormAttrs.Length]; + for (int j = 0; j < relatedResponse.FormAttrs.Length; j++) + { + FormAttributesInfo attrInfo = relatedResponse.FormAttrs[j]; + formTypes[j] = attrInfo.FormType; + } + ItemProperties[] itemProps = new ItemProperties[itemIds.Length]; + ItemProperties itemProperty = new ItemProperties(); + for (int j = 0; j < itemIds.Length; j++) + { + ed1.WriteMessage("start Create form in cache!\n"); + ModelObject[] forms = hellomanagement.createForms(itemIds[j].NewItemId, + formTypes[0], itemIds[j].NewRevId, formTypes[1], null, false); + ed1.WriteMessage("Create form in cache sucessful!\n"); + ed1.WriteMessage("set item properties!\n"); + + //itemProperty.ClientId = "AppX-Test"; + //Ϊ˲ + itemProperty.ItemId = "000099"; + itemProperty.RevId = "A"; + itemProperty.Name = "ҽSB"; + itemProperty.Type = "Item"; + itemProperty.Description = ""; + //itemProperty.Uom = "EA"; + + itemProps[j] = itemProperty; + } + + try + { + ed1.WriteMessage("start item create!\n"); + + itemResp = dmService.CreateItems(itemProps, folder, ""); + + ItemRevision rev = null; + Item newitem = null; + for (int j = 0; j < itemResp.Output.Length; j++) + { + rev = itemResp.Output[j].ItemRev; + newitem = itemResp.Output[j].Item; + } + + ////--------------------- New Item rev Form ---------------------- + ////дform + //FormInfo forminfo = new FormInfo(); + //FormInfo[] forminfo_vec; + //ModelObject[] form_vec = null; + + //ModelObject[] objects1 = { rev }; + //String[] attributes1 = { "IMAN_master_form_rev", + // "is_modifiable","item_revision_id"}; + //dmService.RefreshObjects(objects1); + //dmService.GetProperties(objects1, attributes1); + + //try + //{ + // form_vec = rev.IMAN_master_form_rev; + // ed1.WriteMessage("get_IMAN_master_form_rev sucessful!\n"); + //} + //catch (NotLoadedException ex) + //{ + // ed1.WriteMessage(ex.Message); + //} + + //forminfo_vec = new FormInfo[form_vec.Length]; + //{ + // Form form = form_vec[0] as Form; + + // Hashtable formAttrs = new Hashtable(); + + // string[] formAttrValue8 = new string[1]; + + // forminfo.AttributesMap = formAttrs; + // //forminfo.ClientId = "1"; + // forminfo.Description = ""; + // forminfo.FormObject = form; + // forminfo.Name = btlinfo.Item_id + "/" + rev.Item_revision_id; + // forminfo.ParentObject = null; + // forminfo.RelationName = "IMAN_master_form"; + // forminfo.SaveDB = true; + // forminfo.FormType = "ItemRevision Master"; + + // forminfo_vec[j] = forminfo; + + // try + // { + // CreateOrUpdateFormsResponse formResp + // = dmService.CreateOrUpdateForms(forminfo_vec); + // ed1.WriteMessage("update form attributes sucessful!\n"); + // } + // catch (ServiceException ex) + // { + // ed1.WriteMessage(ex.Message); + // } + //} + string ds_name; + string rev_id = rev.Item_revision_id; + + Teamcenter.Services.Strong.Core._2006_03.DataManagement.DatasetProperties + oneDatasetProp = new Teamcenter.Services.Strong.Core._2006_03.DataManagement.DatasetProperties(); + Teamcenter.Services.Strong.Core._2006_03.DataManagement.DatasetProperties[] + dataset_vec = new Teamcenter.Services.Strong.Core._2006_03.DataManagement.DatasetProperties[1]; + //oneDatasetProp.ClientId = "datasetWriteTixTestClientId"; + //ʹ + oneDatasetProp.Type = "D5DWG"; + oneDatasetProp.Name = "ͷ"; + oneDatasetProp.Description = ""; + oneDatasetProp.Container = null; + dataset_vec[0] = oneDatasetProp; + Teamcenter.Services.Strong.Core._2006_03.DataManagement.CreateDatasetsResponse + dsResp = dmService.CreateDatasets(dataset_vec); + Dataset createdataset = dsResp.Output[0].Dataset; + + //create relationship + Teamcenter.Services.Strong.Core._2006_03.DataManagement.Relationship[] + rela_vec = new Teamcenter.Services.Strong.Core._2006_03.DataManagement.Relationship[1]; + Teamcenter.Services.Strong.Core._2006_03.DataManagement.Relationship + one_rela = new Teamcenter.Services.Strong.Core._2006_03.DataManagement.Relationship(); + one_rela.ClientId = "AppX-myTest"; + one_rela.PrimaryObject = rev; + one_rela.SecondaryObject = createdataset; + one_rela.RelationType = "IMAN_specification"; + one_rela.UserData = null; + rela_vec[0] = one_rela; + Teamcenter.Services.Strong.Core._2006_03.DataManagement.CreateRelationsResponse + reResp = dmService.CreateRelations(rela_vec); + ed1.WriteMessage("ݼϵɹ!\n"); + + Teamcenter.Services.Loose.Core._2006_03.FileManagement.DatasetFileInfo[] fileInfos = new Teamcenter.Services.Loose.Core._2006_03.FileManagement.DatasetFileInfo[1]; + + Teamcenter.Services.Loose.Core._2006_03.FileManagement.DatasetFileInfo fileInfo = new Teamcenter.Services.Loose.Core._2006_03.FileManagement.DatasetFileInfo(); + + DocumentCollection inacdocmgr = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager; + ed1.WriteMessage("ǰļ" + inacdocmgr.MdiActiveDocument.Name + "\n"); + + Document acdoc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument; + acdoc.Database.SaveAs(acdoc.Name, true, DwgVersion.Current, acdoc.Database.SecurityParameters); + + + string mdiactivefile = acdoc.Name; + fileInfo.FileName = mdiactivefile; + fileInfo.AllowReplace = true; + fileInfo.IsText = false; + fileInfo.NamedReferencedName = "Sun7SunThCAD"; + fileInfos[0] = fileInfo; + Teamcenter.Services.Loose.Core._2006_03.FileManagement.GetDatasetWriteTicketsInputData inputData = new Teamcenter.Services.Loose.Core._2006_03.FileManagement.GetDatasetWriteTicketsInputData(); + inputData.Dataset = createdataset; + inputData.CreateNewVersion = false; + inputData.DatasetFileInfos = fileInfos; + Teamcenter.Services.Loose.Core._2006_03.FileManagement.GetDatasetWriteTicketsInputData[] inputs = new Teamcenter.Services.Loose.Core._2006_03.FileManagement.GetDatasetWriteTicketsInputData[1]; + inputs[0] = inputData; + FileManagementUtility fMSFileManagement = new FileManagementUtility(Session.getConnection()); + ServiceData response = fMSFileManagement.PutFiles(inputs); + if (response.sizeOfPartialErrors() > 0) + ed1.WriteMessage("FileManagementService upload returned partial errors:" + response.sizeOfPartialErrors()); + ed1.WriteMessage("DateSet check in successful\n"); + ModelObject[] datasets = new ModelObject[1]; + datasets[0] = createdataset; + dmService.RefreshObjects(datasets); + + //BOMˢ + { + DialogResult updateresult = MessageBox.Show("ǷˢBOM", "ʾ", MessageBoxButtons.YesNo, MessageBoxIcon.Question); + if (updateresult == DialogResult.No || updateresult == DialogResult.None) + { + ed1.WriteMessage("ˢBOM\n"); + } + else + { + CreateBomStructure(rev, createdataset, bomlist, folder); + } + } + + this.savefrom.Hide(); + this.savefrom.Dispose(); + } + catch (ServiceException ex) + { + ed1.WriteMessage(ex.Message); + } + + + } + } + } + else + { + MessageBox.Show("ѡʵļУ"); + return; + } + + } + + [CommandMethod("LOGOUT")] + public void layout() + { + if (!hadlogin) + return; + DialogResult updateresult = MessageBox.Show("ȷѾļ棡ݶʧǷ񱣴棿", "ʾ", MessageBoxButtons.YesNo, MessageBoxIcon.Question); + if (updateresult == DialogResult.Yes) + { + savetotc(); + } + else + { + loginuser = null; + hadlogin = false; + } + + } + + public bool CreateBomStructure(ItemRevision parentRev, Dataset parent_ds, List> bom_Vec, Folder folder) + { + + //DataManagementService dmService = DataManagementService.getService(Session.getConnection()); + //Reservation res = ReservationService.getService(Session.getConnection()); + //Editor ed1 = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; + //ed1.WriteMessage("bom_Vec size:" + bom_Vec.Count.ToString() + "\n"); + //ItemRevision[] revVec = new ItemRevision[bom_Vec.Count]; + //ed1.WriteMessage("revVec size:" + revVec.Length.ToString() + "\n"); + //for (int i = 0; i < bom_Vec.Count; i++) + //{ + // MXLClass it_bom = bom_Vec[i]; + // Tool tool = new Tool(); + // string item_id = it_bom.Item_id; + // SavedQueryResults found = tool.getSearchItem(it_bom.Item_id); + // if (found.NumOfObjects == 0) + // { + // //ItemProperties[] item_vec; + // //DatasetProperties[] dataset_vec; + // ItemProperties oneItemProp = new ItemProperties(); + // CreateItemsResponse itemResp = new CreateItemsResponse(); + + // Teamcenter.Hello.DataManagement hellomanagement = new Teamcenter.Hello.DataManagement(); + + // ItemIdsAndInitialRevisionIds[] itemIds = hellomanagement.generateItemIds(1,it_bom.Itemtype); + // GetItemCreationRelatedInfoResponse relatedResponse = dmService.GetItemCreationRelatedInfo(it_bom.Itemtype, null); + // string[] formTypes = new string[relatedResponse.FormAttrs.Length]; + + // for (int j = 0; j < relatedResponse.FormAttrs.Length; j++) + // { + // FormAttributesInfo attrInfo = relatedResponse.FormAttrs[j]; + // formTypes[j] = attrInfo.FormType; + // } + // ItemProperties[] itemProps = new ItemProperties[itemIds.Length]; + // ItemProperties itemProperty = new ItemProperties(); + // for (int j = 0; j < itemIds.Length; j++) + // { + // ed1.WriteMessage("start Create form in cache!\n"); + // ModelObject[] forms = hellomanagement.createForms(itemIds[j].NewItemId, + // formTypes[0], itemIds[j].NewRevId, formTypes[1],null,false); + // ed1.WriteMessage("Create form in cache sucessful!\n"); + // ed1.WriteMessage("set item properties!\n"); + + // itemProperty.ClientId = ""; + // itemProperty.ItemId = it_bom.Item_id; + // itemProperty.RevId = "A"; + // itemProperty.Name = it_bom.Name; + // itemProperty.Type = it_bom.Itemtype; + // itemProperty.Description = ""; + // itemProperty.Uom = "EA"; + + // itemProps[j] = itemProperty; + // } + // try + // { + // ed1.WriteMessage("start item create!\n"); + // if (folder == null) + // itemResp = dmService.CreateItems(itemProps, null, ""); + // else + // itemResp = dmService.CreateItems(itemProps, folder, ""); + // ed1.WriteMessage("create Items: " + it_bom.Item_id + "sucessful!\n"); + // ItemRevision rev = null; + // Item newitem = null; + // for (int j = 0; j < itemResp.Output.Length;j++ ) + // { + // rev = itemResp.Output[j].ItemRev; + // newitem = itemResp.Output[j].Item; + // } + // revVec[i] = rev; + + // //дform + // FormInfo forminfo = new FormInfo(); + // FormInfo[] forminfo_vec; + // ModelObject[] form_vec = null; + + // ModelObject[] objects = { rev }; + // String[] attributes = { "IMAN_master_form_rev", + // "is_modifiable","item_revision_id"}; + // dmService.RefreshObjects(objects); + // dmService.GetProperties(objects, attributes); + // if (rev.Is_modifiable) + // { + // try + // { + // form_vec = rev.IMAN_master_form_rev; + // ed1.WriteMessage("get_IMAN_master_form_rev sucessful!\n"); + // } + // catch (NotLoadedException ex) + // { + // ed1.WriteMessage(ex.Message); + // } + // forminfo_vec = new FormInfo[form_vec.Length]; + // for (int j = 0; j < form_vec.Length; j++) + // { + // Form form = form_vec[j] as Form; + + // Hashtable formAttrs = new Hashtable(); + // string[] formAttrValue1 = new string[1]; + // formAttrValue1[0] = ""; + // formAttrValue1[0] = it_bom.Material; + // formAttrs.Add("d5MaterialGrade", formAttrValue1); + + // string[] formAttrValue2 = new string[1]; + // formAttrValue2[0] = ""; + // formAttrValue2[0] = it_bom.Perweight; + // formAttrs.Add("d5SingleWeight", formAttrValue2); + + // string[] formAttrValue3 = new string[1]; + // formAttrValue3[0] = ""; + // formAttrValue3[0] = it_bom.Partnumber; + // formAttrs.Add("d5PartNumber", formAttrValue3); + + // string[] formAttrValue4 = new string[1]; + // formAttrValue4[0] = ""; + // formAttrValue4[0] = it_bom.Producttype; + // formAttrs.Add("d5ProductType", formAttrValue4); + + // forminfo.AttributesMap = formAttrs; + // forminfo.ClientId = "1"; + // forminfo.Description = ""; + // forminfo.FormObject = form; + // forminfo.Name = item_id + "/" +rev.Item_revision_id; + // forminfo.ParentObject = null; + // forminfo.RelationName = "IMAN_master_form"; + // forminfo.SaveDB = true; + // forminfo.FormType = "ItemRevision Master"; + + // forminfo_vec[j] = forminfo; + + // try + // { + // CreateOrUpdateFormsResponse formResp + // =dmService.CreateOrUpdateForms(forminfo_vec); + // ed1.WriteMessage("update form attributes sucessful!\n"); + // } + // catch (ServiceException ex) + // { + // ed1.WriteMessage(ex.Message); + // } + // } + // } + // if (it_bom.Memo == "ͼ") + // { + // if (parent_ds != null) + // { + // ExpandGRMRelationsPref myPref = new ExpandGRMRelationsPref(); + // RelationAndTypesFilter2 myFilter = new RelationAndTypesFilter2(); + // myFilter.RelationName = "IMAN_reference"; + // string[] typeVec = new string[1]; + // typeVec[0] = "D5DWG"; + // myFilter.ObjectTypeNames = typeVec; + // myPref.ExpItemRev = false; + // RelationAndTypesFilter2[] myFilterVec = { myFilter }; + // myPref.Info = myFilterVec; + + + // ModelObject[] primaryObjects = { rev }; + // Teamcenter.Services.Strong.Core._2007_06.DataManagement.ExpandGRMRelationsResponse + // myResp = dmService.ExpandGRMRelationsForPrimary(primaryObjects, myPref); + // if (myResp.Output.Length > 0) + // { + // for (int k = 0; k < myResp.Output.Length; k++) + // { + // Teamcenter.Services.Strong.Core._2007_06.DataManagement.ExpandGRMRelationsOutput + // grmOutput = myResp.Output[k]; + // for (int l = 0; l < grmOutput.OtherSideObjData.Length; l++) + // { + // ExpandGRMRelationsData otherSideData = grmOutput.OtherSideObjData[l]; + // if (otherSideData.OtherSideObjects.Length == 0) + // { + // Relationship[] rela_vec = new Relationship[1]; + // Relationship one_rela = new Relationship(); + // one_rela.ClientId = ""; + // one_rela.PrimaryObject = rev; + // one_rela.SecondaryObject = parent_ds; + // one_rela.RelationType = "IMAN_reference"; + // one_rela.UserData = null; + // rela_vec[0] = one_rela; + // CreateRelationsResponse reResp = + // dmService.CreateRelations(rela_vec); + // ed1.WriteMessage("create IMAN_reference sucessful!\n"); + // } + // } + // } + // } + // } + // } + // } + // catch (ServiceException ex) + // { + // ed1.WriteMessage(ex.Message); + // } + // } + // else//found + // { + // ItemRevision itemRev = null; + // for (int j = 0; j < found.NumOfObjects; j++) + // { + // GetItemFromIdInfo[] infos = new GetItemFromIdInfo[1]; + // GetItemFromIdInfo oneItem = new GetItemFromIdInfo(); + // oneItem.ItemId = item_id; + // infos[0] = oneItem; + // GetItemFromIdPref pref = new GetItemFromIdPref(); + // GetItemFromIdResponse infoResp = + // dmService.GetItemFromId(infos, 1, pref); + // for (int n = 0; n < infoResp.Output.Length; n++) + // { + // ModelObject[] objects = { infoResp.Output[n].Item }; + // String[] attributes = { "revision_list", + // "object_name","item_revision"}; + // dmService.RefreshObjects(objects); + // dmService.GetProperties(objects, attributes); + // ModelObject[] revList = infoResp.Output[n].Item.Revision_list; + // dmService.RefreshObjects(revList); + // for (int l = 0; l < revList.Length; l++) + // { + // itemRev = revList[l] as ItemRevision; + // } + // } + // } + // revVec[i] = itemRev; + // //дform + // FormInfo forminfo = new FormInfo(); + // FormInfo[] forminfo_vec = new FormInfo[1]; + // ModelObject[] form_vec; + // ModelObject[] objects1 = {itemRev }; + // String[] attributes1 = { "IMAN_master_form_rev", + // "is_modifiable","item_revision_id", + // "date_released","item_id", + // "release_status_list"}; + // dmService.RefreshObjects(objects1); + // dmService.GetProperties(objects1, attributes1); + + // ReleaseStatus[] releaselist = itemRev.Release_status_list; + // if (releaselist.Length > 0) + // { + // MessageBox.Show("Item IDΪ" + itemRev.Item_id + "°汾ѷ"); + // continue; + // } + // if (!itemRev.Is_modifiable) + // { + // MessageBox.Show("ǰûItem IDΪ" + itemRev.Item_id + "Ȩ޸ĻItem°汾ѷ"); + // continue; + // } + // else if (itemRev.Is_modifiable) + // { + // ed1.WriteMessage("is_modifiable!\n"); + + // form_vec = itemRev.IMAN_master_form_rev; + // ed1.WriteMessage("get_IMAN_master_form_rev sucessful!\n"); + + // for (int j = 0; j < form_vec.Length; j++) + // { + // Form form = form_vec[j] as Form; + // bool m_frash = false, w_frash = false, part_frash = false; + // string[] props = new string[1]; + // string revId = itemRev.Object_string; + // Hashtable formAttrs = new Hashtable(); + // // + // ed1.WriteMessage("ȡd5MaterialGrade\n"); + // props[0] = "d5MaterialGrade"; + // ServiceData serviceData = dmService.GetProperties(form_vec, props); + // if (serviceData.sizeOfPartialErrors() > 0) + // { + // continue; + // } + // Property m_prop = form_vec[j].GetProperty("d5MaterialGrade"); + // if (it_bom.Material != m_prop.StringValue) + // { + // if (m_prop.StringValue == "") + // m_frash = true; + // else + // { + // string message = "ǰϸ" + revId + "IJ" + it_bom.Material + "ϵͳڲ" + m_prop.StringValue + "һ,Ƿ񸲸ϵͳ?"; + // DialogResult updateresult = MessageBox.Show(message, "ʾ", MessageBoxButtons.YesNo, MessageBoxIcon.Question); + // if (updateresult == DialogResult.Yes) + // { + // m_frash = true; + // } + // } + // } + // string[] formAttrValue = new string[1]; + // formAttrValue[0] = ""; + // if (m_frash) + // formAttrValue[0] = it_bom.Material; + // else + // formAttrValue[0] = m_prop.StringValue; + // ed1.WriteMessage("d5MaterialGrade:" + formAttrValue[0] + "\n"); + // formAttrs.Add("d5MaterialGrade", formAttrValue); + // props[0] = ""; + + // // + // ed1.WriteMessage("ȡd5PartNumber\n"); + // props[0] = "d5PartNumber"; + // serviceData = dmService.GetProperties(form_vec, props); + // if (serviceData.sizeOfPartialErrors() > 0) + // { + // continue; + // } + // Property part_prop = form_vec[j].GetProperty("d5PartNumber"); + // if (it_bom.Partnumber != part_prop.StringValue) + // { + // if (part_prop.StringValue == "") + // part_frash = true; + // else + // { + // string message = "ǰϸ" + revId + "Ĵ" + it_bom.Partnumber + "ϵͳڴ" + part_prop.StringValue + "һ,Ƿ񸲸ϵͳ?"; + // DialogResult updateresult = MessageBox.Show(message, "ʾ", MessageBoxButtons.YesNo, MessageBoxIcon.Question); + // if (updateresult == DialogResult.Yes) + // { + // part_frash = true; + // } + // } + // } + // string[] formAttrValue1 = new string[1]; + // formAttrValue1[0] = ""; + // if (part_frash) + // formAttrValue1[0] = it_bom.Partnumber; + // else + // formAttrValue1[0] = part_prop.StringValue; + // ed1.WriteMessage("d5PartNumber:" + formAttrValue1[0] + "\n"); + // formAttrs.Add("d5PartNumber", formAttrValue1); + // props[0] = ""; + // // + // ed1.WriteMessage("ȡd5SingleWeight\n"); + // props[0] = "d5SingleWeight"; + // serviceData = dmService.GetProperties(form_vec, props); + // if (serviceData.sizeOfPartialErrors() > 0) + // { + // continue; + // } + // Property w_prop = form_vec[j].GetProperty("d5SingleWeight"); + // if (it_bom.Perweight != w_prop.StringValue) + // { + // if (w_prop.StringValue == "") + // w_frash = true; + // else + // { + // string message = "ǰϸ" + revId + "ĵ" + it_bom.Perweight + "ϵͳڵ" + w_prop.StringValue + "һ,Ƿ񸲸ϵͳ?"; + // DialogResult updateresult = MessageBox.Show(message, "ʾ", MessageBoxButtons.YesNo, MessageBoxIcon.Question); + // if (updateresult == DialogResult.Yes) + // { + // w_frash = true; + // } + // } + // } + // string[] formAttrValue2 = new string[1]; + // formAttrValue2[0] = ""; + // if (w_frash) + // formAttrValue2[0] = it_bom.Perweight; + // else + // formAttrValue2[0] = w_prop.StringValue; + // ed1.WriteMessage("d5SingleWeight:" + formAttrValue2[0] + "\n"); + // formAttrs.Add("d5SingleWeight", formAttrValue2); + + // forminfo.AttributesMap = formAttrs; + // forminfo.ClientId = ""; + // forminfo.Description = ""; + // forminfo.FormObject = form; + // forminfo.Name = item_id + "/" + itemRev.Item_revision_id; + // forminfo.ParentObject = null; + // forminfo.RelationName = "IMAN_master_form"; + // forminfo.SaveDB = true; + // forminfo.FormType = "ItemRevision Master"; + + // forminfo_vec[0] = forminfo; + // try + // { + // CreateOrUpdateFormsResponse formResp + // = dmService.CreateOrUpdateForms(forminfo_vec); + // } + // catch (SoaException ex) + // { + // ed1.WriteMessage(ex.Message); + // } + // } + // } + // if (it_bom.Memo == "ͼ") + // { + // if (parent_ds != null) + // { + // ExpandGRMRelationsPref myPref = new ExpandGRMRelationsPref(); + // RelationAndTypesFilter2 myFilter = new RelationAndTypesFilter2(); + // myFilter.RelationName = "IMAN_reference"; + // string[] typeVec = new string[1]; + // typeVec[0] = "D5DWG"; + // myFilter.ObjectTypeNames = typeVec; + // myPref.ExpItemRev = false; + // RelationAndTypesFilter2[] myFilterVec = { myFilter }; + // myPref.Info = myFilterVec; + + + // ModelObject[] primaryObjects = { itemRev }; + // Teamcenter.Services.Strong.Core._2007_06.DataManagement.ExpandGRMRelationsResponse + // myResp = dmService.ExpandGRMRelationsForPrimary(primaryObjects, myPref); + // if (myResp.Output.Length > 0) + // { + // for (int k = 0; k < myResp.Output.Length; k++) + // { + // Teamcenter.Services.Strong.Core._2007_06.DataManagement.ExpandGRMRelationsOutput + // grmOutput = myResp.Output[k]; + // for (int l = 0; l < grmOutput.OtherSideObjData.Length; l++) + // { + // ExpandGRMRelationsData otherSideData = grmOutput.OtherSideObjData[l]; + // if (otherSideData.OtherSideObjects.Length == 0) + // { + // Relationship[] rela_vec = new Relationship[1]; + // Relationship one_rela = new Relationship(); + // one_rela.ClientId = ""; + // one_rela.PrimaryObject = itemRev; + // one_rela.SecondaryObject = parent_ds; + // one_rela.RelationType = "IMAN_reference"; + // one_rela.UserData = null; + // rela_vec[0] = one_rela; + // CreateRelationsResponse reResp = + // dmService.CreateRelations(rela_vec); + // ed1.WriteMessage("create IMAN_reference sucessful!\n"); + // } + // } + // } + // } + // } + // } + // } + //}//for + ////BOM + //Teamcenter.Services.Strong.Cad.StructureManagementService ssService = + // Teamcenter.Services.Strong.Cad.StructureManagementService.getService(Session.getConnection()); + //Teamcenter.Services.Strong.Cad._2007_12.StructureManagement.CreateOrUpdateRelativeStructureInfo2 + // structInfo = new Teamcenter.Services.Strong.Cad._2007_12.StructureManagement.CreateOrUpdateRelativeStructureInfo2(); + + //Teamcenter.Services.Strong.Cad._2007_12.StructureManagement.CreateOrUpdateRelativeStructureInfo2[] + // structInfoVec = new Teamcenter.Services.Strong.Cad._2007_12.StructureManagement.CreateOrUpdateRelativeStructureInfo2[1]; + + ////Teamcenter.Services.Strong.Cad._2007_01.StructureManagement.RelativeStructureChildInfo + //// childInfo = new Teamcenter.Services.Strong.Cad._2007_01.StructureManagement.RelativeStructureChildInfo(); + + //Teamcenter.Services.Strong.Cad._2007_01.StructureManagement.RelativeStructureChildInfo[] + // childInfoVec; + + ////Teamcenter.Services.Strong.Cad._2007_01.StructureManagement.RelOccInfo + //// occInfo = new Teamcenter.Services.Strong.Cad._2007_01.StructureManagement.RelOccInfo(); + + ////Teamcenter.Services.Strong.Cad._2007_01.StructureManagement.AttributesInfo + //// attrsInfo = new Teamcenter.Services.Strong.Cad._2007_01.StructureManagement.AttributesInfo(); + + + //Teamcenter.Services.Strong.Cad._2007_12.StructureManagement.CreateOrUpdateRelativeStructurePref2 + // sPref = new Teamcenter.Services.Strong.Cad._2007_12.StructureManagement.CreateOrUpdateRelativeStructurePref2(); + + ////ItemRevision childRev; + //ed1.WriteMessage("ʼ׼pse\n"); + //childInfoVec = new Teamcenter.Services.Strong.Cad._2007_01.StructureManagement.RelativeStructureChildInfo[revVec.Length]; + //ed1.WriteMessage("childInfoVec size:"+childInfoVec.Length+"\n"); + //Teamcenter.Services.Strong.Cad._2007_01.StructureManagement.AttributesInfo[] + // attrsToSet = new Teamcenter.Services.Strong.Cad._2007_01.StructureManagement.AttributesInfo[4]; + //for (int i = 0; i < revVec.Length; i++) + //{ + // MXLClass bomv = bom_Vec[i]; + // ed1.WriteMessage(""+bomv.Item_id+"...\n"); + // Teamcenter.Services.Strong.Cad._2007_01.StructureManagement.RelativeStructureChildInfo + // childInfo = new Teamcenter.Services.Strong.Cad._2007_01.StructureManagement.RelativeStructureChildInfo(); + // Teamcenter.Services.Strong.Cad._2007_01.StructureManagement.RelOccInfo + // occInfo = new Teamcenter.Services.Strong.Cad._2007_01.StructureManagement.RelOccInfo(); + // attrsToSet = new Teamcenter.Services.Strong.Cad._2007_01.StructureManagement.AttributesInfo[4]; + + // Teamcenter.Services.Strong.Cad._2007_01.StructureManagement.AttributesInfo + // attrsInfo = new Teamcenter.Services.Strong.Cad._2007_01.StructureManagement.AttributesInfo(); + // attrsInfo.Name = "bl_quantity"; + // attrsInfo.Value = bomv.Count; + // attrsToSet[0] = attrsInfo; + + + // Teamcenter.Services.Strong.Cad._2007_01.StructureManagement.AttributesInfo + // attrsInfo1 = new Teamcenter.Services.Strong.Cad._2007_01.StructureManagement.AttributesInfo(); + // attrsInfo1.Name = "bl_sequence_no"; + // attrsInfo1.Value = (Convert.ToInt32(bomv.Index) * 10).ToString(); + // attrsToSet[1] = attrsInfo1; + + + // Teamcenter.Services.Strong.Cad._2007_01.StructureManagement.AttributesInfo + // attrsInfo2 = new Teamcenter.Services.Strong.Cad._2007_01.StructureManagement.AttributesInfo(); + // attrsInfo2.Name = "D5DesignNote_bl"; + // attrsInfo2.Value = bomv.Memo; + // attrsToSet[2] = attrsInfo2; + + + // Teamcenter.Services.Strong.Cad._2007_01.StructureManagement.AttributesInfo + // attrsInfo3 = new Teamcenter.Services.Strong.Cad._2007_01.StructureManagement.AttributesInfo(); + // attrsInfo3.Name = "D5TotalWeight"; + // attrsInfo3.Value = bomv.Tolweight; + // attrsToSet[3] = attrsInfo3; + + // occInfo.AttrsToSet = attrsToSet; + + // childInfo.Child = revVec[i]; + // childInfo.OccInfo = occInfo; + + // childInfoVec[i] = childInfo; + + //} + //for (int j = 0; j < childInfoVec.Length; j++) + //{ + // for(int k=0;k 0) + // { + // ed1.WriteMessage("checkout bom returned a partial error."); + // return false; + // } + // } + //} + //catch (ServiceException ex) + //{ + // ed1.WriteMessage(ex.Message); + //} + + //ed1.WriteMessage("ʼBom\n"); + //try + //{ + // Teamcenter.Services.Strong.Cad._2007_01.StructureManagement.CreateOrUpdateRelativeStructureResponse + // cursResp = ssService.CreateOrUpdateRelativeStructure(structInfoVec, "view", true, sPref); + // ed1.WriteMessage("Bomɹ\n"); + //} + //catch (System.Exception ex) + //{ + // ed1.WriteMessage(ex.Message); + // return false; + //} + + //if (bvr != null) + //{ + // ModelObject[] checkIn_vec = new ModelObject[1]; + // checkIn_vec[0] = bvr; + // try + // { + // res.Checkin(checkIn_vec); + // ed1.WriteMessage("Bomview ǩɹ!\n"); + // } + // catch (ServiceException ex) + // { + // ed1.WriteMessage(ex.Message); + // } + //} + return true; + } + + private void loginbuttonclick(object Sender,EventArgs e) + { + login(); + } + + private void openbuttonclick(object Sender, EventArgs e) + { + openformtc(); + } + + private void savebuttonclick(object Sender, EventArgs e) + { + savetotc(); + } + + private void logoutbuttonclick(object Sender, EventArgs e) + { + layout(); + } + + private void showMap(Dictionary formAttrs,Editor ed) + { + foreach (KeyValuePair hash in formAttrs) + { + ed.WriteMessage(hash.Key + ":" + Convert.ToString(hash.Value) + "\n"); + } + } + + private Hashtable updateFormProp(Dictionary formAttrs, Dictionary formValues) + { + Hashtable table = new Hashtable(); + foreach (KeyValuePair hash in formAttrs) + { + string cadName = hash.Key; + string propName = hash.Value; + string propValue =formValues[cadName]; + table.Add(propName,propValue); + } + return table; + } + + //private void addComtextMenu() + //{ + // ContextMenuExtension m_contextmenu = new ContextMenuExtension(); + // m_contextmenu.Title = "MyTeamCenter"; + // Autodesk.AutoCAD.Windows.MenuItem mi = new Autodesk.AutoCAD.Windows.MenuItem("¼"); + // Autodesk.AutoCAD.Windows.MenuItem mi1 = new Autodesk.AutoCAD.Windows.MenuItem(""); + // Autodesk.AutoCAD.Windows.MenuItem mi2 = new Autodesk.AutoCAD.Windows.MenuItem(""); + // Autodesk.AutoCAD.Windows.MenuItem mi3 = new Autodesk.AutoCAD.Windows.MenuItem("˳"); + + // mi.Click += new EventHandler (loginbuttonclick); + // mi1.Click += new EventHandler(openbuttonclick); + // mi2.Click += new EventHandler(savebuttonclick); + // mi3.Click += new EventHandler(logoutbuttonclick); + + + // m_contextmenu.MenuItems.Add(mi); + // m_contextmenu.MenuItems.Add(mi1); + // m_contextmenu.MenuItems.Add(mi2); + // m_contextmenu.MenuItems.Add(mi3); + + // Autodesk.AutoCAD.ApplicationServices.Application.AddDefaultContextMenuExtension(m_contextmenu); + //} + + ////˳ʱ + //public void acdocmgr_DocumentToBeDestroyed(object sender, DocumentCollectionEventArgs e) + //{ + // DialogResult updateresult = MessageBox.Show("ȷѾļ棡ݶʧǷ񱣴棿", "ʾ", MessageBoxButtons.YesNo, MessageBoxIcon.Question); + // if (updateresult == DialogResult.Yes) + // { + // savetotc(); + // } + // else + // { + // loginuser = null; + // hadlogin = false; + // } + //} + + } +} \ No newline at end of file diff --git a/模块化/MyTeamcenter_3/hello/HomeFolder.cs b/模块化/MyTeamcenter_3/hello/HomeFolder.cs new file mode 100644 index 0000000..d597ace --- /dev/null +++ b/模块化/MyTeamcenter_3/hello/HomeFolder.cs @@ -0,0 +1,79 @@ +//================================================== +// +// @@ +// +//================================================== + +using System; + +using Teamcenter.ClientX; +using Teamcenter.Services.Strong.Core; +using Teamcenter.Soa.Client.Model; +using Teamcenter.Soa.Exceptions; + +using User = Teamcenter.Soa.Client.Model.Strong.User; +using Folder = Teamcenter.Soa.Client.Model.Strong.Folder; +using WorkspaceObject = Teamcenter.Soa.Client.Model.Strong.WorkspaceObject; + +namespace Teamcenter.Hello +{ +public class HomeFolder +{ + + /** + * List the contents of the Home folder. + * + */ + public void listHomeFolder(User user) + { + Folder home = null; + WorkspaceObject[] contents = null; + + // Get the service stub + DataManagementService dmService = DataManagementService.getService(Session.getConnection()); + + try + { + // User was a primary object returned from the login command + // the Object Property Policy should be configured to include the + // 'home_folder' property. However the actuall 'home_folder' object + // was a secondary object returned from the login request and + // therefore does not have any properties associated with it. We will need to + // get those properties explicitly with a 'getProperties' service request. + home = user.Home_folder; + } + catch (NotLoadedException e) + { + Console.Out.WriteLine(e.Message); + Console.Out.WriteLine("The Object Property Policy ($TC_DATA/soa/policies/Default.xml) is not configured with this property."); + return; + } + + try + { + ModelObject[] objects = { home }; + String[] attributes = { "contents" }; + + // ***************************** + // Execute the service operation + // ***************************** + dmService.GetProperties(objects, attributes); + + + // The above getProperties call returns a ServiceData object, but it + // just has pointers to the same object we passed into the method, so the + // input object have been updated with new property values + contents = home.Contents; + } + // This should never be thrown, since we just explicitly asked for this + // property + catch (NotLoadedException /*e*/){} + + Console.Out.WriteLine(""); + Console.Out.WriteLine("Home Folder:"); + Session.printObjects( contents ); + + } + +} +} diff --git a/模块化/MyTeamcenter_3/hello/MXLClass.cs b/模块化/MyTeamcenter_3/hello/MXLClass.cs new file mode 100644 index 0000000..ae2cd73 --- /dev/null +++ b/模块化/MyTeamcenter_3/hello/MXLClass.cs @@ -0,0 +1,101 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace HelloTeamcenter.hello +{ + public class MXLClass + { + private string index; + + public string Index + { + get { return index; } + set { index = value; } + } + private string item_id; + + public string Item_id + { + get { return item_id; } + set { item_id = value; } + } + private string partnumber; + + public string Partnumber + { + get { return partnumber; } + set { partnumber = value; } + } + private string name; + + public string Name + { + get { return name; } + set { name = value; } + } + private string object_desc; + + public string Object_desc + { + get { return object_desc; } + set { object_desc = value; } + } + private string count; + + public string Count + { + get { return count; } + set { count = value; } + } + private string material; + + public string Material + { + get { return material; } + set { material = value; } + } + private string tolweight; + + public string Tolweight + { + get { return tolweight; } + set { tolweight = value; } + } + private string perweight; + + public string Perweight + { + get { return perweight; } + set { perweight = value; } + } + private string memo; + + public string Memo + { + get { return memo; } + set { memo = value; } + } + private string itemtype; + + public string Itemtype + { + get { return itemtype; } + set { itemtype = value; } + } + private int index_num; + + public int Index_num + { + get { return index_num; } + set { index_num = value; } + } + private string producttype; + + public string Producttype + { + get { return producttype; } + set { producttype = value; } + } + } +} diff --git a/模块化/MyTeamcenter_3/hello/MyExtension.cs b/模块化/MyTeamcenter_3/hello/MyExtension.cs new file mode 100644 index 0000000..3192bed --- /dev/null +++ b/模块化/MyTeamcenter_3/hello/MyExtension.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Text; + +using Autodesk.AutoCAD.DatabaseServices; +using Autodesk.AutoCAD.Runtime; +using Autodesk.AutoCAD.Geometry; +using Autodesk.AutoCAD.ApplicationServices; +using Autodesk.AutoCAD.EditorInput; +using Autodesk.AutoCAD.Windows; + +namespace HelloTeamcenter.hello +{ + class MyExtension:Autodesk.AutoCAD.Runtime.IExtensionApplication + { + public void Initialize() + { + + } + public void Terminate() + { + + } + } +} diff --git a/模块化/MyTeamcenter_3/hello/Query.cs b/模块化/MyTeamcenter_3/hello/Query.cs new file mode 100644 index 0000000..b7ccbed --- /dev/null +++ b/模块化/MyTeamcenter_3/hello/Query.cs @@ -0,0 +1,113 @@ +//================================================== +// +// @@ +// +//================================================== + +using System; + +using Teamcenter.ClientX; +using Teamcenter.Schemas.Soa._2006_03.Exceptions; +using Teamcenter.Soa.Client.Model; + +//Include the Saved Query Service Interface +using Teamcenter.Services.Strong.Query; + +// Input and output structures for the service operations +// Note: the different namespace from the service interface +using Teamcenter.Services.Strong.Query._2006_03.SavedQuery; + +using ImanQuery = Teamcenter.Soa.Client.Model.Strong.ImanQuery; + + +namespace Teamcenter.Hello +{ +public class Query +{ + + /** + * Perform a simple query of the database + * + */ + public ModelObject[] queryComponent(string queryName, string[] queryProps, string[] queryValues) + { + + ImanQuery query = null; + + // Get the service stub + SavedQueryService queryService = SavedQueryService.getService(Session.getConnection()); + + Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryResults found; + + try + { + + // ***************************** + // Execute the service operation + // ***************************** + GetSavedQueriesResponse savedQueries = queryService.GetSavedQueries(); + + + if (savedQueries.Queries.Length == 0) + { + Console.Out.WriteLine("There are no saved queries in the system."); + return null; + } + + // Find one called 'Item Name' + for (int i = 0; i < savedQueries.Queries.Length; i++) + { + + if (savedQueries.Queries[i].Name.Equals(queryName)) + { + query = savedQueries.Queries[i].Query; + break; + } + } + } + catch (ServiceException e) + { + Console.Out.WriteLine("GetSavedQueries service request failed."); + Console.Out.WriteLine(e.Message); + return null; + } + + if (query == null) + { + Console.WriteLine("There is not an 'Item Name' query."); + return null; + } + + try + { + // Search for all Items, returning a maximum of 25 objects + Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryInput[] savedQueryInput = new Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryInput[1]; + savedQueryInput[0] = new Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryInput(); + savedQueryInput[0].Query = query; + savedQueryInput[0].MaxNumToReturn = 25; + savedQueryInput[0].LimitListCount = 0; + savedQueryInput[0].LimitList = new Teamcenter.Soa.Client.Model.ModelObject[0]; + savedQueryInput[0].Entries = queryProps; + savedQueryInput[0].Values = queryValues; + savedQueryInput[0].MaxNumToInflate = 25; + + //***************************** + //Execute the service operation + //***************************** + Teamcenter.Services.Strong.Query._2007_06.SavedQuery.ExecuteSavedQueriesResponse savedQueryResult = queryService.ExecuteSavedQueries(savedQueryInput); + + found = savedQueryResult.ArrayOfResults[0]; + + System.Console.Out.WriteLine("Found object:"); + Teamcenter.ClientX.Session.printObjects( found.Objects ); + } + catch (ServiceException e) + { + Console.Out.WriteLine("ExecuteSavedQuery service request failed."); + Console.Out.WriteLine(e.Message); + return null; + } + return found.Objects; + } +} +} diff --git a/模块化/MyTeamcenter_3/hello/ReadXML.cs b/模块化/MyTeamcenter_3/hello/ReadXML.cs new file mode 100644 index 0000000..5d62771 --- /dev/null +++ b/模块化/MyTeamcenter_3/hello/ReadXML.cs @@ -0,0 +1,298 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Text; +using System.Windows.Forms; +using System.Xml; + +using Autodesk.AutoCAD.ApplicationServices; +using Autodesk.AutoCAD.EditorInput; + +namespace Teamcenter.Hello +{ + public class ReaderCusXML + { + private XmlTextReader textReader; + private XmlDocument doc; + public ArrayList list = new ArrayList(); + private Editor ed; + + public ReaderCusXML() + { + } + + public ReaderCusXML(string filepath, Document appodc) + { + ed = appodc.Editor; + try + { + // 打开一个 XML 文件 + textReader = new XmlTextReader(filepath); + doc = new XmlDocument(); + doc.Load(textReader); + } + catch (Exception s) + { + Console.WriteLine("Exception: {0}", s.ToString()); + } + } + + public ReaderCusXML(string filepath, Editor ed1) + { + this.ed = ed1; + try + { + // 打开一个 XML 文件 + textReader = new XmlTextReader(filepath); + doc = new XmlDocument(); + doc.Load(textReader); + } + catch (Exception s) + { + Console.WriteLine("Exception: {0}", s.ToString()); + } + } + + public void close() + { + if (textReader != null) + textReader.Close(); + } + + //获取指定的节点 + private XmlNode getNode(XmlDocument doc, string nodeName) + { + XmlNodeList nodelist = doc.ChildNodes; + int nodenum = nodelist.Count; + Console.WriteLine("共有 " + nodenum + " 个节点"); + + foreach (XmlNode node in nodelist) + { + if (nodeName.Equals(node.Name)) + return node; + } + return null; + } + + //获取特定内容 + public void GetALL(string root, string nodeName) + { + XmlReader reader = new XmlNodeReader(doc); + bool isroot = true; + Console.WriteLine("************************************"); + list.Clear(); + while (reader.Read()) + { + //ed.WriteMessage("name:"+reader.Name+"\n"); + switch (reader.NodeType) + { + case XmlNodeType.XmlDeclaration: + break; + case XmlNodeType.Element: + if (isroot) + { + ed.WriteMessage(isroot+"\n"); + if (!root.Equals(reader.Name)) + continue; + else + isroot = false; + } + else if (nodeName.Equals(reader.Name)) + { + //ed.WriteMessage("============\n"); + if (reader.HasAttributes) + { + while (reader.MoveToNextAttribute()) + { + //ed.WriteMessage(string.Format("{0}={1}\n", reader.Name, reader.Value)); + list.Add(reader.Value); + } + } + } + break; + case XmlNodeType.EndElement: + if (root.Equals(reader.Name)) + isroot = true; + break; + case XmlNodeType.Text: + Console.WriteLine(string.Format("内容是:{0}", reader.Value)); + break; + } + } + Console.WriteLine("************************************"); + //showList(); + return ; + } + + //显示list + private void showList() + { + ed.WriteMessage("-----------------------\n"); + foreach (object o in list) + { + ed.WriteMessage((string)o+"\n"); + } + ed.WriteMessage("-----------------------\n"); + } + + //显示所有内容 + public void show() + { + XmlReader reader = new XmlNodeReader(doc); + Console.WriteLine("************************************"); + while (reader.Read()) + { + switch (reader.NodeType) + { + case XmlNodeType.XmlDeclaration: + Console.WriteLine(string.Format("", reader.Name, reader.Value)); + break; + case XmlNodeType.Element: + Console.Write(string.Format("<{0}\t", reader.Name)); + if (reader.HasAttributes) + { + while (reader.MoveToNextAttribute()) + { + Console.Write(string.Format("{0}={1}\t", reader.Name, reader.Value)); + } + } + Console.WriteLine(">"); + break; + case XmlNodeType.EndElement: + Console.WriteLine(string.Format("", reader.Name)); + break; + case XmlNodeType.Text: + Console.WriteLine(string.Format("内容是:{0}", reader.Value)); + break; + } + } + Console.WriteLine("************************************"); + } + + //获取信息 + public Dictionary GetTitleInfo(string root, string blockName, string itemType) + { + XmlReader reader = new XmlNodeReader(doc); + bool rangeStart = true; + bool isroot = true; + bool matched = false; + string temp = "anybody"; + string block = ""; + string type = ""; + string cad = ""; + string tc = ""; + bool writeable = false; + + Dictionary formAttrs = new Dictionary(); + + Console.WriteLine("************************************"); + + while (reader.Read()) + { + //ed.WriteMessage("name:"+reader.Name+"\n"); + switch (reader.NodeType) + { + case XmlNodeType.XmlDeclaration: + break; + case XmlNodeType.Element: + if (rangeStart) + { + if (isroot) + { + temp = reader.Name; + if (!root.Equals(temp)) + rangeStart = false; + else + isroot = false; + } + else if ("extension".Equals(reader.Name)) + { + matched = true; + if (reader.HasAttributes) + { + while (reader.MoveToNextAttribute()) + { + //ed.WriteMessage(string.Format("{0}={1}\n", reader.Name, reader.Value)); + if ("BlockName".Equals(reader.Name)) + block = reader.Value; + else if ("ItemType".Equals(reader.Name)) + type = reader.Value; + } + } + } + else if (matched) + { + //是否是想要的信息 + { + if ((block.Equals(blockName)) && (type.Equals(itemType))) + { + matched = true; + } + else + { + matched = false; + temp = "extension"; + rangeStart = false; + continue; + } + } + if ("Item".Equals(reader.Name)) + { + } + else if ("ItemRevision".Equals(reader.Name)) + { + } + else if ("Form".Equals(reader.Name)) + { + if (reader.HasAttributes) + { + while (reader.MoveToNextAttribute()) + { + //Console.WriteLine(string.Format("{0}={1}\n", reader.Name, reader.Value)); + if ("cad".Equals(reader.Name)) + cad = reader.Value; + else if ("tc".Equals(reader.Name)) + { + tc = reader.Value; + } + else if ("writeable".Equals(reader.Name)) + { + if ("1".Equals(reader.Value)) + writeable = true; + else + writeable = false; + } + } + } + } + } + } + break; + case XmlNodeType.EndElement: + if (temp.Equals(reader.Name)) + rangeStart = true; + else if ("Form".Equals(reader.Name)) + { + //Console.WriteLine(string.Format("cad={0},tc={1}", cad, tc)); + if (writeable) + { + formAttrs.Add(cad, tc); + cad = ""; + tc = ""; + writeable = false; + } + } + break; + case XmlNodeType.Text: + break; + } + } + reader.Close(); + Console.WriteLine("************************************"); + return formAttrs; + } + } +} \ No newline at end of file diff --git a/模块化/MyTeamcenter_3/hello/Tool.cs b/模块化/MyTeamcenter_3/hello/Tool.cs new file mode 100644 index 0000000..2a2475e --- /dev/null +++ b/模块化/MyTeamcenter_3/hello/Tool.cs @@ -0,0 +1,334 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using Autodesk.AutoCAD.DatabaseServices; +using Autodesk.AutoCAD.Runtime; +using Autodesk.AutoCAD.Geometry; +using Autodesk.AutoCAD.ApplicationServices; +using Autodesk.AutoCAD.EditorInput; + +using Teamcenter.Services.Strong.Query._2007_06.SavedQuery; +using Teamcenter.Hello; +using Teamcenter.Soa.Client; +using Teamcenter.ClientX; +using Teamcenter.Services.Strong.Core; +using Teamcenter.Soa.Client.Model; +using Teamcenter.Soa.Exceptions; +using Teamcenter.Services.Strong.Query; + +using Teamcenter.Services.Strong.Core._2007_06.DataManagement; +using Teamcenter.Schemas.Soa._2006_03.Exceptions; +using Teamcenter.Services.Strong.Query._2006_03.SavedQuery; + +using User = Teamcenter.Soa.Client.Model.Strong.User; +using Folder = Teamcenter.Soa.Client.Model.Strong.Folder; +using WorkspaceObject = Teamcenter.Soa.Client.Model.Strong.WorkspaceObject; +using Item = Teamcenter.Soa.Client.Model.Strong.Item; +using ItemRevision = Teamcenter.Soa.Client.Model.Strong.ItemRevision; +using ImanQuery = Teamcenter.Soa.Client.Model.Strong.ImanQuery; +using DataSet = Teamcenter.Soa.Client.Model.Strong.Dataset; + +using SavedQueryResults = Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryResults; + +namespace HelloTeamcenter.hello +{ + + class Tool + { + private BTLClass btlinfo; + private List> bomlist = new List>(); + private static User loginuser; + + public static User Loginuser + { + get { return Tool.loginuser; } + set { Tool.loginuser = value; } + } + + Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; + + //标题栏 + public Dictionary getBTL(string btlname) + { + btlinfo = new BTLClass(); + Database db = HostApplicationServices.WorkingDatabase; + Dictionary myDic = null; + using (Transaction tran = db.TransactionManager.StartTransaction()) + { + BlockTable blt = tran.GetObject(db.BlockTableId, OpenMode.ForRead) as BlockTable; + //ed.WriteMessage("名称"+blt.GetType().Name); + + //if (blt!=null) + if (blt.Has(btlname)) + { + BlockTableRecord bltr = tran.GetObject(db.CurrentSpaceId, OpenMode.ForRead) as BlockTableRecord; + foreach (ObjectId item in bltr) + { + Entity ent = tran.GetObject(item, OpenMode.ForRead) as Entity; + //ed.WriteMessage(ent.GetType().Name + "\n"); + if (ent.GetType().Name == "BlockReference") + { + BlockReference bref = (BlockReference)ent; + if (bref.Name == btlname) + { + //ed.WriteMessage("块名称:" + bref.Name + "\n"); + + myDic = new Dictionary(); + + if (bref.AttributeCollection.Count != 0) + { + System.Collections.IEnumerator bRefEnum = bref.AttributeCollection.GetEnumerator(); + + while (bRefEnum.MoveNext()) + { + ObjectId aId = (ObjectId)bRefEnum.Current;//这一句极其关键 + + AttributeReference aRef = (AttributeReference)tran.GetObject(aId, OpenMode.ForRead); + //ed.WriteMessage(aRef.Tag + ":" + aRef.TextString + "\n"); + myDic.Add(aRef.Tag, aRef.TextString); + + } + } + } + } + + } + + } + tran.Commit(); + } + return myDic; + } + + //明细栏 + public List> getMXL(string mxlname) + { + bomlist.Clear(); + + Database db = HostApplicationServices.WorkingDatabase; + Dictionary myDic = null; + using (Transaction tran = db.TransactionManager.StartTransaction()) + { + BlockTable blt = tran.GetObject(db.BlockTableId, OpenMode.ForRead) as BlockTable; + //ed.WriteMessage("名称"+blt.GetType().Name); + + if (blt.Has(mxlname)) + { + BlockTableRecord bltr = tran.GetObject(db.CurrentSpaceId, OpenMode.ForRead) as BlockTableRecord; + foreach (ObjectId item in bltr) + { + Entity ent = tran.GetObject(item, OpenMode.ForRead) as Entity; + //ed.WriteMessage(ent.GetType().Name + "\n"); + if (ent.GetType().Name == "BlockReference") + { + BlockReference bref = (BlockReference)ent; + //ed.WriteMessage(bref.GetType().Name + "====\n"); + //ed.WriteMessage(bref.Name + "====\n"); + if (bref.Name == mxlname) + { + //ed.WriteMessage("块名称:" + bref.Name + "\n"); + myDic = new Dictionary(); + if (bref.AttributeCollection.Count != 0) + { + System.Collections.IEnumerator bRefEnum = bref.AttributeCollection.GetEnumerator(); + while (bRefEnum.MoveNext()) + { + ObjectId aId = (ObjectId)bRefEnum.Current;//这一句极其关键 + + AttributeReference aRef = (AttributeReference)tran.GetObject(aId, OpenMode.ForRead); + //ed.WriteMessage("属性:" + aRef.Tag + "属性值:" + aRef.TextString + "\n"); + myDic.Add(aRef.Tag, aRef.TextString); + } + bomlist.Add(myDic); + } + } + } + + } + + } + tran.Commit(); + } + return bomlist; + } + + public SavedQueryResults getSearchItem(string item_id) + { + ImanQuery query = null; + SavedQueryService queryService = SavedQueryService.getService(Session.getConnection()); + try + { + GetSavedQueriesResponse savedQueries = queryService.GetSavedQueries(); + if (savedQueries.Queries.Length == 0) + { + ed.WriteMessage("There are no saved queries in the system.\n"); + } + for (int i = 0; i < savedQueries.Queries.Length; i++) + { + + if (savedQueries.Queries[i].Name.Equals("Item ID")) + { + query = savedQueries.Queries[i].Query; + break; + } + } + } + catch (ServiceException e) + { + ed.WriteMessage("GetSavedQueries service request failed.\n"); + ed.WriteMessage(e.Message); + return null; + } + + if (query == null) + { + ed.WriteMessage("There is not an 'Item ID' query.\n"); + } + + try + { + // Search for all Items, returning a maximum of 25 objects + Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryInput[] savedQueryInput = new Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryInput[1]; + savedQueryInput[0] = new Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryInput(); + savedQueryInput[0].Query = query; + savedQueryInput[0].Entries = new String[] { "Item ID" }; + savedQueryInput[0].Values = new String[1]; + savedQueryInput[0].Values[0] = item_id; + + Teamcenter.Services.Strong.Query._2007_06.SavedQuery.ExecuteSavedQueriesResponse savedQueryResult = queryService.ExecuteSavedQueries(savedQueryInput); + + Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryResults found = savedQueryResult.ArrayOfResults[0]; + + ed.WriteMessage("Found Items:" + found.NumOfObjects + "\n"); + return found; + } + catch (ServiceException e) + { + ed.WriteMessage("ExecuteSavedQuery service request failed.\n"); + ed.WriteMessage(e.Message); + return null; + } + } + + public SavedQueryResults getSearchItem(string item_id, string name, string type, string owner) + { + ImanQuery query = null; + SavedQueryService queryService = SavedQueryService.getService(Session.getConnection()); + try + { + GetSavedQueriesResponse savedQueries = queryService.GetSavedQueries(); + if (savedQueries.Queries.Length == 0) + { + ed.WriteMessage("There are no saved queries in the system.\n"); + } + for (int i = 0; i < savedQueries.Queries.Length; i++) + { + + if (savedQueries.Queries[i].Name.Equals("Item...")) + { + query = savedQueries.Queries[i].Query; + break; + } + } + } + catch (ServiceException e) + { + ed.WriteMessage("GetSavedQueries service request failed.\n"); + ed.WriteMessage(e.Message); + return null; + } + + if (query == null) + { + ed.WriteMessage("There is not an 'Item...' query.\n"); + } + + try + { + Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryInput[] savedQueryInput = new Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryInput[1]; + savedQueryInput[0] = new Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryInput(); + savedQueryInput[0].Query = query; + savedQueryInput[0].Entries = new String[] { "Name", "Item ID", "Type", "Owning User" }; + savedQueryInput[0].Values = new String[4]; + savedQueryInput[0].Values[0] = name; + savedQueryInput[0].Values[1] = item_id; + savedQueryInput[0].Values[2] = type; + savedQueryInput[0].Values[3] = owner; + + Teamcenter.Services.Strong.Query._2007_06.SavedQuery.ExecuteSavedQueriesResponse savedQueryResult = queryService.ExecuteSavedQueries(savedQueryInput); + + Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryResults found = savedQueryResult.ArrayOfResults[0]; + + ed.WriteMessage("Found Items:" + found.NumOfObjects + "\n"); + return found; + } + catch (ServiceException e) + { + ed.WriteMessage("ExecuteSavedQuery service request failed.\n"); + ed.WriteMessage(e.Message); + return null; + } + } + + public SavedQueryResults getSearchUser() + { + ImanQuery query = null; + SavedQueryService queryService = SavedQueryService.getService(Session.getConnection()); + try + { + GetSavedQueriesResponse savedQueries = queryService.GetSavedQueries(); + if (savedQueries.Queries.Length == 0) + { + ed.WriteMessage("There are no saved queries in the system.\n"); + } + for (int i = 0; i < savedQueries.Queries.Length; i++) + { + + if (savedQueries.Queries[i].Name.Equals("Admin - Employee Information")) + { + query = savedQueries.Queries[i].Query; + break; + } + } + } + catch (ServiceException e) + { + ed.WriteMessage("GetSavedQueries service request failed.\n"); + ed.WriteMessage(e.Message); + return null; + } + + if (query == null) + { + ed.WriteMessage("There is not an 'Admin - Employee Information' query.\n"); + } + + try + { + // Search for all Items, returning a maximum of 25 objects + Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryInput[] savedQueryInput = new Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryInput[1]; + savedQueryInput[0] = new Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryInput(); + savedQueryInput[0].Query = query; + savedQueryInput[0].Entries = new String[] { "User Id" }; + savedQueryInput[0].Values = new String[1]; + savedQueryInput[0].Values[0] = "*"; + + Teamcenter.Services.Strong.Query._2007_06.SavedQuery.ExecuteSavedQueriesResponse savedQueryResult = queryService.ExecuteSavedQueries(savedQueryInput); + + Teamcenter.Services.Strong.Query._2007_06.SavedQuery.SavedQueryResults found = savedQueryResult.ArrayOfResults[0]; + + ed.WriteMessage("Found Users:" + found.NumOfObjects + "\n"); + return found; + } + catch (ServiceException e) + { + ed.WriteMessage("ExecuteSavedQuery service request failed.\n"); + ed.WriteMessage(e.Message); + return null; + } + } + + } + +} diff --git a/模块化/MyTeamcenter_3/obj/Debug/DFHMAutocad.dll b/模块化/MyTeamcenter_3/obj/Debug/DFHMAutocad.dll new file mode 100644 index 0000000..6fcc86e Binary files /dev/null and b/模块化/MyTeamcenter_3/obj/Debug/DFHMAutocad.dll differ diff --git a/模块化/MyTeamcenter_3/obj/Debug/DFHMAutocad.pdb b/模块化/MyTeamcenter_3/obj/Debug/DFHMAutocad.pdb new file mode 100644 index 0000000..e91da71 Binary files /dev/null and b/模块化/MyTeamcenter_3/obj/Debug/DFHMAutocad.pdb differ diff --git a/模块化/MyTeamcenter_3/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache b/模块化/MyTeamcenter_3/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache new file mode 100644 index 0000000..69799fc Binary files /dev/null and b/模块化/MyTeamcenter_3/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache differ diff --git a/模块化/MyTeamcenter_3/obj/Debug/GenerateResource-ResGen.read.1.tlog b/模块化/MyTeamcenter_3/obj/Debug/GenerateResource-ResGen.read.1.tlog new file mode 100644 index 0000000..46b134b --- /dev/null +++ b/模块化/MyTeamcenter_3/obj/Debug/GenerateResource-ResGen.read.1.tlog @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/模块化/MyTeamcenter_3/obj/Debug/GenerateResource-ResGen.read.4.tlog b/模块化/MyTeamcenter_3/obj/Debug/GenerateResource-ResGen.read.4.tlog new file mode 100644 index 0000000..aa30573 Binary files /dev/null and b/模块化/MyTeamcenter_3/obj/Debug/GenerateResource-ResGen.read.4.tlog differ diff --git a/模块化/MyTeamcenter_3/obj/Debug/GenerateResource-ResGen.write.1.tlog b/模块化/MyTeamcenter_3/obj/Debug/GenerateResource-ResGen.write.1.tlog new file mode 100644 index 0000000..37bb4c1 Binary files /dev/null and b/模块化/MyTeamcenter_3/obj/Debug/GenerateResource-ResGen.write.1.tlog differ diff --git a/模块化/MyTeamcenter_3/obj/Debug/HelloTeamcenter.Properties.Resources.resources b/模块化/MyTeamcenter_3/obj/Debug/HelloTeamcenter.Properties.Resources.resources new file mode 100644 index 0000000..edbecf7 Binary files /dev/null and b/模块化/MyTeamcenter_3/obj/Debug/HelloTeamcenter.Properties.Resources.resources differ diff --git a/模块化/MyTeamcenter_3/obj/Debug/HelloTeamcenter.csproj.FileListAbsolute.txt b/模块化/MyTeamcenter_3/obj/Debug/HelloTeamcenter.csproj.FileListAbsolute.txt new file mode 100644 index 0000000..f0fe64a --- /dev/null +++ b/模块化/MyTeamcenter_3/obj/Debug/HelloTeamcenter.csproj.FileListAbsolute.txt @@ -0,0 +1,171 @@ +D:\soa_client\net\samples\HelloTeamcenter\bin\Debug\HelloTeamcenter.pdb +D:\soa_client\net\samples\HelloTeamcenter\bin\Debug\TcSoaClient.dll +D:\soa_client\net\samples\HelloTeamcenter\bin\Debug\TcSoaCommon.dll +D:\soa_client\net\samples\HelloTeamcenter\bin\Debug\TcSoaCoreStrong.dll +D:\soa_client\net\samples\HelloTeamcenter\bin\Debug\TcSoaCoreTypes.dll +D:\soa_client\net\samples\HelloTeamcenter\bin\Debug\TcSoaQueryStrong.dll +D:\soa_client\net\samples\HelloTeamcenter\bin\Debug\TcSoaQueryTypes.dll +D:\soa_client\net\samples\HelloTeamcenter\bin\Debug\TcSoaStrongModel.dll +D:\soa_client\net\samples\HelloTeamcenter\bin\Debug\Teamcenter_SSOloader.dll +D:\soa_client\net\samples\HelloTeamcenter\obj\Debug\ResolveAssemblyReference.cache +D:\soa_client\net\samples\HelloTeamcenter\obj\Debug\HelloTeamcenter.pdb +D:\soa_client\net\samples\HelloTeamcenter\bin\Debug\HelloTeamcenter.dll.config +D:\soa_client\net\samples\HelloTeamcenter\bin\Debug\HelloTeamcenter.dll +D:\soa_client\net\samples\HelloTeamcenter\bin\Debug\acdbmgd.dll +D:\soa_client\net\samples\HelloTeamcenter\bin\Debug\acmgd.dll +D:\soa_client\net\samples\HelloTeamcenter\bin\Debug\Autodesk.AutoCAD.Interop.Common.dll +D:\soa_client\net\samples\HelloTeamcenter\bin\Debug\Autodesk.AutoCAD.Interop.dll +D:\soa_client\net\samples\HelloTeamcenter\obj\Debug\HelloTeamcenter.dll +D:\HelloTeamcenter\bin\Debug\acdbmgd.dll +D:\HelloTeamcenter\bin\Debug\acmgd.dll +D:\HelloTeamcenter\bin\Debug\Autodesk.AutoCAD.Interop.Common.dll +D:\HelloTeamcenter\bin\Debug\Autodesk.AutoCAD.Interop.dll +D:\HelloTeamcenter\obj\Debug\ResolveAssemblyReference.cache +D:\HelloTeamcenter\obj\Debug\HelloTeamcenter.form.Login.resources +D:\HelloTeamcenter\obj\Debug\HelloTeamcenter.Properties.Resources.resources +D:\HelloTeamcenter\obj\Debug\HelloTeamcenter.csproj.GenerateResource.Cache +D:\HelloTeamcenter\obj\Debug\HelloTeamcenter.form.OpenFromTC.resources +D:\HelloTeamcenter\bin\Debug\TcSoaDocumentManagementStrong.dll +D:\HelloTeamcenter\bin\Debug\TcSoaDocumentManagementTypes.dll +D:\HelloTeamcenter\bin\Debug\log4net.dll +D:\HelloTeamcenter\bin\Debug\FCCNetClientProxyv80.dll +D:\HelloTeamcenter\bin\Debug\FMSNetTicketv80.dll +D:\HelloTeamcenter\bin\Debug\FSCNetClientProxyv80.dll +D:\HelloTeamcenter\bin\Debug\TcSoaFMS.dll +D:\HelloTeamcenter\bin\Debug\TcSoaAdministrationStrong.dll +D:\HelloTeamcenter\bin\Debug\TcSoaAdministrationTypes.dll +D:\HelloTeamcenter\bin\Debug\TcSoaAiStrong.dll +D:\HelloTeamcenter\bin\Debug\TcSoaAiTypes.dll +D:\HelloTeamcenter\bin\Debug\TcSoaAllocationsStrong.dll +D:\HelloTeamcenter\bin\Debug\TcSoaAllocationsTypes.dll +D:\HelloTeamcenter\bin\Debug\TcSoaAsbAsmAlignmentStrong.dll +D:\HelloTeamcenter\bin\Debug\TcSoaAsbAsmAlignmentTypes.dll +D:\HelloTeamcenter\bin\Debug\TcSoaAsBuiltStrong.dll +D:\HelloTeamcenter\bin\Debug\TcSoaAsBuiltTypes.dll +D:\HelloTeamcenter\bin\Debug\TcSoaAsMaintainedStrong.dll +D:\HelloTeamcenter\bin\Debug\TcSoaAsMaintainedTypes.dll +D:\HelloTeamcenter\bin\Debug\TcSoaAuthorizedDataAccessStrong.dll +D:\HelloTeamcenter\bin\Debug\TcSoaAuthorizedDataAccessTypes.dll +D:\HelloTeamcenter\bin\Debug\TcSoaBomStrong.dll +D:\HelloTeamcenter\bin\Debug\TcSoaBomTypes.dll +D:\HelloTeamcenter\bin\Debug\TcSoaBusinessModelerStrong.dll +D:\HelloTeamcenter\bin\Debug\TcSoaBusinessModelerTypes.dll +D:\HelloTeamcenter\bin\Debug\TcSoaCadBomAlignmentStrong.dll +D:\HelloTeamcenter\bin\Debug\TcSoaCadBomAlignmentTypes.dll +D:\HelloTeamcenter\bin\Debug\TcSoaCadStrong.dll +D:\HelloTeamcenter\bin\Debug\TcSoaCadTypes.dll +D:\HelloTeamcenter\bin\Debug\TcSoaCaeStrong.dll +D:\HelloTeamcenter\bin\Debug\TcSoaCaeTypes.dll +D:\HelloTeamcenter\bin\Debug\TcSoaCalendarManagementStrong.dll +D:\HelloTeamcenter\bin\Debug\TcSoaCalendarManagementTypes.dll +D:\HelloTeamcenter\bin\Debug\TcSoaChangeManagementStrong.dll +D:\HelloTeamcenter\bin\Debug\TcSoaChangeManagementTypes.dll +D:\HelloTeamcenter\bin\Debug\TcSoaClassificationStrong.dll +D:\HelloTeamcenter\bin\Debug\TcSoaClassificationTypes.dll +D:\HelloTeamcenter\bin\Debug\TcSoaConfigurationStrong.dll +D:\HelloTeamcenter\bin\Debug\TcSoaConfigurationTypes.dll +D:\HelloTeamcenter\bin\Debug\TcSoaGlobalMultiSiteStrong.dll +D:\HelloTeamcenter\bin\Debug\TcSoaGlobalMultiSiteTypes.dll +D:\HelloTeamcenter\bin\Debug\TcSoaImportExportStrong.dll +D:\HelloTeamcenter\bin\Debug\TcSoaImportExportTypes.dll +D:\HelloTeamcenter\bin\Debug\TcSoaIssueManagementStrong.dll +D:\HelloTeamcenter\bin\Debug\TcSoaIssueManagementTypes.dll +D:\HelloTeamcenter\bin\Debug\TcSoaManufacturingStrong.dll +D:\HelloTeamcenter\bin\Debug\TcSoaManufacturingTypes.dll +D:\HelloTeamcenter\bin\Debug\TcSoaMESStrong.dll +D:\HelloTeamcenter\bin\Debug\TcSoaMESTypes.dll +D:\HelloTeamcenter\bin\Debug\TcSoaMultisiteStrong.dll +D:\HelloTeamcenter\bin\Debug\TcSoaMultisiteTypes.dll +D:\HelloTeamcenter\bin\Debug\TcSoaParameterManagementStrong.dll +D:\HelloTeamcenter\bin\Debug\TcSoaParameterManagementTypes.dll +D:\HelloTeamcenter\bin\Debug\TcSoaProductionManagementStrong.dll +D:\HelloTeamcenter\bin\Debug\TcSoaProductionManagementTypes.dll +D:\HelloTeamcenter\bin\Debug\TcSoaProjectManagementStrong.dll +D:\HelloTeamcenter\bin\Debug\TcSoaProjectManagementTypes.dll +D:\HelloTeamcenter\bin\Debug\TcSoaRdvStrong.dll +D:\HelloTeamcenter\bin\Debug\TcSoaRdvTypes.dll +D:\HelloTeamcenter\bin\Debug\TcSoaReportsStrong.dll +D:\HelloTeamcenter\bin\Debug\TcSoaReportsTypes.dll +D:\HelloTeamcenter\bin\Debug\TcSoaRequirementsManagementStrong.dll +D:\HelloTeamcenter\bin\Debug\TcSoaRequirementsManagementTypes.dll +D:\HelloTeamcenter\bin\Debug\TcSoaSrmIntegrationStrong.dll +D:\HelloTeamcenter\bin\Debug\TcSoaSrmIntegrationTypes.dll +D:\HelloTeamcenter\bin\Debug\TcSoaStrongModelAcadGmo.dll +D:\HelloTeamcenter\bin\Debug\TcSoaStrongModelAdsFoundation.dll +D:\HelloTeamcenter\bin\Debug\TcSoaStrongModelAsBuilt.dll +D:\HelloTeamcenter\bin\Debug\TcSoaStrongModelAsMaintained.dll +D:\HelloTeamcenter\bin\Debug\TcSoaStrongModelBrndMgmt.dll +D:\HelloTeamcenter\bin\Debug\TcSoaStrongModelCba.dll +D:\HelloTeamcenter\bin\Debug\TcSoaStrongModelCcdm.dll +D:\HelloTeamcenter\bin\Debug\TcSoaStrongModelCm.dll +D:\HelloTeamcenter\bin\Debug\TcSoaStrongModelCmtEbop.dll +D:\HelloTeamcenter\bin\Debug\TcSoaStrongModelCmtEmserver.dll +D:\HelloTeamcenter\bin\Debug\TcSoaStrongModelCmtPadTwp.dll +D:\HelloTeamcenter\bin\Debug\TcSoaStrongModelContmgmtBase.dll +D:\HelloTeamcenter\bin\Debug\TcSoaStrongModelContmgmtDita.dll +D:\HelloTeamcenter\bin\Debug\TcSoaStrongModelContmgmtS1000d.dll +D:\HelloTeamcenter\bin\Debug\TcSoaStrongModelCpgMaterials.dll +D:\HelloTeamcenter\bin\Debug\TcSoaStrongModelDpv.dll +D:\HelloTeamcenter\bin\Debug\TcSoaStrongModelEdaLibrary.dll +D:\HelloTeamcenter\bin\Debug\TcSoaStrongModelEdaServer.dll +D:\HelloTeamcenter\bin\Debug\TcSoaStrongModelEmps.dll +D:\HelloTeamcenter\bin\Debug\TcSoaStrongModelEsddm.dll +D:\HelloTeamcenter\bin\Debug\TcSoaStrongModelEsddmScm.dll +D:\HelloTeamcenter\bin\Debug\TcSoaStrongModelEsmBase.dll +D:\HelloTeamcenter\bin\Debug\TcSoaStrongModelEsmProcessor.dll +D:\HelloTeamcenter\bin\Debug\TcSoaStrongModelEsmSoftware.dll +D:\HelloTeamcenter\bin\Debug\TcSoaStrongModelFpMgmt.dll +D:\HelloTeamcenter\bin\Debug\TcSoaStrongModelGmdpv.dll +D:\HelloTeamcenter\bin\Debug\TcSoaStrongModelGmo.dll +D:\HelloTeamcenter\bin\Debug\TcSoaStrongModelHrn.dll +D:\HelloTeamcenter\bin\Debug\TcSoaStrongModelIssueManagement.dll +D:\HelloTeamcenter\bin\Debug\TcSoaStrongModelMES.dll +D:\HelloTeamcenter\bin\Debug\TcSoaStrongModelMROCore.dll +D:\HelloTeamcenter\bin\Debug\TcSoaStrongModelPkgArt.dll +D:\HelloTeamcenter\bin\Debug\TcSoaStrongModelProductVariant.dll +D:\HelloTeamcenter\bin\Debug\TcSoaStrongModelScdt.dll +D:\HelloTeamcenter\bin\Debug\TcSoaStrongModelScmCc.dll +D:\HelloTeamcenter\bin\Debug\TcSoaStrongModelServiceEventManagement.dll +D:\HelloTeamcenter\bin\Debug\TcSoaStrongModelServiceProcessing.dll +D:\HelloTeamcenter\bin\Debug\TcSoaStrongModelServiceRequest.dll +D:\HelloTeamcenter\bin\Debug\TcSoaStrongModelSpecMgr.dll +D:\HelloTeamcenter\bin\Debug\TcSoaStrongModelTcae.dll +D:\HelloTeamcenter\bin\Debug\TcSoaStrongModelTransactionProcessing.dll +D:\HelloTeamcenter\bin\Debug\TcSoaStrongModelVendorManagement.dll +D:\HelloTeamcenter\bin\Debug\TcSoaStructureManagementStrong.dll +D:\HelloTeamcenter\bin\Debug\TcSoaStructureManagementTypes.dll +D:\HelloTeamcenter\bin\Debug\TcSoaSvcProcessingStrong.dll +D:\HelloTeamcenter\bin\Debug\TcSoaSvcProcessingTypes.dll +D:\HelloTeamcenter\bin\Debug\TcSoaSvcRequestStrong.dll +D:\HelloTeamcenter\bin\Debug\TcSoaSvcRequestTypes.dll +D:\HelloTeamcenter\bin\Debug\TcSoaTranslationStrong.dll +D:\HelloTeamcenter\bin\Debug\TcSoaTranslationTypes.dll +D:\HelloTeamcenter\bin\Debug\TcSoaValidationStrong.dll +D:\HelloTeamcenter\bin\Debug\TcSoaValidationTypes.dll +D:\HelloTeamcenter\bin\Debug\TcSoaVendorManagementStrong.dll +D:\HelloTeamcenter\bin\Debug\TcSoaVendorManagementTypes.dll +D:\HelloTeamcenter\bin\Debug\TcSoaWireHarnessStrong.dll +D:\HelloTeamcenter\bin\Debug\TcSoaWireHarnessTypes.dll +D:\HelloTeamcenter\bin\Debug\TcSoaWorkflowStrong.dll +D:\HelloTeamcenter\bin\Debug\TcSoaWorkflowTypes.dll +D:\HelloTeamcenter\bin\Debug\Teamcenter_SSO.dll +D:\HelloTeamcenter\bin\Debug\Teamcenter_SSOloader.dll +D:\HelloTeamcenter\obj\Debug\HelloTeamcenter.form.Search.resources +D:\HelloTeamcenter\obj\Debug\HelloTeamcenter.form.SaveToTC.resources +D:\HelloTeamcenter\bin\Debug\DFHMAutocad.dll.config +D:\HelloTeamcenter\bin\Debug\DFHMAutocad.dll +D:\HelloTeamcenter\bin\Debug\DFHMAutocad.pdb +D:\HelloTeamcenter\obj\Debug\DFHMAutocad.dll +D:\HelloTeamcenter\obj\Debug\DFHMAutocad.pdb +C:\Documents and Settings\Administrator\桌面\HelloTeamcenter\bin\Debug\DFHMAutocad.dll.config +C:\Documents and Settings\Administrator\桌面\HelloTeamcenter\bin\Debug\DFHMAutocad.dll +C:\Documents and Settings\Administrator\桌面\HelloTeamcenter\bin\Debug\DFHMAutocad.pdb +C:\Documents and Settings\Administrator\桌面\HelloTeamcenter\obj\Debug\ResolveAssemblyReference.cache +C:\Documents and Settings\Administrator\桌面\HelloTeamcenter\obj\Debug\HelloTeamcenter.form.Login.resources +C:\Documents and Settings\Administrator\桌面\HelloTeamcenter\obj\Debug\HelloTeamcenter.form.OpenFromTC.resources +C:\Documents and Settings\Administrator\桌面\HelloTeamcenter\obj\Debug\HelloTeamcenter.form.SaveToTC.resources +C:\Documents and Settings\Administrator\桌面\HelloTeamcenter\obj\Debug\HelloTeamcenter.form.Search.resources +C:\Documents and Settings\Administrator\桌面\HelloTeamcenter\obj\Debug\HelloTeamcenter.Properties.Resources.resources +C:\Documents and Settings\Administrator\桌面\HelloTeamcenter\obj\Debug\HelloTeamcenter.csproj.GenerateResource.Cache +C:\Documents and Settings\Administrator\桌面\HelloTeamcenter\obj\Debug\DFHMAutocad.dll +C:\Documents and Settings\Administrator\桌面\HelloTeamcenter\obj\Debug\DFHMAutocad.pdb diff --git a/模块化/MyTeamcenter_3/obj/Debug/HelloTeamcenter.csproj.GenerateResource.Cache b/模块化/MyTeamcenter_3/obj/Debug/HelloTeamcenter.csproj.GenerateResource.Cache new file mode 100644 index 0000000..1c5d1ad Binary files /dev/null and b/模块化/MyTeamcenter_3/obj/Debug/HelloTeamcenter.csproj.GenerateResource.Cache differ diff --git a/模块化/MyTeamcenter_3/obj/Debug/HelloTeamcenter.form.Login.resources b/模块化/MyTeamcenter_3/obj/Debug/HelloTeamcenter.form.Login.resources new file mode 100644 index 0000000..06c24d0 Binary files /dev/null and b/模块化/MyTeamcenter_3/obj/Debug/HelloTeamcenter.form.Login.resources differ diff --git a/模块化/MyTeamcenter_3/obj/Debug/HelloTeamcenter.form.OpenFromTC.resources b/模块化/MyTeamcenter_3/obj/Debug/HelloTeamcenter.form.OpenFromTC.resources new file mode 100644 index 0000000..61253c5 Binary files /dev/null and b/模块化/MyTeamcenter_3/obj/Debug/HelloTeamcenter.form.OpenFromTC.resources differ diff --git a/模块化/MyTeamcenter_3/obj/Debug/HelloTeamcenter.form.SaveToTC.resources b/模块化/MyTeamcenter_3/obj/Debug/HelloTeamcenter.form.SaveToTC.resources new file mode 100644 index 0000000..7ae2447 Binary files /dev/null and b/模块化/MyTeamcenter_3/obj/Debug/HelloTeamcenter.form.SaveToTC.resources differ diff --git a/模块化/MyTeamcenter_3/obj/Debug/HelloTeamcenter.form.Search.resources b/模块化/MyTeamcenter_3/obj/Debug/HelloTeamcenter.form.Search.resources new file mode 100644 index 0000000..7ae2447 Binary files /dev/null and b/模块化/MyTeamcenter_3/obj/Debug/HelloTeamcenter.form.Search.resources differ diff --git a/模块化/MyTeamcenter_3/obj/Debug/MyTeamcenter.csproj.FileListAbsolute.txt b/模块化/MyTeamcenter_3/obj/Debug/MyTeamcenter.csproj.FileListAbsolute.txt new file mode 100644 index 0000000..a07e86d --- /dev/null +++ b/模块化/MyTeamcenter_3/obj/Debug/MyTeamcenter.csproj.FileListAbsolute.txt @@ -0,0 +1,36 @@ +C:\Users\Administrator\Desktop\MyTeamcenter\obj\Debug\ResolveAssemblyReference.cache +C:\Users\Administrator\Desktop\MyTeamcenter\obj\Debug\HelloTeamcenter.form.Login.resources +C:\Users\Administrator\Desktop\MyTeamcenter\obj\Debug\HelloTeamcenter.form.OpenFromTC.resources +C:\Users\Administrator\Desktop\MyTeamcenter\obj\Debug\HelloTeamcenter.form.SaveToTC.resources +C:\Users\Administrator\Desktop\MyTeamcenter\obj\Debug\HelloTeamcenter.form.Search.resources +C:\Users\Administrator\Desktop\MyTeamcenter\obj\Debug\HelloTeamcenter.Properties.Resources.resources +C:\Users\Administrator\Desktop\MyTeamcenter\obj\Debug\MyTeamcenter.csproj.GenerateResource.Cache +C:\Users\Administrator\Desktop\MyTeamcenter\bin\Debug\DFHMAutocad.dll.config +C:\Users\Administrator\Desktop\MyTeamcenter\bin\Debug\DFHMAutocad.dll +C:\Users\Administrator\Desktop\MyTeamcenter\bin\Debug\DFHMAutocad.pdb +C:\Users\Administrator\Desktop\MyTeamcenter\obj\Debug\DFHMAutocad.dll +C:\Users\Administrator\Desktop\MyTeamcenter\obj\Debug\DFHMAutocad.pdb +C:\Users\Administrator\Desktop\MyTeamcenter_3\bin\Debug\DFHMAutocad.dll.config +C:\Users\Administrator\Desktop\MyTeamcenter_3\bin\Debug\DFHMAutocad.dll +C:\Users\Administrator\Desktop\MyTeamcenter_3\bin\Debug\DFHMAutocad.pdb +C:\Users\Administrator\Desktop\MyTeamcenter_3\obj\Debug\ResolveAssemblyReference.cache +C:\Users\Administrator\Desktop\MyTeamcenter_3\obj\Debug\HelloTeamcenter.form.Login.resources +C:\Users\Administrator\Desktop\MyTeamcenter_3\obj\Debug\HelloTeamcenter.form.OpenFromTC.resources +C:\Users\Administrator\Desktop\MyTeamcenter_3\obj\Debug\HelloTeamcenter.form.SaveToTC.resources +C:\Users\Administrator\Desktop\MyTeamcenter_3\obj\Debug\HelloTeamcenter.form.Search.resources +C:\Users\Administrator\Desktop\MyTeamcenter_3\obj\Debug\HelloTeamcenter.Properties.Resources.resources +C:\Users\Administrator\Desktop\MyTeamcenter_3\obj\Debug\MyTeamcenter.csproj.GenerateResource.Cache +C:\Users\Administrator\Desktop\MyTeamcenter_3\obj\Debug\DFHMAutocad.dll +C:\Users\Administrator\Desktop\MyTeamcenter_3\obj\Debug\DFHMAutocad.pdb +C:\Documents and Settings\sunx\桌面\MyTeamcenter_3\bin\Debug\DFHMAutocad.dll.config +C:\Documents and Settings\sunx\桌面\MyTeamcenter_3\bin\Debug\DFHMAutocad.dll +C:\Documents and Settings\sunx\桌面\MyTeamcenter_3\bin\Debug\DFHMAutocad.pdb +C:\Documents and Settings\sunx\桌面\MyTeamcenter_3\obj\Debug\ResolveAssemblyReference.cache +C:\Documents and Settings\sunx\桌面\MyTeamcenter_3\obj\Debug\HelloTeamcenter.form.Login.resources +C:\Documents and Settings\sunx\桌面\MyTeamcenter_3\obj\Debug\HelloTeamcenter.form.OpenFromTC.resources +C:\Documents and Settings\sunx\桌面\MyTeamcenter_3\obj\Debug\HelloTeamcenter.form.SaveToTC.resources +C:\Documents and Settings\sunx\桌面\MyTeamcenter_3\obj\Debug\HelloTeamcenter.form.Search.resources +C:\Documents and Settings\sunx\桌面\MyTeamcenter_3\obj\Debug\HelloTeamcenter.Properties.Resources.resources +C:\Documents and Settings\sunx\桌面\MyTeamcenter_3\obj\Debug\MyTeamcenter.csproj.GenerateResource.Cache +C:\Documents and Settings\sunx\桌面\MyTeamcenter_3\obj\Debug\DFHMAutocad.dll +C:\Documents and Settings\sunx\桌面\MyTeamcenter_3\obj\Debug\DFHMAutocad.pdb diff --git a/模块化/MyTeamcenter_3/obj/Debug/MyTeamcenter.csproj.GenerateResource.Cache b/模块化/MyTeamcenter_3/obj/Debug/MyTeamcenter.csproj.GenerateResource.Cache new file mode 100644 index 0000000..5fa6d05 Binary files /dev/null and b/模块化/MyTeamcenter_3/obj/Debug/MyTeamcenter.csproj.GenerateResource.Cache differ diff --git a/模块化/MyTeamcenter_3/obj/Debug/ResolveAssemblyReference.cache b/模块化/MyTeamcenter_3/obj/Debug/ResolveAssemblyReference.cache new file mode 100644 index 0000000..d13f7ea Binary files /dev/null and b/模块化/MyTeamcenter_3/obj/Debug/ResolveAssemblyReference.cache differ diff --git a/模块化/MyTeamcenter_3/obj/Debug/TempPE/Properties.Resources.Designer.cs.dll b/模块化/MyTeamcenter_3/obj/Debug/TempPE/Properties.Resources.Designer.cs.dll new file mode 100644 index 0000000..456f7f8 Binary files /dev/null and b/模块化/MyTeamcenter_3/obj/Debug/TempPE/Properties.Resources.Designer.cs.dll differ diff --git a/模块化/MyTeamcenter_3/obj/Release/DesignTimeResolveAssemblyReferencesInput.cache b/模块化/MyTeamcenter_3/obj/Release/DesignTimeResolveAssemblyReferencesInput.cache new file mode 100644 index 0000000..52490af Binary files /dev/null and b/模块化/MyTeamcenter_3/obj/Release/DesignTimeResolveAssemblyReferencesInput.cache differ diff --git a/模块化/MyTeamcenter_3/obj/Release/GenerateResource-ResGen.read.1.tlog b/模块化/MyTeamcenter_3/obj/Release/GenerateResource-ResGen.read.1.tlog new file mode 100644 index 0000000..46b134b --- /dev/null +++ b/模块化/MyTeamcenter_3/obj/Release/GenerateResource-ResGen.read.1.tlog @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/模块化/MyTeamcenter_3/obj/Release/GenerateResource-ResGen.read.4.tlog b/模块化/MyTeamcenter_3/obj/Release/GenerateResource-ResGen.read.4.tlog new file mode 100644 index 0000000..aa30573 Binary files /dev/null and b/模块化/MyTeamcenter_3/obj/Release/GenerateResource-ResGen.read.4.tlog differ diff --git a/模块化/MyTeamcenter_3/obj/Release/GenerateResource-ResGen.write.1.tlog b/模块化/MyTeamcenter_3/obj/Release/GenerateResource-ResGen.write.1.tlog new file mode 100644 index 0000000..9494fc9 Binary files /dev/null and b/模块化/MyTeamcenter_3/obj/Release/GenerateResource-ResGen.write.1.tlog differ diff --git a/模块化/MyTeamcenter_3/obj/Release/HelloTeamcenter.Properties.Resources.resources b/模块化/MyTeamcenter_3/obj/Release/HelloTeamcenter.Properties.Resources.resources new file mode 100644 index 0000000..edbecf7 Binary files /dev/null and b/模块化/MyTeamcenter_3/obj/Release/HelloTeamcenter.Properties.Resources.resources differ diff --git a/模块化/MyTeamcenter_3/obj/Release/HelloTeamcenter.csproj.FileListAbsolute.txt b/模块化/MyTeamcenter_3/obj/Release/HelloTeamcenter.csproj.FileListAbsolute.txt new file mode 100644 index 0000000..df57a85 --- /dev/null +++ b/模块化/MyTeamcenter_3/obj/Release/HelloTeamcenter.csproj.FileListAbsolute.txt @@ -0,0 +1,9 @@ +C:\Documents and Settings\Administrator\桌面\HelloTeamcenter\obj\Release\ResolveAssemblyReference.cache +C:\Documents and Settings\Administrator\桌面\HelloTeamcenter\obj\Release\HelloTeamcenter.form.Login.resources +C:\Documents and Settings\Administrator\桌面\HelloTeamcenter\obj\Release\HelloTeamcenter.form.OpenFromTC.resources +C:\Documents and Settings\Administrator\桌面\HelloTeamcenter\obj\Release\HelloTeamcenter.form.SaveToTC.resources +C:\Documents and Settings\Administrator\桌面\HelloTeamcenter\obj\Release\HelloTeamcenter.form.Search.resources +C:\Documents and Settings\Administrator\桌面\HelloTeamcenter\obj\Release\HelloTeamcenter.Properties.Resources.resources +C:\Documents and Settings\Administrator\桌面\HelloTeamcenter\obj\Release\GenerateResource-ResGen.read.4.tlog +C:\Documents and Settings\Administrator\桌面\HelloTeamcenter\obj\Release\GenerateResource-ResGen.read.1.tlog +C:\Documents and Settings\Administrator\桌面\HelloTeamcenter\obj\Release\GenerateResource-ResGen.write.1.tlog diff --git a/模块化/MyTeamcenter_3/obj/Release/HelloTeamcenter.form.Login.resources b/模块化/MyTeamcenter_3/obj/Release/HelloTeamcenter.form.Login.resources new file mode 100644 index 0000000..06c24d0 Binary files /dev/null and b/模块化/MyTeamcenter_3/obj/Release/HelloTeamcenter.form.Login.resources differ diff --git a/模块化/MyTeamcenter_3/obj/Release/HelloTeamcenter.form.OpenFromTC.resources b/模块化/MyTeamcenter_3/obj/Release/HelloTeamcenter.form.OpenFromTC.resources new file mode 100644 index 0000000..1c5025d Binary files /dev/null and b/模块化/MyTeamcenter_3/obj/Release/HelloTeamcenter.form.OpenFromTC.resources differ diff --git a/模块化/MyTeamcenter_3/obj/Release/HelloTeamcenter.form.SaveToTC.resources b/模块化/MyTeamcenter_3/obj/Release/HelloTeamcenter.form.SaveToTC.resources new file mode 100644 index 0000000..1c5025d Binary files /dev/null and b/模块化/MyTeamcenter_3/obj/Release/HelloTeamcenter.form.SaveToTC.resources differ diff --git a/模块化/MyTeamcenter_3/obj/Release/HelloTeamcenter.form.Search.resources b/模块化/MyTeamcenter_3/obj/Release/HelloTeamcenter.form.Search.resources new file mode 100644 index 0000000..1c5025d Binary files /dev/null and b/模块化/MyTeamcenter_3/obj/Release/HelloTeamcenter.form.Search.resources differ diff --git a/模块化/MyTeamcenter_3/obj/Release/TempPE/Properties.Resources.Designer.cs.dll b/模块化/MyTeamcenter_3/obj/Release/TempPE/Properties.Resources.Designer.cs.dll new file mode 100644 index 0000000..f43064e Binary files /dev/null and b/模块化/MyTeamcenter_3/obj/Release/TempPE/Properties.Resources.Designer.cs.dll differ diff --git a/模块化/MyTeamcenter_3/obj/Release/build.force b/模块化/MyTeamcenter_3/obj/Release/build.force new file mode 100644 index 0000000..e69de29 diff --git a/模块化/MyTeamcenter_3/res/FOLDER.ICO b/模块化/MyTeamcenter_3/res/FOLDER.ICO new file mode 100644 index 0000000..5ef86b9 Binary files /dev/null and b/模块化/MyTeamcenter_3/res/FOLDER.ICO differ diff --git a/模块化/MyTeamcenter_3/res/FOLDEROP.ICO b/模块化/MyTeamcenter_3/res/FOLDEROP.ICO new file mode 100644 index 0000000..33123f5 Binary files /dev/null and b/模块化/MyTeamcenter_3/res/FOLDEROP.ICO differ diff --git a/模块化/MyTeamcenter_3/res/Newstuff_Folder.png b/模块化/MyTeamcenter_3/res/Newstuff_Folder.png new file mode 100644 index 0000000..55c4ba5 Binary files /dev/null and b/模块化/MyTeamcenter_3/res/Newstuff_Folder.png differ diff --git a/模块化/MyTeamcenter_3/res/autocad_01.ico b/模块化/MyTeamcenter_3/res/autocad_01.ico new file mode 100644 index 0000000..60e932a Binary files /dev/null and b/模块化/MyTeamcenter_3/res/autocad_01.ico differ diff --git a/模块化/MyTeamcenter_3/res/item.ico b/模块化/MyTeamcenter_3/res/item.ico new file mode 100644 index 0000000..ef9ef7e Binary files /dev/null and b/模块化/MyTeamcenter_3/res/item.ico differ diff --git a/模块化/MyTeamcenter_3/res/itemrev.ico b/模块化/MyTeamcenter_3/res/itemrev.ico new file mode 100644 index 0000000..31f1b57 Binary files /dev/null and b/模块化/MyTeamcenter_3/res/itemrev.ico differ diff --git a/模块化/MyTeamcenter_3/res/login.bmp b/模块化/MyTeamcenter_3/res/login.bmp new file mode 100644 index 0000000..9f0ea9e Binary files /dev/null and b/模块化/MyTeamcenter_3/res/login.bmp differ diff --git a/模块化/MyTeamcenter_3/res/mail.ico b/模块化/MyTeamcenter_3/res/mail.ico new file mode 100644 index 0000000..39fdbcd Binary files /dev/null and b/模块化/MyTeamcenter_3/res/mail.ico differ diff --git a/模块化/MyTeamcenter_3/res/tai.ico b/模块化/MyTeamcenter_3/res/tai.ico new file mode 100644 index 0000000..aa14181 Binary files /dev/null and b/模块化/MyTeamcenter_3/res/tai.ico differ diff --git a/模块化/TEST.xml b/模块化/TEST.xml new file mode 100644 index 0000000..5599754 --- /dev/null +++ b/模块化/TEST.xml @@ -0,0 +1,3 @@ + + +CSDN]]> \ No newline at end of file diff --git a/模块化/数据集.xml b/模块化/数据集.xml new file mode 100644 index 0000000..e4b6560 --- /dev/null +++ b/模块化/数据集.xml @@ -0,0 +1,21 @@ + + + + + + + <_1 seq="1" from="DFHM_BTL.ͼ"/> + <_2 seq="2" from="DFHM_BTL.ڼҳ"/> + + \ No newline at end of file diff --git a/模块化/明细表.xml b/模块化/明细表.xml new file mode 100644 index 0000000..3c6d253 --- /dev/null +++ b/模块化/明细表.xml @@ -0,0 +1,31 @@ + + + + + + <_1 type="bomline" cad="" tc="bl_sequence_no" is_bomline="1" overwrite="1" visiable="1" /> + <_2 type="Item" cad="ͼ" tc="item_id" is_bomline="0" overwrite="1" visiable="1" /> + <_3 type="Item" cad="" tc="object_name" is_bomline="0" overwrite="0" visiable="1" /> + <_4 type="bomline" cad="" tc="bl_quantity" is_bomline="1" overwrite="1" visiable="1" /> + <_5 type="bomline" cad="ע" tc="D5DesignNote_bl" is_bomline="1" overwrite="1" visiable="1" /> + <_6 type="bomline" cad="" tc="D5TotalWeight" is_bomline="1" overwrite="1" visiable="1" /> + <_7 type="Form" cad="" tc="" is_bomline="0" overwrite="1" visiable="" /> + + + diff --git a/模块化/标题栏.xml b/模块化/标题栏.xml new file mode 100644 index 0000000..b978a8e --- /dev/null +++ b/模块化/标题栏.xml @@ -0,0 +1,38 @@ + + + + + <!-- + author : raywei + date : 2012-8-16 + 介绍 (注:以下每个属性都是必须配置): + 1、tpye : 设置属性对应TC系统中的类型 只匹配Item、ItemRevision、Form,配置其他类型无效,并可能出现程序中断 + 2、cad : 在CAD标题栏中属性名称 此项是配置CAD图纸中属性的名称 + 3、tc : 与CAD属性对应的在TC系统中的属性名称 此项是配置与CAD图纸属性名称相对应的TC系统里的属性名 + 4、writeable : 表示此属性在TC系统中是否能够手动更新,例item_id不能够修改,则writeable=“0” + 5、updateable: 表示是否需要更新系统中的信息,前提是writeable必须为1 + --> + + <!-- + 补充说明: + 1、配置中一定要有配置tc="item_id",用于与TC系统交互的唯一标识,例:<_1 type="Item" cad="图号" tc="item_id" writeable="0"/> 如果此项没有配置,则系统中断 + 2、如果没有配置item_revision_id,则系统处理的是最新的版本,如果配置,则匹配到对应的版本 + --> + + <!--设置Item相关属性--> + <_1 type="Item" cad="图号" tc="item_id" writeable="0" updateable="0" fromtc="0"/> + <_2 type="Item" cad="零/部件名称" tc="object_name" writeable="1" updateable="0" fromtc="1"/> + + <!--设置ItemRevision相关属性--> + <_3 type="ItemRevision" cad="版本" tc="item_revision_id" writeable="1" updateable="0" fromtc="0"/> + + <!--设置Form相关属性--> + <_4 type="Form" cad="材料" tc="d5MaterialGrade" writeable="1" updateable="1" fromtc="1"/> + <_5 type="Form" cad="代号" tc="d5PartNumber" writeable="1" updateable="1" fromtc="1"/> + <_6 type="Form" cad="比例" tc="d5Proportion" writeable="1" updateable="1" fromtc="1"/> + <_7 type="Form" cad="图幅" tc="d5Mapsheet" writeable="1" updateable="1" fromtc="1"/> + <_8 type="Form" cad="重量" tc="d5SingleWeight" writeable="1" updateable="1" fromtc="1"/> + + diff --git a/模块化/规则.xml b/模块化/规则.xml new file mode 100644 index 0000000..b2985aa --- /dev/null +++ b/模块化/规则.xml @@ -0,0 +1,51 @@ + + + + + + + <_1 seq="1" source="ͼ" contain="DR" true="2" false="3"/> + <_2 seq="2" source="" contain="DR8" true="9" false="10" /> + <_3 seq="3" source="" startwith="104" true="4" false="5"/> + <_4 seq="4" source="" type="D5StdFasteners"/> + <_5 seq="5" source="" startwith="105" true="4" false="6"/> + <_6 seq="6" source="" startwith="TC" true="7" false="8"/> + <_7 seq="7" source="" type="D5CommonParts" /> + <_8 seq="8" source="" type="D5Part" /> + <_9 seq="9" source="" contain="CG-" true="11" false="10"/> + <_10 seq="10" source="" contain="DR80" true="17" false="14" /> + <_11 seq="11" source="" type="D5PruchasePart"/> + <_12 seq="12" source="" equal="װ" true="13" /> + <_13 seq="13" source="" type="D5Product" /> + <_14 seq="14" source="" equal="װ" true="15" false="16"/> + <_15 seq="15" source="" type="D5AsmPart" /> + <_16 seq="16" source="" type="D5Part" /> + + <_17 seq="17" source="" endwith="0" true="12" /> + + + +