diff --git a/com.connor.chint.wuhan/src/com/chint/plm/createEcn/CreateEcnController.java b/com.connor.chint.wuhan/src/com/chint/plm/createEcn/CreateEcnController.java index aaa7061..ee9add5 100644 --- a/com.connor.chint.wuhan/src/com/chint/plm/createEcn/CreateEcnController.java +++ b/com.connor.chint.wuhan/src/com/chint/plm/createEcn/CreateEcnController.java @@ -147,6 +147,9 @@ public class CreateEcnController extends KFXPanelController { private ComboBox pmCombox; @FXML private TextArea remarkArea; + + @FXML + private Button createBtn; private CreateEcnController controller; private CreateEcnFrame frame; @@ -158,6 +161,30 @@ public class CreateEcnController extends KFXPanelController { private final int PAGE_ROW_CNT = 16;//每页行数 private final int ITEM_ROW_CNT = 1;//每个对象行数 private final int TITLE_ROW_CNT = 7;//表头行数 + + private String contractNo; // 合同代号 + private String contractName;// 合同名称 + private String productModel; // 产品型号 + private String changeType; // 正式临时 + private String changeTime;// 更改实施日期 + private String changeUnit1; // 属性变更发往部门 + + private int pages = 0; + private String[] changeDrawingNo; // 属性zt2_ChangeDrawingNo + private String[] sign; // 属性zt2_Sign +// private String[] placesNo; //属性zt2_PlacesNo + private String[] partition; // 属性zt2_Partition + private String[] changeBefore1; // 属性zt2_ChangeBefore1 + private String[] changeAfter1; // 属性zt2_ChangeAfter1 + private String[] changeReason; // 属性zt2_ChangeReason + private String[] processType1; // 属性zt2_ProcessType1 + private String[] szVersionBefs; // 变更前版本 + private String[] szVersionAfts; // 变更后版本 + private String[] productSzs; // 变更后版本 + private String[] processSzs; // 变更后版本 + + @FXML + public TextField relateEcnText; @Override public void initData(KFXPanel paramKFXPanel) throws Exception { @@ -189,12 +216,8 @@ public class CreateEcnController extends KFXPanelController { // 获取选中的对象 initText(); - } - @FXML - private Button createBtn; - /** * @param event * @throws Exception @@ -692,13 +715,6 @@ public class CreateEcnController extends KFXPanelController { } } - private String contractNo; // 合同代号 - private String contractName;// 合同名称 - private String productModel; // 产品型号 - private String changeType; // 正式临时 - private String changeTime;// 更改实施日期 - private String changeUnit1; // 属性变更发往部门 - /** * @param item 对象 * @param changeName 变更类型 @@ -817,20 +833,6 @@ public class CreateEcnController extends KFXPanelController { item.getTCProperty("zt2_SZProcess").setStringValueArray(processSzs); } - private int pages = 0; - private String[] changeDrawingNo; // 属性zt2_ChangeDrawingNo - private String[] sign; // 属性zt2_Sign -// private String[] placesNo; //属性zt2_PlacesNo - private String[] partition; // 属性zt2_Partition - private String[] changeBefore1; // 属性zt2_ChangeBefore1 - private String[] changeAfter1; // 属性zt2_ChangeAfter1 - private String[] changeReason; // 属性zt2_ChangeReason - private String[] processType1; // 属性zt2_ProcessType1 - private String[] szVersionBefs; // 变更前版本 - private String[] szVersionAfts; // 变更后版本 - private String[] productSzs; // 变更后版本 - private String[] processSzs; // 变更后版本 - /** * @param event * @function 关闭页面操作 @@ -941,6 +943,7 @@ public class CreateEcnController extends KFXPanelController { EcnBean ecnBean = new EcnBean(rowNum, reasons, wips, ChangeDrawingNo[j], sign[j], placesNo[j], ChangeBefore1[j], ChangeAfter1[j], ChangeReason[j], ProcessType1[j], szVersionBef[j], szVersionAft[j], products, szProduct[j]); + ecnBean.addActionListener(frame); ecnBeans.add(ecnBean); // ecnBean.setProductSz(szProduct[j]); } @@ -1080,19 +1083,17 @@ public class CreateEcnController extends KFXPanelController { @SuppressWarnings("unchecked") private void createDetailTable() { // Auto-generated method stub - - TableColumn tc_beforChange = new TableColumn("更改前"); - TableColumn tc_afterChange = new TableColumn("更改后"); - TableColumn tc_afterVer = new TableColumn("更改后版本"); - + TableColumn tc_xh = new TableColumn("序号"); TableColumn tc_drawNo = new TableColumn("图样代号"); TableColumn tc_mark = new TableColumn("标记"); - TableColumn tc_xh = new TableColumn("序号"); - TableColumn> tc_wipTreat = new TableColumn>("在制品处理"); + TableColumn tc_poiNum = new TableColumn("处数"); + TableColumn tc_beforChange = new TableColumn("更改前"); TableColumn tc_beforVer = new TableColumn("更改前版本"); + TableColumn tc_afterChange = new TableColumn("更改后"); + TableColumn tc_afterVer = new TableColumn("更改后版本"); TableColumn> productSz = new TableColumn>("特性等级"); TableColumn> tc_reason = new TableColumn>("更改原因"); - TableColumn tc_poiNum = new TableColumn("处数"); + TableColumn> tc_wipTreat = new TableColumn>("在制品处理"); tableView.getColumns().addAll(tc_xh, tc_drawNo, tc_mark, tc_poiNum, tc_beforChange, tc_beforVer, tc_afterChange, tc_afterVer, productSz, tc_reason, tc_wipTreat); @@ -1525,6 +1526,7 @@ public class CreateEcnController extends KFXPanelController { void addRows(ActionEvent event) { for (int i = 0; i < 5; i++) { EcnBean bean = new EcnBean(ecnBeans.size() + 1, reasons, wips, products); + bean.addActionListener(frame); bean.getProductSz().setValue("C");//特性等级默认为“C” ecnBeans.add(bean); } @@ -1540,6 +1542,7 @@ public class CreateEcnController extends KFXPanelController { @FXML void addRow(ActionEvent event) { EcnBean bean = new EcnBean(ecnBeans.size() + 1, reasons, wips, products); + bean.addActionListener(frame); bean.getProductSz().setValue("C");//特性等级默认为“C” ecnBeans.add(bean); ObservableList data = FXCollections.observableArrayList(ecnBeans); @@ -1582,9 +1585,6 @@ public class CreateEcnController extends KFXPanelController { } } - @FXML - public TextField relateEcnText; - /** * @param event * @function 关联申请单按钮 diff --git a/com.connor.chint.wuhan/src/com/chint/plm/createEcn/EcnBean.java b/com.connor.chint.wuhan/src/com/chint/plm/createEcn/EcnBean.java index 4c2f2bd..c63d664 100644 --- a/com.connor.chint.wuhan/src/com/chint/plm/createEcn/EcnBean.java +++ b/com.connor.chint.wuhan/src/com/chint/plm/createEcn/EcnBean.java @@ -8,17 +8,20 @@ import javafx.scene.control.TextArea; public class EcnBean { - protected SimpleIntegerProperty num; - protected TextArea drawNo;// 图样代号 - protected TextArea mark; // 标记 - protected TextArea poiNum; // 处数 - protected TextArea overChange;// 更改前 - protected TextArea overVersion;// 更改前版本 - protected TextArea afterVersion;// 更改后版本 - protected TextArea afterChange;// 更改后 - protected ComboBox productSz = new ComboBox();// 特性等级 - protected ComboBox changeReason = new ComboBox();// 更改原因 - protected ComboBox wipTreat = new ComboBox();// 在制品处理 + private SimpleIntegerProperty num; + private TextArea drawNo;// 图样代号 + private TextArea mark; // 标记 + private TextArea poiNum; // 处数 + private TextArea overChange;// 更改前 +// private Button overChange = new Button("查看");// 更改前 + private TextArea overVersion;// 更改前版本 + private TextArea afterChange;// 更改后 + private TextArea afterVersion;// 更改后版本 + private ComboBox productSz = new ComboBox();// 特性等级 + private ComboBox changeReason = new ComboBox();// 更改原因 + private ComboBox wipTreat = new ComboBox();// 在制品处理 + +// private String overChangeTxt; public ComboBox getProductSz() { return productSz; @@ -41,12 +44,17 @@ public class EcnBean { overChange = new TextArea(); // ComboBoxTextArea overChange.setPrefSize(200, 40); + overChange.setWrapText(true); + +// overChange = new Button("查看"); +// overChangeTxt = ""; overVersion = new TextArea(); // ComboBoxTextArea overVersion.setPrefSize(200, 40); afterChange = new TextArea(); // ComboBoxTextArea afterChange.setPrefSize(200, 40); + afterChange.setWrapText(true); afterVersion = new TextArea(); // ComboBoxTextArea afterVersion.setPrefSize(200, 40); @@ -75,6 +83,10 @@ public class EcnBean { overChange = new TextArea(); // ComboBoxTextArea overChange.setPrefSize(200, 40); overChange.setText(changeBefore); + overChange.setWrapText(true); + +// overChange = new Button("查看"); +// overChangeTxt = changeBefore; overVersion = new TextArea(); // ComboBoxTextArea overVersion.setPrefSize(200, 40); @@ -83,6 +95,7 @@ public class EcnBean { afterChange = new TextArea(); // ComboBoxTextArea afterChange.setPrefSize(200, 40); afterChange.setText(changeAfter); + afterChange.setWrapText(true); afterVersion = new TextArea(); // ComboBoxTextArea afterVersion.setPrefSize(200, 40); @@ -96,6 +109,19 @@ public class EcnBean { productSz.getItems().addAll(products); productSz.getSelectionModel().select(product); } + + protected void addActionListener(CreateEcnFrame frame) { + overChange.setOnMouseClicked(event -> { + if (event.getClickCount() == 2) { + new EditTextDialog(frame, true, true, overChange).showDialog(); + } + }); + afterChange.setOnMouseClicked(event -> { + if (event.getClickCount() == 2) { + new EditTextDialog(frame, false, true, afterChange).showDialog(); + } + }); + } public Integer getNum() { return num.get(); @@ -137,6 +163,14 @@ public class EcnBean { this.overChange = overChange; } +// public String getOverChangeTxt() { +// return overChangeTxt; +// } +// +// public void setOverChangeTxt(String overChangeTxt) { +// this.overChangeTxt = overChangeTxt; +// } + public TextArea getOverVersion() { return overVersion; } diff --git a/com.connor.chint.wuhan/src/com/chint/plm/createEcn/EditTextDialog.java b/com.connor.chint.wuhan/src/com/chint/plm/createEcn/EditTextDialog.java index f980ed9..7abb9e6 100644 --- a/com.connor.chint.wuhan/src/com/chint/plm/createEcn/EditTextDialog.java +++ b/com.connor.chint.wuhan/src/com/chint/plm/createEcn/EditTextDialog.java @@ -15,6 +15,7 @@ import javax.swing.JTextArea; import com.teamcenter.rac.aif.AbstractAIFDialog; import javafx.scene.control.TableView; +import javafx.scene.control.TextArea; /** * 功能描述: 长文本内容弹窗查看编辑 * 创建日期:2024-12-02 @@ -31,28 +32,44 @@ public class EditTextDialog extends AbstractAIFDialog { private JTextArea textArea; private JButton okBtn; private JButton cancelBtn; - private TableView refTable; - private List refTableBeans; - private int row; - private boolean before; + private String value; + private TextArea changeArea; public EditTextDialog(CreateEcnFrame parent, TableView refTable, int row, List refTableBeans, - boolean before, boolean edit) { + boolean before, boolean edit, String value) { super(parent, true); - this.refTable = refTable; - this.refTableBeans = refTableBeans; - this.row = row; - this.before = before; + this.value = value; - initUI(edit); + initUI(before, edit); + } + + public EditTextDialog(CreateEcnFrame parent, boolean before, boolean edit, String value) { + super(parent, true); + + this.value = value; + + initUI(before, edit); } - - private void initUI(boolean edit) { + public EditTextDialog(CreateEcnFrame parent, boolean before, boolean edit, TextArea area) { + super(parent, true); + + this.changeArea = area; + + initUI(before, edit); + } + + private void initUI(boolean before, boolean edit) { + setTitle(before ? "更改前" : "更改后"); textArea = new JTextArea(); + textArea.setLineWrap(true); textArea.setWrapStyleWord(true); textArea.setEditable(edit); + if(value != null) + textArea.setText(value); + else if(changeArea != null) + textArea.setText(changeArea.getText()); JPanel panel = new JPanel(new FlowLayout()); okBtn = new JButton("确定"); @@ -67,7 +84,7 @@ public class EditTextDialog extends AbstractAIFDialog { this.setLayout(new BorderLayout()); this.add(BorderLayout.CENTER, new JScrollPane(textArea)); this.add(BorderLayout.SOUTH, panel); - this.setPreferredSize(new Dimension(1400, 400)); + this.setPreferredSize(new Dimension(800, 400)); Dimension screen = getToolkit().getScreenSize(); setLocation((screen.width - getSize().width) / 2, (screen.height - getSize().height) / 2); setAlwaysOnTop(true); @@ -83,12 +100,7 @@ public class EditTextDialog extends AbstractAIFDialog { okBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { - if(before) { - refTableBeans.get(EditTextDialog.this.row).getOverChange().setText(textArea.getText()); - }else { - refTableBeans.get(EditTextDialog.this.row).getAfterChange().setText(textArea.getText()); - } - refTable.refresh(); + changeArea.setText(textArea.getText()); dispose(); } }); diff --git a/com.connor.chint.wuhan/src/com/chint/plm/createEcn/RefTableBean.java b/com.connor.chint.wuhan/src/com/chint/plm/createEcn/RefTableBean.java index babec85..db644fa 100644 --- a/com.connor.chint.wuhan/src/com/chint/plm/createEcn/RefTableBean.java +++ b/com.connor.chint.wuhan/src/com/chint/plm/createEcn/RefTableBean.java @@ -1,8 +1,6 @@ package com.chint.plm.createEcn; import javafx.beans.property.SimpleStringProperty; -import javafx.beans.value.ChangeListener; -import javafx.beans.value.ObservableValue; import javafx.scene.control.Button; import javafx.scene.control.CheckBox; import javafx.scene.control.TextField;