|
|
|
@ -8,8 +8,10 @@ package cn.com.origin.autocode.newitem.generatcode;
|
|
|
|
|
import java.awt.Dimension;
|
|
|
|
|
import java.awt.Toolkit;
|
|
|
|
|
import java.awt.datatransfer.StringSelection;
|
|
|
|
|
import java.io.File;
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
import java.math.BigInteger;
|
|
|
|
|
import java.text.ParseException;
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.Arrays;
|
|
|
|
@ -24,6 +26,7 @@ import javax.swing.JDialog;
|
|
|
|
|
import javax.xml.bind.JAXBException;
|
|
|
|
|
import javax.xml.transform.Source;
|
|
|
|
|
|
|
|
|
|
import org.apache.log4j.Logger;
|
|
|
|
|
import org.eclipse.jface.dialogs.Dialog;
|
|
|
|
|
import org.eclipse.jface.dialogs.IDialogConstants;
|
|
|
|
|
import org.eclipse.jface.viewers.TreeViewer;
|
|
|
|
@ -101,12 +104,14 @@ import com.teamcenter.rac.kernel.TCComponentItem;
|
|
|
|
|
import com.teamcenter.rac.kernel.TCComponentItemRevision;
|
|
|
|
|
import com.teamcenter.rac.kernel.TCComponentItemType;
|
|
|
|
|
import com.teamcenter.rac.kernel.TCComponentListOfValues;
|
|
|
|
|
import com.teamcenter.rac.kernel.TCComponentListOfValuesType;
|
|
|
|
|
import com.teamcenter.rac.kernel.TCComponentProject;
|
|
|
|
|
import com.teamcenter.rac.kernel.TCComponentProjectType;
|
|
|
|
|
import com.teamcenter.rac.kernel.TCComponentPseudoFolder;
|
|
|
|
|
import com.teamcenter.rac.kernel.TCComponentQuery;
|
|
|
|
|
import com.teamcenter.rac.kernel.TCComponentQueryType;
|
|
|
|
|
import com.teamcenter.rac.kernel.TCComponentRole;
|
|
|
|
|
import com.teamcenter.rac.kernel.TCComponentTcFile;
|
|
|
|
|
import com.teamcenter.rac.kernel.TCComponentUser;
|
|
|
|
|
import com.teamcenter.rac.kernel.TCException;
|
|
|
|
|
import com.teamcenter.rac.kernel.TCExceptionPartial;
|
|
|
|
@ -132,9 +137,12 @@ import com.teamcenter.soaictstubs.booleanSeq_tHolder;
|
|
|
|
|
import com.teamcenter.soaictstubs.stringSeq_tHolder;
|
|
|
|
|
|
|
|
|
|
public class NewCodeItemDialog extends Dialog {
|
|
|
|
|
private static final Logger log = Logger.getLogger(NewCodeItemDialog.class);
|
|
|
|
|
|
|
|
|
|
//是否为文档
|
|
|
|
|
private boolean isDoc = false;
|
|
|
|
|
private String leftMostCodeRuleNameString = "";
|
|
|
|
|
private String leftMostCodeRuleNameString = "";//选中的编码规则名称
|
|
|
|
|
private String docTypeValue = "";
|
|
|
|
|
// 表单类型中英文对照
|
|
|
|
|
private SashForm sashFormCodeView;
|
|
|
|
|
private CTabItem codeTreeCTab;
|
|
|
|
@ -310,6 +318,7 @@ public class NewCodeItemDialog extends Dialog {
|
|
|
|
|
|
|
|
|
|
public NewCodeItemDialog(Shell parentShell) {
|
|
|
|
|
super(parentShell);
|
|
|
|
|
System.out.println("NewCodeItemDialog~");
|
|
|
|
|
treeViewOperation = new TreeViewOperation();
|
|
|
|
|
treeAndListCodeOperation = new TreeAndListCodeOperation();
|
|
|
|
|
session = (TCSession) AIFUtility.getCurrentApplication().getSession();
|
|
|
|
@ -471,6 +480,7 @@ public class NewCodeItemDialog extends Dialog {
|
|
|
|
|
* 绘制分类属性界面
|
|
|
|
|
*/
|
|
|
|
|
public void addClassPropComosite(String classID) {
|
|
|
|
|
log.info("classID:"+classID);
|
|
|
|
|
System.out.println("classID:"+classID);
|
|
|
|
|
cId = classID;
|
|
|
|
|
// classPropComposite.dispose();
|
|
|
|
@ -519,9 +529,9 @@ public class NewCodeItemDialog extends Dialog {
|
|
|
|
|
classLabelList.add(label);
|
|
|
|
|
Widget widget = null;
|
|
|
|
|
if (!bean.isLov) {
|
|
|
|
|
// System.out.println(ICSFormat.STRING +
|
|
|
|
|
// log.info(ICSFormat.STRING +
|
|
|
|
|
// "|"+ICSFormat.INTEGER +"|"+ICSFormat.REAL);
|
|
|
|
|
// System.out.println(bean.formate
|
|
|
|
|
// log.info(bean.formate
|
|
|
|
|
// +" | "+bean.propDisName +" | " + bean.attrType );
|
|
|
|
|
if (bean.attrType == ICSFormat.STRING) {
|
|
|
|
|
|
|
|
|
@ -645,6 +655,8 @@ public class NewCodeItemDialog extends Dialog {
|
|
|
|
|
* 新建的 UI 组件-Label放在objPropComposite下,内容组件根据类型创建后放在
|
|
|
|
|
*/
|
|
|
|
|
public void addGeneralPropComosite() {
|
|
|
|
|
log.info("addGeneralPropComosite");
|
|
|
|
|
System.out.println("addGeneralPropComosite");
|
|
|
|
|
boolean isDocType = false;//当前属性名称是否为文档类型?
|
|
|
|
|
for (int i = 0; i < generalPropLabelList.size(); i++) {
|
|
|
|
|
Label label = generalPropLabelList.get(i);
|
|
|
|
@ -658,11 +670,14 @@ public class NewCodeItemDialog extends Dialog {
|
|
|
|
|
if (this.cnpropList != null) {
|
|
|
|
|
for (CNProperty cnProp : this.cnpropList) {
|
|
|
|
|
//20250425新增 将最左侧选中的编码规则名称写入到最右侧的文档类别中
|
|
|
|
|
Stirng currentPropName = cnProp.getDisplayName();//当前遍历的对象or分类属性名称
|
|
|
|
|
String currentPropName = cnProp.getDisplayName();//当前遍历的对象or分类属性名称
|
|
|
|
|
log.info("当前创建的UI组件Label名称="+currentPropName);
|
|
|
|
|
log.info("即将写入“文档类别”组件的值="+docTypeValue);
|
|
|
|
|
System.out.println("当前创建的UI组件Label名称="+currentPropName);
|
|
|
|
|
if(currentPropName != null && currentPropName.equals("文档类别") && leftMostCodeRuleNameString != null && !leftMostCodeRuleNameString.equals("")){
|
|
|
|
|
System.out.println("“文档类别”匹配成功!属性值设置为最左侧选中编码名称="+leftMostCodeRuleNameString);
|
|
|
|
|
// widget.setText(leftMostCodeRuleNameString);
|
|
|
|
|
System.out.println("即将写入“文档类别”组件的值="+docTypeValue);
|
|
|
|
|
if(currentPropName != null && currentPropName.equals("文档类别") && docTypeValue != null && !docTypeValue.equals("")){
|
|
|
|
|
log.info("“文档类别”匹配成功!属性值设置为最左侧选中编码名称="+docTypeValue);
|
|
|
|
|
System.out.println("“文档类别”匹配成功!属性值设置为最左侧选中编码名称="+docTypeValue);
|
|
|
|
|
isDocType = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -675,7 +690,7 @@ public class NewCodeItemDialog extends Dialog {
|
|
|
|
|
final Text text = CreateCompositeUtil.createNewText(objPropComposite, cnProp.getDefaultValue());
|
|
|
|
|
// text.setText(cnProp.getDefaultValue());
|
|
|
|
|
if (isDocType){
|
|
|
|
|
text.setText(leftMostCodeRuleNameString);
|
|
|
|
|
text.setText(docTypeValue);
|
|
|
|
|
}else {
|
|
|
|
|
text.setText(cnProp.getDefaultValue());
|
|
|
|
|
}
|
|
|
|
@ -684,7 +699,7 @@ public class NewCodeItemDialog extends Dialog {
|
|
|
|
|
final Text text = CreateCompositeUtil.createNewText(objPropComposite, cnProp.getDefaultValue());
|
|
|
|
|
// text.setText("0");
|
|
|
|
|
if (isDocType){
|
|
|
|
|
text.setText(leftMostCodeRuleNameString);
|
|
|
|
|
text.setText(docTypeValue);
|
|
|
|
|
}else {
|
|
|
|
|
text.setText("0");
|
|
|
|
|
}
|
|
|
|
@ -700,7 +715,7 @@ public class NewCodeItemDialog extends Dialog {
|
|
|
|
|
final Text text = CreateCompositeUtil.createNewText(objPropComposite, cnProp.getDefaultValue());
|
|
|
|
|
// text.setText("0");
|
|
|
|
|
if (isDocType){
|
|
|
|
|
text.setText(leftMostCodeRuleNameString);
|
|
|
|
|
text.setText(docTypeValue);
|
|
|
|
|
}else {
|
|
|
|
|
text.setText("0");
|
|
|
|
|
}
|
|
|
|
@ -721,9 +736,9 @@ public class NewCodeItemDialog extends Dialog {
|
|
|
|
|
} else if (cnProp.getPropertyType().toUpperCase().equals("BOOLEAN")) {
|
|
|
|
|
final Combo comb = CreateCompositeUtil.createNotFillNewCombo(objPropComposite,
|
|
|
|
|
new String[] { "true", "false" }); // new
|
|
|
|
|
comb.setText(cnProp.getDefaultValue()); // Combo(propTable,
|
|
|
|
|
// comb.setText(cnProp.getDefaultValue()); // Combo(propTable,
|
|
|
|
|
if (isDocType){
|
|
|
|
|
comb.setText(leftMostCodeRuleNameString);
|
|
|
|
|
comb.setText(docTypeValue);
|
|
|
|
|
}else {
|
|
|
|
|
comb.setText(cnProp.getDefaultValue());
|
|
|
|
|
}
|
|
|
|
@ -798,9 +813,10 @@ public class NewCodeItemDialog extends Dialog {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
isDocType = false;
|
|
|
|
|
generalPropTextList.add(widget);
|
|
|
|
|
}
|
|
|
|
|
docTypeValue = "";
|
|
|
|
|
}
|
|
|
|
|
objPropComposite.update();
|
|
|
|
|
objPropComposite.layout();
|
|
|
|
@ -1004,7 +1020,7 @@ public class NewCodeItemDialog extends Dialog {
|
|
|
|
|
TCComponentItemRevision rev = item.getLatestItemRevision();
|
|
|
|
|
List<ClassProperty> propList = new ArrayList<>();
|
|
|
|
|
for (int i = 0; i < classPropList.size(); i++) {
|
|
|
|
|
// System.out.println(" CLASS ID = " + integers[i] + " =" +
|
|
|
|
|
// log.info(" CLASS ID = " + integers[i] + " =" +
|
|
|
|
|
// vals[i]);
|
|
|
|
|
CNClassPropBean bean = classPropList.get(i);
|
|
|
|
|
String value = "";
|
|
|
|
@ -1051,7 +1067,7 @@ public class NewCodeItemDialog extends Dialog {
|
|
|
|
|
ICSProperty icspro[] = new ICSProperty[classPropList.size()];
|
|
|
|
|
// 设置分类属性
|
|
|
|
|
for (int i = 0; i < icspro.length; i++) {
|
|
|
|
|
// System.out.println(" CLASS ID = " + integers[i] + " =" +
|
|
|
|
|
// log.info(" CLASS ID = " + integers[i] + " =" +
|
|
|
|
|
// vals[i]);
|
|
|
|
|
CNClassPropBean bean = classPropList.get(i);
|
|
|
|
|
String value = "";
|
|
|
|
@ -1208,7 +1224,7 @@ public class NewCodeItemDialog extends Dialog {
|
|
|
|
|
// Dimension srcDim = Toolkit.getDefaultToolkit().getScreenSize();
|
|
|
|
|
// container1.getShell().setSize(srcDim.width, srcDim.height);
|
|
|
|
|
// Point p =container1.getShell().getSize();
|
|
|
|
|
// System.out.println("");
|
|
|
|
|
// log.info("");
|
|
|
|
|
// MessageBox.post(p.x+"|"+p.y,"P",1);
|
|
|
|
|
return container;
|
|
|
|
|
}
|
|
|
|
@ -1219,7 +1235,7 @@ public class NewCodeItemDialog extends Dialog {
|
|
|
|
|
// if(item.getItemCount()>0){
|
|
|
|
|
// childItem= getLastChild(item.getItem(0));
|
|
|
|
|
// }
|
|
|
|
|
// System.out.println("i am in getLastChild "+childItem.getText());
|
|
|
|
|
// log.info("i am in getLastChild "+childItem.getText());
|
|
|
|
|
// return childItem
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
@ -1404,13 +1420,6 @@ public class NewCodeItemDialog extends Dialog {
|
|
|
|
|
DescText = CreateCompositeUtil.createTextArea(composite, "", 1, 300);
|
|
|
|
|
DescText.setVisible(false);
|
|
|
|
|
|
|
|
|
|
// 进行扩展
|
|
|
|
|
// CreateCompositeUtil.createNewLabel(objPropComposite, "属性");
|
|
|
|
|
// 修改 20170626
|
|
|
|
|
// propTable = CreateCompositeUtil.createNewTable(objPropComposite, "",
|
|
|
|
|
// 170, 230);
|
|
|
|
|
|
|
|
|
|
// idText.setEnabled(false);
|
|
|
|
|
idLengthText.setEnabled(false);
|
|
|
|
|
revText.setEnabled(false);
|
|
|
|
|
DescText.setEnabled(false);
|
|
|
|
@ -1554,7 +1563,7 @@ public class NewCodeItemDialog extends Dialog {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// System.out.println("---->>>>>>> selectedSegmentNode
|
|
|
|
|
// log.info("---->>>>>>> selectedSegmentNode
|
|
|
|
|
// =111>"+selectedSegmentNode.getParentTreeData().getPackCodeNodeInfo());
|
|
|
|
|
getParentGroupNode(selectedSegmentNode);
|
|
|
|
|
selectedSegmentTCComponent = selectedSegmentNode.getPackCodeNodeInfo().getNodeComponent();
|
|
|
|
@ -1566,9 +1575,10 @@ public class NewCodeItemDialog extends Dialog {
|
|
|
|
|
|
|
|
|
|
if (selectedSegmentNode.getParentTreeData() != null) {
|
|
|
|
|
//打印选中的编码分类名称
|
|
|
|
|
log.info("LP RuleName>>>" + selectedSegmentNode.getPackCodeNodeInfo().rule_node);
|
|
|
|
|
System.out.println("LP RuleName>>>" + selectedSegmentNode.getPackCodeNodeInfo().rule_node);
|
|
|
|
|
connor_CurrentTypeNameString = selectedSegmentNode.getPackCodeNodeInfo().rule_node;
|
|
|
|
|
// System.out.println("---->>>>>>> selectedSegmentNode
|
|
|
|
|
// log.info("---->>>>>>> selectedSegmentNode
|
|
|
|
|
// =222>"+selectedSegmentNode.getPackCodeNodeInfo().rule_node);
|
|
|
|
|
if ("电子件".equals(selectedSegmentNode.getPackCodeNodeInfo().rule_node) && (isCanTeam != null)
|
|
|
|
|
&& (isCanTeam.trim().length() > 0) && isCanTeam.toLowerCase().equals("true")) {
|
|
|
|
@ -1613,8 +1623,9 @@ public class NewCodeItemDialog extends Dialog {
|
|
|
|
|
if ((realType != null) && (realType.length() > 0)) {
|
|
|
|
|
tccomponentitemtype = (TCComponentItemType) (session.getTypeComponent(realType));
|
|
|
|
|
}
|
|
|
|
|
// System.out.println("类型 realType = "+realType);
|
|
|
|
|
// log.info("类型 realType = "+realType);
|
|
|
|
|
}
|
|
|
|
|
log.info("选中节点="+selectedSegmentNode.getPackCodeNodeInfo().getNode_name());
|
|
|
|
|
System.out.println("选中节点="+selectedSegmentNode.getPackCodeNodeInfo().getNode_name());
|
|
|
|
|
//选中“编码分类”下的节点对象-selectedSegmentNode.getPackCodeNodeInfo()
|
|
|
|
|
if (selectedSegmentNode.getPackCodeNodeInfo().getNode_type()
|
|
|
|
@ -1642,6 +1653,10 @@ public class NewCodeItemDialog extends Dialog {
|
|
|
|
|
if (selectedData == null) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
log.info("---->>>>>>> 编码树选中对象 =" + selectedData.getPackCodeNodeInfo().getNode_name());
|
|
|
|
|
log.info("type = "+ selectedData.getPackCodeNodeInfo().getNode_type());
|
|
|
|
|
log.info("value = "+ selectedData.getPackCodeNodeInfo().getNode_value());
|
|
|
|
|
log.info("desc = "+ selectedData.getPackCodeNodeInfo().getNode_desc());
|
|
|
|
|
System.out.println("---->>>>>>> 编码树选中对象 =" + selectedData.getPackCodeNodeInfo().getNode_name());
|
|
|
|
|
System.out.println("type = "+ selectedData.getPackCodeNodeInfo().getNode_type());
|
|
|
|
|
System.out.println("value = "+ selectedData.getPackCodeNodeInfo().getNode_value());
|
|
|
|
@ -1658,11 +1673,14 @@ public class NewCodeItemDialog extends Dialog {
|
|
|
|
|
* 选择分类的时候,需要选中最底层才允许创建
|
|
|
|
|
*/
|
|
|
|
|
if(selectedData.getChildrenTreeData() != null && selectedData.getChildrenTreeData().length>0) {
|
|
|
|
|
log.info("不是最底层");
|
|
|
|
|
System.out.println("不是最底层");
|
|
|
|
|
btFlg = true;
|
|
|
|
|
System.out.println("nodeName:"+selectedData.getPackCodeNodeInfo().getNode_name());
|
|
|
|
|
log.info("》》》nodeName:"+selectedData.getPackCodeNodeInfo().getNode_name());
|
|
|
|
|
System.out.println("》》》nodeName:"+selectedData.getPackCodeNodeInfo().getNode_name());
|
|
|
|
|
return;
|
|
|
|
|
}else {
|
|
|
|
|
log.info("是最底层");
|
|
|
|
|
System.out.println("是最底层");
|
|
|
|
|
btFlg = false;
|
|
|
|
|
}
|
|
|
|
@ -1671,15 +1689,20 @@ public class NewCodeItemDialog extends Dialog {
|
|
|
|
|
String name = "";
|
|
|
|
|
// 得到编码相关信息
|
|
|
|
|
getCodeInfo(selectedData);
|
|
|
|
|
//TODO 根据得到的编码信息,假设得到创建对象的类型为文档
|
|
|
|
|
//KUMA 根据得到的编码信息,假设得到创建对象的类型为文档
|
|
|
|
|
System.out.println("begin panduan!");
|
|
|
|
|
if(isDoc){//如果创建对象是文档,
|
|
|
|
|
//1.获取最左侧区域选中的的编码规则名称
|
|
|
|
|
log.info("当前新建对象类型为“文档”");
|
|
|
|
|
System.out.println("当前新建对象类型为“文档”");
|
|
|
|
|
AbstractTreeData leftTreeData = selectedData.getParentTreeData();
|
|
|
|
|
if (leftTreeData != null) {
|
|
|
|
|
leftMostCodeRuleNameString = leftTreeData.getPackCodeNodeInfo().getNode_name();
|
|
|
|
|
//获取首选项SB6_AutoCode_SetDocType中的值
|
|
|
|
|
String[] autocodeTypes = session.getPreferenceService().getStringValues("SB6_AutoCode_SetDocType");
|
|
|
|
|
if (autocodeTypes != null){
|
|
|
|
|
if (autocodeTypes.length <= 0) {
|
|
|
|
|
log.info("获取首选项SB6_AutoCode_SetDocType的信息获取失败,请检查配置!");
|
|
|
|
|
System.out.println("获取首选项SB6_AutoCode_SetDocType的信息获取失败,请检查配置!");
|
|
|
|
|
return;
|
|
|
|
|
}else {
|
|
|
|
@ -1689,31 +1712,32 @@ public class NewCodeItemDialog extends Dialog {
|
|
|
|
|
if (index != -1) {
|
|
|
|
|
String firstPart = autocodeType.substring(0, index);
|
|
|
|
|
String secondPart = autocodeType.substring(index + 1);
|
|
|
|
|
log.info("第一部分: " + firstPart);
|
|
|
|
|
log.info("第二部分: " + secondPart);
|
|
|
|
|
System.out.println("第一部分: " + firstPart);
|
|
|
|
|
System.out.println("第二部分: " + secondPart);
|
|
|
|
|
System.out.println("leftMostCodeRuleNameString:"+leftMostCodeRuleNameString);
|
|
|
|
|
if (firstPart.equals(leftMostCodeRuleNameString)) {
|
|
|
|
|
//将此secondPart填入最右侧区域中的属性“文档类别”下
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//将此secondPart赋值给全局变量docTypeValue,将在addGeneralPropComosite中填入最右侧区域中的属性“文档类别”下
|
|
|
|
|
docTypeValue = secondPart;
|
|
|
|
|
break;
|
|
|
|
|
}else {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
log.info("字符串中未找到 = 符号。");
|
|
|
|
|
System.out.println("字符串中未找到 = 符号。");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}else {
|
|
|
|
|
System.out.println("获取首选项SB6_AutoCode_SetDocType的信息获取失败,请检查配置!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
log.info(">>>>>>>><<<<<<<");
|
|
|
|
|
System.out.println(">>>>>>>><<<<<<<");
|
|
|
|
|
getClassANDPropertyInfo(selectedData);
|
|
|
|
|
//这是编码树视图中选中的节点对象的名称,用来渲染到新建对象的“名称”属性上
|
|
|
|
@ -1724,6 +1748,7 @@ public class NewCodeItemDialog extends Dialog {
|
|
|
|
|
} else {
|
|
|
|
|
LPBIGString = "";
|
|
|
|
|
}
|
|
|
|
|
log.info("LPBIGString="+LPBIGString);
|
|
|
|
|
System.out.println("LPBIGString="+LPBIGString);
|
|
|
|
|
LPSString = selectedData.getPackCodeNodeInfo().getNode_name();
|
|
|
|
|
currentNodeValue = replaceSpecialValue(selectedData.getPackCodeNodeInfo().node_value);
|
|
|
|
@ -1738,12 +1763,13 @@ public class NewCodeItemDialog extends Dialog {
|
|
|
|
|
if (currentNodeDesc.trim().length() > 0) {
|
|
|
|
|
codeDesc = codeDesc + currentNodeDesc;
|
|
|
|
|
}
|
|
|
|
|
if (!TCPreferenceUitl.isTrueTCPreferenceValue(session,
|
|
|
|
|
origin_isItemNameTextDefaultNull)) {
|
|
|
|
|
//ss
|
|
|
|
|
if (!TCPreferenceUitl.isTrueTCPreferenceValue(session,origin_isItemNameTextDefaultNull)) {
|
|
|
|
|
nameText.setText(name);
|
|
|
|
|
} else {
|
|
|
|
|
nameText.setText("");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getFinalPattern();
|
|
|
|
|
// idText.setText(pattern);
|
|
|
|
|
idText.setText(finalPattern);
|
|
|
|
@ -1751,11 +1777,6 @@ public class NewCodeItemDialog extends Dialog {
|
|
|
|
|
idLengthText.setText(String.valueOf(idText.getText().replace(" ", "").trim().length()));
|
|
|
|
|
DescText.setText(codeDesc);
|
|
|
|
|
setMidComposite();
|
|
|
|
|
// String msg =
|
|
|
|
|
// selectedData.getPackCodeNodeInfo().getRealTypeName();
|
|
|
|
|
// MessageBox.post("Info
|
|
|
|
|
// =
|
|
|
|
|
// >"+msg,"INFO",MessageBox.ERROR);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
@ -1804,8 +1825,7 @@ public class NewCodeItemDialog extends Dialog {
|
|
|
|
|
icoPropertyMap = listView.getIcoPropertyMap();
|
|
|
|
|
revText.setText(tccomponentitemtype.getNewRev(null));
|
|
|
|
|
|
|
|
|
|
if (!TCPreferenceUitl.isTrueTCPreferenceValue(session,
|
|
|
|
|
origin_isItemNameTextDefaultNull)) {
|
|
|
|
|
if (!TCPreferenceUitl.isTrueTCPreferenceValue(session,origin_isItemNameTextDefaultNull)) {
|
|
|
|
|
nameText.setText(firstListICOName);
|
|
|
|
|
} else {
|
|
|
|
|
nameText.setText("");
|
|
|
|
@ -1948,11 +1968,48 @@ public class NewCodeItemDialog extends Dialog {
|
|
|
|
|
String parentName = "";
|
|
|
|
|
|
|
|
|
|
if (treeData != null) {
|
|
|
|
|
//判断当前新建对象是否属于“文档”这一类别
|
|
|
|
|
String nodeNameCurrent = treeData.getPackCodeNodeInfo().getNode_name();
|
|
|
|
|
String nodetypeCurrent = treeData.getPackCodeNodeInfo().getNode_type();
|
|
|
|
|
log.info("当前节点【"+nodeNameCurrent+"】属于【"+nodetypeCurrent+"】类别");
|
|
|
|
|
System.out.println("当前节点【"+nodeNameCurrent+"】属于【"+nodetypeCurrent+"】类别");
|
|
|
|
|
if (nodeNameCurrent.contains("文档")){
|
|
|
|
|
log.info("当前节点属于【文档】类别");
|
|
|
|
|
System.out.println("当前节点属于【文档】类别");
|
|
|
|
|
isDoc = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
AbstractTreeData parentData = treeData.getParentTreeData();
|
|
|
|
|
if (parentData != null){
|
|
|
|
|
log.info("parentData != null");
|
|
|
|
|
System.out.println("parentData != null");
|
|
|
|
|
}else {
|
|
|
|
|
log.info("parentData == null");
|
|
|
|
|
System.out.println("parentData == null");
|
|
|
|
|
}
|
|
|
|
|
if (parentData.getParentTreeData() != null) {
|
|
|
|
|
String node_namesss = parentData.getParentTreeData().packCodeNodeInfo.getNode_name();
|
|
|
|
|
if (node_namesss != null && node_namesss.contains("文档")){
|
|
|
|
|
isDoc = true;
|
|
|
|
|
}
|
|
|
|
|
System.out.println("node_namesss="+node_namesss);
|
|
|
|
|
}else {
|
|
|
|
|
System.out.println("node_namesss获取失败");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (parentData.getPackCodeNodeInfo().getNodeComponent() != null){
|
|
|
|
|
log.info("parentData.getPackCodeNodeInfo().getNodeComponent() != null");
|
|
|
|
|
System.out.println("parentData.getPackCodeNodeInfo().getNodeComponent() != null");
|
|
|
|
|
}else {
|
|
|
|
|
log.info("parentData.getPackCodeNodeInfo().getNodeComponent() == null");
|
|
|
|
|
System.out.println("parentData.getPackCodeNodeInfo().getNodeComponent() == null");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ((parentData != null) && (parentData.getPackCodeNodeInfo().getNodeComponent() != null)) {
|
|
|
|
|
parentType = parentData.getPackCodeNodeInfo().getNode_type();
|
|
|
|
|
parentName = parentData.getPackCodeNodeInfo().getNode_name();
|
|
|
|
|
log.info("编码树视图中选中节点的父节点 parentData = " + parentName+"\n type="+parentType);
|
|
|
|
|
System.out.println("编码树视图中选中节点的父节点 parentData = " + parentName+"\n type="+parentType);
|
|
|
|
|
getCodeInfo(parentData);
|
|
|
|
|
String nodeValue = "";
|
|
|
|
@ -1970,15 +2027,20 @@ public class NewCodeItemDialog extends Dialog {
|
|
|
|
|
codeDesc = codeDesc + "\n";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
System.out.println("node_desc ===>" + treeData.getPackCodeNodeInfo().getNode_desc());
|
|
|
|
|
System.out.println("编码描述 codeDesc = "+codeDesc);
|
|
|
|
|
log.info("node_desc ===>" + treeData.getPackCodeNodeInfo().getNode_desc());
|
|
|
|
|
log.info("编码描述 codeDesc = "+codeDesc);
|
|
|
|
|
System.out.println("编码描述 ===>" + codeDesc);
|
|
|
|
|
}else {
|
|
|
|
|
originFatherData = treeData;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (originFatherData != null) {
|
|
|
|
|
log.info("编码树视图选中对象的始祖对象="+originFatherData.getPackCodeNodeInfo().getNode_name()+"\n 类型="+originFatherData.getPackCodeNodeInfo().getNode_type());
|
|
|
|
|
System.out.println("编码树视图选中对象的始祖对象="+originFatherData.getPackCodeNodeInfo().getNode_name()+"\n 类型="+originFatherData.getPackCodeNodeInfo().getNode_type());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void initTreeOrListMouseClick() {
|
|
|
|
|
try {
|
|
|
|
|
if (treeViewOperation.getSelectedTreeNode(classificationTreeViewer) == null) {
|
|
|
|
@ -2657,6 +2719,75 @@ public class NewCodeItemDialog extends Dialog {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static TCComponentListOfValues findLOVByName(TCSession tcsession, String lovName) {
|
|
|
|
|
TCComponentListOfValues tccomponentlistofvalues = null;
|
|
|
|
|
try {
|
|
|
|
|
TCComponentListOfValuesType tccomponentlistofvaluestype = (TCComponentListOfValuesType) tcsession.getTypeComponent("ListOfValues");
|
|
|
|
|
TCComponentListOfValues atccomponentlistofvalues[] = tccomponentlistofvaluestype.find(lovName);
|
|
|
|
|
if (atccomponentlistofvalues != null && atccomponentlistofvalues.length > 0)
|
|
|
|
|
tccomponentlistofvalues = atccomponentlistofvalues[0];
|
|
|
|
|
else
|
|
|
|
|
tccomponentlistofvalues = null;
|
|
|
|
|
} catch (TCException tcexception) {
|
|
|
|
|
tccomponentlistofvalues = null;
|
|
|
|
|
}
|
|
|
|
|
return tccomponentlistofvalues;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获得TC LOV值的显示值-真实值集合
|
|
|
|
|
* @param seesion
|
|
|
|
|
* @return
|
|
|
|
|
* @throws TCException
|
|
|
|
|
*/
|
|
|
|
|
public static Map<String, String> getLOVDisplay_value(TCSession seesion,String lovProp) throws TCException
|
|
|
|
|
{
|
|
|
|
|
Map<String, String> Display_values = new HashMap<String, String>();
|
|
|
|
|
TCComponentListOfValues unitLov = TCLOVUtil.findLOVByName(seesion, lovProp);
|
|
|
|
|
if(unitLov !=null)
|
|
|
|
|
{
|
|
|
|
|
ListOfValuesInfo listOfValues = unitLov.getListOfValues();
|
|
|
|
|
String[] realval = listOfValues.getStringListOfValues();
|
|
|
|
|
String value="";
|
|
|
|
|
boolean flag = false;
|
|
|
|
|
for (int i = 0; i < realval.length; i++) {
|
|
|
|
|
String disval = listOfValues.getDisplayableValue(realval[i]);
|
|
|
|
|
Display_values.put(disval, realval[i]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return Display_values;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 将"yyyy-MM-dd"格式的字符串转换为Calendar对象
|
|
|
|
|
* @param dateStr 日期字符串,格式必须为"yyyy-MM-dd",允许为空字符串
|
|
|
|
|
* @return 转换后的Calendar对象,如果解析失败则返回null
|
|
|
|
|
*/
|
|
|
|
|
public static Calendar stringToCalendar(String dateStr) {
|
|
|
|
|
if (dateStr == null || dateStr.isEmpty()) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
|
|
try {
|
|
|
|
|
Date date = sdf.parse(dateStr);
|
|
|
|
|
Calendar calendar = Calendar.getInstance();
|
|
|
|
|
calendar.setTime(date);
|
|
|
|
|
|
|
|
|
|
// 将时、分、秒、毫秒设置为0
|
|
|
|
|
calendar.set(Calendar.HOUR_OF_DAY, 0);
|
|
|
|
|
calendar.set(Calendar.MINUTE, 0);
|
|
|
|
|
calendar.set(Calendar.SECOND, 0);
|
|
|
|
|
calendar.set(Calendar.MILLISECOND, 0);
|
|
|
|
|
|
|
|
|
|
System.out.println(">>>stringToCalendar方法 入参:"+dateStr+",转换后的日期="+calendar);
|
|
|
|
|
return calendar;
|
|
|
|
|
} catch (ParseException e) {
|
|
|
|
|
System.err.println("日期解析失败: " + dateStr + ", 错误信息: " + e.getMessage());
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 设置对象的属性匹配
|
|
|
|
|
*
|
|
|
|
@ -2665,6 +2796,7 @@ public class NewCodeItemDialog extends Dialog {
|
|
|
|
|
*/
|
|
|
|
|
private void setPropMapping(CreateInput createInput, List<CNProperty> cnProperties,
|
|
|
|
|
Map<String, String> stringMappingOld) {
|
|
|
|
|
System.out.println("setPropMapping方法开始执行~");
|
|
|
|
|
if (cnProperties == null) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
@ -2686,8 +2818,14 @@ public class NewCodeItemDialog extends Dialog {
|
|
|
|
|
if (prop == null) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
// System.out.println(
|
|
|
|
|
// "PROP MAP >>>>"+prop.getRealName()+"<===>"+prop.value);
|
|
|
|
|
Boolean isLov = prop.getIsLov();
|
|
|
|
|
String lovName = prop.getLovName();
|
|
|
|
|
Object inputValue = prop.value;
|
|
|
|
|
//20250509 编码器移植功能增强:对xml配置中,所有isLOV=true且输入有效的属性,通过输入or选择的“显示值”获取lov的真实值
|
|
|
|
|
if (isLov && inputValue != null) {
|
|
|
|
|
String trueNameString = getLovTrueValue(lovName,inputValue);
|
|
|
|
|
prop.value = (trueNameString == null ? prop.value : trueNameString);
|
|
|
|
|
}
|
|
|
|
|
switch (prop.getPropertyType().toUpperCase()) {
|
|
|
|
|
case "STRING":
|
|
|
|
|
stringMapping.put(prop.getRealName(), (String) (prop.value == null ? "" : prop.value));
|
|
|
|
@ -2696,7 +2834,10 @@ public class NewCodeItemDialog extends Dialog {
|
|
|
|
|
intMapping.put(prop.getRealName(), (BigInteger) (prop.value == null ? "" : prop.value));
|
|
|
|
|
break;
|
|
|
|
|
case "DATE":
|
|
|
|
|
dateMapping.put(prop.getRealName(), (Calendar) (prop.value == null ? "" : prop.value));
|
|
|
|
|
System.out.println(">>>转换前的属性输入值="+prop.value);
|
|
|
|
|
String value = (String) (prop.value == null ? "" : prop.value);
|
|
|
|
|
System.out.println(">>>转换成string后的value="+value);
|
|
|
|
|
dateMapping.put(prop.getRealName(), stringToCalendar(value) );
|
|
|
|
|
break;
|
|
|
|
|
case "BOOLEAN":
|
|
|
|
|
booleanMapping.put(prop.getRealName(), (Boolean) (prop.value == null ? "" : prop.value));
|
|
|
|
@ -2717,12 +2858,16 @@ public class NewCodeItemDialog extends Dialog {
|
|
|
|
|
doubleMapping.put(prop.getRealName(), mydv);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
System.out.println("意料之外的类型:"+prop.getPropertyType().toUpperCase());
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
setBigAndS(createInput.boName, stringMapping);
|
|
|
|
|
|
|
|
|
|
System.out.println("开始打印string类型的属性:");
|
|
|
|
|
printMap(stringMapping);
|
|
|
|
|
|
|
|
|
|
createInput.stringProps = stringMapping;
|
|
|
|
|
createInput.intProps = intMapping;
|
|
|
|
|
createInput.dateProps = dateMapping;
|
|
|
|
@ -2731,6 +2876,46 @@ public class NewCodeItemDialog extends Dialog {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 根据lov的显示值获取对应的真实值
|
|
|
|
|
* @param lovName lov名称
|
|
|
|
|
* @param inputValue 输入或选中的lov“显示值”
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
private String getLovTrueValue(String lovName, Object inputValue) {
|
|
|
|
|
if (lovName == null || inputValue == null) {
|
|
|
|
|
System.out.println("获取lov真实值传入的参数无效!");
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
try {
|
|
|
|
|
Map<String, String> lovDisplay_value = getLOVDisplay_value(session, lovName);
|
|
|
|
|
String trueValue = lovDisplay_value.get(inputValue);
|
|
|
|
|
if (trueValue == null) {
|
|
|
|
|
System.out.println("未在lov中查到对应的显示值,获取真实值失败,请检查输入!");
|
|
|
|
|
return null;
|
|
|
|
|
}else {
|
|
|
|
|
System.out.println("成功获取到lov的真实值=》"+inputValue+":"+trueValue);
|
|
|
|
|
return trueValue;
|
|
|
|
|
}
|
|
|
|
|
} catch (TCException e) {
|
|
|
|
|
// TODO 自动生成的 catch 块
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TODO 自动生成的方法存根
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void printMap(Map<String, String> map) {
|
|
|
|
|
if (map == null || map.isEmpty()) {
|
|
|
|
|
System.out.println("The map is empty.");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
for (Map.Entry<String, String> entry : map.entrySet()) {
|
|
|
|
|
System.out.println("》》》Key: " + entry.getKey() + ", Value: " + entry.getValue());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public TCComponent[] queryTCComponent(TCSession session, String[] values, String[] keys, String value)
|
|
|
|
|
throws TCException {
|
|
|
|
|
// String[] keys={"零组件 ID","版本"};
|
|
|
|
@ -2821,8 +3006,8 @@ public class NewCodeItemDialog extends Dialog {
|
|
|
|
|
/**
|
|
|
|
|
* 通过SOA创建对象
|
|
|
|
|
*
|
|
|
|
|
* @param itemID
|
|
|
|
|
* @param itemRev
|
|
|
|
|
* @param itemID 特征码
|
|
|
|
|
* @param itemRev 版本输入框中的内容
|
|
|
|
|
* @param itemType
|
|
|
|
|
* @param itemName
|
|
|
|
|
* @param itemDesc
|
|
|
|
@ -2846,6 +3031,7 @@ public class NewCodeItemDialog extends Dialog {
|
|
|
|
|
ex3.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//创建对象的传入参数
|
|
|
|
|
com.teamcenter.services.rac.core._2008_06.DataManagement.CreateInput itemInput = new com.teamcenter.services.rac.core._2008_06.DataManagement.CreateInput();
|
|
|
|
|
itemInput.boName = itemType;
|
|
|
|
|
System.out.println("Item Type =>>>>" + itemType);
|
|
|
|
@ -2854,8 +3040,10 @@ public class NewCodeItemDialog extends Dialog {
|
|
|
|
|
itemStringMap.put("item_id", itemID);
|
|
|
|
|
itemStringMap.put("object_desc", itemDesc);
|
|
|
|
|
if (iComp != null) {
|
|
|
|
|
System.out.println("iComp != null");
|
|
|
|
|
setPropMapping(itemInput, iComp.getPropertyList(), itemStringMap);
|
|
|
|
|
} else {
|
|
|
|
|
System.out.println("iComp == null");
|
|
|
|
|
itemInput.stringProps = itemStringMap;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -2909,8 +3097,10 @@ public class NewCodeItemDialog extends Dialog {
|
|
|
|
|
|
|
|
|
|
DataManagementService datamanagementservice = DataManagementService.getService(session);
|
|
|
|
|
com.teamcenter.services.rac.core._2008_06.DataManagement.CreateIn createin = new com.teamcenter.services.rac.core._2008_06.DataManagement.CreateIn();
|
|
|
|
|
|
|
|
|
|
createin.clientId = "Test";
|
|
|
|
|
createin.data = itemInput;
|
|
|
|
|
|
|
|
|
|
System.out.println("11111111111111");
|
|
|
|
|
com.teamcenter.services.rac.core._2008_06.DataManagement.CreateResponse createresponse = datamanagementservice
|
|
|
|
|
.createObjects(
|
|
|
|
@ -2990,6 +3180,7 @@ public class NewCodeItemDialog extends Dialog {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
System.out.println(">>" + cnpropList.get(i).getPropertyType().toUpperCase() + "|cnpropList.get(i).value =>"
|
|
|
|
|
+ cnpropList.get(i).value);
|
|
|
|
|
if (cnpropList.get(i).getIsMust()) {
|
|
|
|
@ -3155,74 +3346,131 @@ public class NewCodeItemDialog extends Dialog {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
//文档创建后带出数据集模板
|
|
|
|
|
if (newComp != null) {
|
|
|
|
|
String prefName = "connor_DocTemp";
|
|
|
|
|
String[] preVals = session.getPreferenceService().getStringValues(prefName);
|
|
|
|
|
String type = newComp.getType();
|
|
|
|
|
for (String string : preVals) {
|
|
|
|
|
String[] split = string.split("=");
|
|
|
|
|
if (split.length == 3 && type.equals(split[0])) {
|
|
|
|
|
if(split[1].contains(".") && split[1].contains(":")) {
|
|
|
|
|
System.out.println("开始比较=====================");
|
|
|
|
|
String[] center = split[1].split(":");
|
|
|
|
|
String[] split2 = center[0].split("\\.");
|
|
|
|
|
String preName = split2[1];
|
|
|
|
|
String proFrom = split2[0];
|
|
|
|
|
TCComponent centerCom = null;
|
|
|
|
|
if("Rev".equals(proFrom)) {
|
|
|
|
|
centerCom = ((TCComponentItem) newComp).getLatestItemRevision();
|
|
|
|
|
}
|
|
|
|
|
else if("item".equals(proFrom)) {
|
|
|
|
|
centerCom = newComp;
|
|
|
|
|
}
|
|
|
|
|
else if("Form".equals(proFrom)) {
|
|
|
|
|
centerCom = ((TCComponentItem) newComp).getLatestItemRevision().getRelatedComponent("IMAN_master_form_rev");
|
|
|
|
|
}
|
|
|
|
|
if(centerCom != null) {
|
|
|
|
|
String preValue = centerCom.getTCProperty(preName).getDisplayableValue();
|
|
|
|
|
System.out.println("得到的值为:========" + preValue);
|
|
|
|
|
if (center[1].equals(preValue)) {
|
|
|
|
|
TCComponent[] search = session.search("零组件 ID", new String[] {"零组件 ID"}, new String[] {split[2]});
|
|
|
|
|
TCComponentItemRevision modelRev = null;
|
|
|
|
|
if(search != null && search.length == 1) {
|
|
|
|
|
TCComponentItem item = (TCComponentItem) search[0];
|
|
|
|
|
TCComponent[] relatedComponents = item.getRelatedComponents("revision_list");
|
|
|
|
|
for (int i = relatedComponents.length - 1; i >= 0; i--) {
|
|
|
|
|
TCComponentItemRevision revision = (TCComponentItemRevision) relatedComponents[i];
|
|
|
|
|
if (revision.getProperty("release_status_list") != null
|
|
|
|
|
&& !revision.getProperty("release_status_list").isEmpty()) {
|
|
|
|
|
modelRev = revision;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (modelRev != null) {
|
|
|
|
|
TCComponent[] relatedComponents = modelRev.getRelatedComponents("IMAN_specification");
|
|
|
|
|
if(relatedComponents != null) {
|
|
|
|
|
for (TCComponent com : relatedComponents) {
|
|
|
|
|
if (com instanceof TCComponentDataset) {
|
|
|
|
|
TCComponentDataset component = (TCComponentDataset) com;
|
|
|
|
|
TCComponentItemRevision rev = ((TCComponentItem) newComp)
|
|
|
|
|
.getLatestItemRevision();
|
|
|
|
|
String rev_name = rev.getStringProperty("object_name");
|
|
|
|
|
TCComponentDataset newDataset = component.saveAs(rev_name);
|
|
|
|
|
String oldName = component.getRelatedComponent("ref_list")
|
|
|
|
|
.getProperty("original_file_name");
|
|
|
|
|
String[] split3 = oldName.split("\\.");
|
|
|
|
|
newDataset.getRelatedComponent("ref_list").setProperty(
|
|
|
|
|
"original_file_name",
|
|
|
|
|
newDataset.getStringProperty("object_name") + "."
|
|
|
|
|
+ split3[split3.length - 1]);
|
|
|
|
|
rev.add("IMAN_specification", newDataset);
|
|
|
|
|
// if (newComp != null) {
|
|
|
|
|
// String prefName = "connor_DocTemp";
|
|
|
|
|
// String[] preVals = session.getPreferenceService().getStringValues(prefName);
|
|
|
|
|
// String type = newComp.getType();
|
|
|
|
|
// for (String string : preVals) {
|
|
|
|
|
// String[] split = string.split("=");
|
|
|
|
|
// if (split.length == 3 && type.equals(split[0])) {
|
|
|
|
|
// if(split[1].contains(".") && split[1].contains(":")) {
|
|
|
|
|
// log.info("开始比较=====================");
|
|
|
|
|
// String[] center = split[1].split(":");
|
|
|
|
|
// String[] split2 = center[0].split("\\.");
|
|
|
|
|
// String preName = split2[1];
|
|
|
|
|
// String proFrom = split2[0];
|
|
|
|
|
// TCComponent centerCom = null;
|
|
|
|
|
// if("Rev".equals(proFrom)) {
|
|
|
|
|
// centerCom = ((TCComponentItem) newComp).getLatestItemRevision();
|
|
|
|
|
// }
|
|
|
|
|
// else if("item".equals(proFrom)) {
|
|
|
|
|
// centerCom = newComp;
|
|
|
|
|
// }
|
|
|
|
|
// else if("Form".equals(proFrom)) {
|
|
|
|
|
// centerCom = ((TCComponentItem) newComp).getLatestItemRevision().getRelatedComponent("IMAN_master_form_rev");
|
|
|
|
|
// }
|
|
|
|
|
// if(centerCom != null) {
|
|
|
|
|
// String preValue = centerCom.getTCProperty(preName).getDisplayableValue();
|
|
|
|
|
// log.info("得到的值为:========" + preValue);
|
|
|
|
|
// if (center[1].equals(preValue)) {
|
|
|
|
|
// TCComponent[] search = session.search("零组件 ID", new String[] {"零组件 ID"}, new String[] {split[2]});
|
|
|
|
|
// TCComponentItemRevision modelRev = null;
|
|
|
|
|
// if(search != null && search.length == 1) {
|
|
|
|
|
// TCComponentItem item = (TCComponentItem) search[0];
|
|
|
|
|
// TCComponent[] relatedComponents = item.getRelatedComponents("revision_list");
|
|
|
|
|
// for (int i = relatedComponents.length - 1; i >= 0; i--) {
|
|
|
|
|
// TCComponentItemRevision revision = (TCComponentItemRevision) relatedComponents[i];
|
|
|
|
|
// if (revision.getProperty("release_status_list") != null
|
|
|
|
|
// && !revision.getProperty("release_status_list").isEmpty()) {
|
|
|
|
|
// modelRev = revision;
|
|
|
|
|
// break;
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// if (modelRev != null) {
|
|
|
|
|
// TCComponent[] relatedComponents = modelRev.getRelatedComponents("IMAN_specification");
|
|
|
|
|
// if(relatedComponents != null) {
|
|
|
|
|
// for (TCComponent com : relatedComponents) {
|
|
|
|
|
// if (com instanceof TCComponentDataset) {
|
|
|
|
|
// TCComponentDataset component = (TCComponentDataset) com;
|
|
|
|
|
// TCComponentItemRevision rev = ((TCComponentItem) newComp)
|
|
|
|
|
// .getLatestItemRevision();
|
|
|
|
|
// String rev_name = rev.getStringProperty("object_name");
|
|
|
|
|
// TCComponentDataset newDataset = component.saveAs(rev_name);
|
|
|
|
|
// String oldName = component.getRelatedComponent("ref_list")
|
|
|
|
|
// .getProperty("original_file_name");
|
|
|
|
|
// String[] split3 = oldName.split("\\.");
|
|
|
|
|
// newDataset.getRelatedComponent("ref_list").setProperty(
|
|
|
|
|
// "original_file_name",
|
|
|
|
|
// newDataset.getStringProperty("object_name") + "."
|
|
|
|
|
// + split3[split3.length - 1]);
|
|
|
|
|
// rev.add("IMAN_specification", newDataset);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// break;
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
//20250425 新增:文档创建后,根据 ID=编码规则名称 带出数据集模板
|
|
|
|
|
if (newComp != null && isDoc){
|
|
|
|
|
//获取新建对象的版本对象-rev
|
|
|
|
|
TCComponentItemRevision rev = null;
|
|
|
|
|
if (newComp instanceof TCComponentItemRevision){
|
|
|
|
|
rev = (TCComponentItemRevision) newComp;
|
|
|
|
|
} else if (newComp instanceof TCComponentItem) {
|
|
|
|
|
rev = ((TCComponentItem) newComp).getLatestItemRevision();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
System.out.println("开始挂载对象ID=【" + leftMostCodeRuleNameString+"】的数据集模板到新建对象下");
|
|
|
|
|
if (leftMostCodeRuleNameString != null && !leftMostCodeRuleNameString.isEmpty()){
|
|
|
|
|
//1.KUMA 调用查询,获取版本对象,下载数据集到本地
|
|
|
|
|
TCComponent[] searchs = session.search("零组件 ID",
|
|
|
|
|
new String[] { "零组件 ID"},
|
|
|
|
|
new String[] { leftMostCodeRuleNameString});
|
|
|
|
|
if (searchs.length > 0){
|
|
|
|
|
TCComponent component = searchs[0];
|
|
|
|
|
TCComponentItemRevision componentItemRevision = null;
|
|
|
|
|
|
|
|
|
|
if (component instanceof TCComponentItem){
|
|
|
|
|
componentItemRevision = ((TCComponentItem) component).getLatestItemRevision();
|
|
|
|
|
}else if (component instanceof TCComponentItemRevision) {
|
|
|
|
|
componentItemRevision = (TCComponentItemRevision) component;
|
|
|
|
|
}
|
|
|
|
|
if (componentItemRevision != null) {
|
|
|
|
|
System.out.println("检索到的对象是版本对象,开始获取‘规范’关系下的数据集");
|
|
|
|
|
// TCComponentItemRevision itemRevision = (TCComponentItemRevision) searchs[0];
|
|
|
|
|
//将查询到的版本对象的"规范"关系下的数据集
|
|
|
|
|
TCComponent[] referenceListProperty = componentItemRevision.getReferenceListProperty("IMAN_specification");
|
|
|
|
|
if (referenceListProperty != null && referenceListProperty.length > 0){
|
|
|
|
|
for (TCComponent tcComponent : referenceListProperty){
|
|
|
|
|
if (tcComponent instanceof TCComponentDataset) {
|
|
|
|
|
System.out.println("1");
|
|
|
|
|
TCComponentDataset dataset_old = (TCComponentDataset) tcComponent;
|
|
|
|
|
System.out.println("2");
|
|
|
|
|
TCComponentDataset dataset_new = dataset_old.saveAs(null);
|
|
|
|
|
System.out.println("3");
|
|
|
|
|
//2.将数据集上传到新建版本对象中
|
|
|
|
|
rev.add("IMAN_specification", dataset_new);
|
|
|
|
|
rev.save();
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}else {
|
|
|
|
|
System.out.println("检索到的ID=【"+leftMostCodeRuleNameString+"】的版本对象下没有‘规范’关系下的数据集");
|
|
|
|
|
}
|
|
|
|
|
}else {
|
|
|
|
|
System.out.println("检索到的ID=【"+leftMostCodeRuleNameString+"】的对象既不是Item对象也不是Rev对象!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}else {
|
|
|
|
|
System.out.println("检索不到ID=【"+leftMostCodeRuleNameString+"】的对象");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -3278,6 +3526,7 @@ public class NewCodeItemDialog extends Dialog {
|
|
|
|
|
Combo[] propCombos = listView.getPropertyComb();
|
|
|
|
|
Label[] propLabels = listView.getPropertyLabel();
|
|
|
|
|
List<PackCodeNodeInfo> lp_packCodeNodeInfos = listView.lp_packCodeNodeInfos;
|
|
|
|
|
|
|
|
|
|
if ((propCombos != null) && (propCombos.length > 0)) {
|
|
|
|
|
for (int i = 0; i < propCombos.length; i++) {
|
|
|
|
|
if (propLabels[i].getText().equals("文件类型:")) {
|
|
|
|
@ -3501,9 +3750,9 @@ public class NewCodeItemDialog extends Dialog {
|
|
|
|
|
//判断是否要读分类的用户1的数据
|
|
|
|
|
if (!codeRemark.replace(" ", "").equals("")) {
|
|
|
|
|
System.out.println("当前对象要发送的分类ID为:==================" + codeRemark);
|
|
|
|
|
String[] pres = session.getPreferenceService().getStringValues("Connor_Part_SAPGroupInfo");
|
|
|
|
|
for (String pre : pres) {
|
|
|
|
|
if(newComp.getType().equals(pre)) {
|
|
|
|
|
// String[] pres = session.getPreferenceService().getStringValues("Connor_Part_SAPGroupInfo");
|
|
|
|
|
// for (String pre : pres) {
|
|
|
|
|
// if(newComp.getType().equals(pre)) {
|
|
|
|
|
//读取要发送的分类库上用户数据1的属性值,设置到创建出的物料对象版本上sap分组(ld6_sapGroupInfo)属性上
|
|
|
|
|
TCClassificationService classService = session.getClassificationService();
|
|
|
|
|
ICSAdminClass adminClass = classService.newICSAdminClass();
|
|
|
|
@ -3511,9 +3760,9 @@ public class NewCodeItemDialog extends Dialog {
|
|
|
|
|
String user1 = adminClass.getUser1();
|
|
|
|
|
TCComponentItemRevision rev = ((TCComponentItem) newComp).getLatestItemRevision();
|
|
|
|
|
rev.setStringProperty("ld6_sapGroupInfo", user1);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// break;
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|
new GetCodeNumber().delete_recycleID(counterID);
|
|
|
|
|
setClipboard(newID);
|
|
|
|
|