From 2156c4f8ff38351b0534e9ca711b5895d218d576 Mon Sep 17 00:00:00 2001 From: zouxk Date: Tue, 18 Feb 2020 17:52:23 +0800 Subject: [PATCH] =?UTF-8?q?=E9=9C=80=E6=B1=82=E7=BB=86=E8=8A=82=E5=8F=98?= =?UTF-8?q?=E6=9B=B4=EF=BC=9A=201.=E9=93=BE=E6=8E=A5=E4=BD=8D=E7=BD=AE?= =?UTF-8?q?=E5=8F=98=E6=9B=B4=202.=E6=8F=90=E7=A4=BA=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E5=8F=98=E6=9B=B4=203.=E6=B5=8B=E8=AF=95=E8=AE=A1=E5=88=92?= =?UTF-8?q?=E6=9F=A5=E9=87=8D=E9=80=BB=E8=BE=91=E5=8F=98=E6=9B=B4=20?= =?UTF-8?q?=E9=83=A8=E5=88=86=E5=8A=9F=E8=83=BD=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- com.connor.jd.plm/plugin.xml | 4 +- .../com/connor/jd/plm/form/GTCSJHForm.java | 38 ++++++++++++++++--- .../jd/plm/form/NewProductTestForm.java | 30 ++++++++------- 3 files changed, 50 insertions(+), 22 deletions(-) diff --git a/com.connor.jd.plm/plugin.xml b/com.connor.jd.plm/plugin.xml index 07a5599..6b58354 100644 --- a/com.connor.jd.plm/plugin.xml +++ b/com.connor.jd.plm/plugin.xml @@ -325,9 +325,6 @@ - - - @@ -349,6 +346,7 @@ + diff --git a/com.connor.jd.plm/src/com/connor/jd/plm/form/GTCSJHForm.java b/com.connor.jd.plm/src/com/connor/jd/plm/form/GTCSJHForm.java index 406d071..6b2de77 100644 --- a/com.connor.jd.plm/src/com/connor/jd/plm/form/GTCSJHForm.java +++ b/com.connor.jd.plm/src/com/connor/jd/plm/form/GTCSJHForm.java @@ -9,6 +9,8 @@ import java.awt.Font; import java.awt.ScrollPane; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; import java.io.File; import java.util.ArrayList; import java.util.Arrays; @@ -221,6 +223,34 @@ public class GTCSJHForm extends AbstractRendering { table.setRowHeight(25); table.setAutoscrolls(true); table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); + table.addMouseListener(new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent e) { + if (table.getSelectedColumn() == 15) { + if (e.getClickCount() == 2) { + System.out.println("˫"); + int selectedRow = table.getSelectedRow(); // ѡ + String value = (String) model.getValueAt(selectedRow, 15); + if (value == null) + value = ""; + if (!value.equals("")) { + try { + TCComponent[] result = session.search(" ID", new String[] { " ID" }, + new String[] { value }); + TCComponentItem item = (TCComponentItem) result[0]; + TCComponent[] tccitem = item.getLatestItemRevision().getTCProperty("IMAN_specification") + .getReferenceValueArray(); + TCComponentDataset dataset = (TCComponentDataset) tccitem[0]; + dataset.open(); + } catch (Exception e1) { + e1.printStackTrace(); + } + } + } + } + + } + }); JScrollPane jsp = new JScrollPane(table); jsp.setAutoscrolls(true); innerCenter.add(jsp, BorderLayout.CENTER); @@ -273,9 +303,7 @@ public class GTCSJHForm extends AbstractRendering { for (int i = 0; i < labellTexts.length; i++) { if (parentProp.containsKey(labellTexts[i])) { String str = parentProp.get(labellTexts[i]); - if ("".equals(str)) { - infoValue[i].setText(str); - } + infoValue[i].setText(str); } else { System.out.println("\"" + labellTexts[i] + "\""); } @@ -357,7 +385,7 @@ public class GTCSJHForm extends AbstractRendering { System.out.println(filePath); System.out.println(fileName); int row = table.getSelectedRow(); - String value = model.getValueAt(row, 14) == null ? "" : model.getValueAt(row, 14).toString(); + String value = model.getValueAt(row, 15) == null ? "" : model.getValueAt(row, 15).toString(); if (value.equals("")) { try { TCComponentItemType itemtype = (TCComponentItemType) session.getTypeComponent("JD2_GTCSBG"); @@ -583,7 +611,7 @@ public class GTCSJHForm extends AbstractRendering { private void addResult(String realNo, int row, int times, String result) { if (resultMap.containsKey(realNo)) { - if (times >= resultMap.get(realNo).getTimes()) { + if (times > resultMap.get(realNo).getTimes()) { disableRows.add(resultMap.get(realNo).getRow()); resultMap.put(realNo, new JG(row, times, result)); } diff --git a/com.connor.jd.plm/src/com/connor/jd/plm/form/NewProductTestForm.java b/com.connor.jd.plm/src/com/connor/jd/plm/form/NewProductTestForm.java index db9afc8..764bb13 100644 --- a/com.connor.jd.plm/src/com/connor/jd/plm/form/NewProductTestForm.java +++ b/com.connor.jd.plm/src/com/connor/jd/plm/form/NewProductTestForm.java @@ -107,7 +107,7 @@ public class NewProductTestForm extends AbstractRendering { int[][] propLocation1 = { { 0, 1 }, { 0, 3 }, { 1, 1 }, { 1, 3 }, { 2, 1 }, { 2, 3 }, { 3, 1 }, { 3, 3 }, { 4, 1 }, { 4, 3 }, { 5, 1 }, { 5, 3 } }; for (int i = 0; i < propArr.length; i++) { - modelList1.add(new ModelValue(propArr[i], true, propLocation1[0][1], propLocation1[0][1], true)); + modelList1.add(new ModelValue(propArr[i], true, propLocation1[i][0], propLocation1[i][1], true)); } initModel(model1, modelList1); @@ -325,6 +325,7 @@ public class NewProductTestForm extends AbstractRendering { objStr = "0"; } int num = Integer.parseInt(objStr); + System.out.println("ֵ" + num); if (num < 0) { System.out.println("ֻȻ\"/\""); MessageBox.post("ֻȻ\"/\"", "", MessageBox.ERROR); @@ -352,21 +353,22 @@ public class NewProductTestForm extends AbstractRendering { } table.setValueAt(sum, table.getRowCount() - 1, col); double sum1 = Double - .parseDouble((sumObj = table.getValueAt(table.getRowCount() - 1, 4)) == null ? "0" - : sumObj.toString().trim()); + .parseDouble(((sumObj = table.getValueAt(table.getRowCount() - 1, 4)) == null + || "".equals(sumObj.toString().trim())) ? "0" : sumObj.toString().trim()); double sum2 = Double - .parseDouble((sumObj = table.getValueAt(table.getRowCount() - 1, 5)) == null ? "0" - : sumObj.toString().trim()); + .parseDouble(((sumObj = table.getValueAt(table.getRowCount() - 1, 5)) == null + || "".equals(sumObj.toString().trim())) ? "0" : sumObj.toString().trim()); double sum3 = Double - .parseDouble((sumObj = table.getValueAt(table.getRowCount() - 1, 6)) == null ? "0" - : sumObj.toString().trim()); + .parseDouble(((sumObj = table.getValueAt(table.getRowCount() - 1, 6)) == null + || "".equals(sumObj.toString().trim())) ? "0" : sumObj.toString().trim()); double sum4 = Double - .parseDouble((sumObj = table.getValueAt(table.getRowCount() - 1, 7)) == null ? "0" - : sumObj.toString().trim()); + .parseDouble(((sumObj = table.getValueAt(table.getRowCount() - 1, 7)) == null + || "".equals(sumObj.toString().trim())) ? "0" : sumObj.toString().trim()); table.setValueAt(sum1 + sum2 + sum3 + sum4, table.getRowCount() - 1, 3); table2.revalidate(); table2.repaint(); } catch (NumberFormatException e1) { + e1.printStackTrace(); System.out.println("ֻȻ\"/\""); MessageBox.post("ֻȻ\"/\"", "", MessageBox.ERROR); obj = "/"; @@ -518,7 +520,7 @@ public class NewProductTestForm extends AbstractRendering { try { AIFComponentContext[] comps = form.whereReferenced(); StringBuilder msg = new StringBuilder(); - A1: for (AIFComponentContext aif : comps) { + for (AIFComponentContext aif : comps) { System.out.println("ref type:" + aif.getComponent().getType()); if ("JD2_GTXPCSXQDRevision".equals(aif.getComponent().getType())) { TCComponentItemRevision rev = (TCComponentItemRevision) aif.getComponent(); @@ -531,9 +533,9 @@ public class NewProductTestForm extends AbstractRendering { String ownner = form.getTCProperty("owning_user").getUIFValue(); for (int i = 0; i < 4; i++) { if (exist.contains(jieduan[i])) { - System.out.println("Ѵڽ׶\"" + jieduan[i] + "\"Լƻ飡"); - MessageBox.post("Ѵڽ׶\"" + jieduan[i] + "\"Լƻ飡", "", MessageBox.ERROR); - break A1; + System.out.println("\"" + jieduan[i] + "׶\"ԼƻѴ"); + msg.append("\"" + jieduan[i] + "׶\"ԼƻѴ\n"); + continue; } Object obj; Object temp; @@ -569,7 +571,7 @@ public class NewProductTestForm extends AbstractRendering { System.out.println(Arrays.deepToString(dataArr)); TCTableUtil.setTableRows(form1, "jd2_csjhtable", "JD2_CSJHTABLE", colNames2, dataArr); - msg.append(jieduan[i] + "׶βԼƻɹ\n"); + msg.append("\"" + jieduan[i] + "׶\"Լƻɹ\n"); } colData.clear(); }