diff --git a/com.connor.jd.plm/.classpath b/com.connor.jd.plm/.classpath index 5862cd5..aed57d5 100644 --- a/com.connor.jd.plm/.classpath +++ b/com.connor.jd.plm/.classpath @@ -1,5 +1,6 @@ + diff --git a/com.connor.jd.plm/META-INF/MANIFEST.MF b/com.connor.jd.plm/META-INF/MANIFEST.MF index cad01e9..ad8d3d3 100644 --- a/com.connor.jd.plm/META-INF/MANIFEST.MF +++ b/com.connor.jd.plm/META-INF/MANIFEST.MF @@ -17,7 +17,6 @@ Require-Bundle: org.eclipse.ui;bundle-version="3.108.0", Automatic-Module-Name: JDProject Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Export-Package: com.connor.jd.plm.action, - com.connor.jd.plm.db, com.connor.jd.plm.dialog, com.connor.jd.plm.form, com.connor.jd.plm.handlers, @@ -51,6 +50,6 @@ Bundle-ClassPath: ., lib/poi-ooxml-schemas-4.1.1.jar, lib/poi-scratchpad-4.1.1.jar, lib/xmlbeans-3.1.0.jar, - src/com/connor/jd/plm/db/ + lib/commons-lang3-3.9.jar, lib/ojdbc6.jar, - lib/commons-lang3-3.9.jar + config/ diff --git a/com.connor.jd.plm/build.properties b/com.connor.jd.plm/build.properties index 50cbbff..22a88a1 100644 --- a/com.connor.jd.plm/build.properties +++ b/com.connor.jd.plm/build.properties @@ -22,7 +22,7 @@ bin.includes = plugin.xml,\ lib/poi-ooxml-schemas-4.1.1.jar,\ lib/poi-scratchpad-4.1.1.jar,\ lib/xmlbeans-3.1.0.jar,\ - src/com/connor/jd/plm/db/,\ lib/ojdbc6.jar,\ - lib/commons-lang3-3.9.jar + lib/commons-lang3-3.9.jar,\ + config/ diff --git a/com.connor.jd.plm/src/com/connor/jd/plm/db/db.setting b/com.connor.jd.plm/config/db.setting similarity index 60% rename from com.connor.jd.plm/src/com/connor/jd/plm/db/db.setting rename to com.connor.jd.plm/config/db.setting index e682982..dbbfc73 100644 --- a/com.connor.jd.plm/src/com/connor/jd/plm/db/db.setting +++ b/com.connor.jd.plm/config/db.setting @@ -1,8 +1,8 @@ ## db.setting文件 url = jdbc:oracle:thin:@localhost:1521:TC -user = root -pass = 123456 +user = infodba +pass = infodba ## 可选配置 # 是否在日志中显示执行的SQL @@ -10,6 +10,4 @@ showSql = true # 是否格式化显示的SQL formatSql = false # 是否显示SQL参数 -showParams = true -# 打印SQL的日志等级,默认debug,可以是info、warn、error -sqlLevel = debug \ No newline at end of file +showParams = true \ No newline at end of file diff --git a/com.connor.jd.plm/src/com/connor/jd/plm/dialog/EditClassificationDialog.java b/com.connor.jd.plm/src/com/connor/jd/plm/dialog/EditClassificationDialog.java index 895b62e..372419d 100644 --- a/com.connor.jd.plm/src/com/connor/jd/plm/dialog/EditClassificationDialog.java +++ b/com.connor.jd.plm/src/com/connor/jd/plm/dialog/EditClassificationDialog.java @@ -154,23 +154,23 @@ public class EditClassificationDialog extends AbstractAIFDialog { TCComponentItemRevision rev = (TCComponentItemRevision) target; saveClassification(rev); - try { - System.out.println(rev.getProperty("object_string")); - if (rev.getType().equals("JD2_GTBJRevision")) { - TCComponent[] comps = rev.getReferenceListProperty("TC_Is_Represented_By"); - System.out.println(comps.length); - for (int i = 0; i < comps.length; i++) { - if (comps[i].getType().equals("JD2_XYJTZRevision")) { - System.out.println("object_string:" + comps[i].getProperty("object_string")); - TCComponentItemRevision tzrev = (TCComponentItemRevision) comps[i]; - saveClassification(tzrev); - } - } - } - } catch (TCException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } +// try { +// System.out.println(rev.getProperty("object_string")); +// if (rev.getType().equals("JD2_GTBJRevision")) { +// TCComponent[] comps = rev.getReferenceListProperty("TC_Is_Represented_By"); +// System.out.println(comps.length); +// for (int i = 0; i < comps.length; i++) { +// if (comps[i].getType().equals("JD2_XYJTZRevision")) { +// System.out.println("object_string:" + comps[i].getProperty("object_string")); +// TCComponentItemRevision tzrev = (TCComponentItemRevision) comps[i]; +// saveClassification(tzrev); +// } +// } +// } +// } catch (TCException e1) { +// // TODO Auto-generated catch block +// e1.printStackTrace(); +// } DIALOG.disposeDialog(); } }; diff --git a/com.connor.jd.plm/src/com/connor/jd/plm/form/ComponentTestFrame.java b/com.connor.jd.plm/src/com/connor/jd/plm/form/ComponentTestFrame.java index 49887e6..cb9114a 100644 --- a/com.connor.jd.plm/src/com/connor/jd/plm/form/ComponentTestFrame.java +++ b/com.connor.jd.plm/src/com/connor/jd/plm/form/ComponentTestFrame.java @@ -5,48 +5,79 @@ import java.awt.Color; import java.awt.Component; import java.awt.Container; import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.ScrollPane; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; import javax.swing.BorderFactory; -import javax.swing.DefaultCellEditor; +import javax.swing.JButton; import javax.swing.JCheckBox; import javax.swing.JFrame; +import javax.swing.JPanel; import javax.swing.JTable; +import javax.swing.JTextField; import javax.swing.SwingConstants; import javax.swing.table.DefaultTableCellRenderer; import com.connor.jd.plm.table.CTMap; import com.connor.jd.plm.table.CTable; +import com.connor.jd.plm.table.MyCellEditor4; +import com.connor.jd.plm.table.TCTableUtil; +import com.teamcenter.rac.aifrcp.AIFUtility; +import com.teamcenter.rac.kernel.TCComponentForm; +import com.teamcenter.rac.kernel.TCComponentItem; +import com.teamcenter.rac.kernel.TCComponentItemRevision; +import com.teamcenter.rac.kernel.TCComponentItemType; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCSession; + +import cn.hutool.db.Db; +import cn.hutool.db.Entity; public class ComponentTestFrame extends JFrame { - private String[] arr; private CTMap model; private CTable table; + private List list; + private int bottom; + private Container container; + private TCComponentForm form; + private TCSession session; + private MyCallBack callBack; private static ComponentTestFrame instance; - public static ComponentTestFrame getInstance(String[] row) { + public static ComponentTestFrame getInstance(TCComponentForm form, MyCallBack callBack) { if (instance == null) { - instance = new ComponentTestFrame(row); + instance = new ComponentTestFrame(form); + instance.callBack = callBack; } else { - instance.arr = row; + instance.bottom = 0; + instance.form = form; instance.init(); } return instance; } - private ComponentTestFrame(String[] row) { - this.arr = row; + private ComponentTestFrame(TCComponentForm form) { + this.form = form; + this.session = (TCSession) AIFUtility.getCurrentApplication().getSession(); this.init(); } private void init() { this.setTitle("部件测试项目"); - this.setPreferredSize(new Dimension(700, 500)); + this.setSize(560, 400); this.setResizable(true); + this.setAlwaysOnTop(true); this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); - Container container = this.getContentPane(); + container = this.getContentPane(); container.setLayout(new BorderLayout()); + container.setPreferredSize(new Dimension(600, 400)); model = new CTMap(10, 7); model.setValueAt("序号", 0, 0); @@ -69,7 +100,7 @@ public class ComponentTestFrame extends JFrame { table.setRowHeight(25); table.setBorder(BorderFactory.createLineBorder(Color.black)); for (int i = 0; i < model.getColumnCount(); i++) { - table.getColumnModel().getColumn(i).setPreferredWidth(100); + table.getColumnModel().getColumn(i).setPreferredWidth(80); } DefaultTableCellRenderer tcr1 = new DefaultTableCellRenderer() { // 重写方法 @@ -106,11 +137,129 @@ public class ComponentTestFrame extends JFrame { }; tcr1.setHorizontalAlignment(SwingConstants.CENTER); table.setDefaultRenderer(Object.class, tcr1); - table.getColumnModel().getColumn(6).setCellEditor(new DefaultCellEditor(new JCheckBox())); + table.getColumnModel().getColumn(6).setCellEditor(new MyCellEditor4(new JTextField())); // 填写数据 + try { + list = Db.use().findAll("JD2_COMPONENT"); + bottom = list.size(); + for (int i = 0; i < bottom; i++) { + if (i > model.getRowCount() - 2) { + model.addRow(); + } + int row = i + 1; + model.setValueAt(row, row, 0); + model.setValueAt(list.get(i).getStr("TEST_TYPE"), row, 1); + model.setValueAt(list.get(i).getStr("TEST_PROJECT"), row, 2); + model.setValueAt(list.get(i).getStr("TEST_TIME"), row, 3); + model.setValueAt(list.get(i).getInt("TEST_NUM"), row, 4); + model.setValueAt(list.get(i).getInt("TEST_COST"), row, 5); + model.setValueAt(new JCheckBox(), row, 6); + + System.out.println(list.get(i).toString()); + } + } catch (SQLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + // 按钮 + JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); + JButton createTest = new JButton("创建测试计划"); + createTest.addActionListener(createTest()); + JButton addTestItem = new JButton("新增测试项"); + addTestItem.addActionListener(addTestItem()); + JButton cancel = new JButton("取消"); + cancel.addActionListener(cancel()); + buttonPanel.add(createTest); + buttonPanel.add(addTestItem); + buttonPanel.add(cancel); + + ScrollPane scrollPane = new ScrollPane(); + scrollPane.add(table); + + container.add(scrollPane, BorderLayout.CENTER); + container.add(buttonPanel, BorderLayout.SOUTH); this.setVisible(true); } + private ActionListener createTest() { + return new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + // TODO Auto-generated method stub + try { + TCComponentItemRevision rev = (TCComponentItemRevision) form.whereReferenced()[0].getComponent(); + + TCComponentItemType type = (TCComponentItemType) session.getTypeComponent("Item"); + String itemId = type.getNewID(); + String itemRev = type.getNewRev(null); + TCComponentItem item = type.create(itemId, itemRev, "JD2_GTCSJH", rev.getProperty("item_id"), "", + null); + rev.add("JD2_CSJH", item); + TCComponentItemRevision rev1 = item.getLatestItemRevision(); + TCComponentForm form1 = (TCComponentForm) rev1.getRelatedComponents("IMAN_master_form_rev")[0]; + String[] colNames = new String[] { "jd2_wtry", "jd2_syxm", "jd2_syts", "jd2_syzq", "jd2_syfy" }; + List list = new ArrayList(); + String[] row = new String[5]; + for (int i = 1; i <= bottom; i++) { + JCheckBox jb = (JCheckBox) model.getValueAt(i, 6); + if (jb.isSelected()) { + for (int ii = 2; ii < 6; ii++) { + row[ii - 2] = model.getValueAt(i, ii) == null ? "" : model.getValueAt(i, ii).toString(); + } + list.add(new String[] { session.getUserName(), row[0], row[2], row[1], row[3] }); + } + } + String[][] data = list.toArray(new String[list.size()][5]); + TCTableUtil.setTableRows(form1, "jd2_csjh", "JD2_CSJHTABLE", colNames, data); + callBack.execute(itemId); + dispose(); + } catch (TCException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } + } + }; + } + + private ActionListener addTestItem() { + return new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + // TODO Auto-generated method stub + if (bottom > model.getRowCount() - 2) { + model.addRow(); + } + int num = 1; + if (bottom > 0) { + num = Integer.parseInt(model.getValueAt(bottom, 0).toString()); + } + model.setValueAt(num + 1, ++bottom, 0); + model.setValueAt(new JCheckBox(), bottom, 6); + } + }; + } + + @Override + public void dispose() { + // TODO Auto-generated method stub + container.removeAll(); + super.dispose(); + } + + private ActionListener cancel() { + return new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + // TODO Auto-generated method stub + dispose(); + } + }; + } + } diff --git a/com.connor.jd.plm/src/com/connor/jd/plm/form/ExperimentalPowerOfAttorneyForm.java b/com.connor.jd.plm/src/com/connor/jd/plm/form/ExperimentalPowerOfAttorneyForm.java index 3ad8321..12f484e 100644 --- a/com.connor.jd.plm/src/com/connor/jd/plm/form/ExperimentalPowerOfAttorneyForm.java +++ b/com.connor.jd.plm/src/com/connor/jd/plm/form/ExperimentalPowerOfAttorneyForm.java @@ -4,6 +4,7 @@ import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; import java.awt.Dimension; +import java.awt.ScrollPane; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; @@ -34,7 +35,7 @@ import com.teamcenter.rac.kernel.TCComponentForm; import com.teamcenter.rac.kernel.TCException; import com.teamcenter.rac.stylesheet.AbstractRendering; -public class ExperimentalPowerOfAttorneyForm extends AbstractRendering { +public class ExperimentalPowerOfAttorneyForm extends AbstractRendering implements MyCallBack { private TCComponentForm form; private CTMap model; private CTable table; @@ -52,6 +53,7 @@ public class ExperimentalPowerOfAttorneyForm extends AbstractRendering { private String[] colNames = new String[] { "jd2_no", "jd2_name", "jd2_bgq", "jd2_bgh", "jd2_risk", "jd2_csjh", "jd2_bz" }; private String[][] rows; + private ExperimentalPowerOfAttorneyForm $this; public ExperimentalPowerOfAttorneyForm(TCComponent arg0) throws Exception { super(arg0); @@ -63,119 +65,18 @@ public class ExperimentalPowerOfAttorneyForm extends AbstractRendering { @Override public void loadRendering() throws TCException { + $this = this; + this.setLayout(new BorderLayout()); JPanel root = new JPanel(new BorderLayout()); - root.setPreferredSize(new Dimension(800, 600)); + root.setPreferredSize(new Dimension(800, 500)); // 内容 prop = form.getProperties(); model = new CTMap(20, 11); bottom = model.getRowCount() - end; - disableEdit = new ArrayList<>();// 不允许编辑 - general = new HashMap();// 要填写的一般属性 - model.setValueAt("吉德", 0, 0); - disableEdit.add("0,0"); - model.setValueAt("试验委托书", 0, 3); - disableEdit.add("0,3"); - model.setValueAt("表号", 0, 8); - disableEdit.add("0,8"); - model.setValueAt("生效期", 1, 8); - disableEdit.add("1,8"); - general.put("jd2_bh", new int[] { 0, 9 }); - general.put("jd2_sxq", new int[] { 1, 9 }); - model.setValueAt("委托项目:", 3, 0); - disableEdit.add("3,0"); - model.setValueAt("委托部门:", 4, 0); - disableEdit.add("4,0"); - general.put("jd2_wtxm", new int[] { 3, 3 }); - general.put("jd2_wtbm", new int[] { 4, 3 }); - model.setValueAt("供货厂家:", 3, 6); - disableEdit.add("3,6"); - model.setValueAt("接受部门:", 4, 6); - disableEdit.add("4,6"); - general.put("jd2_ghcj", new int[] { 3, 8 }); - general.put("jd2_jsbm", new int[] { 4, 8 }); - model.setValueAt("变更区分:", 5, 0); - bgqf = new JCheckPanel(new String[] { "复制模", "降本", "二元化", "改善优化", "新规部品" }); - model.setValueAt(bgqf, 5, 2); - model.setValueAt("部品型号:", 7, 0); - disableEdit.add("7,0"); - general.put("jd2_bpxh", new int[] { 7, 2 }); - model.setValueAt("适用型号:", 7, 6); - disableEdit.add("7,6"); - general.put("jd2_syxh", new int[] { 7, 7 }); - model.setValueAt("变更内容", 8, 0); - disableEdit.add("8,0"); - - model.setValueAt("NO", top, 0); - disableEdit.add(top + ",0"); - model.setValueAt("名称", top, 1); - disableEdit.add(top + ",1"); - model.setValueAt("变更前", top, 2); - disableEdit.add(top + ",2"); - model.setValueAt("变更后", top, 5); - disableEdit.add(top + ",5"); - model.setValueAt("Risk", top, 8); - disableEdit.add(top + ",8"); - model.setValueAt("测试计划", top, 9); - disableEdit.add(top + ",9"); - model.setValueAt("备注", top, 10); - disableEdit.add(top + ",10"); - - model.setValueAt("预计完成日期:", bottom, 0); - disableEdit.add(bottom + ",0"); - general.put("jd2_yjwcrq", new int[] { bottom, 2 }); - model.setValueAt("编制签名:", bottom + 1, 0); - disableEdit.add(bottom + 1 + ",0"); - model.setValueAt("批准签名:", bottom + 2, 0); - disableEdit.add(bottom + 3 + ",0"); - general.put("jd2_bz", new int[] { bottom + 2, 2 }); - general.put("jd2_pz", new int[] { bottom + 3, 2 }); - model.setValueAt("编制时间:", bottom + 2, 5); - disableEdit.add(bottom + 2 + ",5"); - model.setValueAt("批准时间:", bottom + 3, 5); - disableEdit.add(bottom + 3 + ",5"); - general.put("jd2_bzrq", new int[] { bottom + 2, 8 }); - general.put("jd2_pzrq", new int[] { bottom + 3, 8 }); - model.combine(new int[] { 0, 1, 2 }, new int[] { 0, 1, 2 }); - model.combine(new int[] { 0, 1, 2 }, new int[] { 3, 4, 5, 6, 7 }); - model.combine(new int[] { 0 }, new int[] { 9, 10 }); - model.combine(new int[] { 1 }, new int[] { 9, 10 }); - model.combine(new int[] { 2 }, new int[] { 8, 9, 10 }); - model.combine(new int[] { 3 }, new int[] { 0, 1, 2 }); - model.combine(new int[] { 3 }, new int[] { 3, 4, 5 }); - model.combine(new int[] { 3 }, new int[] { 6, 7 }); - model.combine(new int[] { 3 }, new int[] { 8, 9, 10 }); - model.combine(new int[] { 4 }, new int[] { 0, 1, 2 }); - model.combine(new int[] { 4 }, new int[] { 3, 4, 5 }); - model.combine(new int[] { 4 }, new int[] { 6, 7 }); - model.combine(new int[] { 4 }, new int[] { 8, 9, 10 }); - model.combine(new int[] { 5 }, new int[] { 0, 1 }); - model.combine(new int[] { 5 }, new int[] { 2, 3, 4, 5, 6, 7, 8, 9, 10 }); - model.combine(new int[] { 6 }, new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }); - model.combine(new int[] { 7 }, new int[] { 0, 1 }); - model.combine(new int[] { 7 }, new int[] { 2, 3, 4, 5 }); - model.combine(new int[] { 7 }, new int[] { 7, 8, 9, 10 }); - model.combine(new int[] { 8, 9 }, new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }); - model.combine(new int[] { top }, new int[] { 2, 3, 4 }); - model.combine(new int[] { top }, new int[] { 5, 6, 7 }); - for (int i = top + 1; i <= bottom; i++) { - model.combine(new int[] { i }, new int[] { 2, 3, 4 }); - model.combine(new int[] { i }, new int[] { 5, 6, 7 }); - model.setValueAt(i - top, i, 0); - disableEdit.add(i + ",0"); - } - model.combine(new int[] { bottom + 1 }, new int[] { 0, 1 }); - model.combine(new int[] { bottom + 1 }, new int[] { 2, 3, 4, 5, 6, 7, 8, 9, 10 }); - model.combine(new int[] { bottom + 2 }, new int[] { 0, 1 }); - model.combine(new int[] { bottom + 2 }, new int[] { 2, 3, 4 }); - model.combine(new int[] { bottom + 2 }, new int[] { 5, 6, 7 }); - model.combine(new int[] { bottom + 2 }, new int[] { 8, 9, 10 }); - model.combine(new int[] { bottom + 3 }, new int[] { 0, 1 }); - model.combine(new int[] { bottom + 3 }, new int[] { 2, 3, 4 }); - model.combine(new int[] { bottom + 3 }, new int[] { 5, 6, 7 }); - model.combine(new int[] { bottom + 3 }, new int[] { 8, 9, 10 }); + initModel(); table = new CTable(model) { @Override @@ -235,6 +136,7 @@ public class ExperimentalPowerOfAttorneyForm extends AbstractRendering { } }; tcr1.setHorizontalAlignment(SwingConstants.CENTER); + table.setAutoResizeMode(CTable.AUTO_RESIZE_NEXT_COLUMN); table.setDefaultRenderer(Object.class, tcr1); table.getColumnModel().getColumn(2).setCellEditor(new MyCellEditor3(new JTextField())); table.addMouseListener(rightClick()); @@ -272,14 +174,125 @@ public class ExperimentalPowerOfAttorneyForm extends AbstractRendering { if (top + i + 1 > bottom) { this.addRow(); } - model.setValueAt(rows[i], top + i + 1, i > 2 ? i > 3 ? i + 4 : i + 2 : i); + for (int ii = 0; ii < rows[0].length; ii++) { + model.setValueAt(rows[i][ii], top + i + 1, ii > 2 ? ii > 3 ? ii + 4 : ii + 2 : ii); + } } - root.add(table, BorderLayout.CENTER); + ScrollPane pane = new ScrollPane(); + pane.add(table); + root.add(pane); this.add(menu); this.add(root); } + private void initModel() { + disableEdit = new ArrayList<>();// 不允许编辑 + general = new HashMap();// 要填写的一般属性 + model.setValueAt("吉德", 0, 0); + disableEdit.add("0,0"); + model.setValueAt("试验委托书", 0, 3); + disableEdit.add("0,3"); + model.setValueAt("表号", 0, 8); + disableEdit.add("0,8"); + model.setValueAt("生效期", 1, 8); + disableEdit.add("1,8"); + general.put("jd2_bh", new int[] { 0, 9 }); + general.put("jd2_sxq", new int[] { 1, 9 }); + model.setValueAt("委托项目:", 3, 0); + disableEdit.add("3,0"); + model.setValueAt("委托部门:", 4, 0); + disableEdit.add("4,0"); + general.put("jd2_wtxm", new int[] { 3, 3 }); + general.put("jd2_wtbm", new int[] { 4, 3 }); + model.setValueAt("供货厂家:", 3, 6); + disableEdit.add("3,6"); + model.setValueAt("接受部门:", 4, 6); + disableEdit.add("4,6"); + general.put("jd2_ghcj", new int[] { 3, 8 }); + general.put("jd2_jsbm", new int[] { 4, 8 }); + model.setValueAt("变更区分:", 5, 0); + bgqf = new JCheckPanel(new String[] { "复制模", "降本", "二元化", "改善优化", "新规部品" }); + model.setValueAt(bgqf, 5, 2); + model.setValueAt("部品型号:", 7, 0); + disableEdit.add("7,0"); + general.put("jd2_bpxh", new int[] { 7, 2 }); + model.setValueAt("适用型号:", 7, 6); + disableEdit.add("7,6"); + general.put("jd2_syxh", new int[] { 7, 7 }); + model.setValueAt("变更内容", 8, 0); + disableEdit.add("8,0"); + + model.setValueAt("NO", top, 0); + disableEdit.add(top + ",0"); + model.setValueAt("名称", top, 1); + disableEdit.add(top + ",1"); + model.setValueAt("变更前", top, 2); + disableEdit.add(top + ",2"); + model.setValueAt("变更后", top, 5); + disableEdit.add(top + ",5"); + model.setValueAt("Risk", top, 8); + disableEdit.add(top + ",8"); + model.setValueAt("测试计划", top, 9); + disableEdit.add(top + ",9"); + model.setValueAt("备注", top, 10); + disableEdit.add(top + ",10"); + + model.setValueAt("预计完成日期:", bottom + 1, 0); + disableEdit.add(bottom + 1 + ",0"); + general.put("jd2_yjwcrq", new int[] { bottom + 1, 2 }); + model.setValueAt("编制签名:", bottom + 2, 0); + disableEdit.add(bottom + 2 + ",0"); + model.setValueAt("批准签名:", bottom + 3, 0); + disableEdit.add(bottom + 3 + ",0"); + general.put("jd2_bz", new int[] { bottom + 2, 2 }); + general.put("jd2_pz", new int[] { bottom + 3, 2 }); + model.setValueAt("编制时间:", bottom + 2, 5); + disableEdit.add(bottom + 2 + ",5"); + model.setValueAt("批准时间:", bottom + 3, 5); + disableEdit.add(bottom + 3 + ",5"); + general.put("jd2_bzrq", new int[] { bottom + 2, 8 }); + general.put("jd2_pzrq", new int[] { bottom + 3, 8 }); + model.combine(new int[] { 0, 1, 2 }, new int[] { 0, 1, 2 }); + model.combine(new int[] { 0, 1, 2 }, new int[] { 3, 4, 5, 6, 7 }); + model.combine(new int[] { 0 }, new int[] { 9, 10 }); + model.combine(new int[] { 1 }, new int[] { 9, 10 }); + model.combine(new int[] { 2 }, new int[] { 8, 9, 10 }); + model.combine(new int[] { 3 }, new int[] { 0, 1, 2 }); + model.combine(new int[] { 3 }, new int[] { 3, 4, 5 }); + model.combine(new int[] { 3 }, new int[] { 6, 7 }); + model.combine(new int[] { 3 }, new int[] { 8, 9, 10 }); + model.combine(new int[] { 4 }, new int[] { 0, 1, 2 }); + model.combine(new int[] { 4 }, new int[] { 3, 4, 5 }); + model.combine(new int[] { 4 }, new int[] { 6, 7 }); + model.combine(new int[] { 4 }, new int[] { 8, 9, 10 }); + model.combine(new int[] { 5 }, new int[] { 0, 1 }); + model.combine(new int[] { 5 }, new int[] { 2, 3, 4, 5, 6, 7, 8, 9, 10 }); + model.combine(new int[] { 6 }, new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }); + model.combine(new int[] { 7 }, new int[] { 0, 1 }); + model.combine(new int[] { 7 }, new int[] { 2, 3, 4, 5 }); + model.combine(new int[] { 7 }, new int[] { 7, 8, 9, 10 }); + model.combine(new int[] { 8, 9 }, new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }); + model.combine(new int[] { top }, new int[] { 2, 3, 4 }); + model.combine(new int[] { top }, new int[] { 5, 6, 7 }); + for (int i = top + 1; i <= bottom; i++) { + model.combine(new int[] { i }, new int[] { 2, 3, 4 }); + model.combine(new int[] { i }, new int[] { 5, 6, 7 }); + model.setValueAt(i - top, i, 0); + disableEdit.add(i + ",0"); + } + model.combine(new int[] { bottom + 1 }, new int[] { 0, 1 }); + model.combine(new int[] { bottom + 1 }, new int[] { 2, 3, 4, 5, 6, 7, 8, 9, 10 }); + model.combine(new int[] { bottom + 2 }, new int[] { 0, 1 }); + model.combine(new int[] { bottom + 2 }, new int[] { 2, 3, 4 }); + model.combine(new int[] { bottom + 2 }, new int[] { 5, 6, 7 }); + model.combine(new int[] { bottom + 2 }, new int[] { 8, 9, 10 }); + model.combine(new int[] { bottom + 3 }, new int[] { 0, 1 }); + model.combine(new int[] { bottom + 3 }, new int[] { 2, 3, 4 }); + model.combine(new int[] { bottom + 3 }, new int[] { 5, 6, 7 }); + model.combine(new int[] { bottom + 3 }, new int[] { 8, 9, 10 }); + } + @Override public void saveRendering() { // TODO Auto-generated method stub @@ -318,7 +331,7 @@ public class ExperimentalPowerOfAttorneyForm extends AbstractRendering { if (prop.containsKey("jd2_sywts")) { List data = new ArrayList(); int num = 0; - while (model.getValueAt(top + 2 + num, 1) != null && !"".equals(model.getValueAt(top + 2 + num, 1))) { + while (model.getValueAt(top + 1 + num, 1) != null && !"".equals(model.getValueAt(top + 1 + num, 1))) { String[] row = new String[7]; for (int ii = 0; ii < row.length; ii++) { Object object = model.getValueAt(top + 1 + num, ii > 2 ? ii > 3 ? ii + 4 : ii + 2 : ii); @@ -350,7 +363,7 @@ public class ExperimentalPowerOfAttorneyForm extends AbstractRendering { public void mouseClicked(MouseEvent e) { if (e.getButton() == MouseEvent.BUTTON3 && form.isCheckedOut() && table.getSelectedRow() != -1) { int row = table.getSelectedRow(); - boolean flag = (row >= top && row <= bottom); + boolean flag = (row > top && row <= bottom); addR.setEnabled(flag); delR.setEnabled(flag); test.setEnabled(flag); @@ -368,9 +381,14 @@ public class ExperimentalPowerOfAttorneyForm extends AbstractRendering { // TODO Auto-generated method stub int num = Integer.parseInt(model.getValueAt(bottom, 0).toString()); model.insertRow(++bottom); - model.setValueAt(num + 1, bottom, 0); - model.combine(new int[] { bottom }, new int[] { 2, 3, 4 }); - model.combine(new int[] { bottom }, new int[] { 5, 6, 7 }); +// model.setValueAt(num + 1, bottom, 0); +// model.combine(new int[] { bottom }, new int[] { 2, 3, 4 }); +// model.combine(new int[] { bottom }, new int[] { 5, 6, 7 }); + + System.out.println(bottom); + initModel(); + table.revalidate(); + table.repaint(); } }; } @@ -382,7 +400,7 @@ public class ExperimentalPowerOfAttorneyForm extends AbstractRendering { public void actionPerformed(ActionEvent e) { // TODO Auto-generated method stub int row = table.getSelectedRow(); - int num = Integer.parseInt(model.getValueAt(bottom, 0).toString()); + int num = Integer.parseInt(model.getValueAt(row, 0).toString()); model.removeRow(row); bottom--; if (row <= bottom) { @@ -390,6 +408,10 @@ public class ExperimentalPowerOfAttorneyForm extends AbstractRendering { model.setValueAt(num + i - row, i, 0); } } + System.out.println(bottom); + initModel(); + table.revalidate(); + table.repaint(); } }; @@ -401,11 +423,17 @@ public class ExperimentalPowerOfAttorneyForm extends AbstractRendering { @Override public void actionPerformed(ActionEvent e) { // TODO Auto-generated method stub - int row = table.getSelectedRow(); - ComponentTestFrame.getInstance(rows[row - top - 1]); + ComponentTestFrame.getInstance(form, $this); } }; } + @Override + public void execute(String itemId) { + // TODO Auto-generated method stub + int row = table.getSelectedRow(); + model.setValueAt(itemId, row, 9); + } + } diff --git a/com.connor.jd.plm/src/com/connor/jd/plm/form/MyCallBack.java b/com.connor.jd.plm/src/com/connor/jd/plm/form/MyCallBack.java new file mode 100644 index 0000000..72f83b0 --- /dev/null +++ b/com.connor.jd.plm/src/com/connor/jd/plm/form/MyCallBack.java @@ -0,0 +1,6 @@ +package com.connor.jd.plm.form; + +public interface MyCallBack { + + public void execute(String itemId); +} diff --git a/com.connor.jd.plm/src/com/connor/jd/plm/form/SampleConfirmationForm.java b/com.connor.jd.plm/src/com/connor/jd/plm/form/SampleConfirmationForm.java index 5edb55b..9c62a68 100644 --- a/com.connor.jd.plm/src/com/connor/jd/plm/form/SampleConfirmationForm.java +++ b/com.connor.jd.plm/src/com/connor/jd/plm/form/SampleConfirmationForm.java @@ -132,265 +132,10 @@ public class SampleConfirmationForm extends AbstractRendering { // 设置属性 model = new CTMap(47, 20); bottom = model.getRowCount() - end; - disableEdit = new ArrayList<>();// 不允许编辑 - general = new HashMap();// 要填写的一般属性 - pic = new HashMap();// 图片 - model.setValueAt("样品确认单", 0, 0); - disableEdit.add("0,0"); - model.setValueAt("提交", 0, 14); - disableEdit.add("0,14"); - model.setValueAt("审核", 0, 16); - disableEdit.add("0,16"); - model.setValueAt("批准", 0, 18); - disableEdit.add("0,18"); - model.setValueAt("部门", 2, 0); - disableEdit.add("2,0"); - model.setValueAt("滚筒研发", 2, 2); - disableEdit.add("2,2"); - general.put("jd2_bz", new int[] { 2, 14 }); - disableEdit.add("2,14"); - general.put("jd2_sh", new int[] { 2, 16 }); - disableEdit.add("2,16"); - general.put("jd2_pz", new int[] { 2, 18 }); - disableEdit.add("2,18"); - model.setValueAt("创建日期", 4, 0); - disableEdit.add("4,0"); - general.put("creation_date", new int[] { 4, 2 }); - disableEdit.add("4,2"); - model.setValueAt("创建人", 4, 5); - disableEdit.add("4,5"); - general.put("owning_user", new int[] { 4, 7 }); - disableEdit.add("4,7"); - general.put("jd2_bzrq", new int[] { 4, 14 }); - disableEdit.add("4,14"); - general.put("jd2_shrq", new int[] { 4, 16 }); - disableEdit.add("4,16"); - general.put("jd2_pzrq", new int[] { 4, 18 }); - disableEdit.add("4,18"); - model.setValueAt("零件名", 6, 0); - disableEdit.add("6,0"); - general.put("jd2_ljm", new int[] { 6, 2 }); - general.put("jd2_ljywm", new int[] { 6, 5 }); - model.setValueAt("型号", 6, 8); - disableEdit.add("6,8"); - general.put("jd2_xh", new int[] { 6, 10 }); - model.setValueAt("分类", 6, 14); - disableEdit.add("6,14"); - general.put("jd2_fl", new int[] { 6, 17 }); - model.setValueAt("物料编码", 7, 0); - disableEdit.add("7,0"); - general.put("jd2_wlbm", new int[] { 7, 2 }); - model.setValueAt("送样数量", 7, 8); - disableEdit.add("7,8"); - yssl = new JRadioPanel(new String[] { "3", "5", "10", "30" }); - model.setValueAt(yssl, 7, 10); - model.setValueAt("状态", 7, 14); - disableEdit.add("7,14"); - general.put("jd2_zt", new int[] { 7, 17 }); - model.setValueAt("部品等级", 8, 0); - disableEdit.add("8,0"); - general.put("jd2_bpdj", new int[] { 8, 2 }); - model.setValueAt("参考物料", 8, 8); - disableEdit.add("8,8"); - model.setValueAt("jd2_ckwl", 8, 10); - general.put("jd2_ckwl", new int[] { 8, 10 }); - model.setValueAt("图号", 9, 0); - disableEdit.add("9,0"); - general.put("jd2_th", new int[] { 9, 2 }); - model.setValueAt("规格", 10, 0); - disableEdit.add("10,0"); - general.put("jd2_gg", new int[] { 10, 2 }); - model.setValueAt("供应商", 11, 0); - disableEdit.add("11,0"); - general.put("jd2_gys", new int[] { 11, 2 }); - model.setValueAt("送样原因", 9, 8); - disableEdit.add("9,8"); - general.put("jd2_syyy", new int[] { 9, 10 }); - model.setValueAt("目前阶段", 12, 0); - disableEdit.add("12,0"); - mqjd = new JCheckPanel(new String[] { "DV", "PV", "PR", "SR", "现场测试", "MP" }); - model.setValueAt(mqjd, 12, 2); - - model.setValueAt("No", top, 0); - disableEdit.add(top + ",0"); - model.setValueAt("尺寸验证", top, 1); - disableEdit.add(top + ",1"); - model.setValueAt("检查数据(#样品号/腔体号)", top, 7); - disableEdit.add(top + ",7"); - model.setValueAt("结果", top, 19); - disableEdit.add(top + ",19"); - model.setValueAt("规格", top + 1, 1); - disableEdit.add(top + 1 + ",1"); - model.setValueAt("公差", top + 1, 5); - disableEdit.add(top + 1 + ",5"); - for (int i = 1; i < 11; i++) { - model.setValueAt("#" + i, top + 1, i + 6); - disableEdit.add(top + 1 + "," + (i + 6)); - } - model.setValueAt("Min", top + 1, 17); - disableEdit.add(top + 1 + ",17"); - model.setValueAt("Max", top + 1, 18); - disableEdit.add(top + 1 + ",18"); - - for (int i = top + 2; i <= bottom; i++) { - model.setValueAt(i - 1 - top, i, 0); - disableEdit.add(i + ",0"); - model.combine(new int[] { i }, new int[] { 2, 3, 4 }); - } - - model.setValueAt("被标记为“CTQ”的尺寸非常重要", bottom + 1, 0);// 从“底部”开始 - disableEdit.add(bottom + 1 + ",0"); - model.setValueAt("SPL Picture", bottom + 2, 0); - pic.put("jd2_ypzp", new int[] { bottom + 3, 0 }); - disableEdit.add(bottom + 2 + ",0"); - model.setValueAt("注塑条件", bottom + 2, 4); - disableEdit.add(bottom + 2 + ",4"); - model.setValueAt("C/Time", bottom + 2, 5); - disableEdit.add(bottom + 2 + ",5"); - model.setValueAt("注塑", bottom + 2, 6); - disableEdit.add(bottom + 2 + ",6"); - model.setValueAt("冷却", bottom + 2, 7); - disableEdit.add(bottom + 2 + ",7"); - model.setValueAt("包装", bottom + 2, 8); - disableEdit.add(bottom + 2 + ",8"); - model.setValueAt("供方自检报告", bottom + 2, 9); - disableEdit.add(bottom + 2 + ",9"); - model.setValueAt("供方作业指导书", bottom + 2, 12); - disableEdit.add(bottom + 2 + ",12"); - model.setValueAt("供方QC工程图", bottom + 2, 15); - disableEdit.add(bottom + 2 + ",15"); - model.setValueAt("物料包装及标签", bottom + 2, 18); - disableEdit.add(bottom + 2 + ",18"); - general.put("jd2_Ctime", new int[] { bottom + 3, 5 }); - general.put("jd2_zs", new int[] { bottom + 3, 6 }); - general.put("jd2_lq", new int[] { bottom + 3, 7 }); - general.put("jd2_baoz", new int[] { bottom + 3, 8 }); - pic.put("jd2_gfzjbg", new int[] { bottom + 3, 9 }); - pic.put("jd2_gfzyzds", new int[] { bottom + 3, 12 }); - pic.put("jd2_gfqcgct", new int[] { bottom + 3, 15 }); - pic.put("jd2_wlbzjbq", new int[] { bottom + 3, 18 }); - model.setValueAt("Shot/24Hr", bottom + 4, 5); - disableEdit.add(bottom + 4 + ",5"); - model.setValueAt("吨", bottom + 4, 6); - disableEdit.add(bottom + 4 + ",6"); - general.put("jd2_Shot24Hr", new int[] { bottom + 5, 5 }); - general.put("jd2_d", new int[] { bottom + 5, 6 }); - model.setValueAt("3D重量", bottom + 6, 4); - disableEdit.add(bottom + 6 + ",4"); - model.setValueAt("jd2_3Dzl", bottom + 6, 5); - general.put("jd2_3Dzl", new int[] { bottom + 6, 5 }); - model.setValueAt("注塑工艺条件", bottom + 6, 7); - disableEdit.add(bottom + 6 + ",7"); - model.setValueAt("IQC首检报告", bottom + 6, 9); - disableEdit.add(bottom + 6 + ",9"); - model.setValueAt("测试报告", bottom + 6, 12); - disableEdit.add(bottom + 6 + ",12"); - model.setValueAt("材质报告", bottom + 6, 15); - disableEdit.add(bottom + 6 + ",15"); - model.setValueAt("模具标识", bottom + 6, 18); - disableEdit.add(bottom + 6 + ",18"); - pic.put("jd2_zsgytj", new int[] { bottom + 7, 7 }); - pic.put("jd2_icqsjbg", new int[] { bottom + 7, 9 }); - pic.put("jd2_csbg", new int[] { bottom + 7, 12 }); - pic.put("jd2_czbg", new int[] { bottom + 7, 15 }); - pic.put("jd2_mjbs", new int[] { bottom + 7, 18 }); - model.setValueAt("实测重量", bottom + 8, 4); - disableEdit.add(bottom + 8 + ",4"); - general.put("jd2_sczl", new int[] { bottom + 8, 5 }); - model.setValueAt("IQC作业指导书", bottom + 10, 4); - disableEdit.add(bottom + 10 + ",4"); - pic.put("jd2_icqjyzds", new int[] { bottom + 11, 4 }); - model.setValueAt("决定", bottom + 12, 12); - disableEdit.add(bottom + 12 + ",12"); - general.put("jd2_jued", new int[] { bottom + 12, 15 }); - pic.put("jd2_qtbg", new int[] { bottom + 10, 7 }); // 合并单元格 - model.combine(new int[] { 0, 1 }, new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 }); - model.combine(new int[] { 0, 1 }, new int[] { 14, 15 }); - model.combine(new int[] { 0, 1 }, new int[] { 16, 17 }); - model.combine(new int[] { 0, 1 }, new int[] { 18, 19 }); - model.combine(new int[] { 2, 3 }, new int[] { 0, 1 }); - model.combine(new int[] { 2, 3 }, new int[] { 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 }); - model.combine(new int[] { 2, 3 }, new int[] { 14, 15 }); - model.combine(new int[] { 2, 3 }, new int[] { 16, 17 }); - model.combine(new int[] { 2, 3 }, new int[] { 18, 19 }); - model.combine(new int[] { 4, 5 }, new int[] { 0, 1 }); - model.combine(new int[] { 4, 5 }, new int[] { 2, 3, 4 }); - model.combine(new int[] { 4, 5 }, new int[] { 5, 6 }); - model.combine(new int[] { 4, 5 }, new int[] { 7, 8, 9, 10, 11, 12, 13 }); - model.combine(new int[] { 4, 5 }, new int[] { 14, 15 }); - model.combine(new int[] { 4, 5 }, new int[] { 16, 17 }); - model.combine(new int[] { 4, 5 }, new int[] { 18, 19 }); - model.combine(new int[] { 6 }, new int[] { 0, 1 }); - model.combine(new int[] { 6 }, new int[] { 2, 3, 4 }); - model.combine(new int[] { 6 }, new int[] { 5, 6, 7 }); - model.combine(new int[] { 6 }, new int[] { 8, 9 }); - model.combine(new int[] { 6 }, new int[] { 10, 11, 12, 13 }); - model.combine(new int[] { 6 }, new int[] { 14, 15, 16 }); - model.combine(new int[] { 6 }, new int[] { 17, 18, 19 }); - model.combine(new int[] { 7 }, new int[] { 0, 1 }); - model.combine(new int[] { 7 }, new int[] { 2, 3, 4, 5, 6, 7 }); - model.combine(new int[] { 7 }, new int[] { 8, 9 }); - model.combine(new int[] { 7 }, new int[] { 10, 11, 12, 13 }); - model.combine(new int[] { 7 }, new int[] { 14, 15, 16 }); - model.combine(new int[] { 7 }, new int[] { 17, 18, 19 }); - model.combine(new int[] { 8 }, new int[] { 0, 1 }); - model.combine(new int[] { 8 }, new int[] { 2, 3, 4, 5, 6, 7 }); - model.combine(new int[] { 8 }, new int[] { 8, 9 }); - model.combine(new int[] { 8 }, new int[] { 10, 11, 12, 13, 14, 15, 16, 17, 18, 19 }); - model.combine(new int[] { 9 }, new int[] { 0, 1 }); - model.combine(new int[] { 9 }, new int[] { 2, 3, 4, 5, 6, 7 }); - model.combine(new int[] { 9, 10, 11 }, new int[] { 8, 9 }); - model.combine(new int[] { 9, 10, 11 }, new int[] { 10, 11, 12, 13, 14, 15, 16, 17, 18, 19 }); - model.combine(new int[] { 10 }, new int[] { 0, 1 }); - model.combine(new int[] { 10 }, new int[] { 2, 3, 4, 5, 6, 7 }); - model.combine(new int[] { 11 }, new int[] { 0, 1 }); - model.combine(new int[] { 11 }, new int[] { 2, 3, 4, 5, 6, 7 }); - model.combine(new int[] { 12 }, new int[] { 0, 1 }); - model.combine(new int[] { 12 }, new int[] { 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19 }); - model.combine(new int[] { top, 1 }, new int[] { 0 }); - model.combine(new int[] { top }, new int[] { 1, 2, 3, 4, 5, 6 }); - model.combine(new int[] { top }, new int[] { 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18 }); - model.combine(new int[] { top, top + 1 }, new int[] { 19 }); - model.combine(new int[] { top + 1 }, new int[] { 1, 2, 3, 4 }); - model.combine(new int[] { top + 1 }, new int[] { 5, 6 }); - model.combine(new int[] { bottom + 1 }, new int[] { 0, 1, 2, 3, 4, 5 }); - model.combine(new int[] { bottom + 2 }, new int[] { 0, 1 }); - model.combine(new int[] { bottom + 2 }, new int[] { 2, 3 }); - model.combine(new int[] { bottom + 3, bottom + 4, bottom + 5, bottom + 6, bottom + 7, bottom + 8, bottom + 9, - bottom + 10, bottom + 11, bottom + 12, bottom + 13 }, new int[] { 0, 1, 2, 3 }); - model.combine(new int[] { bottom + 2, bottom + 3, bottom + 4, bottom + 5 }, new int[] { 4 }); - model.combine(new int[] { bottom + 2 }, new int[] { 9, 10, 11 }); - model.combine(new int[] { bottom + 2 }, new int[] { 12, 13, 14 }); - model.combine(new int[] { bottom + 2 }, new int[] { 15, 16, 17 }); - model.combine(new int[] { bottom + 2 }, new int[] { 18, 19 }); - model.combine(new int[] { bottom + 4, bottom + 5 }, new int[] { 7, 8 }); - model.combine(new int[] { bottom + 3, bottom + 4, bottom + 5 }, new int[] { 9, 10, 11 }); - model.combine(new int[] { bottom + 3, bottom + 4, bottom + 5 }, new int[] { 12, 13, 14 }); - model.combine(new int[] { bottom + 3, bottom + 4, bottom + 5 }, new int[] { 15, 16, 17 }); - model.combine(new int[] { bottom + 3, bottom + 4, bottom + 5 }, new int[] { 18, 19 }); - model.combine(new int[] { bottom + 6, bottom + 7 }, new int[] { 4 }); - model.combine(new int[] { bottom + 8, bottom + 9 }, new int[] { 4 }); - model.combine(new int[] { bottom + 6, bottom + 7 }, new int[] { 5 }); - model.combine(new int[] { bottom + 8, bottom + 9 }, new int[] { 5 }); - model.combine(new int[] { bottom + 6, bottom + 7, bottom + 8, bottom + 9 }, new int[] { 6 }); - model.combine(new int[] { bottom + 6 }, new int[] { 7, 8 }); - model.combine(new int[] { bottom + 6 }, new int[] { 9, 10, 11 }); - model.combine(new int[] { bottom + 6 }, new int[] { 12, 13, 14 }); - model.combine(new int[] { bottom + 6 }, new int[] { 15, 16, 17 }); - model.combine(new int[] { bottom + 6 }, new int[] { 18, 19 }); - model.combine(new int[] { bottom + 7, bottom + 8, bottom + 9 }, new int[] { 7, 8 }); - model.combine(new int[] { bottom + 7, bottom + 8, bottom + 9 }, new int[] { 9, 10, 11 }); - model.combine(new int[] { bottom + 7, bottom + 8, bottom + 9 }, new int[] { 12, 13, 14 }); - model.combine(new int[] { bottom + 7, bottom + 8, bottom + 9 }, new int[] { 15, 16, 17 }); - model.combine(new int[] { bottom + 7, bottom + 8, bottom + 9 }, new int[] { 18, 19 }); - model.combine(new int[] { bottom + 10 }, new int[] { 4, 5, 6 }); - model.combine(new int[] { bottom + 11, bottom + 12, bottom + 13 }, new int[] { 4, 5, 6 }); - model.combine(new int[] { bottom + 10, bottom + 11, bottom + 12, bottom + 13 }, new int[] { 7, 8, 9, 10, 11 }); - model.combine(new int[] { bottom + 10, bottom + 11 }, new int[] { 12, 13, 14, 15, 16, 17, 18, 19 }); - model.combine(new int[] { bottom + 12, bottom + 13 }, new int[] { 12, 13, 14 }); - model.combine(new int[] { bottom + 12, bottom + 13 }, new int[] { 15, 16, 17, 18, 19 }); + + initModel(); table = new CTable(model) { @Override @@ -720,30 +465,292 @@ public class SampleConfirmationForm extends AbstractRendering { menu.add(delR); delR.addActionListener(deleteRow()); - // 检验单右键菜单 - menu2.setVisible(false); - addR2 = new JMenuItem("添加行"); - addR2.setEnabled(false); - menu2.add(addR2); - addR2.addActionListener(addRow2()); - insertR2 = new JMenuItem("插入行"); - insertR2.setEnabled(false); - menu2.add(insertR2); - insertR2.addActionListener(insertRow2()); - delR2 = new JMenuItem("删除行"); - delR2.setEnabled(false); - menu2.add(delR2); - delR2.addActionListener(deleteRow2()); + // 检验单右键菜单 + menu2.setVisible(false); + addR2 = new JMenuItem("添加行"); + addR2.setEnabled(false); + menu2.add(addR2); + addR2.addActionListener(addRow2()); + insertR2 = new JMenuItem("插入行"); + insertR2.setEnabled(false); + menu2.add(insertR2); + insertR2.addActionListener(insertRow2()); + delR2 = new JMenuItem("删除行"); + delR2.setEnabled(false); + menu2.add(delR2); + delR2.addActionListener(deleteRow2()); + + center.add("confirm", confirmScrollPanel); + center.add("examine", examineScrollPanel); + root.add(buttons, BorderLayout.NORTH); + root.add(center, BorderLayout.CENTER); + this.add(menu); + this.add(menu2); + this.add(root, BorderLayout.CENTER); + + cl.show(center, "confirm"); + } + + private void initModel() { + disableEdit = new ArrayList<>();// 不允许编辑 + general = new HashMap();// 要填写的一般属性 + pic = new HashMap();// 图片 + model.setValueAt("样品确认单", 0, 0); + disableEdit.add("0,0"); + model.setValueAt("提交", 0, 14); + disableEdit.add("0,14"); + model.setValueAt("审核", 0, 16); + disableEdit.add("0,16"); + model.setValueAt("批准", 0, 18); + disableEdit.add("0,18"); + model.setValueAt("部门", 2, 0); + disableEdit.add("2,0"); + model.setValueAt("滚筒研发", 2, 2); + disableEdit.add("2,2"); + general.put("jd2_bz", new int[] { 2, 14 }); + disableEdit.add("2,14"); + general.put("jd2_sh", new int[] { 2, 16 }); + disableEdit.add("2,16"); + general.put("jd2_pz", new int[] { 2, 18 }); + disableEdit.add("2,18"); + model.setValueAt("创建日期", 4, 0); + disableEdit.add("4,0"); + general.put("creation_date", new int[] { 4, 2 }); + disableEdit.add("4,2"); + model.setValueAt("创建人", 4, 5); + disableEdit.add("4,5"); + general.put("owning_user", new int[] { 4, 7 }); + disableEdit.add("4,7"); + general.put("jd2_bzrq", new int[] { 4, 14 }); + disableEdit.add("4,14"); + general.put("jd2_shrq", new int[] { 4, 16 }); + disableEdit.add("4,16"); + general.put("jd2_pzrq", new int[] { 4, 18 }); + disableEdit.add("4,18"); + model.setValueAt("零件名", 6, 0); + disableEdit.add("6,0"); + general.put("jd2_ljm", new int[] { 6, 2 }); + general.put("jd2_ljywm", new int[] { 6, 5 }); + model.setValueAt("型号", 6, 8); + disableEdit.add("6,8"); + general.put("jd2_xh", new int[] { 6, 10 }); + model.setValueAt("分类", 6, 14); + disableEdit.add("6,14"); + general.put("jd2_fl", new int[] { 6, 17 }); + model.setValueAt("物料编码", 7, 0); + disableEdit.add("7,0"); + general.put("jd2_wlbm", new int[] { 7, 2 }); + model.setValueAt("送样数量", 7, 8); + disableEdit.add("7,8"); + yssl = new JRadioPanel(new String[] { "3", "5", "10", "30" }); + model.setValueAt(yssl, 7, 10); + model.setValueAt("状态", 7, 14); + disableEdit.add("7,14"); + general.put("jd2_zt", new int[] { 7, 17 }); + model.setValueAt("部品等级", 8, 0); + disableEdit.add("8,0"); + general.put("jd2_bpdj", new int[] { 8, 2 }); + model.setValueAt("参考物料", 8, 8); + disableEdit.add("8,8"); + model.setValueAt("jd2_ckwl", 8, 10); + general.put("jd2_ckwl", new int[] { 8, 10 }); + model.setValueAt("图号", 9, 0); + disableEdit.add("9,0"); + general.put("jd2_th", new int[] { 9, 2 }); + model.setValueAt("规格", 10, 0); + disableEdit.add("10,0"); + general.put("jd2_gg", new int[] { 10, 2 }); + model.setValueAt("供应商", 11, 0); + disableEdit.add("11,0"); + general.put("jd2_gys", new int[] { 11, 2 }); + model.setValueAt("送样原因", 9, 8); + disableEdit.add("9,8"); + general.put("jd2_syyy", new int[] { 9, 10 }); + model.setValueAt("目前阶段", 12, 0); + disableEdit.add("12,0"); + mqjd = new JCheckPanel(new String[] { "DV", "PV", "PR", "SR", "现场测试", "MP" }); + model.setValueAt(mqjd, 12, 2); + + model.setValueAt("No", top, 0); + disableEdit.add(top + ",0"); + model.setValueAt("尺寸验证", top, 1); + disableEdit.add(top + ",1"); + model.setValueAt("检查数据(#样品号/腔体号)", top, 7); + disableEdit.add(top + ",7"); + model.setValueAt("结果", top, 19); + disableEdit.add(top + ",19"); + model.setValueAt("规格", top + 1, 1); + disableEdit.add(top + 1 + ",1"); + model.setValueAt("公差", top + 1, 5); + disableEdit.add(top + 1 + ",5"); + for (int i = 1; i < 11; i++) { + model.setValueAt("#" + i, top + 1, i + 6); + disableEdit.add(top + 1 + "," + (i + 6)); + } + model.setValueAt("Min", top + 1, 17); + disableEdit.add(top + 1 + ",17"); + model.setValueAt("Max", top + 1, 18); + disableEdit.add(top + 1 + ",18"); - center.add("confirm", confirmScrollPanel); - center.add("examine", examineScrollPanel); - root.add(buttons, BorderLayout.NORTH); - root.add(center, BorderLayout.CENTER); - this.add(menu); - this.add(menu2); - this.add(root, BorderLayout.CENTER); + for (int i = top + 2; i <= bottom; i++) { + model.setValueAt(i - 1 - top, i, 0); + disableEdit.add(i + ",0"); + } - cl.show(center, "confirm"); + model.setValueAt("被标记为“CTQ”的尺寸非常重要", bottom + 1, 0);// 从“底部”开始 + disableEdit.add(bottom + 1 + ",0"); + model.setValueAt("SPL Picture", bottom + 2, 0); + pic.put("jd2_ypzp", new int[] { bottom + 3, 0 }); + disableEdit.add(bottom + 2 + ",0"); + model.setValueAt("注塑条件", bottom + 2, 4); + disableEdit.add(bottom + 2 + ",4"); + model.setValueAt("C/Time", bottom + 2, 5); + disableEdit.add(bottom + 2 + ",5"); + model.setValueAt("注塑", bottom + 2, 6); + disableEdit.add(bottom + 2 + ",6"); + model.setValueAt("冷却", bottom + 2, 7); + disableEdit.add(bottom + 2 + ",7"); + model.setValueAt("包装", bottom + 2, 8); + disableEdit.add(bottom + 2 + ",8"); + model.setValueAt("供方自检报告", bottom + 2, 9); + disableEdit.add(bottom + 2 + ",9"); + model.setValueAt("供方作业指导书", bottom + 2, 12); + disableEdit.add(bottom + 2 + ",12"); + model.setValueAt("供方QC工程图", bottom + 2, 15); + disableEdit.add(bottom + 2 + ",15"); + model.setValueAt("物料包装及标签", bottom + 2, 18); + disableEdit.add(bottom + 2 + ",18"); + general.put("jd2_Ctime", new int[] { bottom + 3, 5 }); + general.put("jd2_zs", new int[] { bottom + 3, 6 }); + general.put("jd2_lq", new int[] { bottom + 3, 7 }); + general.put("jd2_baoz", new int[] { bottom + 3, 8 }); + pic.put("jd2_gfzjbg", new int[] { bottom + 3, 9 }); + pic.put("jd2_gfzyzds", new int[] { bottom + 3, 12 }); + pic.put("jd2_gfqcgct", new int[] { bottom + 3, 15 }); + pic.put("jd2_wlbzjbq", new int[] { bottom + 3, 18 }); + model.setValueAt("Shot/24Hr", bottom + 4, 5); + disableEdit.add(bottom + 4 + ",5"); + model.setValueAt("吨", bottom + 4, 6); + disableEdit.add(bottom + 4 + ",6"); + general.put("jd2_Shot24Hr", new int[] { bottom + 5, 5 }); + general.put("jd2_d", new int[] { bottom + 5, 6 }); + model.setValueAt("3D重量", bottom + 6, 4); + disableEdit.add(bottom + 6 + ",4"); + model.setValueAt("jd2_3Dzl", bottom + 6, 5); + general.put("jd2_3Dzl", new int[] { bottom + 6, 5 }); + model.setValueAt("注塑工艺条件", bottom + 6, 7); + disableEdit.add(bottom + 6 + ",7"); + model.setValueAt("IQC首检报告", bottom + 6, 9); + disableEdit.add(bottom + 6 + ",9"); + model.setValueAt("测试报告", bottom + 6, 12); + disableEdit.add(bottom + 6 + ",12"); + model.setValueAt("材质报告", bottom + 6, 15); + disableEdit.add(bottom + 6 + ",15"); + model.setValueAt("模具标识", bottom + 6, 18); + disableEdit.add(bottom + 6 + ",18"); + pic.put("jd2_zsgytj", new int[] { bottom + 7, 7 }); + pic.put("jd2_icqsjbg", new int[] { bottom + 7, 9 }); + pic.put("jd2_csbg", new int[] { bottom + 7, 12 }); + pic.put("jd2_czbg", new int[] { bottom + 7, 15 }); + pic.put("jd2_mjbs", new int[] { bottom + 7, 18 }); + model.setValueAt("实测重量", bottom + 8, 4); + disableEdit.add(bottom + 8 + ",4"); + general.put("jd2_sczl", new int[] { bottom + 8, 5 }); + model.setValueAt("IQC作业指导书", bottom + 10, 4); + disableEdit.add(bottom + 10 + ",4"); + pic.put("jd2_icqjyzds", new int[] { bottom + 11, 4 }); + model.setValueAt("决定", bottom + 12, 12); + disableEdit.add(bottom + 12 + ",12"); + general.put("jd2_jued", new int[] { bottom + 12, 15 }); + pic.put("jd2_qtbg", new int[] { bottom + 10, 7 }); + for (int i = top + 2; i <= bottom; i++) { + model.combine(new int[] { i }, new int[] { 2, 3, 4 }); + } + model.combine(new int[] { 0, 1 }, new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 }); + model.combine(new int[] { 0, 1 }, new int[] { 14, 15 }); + model.combine(new int[] { 0, 1 }, new int[] { 16, 17 }); + model.combine(new int[] { 0, 1 }, new int[] { 18, 19 }); + model.combine(new int[] { 2, 3 }, new int[] { 0, 1 }); + model.combine(new int[] { 2, 3 }, new int[] { 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 }); + model.combine(new int[] { 2, 3 }, new int[] { 14, 15 }); + model.combine(new int[] { 2, 3 }, new int[] { 16, 17 }); + model.combine(new int[] { 2, 3 }, new int[] { 18, 19 }); + model.combine(new int[] { 4, 5 }, new int[] { 0, 1 }); + model.combine(new int[] { 4, 5 }, new int[] { 2, 3, 4 }); + model.combine(new int[] { 4, 5 }, new int[] { 5, 6 }); + model.combine(new int[] { 4, 5 }, new int[] { 7, 8, 9, 10, 11, 12, 13 }); + model.combine(new int[] { 4, 5 }, new int[] { 14, 15 }); + model.combine(new int[] { 4, 5 }, new int[] { 16, 17 }); + model.combine(new int[] { 4, 5 }, new int[] { 18, 19 }); + model.combine(new int[] { 6 }, new int[] { 0, 1 }); + model.combine(new int[] { 6 }, new int[] { 2, 3, 4 }); + model.combine(new int[] { 6 }, new int[] { 5, 6, 7 }); + model.combine(new int[] { 6 }, new int[] { 8, 9 }); + model.combine(new int[] { 6 }, new int[] { 10, 11, 12, 13 }); + model.combine(new int[] { 6 }, new int[] { 14, 15, 16 }); + model.combine(new int[] { 6 }, new int[] { 17, 18, 19 }); + model.combine(new int[] { 7 }, new int[] { 0, 1 }); + model.combine(new int[] { 7 }, new int[] { 2, 3, 4, 5, 6, 7 }); + model.combine(new int[] { 7 }, new int[] { 8, 9 }); + model.combine(new int[] { 7 }, new int[] { 10, 11, 12, 13 }); + model.combine(new int[] { 7 }, new int[] { 14, 15, 16 }); + model.combine(new int[] { 7 }, new int[] { 17, 18, 19 }); + model.combine(new int[] { 8 }, new int[] { 0, 1 }); + model.combine(new int[] { 8 }, new int[] { 2, 3, 4, 5, 6, 7 }); + model.combine(new int[] { 8 }, new int[] { 8, 9 }); + model.combine(new int[] { 8 }, new int[] { 10, 11, 12, 13, 14, 15, 16, 17, 18, 19 }); + model.combine(new int[] { 9 }, new int[] { 0, 1 }); + model.combine(new int[] { 9 }, new int[] { 2, 3, 4, 5, 6, 7 }); + model.combine(new int[] { 9, 10, 11 }, new int[] { 8, 9 }); + model.combine(new int[] { 9, 10, 11 }, new int[] { 10, 11, 12, 13, 14, 15, 16, 17, 18, 19 }); + model.combine(new int[] { 10 }, new int[] { 0, 1 }); + model.combine(new int[] { 10 }, new int[] { 2, 3, 4, 5, 6, 7 }); + model.combine(new int[] { 11 }, new int[] { 0, 1 }); + model.combine(new int[] { 11 }, new int[] { 2, 3, 4, 5, 6, 7 }); + model.combine(new int[] { 12 }, new int[] { 0, 1 }); + model.combine(new int[] { 12 }, new int[] { 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19 }); + model.combine(new int[] { top, 1 }, new int[] { 0 }); + model.combine(new int[] { top }, new int[] { 1, 2, 3, 4, 5, 6 }); + model.combine(new int[] { top }, new int[] { 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18 }); + model.combine(new int[] { top, top + 1 }, new int[] { 19 }); + model.combine(new int[] { top + 1 }, new int[] { 1, 2, 3, 4 }); + model.combine(new int[] { top + 1 }, new int[] { 5, 6 }); + model.combine(new int[] { bottom + 1 }, new int[] { 0, 1, 2, 3, 4, 5 }); + model.combine(new int[] { bottom + 2 }, new int[] { 0, 1 }); + model.combine(new int[] { bottom + 2 }, new int[] { 2, 3 }); + model.combine(new int[] { bottom + 3, bottom + 4, bottom + 5, bottom + 6, bottom + 7, bottom + 8, bottom + 9, + bottom + 10, bottom + 11, bottom + 12, bottom + 13 }, new int[] { 0, 1, 2, 3 }); + model.combine(new int[] { bottom + 2, bottom + 3, bottom + 4, bottom + 5 }, new int[] { 4 }); + model.combine(new int[] { bottom + 2 }, new int[] { 9, 10, 11 }); + model.combine(new int[] { bottom + 2 }, new int[] { 12, 13, 14 }); + model.combine(new int[] { bottom + 2 }, new int[] { 15, 16, 17 }); + model.combine(new int[] { bottom + 2 }, new int[] { 18, 19 }); + model.combine(new int[] { bottom + 4, bottom + 5 }, new int[] { 7, 8 }); + model.combine(new int[] { bottom + 3, bottom + 4, bottom + 5 }, new int[] { 9, 10, 11 }); + model.combine(new int[] { bottom + 3, bottom + 4, bottom + 5 }, new int[] { 12, 13, 14 }); + model.combine(new int[] { bottom + 3, bottom + 4, bottom + 5 }, new int[] { 15, 16, 17 }); + model.combine(new int[] { bottom + 3, bottom + 4, bottom + 5 }, new int[] { 18, 19 }); + model.combine(new int[] { bottom + 6, bottom + 7 }, new int[] { 4 }); + model.combine(new int[] { bottom + 8, bottom + 9 }, new int[] { 4 }); + model.combine(new int[] { bottom + 6, bottom + 7 }, new int[] { 5 }); + model.combine(new int[] { bottom + 8, bottom + 9 }, new int[] { 5 }); + model.combine(new int[] { bottom + 6, bottom + 7, bottom + 8, bottom + 9 }, new int[] { 6 }); + model.combine(new int[] { bottom + 6 }, new int[] { 7, 8 }); + model.combine(new int[] { bottom + 6 }, new int[] { 9, 10, 11 }); + model.combine(new int[] { bottom + 6 }, new int[] { 12, 13, 14 }); + model.combine(new int[] { bottom + 6 }, new int[] { 15, 16, 17 }); + model.combine(new int[] { bottom + 6 }, new int[] { 18, 19 }); + model.combine(new int[] { bottom + 7, bottom + 8, bottom + 9 }, new int[] { 7, 8 }); + model.combine(new int[] { bottom + 7, bottom + 8, bottom + 9 }, new int[] { 9, 10, 11 }); + model.combine(new int[] { bottom + 7, bottom + 8, bottom + 9 }, new int[] { 12, 13, 14 }); + model.combine(new int[] { bottom + 7, bottom + 8, bottom + 9 }, new int[] { 15, 16, 17 }); + model.combine(new int[] { bottom + 7, bottom + 8, bottom + 9 }, new int[] { 18, 19 }); + model.combine(new int[] { bottom + 10 }, new int[] { 4, 5, 6 }); + model.combine(new int[] { bottom + 11, bottom + 12, bottom + 13 }, new int[] { 4, 5, 6 }); + model.combine(new int[] { bottom + 10, bottom + 11, bottom + 12, bottom + 13 }, new int[] { 7, 8, 9, 10, 11 }); + model.combine(new int[] { bottom + 10, bottom + 11 }, new int[] { 12, 13, 14, 15, 16, 17, 18, 19 }); + model.combine(new int[] { bottom + 12, bottom + 13 }, new int[] { 12, 13, 14 }); + model.combine(new int[] { bottom + 12, bottom + 13 }, new int[] { 15, 16, 17, 18, 19 }); } @Override @@ -925,7 +932,7 @@ public class SampleConfirmationForm extends AbstractRendering { public void mouseClicked(MouseEvent e) { if (e.getButton() == MouseEvent.BUTTON3 && form.isCheckedOut() && table.getSelectedRow() != -1) { int row = table.getSelectedRow(); - boolean flag = (row >= top && row <= bottom); + boolean flag = (row >= top + 2 && row <= bottom); addR.setEnabled(flag); insertR.setEnabled(flag); delR.setEnabled(flag); @@ -1044,8 +1051,13 @@ public class SampleConfirmationForm extends AbstractRendering { // TODO Auto-generated method stub int num = Integer.parseInt(model.getValueAt(bottom, 0).toString()); model.insertRow(++bottom); - model.setValueAt(num + 1, bottom, 0); - model.combine(new int[] { bottom }, new int[] { 2, 3, 4 }); +// model.setValueAt(num + 1, bottom, 0); +// model.combine(new int[] { bottom }, new int[] { 2, 3, 4 }); + + System.out.println(bottom); + initModel(); + table.revalidate(); + table.repaint(); } }; @@ -1081,6 +1093,11 @@ public class SampleConfirmationForm extends AbstractRendering { model.setValueAt(num + i - row, i, 0); } model.combine(new int[] { row }, new int[] { 2, 3, 4 }); + + System.out.println(bottom); + initModel(); + table.revalidate(); + table.repaint(); } }; return actionListener; @@ -1120,6 +1137,11 @@ public class SampleConfirmationForm extends AbstractRendering { model.setValueAt(num + i - row, i, 0); } } + + System.out.println(bottom); + initModel(); + table.revalidate(); + table.repaint(); } }; return actionListener; diff --git a/com.connor.jd.plm/src/com/connor/jd/plm/table/MyCellEditor4.java b/com.connor.jd.plm/src/com/connor/jd/plm/table/MyCellEditor4.java index 26ddcd7..73c3323 100644 --- a/com.connor.jd.plm/src/com/connor/jd/plm/table/MyCellEditor4.java +++ b/com.connor.jd.plm/src/com/connor/jd/plm/table/MyCellEditor4.java @@ -1,5 +1,37 @@ package com.connor.jd.plm.table; -public class MyCellEditor4 { +import java.awt.Component; + +import javax.swing.DefaultCellEditor; +import javax.swing.JCheckBox; +import javax.swing.JTable; +import javax.swing.JTextField; + +public class MyCellEditor4 extends DefaultCellEditor { + private int type = -1; + private JCheckBox check; + + public MyCellEditor4(JTextField arg0) { + super(arg0); + } + + @Override + public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { + if (value instanceof JCheckBox) { + check = (JCheckBox) value; + type = 1; + return check; + } + type = 0; + return super.getTableCellEditorComponent(table, value, isSelected, row, column); + } + + @Override + public Object getCellEditorValue() { + if (type == 1) { + return check; + } + return super.getCellEditorValue(); + } }