From 01187105a5ef6b1bd8c655a4daa545144ad444c3 Mon Sep 17 00:00:00 2001 From: lijh Date: Fri, 3 Jan 2025 17:43:52 +0800 Subject: [PATCH] 20250103 --- src/com/langtech/plm/bg/QDRWChooseDialog.java | 3 +- src/com/langtech/plm/bg/QDRWDialog.java | 14 +- src/com/langtech/plm/bg/RWFPDialog.java | 45 +++- .../plm/template/TemplateHandler.java | 234 +++++++++--------- 4 files changed, 168 insertions(+), 128 deletions(-) diff --git a/src/com/langtech/plm/bg/QDRWChooseDialog.java b/src/com/langtech/plm/bg/QDRWChooseDialog.java index 813bcc1..f86c795 100644 --- a/src/com/langtech/plm/bg/QDRWChooseDialog.java +++ b/src/com/langtech/plm/bg/QDRWChooseDialog.java @@ -84,6 +84,7 @@ public class QDRWChooseDialog extends JFrame implements ActionListener { ArrayList list = new ArrayList(); list.add(split[1]); list.add(split[2]); + list.add(split[3]); map.put(split[0], list); } @@ -109,7 +110,7 @@ public class QDRWChooseDialog extends JFrame implements ActionListener { if (this.okButton.equals(source)) { String selectedItem = (String) objectComboBox.getSelectedItem(); ArrayList arrayList = map.get(selectedItem); - new QDRWDialog((TCSession)app.getSession(),arrayList.get(0),arrayList.get(1),selectedItem); + new QDRWDialog((TCSession)app.getSession(),arrayList.get(0),arrayList.get(1),selectedItem,arrayList.get(2)); System.out.println("newnewnwenew"); this.dispose(); } else if (this.concelButton.equals(source)) { diff --git a/src/com/langtech/plm/bg/QDRWDialog.java b/src/com/langtech/plm/bg/QDRWDialog.java index b065c29..cf16fc1 100644 --- a/src/com/langtech/plm/bg/QDRWDialog.java +++ b/src/com/langtech/plm/bg/QDRWDialog.java @@ -118,12 +118,14 @@ public class QDRWDialog extends JFrame implements ActionListener { LinkedHashMap>>> valueMap; private Connection conn = null; private String tamplateName; - public QDRWDialog(TCSession session, String pref, String taskName,String tamplateName) { + private String chooseType; + public QDRWDialog(TCSession session, String pref, String taskName,String tamplateName,String chooseType) { // TODO Auto-generated constructor stub this.session = session; this.pref = pref; this.taskName = taskName; this.tamplateName = tamplateName; + this.chooseType = chooseType; initUI(); } @@ -246,13 +248,13 @@ public class QDRWDialog extends JFrame implements ActionListener { jhwcS.setDate("未设置日期"); topPanel.add("1.1.left.center", new JLabel("ID ")); topPanel.add("1.2.left.center", idField); - topPanel.add("1.3.left.center", new JLabel(" 计划开始早于 ")); + topPanel.add("1.3.left.center", new JLabel(" 计划开始晚于 ")); topPanel.add("1.4.left.center", jhksB); - topPanel.add("1.5.left.center", new JLabel(" 计划开始晚于 ")); + topPanel.add("1.5.left.center", new JLabel(" 计划开始早于 ")); topPanel.add("1.6.left.center", jhksS); - topPanel.add("1.7.left.center", new JLabel(" 计划完成早于 ")); + topPanel.add("1.7.left.center", new JLabel(" 计划完成晚于 ")); topPanel.add("1.8.left.center", jhwcB); - topPanel.add("1.9.left.center", new JLabel(" 计划完成晚于 ")); + topPanel.add("1.9.left.center", new JLabel(" 计划完成早于 ")); topPanel.add("1.10.left.center", jhwcS); topPanel.add("2.1.left.center", new JLabel(" ")); return topPanel; @@ -605,7 +607,7 @@ public class QDRWDialog extends JFrame implements ActionListener { MessageBox.post("请填写条件!", "提示", 2); return; } - String sqlIdString = "SELECT ID FROM LY_CHANGETASSKFORM_DETAILS where TEMPLATENAME = '"+tamplateName+ "' " + condition; + String sqlIdString = "SELECT ID FROM LY_CHANGETASSKFORM_DETAILS where TEMPLATENAME = '"+tamplateName+ "' and OBJECTTYPE = '"+ chooseType + "' " + condition; System.out.println("sqlIdString=========" + sqlIdString); conn = getConn(); PreparedStatement stmt = null; diff --git a/src/com/langtech/plm/bg/RWFPDialog.java b/src/com/langtech/plm/bg/RWFPDialog.java index 43a7f23..eb081df 100644 --- a/src/com/langtech/plm/bg/RWFPDialog.java +++ b/src/com/langtech/plm/bg/RWFPDialog.java @@ -5,6 +5,7 @@ import java.awt.Dimension; import java.awt.Toolkit; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.io.File; @@ -45,6 +46,8 @@ import javax.swing.JTable; import javax.swing.JTextField; import javax.swing.ListSelectionModel; import javax.swing.RowSorter; +import javax.swing.event.TableModelEvent; +import javax.swing.event.TableModelListener; import javax.swing.table.DefaultTableModel; import javax.swing.table.TableColumnModel; import javax.swing.table.TableModel; @@ -64,6 +67,7 @@ import com.teamcenter.rac.kernel.TCComponentItemRevision; import com.teamcenter.rac.kernel.TCComponentListOfValues; import com.teamcenter.rac.kernel.TCComponentListOfValuesType; import com.teamcenter.rac.kernel.TCComponentProject; +import com.teamcenter.rac.kernel.TCComponentUser; import com.teamcenter.rac.kernel.TCException; import com.teamcenter.rac.kernel.TCProperty; import com.teamcenter.rac.kernel.TCSession; @@ -72,6 +76,8 @@ import com.teamcenter.rac.util.MessageBox; import com.teamcenter.rac.util.PropertyLayout; import com.teamcenter.soa.client.model.LovValue; +import k.util.KOrgDialog; + public class RWFPDialog extends JFrame implements ActionListener { private Map textMap = new HashMap<>(); @@ -100,7 +106,7 @@ public class RWFPDialog extends JFrame implements ActionListener { private String objectString; private boolean readOnly; private ArrayList canWriteColume = new ArrayList(); - + private ArrayList choosePersonColume = new ArrayList(); public RWFPDialog(TCSession session, String type, String id, String objectString, boolean readOnly) { // TODO Auto-generated constructor stub this.session = session; @@ -164,6 +170,11 @@ public class RWFPDialog extends JFrame implements ActionListener { String[] split4 = split3[2].split("%"); widtheMap.put(j, Integer.parseInt(split4[0])); canWriteColume.add(j); + }else if(split3[2].contains("#")) { + String[] split4 = split3[2].split("#"); + widtheMap.put(j, Integer.parseInt(split4[0])); + choosePersonColume.add(j); + canWriteColume.add(j); }else { widtheMap.put(j, Integer.parseInt(split3[2])); } @@ -176,6 +187,11 @@ public class RWFPDialog extends JFrame implements ActionListener { widtheMap.put(j, Integer.parseInt(split4[0])); System.out.println("split4[0]========"+split4[0]); canWriteColume.add(j); + }else if(split3[2].contains("#")) { + String[] split4 = split3[2].split("#"); + widtheMap.put(j, Integer.parseInt(split4[0])); + choosePersonColume.add(j); + canWriteColume.add(j); }else { widtheMap.put(j, Integer.parseInt(split3[2])); } @@ -186,7 +202,7 @@ public class RWFPDialog extends JFrame implements ActionListener { } } - + System.out.println("choosePersonColume====="+choosePersonColume.size()); System.out.println("canWriteColume====="+canWriteColume.size()); System.out.println("fieldsMap====="+fieldsMap); System.out.println("positionMap====="+lovPositionMap); @@ -257,7 +273,7 @@ public class RWFPDialog extends JFrame implements ActionListener { while (result.next()) { ArrayList arList = new ArrayList(); for (int i = 0; i < fieldsMap.size(); i++) { - System.out.println("result.getString(i+1)==========="+result.getString(i+1)); + //System.out.println("result.getString(i+1)==========="+result.getString(i+1)); arList.add(result.getString(i+1) == null? result.getString(i+1) : validateAndFormatDate(result.getString(i+1))); } dtm1.addRow(arList.toArray(new Object[0])); @@ -343,6 +359,28 @@ public class RWFPDialog extends JFrame implements ActionListener { } table.getColumnModel().getColumn(map.getKey()).setCellEditor(new DefaultCellEditor(jComboBox)); } + table.addMouseListener(new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent e) { + if (e.getClickCount() == 2 || e.getClickCount() == 1) { // 判断是否双击并且是在第二列 + int row = table.rowAtPoint(e.getPoint()); + int column = table.columnAtPoint(e.getPoint()); + System.out.println("column========"+column); + if (choosePersonColume.contains(column)) { + System.out.println("1111111111111111111111111111111"); + try { + TCComponentUser user = new KOrgDialog("").getUser(); + System.out.println("user============"+user.getUserName()); + //table.setValueAt(user.getUserName()+"("+user.getUserId()+")", row, column); + } catch (TCException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } + } + } + } + }); + pane.setPreferredSize(new Dimension(1800, 850)); pane.setViewportView(table);// 为scrollPane指定显示对象为table return pane; @@ -391,7 +429,6 @@ public class RWFPDialog extends JFrame implements ActionListener { if (canWriteColume.size() > 0) { for (int i = 0; i < canWriteColume.size(); i++) { if (canWriteColume.get(i) == column) { - System.out.println("row==========" + row); return true; } } diff --git a/src/com/langtech/plm/template/TemplateHandler.java b/src/com/langtech/plm/template/TemplateHandler.java index 4f36ab3..57be3d8 100644 --- a/src/com/langtech/plm/template/TemplateHandler.java +++ b/src/com/langtech/plm/template/TemplateHandler.java @@ -1,117 +1,117 @@ -//package com.langtech.plm.template; -// -//import org.eclipse.core.commands.AbstractHandler; -//import org.eclipse.core.commands.ExecutionEvent; -//import org.eclipse.core.commands.ExecutionException; -// -//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.TCComponentItemRevision; -//import com.teamcenter.rac.kernel.TCComponentSchedule; -//import com.teamcenter.rac.kernel.TCComponentScheduleTask; -//import com.teamcenter.rac.kernel.TCException; -//import com.teamcenter.rac.kernel.TCSession; -//import com.teamcenter.rac.util.MessageBox; -// -//public class TemplateHandler extends AbstractHandler{ -// -// -// @Override -// public Object execute(ExecutionEvent arg0) throws ExecutionException { -// AbstractAIFApplication app = AIFUtility.getCurrentApplication(); -// TCSession session = (TCSession) app.getSession(); -// try { -// -// -// -// new Thread() { -// @Override -// public void run() { -// InterfaceAIFComponent targetComponent = app.getTargetComponent(); -// -// String type = targetComponent.getType(); -// System.out.println("type==========="+type); -// if(targetComponent instanceof TCComponentItemRevision) { -// try { -// String[] pref = session.getPreferenceService().getStringValues("LY6_MEOP_TemplateObject"); -// String types = ""; -// if(pref.length > 0) { -// types = pref[0]; -// }else { -// MessageBox.post("请配置首选项LY6_MEOP_TemplateObject!","提示",2); -// return; -// } -// -// TCComponentItemRevision rev = (TCComponentItemRevision)targetComponent; -// String object_type = rev.getStringProperty("object_type"); -// if(types.contains(object_type)) { -// new TemplateDialog(session,rev,object_type); -// }else { -// MessageBox.post("请选择首选项LY6_MEOP_TemplateObject中匹配的对象!","提示",2); -// return; -// } -// -// -// -// -// } catch (Exception e) { -// // TODO Auto-generated catch block -// e.printStackTrace(); -// } -// }else if(type.equals("Mfg0BvrOperation")){ -// TCComponent com = (TCComponent) targetComponent; -// try { -// TCComponent rev = com.getRelatedComponent("bl_line_object"); -// if(rev instanceof TCComponentItemRevision) { -// try { -// String[] pref = session.getPreferenceService().getStringValues("LY6_MEOP_TemplateObject"); -// String types = ""; -// if(pref.length > 0) { -// types = pref[0]; -// }else { -// MessageBox.post("请配置首选项LY6_MEOP_TemplateObject!","提示",2); -// return; -// } -// -// TCComponentItemRevision revision = (TCComponentItemRevision)rev; -// String object_type = rev.getStringProperty("object_type"); -// if(types.contains(object_type)) { -// new TemplateDialog(session,revision,object_type); -// }else { -// MessageBox.post("请选择首选项LY6_MEOP_TemplateObject中匹配的对象!","提示",2); -// return; -// } -// -// -// -// -// } catch (Exception e) { -// // TODO Auto-generated catch block -// e.printStackTrace(); -// } -// } -// } catch (TCException e) { -// // TODO Auto-generated catch block -// e.printStackTrace(); -// } -// }else { -// MessageBox.post("请选择版本对象!","提示",2); -// return; -// } -// -// -// } -// }.start(); -// -// } catch (Exception e) { -// // TODO: handle exception -// e.printStackTrace(); -// } -// -// return null; -// } -// -// -//} +package com.langtech.plm.template; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; + +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.TCComponentItemRevision; +import com.teamcenter.rac.kernel.TCComponentSchedule; +import com.teamcenter.rac.kernel.TCComponentScheduleTask; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.util.MessageBox; + +public class TemplateHandler extends AbstractHandler{ + + + @Override + public Object execute(ExecutionEvent arg0) throws ExecutionException { + AbstractAIFApplication app = AIFUtility.getCurrentApplication(); + TCSession session = (TCSession) app.getSession(); + try { + + + + new Thread() { + @Override + public void run() { + InterfaceAIFComponent targetComponent = app.getTargetComponent(); + + String type = targetComponent.getType(); + System.out.println("type==========="+type); + if(targetComponent instanceof TCComponentItemRevision) { + try { + String[] pref = session.getPreferenceService().getStringValues("LY6_MEOP_TemplateObject"); + String types = ""; + if(pref.length > 0) { + types = pref[0]; + }else { + MessageBox.post("请配置首选项LY6_MEOP_TemplateObject!","提示",2); + return; + } + + TCComponentItemRevision rev = (TCComponentItemRevision)targetComponent; + String object_type = rev.getStringProperty("object_type"); + if(types.contains(object_type)) { + new TemplateDialog(session,rev,object_type); + }else { + MessageBox.post("请选择首选项LY6_MEOP_TemplateObject中匹配的对象!","提示",2); + return; + } + + + + + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + }else if(type.equals("Mfg0BvrOperation")){ + TCComponent com = (TCComponent) targetComponent; + try { + TCComponent rev = com.getRelatedComponent("bl_line_object"); + if(rev instanceof TCComponentItemRevision) { + try { + String[] pref = session.getPreferenceService().getStringValues("LY6_MEOP_TemplateObject"); + String types = ""; + if(pref.length > 0) { + types = pref[0]; + }else { + MessageBox.post("请配置首选项LY6_MEOP_TemplateObject!","提示",2); + return; + } + + TCComponentItemRevision revision = (TCComponentItemRevision)rev; + String object_type = rev.getStringProperty("object_type"); + if(types.contains(object_type)) { + new TemplateDialog(session,revision,object_type); + }else { + MessageBox.post("请选择首选项LY6_MEOP_TemplateObject中匹配的对象!","提示",2); + return; + } + + + + + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + } catch (TCException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + }else { + MessageBox.post("请选择版本对象!","提示",2); + return; + } + + + } + }.start(); + + } catch (Exception e) { + // TODO: handle exception + e.printStackTrace(); + } + + return null; + } + + +}