@ -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 < String , Object > 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 < messages . length ; j + + ) {
System . out . println ( createresponse . serviceData . getPartialError ( 0 ) . getErrorValues ( ) [ j ] . getMessage ( ) ) ;
}
System . out . println ( createresponse . serviceData . getPartialError ( 0 ) . getMessages ( ) ) ;
System . out . println ( createresponse . serviceData . getPartialError ( 0 ) . getErrorValues ( ) [ 0 ] . getMessage ( ) ) ;
}
}
SoaUtil . handlePartialErrors ( createresponse . serviceData , null , null , true ) ;
com . teamcenter . services . rac . core . _2008_06 . DataManagement . CreateOut acreateout [ ] = createresponse . output ;
if ( acreateout ! = null & & acreateout . length > 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,19 +4512,40 @@ public class NewCodeItemDialog extends Dialog {
itemID = new GetCodeNumber ( ) . getCodeNumber ( "LS" , 10 , 0 , 99999999 , 1 , "" ) ;
} while ( tccomponentitemtype . find ( itemID ) ! = null ) ;
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 {
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 {
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 ) ;