From dc52c6919877474d81f4cd0952a3f398b1ce6591 Mon Sep 17 00:00:00 2001 From: lijh Date: Mon, 1 Jul 2024 17:46:24 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B7=A5=E8=A3=85=E9=9C=80=E6=B1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- com.connor.chint.wuhan/bin/.gitignore | 3 - com.connor.chint.wuhan/plugin.xml | 6 + .../plm/CostListManagement/pojo/GzxqBean.java | 649 +++++-- .../com/connor/plm/GZXQ/ButtonCellEditor.java | 248 +-- .../src/com/connor/plm/GZXQ/GZXQHandler.java | 42 +- .../src/com/connor/plm/GZXQ/NewJFrame.java | 1644 +++++++++-------- 6 files changed, 1499 insertions(+), 1093 deletions(-) diff --git a/com.connor.chint.wuhan/bin/.gitignore b/com.connor.chint.wuhan/bin/.gitignore index fcae520..c2d9872 100644 --- a/com.connor.chint.wuhan/bin/.gitignore +++ b/com.connor.chint.wuhan/bin/.gitignore @@ -1,4 +1 @@ /com/ -/mes/ -/nc/ -/plm/ diff --git a/com.connor.chint.wuhan/plugin.xml b/com.connor.chint.wuhan/plugin.xml index 8c22fb6..cf21627 100644 --- a/com.connor.chint.wuhan/plugin.xml +++ b/com.connor.chint.wuhan/plugin.xml @@ -73,6 +73,12 @@ + + + + + + diff --git a/com.connor.chint.wuhan/src/com/connor/plm/CostListManagement/pojo/GzxqBean.java b/com.connor.chint.wuhan/src/com/connor/plm/CostListManagement/pojo/GzxqBean.java index cb3ddf4..0e862e5 100644 --- a/com.connor.chint.wuhan/src/com/connor/plm/CostListManagement/pojo/GzxqBean.java +++ b/com.connor.chint.wuhan/src/com/connor/plm/CostListManagement/pojo/GzxqBean.java @@ -1,164 +1,495 @@ package com.connor.plm.CostListManagement.pojo; + + +/** + * =============================================================================== + * Copyright (c) 2012-2024 CONNOR lijh. Unpublished - All Rights Reserved + * =============================================================================== + * File description: + * + * GzxqBean.java 工装需求bean + * + * =============================================================================== + * DATE Name Description of Change + * + * 2024-06-13 ljh create + * =============================================================================== + */ + + + + +import java.awt.Desktop; +import java.net.URI; + +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent; +import com.teamcenter.rac.aifrcp.AIFUtility; +import com.teamcenter.rac.kernel.TCComponentFolder; +import com.teamcenter.rac.kernel.TCComponentItem; +import com.teamcenter.rac.kernel.TCComponentItemRevision; +import com.teamcenter.rac.kernel.TCComponentItemType; +import com.teamcenter.rac.kernel.TCSession; + +import javafx.event.ActionEvent; +import javafx.event.EventHandler; +import javafx.scene.control.Button; +import javafx.scene.control.TextArea; + public class GzxqBean { - private String instanceId; - private String factory; - private String sfId; - private String head; - private String scheduledtime; - private String model; - private String productname; - private String toolnumber; - private String toolname; - private String toolinglevel; - private String reason; - private String jsgyrequirements; - private String link; - private String state; - - public GzxqBean() { - super(); - } - - public String getInstanceId() { - return instanceId; - } - - public void setInstanceId(String instanceId) { - this.instanceId = instanceId; - } - - public String getFactory() { - return factory; - } - - public void setFactory(String factory) { - this.factory = factory; - } - - public String getSfId() { - return sfId; - } - - public void setSfId(String sfId) { - this.sfId = sfId; - } - - public String getHead() { - return head; - } - - public void setHead(String head) { - this.head = head; - } - - public String getScheduledtime() { - return scheduledtime; - } - - public void setScheduledtime(String scheduledtime) { - this.scheduledtime = scheduledtime; - } - - public String getModel() { - return model; - } - - public void setModel(String model) { - this.model = model; - } - - public String getProductname() { - return productname; - } - - public void setProductname(String productname) { - this.productname = productname; - } - - public String getToolnumber() { - return toolnumber; - } - - public void setToolnumber(String toolnumber) { - this.toolnumber = toolnumber; - } - - public String getToolname() { - return toolname; - } - - public void setToolname(String toolname) { - this.toolname = toolname; - } - - public String getToolinglevel() { - return toolinglevel; - } - - public void setToolinglevel(String toolinglevel) { - this.toolinglevel = toolinglevel; - } - - public String getReason() { - return reason; - } - - public void setReason(String reason) { - this.reason = reason; - } - - public String getJsgyrequirements() { - return jsgyrequirements; - } - - public void setJsgyrequirements(String jsgyrequirements) { - this.jsgyrequirements = jsgyrequirements; - } - - public String getLink() { - return link; - } - - public void setLink(String link) { - this.link = link; - } - - public String getState() { - return state; - } - - public void setState(String state) { - this.state = state; - } - - public GzxqBean(String instanceId, String factory, String sfId, String head, String scheduledtime, String model, - String productname, String toolnumber, String toolname, String toolinglevel, String reason, - String jsgyrequirements, String link, String state) { - super(); - this.instanceId = instanceId; - this.factory = factory; - this.sfId = sfId; - this.head = head; - this.scheduledtime = scheduledtime; - this.model = model; - this.productname = productname; - this.toolnumber = toolnumber; - this.toolname = toolname; - this.toolinglevel = toolinglevel; - this.reason = reason; - this.jsgyrequirements = jsgyrequirements; - this.link = link; - this.state = state; - } - - @Override - public String toString() { - return "GzxqBean [instanceId=" + instanceId + ", factory=" + factory + ", sfId=" + sfId + ", head=" + head - + ", scheduledtime=" + scheduledtime + ", model=" + model + ", productname=" + productname - + ", toolnumber=" + toolnumber + ", toolname=" + toolname + ", toolinglevel=" + toolinglevel - + ", reason=" + reason + ", jsgyrequirements=" + jsgyrequirements + ", link=" + link + ", state=" - + state + "]"; - } + private TextArea instanceId = new TextArea(); + private TextArea factory = new TextArea(); + private TextArea sfId = new TextArea(); + private TextArea head = new TextArea(); + private TextArea scheduledtime = new TextArea(); + private TextArea model = new TextArea(); + private TextArea productname = new TextArea(); + private TextArea toolnumber = new TextArea(); + private TextArea toolname = new TextArea(); + private TextArea toolinglevel = new TextArea(); + + private TextArea reason = new TextArea(); + private TextArea jsgyrequirements = new TextArea(); + private Button link = new Button(); + private Button cjgzxq = new Button(); + private String linkStr; + private String sfIdStr; + private String instanceIdStr; + private TCSession session; + private TextArea state = new TextArea(); + private TextArea xh = new TextArea(); + //设置TextArea的值和Button + public GzxqBean(String instanceId, String factory, String sfId, String head, String scheduledtime, + String model, String productname, String toolnumber, String toolname, String toolinglevel, + String reason, String jsgyrequirements, String link, String state, String xh,TCSession session) { + super(); + this.instanceId.setText(instanceId); + this.instanceId.setEditable(false); + this.instanceId.setPrefSize(200, 40); + + this.factory.setText(factory); + this.factory.setEditable(false); + this.factory.setPrefSize(200, 40); + + this.sfId.setText(sfId); + this.sfId.setEditable(false); + this.sfId.setPrefSize(200, 40); + + this.head.setText(head); + this.head.setEditable(false); + this.head.setPrefSize(200, 40); + + this.scheduledtime.setText(scheduledtime); + this.scheduledtime.setEditable(false); + this.scheduledtime.setPrefSize(200, 40); + + + this.model.setText(model); + this.model.setEditable(false); + this.model.setPrefSize(200, 40); + + this.productname.setText(productname); + this.productname.setEditable(false); + this.productname.setPrefSize(200, 40); + + this.toolnumber.setText(toolnumber); + this.toolnumber.setEditable(false); + this.toolnumber.setPrefSize(200, 40); + + this.toolname.setText(toolname); + this.toolname.setEditable(false); + this.toolname.setPrefSize(200, 40); + + this.toolinglevel.setText(toolinglevel); + this.toolinglevel.setEditable(false); + this.toolinglevel.setPrefSize(200, 40); + + + + this.reason.setText(reason); + this.reason.setEditable(false); + this.reason.setPrefSize(200, 40); + + this.jsgyrequirements.setText(jsgyrequirements); + this.jsgyrequirements.setEditable(false); + this.jsgyrequirements.setPrefSize(200, 40); + + this.cjgzxq.setText("设计");; + this.cjgzxq.setPrefSize(200, 40); + this.link.setText("打开"); + this.link.setPrefSize(200, 40); + this.linkStr = link; + this.sfIdStr = sfId; + this.instanceIdStr = instanceId; + this.session = session; + + this.state.setText(state); + this.state.setEditable(false); + this.state.setPrefSize(200, 40); + + this.xh.setText(xh); + this.xh.setEditable(false); + this.xh.setPrefSize(200, 40); + + //加按钮监听 + this.link.setOnAction(new EventHandler() { + @Override + public void handle(ActionEvent event) { + System.out.println("Button was clicked!"); + // 在这里可以添加更多的逻辑 + try { + browse2(linkStr); + } catch (Exception e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } + } + }); + + //加按钮监听 创建对象 + this.cjgzxq.setOnAction(new EventHandler() { + @Override + public void handle(ActionEvent event) { + System.out.println("Button was clicked!"); + // 在这里可以添加更多的逻辑 + + String formnumber = instanceIdStr; + String sfid =sfIdStr; + AbstractAIFApplication app = AIFUtility.getCurrentApplication(); + InterfaceAIFComponent target = app.getTargetComponent(); + if(target instanceof TCComponentFolder) { + TCComponentFolder folder = (TCComponentFolder)target; + try { + TCComponentItemType typeComponent = (TCComponentItemType) session.getTypeComponent("ZT2_Frock"); + String newID = typeComponent.getNewID(); + TCComponentItem item = typeComponent.create(newID, "A", "ZT2_Frock", "", "", null); + TCComponentItemRevision itemRev = item.getLatestItemRevision(); + if(itemRev != null && formnumber != null && !formnumber.isEmpty()) { + itemRev.setStringProperty("zt2_formnumber", formnumber); + } + if(itemRev != null && sfid != null && !sfid.isEmpty()) { + itemRev.setStringProperty("zt2_sfid", sfid); + } + folder.add("contents", item); + folder.refresh(); + } catch (Exception e2) { + // TODO: handle exception + e2.printStackTrace(); + } + + }else { + try { + TCComponentItemType typeComponent = (TCComponentItemType) session.getTypeComponent("ZT2_Frock"); + String newID = typeComponent.getNewID(); + TCComponentItem item = typeComponent.create(newID, "A", "ZT2_Frock", "", "", null); + TCComponentItemRevision itemRev = item.getLatestItemRevision(); + if(itemRev != null && formnumber != null && !formnumber.isEmpty()) { + itemRev.setStringProperty("zt2_formnumber", formnumber); + + } + if(itemRev != null && sfid != null && !sfid.isEmpty()) { + itemRev.setStringProperty("zt2_sfid", sfid); + } + session.getUser().getNewStuffFolder().add("contents", item); + } catch (Exception e2) { + // TODO: handle exception + e2.printStackTrace(); + } + + } + + } + }); + } + + public TextArea getInstanceId() { + return instanceId; + } + public void setInstanceId(TextArea instanceId) { + this.instanceId = instanceId; + } + public TextArea getFactory() { + return factory; + } + public void setFactory(TextArea factory) { + this.factory = factory; + } + public TextArea getSfId() { + return sfId; + } + public void setSfId(TextArea sfId) { + this.sfId = sfId; + } + public TextArea getHead() { + return head; + } + public void setHead(TextArea head) { + this.head = head; + } + public TextArea getScheduledtime() { + return scheduledtime; + } + public void setScheduledtime(TextArea scheduledtime) { + this.scheduledtime = scheduledtime; + } + public TextArea getModel() { + return model; + } + public void setModel(TextArea model) { + this.model = model; + } + public TextArea getProductname() { + return productname; + } + public void setProductname(TextArea productname) { + this.productname = productname; + } + public TextArea getToolnumber() { + return toolnumber; + } + public void setToolnumber(TextArea toolnumber) { + this.toolnumber = toolnumber; + } + public TextArea getToolname() { + return toolname; + } + public void setToolname(TextArea toolname) { + this.toolname = toolname; + } + public TextArea getToolinglevel() { + return toolinglevel; + } + public void setToolinglevel(TextArea toolinglevel) { + this.toolinglevel = toolinglevel; + } + public TextArea getReason() { + return reason; + } + public void setReason(TextArea reason) { + this.reason = reason; + } + public Button getCjgzxq() { + return cjgzxq; + } + public void setCjgzxq(Button cjgzxq) { + this.cjgzxq = cjgzxq; + } + public Button getLink() { + return link; + } + public void setLink(Button link) { + this.link = link; + } + public TextArea getState() { + return state; + } + public void setState(TextArea state) { + this.state = state; + } + public TextArea getXh() { + return xh; + } + public void setXh(TextArea xh) { + this.xh = xh; + } + + + public TextArea getJsgyrequirements() { + return jsgyrequirements; + } + + public void setJsgyrequirements(TextArea jsgyrequirements) { + this.jsgyrequirements = jsgyrequirements; + } + + public String getLinkStr() { + return linkStr; + } + + public void setLinkStr(String linkStr) { + this.linkStr = linkStr; + } + + public String getSfIdStr() { + return sfIdStr; + } + + public void setSfIdStr(String sfIdStr) { + this.sfIdStr = sfIdStr; + } + + public String getInstanceIdStr() { + return instanceIdStr; + } + + public void setInstanceIdStr(String instanceIdStr) { + this.instanceIdStr = instanceIdStr; + } + + public TCSession getSession() { + return session; + } + + public void setSession(TCSession session) { + this.session = session; + } + + /** + * 通过浏览器打开连接 +*/ + private void browse2(String url) throws Exception { + Desktop desktop = Desktop.getDesktop(); + if (Desktop.isDesktopSupported() && desktop.isSupported(Desktop.Action.BROWSE)) { + URI uri = new URI(url); + desktop.browse(uri); + } + } +// public GzxqBean() { +// super(); +// } +// +// public String getInstanceId() { +// return instanceId; +// } +// +// public void setInstanceId(String instanceId) { +// this.instanceId = instanceId; +// } +// +// public String getFactory() { +// return factory; +// } +// +// public void setFactory(String factory) { +// this.factory = factory; +// } +// +// public String getSfId() { +// return sfId; +// } +// +// public void setSfId(String sfId) { +// this.sfId = sfId; +// } +// +// public String getHead() { +// return head; +// } +// +// public void setHead(String head) { +// this.head = head; +// } +// +// public String getScheduledtime() { +// return scheduledtime; +// } +// +// public void setScheduledtime(String scheduledtime) { +// this.scheduledtime = scheduledtime; +// } +// +// public String getModel() { +// return model; +// } +// +// public void setModel(String model) { +// this.model = model; +// } +// +// public String getProductname() { +// return productname; +// } +// +// public void setProductname(String productname) { +// this.productname = productname; +// } +// +// public String getToolnumber() { +// return toolnumber; +// } +// +// public void setToolnumber(String toolnumber) { +// this.toolnumber = toolnumber; +// } +// +// public String getToolname() { +// return toolname; +// } +// +// public void setToolname(String toolname) { +// this.toolname = toolname; +// } +// +// public String getToolinglevel() { +// return toolinglevel; +// } +// +// public void setToolinglevel(String toolinglevel) { +// this.toolinglevel = toolinglevel; +// } +// +// public String getReason() { +// return reason; +// } +// +// public void setReason(String reason) { +// this.reason = reason; +// } +// +// public String getJsgyrequirements() { +// return jsgyrequirements; +// } +// +// public void setJsgyrequirements(String jsgyrequirements) { +// this.jsgyrequirements = jsgyrequirements; +// } +// +// public String getLink() { +// return link; +// } +// +// public void setLink(String link) { +// this.link = link; +// } +// +// public String getState() { +// return state; +// } +// +// public void setState(String state) { +// this.state = state; +// } +// +// public GzxqBean(String instanceId, String factory, String sfId, String head, String scheduledtime, String model, +// String productname, String toolnumber, String toolname, String toolinglevel, String reason, +// String jsgyrequirements, String link, String state) { +// super(); +// this.instanceId = instanceId; +// this.factory = factory; +// this.sfId = sfId; +// this.head = head; +// this.scheduledtime = scheduledtime; +// this.model = model; +// this.productname = productname; +// this.toolnumber = toolnumber; +// this.toolname = toolname; +// this.toolinglevel = toolinglevel; +// this.reason = reason; +// this.jsgyrequirements = jsgyrequirements; +// this.link = link; +// this.state = state; +// } +// +// @Override +// public String toString() { +// return "GzxqBean [instanceId=" + instanceId + ", factory=" + factory + ", sfId=" + sfId + ", head=" + head +// + ", scheduledtime=" + scheduledtime + ", model=" + model + ", productname=" + productname +// + ", toolnumber=" + toolnumber + ", toolname=" + toolname + ", toolinglevel=" + toolinglevel +// + ", reason=" + reason + ", jsgyrequirements=" + jsgyrequirements + ", link=" + link + ", state=" +// + state + "]"; +// } + + } diff --git a/com.connor.chint.wuhan/src/com/connor/plm/GZXQ/ButtonCellEditor.java b/com.connor.chint.wuhan/src/com/connor/plm/GZXQ/ButtonCellEditor.java index ab96689..fefb1bf 100644 --- a/com.connor.chint.wuhan/src/com/connor/plm/GZXQ/ButtonCellEditor.java +++ b/com.connor.chint.wuhan/src/com/connor/plm/GZXQ/ButtonCellEditor.java @@ -1,124 +1,124 @@ -package com.connor.plm.GZXQ; - -import java.awt.Component; -import java.awt.Desktop; -import java.net.URI; -import java.util.List; - -import javax.swing.AbstractCellEditor; -import javax.swing.JButton; -import javax.swing.JTable; -import javax.swing.table.TableCellEditor; - -import com.connor.plm.CostListManagement.pojo.Cusquotation; -import com.connor.plm.CostListManagement.pojo.GzxqBean; -import com.teamcenter.rac.aif.AbstractAIFApplication; -import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent; -import com.teamcenter.rac.aifrcp.AIFUtility; -import com.teamcenter.rac.kernel.TCComponent; -import com.teamcenter.rac.kernel.TCComponentFolder; -import com.teamcenter.rac.kernel.TCComponentItem; -import com.teamcenter.rac.kernel.TCComponentItemRevision; -import com.teamcenter.rac.kernel.TCComponentItemType; -import com.teamcenter.rac.kernel.TCSession; - -public class ButtonCellEditor extends AbstractCellEditor implements TableCellEditor{ - - - private JButton button; - private JTable table; - private List quotations; - private Boolean flag = false; - public static GzxqBean quotation; - public static Cusquotation cusquotation; - public static TCSession session; - - public ButtonCellEditor(JTable jTable2,List quotations,TCSession session, TCComponent f) { - button = new JButton(); - this.table = jTable2; - this.quotations = quotations; - this.session = session; - button.addActionListener(e -> { - // 这里可以添加按钮的点击事件响应逻辑 - int selectedRow = table.getSelectedRow(); - System.out.println("点击了第"+selectedRow+"行"); - String text = button.getText(); - System.out.println("点击按钮名称:"+text); - if("打开".equals(text)) { - String url = quotations.get(selectedRow).getLink(); - try { - browse2(url); - } catch (Exception e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } - }else if("设计".equals(text)){ - String formnumber = quotations.get(selectedRow).getInstanceId(); - String sfid = quotations.get(selectedRow).getSfId(); - AbstractAIFApplication app = AIFUtility.getCurrentApplication(); - InterfaceAIFComponent target = app.getTargetComponent(); - if(target instanceof TCComponentFolder) { - TCComponentFolder folder = (TCComponentFolder)target; - try { - TCComponentItemType typeComponent = (TCComponentItemType) session.getTypeComponent("ZT2_Frock"); - String newID = typeComponent.getNewID(); - TCComponentItem item = typeComponent.create(newID, "A", "ZT2_Frock", "", "", null); - TCComponentItemRevision itemRev = item.getLatestItemRevision(); - if(itemRev != null && formnumber != null && !formnumber.isEmpty()) { - itemRev.setStringProperty("zt2_formnumber", formnumber); - } - if(itemRev != null && sfid != null && !sfid.isEmpty()) { - itemRev.setStringProperty("zt2_sfid", sfid); - } - folder.add("contents", item); - folder.refresh(); - } catch (Exception e2) { - // TODO: handle exception - e2.printStackTrace(); - } - - }else { - try { - TCComponentItemType typeComponent = (TCComponentItemType) session.getTypeComponent("ZT2_Frock"); - String newID = typeComponent.getNewID(); - TCComponentItem item = typeComponent.create(newID, "A", "ZT2_Frock", "", "", null); - TCComponentItemRevision itemRev = item.getLatestItemRevision(); - if(itemRev != null && formnumber != null && !formnumber.isEmpty()) { - itemRev.setStringProperty("zt2_formnumber", formnumber); - - } - if(itemRev != null && sfid != null && !sfid.isEmpty()) { - itemRev.setStringProperty("zt2_sfid", sfid); - } - session.getUser().getNewStuffFolder().add("contents", item); - } catch (Exception e2) { - // TODO: handle exception - e2.printStackTrace(); - } - - } - } - }); - - } -private void browse2(String url) throws Exception { - Desktop desktop = Desktop.getDesktop(); - if (Desktop.isDesktopSupported() && desktop.isSupported(Desktop.Action.BROWSE)) { - URI uri = new URI(url); - desktop.browse(uri); - } -} - -@Override -public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, - int row, int column) { - button.setText(value != null ? value.toString() : ""); - return button; -} - -@Override -public Object getCellEditorValue() { - return button.getText(); -} - -} +//package com.connor.plm.GZXQ; +// +//import java.awt.Component; +//import java.awt.Desktop; +//import java.net.URI; +//import java.util.List; +// +//import javax.swing.AbstractCellEditor; +//import javax.swing.JButton; +//import javax.swing.JTable; +//import javax.swing.table.TableCellEditor; +// +//import com.connor.plm.CostListManagement.pojo.Cusquotation; +//import com.connor.plm.CostListManagement.pojo.GzxqBean; +//import com.teamcenter.rac.aif.AbstractAIFApplication; +//import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent; +//import com.teamcenter.rac.aifrcp.AIFUtility; +//import com.teamcenter.rac.kernel.TCComponent; +//import com.teamcenter.rac.kernel.TCComponentFolder; +//import com.teamcenter.rac.kernel.TCComponentItem; +//import com.teamcenter.rac.kernel.TCComponentItemRevision; +//import com.teamcenter.rac.kernel.TCComponentItemType; +//import com.teamcenter.rac.kernel.TCSession; +// +//public class ButtonCellEditor extends AbstractCellEditor implements TableCellEditor{ +// +// +// private JButton button; +// private JTable table; +// private List quotations; +// private Boolean flag = false; +// public static GzxqBean quotation; +// public static Cusquotation cusquotation; +// public static TCSession session; +// +// public ButtonCellEditor(JTable jTable2,List quotations,TCSession session, TCComponent f) { +// button = new JButton(); +// this.table = jTable2; +// this.quotations = quotations; +// this.session = session; +// button.addActionListener(e -> { +// // 这里可以添加按钮的点击事件响应逻辑 +// int selectedRow = table.getSelectedRow(); +// System.out.println("点击了第"+selectedRow+"行"); +// String text = button.getText(); +// System.out.println("点击按钮名称:"+text); +// if("打开".equals(text)) { +// String url = quotations.get(selectedRow).getLink(); +// try { +// browse2(url); +// } catch (Exception e1) { +// // TODO Auto-generated catch block +// e1.printStackTrace(); +// } +// }else if("设计".equals(text)){ +// String formnumber = quotations.get(selectedRow).getInstanceId(); +// String sfid = quotations.get(selectedRow).getSfId(); +// AbstractAIFApplication app = AIFUtility.getCurrentApplication(); +// InterfaceAIFComponent target = app.getTargetComponent(); +// if(target instanceof TCComponentFolder) { +// TCComponentFolder folder = (TCComponentFolder)target; +// try { +// TCComponentItemType typeComponent = (TCComponentItemType) session.getTypeComponent("ZT2_Frock"); +// String newID = typeComponent.getNewID(); +// TCComponentItem item = typeComponent.create(newID, "A", "ZT2_Frock", "", "", null); +// TCComponentItemRevision itemRev = item.getLatestItemRevision(); +// if(itemRev != null && formnumber != null && !formnumber.isEmpty()) { +// itemRev.setStringProperty("zt2_formnumber", formnumber); +// } +// if(itemRev != null && sfid != null && !sfid.isEmpty()) { +// itemRev.setStringProperty("zt2_sfid", sfid); +// } +// folder.add("contents", item); +// folder.refresh(); +// } catch (Exception e2) { +// // TODO: handle exception +// e2.printStackTrace(); +// } +// +// }else { +// try { +// TCComponentItemType typeComponent = (TCComponentItemType) session.getTypeComponent("ZT2_Frock"); +// String newID = typeComponent.getNewID(); +// TCComponentItem item = typeComponent.create(newID, "A", "ZT2_Frock", "", "", null); +// TCComponentItemRevision itemRev = item.getLatestItemRevision(); +// if(itemRev != null && formnumber != null && !formnumber.isEmpty()) { +// itemRev.setStringProperty("zt2_formnumber", formnumber); +// +// } +// if(itemRev != null && sfid != null && !sfid.isEmpty()) { +// itemRev.setStringProperty("zt2_sfid", sfid); +// } +// session.getUser().getNewStuffFolder().add("contents", item); +// } catch (Exception e2) { +// // TODO: handle exception +// e2.printStackTrace(); +// } +// +// } +// } +// }); +// +// } +//private void browse2(String url) throws Exception { +// Desktop desktop = Desktop.getDesktop(); +// if (Desktop.isDesktopSupported() && desktop.isSupported(Desktop.Action.BROWSE)) { +// URI uri = new URI(url); +// desktop.browse(uri); +// } +//} +// +//@Override +//public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, +// int row, int column) { +// button.setText(value != null ? value.toString() : ""); +// return button; +//} +// +//@Override +//public Object getCellEditorValue() { +// return button.getText(); +//} +// +//} diff --git a/com.connor.chint.wuhan/src/com/connor/plm/GZXQ/GZXQHandler.java b/com.connor.chint.wuhan/src/com/connor/plm/GZXQ/GZXQHandler.java index 5da2a20..e3ef483 100644 --- a/com.connor.chint.wuhan/src/com/connor/plm/GZXQ/GZXQHandler.java +++ b/com.connor.chint.wuhan/src/com/connor/plm/GZXQ/GZXQHandler.java @@ -3,9 +3,11 @@ package com.connor.plm.GZXQ; import java.awt.Dimension; import java.awt.Toolkit; +import org.apache.log4j.chainsaw.Main; import org.eclipse.core.commands.AbstractHandler; import org.eclipse.core.commands.ExecutionEvent; +import com.chint.plm.SearchSapResult.SapResultFrame; import com.teamcenter.rac.aif.AbstractAIFApplication; import com.teamcenter.rac.aifrcp.AIFUtility; import com.teamcenter.rac.kernel.TCSession; @@ -26,22 +28,26 @@ public class GZXQHandler extends AbstractHandler{ new Thread() { @Override public void run() { - NewJFrame newJFrame = new NewJFrame(session); - int width2 = newJFrame.getWidth(); - int height2 = newJFrame.getHeight(); - Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); // 获取屏幕尺寸 - int screenWidth = screenSize.width; // 获取屏幕宽度 - int screenHeight = screenSize.height; // 获取屏幕高度 - int x = (screenWidth - width2) / 2; // 计算Frame的左上角x坐标 - int y = (screenHeight - height2) / 2; // 计算Frame的左上角y坐标 - newJFrame.setTitle("工装需求查询"); - // this.getContentPane().setBackground(Color.red); - newJFrame.getContentPane().setBackground(new java.awt.Color(255, 255, 255)); - newJFrame.setSize(1240, height2); // 设置Frame的大小 - newJFrame.setLocation(x, y); // 设置Frame的位置 - newJFrame.setResizable(false); - newJFrame.setDefaultCloseOperation(2); // 设置窗口关闭时的默认操作 - newJFrame.setVisible(true); +// NewJFrame newJFrame = new NewJFrame(session); +// int width2 = newJFrame.getWidth(); +// int height2 = newJFrame.getHeight(); +// Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); // 获取屏幕尺寸 +// int screenWidth = screenSize.width; // 获取屏幕宽度 +// int screenHeight = screenSize.height; // 获取屏幕高度 +// int x = (screenWidth - width2) / 2; // 计算Frame的左上角x坐标 +// int y = (screenHeight - height2) / 2; // 计算Frame的左上角y坐标 +// newJFrame.setTitle("工装需求查询"); +// // this.getContentPane().setBackground(Color.red); +// newJFrame.getContentPane().setBackground(new java.awt.Color(255, 255, 255)); +// newJFrame.setSize(1240, height2); // 设置Frame的大小 +// newJFrame.setLocation(x, y); // 设置Frame的位置 +// newJFrame.setResizable(false); +// newJFrame.setDefaultCloseOperation(2); // 设置窗口关闭时的默认操作 +// newJFrame.setVisible(true); + + + + new GZXQFrame(); } }.start(); } catch (Exception e) { @@ -50,4 +56,8 @@ public class GZXQHandler extends AbstractHandler{ return null; } + public static void main(String[] args) { + new GZXQFrame(); + } + } diff --git a/com.connor.chint.wuhan/src/com/connor/plm/GZXQ/NewJFrame.java b/com.connor.chint.wuhan/src/com/connor/plm/GZXQ/NewJFrame.java index 07890f5..9453942 100644 --- a/com.connor.chint.wuhan/src/com/connor/plm/GZXQ/NewJFrame.java +++ b/com.connor.chint.wuhan/src/com/connor/plm/GZXQ/NewJFrame.java @@ -1,798 +1,860 @@ -package com.connor.plm.GZXQ; -/* - * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license - * Click nbfs://nbhost/SystemFileSystem/Templates/GUIForms/JFrame.java to edit this template - */ - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Font; -import java.awt.Toolkit; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.util.ArrayList; -import java.util.List; - -import javax.swing.LayoutStyle; -import javax.swing.border.EtchedBorder; -import javax.swing.border.TitledBorder; -import javax.swing.table.DefaultTableModel; -import javax.swing.table.TableColumnModel; - -import com.chint.plm.SearchSapResult9.SumTableBean; -import com.connor.chint.sap2.util.SAPUtil; -import com.connor.chint.sap2.util.SqlUtil; -import com.connor.plm.CostListManagement.pojo.GzxqBean; -import com.teamcenter.rac.kernel.TCComponent; -import com.teamcenter.rac.kernel.TCException; -import com.teamcenter.rac.kernel.TCSession; -import com.teamcenter.rac.util.MessageBox; - -/** - * - * @author admin - */ -public class NewJFrame extends javax.swing.JFrame { - - - //分页 - private int pageNum;//分页显示当前第几页 - private List> tableBeans = new ArrayList>(); - private DefaultTableModel model; - - - // Variables declaration - do not modify - private javax.swing.JButton sy; - private javax.swing.JButton syy; - private javax.swing.JButton xyy; - private javax.swing.JButton wy; - - - private javax.swing.JButton jButton1; - private javax.swing.JButton jButton2; - private javax.swing.JLabel jLabel1; - private javax.swing.JLabel jLabel10; - private javax.swing.JLabel jLabel11; - private javax.swing.JLabel jLabel12; - private javax.swing.JLabel jLabel13; - private javax.swing.JLabel jLabel14; - private javax.swing.JLabel jLabel15; - private javax.swing.JLabel jLabel2; - private javax.swing.JLabel jLabel3; - private javax.swing.JLabel jLabel4; - private javax.swing.JLabel jLabel5; - private javax.swing.JLabel jLabel6; - private javax.swing.JLabel jLabel7; - private javax.swing.JLabel jLabel8; - private javax.swing.JLabel jLabel9; - private javax.swing.JPanel jPanel1; - private javax.swing.JPanel jPanel2; - private javax.swing.JPanel jPanel3; - private javax.swing.JScrollPane jScrollPane2; - private javax.swing.JScrollPane jScrollPane3; - private javax.swing.JScrollPane jScrollPane4; - private javax.swing.JTable jTable1; - private javax.swing.JTable jTable2; - private javax.swing.JTable jTable3; - private javax.swing.JTextField jTextField1; - private javax.swing.JTextField jTextField10; - private javax.swing.JTextField jTextField11; - private javax.swing.JTextField jTextField12; - private javax.swing.JTextField jTextField13; - private javax.swing.JTextField jTextField14; - private javax.swing.JTextField jTextField2; - private javax.swing.JTextField jTextField3; - private javax.swing.JTextField jTextField4; - private javax.swing.JTextField jTextField5; - private javax.swing.JTextField jTextField6; - private javax.swing.JTextField jTextField7; - private javax.swing.JTextField jTextField8; - private javax.swing.JTextField jTextField9; - // End of variables declaration - - private TCSession session; - private Connection conn; - private TCComponent f; - /** - * Creates new form NewJFrame - * @param session - */ - public NewJFrame(TCSession session) { - String[] prefs = session.getPreferenceService().getStringValues("database_tc"); - System.out.println("===============开始连接tc数据库==============="); - long time31 = System.nanoTime(); - conn = SqlUtil.getTCDataConnection(prefs); - long time32 = System.nanoTime(); - System.out.println("===============连接tc数据库用时(ms): " + ((time32 - time31) / 1000000L)+"==============="); - this.session = session; - initComponents(); - - } - - /** - * This method is called from within the constructor to initialize the form. - * WARNING: Do NOT modify this code. The content of this method is always - * regenerated by the Form Editor. - */ - @SuppressWarnings("unchecked") - // - private void initComponents() { - - jScrollPane2 = new javax.swing.JScrollPane(); - jTable1 = new javax.swing.JTable(); - jTable3 = new javax.swing.JTable(); - jPanel1 = new javax.swing.JPanel(); - jLabel2 = new javax.swing.JLabel(); - jTextField1 = new javax.swing.JTextField(); - jLabel3 = new javax.swing.JLabel(); - jTextField2 = new javax.swing.JTextField(); - jLabel4 = new javax.swing.JLabel(); - jTextField3 = new javax.swing.JTextField(); - jLabel5 = new javax.swing.JLabel(); - jTextField4 = new javax.swing.JTextField(); - jLabel6 = new javax.swing.JLabel(); - jTextField5 = new javax.swing.JTextField(); - jLabel7 = new javax.swing.JLabel(); - jTextField6 = new javax.swing.JTextField(); - jLabel8 = new javax.swing.JLabel(); - jTextField7 = new javax.swing.JTextField(); - jLabel9 = new javax.swing.JLabel(); - jTextField8 = new javax.swing.JTextField(); - jLabel10 = new javax.swing.JLabel(); - jTextField9 = new javax.swing.JTextField(); - jLabel11 = new javax.swing.JLabel(); - jTextField10 = new javax.swing.JTextField(); - jLabel12 = new javax.swing.JLabel(); - jTextField11 = new javax.swing.JTextField(); - jLabel13 = new javax.swing.JLabel(); - jTextField12 = new javax.swing.JTextField(); - jButton1 = new javax.swing.JButton(); - jButton2 = new javax.swing.JButton(); - jLabel14 = new javax.swing.JLabel(); - jTextField13 = new javax.swing.JTextField(); - jLabel15 = new javax.swing.JLabel(); - jTextField14 = new javax.swing.JTextField(); - jTextField14.setVisible(false); - jLabel1 = new javax.swing.JLabel(); - jPanel2 = new javax.swing.JPanel(); - jScrollPane3 = new javax.swing.JScrollPane(); - jPanel3 = new javax.swing.JPanel(); - jScrollPane4 = new javax.swing.JScrollPane(); - jTable2 = new javax.swing.JTable(); - - //分页 - sy = new javax.swing.JButton(); - syy = new javax.swing.JButton(); - xyy = new javax.swing.JButton(); - wy = new javax.swing.JButton(); - -sy.addActionListener(new ActionListener() { - - @Override - public void actionPerformed(ActionEvent var1) { - // TODO Auto-generated method stub - pageNum = 0; - model.setRowCount(0);//清空数据 - for (int j = 0; j < tableBeans.get(0).size(); j++) { - GzxqBean quotation = tableBeans.get(0).get(j); - String[] row = {j+1+"",quotation.getSfId(),quotation.getInstanceId(),quotation.getHead(),quotation.getScheduledtime(),quotation.getReason(),quotation.getJsgyrequirements(),"打开","设计",quotation.getState()}; - model.addRow(row); - } - - } - }); - -syy.addActionListener(new ActionListener() { - - @Override - public void actionPerformed(ActionEvent var1) { - // TODO Auto-generated method stub - if(pageNum>0) { - pageNum = pageNum -1; - } - model.setRowCount(0);//清空数据 - for (int j = 0; j < tableBeans.get(pageNum).size(); j++) { - GzxqBean quotation = tableBeans.get(pageNum).get(j); - String[] row = {pageNum*10+j+1+"",quotation.getSfId(),quotation.getInstanceId(),quotation.getHead(),quotation.getScheduledtime(),quotation.getReason(),quotation.getJsgyrequirements(),"打开","设计",quotation.getState()}; - model.addRow(row); - } - } -}); - -xyy.addActionListener(new ActionListener() { - - @Override - public void actionPerformed(ActionEvent var1) { - // TODO Auto-generated method stub - if(pageNum> tableBeans = new ArrayList>(); +// private DefaultTableModel model; +// +// +// // Variables declaration - do not modify +// private javax.swing.JButton sy; +// private javax.swing.JButton syy; +// private javax.swing.JButton xyy; +// private javax.swing.JButton wy; +// +// +// private javax.swing.JButton jButton1; +// private javax.swing.JButton jButton2; +// private javax.swing.JLabel jLabel1; +// private javax.swing.JLabel jLabel10; +// private javax.swing.JLabel jLabel11; +// private javax.swing.JLabel jLabel12; +// private javax.swing.JLabel jLabel13; +// private javax.swing.JLabel jLabel14; +// private javax.swing.JLabel jLabel15; +// private javax.swing.JLabel jLabel2; +// private javax.swing.JLabel jLabel3; +// private javax.swing.JLabel jLabel4; +// private javax.swing.JLabel jLabel5; +// private javax.swing.JLabel jLabel6; +// private javax.swing.JLabel jLabel7; +// private javax.swing.JLabel jLabel8; +// private javax.swing.JLabel jLabel9; +// private javax.swing.JPanel jPanel1; +// private javax.swing.JPanel jPanel2; +// private javax.swing.JPanel jPanel3; +// private javax.swing.JScrollPane jScrollPane2; +// private javax.swing.JScrollPane jScrollPane3; +// private javax.swing.JScrollPane jScrollPane4; +// private javax.swing.JTable jTable1; +// private javax.swing.JTable jTable2; +// private javax.swing.JTable jTable3; +// private javax.swing.JTextField jTextField1; +// private javax.swing.JTextField jTextField10; +// private javax.swing.JTextField jTextField11; +// private javax.swing.JTextField jTextField12; +// private javax.swing.JTextField jTextField13; +// private javax.swing.JTextField jTextField14; +// private javax.swing.JTextField jTextField2; +// private javax.swing.JTextField jTextField3; +// private javax.swing.JTextField jTextField4; +// private javax.swing.JTextField jTextField5; +// private javax.swing.JTextField jTextField6; +// private javax.swing.JTextField jTextField7; +// private javax.swing.JTextField jTextField8; +// private javax.swing.JTextField jTextField9; +// // End of variables declaration +// +// private TCSession session; +// private Connection conn; +// private TCComponent f; +// /** +// * Creates new form NewJFrame +// * @param session +// */ +// public NewJFrame(TCSession session) { +// String[] prefs = session.getPreferenceService().getStringValues("database_tc"); +// System.out.println("===============开始连接tc数据库==============="); +// long time31 = System.nanoTime(); +// conn = SqlUtil.getTCDataConnection(prefs); +// long time32 = System.nanoTime(); +// System.out.println("===============连接tc数据库用时(ms): " + ((time32 - time31) / 1000000L)+"==============="); +// this.session = session; +// initComponents(); +// +// } +// +// /** +// * This method is called from within the constructor to initialize the form. +// * WARNING: Do NOT modify this code. The content of this method is always +// * regenerated by the Form Editor. +// */ +// @SuppressWarnings("unchecked") +// // +// private void initComponents() { +// +// jScrollPane2 = new javax.swing.JScrollPane(); +// jTable1 = new javax.swing.JTable(); +// jTable3 = new javax.swing.JTable(); +// jPanel1 = new javax.swing.JPanel(); +// jLabel2 = new javax.swing.JLabel(); +// jTextField1 = new javax.swing.JTextField(); +// jLabel3 = new javax.swing.JLabel(); +// jTextField2 = new javax.swing.JTextField(); +// jLabel4 = new javax.swing.JLabel(); +// jTextField3 = new javax.swing.JTextField(); +// jLabel5 = new javax.swing.JLabel(); +// jTextField4 = new javax.swing.JTextField(); +// jLabel6 = new javax.swing.JLabel(); +// jTextField5 = new javax.swing.JTextField(); +// jLabel7 = new javax.swing.JLabel(); +// jTextField6 = new javax.swing.JTextField(); +// jLabel8 = new javax.swing.JLabel(); +// jTextField7 = new javax.swing.JTextField(); +// jLabel9 = new javax.swing.JLabel(); +// jTextField8 = new javax.swing.JTextField(); +// jLabel10 = new javax.swing.JLabel(); +// jTextField9 = new javax.swing.JTextField(); +// jLabel11 = new javax.swing.JLabel(); +// jTextField10 = new javax.swing.JTextField(); +// jLabel12 = new javax.swing.JLabel(); +// jTextField11 = new javax.swing.JTextField(); +// jLabel13 = new javax.swing.JLabel(); +// jTextField12 = new javax.swing.JTextField(); +// jButton1 = new javax.swing.JButton(); +// jButton2 = new javax.swing.JButton(); +// jLabel14 = new javax.swing.JLabel(); +// jTextField13 = new javax.swing.JTextField(); +// jLabel15 = new javax.swing.JLabel(); +// jTextField14 = new javax.swing.JTextField(); +// jTextField14.setVisible(false); +// jLabel1 = new javax.swing.JLabel(); +// jPanel2 = new javax.swing.JPanel(); +// jScrollPane3 = new javax.swing.JScrollPane(); +// jPanel3 = new javax.swing.JPanel(); +// jScrollPane4 = new javax.swing.JScrollPane(); +// jTable2 = new javax.swing.JTable(); +// +// //分页 +// sy = new javax.swing.JButton(); +// syy = new javax.swing.JButton(); +// xyy = new javax.swing.JButton(); +// wy = new javax.swing.JButton(); +// +//sy.addActionListener(new ActionListener() { +// +// @Override +// public void actionPerformed(ActionEvent var1) { +// // TODO Auto-generated method stub +// pageNum = 0; +// model.setRowCount(0);//清空数据 +// for (int j = 0; j < tableBeans.get(0).size(); j++) { +// GzxqBean quotation = tableBeans.get(0).get(j); +// String[] row = {j+1+"",quotation.getSfId(),quotation.getInstanceId(),quotation.getHead(),quotation.getScheduledtime(),quotation.getReason(),quotation.getJsgyrequirements(),"打开","设计",quotation.getState()}; +// model.addRow(row); +// } +// +// } +// }); +// +//syy.addActionListener(new ActionListener() { +// +// @Override +// public void actionPerformed(ActionEvent var1) { +// // TODO Auto-generated method stub +// if(pageNum>0) { +// pageNum = pageNum -1; +// } +// model.setRowCount(0);//清空数据 +// for (int j = 0; j < tableBeans.get(pageNum).size(); j++) { +// GzxqBean quotation = tableBeans.get(pageNum).get(j); +// String[] row = {pageNum*10+j+1+"",quotation.getSfId(),quotation.getInstanceId(),quotation.getHead(),quotation.getScheduledtime(),quotation.getReason(),quotation.getJsgyrequirements(),"打开","设计",quotation.getState()}; +// model.addRow(row); +// } +// } +//}); +// +//xyy.addActionListener(new ActionListener() { +// +// @Override +// public void actionPerformed(ActionEvent var1) { +// // TODO Auto-generated method stub +// if(pageNum quotations = new ArrayList(); - while (res.next()) { - - GzxqBean gzxqBean = new GzxqBean( - res.getString("instanceId") != null ? res.getString("instanceId") : "", - res.getString("factory") != null ? res.getString("factory") : "", - res.getString("sfId") != null ? res.getString("sfId") : "", - res.getString("head") != null ? res.getString("head") : "", - res.getString("scheduledtime") != null ? res.getString("scheduledtime") : "", - res.getString("model") != null ? res.getString("model") : "", - res.getString("productname") != null ? res.getString("productname") : "", - res.getString("toolnumber") != null ? res.getString("toolnumber") : "", - res.getString("toolname") != null ? res.getString("toolname") : "", - res.getString("toolinglevel") != null ? res.getString("toolinglevel") : "", - res.getString("reason") != null ? res.getString("reason") : "", - res.getString("jsgyrequirements") != null ? res.getString("jsgyrequirements") : "", - res.getString("link") != null ? res.getString("link") : "", - res.getString("state") != null ? res.getString("state") : "" - ); - if(z % 10 ==1) { - quotations = new ArrayList(); - tableBeans.add(quotations); - } - quotations.add(gzxqBean); - z = z+1; - } - pageNum = 0; - //将数据插入到表格 - String[] title = new String [] { "序号","申请人","流程实例ID","工艺负责人","计划时间", "委托理由", "技术工艺要求", "OA表单链接","创建工装需求","状态"}; -// DefaultTableModel model = new DefaultTableModel(new Object [][] {},title); - model = new DefaultTableModel(new Object [][] {},title) { - - // 重写isCellEditable方法,禁止第一列 第二列 第五列单元格编辑 - @Override - public boolean isCellEditable(int row, int column) { - // 将第一列、第二列和第五列设置为不可编辑 - return !(column == 0 || column == 1 || column == 2 || column == 3 || column == 4 || column == 5 || column == 6 || column == 9); - } - }; - -// Object[][] str = {{"数据1列1", "数据1列2", "打卡", "创建", "数据1列5"},{"数据1列1", "数据1列2", "打卡", "创建", "数据1列5"}}; -// DefaultTableModel model = new DefaultTableModel(str,title) { +// if(jTextField9.getText()!=null && !"".equals(jTextField9.getText().trim())) { +// sql += "and \"PRODUCTNAME\" = \'" + jTextField9.getText() +"\'"; +// } +// if(jTextField10.getText()!=null && !"".equals(jTextField10.getText().trim())) { +// sql += "and \"TOOLINGLEVEL\" = \'" + jTextField10.getText() +"\'"; +// } +// if(jTextField6.getText()!=null && !"".equals(jTextField6.getText().trim())) { +// sql += "and \"REASON\" = \'" + jTextField6.getText() +"\'"; +// } +// System.out.println("sql:"+sql); +// PreparedStatement statement; +// +// +// try { +// int z=1; +// statement = conn.prepareStatement(sql); +// ResultSet res = statement.executeQuery(); +// List quotations = new ArrayList(); +// while (res.next()) { +// +// GzxqBean gzxqBean = new GzxqBean( +// res.getString("instanceId") != null ? res.getString("instanceId") : "", +// res.getString("factory") != null ? res.getString("factory") : "", +// res.getString("sfId") != null ? res.getString("sfId") : "", +// res.getString("head") != null ? res.getString("head") : "", +// res.getString("scheduledtime") != null ? res.getString("scheduledtime") : "", +// res.getString("model") != null ? res.getString("model") : "", +// res.getString("productname") != null ? res.getString("productname") : "", +// res.getString("toolnumber") != null ? res.getString("toolnumber") : "", +// res.getString("toolname") != null ? res.getString("toolname") : "", +// res.getString("toolinglevel") != null ? res.getString("toolinglevel") : "", +// res.getString("reason") != null ? res.getString("reason") : "", +// res.getString("jsgyrequirements") != null ? res.getString("jsgyrequirements") : "", +// res.getString("link") != null ? res.getString("link") : "", +// res.getString("state") != null ? res.getString("state") : "" +// ); +// if(z % 10 ==1) { +// quotations = new ArrayList(); +// tableBeans.add(quotations); +// } +// quotations.add(gzxqBean); +// z = z+1; +// } +// pageNum = 0; +// //将数据插入到表格 +// String[] title = new String [] { "序号","申请人","流程实例ID","工艺负责人","计划时间", "委托理由", "技术工艺要求", "OA表单链接","创建工装需求","状态"}; +//// DefaultTableModel model = new DefaultTableModel(new Object [][] {},title); +// model = new DefaultTableModel(new Object [][] {},title) { +// // // 重写isCellEditable方法,禁止第一列 第二列 第五列单元格编辑 // @Override // public boolean isCellEditable(int row, int column) { // // 将第一列、第二列和第五列设置为不可编辑 -// return !(column == 0 || column == 1 || column == 4); +// return !(column == 0 || column == 1 || column == 2 || column == 3 || column == 4 || column == 5 || column == 6 || column == 9); // } -// }; - jTable2.setModel(model); - if(tableBeans.get(0).size() > 0) { - for(int i = 0;i - - - /** - * @param args the command line arguments - */ - public static void main(String args[]) { - /* Set the Nimbus look and feel */ - // - /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. - * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html - */ -// try { -// for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { -// if ("Nimbus".equals(info.getName())) { -// javax.swing.UIManager.setLookAndFeel(info.getClassName()); -// break; -// } +// }; +// +//// Object[][] str = {{"数据1列1", "数据1列2", "打卡", "创建", "数据1列5"},{"数据1列1", "数据1列2", "打卡", "创建", "数据1列5"}}; +//// DefaultTableModel model = new DefaultTableModel(str,title) { +//// // 重写isCellEditable方法,禁止第一列 第二列 第五列单元格编辑 +//// @Override +//// public boolean isCellEditable(int row, int column) { +//// // 将第一列、第二列和第五列设置为不可编辑 +//// return !(column == 0 || column == 1 || column == 4); +//// } +//// }; +// jTable2.setModel(model); +// model.setRowCount(0);//清空数据 +// if(tableBeans == null || tableBeans.size() <= 0 || tableBeans.get(0).size() <= 0) { +// MessageBox.post("未查询到对应工装需求!","提示",2); +// return; +// } +// else { +// for(int i = 0;i +// /** +// * @param frame +// * @function 添加页面的监听 +// */ +// private void addWindListener(Frame frame) { +// // TODO Auto-generated method stub +// +// frame.addComponentListener(new ComponentListener() { +// +// @Override +// public void componentShown(ComponentEvent e) { +// // TODO Auto-generated method stub +// +// } +// +// @Override +// public void componentResized(ComponentEvent e) { +// // TODO Auto-generated method stub +//// System.out.println("=============="); +// +// Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); // 获取屏幕尺寸 +// int screenWidth = screenSize.width; // 获取屏幕宽度 +// int screenHeight = screenSize.height; // 获取屏幕高度 +// Component component = e.getComponent(); +// System.out.println("component==>" + component); +// double width = component.getSize().getWidth(); +//// // double width = primaryStage.getWidth(); +// System.out.println("width==>" + width); +// jPanel1.setPreferredSize(new Dimension((int) (screenWidth * 0.98), jPanel1.getHeight())); +// jPanel2.setPreferredSize(new Dimension((int) (screenWidth * 0.98), jPanel2.getHeight())); +// jPanel3.setPreferredSize(new Dimension((int) (screenWidth * 0.98), jPanel3.getHeight())); +// +// jScrollPane2.setPreferredSize(new Dimension((int) (screenWidth * 0.98), jScrollPane2.getHeight())); +// jScrollPane3.setPreferredSize(new Dimension((int) (screenWidth * 0.98), jScrollPane3.getHeight())); +// jScrollPane4.setPreferredSize(new Dimension((int) (screenWidth * 0.98), jScrollPane4.getHeight())); +// // jTable1.setPreferredSize(new Dimension((int) (screenWidth * 0.98), jTable1.getHeight())); +// // jTable2.setPreferredSize(new Dimension((int) (screenWidth * 0.98), jTable2.getHeight())); +// // jTable3.setPreferredSize(new Dimension((int) (screenWidth * 0.98), jTable3.getHeight())); +//// refTable.setPrefWidth(width * 0.97); +// } +// +// @Override +// public void componentMoved(ComponentEvent e) { +// // TODO Auto-generated method stub +// +// } +// +// @Override +// public void componentHidden(ComponentEvent e) { +// // TODO Auto-generated method stub +// // } -// } catch (ClassNotFoundException ex) { -// java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); -// } catch (InstantiationException ex) { -// java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); -// } catch (IllegalAccessException ex) { -// java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); -// } catch (javax.swing.UnsupportedLookAndFeelException ex) { -// java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); -// } - // - - /* Create and display the form */ - java.awt.EventQueue.invokeLater(new Runnable() { - public void run() { - NewJFrame newJFrame = new NewJFrame(null); - int width2 = newJFrame.getWidth(); - int height2 = newJFrame.getHeight(); - Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); // 获取屏幕尺寸 - int screenWidth = screenSize.width; // 获取屏幕宽度 - int screenHeight = screenSize.height; // 获取屏幕高度 - int x = (screenWidth - width2) / 2; // 计算Frame的左上角x坐标 - int y = (screenHeight - height2) / 2; // 计算Frame的左上角y坐标 - newJFrame.setTitle("工装需求查询"); - // this.getContentPane().setBackground(Color.red); - newJFrame.getContentPane().setBackground(new java.awt.Color(255, 255, 255)); - newJFrame.setSize(width2, height2); // 设置Frame的大小 - newJFrame.setLocation(x, y); // 设置Frame的位置 - newJFrame.setResizable(false); - newJFrame.setDefaultCloseOperation(2); // 设置窗口关闭时的默认操作 - newJFrame.setVisible(true); - } - }); - } - - - - -} +// }); +// +// } +// +// +// /** +// * @param args the command line arguments +// */ +// public static void main(String args[]) { +// /* Set the Nimbus look and feel */ +// // +// /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. +// * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html +// */ +//// try { +//// for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { +//// if ("Nimbus".equals(info.getName())) { +//// javax.swing.UIManager.setLookAndFeel(info.getClassName()); +//// break; +//// } +//// } +//// } catch (ClassNotFoundException ex) { +//// java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); +//// } catch (InstantiationException ex) { +//// java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); +//// } catch (IllegalAccessException ex) { +//// java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); +//// } catch (javax.swing.UnsupportedLookAndFeelException ex) { +//// java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); +//// } +// // +// +// /* Create and display the form */ +// java.awt.EventQueue.invokeLater(new Runnable() { +// public void run() { +// NewJFrame newJFrame = new NewJFrame(null); +// int width2 = newJFrame.getWidth(); +// int height2 = newJFrame.getHeight(); +// Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); // 获取屏幕尺寸 +// int screenWidth = screenSize.width; // 获取屏幕宽度 +// int screenHeight = screenSize.height; // 获取屏幕高度 +// int x = (screenWidth - width2) / 2; // 计算Frame的左上角x坐标 +// int y = (screenHeight - height2) / 2; // 计算Frame的左上角y坐标 +// newJFrame.setTitle("工装需求查询"); +// // this.getContentPane().setBackground(Color.red); +// newJFrame.getContentPane().setBackground(new java.awt.Color(255, 255, 255)); +// newJFrame.setSize(width2, height2); // 设置Frame的大小 +// newJFrame.setLocation(x, y); // 设置Frame的位置 +// newJFrame.setResizable(false); +// // newJFrame.setDefaultCloseOperation(2); // 设置窗口关闭时的默认操作 +// newJFrame.setVisible(true); +// } +// }); +// } +// +// +// +// +//}