|
|
package com.connor.rb.plm.rb007;
|
|
|
|
|
|
import java.awt.BorderLayout;
|
|
|
import java.awt.Dimension;
|
|
|
import java.awt.event.ActionEvent;
|
|
|
import java.awt.event.ActionListener;
|
|
|
import java.awt.event.KeyEvent;
|
|
|
import java.awt.event.KeyListener;
|
|
|
import java.io.File;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Arrays;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.Map.Entry;
|
|
|
|
|
|
import javax.swing.ComboBoxModel;
|
|
|
import javax.swing.DefaultComboBoxModel;
|
|
|
import javax.swing.JButton;
|
|
|
import javax.swing.JComboBox;
|
|
|
import javax.swing.JLabel;
|
|
|
import javax.swing.JPanel;
|
|
|
import javax.swing.JScrollPane;
|
|
|
import javax.swing.JSplitPane;
|
|
|
import javax.swing.JTextField;
|
|
|
import javax.swing.JTree;
|
|
|
import javax.swing.event.TreeSelectionEvent;
|
|
|
import javax.swing.event.TreeSelectionListener;
|
|
|
import javax.swing.tree.DefaultMutableTreeNode;
|
|
|
import javax.swing.tree.TreeNode;
|
|
|
|
|
|
import org.eclipse.swt.widgets.Button;
|
|
|
import org.eclipse.swt.widgets.Display;
|
|
|
import org.eclipse.swt.widgets.Shell;
|
|
|
|
|
|
import com.connor.rb.plm.entity.ZC_LBJ_list;
|
|
|
import com.connor.rb.plm.newcombox.RwJComboBox;
|
|
|
import com.connor.rb.plm.util.ClassAttributeBean;
|
|
|
import com.connor.rb.plm.util.ClassProperty;
|
|
|
import com.connor.rb.plm.util.CodeBean;
|
|
|
import com.connor.rb.plm.util.GetCodeBean;
|
|
|
import com.connor.rb.plm.util.MenuBean;
|
|
|
import com.connor.rb.plm.util.ParseXML;
|
|
|
import com.connor.rb.plm.util.PlmLocaleUtil;
|
|
|
import com.connor.rb.plm.util.SoaServerUtil;
|
|
|
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
|
|
import com.teamcenter.rac.aif.AbstractAIFDialog;
|
|
|
import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent;
|
|
|
import com.teamcenter.rac.common.tcviewer.multiplenamedrefs.MultipleNamedReferencesComboBox;
|
|
|
import com.teamcenter.rac.kernel.TCClassificationService;
|
|
|
import com.teamcenter.rac.kernel.TCComponent;
|
|
|
import com.teamcenter.rac.kernel.TCComponentBOMLine;
|
|
|
import com.teamcenter.rac.kernel.TCComponentBOMWindow;
|
|
|
import com.teamcenter.rac.kernel.TCComponentBOMWindowType;
|
|
|
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.TCComponentQuery;
|
|
|
import com.teamcenter.rac.kernel.TCComponentQueryType;
|
|
|
import com.teamcenter.rac.kernel.TCException;
|
|
|
import com.teamcenter.rac.kernel.TCPreferenceService;
|
|
|
import com.teamcenter.rac.kernel.TCProperty;
|
|
|
import com.teamcenter.rac.kernel.TCSession;
|
|
|
import com.teamcenter.rac.kernel.TCTypeService;
|
|
|
import com.teamcenter.rac.kernel.ics.ICSAdminClass;
|
|
|
import com.teamcenter.rac.kernel.ics.ICSAdminClassAttribute;
|
|
|
import com.teamcenter.rac.kernel.ics.ICSKeyLov;
|
|
|
import com.teamcenter.rac.kernel.ics.ICSProperty;
|
|
|
import com.teamcenter.rac.util.MessageBox;
|
|
|
import com.teamcenter.rac.util.PropertyLayout;
|
|
|
|
|
|
import cn.com.origin.autocodemanager.common.CreateCompositeUtil;
|
|
|
|
|
|
public class Rb007Dialog extends AbstractAIFDialog {
|
|
|
private AbstractAIFApplication app;
|
|
|
private TCSession session;
|
|
|
private TCPreferenceService service;
|
|
|
private String name;
|
|
|
private MenuBean menuBean;
|
|
|
private JPanel jp1;
|
|
|
private JPanel jp2;
|
|
|
private JPanel classJpanel;
|
|
|
private List<Map<String, Object>> values;
|
|
|
private List<ClassAttributeBean> classList = new ArrayList<ClassAttributeBean>();
|
|
|
// private List<CodeBean> codeBeanList;
|
|
|
private CodeBean selCodeBean;
|
|
|
private JButton okBut = new JButton("ȷ<><C8B7>");
|
|
|
private JButton button2 = new JButton("ͼֽ<CDBC><D6BD><EFBFBD><EFBFBD>");
|
|
|
private JButton celBut = new JButton("ȡ<><C8A1>");
|
|
|
private GetCodeBean getcode;
|
|
|
private JLabel[] labels1 = null;
|
|
|
private JComboBox<String> comb = null;
|
|
|
private String url = "";
|
|
|
private JScrollPane scr2;
|
|
|
private boolean classFlag = true;
|
|
|
private boolean classFlag2 = false;
|
|
|
private Map<String, Object> map2;
|
|
|
private Map<String, JComboBox<String>> boxMap = new HashMap<String, JComboBox<String>>();
|
|
|
private List<TCComponentItemRevision> revList = new ArrayList<TCComponentItemRevision>();
|
|
|
private List<Object> idList = new ArrayList<Object>();
|
|
|
private List<JComboBox> typeList = new ArrayList<JComboBox>();
|
|
|
private JLabel nameLabel;
|
|
|
private JComboBox<String> nameComb;
|
|
|
private JLabel idLabel;
|
|
|
private JTextField idField1;
|
|
|
private JLabel revLabel;
|
|
|
private JComboBox<String> revBox;
|
|
|
private String className2;
|
|
|
private TCComponentItemRevision targetItem;
|
|
|
private String productNumber = "";
|
|
|
private String drawingNumber = "";
|
|
|
private String HeatTreatment = "";
|
|
|
private Map<String, List<String>> attrMap;
|
|
|
private Map<String, List<String>> attrMap2;
|
|
|
private Map<String, Object> objMap = new HashMap<String, Object>();
|
|
|
private Map<String, Object> objMap2 = new HashMap<String, Object>();
|
|
|
private Map<String, String> lovMap = new HashMap<String, String>();
|
|
|
private Map<String, String> lovMap2 = new HashMap<String, String>();
|
|
|
private List<String> attrList = new ArrayList<String>();
|
|
|
private List<String> esAttrList = new ArrayList<String>();
|
|
|
// private List<Object> objList = new ArrayList<Object>();
|
|
|
// private List<String> lovList = new ArrayList<String>();
|
|
|
private List<String> attrList2 = new ArrayList<String>();
|
|
|
private List<String> esAttrList2 = new ArrayList<String>();
|
|
|
// private List<Object> objList2 = new ArrayList<Object>();
|
|
|
// private List<String> lovList2 = new ArrayList<String>();
|
|
|
private List<String> markList = new ArrayList<String>();
|
|
|
private List<String> markList2 = new ArrayList<String>();
|
|
|
private List<String> isNList = new ArrayList<String>();
|
|
|
private List<String> isNList2 = new ArrayList<String>();
|
|
|
private List<String> defaultValueList = new ArrayList<String>();
|
|
|
private List<String> defaultValueList2 = new ArrayList<String>();
|
|
|
private List<String> asList = new ArrayList<String>();
|
|
|
private List<String> esList = new ArrayList<String>();
|
|
|
//<2F>Ż<EFBFBD>
|
|
|
private int v=0;
|
|
|
private Map<String,String> lishu_lov=ZC_LBJ_list.LiShu_lov;
|
|
|
private Map<String,String> lishu=ZC_LBJ_list.LiShu;
|
|
|
private Map<String,String> zc_pro_map=new HashMap<String,String>();//<2F>ܳɵ<DCB3><C9B5><EFBFBD><EFBFBD>Լ<EFBFBD>ֵ<EFBFBD><D6B5>
|
|
|
//TextField<6C><64><EFBFBD><EFBFBD>
|
|
|
private List<Object> fieldList=new ArrayList<Object>();
|
|
|
//box<6F><78><EFBFBD><EFBFBD>
|
|
|
private List<Object> comboxList=new ArrayList<Object>();
|
|
|
private Map<String,String> fieldmap=new HashMap<>();
|
|
|
private Map<String,String> comboxmap=new HashMap<>();
|
|
|
//end<6E>Ż<EFBFBD>
|
|
|
|
|
|
// 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 Rb007Dialog(AbstractAIFApplication app, String name) {
|
|
|
super(false);
|
|
|
this.app = app;
|
|
|
this.session = (TCSession) app.getSession();
|
|
|
this.service = session.getPreferenceService();
|
|
|
this.name = name;
|
|
|
this.values = new ArrayList<Map<String, Object>>();
|
|
|
this.url = service.getStringValue("Autocode_SendClassServer_URL");
|
|
|
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void run() {
|
|
|
// TODO Auto-generated method stub
|
|
|
getcode = new GetCodeBean(session);
|
|
|
menuBean = getcode.getMenuBean(name);
|
|
|
// codeBeanList = bean.getCodeBeanList();
|
|
|
|
|
|
try {
|
|
|
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]);
|
|
|
}
|
|
|
}
|
|
|
ParseXML xml = new ParseXML();
|
|
|
File file = xml.getSXX("RB3_CPHPJFS", session);
|
|
|
|
|
|
attrMap = xml.parseXMLAttr(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;
|
|
|
}
|
|
|
File file2 = xml.getSXX("RB3_THPJFS", session);
|
|
|
attrMap2 = xml.parseXMLAttr(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;
|
|
|
}
|
|
|
InterfaceAIFComponent targetComp = app.getTargetComponent();
|
|
|
if (targetComp instanceof TCComponentItemRevision) {
|
|
|
targetItem = (TCComponentItemRevision) targetComp;
|
|
|
|
|
|
//<2F>Ż<EFBFBD>
|
|
|
zc_pro_map=targetItem.getProperties();
|
|
|
//end
|
|
|
}
|
|
|
init();
|
|
|
} catch (TCException e) {
|
|
|
// TODO Auto-generated catch block
|
|
|
|
|
|
MessageBox.post("init()<29><><EFBFBD><EFBFBD><EFBFBD>쳣","WARNING",MessageBox.WARNING);
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* <20><>ҳ<EFBFBD><D2B3>
|
|
|
*
|
|
|
* @throws TCException
|
|
|
*/
|
|
|
private void init() throws TCException{
|
|
|
// TODO Auto-generated method stub
|
|
|
this.setTitle(name);
|
|
|
this.setMinimumSize(new Dimension(860,900));
|
|
|
this.setPreferredSize(new Dimension(860, 900));
|
|
|
// this.setLayout(new PropertyLayout());
|
|
|
this.setLayout(new BorderLayout());
|
|
|
classJpanel = new JPanel(new PropertyLayout());// <20><><EFBFBD>Խ<EFBFBD><D4BD><EFBFBD>
|
|
|
jp1 = new JPanel(new BorderLayout());
|
|
|
jp2 = new JPanel(new PropertyLayout());
|
|
|
jp1.setPreferredSize(new Dimension(200, 820));
|
|
|
scr2 = new JScrollPane(jp2);
|
|
|
scr2.setPreferredSize(new Dimension(640, 820));
|
|
|
classJpanel.add("1.1.center.top", scr2);
|
|
|
// jp2.setPreferredSize(new Dimension(350, 600));
|
|
|
JTree tree = getTree(menuBean);
|
|
|
tree.addTreeSelectionListener(new TreeSelectionListener() {
|
|
|
public void valueChanged(TreeSelectionEvent e) {
|
|
|
// objList.clear();
|
|
|
// objList2.clear();
|
|
|
// lovList.clear();
|
|
|
// lovList2.clear();
|
|
|
classFlag = true;
|
|
|
classFlag2 = false;
|
|
|
objMap.clear();
|
|
|
objMap2.clear();
|
|
|
zc_pro_map.clear();
|
|
|
fieldList.clear();
|
|
|
comboxList.clear();
|
|
|
fieldmap.clear();
|
|
|
comboxmap.clear();
|
|
|
lovMap.clear();
|
|
|
lovMap2.clear();
|
|
|
attrList.clear();
|
|
|
esAttrList.clear();
|
|
|
attrList2.clear();
|
|
|
esAttrList2.clear();
|
|
|
classList.clear();
|
|
|
markList.clear();
|
|
|
markList2.clear();
|
|
|
isNList.clear();
|
|
|
isNList2.clear();
|
|
|
defaultValueList.clear();
|
|
|
defaultValueList2.clear();
|
|
|
jp2.removeAll();
|
|
|
idList.clear();
|
|
|
DefaultMutableTreeNode treeNode = (DefaultMutableTreeNode) e.getPath().getLastPathComponent();
|
|
|
int childCount = treeNode.getChildCount();
|
|
|
System.out.println("<22><>ǰ<EFBFBD><C7B0>ѡ<EFBFBD>еĽڵ<C4BD>: " + treeNode + " <20>ӽڵ<D3BD><DAB5><EFBFBD><EFBFBD><EFBFBD>:" + childCount);
|
|
|
if (childCount > 0) {
|
|
|
jp2.setVisible(false);
|
|
|
} else {
|
|
|
String names = getNode(treeNode, "");
|
|
|
selCodeBean = getcode.getCodebean(names);
|
|
|
if (selCodeBean == null) {
|
|
|
MessageBox.post("<22><>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD>ײ<EFBFBD><D7B2>ڵ㣡<DAB5><E3A3A1><EFBFBD><EFBFBD>", "<22><>ʾ", MessageBox.INFORMATION);
|
|
|
return;
|
|
|
}
|
|
|
JTextField idfield = new JTextField(18);
|
|
|
idList.add(idfield);
|
|
|
JComboBox<String> idbox = new JComboBox<String>();
|
|
|
|
|
|
idList.add(idbox);
|
|
|
idbox.addItem(" ");
|
|
|
String[] idstrs = new String[99];
|
|
|
for (int j = 0; j < 99; j++) {
|
|
|
if (j < 9) {
|
|
|
idstrs[j] = "0" + (j + 1);
|
|
|
} else {
|
|
|
idstrs[j] = (j + 1) + "";
|
|
|
}
|
|
|
}
|
|
|
for (int j = 0; j < idstrs.length; j++) {
|
|
|
idbox.addItem(idstrs[j]);
|
|
|
}
|
|
|
boxMap.put(PlmLocaleUtil.getString("PartNumber"), idbox);
|
|
|
revLabel = new JLabel("<22>汾<EFBFBD><E6B1BE>");
|
|
|
revBox = new JComboBox<String>();
|
|
|
revBox.setEditable(false);
|
|
|
revBox.addItem("B1");
|
|
|
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;
|
|
|
}
|
|
|
for (int i = 0; i < revs.length; i++) {
|
|
|
revBox.addItem(revs[i]);
|
|
|
}
|
|
|
nameLabel = new JLabel("<22><><EFBFBD>ƣ<EFBFBD>");
|
|
|
nameComb = new JComboBox<String>();
|
|
|
nameComb.setEditable(false);
|
|
|
|
|
|
|
|
|
nameComb.addItem("");
|
|
|
String[] lbjNames = service.getStringValues("RB3_LBJ_names");
|
|
|
if (lbjNames == null || lbjNames.length <= 0) {
|
|
|
MessageBox.post("<22><>ѡ<EFBFBD><D1A1>RB3_LBJ_namesδ<73><CEB4><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5><EFBFBD><EFBFBD>Ա!!", "<22><><EFBFBD><EFBFBD>", MessageBox.ERROR);
|
|
|
return;
|
|
|
}
|
|
|
for (int i = 0; i < lbjNames.length; i++) {
|
|
|
nameComb.addItem(lbjNames[i]);
|
|
|
}
|
|
|
|
|
|
|
|
|
//<2F>Ż<EFBFBD>
|
|
|
nameComb.setSelectedIndex(1);
|
|
|
//end<6E>Ż<EFBFBD>
|
|
|
|
|
|
|
|
|
idLabel = new JLabel("<22>ܳ<EFBFBD><DCB3><EFBFBD><EFBFBD>ϱ<EFBFBD><CFB1>룺");
|
|
|
idField1 = new JTextField(18);
|
|
|
|
|
|
|
|
|
|
|
|
//<2F>Ż<EFBFBD>
|
|
|
try {
|
|
|
idField1.setText(targetItem.getProperty("item_id"));
|
|
|
} catch (TCException e2) {
|
|
|
// TODO Auto-generated catch block
|
|
|
e2.printStackTrace();
|
|
|
}
|
|
|
//end<6E>Ż<EFBFBD>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
jp2.add("1.1.center.center", new JLabel(""));
|
|
|
jp2.add("2.1.center.center", idLabel);
|
|
|
jp2.add("2.2.center.center", idField1);
|
|
|
jp2.add("3.1.center.center", nameLabel);
|
|
|
jp2.add("3.2.center.center", nameComb);
|
|
|
jp2.add("4.1.center.center", new JLabel(PlmLocaleUtil.getString("PartNumber")));
|
|
|
jp2.add("4.2.center.center", idfield);
|
|
|
jp2.add("4.3.center.center", idbox);
|
|
|
jp2.add("5.1.center.center", revLabel);
|
|
|
jp2.add("5.2.center.center", revBox);
|
|
|
try {
|
|
|
String className = targetItem.getClassificationClass();
|
|
|
TCClassificationService classificationService = session.getClassificationService();
|
|
|
ICSAdminClass c = classificationService.newICSAdminClass();
|
|
|
System.out.println("className============" + className);
|
|
|
c.load(className);
|
|
|
ICSAdminClassAttribute[] icsAttrS = c.getAttributes();
|
|
|
// <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
TCComponentICO[] icos = targetItem.getClassificationObjects();
|
|
|
System.out.print("icos:====" + icos);
|
|
|
if (icos == null || icos.length <= 0) {
|
|
|
MessageBox.post("ѡ<>е<EFBFBD><D0B5><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD>з<EFBFBD><D0B7>͵<EFBFBD><CDB5><EFBFBD><EFBFBD>࣬<EFBFBD>뷢<EFBFBD>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD><EFBFBD>", "<22><>ʾ", MessageBox.INFORMATION);
|
|
|
return;
|
|
|
}
|
|
|
Map<String, String> claMap = new HashMap<String, String>();
|
|
|
if (icos != null && icos.length > 0) {
|
|
|
|
|
|
ICSProperty[] icss = icos[0].getICSProperties(true);
|
|
|
|
|
|
for (ICSProperty ics : icss) {
|
|
|
for (ICSAdminClassAttribute icsa : icsAttrS) {
|
|
|
if (icsa.getAttributeId() == ics.getId()) {
|
|
|
System.out.print("icsa.getName():" + icsa.getName());
|
|
|
claMap.put(icsa.getName(), ics.getValue());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
ICSAdminClass c2 = classificationService.newICSAdminClass();
|
|
|
className2 = selCodeBean.getClassID();
|
|
|
// String xmlClassName = className2.substring(0, 6);
|
|
|
System.out.println("className2===========" + className2);
|
|
|
// System.out.println("xmlClassName==========="+xmlClassName);
|
|
|
|
|
|
if (attrMap.containsKey(className2)) {
|
|
|
List<String> nameMarkList = attrMap.get(className2);
|
|
|
String attrNames = nameMarkList.get(0);
|
|
|
String marks = nameMarkList.get(1);
|
|
|
String defaultValues = nameMarkList.get(2);
|
|
|
String isN = nameMarkList.get(3);
|
|
|
if (attrNames.contains(";")) {
|
|
|
String[] attrs = attrNames.split(";");
|
|
|
String[] markss = marks.split(";");
|
|
|
String[] valuess = defaultValues.split(";");
|
|
|
String[] isNs = isN.split(";");
|
|
|
for (int i = 0; i < attrs.length; i++) {
|
|
|
System.out.println("attrs==============" + attrs[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]);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
List<String> nameMarkList2 = attrMap2.get(className2);
|
|
|
String attrNames2 = nameMarkList2.get(0);
|
|
|
String marks2 = nameMarkList2.get(1);
|
|
|
String defaultValues2 = nameMarkList2.get(2);
|
|
|
String isNs2 = nameMarkList2.get(3);
|
|
|
System.out.println("attrNames2============" + attrNames2);
|
|
|
if (attrNames2.contains(";")) {
|
|
|
String[] attrs2 = attrNames2.split(";");
|
|
|
String[] markss2 = marks2.split(";");
|
|
|
String[] valuess = defaultValues2.split(";");
|
|
|
String[] isNs2s = isNs2.split(";");
|
|
|
for (int i = 0; i < attrs2.length; i++) {
|
|
|
if (attrs2[i].contains("+")) {
|
|
|
String[] attrss = attrs2[i].split("\\+");
|
|
|
attrList2.add(attrss[0]);
|
|
|
esAttrList2.add(attrss[1]);
|
|
|
markList2.add(markss2[i]);
|
|
|
defaultValueList2.add(valuess[i]);
|
|
|
isNList2.add(isNs2s[i]);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
c2.load(className2);
|
|
|
String cName = c2.getName();
|
|
|
if (PlmLocaleUtil.getString("BearingAccessories").equals(cName)) {
|
|
|
classFlag = false;
|
|
|
} else if (PlmLocaleUtil.getString("Cage").equals(cName)) {
|
|
|
classFlag2 = true;
|
|
|
}
|
|
|
System.out.println("cName===" + cName);
|
|
|
ICSAdminClassAttribute[] icsAttrS2 = c2.getAttributes();
|
|
|
if (icsAttrS2 != null) {
|
|
|
for (ICSAdminClassAttribute attr : icsAttrS2) {
|
|
|
ClassAttributeBean bean = new ClassAttributeBean();
|
|
|
if (attr.isReferenceAttribute()) {// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
continue;
|
|
|
}
|
|
|
if (attr.isReference()) {
|
|
|
continue;
|
|
|
}
|
|
|
int propID = attr.getAttributeId();
|
|
|
bean.setId(propID);
|
|
|
String propDisName = attr.getName();
|
|
|
System.out.print("propDisName:" + propDisName);
|
|
|
bean.setName(propDisName);
|
|
|
|
|
|
int attrType = attr.getFormat1().getType();
|
|
|
bean.setType(attrType);
|
|
|
// <20><><EFBFBD>÷<EFBFBD><C3B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
if (claMap != null && claMap.containsKey(propDisName)) {
|
|
|
bean.setVal(claMap.get(propDisName));
|
|
|
} else {
|
|
|
bean.setVal("");
|
|
|
}
|
|
|
ICSKeyLov lov1 = attr.getFormat1().getKeyLov();
|
|
|
lov1 = (lov1 == null ? attr.getFormat2().getKeyLov() : lov1);
|
|
|
if (lov1 != null) {
|
|
|
bean.setIslov(true);
|
|
|
String[] keys = lov1.getKeys();
|
|
|
Map<String, String> map1 = new HashMap<String, String>();
|
|
|
for (String key : keys) {
|
|
|
String value = lov1.getValueOfKey(key);
|
|
|
map1.put(value, key);// <<3C><>ʾֵ,<2C><>ʵֵ>
|
|
|
if (key.equals(bean.getVal()) && (!bean.getVal().equals(""))) {
|
|
|
bean.setVal(value);
|
|
|
}
|
|
|
}
|
|
|
bean.setLov(map1);
|
|
|
} else {
|
|
|
bean.setIslov(false);
|
|
|
}
|
|
|
|
|
|
classList.add(bean);
|
|
|
|
|
|
}
|
|
|
}
|
|
|
} catch (TCException e1) {
|
|
|
e1.printStackTrace();
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
labels1 = new JLabel[classList.size()];
|
|
|
System.out.print("classList.size():" + classList.size());
|
|
|
for (int i = 0; i < classList.size(); i++) {
|
|
|
ClassAttributeBean bean = classList.get(i);
|
|
|
String attrName = bean.getName();
|
|
|
labels1[i] = new JLabel(attrName);
|
|
|
jp2.add((i + 6) + ".1.center.top", labels1[i]);
|
|
|
labels1[i].setBounds(5, 5, 5, 5);
|
|
|
String value = bean.getVal();
|
|
|
System.out.println("Ĭ<><C4AC>ֵΪ:"+value);
|
|
|
if (bean.isIslov()) {
|
|
|
comb = new JComboBox<String>();
|
|
|
comb.setEditable(false);
|
|
|
comb.setSize(new Dimension(60, 40));
|
|
|
if (classFlag2) {
|
|
|
if ((PlmLocaleUtil.getString("heatTreatment")).equals(attrName)) {
|
|
|
comb.addItem("");
|
|
|
HeatTreatment = value;
|
|
|
}else {
|
|
|
comb.addItem(value);
|
|
|
}
|
|
|
} else {
|
|
|
comb.addItem(value);
|
|
|
}
|
|
|
for (Entry<String, String> entry : bean.getLov().entrySet()) {
|
|
|
if(i == 0) {
|
|
|
System.out.println("entry.getKey()===="+entry.getKey());
|
|
|
}
|
|
|
if (!(value.equals(entry.getKey()))) {
|
|
|
comb.addItem(entry.getKey());
|
|
|
}
|
|
|
}
|
|
|
map2 = new HashMap<String, Object>();
|
|
|
map2.put("JComboBox", comb);
|
|
|
values.add(map2);
|
|
|
jp2.add((i + 6) + ".2.center.top", comb);
|
|
|
if (attrList.contains(attrName) || esAttrList.contains(attrName)) {
|
|
|
objMap.put(attrName, comb);
|
|
|
lovMap.put(attrName, "yes");
|
|
|
}
|
|
|
if (attrList2.contains(attrName) || esAttrList2.contains(attrName)) {
|
|
|
objMap2.put(attrName, comb);
|
|
|
lovMap2.put(attrName, "yes");
|
|
|
}
|
|
|
if ((PlmLocaleUtil.getString("Category")).equals(attrName)) {
|
|
|
typeList.add(comb);
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
JTextField field = new JTextField(18);
|
|
|
field.setText(value);
|
|
|
map2 = new HashMap<String, Object>();
|
|
|
map2.put("JTextField", field);
|
|
|
values.add(map2);
|
|
|
jp2.add((i + 6) + ".2.center.top", field);
|
|
|
if ((PlmLocaleUtil.getString("RadialInternalClearance")).equals(attrName)) {
|
|
|
JComboBox<String> box = new JComboBox<String>();
|
|
|
box.addItem(" ");
|
|
|
String[] strs = new String[] { "C0", "C2", "C3", "C4", "C5" };
|
|
|
for (int j = 0; j < strs.length; j++) {
|
|
|
box.addItem(strs[j]);
|
|
|
}
|
|
|
boxMap.put(attrName, box);
|
|
|
jp2.add((i + 6) + ".3.center.top", box);
|
|
|
}
|
|
|
if (attrList.contains(attrName) || esAttrList.contains(attrName)) {
|
|
|
objMap.put(attrName, field);
|
|
|
lovMap.put(attrName, "no");
|
|
|
}
|
|
|
if (attrList2.contains(attrName) || esAttrList2.contains(attrName)) {
|
|
|
objMap2.put(attrName, field);
|
|
|
lovMap2.put(attrName, "no");
|
|
|
}
|
|
|
}
|
|
|
v=i+7;
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//<2F>Ż<EFBFBD>
|
|
|
jp2.add(v+".1.center.top",new JLabel("***<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>***"));
|
|
|
v+=1;
|
|
|
// for(String s:lishu_lov.keySet()) {
|
|
|
// String val = lishu_lov.get(s);
|
|
|
// jp2.add(v+".1.center.top",new JLabel(val));
|
|
|
// JComboBox lishu_comb=new JComboBox();
|
|
|
// lishu_comb.setEditable(false);
|
|
|
// lishu_comb.setSize(new Dimension(60,40));
|
|
|
// try {
|
|
|
// TCProperty zcLov_val = targetItem.getTCProperty(s);
|
|
|
// TCComponentListOfValues lov_val = zcLov_val.getLOV();
|
|
|
// if(lov_val!=null) {
|
|
|
// String[] comboxitems=lov_val.getListOfValues().getLOVDisplayValues();
|
|
|
// ComboBoxModel model = new DefaultComboBoxModel(comboxitems);
|
|
|
// lishu_comb.setModel(model);
|
|
|
// comboxList.add(lishu_comb);
|
|
|
// }
|
|
|
// lishu_comb.setSelectedItem(zc_pro_map.get(s));
|
|
|
// jp2.add(v+".2.center.top",lishu_comb);
|
|
|
// } catch (TCException e1) {
|
|
|
// // TODO Auto-generated catch block
|
|
|
// e1.printStackTrace();
|
|
|
// }
|
|
|
// lishu_comb.setName(s);
|
|
|
// v++;
|
|
|
// }
|
|
|
// for(String m:lishu.keySet()) {
|
|
|
// String val=lishu.get(m);
|
|
|
// jp2.add(v+".1.center.top",new JLabel(val));
|
|
|
// JTextField jf=new JTextField(18);
|
|
|
// jf.setName(m);
|
|
|
// jf.setText(zc_pro_map.get(m));
|
|
|
// fieldList.add(jf);
|
|
|
// jp2.add(v+".2.center.top",jf);
|
|
|
// v++;
|
|
|
// }
|
|
|
for(int i=0;i<ZC_LBJ_list.LBJPros.size();i++) {
|
|
|
|
|
|
System.out.println("ѭ<><D1AD><EFBFBD><EFBFBD>"+i+"<22><>,<2C><>Ҫ<EFBFBD><D2AA><EFBFBD>ӵ<EFBFBD><D3B5><EFBFBD><EFBFBD><EFBFBD>Ϊ"+ZC_LBJ_list.LBJDisPros.get(i)+"("+ZC_LBJ_list.LBJPros.get(i)+")");
|
|
|
jp2.add((v)+".1.center.top",new JLabel(ZC_LBJ_list.LBJDisPros.get(i)));
|
|
|
boolean b = ZC_LBJ_list.map.containsKey(ZC_LBJ_list.LBJPros.get(i));
|
|
|
try {
|
|
|
if(b) {
|
|
|
|
|
|
System.out.println("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Lov<6F><76><EFBFBD><EFBFBD>");
|
|
|
if(ZC_LBJ_list.LBJPros.get(i).equals("rb3_scgc1")) {
|
|
|
System.out.println("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
String[] vals = ((TCComponentItemRevision) targetItem).getTCProperty("rb3_scgc1").getStringValueArray();
|
|
|
JComboBox nbox=new RwJComboBox(new String[] {""});
|
|
|
nbox.setEditable(true);
|
|
|
TCProperty zclov = ((TCComponentItemRevision) targetItem).getTCProperty(ZC_LBJ_list.LBJPros.get(i));
|
|
|
TCComponentListOfValues zcprolov = zclov.getLOV();
|
|
|
List<String> disVal=null;
|
|
|
String[] comboxitems;
|
|
|
for(int a=0;a<vals.length;a++) {
|
|
|
if(vals[a]!=null && !vals[a].equals("")) {
|
|
|
String disname = zcprolov.getListOfValues().getDisplayableValue(vals[a]);
|
|
|
disVal=new ArrayList<String>();
|
|
|
disVal.add(disname);
|
|
|
}
|
|
|
}
|
|
|
if(zcprolov!=null) {
|
|
|
comboxitems = zcprolov.getListOfValues().getLOVDisplayValues();
|
|
|
//ComboBoxModel model = new DefaultComboBoxModel(comboxitems);
|
|
|
|
|
|
nbox=new RwJComboBox(comboxitems);
|
|
|
nbox.setEditable(true);
|
|
|
nbox.setName("rb3_scgc1");
|
|
|
nbox.setSize(new Dimension(60,40));
|
|
|
if(disVal.size()>0) {
|
|
|
StringBuilder sb=new StringBuilder();
|
|
|
for(int t=0;t<disVal.size();t++) {
|
|
|
if(t!=(vals.length-1)) {
|
|
|
|
|
|
sb.append(disVal.get(t));
|
|
|
sb.append(",");
|
|
|
}else {
|
|
|
sb.append(disVal.get(t));
|
|
|
}
|
|
|
}
|
|
|
JTextField ed=(JTextField)nbox.getEditor().getEditorComponent();
|
|
|
ed.setText(sb.toString());
|
|
|
}
|
|
|
comboxList.add(nbox);
|
|
|
}
|
|
|
|
|
|
jp2.add(v+".2.center.top",nbox);
|
|
|
}else {
|
|
|
JComboBox zcBox=new JComboBox<String>();
|
|
|
zcBox.setSize(new Dimension(60,40));
|
|
|
zcBox.setName(ZC_LBJ_list.LBJPros.get(i));
|
|
|
TCProperty zclov = ((TCComponentItemRevision) targetItem).getTCProperty(ZC_LBJ_list.LBJPros.get(i));
|
|
|
TCComponentListOfValues zcprolov = zclov.getLOV();
|
|
|
String[] comboxitems;
|
|
|
if(zcprolov!=null) {
|
|
|
comboxitems = zcprolov.getListOfValues().getLOVDisplayValues();
|
|
|
ComboBoxModel model = new DefaultComboBoxModel(comboxitems);
|
|
|
zcBox.setModel(model);
|
|
|
comboxList.add(zcBox);
|
|
|
}
|
|
|
|
|
|
zcBox.setSelectedItem(zc_pro_map.get(ZC_LBJ_list.LBJPros.get(i)));
|
|
|
if(!(ZC_LBJ_list.LBJDisPros.get(i)).equals("<22><>ʱ<EFBFBD><CAB1><EFBFBD>ϱ<EFBFBD>ʶ")) {
|
|
|
zcBox.setSelectedIndex(-1);
|
|
|
}
|
|
|
|
|
|
jp2.add(v+".2.center.top",zcBox);
|
|
|
}
|
|
|
}else {
|
|
|
JTextField field=new JTextField(18);
|
|
|
field.setName(ZC_LBJ_list.LBJPros.get(i));
|
|
|
if((ZC_LBJ_list.LBJDisPros.get(i)).equals("<22><><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD>")) {
|
|
|
field.setText(zc_pro_map.get(ZC_LBJ_list.LBJPros.get(i)));
|
|
|
}
|
|
|
jp2.add(v+".2.center.top",field);
|
|
|
fieldList.add(field);
|
|
|
}
|
|
|
} catch (TCException e1) {
|
|
|
// TODO Auto-generated catch block
|
|
|
e1.printStackTrace();
|
|
|
}
|
|
|
v++;
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
jp2.setVisible(true);
|
|
|
jp2.validate();
|
|
|
jp2.repaint();
|
|
|
scr2.validate();
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
JScrollPane scrollPane = new JScrollPane(tree);
|
|
|
scrollPane.setPreferredSize(new Dimension(250, 250));
|
|
|
;
|
|
|
// <20><><EFBFBD>ӹ<EFBFBD><D3B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>嵽<EFBFBD><E5B5BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
jp1.add(scrollPane, BorderLayout.CENTER);
|
|
|
//jp2.setVisible(false);
|
|
|
classJpanel.add("1.1.center.top", scr2);
|
|
|
JSplitPane splitPane = new JSplitPane();
|
|
|
splitPane.setOneTouchExpandable(true);// <20>÷ָ<C3B7><D6B8><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>ͷ
|
|
|
splitPane.setContinuousLayout(true);// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7><EFBFBD>ػ<EFBFBD>ͼ<EFBFBD><CDBC>
|
|
|
splitPane.setLeftComponent(jp1);
|
|
|
splitPane.setRightComponent(classJpanel);
|
|
|
JPanel titlePanel = new JPanel(new PropertyLayout());// <20><><EFBFBD>Խ<EFBFBD><D4BD><EFBFBD>
|
|
|
|
|
|
titlePanel.add("1.1.center.center", new JLabel(" "));
|
|
|
titlePanel.add("1.2.center.center", new JLabel(" "));
|
|
|
titlePanel.add("1.3.center.center", button2);
|
|
|
titlePanel.add("1.4.center.center", new JLabel(" "));
|
|
|
titlePanel.add("1.5.center.center", new JLabel(" "));
|
|
|
titlePanel.add("1.6.center.center", okBut);
|
|
|
titlePanel.add("1.7.center.center", new JLabel(" "));
|
|
|
titlePanel.add("1.8.center.center", new JLabel(" "));
|
|
|
titlePanel.add("1.9.center.center", celBut);
|
|
|
this.add(splitPane, BorderLayout.NORTH);
|
|
|
this.add(titlePanel, BorderLayout.CENTER);
|
|
|
// add("1.1.center.center", splitPane);
|
|
|
// add("1.1.center.center", jp1);
|
|
|
// add("1.2.center.center", classJpanel);
|
|
|
// add("2.1.center.center", button2);
|
|
|
// add("2.2.center.center", okBut);
|
|
|
// add("2.3.center.center", celBut);
|
|
|
|
|
|
button2.addActionListener(new ActionListener() {
|
|
|
public void actionPerformed(ActionEvent e) {
|
|
|
// TODO Auto-generated method stub
|
|
|
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();
|
|
|
}
|
|
|
});
|
|
|
|
|
|
okBut.addActionListener(new ActionListener() {
|
|
|
|
|
|
public void actionPerformed(ActionEvent e) {
|
|
|
// TODO Auto-generated method stub
|
|
|
createItem();
|
|
|
// setVisible(false);
|
|
|
}
|
|
|
|
|
|
});
|
|
|
celBut.addActionListener(new ActionListener() {
|
|
|
|
|
|
public void actionPerformed(ActionEvent e) {
|
|
|
// TODO Auto-generated method stub
|
|
|
System.out.println("ȡ<><C8A1>");
|
|
|
setVisible(false);
|
|
|
}
|
|
|
});
|
|
|
this.setVisible(true);
|
|
|
this.centerToScreen();
|
|
|
// this.pack();
|
|
|
}
|
|
|
|
|
|
/*
|
|
|
* <20><><EFBFBD>ϴ<EFBFBD><CFB4><EFBFBD>
|
|
|
*/
|
|
|
public void createItem() {
|
|
|
// TODO Auto-generated method stub
|
|
|
String jhID = "";
|
|
|
try {
|
|
|
if (idList != null && idList.size() > 0) {
|
|
|
JTextField idField = (JTextField) idList.get(0);
|
|
|
JComboBox<String> idbox = (JComboBox<String>) idList.get(1);
|
|
|
String id = idField.getText();
|
|
|
String boxID = (String) idbox.getSelectedItem();
|
|
|
// if ("".equals(id.trim()) && "".equals(boxID.trim())) {
|
|
|
// MessageBox.post("<22><><EFBFBD><EFBFBD>δ<EFBFBD><CEB4>д<EFBFBD><D0B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "<22><>ʾ", MessageBox.INFORMATION);
|
|
|
// return;
|
|
|
// }
|
|
|
if ("".equals(id.trim())) {
|
|
|
id = boxID.trim();
|
|
|
}
|
|
|
jhID = id;
|
|
|
}
|
|
|
String typeID = "";
|
|
|
if (typeList != null && typeList.size() > 0) {
|
|
|
JComboBox idComb = typeList.get(0);
|
|
|
typeID = (String) idComb.getSelectedItem();
|
|
|
if (typeID.indexOf("<22><>Ʒ<EFBFBD><C6B7>") >= 0 || typeID.indexOf("Finished product") >= 0) {
|
|
|
typeID = "";
|
|
|
} else if (typeID.indexOf("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>") >= 0 || typeID.indexOf("Turning workpiece") >= 0) {
|
|
|
typeID = "C";
|
|
|
} else if (typeID.indexOf("<22>ȴ<EFBFBD><C8B4><EFBFBD><EFBFBD><EFBFBD>") >= 0 || typeID.indexOf("Heat treatment parts") >= 0) {
|
|
|
typeID = "R";
|
|
|
} else if (typeID.indexOf("<22><>շ<EFBFBD><D5B7><EFBFBD><EFBFBD><EFBFBD>伷<EFBFBD><E4BCB7>") >= 0
|
|
|
|| typeID.indexOf("Cold rolled parts or cold extrusion parts") >= 0) {
|
|
|
typeID = "D";
|
|
|
} else if (typeID.indexOf("<22>ͼ<EFBFBD>") >= 0 || typeID.indexOf("Forge piece") >= 0) {
|
|
|
typeID = "D";
|
|
|
}
|
|
|
}
|
|
|
String item_type = "";
|
|
|
if (selCodeBean != null) {
|
|
|
item_type = selCodeBean.getType();
|
|
|
} else {
|
|
|
MessageBox.post("<22><>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD>ײ<EFBFBD><D7B2>ڵ㣡<DAB5><E3A3A1><EFBFBD><EFBFBD>", "<22><>ʾ", MessageBox.INFORMATION);
|
|
|
return;
|
|
|
}
|
|
|
String targetId = idField1.getText();
|
|
|
if ("".equals(targetId.trim())) {
|
|
|
MessageBox.post("<22><><EFBFBD><EFBFBD>д<EFBFBD>ܳ<EFBFBD><DCB3><EFBFBD><EFBFBD>ϱ<EFBFBD><CFB1>ţ<EFBFBD><C5A3><EFBFBD><EFBFBD><EFBFBD>", "<22><>ʾ", MessageBox.INFORMATION);
|
|
|
return;
|
|
|
}
|
|
|
String newID = targetId + jhID + typeID;
|
|
|
String revID = (String) revBox.getSelectedItem();
|
|
|
String itemName = (String) nameComb.getSelectedItem();
|
|
|
|
|
|
// List<String> asList = Arrays.asList(lovVal);
|
|
|
// List<String> esList = Arrays.asList(esLovVal);
|
|
|
// 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()))) {
|
|
|
// JComboBox<String> box = null;
|
|
|
// if((PlmLocale.getString("RadialInternalClearance")).equals(attr)
|
|
|
// || (PlmLocale.getString("PartNumber")).equals(attr)) {
|
|
|
// box = boxMap.get(attr);
|
|
|
// }
|
|
|
// Object obj = objMap.get(attr);
|
|
|
// if(obj == null) {
|
|
|
// JTextField field = (JTextField)objMap.get(esAttr);
|
|
|
// if(box != null) {
|
|
|
// String fieldText = field.getText();
|
|
|
// String boxText = (String) box.getSelectedItem();
|
|
|
// 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()))) {
|
|
|
// objList.add(field);
|
|
|
// lovList.add("no");
|
|
|
// }else {
|
|
|
// objList.add(box);
|
|
|
// lovList.add("yes");
|
|
|
// }
|
|
|
// }else {
|
|
|
// objList.add(field);
|
|
|
// lovList.add(lovMap.get(esAttr));
|
|
|
// }
|
|
|
// }else {
|
|
|
// if(box != null) {
|
|
|
// JTextField field = (JTextField)obj;
|
|
|
// String fieldText = field.getText();
|
|
|
// String boxText = (String) box.getSelectedItem();
|
|
|
// 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()))) {
|
|
|
// 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 < attrList2.size(); i++) {
|
|
|
// String attr = attrList2.get(i);
|
|
|
// String esAttr = esAttrList2.get(i);
|
|
|
// if(!("".equals(attr.trim()))) {
|
|
|
// JComboBox<String> box = null;
|
|
|
// if((PlmLocale.getString("RadialInternalClearance")).equals(attr)
|
|
|
// || (PlmLocale.getString("PartNumber")).equals(attr)) {
|
|
|
// box = boxMap.get(attr);
|
|
|
// }
|
|
|
// Object obj = objMap2.get(attr);
|
|
|
// if(obj == null) {
|
|
|
// JTextField field = (JTextField)objMap.get(esAttr);
|
|
|
// if(box != null) {
|
|
|
// String fieldText = field.getText();
|
|
|
// String boxText = (String) box.getSelectedItem();
|
|
|
// 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(field);
|
|
|
// lovList2.add(lovMap2.get(esAttr));
|
|
|
// }
|
|
|
// }else {
|
|
|
// if(box != null) {
|
|
|
// JTextField field = (JTextField)obj;
|
|
|
// String fieldText = field.getText();
|
|
|
// String boxText = (String) box.getSelectedItem();
|
|
|
// 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));
|
|
|
// }
|
|
|
// }
|
|
|
// }
|
|
|
// }
|
|
|
// for (int i = 0; i < objList.size(); i++) {
|
|
|
// String attrValue = "";
|
|
|
// if("yes".equals(lovList.get(i))) {
|
|
|
// String value = (String) ((JComboBox<String>)
|
|
|
// objList.get(i)).getSelectedItem();
|
|
|
// 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 = ((JTextField) objList.get(i)).getText();
|
|
|
// }
|
|
|
// String mark = markList.get(i);
|
|
|
// sb.append(mark.trim());
|
|
|
// sb.append(attrValue);
|
|
|
// System.out.println("attrValue=============="+attrValue);
|
|
|
// }
|
|
|
// productNumber = sb.toString();
|
|
|
// System.out.println("productNumber============"+productNumber);
|
|
|
// StringBuilder sb2 = new StringBuilder();
|
|
|
//
|
|
|
// for (int i = 0; i < objList2.size(); i++) {
|
|
|
// String attrValue = "";
|
|
|
// if("yes".equals(lovList2.get(i))) {
|
|
|
// String value = (String) ((JComboBox<String>)
|
|
|
// objList2.get(i)).getSelectedItem();
|
|
|
// 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 = ((JTextField) objList2.get(i)).getText();
|
|
|
// }
|
|
|
// System.out.println("attrValue11111=============="+attrValue);
|
|
|
// String mark = markList2.get(i);
|
|
|
// sb2.append(mark.trim());
|
|
|
// sb2.append(attrValue);
|
|
|
// }
|
|
|
// drawingNumber = sb2.toString();
|
|
|
// System.out.println("drawingNumber============"+drawingNumber);
|
|
|
if (classFlag) {
|
|
|
productNumber = splicValue(defaultValueList, attrList, esAttrList, objMap, markList,isNList,lovMap);
|
|
|
drawingNumber = splicValue(defaultValueList2, attrList2, esAttrList2, objMap2, markList2,isNList2, lovMap2);
|
|
|
|
|
|
System.out.println("productNumber============" + productNumber);
|
|
|
System.out.println("drawingNumber============" + drawingNumber);
|
|
|
if (productNumber == null || drawingNumber == null) {
|
|
|
return;
|
|
|
}
|
|
|
} else {
|
|
|
productNumber = targetItem.getStringProperty("rb3_th") + jhID;
|
|
|
drawingNumber = targetItem.getStringProperty("rb3_th") + jhID;
|
|
|
System.out.println("productNumber============" + productNumber);
|
|
|
System.out.println("drawingNumber============" + drawingNumber);
|
|
|
}
|
|
|
|
|
|
|
|
|
TCComponentItemType itemType = (TCComponentItemType) session.getTypeComponent(item_type);
|
|
|
TCComponentItem find = itemType.find(newID);
|
|
|
if (find != null) {
|
|
|
MessageBox.post("<22><><EFBFBD><EFBFBD>:" + newID + "<22>Ѵ<EFBFBD><D1B4><EFBFBD>,<2C><EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD>!", "<22><><EFBFBD><EFBFBD>",
|
|
|
MessageBox.ERROR);
|
|
|
return;
|
|
|
}
|
|
|
//<2F>Ż<EFBFBD>
|
|
|
List<TCComponent> compList = queryObject("RBSearchLBJCPH", new String[] { "<22><>Ʒ<EFBFBD><C6B7>" },
|
|
|
new String[] { productNumber });
|
|
|
if (compList != null) {
|
|
|
if (compList.size() > 0) {
|
|
|
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>
|
|
|
TCComponentItem itemComp = itemType.create(newID, revID, item_type, itemName, null, null);
|
|
|
if (itemComp != null) {
|
|
|
session.getUser().getHomeFolder().add("contents", itemComp);
|
|
|
session.getUser().getHomeFolder().refresh();
|
|
|
}
|
|
|
TCComponentItemRevision itemRev = itemComp.getLatestItemRevision();
|
|
|
|
|
|
|
|
|
//<2F>Ż<EFBFBD>
|
|
|
for(int k=0;k<fieldList.size();k++){
|
|
|
JTextField jt = (JTextField)fieldList.get(k);
|
|
|
String key=jt.getName();
|
|
|
String val=jt.getText();
|
|
|
fieldmap.put(key, val);
|
|
|
}
|
|
|
for(int m=0;m<comboxList.size();m++) {
|
|
|
JComboBox cbo=(JComboBox)comboxList.get(m);
|
|
|
cbo.setEditable(false);
|
|
|
String key=cbo.getName();
|
|
|
System.out.println("combox<6F><78>NameΪ:"+key);
|
|
|
|
|
|
if(key.equals("rb3_scgc1")) {
|
|
|
JTextField ed=(JTextField)cbo.getEditor().getEditorComponent();
|
|
|
String text = ed.getText();
|
|
|
|
|
|
if(!text.equals("") && text!=null) {
|
|
|
List<String> proList=new ArrayList<>();
|
|
|
String[] split = text.split(",");
|
|
|
TCProperty tclov = ((TCComponentItemRevision) targetItem).getTCProperty(key);
|
|
|
TCComponentListOfValues lov = tclov.getLOV();
|
|
|
for(int p=0;p<split.length;p++) {
|
|
|
String realVal=(String)lov.getListOfValues().getRealValue(split[p]);
|
|
|
proList.add(realVal);
|
|
|
}
|
|
|
String[] array = (String[])proList.toArray();
|
|
|
itemRev.getTCProperty("rb3_scgc1").setStringValueArray(array);
|
|
|
}
|
|
|
}else {
|
|
|
String val=(String) cbo.getSelectedItem();
|
|
|
TCProperty tclov = ((TCComponentItemRevision)targetItem).getTCProperty(key);
|
|
|
TCComponentListOfValues lov = tclov.getLOV();
|
|
|
String realVal = (String)lov.getListOfValues().getRealValue(val);
|
|
|
System.out.println("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD>е<EFBFBD>ֵΪ:"+val);
|
|
|
comboxmap.put(key,realVal);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
itemRev.setProperties(fieldmap);
|
|
|
itemRev.setProperties(comboxmap);
|
|
|
|
|
|
//end<6E>Ż<EFBFBD>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String statu = "";
|
|
|
if ("A1".equals(revID)) {
|
|
|
statu = "<22><>:Conceptual design";
|
|
|
} else if ("B1".equals(revID)) {
|
|
|
statu = "<22><>:Product design";
|
|
|
} else if ("R1".equals(revID)) {
|
|
|
statu = "<22><>:Process design/Sample delivery";
|
|
|
} else if ("P1".equals(revID)) {
|
|
|
statu = "P:Pilot production/small batch";
|
|
|
} else if ("M1".equals(revID)) {
|
|
|
statu = "M:Mass production";
|
|
|
}
|
|
|
|
|
|
itemRev.setStringProperty("rb3_cph", productNumber);
|
|
|
itemRev.setStringProperty("rb3_smzqzt", statu);
|
|
|
itemRev.setStringProperty("rb3_jh", jhID);
|
|
|
|
|
|
if("RB3_GNLBJ".equals(item_type)) {
|
|
|
itemRev.setStringProperty("rb3_glh", drawingNumber);
|
|
|
}else {
|
|
|
itemRev.setStringProperty("rb3_th", drawingNumber);
|
|
|
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_CGT");
|
|
|
// 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_CGT", "", "", null);
|
|
|
CPTRev = CPTItem.getLatestItemRevision();
|
|
|
if (CPTItem != null) {
|
|
|
session.getUser().getHomeFolder().add("contents", CPTItem);
|
|
|
session.getUser().getHomeFolder().refresh();
|
|
|
}
|
|
|
}
|
|
|
CPTRev.setStringProperty("rb3_th", drawingNumber);
|
|
|
itemRev.add("TC_Is_Represented_By", CPTRev);
|
|
|
// CPTRev.add("RB3_GLWL", itemRev);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
List<String> vals = new ArrayList<String>();
|
|
|
for (Map<String, Object> value : values) {
|
|
|
for (Map.Entry<String, Object> entry : value.entrySet()) {
|
|
|
String type = entry.getKey();
|
|
|
if (type.equals("JComboBox")) {
|
|
|
JComboBox<String> comb1 = (JComboBox<String>) entry.getValue();
|
|
|
String val = (String) comb1.getSelectedItem();
|
|
|
vals.add(val);
|
|
|
} else {
|
|
|
JTextField field1 = (JTextField) entry.getValue();
|
|
|
String val = field1.getText();
|
|
|
vals.add(val);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
Integer[] classKeys = new Integer[classList.size()];
|
|
|
String[] classVals = new String[classList.size()];
|
|
|
System.out.println("size============================" + classList.size());
|
|
|
for (int i = 0; i < labels1.length; i++) {
|
|
|
String val = vals.get(i);
|
|
|
if (val == null || val.trim() == "") {
|
|
|
continue;
|
|
|
}
|
|
|
String val2 = "";
|
|
|
if (classList.get(i).isIslov()) {
|
|
|
val2 = classList.get(i).getLov().get(val);// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʵֵ
|
|
|
System.out.println("val2================" + val2);
|
|
|
System.out.println("val================" + val);
|
|
|
} else {
|
|
|
val2 = val;
|
|
|
}
|
|
|
classKeys[i] = classList.get(i).getId();
|
|
|
String attrName = classList.get(i).getName();
|
|
|
if ((PlmLocaleUtil.getString("RadialInternalClearance")).equals(attrName)
|
|
|
|| (PlmLocaleUtil.getString("PartNumber")).equals(attrName)) {
|
|
|
if ("".equals(val2.trim())) {
|
|
|
JComboBox<String> box = boxMap.get(attrName);
|
|
|
val2 = (String) box.getSelectedItem();
|
|
|
}
|
|
|
}
|
|
|
classVals[i] = val2;
|
|
|
}
|
|
|
TCTypeService typeService = session.getTypeService();
|
|
|
TCComponentBOMWindowType winType = (TCComponentBOMWindowType) typeService.getTypeComponent("BOMWindow");
|
|
|
// <20><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD>µ<EFBFBD>window
|
|
|
TCComponentBOMWindow view = winType.create(null);
|
|
|
view.lock();
|
|
|
// <20><><EFBFBD>ö<EFBFBD><C3B6><EFBFBD><EFBFBD><EFBFBD>bomline
|
|
|
TCComponentBOMLine line = view.setWindowTopLine(targetItem.getItem(), targetItem, null, null);
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>bomline
|
|
|
TCComponentBOMLine childBomline = line.add(itemComp, itemRev, null, false, "");
|
|
|
// <20><><EFBFBD><EFBFBD>
|
|
|
view.save();
|
|
|
// <20><><EFBFBD><EFBFBD>
|
|
|
view.unlock();
|
|
|
// <20>ر<EFBFBD>
|
|
|
view.close();
|
|
|
sendObjToClassficationByWebService(className2, itemRev, classKeys, classVals, url);// <20><><EFBFBD>ͷ<EFBFBD><CDB7><EFBFBD>
|
|
|
MessageBox.post("<22><><EFBFBD>ϴ<EFBFBD><CFB4><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "<22><><EFBFBD><EFBFBD>", MessageBox.INFORMATION);
|
|
|
|
|
|
setVisible(false);
|
|
|
|
|
|
} catch (Exception e2) {
|
|
|
// TODO: handle exception
|
|
|
e2.printStackTrace();
|
|
|
MessageBox.post("<22><><EFBFBD>ϴ<EFBFBD><CFB4><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD><DCA3><EFBFBD><EFBFBD><EFBFBD>", "<22><><EFBFBD><EFBFBD>", MessageBox.INFORMATION);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD>ǰTreeNode<64>ĸ<EFBFBD>-<2D><><EFBFBD><EFBFBD><EFBFBD>ƻ<EFBFBD><C6BB><EFBFBD>
|
|
|
*
|
|
|
* @param treeNode <20><><EFBFBD>ڵ<EFBFBD>
|
|
|
* @param names <20><><EFBFBD>ƻ<EFBFBD><C6BB><EFBFBD>
|
|
|
* @return
|
|
|
*/
|
|
|
private String getNode(TreeNode treeNode, String names) {
|
|
|
// TODO Auto-generated method stub
|
|
|
if (!names.equals("")) {
|
|
|
names = "&" + names;
|
|
|
}
|
|
|
names = treeNode.toString() + names;
|
|
|
|
|
|
TreeNode parent = treeNode.getParent();
|
|
|
if (parent != null) {
|
|
|
return getNode(parent, names);
|
|
|
}
|
|
|
|
|
|
return names;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
*
|
|
|
* @param menuBean1
|
|
|
* @return
|
|
|
*/
|
|
|
private JTree getTree(MenuBean menuBean1) {
|
|
|
// TODO Auto-generated method stub
|
|
|
String treenodename = menuBean1.getName();
|
|
|
List<MenuBean> list = menuBean1.getList();
|
|
|
DefaultMutableTreeNode rootNode = new DefaultMutableTreeNode(treenodename);
|
|
|
if (list != null && list.size() > 0) {
|
|
|
for (int i = 0; i < list.size(); i++) {
|
|
|
getRecursion(list.get(i), rootNode);
|
|
|
}
|
|
|
}
|
|
|
JTree tree = new JTree(rootNode);
|
|
|
tree.setShowsRootHandles(true);
|
|
|
// tree.setEditable(true);
|
|
|
|
|
|
return tree;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* <20>ݹ<EFBFBD><DDB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD><CBB5>ṹ
|
|
|
*
|
|
|
* @param menuBean1
|
|
|
* @param rootNode
|
|
|
*/
|
|
|
private void getRecursion(MenuBean menuBean1, DefaultMutableTreeNode rootNode) {
|
|
|
// TODO Auto-generated method stub
|
|
|
String treenodename = menuBean1.getName();
|
|
|
List<MenuBean> list = menuBean1.getList();
|
|
|
DefaultMutableTreeNode node = new DefaultMutableTreeNode(treenodename);
|
|
|
rootNode.add(node);
|
|
|
if (list != null && list.size() > 0) {
|
|
|
for (int i = 0; i < list.size(); i++) {
|
|
|
getRecursion(list.get(i), node);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* ͨ<><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;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* <20><><EFBFBD>ͷ<EFBFBD><CDB7><EFBFBD>
|
|
|
*/
|
|
|
public void sendObjToClassficationByWebService(String class_id, TCComponentItemRevision rev, Integer[] keys,
|
|
|
String[] vals, String url) {
|
|
|
|
|
|
try {
|
|
|
System.out.println("class_id-----dddddd----->" + class_id);
|
|
|
if (!class_id.replace(" ", "").equals("")) {
|
|
|
|
|
|
List<ClassProperty> propList = new ArrayList<ClassProperty>();
|
|
|
|
|
|
for (int i = 0; i < keys.length; i++) {
|
|
|
if (keys[i] != null && vals[i] != null) {
|
|
|
ClassProperty prop = new ClassProperty(keys[i], vals[i]);// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
propList.add(prop);
|
|
|
}
|
|
|
}
|
|
|
String json = SoaServerUtil.objectToJson(propList);// <20><>Java<76><61><EFBFBD><EFBFBD>ת<EFBFBD><D7AA>Ϊjson<6F><6E><EFBFBD><EFBFBD>
|
|
|
SoaServerUtil.sendToClass(rev.getUid(), class_id, json, url);// <20><><EFBFBD>͵<EFBFBD><CDB5><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
SoaServerUtil.grantReadPrivilege(session, rev);// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȩ<EFBFBD><C8A8>
|
|
|
}
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public String splicValue(List<String> defaultValueList, List<String> attrList, List<String> esAttrList,
|
|
|
Map<String, Object> map, List<String> markList,List<String> isNList, Map<String, String> lovMap) {
|
|
|
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);
|
|
|
System.out.println("attr======112" + attr);
|
|
|
String esAttr = esAttrList.get(i);
|
|
|
if (classFlag2) {
|
|
|
if ((PlmLocaleUtil.getString("heatTreatment")).equals(attr)
|
|
|
|| (PlmLocaleUtil.getString("heatTreatment")).equals(esAttr)) {
|
|
|
objList.add(HeatTreatment);
|
|
|
lovList.add("string");
|
|
|
continue;
|
|
|
}
|
|
|
}
|
|
|
if (map.get(attr) == null && map.get(esAttr) == null) {
|
|
|
if ((PlmLocaleUtil.getString("PartNumber")).equals(attr)
|
|
|
|| (PlmLocaleUtil.getString("PartNumber")).equals(esAttr)) {
|
|
|
JComboBox<String> idbox = boxMap.get(PlmLocaleUtil.getString("PartNumber"));
|
|
|
JTextField idfield = (JTextField) idList.get(0);
|
|
|
String fieldText = idfield.getText();
|
|
|
String boxText = (String) idbox.getSelectedItem();
|
|
|
if (!("".equals(fieldText.trim())) && !("".equals(boxText.trim()))) {
|
|
|
MessageBox.post(PlmLocaleUtil.getString("PartNumber") + "<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(PlmLocaleUtil.getString("PartNumber") + "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>дһ<D0B4><D2BB>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "<22><>ʾ",
|
|
|
// MessageBox.INFORMATION);
|
|
|
// return null;
|
|
|
// }
|
|
|
if (!("".equals(fieldText.trim()))) {
|
|
|
objList.add(fieldText);
|
|
|
lovList.add("string");
|
|
|
} else {
|
|
|
objList.add(boxText);
|
|
|
lovList.add("string");
|
|
|
}
|
|
|
continue;
|
|
|
}
|
|
|
objList.add(defaultValueList.get(i));
|
|
|
lovList.add("string");
|
|
|
continue;
|
|
|
}
|
|
|
if (!("".equals(attr.trim()))) {
|
|
|
Object obj = map.get(attr);
|
|
|
JComboBox<String> box = null;
|
|
|
if ((PlmLocaleUtil.getString("RadialInternalClearance")).equals(attr)
|
|
|
|| (PlmLocaleUtil.getString("RadialInternalClearance")).equals(esAttr)) {
|
|
|
box = boxMap.get(PlmLocaleUtil.getString("RadialInternalClearance"));
|
|
|
}
|
|
|
if (obj == null) {
|
|
|
obj = map.get(esAttr);
|
|
|
if (box != null) {
|
|
|
JTextField field = (JTextField) obj;
|
|
|
String fieldText = field.getText();
|
|
|
String boxText = (String) box.getSelectedItem();
|
|
|
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 (box != null) {
|
|
|
JTextField field = (JTextField) obj;
|
|
|
String fieldText = field.getText();
|
|
|
String boxText = (String) box.getSelectedItem();
|
|
|
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 = "";
|
|
|
Object obj = objList.get(i);
|
|
|
if (obj != null) {
|
|
|
if ("yes".equals(lovList.get(i))) {
|
|
|
String value = (String) ((JComboBox<String>) obj).getSelectedItem();
|
|
|
System.out.println("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵΪ:"+value);
|
|
|
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];
|
|
|
} else if (value.contains("<22><>")) {
|
|
|
System.out.println("value============" + value);
|
|
|
String[] values = value.split("<22><>");
|
|
|
value = values[0];
|
|
|
}
|
|
|
}else {
|
|
|
value = "";
|
|
|
}
|
|
|
} else {
|
|
|
if (value.contains(":")) {
|
|
|
System.out.println("value============" + value);
|
|
|
String[] values = value.split(":");
|
|
|
value = values[0];
|
|
|
} else if (value.contains("<22><>")) {
|
|
|
System.out.println("value============" + value);
|
|
|
String[] values = value.split("<22><>");
|
|
|
value = values[0];
|
|
|
}
|
|
|
}
|
|
|
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 = ((JTextField) obj).getText();
|
|
|
} else {
|
|
|
attrValue = (String) obj;
|
|
|
}
|
|
|
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];
|
|
|
}
|
|
|
}
|
|
|
String mark = markList.get(i);
|
|
|
if (!("".equals(attrValue.trim()))) {
|
|
|
sb.append(mark.trim());
|
|
|
sb.append(attrValue);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
return sb.toString();
|
|
|
}
|
|
|
}
|