|
|
//==================================================
|
|
|
//
|
|
|
// @<COPYRIGHT>@
|
|
|
//
|
|
|
//==================================================
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
//<2F><><EFBFBD>ڼ<EFBFBD>¼Item<65><6D><EFBFBD><EFBFBD>.xml<6D>ļ<EFBFBD><C4BC>ж<EFBFBD>Ӧ<EFBFBD><D3A6>Item<65><6D><EFBFBD><EFBFBD>
|
|
|
static OriginItemType originitemtype;
|
|
|
|
|
|
static string xmlpath = "";
|
|
|
|
|
|
public static Dictionary<string, string> pathType;
|
|
|
public static List<string> puidList;
|
|
|
|
|
|
public void getFilePuid()
|
|
|
{
|
|
|
if (puidList == null)
|
|
|
{
|
|
|
puidList = new List<string>();
|
|
|
|
|
|
}
|
|
|
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("<22><><EFBFBD><EFBFBD>" + path);
|
|
|
DirectoryInfo folderInfo = new DirectoryInfo(path);
|
|
|
FileInfo[] fileInfos = folderInfo.GetFiles();
|
|
|
if (fileInfos != null)
|
|
|
{
|
|
|
ed.WriteMessage("<22>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>=" + 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("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> " + dwgType);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
ed.WriteMessage(puidList.Count + "");
|
|
|
ed.WriteMessage("<22><><EFBFBD><EFBFBD> " + dwgType);
|
|
|
}
|
|
|
sr.Close();
|
|
|
File.Delete(fileInfo.FullName);
|
|
|
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
ed.WriteMessage("<22>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>NULL");
|
|
|
}
|
|
|
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
ed.WriteMessage("<22><><EFBFBD><EFBFBD>" + path);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
public void Initialize()
|
|
|
{
|
|
|
//addComtextMenu();
|
|
|
}
|
|
|
public void Terminate()
|
|
|
{
|
|
|
|
|
|
}
|
|
|
[CommandMethod("SET_PATH_TYPE")]
|
|
|
public void setPathType()
|
|
|
{
|
|
|
if (pathType == null)
|
|
|
{
|
|
|
pathType = new Dictionary<string, string>();
|
|
|
}
|
|
|
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);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
*<2A><>¼
|
|
|
*/
|
|
|
[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("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ:\n" + "ͼ<>ţ<EFBFBD>" + titleinfo.Item_id.ToString());
|
|
|
|
|
|
//<2F><>ȡ<EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>
|
|
|
//OriginTool origintool = new OriginTool();
|
|
|
//xmlpath = System.Environment.CurrentDirectory;
|
|
|
xmlpath = System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase;
|
|
|
ed.WriteMessage("<22><>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>·<EFBFBD><C2B7>:" + 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("<22><>¼:" + loginfrom.m_WebAddress + "--" + loginfrom.username + "---" + loginfrom.password + "\n");
|
|
|
string address = loginfrom.m_WebAddress;
|
|
|
session = new Session(address);
|
|
|
ed.WriteMessage("<22><><EFBFBD>ӷ<EFBFBD><D3B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>\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("<22><>¼<EFBFBD>ɹ<EFBFBD>\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();
|
|
|
}
|
|
|
|
|
|
//<2F>ӷ<EFBFBD><D3B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˻<EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>xml<6D>ļ<EFBFBD>
|
|
|
OriginTool origintool = new OriginTool();
|
|
|
|
|
|
// bool hasxmlfile = origintool.checkxml(xmlpath);
|
|
|
bool hasxmlfile = true;
|
|
|
if (hasxmlfile)//
|
|
|
{
|
|
|
//DialogResult hasresult = MessageBox.Show("<22><>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>Ŀ¼<C4BF>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD><EFBFBD>XML<4D><4C><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD>", "<22><>ʾ", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
|
|
|
//if (hasresult == DialogResult.No || hasresult == DialogResult.None)
|
|
|
//{
|
|
|
// ed.WriteMessage("<22><><EFBFBD><EFBFBD>XML<4D><4C><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>ͬ<EFBFBD><CDAC>\n");
|
|
|
//}
|
|
|
//if (hasresult == DialogResult.Yes)
|
|
|
//{
|
|
|
// Hashtable prevalues = origintool.getTCPreferences("OriginXMLFile");
|
|
|
// if (prevalues != null && prevalues.Count > 0)
|
|
|
// {
|
|
|
// foreach (DictionaryEntry de in prevalues)
|
|
|
// {
|
|
|
// List<string> 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ϵͳ<CFB5><CDB3><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȷ<EFBFBD><C8B7>\n");
|
|
|
// return;
|
|
|
// }
|
|
|
// else
|
|
|
// {
|
|
|
// Item dmtitem = found.Objects[0] as Item;
|
|
|
// if (!origintool.downloadfile(dmtitem, xmlpath))
|
|
|
// {
|
|
|
// ed.WriteMessage("<22><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
// return;
|
|
|
// }
|
|
|
// }
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
//}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
MessageBox.Show("<22>Բ<EFBFBD><D4B2>𣬵<EFBFBD>¼ʧ<C2BC>ܣ<EFBFBD><DCA3><EFBFBD>ȷ<EFBFBD><C8B7>");
|
|
|
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("<22>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>µ<EFBFBD>¼");
|
|
|
// 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<ALLOBJECT> datasetlist = this.openfrom.datasetlist;
|
|
|
foreach (ALLOBJECT perobject in datasetlist)
|
|
|
{
|
|
|
if (perobject.treenode.Equals(nownode))
|
|
|
{
|
|
|
this.openfrom.textBox1.Text = perobject.name;
|
|
|
DialogResult isopen = MessageBox.Show("<22><><EFBFBD>Ƿ<EFBFBD>ȷ<EFBFBD><C8B7><EFBFBD><EFBFBD>ͼֽ<CDBC><D6BD>", "<22><>ʾ", 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("<22><>û<EFBFBD><C3BB><EFBFBD><EFBFBD>Ȩ<EFBFBD>ޣ<EFBFBD><DEA3>Ƿ<EFBFBD><C7B7><EFBFBD>ֻ<EFBFBD><D6BB><EFBFBD><EFBFBD>ʽ<EFBFBD><EFBFBD>", "<22><>ʾ", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
|
|
|
if (moresult == DialogResult.Yes)
|
|
|
{
|
|
|
hasRight = false;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
if (mydateset.Is_modifiable)
|
|
|
{
|
|
|
DialogResult moresult = MessageBox.Show("<22>Ƿ<EFBFBD>ǩ<EFBFBD><C7A9><EFBFBD><EFBFBD>", "<22><>ʾ", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
|
|
|
if (moresult == DialogResult.Yes)
|
|
|
{
|
|
|
if (mydateset.Checked_out == "Y")
|
|
|
{
|
|
|
MessageBox.Show("<22>Բ<EFBFBD><D4B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>ǩ<EFBFBD><C7A9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȷ<EFBFBD><C8B7><EFBFBD>ļ<EFBFBD>ǩ<EFBFBD><C7A9><EFBFBD><EFBFBD>ִ<EFBFBD>д˲<D0B4><CBB2><EFBFBD>");
|
|
|
return;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
ModelObject[] dataobj = { mydateset };
|
|
|
res.Checkout(dataobj, "", "");
|
|
|
ed1.WriteMessage("<22>ļ<EFBFBD><C4BC><EFBFBD>ǩ<EFBFBD><C7A9>");
|
|
|
ed1.WriteMessage("\n");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
ModelObject[] dsfilevec = mydateset.Ref_list;
|
|
|
|
|
|
ed1.WriteMessage("<22><><EFBFBD><EFBFBD>:" + 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("·<><C2B7>:" + dsfile.Relative_directory_path + "\n");
|
|
|
ed1.WriteMessage("<22>ļ<EFBFBD><C4BC><EFBFBD>:" + 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("<22><><EFBFBD><EFBFBD>" + ticket.Key + "\n" + "ֵ<><D6B5>" + 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("<22>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>" + 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("<22><><EFBFBD><EFBFBD>·<EFBFBD><C2B7><EFBFBD><EFBFBD>" + 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("<22>Բ<EFBFBD><D4B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><C3BB><EFBFBD>ʱĿ¼<C4BF>²<EFBFBD><C2B2><EFBFBD><EFBFBD>ڴ<EFBFBD><DAB4>ļ<EFBFBD>\n");
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
ed1.WriteMessage("<22><>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD>ȷ<EFBFBD><C8B7><EFBFBD><EFBFBD><EFBFBD>ݼ<EFBFBD><DDBC><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
MessageBox.Show("<22><>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD>ȷ<EFBFBD><C8B7><EFBFBD><EFBFBD><EFBFBD>ݼ<EFBFBD><DDBC><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
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));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
*<2A><><EFBFBD><EFBFBD>
|
|
|
*/
|
|
|
[CommandMethod("SAVE_AS")]
|
|
|
public void saveas()
|
|
|
{
|
|
|
savetotc();
|
|
|
}
|
|
|
/// <summary>
|
|
|
/// <20>ϴ<EFBFBD>PDF<44><46>TC
|
|
|
///
|
|
|
///
|
|
|
/// </summary>
|
|
|
/// <param name="rev"><3E>汾</param>
|
|
|
/// <param name="pdfPath">PDF<44><46><EFBFBD><EFBFBD><EFBFBD><EFBFBD>·<EFBFBD><C2B7></param>
|
|
|
/// <param name="pdfDatasetType">PDF<44><46><EFBFBD>ݼ<EFBFBD><DDBC><EFBFBD><EFBFBD><EFBFBD></param>
|
|
|
/// <param name="pdfDatasetReferenceName">PDF<44><46><EFBFBD>ݼ<EFBFBD><DDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD></param>
|
|
|
public void savePDFToTC(ItemRevision itemRev, String pdfPath, String pdfName, String pdfDatasetType, String pdfDatasetReferenceName)
|
|
|
{
|
|
|
DataManagementService dmService = DataManagementService.getService(Session.getConnection());
|
|
|
//CAD<41><44><EFBFBD><EFBFBD>̨
|
|
|
Editor cadEditor = ZwSoft.ZwCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
|
|
|
//PDF<44><46><EFBFBD>ݼ<EFBFBD>
|
|
|
Dataset pdfDataset = null;
|
|
|
Dataset dwgDataset = null;
|
|
|
String filename = null;
|
|
|
bool findDateset = false;
|
|
|
bool findDwgDataset = false;
|
|
|
bool neworupdate = false;
|
|
|
//<2F><><EFBFBD><EFBFBD>dwg<77><67><EFBFBD>ݼ<EFBFBD>
|
|
|
cadEditor.WriteMessage("<22><>ʼ<EFBFBD><CABC><EFBFBD>ҵ<EFBFBD>DWG<57><47><EFBFBD>ݼ<EFBFBD>\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];
|
|
|
//<2F><><EFBFBD>ݼ<EFBFBD><DDBC><EFBFBD><EFBFBD><EFBFBD>
|
|
|
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("<22>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD>ƣ<EFBFBD>" + ds_name + "\n");
|
|
|
if (ds_name == pdfName)
|
|
|
{
|
|
|
findDwgDataset = true;
|
|
|
dwgDataset = otherSideData.OtherSideObjects[m] as Dataset;
|
|
|
cadEditor.WriteMessage("<22>ҵ<EFBFBD>DWG<57><47><EFBFBD>ݼ<EFBFBD>!\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("=======<3D>ϴ<EFBFBD>PDF<44><46><EFBFBD>ݼ<EFBFBD>=========\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];
|
|
|
//<2F><><EFBFBD>ݼ<EFBFBD><DDBC><EFBFBD><EFBFBD><EFBFBD>
|
|
|
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("<22>ҵ<EFBFBD>PDF<44><46><EFBFBD>ݼ<EFBFBD>!\n");
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//<2F>½<EFBFBD><C2BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݼ<EFBFBD>
|
|
|
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("<22><><EFBFBD><EFBFBD>PDFͼֽ״̬Ϊֻ<CEAA><D6BB>,<2C><><EFBFBD><EFBFBD><DEB7><EFBFBD><EFBFBD>浽<EFBFBD><E6B5BD>ϵͳ!");
|
|
|
// return;
|
|
|
// }
|
|
|
User checkuserinfo = pdfDataset.Checked_out_user as User;
|
|
|
if (checkuserinfo != null)
|
|
|
{
|
|
|
if (checkuserinfo.Uid != loginuser.Uid)
|
|
|
{
|
|
|
MessageBox.Show("<22><>PDFͼֽ<CDBC>ѱ<EFBFBD><D1B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD>ǩ<EFBFBD><C7A9>,<2C><EFBFBD><DEB7><EFBFBD><EFBFBD>浽ϵͳ!");
|
|
|
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("<22><>ǰ<EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>" + 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;
|
|
|
//<2F><><EFBFBD>ݼ<EFBFBD><DDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
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;
|
|
|
//д<><D0B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
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<63>ϴ<EFBFBD><CFB4><EFBFBD><EFBFBD>ݼ<EFBFBD><DDBC><EFBFBD><EFBFBD><EFBFBD>" + response.sizeOfPartialErrors());
|
|
|
MessageBox.Show("<22>ϴ<EFBFBD>PDFʧ<46>ܣ<EFBFBD>");
|
|
|
return;
|
|
|
}
|
|
|
dmService.RefreshObjects(datasets);
|
|
|
MessageBox.Show("<22>ϴ<EFBFBD>PDF<44>ɹ<EFBFBD><C9B9><EFBFBD>");
|
|
|
|
|
|
}
|
|
|
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("<22><><EFBFBD>ݼ<EFBFBD><DDBC><EFBFBD>ϵ<EFBFBD><CFB5><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>!\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("<22><>ǰ<EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>" + 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<63>ϴ<EFBFBD><CFB4><EFBFBD><EFBFBD>ݼ<EFBFBD><DDBC><EFBFBD><EFBFBD><EFBFBD>" + response.sizeOfPartialErrors());
|
|
|
MessageBox.Show("<22>ϴ<EFBFBD>PDFʧ<46>ܣ<EFBFBD>");
|
|
|
return;
|
|
|
}
|
|
|
cadEditor.WriteMessage("<22>ϴ<EFBFBD><CFB4><EFBFBD><EFBFBD>ݼ<EFBFBD><DDBC>ɹ<EFBFBD>\n");
|
|
|
ModelObject[] datasets = new ModelObject[1];
|
|
|
datasets[0] = createdataset;
|
|
|
|
|
|
dmService.RefreshObjects(datasets);
|
|
|
MessageBox.Show("<22>ϴ<EFBFBD>PDF<44>ɹ<EFBFBD><C9B9><EFBFBD>");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
[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();
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// <20><><EFBFBD><EFBFBD><EFBFBD>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD>쳣<EFBFBD><ECB3A3>Ϣ
|
|
|
/// </summary>
|
|
|
/// <param name="ex"><3E>쳣<EFBFBD><ECB3A3><EFBFBD><EFBFBD></param>
|
|
|
/// <param name="backStr"><3E><><EFBFBD><EFBFBD><EFBFBD>쳣<EFBFBD><ECB3A3>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>exΪnullʱ<6C><CAB1>Ч</param>
|
|
|
/// <returns><3E>쳣<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>ı<EFBFBD></returns>
|
|
|
static string GetExceptionMsg(System.Exception ex, string backStr)
|
|
|
{
|
|
|
StringBuilder sb = new StringBuilder();
|
|
|
sb.AppendLine("****************************<2A>쳣<EFBFBD>ı<EFBFBD>****************************");
|
|
|
sb.AppendLine("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD>䡿<EFBFBD><E4A1BF>" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss"));
|
|
|
if (ex != null)
|
|
|
{
|
|
|
sb.AppendLine("<22><><EFBFBD>쳣<EFBFBD><ECB3A3><EFBFBD>͡<EFBFBD><CDA1><EFBFBD>" + ex.GetType().Name);
|
|
|
sb.AppendLine("<22><><EFBFBD>쳣<EFBFBD><ECB3A3>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>" + ex.Message);
|
|
|
sb.AppendLine("<22><><EFBFBD><EFBFBD>ջ<EFBFBD><D5BB><EFBFBD>á<EFBFBD><C3A1><EFBFBD>" + ex.StackTrace);
|
|
|
sb.AppendLine("<22><><EFBFBD>쳣<EFBFBD><ECB3A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>" + ex.TargetSite);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
sb.AppendLine("<22><>δ<EFBFBD><CEB4><EFBFBD><EFBFBD><EFBFBD>쳣<EFBFBD><ECB3A3><EFBFBD><EFBFBD>" + backStr);
|
|
|
}
|
|
|
sb.AppendLine("***************************************************************");
|
|
|
|
|
|
|
|
|
//Update.Updated(); // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>쳣<EFBFBD><EFBFBD><F3A3ACBC><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7>а汾<D0B0><E6B1BE><EFBFBD><EFBFBD>
|
|
|
|
|
|
return sb.ToString();
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// <20><>ȡPDF<44><46><EFBFBD>ݼ<EFBFBD><DDBC><EFBFBD><EFBFBD><EFBFBD>
|
|
|
/// </summary>
|
|
|
/// <param name="dwgRev"></param>
|
|
|
/// <returns></returns>
|
|
|
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<><6E>ʼ<EFBFBD><CABC>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ...\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("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƣ<EFBFBD>" + onebtlinfo.Btlname + "\n");
|
|
|
ed1.WriteMessage("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϸ<EFBFBD><CFB8>Ϣ:" + "\n");
|
|
|
foreach (DictionaryEntry de in onebtlinfo.Btldatatable)
|
|
|
{
|
|
|
ed1.WriteMessage("CAD<41><44><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>" + de.Key + "\tCAD<41><44><EFBFBD><EFBFBD>ֵ:" + de.Value +
|
|
|
"\tTC<54><43><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:" + onebtlinfo.Btltctable[de.Key] +
|
|
|
"\tTCϵͳ<CFB5><CDB3><EFBFBD><EFBFBD>:" + onebtlinfo.Btltypetable[de.Key] +
|
|
|
"\t<><74>д<EFBFBD><D0B4>" + onebtlinfo.Btlwritetable[de.Key] +
|
|
|
"\t<><74>ͬ<EFBFBD><CDAC>:" + onebtlinfo.Btlfromtctable[de.Key] + "\n");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
for (int btli = 0; btli < btllist.Count; btli++)
|
|
|
{
|
|
|
OriginBTL btlinfo = (OriginBTL)btllist[btli];
|
|
|
//<2F><><EFBFBD><EFBFBD>item_id<69><64><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6>cadͼֽ<CDBC><D6BD>Ϣ
|
|
|
object key = origintool.getKeyFromValue(btlinfo.Btltctable, "item_id");
|
|
|
object key_rev = origintool.getKeyFromValue(btlinfo.Btltctable, "item_revision_id");
|
|
|
if (key == null)
|
|
|
{
|
|
|
ed1.WriteMessage("ϵͳû<CDB3><C3BB><EFBFBD>ҵ<EFBFBD>item_id<69><64><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6>ͼֽ<CDBC><D6BD>Ϣ<EFBFBD><CFA2>ϵͳ<CFB5>ж<EFBFBD>\n");
|
|
|
return;
|
|
|
}
|
|
|
if (key_rev == null)
|
|
|
{
|
|
|
ed1.WriteMessage("ϵͳû<CDB3><C3BB><EFBFBD>ҵ<EFBFBD>item_revision_id<69><64><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6>ͼֽ<CDBC><D6BD>Ϣ<EFBFBD><CFA2>ϵͳ<CFB5>ж<EFBFBD>\n");
|
|
|
return;
|
|
|
}
|
|
|
itemID = btlinfo.Btldatatable[key].ToString();
|
|
|
if (itemID == null || itemID.Trim().Equals(""))
|
|
|
{
|
|
|
ed1.WriteMessage("<22><>ȡ<EFBFBD><C8A1>Item<65><6D>ϢΪ<CFA2>գ<EFBFBD>ϵͳ<CFB5><CDB3><EFBFBD><EFBFBD>ѭ<EFBFBD><D1AD>\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("<22>ҵ<EFBFBD><D2B5><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Item<65><6D><EFBFBD>Ƿ<EFBFBD>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD>", "<22><>ʾ", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
|
|
|
// if (upresult == DialogResult.No || upresult == DialogResult.None)
|
|
|
// {
|
|
|
// ed1.WriteMessage("<22><><EFBFBD><EFBFBD>ͬ<EFBFBD><CDAC>\n");
|
|
|
// return;
|
|
|
// }
|
|
|
if (true)
|
|
|
{
|
|
|
for (int i = 0; i < found.NumOfObjects; i++)
|
|
|
{
|
|
|
Item item = found.Objects[i] as Item;
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD>ð汾<C3B0>ϵ<EFBFBD><CFB5><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
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û<6D>ж<EFBFBD>Ӧ<EFBFBD>汾\n");
|
|
|
return;
|
|
|
}
|
|
|
string myPdfName = getPDFName(itemRev);
|
|
|
PrintDwg pdfdwg = new PrintDwg(AcAp.DocumentManager.MdiActiveDocument);
|
|
|
|
|
|
string tempPDFPath = pdfdwg.MultiSheetPlot2(myPdfName);
|
|
|
|
|
|
if (File.Exists(tempPDFPath))
|
|
|
{
|
|
|
ed1.WriteMessage("<22><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>·<EFBFBD><C2B7><EFBFBD><EFBFBD>" + tempPDFPath + "<22><>\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("<22><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>·<EFBFBD><C2B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
catch (System.Exception ex_1)
|
|
|
{
|
|
|
string str = GetExceptionMsg(ex_1, string.Empty);
|
|
|
MessageBox.Show(str, "ϵͳ<CFB5><CDB3><EFBFBD><EFBFBD>", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
|
//ed1.WriteMessage(ex_1.Message+"\n"+ex_1.ToString());
|
|
|
}
|
|
|
finally
|
|
|
{
|
|
|
if (byPassService.AskBypass())
|
|
|
{
|
|
|
byPassService.SetBypass(false);
|
|
|
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/*
|
|
|
*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϸ<EFBFBD><CFB8><EFBFBD><EFBFBD>Ϣ
|
|
|
*/
|
|
|
[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<><6E>ʼ<EFBFBD><CABC>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ...\n");
|
|
|
/************************************************************************/
|
|
|
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD>ݵĴ<DDB5><C4B4><EFBFBD> */
|
|
|
/************************************************************************/
|
|
|
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("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƣ<EFBFBD>" + onebtlinfo.Btlname + "\n");
|
|
|
ed1.WriteMessage("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϸ<EFBFBD><CFB8>Ϣ:" + "\n");
|
|
|
foreach (DictionaryEntry de in onebtlinfo.Btldatatable)
|
|
|
{
|
|
|
ed1.WriteMessage("CAD<41><44><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>" + de.Key + "\tCAD<41><44><EFBFBD><EFBFBD>ֵ:" + de.Value +
|
|
|
"\tTC<54><43><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:" + onebtlinfo.Btltctable[de.Key] +
|
|
|
"\tTCϵͳ<CFB5><CDB3><EFBFBD><EFBFBD>:" + onebtlinfo.Btltypetable[de.Key] +
|
|
|
"\t<><74>д<EFBFBD><D0B4>" + onebtlinfo.Btlwritetable[de.Key] + "\n");
|
|
|
}
|
|
|
}
|
|
|
ed1.WriteMessage("<22><>ʼ<EFBFBD><CABC>ȡ<EFBFBD><C8A1>ϸ<EFBFBD><CFB8><EFBFBD><EFBFBD>Ϣ...\n");
|
|
|
List<OriginMXL> mxllist = new List<OriginMXL>();
|
|
|
mxllist = readxml.OriginReadMXLXML(xmlpath);
|
|
|
|
|
|
for (int i = 0; i < mxllist.Count; i++)
|
|
|
{
|
|
|
OriginMXL mxlinfo = mxllist[i];
|
|
|
ed1.WriteMessage("<22><>ϸ<EFBFBD><CFB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƣ<EFBFBD>" + mxlinfo.Mxlname + "\n");
|
|
|
ed1.WriteMessage("<22><>ϸ<EFBFBD><CFB8>" + i + "<22><>ϸ<EFBFBD><CFB8>Ϣ:" + "\n");
|
|
|
foreach (DictionaryEntry de in mxlinfo.Mxldatatable)
|
|
|
{
|
|
|
ed1.WriteMessage("CAD<41><44><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>" + de.Key + "\tCAD<41><44><EFBFBD><EFBFBD>ֵ:" + de.Value +
|
|
|
"\tTC<54><43><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:" + mxlinfo.Mxltctable[de.Key] +
|
|
|
"\tis_bomline:" + mxlinfo.Mxlisbomtable[de.Key] +
|
|
|
"\twritable:" + mxlinfo.Mxlupdatetable[de.Key] + "\n");
|
|
|
}
|
|
|
}
|
|
|
ed1.WriteMessage("<22><>ϸ<EFBFBD><CFB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ:" + mxllist.Count);
|
|
|
ed1.WriteMessage("<22><>ʼΪbom<6F>ṹ<EFBFBD><E1B9B9><EFBFBD><EFBFBD>\n");
|
|
|
// mxllist = origintool.sortbomlist(mxllist);
|
|
|
ed1.WriteMessage("<22><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>...\n");
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
for (int btli = 0; btli < btllist.Count; btli++)
|
|
|
{
|
|
|
OriginBTL btlinfo = (OriginBTL)btllist[btli];
|
|
|
//<2F><><EFBFBD><EFBFBD>item_id<69><64><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6>cadͼֽ<CDBC><D6BD>Ϣ
|
|
|
object key = origintool.getKeyFromValue(btlinfo.Btltctable, "item_id");
|
|
|
if (key == null)
|
|
|
{
|
|
|
ed1.WriteMessage("ϵͳû<CDB3><C3BB><EFBFBD>ҵ<EFBFBD>item_id<69><64><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6>ͼֽ<CDBC><D6BD>Ϣ<EFBFBD><CFA2>ϵͳ<CFB5>ж<EFBFBD>\n");
|
|
|
return;
|
|
|
}
|
|
|
SavedQueryResults found = origintool.getSearchItem(btlinfo.Btldatatable[key].ToString());
|
|
|
if (found != null && found.NumOfObjects > 0)
|
|
|
{
|
|
|
DialogResult upresult = MessageBox.Show("<22>ҵ<EFBFBD><D2B5><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Item<65><6D><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD>£<EFBFBD>", "<22><>ʾ", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
|
|
|
if (upresult == DialogResult.No || upresult == DialogResult.None)
|
|
|
{
|
|
|
ed1.WriteMessage("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\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();
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD>µķ<C2B5>ʽ
|
|
|
GetItemFromIdResponse infoResp = dmService.GetItemFromId(infos, 1, pref);
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>㼶<EFBFBD><E3BCB6><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD>Ӷ<EFBFBD>Item<65><6D><EFBFBD>Եĸ<D4B5><C4B8><EFBFBD>
|
|
|
if (btlinfo.Btltypetable.ContainsValue("Item"))
|
|
|
{
|
|
|
ed1.WriteMessage("<22><><EFBFBD>ڸ<EFBFBD><DAB8><EFBFBD>Item<65><6D><EFBFBD><EFBFBD>\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("<22><><EFBFBD><EFBFBD>Item<65><6D><EFBFBD>Գɹ<D4B3>\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);
|
|
|
|
|
|
//<2F>ж<EFBFBD>ͼֽ<CDBC><D6BD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˰汾<CBB0><E6B1BE>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˰汾<CBB0><E6B1BE>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8><EFBFBD>İ汾<C4B0><E6B1BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><F2A3ACB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>°汾
|
|
|
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û<6D>ж<EFBFBD>Ӧ<EFBFBD>汾\n");
|
|
|
return;
|
|
|
}
|
|
|
rev_id = itemRev.Item_revision_id;
|
|
|
ReleaseStatus[] releaselist = itemRev.Release_status_list;
|
|
|
if (!itemRev.Is_modifiable)
|
|
|
{
|
|
|
MessageBox.Show("ItemRevisionΪֻ<CEAA><D6BB>,<2C><>û<EFBFBD>б<EFBFBD><D0B1><EFBFBD>Ȩ<EFBFBD><C8A8>!");
|
|
|
return;
|
|
|
}
|
|
|
if (releaselist.Length > 0)
|
|
|
{
|
|
|
string message = "Item IDΪ" + itemRev.Item_id + "<22><><EFBFBD><EFBFBD><EFBFBD>°汾<C2B0>ѷ<EFBFBD><D1B7><EFBFBD><EFBFBD><EFBFBD>";
|
|
|
MessageBox.Show(message);
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>㼶<EFBFBD><E3BCB6>Ҫ<EFBFBD><D2AA><EFBFBD>Ӷ汾<D4B0><E6B1BE><EFBFBD>Եĸ<D4B5><C4B8><EFBFBD>
|
|
|
if (btlinfo.Btltypetable.ContainsValue("ItemRevision"))
|
|
|
{
|
|
|
ed1.WriteMessage("<22><><EFBFBD>ڸ<EFBFBD><DAB8><EFBFBD>ItemRevision<6F><6E><EFBFBD><EFBFBD>\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("<22><><EFBFBD><EFBFBD>ItemRevision<6F><6E><EFBFBD>Գɹ<D4B3>\n");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD>±<EFBFBD><C2B1><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
|
|
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();
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Form<72><6D><EFBFBD>ԣ<EFBFBD><D4A3><EFBFBD>ִ<EFBFBD><D6B4><EFBFBD><EFBFBD><EFBFBD>´<EFBFBD><C2B4><EFBFBD>
|
|
|
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("ȡ<><C8A1><EFBFBD><EFBFBD>" + 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 = "<22><>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼֽ:" + cadstring + "<22><><EFBFBD><EFBFBD>ֵ" + cadvalue + "<22><>ϵͳ<CFB5><CDB3>:" + tcstring + "<22><><EFBFBD><EFBFBD>ֵ" + my_prop.StringValue + "<22><>һ<EFBFBD><D2BB>,<2C>Ƿ<C7B7>ϵͳ<CFB5><CDB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>?";
|
|
|
DialogResult updateresult = MessageBox.Show(message, "<22><>ʾ", 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("<22><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>\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("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
break;
|
|
|
}
|
|
|
catch (ServiceException ex)
|
|
|
{
|
|
|
ed1.WriteMessage(ex.Message);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/*
|
|
|
ed1.WriteMessage("=======<3D><><EFBFBD>ݼ<EFBFBD>=========\n");
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݼ<EFBFBD><DDBC><EFBFBD><EFBFBD>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD>ɴ<EFBFBD><C9B4><EFBFBD>,<2C><><EFBFBD><EFBFBD>type refname separator
|
|
|
|
|
|
OriginReadXml originreadxml = new OriginReadXml();
|
|
|
OriginDataSet datasetinfo = originreadxml.OriginReadDataSetXML(xmlpath);
|
|
|
datasetinfo = origintool.GetDataSetInfo(datasetinfo, btlinfo);
|
|
|
|
|
|
ed1.WriteMessage("<><D7BC><EFBFBD><EFBFBD><EFBFBD>ݼ<EFBFBD><DDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\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("<22>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD>ݼ<EFBFBD>!\n");
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
//if (!findDateset)
|
|
|
//{
|
|
|
// DialogResult updateornewdialog = MessageBox.Show("<22><>Item<65>Ѵ<EFBFBD><D1B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݼ<EFBFBD><DDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "<22><>ʾ", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
|
|
|
// if (updateornewdialog == DialogResult.Yes)
|
|
|
// {
|
|
|
|
|
|
// }
|
|
|
//}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//<2F>½<EFBFBD><C2BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݼ<EFBFBD>
|
|
|
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("<22><><EFBFBD><EFBFBD>ͼֽ״̬Ϊֻ<CEAA><D6BB>,<2C><><EFBFBD><EFBFBD><DEB7><EFBFBD><EFBFBD>浽<EFBFBD><E6B5BD>ϵͳ!");
|
|
|
return;
|
|
|
}
|
|
|
User checkuserinfo = dataset.Checked_out_user as User;
|
|
|
if (checkuserinfo != null)
|
|
|
{
|
|
|
if (checkuserinfo.Uid != loginuser.Uid)
|
|
|
{
|
|
|
MessageBox.Show("<22><>ͼֽ<CDBC>ѱ<EFBFBD><D1B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD>ǩ<EFBFBD><C7A9>,<2C><EFBFBD><DEB7><EFBFBD><EFBFBD>浽ϵͳ!");
|
|
|
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<32><32><EFBFBD>ݼ<EFBFBD>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><33><EFBFBD>ݼ<EFBFBD>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("<22><>ǰ<EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>" + 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<34><34><EFBFBD>ݼ<EFBFBD>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("<22><><EFBFBD>ݼ<EFBFBD><DDBC><EFBFBD>ϵ<EFBFBD><CFB5><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>!\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("<22><>ǰ<EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>" + 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;
|
|
|
}
|
|
|
*/
|
|
|
//<2F><><EFBFBD><EFBFBD>BOM
|
|
|
if (mxllist.Count > 0)
|
|
|
{
|
|
|
DialogResult flushbomresult = MessageBox.Show("<22>Ƿ<EFBFBD>ˢ<EFBFBD><CBA2>BOM", "<22><>ʾ", 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("<22>ҵ<EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>\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 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
* add by raywei
|
|
|
* function used by savetotc
|
|
|
* <20><><EFBFBD><EFBFBD><DFBC><EFBFBD>
|
|
|
* <20><><EFBFBD><EFBFBD>ITEMʱ<4D><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݼ<EFBFBD><DDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݼ<EFBFBD><DDBC><EFBFBD>Դ<EFBFBD><D4B4>ϵͳ<CFB5>ж<EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>item<65>µ<EFBFBD><C2B5><EFBFBD><EFBFBD>ݼ<EFBFBD><DDBC><EFBFBD><EFBFBD><EFBFBD>
|
|
|
* 1<><31><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1> <20>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>=ģ<><C4A3>ID <20>ָ<EFBFBD><D6B8>ַ<EFBFBD><D6B7><EFBFBD>
|
|
|
* 2<><32><EFBFBD><EFBFBD><EFBFBD>ñ<EFBFBD><C3B1><EFBFBD><EFBFBD><EFBFBD>item<65><6D><EFBFBD>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD>ö<EFBFBD>Ӧģ<D3A6><C4A3>ID<49><44><EFBFBD><EFBFBD><EFBFBD>ݴ<EFBFBD>ID<49>ҵ<EFBFBD>ϵͳITEM
|
|
|
* 3<><33><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD>Item<65><6D><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݼ<EFBFBD>
|
|
|
* 4<><34><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݼ<EFBFBD><DDBC>ļ<EFBFBD>
|
|
|
* 5<><35><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ITEM
|
|
|
* 6<><36><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>µ<EFBFBD><C2B5><EFBFBD><EFBFBD>ݼ<EFBFBD>
|
|
|
* 7<><37><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
************************************************************************/
|
|
|
|
|
|
public void updateItemDataSet(Editor ed1, BTLClass btlinfo,
|
|
|
ItemRevision itemrevision, DataManagementService dmService, string rev_id)
|
|
|
{
|
|
|
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1>
|
|
|
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("<22><>ѡ<EFBFBD><D1A1>DFHM_dstype<70><65><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
}
|
|
|
|
|
|
for (int i = 0; i < prevalues.Length; i++)
|
|
|
{
|
|
|
ed1.WriteMessage(prevalues[i].ToString() + "\n");
|
|
|
}
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>WORD<52><44><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݼ<EFBFBD>
|
|
|
ed1.WriteMessage("<22><><EFBFBD><EFBFBD>Item<65>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>WORD<52><44><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݼ<EFBFBD>\n");
|
|
|
bool hasWordDS = checkHasWord(itemrevision, dmService);
|
|
|
if (hasWordDS)
|
|
|
{
|
|
|
ed1.WriteMessage("Item<65>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD><EFBFBD>WORD<52><44><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݼ<EFBFBD>\n");
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
ed1.WriteMessage("Item<65><6D><EFBFBD><EFBFBD><EFBFBD><EFBFBD>WORD<52><44><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݼ<EFBFBD>\n");
|
|
|
//<2F><>ȡ<EFBFBD><C8A1>Ӧģ<D3A6><C4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ID
|
|
|
ed1.WriteMessage("<22><><EFBFBD>ڷ<EFBFBD><DAB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ͷ<EFBFBD>Ӧģ<D3A6><C4A3>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);
|
|
|
//<2F>ҵ<EFBFBD>ģ<EFBFBD><C4A3>item
|
|
|
ed1.WriteMessage("<22>ҵ<EFBFBD>ģ<EFBFBD><C4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
if (found.NumOfObjects > 0 && found != null)
|
|
|
{
|
|
|
Item DMTItem = found.Objects[0] as Item;
|
|
|
DMTFilepath = downloadfile(DMTItem);
|
|
|
ed1.WriteMessage("ģ<><C4A3><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɣ<EFBFBD>·<EFBFBD><C2B7>" + DMTFilepath + "\n");
|
|
|
}
|
|
|
}
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݼ<EFBFBD><DDBC><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>
|
|
|
if (DMTFilepath != "")
|
|
|
{
|
|
|
bool uploadresult = uploadfile(DMTFilepath, btlinfo.Item_id + "/" + rev_id, itemrevision);
|
|
|
if (uploadresult)
|
|
|
ed1.WriteMessage("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD>ݼ<EFBFBD>ģ<EFBFBD><C4A3><EFBFBD>ɹ<EFBFBD>\n");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>MSWORD<52><44><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݼ<EFBFBD>
|
|
|
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
|
|
|
* <20><><EFBFBD><EFBFBD><DFBC><EFBFBD>
|
|
|
* <20><><EFBFBD><EFBFBD><EFBFBD>½<EFBFBD>ITEMʱ<4D><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݼ<EFBFBD><DDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݼ<EFBFBD><DDBC><EFBFBD>Դ<EFBFBD><D4B4>ϵͳ<CFB5>ж<EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>item<65>µ<EFBFBD><C2B5><EFBFBD><EFBFBD>ݼ<EFBFBD><DDBC><EFBFBD><EFBFBD><EFBFBD>
|
|
|
* 1<><31><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1> <20>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>=ģ<><C4A3>ID <20>ָ<EFBFBD><D6B8>ַ<EFBFBD><D6B7><EFBFBD>
|
|
|
* 2<><32><EFBFBD><EFBFBD><EFBFBD>ñ<EFBFBD><C3B1><EFBFBD><EFBFBD><EFBFBD>item<65><6D><EFBFBD>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD>ö<EFBFBD>Ӧģ<D3A6><C4A3>ID<49><44><EFBFBD><EFBFBD><EFBFBD>ݴ<EFBFBD>ID<49>ҵ<EFBFBD>ϵͳITEM
|
|
|
* 3<><33><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD>Item<65><6D><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݼ<EFBFBD>
|
|
|
* 4<><34><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݼ<EFBFBD><DDBC>ļ<EFBFBD>
|
|
|
* 5<><35><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>µ<EFBFBD>ITEM
|
|
|
* 6<><36><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>µ<EFBFBD><C2B5><EFBFBD><EFBFBD>ݼ<EFBFBD>
|
|
|
* 7<><37><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
************************************************************************/
|
|
|
|
|
|
/************************************************************************
|
|
|
* 2012-2-13
|
|
|
* add by raywei
|
|
|
* <20><><EFBFBD>÷<EFBFBD><C3B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݼ<EFBFBD><DDBC>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD><D8B5><EFBFBD><EFBFBD>أ<EFBFBD><D8A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>·<EFBFBD><C2B7>
|
|
|
************************************************************************/
|
|
|
|
|
|
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("<22><><EFBFBD><EFBFBD>·<EFBFBD><C2B7><EFBFBD><EFBFBD>" + DMTFilepath + "\n");
|
|
|
System.IO.File.Copy(file.FullName, DMTFilepath, true);
|
|
|
System.IO.File.SetAttributes(DMTFilepath, FileAttributes.Normal);
|
|
|
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return DMTFilepath;
|
|
|
}
|
|
|
|
|
|
//<2F>½<EFBFBD><C2BD><EFBFBD><EFBFBD>ݼ<EFBFBD><DDBC><EFBFBD><EFBFBD>ϴ<EFBFBD><CFB4>ļ<EFBFBD>
|
|
|
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("<22><><EFBFBD>ݼ<EFBFBD><DDBC><EFBFBD>ϵ<EFBFBD><CFB5><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>!\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<74><63><EFBFBD>ڱ<EFBFBD><DAB1>水<EFBFBD><E6B0B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD>
|
|
|
************************************************************************/
|
|
|
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<OriginMXL> bomlist = this.savefrom.bomlist;
|
|
|
ed1.WriteMessage("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ITEM<45><4D>" + btlinfo.Btldatatable[origintool.getKeyFromValue(btlinfo.Btltctable, "item_id")].ToString());
|
|
|
ed1.WriteMessage("<22><>ϸ<EFBFBD><CFB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:" + 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("<22>ҵ<EFBFBD>ָ<EFBFBD><D6B8><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>\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("<22><><EFBFBD><EFBFBD>Ŀ¼û<C2BC><C3BB>дȨ<D0B4>ޣ<EFBFBD><DEA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1>");
|
|
|
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("<22>汾<EFBFBD><E6B1BE><EFBFBD>Ҳ<EFBFBD><D2B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>" + itemIDTemp + "/" + itemRevIDTemp);
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
if (newitem == null)
|
|
|
{
|
|
|
//ed1.WriteMessage("item is null\n");
|
|
|
newitem = (Item)Query.queryItemByID(itemIDTemp);
|
|
|
if (newitem == null)
|
|
|
{
|
|
|
ed1.WriteMessage("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҳ<EFBFBD><D2B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>" + itemIDTemp);
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
//<2F><><EFBFBD>Ӷ<EFBFBD>Item<65><6D><EFBFBD>Եĸ<D4B5><C4B8><EFBFBD>
|
|
|
if (btlinfo.Btltypetable.ContainsValue("Item"))
|
|
|
{
|
|
|
ed1.WriteMessage("<22><><EFBFBD>ڸ<EFBFBD><DAB8><EFBFBD>Item<65><6D><EFBFBD><EFBFBD>\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("<22><><EFBFBD><EFBFBD>Item<65><6D><EFBFBD>Գɹ<D4B3>\n");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//<2F><><EFBFBD>Ӷ汾<D4B0><E6B1BE><EFBFBD>Եĸ<D4B5><C4B8><EFBFBD>
|
|
|
if (btlinfo.Btltypetable.ContainsValue("ItemRevision"))
|
|
|
{
|
|
|
ed1.WriteMessage("<22><><EFBFBD>ڸ<EFBFBD><DAB8><EFBFBD>ItemRevision<6F><6E><EFBFBD><EFBFBD>\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("<22><><EFBFBD><EFBFBD>ItemRevision<6F><6E><EFBFBD>Գɹ<D4B3>\n");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//дform<72><6D><EFBFBD><EFBFBD>
|
|
|
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();
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Form<72><6D><EFBFBD>ԣ<EFBFBD><D4A3><EFBFBD>ִ<EFBFBD><D6B4><EFBFBD><EFBFBD><EFBFBD>´<EFBFBD><C2B4><EFBFBD>
|
|
|
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;
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݼ<EFBFBD><DDBC><EFBFBD><EFBFBD>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD>ɴ<EFBFBD><C9B4><EFBFBD>,<2C><><EFBFBD><EFBFBD>type refname separator
|
|
|
|
|
|
OriginReadXml originreadxml = new OriginReadXml();
|
|
|
OriginDataSet datasetinfo = originreadxml.OriginReadDataSetXML(xmlpath);
|
|
|
datasetinfo = origintool.GetDataSetInfo(datasetinfo, btlinfo);
|
|
|
|
|
|
ed1.WriteMessage("<><D7BC><EFBFBD><EFBFBD><EFBFBD>ݼ<EFBFBD><DDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\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("<><D7BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݼ<EFBFBD>\n");
|
|
|
Teamcenter.Services.Strong.Core._2006_03.DataManagement.CreateDatasetsResponse
|
|
|
dsResp = dmService.CreateDatasets(dataset_vec);
|
|
|
if (dsResp.Output.Length == 0)
|
|
|
{
|
|
|
ed1.WriteMessage("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݼ<EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD><DCA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݼ<EFBFBD>.xml<6D>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ");
|
|
|
return;
|
|
|
}
|
|
|
Dataset createdataset = dsResp.Output[0].Dataset;
|
|
|
ed1.WriteMessage("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݼ<EFBFBD><DDBC><EFBFBD><EFBFBD><EFBFBD>\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("<22><><EFBFBD>ݼ<EFBFBD><DDBC><EFBFBD>ϵ<EFBFBD><CFB5><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>!\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("<22><>ǰ<EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>" + 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);
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˢ<EFBFBD><CBA2>bom
|
|
|
|
|
|
if (bomlist.Count > 0)
|
|
|
{
|
|
|
DialogResult updateresult = MessageBox.Show("<22>Ƿ<EFBFBD>ˢ<EFBFBD><CBA2>BOM", "<22><>ʾ", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
|
|
|
if (updateresult == DialogResult.No || updateresult == DialogResult.None)
|
|
|
{
|
|
|
ed1.WriteMessage("<22><><EFBFBD><EFBFBD>ˢ<EFBFBD><CBA2>BOM\n");
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
CreateBomStructure(rev, createdataset, bomlist, folder);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
this.savefrom.Hide();
|
|
|
this.savefrom.Dispose();
|
|
|
}
|
|
|
catch (ServiceException ex)
|
|
|
{
|
|
|
ed1.WriteMessage(ex.Message);
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
MessageBox.Show("<22><>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5><EFBFBD>ļ<EFBFBD><C4BC>У<EFBFBD>");
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
*<2A>˳<EFBFBD>
|
|
|
*/
|
|
|
[CommandMethod("LOGOUT")]
|
|
|
public void layout()
|
|
|
{
|
|
|
DialogResult updateresult = MessageBox.Show("<22><>ȷ<EFBFBD><C8B7><EFBFBD><EFBFBD><EFBFBD>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD>棡<EFBFBD><E6A3A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݶ<EFBFBD>ʧ<EFBFBD><CAA7><EFBFBD>Ƿ棿", "<22><>ʾ", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
|
|
|
if (updateresult == DialogResult.Yes)
|
|
|
{
|
|
|
savetotc();
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
loginuser = null;
|
|
|
hadlogin = false;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* <09><>ȡTC<54><43><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:<3A><>ȡTC<54><43>ϸ<EFBFBD><CFB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>дֻ<D0B4><D6BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
*/
|
|
|
[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("<22><><EFBFBD>ļ<EFBFBD>Ϊֻ<CEAA><D6BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܸ<EFBFBD><DCB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!");
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
OriginTool origintool = new OriginTool();
|
|
|
// if (itemBean == null)
|
|
|
// {
|
|
|
// ed1.WriteMessage("û<><C3BB><EFBFBD>ҵ<EFBFBD>Item<65><6D>Ϣ\n");
|
|
|
// return;
|
|
|
// }
|
|
|
// else
|
|
|
// {
|
|
|
// itemID = itemBean.ItemId;
|
|
|
// itemRev2 = itemBean.ItemRev;
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ed1.WriteMessage("\n<><6E>ʼ<EFBFBD><CABC>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ...\n");
|
|
|
/************************************************************************/
|
|
|
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD>ݵĴ<DDB5><C4B4><EFBFBD> */
|
|
|
/************************************************************************/
|
|
|
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("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƣ<EFBFBD>" + onebtlinfo.Btlname + "\n");
|
|
|
ed1.WriteMessage("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϸ<EFBFBD><CFB8>Ϣ:" + "\n");
|
|
|
foreach (DictionaryEntry de in onebtlinfo.Btldatatable)
|
|
|
{
|
|
|
ed1.WriteMessage("CAD<41><44><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>" + de.Key + "\tCAD<41><44><EFBFBD><EFBFBD>ֵ:" + de.Value +
|
|
|
"\tTC<54><43><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:" + onebtlinfo.Btltctable[de.Key] +
|
|
|
"\tTCϵͳ<CFB5><CDB3><EFBFBD><EFBFBD>:" + onebtlinfo.Btltypetable[de.Key] +
|
|
|
"\t<><74>д<EFBFBD><D0B4>" + onebtlinfo.Btlwritetable[de.Key] +
|
|
|
"\t<><74>ͬ<EFBFBD><CDAC>:" + onebtlinfo.Btlfromtctable[de.Key] + "\n");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
for (int btli = 0; btli < btllist.Count; btli++)
|
|
|
{
|
|
|
OriginBTL btlinfo = (OriginBTL)btllist[btli];
|
|
|
//<2F><><EFBFBD><EFBFBD>item_id<69><64><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6>cadͼֽ<CDBC><D6BD>Ϣ
|
|
|
object key = origintool.getKeyFromValue(btlinfo.Btltctable, "item_id");
|
|
|
object key_rev = origintool.getKeyFromValue(btlinfo.Btltctable, "item_revision_id");
|
|
|
if (key == null)
|
|
|
{
|
|
|
ed1.WriteMessage("ϵͳû<CDB3><C3BB><EFBFBD>ҵ<EFBFBD>item_id<69><64><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6>ͼֽ<CDBC><D6BD>Ϣ<EFBFBD><CFA2>ϵͳ<CFB5>ж<EFBFBD>\n");
|
|
|
return;
|
|
|
}
|
|
|
if (key_rev == null)
|
|
|
{
|
|
|
ed1.WriteMessage("ϵͳû<CDB3><C3BB><EFBFBD>ҵ<EFBFBD>item_revision_id<69><64><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6>ͼֽ<CDBC><D6BD>Ϣ<EFBFBD><CFA2>ϵͳ<CFB5>ж<EFBFBD>\n");
|
|
|
return;
|
|
|
}
|
|
|
itemID = btlinfo.Btldatatable[key].ToString();
|
|
|
if (itemID == null || itemID.Trim().Equals(""))
|
|
|
{
|
|
|
ed1.WriteMessage("<22><>ȡ<EFBFBD><C8A1>Item<65><6D>ϢΪ<CFA2>գ<EFBFBD>ϵͳ<CFB5><CDB3><EFBFBD><EFBFBD>ѭ<EFBFBD><D1AD>\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("<22>ҵ<EFBFBD><D2B5><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Item<65><6D><EFBFBD>Ƿ<EFBFBD>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD>", "<22><>ʾ", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
|
|
|
// if (upresult == DialogResult.No || upresult == DialogResult.None)
|
|
|
// {
|
|
|
// ed1.WriteMessage("<22><><EFBFBD><EFBFBD>ͬ<EFBFBD><CDAC>\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("<22><>ǰΪ<C7B0><CEAA><EFBFBD><EFBFBD>ͼֽ<CDBC><D6BD><EFBFBD><EFBFBD><EFBFBD>ܸ<EFBFBD><DCB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!");
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
// document2.Name
|
|
|
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (object_type.Equals("TM2_TEdrawing"))
|
|
|
{
|
|
|
MessageBox.Show("<22><>ǰΪ<C7B0><CEAA><EFBFBD><EFBFBD>ͼֽ<CDBC><D6BD><EFBFBD><EFBFBD><EFBFBD>ܸ<EFBFBD><DCB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!");
|
|
|
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();
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD>µķ<C2B5>ʽ
|
|
|
GetItemFromIdResponse infoResp = dmService.GetItemFromId(infos, 1, pref);
|
|
|
|
|
|
//<><D7BC>д<EFBFBD><D0B4>CADͼֽ<CDBC>ϵ<EFBFBD><CFB5><EFBFBD>Ϣ
|
|
|
Hashtable tempvaluetable = new Hashtable();
|
|
|
|
|
|
//<><D7BC>дU8<55><38><EFBFBD>뵽CADͼֽ<CDBC>ϵ<EFBFBD>
|
|
|
Hashtable u8valuetable = new Hashtable();
|
|
|
|
|
|
//<2F><>ȡItem<65>ϵ<EFBFBD><CFB5><EFBFBD><EFBFBD><EFBFBD>
|
|
|
if (btlinfo.Btltypetable.ContainsValue("Item"))
|
|
|
{
|
|
|
ed1.WriteMessage("<22><><EFBFBD><EFBFBD>ͬ<EFBFBD><CDAC>Item<65><6D><EFBFBD><EFBFBD>\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("ȡ<><C8A1><EFBFBD><EFBFBD>" + 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ϵͳ<CFB5>е<EFBFBD><D0B5><EFBFBD><EFBFBD><EFBFBD>" + tcstring + "ֵΪ <20><>" + tempcadvalue + "\n");
|
|
|
if (cadvalue != tempcadvalue)
|
|
|
{
|
|
|
origintool.TableHasKey(tempvaluetable, cadstring, tempcadvalue);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//<2F><><EFBFBD>ð汾<C3B0>ϵ<EFBFBD><CFB5><EFBFBD><EFBFBD><EFBFBD>
|
|
|
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û<6D>ж<EFBFBD>Ӧ<EFBFBD>汾\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 + "]û<>ж<EFBFBD>Ӧ[" + itemRev2 + "]<5D>汾\n");
|
|
|
continue;
|
|
|
}
|
|
|
ed1.WriteMessage("Item[" + rev_id + "]<5D>ҵ<EFBFBD><D2B5><EFBFBD>Ӧ[" + itemRev2 + "]<5D>汾\n");
|
|
|
|
|
|
ReleaseStatus[] releaselist = itemRev.Release_status_list;
|
|
|
// if (!itemRev.Is_modifiable)
|
|
|
// {
|
|
|
// MessageBox.Show("ItemRevisionΪֻ<CEAA><D6BB>,<2C><>û<EFBFBD>б<EFBFBD><D0B1><EFBFBD>Ȩ<EFBFBD><C8A8>!");
|
|
|
// return;
|
|
|
// }
|
|
|
if (releaselist.Length > 0)
|
|
|
{
|
|
|
string message = "Item IDΪ" + itemRev.Item_id + "<22><><EFBFBD><EFBFBD><EFBFBD>°汾<C2B0>ѷ<EFBFBD><D1B7><EFBFBD><EFBFBD><EFBFBD>";
|
|
|
MessageBox.Show(message);
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
if (btlinfo.Btltypetable.ContainsValue("ItemRevision"))
|
|
|
{
|
|
|
ed1.WriteMessage("<22><><EFBFBD><EFBFBD>ͬ<EFBFBD><CDAC>ItemRevision<6F><6E><EFBFBD><EFBFBD>\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("ȡ<><C8A1><EFBFBD><EFBFBD>" + 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ϵͳ<CFB5>е<EFBFBD><D0B5><EFBFBD><EFBFBD><EFBFBD>" + tcstring + "ֵΪ <20><>" + tempcadvalue + "\n");
|
|
|
if (cadvalue != tempcadvalue)
|
|
|
{
|
|
|
if (!cadstring.Equals("U8<55><38><EFBFBD><EFBFBD>"))
|
|
|
{
|
|
|
origintool.TableHasKey(tempvaluetable, cadstring, tempcadvalue);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
origintool.TableHasKey(u8valuetable, cadstring, tempcadvalue);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//<2F><><EFBFBD>ð汾<C3B0><E6B1BE><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5><EFBFBD><EFBFBD><EFBFBD>
|
|
|
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("<22><><EFBFBD><EFBFBD>ͬ<EFBFBD><CDAC>ItemRevision<6F><6E><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\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("ȡ<><C8A1><EFBFBD><EFBFBD>" + 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ϵͳ<CFB5>е<EFBFBD><D0B5><EFBFBD><EFBFBD><EFBFBD>" + tcstring + "ֵΪ <20><>" + tempcadvalue + "\n");
|
|
|
if (cadvalue != tempcadvalue)
|
|
|
{
|
|
|
origintool.TableHasKey(tempvaluetable, cadstring, tempcadvalue);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD><EFBFBD>Ҫͬ<D2AA><CDAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ռ<EFBFBD><D5BC><EFBFBD><EFBFBD><EFBFBD>
|
|
|
foreach (DictionaryEntry de in tempvaluetable)
|
|
|
{
|
|
|
ed1.WriteMessage("CAD<41><44><EFBFBD><EFBFBD>:" + de.Key.ToString() + "\tֵ:" + de.Value.ToString() + "\n");
|
|
|
}
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><D0B4>CADͼֽ
|
|
|
origintool.SetTitleInfo(btlinfo.Btlname, tempvaluetable);//
|
|
|
origintool.SetTitleInfo_v1("1-U8<55><38><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", u8valuetable);
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
/// <summary>
|
|
|
/// ˫<><CBAB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݼ<EFBFBD><DDBC><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>ͻ<EFBFBD><CDBB><EFBFBD>item<65><6D><EFBFBD><EFBFBD>Ϣд<CFA2>뵽<EFBFBD><EBB5BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
/// <20><>ȡitem<65><6D><EFBFBD><EFBFBD>Ϣ
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
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();
|
|
|
}
|
|
|
}
|
|
|
//<2F><>ȡ<EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֤<EFBFBD>ļ<EFBFBD>֮<EFBFBD><D6AE>һ<EFBFBD><D2BB>
|
|
|
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;
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĵ<EFBFBD> Lock the new document
|
|
|
using (DocumentLock acLckDoc = acNewDoc.LockDocument())
|
|
|
{
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD><DDBF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Start a transaction in the new database
|
|
|
using (Transaction acTrans = acDbNewDoc.TransactionManager.StartTransaction())
|
|
|
{
|
|
|
//acTrans.GetObject(acDbNewDoc., OpenMode.ForRead);
|
|
|
}
|
|
|
}
|
|
|
ed1.WriteMessage("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǰ<EFBFBD>ĵ<EFBFBD>");
|
|
|
|
|
|
|
|
|
}
|
|
|
catch (SystemException ex)
|
|
|
{
|
|
|
ed1.WriteMessage("<22><><EFBFBD><EFBFBD><EFBFBD>ĵ<EFBFBD><C4B5>쳣");
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
/*
|
|
|
*<2A><>ȡTCBOM<4F><4D>ϸ<EFBFBD><CFB8><EFBFBD>ԣ<EFBFBD><D4A3><EFBFBD>ȡTCBOM<4F><4D>д<EFBFBD><D0B4><EFBFBD><EFBFBD>ϸ<EFBFBD><CFB8>
|
|
|
*/
|
|
|
/// <summary>
|
|
|
/// <20><><EFBFBD><EFBFBD>BOM<4F><4D>CAD<41><44>
|
|
|
/// </summary>
|
|
|
[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 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
// if (document2.IsReadOnly)
|
|
|
// {
|
|
|
// MessageBox.Show("<22><><EFBFBD>ļ<EFBFBD>Ϊֻ<CEAA><D6BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܸ<EFBFBD><DCB8><EFBFBD>BOM!");
|
|
|
// return;
|
|
|
// }
|
|
|
//20240408 ѡ<>Ǿ<EFBFBD><C7BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD>Ĭ<EFBFBD>Ϲ<EFBFBD><CFB9>ܣ<EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD>ϸ<EFBFBD><CFB8><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>㣬ѡ<E3A3AC><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD>ϸ<EFBFBD><CFB8><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
Boolean eraseBOM = true;
|
|
|
DialogResult AF = MessageBox.Show("<22>Ƿ<EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϸ<EFBFBD>飿", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϸ", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
|
|
|
if (AF == DialogResult.Yes)
|
|
|
{
|
|
|
//<2F>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD>ȷ<EFBFBD>Ϻ<EFBFBD>ִ<EFBFBD>еĴ<D0B5><C4B4><EFBFBD>
|
|
|
eraseBOM = true;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
//<2F>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD>߹رնԻ<D5B6><D4BB><EFBFBD><EFBFBD><EFBFBD>ִ<EFBFBD>еĴ<D0B5><C4B4><EFBFBD>
|
|
|
eraseBOM = false;
|
|
|
}
|
|
|
|
|
|
|
|
|
String itemID = null;
|
|
|
String itemRev = null;
|
|
|
Editor ed1 = ZwSoft.ZwCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
|
|
|
// getItemInfo();
|
|
|
// if(itemBean ==null){
|
|
|
// ed1.WriteMessage("û<><C3BB><EFBFBD>ҵ<EFBFBD>BOM<4F><4D>Ϣ\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("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƣ<EFBFBD>" + onebtlinfo.Btlname + "\n");
|
|
|
ed1.WriteMessage("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϸ<EFBFBD><CFB8>Ϣ:" + "\n");
|
|
|
foreach (DictionaryEntry de in onebtlinfo.Btldatatable)
|
|
|
{
|
|
|
ed1.WriteMessage("CAD<41><44><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>" + de.Key + "\tCAD<41><44><EFBFBD><EFBFBD>ֵ:" + de.Value +
|
|
|
"\tTC<54><43><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:" + onebtlinfo.Btltctable[de.Key] +
|
|
|
"\tTCϵͳ<CFB5><CDB3><EFBFBD><EFBFBD>:" + onebtlinfo.Btltypetable[de.Key] +
|
|
|
"\t<><74>д<EFBFBD><D0B4>" + onebtlinfo.Btlwritetable[de.Key] +
|
|
|
"\t<><74>ͬ<EFBFBD><CDAC>:" + onebtlinfo.Btlfromtctable[de.Key] + "\n");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
for (int btli = 0; btli < btllist.Count; btli++)
|
|
|
{
|
|
|
OriginBTL btlinfo = (OriginBTL)btllist[btli];
|
|
|
//<2F><><EFBFBD><EFBFBD>item_id<69><64><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6>cadͼֽ<CDBC><D6BD>Ϣ
|
|
|
object key = origintool.getKeyFromValue(btlinfo.Btltctable, "item_id");
|
|
|
object key_rev = origintool.getKeyFromValue(btlinfo.Btltctable, "item_revision_id");
|
|
|
if (key == null)
|
|
|
{
|
|
|
ed1.WriteMessage("ϵͳû<CDB3><C3BB><EFBFBD>ҵ<EFBFBD>item_id<69><64><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6>ͼֽ<CDBC><D6BD>Ϣ<EFBFBD><CFA2>ϵͳ<CFB5>ж<EFBFBD>\n");
|
|
|
continue;
|
|
|
}
|
|
|
if (key_rev == null)
|
|
|
{
|
|
|
ed1.WriteMessage("ϵͳû<CDB3><C3BB><EFBFBD>ҵ<EFBFBD>item_revision_id<69><64><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6>ͼֽ<CDBC><D6BD>Ϣ<EFBFBD><CFA2>ϵͳ<CFB5>ж<EFBFBD>\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("û<><C3BB><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>BOM<4F><4D><EFBFBD>£<EFBFBD>", "<22><>ʾ");
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (!hadlogin)
|
|
|
{
|
|
|
ed1.WriteMessage("<22><><EFBFBD><EFBFBD><EFBFBD>µ<EFBFBD>¼\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("û<><C3BB><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD>Ӧ<EFBFBD><D3A6>[ ItemID = " + itemID + " ItemRevsionID = " + itemRev + " ]<5D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>汾\n");
|
|
|
return;
|
|
|
}
|
|
|
ed1.WriteMessage("<22>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ = " + 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();
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD>µķ<C2B5>ʽ
|
|
|
GetItemFromIdResponse infoResp = dmService.GetItemFromId(infos, 1, pref);
|
|
|
ItemRevision revision = null;
|
|
|
//<2F><><EFBFBD>ð汾<C3B0>ϵ<EFBFBD><CFB5><EFBFBD><EFBFBD><EFBFBD>
|
|
|
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<ModelObject> qryObjList = new List<ModelObject>();
|
|
|
// 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;//<2F><>ȡBOMVIEW
|
|
|
if (boms == null || boms.Length < 1)//<2F><><EFBFBD><EFBFBD>bomviewΪ<77>ջ<EFBFBD><D5BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ0<CEAA><30><EFBFBD>˳<EFBFBD>
|
|
|
{
|
|
|
ed1.WriteMessage("û<><C3BB><EFBFBD>ҵ<EFBFBD>BOMVIEW \n");
|
|
|
MessageBox.Show("û<><C3BB><EFBFBD>ҵ<EFBFBD>BOMVIEW<45><57><EFBFBD><EFBFBD><EFBFBD><EFBFBD>BOM<4F><4D><EFBFBD>£<EFBFBD>", "<22><>ʾ");
|
|
|
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("û<><C3BB><EFBFBD>ҵ<EFBFBD><D2B5>汾<EFBFBD><E6B1BE><EFBFBD><EFBFBD> \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("û<><C3BB><EFBFBD>ҵ<EFBFBD>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("<22><><EFBFBD><EFBFBD>BOMʧ<4D><CAA7>\n");
|
|
|
MessageBox.Show("<22><><EFBFBD><EFBFBD>BOMʧ<4D>ܣ<EFBFBD><DCA3><EFBFBD><EFBFBD><EFBFBD>BOM<4F><4D><EFBFBD>£<EFBFBD>", "<22><>ʾ");
|
|
|
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("û<><C3BB>BOM<4F>ṹ\n");
|
|
|
MessageBox.Show("û<><C3BB>BOM<4F>ṹ<EFBFBD><E1B9B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>BOM<4F><4D><EFBFBD>£<EFBFBD>", "<22><>ʾ");
|
|
|
return;
|
|
|
}
|
|
|
List<BomMsgBean> bomMsgList = new List<BomMsgBean>();
|
|
|
|
|
|
//
|
|
|
//
|
|
|
ed1.WriteMessage("<22>õ<EFBFBD><C3B5><EFBFBD>ChildLines<65><73><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=" + 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");//<2F><><EFBFBD><EFBFBD>
|
|
|
//blMaterial = bomLine.Bl_item_uom_tag;jk8U8Number
|
|
|
//blMaterial = bomLine.GetPropertyDisplayableValue("tm2_material_bomline");//<2F><><EFBFBD><EFBFBD>
|
|
|
//blNote = bomLine.GetPropertyDisplayableValue("TM2_remark");//<2F><>ע
|
|
|
// 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 <20><><EFBFBD><EFBFBD>ѡ<EFBFBD>Ǿ<EFBFBD><C7BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD>Ĭ<EFBFBD>Ϲ<EFBFBD><CFB9>ܣ<EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD>ϸ<EFBFBD><CFB8><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>㣬ѡ<E3A3AC><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD>ϸ<EFBFBD><CFB8><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
tool.insertBomMXL(bomMsgList, eraseBOM);
|
|
|
ed1.WriteMessage("<22><>ϸ<EFBFBD><CFB8><EFBFBD>ṹ<EFBFBD><E1B9B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
MessageBox.Show("<22><>ϸ<EFBFBD><CFB8><EFBFBD>ṹ<EFBFBD><E1B9B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϣ<EFBFBD>BOM<4F><4D><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɣ<EFBFBD>", "<22><>ʾ");
|
|
|
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
///
|
|
|
/// </summary>
|
|
|
/// <param name="dmService"></param>
|
|
|
/// <param name="index"></param>
|
|
|
/// <param name="topBomline"></param>
|
|
|
/// <param name="bomMsgList"></param>
|
|
|
private void getBomStruct(DataManagementService dmService, int index, Teamcenter.Soa.Client.Model.Strong.BOMLine topBomline, List<BomMsgBean> 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<BomMsgBean> bomMsgList = new List<BomMsgBean>();
|
|
|
// 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<String> allPropertyList = new List<string>();
|
|
|
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());//<2F><><EFBFBD>ţ<EFBFBD><C5A3><EFBFBD><EFBFBD>ƣ<EFBFBD><C6A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϣ<EFBFBD><CFA3><EFBFBD><EFBFBD>أ<EFBFBD><D8A3><EFBFBD><EFBFBD>أ<EFBFBD><D8A3><EFBFBD>ע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 = "";//ע<>ͷ<EFBFBD>ĸ<EFBFBD><C4B8><EFBFBD><EFBFBD>ע<EFBFBD>Ͳ<EFBFBD>Ϊ<EFBFBD><CEAA>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>/<2F><>ĸ
|
|
|
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");//<2F><><EFBFBD><EFBFBD>
|
|
|
//blMaterial = bomLine.Bl_item_uom_tag;jk8U8Number
|
|
|
blMaterial = bomLine.GetPropertyDisplayableValue("XYMaterials");//<2F><><EFBFBD><EFBFBD>
|
|
|
blSingleWeight = bomLine.GetPropertyDisplayableValue("XYPartWeight");//<2F><><EFBFBD><EFBFBD>
|
|
|
kwc6_denominator = bomLine.GetPropertyDisplayableValue("bl_occ_kwc6_denominator");//ע<><D7A2>
|
|
|
ed.WriteMessage("kwc6_denominator:" + kwc6_denominator + "\n");
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>*<2A><><EFBFBD><EFBFBD>=<3D><><EFBFBD><EFBFBD>
|
|
|
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");//<2F><>ע
|
|
|
blNote = "";
|
|
|
for (int j = 0; j < values.Length; j++)
|
|
|
{
|
|
|
blNote = blNote + bomLine.GetPropertyDisplayableValue(values[j]);//<2F><>ע
|
|
|
|
|
|
}
|
|
|
//20240409ע<39>ͷ<EFBFBD>ĸ<EFBFBD><C4B8><EFBFBD><EFBFBD>ע<EFBFBD>Ͳ<EFBFBD>Ϊ<EFBFBD><CEAA>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>/<2F><>ĸ
|
|
|
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<30><34><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡBOMʱ<4D><CAB1>ij<EFBFBD><C4B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>²<EFBFBD><C2B2>ṹ<EFBFBD><E1B9B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϸ<EFBFBD><CFB8>Ϊ<EFBFBD>ն<EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>ID<49><44><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
// if (bomLine.Bl_child_lines == null || bomLine.Bl_child_lines.Length < 1)
|
|
|
// {
|
|
|
// chidLineMsg.CodeNo = bomLine.Bl_item_item_id;
|
|
|
// }
|
|
|
// else
|
|
|
// {
|
|
|
// //20240222<32><32><EFBFBD><EFBFBD>Ҫչʾ<D5B9><CABE><EFBFBD>в㼶<D0B2><E3BCB6>ֻ<EFBFBD>赥<EFBFBD><E8B5A5>
|
|
|
//// chidLineMsg.CodeNo = "";
|
|
|
//// getBomStruct(dmService, index, bomLine, bomMsgList);
|
|
|
// }
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
///
|
|
|
/// </summary>
|
|
|
/// <param name="bomMsgBeanList"></param>
|
|
|
/// <returns></returns>
|
|
|
///
|
|
|
[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("<22><>ȡ<EFBFBD><C8A1>ϸ<EFBFBD><CFB8> mxl \n");
|
|
|
//ɾ<><C9BE><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD><D0B5><EFBFBD>ϸ<EFBFBD><CFB8>
|
|
|
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("<22><>ȡ<EFBFBD><C8A1>ϸ<EFBFBD><CFB8> mxn \n");
|
|
|
//<2F><><EFBFBD>Ҵ<EFBFBD><D2B4><EFBFBD><EFBFBD><EFBFBD>ϸ<EFBFBD><CFB8><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC>
|
|
|
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");
|
|
|
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϸ<EFBFBD><CFB8>
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
return isOk;
|
|
|
}
|
|
|
public bool CreateBomStructure(ItemRevision parentRev, Dataset parent_ds, List<OriginMXL> 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");
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><CDB9><EFBFBD>
|
|
|
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("<22><>ϸ<EFBFBD><CFB8><EFBFBD><EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>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();
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>Item<65><6D><EFBFBD><EFBFBD>
|
|
|
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<72><6D><EFBFBD><EFBFBD>
|
|
|
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();
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Form<72><6D><EFBFBD>ԣ<EFBFBD><D4A3><EFBFBD>ִ<EFBFBD><D6B4><EFBFBD><EFBFBD><EFBFBD>´<EFBFBD><C2B4><EFBFBD>
|
|
|
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 == "<22><>ͼ")
|
|
|
{
|
|
|
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<72><6D><EFBFBD><EFBFBD>
|
|
|
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 + "<22><><EFBFBD><EFBFBD><EFBFBD>°汾<C2B0>ѷ<EFBFBD><D1B7><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
continue;
|
|
|
}
|
|
|
if (!itemRev.Is_modifiable)
|
|
|
{
|
|
|
MessageBox.Show("<22><>ǰ<EFBFBD>û<EFBFBD><C3BB><EFBFBD>Item IDΪ" + itemRev.Item_id + "<22><>Ȩ<EFBFBD>Ļ<DEB8><C4BB><EFBFBD>Item<65><6D><EFBFBD>°汾<C2B0>ѷ<EFBFBD><D1B7><EFBFBD>");
|
|
|
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();
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Form<72><6D><EFBFBD>ԣ<EFBFBD><D4A3><EFBFBD>ִ<EFBFBD><D6B4><EFBFBD><EFBFBD><EFBFBD>´<EFBFBD><C2B4><EFBFBD>
|
|
|
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("ȡ<><C8A1><EFBFBD><EFBFBD>" + 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 = "<22><>ǰ<EFBFBD><C7B0>ϸ<EFBFBD><CFB8>ͼֽ:" + cadstring + "<22><><EFBFBD><EFBFBD>ֵ" + cadvalue + "<22><>ϵͳ<CFB5><CDB3>:" + tcstring + "<22><><EFBFBD><EFBFBD>ֵ" + my_prop.StringValue + "<22><>һ<EFBFBD><D2BB>,<2C>Ƿ<C7B7>ϵͳ<CFB5><CDB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>?";
|
|
|
DialogResult updateresult = MessageBox.Show(message, "<22><>ʾ", 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 == "<22><>ͼ")
|
|
|
////{
|
|
|
//// 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
|
|
|
//<2F><><EFBFBD><EFBFBD>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("<22><>ʼ<CABC><D7BC>pse<73><65><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\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("<22><><EFBFBD><EFBFBD>" + 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("<22><>ʼǩ<CABC><C7A9>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("<22><>Ȩ<EFBFBD><EFBFBD>BOM<4F><4D>");
|
|
|
return false;
|
|
|
}
|
|
|
if (bvr.Checked_out == "Y")
|
|
|
{
|
|
|
MessageBox.Show("BOM<4F>Ѿ<EFBFBD>ǩ<EFBFBD><C7A9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȷ<EFBFBD><C8B7>ǩ<EFBFBD><C7A9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ִ<EFBFBD>б<EFBFBD><D0B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
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("<22><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>Bom\n");
|
|
|
try
|
|
|
{
|
|
|
Teamcenter.Services.Strong.Cad._2007_01.StructureManagement.CreateOrUpdateRelativeStructureResponse
|
|
|
cursResp = ssService.CreateOrUpdateRelativeStructure(structInfoVec, "view", true, sPref);
|
|
|
ed1.WriteMessage("Bom<6F><6D><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>\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 ǩ<><C7A9><EFBFBD>ɹ<EFBFBD>!\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();
|
|
|
}
|
|
|
|
|
|
//<2F><>tc<74><63>Item<65><6D><EFBFBD><EFBFBD><EFBFBD>Լ<EFBFBD><D4BC>ص<EFBFBD><D8B5><EFBFBD>ǰͼֽ<CDBC><D6BD>
|
|
|
[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("<22><><EFBFBD>Ƿ<EFBFBD>ȷ<EFBFBD><C8B7><EFBFBD><EFBFBD>ȡ<EFBFBD>ð汾<C3B0><E6B1BE><EFBFBD>ԣ<EFBFBD>", "<22><>ʾ", 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("<22><>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD>ȷ<EFBFBD><C8B7><EFBFBD><EFBFBD><EFBFBD>ݼ<EFBFBD><DDBC><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
MessageBox.Show("<22><>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD>ȷ<EFBFBD>İ汾");
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
//<2F><>tc<74><63>Item<65><6D><EFBFBD><EFBFBD><EFBFBD>Լ<EFBFBD><D4BC>ص<EFBFBD><D8B5><EFBFBD>ǰͼֽ<CDBC><D6BD> <20><><EFBFBD><EFBFBD>ȷ<EFBFBD>Ϻ<EFBFBD><CFBA>ķ<EFBFBD><C4B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƣ<EFBFBD>
|
|
|
// 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("<22><><EFBFBD>ļ<EFBFBD>Ϊֻ<CEAA><D6BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܸ<EFBFBD><DCB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!");
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
OriginTool origintool = new OriginTool();
|
|
|
|
|
|
|
|
|
ed1.WriteMessage("\n<><6E>ʼ<EFBFBD><CABC>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ...\n");
|
|
|
/************************************************************************/
|
|
|
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD>ݵĴ<DDB5><C4B4><EFBFBD> */
|
|
|
/************************************************************************/
|
|
|
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("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƣ<EFBFBD>" + onebtlinfo.Btlname + "\n");
|
|
|
ed1.WriteMessage("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϸ<EFBFBD><CFB8>Ϣ:" + "\n");
|
|
|
foreach (DictionaryEntry de in onebtlinfo.Btldatatable)
|
|
|
{
|
|
|
ed1.WriteMessage("CAD<41><44><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>" + de.Key + "\tCAD<41><44><EFBFBD><EFBFBD>ֵ:" + de.Value +
|
|
|
"\tTC<54><43><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:" + onebtlinfo.Btltctable[de.Key] +
|
|
|
"\tTCϵͳ<CFB5><CDB3><EFBFBD><EFBFBD>:" + onebtlinfo.Btltypetable[de.Key] +
|
|
|
"\t<><74>д<EFBFBD><D0B4>" + onebtlinfo.Btlwritetable[de.Key] +
|
|
|
"\t<><74>ͬ<EFBFBD><CDAC>:" + onebtlinfo.Btlfromtctable[de.Key] + "\n");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
for (int btli = 0; btli < btllist.Count; btli++)
|
|
|
{
|
|
|
OriginBTL btlinfo = (OriginBTL)btllist[btli];
|
|
|
//<2F><><EFBFBD><EFBFBD>item_id<69><64><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6>cadͼֽ<CDBC><D6BD>Ϣ
|
|
|
object key = origintool.getKeyFromValue(btlinfo.Btltctable, "item_id");
|
|
|
object key_rev = origintool.getKeyFromValue(btlinfo.Btltctable, "item_revision_id");
|
|
|
if (key == null)
|
|
|
{
|
|
|
ed1.WriteMessage("ϵͳû<CDB3><C3BB><EFBFBD>ҵ<EFBFBD>item_id<69><64><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6>ͼֽ<CDBC><D6BD>Ϣ<EFBFBD><CFA2>ϵͳ<CFB5>ж<EFBFBD>\n");
|
|
|
return;
|
|
|
}
|
|
|
if (key_rev == null)
|
|
|
{
|
|
|
ed1.WriteMessage("ϵͳû<CDB3><C3BB><EFBFBD>ҵ<EFBFBD>item_revision_id<69><64><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6>ͼֽ<CDBC><D6BD>Ϣ<EFBFBD><CFA2>ϵͳ<CFB5>ж<EFBFBD>\n");
|
|
|
return;
|
|
|
}
|
|
|
//itemID = btlinfo.Btldatatable[key].ToString();
|
|
|
//if (itemID == null || itemID.Trim().Equals(""))
|
|
|
//{
|
|
|
// ed1.WriteMessage("<22><>ȡ<EFBFBD><C8A1>Item<65><6D>ϢΪ<CFA2>գ<EFBFBD>ϵͳ<CFB5><CDB3><EFBFBD><EFBFBD>ѭ<EFBFBD><D1AD>\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("<22>ҵ<EFBFBD><D2B5><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Item<65><6D><EFBFBD>Ƿ<EFBFBD>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD>", "<22><>ʾ", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
|
|
|
// if (upresult == DialogResult.No || upresult == DialogResult.None)
|
|
|
// {
|
|
|
// ed1.WriteMessage("<22><><EFBFBD><EFBFBD>ͬ<EFBFBD><CDAC>\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("<22><>ǰΪ<C7B0><CEAA><EFBFBD><EFBFBD>ͼֽ<CDBC><D6BD><EFBFBD><EFBFBD><EFBFBD>ܸ<EFBFBD><DCB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!");
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
// document2.Name
|
|
|
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (object_type.Equals("TM2_TEdrawing"))
|
|
|
{
|
|
|
MessageBox.Show("<22><>ǰΪ<C7B0><CEAA><EFBFBD><EFBFBD>ͼֽ<CDBC><D6BD><EFBFBD><EFBFBD><EFBFBD>ܸ<EFBFBD><DCB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!");
|
|
|
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();
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD>µķ<C2B5>ʽ
|
|
|
GetItemFromIdResponse infoResp = dmService.GetItemFromId(infos, 1, pref);
|
|
|
|
|
|
//<><D7BC>д<EFBFBD><D0B4>CADͼֽ<CDBC>ϵ<EFBFBD><CFB5><EFBFBD>Ϣ
|
|
|
Hashtable tempvaluetable = new Hashtable();
|
|
|
|
|
|
//<><D7BC>дU8<55><38><EFBFBD>뵽CADͼֽ<CDBC>ϵ<EFBFBD>
|
|
|
Hashtable u8valuetable = new Hashtable();
|
|
|
|
|
|
//<2F><>ȡItem<65>ϵ<EFBFBD><CFB5><EFBFBD><EFBFBD><EFBFBD>
|
|
|
if (btlinfo.Btltypetable.ContainsValue("Item"))
|
|
|
{
|
|
|
ed1.WriteMessage("<22><><EFBFBD><EFBFBD>ͬ<EFBFBD><CDAC>Item<65><6D><EFBFBD><EFBFBD>\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("ȡ<><C8A1><EFBFBD><EFBFBD>" + 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ϵͳ<CFB5>е<EFBFBD><D0B5><EFBFBD><EFBFBD><EFBFBD>" + tcstring + "ֵΪ <20><>" + tempcadvalue + "\n");
|
|
|
if (cadvalue != tempcadvalue)
|
|
|
{
|
|
|
origintool.TableHasKey(tempvaluetable, cadstring, tempcadvalue);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//<2F><><EFBFBD>ð汾<C3B0>ϵ<EFBFBD><CFB5><EFBFBD><EFBFBD><EFBFBD>
|
|
|
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û<6D>ж<EFBFBD>Ӧ<EFBFBD>汾\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 + "]û<>ж<EFBFBD>Ӧ[" + itemRev2 + "]<5D>汾\n");
|
|
|
continue;
|
|
|
}
|
|
|
ed1.WriteMessage("Item[" + itemID + "]<5D>ҵ<EFBFBD><D2B5><EFBFBD>Ӧ[" + itemRev2 + "]<5D>汾\n");
|
|
|
|
|
|
ReleaseStatus[] releaselist = itemRev.Release_status_list;
|
|
|
// if (!itemRev.Is_modifiable)
|
|
|
// {
|
|
|
// MessageBox.Show("ItemRevisionΪֻ<CEAA><D6BB>,<2C><>û<EFBFBD>б<EFBFBD><D0B1><EFBFBD>Ȩ<EFBFBD><C8A8>!");
|
|
|
// return;
|
|
|
// }
|
|
|
//if (releaselist.Length > 0)
|
|
|
//{
|
|
|
// string message = "Item IDΪ" + itemRev.Item_id + "<22><><EFBFBD><EFBFBD><EFBFBD>°汾<C2B0>ѷ<EFBFBD><D1B7><EFBFBD><EFBFBD><EFBFBD>";
|
|
|
// MessageBox.Show(message);
|
|
|
// return;
|
|
|
//}
|
|
|
|
|
|
if (btlinfo.Btltypetable.ContainsValue("ItemRevision"))
|
|
|
{
|
|
|
ed1.WriteMessage("<22><><EFBFBD><EFBFBD>ͬ<EFBFBD><CDAC>ItemRevision<6F><6E><EFBFBD><EFBFBD>\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("ȡ<><C8A1><EFBFBD><EFBFBD>" + 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ϵͳ<CFB5>е<EFBFBD><D0B5><EFBFBD><EFBFBD><EFBFBD>" + tcstring + "ֵΪ <20><>" + tempcadvalue + "\n");
|
|
|
if (cadvalue != tempcadvalue)
|
|
|
{
|
|
|
if (!cadstring.Equals("U8<55><38><EFBFBD><EFBFBD>"))
|
|
|
{
|
|
|
origintool.TableHasKey(tempvaluetable, cadstring, tempcadvalue);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
origintool.TableHasKey(u8valuetable, cadstring, tempcadvalue);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//<2F><><EFBFBD>ð汾<C3B0><E6B1BE><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5><EFBFBD><EFBFBD><EFBFBD>
|
|
|
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("<22><><EFBFBD><EFBFBD>ͬ<EFBFBD><CDAC>ItemRevision<6F><6E><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\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("ȡ<><C8A1><EFBFBD><EFBFBD>" + 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ϵͳ<CFB5>е<EFBFBD><D0B5><EFBFBD><EFBFBD><EFBFBD>" + tcstring + "ֵΪ <20><>" + tempcadvalue + "\n");
|
|
|
if (cadvalue != tempcadvalue)
|
|
|
{
|
|
|
origintool.TableHasKey(tempvaluetable, cadstring, tempcadvalue);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD><EFBFBD>Ҫͬ<D2AA><CDAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ռ<EFBFBD><D5BC><EFBFBD><EFBFBD><EFBFBD>
|
|
|
foreach (DictionaryEntry de in tempvaluetable)
|
|
|
{
|
|
|
ed1.WriteMessage("CAD<41><44><EFBFBD><EFBFBD>:" + de.Key.ToString() + "\tֵ:" + de.Value.ToString() + "\n");
|
|
|
}
|
|
|
ed1.WriteMessage("Btlname=" + btlinfo.Btlname + "\n");
|
|
|
string btlname = btlinfo.Btlname;
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><D0B4>CADͼֽ
|
|
|
origintool.SetTitleInfo_open(btlinfo.Btlname, tempvaluetable);//
|
|
|
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
} |