更新功能

main
ChenZichaoczc 4 weeks ago
parent 96135fdf15
commit 2f680a47fb

@ -87,7 +87,7 @@ public class UploadClientDrawingDialog extends AbstractAIFDialog implements Runn
// TODO Auto-generated method stub // TODO Auto-generated method stub
InterfaceAIFComponent selectComponent = application.getTargetContext().getComponent(); InterfaceAIFComponent selectComponent = application.getTargetContext().getComponent();
try { try {
String type = ((TCComponentItemRevision) selectComponent).getStringProperty("object_type"); String type = selectComponent.getProperty("object_type");
System.out.println("type : " + type); System.out.println("type : " + type);
if (selectComponent != null && selectComponent instanceof TCComponentItemRevision if (selectComponent != null && selectComponent instanceof TCComponentItemRevision
&& type.equals("VF5khtzRevision")) { && type.equals("VF5khtzRevision")) {
@ -205,43 +205,6 @@ public class UploadClientDrawingDialog extends AbstractAIFDialog implements Runn
} }
public void uploadDrawings(TCComponent item, File file, boolean flag) throws TCException { public void uploadDrawings(TCComponent item, File file, boolean flag) throws TCException {
// Map<String,TCComponentDataset> fileMap = getFileMap(item);
// String fileName = file.getName();
// if (file.isFile()){
// TCComponentDataset existData = isExistData(fileMap, fileName);
// if(existData!=null && removeData(item,existData)) {
// System.out.println("删除成功,开始添加数据集: "+fileName);
// }
// TCComponentDataset date = addData(item, file.getAbsolutePath());
// if(date == null) {
// StringBuffer str = new StringBuffer();
// str.append("Under the file path: ");
// str.append(file.getAbsolutePath());
// str.append("\nfileName: ");
// str.append(fileName);
// str.append(" add failed");
// JOptionPane.showMessageDialog(this,str.toString());
// }
// } else if (file.isDirectory()) {
// if(flag) {
// // 遍历本地文件夹
// for (File childFile : file.listFiles()){
// uploadDrawings(item,childFile,false);
// }
// }else {
// TCComponentFolder existFolder = isExistFolder(item,fileName);
// if(existFolder==null) {
// existFolder = addFolder(item, file.getName());
// }
//
// // 遍历本地文件夹
// for (File childFile : file.listFiles()){
// uploadDrawings(existFolder,childFile,false);
// }
// }
// }
File[] files = file.listFiles(); File[] files = file.listFiles();
String folderName = file.getName(); String folderName = file.getName();
TCComponent existFolder = item; TCComponent existFolder = item;

@ -48,7 +48,7 @@ public class DbomTransitionToEbomCommand extends AbstractAIFCommand {
//判断对象类型 //判断对象类型
TCComponentItem item = bomLine.getItem(); TCComponentItem item = bomLine.getItem();
boolean isTypeof=false; boolean isTypeof=false;
String[] prefValues = session.getPreferenceService().getStringValues("Connor_LY6_DBOM_Type"); //Connor_DBOM_Type String[] prefValues = session.getPreferenceService().getStringValues("Connor_AHBXW_DBOM_Type"); //Connor_DBOM_Type
System.out.println("prefValuse"+prefValues.toString()); System.out.println("prefValuse"+prefValues.toString());
for(String pref : prefValues) { for(String pref : prefValues) {
if(pref.equals(item.getType())) { if(pref.equals(item.getType())) {
@ -69,7 +69,7 @@ public class DbomTransitionToEbomCommand extends AbstractAIFCommand {
//final List<List<Object>> bomPropertyList = this.getBomPropertys(session, bomLine); //final List<List<Object>> bomPropertyList = this.getBomPropertys(session, bomLine);
String[] prefValueParts = session.getPreferenceService().getStringValues("Connor_LY6_DBOM_PartType"); String[] prefValueParts = session.getPreferenceService().getStringValues("Connor_AHBXW_DBOM_PartType");
for (String string : prefValueParts) { for (String string : prefValueParts) {
preList.add(string); preList.add(string);
} }

@ -328,6 +328,8 @@ public class DbomTransitionToEbomDialog extends AbstractAIFDialog implements Act
for (int i = 0; i < rootNode.getChildCount(); i++) { for (int i = 0; i < rootNode.getChildCount(); i++) {
DefaultMutableTreeTableNode childNode = (DefaultMutableTreeTableNode) rootNode.getChildAt(i); DefaultMutableTreeTableNode childNode = (DefaultMutableTreeTableNode) rootNode.getChildAt(i);
NodeBean childBean = (NodeBean) childNode.getUserObject(); NodeBean childBean = (NodeBean) childNode.getUserObject();
System.out.println("childBean.getLabel() : "+childBean.getLabel());
System.out.println("childBean.getEbom() : "+childBean.getEbom());
if (childBean.getLabel().equals("1") && !childBean.getEbom().isEmpty()) { if (childBean.getLabel().equals("1") && !childBean.getEbom().isEmpty()) {
// MessageBox.post("上层["+childBean.getEbom()+"]已勾选发布的对象,下层不允许勾选!", "错误", // MessageBox.post("上层["+childBean.getEbom()+"]已勾选发布的对象,下层不允许勾选!", "错误",
// MessageBox.ERROR); // MessageBox.ERROR);
@ -438,10 +440,10 @@ public class DbomTransitionToEbomDialog extends AbstractAIFDialog implements Act
if (source.equals(this.okButton)) { if (source.equals(this.okButton)) {
// 获取选中的EBOM对象 // 获取选中的EBOM对象
try { try {
MethodUtil.openByPass(session); // MethodUtil.openByPass(session);
TCComponentItemType itemType = (TCComponentItemType) session.getTypeComponent("Item"); TCComponentItemType itemType = (TCComponentItemType) session.getTypeComponent("Item");
this.adaptiveVariants((DefaultMutableTreeTableNode) (this.node.getChildAt(0)), itemType, true); this.adaptiveVariants((DefaultMutableTreeTableNode) (this.node.getChildAt(0)), itemType, true);
MethodUtil.closeByPass(session); // MethodUtil.closeByPass(session);
MessageBox.post("转换成功!", "成功", MessageBox.INFORMATION); MessageBox.post("转换成功!", "成功", MessageBox.INFORMATION);
} catch (TCException e1) { } catch (TCException e1) {
// TODO Auto-generated catch block // TODO Auto-generated catch block

@ -50,10 +50,11 @@ public class ClassificationCraftDialog extends JFrame implements Runnable {
// TODO Auto-generated method stub // TODO Auto-generated method stub
InterfaceAIFComponent targetComponent = this.application.getTargetComponent(); InterfaceAIFComponent targetComponent = this.application.getTargetComponent();
String itemType = targetComponent.getType(); String itemType = targetComponent.getType();
if (itemType.equals("VF5ccpRevision") || itemType.equals("VF5bcpRevision")) { System.out.println("itemType : "+itemType);
if (itemType.equals("Folder")) {
initUI(); initUI();
} else { } else {
JOptionPane.showMessageDialog(null, "请选择正确的版本!", "Error", JOptionPane.WARNING_MESSAGE); JOptionPane.showMessageDialog(null, "请选择文件夹!", "Error", JOptionPane.WARNING_MESSAGE);
} }
} }
@ -90,7 +91,6 @@ public class ClassificationCraftDialog extends JFrame implements Runnable {
confirmButton.setPreferredSize(new Dimension(87, 25)); // 设置确定按钮的长宽为100x30 confirmButton.setPreferredSize(new Dimension(87, 25)); // 设置确定按钮的长宽为100x30
confirmButton.addActionListener(e -> { confirmButton.addActionListener(e -> {
// 在这里执行确定操作,例如关闭窗口等 // 在这里执行确定操作,例如关闭窗口等
this.dispose();
doTask(); doTask();
}); });
@ -209,9 +209,8 @@ public class ClassificationCraftDialog extends JFrame implements Runnable {
} }
ClassificationCraftOperation classificationCraftOperation = new ClassificationCraftOperation(application, ClassificationCraftOperation classificationCraftOperation = new ClassificationCraftOperation(application,
uid); uid);
// 关闭窗口
this.dispose(); this.dispose();
// 关闭窗口
this.tcSession.queueExcludedOperation(classificationCraftOperation); this.tcSession.queueExcludedOperation(classificationCraftOperation);
} else { } else {
// 如果没有选中任何行,可以弹出提示信息 // 如果没有选中任何行,可以弹出提示信息

@ -29,8 +29,6 @@ public class ClassificationCraftOperation extends AbstractAIFOperation {
private TCSession tcSession; private TCSession tcSession;
private String[] uid; private String[] uid;
private TCComponentItemRevision targetRev;
public ClassificationCraftOperation(AbstractAIFApplication application, String[] itemUid) { public ClassificationCraftOperation(AbstractAIFApplication application, String[] itemUid) {
this.application = application; this.application = application;
this.tcSession = (TCSession) application.getSession(); this.tcSession = (TCSession) application.getSession();
@ -39,52 +37,20 @@ public class ClassificationCraftOperation extends AbstractAIFOperation {
@Override @Override
public void executeOperation() throws Exception { public void executeOperation() throws Exception {
TCComponentFolder targetFolder = getTargetFolder(); TCComponentFolder targetFolder = (TCComponentFolder) this.application.getTargetComponent();
if (targetFolder != null) { if (targetFolder != null) {
TCComponent[] referenceValueArray = targetRev.getTCProperty("IMAN_master_form_rev")
.getReferenceValueArray();
String name = referenceValueArray[0].getStringProperty("object_name");
TCComponentItemType component = (TCComponentItemType) tcSession.getTypeComponent("VF5gy"); TCComponentItemType component = (TCComponentItemType) tcSession.getTypeComponent("VF5gy");
TCComponentItem item = component.create(component.getNewID(), "", "VF5gy", name, "", null); TCComponentItem item = component.create(component.getNewID(), "", "VF5gy", "¹¤ÒÕ·Ïß", "", null);
TCComponentItemRevision gyItemRev = item.getLatestItemRevision(); TCComponentItemRevision gyItemRev = item.getLatestItemRevision();
targetFolder.add("contents", item); targetFolder.add("contents", item);
TCComponentItemRevision targetComponent = (TCComponentItemRevision)application.getTargetComponent();
targetComponent.add("VF5gygx", item);
gyItemRev.add("IMAN_METarget", targetComponent);
setReference(gyItemRev, uid); setReference(gyItemRev, uid);
} else { } else {
MessageBox.post("当前未找到名为POR的文件夹!", "error", MessageBox.ERROR); MessageBox.post("当前未找到名为POR的文件夹!", "error", MessageBox.ERROR);
} }
} }
public TCComponentFolder getTargetFolder() throws TCException {
System.out.println("开始获取target文件夹");
InterfaceAIFComponent targetComponent = this.application.getTargetComponent();
String type = targetComponent.getType();
targetRev = (TCComponentItemRevision) targetComponent;
TCComponentFolder targetFolder = (TCComponentFolder) TcUtil.getLastReferenced(targetRev.getItem(), "Folder","Item");
if(targetFolder!=null) {
targetFolder = (TCComponentFolder) TcUtil.getLastReferenced(targetFolder, "VF5xmwjj","Folder");
}else {
MessageBox.post("当前父文件夹未被引用!", "error", MessageBox.ERROR);
}
if (targetFolder != null) {
TCComponent[] valueArray = targetFolder.getTCProperty("contents").getReferenceValueArray();
for (TCComponent tcComponent : valueArray) {
if (tcComponent instanceof TCComponentFolder
&& tcComponent.getStringProperty("object_name").equals("POR")) {
return (TCComponentFolder) tcComponent;
}
}
} else {
System.out.println("targetFolder is null");
}
return null;
}
public void setReference(TCComponentItemRevision gyItemRev, String[] itemUid) throws TCException { public void setReference(TCComponentItemRevision gyItemRev, String[] itemUid) throws TCException {
TCComponentBOMWindowType winType = (TCComponentBOMWindowType) tcSession.getTypeComponent("BOMWindow"); TCComponentBOMWindowType winType = (TCComponentBOMWindowType) tcSession.getTypeComponent("BOMWindow");
TCComponentBOMWindow view = winType.create(null); TCComponentBOMWindow view = winType.create(null);

@ -111,7 +111,6 @@ public class ClassificationProcessesDialog extends JFrame implements Runnable {
}); });
okButton = new JButton(ConstantPool.CH_BUTTON_CONFIRM); okButton = new JButton(ConstantPool.CH_BUTTON_CONFIRM);
okButton.addActionListener(e -> { okButton.addActionListener(e -> {
this.dispose();
doTask(); doTask();
}); });
cancelButton = new JButton(ConstantPool.CH_BUTTON_CANCEL); cancelButton = new JButton(ConstantPool.CH_BUTTON_CANCEL);
@ -244,7 +243,5 @@ public class ClassificationProcessesDialog extends JFrame implements Runnable {
} else { } else {
System.out.println("No rows selected"); System.out.println("No rows selected");
} }
this.dispose();
} }
} }

Loading…
Cancel
Save