|
|
@ -8,6 +8,7 @@ package cn.com.origin.autocode.newitem.generatcode;
|
|
|
|
import java.awt.Dimension;
|
|
|
|
import java.awt.Dimension;
|
|
|
|
import java.awt.Toolkit;
|
|
|
|
import java.awt.Toolkit;
|
|
|
|
import java.awt.datatransfer.StringSelection;
|
|
|
|
import java.awt.datatransfer.StringSelection;
|
|
|
|
|
|
|
|
import java.io.File;
|
|
|
|
import java.io.IOException;
|
|
|
|
import java.io.IOException;
|
|
|
|
import java.math.BigInteger;
|
|
|
|
import java.math.BigInteger;
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
@ -107,6 +108,7 @@ import com.teamcenter.rac.kernel.TCComponentPseudoFolder;
|
|
|
|
import com.teamcenter.rac.kernel.TCComponentQuery;
|
|
|
|
import com.teamcenter.rac.kernel.TCComponentQuery;
|
|
|
|
import com.teamcenter.rac.kernel.TCComponentQueryType;
|
|
|
|
import com.teamcenter.rac.kernel.TCComponentQueryType;
|
|
|
|
import com.teamcenter.rac.kernel.TCComponentRole;
|
|
|
|
import com.teamcenter.rac.kernel.TCComponentRole;
|
|
|
|
|
|
|
|
import com.teamcenter.rac.kernel.TCComponentTcFile;
|
|
|
|
import com.teamcenter.rac.kernel.TCComponentUser;
|
|
|
|
import com.teamcenter.rac.kernel.TCComponentUser;
|
|
|
|
import com.teamcenter.rac.kernel.TCException;
|
|
|
|
import com.teamcenter.rac.kernel.TCException;
|
|
|
|
import com.teamcenter.rac.kernel.TCExceptionPartial;
|
|
|
|
import com.teamcenter.rac.kernel.TCExceptionPartial;
|
|
|
@ -134,7 +136,7 @@ import com.teamcenter.soaictstubs.stringSeq_tHolder;
|
|
|
|
public class NewCodeItemDialog extends Dialog {
|
|
|
|
public class NewCodeItemDialog extends Dialog {
|
|
|
|
//是否为文档
|
|
|
|
//是否为文档
|
|
|
|
private boolean isDoc = false;
|
|
|
|
private boolean isDoc = false;
|
|
|
|
private String leftMostCodeRuleNameString = "";
|
|
|
|
private String leftMostCodeRuleNameString = "";//选中的编码规则名称
|
|
|
|
private String docTypeValue = "";
|
|
|
|
private String docTypeValue = "";
|
|
|
|
// 表单类型中英文对照
|
|
|
|
// 表单类型中英文对照
|
|
|
|
private SashForm sashFormCodeView;
|
|
|
|
private SashForm sashFormCodeView;
|
|
|
@ -646,6 +648,7 @@ public class NewCodeItemDialog extends Dialog {
|
|
|
|
* 新建的 UI 组件-Label放在objPropComposite下,内容组件根据类型创建后放在
|
|
|
|
* 新建的 UI 组件-Label放在objPropComposite下,内容组件根据类型创建后放在
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public void addGeneralPropComosite() {
|
|
|
|
public void addGeneralPropComosite() {
|
|
|
|
|
|
|
|
System.out.println("addGeneralPropComosite");
|
|
|
|
boolean isDocType = false;//当前属性名称是否为文档类型?
|
|
|
|
boolean isDocType = false;//当前属性名称是否为文档类型?
|
|
|
|
for (int i = 0; i < generalPropLabelList.size(); i++) {
|
|
|
|
for (int i = 0; i < generalPropLabelList.size(); i++) {
|
|
|
|
Label label = generalPropLabelList.get(i);
|
|
|
|
Label label = generalPropLabelList.get(i);
|
|
|
@ -661,7 +664,7 @@ public class NewCodeItemDialog extends Dialog {
|
|
|
|
//20250425新增 将最左侧选中的编码规则名称写入到最右侧的文档类别中
|
|
|
|
//20250425新增 将最左侧选中的编码规则名称写入到最右侧的文档类别中
|
|
|
|
String currentPropName = cnProp.getDisplayName();//当前遍历的对象or分类属性名称
|
|
|
|
String currentPropName = cnProp.getDisplayName();//当前遍历的对象or分类属性名称
|
|
|
|
System.out.println("当前创建的UI组件Label名称="+currentPropName);
|
|
|
|
System.out.println("当前创建的UI组件Label名称="+currentPropName);
|
|
|
|
if(currentPropName != null && currentPropName.equals("文档类型") && docTypeValue != null && !docTypeValue.equals("")){
|
|
|
|
if(currentPropName != null && currentPropName.equals("文档类别") && docTypeValue != null && !docTypeValue.equals("")){
|
|
|
|
System.out.println("“文档类别”匹配成功!属性值设置为最左侧选中编码名称="+docTypeValue);
|
|
|
|
System.out.println("“文档类别”匹配成功!属性值设置为最左侧选中编码名称="+docTypeValue);
|
|
|
|
isDocType = true;
|
|
|
|
isDocType = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1660,7 +1663,7 @@ public class NewCodeItemDialog extends Dialog {
|
|
|
|
if(selectedData.getChildrenTreeData() != null && selectedData.getChildrenTreeData().length>0) {
|
|
|
|
if(selectedData.getChildrenTreeData() != null && selectedData.getChildrenTreeData().length>0) {
|
|
|
|
System.out.println("不是最底层");
|
|
|
|
System.out.println("不是最底层");
|
|
|
|
btFlg = true;
|
|
|
|
btFlg = true;
|
|
|
|
System.out.println("nodeName:"+selectedData.getPackCodeNodeInfo().getNode_name());
|
|
|
|
System.out.println("》》》nodeName:"+selectedData.getPackCodeNodeInfo().getNode_name());
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}else {
|
|
|
|
}else {
|
|
|
|
System.out.println("是最底层");
|
|
|
|
System.out.println("是最底层");
|
|
|
@ -1671,9 +1674,10 @@ public class NewCodeItemDialog extends Dialog {
|
|
|
|
String name = "";
|
|
|
|
String name = "";
|
|
|
|
// 得到编码相关信息
|
|
|
|
// 得到编码相关信息
|
|
|
|
getCodeInfo(selectedData);
|
|
|
|
getCodeInfo(selectedData);
|
|
|
|
//TODO 根据得到的编码信息,假设得到创建对象的类型为文档
|
|
|
|
//KUMA 根据得到的编码信息,假设得到创建对象的类型为文档
|
|
|
|
if(isDoc){//如果创建对象是文档,
|
|
|
|
if(isDoc){//如果创建对象是文档,
|
|
|
|
//1.获取最左侧区域选中的的编码规则名称
|
|
|
|
//1.获取最左侧区域选中的的编码规则名称
|
|
|
|
|
|
|
|
System.out.println("当前新建对象类型为“文档”");
|
|
|
|
AbstractTreeData leftTreeData = selectedData.getParentTreeData();
|
|
|
|
AbstractTreeData leftTreeData = selectedData.getParentTreeData();
|
|
|
|
if (leftTreeData != null) {
|
|
|
|
if (leftTreeData != null) {
|
|
|
|
leftMostCodeRuleNameString = leftTreeData.getPackCodeNodeInfo().getNode_name();
|
|
|
|
leftMostCodeRuleNameString = leftTreeData.getPackCodeNodeInfo().getNode_name();
|
|
|
@ -1692,7 +1696,7 @@ public class NewCodeItemDialog extends Dialog {
|
|
|
|
System.out.println("第一部分: " + firstPart);
|
|
|
|
System.out.println("第一部分: " + firstPart);
|
|
|
|
System.out.println("第二部分: " + secondPart);
|
|
|
|
System.out.println("第二部分: " + secondPart);
|
|
|
|
if (firstPart.equals(leftMostCodeRuleNameString)) {
|
|
|
|
if (firstPart.equals(leftMostCodeRuleNameString)) {
|
|
|
|
//将此secondPart填入最右侧区域中的属性“文档类别”下
|
|
|
|
//将此secondPart赋值给全局变量docTypeValue,将在addGeneralPropComosite中填入最右侧区域中的属性“文档类别”下
|
|
|
|
docTypeValue = secondPart;
|
|
|
|
docTypeValue = secondPart;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}else {
|
|
|
|
}else {
|
|
|
@ -1730,12 +1734,13 @@ public class NewCodeItemDialog extends Dialog {
|
|
|
|
if (currentNodeDesc.trim().length() > 0) {
|
|
|
|
if (currentNodeDesc.trim().length() > 0) {
|
|
|
|
codeDesc = codeDesc + currentNodeDesc;
|
|
|
|
codeDesc = codeDesc + currentNodeDesc;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!TCPreferenceUitl.isTrueTCPreferenceValue(session,
|
|
|
|
//ss
|
|
|
|
origin_isItemNameTextDefaultNull)) {
|
|
|
|
if (!TCPreferenceUitl.isTrueTCPreferenceValue(session,origin_isItemNameTextDefaultNull)) {
|
|
|
|
nameText.setText(name);
|
|
|
|
nameText.setText(name);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
nameText.setText("");
|
|
|
|
nameText.setText("");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
getFinalPattern();
|
|
|
|
getFinalPattern();
|
|
|
|
// idText.setText(pattern);
|
|
|
|
// idText.setText(pattern);
|
|
|
|
idText.setText(finalPattern);
|
|
|
|
idText.setText(finalPattern);
|
|
|
@ -1796,8 +1801,7 @@ public class NewCodeItemDialog extends Dialog {
|
|
|
|
icoPropertyMap = listView.getIcoPropertyMap();
|
|
|
|
icoPropertyMap = listView.getIcoPropertyMap();
|
|
|
|
revText.setText(tccomponentitemtype.getNewRev(null));
|
|
|
|
revText.setText(tccomponentitemtype.getNewRev(null));
|
|
|
|
|
|
|
|
|
|
|
|
if (!TCPreferenceUitl.isTrueTCPreferenceValue(session,
|
|
|
|
if (!TCPreferenceUitl.isTrueTCPreferenceValue(session,origin_isItemNameTextDefaultNull)) {
|
|
|
|
origin_isItemNameTextDefaultNull)) {
|
|
|
|
|
|
|
|
nameText.setText(firstListICOName);
|
|
|
|
nameText.setText(firstListICOName);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
nameText.setText("");
|
|
|
|
nameText.setText("");
|
|
|
@ -1940,6 +1944,16 @@ public class NewCodeItemDialog extends Dialog {
|
|
|
|
String parentName = "";
|
|
|
|
String parentName = "";
|
|
|
|
|
|
|
|
|
|
|
|
if (treeData != null) {
|
|
|
|
if (treeData != null) {
|
|
|
|
|
|
|
|
//判断当前新建对象是否属于“文档”这一类别
|
|
|
|
|
|
|
|
String nodeNameCurrent = treeData.getPackCodeNodeInfo().getNode_name();
|
|
|
|
|
|
|
|
String nodetypeCurrent = treeData.getPackCodeNodeInfo().getNode_type();
|
|
|
|
|
|
|
|
System.out.println("当前节点【"+nodeNameCurrent+"】属于【"+nodetypeCurrent+"】类别");
|
|
|
|
|
|
|
|
if (nodeNameCurrent.contains("文档")){
|
|
|
|
|
|
|
|
System.out.println("当前节点属于【文档】类别");
|
|
|
|
|
|
|
|
isDoc = true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
AbstractTreeData parentData = treeData.getParentTreeData();
|
|
|
|
AbstractTreeData parentData = treeData.getParentTreeData();
|
|
|
|
|
|
|
|
|
|
|
|
if ((parentData != null) && (parentData.getPackCodeNodeInfo().getNodeComponent() != null)) {
|
|
|
|
if ((parentData != null) && (parentData.getPackCodeNodeInfo().getNodeComponent() != null)) {
|
|
|
@ -1968,9 +1982,12 @@ public class NewCodeItemDialog extends Dialog {
|
|
|
|
originFatherData = treeData;
|
|
|
|
originFatherData = treeData;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (originFatherData != null) {
|
|
|
|
System.out.println("编码树视图选中对象的始祖对象="+originFatherData.getPackCodeNodeInfo().getNode_name()+"\n 类型="+originFatherData.getPackCodeNodeInfo().getNode_type());
|
|
|
|
System.out.println("编码树视图选中对象的始祖对象="+originFatherData.getPackCodeNodeInfo().getNode_name()+"\n 类型="+originFatherData.getPackCodeNodeInfo().getNode_type());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void initTreeOrListMouseClick() {
|
|
|
|
private void initTreeOrListMouseClick() {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
if (treeViewOperation.getSelectedTreeNode(classificationTreeViewer) == null) {
|
|
|
|
if (treeViewOperation.getSelectedTreeNode(classificationTreeViewer) == null) {
|
|
|
@ -3221,15 +3238,41 @@ public class NewCodeItemDialog extends Dialog {
|
|
|
|
|
|
|
|
|
|
|
|
//20250425 新增:文档创建后,根据 ID=编码规则名称 带出数据集模板
|
|
|
|
//20250425 新增:文档创建后,根据 ID=编码规则名称 带出数据集模板
|
|
|
|
if (newComp != null && isDoc){
|
|
|
|
if (newComp != null && isDoc){
|
|
|
|
if (leftMostCodeRuleNameString != null && !leftMostCodeRuleNameString.isEmpty()){
|
|
|
|
//获取新建对象的版本对象-rev
|
|
|
|
//1.调用查询,获取版本对象,下载数据集到本地
|
|
|
|
TCComponentItemRevision rev = null;
|
|
|
|
|
|
|
|
if (newComp instanceof TCComponentItemRevision){
|
|
|
|
|
|
|
|
rev = (TCComponentItemRevision) newComp;
|
|
|
|
|
|
|
|
} else if (newComp instanceof TCComponentItem) {
|
|
|
|
|
|
|
|
rev = ((TCComponentItem) newComp).getLatestItemRevision();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (leftMostCodeRuleNameString != null && !leftMostCodeRuleNameString.isEmpty()){
|
|
|
|
|
|
|
|
//1.KUMA 调用查询,获取版本对象,下载数据集到本地
|
|
|
|
|
|
|
|
TCComponent[] searchs = session.search("零组件 ID",
|
|
|
|
|
|
|
|
new String[] { "零组件 ID"},
|
|
|
|
|
|
|
|
new String[] { leftMostCodeRuleNameString});
|
|
|
|
|
|
|
|
if (searchs.length > 0){
|
|
|
|
|
|
|
|
if (searchs[0] instanceof TCComponentItemRevision){
|
|
|
|
|
|
|
|
TCComponentItemRevision itemRevision = (TCComponentItemRevision) searchs[0];
|
|
|
|
|
|
|
|
//将查询到的版本对象的"规范"关系下的数据集
|
|
|
|
|
|
|
|
TCComponent[] referenceListProperty = itemRevision.getReferenceListProperty("IMAN_specification");
|
|
|
|
|
|
|
|
if (referenceListProperty != null && referenceListProperty.length > 0){
|
|
|
|
|
|
|
|
for (TCComponent tcComponent : referenceListProperty){
|
|
|
|
|
|
|
|
if (tcComponent instanceof TCComponentDataset) {
|
|
|
|
|
|
|
|
TCComponentDataset dataset_old = (TCComponentDataset) tcComponent;
|
|
|
|
|
|
|
|
TCComponentDataset dataset_new = dataset_old.saveAs(null);
|
|
|
|
|
|
|
|
//2.将数据集上传到新建版本对象中
|
|
|
|
|
|
|
|
rev.add("IMAN_specification", dataset_new);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//2.将本地数据集上传到新建版本对象中
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (targetObject != null) {
|
|
|
|
if (targetObject != null) {
|
|
|
|
targetObject.refresh();
|
|
|
|
targetObject.refresh();
|
|
|
|