diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..35410ca --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# 默认忽略的文件 +/shelf/ +/workspace.xml +# 基于编辑器的 HTTP 客户端请求 +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/autocode.iml b/.idea/autocode.iml new file mode 100644 index 0000000..d6ebd48 --- /dev/null +++ b/.idea/autocode.iml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/aws.xml b/.idea/aws.xml new file mode 100644 index 0000000..b63b642 --- /dev/null +++ b/.idea/aws.xml @@ -0,0 +1,11 @@ + + + + + + \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml new file mode 100644 index 0000000..a10f443 --- /dev/null +++ b/.idea/encodings.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/git_toolbox_blame.xml b/.idea/git_toolbox_blame.xml new file mode 100644 index 0000000..7dc1249 --- /dev/null +++ b/.idea/git_toolbox_blame.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..5115cce --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..5b30b92 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.project b/.project new file mode 100644 index 0000000..f56f5f1 --- /dev/null +++ b/.project @@ -0,0 +1,11 @@ + + + autocode + + + + + + + + diff --git a/cn.com.origin.autocode/classes/.gitignore b/cn.com.origin.autocode/classes/.gitignore deleted file mode 100644 index 28b1e45..0000000 --- a/cn.com.origin.autocode/classes/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/cn/ -/icons/ diff --git a/cn.com.origin.autocode/src/cn/com/origin/autocode/handlers/AutoCodeNewItemHandler.java b/cn.com.origin.autocode/src/cn/com/origin/autocode/handlers/AutoCodeNewItemHandler.java index 36732fb..419a1c6 100644 --- a/cn.com.origin.autocode/src/cn/com/origin/autocode/handlers/AutoCodeNewItemHandler.java +++ b/cn.com.origin.autocode/src/cn/com/origin/autocode/handlers/AutoCodeNewItemHandler.java @@ -14,6 +14,7 @@ import cn.com.origin.autocodemanager.common.TCPreferenceUitl; import com.teamcenter.rac.aif.AIFDesktop; import com.teamcenter.rac.aifrcp.AIFUtility; import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.util.MessageBox; public class AutoCodeNewItemHandler extends AbstractHandler { private String origin_newItemDialogType = "origin_newItemDialogType"; @@ -25,8 +26,6 @@ public class AutoCodeNewItemHandler extends AbstractHandler { new Thread() { public void run() { ORNewItemCommand command = new ORNewItemCommand(AIFDesktop.getActiveDesktop().getFrame(), AIFUtility.getCurrentApplication()); - // ExcelTemplate Item - // ORNewItemCommand command = new ORNewItemCommand(AIFDesktop.getActiveDesktop().getFrame(), AIFUtility.getCurrentApplication(),"DMTemplate"); try { command.executeModal(); } catch (Exception e) { @@ -36,6 +35,7 @@ public class AutoCodeNewItemHandler extends AbstractHandler { }.start(); } else { new NewCodeItemDialog(AIFDesktop.getActiveDesktop().getShell()).open(); + } return null; } diff --git a/cn.com.origin.autocode/src/cn/com/origin/autocode/newitem/generatcode/NewCodeItemDialog.java b/cn.com.origin.autocode/src/cn/com/origin/autocode/newitem/generatcode/NewCodeItemDialog.java index 04925ce..c11b9a3 100644 --- a/cn.com.origin.autocode/src/cn/com/origin/autocode/newitem/generatcode/NewCodeItemDialog.java +++ b/cn.com.origin.autocode/src/cn/com/origin/autocode/newitem/generatcode/NewCodeItemDialog.java @@ -103,7 +103,10 @@ import com.teamcenter.rac.util.MessageBox; import com.teamcenter.rac.util.PlatformHelper; import com.teamcenter.schemas.soa._2006_03.exceptions.ServiceException; import com.teamcenter.services.rac.core.DataManagementService; +import com.teamcenter.services.rac.core._2008_06.DataManagement.CreateIn; import com.teamcenter.services.rac.core._2008_06.DataManagement.CreateInput; +import com.teamcenter.services.rac.core._2008_06.DataManagement.CreateOut; +import com.teamcenter.services.rac.core._2008_06.DataManagement.CreateResponse; import com.teamcenter.soa.client.model.LovValue; import cn.com.origin.autocode.jfom.util.ClassProperty; @@ -3037,6 +3040,7 @@ public class NewCodeItemDialog extends Dialog { createitemsresponse = datamanagementservice.createItems(aitemproperties, tccomponent1, s1); if (createitemsresponse.serviceData.sizeOfPartialErrors() == 0) { newComp = createitemsresponse.output[0].item; + System.out.println("1:"+newComp.toString()); if (newComp != null) { try { TCComponentItemRevision rev = ((TCComponentItem) newComp).getLatestItemRevision(); @@ -3181,7 +3185,8 @@ public class NewCodeItemDialog extends Dialog { CNCompontent iComp, CNCompontent imComp, CNCompontent rComp, CNCompontent rmComp) { try { - com.teamcenter.services.rac.core._2008_06.DataManagement.CreateInput itemInput = new com.teamcenter.services.rac.core._2008_06.DataManagement.CreateInput(); + //com.teamcenter.services.rac.core._2008_06.DataManagement.CreateInput itemInput = new com.teamcenter.services.rac.core._2008_06.DataManagement.CreateInput(); + CreateInput itemInput = new CreateInput(); itemInput.boName = itemType; System.out.println("Item Type =>>>>" + itemType); Map itemStringMap = new HashMap(); @@ -3248,14 +3253,23 @@ public class NewCodeItemDialog extends Dialog { itemInput.compoundCreateInput = compMap; 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 createin = new CreateIn(); createin.clientId = "Test"; createin.data = itemInput; System.out.println("11111111111111"); - com.teamcenter.services.rac.core._2008_06.DataManagement.CreateResponse createresponse = datamanagementservice - .createObjects( - new com.teamcenter.services.rac.core._2008_06.DataManagement.CreateIn[] { createin }); - + com.teamcenter.services.rac.core._2008_06.DataManagement.CreateResponse createresponse; + createresponse = datamanagementservice.createObjects(new CreateIn[] { createin }); + if (createresponse.serviceData.sizeOfPartialErrors() > 0) { + System.out.println("create item failed"); + for (int i = 0; i < createresponse.serviceData.sizeOfPartialErrors(); i++) { + String[] messages = createresponse.serviceData.getPartialError(0).getMessages(); + for(int j=0;j 0) { @@ -3268,6 +3282,7 @@ public class NewCodeItemDialog extends Dialog { if (atccomponent != null && atccomponent.length > 0) { arraylist.addAll(Arrays.asList(atccomponent)); newComp = atccomponent[0]; + System.out.println("2:"+newComp.toString()+i); } } } @@ -3428,6 +3443,7 @@ public class NewCodeItemDialog extends Dialog { System.out.println("Ñ¡ÖжÔÏó:" + targetObject + " ÀàÐÍ:" + type); } TCComponentItem newItem = (TCComponentItem) newComp; + System.out.println("3:"+newItem.toString()); for (int i = 0; i < generalPropLabelList.size(); i++) { String text = generalPropLabelList.get(i).getText(); @@ -3515,7 +3531,7 @@ public class NewCodeItemDialog extends Dialog { } if (targetObject instanceof TCComponentFolder) { - + System.out.println("5"+newComp.toString()); if (newComp != null) { TCComponentFolder folder = (TCComponentFolder) targetObject; if (isHaveWritePrivilige(folder)) { @@ -3528,7 +3544,7 @@ public class NewCodeItemDialog extends Dialog { } } else if (type.equals("Hxc8tuzhiRevision") || type.equals("Hxc8bctuzhiRevision") || type.equals("Hxc8dmtuzhiRevision") || type.equals("Hxc8mjtuzhiRevision")) { - + System.out.println("6"+newComp.toString()); if (newComp != null) { openByPass(session); targetObject.add("representation_for", ((TCComponentItem) newComp).getLatestItemRevision());// ¹ØÏµ @@ -3546,7 +3562,7 @@ public class NewCodeItemDialog extends Dialog { } } else if (targetObject instanceof TCComponentPseudoFolder) { - + System.out.println("4"+newComp.toString()); if (newComp != null) { if (TCPreferenceUitl.isTrueTCPreferenceValue(session, origin_isNotSaveNewItemToPseudoFolder)) { session.getUser().getNewStuffFolder().add("contents", newComp); @@ -3562,7 +3578,7 @@ public class NewCodeItemDialog extends Dialog { } } } else { - + System.out.println("5"+newComp.toString()); if (newComp != null) { session.getUser().getNewStuffFolder().add("contents", newComp); session.getUser().getNewStuffFolder().refresh(); @@ -4484,12 +4500,7 @@ public class NewCodeItemDialog extends Dialog { } } - TCComponentItem oldItem = tccomponentitemtype.find(getJYNewID(newID)); - if (oldItem != null) { - MessageBox.post("IDΪ¡¾" + getJYNewID(newID) + "¡¿µÄÎïÁÏÒѾ­´æÔÚ!", "INFO", MessageBox.WARNING); - new GetCodeNumber().delete_recycleID(counterID); - return; - } + long time11 = System.nanoTime(); if (!TCPreferenceUitl.isSelectExsitToTCPreferenceValues(session, origin_idNeddExamineAndApproveTypes, @@ -4501,18 +4512,39 @@ public class NewCodeItemDialog extends Dialog { itemID = new GetCodeNumber().getCodeNumber("LS", 10, 0, 99999999, 1, ""); } while (tccomponentitemtype.find(itemID) != null); - createNewItem(itemID, revText.getText(), "JK8LSMaterial", nameText.getText(), ""); - + TCComponentItem oldItem = tccomponentitemtype.find(itemID); + if (oldItem != null) { + MessageBox.post("IDΪ¡¾" + itemID + "¡¿µÄÎïÁÏÒѾ­´æÔÚ!", "INFO", MessageBox.WARNING); + new GetCodeNumber().delete_recycleID(counterID); + return; + }else { + createNewItem(itemID, revText.getText(), "JK8LSMaterial", nameText.getText(), ""); + } + } catch (ServiceException e) { // TODO Auto-generated catch block e.printStackTrace(); } } else { - - createNewItem(getJYNewID(newID), revText.getText(), realItemType, nameText.getText(), ""); + TCComponentItem oldItem = tccomponentitemtype.find(getJYNewID(newID)); + if (oldItem != null) { + MessageBox.post("IDΪ¡¾" + getJYNewID(newID) + "¡¿µÄÎïÁÏÒѾ­´æÔÚ!", "INFO", MessageBox.WARNING); + new GetCodeNumber().delete_recycleID(counterID); + return; + }else { + createNewItem(getJYNewID(newID), revText.getText(), realItemType, nameText.getText(), ""); + } + } } else { - createNewItem(tccomponentitemtype.getNewID(), revText.getText(), realItemType, nameText.getText(), ""); + TCComponentItem oldItem = tccomponentitemtype.find(tccomponentitemtype.getNewID()); + if (oldItem != null) { + MessageBox.post("IDΪ¡¾" + tccomponentitemtype.getNewID() + "¡¿µÄÎïÁÏÒѾ­´æÔÚ!", "INFO", MessageBox.WARNING); + new GetCodeNumber().delete_recycleID(counterID); + return; + }else { + createNewItem(tccomponentitemtype.getNewID(), revText.getText(), realItemType, nameText.getText(), ""); + } } long time12 = System.nanoTime(); System.out.println("´´½¨itemÓÃʱ(ms)£º " + (time12 - time11) / 1000000); @@ -4900,7 +4932,9 @@ public class NewCodeItemDialog extends Dialog { try { TCComponentItemRevision rev = ((TCComponentItem) newComp).getLatestItemRevision(); rev.refresh(); + //»ñÈ¡Ê×Ñ¡ÏîÅäÖõķÖÀàÅäÖÃprefArr£º[{Ï´»¤·ÖÀà¿â/Ï´»¤×ÔÖÆ¼þ:¹æ¸ñ,²ÄÖÊ,³ß´ç,ÑÕÉ«},{},{}] String[] prefArr = getPrefStrArray("jd2_custom_display_name"); + //»ñÈ¡·ÖÀà·¾¶ String classAddress = getClassificationAddress(rev.getClassificationClass()); System.out.println("classAddress=====>" + classAddress); for (String pref : prefArr) { @@ -4928,7 +4962,6 @@ public class NewCodeItemDialog extends Dialog { } } } catch (TCException e) { - // TODO Auto-generated catch block e.printStackTrace(); JOptionPane.showMessageDialog(null, "Ê×Ñ¡Ïîjd2_custom_display_nameÅäÖÃÓÐÎó£¬Çë¼ì²é\r\n" + e.getMessage(), "Ìáʾ", JOptionPane.WARNING_MESSAGE); diff --git a/cn.com.origin.autocodemanager/classes/.gitignore b/cn.com.origin.autocodemanager/classes/.gitignore index e07adca..28b1e45 100644 --- a/cn.com.origin.autocodemanager/classes/.gitignore +++ b/cn.com.origin.autocodemanager/classes/.gitignore @@ -1,2 +1,2 @@ -/icons/ /cn/ +/icons/