You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

4955 lines
164 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

/**
* @author tyl
* @Action ini
* 2011-4-4
*/
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.io.UnsupportedEncodingException;
import java.math.BigInteger;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import javax.swing.JDialog;
import javax.xml.bind.JAXBException;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CTabFolder;
import org.eclipse.swt.custom.CTabItem;
import org.eclipse.swt.custom.SashForm;
import org.eclipse.swt.custom.ScrolledComposite;
import org.eclipse.swt.events.ControlAdapter;
import org.eclipse.swt.events.ControlEvent;
import org.eclipse.swt.events.FocusEvent;
import org.eclipse.swt.events.FocusListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.VerifyEvent;
import org.eclipse.swt.events.VerifyListener;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.DateTime;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import org.eclipse.swt.widgets.Widget;
import cn.com.origin.autocode.jfom.util.ChangTextField;
import cn.com.origin.autocode.jfom.util.ClassProperty;
import cn.com.origin.autocode.jfom.util.JFomMethodUtil;
import cn.com.origin.autocode.jfom.util.JFomUtil;
import cn.com.origin.autocode.jfom.util.SoaServerUtil;
import cn.com.origin.autocode.newitem.origin.ORAfterNewItemCustomization;
import cn.com.origin.autocode.newitem.origin.ORCreateICOObject;
import cn.com.origin.autocode.newitem.origin.ORSaveObjectDescOperation;
import cn.com.origin.autocode.newitem.system.ORItemInfoPanel;
import cn.com.origin.autocode.newitem.system.ORNewItemDialog;
import cn.com.origin.autocode.saveas.ORSaveItemAsDialog;
import cn.com.origin.autocode.views.itemtypeview.NewItemClassificationView;
import cn.com.origin.autocode.xmlutil.CNCompontent;
import cn.com.origin.autocode.xmlutil.CNPart;
import cn.com.origin.autocode.xmlutil.CNPartList;
import cn.com.origin.autocode.xmlutil.CNProperty;
import cn.com.origin.autocode.xmlutil.CNXmlUtil;
import cn.com.origin.autocode.xmlutil.ParseXMLUtil;
import cn.com.origin.autocodemanager.common.AutoCodeManagerPropertyName;
import cn.com.origin.autocodemanager.common.CreateCompositeUtil;
import cn.com.origin.autocodemanager.common.PackCodeDescInfos;
import cn.com.origin.autocodemanager.common.TCLOVUtil;
import cn.com.origin.autocodemanager.common.TCPreferenceUitl;
import cn.com.origin.autocodemanager.common.TCQueryUtil;
import cn.com.origin.autocodemanager.common.operations.GetCodeNumber;
import cn.com.origin.autocodemanager.common.operations.PackCodeNodeInfo;
import cn.com.origin.autocodemanager.common.operations.TreeAndListCodeOperation;
import cn.com.origin.autocodemanager.common.tree.AbstractTreeData;
import cn.com.origin.autocodemanager.common.tree.TreeViewOperation;
import cn.com.origin.autocodemanager.views.listcodeview.NewItemListCodeView;
import cn.com.origin.autocodemanager.views.treecodeview.NewItemTreeCodeView;
import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent;
import com.teamcenter.rac.aifrcp.AIFUtility;
import com.teamcenter.rac.kernel.ListOfValuesInfo;
import com.teamcenter.rac.kernel.SoaUtil;
import com.teamcenter.rac.kernel.TCAccessControlService;
import com.teamcenter.rac.kernel.TCClassificationService;
import com.teamcenter.rac.kernel.TCComponent;
import com.teamcenter.rac.kernel.TCComponentFolder;
import com.teamcenter.rac.kernel.TCComponentGroup;
import com.teamcenter.rac.kernel.TCComponentICO;
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.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.TCComponentUser;
import com.teamcenter.rac.kernel.TCException;
import com.teamcenter.rac.kernel.TCExceptionPartial;
import com.teamcenter.rac.kernel.TCPreferenceService;
import com.teamcenter.rac.kernel.TCProperty;
import com.teamcenter.rac.kernel.TCSession;
import com.teamcenter.rac.kernel.TCUserService;
import com.teamcenter.rac.kernel.ics.ICSAdminClass;
import com.teamcenter.rac.kernel.ics.ICSAdminClassAttribute;
import com.teamcenter.rac.kernel.ics.ICSApplicationObject;
import com.teamcenter.rac.kernel.ics.ICSFormat;
import com.teamcenter.rac.kernel.ics.ICSProperty;
import com.teamcenter.rac.kernel.ics.ICSSearchResult;
import com.teamcenter.rac.kernel.ics.ICSView;
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 com.teamcenter.soaictstubs.booleanSeq_tHolder;
import com.teamcenter.soaictstubs.stringSeq_tHolder;
public class NewCodeItemDialog extends Dialog {
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӣ<EFBFBD>Ķ<EFBFBD><C4B6><EFBFBD>
private SashForm sashFormCodeView;
private CTabItem codeTreeCTab;
private CTabItem codeListCTab;
private Composite compositCodeTree;
private Composite compositCodeList;
private CTabFolder ctabFolder;
private Text idLengthText;
private Text DescText;
private Text idText;
private Combo revCombo;
private Text nameText;
private Combo unitCombo;
private NewItemClassificationView classificationView;
private NewItemListCodeView listView;
private NewItemTreeCodeView treeView;
private TreeViewer classificationTreeViewer;
private TreeViewOperation treeViewOperation;
public TreeAndListCodeOperation treeAndListCodeOperation;
private TCSession session;
private TCComponentItemType tccomponentitemtype;
private AbstractTreeData selectedSegmentNode = null;
private TCComponent selectedSegmentTCComponent = null;
private AbstractTreeData icoTreeData;
private String pattern = "";
private String codeDesc = "";
private String codeStyle = "";
private String newSeq = "";
private String counterID = "";
private String newID = "";
private String finalPattern = "";
private String idPattern = "";
// 20170510 class id
private String codeRemark = "";
private int codeLength;
private Map<String, String> icoPropertyMap;
private String firstListICOName = "";
private String codeCounterName = "";
private Map<AbstractTreeData, String> segmentItemType;
private TCComponent newComp;
private String showItemType = "";
private Boolean isTypeFilter = false;
private String origin_isNewItemMustLastNode = "origin_isNewItemMustLastNode";
private String origin_idNeddExamineAndApproveTypes = "origin_idNeddExamineAndApproveTypes";
private String origin_sendToClassification_excludeType = "origin_sendToClassification_excludeType";
private String origin_sendToPreviousTreeNode = "origin_sendToPreviousTreeNode";
private String origin_sendToClassification_Automatic = "origin_sendToClassification_Automatic";
private String origin_isCodePatternCanEditTypes = "origin_isCodePatternCanEditTypes";
private String unitLOVName = "Unit of Measures";
private String origin_newItem_isShowUnit = "origin_newItem_isShowUnit";
private String origin_showUnit_excludeTypes = "origin_showUnit_excludeTypes";
private JDialog newItemDialog;
private ORItemInfoPanel orNewItemInfoPanel;
private TCComponent[] units = null;
private String origin_isItemNameTextDefaultNull = "origin_isItemNameTextDefaultNull";
private PackCodeDescInfos packCodeDescInfos = null;
private SashForm container;
private SashForm itemInfoComposite;
private SashForm sashFormClassfication;
private String origin_isMustSelecteUnit = "origin_isMustSelecteUnit";
private String origin_searchGenerateID = "origin_searchGenerateID";
private String origin_isNotSaveNewItemToPseudoFolder = "origin_isNotSaveNewItemToPseudoFolder";
private String origin_isShowPCUnitLast = "origin_isShowPCUnitLast";
private String origin_newCodeSequenceNumber = "origin_newCodeSequenceNumber";
private String origin_sequenceExcludeFirstPatternTypes = "origin_sequenceExcludeFirstPatternTypes";
private String connor_isCanCreateTempMaterial = "connor_isCanCreateTempMaterial";
private final String connor_isIdTextEnable = "connor_isIdTextEnable";
private Composite cpxCompsite;
private Label cpxLabel;
private Text cpxText;
private Label nfLabel;
private Text nfText;
private Label cpxLabel2;
private Combo cpxText2;
private final String CPX = "CPDM";
private final String NF = "NF";
private final String CPX2 = "CP";
private final String JY_CPX_Option = "JY_CPX_Option";
private HashMap<String, String> jyCPXMap;
// 2017.05.10
private Button isCreateTempItemButton = null;
private Boolean isCreateTempItem = false;
// 2017.06.02
// private List<>
private Composite objPropComposite;
private Composite classPropComposite;
private static TCClassificationService classService;
private static ICSAdminClass adminClass;
// 2017.06.26
private String LPBIGString;
private String LPSString;
// 2017.07.02
private CNPartList cnPartList;
private CNPart currentCNPart;
private List<CNProperty> cnpropList;
// 2018.09.30
private String LP_PROJECT_ID;
//2019.11.07
private String connor_InsertSequence = "LP_sequenceMapping";
private HashMap<String, Integer> connor_SequenceNameMapping;
private List<String> connor_PatterValueList;
private String connor_CurrentTypeNameString = "";
//2020.12.28
// private Button picCheckbox;
private Button picButton;
private List<TCComponentItemRevision> revList = new ArrayList<TCComponentItemRevision>();
private String productNumber = "";
private String drawingNumber = "";
private String bsNumber = "";
private String smNumber = "";
private String cldh = "";
private String zcType = "";
private Map<String,List<String>> attrMap;
private Map<String,List<String>> attrMap2;
private Map<String,List<String>> attrMap3;
private Map<String,List<String>> attrMap4;
private Map<String,Object> objMap = new HashMap<String, Object>();
private Map<String,Object> objMap2 = new HashMap<String, Object>();
private Map<String,Object> objMap3 = new HashMap<String, Object>();
private Map<String,Object> objMap4 = new HashMap<String, Object>();
private Map<String,String> lovMap = new HashMap<String, String>();
private Map<String,String> lovMap2 = new HashMap<String, String>();
private Map<String,String> lovMap3 = new HashMap<String, String>();
private Map<String,String> lovMap4 = new HashMap<String, String>();
private List<String> attrList = new ArrayList<String>();
private List<String> esAttrList = new ArrayList<String>();
private List<String> defaultValueList = new ArrayList<String>();
private List<String> markList = new ArrayList<String>();
private List<String> markList2 = new ArrayList<String>();
private List<String> markList3 = new ArrayList<String>();
private List<String> markList4 = new ArrayList<String>();
private List<String> isNList = new ArrayList<String>();
private List<String> isNList2 = new ArrayList<String>();
private List<String> isNList3 = new ArrayList<String>();
private List<String> isNList4 = new ArrayList<String>();
private List<String> attrList2 = new ArrayList<String>();
private List<String> attrList3 = new ArrayList<String>();
private List<String> attrList4 = new ArrayList<String>();
private List<String> esAttrList2 = new ArrayList<String>();
private List<String> esAttrList3 = new ArrayList<String>();
private List<String> esAttrList4 = new ArrayList<String>();
private Map<String,Combo> boxMap = new HashMap<String, Combo>();
private Map<String,Object> idMap = new HashMap<String, Object>();
private List<String> asList = new ArrayList<String>();
private List<String> esList = new ArrayList<String>();
// private String[] lovVal = new String[] { "<22><>ǰ<EFBFBD><C7B0>", "<22><>׼<EFBFBD><D7BC><EFBFBD><EFBFBD>", "<22>޽Ӵ<DEBD><D3B4><EFBFBD>", "<22><>ʽ", "<22><><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD>", "A:NBR", "0:<3A><>", "<22><>", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>",
// "SN:180<38><30><EFBFBD><EFBFBD>5<EFBFBD><35><EFBFBD>ػ<EFBFBD>", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȴ<EFBFBD><C8B4><EFBFBD>", "<22><><EFBFBD><EFBFBD>", "S:(25% to 35%)", "C0","V0","Z0","<22><>׼","PC:<3A><EFBFBD><EFB5BD><EFBFBD><EFBFBD>C&UƷ<55>ƾ<EFBFBD><C6BE><EFBFBD>Ҫ<EFBFBD><D2AA>"
// ,"P0:<3A><EFBFBD><EFB5BD><EFBFBD><EFBFBD>C&UƷ<55>ƾ<EFBFBD><C6BE><EFBFBD>Ҫ<EFBFBD><D2AA>","<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E1B9B9>Ҫ<EFBFBD><D2AA><EFBFBD>ƹ<EFBFBD><C6B9><EFBFBD>","0:˫<>нǽӴ<C7BD><D3B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>","<22><><EFBFBD><EFBFBD>:SECC<43><43><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E0B5B1><EFBFBD><EFBFBD>","<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:<3A>벿<EFBFBD><EBB2BF><EFBFBD>Ŷ<EFBFBD>ȷ<EFBFBD><C8B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>","BC:35<33><35>"};
// private String[] esLovVal = new String[] { "Non", "Standard ball", "Non", "Open", "Without vent hole", "A:NBR",
// "0:Black", "Non", "Ball", "SN:180<38><30><EFBFBD><EFBFBD>5<EFBFBD><35> temper","Conventional monolithic martensite quenching heat treatment",
// "Single", "S:(25% to 35%)", "C0","V0","Z0","Standard","PC:Meet the group C&U brand accuracy requirements"
// ,"P0:Meet the group C&U brand accuracy requirements","Other structures need to formulate rules","0:Double row angular contact ball bearing"
// ,"Not marked: SECC or equivalent","Other materials: confirm with department team for approval","BC:35<33><35>"};
public Text getIdLengthText() {
return idLengthText;
}
public void setIdLengthText(Text idLengthText) {
this.idLengthText = idLengthText;
}
public Combo getUnitCombo() {
return unitCombo;
}
public void setUnitCombo(Combo unitCombo) {
this.unitCombo = unitCombo;
}
public Text getDescText() {
return DescText;
}
public void setDescText(Text descText) {
DescText = descText;
}
public Text getIdText() {
return idText;
}
public void setIdText(Text idText) {
this.idText = idText;
}
public Combo getRevCombo() {
return revCombo;
}
public void setRevCombo(Combo revCombo) {
this.revCombo = revCombo;
}
public Text getNameText() {
return nameText;
}
public void setNameText(Text nameText) {
this.nameText = nameText;
}
public TCComponent getNewComp() {
return newComp;
}
public void setNewComp(TCComponent newComp) {
this.newComp = newComp;
}
// public Button getPicCheckbox() {
// return picCheckbox;
// }
//
// public void setPicCheckbox(Button picCheckbox) {
// this.picCheckbox = picCheckbox;
// }
public Button getPicButton() {
return picButton;
}
public void setPicButton(Button picButton) {
this.picButton = picButton;
}
public NewCodeItemDialog(Shell parentShell) {
super(parentShell);
treeViewOperation = new TreeViewOperation();
treeAndListCodeOperation = new TreeAndListCodeOperation();
session = (TCSession) AIFUtility.getCurrentApplication().getSession();
segmentItemType = new HashMap<AbstractTreeData, String>();
try {
tccomponentitemtype = (TCComponentItemType) (session
.getTypeComponent("Item"));
} catch (TCException e) {
e.printStackTrace();
}
}
public NewCodeItemDialog(Shell parentShell, String showItemType) {
super(parentShell);
treeViewOperation = new TreeViewOperation();
this.showItemType = showItemType.trim();
treeAndListCodeOperation = new TreeAndListCodeOperation();
session = (TCSession) AIFUtility.getCurrentApplication().getSession();
segmentItemType = new HashMap<AbstractTreeData, String>();
try {
tccomponentitemtype = (TCComponentItemType) (session
.getTypeComponent("Item"));
} catch (TCException e) {
e.printStackTrace();
}
}
public NewCodeItemDialog(Shell parentShell, String showItemType,
Boolean isFilterType) {
super(parentShell);
treeViewOperation = new TreeViewOperation();
this.showItemType = showItemType.trim();
this.isTypeFilter = isFilterType;
treeAndListCodeOperation = new TreeAndListCodeOperation();
session = (TCSession) AIFUtility.getCurrentApplication().getSession();
segmentItemType = new HashMap<AbstractTreeData, String>();
try {
tccomponentitemtype = (TCComponentItemType) (session
.getTypeComponent("Item"));
} catch (TCException e) {
e.printStackTrace();
}
}
public NewCodeItemDialog(JDialog newItemDialog, Shell parentShell,
String showItemType) {
super(parentShell);
this.newItemDialog = newItemDialog;
treeViewOperation = new TreeViewOperation();
this.showItemType = showItemType.trim();
treeAndListCodeOperation = new TreeAndListCodeOperation();
session = (TCSession) AIFUtility.getCurrentApplication().getSession();
segmentItemType = new HashMap<AbstractTreeData, String>();
try {
tccomponentitemtype = (TCComponentItemType) (session
.getTypeComponent("Item"));
} catch (TCException e) {
e.printStackTrace();
}
}
public NewCodeItemDialog(Shell parentShell, String showItemType,
PackCodeDescInfos packCodeDescInfos) {
super(parentShell);
treeViewOperation = new TreeViewOperation();
this.showItemType = showItemType.trim();
treeAndListCodeOperation = new TreeAndListCodeOperation();
session = (TCSession) AIFUtility.getCurrentApplication().getSession();
segmentItemType = new HashMap<AbstractTreeData, String>();
this.packCodeDescInfos = packCodeDescInfos;
try {
tccomponentitemtype = (TCComponentItemType) (session
.getTypeComponent("Item"));
} catch (TCException e) {
e.printStackTrace();
}
}
public NewCodeItemDialog(ORItemInfoPanel newItemInfoPanel,
Shell parentShell, String showItemType) {
super(parentShell);
this.orNewItemInfoPanel = newItemInfoPanel;
treeViewOperation = new TreeViewOperation();
this.showItemType = showItemType.trim();
treeAndListCodeOperation = new TreeAndListCodeOperation();
session = (TCSession) AIFUtility.getCurrentApplication().getSession();
segmentItemType = new HashMap<AbstractTreeData, String>();
try {
tccomponentitemtype = (TCComponentItemType) (session
.getTypeComponent("Item"));
} catch (TCException e) {
e.printStackTrace();
}
}
/**
* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҳ<EFBFBD><D2B3> <20><><EFBFBD>ӷ<EFBFBD><D3B7><EFBFBD><EFBFBD><EFBFBD>Ϥҳ<CFA4><D2B3>
*
* @param parent
*/
public void createClassTablePannel(Composite parent1) {
GridLayout gridLayout = new GridLayout();
gridLayout.numColumns = 3;
GridLayout classGridLayout = new GridLayout();
classGridLayout.numColumns = 3;
GridData gridData1 = new GridData();
gridData1.widthHint = 200;
gridData1.heightHint = 680;
gridData1.horizontalAlignment = GridData.FILL;
gridData1.verticalAlignment = GridData.CENTER;
gridData1.grabExcessHorizontalSpace = true;
CTabFolder ctabFolder = new CTabFolder(parent1, SWT.BORDER);
ctabFolder.setBorderVisible(true);
ctabFolder.setSimple(false);
ctabFolder.setLayoutData(gridData1);
CTabItem objPropTab = new CTabItem(ctabFolder, SWT.NONE);
objPropTab.setText(PlmLocale.getString("ObjectProperties"));
Composite objectCompsite = new Composite(ctabFolder, SWT.BORDER);
objectCompsite.setLayout(new FillLayout());
final ScrolledComposite objectSrolledComposite = new ScrolledComposite(
objectCompsite, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
objPropComposite = new Composite(objectSrolledComposite, SWT.NONE);
objPropComposite.setLayout(gridLayout);
objectSrolledComposite.setContent(objPropComposite);// <20><><EFBFBD><EFBFBD><EFBFBD>ܿ<EFBFBD><DCBF><EFBFBD><EFBFBD><EFBFBD>
objectSrolledComposite.setExpandHorizontal(true);
objectSrolledComposite.setExpandVertical(true);
objectSrolledComposite.addControlListener(new ControlAdapter() {
public void controlResized(ControlEvent e) {
Point r = objPropComposite
.computeSize(SWT.DEFAULT, SWT.DEFAULT);
objectSrolledComposite.setMinSize(objectSrolledComposite
.computeSize(r.x, (r.y)+300));
}
});
objPropTab.setControl(objectCompsite);
ctabFolder.setSelection(0);
//
CTabItem classPropTab = new CTabItem(ctabFolder, SWT.NONE);
classPropTab.setText(PlmLocale.getString("ClassificationProperties"));
Composite classCompsite = new Composite(ctabFolder, SWT.BORDER);
classCompsite.setLayout(new FillLayout());
final ScrolledComposite classSrolledComposite = new ScrolledComposite(
classCompsite, SWT.V_SCROLL);
classPropComposite = new Composite(classSrolledComposite, SWT.NONE);// ctabFolder
classPropComposite.setLayout(classGridLayout);
classSrolledComposite.setContent(classPropComposite);// <20><><EFBFBD><EFBFBD><EFBFBD>ܿ<EFBFBD><DCBF><EFBFBD><EFBFBD><EFBFBD>
classSrolledComposite.setExpandHorizontal(true);
classSrolledComposite.setExpandVertical(true);
classSrolledComposite.addControlListener(new ControlAdapter() {
public void controlResized(ControlEvent e) {
Point r = classPropComposite.computeSize(SWT.DEFAULT,
SWT.DEFAULT);
classSrolledComposite.setMinSize(classSrolledComposite
.computeSize(r.x, (r.y)+300));
}
});
classPropTab.setControl(classCompsite);
}
public List<Label> classLabelList = new ArrayList<>();
public List<Widget> classTextList = new ArrayList<>();
public List<CNClassPropBean> classPropList = new ArrayList<>();
public List<Widget> boxList = new ArrayList<>();
/**
* <20><><EFBFBD>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Խ<EFBFBD><D4BD><EFBFBD>
*/
public void addClassPropComosite(String classID) {
// classPropComposite.dispose();
// GridLayout gridLayout = new GridLayout();
// gridLayout.numColumns = 2;
// a
for (int i = 0; i < classLabelList.size(); i++) {
Label label = classLabelList.get(i);
Widget text = classTextList.get(i);
Widget text1 = boxList.get(i);
label.dispose();
text.dispose();
text1.dispose();
}
classPropList.clear();
classLabelList.clear();
classTextList.clear();
boxList.clear();
idMap.clear();
boxMap.clear();
if (classID == null || classID.replace(" ", "").equals("")) {
return;
}
try {
if (session == null) {
session = (TCSession) AIFUtility.getCurrentApplication()
.getSession();
}
if (classService == null) {
classService = session.getClassificationService();
}
if (adminClass == null) {
adminClass = classService.newICSAdminClass();
}
adminClass.load(classID);
ICSAdminClassAttribute[] icsAttrS = adminClass.getAttributes();
if (icsAttrS != null) {
for (ICSAdminClassAttribute attr : icsAttrS) {
if (attr.isReferenceAttribute()) {
continue;
}
if (attr.isReference()) {
continue;
}
final CNClassPropBean bean = new CNClassPropBean(attr);
classPropList.add(bean);
Label label = CreateCompositeUtil.createNewLabel(
classPropComposite, bean.propDisName);
label.getParent().layout();
classLabelList.add(label);
Widget widget = null;
Widget widget1 = null;
if (!bean.isLov) {
// System.out.println(ICSFormat.STRING +
// "|"+ICSFormat.INTEGER +"|"+ICSFormat.REAL);
// System.out.println(bean.formate
// +" | "+bean.propDisName +" | " + bean.attrType );
if (bean.attrType == ICSFormat.STRING) {
Text propText = CreateCompositeUtil.createNewText(
classPropComposite, "");
propText.getParent().layout();
ChangTextField.chField(propText);
if (bean.propID == -500292) {
propText.addVerifyListener(new VerifyListener() {
@Override
public void verifyText(VerifyEvent e) {
if (e.keyCode != 8) {
boolean b = "abcdefghijklmnopqrstuvwxyz"
.indexOf(e.text) >= 0;
e.doit = !b;
} else
e.doit = true; // doit<69><74><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊtrue,<2C><><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C><>֮<EFBFBD><D6AE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
}
});
}
widget = propText;
} else if (bean.attrType == ICSFormat.REAL) {
final int intL = bean.intsize;
System.out.println(intL);
final int floatL = bean.floatsize;
System.out.println(floatL);
final StringBuffer number = new StringBuffer();
if (intL > 0 && floatL > 0) {
for (int i = 0; i < intL; i++) {
number.append("9");
}
number.append(".");
for (int i = 0; i < floatL; i++) {
number.append("9");
}
} else {
number.append("0");
}
System.out.println(bean.formate);
System.out.println(number.toString());
final Text propText = CreateCompositeUtil
.createNewText(classPropComposite, "");
ChangTextField.chField(propText);
propText.getParent().layout();
propText.addVerifyListener(new VerifyListener() {
@Override
public void verifyText(VerifyEvent e) {
boolean b = "0123456789.".indexOf(e.text) >= 0;
e.doit = b; // doit<69><74><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊtrue,<2C><><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C><>֮<EFBFBD><D6AE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
System.out.println(b + " | " + e.keyCode
+ " | "
+ propText.getText().length() + "|"
+ intL + "|" + floatL);
if (e.keyCode != 8) {
if (b
&& propText.getText().length() > (intL
+ floatL - 1)) {
e.doit = false;
return;
}
}
if (b && e.text.equals(".")
&& propText.getText().contains(".")) {
e.doit = false;
return;
}
if (e.doit) {
try {
float f = Float.parseFloat(propText
.getText()
+ (e.text)
+ ("0"));
float f2 = Float.parseFloat(number
.append("0").toString());
if (f > f2) {
e.doit = false;
}
} catch (Exception e1) {
e1.printStackTrace();
}
}
}
});
widget = propText;
} else if (bean.attrType == ICSFormat.INTEGER) {
Text propText = CreateCompositeUtil.createNewText(
classPropComposite, "");
propText.getParent().layout();
ChangTextField.chField(propText);
widget = propText;
propText.addVerifyListener(new VerifyListener() {
@Override
public void verifyText(VerifyEvent e) {
boolean b = "0123456789".indexOf(e.text) >= 0;
e.doit = b; // doit<69><74><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊtrue,<2C><><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C><>֮<EFBFBD><D6AE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
}
});
} else {
Text propText = CreateCompositeUtil.createNewText(
classPropComposite, "");
propText.getParent().layout();
ChangTextField.chField(propText);
widget = propText;
}
} else {
final Button comb = CreateCompositeUtil.createButton(
classPropComposite, "", 20,
240);
comb.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
Point p = classPropComposite
.toDisplay(((Button) e.getSource())
.getLocation());
ShowClassLovDialog dialog = new ShowClassLovDialog(
classPropComposite.getShell(), SWT.NONE,p,bean.keyList.toArray(new String[bean.keyList.size()]));
((Button) e.getSource()).setEnabled(false);
Object resault = dialog.open();
((Button) e.getSource()).setEnabled(true);
if (resault != null
&& resault instanceof LovKeyValue
&& ((LovKeyValue) resault).value != null) {
LovKeyValue kv = (LovKeyValue) resault;
((Button) e.getSource()).setData(kv.key);
((Button) e.getSource()).setText(kv.value);
System.out.println("LOV=>KEY>" + kv.key
+ "|VALUE=>V>" + kv.value);
} else {
System.out.println("LovKeyValue NULL");
}
}
});
widget = comb;
// Combo combo = CreateCompositeUtil
// .createNotFillNewCombo(
// classPropComposite,
// bean.keyList
// .toArray(new String[bean.keyList
// .size()]));
comb.getParent().layout();
widget = comb;
}
if((PlmLocale.getString("statusCode")).equals(bean.propDisName) ||
(PlmLocale.getString("Customer")).equals(bean.propDisName) ||
(PlmLocale.getString("PartNumber")).equals(bean.propDisName) ) {
idMap.put(bean.propDisName, widget);
}
if((PlmLocale.getString("RadialClearance")).equals(bean.propDisName)) {
Combo combo = CreateCompositeUtil
.createNotFillNewCombo(
classPropComposite,
new String[] {PlmLocale.getString("Non"),"C0","C2","C3","C4","C5"});
widget1 = combo;
boxMap.put(bean.propDisName, combo);
}else if((PlmLocale.getString("GreaseAmount")).equals(bean.propDisName)){
Combo combo = CreateCompositeUtil
.createNotFillNewCombo(
classPropComposite,
new String[] {PlmLocale.getString("Non"),"L:(15% to 25%)","S:(25% to 35%)","H:(35% to 45%)"
,"SG5:(0 to 10%)","SG10:(5% to 15%)","SG15:(10% to 20%)","SG25:(20% to 30%)"
,"SG35:(30% to 40%)","SG45:(40% to 50%)","SG50:(45% to 55%)","SG55:(50% to 60%)"
,"SG60:(55% to 65%)","SG65:(60% to 70%)","SG70:(65% to 75%)","SG75:(70% to 80%)"
,"SG80:(75% to 85%)","SG85:(80% to 90%)","SG90:(85% to 95%)","SG95:(90% to 100%)"});
widget1 = combo;
boxMap.put(bean.propDisName, combo);
}else if((PlmLocale.getString("VibrationAcceleration")).equals(bean.propDisName)){
Combo combo = CreateCompositeUtil
.createNotFillNewCombo(
classPropComposite,
new String[] {PlmLocale.getString("Non"),"Z0","Z1","Z2"
,"Z3","Z4"});
widget1 = combo;
boxMap.put(bean.propDisName, combo);
}else if((PlmLocale.getString("VibrationSpeed")).equals(bean.propDisName)){
Combo combo = CreateCompositeUtil
.createNotFillNewCombo(
classPropComposite,
new String[] {PlmLocale.getString("Non"),"V0","V1","V2"
,"V3","V4"});
widget1 = combo;
boxMap.put(bean.propDisName, combo);
}else {
Label label2 = new Label(classPropComposite, SWT.NONE);
label2.setText("");
widget1 = label2;
}
boxList.add(widget1);
classTextList.add(widget);
}
}
} catch (TCException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
classPropComposite.update();
classPropComposite.layout();
}
public List<Label> generalPropLabelList = new ArrayList<>();
public List<Widget> generalPropTextList = new ArrayList<>();
public List<Widget> fuheTextList = new ArrayList<>();
public void addGeneralPropComosite() {
for (int i = 0; i < generalPropLabelList.size(); i++) {
Label label = generalPropLabelList.get(i);
Widget text = generalPropTextList.get(i);
Widget text1 = fuheTextList.get(i);
label.dispose();
text.dispose();
text1.dispose();
}
generalPropLabelList.clear();
generalPropTextList.clear();
fuheTextList.clear();
if (this.cnpropList != null) {
for (CNProperty cnProp : this.cnpropList) {
final String generalName = PlmLocale.getString(cnProp.getDisplayName());
Label label = CreateCompositeUtil.createNewLabel(
objPropComposite,
cnProp.getIsMust() ? (generalName + "(<28><><EFBFBD><EFBFBD>)")
: generalName);
generalPropLabelList.add(label);
Widget widget = null;
Widget widget1 = null;
if (!cnProp.getIsLov()) {
if (cnProp.getPropertyType().toUpperCase().equals("STRING")) {
final Text text = CreateCompositeUtil.createNewText(
objPropComposite, cnProp.getDefaultValue());
text.setText(cnProp.getDefaultValue());
if(generalName.contains(PlmLocale.getString("dynamicLoadRatingCr"))
|| generalName.contains(PlmLocale.getString("staticLoadRatingCor"))) {
System.out.println("<22>˱<EFBFBD><CBB1><EFBFBD><EEB6A8><EFBFBD>ɵ<EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD><E2B4A6>");
final Combo comb = CreateCompositeUtil
.createNotFillNewCombo(
objPropComposite,
new String[] {"kN","N"});
// new
comb.setText("");
widget1 = comb; // Combo(propTable, // SWT.NONE);
}else if(generalName.contains(PlmLocale.getString("OperatingRange"))
|| generalName.contains(PlmLocale.getString("Resolution"))) {
try {
String s1 = new String("<22><>m".getBytes("GBK"),"GBK");
String s2 = new String("N<><4E>m".getBytes("GBK"),"GBK");
String s3 = new String("Kg<4B><67>m/s".getBytes("GBK"),"GBK");
String s4 = new String("<22><><EFBFBD><EFBFBD>m".getBytes("GBK"),"GBK");
String s5 = new String("<22><>".getBytes("GBK"),"GBK");
String s6 = new String("<22><>".getBytes("GBK"),"GBK");
final Combo comb = CreateCompositeUtil
.createNotFillNewCombo(
objPropComposite,
new String[] {"m","cm","mm",s1,"mg","g","kg",
"s","min","h","dB","A","K","mol","cd","m/s","m^2","m^3","m/s^2",
"rad/s","Hz","kg/m^3","N",s2,s3,"Pa","J","W","C","V/m",
"V","F",s4,s5,"T","Wb","H","lm","lx","Bq","Gy",s6,"r/min","L","eV"});
// new
comb.setText("");
widget1 = comb; // Combo(propTable, // SWT.NONE);
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}else {
Label label2 = new Label(objPropComposite, SWT.NONE);
label2.setText("");
widget1 = label2;
}
widget = text;
} else if (cnProp.getPropertyType().toUpperCase()
.equals("INTEGER")) {
final Text text = CreateCompositeUtil.createNewText(
objPropComposite, cnProp.getDefaultValue());
text.setText("0");
widget = text;
text.addVerifyListener(new VerifyListener() {
@Override
public void verifyText(VerifyEvent e) {
boolean b = "0123456789".indexOf(e.text) >= 0;
e.doit = b; // doit<69><74><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊtrue,<2C><><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C><>֮<EFBFBD><D6AE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
}
});
Label label2 = new Label(objPropComposite, SWT.NONE);
label2.setText("");
widget1 = label2;
} else if (cnProp.getPropertyType().toUpperCase()
.equals("DOUBLE")) {
final Text text = CreateCompositeUtil.createNewText(
objPropComposite, cnProp.getDefaultValue());
text.setText("0");
widget = text;
text.addVerifyListener(new VerifyListener() {
@Override
public void verifyText(VerifyEvent e) {
boolean b = "0123456789.".indexOf(e.text) >= 0;
e.doit = b; // doit<69><74><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊtrue,<2C><><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C><>֮<EFBFBD><D6AE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if (b && e.text.equals(".")
&& text.getText().contains(".")) {
e.doit = false;
}
}
});
Label label2 = new Label(objPropComposite, SWT.NONE);
label2.setText("");
widget1 = label2;
} else if (cnProp.getPropertyType().toUpperCase()
.equals("DATE")) {
final DateTime text = new DateTime(objPropComposite,
SWT.DATE);
widget = text;
Label label2 = new Label(objPropComposite, SWT.NONE);
label2.setText("");
widget1 = label2;
} else if (cnProp.getPropertyType().toUpperCase()
.equals("BOOLEAN")) {
final Combo comb = CreateCompositeUtil
.createNotFillNewCombo(objPropComposite,
new String[] { "true", "false" }); // new
comb.setText(cnProp.getDefaultValue()); // Combo(propTable,
widget = comb; // SWT.NONE);
Label label2 = new Label(objPropComposite, SWT.NONE);
label2.setText("");
widget1 = label2;
}
}else {// lovBeanList
final TCComponentListOfValues cnProplov = cnProp.lov;
boolean isMutilLov = false;
if (cnProplov != null) {
try {
ListOfValuesInfo info = cnProplov.getListOfValues();
String[] valuesList = info.getStringListOfValues();
for (String v : valuesList) {
TCComponentListOfValues cLov = cnProplov
.getListOfFilterOfValue(v);
if (cLov != null) {
isMutilLov = true;
break;
}
}
} catch (TCException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
if(cnProp.getPropertyType().toUpperCase().equals("ARRAYS")) {
final Button comb = CreateCompositeUtil.createButton(
objPropComposite, cnProp.getDefaultValue(), 20,
240);
comb.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
Point p = objPropComposite
.toDisplay(((Button) e.getSource())
.getLocation());
ShowLovDialog2 dialog = new ShowLovDialog2(
objPropComposite.getShell(), SWT.NONE,p,cnProplov,generalName);
((Button) e.getSource()).setEnabled(false);
Object resault = dialog.open();
((Button) e.getSource()).setEnabled(true);
if (resault != null
&& resault instanceof LovKeyValue
&& ((LovKeyValue) resault).value != null) {
LovKeyValue kv = (LovKeyValue) resault;
((Button) e.getSource()).setData(kv.key);
((Button) e.getSource()).setText(kv.value);
System.out.println("LOV=>KEY>" + kv.key
+ "|VALUE=>V>" + kv.value);
} else {
System.out.println("LovKeyValue NULL");
}
}
});
widget = comb; // Combo(propTable, // SWT.NONE);
comb.setText(cnProp.getDefaultValue());
Label label2 = new Label(objPropComposite, SWT.NONE);
label2.setText("");
widget1 = label2;
fuheTextList.add(widget1);
generalPropTextList.add(widget);
continue;
}
if (isMutilLov) {
final Button comb = CreateCompositeUtil.createButton(
objPropComposite, cnProp.getDefaultValue(), 20,
240);
comb.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
Point p = objPropComposite
.toDisplay(((Button) e.getSource())
.getLocation());
ShowLovDialog dialog = new ShowLovDialog(
objPropComposite.getShell(), SWT.NONE,
comb.getText(), comb.getData(), p,cnProplov);
((Button) e.getSource()).setEnabled(false);
Object resault = dialog.open();
((Button) e.getSource()).setEnabled(true);
if (resault != null
&& resault instanceof LovKeyValue
&& ((LovKeyValue) resault).value != null) {
LovKeyValue kv = (LovKeyValue) resault;
((Button) e.getSource()).setData(kv.key);
((Button) e.getSource()).setText(kv.value);
System.out.println("LOV=>KEY>" + kv.key
+ "|VALUE=>V>" + kv.value);
} else {
System.out.println("LovKeyValue NULL");
}
}
});
widget = comb; // Combo(propTable, // SWT.NONE);
comb.setText(cnProp.getDefaultValue());
Label label2 = new Label(objPropComposite, SWT.NONE);
label2.setText("");
widget1 = label2;
} else {
final Combo comb = CreateCompositeUtil
.createNotFillNewCombo(
objPropComposite,
cnProp.lovDisplayValueList
.toArray(new String[cnProp.lovDisplayValueList
.size()]));
// new
widget = comb; // Combo(propTable, // SWT.NONE);
if(generalName.contains(PlmLocale.getString("AssemblyTypes"))) {
comb.setText(zcType);
}else {
comb.setText(cnProp.getDefaultValue());
}
if (cnProp.getDefaultValue() != null
&& !cnProp.getDefaultValue().equals("")) {
int dindex = cnProp.lovDisplayValueList
.lastIndexOf(cnProp.getDefaultValue());
if (dindex >= 0) {
comb.select(dindex);
}
}
Label label2 = new Label(objPropComposite, SWT.NONE);
label2.setText("");
widget1 = label2;
}
}
fuheTextList.add(widget1);
generalPropTextList.add(widget);
}
}
objPropComposite.update();
objPropComposite.layout();
}
/**
* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*/
public boolean checkClassficationICO() {
boolean isContent = false;
try {
// codeRemark
if (classPropList.size() > 0) {
ICSProperty icspro[] = new ICSProperty[classPropList.size()];
for (int i = 0; i < classPropList.size(); i++) {
CNClassPropBean bean = classPropList.get(i);
String value = "";
if (bean.isLov) {
value = ((Combo) classTextList.get(i)).getText();
value = bean.lovMapping.get(value);
} else {
value = ((Text) classTextList.get(i)).getText();
}
icspro[i] = new ICSProperty(bean.propID, value);
if (bean.propID == -500292) {
if (value.replace(" ", "").equals("")) {
MessageBox.post("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>[" + bean.propDisName
+ "]Ϊ<><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԣ<EFBFBD><D4A3><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!", "<22><><EFBFBD><EFBFBD>", MessageBox.ERROR);
return true;
}
}
}
TCClassificationService classificationService = this.session
.getClassificationService();
ICSAdminClass c = classificationService.newICSAdminClass();
c.load(codeRemark);
// <20><>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
// <20><><EFBFBD><EFBFBD>1<EFBFBD><31><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ID
// <20><><EFBFBD><EFBFBD>2<EFBFBD><32><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Թ<EFBFBD><D4B9><EFBFBD>
// <20><><EFBFBD><EFBFBD>3<EFBFBD><33>Ĭ<EFBFBD>ϣ<EFBFBD>FIND_VALUES_UNIT_SYSTEM_NONE<4E><45>
ICSSearchResult[] results = classificationService.searchICOs(
codeRemark, icspro, 0);
if (results == null || results.length == 0) {
System.out.println(" <20><><EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD><C3B5>Ľ<EFBFBD><C4BD><EFBFBD>Ϊ0");
isContent = false;
} else {
System.out.println(" <20><><EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD><C3B5>Ľ<EFBFBD><C4BD><EFBFBD>Ϊ:" + results.length);
// StringBuffer sb = new StringBuffer();
// sb.append("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><C2B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬ<EFBFBD>ķ<EFBFBD><C4B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:\n");
List<String> valueList = new ArrayList<String>();
boolean isT = false;
for (int i = 0; i < results.length; i++) {
String icoUID = results[i].getIcoUid();
TCComponentICO ico = (TCComponentICO) session
.stringToComponent(icoUID);
ICSProperty[] icsProps = ico.getICSProperties(true);
HashMap<Integer, String> icsPropsMap = new HashMap<>();
for (int w = 0; w < icsProps.length; w++) {
icsPropsMap.put(icsProps[w].getId(),
icsProps[w].getValue());
}
boolean isAll = false;
for (int w = 0; w < icspro.length; w++) {
String value1 = icspro[w].getValue();
if (value1 == null) {
value1 = "";
}
String value = icsPropsMap.get(icspro[w].getId());
if (value == null) {
value = "";
}
if (classPropList.get(w).attrType == ICSFormat.REAL
|| classPropList.get(w).attrType == ICSFormat.INTEGER) {
float f1 = Float.parseFloat(value1 + "0");
float f = Float.parseFloat(value + "0");
if (f1 != f) {
isAll = true;
}
} else {
if (!value1.endsWith(value)) {
isAll = true;
} else {
if (icspro[w].getId() == -500292) {
MessageBox
.post("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>["
+ classPropList.get(w).propDisName
+ "]<5D>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD>ڣ<EFBFBD><DAA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!", "<22><><EFBFBD><EFBFBD>",
MessageBox.ERROR);
return true;
}
}
}
}
if (!isAll) {
isT = true;
String wsoString = "";
System.out.println("WSO_PUID="
+ results[i].getWsoUid());
if (session.stringToComponent(results[i]
.getWsoUid()) != null) {
wsoString = session.stringToComponent(
results[i].getWsoUid())
.getStringProperty("object_string");
} else {
setByPass(true);
if (session.stringToComponent(results[i]
.getWsoUid()) != null) {
wsoString = session.stringToComponent(
results[i].getWsoUid())
.getStringProperty("object_string");
}
setByPass(false);
}
// sb.append(wsoString).append("\n");
valueList.add(wsoString);
}
}
// sb.append("\n<>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>?\n");
if (isT) {
MyMessageBox box = new MyMessageBox(
PlatformHelper.getCurrentShell(),
SWT.DIALOG_TRIM | SWT.MAX | SWT.RESIZE, "<22><><EFBFBD><EFBFBD>",
valueList.toArray(new String[valueList.size()]));
//
// org.eclipse.swt.widgets.MessageBox box = new
// org.eclipse.swt.widgets.MessageBox(
// PlatformHelper.getCurrentShell(),
// SWT.ICON_WARNING | SWT.YES | SWT.NO);
// <20><><EFBFBD>öԻ<C3B6><D4BB><EFBFBD><EFBFBD>ı<EFBFBD><C4B1><EFBFBD>
// box.setText("<22><><EFBFBD><EFBFBD>");
// <20><><EFBFBD>öԻ<C3B6><D4BB><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>Ϣ
// box.setMessage(sb.toString());
// <20>򿪶Ի<F2BFAAB6><D4BB>򣬽<EFBFBD><F2A3ACBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD>choice
int choice = box.open();
// <20><>ӡ<EFBFBD><D3A1><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD>ֵ
if (choice == SWT.YES) {
System.out.print("Yes");
isContent = false;
} else if (choice == SWT.NO) {
System.out.print("No");
isContent = true;
}
}
}
// for(int i = 0;i<results.length;i++){
// //String icoID = results[i].getIcoId();
// String icoUid = results[i].getIcoUid();
// InterfaceAIFComponent comp2 =
// this.session.stringToComponent(icoUid);
// //<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
// ICSProperty[] icsProps =
// ((TCComponentICO)comp2).getICSProperties(true);
// for(int w = 0 ;w <icsProps.length;w++){
// //<2F><><EFBFBD><EFBFBD>ֵ
// icsProps[w].getValue();
// //<2F><><EFBFBD><EFBFBD>ID
// icsProps[w].getId();
// }
// }
}
} catch (TCException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
return isContent;
}
public TCUserService userservice;
public void setByPass(boolean val) throws TCException {
if (userservice == null) {
userservice = this.session.getUserService();
}
Object[] obj = new Object[1];
obj[0] = "origin";
if (val) {
userservice.call("ORIGIN_set_bypass", obj);
} else {
userservice.call("ORIGIN_close_bypass", obj);
}
}
public void sendObjToClassficationByWebService(TCComponentItem item) {
try {
if (!codeRemark.replace(" ", "").equals("") && item != null) {
TCComponentItemRevision rev = item.getLatestItemRevision();
List<ClassProperty> propList = new ArrayList<>();
for (int i = 0; i < classPropList.size(); i++) {
// System.out.println(" CLASS ID = " + integers[i] + " =" +
// vals[i]);
CNClassPropBean bean = classPropList.get(i);
String attrName = bean.propDisName;
String value = "";
if (bean.isLov) {
value = ((Combo) classTextList.get(i)).getText();
value = bean.lovMapping.get(value);
} else {
value = ((Text) classTextList.get(i)).getText();
if((PlmLocale.getString("RadialClearance")).equals(attrName)) {
System.out.println("attrName+++="+attrName);
if("".equals(value.trim())) {
Combo box = boxMap.get(attrName);
value = box.getText();
}
}else if((PlmLocale.getString("GreaseAmount")).equals(attrName)) {
System.out.println("attrName+++="+attrName);
if("".equals(value.trim())) {
Combo box = boxMap.get(attrName);
value = box.getText();
}
}else if((PlmLocale.getString("VibrationAcceleration")).equals(attrName)) {
System.out.println("attrName+++="+attrName);
if("".equals(value.trim())) {
Combo box = boxMap.get(attrName);
value = box.getText();
}
}else if((PlmLocale.getString("VibrationSpeed")).equals(attrName)) {
System.out.println("attrName+++="+attrName);
if("".equals(value.trim())) {
Combo box = boxMap.get(attrName);
value = box.getText();
}
}else if((PlmLocale.getString("C&UCode")).equals(attrName)) {
value = drawingNumber;
}
}
System.out.println("bean.propDisName="+bean.propDisName+"value="+value);
// icspro[i] = new ICSProperty(bean.propID, value);
ClassProperty prop = new ClassProperty(bean.propID, value);
propList.add(prop);
}
String json = SoaServerUtil.objectToJson(propList);
// SoaServerUtil.grantWritePrivilege(session, rev);
long time21 = System.nanoTime();
SoaServerUtil.sendToClass(rev.getUid(), codeRemark, json);
long time22 = System.nanoTime();
System.out.println("<22><><EFBFBD>ͷ<EFBFBD><CDB7><EFBFBD><EFBFBD><EFBFBD>ʱ(ms)<29><> " + (time22 - time21) / 1000000);
// SoaServerUtil.grantReadPrivilege(session, rev);
}
} catch (TCException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
/**
* <20><><EFBFBD>Ͷ<EFBFBD><CDB6>󵽷<EFBFBD><F3B5BDB7><EFBFBD>
*
* @return
*/
public void sendObjToClassfication(TCComponentItem item) {
try {
if (!codeRemark.replace(" ", "").equals("") && item != null) {
String partid = item.getStringProperty("item_id");
TCComponentItemRevision rev = item.getLatestItemRevision();
TCClassificationService myService = session
.getClassificationService();
ICSApplicationObject icsAppObj = myService
.newICSApplicationObject("ICM");
icsAppObj.create(partid, rev.getUid());
icsAppObj.setView(codeRemark);
ICSView icsview = icsAppObj.getView();
// ICSPropertyDescription icsproperty[] = icsview
// .getPropertyDescriptions();
ICSProperty icspro[] = new ICSProperty[classPropList.size()];
// <20><><EFBFBD>÷<EFBFBD><C3B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
for (int i = 0; i < icspro.length; i++) {
// System.out.println(" CLASS ID = " + integers[i] + " =" +
// vals[i]);
CNClassPropBean bean = classPropList.get(i);
String value = "";
if (bean.isLov) {
value = ((Combo) classTextList.get(i)).getText();
value = bean.lovMapping.get(value);
} else {
value = ((Text) classTextList.get(i)).getText();
}
icspro[i] = new ICSProperty(bean.propID, value);
}
icsAppObj.setProperties(icspro);
icsAppObj.save();
}
} catch (TCException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
/*
* <20><><EFBFBD><EFBFBD><EFBFBD>Ի<EFBFBD><D4BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*
* @see
* org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets
* .Composite)
*/
@Override
protected Control createDialogArea(Composite parent) {
// <20><>ȡ<EFBFBD><C8A1>ѡ<EFBFBD><D1A1><EFBFBD>е<EFBFBD><D0B5><EFBFBD><EFBFBD><EFBFBD>
this.connor_PatterValueList = new ArrayList<>();
this.connor_SequenceNameMapping = new HashMap<>();
String[] partterNames = JFomMethodUtil.getOptionValues(this.connor_InsertSequence, session);
try{
if(partterNames!=null){
for(String parrtterNameString : partterNames){
String[] patterNamesStrings = parrtterNameString.split("@");
if(patterNamesStrings==null || patterNamesStrings.length !=2){
continue;
}
Integer index = 1;
try {
index = Integer.parseInt(patterNamesStrings[1]);
this.connor_SequenceNameMapping.put(patterNamesStrings[0], index);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}catch(Exception ex){
ex.printStackTrace();
}
String puid = JFomMethodUtil.getOptionValue(JFomUtil.AUTOCODE_UID_REF,
session);
try {
TCComponent datasetcomp = session.stringToComponent(puid);
String filePath = JFomMethodUtil.downLoadFile(datasetcomp);
Object object = CNXmlUtil.xmlToBean(filePath, CNPartList.class);
CNPartList parts = (CNPartList) object;
this.cnPartList = parts;
List<CNPart> partList = parts.getPartList();
for (int i = 0; i < partList.size(); i++) {
System.out.println(partList.get(i).getType());
for (CNCompontent comp : partList.get(i).getCompontentList()) {
System.out.println(comp.getType());
System.out.println(comp.getCompententType());
for (CNProperty prop : comp.getPropertyList()) {
System.out.println(prop.getDisplayName());
}
}
}
System.out.println("-----------------------------");
} catch (TCException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (JAXBException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Composite container1 = (Composite) super.createDialogArea(parent);
// container1.
FillLayout fillLayout = new FillLayout(SWT.HORIZONTAL);
container1.setLayout(fillLayout);
Shell shell = container1.getShell();
shell.setFullScreen(true);
// TODO 2017.06.02
int x = shell.getSize().x;// + 200;
Dimension srcDim = Toolkit.getDefaultToolkit().getScreenSize();
shell.setSize(x, srcDim.height);
// shell.open();
container = new SashForm(container1, SWT.NONE);
sashFormClassfication = new SashForm(container, SWT.NONE);
// SashForm sashFormClassfication = new SashForm(container, SWT.BORDER |
// SWT.H_SCROLL);
// sashFormClassfication.setOrientation(SWT.HORIZONTAL);
classificationView = new NewItemClassificationView(
sashFormClassfication, PlmLocale.getString("CodingClassification"), showItemType, isTypeFilter);
if (isTypeFilter = true) {
showItemType = "";
}
classificationTreeViewer = classificationView.treeViewer;
addMouseAction();
sashFormCodeView = new SashForm(container, SWT.NONE);
GridData gridData1 = new GridData();
gridData1.heightHint = 70;
gridData1.horizontalAlignment = GridData.FILL;
gridData1.verticalAlignment = GridData.CENTER;
gridData1.grabExcessHorizontalSpace = true;
ctabFolder = new CTabFolder(sashFormCodeView, SWT.BORDER);
ctabFolder.setBorderVisible(true);
ctabFolder.setSimple(false);
ctabFolder.setLayoutData(gridData1);
codeTreeCTab = new CTabItem(ctabFolder, SWT.NONE);
codeTreeCTab.setText(PlmLocale.getString("CodingTree"));
compositCodeTree = new Composite(ctabFolder, SWT.NONE);
compositCodeTree.setLayout(new FillLayout());
codeTreeCTab.setControl(compositCodeTree);
treeView = new NewItemTreeCodeView(compositCodeTree, "root");
codeListCTab = new CTabItem(ctabFolder, SWT.NONE);
codeListCTab.setText(PlmLocale.getString("CodingList"));
ctabFolder.setSelection(0);
compositCodeList = new Composite(ctabFolder, SWT.NONE);
compositCodeList.setLayout(new FillLayout());
codeListCTab.setControl(compositCodeList);
listView = new NewItemListCodeView();
ctabFolder.setSelection(1);
itemInfoComposite = new SashForm(container, SWT.NONE);
createNewItemInfo(itemInfoComposite);
try {
classificationView
.createOrgAutoCodeNodeChildren(new AbstractTreeData[] { (AbstractTreeData) classificationView.treeViewer
.getTree().getTopItem().getData() });
} catch (Exception e) {
e.printStackTrace();
}
container.setWeights(new int[] { 3, 5, 6 });
// container.getShell().setFullScreen(true);
// Dimension srcDim = Toolkit.getDefaultToolkit().getScreenSize();
// container1.getShell().setSize(srcDim.width, srcDim.height);
// Point p =container1.getShell().getSize();
// System.out.println("");
// MessageBox.post(p.x+"|"+p.y,"P",1);
TCPreferenceService service = session.getPreferenceService();
String lovVal = service.getStringValue("RB3_lovVal_default");
String esLovVal = service.getStringValue("RB3_esLovVal_default");
if(lovVal.contains(";")) {
String[] vals = lovVal.split(";");
String[] esVals = esLovVal.split(";");
for (int i = 0; i < vals.length; i++) {
asList.add(vals[i]);
esList.add(esVals[i]);
}
}
ParseXMLUtil xml=new ParseXMLUtil();
File file=xml.getSXX("RB3_CPHPJFS", session);
attrMap =xml.parseXMLCode(file);
if(attrMap == null || attrMap.size() <= 0) {
MessageBox.post("<22><>ѡ<EFBFBD><D1A1>RB3_CPHPJFSδ<53><CEB4><EFBFBD>ã<EFBFBD><C3A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>飡", "WARNING",
MessageBox.WARNING);
return container;
}
File file2=xml.getSXX("RB3_THPJFS", session);
attrMap2 =xml.parseXMLCode(file2);
if(attrMap2 == null || attrMap2.size() <= 0) {
MessageBox.post("<22><>ѡ<EFBFBD><D1A1>RB3_THPJFSδ<53><CEB4><EFBFBD>ã<EFBFBD><C3A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>飡", "WARNING",
MessageBox.WARNING);
return container;
}
File file3=xml.getSXX("RB3_BSHPJFS", session);
attrMap3 =xml.parseXMLCode(file3);
if(attrMap3 == null || attrMap3.size() <= 0) {
MessageBox.post("<22><>ѡ<EFBFBD><D1A1>RB3_BSHPJFSδ<53><CEB4><EFBFBD>ã<EFBFBD><C3A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>飡", "WARNING",
MessageBox.WARNING);
return container;
}
File file4=xml.getSXX("RB3_SMPJFS", session);
attrMap4 =xml.parseXMLCode(file4);
if(attrMap4 == null || attrMap4.size() <= 0) {
MessageBox.post("<22><>ѡ<EFBFBD><D1A1>RB3_SMPJFSδ<53><CEB4><EFBFBD>ã<EFBFBD><C3A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>飡", "WARNING",
MessageBox.WARNING);
return container;
}
return container;
}
// <20>õ<EFBFBD><C3B5><EFBFBD><EFBFBD>Ͳ<EFBFBD><CDB2>Ľڵ<C4BD>
// public TreeItem getLastChild(TreeItem item){
// TreeItem childItem =item;
// if(item.getItemCount()>0){
// childItem= getLastChild(item.getItem(0));
// }
// System.out.println("i am in getLastChild "+childItem.getText());
// return childItem
// }
/*
* //<2F><><EFBFBD>ô򿪽<C3B4><F2BFAABD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>Ĭ<EFBFBD><C4AC>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD>սڵ<D5BD> public void initSelectedCodeTree() { try {
* classificationView.createOrgAutoCodeNodeChildren(new
* AbstractTreeData[]{(AbstractTreeData)
* classificationView.treeViewer.getTree().getTopItem().getData()} );
* ctabFolder.setSelection(0);
* if(classificationTreeViewer.getTree().getTopItem().getItemCount()>0){
* if(classificationTreeViewer.getTree().getTopItem().getItem(0).
* getItemCount()>0){
* classificationTreeViewer.getTree().setSelection(classificationTreeViewer.
* getTree().getTopItem().getItem(0).getItem(0));
* setTreeNodes(treeViewOperation.getSelectedTreeNode(classificationView.
* treeViewer)); ctabFolder.redraw(); // showRule(); addMouseAction()<29><><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD><D0B5><EFBFBD><EFBFBD>ݣ<EFBFBD>
* // ȥ<><C8A5> classificationTreeViewer.getTree().addSelectionListener(new
* SelectionAdapter() { // public void widgetSelected(SelectionEvent e) { }}
* } }
*
* } catch (Exception e) { e.printStackTrace(); } }
*/
/**
* <20><>ȡ<EFBFBD><C8A1>Ʒ<EFBFBD><C6B7>
*
* @return
*/
private String[] getAllCpx() {
String[] cpxS = null;
TCPreferenceService service = session.getPreferenceService();
jyCPXMap = new HashMap<>();
String[] value = service.getStringValues(JY_CPX_Option);
if (value != null) {
cpxS = new String[value.length];
for (int i = 0; i < value.length; i++) {
String cpx = value[i];
String[] valueS = cpx.split("=");
if (valueS != null && valueS.length == 2) {
cpxS[i] = valueS[0];
jyCPXMap.put(valueS[0], valueS[1]);
}
}
}
return cpxS;
}
private void getZCType(AbstractTreeData selectedData) {
// TODO Auto-generated method stub
AbstractTreeData parent = selectedData.getParentTreeData();
if (parent != null) {
parent = selectedData.getParentTreeData();
String type = parent.getPackCodeNodeInfo().getNode_name();
if((PlmLocale.getString("ProductCategory")).equals(type)) {
zcType = selectedData.getPackCodeNodeInfo().getNode_name();
}else {
getZCType(parent);
}
}
}
/**
* CPX::<3A><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD> NF::
*
*
*
*
* @param cpx
* @param nf
*/
private void setMidComposite() {
String text = "";
if (DescText != null) {
text = DescText.getText();
}
SimpleDateFormat sdf = new SimpleDateFormat("yyyy");
System.out.println("DESC ==>" + text);
if (text.contains(CPX2 + "::")) {
System.out.println("CPX2 ADD");
if (cpxLabel2 == null && cpxText2 == null) {
cpxLabel2 = CreateCompositeUtil.createNewLabel(cpxCompsite,
"<22><>Ʒ<EFBFBD><C6B7>");
cpxText2 = CreateCompositeUtil.createNotFillNewCombo(
cpxCompsite, getAllCpx());
;
// cpxText2.setEditable(true);
cpxLabel2.getParent().layout();
}
} else {
if (cpxLabel2 != null && cpxText2 != null) {
cpxLabel2.dispose();
cpxText2.dispose();
cpxLabel2 = null;
cpxText2 = null;
}
}
if (text.contains(CPX + "::")) {
System.out.println("CPX ADD");
if (cpxLabel == null && cpxText == null) {
cpxLabel = CreateCompositeUtil.createNewLabel(cpxCompsite,
"<22><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>");
cpxText = CreateCompositeUtil.createNewText(cpxCompsite, "");
cpxText.setEditable(true);
cpxLabel.getParent().layout();
}
} else {
if (cpxLabel != null && cpxText != null) {
cpxLabel.dispose();
cpxText.dispose();
cpxLabel = null;
cpxText = null;
}
}
if (text.contains(NF + "::")) {
System.out.println("NF ADD");
if (nfLabel == null && nfText == null) {
nfLabel = CreateCompositeUtil.createNewLabel(cpxCompsite, "<22><><EFBFBD><EFBFBD>");
nfText = CreateCompositeUtil.createNewText(cpxCompsite, "");
nfText.setEditable(true);
nfText.setText(sdf.format(new Date()));
nfLabel.getParent().layout();
}
} else {
if (nfLabel != null && nfText != null) {
nfLabel.dispose();
nfText.dispose();
nfLabel = null;
nfText = null;
}
}
cpxCompsite.update();
cpxCompsite.layout();
composite.update();
composite.layout();
}
private Composite composite;
private void createNewItemInfo(Composite parent) {
composite = new Composite(parent, SWT.BORDER);
GridLayout gridLayout = new GridLayout();
gridLayout.numColumns = 1;
composite.setLayout(gridLayout);
CreateCompositeUtil.createNewLabel(composite, PlmLocale.getString("SignatureCode"));
idText = CreateCompositeUtil.createNewText(composite, "");
CreateCompositeUtil.createNewLabel(composite, PlmLocale.getString("SignatureLength"));
idLengthText = CreateCompositeUtil.createNewText(composite, "");
// ===JY 2017.01.09====
GridLayout gridLayout2 = new GridLayout();
gridLayout2.numColumns = 4;
cpxCompsite = new Composite(composite, SWT.BORDER);
cpxCompsite.setLayout(gridLayout2);
setMidComposite();
// cpxLabel.dispose();//setVisible(false);
// cpxText.dispose();//setVisible(false);
CreateCompositeUtil.createNewLabel(composite, PlmLocale.getString("Version"));
revCombo = CreateCompositeUtil.createNewCombo(composite, new String[] {""});
CreateCompositeUtil.createNewLabel(composite, PlmLocale.getString("Name"));
nameText = CreateCompositeUtil.createNewText(composite, "");
// picCheckbox = CreateCompositeUtil.createNewCheckBox(composite, "ͼֽͬ<D6BD><CDAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
// picCheckbox.addSelectionListener(new SelectionListener() {
//
// @Override
// public void widgetSelected(SelectionEvent arg0) {
// // TODO Auto-generated method stub
//
// }
//
// @Override
// public void widgetDefaultSelected(SelectionEvent arg0) {
// // TODO Auto-generated method stub
//
// }
// });
// picButton = CreateCompositeUtil.createNewButton(composite, "<22><><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC>");
//
if (TCPreferenceUitl.isTrueTCPreferenceValue(session,
origin_newItem_isShowUnit)) {
try {
CreateCompositeUtil.createNewLabel(composite, "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ");
TCComponentListOfValues listOfValues = TCLOVUtil.findLOVByName(
session, unitLOVName);
ListOfValuesInfo listOfValuesInfo = listOfValues
.getListOfValues();
String[] values = listOfValuesInfo.getLOVDisplayValues();
units = listOfValuesInfo.getTagListOfValues();
if (values != null) {
String[] unitvalues = new String[values.length + 1];
if (TCPreferenceUitl.isTrueTCPreferenceValue(session,
origin_isShowPCUnitLast)) {
for (int i = 0; i < values.length; i++) {
unitvalues[i] = values[i];
}
unitvalues[values.length] = "";// ÿ<><C3BF>
} else {
unitvalues[0] = "";// ÿ<><C3BF>
for (int i = 0; i < values.length; i++) {
unitvalues[i + 1] = values[i];
}
}
unitCombo = CreateCompositeUtil.createNotFillNewCombo(
composite, unitvalues);
}
} catch (TCException e) {
e.printStackTrace();
}
}
createClassTablePannel(composite);
// CreateCompositeUtil.createNewLabel(composite, "<22><><EFBFBD><EFBFBD>");
DescText = CreateCompositeUtil.createTextArea(composite, "", 1, 300);
DescText.setVisible(false);
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>չ
// CreateCompositeUtil.createNewLabel(objPropComposite, "<22><><EFBFBD><EFBFBD>");
// <20>޸<EFBFBD> 20170626
// propTable = CreateCompositeUtil.createNewTable(objPropComposite, "",
// 170, 230);
// idText.setEnabled(false);
idLengthText.setEnabled(false);
//revCombo.setEnabled(false);
DescText.setEnabled(false);
}
private class NameValue {
private String name = "";
private String value = "";
public NameValue(String name, String value) {
this.name = name;
this.value = value;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
}
private TCComponent[] getParentGroupNode(AbstractTreeData segmentNode) {
TCComponent[] tccomponents = null;
classificationTreeViewer.refresh();
if (segmentNode == null) {
return null;
}
if ((segmentNode.getPackCodeNodeInfo().getNodeComponent() != null)
&& (segmentNode.getPackCodeNodeInfo().is_root)) {
} else {
return null;
}
getRealItemType(segmentNode, segmentNode.getParentTreeData());
return tccomponents;
}
private void getRealItemType(AbstractTreeData segmentNode,
AbstractTreeData parentNode) {
if ((parentNode != null)
&& (parentNode.getPackCodeNodeInfo().getNode_type()
.equals(AutoCodeManagerPropertyName.ItemName))) {
String realItemType = parentNode.getPackCodeNodeInfo()
.getRealTypeName().trim();
if (!segmentItemType.containsKey(segmentNode)) {
segmentItemType.put(segmentNode, realItemType);
}
} else {
if (parentNode != null) {
parentNode = parentNode.getParentTreeData();
getRealItemType(segmentNode, parentNode);
}
}
}
public void setTreeNodes(AbstractTreeData segmentNode) {
try {
classificationTreeViewer.refresh();
if (segmentNode == null) {
return;
}
getRealItemType(segmentNode, segmentNode.getParentTreeData());
TCComponent autoCodeDataComponent = segmentNode
.getPackCodeNodeInfo().getNodeComponent();
TreeAndListCodeOperation treeAndListCodeOperation = new TreeAndListCodeOperation();
HashMap<Object, Object> hashMap = new HashMap<Object, Object>();
String parentStr = "";
parentStr = treeAndListCodeOperation.getParentStr(segmentNode,
parentStr);
if (autoCodeDataComponent != null) {
hashMap.put(
AutoCodeManagerPropertyName.CodeRelation_current_node,
autoCodeDataComponent.getUid());
hashMap.put(
AutoCodeManagerPropertyName.CodeRelation_parent_node,
parentStr);
} else {
hashMap.put(
AutoCodeManagerPropertyName.CodeRelation_parent_node,
"");
hashMap.put(
AutoCodeManagerPropertyName.CodeRelation_current_node,
"");
}
String parentStr2 = "";
if (autoCodeDataComponent != null) {
if (parentStr.trim().length() == 0) {
parentStr2 = autoCodeDataComponent.getUid();
} else {
parentStr2 = parentStr + ","
+ autoCodeDataComponent.getUid();
}
} else {
parentStr2 = parentStr;
}
List<PackCodeNodeInfo> packCodeNodeInfos = treeAndListCodeOperation
.searchTreeORListNodeInfos(
hashMap,
parentStr2,
AutoCodeManagerPropertyName.searchTreeAndListCodeNodePropNames);
if (packCodeNodeInfos != null && packCodeNodeInfos.size() > 0) {
AbstractTreeData autoCodeDataTCComs[] = new AbstractTreeData[packCodeNodeInfos
.size()];
for (int k = 0; k < packCodeNodeInfos.size(); k++) {
if (packCodeNodeInfos.get(k).getNodeComponent() == null) {
continue;
}
PackCodeNodeInfo packCodeNodeInfo = packCodeNodeInfos
.get(k);
autoCodeDataTCComs[k] = new AbstractTreeData(segmentNode,
packCodeNodeInfo);
if (packCodeNodeInfo.isContainsChildren()) {
autoCodeDataTCComs[k]
.setTreeAutoCodeNodeChildren(new AbstractTreeData[] { new AbstractTreeData() });
}
}
treeView.treeViewer.setInput(autoCodeDataTCComs);
treeView.treeViewer.refresh();
}
} catch (ServiceException e) {
e.printStackTrace();
} catch (TCException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
}
public void addMouseAction() {
classificationTreeViewer.getTree().addSelectionListener(
new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
// MessageBox.post("prop","xxx",MessageBox.ERROR);
try {
initClassificationMouseClick();
selectedSegmentNode = treeViewOperation
.getSelectedTreeNode(classificationTreeViewer);
if (selectedSegmentNode == null) {
return;
}
// System.out.println("---->>>>>>> selectedSegmentNode =111>"+selectedSegmentNode.getParentTreeData().getPackCodeNodeInfo());
getParentGroupNode(selectedSegmentNode);
selectedSegmentTCComponent = selectedSegmentNode
.getPackCodeNodeInfo().getNodeComponent();
if (selectedSegmentTCComponent == null) {
return;
}
if (selectedSegmentNode.getParentTreeData() != null) {
System.out.println("LP RuleName>>>"+selectedSegmentNode
.getPackCodeNodeInfo().rule_node);
connor_CurrentTypeNameString = selectedSegmentNode
.getPackCodeNodeInfo().rule_node;
// System.out.println("---->>>>>>> selectedSegmentNode =222>"+selectedSegmentNode.getPackCodeNodeInfo().rule_node);
if ("<22><><EFBFBD>Ӽ<EFBFBD>".equals(selectedSegmentNode
.getPackCodeNodeInfo().rule_node)
&& (isCanTeam != null)
&& (isCanTeam.trim().length() > 0)
&& isCanTeam.toLowerCase().equals(
"true")) {
isCreateTempItemButton.setVisible(true);
} else {
isCreateTempItemButton.setVisible(false);
}
}
if (selectedSegmentTCComponent
.getLogicalProperty(AutoCodeManagerPropertyName.TreeAndListCodeNode_is_lock)) {
ScrolledComposite scrolledComposite = new ScrolledComposite(
ctabFolder, SWT.H_SCROLL | SWT.V_SCROLL);
codeListCTab.setControl(scrolledComposite);
treeView.treeViewer.setInput(null);
return;
}
if ((selectedSegmentNode.getPackCodeNodeInfo()
.getNode_type()
.equals(AutoCodeManagerPropertyName.TreeName))
|| (selectedSegmentNode
.getPackCodeNodeInfo()
.getNode_type()
.equals(AutoCodeManagerPropertyName.ListName))) {
// String realType =
// selectedSegmentNode.getPackCodeNodeInfo().getRealTypeName();
String realType = "";
if (segmentItemType != null) {
realType = (String) segmentItemType
.get(selectedSegmentNode);
}
if ((realType == null)
|| (realType.trim().length() == 0)) {
realType = showItemType;
}
if (TCPreferenceUitl
.isSelectExsitToTCPreferenceValues(
session,
origin_showUnit_excludeTypes,
realType)) {
if (unitCombo != null) {
unitCombo.setEnabled(false);
}
} else {
if (unitCombo != null) {
unitCombo.setEnabled(true);
}
}
if ((realType != null)
&& (realType.length() > 0)) {
tccomponentitemtype = (TCComponentItemType) (session
.getTypeComponent(realType));
}
TCPreferenceService service = session.getPreferenceService();
String[] revs = service.getStringValues("RB_Revision_id");
if(revs == null || revs.length <= 0) {
MessageBox.post("<22><>ѡ<EFBFBD><D1A1>RB_Revision_idδ<64><CEB4><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5><EFBFBD><EFBFBD>Ա!!",
"<22><><EFBFBD><EFBFBD>", MessageBox.ERROR);
return;
}
if("RB3_JSFXWTD".equals(realType)) {
revCombo.setItems(new String[] {"V0"});
revCombo.setText("V0");
}else {
revCombo.setItems(revs);
revCombo.setText("B1");
}
}
if (selectedSegmentNode
.getPackCodeNodeInfo()
.getNode_type()
.equals(AutoCodeManagerPropertyName.TreeName)) {
classificationView.treeViewer.refresh();
listView.setPropertyComb(null);
treeView.treeViewer.setInput(null);
Composite compositTemp = new Composite(
ctabFolder, SWT.NONE);
codeListCTab.setControl(compositTemp);
setTreeNodes(treeViewOperation
.getSelectedTreeNode(classificationView.treeViewer));
ctabFolder.setSelection(0);
ctabFolder.redraw();
treeView.treeViewer.getTree()
.addSelectionListener(
new SelectionAdapter() {
public void widgetSelected(
SelectionEvent e) {
//MessageBox.post("yyyyyys","xxx",MessageBox.ERROR);
initTreeOrListMouseClick();
AbstractTreeData selectedData = treeViewOperation
.getSelectedTreeNode(treeView.treeViewer);
if (selectedData == null) {
return;
}
if (selectedData
.getPackCodeNodeInfo()
.getNodeComponent() == null) {
return;
}
if ((selectedData
.getPackCodeNodeInfo().is_lock)) {
return;
}
getZCType(selectedData);
System.out.println("zcType============"+zcType);
String currentNodeDesc = "";
String currentNodeValue = "";
String name = "";
// <20>õ<EFBFBD><C3B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
getCodeInfo(selectedData);
System.out
.println(">>>>>>>><<<<<<<");
getClassANDPropertyInfo(selectedData);
System.out.println("codeRemark========="+codeRemark);
if(!("".equals(codeRemark.trim()))) {
// String classID = codeRemark.substring(0,6
// //codeRemark.length()-4
// );
String classID = codeRemark;
//classID = "ICM" + classID;
objMap.clear();
objMap2.clear();
objMap3.clear();
objMap4.clear();
lovMap.clear();
lovMap2.clear();
lovMap3.clear();
lovMap4.clear();
attrList.clear();
esAttrList.clear();
attrList2.clear();
esAttrList2.clear();
attrList3.clear();
esAttrList3.clear();
attrList4.clear();
esAttrList4.clear();
defaultValueList.clear();
markList.clear();
markList2.clear();
markList3.clear();
markList4.clear();
isNList.clear();
isNList2.clear();
isNList3.clear();
isNList4.clear();
String realItemType = (String) segmentItemType
.get(selectedSegmentNode);
// TCPreferenceService service = session.getPreferenceService();
// String[] revs = service.getStringValues("RB_Revision_id");
// if(revs == null || revs.length <= 0) {
// MessageBox.post("<22><>ѡ<EFBFBD><D1A1>RB_Revision_idδ<64><CEB4><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5><EFBFBD><EFBFBD>Ա!!",
// "<22><><EFBFBD><EFBFBD>", MessageBox.ERROR);
// return;
// }
// if("RB3_JSFXWTD".equals(realItemType)) {
// revCombo.setItems(new String[] {"V0"});
// revCombo.setText("V0");
// }else {
// revCombo.setItems(revs);
// revCombo.setText("B1");
// }
if(attrMap.containsKey(classID)) {
List<String> nameMarkList = attrMap.get(classID);
String attrNames = nameMarkList.get(0);
String marks = nameMarkList.get(1);
String values = nameMarkList.get(2);
String isN = nameMarkList.get(3);
if(attrNames.contains(";")) {
String[] attrs = attrNames.split(";");
String[] markss = marks.split(";");
String[] valuess = values.split(";");
String[] isNs = isN.split(";");
for (int i = 0; i < attrs.length; i++) {
if(attrs[i].contains("+")) {
String[] attrss = attrs[i].split("\\+");
attrList.add(attrss[0]);
esAttrList.add(attrss[1]);
markList.add(markss[i]);
defaultValueList.add(valuess[i]);
isNList.add(isNs[i]);
}
}
}
if("RB3_ZC".equals(realItemType)) {
saveCOM(classID,attrMap2,attrList2,esAttrList2,markList2,isNList2,
classPropList,objMap2,lovMap2,classTextList);
saveCOM(classID,attrMap3,attrList3,esAttrList3,markList3,isNList3,
classPropList,objMap3,lovMap3,classTextList);
saveCOM(classID,attrMap4,attrList4,esAttrList4,markList4,isNList4,
classPropList,objMap4,lovMap4,classTextList);
}else if("RB3_YZ".equals(realItemType)) {
saveCOM(classID,attrMap2,attrList2,esAttrList2,markList2,isNList2,
classPropList,objMap2,lovMap2,classTextList);
}
}
for (int i = 0; i < attrList.size(); i++) {
boolean objFalg = true;
String cnName = attrList.get(i);
String esName = esAttrList.get(i);
for (int j = 0; j < classPropList.size(); j++) {
CNClassPropBean bean = classPropList.get(j);
String attrName = "";
if((bean.propDisName).contains("\\")) {
attrName = (bean.propDisName).split("\\\\")[0];
}else {
attrName = bean.propDisName;
}
if(cnName.equals(attrName) || esName.equals(attrName)) {
objMap.put(attrName, classTextList.get(j));
if(bean.isLov) {
lovMap.put(attrName, "yes");
}else {
lovMap.put(attrName, "no");
}
objFalg = false;
break;
}
}
if(objFalg) {
objMap.put(cnName, defaultValueList.get(i));
lovMap.put(cnName, "string");
objMap.put(esName, defaultValueList.get(i));
lovMap.put(esName, "string");
}
}
}
name = selectedData
.getPackCodeNodeInfo()
.getNode_name();
icoTreeData = selectedData;
if (selectedData
.getParentTreeData() != null) {
LPBIGString = selectedData
.getParentTreeData()
.getPackCodeNodeInfo()
.getNode_name();
} else {
LPBIGString = "";
}
LPSString = selectedData
.getPackCodeNodeInfo()
.getNode_name();
currentNodeValue = replaceSpecialValue(selectedData
.getPackCodeNodeInfo().node_value);
if (currentNodeValue
.length() > 0) {
currentNodeDesc = currentNodeValue
+ "::"
+ selectedData
.getPackCodeNodeInfo()
.getNode_name();
}
if (currentNodeValue
.trim()
.length() > 0) {
pattern = pattern
+ " "
+ currentNodeValue
+ " ";
}
if (currentNodeDesc
.trim()
.length() > 0) {
codeDesc = codeDesc
+ currentNodeDesc;
}
if (!TCPreferenceUitl
.isTrueTCPreferenceValue(
session,
origin_isItemNameTextDefaultNull)) {
nameText.setText(name);
} else {
nameText.setText("");
}
getFinalPattern();
// idText.setText(pattern);
idText.setText(finalPattern);
setIDPatternTextIsCanEdit();
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);
}
});
} else if (selectedSegmentNode
.getPackCodeNodeInfo()
.getNode_type()
.equals(AutoCodeManagerPropertyName.ListName)) {
treeView.treeViewer.setInput(null);
ctabFolder.setLayout(new FillLayout());
ScrolledComposite scrolledComposite = new ScrolledComposite(
ctabFolder, SWT.H_SCROLL | SWT.V_SCROLL);
Composite compositTemp = new Composite(
scrolledComposite, SWT.NONE);
compositTemp.setLayout(new FillLayout());
scrolledComposite.setContent(compositTemp);
getParentGroupNode(selectedSegmentNode);
listView.createCombox(compositTemp,
selectedSegmentNode);
codeListCTab.setControl(scrolledComposite);
scrolledComposite.setExpandHorizontal(true);
scrolledComposite.setExpandVertical(true);
scrolledComposite.setMinWidth(250);
scrolledComposite.setMinHeight(1000);
ctabFolder.setSelection(1);
ctabFolder.redraw();
Combo[] coms = listView.getPropertyComb();
if (coms == null) {
return;
}
for (int i = 0; i < coms.length; i++) {
if (coms[i] == null) {
continue;
}
int comboStyle = coms[i].getStyle();
if (comboStyle == 33554692) {
coms[i].addFocusListener(new FocusListener() {
public void focusGained(
FocusEvent event) {
}
public void focusLost(
FocusEvent event) {
initTreeOrListMouseClick();
try {
firstListICOName = listView
.getFirstComboName();
listView.getListPropertyValue(selectedSegmentNode);
codeDesc = listView
.getCodeDesc()
.toString();
pattern = listView
.getPattern()
.toString();
icoPropertyMap = listView
.getIcoPropertyMap();
// revCombo.setText(tccomponentitemtype
// .getNewRev(null));
//revCombo.setText("B1");
if (!TCPreferenceUitl
.isTrueTCPreferenceValue(
session,
origin_isItemNameTextDefaultNull)) {
nameText.setText(firstListICOName);
} else {
nameText.setText("");
}
getFinalPattern();
// idText.setText(pattern);
idText.setText(finalPattern);
setIDPatternTextIsCanEdit();
idLengthText.setText(String
.valueOf(idText
.getText()
.replace(
" ",
"")
.trim()
.length()));
DescText.setText(codeDesc);
setMidComposite();
} catch (Exception e1) {
e1.printStackTrace();
}
}
});
} else {
coms[i].addSelectionListener(new SelectionAdapter() {
public void widgetSelected(
SelectionEvent selectionevent) {
initTreeOrListMouseClick();
// MessageBox.post("jjjjjj","xxx",MessageBox.ERROR);
try {
firstListICOName = listView
.getFirstComboName();
listView.getListPropertyValue(selectedSegmentNode);
codeDesc = listView
.getCodeDesc()
.toString();
pattern = listView
.getPattern()
.toString();
icoPropertyMap = listView
.getIcoPropertyMap();
//revCombo.setText("B1");
// revCombo.setText(tccomponentitemtype
// .getNewRev(null));
if (!TCPreferenceUitl
.isTrueTCPreferenceValue(
session,
origin_isItemNameTextDefaultNull)) {
nameText.setText(firstListICOName);
} else {
nameText.setText("");
}
getFinalPattern();
idText.setText(finalPattern);
// idText.setText(pattern);
setIDPatternTextIsCanEdit();
idLengthText.setText(String
.valueOf(idText
.getText()
.replace(
" ",
"")
.trim()
.length()));
DescText.setText(codeDesc);
getClassANDPropertyInfo("");
setMidComposite();
} catch (Exception e1) {
e1.printStackTrace();
}
}
});
}
}
}
if (tccomponentitemtype != null) {
// TODO
String type = tccomponentitemtype.getType();
if (type.equals("JK8Material")) {// JK8LSMaterial
// TM2_powder
nameText.setEditable(true);
} else {
nameText.setEditable(true);
}
// MessageBox.post("TYPE =
// "+tccomponentitemtype.getType(),"Type",MessageBox.ERROR);
}
} catch (Exception e1) {
e1.printStackTrace();
}
}
});
}
private void setIDPatternTextIsCanEdit() {
String realItemType = "Item";
if (segmentItemType != null) {
realItemType = (String) segmentItemType.get(selectedSegmentNode);
}
// if (TCPreferenceUitl.isSelectExsitToTCPreferenceValues(session,
// origin_isCodePatternCanEditTypes, realItemType)) {
// idText.setEnabled(true);
// }
}
public String replaceSpecialValue(String value) {
Date date = new Date(System.currentTimeMillis());
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
String dateStr = formatter.format(date);
String temps[] = dateStr.split("-");
if (value.contains(AutoCodeManagerPropertyName.Code_year4)) {
value = value.replace(AutoCodeManagerPropertyName.Code_year4,
temps[0]);
value = value + " ";
}
if (value.contains(AutoCodeManagerPropertyName.Code_year2)) {
value = value.replace(AutoCodeManagerPropertyName.Code_year2,
temps[0].substring(2));
value = value + " ";
}
if (value.contains(AutoCodeManagerPropertyName.Code_mouth1)) {
value = value.replace(AutoCodeManagerPropertyName.Code_mouth1,
temps[1]);
value = value + " ";
}
if (value.contains(AutoCodeManagerPropertyName.Code_mouth2)) {
value = value.replace(AutoCodeManagerPropertyName.Code_mouth2,
temps[1]);
value = value + " ";
}
if (value.contains(AutoCodeManagerPropertyName.Code_date1)) {
value = value.replace(AutoCodeManagerPropertyName.Code_date1,
temps[2]);
value = value + " ";
}
if (value.contains(AutoCodeManagerPropertyName.Code_date2)) {
value = value.replace(AutoCodeManagerPropertyName.Code_date2,
temps[2]);
value = value + " ";
}
// if (value.contains(AutoCodeManagerPropertyName.Code_seq)) {
// value = value.replace(AutoCodeManagerPropertyName.Code_seq, newSeq);
// value = value + " ";
// }
if (value.contains(AutoCodeManagerPropertyName.Code_pattern)) {
value = value.replace(AutoCodeManagerPropertyName.Code_pattern,
pattern);
value = value + " ";
}
return value;
}
public void getCodeInfo(AbstractTreeData treeData) {
if (treeData != null) {
AbstractTreeData parentData = treeData.getParentTreeData();
if ((parentData != null)
&& (parentData.getPackCodeNodeInfo().getNodeComponent() != null)) {
getCodeInfo(parentData);
String nodeValue = "";
String nodeName = "";
if (!parentData.getPackCodeNodeInfo().getNode_type()
.equals(AutoCodeManagerPropertyName.ItemName)) {
nodeValue = replaceSpecialValue(parentData
.getPackCodeNodeInfo().getNode_value());
nodeName = parentData.getPackCodeNodeInfo().getNode_name();
}
if (nodeValue.trim().length() > 0) {
pattern = pattern + nodeValue;
pattern = pattern + " ";
codeDesc = codeDesc + nodeValue;
codeDesc = codeDesc + "::";
codeDesc = codeDesc + nodeName;
codeDesc = codeDesc + "\n";
}
System.out.println("node_desc ===>"
+ treeData.getPackCodeNodeInfo().getNode_desc());
}
}
}
private void initTreeOrListMouseClick() {
try {
AbstractTreeData select = treeViewOperation.getSelectedTreeNode(classificationTreeViewer);
if (select == null) {
return;
}
icoPropertyMap = new HashMap<String, String>();
pattern = "";
codeDesc = "";
newSeq = "";
DescText.setText("");
setMidComposite();
codeCounterName = "";
idText.setText("");
if (unitCombo != null) {
unitCombo.setText("");
}
// idText.setEnabled(false);
// revCombo.setText(tccomponentitemtype.getNewRev(null));
//revCombo.setText("B1");
idLengthText.setText("");
nameText.setText("");
} catch (Exception e) {
e.printStackTrace();
}
}
private void getClassANDPropertyInfo(String remark) {
this.codeRemark = remark;
String cnpartType = ""; // treeData.getPackCodeNodeInfo().getNode_type();
if (segmentItemType != null) {
cnpartType = (String) segmentItemType.get(selectedSegmentNode);
}
System.out.println("cnpartType >>>>=>" + cnpartType);
this.cnpropList = new ArrayList<>();
this.currentCNPart = null;
if (this.cnPartList != null && this.cnPartList.getPartList() != null) {
for (CNPart cnpart1 : this.cnPartList.getPartList()) {
if (cnpart1 != null && cnpart1.getType().endsWith(cnpartType)) {
this.currentCNPart = cnpart1;
if (cnpart1.getCompontentList() != null) {
for (CNCompontent cncomp : cnpart1.getCompontentList()) {
if (cncomp.getPropertyList() != null) {
for (CNProperty cnprop : cncomp
.getPropertyList()) {
if (cnprop != null) {
this.cnpropList.add(cnprop);
}
}
}
}
}
}
}
}
// TODO CLASS
if (!TCPreferenceUitl.isTrueTCPreferenceValue(session,
connor_isIdTextEnable)) {
addClassPropComosite(codeRemark);
} else {
if (codeRemark.toLowerCase().startsWith("true")) {
if (idText != null) {
idText.setEnabled(true);
}
if (codeRemark.length() > 4) {
addClassPropComosite(codeRemark.substring(5,
codeRemark.length()));
}
} else {
if (idText != null) {
idText.setEnabled(false);
}
addClassPropComosite(codeRemark);
}
}
if (this.cnpropList != null) {
for (CNProperty cnp : this.cnpropList) {
cnp.initProperty();
}
}
addGeneralPropComosite();
}
private void getClassANDPropertyInfo(AbstractTreeData treeData) {
this.codeRemark = treeData.getPackCodeNodeInfo().getNode_desc();
String cnpartType = ""; // treeData.getPackCodeNodeInfo().getNode_type();
if (segmentItemType != null) {
cnpartType = (String) segmentItemType.get(selectedSegmentNode);
}
System.out.println("cnpartType =>" + cnpartType);
this.cnpropList = new ArrayList<>();
this.currentCNPart = null;
if (this.cnPartList != null && this.cnPartList.getPartList() != null) {
for (CNPart cnpart1 : this.cnPartList.getPartList()) {
if (cnpart1 != null && cnpart1.getType().endsWith(cnpartType)) {
this.currentCNPart = cnpart1;
if (cnpart1.getCompontentList() != null) {
for (CNCompontent cncomp : cnpart1.getCompontentList()) {
if (cncomp.getPropertyList() != null) {
for (CNProperty cnprop : cncomp
.getPropertyList()) {
if (cnprop != null) {
this.cnpropList.add(cnprop);
}
}
}
}
}
}
}
}
// TODO CLASS
if (!TCPreferenceUitl.isTrueTCPreferenceValue(session,
connor_isIdTextEnable)) {
addClassPropComosite(codeRemark);
} else {
if (codeRemark.toLowerCase().startsWith("true")) {
if (idText != null) {
idText.setEnabled(true);
}
if (codeRemark.length() > 4) {
addClassPropComosite(codeRemark.substring(5,
codeRemark.length()));
}
} else {
if (idText != null) {
idText.setEnabled(false);
}
addClassPropComosite(codeRemark);
}
}
if (this.cnpropList != null) {
for (CNProperty cnp : this.cnpropList) {
cnp.initProperty();
}
}
addGeneralPropComosite();
}
private void initClassificationMouseClick() {
try {
if (treeViewOperation.getSelectedTreeNode(classificationTreeViewer) == null) {
return;
}
icoPropertyMap = new HashMap<String, String>();
pattern = "";
codeDesc = "";
pattern = "";
newSeq = "";
codeCounterName = "";
DescText.setText("");
setMidComposite();
idText.setText("");
if (unitCombo != null) {
unitCombo.setText("");
}
// idText.setEnabled(false);
idLengthText.setText("");
// revCombo.setText(tccomponentitemtype.getNewRev(null));
//revCombo.setText("B1");
nameText.setText("");
} catch (Exception e) {
e.printStackTrace();
}
}
public String getParentCodeData(AbstractTreeData treeData, String str) {
if (treeData != null) {
AbstractTreeData parentData = treeData.getParentTreeData();
if ((parentData != null)
&& (parentData.getPackCodeNodeInfo().getNodeComponent() != null)) {
str = getParentCodeData(parentData, str);
String nodeValue = parentData.getPackCodeNodeInfo()
.getNode_value();
if (nodeValue.trim().length() > 0) {
str = str + nodeValue;
str = str + " ";
}
}
}
return str;
}
public String getParentDescData(AbstractTreeData treeData, String str) {
if (treeData != null) {
AbstractTreeData parentData = treeData.getParentTreeData();
if ((parentData != null)
&& (parentData.getPackCodeNodeInfo().getNodeComponent() != null)) {
str = getParentDescData(parentData, str);
String nodeValue = parentData.getPackCodeNodeInfo()
.getNode_value();
String nodeDesc = parentData.getPackCodeNodeInfo()
.getNode_name();
if (nodeValue.trim().length() > 0) {
str = str + nodeValue;
str = str + "::";
str = str + nodeDesc;
str = str + "\n";
}
}
}
return str;
}
@Override
protected void buttonPressed(int buttonId) {
if (buttonId == IDialogConstants.YES_ID
|| buttonId == IDialogConstants.FINISH_ID) {
if (buttonId == IDialogConstants.FINISH_ID) {
isCreateTempItem = true;
} else {
isCreateTempItem = false;
}
if ((newItemDialog != null) || (orNewItemInfoPanel != null)
|| (packCodeDescInfos != null)) {
long time1 = System.nanoTime();
transferInfoToDialog();
long time2 = System.nanoTime();
System.out.println("<22><>Ո<EFBFBD><D588>ˮ<EFBFBD><CBAE><EFBFBD><EFBFBD>ʱ(ms)<29><> " + (time2 - time1) / 1000000);
} else {
long time1 = System.nanoTime();
createPressed();
long time2 = System.nanoTime();
System.out.println("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ(ms)<29><> " + (time2 - time1) / 1000000);
}
}
if (buttonId == IDialogConstants.CANCEL_ID) {
cancelPressed();
}
if(buttonId == IDialogConstants.OPEN_ID) {
System.out.println("׼<><D7BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
G4MDialog classDialog = new G4MDialog("<22>˱<EFBFBD><CBB1><EFBFBD><EFBFBD><EFBFBD>", null,revList, session);
new Thread(classDialog).start();
}
}
/**
* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*/
public void transferInfoToDialog() {
try {
if (!beforeGetNewSequenceNo()) {
return;
}
String tezh = idText.getText();
pattern = tezh.replaceAll(" ", "");
String realItemType = "Item";
if (segmentItemType != null) {
realItemType = (String) segmentItemType
.get(selectedSegmentNode);
}
getSequenceNo(realItemType);
while (newID == null || tccomponentitemtype.find(newID) != null)
{
System.out.println("<22><><EFBFBD><EFBFBD>id<69><64><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>»<EFBFBD>ȡid");
getSequenceNo(realItemType);
}
if ((newID == null) || (newID.trim().length() == 0)) {
MessageBox.post("ID<49><44><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!", "INFO", MessageBox.WARNING);
return;
}
// while (tccomponentitemtype.find(newID) != null) {
// getSequenceNo(realItemType);
// }
tccomponentitemtype = (TCComponentItemType) (session
.getTypeComponent(realItemType));
TCComponentItem oldItem = tccomponentitemtype.find(newID);
if (oldItem != null) {
new GetCodeNumber().delete_recycleID(counterID);
MessageBox.post("IDΪ<44><CEAA>" + newID + "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD><EFBFBD>!", "INFO",
MessageBox.WARNING);
return;
} else {
String[] keys = { AutoCodeManagerPropertyName.Item_generateID };
String[] values = { newID };
InterfaceAIFComponent[] components = TCQueryUtil
.searchComponentsCollection(session,
origin_searchGenerateID, keys, values);
if (components != null) {
if (components.length > 0) {
new GetCodeNumber().delete_recycleID(counterID);
MessageBox.post("IDΪ<44><CEAA>" + newID + "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD><EFBFBD>!", "INFO",
MessageBox.WARNING);
return;
}
}
}
if ((newItemDialog != null)
&& (newItemDialog instanceof ORSaveItemAsDialog)) {
ORSaveItemAsDialog orSaveItemAsDialog = (ORSaveItemAsDialog) newItemDialog;
if ((newID.length() > 0) && (revCombo.getText().length() > 0)) {
PackCodeDescInfos packCodeDescInfos = new PackCodeDescInfos();
// packCodeDescInfos.setCodeStyle(codeStyle);
packCodeDescInfos.setCodeStyle(finalPattern);
packCodeDescInfos.setCodetz(codeCounterName
.replace(" ", "").trim());
packCodeDescInfos.setGenerateID(newID);
packCodeDescInfos.setIdDesc(DescText.getText());
packCodeDescInfos.setIdjl(counterID);
packCodeDescInfos
.setSelectedSegmentNode(selectedSegmentNode);
orSaveItemAsDialog.setPackCodeDescInfos(packCodeDescInfos);
if (!TCPreferenceUitl.isSelectExsitToTCPreferenceValues(
session, origin_idNeddExamineAndApproveTypes,
realItemType)) {
orSaveItemAsDialog.setItemID(newID);
} else {
orSaveItemAsDialog.setItemID(tccomponentitemtype
.getNewID());
}
orSaveItemAsDialog.setItemName(nameText.getText());
orSaveItemAsDialog.setItemRev(revCombo.getText());
}
} else if ((orNewItemInfoPanel != null)
&& (orNewItemInfoPanel instanceof ORItemInfoPanel)) {
if (newID.length() > 0) {
ORNewItemDialog newItemDialog = (ORNewItemDialog) orNewItemInfoPanel.itemPanel.dialog;
PackCodeDescInfos packCodeDescInfos = new PackCodeDescInfos();
// packCodeDescInfos.setCodeStyle(codeStyle);
packCodeDescInfos.setCodeStyle(finalPattern);
packCodeDescInfos.setCodetz(codeCounterName
.replace(" ", "").trim());
packCodeDescInfos.setGenerateID(newID);
packCodeDescInfos.setIdDesc(DescText.getText());
packCodeDescInfos.setIdjl(counterID);
packCodeDescInfos
.setSelectedSegmentNode(selectedSegmentNode);
newItemDialog.setCodeDescInfos(packCodeDescInfos);
if (!TCPreferenceUitl.isSelectExsitToTCPreferenceValues(
session, origin_idNeddExamineAndApproveTypes,
realItemType)) {
orNewItemInfoPanel.setNewItemID(newID);
} else {
orNewItemInfoPanel.setNewItemID(tccomponentitemtype
.getNewID());
}
orNewItemInfoPanel.setNewItemRev(revCombo.getText());
orNewItemInfoPanel.setNewItemName(nameText.getText());
}
} else if (packCodeDescInfos != null) {
if (newID.length() > 0) {
// packCodeDescInfos.setCodeStyle(codeStyle);
packCodeDescInfos.setCodeStyle(finalPattern);
packCodeDescInfos.setCodetz(codeCounterName
.replace(" ", "").trim());
packCodeDescInfos.setGenerateID(newID);
packCodeDescInfos.setIdDesc(DescText.getText());
packCodeDescInfos.setIdjl(counterID);
packCodeDescInfos
.setSelectedSegmentNode(selectedSegmentNode);
if (!TCPreferenceUitl.isSelectExsitToTCPreferenceValues(
session, origin_idNeddExamineAndApproveTypes,
realItemType)) {
if (packCodeDescInfos.getIdValueIText() != null) {
packCodeDescInfos.getIdValueIText().setText(newID);
} else if (packCodeDescInfos.getIdValueJText() != null) {
packCodeDescInfos.getIdValueJText().setText(newID);
}
} else {
if (packCodeDescInfos.getIdValueIText() != null) {
packCodeDescInfos.getIdValueIText().setText(
tccomponentitemtype.getNewID());
} else if (packCodeDescInfos.getIdValueJText() != null) {
packCodeDescInfos.getIdValueJText().setText(
tccomponentitemtype.getNewID());
}
}
if (packCodeDescInfos.getRevValueIText() != null) {
packCodeDescInfos.getRevValueIText().setText(
this.revCombo.getText());
} else if (packCodeDescInfos.getRevValueJText() != null) {
packCodeDescInfos.getRevValueJText().setText(
this.revCombo.getText());
}
if (packCodeDescInfos.getNameValueIText() != null) {
packCodeDescInfos.getNameValueIText().setText(
this.nameText.getText());
} else if (packCodeDescInfos.getNameValueJText() != null) {
packCodeDescInfos.getNameValueJText().setText(
this.nameText.getText());
}
}
}
} catch (TCException e) {
e.printStackTrace();
}
super.okPressed();
}
@Override
protected void cancelPressed() {
try {
if ((orNewItemInfoPanel != null)
&& (orNewItemInfoPanel instanceof ORItemInfoPanel)) {
orNewItemInfoPanel.setNewItemID("");
orNewItemInfoPanel.setNewItemRev("");
orNewItemInfoPanel.setNewItemName("");
} else if ((newItemDialog != null)
&& (newItemDialog instanceof ORSaveItemAsDialog)) {
ORSaveItemAsDialog orSaveItemAsDialog = (ORSaveItemAsDialog) newItemDialog;
orSaveItemAsDialog.setItemID("");
orSaveItemAsDialog.setItemName("");
orSaveItemAsDialog.setItemRev("");
}
if (packCodeDescInfos != null) {
if (packCodeDescInfos.getIdValueIText() != null) {
packCodeDescInfos.getIdValueIText().setText("");
} else if (packCodeDescInfos.getIdValueJText() != null) {
packCodeDescInfos.getIdValueJText().setText("");
}
if (packCodeDescInfos.getRevValueIText() != null) {
packCodeDescInfos.getRevValueIText().setText("");
} else if (packCodeDescInfos.getRevValueJText() != null) {
packCodeDescInfos.getRevValueJText().setText("");
}
if (packCodeDescInfos.getNameValueIText() != null) {
packCodeDescInfos.getNameValueIText().setText("");
} else if (packCodeDescInfos.getNameValueJText() != null) {
packCodeDescInfos.getNameValueJText().setText("");
}
}
} catch (Exception e) {
e.printStackTrace();
}
super.okPressed();
}
public String getID(String value) {
String id = replaceSpecialValue(value);
return id.replace(" ", "").trim();
}
private void getFinalPattern() {
this.connor_PatterValueList.clear();
int codeSeqLength = 0;
try {
if (selectedSegmentTCComponent != null) {
String[] propNames = {
AutoCodeManagerPropertyName.TreeAndListCodeNode_code_style,
AutoCodeManagerPropertyName.TreeAndListCodeNode_code_length,
AutoCodeManagerPropertyName.TreeAndListCodeNode_seq_length };
String[] propValues = selectedSegmentTCComponent
.getProperties(propNames);
codeStyle = propValues[0];
codeLength = Integer.valueOf(propValues[1]);
codeSeqLength = Integer.valueOf(propValues[2]);
}
} catch (TCException e) {
e.printStackTrace();
}
String realItemType = "";
if (segmentItemType != null) {
realItemType = (String) segmentItemType.get(selectedSegmentNode);
}
String patternStyle = codeStyle;
HashMap<String, String> sequenceMap = TCPreferenceUitl
.getPreferenceHashMap(session, 4, origin_newCodeSequenceNumber);
if ((sequenceMap != null) && (sequenceMap.size() > 0)) {
String sequences = sequenceMap.get(realItemType
+ "&&"
+ selectedSegmentNode.getPackCodeNodeInfo().getNode_name()
.trim());
if (sequences != null) {
String[] nums = sequences.split(";");
if ((nums != null) && (nums.length > 0)) {
String[] codeDesc1 = codeDesc.split("\n");
if ((codeDesc1 != null)) {
int descLength = codeDesc1.length;
String newPattern = "";
for (int n = 0; n < nums.length; n++) {
String num = nums[n];
int index = Integer.valueOf(num);
if ((descLength >= index) && (index - 1 >= 0)) {
String desc = codeDesc1[index - 1];
String[] codeDesc2 = desc.split("::");
if (codeDesc2.length == 2) {
this.connor_PatterValueList.add(codeDesc2[0]);
newPattern = newPattern + codeDesc2[0];
newPattern = newPattern + " ";
}
}
}
pattern = newPattern;
}
}
}
}
pattern = replaceSpecialValue(patternStyle);
int coverNum = codeLength - pattern.replace(" ", "").trim().length()
- codeSeqLength;
String coverStr = "";
if (coverNum > 0) {
for (int i = 0; i < coverNum; i++) {
coverStr = coverStr + "0";
}
if (coverStr.trim().length() > 0) {
pattern = pattern + coverStr + " ";
}
}
finalPattern = pattern;
pattern = pattern.replace(" ", "");
}
public void getSequenceNo(String realItemType) {
this.connor_PatterValueList.clear();
String[] codeDesc1 = codeDesc.split("\n");
System.out.println("M DESC =>"+codeDesc+"|COUNT ="+codeDesc1.length);
if (codeDesc1 != null) {
for (int n = 0; n < codeDesc1.length; n++) {
String descString = codeDesc1[n];
String[] codeDesc2 = descString.split("::");
if (codeDesc2.length == 2) {
this.connor_PatterValueList.add(codeDesc2[0]);
}
}
}
long time1 = System.nanoTime();
try {
TCComponent seqComponent = selectedSegmentTCComponent
.getReferenceProperty(AutoCodeManagerPropertyName.TreeAndListCodeNode_rule_node);
if (seqComponent != null) {
String[] seqPropertys = {
AutoCodeManagerPropertyName.TreeAndListCodeNode_code_style,
AutoCodeManagerPropertyName.TreeAndListCodeNode_code_length,
AutoCodeManagerPropertyName.TreeAndListCodeNode_seq_begin_value,
AutoCodeManagerPropertyName.TreeAndListCodeNode_seq_length,
AutoCodeManagerPropertyName.TreeAndListCodeNode_seq_max_value };
String[] seqValues = seqComponent.getProperties(seqPropertys);
try {
codeStyle = seqValues[0];
codeLength = Integer.valueOf(seqValues[1]);
int startValue = Integer.valueOf(seqValues[2]);
int codeSeqLength = Integer.valueOf(seqValues[3]);
int endValue = Integer.valueOf(seqValues[4]);
int increaseStep = 1;
String excludeStr = "";
if (startValue < 1) {
startValue = 1;
}
finalPattern = this.idText.getText();
idPattern = finalPattern;
int seqIndex = idPattern
.indexOf(AutoCodeManagerPropertyName.Code_seq);
if (seqIndex > -1) {
idPattern = idPattern.substring(0, seqIndex);
}
String segmentPattern = selectedSegmentNode
.getPackCodeNodeInfo().getNode_value();
segmentPattern = replaceSpecialValue(segmentPattern)
.replace(" ", "");
String seqPattern = excludeFirstPattern(idPattern,
realItemType).replace(" ", "");
if ((seqIndex == -1)) {
codeCounterName = idPattern + "$" + codeSeqLength + "$"
+ startValue + "$" + endValue + "$"
+ increaseStep;
counterID = seqPattern.replace(" ", "");
newID = idPattern.replace(" ", "");
} else {
codeCounterName = seqPattern + "$" + codeSeqLength
+ "$" + startValue + "$" + endValue + "$"
+ increaseStep;
String newSeqPattern = seqPattern;
String newCodeNum ="";
boolean isSep = false;
if(newSeqPattern.startsWith("EC-")) {
String values[] = newSeqPattern.split("-");
if(values.length > 3) {
newSeqPattern = "EC-"+values[3]+"-";
newCodeNum= new GetCodeNumber().getCodeNumber(
newSeqPattern, codeSeqLength, startValue,
endValue, increaseStep, excludeStr);
newCodeNum = newCodeNum.replace(newSeqPattern, seqPattern);
isSep = true;
}
}
if(! isSep){
newCodeNum= new GetCodeNumber().getCodeNumber(
seqPattern, codeSeqLength, startValue,
endValue, increaseStep, excludeStr);
}
counterID = newCodeNum.replace(" ", "");
String newSeq = "";
newSeq = newCodeNum.substring(newCodeNum
.indexOf(seqPattern) + seqPattern.length());
String newCodeNum2 = "";
boolean hadNewID = false;
System.out.println("LP 1>"+this.connor_CurrentTypeNameString);
if(this.connor_CurrentTypeNameString !=null){
System.out.println("LP 2>" + this.connor_SequenceNameMapping.size());
System.out.println("LP 3>" + this.connor_PatterValueList.size());
if(this.connor_SequenceNameMapping.containsKey(this.connor_CurrentTypeNameString)){
int myIndex = this.connor_SequenceNameMapping.get(this.connor_CurrentTypeNameString)-1;
System.out.println("LP 4>" + myIndex);
if(myIndex >=0 && myIndex < this.connor_PatterValueList.size()){
//String partterNameString = this.connor_PatterValueList.get(myIndex);
for(int ii = 0;ii<this.connor_PatterValueList.size();ii++){
if(ii == myIndex){
newCodeNum2 = newCodeNum2 + this.connor_PatterValueList.get(ii) + newSeq;
}else{
newCodeNum2 = newCodeNum2 + this.connor_PatterValueList.get(ii);
}
//newCodeNum2
}
hadNewID = true;
}
}
}
if(!hadNewID){
newCodeNum2 = finalPattern.replace(
AutoCodeManagerPropertyName.Code_seq, newSeq);
}
newID = newCodeNum2.replace(" ", "");
}
} catch (ServiceException e) {
e.printStackTrace();
}
}
} catch (Exception e) {
e.printStackTrace();
}
long time2 = System.nanoTime();
System.out.println("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE>ʱ(ms)<29><> " + (time2 - time1) / 1000000);
return;
}
private String excludeFirstPattern(String seqPattern, String realItemType) {
if (TCPreferenceUitl.isSelectExsitToTCPreferenceValues(session,
origin_sequenceExcludeFirstPatternTypes, realItemType)) {
String segmentPattern = selectedSegmentNode.getPackCodeNodeInfo()
.getNode_value();
int segmentPatternLength = segmentPattern.length();
if (segmentPatternLength > 0) {
segmentPattern = replaceSpecialValue(segmentPattern).replace(
" ", "");
segmentPatternLength = segmentPattern.length();
seqPattern = seqPattern.substring(segmentPatternLength);
}
}
return seqPattern;
}
public void orCustomizationAction() {
new ORAfterNewItemCustomization(this, newComp);
}
private boolean isHaveWritePrivilige(TCComponent component) {
boolean privilige = true;
try {
TCComponentUser user = session.getUser();
TCComponentGroup group = session.getCurrentGroup();
TCComponentRole role = session.getCurrentRole();
TCComponent coms[] = { user, group, role };
TCAccessControlService service = session
.getTCAccessControlService();
boolean[] flags = service.checkAccessorsPrivileges(coms, component,
new String[] { "WRITE" });
for (boolean b : flags) {
if (!b) {
privilige = false;
break;
}
}
} catch (TCException e) {
e.printStackTrace();
}
return privilige;
}
public void setBigAndS(String compType,Map<String, String> stringMapping){
//String compType = createInput.boName;
System.out.println("<22><><EFBFBD>ô<EFBFBD>С<EFBFBD><D0A1> <20><>boName="+compType);
if (compType.equals("LP2_Elc_CompRevision")) {//<2F><><EFBFBD><EFBFBD>Ԫ<EFBFBD><D4AA><EFBFBD><EFBFBD>
stringMapping.put("lp2_Total_Parent", LPBIGString);
stringMapping.put("lp2_Elc_Part_Child", LPSString);
} else if (compType.equals("LP2_Elc_PartRevision")) {//<2F><EFBFBD><E1B9B9>
stringMapping.put("lp2_Total_Parent", LPBIGString);
stringMapping.put("lp2_Elc_Part_Child", LPSString);
} else if (compType.equals("LP2_Elc_PCBRevision")) {//ӡ<><D3A1><EFBFBD><EFBFBD>·<EFBFBD><C2B7>
stringMapping.put("lp2_Total_Parent", LPBIGString);
stringMapping.put("lp2_PCB26", LPSString);
} else if (compType.equals("LP2_elc_halfpartRevision")) {//<2F><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>Ʒ
stringMapping.put("lp2_Total_Parent", LPBIGString);
stringMapping.put("lp2_child", LPSString);
} else if (compType.equals("LP2_Elc_SoftwareRevision")) {//<2F><><EFBFBD><EFBFBD>
stringMapping.put("lp2_Total_Parent", LPBIGString);
stringMapping.put("lp2_software_child", LPSString);
}else if(compType.equals("LP2_mouldRevision")) {//ģ<><C4A3>
stringMapping.put("lp2_Total_Parent", LPBIGString);
stringMapping.put("lp2_child", LPSString);
}
}
/**
* <20><><EFBFBD>ö<EFBFBD><C3B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƥ<EFBFBD><C6A5>
*
* @param createInput
* @param cnProperties
*/
private void setPropMapping(CreateInput createInput,
List<CNProperty> cnProperties, Map<String, String> stringMappingOld) {
if (cnProperties == null) {
return;
}
Map<String, String> stringMapping = new HashMap<>();
if (stringMappingOld != null) {
for(Entry<String, String> entry : stringMappingOld.entrySet()){
stringMapping.put(entry.getKey(), (String)entry.getValue());
}
//= stringMappingOld;
}
Map<String, BigInteger> intMapping = new HashMap<>();
Map<String, Calendar> dateMapping = new HashMap<>();
Map<String, Boolean> booleanMapping = new HashMap<>();
Map<String, Double> doubleMapping = new HashMap<>();
Map<String, String[]> arrsMapping = new HashMap<>();
for (CNProperty prop : cnProperties) {
if (prop == null) {
continue;
}
// System.out.println(
// "PROP MAP >>>>"+prop.getRealName()+"<===>"+prop.value);
switch (prop.getPropertyType().toUpperCase()) {
case "STRING":
stringMapping.put(prop.getRealName(), (String) (prop.value == null ? ""
: prop.value));
break;
case "INTEGER":
intMapping.put(prop.getRealName(), (BigInteger) (prop.value == null ? ""
: prop.value));
break;
case "DATE":
try {
SimpleDateFormat sdf= new SimpleDateFormat("yyyy-MM-dd");
Date date = sdf.parse((String) prop.value);
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
dateMapping.put(prop.getRealName(), (Calendar) (prop.value == null ? ""
: calendar));
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
break;
case "BOOLEAN":
booleanMapping.put(prop.getRealName(), (Boolean) (prop.value == null ? ""
: prop.value));
break;
case "DOUBLE":
Double mydv = null;
if(prop.value == null) {
if(prop.value instanceof Integer) {
mydv = new Double(""+prop.value );
}else if(prop.value instanceof Double) {
mydv = (Double)prop.value;
}else {
mydv = new Double(0);
}
}else {
mydv = new Double(0);
}
doubleMapping.put(prop.getRealName(), mydv);
break;
case "ARRAYS":
String val = (String) prop.value;
String [] strs = null;
if(val == null) {
strs = new String[] {""};
}else {
if(!("".equals(val.trim()))) {
if(val.contains(";")) {
String[] vals = val.split(";");
strs = new String[vals.length];
for (int i = 0; i < vals.length; i++) {
strs[i] = vals[i];
}
}else {
strs = new String[] {val};
}
}
}
arrsMapping.put(prop.getRealName(), strs);
break;
default:
break;
}
}
setBigAndS(createInput.boName,stringMapping);
createInput.stringProps = stringMapping;
createInput.intProps = intMapping;
createInput.dateProps = dateMapping;
createInput.boolProps = booleanMapping;
createInput.doubleProps = doubleMapping;
createInput.stringArrayProps = arrsMapping;
}
public TCComponent[] queryTCComponent(TCSession session,String[] values,String[] keys,String value) throws TCException{
// String[] keys={"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ID","<22>汾"};
TCComponent[] component = null;
TCComponentQueryType queryType = (TCComponentQueryType) session.getTypeComponent("ImanQuery");
TCComponentQuery query = (TCComponentQuery) queryType.find(value);
if(query!=null){
component = query.execute(keys,values);
}else{
MessageBox.post("<22><>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>","<22><><EFBFBD><EFBFBD>",MessageBox.WARNING);
}
return component;
}
/**
* <20><><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ
* @param projectID
* @return
*/
public boolean checkIsProjectExits(String projectID){
if(projectID==null){
return false;
}
boolean isExits = false;
try {
String[] projectNames = session.getUser().getProjectNames();
if(projectNames == null || projectNames.length <1){
System.out.println("û<><C3BB><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD>Ŀ");
return false;
}
for(String projName : projectNames){
System.out.println("<22><>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD>=<3D><>"+projName);
TCComponent[] projects=(TCComponent[]) queryTCComponent(session, new String[]{projName.split("-")[0]}, new String[]{"<22><>Ŀ ID"}, "<22><>Ŀ...");
if(projects==null || projects.length < 1){
System.out.println("û<>в<EFBFBD>ѯ<EFBFBD><D1AF>["+projName+"]<5D><>Ŀ");
continue;
}
TCComponentProject project = (TCComponentProject) projects[0];
String id = project.getProjectID();
if(projectID.equals(id)){
isExits = true;
break;
}
}
} catch (TCException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return isExits;
}
/**
* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ
* @param projectId
* @param revision
*/
public void sendToProject(String projectId,TCComponentItemRevision revision){
if(projectId==null){
return;
}
try {
TCComponent[] projects=(TCComponent[]) queryTCComponent(session, new String[]{projectId}, new String[]{"<22><>Ŀ ID"}, "<22><>Ŀ...");
if(projects==null || projects.length < 1){
System.out.println("û<>в<EFBFBD>ѯ<EFBFBD><D1AF>["+projectId+"]<5D><>Ŀ");
return;
}
TCComponentProject project = (TCComponentProject) projects[0];
if(project!=null){
project.assignToProject(new TCComponent[]{revision});
}
} catch (TCException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
/**
* ͨ<><CDA8>SOA<4F><41><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*
* @param itemID
* @param itemRev
* @param itemType
* @param itemName
* @param itemDesc
* @param iComp
* @param imComp
* @param rComp
* @param rmComp
*/
private void createNewItemSoa2(String itemID, String itemRev,
String itemType, String itemName, String itemDesc,
CNCompontent iComp, CNCompontent imComp, CNCompontent rComp,
CNCompontent rmComp) {
try {
TCPreferenceService prefService = session.getPreferenceService();
String levPropName =null;
if(itemType.equals("LP2_Proj_Doc")){
itemName += LP_Name;
try{
levPropName = prefService.getStringValue("LP_proj_doc_lev_prop");
}catch(Exception ex3){
ex3.printStackTrace();
}
}
CreateInput itemInput = new CreateInput();
itemInput.boName = itemType;
System.out.println("Item Type =>>>>" + itemType);
Map<String, String> itemStringMap = new HashMap();
itemStringMap.put("object_name", itemName);
itemStringMap.put("item_id", itemID);
itemStringMap.put("object_desc", itemDesc);
if (iComp != null) {
setPropMapping(itemInput, iComp.getPropertyList(),
itemStringMap);
} else {
itemInput.stringProps = itemStringMap;
}
Map<String, CreateInput[]> compMap = new HashMap();
CreateInput[] compInputS = new CreateInput[1];
compInputS[0] = new CreateInput();
Map<String, String> compStringMap = new HashMap();
compStringMap.put("item_revision_id", itemRev);
if (rComp == null) {
compInputS[0].boName = itemType + "Revision";
setBigAndS(compInputS[0].boName,compStringMap);
compInputS[0].stringProps = compStringMap;
} else {
if (itemType.equals("JK8LSMaterial")) {
compInputS[0].boName = itemType + "Revision";
} else {
compInputS[0].boName = rComp.getCompententType();
}
setPropMapping( compInputS[0], rComp.getPropertyList(), compStringMap);
}
if(itemType.equals("LP2_Proj_Doc")&& levPropName!=null && levPropName.length()>0){
compInputS[0].stringProps.put(levPropName, LP_Remark);
}
Map<String, String> compStringMap2 = new HashMap();
CreateInput[] formCompInputS = new CreateInput[1];
formCompInputS[0] = new CreateInput();
if (rmComp == null) {
formCompInputS[0].boName = itemType + "RevisionMaster";
formCompInputS[0].stringProps = compStringMap2;
} else {
if (itemType.equals("JK8LSMaterial")) {
formCompInputS[0].boName = itemType + "RevisionMaster";
} else {
formCompInputS[0].boName = rmComp.getCompententType();
}
setPropMapping(formCompInputS[0], rmComp.getPropertyList(),
compStringMap2);
}
Map<String, CreateInput[]> formCompMap = new HashMap();
formCompMap.put("IMAN_master_form_rev", formCompInputS);
compInputS[0].compoundCreateInput = formCompMap;
compMap.put("revision", compInputS);
itemInput.compoundCreateInput = compMap;
DataManagementService datamanagementservice = DataManagementService
.getService(session);
CreateIn createin = new CreateIn();
createin.clientId = "Test";
createin.data = itemInput;
System.out.println("11111111111111");
CreateResponse createresponse = datamanagementservice
.createObjects(new CreateIn[] { createin });
SoaUtil.handlePartialErrors(createresponse.serviceData, null, null,
true);
CreateOut acreateout[] = createresponse.output;
if (acreateout != null && acreateout.length > 0) {
ArrayList arraylist = new ArrayList(0);
CreateOut acreateout1[];
int j = (acreateout1 = acreateout).length;
for (int i = 0; i < j; i++) {
CreateOut createout = acreateout1[i];
TCComponent atccomponent[] = createout.objects;
if (atccomponent != null && atccomponent.length > 0) {
arraylist.addAll(Arrays.asList(atccomponent));
newComp = atccomponent[0];
}
}
}
} catch (ServiceException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (TCExceptionPartial e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
/**
* <20><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ
*/
public boolean finitPropList() {
for (int i = 0; i < this.cnpropList.size(); i++) {
Widget wd = generalPropTextList.get(i);
Label label = generalPropLabelList.get(i);
System.out.println("label==========="+label.getText());
if (wd instanceof Text) {
if (cnpropList.get(i).getPropertyType().toUpperCase()
.endsWith("STRING")) {
String value = ((Text) wd).getText();
if((label.getText()).contains(PlmLocale.getString("dynamicLoadRatingCr"))
|| (label.getText()).contains(PlmLocale.getString("staticLoadRatingCor"))
|| (label.getText()).contains(PlmLocale.getString("OperatingRange"))
|| (label.getText()).contains(PlmLocale.getString("Resolution"))) {
Widget wd1 = fuheTextList.get(i);
String val = ((Combo)wd1).getText();
System.out.println("val=================="+val);
value = value + val;
}
cnpropList.get(i).value = value;
} else if (cnpropList.get(i).getPropertyType().toUpperCase()
.endsWith("INTEGER")) {
if (!((Text) wd).getText().replace(" ", "").endsWith("")) {
cnpropList.get(i).value = Integer.parseInt(((Text) wd)
.getText().replace(" ", ""));
} else {
cnpropList.get(i).value = 0;
}
} else if (cnpropList.get(i).getPropertyType().toUpperCase()
.endsWith("DOUBLE")) {//
if (!((Text) wd).getText().replace(" ", "").endsWith("")) {
cnpropList.get(i).value = Double
.parseDouble(((Text) wd).getText().replace(" ",
""));
} else {
cnpropList.get(i).value = 0;
}
}
} else if (wd instanceof Button) {
cnpropList.get(i).value = wd.getData();
System.out.println("V==>" + wd.getData());
} else if (wd instanceof DateTime) {
DateTime dt = (DateTime) wd;
int year = dt.getYear();
int month = dt.getMonth() + 1;
int day = dt.getDay();
String data = year + "-" + month + "-"+ day;
cnpropList.get(i).value = data;
} else if (wd instanceof Combo) {
if (cnpropList.get(i).getIsLov()) {
int index = ((Combo) wd).getSelectionIndex();
System.out.println("index============"+index);
if((label.getText()).contains(PlmLocale.getString("AssemblyTypes"))) {
for (int j = 0; j < cnpropList.get(i).lovDisplayValueList.size(); j++) {
if(zcType.equals(cnpropList.get(i).lovDisplayValueList.get(j))) {
index = j;
break;
}
}
}
if (index != -1) {
cnpropList.get(i).value = cnpropList.get(i).lovValueList
.get(index);
}
} else if (cnpropList.get(i).getPropertyType().toUpperCase()
.endsWith("BOOLEAN")) {
if (!((Combo) wd).getText().replace(" ", "").equals("")) {
cnpropList.get(i).value = Boolean
.parseBoolean(((Combo) wd).getText());
}
}
}
System.out.println(">>"
+ cnpropList.get(i).getPropertyType().toUpperCase()
+ "|cnpropList.get(i).value =>" + cnpropList.get(i).value);
if (cnpropList.get(i).getIsMust()) {
if (cnpropList.get(i).value == null) {
System.out.println("11111111111111");
return false;
} else {
if ((cnpropList.get(i).value.toString()).replace(" ", "")
.equals("")) {
System.out.println("222222222222");
return false;
}
}
}
}
return true;
}
private void createNewItem(String itemID, String itemRev, String itemType,
String itemName, String itemDesc) {
try {
TCComponent targetObject = (TCComponent) AIFUtility
.getCurrentApplication().getTargetComponent();
CNCompontent iCNComp = null;
CNCompontent imCNComp = null;
CNCompontent rCNComp = null;
CNCompontent rmCNComp = null;
if (this.currentCNPart != null) {
for (CNCompontent cnComp : this.currentCNPart
.getCompontentList()) {
switch (cnComp.getType()) {
case "I":
iCNComp = cnComp;
break;
case "IM":
imCNComp = cnComp;
break;
case "R":
rCNComp = cnComp;
break;
case "RM":
rmCNComp = cnComp;
break;
default:
break;
}
}
}
createNewItemSoa2(itemID, revCombo.getText(), itemType, itemName,
"", iCNComp, imCNComp, rCNComp, rmCNComp);
if (targetObject instanceof TCComponentFolder) {
if (newComp != null) {
TCComponentFolder folder = (TCComponentFolder) targetObject;
if (isHaveWritePrivilige(folder)) {
folder.add("contents", newComp);
folder.refresh();
} else {
session.getUser().getNewStuffFolder()
.add("contents", newComp);
session.getUser().getNewStuffFolder().refresh();
}
}
} else if (targetObject instanceof TCComponentPseudoFolder) {
if (newComp != null) {
if (TCPreferenceUitl.isTrueTCPreferenceValue(session,
origin_isNotSaveNewItemToPseudoFolder)) {
session.getUser().getNewStuffFolder()
.add("contents", newComp);
session.getUser().getNewStuffFolder().refresh();
} else {
TCComponentPseudoFolder folder = (TCComponentPseudoFolder) targetObject;
String propertyName = folder
.getProperty("property_name");
TCComponent ownerComponent = folder
.getOwningComponent();
if (ownerComponent != null) {
ownerComponent.add(propertyName, newComp);
ownerComponent.refresh();
}
}
}
} else {
if (newComp != null) {
session.getUser().getNewStuffFolder()
.add("contents", newComp);
session.getUser().getNewStuffFolder().refresh();
}
}
if (newComp != null) {
// TODO <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
// <20>
TCComponentItemRevision rev = ((TCComponentItem) newComp)
.getLatestItemRevision();
System.out.println("LP > <" + LPBIGString + "> <" + LPSString
+ ">");
System.out.println("2959>>xxxx");
sendToProject(this.LP_PROJECT_ID,rev);
/* TCProperty[] lpprops = null;
if (rev.getType().equals("LP2_Elc_CompRevision")) {
lpprops = rev.getTCProperties(new String[] {
"lp2_Elc_Comp_Parent", "lp2_Elc_Part_Child" });
} else if (rev.getType().equals("LP2_Elc_PartRevision")) {
lpprops = rev.getTCProperties(new String[] {
"lp2_Elc_Part_Parent", "lp2_Elc_Part_Child" });
} else if (rev.getType().equals("LP2_Elc_PCBRevision")) {//
lpprops = rev.getTCProperties(new String[] { "lp2_PCB25",
"lp2_PCB26" });
} else if (rev.getType().equals("LP2_elc_halfpartRevision")) {
lpprops = rev.getTCProperties(new String[] {
"lp2_Total_parents", "lp2_child" });
} else if (rev.getType().equals("LP2_Elc_SoftwareRevision")) {
lpprops = rev.getTCProperties(new String[] {
"lp2_software_parent", "lp2_software_child" });
}
if (lpprops != null && lpprops.length == 2) {
if (lpprops[0] != null) {
TCComponentListOfValues lov = lpprops[0].getLOV();
if (lov != null) {
ListOfValuesInfo lovinfo = lov.getListOfValues();
List<LovValue> lovValueList = lovinfo.getValues();
for (LovValue lv : lovValueList) {
if (lv.getDisplayValue().endsWith(LPBIGString)) {
lpprops[0].setStringValue((String) lv
.getValue());
}
}
} else {
lpprops[0].setStringValue(LPBIGString);
}
rev.lock();
rev.setTCProperty(lpprops[0]);
rev.save();
rev.unlock();
}
if (lpprops[1] != null) {
TCComponentListOfValues lov = lpprops[1].getLOV();
if (lov != null) {
ListOfValuesInfo lovinfo = lov.getListOfValues();
List<LovValue> lovValueList = lovinfo.getValues();
for (LovValue lv : lovValueList) {
if (lv.getDisplayValue().endsWith(LPSString)) {
lpprops[1].setStringValue((String) lv
.getValue());
}
}
} else {
lpprops[1].setStringValue(LPSString);
}
rev.lock();
rev.setTCProperty(lpprops[1]);
rev.save();
rev.unlock();
}
}*/
}
if (targetObject != null) {
targetObject.refresh();
}
} catch (Exception e) {
e.printStackTrace();
}
}
private String LP_Name;
private String LP_Remark;
private boolean beforeGetNewSequenceNo() {
if (selectedSegmentNode.getPackCodeNodeInfo().getNode_type()
.equals(AutoCodeManagerPropertyName.ListName)) {
if (listView != null) {
Combo[] propCombos = listView.getPropertyComb();
Label[] propLabels = listView.getPropertyLabel();
if ((propCombos != null) && (propCombos.length > 0)) {
for (int i = 0; i < propCombos.length; i++) {
if (propCombos[i].getSelectionIndex() == -1) {
if ((propCombos[i].getText() != null)
&& (propCombos[i].getText().length() == 0)) {
MessageBox.post("<22><>" + propLabels[i].getText()
+ "<22><><EFBFBD><EFBFBD><EFBFBD>", "INFO", MessageBox.WARNING);
return false;
}
}
}
}
}
}
if (selectedSegmentNode.getPackCodeNodeInfo().getNode_type()
.equals(AutoCodeManagerPropertyName.TreeName)) {
if (TCPreferenceUitl.isTrueTCPreferenceValue(session,
origin_isNewItemMustLastNode)) {
int childrenNum = icoTreeData.getChildrenDatas().length;
if (childrenNum > 0) {
MessageBox.post("<22><>ѡ<EFBFBD><D1A1>ĩ<EFBFBD>˽ڵ<CBBD>!", "INFO", MessageBox.WARNING);
return false;
}
}
}
String tezh = idText.getText();
if ((tezh == null) || (tezh.trim().length() == 0)) {
MessageBox.post("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EBB2BB>Ϊ<EFBFBD><CEAA>!", "INFO", MessageBox.WARNING);
return false;
}
return true;
}
// private void getNameAndRemark() {
// if (selectedSegmentNode.getPackCodeNodeInfo().getNode_type()
// .equals(AutoCodeManagerPropertyName.ListName)) {
// if (listView != null) {
// 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("<22>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>:")){
// String key =null;
// String value = null;
// String[] projids =propCombos[i].getText().split("<---->");
// if(projids.length >= 2){
// key = projids[0];
// value = projids[1];
// }
//
// System.out.println("value="+key +"|name="+value);
//
// for(PackCodeNodeInfo pcn : lp_packCodeNodeInfos){
// System.out.println("pcn.getNode_value()="+pcn.getNode_value()+"|pcn.getNode_name()="+pcn.getNode_name());
// if(key!=null &&
// value !=null &&
// pcn.getNode_value().equals(key)&&
// pcn.getNode_name().equals(value)){
// LP_Name = pcn.getNode_name();
// LP_Remark = pcn.getNode_desc();
// System.out.println("20181019 LP_Name=>>" +LP_Name);
// System.out.println("20181019 LP_Remark=>>" +LP_Remark);
// }
// }
// break;
// }
// }
// }
// }
// }
//
//
// }
/**
* <20><><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD><EFBFBD>ID
*
* @param newID
* @return
*/
private String getJYNewID(String newID) {
String jyNewID = newID;
if (cpxText != null) {
jyNewID = jyNewID.replace(CPX, cpxText.getText());
}
if (nfText != null) {
jyNewID = jyNewID.replace(NF, nfText.getText().substring(2, 4)
+ "-");
}
if (cpxText2 != null) {
String cpx = cpxText2.getText();
String value = jyCPXMap.get(cpx);
jyNewID = jyNewID.replace(CPX2, value + "-");
}
return jyNewID;
}
public void createPressed() {
try {
cldh = "";
this.LP_PROJECT_ID=null;
/*
* (org.eclipse.swt.widgets.Shell parent, java.lang.String msg,
* java.lang.Throwable t, boolean callStack, java.lang.String title,
* int type, boolean showDetailsInitially, java.lang.String
* cookieName)
*/
// MessageBox.post(PlatformHelper.getCurrentShell(),"1111",null,true,"ok",4,true,"ss");
if (checkClassficationICO()) {
// MessageBox.post("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><D0B4><EFBFBD><EFBFBD><EFBFBD>ͬ<EFBFBD><CDAC><EFBFBD>Եķ<D4B5><C4B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><D0B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!", "INFO",
// MessageBox.WARNING);
return;
}
if (!finitPropList()) {
MessageBox.post("<22><><EFBFBD><EFBFBD>д<EFBFBD><D0B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "<22><><EFBFBD><EFBFBD>", MessageBox.ERROR);
return;
}
if (!beforeGetNewSequenceNo()) {
return;
}
if (cpxText2 != null && cpxText2.getText().trim().isEmpty()) {
MessageBox.post("<22><><EFBFBD><EFBFBD>д[<5B><>Ʒ<EFBFBD><C6B7>]!", "INFO", MessageBox.WARNING);
return;
}
if (cpxText != null && cpxText.getText().trim().isEmpty()) {
MessageBox.post("<22><><EFBFBD><EFBFBD>д[<5B><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>]!", "INFO", MessageBox.WARNING);
return;
}
if (nfText != null && nfText.getText().trim().isEmpty()) {
MessageBox.post("<22><><EFBFBD><EFBFBD>д[<5B><><EFBFBD><EFBFBD>]!", "INFO", MessageBox.WARNING);
return;
}
// if (!isMust()) {
// MessageBox.post("<22><><EFBFBD><EFBFBD>д[<5B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Դ<EFBFBD><D4B4>]<5D><><EFBFBD><EFBFBD>!", "INFO", MessageBox.WARNING);
// return;
// }
if (TCPreferenceUitl.isTrueTCPreferenceValue(session,
origin_isMustSelecteUnit)) {
if (unitCombo != null && unitCombo.isEnabled()) {
if ((unitCombo.getSelectionIndex() == -1)
|| (unitCombo.getText().trim().length() == 0)) {
MessageBox.post("<22><>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD>λ!", "INFO", MessageBox.WARNING);
return;
}
}
}
String tezh = idText.getText();
String nameTextValue = nameText.getText();
String type = tccomponentitemtype.getType();
if("RB3_ZC".equals(type)) {
drawingNumber = splicValue(attrList2,esAttrList2,objMap2,markList2,isNList2,lovMap2);
if(drawingNumber == null) {
return;
}
if(drawingNumber.contains(" ")) {
drawingNumber = drawingNumber.replace(" ", "");
}
bsNumber = splicValue(attrList3,esAttrList3,objMap3,markList3,isNList3,lovMap3);
if(bsNumber == null) {
return;
}
if(bsNumber.contains(" ")) {
bsNumber = bsNumber.replace(" ", "");
}
smNumber = splicValue(attrList4,esAttrList4,objMap4,markList4,isNList4,lovMap4);
if(smNumber == null) {
return;
}
if(smNumber.contains(" ")) {
smNumber = smNumber.replace(" ", "");
}
System.out.println("bsNumber============"+bsNumber);
System.out.println("smNumber============"+smNumber);
System.out.println("drawingNumber============"+drawingNumber);
}else if("RB3_YZ".equals(type)) {
drawingNumber = splicValue(attrList2,esAttrList2,objMap2,markList2,isNList2,lovMap2);
if(drawingNumber == null) {
return;
}
if(drawingNumber.contains(" ")) {
drawingNumber = drawingNumber.replace(" ", "");
}
System.out.println("drawingNumber============"+drawingNumber);
}
productNumber = splicValue(attrList,esAttrList,objMap,markList,isNList,lovMap);
if(productNumber == null) {
return;
}
if(productNumber.contains(" ")) {
productNumber = productNumber.replace(" ", "");
}
System.out.println("productNumber============"+productNumber);
// for (int i = 0; i < attrList2.size(); i++) {
// String attr = attrList2.get(i);
// System.out.println("attr=====!!"+attr);
// String esAttr = esAttrList2.get(i);
// if(!("".equals(attr.trim()))) {
// Object obj = objMap2.get(attr);
// Combo box = null;
// if((PlmLocale.getString("RadialClearance")).equals(attr)) {
// box = boxMap.get(attr);
// }
// if(obj == null) {
// System.out.println("1122221111");
// obj = objMap2.get(esAttr);
// if(box != null) {
// Text field = (Text)obj;
// String fieldText = field.getText();
// String boxText = box.getText();
// if(!("".equals(fieldText.trim())) && !("".equals(boxText.trim()))) {
// MessageBox.post(esAttr+"<22><><EFBFBD><EFBFBD>ͬʱ<CDAC><CAB1>д<EFBFBD><D0B4><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "<22><>ʾ", MessageBox.INFORMATION);
// return;
// }
// if("".equals(fieldText.trim()) && "".equals(boxText.trim())) {
// MessageBox.post(esAttr+"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>дһ<D0B4><D2BB>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "<22><>ʾ", MessageBox.INFORMATION);
// return;
// }
// if(!("".equals(fieldText.trim()))) {
// objList2.add(field);
// lovList2.add("no");
// }else {
// objList2.add(box);
// lovList2.add("yes");
// }
// }else {
// objList2.add(obj);
// lovList2.add(lovMap2.get(esAttr));
// }
// }else {
// if(box != null) {
// Text field = (Text)obj;
// String fieldText = field.getText();
// String boxText = box.getText();
// if(!("".equals(fieldText.trim())) && !("".equals(boxText.trim()))) {
// MessageBox.post(attr+"<22><><EFBFBD><EFBFBD>ͬʱ<CDAC><CAB1>д<EFBFBD><D0B4><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "<22><>ʾ", MessageBox.INFORMATION);
// return;
// }
// if("".equals(fieldText.trim()) && "".equals(boxText.trim())) {
// MessageBox.post(attr+"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>дһ<D0B4><D2BB>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "<22><>ʾ", MessageBox.INFORMATION);
// return;
// }
// if(!("".equals(fieldText.trim()))) {
// objList2.add(field);
// lovList2.add("no");
// }else {
// objList2.add(box);
// lovList2.add("yes");
// }
// }else {
// objList2.add(obj);
// lovList2.add(lovMap2.get(attr));
// }
// }
// }
// }
//
//
// StringBuilder sb2 = new StringBuilder();
//
// for (int i = 0; i < objList2.size(); i++) {
// String attrValue = "";
// if("yes".equals(lovList2.get(i))) {
// String value = ((Combo) objList2.get(i)).getText();
// if(asList.contains(value) || esList.contains(value)) {
// value = "";
// }else {
// if(value.contains(":")) {
// String[] values = value.split(":");
// value = values[0];
// }else if(value.contains("<22><>")) {
// String[] values = value.split("<22><>");
// value = values[0];
// }
// }
// if("<22><>Ʒ<EFBFBD><C6B7>".equals(value)) {
// value = "";
// }else if("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>".equals(value)) {
// value = "C";
// }else if("<22>ȴ<EFBFBD><C8B4><EFBFBD><EFBFBD><EFBFBD>".equals(value)) {
// value = "R";
// }else if("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>".equals(value)) {
// value = "L";
// }else if("<22>ͼ<EFBFBD>".equals(value)) {
// value = "D";
// }
// attrValue = value;
// }else {
// attrValue = ((Text) objList2.get(i)).getText();
// }
// System.out.println("attrValue=================="+attrValue);
// String mark = markList2.get(i);
// sb2.append(mark.trim());
// sb2.append(attrValue);
// }
// sb2.append("-00");
// drawingNumber = sb2.toString();
if("RB3_ZC".equals(type)) {
List<TCComponent> compList = queryObject("RBSearchZCCPH",
new String[] {"<22><>Ʒ<EFBFBD><C6B7>"}, new String[] {productNumber});
if(compList != null ) {
if( compList.size() > 0) {
//<2F>Ż<EFBFBD>
String nID=newID.substring(0,2);
for(int j=0;j<compList.size();j++) {
System.out.println("<22>ж<EFBFBD>item_idǰ<64><C7B0>λ<EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>ͬ");
String compID = compList.get(j).getProperty("item_id");
String cID=compID.substring(0, 2);
if(nID.equals(cID)) {
MessageBox.post("ϵͳ<CFB5><CDB3><EFBFBD>Ѵ<EFBFBD><D1B4>ڲ<EFBFBD>Ʒ<EFBFBD><C6B7>Ϊ" + productNumber + "<22><><EFBFBD><EFBFBD><EFBFBD>ϣ<EFBFBD><CFA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EBA3A1><EFBFBD><EFBFBD>", "<22><><EFBFBD><EFBFBD>", MessageBox.INFORMATION);
return;
}
}
//end<6E>Ż<EFBFBD>
}
}
//sb2.append("-00");
}else if("RB3_LBJ".equals(type)) {
List<TCComponent> compList = queryObject("RBSearchLBJCPH",
new String[] {"<22><>Ʒ<EFBFBD><C6B7>"}, new String[] {productNumber});
if(compList != null ) {
//<2F>Ż<EFBFBD>
String nID=newID.substring(0,2);
for(int j=0;j<compList.size();j++) {
System.out.println("<22>ж<EFBFBD>item_idǰ<64><C7B0>λ<EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>ͬ");
String compID = compList.get(j).getProperty("item_id");
String cID=compID.substring(0, 2);
if(nID.equals(cID)) {
MessageBox.post("ϵͳ<CFB5><CDB3><EFBFBD>Ѵ<EFBFBD><D1B4>ڲ<EFBFBD>Ʒ<EFBFBD><C6B7>Ϊ" + productNumber + "<22><><EFBFBD><EFBFBD><EFBFBD>ϣ<EFBFBD><CFA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EBA3A1><EFBFBD><EFBFBD>", "<22><><EFBFBD><EFBFBD>", MessageBox.INFORMATION);
return;
}
}
//end<6E>Ż<EFBFBD>
}
//sb2.append("-00");
// drawingNumber = sb2.toString();
}else if("RB3_YCL".equals(type)) {
List<TCComponent> compList = queryObject("RBSearchYCLCPH",
new String[] {"<22><>Ʒ<EFBFBD><C6B7>"}, new String[] {productNumber});
if(compList != null ) {
//<2F>Ż<EFBFBD>
String nID=newID.substring(0,2);
for(int j=0;j<compList.size();j++) {
System.out.println("<22>ж<EFBFBD>item_idǰ<64><C7B0>λ<EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>ͬ");
String compID = compList.get(j).getProperty("item_id");
String cID=compID.substring(0, 2);
if(nID.equals(cID)) {
MessageBox.post("ϵͳ<CFB5><CDB3><EFBFBD>Ѵ<EFBFBD><D1B4>ڲ<EFBFBD>Ʒ<EFBFBD><C6B7>Ϊ" + productNumber + "<22><><EFBFBD><EFBFBD><EFBFBD>ϣ<EFBFBD><CFA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EBA3A1><EFBFBD><EFBFBD>", "<22><><EFBFBD><EFBFBD>", MessageBox.INFORMATION);
return;
}
}
//end<6E>Ż<EFBFBD>
}
//sb2.append("-00");
// drawingNumber = sb2.toString();
}else if("RB3_YZ".equals(type)) {
List<TCComponent> compList = queryObject("RBSearchYZCPH",
new String[] {"<22><>Ʒ<EFBFBD><C6B7>"}, new String[] {productNumber});
if(compList != null ) {
//<2F>Ż<EFBFBD>
String nID=newID.substring(0,2);
for(int j=0;j<compList.size();j++) {
System.out.println("<22>ж<EFBFBD>item_idǰ<64><C7B0>λ<EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>ͬ");
String compID = compList.get(j).getProperty("item_id");
String cID=compID.substring(0, 2);
if(nID.equals(cID)) {
MessageBox.post("ϵͳ<CFB5><CDB3><EFBFBD>Ѵ<EFBFBD><D1B4>ڲ<EFBFBD>Ʒ<EFBFBD><C6B7>Ϊ" + productNumber + "<22><><EFBFBD><EFBFBD><EFBFBD>ϣ<EFBFBD><CFA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EBA3A1><EFBFBD><EFBFBD>", "<22><><EFBFBD><EFBFBD>", MessageBox.INFORMATION);
return;
}
}
//end<6E>Ż<EFBFBD>
}
//sb2.append("-00");
// drawingNumber = sb2.toString();
}
if (!type.equals("TM2_powder"))
if ((nameTextValue == null)
|| (nameTextValue.trim().length() == 0)) {
MessageBox.post("<22><><EFBFBD>Ʋ<EFBFBD><C6B2><EFBFBD>Ϊ<EFBFBD><CEAA>!", "INFO", MessageBox.WARNING);
return;
}
pattern = tezh.replaceAll(" ", "");
if (treeViewOperation.getSelectedTreeNode(classificationTreeViewer) == null) {
return;
}
String realItemType = "Item";
if (segmentItemType != null) {
realItemType = (String) segmentItemType
.get(selectedSegmentNode);
}
//TODO <20><><EFBFBD>ӷ<EFBFBD><D3B7>͵<EFBFBD><CDB5><EFBFBD>Ŀ
System.out.println("realItemType =>"+realItemType);
//String newItemName = nameText.getText();
if(realItemType!=null && realItemType.equals("LP2_Proj_Doc")){
//newItemName += LP_Name;
// getNameAndRemark();
String desctest = DescText.getText();
String[] values = desctest.split("\r");
System.out.println("values lengh = >"+values.length);
if(values.length>=2){
String[] projids = values[1].split("::");
if(projids.length >= 2){
String projID = projids[1];
if(!checkIsProjectExits(projID)){
MessageBox.post("<22><><EFBFBD><EFBFBD>ǰû<C7B0><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ["+projID+"]<5D><><EFBFBD>ͽ<EFBFBD><CDBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȩ<EFBFBD>ޣ<EFBFBD>\r<><72><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5><EFBFBD><EFBFBD>Ա<EFBFBD><D4B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӵ<EFBFBD><D3B5><EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF>","<22><><EFBFBD><EFBFBD>",MessageBox.WARNING);
return;
}
this.LP_PROJECT_ID =projID;
}
}
}
// if (codeStyle.contains(AutoCodeManagerPropertyName.Code_seq)) {
// while (newID == null || tccomponentitemtype.find(newID) != null)
// {
getSequenceNo(realItemType);
// }
// }
if ((newID == null) || (newID.trim().length() == 0)) {
MessageBox.post("ID<49><44><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!", "INFO", MessageBox.WARNING);
return;
}
// <20><><EFBFBD>Ǵ<EFBFBD><C7B4><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>ϵ<EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA>ID<49><44><EFBFBD><EFBFBD>
if (!this.isCreateTempItem) {
// NEW_ID:
int ii = 0;
while (tccomponentitemtype.find(getJYNewID(newID)) != null
// && ii != 5
) {
ii++;
System.out.println("newID = " + newID + "<22>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD><EFBFBD>");
getSequenceNo(realItemType);
if ((newID == null) || (newID.trim().length() == 0)) {
MessageBox.post("ID<49><44><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!", "INFO", MessageBox.WARNING);
return;
}
new GetCodeNumber().delete_recycleID(counterID);
try {
new Thread().sleep(500);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
System.out.println("-------");
}
tccomponentitemtype = (TCComponentItemType) (session
.getTypeComponent(realItemType));
TCComponentItem oldItem = tccomponentitemtype
.find(getJYNewID(newID));
if (oldItem != null) {
MessageBox.post("IDΪ<44><CEAA>" + getJYNewID(newID) + "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD><EFBFBD>!",
"INFO", MessageBox.WARNING);
new GetCodeNumber().delete_recycleID(counterID);
return;
}
}
long time11 = System.nanoTime();
if (!TCPreferenceUitl.isSelectExsitToTCPreferenceValues(session,
origin_idNeddExamineAndApproveTypes, realItemType)) {
if (this.isCreateTempItem) {
try {
tccomponentitemtype = (TCComponentItemType) (session
.getTypeComponent("JK8LSMaterial"));
String itemID = tccomponentitemtype.getNewID();
createNewItem(itemID, revCombo.getText(),
"JK8LSMaterial", nameText.getText(), "");
} catch (TCException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} else {
String itemID = getJYNewID(newID);
// if(!("RB3_ZC".equals(realItemType))) {
// StringBuilder idSB = new StringBuilder(itemID);
// String jhStr = PlmLocale.getString("PartNumber");
// String statuStr = PlmLocale.getString("statusCode");
// String khdmStr = PlmLocale.getString("Customer");
// Combo jhCombo = (Combo) idMap.get(jhStr);
// String jh = jhCombo.getText();
// Combo statuCombo = (Combo) idMap.get(statuStr);
// String statu = statuCombo.getText();
// Combo khdmCombo = (Combo) idMap.get(khdmStr);
// String khdm = khdmCombo.getText();
// idSB.append(jh);
// idSB.append(statu);
// idSB.append("-");
// idSB.append(khdm);
// itemID = idSB.toString();
// }
createNewItem(itemID, revCombo.getText(),
realItemType, nameText.getText(), "");
}
} else {
String itemID = tccomponentitemtype.getNewID();
// if(!("RB3_ZC".equals(realItemType))) {
// StringBuilder idSB = new StringBuilder(itemID);
// String jhStr = PlmLocale.getString("PartNumber");
// String statuStr = PlmLocale.getString("statusCode");
// String khdmStr = PlmLocale.getString("Customer");
// Combo jhCombo = (Combo) idMap.get(jhStr);
// String jh = jhCombo.getText();
// Combo statuCombo = (Combo) idMap.get(statuStr);
// String statu = statuCombo.getText();
// Combo khdmCombo = (Combo) idMap.get(khdmStr);
// String khdm = khdmCombo.getText();
// idSB.append(jh);
// idSB.append(statu);
// idSB.append("-");
// idSB.append(khdm);
// itemID = idSB.toString();
// }
createNewItem(itemID,
revCombo.getText(), realItemType, nameText.getText(), "");
}
long time12 = System.nanoTime();
System.out.println("<22><><EFBFBD><EFBFBD>item<65><6D>ʱ(ms)<29><> " + (time12 - time11) / 1000000);
long time21 = System.nanoTime();
if (newComp != null) {
if(newComp instanceof TCComponentItem) {
TCComponentItem item = (TCComponentItem) newComp;
TCComponentItemRevision itemRev = item.getLatestItemRevision();
String statu = "";
String rev = revCombo.getText();
if("A1".equals(rev)) {
statu = "<22><>:Conceptual design";
}else if("B1".equals(rev)) {
statu = "<22><>:Product design";
}else if("R1".equals(rev)) {
statu = "<22><>:Process design/Sample delivery";
}else if("P1".equals(rev)) {
statu = "P:Pilot production/small batch";
}else if("M1".equals(rev)) {
statu = "M:Mass production";
}
itemRev.setStringProperty("rb3_smzqzt", statu);
itemRev.setStringProperty("rb3_cph", productNumber);
if("RB3_ZC".equals(type)) {
itemRev.setStringProperty("rb3_th", drawingNumber);
itemRev.setStringProperty("rb3_bsh", bsNumber);
itemRev.setStringProperty("rb3_sm2", smNumber);
}else if("RB3_YZ".equals(type)) {
itemRev.setStringProperty("rb3_th", drawingNumber);
}else if("RB3_YCL".equals(type)) {
if(!("".equals(cldh.trim()))) {
itemRev.setStringProperty("rb3_tzcldh", cldh);
}
}
if("RB3_ZC".equals(type)) {
if(revList.size() > 0) {
TCComponentItemRevision picItem = revList.get(0);
TCComponent[] pics = picItem.getReferenceListProperty("TC_Is_Represented_By");
for (int i = 0; i < pics.length; i++) {
itemRev.add("TC_Is_Represented_By", pics[i]);
}
//picItem.add("RB3_GLWL", itemRev);
}else {
TCComponentItemType typeComponent = (TCComponentItemType) session.getTypeComponent("RB3_CPT");
//String revID = typeComponent.getNewRev(null);
//String drawID = typeComponent.getNewID();
String[] keys = new String[]{"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ID"};
String[] values = new String[]{drawingNumber};
List<TCComponent> tzList = queryObject("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ID", keys, values);
TCComponentItemRevision CPTRev = null;
if(tzList != null) {
if(tzList.size() > 0) {
if(tzList.get(0) instanceof TCComponentItem) {
TCComponentItem tcItem = (TCComponentItem) tzList.get(0);
CPTRev = tcItem.getLatestItemRevision();
}
}
}else {
TCComponentItem CPTItem = typeComponent.create(drawingNumber, "V1","RB3_CPT", "", "",null);
CPTRev = CPTItem.getLatestItemRevision();
TCComponent targetObject = (TCComponent) AIFUtility
.getCurrentApplication().getTargetComponent();
if (targetObject instanceof TCComponentFolder) {
if (CPTItem != null) {
TCComponentFolder folder = (TCComponentFolder) targetObject;
if (isHaveWritePrivilige(folder)) {
folder.add("contents", CPTItem);
folder.refresh();
} else {
session.getUser().getNewStuffFolder()
.add("contents", CPTItem);
session.getUser().getNewStuffFolder().refresh();
}
}
} else if (targetObject instanceof TCComponentPseudoFolder) {
if (CPTItem != null) {
if (TCPreferenceUitl.isTrueTCPreferenceValue(session,
origin_isNotSaveNewItemToPseudoFolder)) {
session.getUser().getNewStuffFolder()
.add("contents", CPTItem);
session.getUser().getNewStuffFolder().refresh();
} else {
TCComponentPseudoFolder folder = (TCComponentPseudoFolder) targetObject;
String propertyName = folder
.getProperty("property_name");
TCComponent ownerComponent = folder
.getOwningComponent();
if (ownerComponent != null) {
ownerComponent.add(propertyName, CPTItem);
ownerComponent.refresh();
}
}
}
} else {
if (CPTItem != null) {
session.getUser().getNewStuffFolder()
.add("contents", CPTItem);
session.getUser().getNewStuffFolder().refresh();
}
}
}
CPTRev.setStringProperty("rb3_th", drawingNumber);
itemRev.add("TC_Is_Represented_By", CPTRev);
//CPTRev.add("RB3_GLWL", itemRev);
}
}
}
long time22 = System.nanoTime();
System.out.println("item<65><6D><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ(ms)<29><> " + (time22 - time21) / 1000000);
// sendObjToClassfication((TCComponentItem)newComp);
new Runnable() {
public void run() {
sendObjToClassficationByWebService((TCComponentItem) newComp);
}
}.run();
newComp.refresh();
new GetCodeNumber().delete_recycleID(counterID);
setClipboard(newID);
PackCodeDescInfos packCodeDescInfos = new PackCodeDescInfos();
// packCodeDescInfos.setCodeStyle(codeStyle);
packCodeDescInfos.setCodeStyle(finalPattern);
packCodeDescInfos.setCodetz(codeCounterName.replace(" ", "")
.trim());
packCodeDescInfos.setGenerateID(newID);
packCodeDescInfos.setIdDesc(DescText.getText());
packCodeDescInfos.setIdjl(counterID);
packCodeDescInfos.setSelectedSegmentNode(selectedSegmentNode);
ORSaveObjectDescOperation orSaveObjectDescOperation = new ORSaveObjectDescOperation(
newComp);
orSaveObjectDescOperation.saveObject_Desc(packCodeDescInfos);
if (TCPreferenceUitl.isTrueTCPreferenceValue(session,
origin_isShowPCUnitLast)) {
if ((unitCombo != null)
&& (unitCombo.getSelectionIndex() >= 0)
&& (unitCombo.getSelectionIndex() != (units.length))) {
orSaveObjectDescOperation.saveUom_tag(units[unitCombo
.getSelectionIndex()]);
}
} else {
if ((unitCombo != null)
&& (unitCombo.getSelectionIndex() > 0)) {
orSaveObjectDescOperation.saveUom_tag(units[unitCombo
.getSelectionIndex() - 1]);
}
}
if (TCPreferenceUitl.isTrueTCPreferenceValue(session,
origin_sendToClassification_Automatic)) {
long time31 = System.nanoTime();
if (!TCPreferenceUitl.isSelectExsitToTCPreferenceValues(
session, origin_sendToClassification_excludeType,
newComp.getType())) {
AbstractTreeData selectedSegment = treeViewOperation
.getSelectedTreeNode(classificationTreeViewer);
if (selectedSegment.getPackCodeNodeInfo()
.getNode_type()
.equals(AutoCodeManagerPropertyName.ListName)) {
new ORCreateICOObject().createListNodeICObject(
selectedSegment, firstListICOName,
firstListICOName,
(TCComponentItem) newComp, icoPropertyMap);
} else if (selectedSegment.getPackCodeNodeInfo()
.getNode_type()
.equals(AutoCodeManagerPropertyName.TreeName)) {
if (TCPreferenceUitl
.isSelectExsitToTCPreferenceValues(session,
origin_sendToPreviousTreeNode,
newComp.getType())) {
new ORCreateICOObject().createTreeNodeICObject(
icoTreeData.getParentTreeData()
.getParentTreeData(),
icoTreeData.getParentTreeData(),
(TCComponentItem) newComp,
icoPropertyMap);
} else {
new ORCreateICOObject().createTreeNodeICObject(
icoTreeData.getParentTreeData(),
icoTreeData, (TCComponentItem) newComp,
icoPropertyMap);
}
}
} else {
MessageBox.post("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>" + newComp + "<22><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>!", "INFO",
MessageBox.WARNING);
}
long time32 = System.nanoTime();
System.out.println("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ(ms)<29><> " + (time32 - time31)
/ 1000000);
} else {
MessageBox.post("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>" + newComp + "<22><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>!", "INFO",
MessageBox.WARNING);
}
orCustomizationAction();
} else {
MessageBox.post("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!", "INFO", MessageBox.WARNING);
}
} catch (TCException e) {
e.printStackTrace();
MessageBox.post("<22><><EFBFBD><EFBFBD><EFBFBD>쳣:" + e.getMessage(), "INFO",
MessageBox.WARNING);
}
}
@Override
protected int getShellStyle() {
return super.getShellStyle() | SWT.RESIZE | SWT.MAX;
}
@Override
public boolean close() {
return super.close();
}
// <20><><EFBFBD>öԻ<C3B6><D4BB><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC>С
@Override
protected Point getInitialSize() {
return new Point(800, 500);
}
String isCanTeam = "false";
protected void createButtonsForButtonBar(final Composite parent) {
if ((newItemDialog != null) || (orNewItemInfoPanel != null)
|| (packCodeDescInfos != null)) {
this.isCreateTempItemButton = createButton(parent,
IDialogConstants.FINISH_ID, "<22>½<EFBFBD><C2BD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>", false);
createButton(parent, IDialogConstants.YES_ID, "<22><><EFBFBD><EFBFBD>ID", false);
createButton(parent, IDialogConstants.CANCEL_ID, "ȡ<><C8A1>", false);
} else {
session = (TCSession) AIFUtility.getCurrentApplication()
.getSession();
String origin_newItemButtonName = "origin_newItemButtonName";
String name = TCPreferenceUitl.getTCPreferenceValue(session,
origin_newItemButtonName);
this.isCreateTempItemButton = createButton(parent,
IDialogConstants.FINISH_ID, "<22>½<EFBFBD><C2BD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>", false);
this.picButton = createButton(parent,
IDialogConstants.OPEN_ID, PlmLocale.getString("ReferenceDrawingNo"), false);
if ((name != null) && (name.trim().length() > 0)) {
createButton(parent, IDialogConstants.YES_ID, name, false);
} else {
createButton(parent, IDialogConstants.YES_ID, PlmLocale.getString("Create"), false);
}
createButton(parent, IDialogConstants.CANCEL_ID, PlmLocale.getString("Cancel"), false);
}
isCanTeam = TCPreferenceUitl.getTCPreferenceValue(session,
connor_isCanCreateTempMaterial);
if ((isCanTeam != null) && (isCanTeam.trim().length() > 0)
&& isCanTeam.toLowerCase().equals("true")) {
this.isCreateTempItemButton.setVisible(true);
} else {
this.isCreateTempItemButton.setVisible(false);
}
}
public void setClipboard(String str) {
try {
if (!"".equals(str)) {
StringSelection ss = new StringSelection(str);
Toolkit.getDefaultToolkit().getSystemClipboard()
.setContents(ss, null);
}
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* ͨ<><CDA8><EFBFBD><EFBFBD>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѯ<EFBFBD><D1AF>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD>
*
* @param queryName <20><>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD>
* @param keys <20><>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD>
* @param values <20><>ѯֵ
* @return
*/
public List<TCComponent> queryObject(String queryName, String[] keys, String[] values) {
TCComponent[] components = null;
try {
TCComponentQueryType queryType = (TCComponentQueryType) session.getTypeComponent("ImanQuery");
TCComponentQuery query = (TCComponentQuery) queryType.find(queryName);
if (query == null) {
MessageBox.post("û<><C3BB><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD>ѯ:" + queryName, "<22><><EFBFBD><EFBFBD>", MessageBox.ERROR);
return null;
}
components = query.execute(keys, values);
} catch (TCException e) {
e.printStackTrace();
}
if (components != null && components.length > 0) {
List<TCComponent> compList = Arrays.asList(components);
return compList;
} else {
return null;
}
}
public String splicValue(List<String> attrList,List<String> esAttrList,
Map<String,Object> map,List<String> markList,List<String> isNList,Map<String,String> lovMap) {
// List<String> asList = Arrays.asList(lovVal);
// List<String> esList = Arrays.asList(esLovVal);
List<Object> objList = new ArrayList<Object>();
List<String> lovList = new ArrayList<String>();
StringBuilder sb = new StringBuilder();
for (int i = 0; i < attrList.size(); i++) {
String attr = attrList.get(i);
String esAttr = esAttrList.get(i);
if(!("".equals(attr.trim()))) {
String str = lovMap.get(attr);
Object obj = map.get(attr);
Combo box = null;
if((PlmLocale.getString("RadialClearance")).equals(attr) ||
(PlmLocale.getString("GreaseAmount")).equals(attr)||
(PlmLocale.getString("VibrationAcceleration")).equals(attr)||
(PlmLocale.getString("VibrationSpeed")).equals(attr)) {
box = boxMap.get(attr);
if(box == null) {
box = boxMap.get(esAttr);
}
}
if(obj == null) {
obj = map.get(esAttr);
if("string".equals(str)) {
objList.add(obj);
lovList.add("string");
continue;
}
if(box != null) {
Text field = (Text)obj;
String fieldText = field.getText();
String boxText = box.getText();
if(!("".equals(fieldText.trim())) && !("".equals(boxText.trim()))) {
MessageBox.post(esAttr+"<22><><EFBFBD><EFBFBD>ͬʱ<CDAC><CAB1>д<EFBFBD><D0B4><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "<22><>ʾ", MessageBox.INFORMATION);
return null;
}
if("".equals(fieldText.trim()) && "".equals(boxText.trim())) {
MessageBox.post(esAttr+"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>дһ<D0B4><D2BB>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "<22><>ʾ", MessageBox.INFORMATION);
return null;
}
if(!("".equals(fieldText.trim()))) {
objList.add(field);
lovList.add("no");
}else {
objList.add(box);
lovList.add("yes");
}
}else {
objList.add(obj);
lovList.add(lovMap.get(esAttr));
}
}else {
if("string".equals(str)) {
objList.add(obj);
lovList.add("string");
continue;
}
if(box != null) {
Text field = (Text)obj;
String fieldText = field.getText();
String boxText = box.getText();
if(!("".equals(fieldText.trim())) && !("".equals(boxText.trim()))) {
MessageBox.post(attr+"<22><><EFBFBD><EFBFBD>ͬʱ<CDAC><CAB1>д<EFBFBD><D0B4><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "<22><>ʾ", MessageBox.INFORMATION);
return null;
}
if("".equals(fieldText.trim()) && "".equals(boxText.trim())) {
MessageBox.post(attr+"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>дһ<D0B4><D2BB>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "<22><>ʾ", MessageBox.INFORMATION);
return null;
}
if(!("".equals(fieldText.trim()))) {
objList.add(field);
lovList.add("no");
}else {
objList.add(box);
lovList.add("yes");
}
}else {
objList.add(obj);
lovList.add(lovMap.get(attr));
}
}
}
}
for (int i = 0; i < objList.size(); i++) {
String attrValue = "";
if("yes".equals(lovList.get(i))) {
String value = ((Combo) objList.get(i)).getText();
if(asList.contains(value) || esList.contains(value)) {
if(isNList.get(i).trim().contains(value)) {
if(value.contains(":")) {
System.out.println("value============"+value);
String[] values = value.split(":");
value = values[0];
System.out.println("value2=========="+value);
}else if(value.contains("<22><>")) {
System.out.println("value============"+value);
String[] values = value.split("<22><>");
value = values[0];
System.out.println("value2=========="+value);
}
}else {
value = "";
}
}else {
if(value.contains(":")) {
System.out.println("value============"+value);
String[] values = value.split(":");
value = values[0];
System.out.println("value2=========="+value);
}else if(value.contains("<22><>")) {
System.out.println("value============"+value);
String[] values = value.split("<22><>");
value = values[0];
System.out.println("value2=========="+value);
}
}
if("<22><>Ʒ<EFBFBD><C6B7>".equals(value) || "Finished product".equals(value)) {
value = "";
}else if("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>".equals(value) || "Turning workpiece".equals(value)) {
value = "C";
}else if("<22>ȴ<EFBFBD><C8B4><EFBFBD><EFBFBD><EFBFBD>".equals(value) || "Heat treatment parts".equals(value)) {
value = "R";
}else if("<22><>շ<EFBFBD><D5B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E4BCB7>".equals(value) || "Cold rolled parts or cold extrusion parts".equals(value)) {
value = "D";
}else if("<22>ͼ<EFBFBD>".equals(value) || "Forge piece".equals(value)) {
value = "D";
}
attrValue = value;
}else if("no".equals(lovList.get(i))){
attrValue = ((Text) objList.get(i)).getText();
if(asList.contains(attrValue) || esList.contains(attrValue)) {
attrValue = "";
}else {
if(attrValue.contains(":")) {
System.out.println("attrValue============"+attrValue);
String[] values = attrValue.split(":");
attrValue = values[0];
}else if(attrValue.contains("<22><>")) {
System.out.println("attrValue============"+attrValue);
String[] values = attrValue.split("<22><>");
attrValue = values[0];
}
}
}else{
attrValue = (String)objList.get(i);
}
if("40<34><30><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˶<EFBFBD>ճ<EFBFBD><D5B3>(mm2/s)".equals(attrList.get(i))) {
try {
double d = Double.parseDouble(attrValue);
int d1 = (int) Math.round(d);
int d2 = d1%26;
StringBuilder numSb = new StringBuilder();
getNum(d1,numSb);
String str = getStage(d2);
numSb.append(str);
attrValue = numSb.toString();
} catch (Exception e) {
// TODO: handle exception
MessageBox.post("40<34><30><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˶<EFBFBD>ճ<EFBFBD><D5B3><EFBFBD><EFBFBD>д<EFBFBD><D0B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><D0B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "<22><>ʾ", MessageBox.INFORMATION);
return null;
}
}else if("<22><><EFBFBD>ϴ<EFBFBD><CFB4><EFBFBD>".equals(attrList.get(i))) {
cldh = attrValue;
}else if("C&U<><55><EFBFBD><EFBFBD>".equals(attrList.get(i))) {
if("".equals(attrValue.trim())) {
attrValue = drawingNumber;
}else {
drawingNumber = attrValue;
}
}
System.out.println("attrValue==============="+attrValue);
String mark = markList.get(i);
if(attrValue != null && !("".equals(attrValue.trim()))) {
sb.append(mark.trim());
}
sb.append(attrValue);
}
return sb.toString();
}
public void saveCOM(String classID,Map<String,List<String>> map,List<String> attrList,
List<String> esAttrList,List<String> markList,List<String> isNList,List<CNClassPropBean> classPropList,
Map<String,Object> objMap,Map<String,String> lovMap,List<Widget> classTextList) {
List<String> nameMarkList2 = map.get(classID);
String attrNames2 = nameMarkList2.get(0);
String marks2 = nameMarkList2.get(1);
String isN2 = nameMarkList2.get(3);
if(attrNames2.contains(";")) {
String[] attrs2 = attrNames2.split(";");
String[] markss2 = marks2.split(";");
String[] isNs2 = isN2.split(";");
for (int i = 0; i < attrs2.length; i++) {
if(attrs2[i].contains("+")) {
String[] attrss = attrs2[i].split("\\+");
System.out.println("attrss[0]====="+attrss[0]);
attrList.add(attrss[0]);
esAttrList.add(attrss[1]);
markList.add(markss2[i]);
isNList.add(isNs2[i]);
}
}
}
for (int i = 0; i < classPropList.size(); i++) {
CNClassPropBean bean = classPropList.get(i);
String attrName = "";
if((bean.propDisName).contains("\\")) {
attrName = (bean.propDisName).split("\\\\")[0];
}else {
attrName = bean.propDisName;
}
System.out.println("propDisName======"+attrName);
if(attrList.contains(attrName) || esAttrList.contains(attrName)) {
objMap.put(attrName, classTextList.get(i));
if(bean.isLov) {
lovMap.put(attrName, "yes");
}else {
lovMap.put(attrName, "no");
}
}
}
}
public static void getNum(int x,StringBuilder sb) {
int a = x/26;
if(a >= 26) {
getNum(a,sb);
}else {
String str = getStage(a);
sb.append(str);
}
}
public static String getStage(int x) {
String str = "";
switch (x) {
case 0:str = "A";break;case 1:str = "B";break;case 2:str = "C";break;
case 3:str = "D";break;case 4:str = "E";break;case 5:str = "F";break;
case 6:str = "G";break;case 7:str = "H";break;case 8:str = "I";break;
case 9:str = "J";break;case 10:str = "K";break;case 11:str = "L";break;
case 12:str = "M";break;case 13:str = "N";break;case 14:str = "O";break;
case 15:str = "P";break;case 16:str = "Q";break;case 17:str = "R";break;
case 18:str = "S";break;case 19:str = "T";break;case 20:str = "U";break;
case 21:str = "V";break;case 22:str = "W";break;case 23:str = "X";break;
case 24:str = "Y";break;case 25:str = "Z";break;
default:
break;
}
return str;
}
}