|
|
@ -9,6 +9,7 @@ package cn.com.origin.autocode.newitem.generatcode;
|
|
|
|
import java.awt.Dimension;
|
|
|
|
import java.awt.Dimension;
|
|
|
|
import java.awt.Toolkit;
|
|
|
|
import java.awt.Toolkit;
|
|
|
|
import java.awt.datatransfer.StringSelection;
|
|
|
|
import java.awt.datatransfer.StringSelection;
|
|
|
|
|
|
|
|
import java.io.File;
|
|
|
|
import java.io.IOException;
|
|
|
|
import java.io.IOException;
|
|
|
|
import java.math.BigInteger;
|
|
|
|
import java.math.BigInteger;
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
@ -22,6 +23,7 @@ import java.util.List;
|
|
|
|
import java.util.Map;
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
|
|
|
|
import javax.swing.JDialog;
|
|
|
|
import javax.swing.JDialog;
|
|
|
|
|
|
|
|
import javax.swing.JOptionPane;
|
|
|
|
import javax.xml.bind.JAXBException;
|
|
|
|
import javax.xml.bind.JAXBException;
|
|
|
|
|
|
|
|
|
|
|
|
import org.eclipse.jface.dialogs.Dialog;
|
|
|
|
import org.eclipse.jface.dialogs.Dialog;
|
|
|
@ -95,6 +97,8 @@ import com.teamcenter.rac.kernel.ics.ICSFormat;
|
|
|
|
import com.teamcenter.rac.kernel.ics.ICSProperty;
|
|
|
|
import com.teamcenter.rac.kernel.ics.ICSProperty;
|
|
|
|
import com.teamcenter.rac.kernel.ics.ICSSearchResult;
|
|
|
|
import com.teamcenter.rac.kernel.ics.ICSSearchResult;
|
|
|
|
import com.teamcenter.rac.kernel.ics.ICSView;
|
|
|
|
import com.teamcenter.rac.kernel.ics.ICSView;
|
|
|
|
|
|
|
|
import com.teamcenter.rac.util.ConfirmDialog;
|
|
|
|
|
|
|
|
import com.teamcenter.rac.util.ConfirmationDialog;
|
|
|
|
import com.teamcenter.rac.util.MessageBox;
|
|
|
|
import com.teamcenter.rac.util.MessageBox;
|
|
|
|
import com.teamcenter.rac.util.PlatformHelper;
|
|
|
|
import com.teamcenter.rac.util.PlatformHelper;
|
|
|
|
import com.teamcenter.schemas.soa._2006_03.exceptions.ServiceException;
|
|
|
|
import com.teamcenter.schemas.soa._2006_03.exceptions.ServiceException;
|
|
|
@ -122,6 +126,8 @@ import cn.com.origin.autocode.xmlutil.CNPart;
|
|
|
|
import cn.com.origin.autocode.xmlutil.CNPartList;
|
|
|
|
import cn.com.origin.autocode.xmlutil.CNPartList;
|
|
|
|
import cn.com.origin.autocode.xmlutil.CNProperty;
|
|
|
|
import cn.com.origin.autocode.xmlutil.CNProperty;
|
|
|
|
import cn.com.origin.autocode.xmlutil.CNXmlUtil;
|
|
|
|
import cn.com.origin.autocode.xmlutil.CNXmlUtil;
|
|
|
|
|
|
|
|
import cn.com.origin.autocode.xmlutil.ExcelInfoScanner;
|
|
|
|
|
|
|
|
import cn.com.origin.autocode.xmlutil.TranslateEnglish;
|
|
|
|
import cn.com.origin.autocodemanager.common.AutoCodeManagerPropertyName;
|
|
|
|
import cn.com.origin.autocodemanager.common.AutoCodeManagerPropertyName;
|
|
|
|
import cn.com.origin.autocodemanager.common.CreateCompositeUtil;
|
|
|
|
import cn.com.origin.autocodemanager.common.CreateCompositeUtil;
|
|
|
|
import cn.com.origin.autocodemanager.common.PackCodeDescInfos;
|
|
|
|
import cn.com.origin.autocodemanager.common.PackCodeDescInfos;
|
|
|
@ -135,7 +141,8 @@ import cn.com.origin.autocodemanager.common.tree.AbstractTreeData;
|
|
|
|
import cn.com.origin.autocodemanager.common.tree.TreeViewOperation;
|
|
|
|
import cn.com.origin.autocodemanager.common.tree.TreeViewOperation;
|
|
|
|
import cn.com.origin.autocodemanager.views.listcodeview.NewItemListCodeView;
|
|
|
|
import cn.com.origin.autocodemanager.views.listcodeview.NewItemListCodeView;
|
|
|
|
import cn.com.origin.autocodemanager.views.treecodeview.NewItemTreeCodeView;
|
|
|
|
import cn.com.origin.autocodemanager.views.treecodeview.NewItemTreeCodeView;
|
|
|
|
import net.sf.json.JSONObject;
|
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
|
|
|
|
import cn.hutool.json.JSONUtil;
|
|
|
|
|
|
|
|
|
|
|
|
public class NewCodeItemDialog extends Dialog {
|
|
|
|
public class NewCodeItemDialog extends Dialog {
|
|
|
|
private Table propTable;
|
|
|
|
private Table propTable;
|
|
|
@ -257,6 +264,11 @@ public class NewCodeItemDialog extends Dialog {
|
|
|
|
private String ys = null;
|
|
|
|
private String ys = null;
|
|
|
|
private String cz = null;
|
|
|
|
private String cz = null;
|
|
|
|
private String xh = null;
|
|
|
|
private String xh = null;
|
|
|
|
|
|
|
|
private String nodeName;
|
|
|
|
|
|
|
|
private String rootNodeName;
|
|
|
|
|
|
|
|
private Map<String, String> classMustMap = new HashMap<String, String>();
|
|
|
|
|
|
|
|
private TCComponentItemRevision gltz;
|
|
|
|
|
|
|
|
private TCComponentItemRevision glwl;
|
|
|
|
|
|
|
|
|
|
|
|
public Text getIdLengthText() {
|
|
|
|
public Text getIdLengthText() {
|
|
|
|
return idLengthText;
|
|
|
|
return idLengthText;
|
|
|
@ -455,7 +467,7 @@ public class NewCodeItemDialog extends Dialog {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void controlResized(ControlEvent e) {
|
|
|
|
public void controlResized(ControlEvent e) {
|
|
|
|
Point r = classPropComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT);
|
|
|
|
Point r = classPropComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT);
|
|
|
|
classSrolledComposite.setMinSize(classSrolledComposite.computeSize(r.x, r.y));
|
|
|
|
classSrolledComposite.setMinSize(classSrolledComposite.computeSize(r.x, r.y + 200));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
classPropTab.setControl(classCompsite);
|
|
|
|
classPropTab.setControl(classCompsite);
|
|
|
@ -487,6 +499,19 @@ public class NewCodeItemDialog extends Dialog {
|
|
|
|
if (classID == null || classID.replace(" ", "").equals("")) {
|
|
|
|
if (classID == null || classID.replace(" ", "").equals("")) {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 获取分类属性自定义下拉选择
|
|
|
|
|
|
|
|
String uid = getPrefStr("jd_class_prop_option");
|
|
|
|
|
|
|
|
TCComponent comp = null;
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
comp = session.stringToComponent(uid);
|
|
|
|
|
|
|
|
} catch (TCException e2) {
|
|
|
|
|
|
|
|
// TODO Auto-generated catch block
|
|
|
|
|
|
|
|
e2.printStackTrace();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
TCComponentDataset op = null;
|
|
|
|
|
|
|
|
Map<Integer, String> propOption = null;
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
if (session == null) {
|
|
|
|
if (session == null) {
|
|
|
|
session = (TCSession) AIFUtility.getCurrentApplication().getSession();
|
|
|
|
session = (TCSession) AIFUtility.getCurrentApplication().getSession();
|
|
|
@ -502,6 +527,16 @@ public class NewCodeItemDialog extends Dialog {
|
|
|
|
|
|
|
|
|
|
|
|
ICSAdminClassAttribute[] icsAttrS = adminClass.getAttributes();
|
|
|
|
ICSAdminClassAttribute[] icsAttrS = adminClass.getAttributes();
|
|
|
|
if (icsAttrS != null) {
|
|
|
|
if (icsAttrS != null) {
|
|
|
|
|
|
|
|
// 分类属性自定义下拉框选择项
|
|
|
|
|
|
|
|
if (comp != null) {
|
|
|
|
|
|
|
|
op = (TCComponentDataset) comp;
|
|
|
|
|
|
|
|
String temp = System.getenv("temp");
|
|
|
|
|
|
|
|
String[] types = op.getProperty("ref_names").split(",");
|
|
|
|
|
|
|
|
File optionFile = op.getFiles(types[0], temp)[0];
|
|
|
|
|
|
|
|
optionFile.deleteOnExit();
|
|
|
|
|
|
|
|
propOption = ExcelInfoScanner.getClassPropOptions(optionFile.getPath(), rootNodeName);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
for (ICSAdminClassAttribute attr : icsAttrS) {
|
|
|
|
for (ICSAdminClassAttribute attr : icsAttrS) {
|
|
|
|
if (attr.isReferenceAttribute()) {
|
|
|
|
if (attr.isReferenceAttribute()) {
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
@ -510,8 +545,23 @@ public class NewCodeItemDialog extends Dialog {
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
CNClassPropBean bean = new CNClassPropBean(attr);
|
|
|
|
CNClassPropBean bean = new CNClassPropBean(attr);
|
|
|
|
|
|
|
|
// 分类属性增加自定义下拉框
|
|
|
|
|
|
|
|
if (op != null) {
|
|
|
|
|
|
|
|
String options = propOption.get(bean.propID);
|
|
|
|
|
|
|
|
System.out.println(bean.propDisName + "选项:" + options);
|
|
|
|
|
|
|
|
if (options != null && !"".equals(options)) {
|
|
|
|
|
|
|
|
bean.setUserLov(options);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 设置分类属性必填
|
|
|
|
|
|
|
|
if (classMustMap.get(rootNodeName) != null
|
|
|
|
|
|
|
|
&& classMustMap.get(rootNodeName).contains(bean.propID + "")) {
|
|
|
|
|
|
|
|
bean.setMust(true);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
classPropList.add(bean);
|
|
|
|
classPropList.add(bean);
|
|
|
|
Label label = CreateCompositeUtil.createNewLabel(classPropComposite, bean.propDisName);
|
|
|
|
Label label = CreateCompositeUtil.createNewLabel(classPropComposite, bean.propDisName + bean.must);
|
|
|
|
label.getParent().layout();
|
|
|
|
label.getParent().layout();
|
|
|
|
classLabelList.add(label);
|
|
|
|
classLabelList.add(label);
|
|
|
|
Widget widget = null;
|
|
|
|
Widget widget = null;
|
|
|
@ -641,13 +691,68 @@ public class NewCodeItemDialog extends Dialog {
|
|
|
|
generalPropLabelList.clear();
|
|
|
|
generalPropLabelList.clear();
|
|
|
|
generalPropTextList.clear();
|
|
|
|
generalPropTextList.clear();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 对象属性多级下拉框获取配置
|
|
|
|
|
|
|
|
String uid = getPrefStr("jd2_general_muti_lov");
|
|
|
|
|
|
|
|
File mutiSetting = null;
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
TCComponent comp = session.stringToComponent(uid);
|
|
|
|
|
|
|
|
if (comp != null) {
|
|
|
|
|
|
|
|
TCComponentDataset muti = (TCComponentDataset) comp;
|
|
|
|
|
|
|
|
String temp = System.getenv("temp");
|
|
|
|
|
|
|
|
String[] types = muti.getProperty("ref_names").split(",");
|
|
|
|
|
|
|
|
mutiSetting = muti.getFiles(types[0], temp)[0];
|
|
|
|
|
|
|
|
mutiSetting.deleteOnExit();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} catch (TCException e2) {
|
|
|
|
|
|
|
|
// TODO Auto-generated catch block
|
|
|
|
|
|
|
|
e2.printStackTrace();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (this.cnpropList != null) {
|
|
|
|
if (this.cnpropList != null) {
|
|
|
|
|
|
|
|
Map<String, CustomLovBean> settingMap = new HashMap<String, CustomLovBean>();
|
|
|
|
|
|
|
|
if (mutiSetting != null) {
|
|
|
|
|
|
|
|
settingMap = ExcelInfoScanner.getGeneralPropMutiLovInfo(mutiSetting.getPath(), rootNodeName);
|
|
|
|
|
|
|
|
}
|
|
|
|
for (CNProperty cnProp : this.cnpropList) {
|
|
|
|
for (CNProperty cnProp : this.cnpropList) {
|
|
|
|
|
|
|
|
|
|
|
|
Label label = CreateCompositeUtil.createNewLabel(objPropComposite,
|
|
|
|
Label label = CreateCompositeUtil.createNewLabel(objPropComposite,
|
|
|
|
cnProp.getIsMust() ? (cnProp.getDisplayName() + "(必填)") : cnProp.getDisplayName());
|
|
|
|
cnProp.getIsMust() ? (cnProp.getDisplayName() + "(必填)") : cnProp.getDisplayName());
|
|
|
|
generalPropLabelList.add(label);
|
|
|
|
generalPropLabelList.add(label);
|
|
|
|
Widget widget = null;
|
|
|
|
Widget widget = null;
|
|
|
|
|
|
|
|
if (settingMap.containsKey(cnProp.getDisplayName())) {
|
|
|
|
|
|
|
|
final CustomLovBean lovBean = settingMap.get(cnProp.getDisplayName());
|
|
|
|
|
|
|
|
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, lovBean);
|
|
|
|
|
|
|
|
((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 {
|
|
|
|
|
|
|
|
((Button) e.getSource()).setData("");
|
|
|
|
|
|
|
|
((Button) e.getSource()).setText("");
|
|
|
|
|
|
|
|
System.out.println("LovKeyValue NULL");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
widget = comb; // Combo(propTable, // SWT.NONE);
|
|
|
|
|
|
|
|
comb.setText(cnProp.getDefaultValue());
|
|
|
|
|
|
|
|
generalPropTextList.add(widget);
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
if (!cnProp.getIsLov()) {
|
|
|
|
if (!cnProp.getIsLov()) {
|
|
|
|
if (cnProp.getPropertyType().toUpperCase().equals("STRING")) {
|
|
|
|
if (cnProp.getPropertyType().toUpperCase().equals("STRING")) {
|
|
|
|
final Text text = CreateCompositeUtil.createNewText(objPropComposite, cnProp.getDefaultValue());
|
|
|
|
final Text text = CreateCompositeUtil.createNewText(objPropComposite, cnProp.getDefaultValue());
|
|
|
@ -683,7 +788,7 @@ public class NewCodeItemDialog extends Dialog {
|
|
|
|
widget = text;
|
|
|
|
widget = text;
|
|
|
|
} else if (cnProp.getPropertyType().toUpperCase().equals("BOOLEAN")) {
|
|
|
|
} else if (cnProp.getPropertyType().toUpperCase().equals("BOOLEAN")) {
|
|
|
|
final Combo comb = CreateCompositeUtil.createNotFillNewCombo(objPropComposite,
|
|
|
|
final Combo comb = CreateCompositeUtil.createNotFillNewCombo(objPropComposite,
|
|
|
|
new String[] { "true", "false" }); // new
|
|
|
|
new String[] { "true", "false", "" }); // new
|
|
|
|
comb.setText(cnProp.getDefaultValue()); // Combo(propTable,
|
|
|
|
comb.setText(cnProp.getDefaultValue()); // Combo(propTable,
|
|
|
|
widget = comb; // SWT.NONE);
|
|
|
|
widget = comb; // SWT.NONE);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -728,6 +833,8 @@ public class NewCodeItemDialog extends Dialog {
|
|
|
|
((Button) e.getSource()).setText(kv.value);
|
|
|
|
((Button) e.getSource()).setText(kv.value);
|
|
|
|
System.out.println("LOV=>KEY>" + kv.key + "|VALUE=>V>" + kv.value);
|
|
|
|
System.out.println("LOV=>KEY>" + kv.key + "|VALUE=>V>" + kv.value);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
|
|
|
|
((Button) e.getSource()).setData("");
|
|
|
|
|
|
|
|
((Button) e.getSource()).setText("");
|
|
|
|
System.out.println("LovKeyValue NULL");
|
|
|
|
System.out.println("LovKeyValue NULL");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -736,8 +843,11 @@ public class NewCodeItemDialog extends Dialog {
|
|
|
|
widget = comb; // Combo(propTable, // SWT.NONE);
|
|
|
|
widget = comb; // Combo(propTable, // SWT.NONE);
|
|
|
|
comb.setText(cnProp.getDefaultValue());
|
|
|
|
comb.setText(cnProp.getDefaultValue());
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
final Combo comb = CreateCompositeUtil.createNotFillNewCombo(objPropComposite,
|
|
|
|
String[] items = cnProp.lovDisplayValueList
|
|
|
|
cnProp.lovDisplayValueList.toArray(new String[cnProp.lovDisplayValueList.size()]));
|
|
|
|
.toArray(new String[cnProp.lovDisplayValueList.size()]);
|
|
|
|
|
|
|
|
String[] newItems = Arrays.copyOf(items, items.length + 1);
|
|
|
|
|
|
|
|
newItems[newItems.length - 1] = "";
|
|
|
|
|
|
|
|
final Combo comb = CreateCompositeUtil.createNotFillNewCombo(objPropComposite, newItems);
|
|
|
|
// new
|
|
|
|
// new
|
|
|
|
widget = comb; // Combo(propTable, // SWT.NONE);
|
|
|
|
widget = comb; // Combo(propTable, // SWT.NONE);
|
|
|
|
comb.setText(cnProp.getDefaultValue());
|
|
|
|
comb.setText(cnProp.getDefaultValue());
|
|
|
@ -1023,6 +1133,7 @@ public class NewCodeItemDialog extends Dialog {
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
protected Control createDialogArea(Composite parent) {
|
|
|
|
protected Control createDialogArea(Composite parent) {
|
|
|
|
|
|
|
|
|
|
|
|
// 获取首选项中的配置
|
|
|
|
// 获取首选项中的配置
|
|
|
|
propBeanList = JFomMethodUtil.getTcPropInfo(JFomUtil.ITEM_TYPE_PROP_MAPPING_REF, session);
|
|
|
|
propBeanList = JFomMethodUtil.getTcPropInfo(JFomUtil.ITEM_TYPE_PROP_MAPPING_REF, session);
|
|
|
|
propMapping = JFomMethodUtil.getMapping(JFomUtil.FORM_TYPE_PROP_MAPPING, session);
|
|
|
|
propMapping = JFomMethodUtil.getMapping(JFomUtil.FORM_TYPE_PROP_MAPPING, session);
|
|
|
@ -1291,6 +1402,12 @@ public class NewCodeItemDialog extends Dialog {
|
|
|
|
CreateCompositeUtil.createNewLabel(composite, "特征码长度");
|
|
|
|
CreateCompositeUtil.createNewLabel(composite, "特征码长度");
|
|
|
|
idLengthText = CreateCompositeUtil.createNewText(composite, "");
|
|
|
|
idLengthText = CreateCompositeUtil.createNewText(composite, "");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 读取分类必填属性
|
|
|
|
|
|
|
|
String[] prefStrArray = getPrefStrArray("jd_class_prop_must");
|
|
|
|
|
|
|
|
for (String str : prefStrArray) {
|
|
|
|
|
|
|
|
classMustMap.put(str.split("/")[0], str.split("/")[1]);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ===JY 2017.01.09====
|
|
|
|
// ===JY 2017.01.09====
|
|
|
|
GridLayout gridLayout2 = new GridLayout();
|
|
|
|
GridLayout gridLayout2 = new GridLayout();
|
|
|
|
gridLayout2.numColumns = 4;
|
|
|
|
gridLayout2.numColumns = 4;
|
|
|
@ -1308,6 +1425,11 @@ public class NewCodeItemDialog extends Dialog {
|
|
|
|
nameText = CreateCompositeUtil.createNewText(composite, "");
|
|
|
|
nameText = CreateCompositeUtil.createNewText(composite, "");
|
|
|
|
// 如果选中的对象是图纸类型,名称就复制
|
|
|
|
// 如果选中的对象是图纸类型,名称就复制
|
|
|
|
TCComponent targetObject = (TCComponent) AIFUtility.getCurrentApplication().getTargetComponent();
|
|
|
|
TCComponent targetObject = (TCComponent) AIFUtility.getCurrentApplication().getTargetComponent();
|
|
|
|
|
|
|
|
if (targetObject == null) {
|
|
|
|
|
|
|
|
MessageBox.post("未选择目标,请选择后再进行创建", "错误", MessageBox.ERROR);
|
|
|
|
|
|
|
|
this.close();
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
if (targetObject instanceof TCComponentItemRevision) {
|
|
|
|
if (targetObject instanceof TCComponentItemRevision) {
|
|
|
|
TCComponentItemRevision design = (TCComponentItemRevision) targetObject;
|
|
|
|
TCComponentItemRevision design = (TCComponentItemRevision) targetObject;
|
|
|
|
try {
|
|
|
|
try {
|
|
|
@ -1321,7 +1443,7 @@ public class NewCodeItemDialog extends Dialog {
|
|
|
|
|
|
|
|
|
|
|
|
if (TCPreferenceUitl.isTrueTCPreferenceValue(session, origin_newItem_isShowUnit)) {
|
|
|
|
if (TCPreferenceUitl.isTrueTCPreferenceValue(session, origin_newItem_isShowUnit)) {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
CreateCompositeUtil.createNewLabel(composite, "度量单位");
|
|
|
|
CreateCompositeUtil.createNewLabel(composite, "基本计量单位");
|
|
|
|
TCComponentListOfValues listOfValues = TCLOVUtil.findLOVByName(session, unitLOVName);
|
|
|
|
TCComponentListOfValues listOfValues = TCLOVUtil.findLOVByName(session, unitLOVName);
|
|
|
|
ListOfValuesInfo listOfValuesInfo = listOfValues.getListOfValues();
|
|
|
|
ListOfValuesInfo listOfValuesInfo = listOfValues.getListOfValues();
|
|
|
|
String[] values = listOfValuesInfo.getLOVDisplayValues();
|
|
|
|
String[] values = listOfValuesInfo.getLOVDisplayValues();
|
|
|
@ -1865,6 +1987,12 @@ public class NewCodeItemDialog extends Dialog {
|
|
|
|
if ((selectedData.getPackCodeNodeInfo().is_lock)) {
|
|
|
|
if ((selectedData.getPackCodeNodeInfo().is_lock)) {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
objPropComposite.setVisible(true);
|
|
|
|
|
|
|
|
if (selectedData.getPackCodeNodeInfo().isContainsChildren()) {
|
|
|
|
|
|
|
|
objPropComposite.setVisible(false);
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
String currentNodeDesc = "";
|
|
|
|
String currentNodeDesc = "";
|
|
|
|
String currentNodeValue = "";
|
|
|
|
String currentNodeValue = "";
|
|
|
|
String name = "";
|
|
|
|
String name = "";
|
|
|
@ -1915,6 +2043,7 @@ public class NewCodeItemDialog extends Dialog {
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
nameText.setText("");
|
|
|
|
nameText.setText("");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
getFinalPattern();
|
|
|
|
getFinalPattern();
|
|
|
|
// idText.setText(pattern);
|
|
|
|
// idText.setText(pattern);
|
|
|
|
idText.setText(finalPattern);
|
|
|
|
idText.setText(finalPattern);
|
|
|
@ -1931,6 +2060,32 @@ public class NewCodeItemDialog extends Dialog {
|
|
|
|
// =
|
|
|
|
// =
|
|
|
|
// >"+msg,"INFO",MessageBox.ERROR);
|
|
|
|
// >"+msg,"INFO",MessageBox.ERROR);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 填写英文名称
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
for (int i = 0; i < classLabelList.size(); i++) {
|
|
|
|
|
|
|
|
String text = classLabelList.get(i).getText();
|
|
|
|
|
|
|
|
System.out.println(text);
|
|
|
|
|
|
|
|
if ("英文名称:".equals(text)) {
|
|
|
|
|
|
|
|
String uid = getPrefStr("jd_chinese_to_english");
|
|
|
|
|
|
|
|
TCComponentDataset en = (TCComponentDataset) session.stringToComponent(uid);
|
|
|
|
|
|
|
|
String temp = System.getenv("temp");
|
|
|
|
|
|
|
|
String[] types = en.getProperty("ref_names").split(",");
|
|
|
|
|
|
|
|
File englishFile = en.getFiles(types[0], temp)[0];
|
|
|
|
|
|
|
|
String res = TranslateEnglish.getEnglish(englishFile.getPath(), nodeName);
|
|
|
|
|
|
|
|
System.out.println("当前选择节点中文名称:" + nodeName);
|
|
|
|
|
|
|
|
System.out.println("当前选择节点英文名称:" + res);
|
|
|
|
|
|
|
|
if (res != null) {
|
|
|
|
|
|
|
|
// Text englishText = CreateCompositeUtil.createNewText(classPropComposite,
|
|
|
|
|
|
|
|
// res);
|
|
|
|
|
|
|
|
((Text) classTextList.get(i)).setText(res);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} catch (TCException e1) {
|
|
|
|
|
|
|
|
// TODO Auto-generated catch block
|
|
|
|
|
|
|
|
e1.printStackTrace();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
} else if (selectedSegmentNode.getPackCodeNodeInfo().getNode_type()
|
|
|
|
} else if (selectedSegmentNode.getPackCodeNodeInfo().getNode_type()
|
|
|
@ -2222,7 +2377,16 @@ public class NewCodeItemDialog extends Dialog {
|
|
|
|
codeDesc = codeDesc + "\n";
|
|
|
|
codeDesc = codeDesc + "\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
this.codeRemark = treeData.getPackCodeNodeInfo().getNode_desc();
|
|
|
|
this.codeRemark = treeData.getPackCodeNodeInfo().getNode_desc();
|
|
|
|
|
|
|
|
this.nodeName = treeData.getPackCodeNodeInfo().getNode_name();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
System.out.println("node_name ===>" + treeData.getPackCodeNodeInfo().getNode_name());
|
|
|
|
System.out.println("node_desc ===>" + treeData.getPackCodeNodeInfo().getNode_desc());
|
|
|
|
System.out.println("node_desc ===>" + treeData.getPackCodeNodeInfo().getNode_desc());
|
|
|
|
|
|
|
|
AbstractTreeData temp = treeData;
|
|
|
|
|
|
|
|
while (temp != null) {
|
|
|
|
|
|
|
|
rootNodeName = temp.getPackCodeNodeInfo().getNode_name();
|
|
|
|
|
|
|
|
temp = temp.getParentTreeData();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
System.out.println("rootNodeName ===>" + rootNodeName);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -3125,7 +3289,6 @@ public class NewCodeItemDialog extends Dialog {
|
|
|
|
public boolean finitPropList() {
|
|
|
|
public boolean finitPropList() {
|
|
|
|
for (int i = 0; i < this.cnpropList.size(); i++) {
|
|
|
|
for (int i = 0; i < this.cnpropList.size(); i++) {
|
|
|
|
Widget wd = generalPropTextList.get(i);
|
|
|
|
Widget wd = generalPropTextList.get(i);
|
|
|
|
|
|
|
|
|
|
|
|
if (wd instanceof Text) {
|
|
|
|
if (wd instanceof Text) {
|
|
|
|
if (cnpropList.get(i).getPropertyType().toUpperCase().endsWith("STRING")) {
|
|
|
|
if (cnpropList.get(i).getPropertyType().toUpperCase().endsWith("STRING")) {
|
|
|
|
|
|
|
|
|
|
|
@ -3152,15 +3315,20 @@ public class NewCodeItemDialog extends Dialog {
|
|
|
|
} else if (wd instanceof Combo) {
|
|
|
|
} else if (wd instanceof Combo) {
|
|
|
|
if (cnpropList.get(i).getIsLov()) {
|
|
|
|
if (cnpropList.get(i).getIsLov()) {
|
|
|
|
int index = ((Combo) wd).getSelectionIndex();
|
|
|
|
int index = ((Combo) wd).getSelectionIndex();
|
|
|
|
if (index != -1) {
|
|
|
|
if (index != -1 && cnpropList.get(i).lovValueList.size() > index) {
|
|
|
|
cnpropList.get(i).value = cnpropList.get(i).lovValueList.get(index);
|
|
|
|
cnpropList.get(i).value = cnpropList.get(i).lovValueList.get(index);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
cnpropList.get(i).value = "";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
} else if (cnpropList.get(i).getPropertyType().toUpperCase().endsWith("BOOLEAN")) {
|
|
|
|
} else if (cnpropList.get(i).getPropertyType().toUpperCase().endsWith("BOOLEAN")) {
|
|
|
|
|
|
|
|
|
|
|
|
if (!((Combo) wd).getText().replace(" ", "").equals("")) {
|
|
|
|
if (!((Combo) wd).getText().replace(" ", "").equals("")) {
|
|
|
|
cnpropList.get(i).value = Boolean.parseBoolean(((Combo) wd).getText());
|
|
|
|
if (!"".equals(((Combo) wd).getText())) {
|
|
|
|
|
|
|
|
cnpropList.get(i).value = Boolean.parseBoolean(((Combo) wd).getText());
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
cnpropList.get(i).value = "";
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -3259,6 +3427,7 @@ public class NewCodeItemDialog extends Dialog {
|
|
|
|
type = targetObject.getType();
|
|
|
|
type = targetObject.getType();
|
|
|
|
System.out.println("选中对象:" + targetObject + " 类型:" + type);
|
|
|
|
System.out.println("选中对象:" + targetObject + " 类型:" + type);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
TCComponentItem newItem = (TCComponentItem) newComp;
|
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < generalPropLabelList.size(); i++) {
|
|
|
|
for (int i = 0; i < generalPropLabelList.size(); i++) {
|
|
|
|
String text = generalPropLabelList.get(i).getText();
|
|
|
|
String text = generalPropLabelList.get(i).getText();
|
|
|
@ -3279,9 +3448,8 @@ public class NewCodeItemDialog extends Dialog {
|
|
|
|
flag = true;
|
|
|
|
flag = true;
|
|
|
|
TCComponent cadTemplate = session.stringToComponent(uid);
|
|
|
|
TCComponent cadTemplate = session.stringToComponent(uid);
|
|
|
|
TCComponentDataset cadDataset = (TCComponentDataset) cadTemplate;
|
|
|
|
TCComponentDataset cadDataset = (TCComponentDataset) cadTemplate;
|
|
|
|
TCComponentItem item = (TCComponentItem) newComp;
|
|
|
|
TCComponentDataset newCad = cadDataset.saveAs(newItem.getProperty("item_id"));
|
|
|
|
TCComponentDataset newCad = cadDataset.saveAs(item.getProperty("item_id"));
|
|
|
|
newItem.getLatestItemRevision().add("IMAN_specification", newCad);
|
|
|
|
item.getLatestItemRevision().add("TC_Attaches", newCad);
|
|
|
|
|
|
|
|
System.out.println("cad数据集创建成功");
|
|
|
|
System.out.println("cad数据集创建成功");
|
|
|
|
// MessageBox.post("二维图框大小为\"" + rwtk + "\"的cad数据集\"" + newCad.getProperty("object_string")
|
|
|
|
// MessageBox.post("二维图框大小为\"" + rwtk + "\"的cad数据集\"" + newCad.getProperty("object_string")
|
|
|
|
// + "\"创建成功", "错误", MessageBox.WARNING);
|
|
|
|
// + "\"创建成功", "错误", MessageBox.WARNING);
|
|
|
@ -3297,7 +3465,6 @@ public class NewCodeItemDialog extends Dialog {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (ksfl != null) {
|
|
|
|
if (ksfl != null) {
|
|
|
|
TCComponentItem newItem = (TCComponentItem) newComp;
|
|
|
|
|
|
|
|
TCComponentItemRevision rev = newItem.getLatestItemRevision();
|
|
|
|
TCComponentItemRevision rev = newItem.getLatestItemRevision();
|
|
|
|
TCComponentForm form = (TCComponentForm) rev.getRelatedComponents("IMAN_master_form_rev")[0];
|
|
|
|
TCComponentForm form = (TCComponentForm) rev.getRelatedComponents("IMAN_master_form_rev")[0];
|
|
|
|
if (ksfl.equals(form.getProperty("jd2_ksfl"))) {
|
|
|
|
if (ksfl.equals(form.getProperty("jd2_ksfl"))) {
|
|
|
@ -3315,35 +3482,38 @@ public class NewCodeItemDialog extends Dialog {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (ysjtzRev != null) {
|
|
|
|
if (ysjtzRev != null) {
|
|
|
|
TCComponentItem item = (TCComponentItem) newComp;
|
|
|
|
|
|
|
|
if (ysdzbForm != null) {
|
|
|
|
if (ysdzbForm != null) {
|
|
|
|
if (ysjTable != null) {
|
|
|
|
if (ysjTable != null) {
|
|
|
|
// String[][] ysjTable1 = new String[ysjTable.length + 1][colNames.length];
|
|
|
|
List<String[]> ysjTableList = new ArrayList<>(Arrays.asList(ysjTable));
|
|
|
|
List<String[]> ysjTable1 = new ArrayList<String[]>();
|
|
|
|
String[] newRow = new String[] { newItem.getProperty("item_id"), cz, ys, xh };
|
|
|
|
for (String[] arr : ysjTable) {
|
|
|
|
System.out.println("new row===>" + Arrays.toString(newRow));
|
|
|
|
ysjTable1.add(arr);
|
|
|
|
ysjTableList.add(newRow);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String[] newRow = new String[] { item.getProperty("item_id"), cz, ys, xh };
|
|
|
|
|
|
|
|
ysjTable1.add(newRow);
|
|
|
|
|
|
|
|
TCTableUtil.setTableRows(ysdzbForm, "jd2_ysdzb", "JD2_YSDZBTABLE", colNames,
|
|
|
|
TCTableUtil.setTableRows(ysdzbForm, "jd2_ysdzb", "JD2_YSDZBTABLE", colNames,
|
|
|
|
ysjTable1.toArray(new String[ysjTable1.size()][colNames.length]));
|
|
|
|
ysjTableList.toArray(new String[ysjTableList.size()][colNames.length]));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
TCComponentFormType formType = (TCComponentFormType) session.getTypeComponent("Form");
|
|
|
|
TCComponentFormType formType = (TCComponentFormType) session.getTypeComponent("Form");
|
|
|
|
ysdzbForm = formType.create("颜色对照表", "颜色对照表", "JD2_YSDZB");
|
|
|
|
ysdzbForm = formType.create("颜色对照表", "颜色对照表", "JD2_YSDZB");
|
|
|
|
ysjTable = new String[][] { { item.getProperty("item_id"), cz, ys, xh } };
|
|
|
|
ysjTable = new String[][] { { newItem.getProperty("item_id"), cz, ys, xh } };
|
|
|
|
|
|
|
|
System.out.println("init row===>" + Arrays.deepToString(ysjTable));
|
|
|
|
TCTableUtil.setTableRows(ysdzbForm, "jd2_ysdzb", "JD2_YSDZBTABLE", colNames, ysjTable);
|
|
|
|
TCTableUtil.setTableRows(ysdzbForm, "jd2_ysdzb", "JD2_YSDZBTABLE", colNames, ysjTable);
|
|
|
|
session.getUserService().call("bs_bypass", new Object[] { true });
|
|
|
|
session.getUserService().call("bs_bypass", new Object[] { true });
|
|
|
|
ysjtzRev.add("IMAN_specification", ysdzbForm);
|
|
|
|
ysjtzRev.add("IMAN_specification", ysdzbForm);
|
|
|
|
session.getUserService().call("bs_bypass", new Object[] { false });
|
|
|
|
session.getUserService().call("bs_bypass", new Object[] { false });
|
|
|
|
}
|
|
|
|
}
|
|
|
|
item.getLatestItemRevision().add("TC_Is_Represented_By", ysjtzRev);
|
|
|
|
newItem.getLatestItemRevision().add("TC_Is_Represented_By", ysjtzRev);
|
|
|
|
ysjtzRev.refresh();
|
|
|
|
ysjtzRev.refresh();
|
|
|
|
item.refresh();
|
|
|
|
newItem.refresh();
|
|
|
|
System.out.println("颜色件创建成功");
|
|
|
|
System.out.println("颜色件创建成功");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (gltz != null) {
|
|
|
|
|
|
|
|
newItem.getLatestItemRevision().add("TC_Is_Represented_By", gltz);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (glwl != null) {
|
|
|
|
|
|
|
|
newItem.getLatestItemRevision().add("representation_for", glwl);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (targetObject instanceof TCComponentFolder) {
|
|
|
|
if (targetObject instanceof TCComponentFolder) {
|
|
|
|
|
|
|
|
|
|
|
|
if (newComp != null) {
|
|
|
|
if (newComp != null) {
|
|
|
@ -4123,6 +4293,23 @@ public class NewCodeItemDialog extends Dialog {
|
|
|
|
MessageBox.post("请填写必填属性", "错误", MessageBox.ERROR);
|
|
|
|
MessageBox.post("请填写必填属性", "错误", MessageBox.ERROR);
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for (int i = 0; i < classPropList.size(); i++) {
|
|
|
|
|
|
|
|
CNClassPropBean bean = classPropList.get(i);
|
|
|
|
|
|
|
|
if (classMustMap.get(rootNodeName) != null
|
|
|
|
|
|
|
|
&& classMustMap.get(rootNodeName).contains(bean.propID + "")) {
|
|
|
|
|
|
|
|
String value = "";
|
|
|
|
|
|
|
|
if (bean.isLov) {
|
|
|
|
|
|
|
|
value = ((Combo) classTextList.get(i)).getText();
|
|
|
|
|
|
|
|
value = bean.lovMapping.get(value);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
value = ((Text) classTextList.get(i)).getText();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (value == null || "".equals(value.trim())) {
|
|
|
|
|
|
|
|
MessageBox.post("请填写必填分类属性", "错误", MessageBox.ERROR);
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 波轮图纸分类
|
|
|
|
// 波轮图纸分类
|
|
|
|
ksfl = null;
|
|
|
|
ksfl = null;
|
|
|
@ -4140,7 +4327,7 @@ public class NewCodeItemDialog extends Dialog {
|
|
|
|
String text = generalPropLabelList.get(i).getText();
|
|
|
|
String text = generalPropLabelList.get(i).getText();
|
|
|
|
System.out.println(text);
|
|
|
|
System.out.println(text);
|
|
|
|
if (text.equals("款式分类:")) {
|
|
|
|
if (text.equals("款式分类:")) {
|
|
|
|
ksfl = ((Text) generalPropTextList.get(i)).getText();
|
|
|
|
ksfl = ((Button) generalPropTextList.get(i)).getText();
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -4159,6 +4346,9 @@ public class NewCodeItemDialog extends Dialog {
|
|
|
|
|
|
|
|
|
|
|
|
// 颜色件
|
|
|
|
// 颜色件
|
|
|
|
String ysjth = null;
|
|
|
|
String ysjth = null;
|
|
|
|
|
|
|
|
ysjtzRev = null;
|
|
|
|
|
|
|
|
ysdzbForm = null;
|
|
|
|
|
|
|
|
ysjTable = null;
|
|
|
|
ys = null;
|
|
|
|
ys = null;
|
|
|
|
cz = null;
|
|
|
|
cz = null;
|
|
|
|
xh = null;
|
|
|
|
xh = null;
|
|
|
@ -4173,8 +4363,6 @@ public class NewCodeItemDialog extends Dialog {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for (int i = 0; i < classPropList.size(); i++) {
|
|
|
|
for (int i = 0; i < classPropList.size(); i++) {
|
|
|
|
// System.out.println(" CLASS ID = " + integers[i] + " =" +
|
|
|
|
|
|
|
|
// vals[i]);
|
|
|
|
|
|
|
|
CNClassPropBean bean = classPropList.get(i);
|
|
|
|
CNClassPropBean bean = classPropList.get(i);
|
|
|
|
System.out.println(bean.propDisName);
|
|
|
|
System.out.println(bean.propDisName);
|
|
|
|
if ("颜色".equals(bean.propDisName)) {
|
|
|
|
if ("颜色".equals(bean.propDisName)) {
|
|
|
@ -4184,7 +4372,6 @@ public class NewCodeItemDialog extends Dialog {
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
ys = ((Text) classTextList.get(i)).getText();
|
|
|
|
ys = ((Text) classTextList.get(i)).getText();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// icspro[i] = new ICSProperty(bean.propID, value);
|
|
|
|
|
|
|
|
System.out.println("颜色:" + ys);
|
|
|
|
System.out.println("颜色:" + ys);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ("材质".equals(bean.propDisName)) {
|
|
|
|
if ("材质".equals(bean.propDisName)) {
|
|
|
@ -4194,7 +4381,6 @@ public class NewCodeItemDialog extends Dialog {
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
cz = ((Text) classTextList.get(i)).getText();
|
|
|
|
cz = ((Text) classTextList.get(i)).getText();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// icspro[i] = new ICSProperty(bean.propID, value);
|
|
|
|
|
|
|
|
System.out.println("材质:" + cz);
|
|
|
|
System.out.println("材质:" + cz);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ("型号".equals(bean.propDisName)) {
|
|
|
|
if ("型号".equals(bean.propDisName)) {
|
|
|
@ -4204,15 +4390,23 @@ public class NewCodeItemDialog extends Dialog {
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
xh = ((Text) classTextList.get(i)).getText();
|
|
|
|
xh = ((Text) classTextList.get(i)).getText();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// icspro[i] = new ICSProperty(bean.propID, value);
|
|
|
|
|
|
|
|
System.out.println("型号:" + xh);
|
|
|
|
System.out.println("型号:" + xh);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (ysjth != null && !"".equals(ysjth.trim()) && ys == null) {
|
|
|
|
if ((ysjth == null || "".equals(ysjth)) && ys != null && !"".equals(ys.trim())) {
|
|
|
|
MessageBox.post("该物料不是颜色件", "错误", MessageBox.ERROR);
|
|
|
|
// int res = JOptionPane.showConfirmDialog(null, "如果该件是颜色件,请取消并填写颜色件图号", "提示",
|
|
|
|
return;
|
|
|
|
// JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE);
|
|
|
|
|
|
|
|
int res = ConfirmDialog.prompt(this.getShell(), "提示", "如果该件是颜色件,请按否并填写颜色件图号");
|
|
|
|
|
|
|
|
System.out.println("res======>" + res);
|
|
|
|
|
|
|
|
if (res == ConfirmationDialog.YES) {
|
|
|
|
|
|
|
|
System.out.println("YES");
|
|
|
|
|
|
|
|
// do nothing
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
System.out.println("NO OR CANCEL");
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (ysjth != null && !"".equals(ysjth.trim())) {
|
|
|
|
if (ysjth != null && !"".equals(ysjth.trim()) && ys != null && !"".equals(ys.trim())) {
|
|
|
|
TCComponent comp = null;
|
|
|
|
TCComponent comp = null;
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
comp = session.search("Item ID", new String[] { "零组件 ID" }, new String[] { ysjth })[0];
|
|
|
|
comp = session.search("Item ID", new String[] { "零组件 ID" }, new String[] { ysjth })[0];
|
|
|
@ -4230,8 +4424,8 @@ public class NewCodeItemDialog extends Dialog {
|
|
|
|
ysjTable = TCTableUtil.getTableRows(ysdzbForm, "jd2_ysdzb", colNames);
|
|
|
|
ysjTable = TCTableUtil.getTableRows(ysdzbForm, "jd2_ysdzb", colNames);
|
|
|
|
for (String[] row : ysjTable) {
|
|
|
|
for (String[] row : ysjTable) {
|
|
|
|
if (ys.equals(row[2])) {
|
|
|
|
if (ys.equals(row[2])) {
|
|
|
|
MessageBox.post("图号为\"" + ysjth + "\"的颜色件已存在颜色\"" + ys + "\"", "错误",
|
|
|
|
MessageBox.post("图号为\"" + ysjth + "\"的颜色件已存在颜色\"" + ys + "\"", "提示",
|
|
|
|
MessageBox.ERROR);
|
|
|
|
MessageBox.WARNING);
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -4239,11 +4433,57 @@ public class NewCodeItemDialog extends Dialog {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
MessageBox.post("没有找到与\"" + ysjth + "\"对应的图纸信息", "错误", MessageBox.ERROR);
|
|
|
|
MessageBox.post("没有找到与\"" + ysjth + "\"对应的图纸信息", "提示", MessageBox.WARNING);
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 物料图纸相互关联
|
|
|
|
|
|
|
|
gltz = null;
|
|
|
|
|
|
|
|
glwl = null;
|
|
|
|
|
|
|
|
System.out.println("物料图纸相互关联");
|
|
|
|
|
|
|
|
for (int i = 0; i < generalPropLabelList.size(); i++) {
|
|
|
|
|
|
|
|
String text = generalPropLabelList.get(i).getText();
|
|
|
|
|
|
|
|
if (text.equals("图号关联:")) {
|
|
|
|
|
|
|
|
String th = ((Text) generalPropTextList.get(i)).getText();
|
|
|
|
|
|
|
|
if (StrUtil.isNotBlank(th)) {
|
|
|
|
|
|
|
|
System.out.println("图号:" + th);
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
TCComponent[] comps = session.search("Item ID", new String[] { "零组件 ID" },
|
|
|
|
|
|
|
|
new String[] { th });
|
|
|
|
|
|
|
|
if (comps.length > 0) {
|
|
|
|
|
|
|
|
System.out.println(comps[0].getUid());
|
|
|
|
|
|
|
|
gltz = ((TCComponentItem) comps[0]).getLatestItemRevision();
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
MessageBox.post("图号不存在,请重新填写或清空值!", "提示", MessageBox.WARNING);
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (text.equals("物料号关联:")) {
|
|
|
|
|
|
|
|
String wlh = ((Text) generalPropTextList.get(i)).getText();
|
|
|
|
|
|
|
|
if (StrUtil.isNotBlank(wlh)) {
|
|
|
|
|
|
|
|
System.out.println("物料号:" + wlh);
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
TCComponent[] comps = session.search("Item ID", new String[] { "零组件 ID" },
|
|
|
|
|
|
|
|
new String[] { wlh });
|
|
|
|
|
|
|
|
if (comps.length > 0) {
|
|
|
|
|
|
|
|
System.out.println(comps[0].getUid());
|
|
|
|
|
|
|
|
glwl = ((TCComponentItem) comps[0]).getLatestItemRevision();
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
MessageBox.post("物料号不存在,请重新填写或清空值!", "提示", MessageBox.WARNING);
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TCComponentItem oldItem = tccomponentitemtype.find(getJYNewID(newID));
|
|
|
|
TCComponentItem oldItem = tccomponentitemtype.find(getJYNewID(newID));
|
|
|
|
if (oldItem != null) {
|
|
|
|
if (oldItem != null) {
|
|
|
|
MessageBox.post("ID为【" + getJYNewID(newID) + "】的物料已经存在!", "INFO", MessageBox.WARNING);
|
|
|
|
MessageBox.post("ID为【" + getJYNewID(newID) + "】的物料已经存在!", "INFO", MessageBox.WARNING);
|
|
|
@ -4509,15 +4749,15 @@ public class NewCodeItemDialog extends Dialog {
|
|
|
|
TCComponentForm form = (TCComponentForm) rev.getRelatedComponents("IMAN_master_form_rev")[0];
|
|
|
|
TCComponentForm form = (TCComponentForm) rev.getRelatedComponents("IMAN_master_form_rev")[0];
|
|
|
|
String type = form.getProperty("jd2_wllx");
|
|
|
|
String type = form.getProperty("jd2_wllx");
|
|
|
|
TCProperty tcProperty = form.getTCProperty("jd2_wllx");
|
|
|
|
TCProperty tcProperty = form.getTCProperty("jd2_wllx");
|
|
|
|
System.out.println(tcProperty==null?"非物料":tcProperty.getLOV());
|
|
|
|
System.out.println(tcProperty == null ? "非物料" : tcProperty.getLOV());
|
|
|
|
if (tcProperty != null) {
|
|
|
|
if (tcProperty != null) {
|
|
|
|
System.out.println("isLov");
|
|
|
|
System.out.println("isLov");
|
|
|
|
type = (String) form.getTCProperty("jd2_wllx").getLOV().getListOfValues().getRealValue(type);
|
|
|
|
type = (String) form.getTCProperty("jd2_wllx").getLOV().getListOfValues().getRealValue(type);
|
|
|
|
}else {
|
|
|
|
} else {
|
|
|
|
type="非物料";
|
|
|
|
type = "非物料";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
System.out.println("物料类型:" + type);
|
|
|
|
System.out.println("物料类型:" + type);
|
|
|
|
property.append(item.getProperty("object_type"));
|
|
|
|
property.append(item.getProperty("object_name"));
|
|
|
|
|
|
|
|
|
|
|
|
System.out.println(type);
|
|
|
|
System.out.println(type);
|
|
|
|
if (type != null && !"非物料".equals(type)) {
|
|
|
|
if (type != null && !"非物料".equals(type)) {
|
|
|
@ -4529,7 +4769,7 @@ public class NewCodeItemDialog extends Dialog {
|
|
|
|
flag = true;
|
|
|
|
flag = true;
|
|
|
|
for (int j = 0; j < row[3].split(",").length; j++) {
|
|
|
|
for (int j = 0; j < row[3].split(",").length; j++) {
|
|
|
|
int id = Integer.parseInt(row[3].split(",")[j]);
|
|
|
|
int id = Integer.parseInt(row[3].split(",")[j]);
|
|
|
|
if (map.get(id) != null) {
|
|
|
|
if (map.get(id) != null && !"".equals(map.get(id))) {
|
|
|
|
property.append("," + map.get(id));
|
|
|
|
property.append("," + map.get(id));
|
|
|
|
System.out.println(map.get(id));
|
|
|
|
System.out.println(map.get(id));
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -4542,7 +4782,7 @@ public class NewCodeItemDialog extends Dialog {
|
|
|
|
row = arr[2].split("/");
|
|
|
|
row = arr[2].split("/");
|
|
|
|
for (int j = 0; j < row[2].split(",").length; j++) {
|
|
|
|
for (int j = 0; j < row[2].split(",").length; j++) {
|
|
|
|
int id = Integer.parseInt(row[2].split(",")[j]);
|
|
|
|
int id = Integer.parseInt(row[2].split(",")[j]);
|
|
|
|
if (map.get(id) != null) {
|
|
|
|
if (map.get(id) != null && !"".equals(map.get(id))) {
|
|
|
|
property.append("," + map.get(id));
|
|
|
|
property.append("," + map.get(id));
|
|
|
|
System.out.println(map.get(id));
|
|
|
|
System.out.println(map.get(id));
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -4554,7 +4794,7 @@ public class NewCodeItemDialog extends Dialog {
|
|
|
|
row = arr[0].split("/");
|
|
|
|
row = arr[0].split("/");
|
|
|
|
for (int j = 0; j < row[2].split(",").length; j++) {
|
|
|
|
for (int j = 0; j < row[2].split(",").length; j++) {
|
|
|
|
int id = Integer.parseInt(row[2].split(",")[j]);
|
|
|
|
int id = Integer.parseInt(row[2].split(",")[j]);
|
|
|
|
if (map.get(id) != null) {
|
|
|
|
if (map.get(id) != null && !"".equals(map.get(id))) {
|
|
|
|
property.append("," + map.get(id));
|
|
|
|
property.append("," + map.get(id));
|
|
|
|
System.out.println(map.get(id));
|
|
|
|
System.out.println(map.get(id));
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -4564,7 +4804,7 @@ public class NewCodeItemDialog extends Dialog {
|
|
|
|
row = arr[1].split("/");
|
|
|
|
row = arr[1].split("/");
|
|
|
|
for (int j = 0; j < row[2].split(",").length; j++) {
|
|
|
|
for (int j = 0; j < row[2].split(",").length; j++) {
|
|
|
|
int id = Integer.parseInt(row[2].split(",")[j]);
|
|
|
|
int id = Integer.parseInt(row[2].split(",")[j]);
|
|
|
|
if (map.get(id) != null) {
|
|
|
|
if (map.get(id) != null && !"".equals(map.get(id))) {
|
|
|
|
property.append("," + map.get(id));
|
|
|
|
property.append("," + map.get(id));
|
|
|
|
System.out.println(map.get(id));
|
|
|
|
System.out.println(map.get(id));
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -4582,12 +4822,17 @@ public class NewCodeItemDialog extends Dialog {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public boolean sendToClassification() {
|
|
|
|
public boolean sendToClassification() {
|
|
|
|
|
|
|
|
if (classPropList.size() == 0) {
|
|
|
|
|
|
|
|
System.out.println("分类属性列表size=0");
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
TCComponentItem item = (TCComponentItem) newComp;
|
|
|
|
TCComponentItem item = (TCComponentItem) newComp;
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
String uid = item.getLatestItemRevision().getUid();
|
|
|
|
String uid = item.getLatestItemRevision().getUid();
|
|
|
|
String cid = codeRemark.trim();
|
|
|
|
String cid = codeRemark.trim();
|
|
|
|
List<Integer> idsList = new ArrayList<Integer>();
|
|
|
|
List<Integer> idsList = new ArrayList<Integer>();
|
|
|
|
List<String> valuesList = new ArrayList<String>();
|
|
|
|
List<String> valuesList = new ArrayList<String>();
|
|
|
|
|
|
|
|
List<String> namesList = new ArrayList<String>();
|
|
|
|
for (int i = 0; i < classPropList.size(); i++) {
|
|
|
|
for (int i = 0; i < classPropList.size(); i++) {
|
|
|
|
// System.out.println(" CLASS ID = " + integers[i] + " =" +
|
|
|
|
// System.out.println(" CLASS ID = " + integers[i] + " =" +
|
|
|
|
// vals[i]);
|
|
|
|
// vals[i]);
|
|
|
@ -4602,6 +4847,7 @@ public class NewCodeItemDialog extends Dialog {
|
|
|
|
// icspro[i] = new ICSProperty(bean.propID, value);
|
|
|
|
// icspro[i] = new ICSProperty(bean.propID, value);
|
|
|
|
if (!"".equals(value)) {
|
|
|
|
if (!"".equals(value)) {
|
|
|
|
idsList.add(bean.propID);
|
|
|
|
idsList.add(bean.propID);
|
|
|
|
|
|
|
|
namesList.add(bean.propDisName);
|
|
|
|
valuesList.add(value);
|
|
|
|
valuesList.add(value);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -4614,18 +4860,18 @@ public class NewCodeItemDialog extends Dialog {
|
|
|
|
|
|
|
|
|
|
|
|
System.out.println(Arrays.toString(ids));
|
|
|
|
System.out.println(Arrays.toString(ids));
|
|
|
|
System.out.println(Arrays.toString(values));
|
|
|
|
System.out.println(Arrays.toString(values));
|
|
|
|
JSONObject obj = new JSONObject();
|
|
|
|
cn.hutool.json.JSONObject obj = JSONUtil.createObj();
|
|
|
|
obj.put("ids", ids);
|
|
|
|
obj.put("ids", ids);
|
|
|
|
obj.put("values", values);
|
|
|
|
obj.put("values", values);
|
|
|
|
String prop = obj.toString();
|
|
|
|
String prop = obj.toString();
|
|
|
|
prop = prop.replace("\"", "\\\"");
|
|
|
|
// prop = prop.replace("\"", "\\\"");
|
|
|
|
System.out.println(prop);
|
|
|
|
System.out.println(prop);
|
|
|
|
String server = getPrefStr("jd2_server_ip");
|
|
|
|
String server = getPrefStr("jd2_server_ip");
|
|
|
|
if (server == null || "".equals(server)) {
|
|
|
|
if (server == null || "".equals(server)) {
|
|
|
|
MessageBox.post("未配置jd2_server_ip首选项", "错误", MessageBox.ERROR);
|
|
|
|
MessageBox.post("未配置jd2_server_ip首选项", "错误", MessageBox.ERROR);
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
String url = "http://" + server + ":8080/classification";
|
|
|
|
String url = "http://" + server + ":8880/api/sendClassification";
|
|
|
|
Map<String, Object> paramMap = new HashMap<String, Object>();
|
|
|
|
Map<String, Object> paramMap = new HashMap<String, Object>();
|
|
|
|
paramMap.put("uid", uid);
|
|
|
|
paramMap.put("uid", uid);
|
|
|
|
paramMap.put("cid", cid);
|
|
|
|
paramMap.put("cid", cid);
|
|
|
@ -4639,6 +4885,7 @@ public class NewCodeItemDialog extends Dialog {
|
|
|
|
public void run() {
|
|
|
|
public void run() {
|
|
|
|
// TODO Auto-generated method stub
|
|
|
|
// TODO Auto-generated method stub
|
|
|
|
cn.hutool.http.HttpUtil.post(URL, PARAMMAP);
|
|
|
|
cn.hutool.http.HttpUtil.post(URL, PARAMMAP);
|
|
|
|
|
|
|
|
setFLFH(namesList, values);
|
|
|
|
System.out.println("success");
|
|
|
|
System.out.println("success");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}).start();
|
|
|
|
}).start();
|
|
|
@ -4648,4 +4895,53 @@ public class NewCodeItemDialog extends Dialog {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void setFLFH(List<String> namesList, String[] values) {
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
TCComponentItemRevision rev = ((TCComponentItem) newComp).getLatestItemRevision();
|
|
|
|
|
|
|
|
rev.refresh();
|
|
|
|
|
|
|
|
String[] prefArr = getPrefStrArray("jd2_custom_display_name");
|
|
|
|
|
|
|
|
String classAddress = getClassificationAddress(rev.getClassificationClass());
|
|
|
|
|
|
|
|
System.out.println("classAddress=====>" + classAddress);
|
|
|
|
|
|
|
|
for (String pref : prefArr) {
|
|
|
|
|
|
|
|
String[] className = pref.split(":")[0].split("/");
|
|
|
|
|
|
|
|
if (classAddress.contains(className[0]) && classAddress.contains(className[1])) {
|
|
|
|
|
|
|
|
String[] prefClassNamesArr = pref.split(":")[1].split(",");
|
|
|
|
|
|
|
|
System.out.println("pref class porp names=====>" + Arrays.toString(prefClassNamesArr));
|
|
|
|
|
|
|
|
StringBuilder builder = new StringBuilder();
|
|
|
|
|
|
|
|
for (int i = 0; i < prefClassNamesArr.length; i++) {
|
|
|
|
|
|
|
|
for (int ii = 0; ii < namesList.size(); ii++) {
|
|
|
|
|
|
|
|
if (prefClassNamesArr[i].equals(namesList.get(ii)) && !"".equals(values[ii].trim())) {
|
|
|
|
|
|
|
|
builder.append(values[ii] + ",");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
String temp = builder.toString().substring(0, builder.toString().length() - 1);
|
|
|
|
|
|
|
|
System.out.println("class porp values=====>" + temp);
|
|
|
|
|
|
|
|
session.getUserService().call("bs_bypass", new Object[] { true });
|
|
|
|
|
|
|
|
rev.lock();
|
|
|
|
|
|
|
|
rev.setProperty("jd2_flfh", temp);
|
|
|
|
|
|
|
|
rev.save();
|
|
|
|
|
|
|
|
rev.unlock();
|
|
|
|
|
|
|
|
session.getUserService().call("bs_bypass", new Object[] { false });
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} catch (TCException e) {
|
|
|
|
|
|
|
|
// TODO Auto-generated catch block
|
|
|
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
|
|
|
JOptionPane.showMessageDialog(null, "首选项jd2_custom_display_name配置有误,请检查\r\n" + e.getMessage(), "提示",
|
|
|
|
|
|
|
|
JOptionPane.WARNING_MESSAGE);
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private String getClassificationAddress(String classId) throws TCException {
|
|
|
|
|
|
|
|
ICSAdminClass clazz = session.getClassificationService().newICSAdminClass();
|
|
|
|
|
|
|
|
clazz.load(classId);
|
|
|
|
|
|
|
|
if ("ICM".equals(clazz.askClassId())) {
|
|
|
|
|
|
|
|
return "根";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return clazz.getName() + "=>" + getClassificationAddress(clazz.getParent());
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|