|
|
|
@ -3154,77 +3154,82 @@ 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);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// break;
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
//20250425 新增:文档创建后,根据 ID=编码规则名称 带出数据集模板
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (targetObject != null) {
|
|
|
|
|
targetObject.refresh();
|
|
|
|
|