|
|
|
@ -23,6 +23,7 @@ import java.util.Map.Entry;
|
|
|
|
|
import javax.swing.BorderFactory;
|
|
|
|
|
import javax.swing.ImageIcon;
|
|
|
|
|
import javax.swing.JButton;
|
|
|
|
|
import javax.swing.JComboBox;
|
|
|
|
|
import javax.swing.JFileChooser;
|
|
|
|
|
import javax.swing.JLabel;
|
|
|
|
|
import javax.swing.JMenuItem;
|
|
|
|
@ -31,6 +32,7 @@ import javax.swing.JPopupMenu;
|
|
|
|
|
import javax.swing.JTable;
|
|
|
|
|
import javax.swing.JTextField;
|
|
|
|
|
import javax.swing.SwingConstants;
|
|
|
|
|
import javax.swing.border.EmptyBorder;
|
|
|
|
|
import javax.swing.filechooser.FileFilter;
|
|
|
|
|
import javax.swing.table.DefaultTableCellRenderer;
|
|
|
|
|
|
|
|
|
@ -86,6 +88,10 @@ public class SampleConfirmationForm extends AbstractRendering {
|
|
|
|
|
private List<String> disableEdit2;
|
|
|
|
|
private JRadioPanel yssl;
|
|
|
|
|
private JCheckPanel mqjd;
|
|
|
|
|
private JComboBox<String> bpdj;
|
|
|
|
|
private JComboBox<String> fl;
|
|
|
|
|
private JComboBox<String> zt;
|
|
|
|
|
private JComboBox<String> jued;
|
|
|
|
|
private String[] colNames = { "jd2_no", "jd2_gg", "jd2_gg1", "jd2_gc", "jd2_gc1", "jd2_1", "jd2_2", "jd2_3",
|
|
|
|
|
"jd2_4", "jd2_5", "jd2_6", "jd2_7", "jd2_8", "jd2_9", "jd2_10", "jd2_min", "jd2_max", "jd2_jg" };
|
|
|
|
|
private String[] colNames1 = { "jd2_ctq1", "jd2_ctq2", "jd2_ctq3", "jd2_ctq4", "jd2_ctq5", "jd2_ctq6", "jd2_ctq7",
|
|
|
|
@ -94,6 +100,7 @@ public class SampleConfirmationForm extends AbstractRendering {
|
|
|
|
|
"jd2_ctq7", "jd2_ctq8" };
|
|
|
|
|
private String[] colNames3 = { "jd2_ctq1", "jd2_ctq2", "jd2_ctq3", "jd2_ctq4", "jd2_ctq5", "jd2_ctq6", "jd2_ctq7",
|
|
|
|
|
"jd2_ctq8" };
|
|
|
|
|
private Map<String, String> jgItems = new HashMap<String, String>();
|
|
|
|
|
private JMenuItem addP;
|
|
|
|
|
private JMenuItem delP;
|
|
|
|
|
private JMenuItem addR;
|
|
|
|
@ -102,6 +109,7 @@ public class SampleConfirmationForm extends AbstractRendering {
|
|
|
|
|
private JMenuItem addR2;
|
|
|
|
|
private JMenuItem insertR2;
|
|
|
|
|
private JMenuItem delR2;
|
|
|
|
|
private TCComponentItemRevision rev;
|
|
|
|
|
|
|
|
|
|
public SampleConfirmationForm(TCComponent arg0) throws Exception {
|
|
|
|
|
super(arg0);
|
|
|
|
@ -115,9 +123,17 @@ public class SampleConfirmationForm extends AbstractRendering {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void loadRendering() throws TCException {
|
|
|
|
|
jgItems.put("ºÏ¸ñ", "0");
|
|
|
|
|
jgItems.put("¾Ü¾ø", "1");
|
|
|
|
|
jgItems.put("±£Áô", "2");
|
|
|
|
|
jgItems.put("¸ü¸Äͼֽ", "3");
|
|
|
|
|
AIFComponentContext[] ref = form.whereReferenced();
|
|
|
|
|
rev = (TCComponentItemRevision) ref[0].getComponent();
|
|
|
|
|
|
|
|
|
|
setLayout(new BorderLayout());
|
|
|
|
|
JPanel root = new JPanel(new BorderLayout());
|
|
|
|
|
root.setPreferredSize(new Dimension(800, 600));
|
|
|
|
|
root.setBorder(new EmptyBorder(0, 0, 0, 25));
|
|
|
|
|
// 头部
|
|
|
|
|
JPanel buttons = new JPanel(new FlowLayout(FlowLayout.LEFT));
|
|
|
|
|
JButton confirm = new JButton("样品确认单");
|
|
|
|
@ -173,6 +189,9 @@ public class SampleConfirmationForm extends AbstractRendering {
|
|
|
|
|
if (value instanceof JPanel) {
|
|
|
|
|
return (JPanel) value;
|
|
|
|
|
}
|
|
|
|
|
if (value instanceof JComboBox) {
|
|
|
|
|
return (JComboBox<String>) value;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int maxPreferredHeight = 0;
|
|
|
|
|
for (int i = 0; i < table.getColumnCount(); i++) {
|
|
|
|
@ -237,6 +256,9 @@ public class SampleConfirmationForm extends AbstractRendering {
|
|
|
|
|
if (value instanceof JLabel) {
|
|
|
|
|
return (JLabel) value;
|
|
|
|
|
}
|
|
|
|
|
if (value instanceof JComboBox) {
|
|
|
|
|
return (JComboBox<String>) value;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int maxPreferredHeight = 0;
|
|
|
|
|
for (int i = 0; i < table.getColumnCount(); i++) {
|
|
|
|
@ -348,6 +370,7 @@ public class SampleConfirmationForm extends AbstractRendering {
|
|
|
|
|
if (prop.containsKey("jd2_ypqrdtable")) {
|
|
|
|
|
String[][] tableRows = TCTableUtil.getTableRows(form, "jd2_ypqrdtable", colNames);
|
|
|
|
|
System.out.println(Arrays.deepToString(tableRows));
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < tableRows.length; i++) {
|
|
|
|
|
for (int ii = 0; ii < tableRows[0].length; ii++) {
|
|
|
|
|
if (i + top + 2 > bottom) {
|
|
|
|
@ -357,7 +380,16 @@ public class SampleConfirmationForm extends AbstractRendering {
|
|
|
|
|
model.combine(new int[] { bottom }, new int[] { 2, 3, 4 });
|
|
|
|
|
bottom = model.getRowCount() - end;
|
|
|
|
|
}
|
|
|
|
|
model.setValueAt(tableRows[i][ii], i + top + 2, ii > 2 ? ii + 2 : ii);
|
|
|
|
|
if (ii == tableRows[0].length - 1) {
|
|
|
|
|
JComboBox<String> jgComBox = new JComboBox<String>();
|
|
|
|
|
for (Entry<String, String> entry : jgItems.entrySet()) {
|
|
|
|
|
jgComBox.addItem(entry.getKey());
|
|
|
|
|
}
|
|
|
|
|
jgComBox.setSelectedItem(tableRows[i][ii]);
|
|
|
|
|
model.setValueAt(jgComBox, i + top + 2, ii + 2);
|
|
|
|
|
} else {
|
|
|
|
|
model.setValueAt(tableRows[i][ii], i + top + 2, ii > 2 ? ii + 2 : ii);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
@ -618,7 +650,18 @@ public class SampleConfirmationForm extends AbstractRendering {
|
|
|
|
|
general.put("jd2_xh", new int[] { 6, 10 });
|
|
|
|
|
model.setValueAt("分类", 6, 14);
|
|
|
|
|
disableEdit.add("6,14");
|
|
|
|
|
general.put("jd2_fl", new int[] { 6, 17 });
|
|
|
|
|
fl = new JComboBox<String>();
|
|
|
|
|
try {
|
|
|
|
|
String[] items = form.getTCProperty("jd2_fl").getLOV().getListOfValues().getLOVDisplayValues();
|
|
|
|
|
for (String s : items) {
|
|
|
|
|
fl.addItem(s);
|
|
|
|
|
}
|
|
|
|
|
fl.setSelectedItem(form.getProperty("jd2_fl"));
|
|
|
|
|
model.setValueAt(fl, 6, 17);
|
|
|
|
|
} catch (TCException e) {
|
|
|
|
|
// TODO Auto-generated catch block
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
model.setValueAt("物料编码", 7, 0);
|
|
|
|
|
disableEdit.add("7,0");
|
|
|
|
|
general.put("jd2_wlbm", new int[] { 7, 2 });
|
|
|
|
@ -628,10 +671,32 @@ public class SampleConfirmationForm extends AbstractRendering {
|
|
|
|
|
model.setValueAt(yssl, 7, 10);
|
|
|
|
|
model.setValueAt("状态", 7, 14);
|
|
|
|
|
disableEdit.add("7,14");
|
|
|
|
|
general.put("jd2_zt", new int[] { 7, 17 });
|
|
|
|
|
zt = new JComboBox<String>();
|
|
|
|
|
try {
|
|
|
|
|
String[] items = form.getTCProperty("jd2_zt").getLOV().getListOfValues().getLOVDisplayValues();
|
|
|
|
|
for (String s : items) {
|
|
|
|
|
zt.addItem(s);
|
|
|
|
|
}
|
|
|
|
|
zt.setSelectedItem(form.getProperty("jd2_zt"));
|
|
|
|
|
model.setValueAt(zt, 7, 17);
|
|
|
|
|
} catch (TCException e) {
|
|
|
|
|
// TODO Auto-generated catch block
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
model.setValueAt("部品等级", 8, 0);
|
|
|
|
|
disableEdit.add("8,0");
|
|
|
|
|
general.put("jd2_bpdj", new int[] { 8, 2 });
|
|
|
|
|
bpdj = new JComboBox<String>();
|
|
|
|
|
try {
|
|
|
|
|
String[] items = form.getTCProperty("jd2_bpdj").getLOV().getListOfValues().getLOVDisplayValues();
|
|
|
|
|
for (String s : items) {
|
|
|
|
|
bpdj.addItem(s);
|
|
|
|
|
}
|
|
|
|
|
bpdj.setSelectedItem(form.getProperty("jd2_bpdj"));
|
|
|
|
|
model.setValueAt(bpdj, 8, 2);
|
|
|
|
|
} catch (TCException e) {
|
|
|
|
|
// TODO Auto-generated catch block
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
model.setValueAt("参考物料", 8, 8);
|
|
|
|
|
disableEdit.add("8,8");
|
|
|
|
|
model.setValueAt("jd2_ckwl", 8, 10);
|
|
|
|
@ -678,6 +743,11 @@ public class SampleConfirmationForm extends AbstractRendering {
|
|
|
|
|
model.setValueAt(i - 1 - top, i, 0);
|
|
|
|
|
disableEdit.add(i + ",0");
|
|
|
|
|
model.combine(new int[] { i }, new int[] { 2, 3, 4 });
|
|
|
|
|
JComboBox<String> jgComBox = new JComboBox<String>();
|
|
|
|
|
for (Entry<String, String> entry : jgItems.entrySet()) {
|
|
|
|
|
jgComBox.addItem(entry.getKey());
|
|
|
|
|
}
|
|
|
|
|
model.setValueAt(jgComBox, i, model.getColumnCount() - 1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
model.combine(new int[] { 0, 1 }, new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 });
|
|
|
|
@ -800,7 +870,18 @@ public class SampleConfirmationForm extends AbstractRendering {
|
|
|
|
|
pic.put("jd2_icqjyzds", new int[] { 10, 4 });
|
|
|
|
|
model3.setValueAt("决定", 11, 12);
|
|
|
|
|
disableEdit3.add(11 + ",12");
|
|
|
|
|
general3.put("jd2_jued", new int[] { 11, 15 });
|
|
|
|
|
jued = new JComboBox<String>();
|
|
|
|
|
try {
|
|
|
|
|
String[] items = form.getTCProperty("jd2_jued").getLOV().getListOfValues().getLOVDisplayValues();
|
|
|
|
|
for (String s : items) {
|
|
|
|
|
jued.addItem(s);
|
|
|
|
|
}
|
|
|
|
|
jued.setSelectedItem(form.getProperty("jd2_jued"));
|
|
|
|
|
model3.setValueAt(jued, 11, 15);
|
|
|
|
|
} catch (TCException e) {
|
|
|
|
|
// TODO Auto-generated catch block
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
pic.put("jd2_qtbg", new int[] { 9, 7 });
|
|
|
|
|
|
|
|
|
|
model3.combine(new int[] { 0 }, new int[] { 0, 1, 2, 3, 4, 5 });
|
|
|
|
@ -873,6 +954,34 @@ public class SampleConfirmationForm extends AbstractRendering {
|
|
|
|
|
}
|
|
|
|
|
form.setProperty("jd2_mqjd", value);
|
|
|
|
|
}
|
|
|
|
|
if (prop.containsKey("jd2_bpdj")) {
|
|
|
|
|
String value = bpdj.getSelectedItem() == null ? "" : bpdj.getSelectedItem().toString();
|
|
|
|
|
if (form.getTCProperty("jd2_bpdj").getLOV() != null && !"".equals(value)) {
|
|
|
|
|
value = (String) form.getTCProperty("jd2_bpdj").getLOV().getListOfValues().getRealValue(value);
|
|
|
|
|
}
|
|
|
|
|
form.setProperty("jd2_bpdj", value);
|
|
|
|
|
}
|
|
|
|
|
if (prop.containsKey("jd2_fl")) {
|
|
|
|
|
String value = fl.getSelectedItem() == null ? "" : fl.getSelectedItem().toString();
|
|
|
|
|
if (form.getTCProperty("jd2_fl").getLOV() != null && !"".equals(value)) {
|
|
|
|
|
value = (String) form.getTCProperty("jd2_fl").getLOV().getListOfValues().getRealValue(value);
|
|
|
|
|
}
|
|
|
|
|
form.setProperty("jd2_fl", value);
|
|
|
|
|
}
|
|
|
|
|
if (prop.containsKey("jd2_zt")) {
|
|
|
|
|
String value = zt.getSelectedItem() == null ? "" : zt.getSelectedItem().toString();
|
|
|
|
|
if (form.getTCProperty("jd2_zt").getLOV() != null && !"".equals(value)) {
|
|
|
|
|
value = (String) form.getTCProperty("jd2_zt").getLOV().getListOfValues().getRealValue(value);
|
|
|
|
|
}
|
|
|
|
|
form.setProperty("jd2_zt", value);
|
|
|
|
|
}
|
|
|
|
|
if (prop.containsKey("jd2_jued")) {
|
|
|
|
|
String value = jued.getSelectedItem() == null ? "" : jued.getSelectedItem().toString();
|
|
|
|
|
if (form.getTCProperty("jd2_jued").getLOV() != null && !"".equals(value)) {
|
|
|
|
|
value = (String) form.getTCProperty("jd2_jued").getLOV().getListOfValues().getRealValue(value);
|
|
|
|
|
}
|
|
|
|
|
form.setProperty("jd2_jued", value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} catch (TCException e) {
|
|
|
|
|
// TODO Auto-generated catch block
|
|
|
|
@ -919,10 +1028,11 @@ public class SampleConfirmationForm extends AbstractRendering {
|
|
|
|
|
String[] row = new String[18];
|
|
|
|
|
for (int ii = 0; ii < row.length; ii++) {
|
|
|
|
|
Object object = model.getValueAt(top + 2 + num, ii > 2 ? ii + 2 : ii);
|
|
|
|
|
if (object == null) {
|
|
|
|
|
row[ii] = "";
|
|
|
|
|
if (ii == row.length - 1) {
|
|
|
|
|
object = ((JComboBox<String>) object).getSelectedItem();
|
|
|
|
|
row[ii] = object == null ? "" : jgItems.get(object.toString());
|
|
|
|
|
} else {
|
|
|
|
|
row[ii] = object.toString();
|
|
|
|
|
row[ii] = object == null ? "" : object.toString();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
data.add(row);
|
|
|
|
@ -1123,14 +1233,23 @@ public class SampleConfirmationForm extends AbstractRendering {
|
|
|
|
|
TCComponentDataset dataset = datasetType.create(file.getName(), "", "Image");
|
|
|
|
|
dataset.setFiles(as1, as2);
|
|
|
|
|
TCComponent[] comps = form.getRelatedComponents();
|
|
|
|
|
AIFComponentContext[] ref = form.whereReferenced();
|
|
|
|
|
TCComponentItemRevision rev = (TCComponentItemRevision) ref[0].getComponent();
|
|
|
|
|
rev.add("IMAN_specification", dataset);
|
|
|
|
|
String uid = dataset.getUid();
|
|
|
|
|
System.out.println("uid:" + uid);
|
|
|
|
|
ImageIcon icon = new ImageIcon(file.getPath());
|
|
|
|
|
int row = table3.getSelectedRow();
|
|
|
|
|
int col = table3.getSelectedColumn();
|
|
|
|
|
String str = ((JLabel) model3.getValueAt(row, col)).getToolTipText();
|
|
|
|
|
if (str != null && !"".equals(str)) {
|
|
|
|
|
try {
|
|
|
|
|
TCComponentDataset oldDataset = (TCComponentDataset) session.stringToComponent(str);
|
|
|
|
|
rev.cutOperation("IMAN_specification", new TCComponent[] { oldDataset });
|
|
|
|
|
oldDataset.delete();
|
|
|
|
|
} catch (TCException e1) {
|
|
|
|
|
// TODO Auto-generated catch block
|
|
|
|
|
e1.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
int[] arr = model3.getSpan(row, col);
|
|
|
|
|
System.out.println("row:" + arr[0] + ",col:" + arr[1]);
|
|
|
|
|
icon.setImage(icon.getImage().getScaledInstance(
|
|
|
|
@ -1142,6 +1261,8 @@ public class SampleConfirmationForm extends AbstractRendering {
|
|
|
|
|
label.addMouseListener(showImg(file.getPath()));
|
|
|
|
|
label.setToolTipText(uid);
|
|
|
|
|
model3.setValueAt(label, table3.getSelectedRow(), table3.getSelectedColumn());
|
|
|
|
|
table3.revalidate();
|
|
|
|
|
table3.repaint();
|
|
|
|
|
} catch (TCException e1) {
|
|
|
|
|
// TODO Auto-generated catch block
|
|
|
|
|
e1.printStackTrace();
|
|
|
|
@ -1161,7 +1282,20 @@ public class SampleConfirmationForm extends AbstractRendering {
|
|
|
|
|
// TODO Auto-generated method stub
|
|
|
|
|
int row = table3.getSelectedRow();
|
|
|
|
|
int col = table3.getSelectedColumn();
|
|
|
|
|
String uid = ((JLabel) model3.getValueAt(row, col)).getToolTipText();
|
|
|
|
|
if (uid != null && !"".equals(uid)) {
|
|
|
|
|
try {
|
|
|
|
|
TCComponentDataset dataset = (TCComponentDataset) session.stringToComponent(uid);
|
|
|
|
|
rev.cutOperation("IMAN_specification", new TCComponent[] { dataset });
|
|
|
|
|
dataset.delete();
|
|
|
|
|
} catch (TCException e1) {
|
|
|
|
|
// TODO Auto-generated catch block
|
|
|
|
|
e1.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
model3.setValueAt(new JLabel(""), row, col);
|
|
|
|
|
table3.revalidate();
|
|
|
|
|
table3.repaint();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
@ -1183,7 +1317,6 @@ public class SampleConfirmationForm extends AbstractRendering {
|
|
|
|
|
// initModel();
|
|
|
|
|
table.revalidate();
|
|
|
|
|
table.repaint();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
return actionListener;
|
|
|
|
@ -1199,6 +1332,8 @@ public class SampleConfirmationForm extends AbstractRendering {
|
|
|
|
|
model2.insertRow(++bottom2);
|
|
|
|
|
model2.setValueAt(num + 1, bottom2, 0);
|
|
|
|
|
model2.combine(new int[] { bottom2 }, new int[] { 0, 1 });
|
|
|
|
|
table2.revalidate();
|
|
|
|
|
table2.repaint();
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
return actionListener;
|
|
|
|
@ -1242,6 +1377,8 @@ public class SampleConfirmationForm extends AbstractRendering {
|
|
|
|
|
model2.setValueAt(num + i - row, i, 0);
|
|
|
|
|
}
|
|
|
|
|
model2.combine(new int[] { row }, new int[] { 0, 1 });
|
|
|
|
|
table2.revalidate();
|
|
|
|
|
table2.repaint();
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
return actionListener;
|
|
|
|
@ -1287,6 +1424,8 @@ public class SampleConfirmationForm extends AbstractRendering {
|
|
|
|
|
model2.setValueAt(num + i - row, i, 0);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
table2.revalidate();
|
|
|
|
|
table2.repaint();
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
return actionListener;
|
|
|
|
|