diff --git a/com.connor.chint.wuhan/bin/com/chint/plm/SearchSapResult/DetailsController.class b/com.connor.chint.wuhan/bin/com/chint/plm/SearchSapResult/DetailsController.class index fc9c9bb..c6f755d 100644 Binary files a/com.connor.chint.wuhan/bin/com/chint/plm/SearchSapResult/DetailsController.class and b/com.connor.chint.wuhan/bin/com/chint/plm/SearchSapResult/DetailsController.class differ diff --git a/com.connor.chint.wuhan/bin/com/chint/plm/SearchSapResult/SearchSapController.class b/com.connor.chint.wuhan/bin/com/chint/plm/SearchSapResult/SearchSapController.class index c41edb5..7231a0a 100644 Binary files a/com.connor.chint.wuhan/bin/com/chint/plm/SearchSapResult/SearchSapController.class and b/com.connor.chint.wuhan/bin/com/chint/plm/SearchSapResult/SearchSapController.class differ diff --git a/com.connor.chint.wuhan/bin/com/chint/plm/SearchSapResult/SearchSapDetailPanel.fxml b/com.connor.chint.wuhan/bin/com/chint/plm/SearchSapResult/SearchSapDetailPanel.fxml index 2ab9c05..6f79955 100644 --- a/com.connor.chint.wuhan/bin/com/chint/plm/SearchSapResult/SearchSapDetailPanel.fxml +++ b/com.connor.chint.wuhan/bin/com/chint/plm/SearchSapResult/SearchSapDetailPanel.fxml @@ -22,7 +22,7 @@ - + diff --git a/com.connor.chint.wuhan/bin/com/chint/plm/createEcn/AssignIdController.class b/com.connor.chint.wuhan/bin/com/chint/plm/createEcn/AssignIdController.class index f11b974..d485546 100644 Binary files a/com.connor.chint.wuhan/bin/com/chint/plm/createEcn/AssignIdController.class and b/com.connor.chint.wuhan/bin/com/chint/plm/createEcn/AssignIdController.class differ diff --git a/com.connor.chint.wuhan/bin/com/chint/plm/createEcn/AssignIdDialog.class b/com.connor.chint.wuhan/bin/com/chint/plm/createEcn/AssignIdDialog.class index f833c77..d5446e2 100644 Binary files a/com.connor.chint.wuhan/bin/com/chint/plm/createEcn/AssignIdDialog.class and b/com.connor.chint.wuhan/bin/com/chint/plm/createEcn/AssignIdDialog.class differ diff --git a/com.connor.chint.wuhan/bin/com/chint/plm/createEcn/CreateEcnController$1.class b/com.connor.chint.wuhan/bin/com/chint/plm/createEcn/CreateEcnController$1.class index e7020a1..b36c075 100644 Binary files a/com.connor.chint.wuhan/bin/com/chint/plm/createEcn/CreateEcnController$1.class and b/com.connor.chint.wuhan/bin/com/chint/plm/createEcn/CreateEcnController$1.class differ diff --git a/com.connor.chint.wuhan/bin/com/chint/plm/createEcn/CreateEcnController.class b/com.connor.chint.wuhan/bin/com/chint/plm/createEcn/CreateEcnController.class index 406baa2..7c54df5 100644 Binary files a/com.connor.chint.wuhan/bin/com/chint/plm/createEcn/CreateEcnController.class and b/com.connor.chint.wuhan/bin/com/chint/plm/createEcn/CreateEcnController.class differ diff --git a/com.connor.chint.wuhan/bin/com/chint/plm/createEcn/EcnBean.class b/com.connor.chint.wuhan/bin/com/chint/plm/createEcn/EcnBean.class index b1aab38..293ab33 100644 Binary files a/com.connor.chint.wuhan/bin/com/chint/plm/createEcn/EcnBean.class and b/com.connor.chint.wuhan/bin/com/chint/plm/createEcn/EcnBean.class differ diff --git a/com.connor.chint.wuhan/bin/com/chint/plm/createEcn/Util.class b/com.connor.chint.wuhan/bin/com/chint/plm/createEcn/Util.class index 3b11a7e..da864fe 100644 Binary files a/com.connor.chint.wuhan/bin/com/chint/plm/createEcn/Util.class and b/com.connor.chint.wuhan/bin/com/chint/plm/createEcn/Util.class differ diff --git a/com.connor.chint.wuhan/bin/com/connor/plm/SendGXToMOM/sendGXToMOMOperation.class b/com.connor.chint.wuhan/bin/com/connor/plm/SendGXToMOM/sendGXToMOMOperation.class index ba54056..ec0170a 100644 Binary files a/com.connor.chint.wuhan/bin/com/connor/plm/SendGXToMOM/sendGXToMOMOperation.class and b/com.connor.chint.wuhan/bin/com/connor/plm/SendGXToMOM/sendGXToMOMOperation.class differ diff --git a/com.connor.chint.wuhan/src/com/chint/plm/SearchSapResult/DetailsController.java b/com.connor.chint.wuhan/src/com/chint/plm/SearchSapResult/DetailsController.java index a4d071e..537b872 100644 --- a/com.connor.chint.wuhan/src/com/chint/plm/SearchSapResult/DetailsController.java +++ b/com.connor.chint.wuhan/src/com/chint/plm/SearchSapResult/DetailsController.java @@ -1,16 +1,25 @@ package com.chint.plm.SearchSapResult; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.List; +import org.apache.poi.xssf.usermodel.XSSFSheet; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; + +import com.chint.plm.createEcn.Util; import com.connor.chint.sap2.util.ChintPreferenceUtil; import com.connor.chint.sap2.util.SqlUtil; import com.teamcenter.rac.aif.AbstractAIFApplication; import com.teamcenter.rac.aifrcp.AIFUtility; import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.util.MessageBox; +import javafx.application.Platform; import javafx.beans.property.SimpleIntegerProperty; import javafx.beans.property.SimpleStringProperty; import javafx.beans.value.ChangeListener; @@ -18,6 +27,7 @@ import javafx.beans.value.ObservableValue; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.event.ActionEvent; +import javafx.event.EventHandler; import javafx.fxml.FXML; import javafx.scene.control.Button; import javafx.scene.control.CheckBox; @@ -27,6 +37,8 @@ import javafx.scene.control.TableColumn; import javafx.scene.control.TableView; import javafx.scene.control.TextField; import javafx.scene.control.cell.PropertyValueFactory; +import javafx.scene.input.KeyCode; +import javafx.scene.input.KeyEvent; import javafx.scene.layout.FlowPane; import javafx.scene.layout.GridPane; import javafx.scene.layout.StackPane; @@ -62,8 +74,8 @@ public class DetailsController { @FXML private TableColumn tc_batch; - @FXML - private TextField pageNumTxt; + @FXML + private TextField pageNumTxt; @FXML private TableColumn tc_wbs; @FXML @@ -92,7 +104,10 @@ public class DetailsController { private Button bt_all; int pageNum = 0; - List> tableBeans; + List> tableBeans; // ¼ + + List> errMsgBeans; // ¼ + List> allMsgBeans; // ¼ȫ @FXML void firstAction(ActionEvent event) { @@ -155,23 +170,41 @@ public class DetailsController { protected AbstractAIFApplication app; private TCSession session; - /** * @param event - * @function + * @function EXCEL */ @FXML void outputAction(ActionEvent event) { + // ȡѡļ + File tempFile = Util.getFile(session, "CHINT_BOM_RESULT_TEMPLATE", "MSExcelX"); + if (tempFile == null) { + MessageBox.post("δҵexcelģ壬CHINT_BOM_RESULT_TEMPLATE.", "ʧ", MessageBox.INFORMATION); + return; + } + try { + FileInputStream in = new FileInputStream(tempFile); + XSSFWorkbook wb = new XSSFWorkbook(in); + in.close(); + + XSSFSheet sheetAt = wb.getSheet("SAPݽ"); + for (List detailList : tableBeans) { + + } + + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } private StringBuilder sqlTotal; - public void initData(Stage primaryStage, boolean onlyError, - StringBuilder sqlTotal) { + public void initData(Stage primaryStage, boolean onlyError, StringBuilder sqlTotal) { // TODO Auto-generated method stub this.sqlTotal = sqlTotal; - this.app = AIFUtility.getCurrentApplication(); this.session = (TCSession) app.getSession(); // аbean @@ -200,7 +233,7 @@ public class DetailsController { tc_returnTime.setCellValueFactory(new PropertyValueFactory("returnTime")); tc_plm.setCellValueFactory(new PropertyValueFactory("plmStatus")); - //п + // п tc_xh.prefWidthProperty().bind(tableView.widthProperty().multiply(0.05)); tc_batch.prefWidthProperty().bind(tableView.widthProperty().multiply(0.08)); tc_material.prefWidthProperty().bind(tableView.widthProperty().multiply(0.12)); @@ -212,8 +245,8 @@ public class DetailsController { tc_returnDate.prefWidthProperty().bind(tableView.widthProperty().multiply(0.08)); tc_returnTime.prefWidthProperty().bind(tableView.widthProperty().multiply(0.08)); tc_plm.prefWidthProperty().bind(tableView.widthProperty().multiply(0.07)); - - //ѯĬϴ + + // ѯĬϴ try { cb_errBtn.setSelected(true); searchErrMsg(); @@ -224,10 +257,10 @@ public class DetailsController { ObservableList data = FXCollections.observableArrayList(tableBeans.get(0)); tableView.getItems().clear(); tableView.setItems(data); - lb_page.setText("/"+tableBeans.size()); + lb_page.setText("/" + tableBeans.size()); // this.tableBeans = tableBeans; - //󻯰 + // 󻯰 primaryStage.widthProperty().addListener(new ChangeListener() { @Override public void changed(ObservableValue observable, Number oldValue, Number newValue) { @@ -242,71 +275,109 @@ public class DetailsController { } }); primaryStage.setMaximized(true); + cb_errBtn.selectedProperty().addListener(new ChangeListener() { + @Override + public void changed(ObservableValue observable, Boolean oldValue, Boolean newValue) { + // just show results + try { + if (flagEdit) { + flagEdit = false; + searchErrMsg(); + Platform.runLater(() -> { + flagEdit = true; + }); + } + } catch (Exception ex) { + ex.printStackTrace(); + } finally { + System.out.println("END" + sqlTotal.toString()); + SqlUtil.freeAll(); + } + } + }); + + pageNumTxt.setOnKeyPressed(new EventHandler() { + @Override + public void handle(KeyEvent event) { + if (event.getCode() == KeyCode.ENTER) { +// showHistoryWords(querybox.getText()); + } + } + }); + } + private boolean flagEdit = true; /** * @param event * @function ֻʾ */ - @FXML - void errBtnAction(ActionEvent event) { +// @FXML +// void errBtnAction(ActionEvent event) { +// + +// } - try { - cb_errBtn.setDisable(true); - searchErrMsg(); - cb_errBtn.setDisable(false); - } catch (Exception ex) { - ex.printStackTrace(); - } finally { - System.out.println("END" + sqlTotal.toString()); - SqlUtil.freeAll(); - } - } - /** * @throws Exception * @function ʾ */ private void searchErrMsg() throws Exception { - String[] prefs = ChintPreferenceUtil.getPreferences("database_tc", session); + // BOMϢ : ȫ״̬. List> tableBeans = new ArrayList>(); - SqlUtil.getTCDataConnection(prefs); - String sqlDetail = ""; - if (cb_errBtn.isSelected()) { - sqlDetail = sqlTotal.toString() + " and status = 'E' "; + if (cb_errBtn.isSelected() && errMsgBeans.size() > 0) { + tableBeans = errMsgBeans; + } else if (!cb_errBtn.isSelected() && allMsgBeans.size() > 0) { + tableBeans = allMsgBeans; } else { - sqlDetail = sqlTotal.toString();// + " and status = 'S' "; - } - ResultSet read = SqlUtil.read(sqlDetail); - int i = 1; - List beanList = null; - while (read.next()) { - // ҳ 20 ѯ - DetailsBean sumBean = new DetailsBean(new SimpleIntegerProperty(i), - new SimpleStringProperty(read.getString(1)), new SimpleStringProperty(read.getString(2)), - new SimpleStringProperty(read.getString(3)), new SimpleStringProperty(read.getString(4)), - new SimpleStringProperty(read.getString(5)), new SimpleStringProperty(read.getString(6)), - new SimpleStringProperty(read.getString(7)), new SimpleStringProperty(read.getString(8)), - new SimpleStringProperty(read.getString(9)), new SimpleStringProperty(read.getString(10))); - if (i % 20 == 1) { + String sqlDetail = ""; + if (cb_errBtn.isSelected()) { + sqlDetail = sqlTotal.toString() + " and status = 'E' "; + } else { + sqlDetail = sqlTotal.toString();// + " and status = 'S' "; + } + String[] prefs = ChintPreferenceUtil.getPreferences("database_tc", session); + SqlUtil.getTCDataConnection(prefs); + System.out.println("cb_errBtn" + cb_errBtn.isSelected()); + System.out.println("sqlDetail" + sqlDetail.toString()); + ResultSet read = SqlUtil.read(sqlDetail); + int i = 1; + List beanList = null; + while (read.next()) { + // ҳ 20 ѯ + DetailsBean sumBean = new DetailsBean(new SimpleIntegerProperty(i), + new SimpleStringProperty(read.getString(1)), new SimpleStringProperty(read.getString(2)), + new SimpleStringProperty(read.getString(3)), new SimpleStringProperty(read.getString(4)), + new SimpleStringProperty(read.getString(5)), new SimpleStringProperty(read.getString(6)), + new SimpleStringProperty(read.getString(7)), new SimpleStringProperty(read.getString(8)), + new SimpleStringProperty(read.getString(9)), new SimpleStringProperty(read.getString(10))); + if (i % 40 == 1) { + beanList = new ArrayList(); + tableBeans.add(beanList); + } + beanList.add(sumBean); + i = i + 1; + } + SqlUtil.freeAll(); + if (tableBeans.size() == 0) { beanList = new ArrayList(); tableBeans.add(beanList); } - beanList.add(sumBean); - i = i + 1; - } - SqlUtil.freeAll(); - if (tableBeans.size() == 0) { - beanList = new ArrayList(); - tableBeans.add(beanList); + if (errMsgBeans.size() == 0 && cb_errBtn.isSelected()) { + errMsgBeans = tableBeans; + } else if (allMsgBeans.size() == 0 && !cb_errBtn.isSelected()) { + allMsgBeans = tableBeans; + } } + ObservableList data = FXCollections.observableArrayList(tableBeans.get(0)); tableView.getItems().clear(); tableView.setItems(data); pageNum = 0; this.tableBeans = tableBeans; - lb_page.setText("/"+tableBeans.size()); + lb_page.setText("/" + tableBeans.size()); + pageNumTxt.setText("1"); } } diff --git a/com.connor.chint.wuhan/src/com/chint/plm/SearchSapResult/SearchSapController.java b/com.connor.chint.wuhan/src/com/chint/plm/SearchSapResult/SearchSapController.java index 74cb30e..0b75b5c 100644 --- a/com.connor.chint.wuhan/src/com/chint/plm/SearchSapResult/SearchSapController.java +++ b/com.connor.chint.wuhan/src/com/chint/plm/SearchSapResult/SearchSapController.java @@ -272,7 +272,7 @@ public class SearchSapController extends KFXPanelController { i = i + 1; } if (tableBeans.size() == 0) { - MessageBox.post("δѯݼ¼.", "ʾ", 2); + MessageBox.post(frame,"δѯݼ¼.", "ʾ", 2); beanList = new ArrayList(); tableBeans.add(beanList); } @@ -308,7 +308,7 @@ public class SearchSapController extends KFXPanelController { frame = (SapResultFrame) paramKFXPanel.getParentDialog(); addWindListener(frame); - frame.setExtendedState(JFrame.MAXIMIZED_BOTH); + frame.setMaximumSize(frame.getMaximumSize()); System.out.println("frame==>" + frame); this.app = AIFUtility.getCurrentApplication(); this.session = (TCSession) app.getSession(); @@ -383,7 +383,7 @@ public class SearchSapController extends KFXPanelController { } }; }); - + // tableView.setMaxHeight(pageNum); } @@ -402,7 +402,7 @@ public class SearchSapController extends KFXPanelController { sapStateList.add("PLMݼδͨ"); sapStateList.add("δ"); sapStateList.add(""); - sapStateList.add("ȫ"); + sapStateList.add("ȫɹ"); sapStateList.add("ʧ"); cb_sapState.getItems().addAll(sapStateList); List sapStatusList = new ArrayList(); diff --git a/com.connor.chint.wuhan/src/com/chint/plm/SearchSapResult/SearchSapDetailPanel.fxml b/com.connor.chint.wuhan/src/com/chint/plm/SearchSapResult/SearchSapDetailPanel.fxml index 2ab9c05..6f79955 100644 --- a/com.connor.chint.wuhan/src/com/chint/plm/SearchSapResult/SearchSapDetailPanel.fxml +++ b/com.connor.chint.wuhan/src/com/chint/plm/SearchSapResult/SearchSapDetailPanel.fxml @@ -22,7 +22,7 @@ - + diff --git a/com.connor.chint.wuhan/src/com/chint/plm/createEcn/AssignIdController.java b/com.connor.chint.wuhan/src/com/chint/plm/createEcn/AssignIdController.java index 6ccc522..db06b82 100644 --- a/com.connor.chint.wuhan/src/com/chint/plm/createEcn/AssignIdController.java +++ b/com.connor.chint.wuhan/src/com/chint/plm/createEcn/AssignIdController.java @@ -26,36 +26,38 @@ import javafx.scene.control.ComboBox; import javafx.scene.control.TextField; import javafx.stage.Stage; -public class AssignIdController{ +public class AssignIdController { private String groupID; private TCSession session; private TextField field; private TCComponent tar; private boolean flag; - @FXML - private Button assignBtn; - private Button assignBtnTop; //еָɰť - @FXML - private TextField ylText; + @FXML + private Button assignBtn; + private Button assignBtnTop; // еָɰť + @FXML + private TextField ylText; - @FXML - private Button closeBtn; + @FXML + private Button closeBtn; - @FXML - private ComboBox bmComb; + @FXML + private ComboBox bmComb; + + @FXML + private ComboBox factoryComb; - @FXML - private ComboBox factoryComb; /** - * @param session - * @param groupID ID - * @param field ı - * @param tar ѡж - * @param flag ʽʱ + * @param session + * @param groupID ID + * @param field ı + * @param tar ѡж + * @param flag ʽʱ * @param assignBtn ָɰť * @function ʼ */ - public void initData(TCSession session,String groupID,TextField field,TCComponent tar,boolean flag,Button assignBtn) { + public void initData(TCSession session, String groupID, TextField field, TCComponent tar, boolean flag, + Button assignBtn) { // TODO Auto-generated method stub this.groupID = groupID; this.session = session; @@ -65,21 +67,22 @@ public class AssignIdController{ this.assignBtnTop = assignBtn; getCombox(); } - @FXML - void okBtnClick(ActionEvent event) { - SimpleDateFormat sdf = new SimpleDateFormat("yy"); + + @FXML + void okBtnClick(ActionEvent event) { + SimpleDateFormat sdf = new SimpleDateFormat("yy"); String year = sdf.format(new Date()); String fac = factoryComb.getSelectionModel().getSelectedItem(); String off = bmComb.getSelectionModel().getSelectedItem(); - if(off.equals("-")) { + if (off.equals("-")) { off = ""; } String TF = ""; /// if(1==1) // return; - if (flag) { //ʱ + if (flag) { // ʱ TF = "L"; - } else { //if (TF.trim().equals("ʽ֪ͨ")) + } else { // if (TF.trim().equals("ʽ֪ͨ")) TF = ""; } String searchWord = fac.split("-")[0] + off.split("-")[0] + "-" + year + TF; @@ -101,8 +104,8 @@ public class AssignIdController{ FLOW = String.format("%04d", Integer.valueOf(FLOW) + 1); query = "update CHINT_ECN_CODE set FLOW='" + FLOW + "' where CODE='" + searchWord + "'"; } else { - query = "insert into CHINT_ECN_CODE (FACTORY,OFFICE,CODE,FLOW) VALUES('" + fac + "','" + off - + "','" + searchWord + "','0002')"; + query = "insert into CHINT_ECN_CODE (FACTORY,OFFICE,CODE,FLOW) VALUES('" + fac + "','" + off + "','" + + searchWord + "','0002')"; // query = "insert into CHINT_ECN_CODE (FACTORY,OFFICE,CODE,FLOW) VALUES('" + // fac + "','" + off // + "','" + searchWord + "','0002')"; @@ -122,32 +125,32 @@ public class AssignIdController{ } assignBtnTop.setDisable(true);// ָֻһ assignBtn.setDisable(true);// ָֻһ - Stage stage = (Stage)closeBtn.getScene().getWindow(); - stage.close(); - } - - @FXML - void cancelBtnClick(ActionEvent event) { - Stage stage = (Stage)closeBtn.getScene().getWindow(); - stage.close(); - } + Stage stage = (Stage) closeBtn.getScene().getWindow(); + stage.close(); + } - @FXML - void selectDepart(ActionEvent event) { + @FXML + void cancelBtnClick(ActionEvent event) { + Stage stage = (Stage) closeBtn.getScene().getWindow(); + stage.close(); + } - } + @FXML + void selectDepart(ActionEvent event) { - @FXML - void selectFactory(ActionEvent event) { + } - } + @FXML + void selectFactory(ActionEvent event) { + + } /** * * @function ѡȡͲ */ public void getCombox() { - //ѡȡͲ + // ѡȡͲ String[] FO = session.getPreferenceService().getStringValues("CHINT_FAC_OFF"); List facList = new ArrayList<>(); String first_FO = ""; @@ -171,40 +174,40 @@ public class AssignIdController{ // foMap.put(FO[i].split(":")[0], list); foMap.put(group, list); } - //ʼ߼ + // ʼ߼ factoryComb.getItems().addAll(facList); factoryComb.getSelectionModel().select(first_FO); - //Ӽ ̬ + // Ӽ ̬ factoryComb.valueProperty().addListener((obs, oldVal, newVal) -> { - System.out.println("ѡˣ" + newVal); - String index = factoryComb.getSelectionModel().getSelectedItem(); - List vector = foMap.get(index); - bmComb.getItems().clear(); - bmComb.getItems().addAll(vector); - if(vector.size()==1 && vector.get(0).equals("-")) { + System.out.println("ѡˣ" + newVal); + String index = factoryComb.getSelectionModel().getSelectedItem(); + List vector = foMap.get(index); + bmComb.getItems().clear(); + bmComb.getItems().addAll(vector); + if (vector.size() == 1 && vector.get(0).equals("-")) { bmComb.setVisible(false); - }else { + } else { bmComb.setVisible(true); } }); List init = foMap.get(factoryComb.getSelectionModel().getSelectedItem()); bmComb.getItems().addAll(init); - - //Ӽ ԤϢ + + // Ӽ ԤϢ bmComb.valueProperty().addListener((obs, oldVal, newVal) -> { - System.out.println("ѡˣ" + newVal); - SimpleDateFormat sdf = new SimpleDateFormat("yy"); + System.out.println("ѡˣ" + newVal); + SimpleDateFormat sdf = new SimpleDateFormat("yy"); String year = sdf.format(new Date()); String fac = factoryComb.getSelectionModel().getSelectedItem(); String off = bmComb.getSelectionModel().getSelectedItem(); - if(off.equals("-")) { + if (off.equals("-")) { off = ""; } String TF = ""; - if (flag) { //ʱ + if (flag) { // ʱ TF = "L"; - } else { //if (TF.trim().equals("ʽ֪ͨ")) + } else { // if (TF.trim().equals("ʽ֪ͨ")) TF = ""; } String searchWord = fac.split("-")[0] + off.split("-")[0] + "-" + year + TF; @@ -238,7 +241,7 @@ public class AssignIdController{ e1.printStackTrace(); } }); - + // comBoxOffice = new JComboBox(new DefaultComboBoxModel(init.toArray(new String[init.size()]))); System.out.println("first_FO:" + first_FO); // if (tar.getType().equals("ZT2_Change")) { @@ -259,5 +262,6 @@ public class AssignIdController{ // // } } + private Util util = new Util(); } diff --git a/com.connor.chint.wuhan/src/com/chint/plm/createEcn/AssignIdDialog.java b/com.connor.chint.wuhan/src/com/chint/plm/createEcn/AssignIdDialog.java index 154bbb0..fcfdc29 100644 --- a/com.connor.chint.wuhan/src/com/chint/plm/createEcn/AssignIdDialog.java +++ b/com.connor.chint.wuhan/src/com/chint/plm/createEcn/AssignIdDialog.java @@ -35,14 +35,16 @@ import javafx.scene.control.Button; import javafx.scene.control.TextField; import javafx.stage.Stage; -public class AssignIdDialog extends Application { +public class AssignIdDialog extends Application { private String groupID; private TCSession session; private TextField field; private TCComponent tar; private Button assignBtn; private boolean flag; - public AssignIdDialog(TCSession session,String groupID,TextField field,TCComponent tar,boolean flag,Button assignBtn) { + + public AssignIdDialog(TCSession session, String groupID, TextField field, TCComponent tar, boolean flag, + Button assignBtn) { super(); this.groupID = groupID; this.session = session; @@ -51,19 +53,19 @@ public class AssignIdDialog extends Application { this.flag = flag; this.assignBtn = assignBtn; } + @Override - public void start(Stage primaryStage) throws IOException { + public void start(Stage primaryStage) throws IOException { // StackPane root = new StackPane(); FXMLLoader fxmlLoader = new FXMLLoader(); fxmlLoader.setLocation(getClass().getResource("AssignIdPane.fxml")); Parent root = (Parent) fxmlLoader.load(); Scene scene = new Scene(root, 400.0, 240.0); AssignIdController controller = (AssignIdController) fxmlLoader.getController(); - primaryStage.setTitle("֪ͨ"); - controller.initData(session,groupID,field,tar,flag,assignBtn); - primaryStage.setScene(scene); - primaryStage.show(); - } - + primaryStage.setTitle("֪ͨ"); + controller.initData(session, groupID, field, tar, flag, assignBtn); + primaryStage.setScene(scene); + primaryStage.show(); + } } diff --git a/com.connor.chint.wuhan/src/com/chint/plm/createEcn/CreateEcnCommond.java b/com.connor.chint.wuhan/src/com/chint/plm/createEcn/CreateEcnCommond.java index aa86bbe..713d3a5 100644 --- a/com.connor.chint.wuhan/src/com/chint/plm/createEcn/CreateEcnCommond.java +++ b/com.connor.chint.wuhan/src/com/chint/plm/createEcn/CreateEcnCommond.java @@ -7,18 +7,18 @@ import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent; import com.teamcenter.rac.util.MessageBox; public class CreateEcnCommond extends KCommand { - + public CreateEcnCommond(AbstractAIFApplication app, String commandId, String actionInfo) { super(app, commandId, actionInfo); try { InterfaceAIFComponent targetComponent = app.getTargetComponent(); - if(targetComponent.getType().equals("ZT2_ProjectItem") || targetComponent.getType().equals("ZT2_Change")) { + if (targetComponent.getType().equals("ZT2_ProjectItem") || targetComponent.getType().equals("ZT2_Change")) { new CreateEcnFrame(); - }else { + } else { MessageBox.post("ѡĿ߸֪ͨļ", "", MessageBox.ERROR); } - - }catch(Exception e) { + + } catch (Exception e) { e.printStackTrace(); } } 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 dd09856..8802c9f 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 @@ -71,116 +71,118 @@ import javafx.scene.layout.StackPane; import javafx.stage.Stage; public class CreateEcnController extends KFXPanelController { - @FXML - private TextField ecnId; - @FXML - private Button assignBtn; + @FXML + private TextField ecnId; + @FXML + private Button assignBtn; @FXML private TableView tableView; @FXML - private StackPane stackPane; - @FXML - private DatePicker changeDate; - @FXML - private TitledPane referencePane; - @FXML - private RadioButton rb_product; - @FXML - private GridPane gridPane; - @FXML - private RadioButton rb_tempChange; //ʱ֪ͨ - @FXML - private RadioButton rb_Process; - @FXML - private ScrollPane scollPane; - @FXML - private TitledPane tp_product; - @FXML - private TitledPane tc_details; - private List parts = new ArrayList(); - private List reasons = new ArrayList(); - private List wips = new ArrayList(); - private List products = new ArrayList(); - private List ecnBeans = new ArrayList(); - protected AbstractAIFApplication app; - private TCSession session; - private TCComponent target; - @FXML - private RadioButton rb_formalChange; //ʽ֪ͨ - @FXML - private TextField factoryText; - @FXML - private GridPane productPane; - - @FXML - private TextField htNameText; - @FXML - public TextField markText; - @FXML - private TextField contractText; - @FXML - private ComboBox prodNameComb; - @FXML - private FlowPane departPane; - private List partBtns = new ArrayList<>(); - @FXML - private ComboBox pmCombox; - private CreateEcnController controller; - private CreateEcnFrame frame; - private String[] database; - - @Override + private StackPane stackPane; + @FXML + private DatePicker changeDate; + @FXML + private TitledPane referencePane; + @FXML + private RadioButton rb_product; + @FXML + private GridPane gridPane; + @FXML + private RadioButton rb_tempChange; // ʱ֪ͨ + @FXML + private RadioButton rb_Process; + @FXML + private ScrollPane scollPane; + @FXML + private TitledPane tp_product; + @FXML + private TitledPane tc_details; + private List parts = new ArrayList(); + private List reasons = new ArrayList(); + private List wips = new ArrayList(); + private List products = new ArrayList(); + private List ecnBeans = new ArrayList(); + protected AbstractAIFApplication app; + private TCSession session; + private TCComponent target; + @FXML + private RadioButton rb_formalChange; // ʽ֪ͨ + @FXML + private TextField factoryText; + @FXML + private GridPane productPane; + + @FXML + private TextField htNameText; + @FXML + public TextField markText; + @FXML + private TextField contractText; + @FXML + private ComboBox prodNameComb; + @FXML + private FlowPane departPane; + private List partBtns = new ArrayList<>(); + @FXML + private ComboBox pmCombox; + private CreateEcnController controller; + private CreateEcnFrame frame; + private String[] database; + + @Override public void initData(KFXPanel paramKFXPanel) throws Exception { // TODO Auto-generated method stub - this.app = AIFUtility.getCurrentApplication(); + this.app = AIFUtility.getCurrentApplication(); this.session = (TCSession) app.getSession(); - target = (TCComponent)app.getTargetComponent(); + target = (TCComponent) app.getTargetComponent(); database = session.getPreferenceService().getStringValues("database_tc"); - CreateEcnFrame frame = (CreateEcnFrame)paramKFXPanel.getParentDialog(); - this.frame = frame; - addWindListener(frame); - // - ToggleGroup group = new ToggleGroup(); // - //ʵֵѡ - rb_formalChange.setToggleGroup(group); - rb_tempChange.setToggleGroup(group); - rb_formalChange.setSelected(true); - referencePane.setExpanded(false); - - ToggleGroup groupGc = new ToggleGroup(); // - rb_product.setToggleGroup(groupGc); - rb_Process.setToggleGroup(groupGc); - tp_product.setCollapsible(false); - tc_details.setCollapsible(false); - controller = this; - createDetailTable(); - + CreateEcnFrame frame = (CreateEcnFrame) paramKFXPanel.getParentDialog(); + this.frame = frame; + addWindListener(frame); + // + ToggleGroup group = new ToggleGroup(); // + // ʵֵѡ + rb_formalChange.setToggleGroup(group); + rb_tempChange.setToggleGroup(group); + rb_formalChange.setSelected(true); + referencePane.setExpanded(false); + + ToggleGroup groupGc = new ToggleGroup(); // + rb_product.setToggleGroup(groupGc); + rb_Process.setToggleGroup(groupGc); + tp_product.setCollapsible(false); + tc_details.setCollapsible(false); + controller = this; + createDetailTable(); + createRefTable(); - //ȡѡеĶ - + // ȡѡеĶ + initText(); - + } - @FXML - private Button createBtn; - /** - * @param event - * @throws Exception - * @function ť - */ - @FXML - void createClick(ActionEvent event) throws Exception { - if(ecnId.getText().isEmpty()) { - MessageBox.post("ָɱID","ʾ",2); - return; - } - String changeName = "ʱ֪ͨ"; - if(rb_formalChange.isSelected()) { + + @FXML + private Button createBtn; + + /** + * @param event + * @throws Exception + * @function ť + */ + @FXML + void createClick(ActionEvent event) throws Exception { + if (ecnId.getText().isEmpty()) { + MessageBox.post("ָɱID", "ʾ", 2); + return; + } + String changeName = "ʱ֪ͨ"; + if (rb_formalChange.isSelected()) { changeName = "ʽ֪ͨ"; } - if (target.getType().equals("ZT2_Change")) { + if (target.getType().equals("ZT2_Change")) { TCComponentItem item = (TCComponentItem) target; - setItemProperty(item,changeName); + setItemProperty(item, changeName); String type = item.getProperty("zt2_Template"); TCComponentDataset dataset = null; @@ -207,10 +209,8 @@ public class CreateEcnController extends KFXPanelController { } else if (target.getType().equals("ZT2_ProjectItem")) { String zt2_WBSNo = target.getProperty("zt2_WBSNo"); // ½ - TCComponentItemType itemType = (TCComponentItemType) session - .getTypeComponent("ZT2_Change"); - TCComponentItem item = itemType.create(ecnId.getText(), null, "ZT2_Change", - changeName, "", null); + TCComponentItemType itemType = (TCComponentItemType) session.getTypeComponent("ZT2_Change"); + TCComponentItem item = itemType.create(ecnId.getText(), null, "ZT2_Change", changeName, "", null); // boolean flag = true; try { @@ -254,87 +254,80 @@ public class CreateEcnController extends KFXPanelController { } } - - //ӰϢ 浽CHINT_ECN_NOTIFICATION - try { - SqlUtil.getTCDataConnection(database); - String deleteSql = "delete CHINT_ECN_NOTIFICATION where \"ecncode\" = ? "; - String endCode = ecnId.getText(); - SqlUtil.delete(deleteSql,new String[] {endCode}); - String insertSql = "insert into CHINT_ECN_NOTIFICATION (\"ecncode\", \"code\", \"section\", \"no\" ," - + "\"actionstatement\",\"result\",\"principal\",\"pctime\",\"remark\") values (?,?,?,?,?,?,?,?,?)"; - ObservableList items = refTable.getItems(); - - for(int i=0;i<7;i++) { - RefTableBean refTableBean = items.get(i); - String result = refTableBean.getShYes().isSelected()?"":""; - SqlUtil.write( - new String[] {endCode,"1",refTableBean.getDepart(),String.valueOf(i+1), - refTableBean.getMessage(),result,refTableBean.getUser().getText(), - refTableBean.getCompDate().getText(),refTableBean.getMark().getText()}, insertSql); + + // ӰϢ 浽CHINT_ECN_NOTIFICATION + try { + SqlUtil.getTCDataConnection(database); + String deleteSql = "delete CHINT_ECN_NOTIFICATION where \"ecncode\" = ? "; + String endCode = ecnId.getText(); + SqlUtil.delete(deleteSql, new String[] { endCode }); + String insertSql = "insert into CHINT_ECN_NOTIFICATION (\"ecncode\", \"code\", \"section\", \"no\" ," + + "\"actionstatement\",\"result\",\"principal\",\"pctime\",\"remark\") values (?,?,?,?,?,?,?,?,?)"; + ObservableList items = refTable.getItems(); + + for (int i = 0; i < 7; i++) { + RefTableBean refTableBean = items.get(i); + String result = refTableBean.getShYes().isSelected() ? "" : ""; + SqlUtil.write(new String[] { endCode, "1", refTableBean.getDepart(), String.valueOf(i + 1), + refTableBean.getMessage(), result, refTableBean.getUser().getText(), + refTableBean.getCompDate().getText(), refTableBean.getMark().getText() }, insertSql); } - for(int i=7;i<11;i++) { - RefTableBean refTableBean = items.get(i); - String result = refTableBean.getShYes().isSelected()?"":""; - SqlUtil.write( - new String[] {endCode,"2",refTableBean.getDepart(),String.valueOf(i-6), - refTableBean.getMessage(),result,refTableBean.getUser().getText(), - refTableBean.getCompDate().getText(),refTableBean.getMark().getText()}, insertSql); + for (int i = 7; i < 11; i++) { + RefTableBean refTableBean = items.get(i); + String result = refTableBean.getShYes().isSelected() ? "" : ""; + SqlUtil.write(new String[] { endCode, "2", refTableBean.getDepart(), String.valueOf(i - 6), + refTableBean.getMessage(), result, refTableBean.getUser().getText(), + refTableBean.getCompDate().getText(), refTableBean.getMark().getText() }, insertSql); } - for(int i=11;i<15;i++) { - RefTableBean refTableBean = items.get(i); - String result = refTableBean.getShYes().isSelected()?"":""; - SqlUtil.write( - new String[] {endCode,"3",refTableBean.getDepart(),String.valueOf(i-10), - refTableBean.getMessage(),result,refTableBean.getUser().getText(), - refTableBean.getCompDate().getText(),refTableBean.getMark().getText()}, insertSql); + for (int i = 11; i < 15; i++) { + RefTableBean refTableBean = items.get(i); + String result = refTableBean.getShYes().isSelected() ? "" : ""; + SqlUtil.write(new String[] { endCode, "3", refTableBean.getDepart(), String.valueOf(i - 10), + refTableBean.getMessage(), result, refTableBean.getUser().getText(), + refTableBean.getCompDate().getText(), refTableBean.getMark().getText() }, insertSql); } - for(int i=15;i<19;i++) { - RefTableBean refTableBean = items.get(i); - String result = refTableBean.getShYes().isSelected()?"":""; - SqlUtil.write( - new String[] {endCode,"4",refTableBean.getDepart(),String.valueOf(i-14), - refTableBean.getMessage(),result,refTableBean.getUser().getText(), - refTableBean.getCompDate().getText(),refTableBean.getMark().getText()}, insertSql); + for (int i = 15; i < 19; i++) { + RefTableBean refTableBean = items.get(i); + String result = refTableBean.getShYes().isSelected() ? "" : ""; + SqlUtil.write(new String[] { endCode, "4", refTableBean.getDepart(), String.valueOf(i - 14), + refTableBean.getMessage(), result, refTableBean.getUser().getText(), + refTableBean.getCompDate().getText(), refTableBean.getMark().getText() }, insertSql); } - for(int i=19;i<24;i++) { - RefTableBean refTableBean = items.get(i); - String result = refTableBean.getShYes().isSelected()?"":""; - SqlUtil.write( - new String[] {endCode,"5",refTableBean.getDepart(),String.valueOf(i-18), - refTableBean.getMessage(),result,refTableBean.getUser().getText(), - refTableBean.getCompDate().getText(),refTableBean.getMark().getText()}, insertSql); + for (int i = 19; i < 24; i++) { + RefTableBean refTableBean = items.get(i); + String result = refTableBean.getShYes().isSelected() ? "" : ""; + SqlUtil.write(new String[] { endCode, "5", refTableBean.getDepart(), String.valueOf(i - 18), + refTableBean.getMessage(), result, refTableBean.getUser().getText(), + refTableBean.getCompDate().getText(), refTableBean.getMark().getText() }, insertSql); } - for(int i=24;i<27;i++) { - RefTableBean refTableBean = items.get(i); - String result = refTableBean.getShYes().isSelected()?"":""; - SqlUtil.write( - new String[] {endCode,"6",refTableBean.getDepart(),String.valueOf(i-23), - refTableBean.getMessage(),result,refTableBean.getUser().getText(), - refTableBean.getCompDate().getText(),refTableBean.getMark().getText()}, insertSql); + for (int i = 24; i < 27; i++) { + RefTableBean refTableBean = items.get(i); + String result = refTableBean.getShYes().isSelected() ? "" : ""; + SqlUtil.write(new String[] { endCode, "6", refTableBean.getDepart(), String.valueOf(i - 23), + refTableBean.getMessage(), result, refTableBean.getUser().getText(), + refTableBean.getCompDate().getText(), refTableBean.getMark().getText() }, insertSql); } - for(int i=27;i<28;i++) { - RefTableBean refTableBean = items.get(i); - String result = refTableBean.getShYes().isSelected()?"":""; - SqlUtil.write( - new String[] {endCode,"7",refTableBean.getDepart(),String.valueOf(i-26), - refTableBean.getMessage(),result,refTableBean.getUser().getText(), - refTableBean.getCompDate().getText(),refTableBean.getMark().getText()}, insertSql); + for (int i = 27; i < 28; i++) { + RefTableBean refTableBean = items.get(i); + String result = refTableBean.getShYes().isSelected() ? "" : ""; + SqlUtil.write(new String[] { endCode, "7", refTableBean.getDepart(), String.valueOf(i - 26), + refTableBean.getMessage(), result, refTableBean.getUser().getText(), + refTableBean.getCompDate().getText(), refTableBean.getMark().getText() }, insertSql); } - }catch(Exception e) { - e.printStackTrace(); - }finally { - SqlUtil.freeAll(); - } - createBtn.setDisable(true); - } - /** - * @param ݼ - * @param ļ· - * @param - * 滻excelļ - */ - protected void createOrReplace(TCComponentDataset dataset, File file, String changeName) { + } catch (Exception e) { + e.printStackTrace(); + } finally { + SqlUtil.freeAll(); + } + createBtn.setDisable(true); + } + + /** + * @param ݼ + * @param ļ· + * @param 滻excelļ + */ + protected void createOrReplace(TCComponentDataset dataset, File file, String changeName) { // 20200407ɾ try { FileInputStream fis = new FileInputStream(file); @@ -344,7 +337,7 @@ public class CreateEcnController extends KFXPanelController { sheet.getRow(1).getCell(13).setCellValue(ecnId.getText()); // int page = 0; List mergeRegions = null; - + for (int i = 0; i < pages; i++) { int pace = 0; if (sheet.getRow(2 + i * 23) == null) { @@ -410,7 +403,7 @@ public class CreateEcnController extends KFXPanelController { file2 = new File(filePath); FileOutputStream fos = new FileOutputStream(file2); workBook.write(fos); - + Util.deMerge(filePath, filePath, pages); Util.delete(filePath, filePath, pages); dataset.setFiles(new String[] { filePath }, new String[] { "excel" }); @@ -419,28 +412,28 @@ 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 - * @throws Exception - * @function ޸ı - */ - protected void setItemProperty(TCComponentItem item, String changeName) throws Exception { - - contractNo = contractText.getText(); //ͬ - contractName = htNameText.getText();//ͬ - productModel = pmCombox.getSelectionModel().getSelectedItem(); //Ʒͺ + + private String contractNo; // ͬ + private String contractName;// ͬ + private String productModel; // Ʒͺ + private String changeType; // ʽʱ + private String changeTime;// ʵʩ + private String changeUnit1; // Ա + + /** + * @param item + * @param changeName + * @throws Exception + * @function ޸ı + */ + protected void setItemProperty(TCComponentItem item, String changeName) throws Exception { + + contractNo = contractText.getText(); // ͬ + contractName = htNameText.getText();// ͬ + productModel = pmCombox.getSelectionModel().getSelectedItem(); // Ʒͺ String productName = prodNameComb.getSelectionModel().getSelectedItem(); String fileName = markText.getText(); - changeType = changeName; //ʽʱ + changeType = changeName; // ʽʱ item.setProperty("zt2_ContractNo", contractNo); item.setProperty("zt2_ContractName", contractName); item.setProperty("zt2_ProductModel", productModel); @@ -455,9 +448,9 @@ public class CreateEcnController extends KFXPanelController { item.setDateProperty("zt2_ChangeDate", date); } StringBuilder unit = new StringBuilder(""); - for(int j=0;j 0) { unit.append(";").append(radioButton.getText()); } else { @@ -465,11 +458,11 @@ public class CreateEcnController extends KFXPanelController { } } } - changeUnit1 = unit.toString(); //Ա + changeUnit1 = unit.toString(); // Ա item.setProperty("zt2_ChangeUnit1", changeUnit1); ObservableList items = tableView.getItems(); int rowCount = items.size(); - + System.out.println(rowCount); changeDrawingNo = new String[rowCount]; sign = new String[rowCount]; @@ -479,12 +472,12 @@ public class CreateEcnController extends KFXPanelController { changeAfter1 = new String[rowCount]; changeReason = new String[rowCount]; processType1 = new String[rowCount]; - szVersionBefs = new String[rowCount]; - szVersionAfts = new String[rowCount]; - - productSzs = new String[rowCount]; - processSzs = new String[rowCount]; - + szVersionBefs = new String[rowCount]; + szVersionAfts = new String[rowCount]; + + productSzs = new String[rowCount]; + processSzs = new String[rowCount]; + int modulus = changeDrawingNo.length % 5; int dlivery = changeDrawingNo.length / 5; if (modulus == 0) { @@ -502,17 +495,17 @@ public class CreateEcnController extends KFXPanelController { changeBefore1[i] = ecnBean.getOverChange().getText(); changeAfter1[i] = ecnBean.getAfterChange().getText(); String reasonItem = ecnBean.getChangeReason().getSelectionModel().getSelectedItem(); - changeReason[i] = reasonItem==null?"":reasonItem; + changeReason[i] = reasonItem == null ? "" : reasonItem; String processTypeItem = ecnBean.getWipTreat().getSelectionModel().getSelectedItem(); - processType1[i] = processTypeItem==null?"":processTypeItem; + processType1[i] = processTypeItem == null ? "" : processTypeItem; szVersionBefs[i] = ecnBean.getOverVersion().getText(); szVersionAfts[i] = ecnBean.getAfterVersion().getText(); productSzs[i] = ecnBean.getProductSz().getSelectionModel().getSelectedItem(); - processSzs[i] = rb_product.isSelected() ? "Y":"N"; + processSzs[i] = rb_product.isSelected() ? "Y" : "N"; } item.getTCProperty("zt2_ChangeDrawingNo").setStringValueArray(changeDrawingNo); item.getTCProperty("zt2_Sign").setStringValueArray(sign); - item.getTCProperty("zt2_PlacesNo").setStringValueArray(partition); // + item.getTCProperty("zt2_PlacesNo").setStringValueArray(partition); // item.getTCProperty("zt2_ChangeBefore1").setStringValueArray(changeBefore1); item.getTCProperty("zt2_ChangeAfter1").setStringValueArray(changeAfter1); item.getTCProperty("zt2_ChangeReason").setStringValueArray(changeReason); @@ -522,36 +515,38 @@ public class CreateEcnController extends KFXPanelController { item.getTCProperty("zt2_SZProduct").setStringValueArray(productSzs); item.getTCProperty("zt2_SZProcess").setStringValueArray(processSzs); } - private int pages = 0; - private String[] changeDrawingNo; //zt2_ChangeDrawingNo - private String[] sign; //zt2_Sign + + 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 رҳ - */ - @FXML - void disposeClick(ActionEvent event) { - frame.dispose(); - } - - /** - * @throws Exception - * @function ʼҳ - */ - private void initText() throws Exception { - List productModelList = new ArrayList<>(); - productModelList = Util.getproductModel(target, productModelList); - factoryText.setEditable(false); + 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 رҳ + */ + @FXML + void disposeClick(ActionEvent event) { + frame.dispose(); + } + + /** + * @throws Exception + * @function ʼҳ + */ + private void initText() throws Exception { + List productModelList = new ArrayList<>(); + productModelList = Util.getproductModel(target, productModelList); + factoryText.setEditable(false); pmCombox.getItems().addAll(productModelList); List unitList = new ArrayList<>(); contractText.setText(Util.getProjectNo(target)); @@ -560,27 +555,27 @@ public class CreateEcnController extends KFXPanelController { htNameText.setEditable(false); ecnId.setEditable(false); rb_product.setSelected(true); - if(target.getType().equals("ZT2_ProjectItem")) { - //ȡƷ - List ccpNameFromProject = KUtil.getCCPNameFromProject(target, session); - prodNameComb.getItems().addAll(ccpNameFromProject); - }else { - //Ϊʱ IDʱ䣬Ʒͺš - List productNameList = new ArrayList<>(); - productNameList = Util.getProductNames(target, productNameList); - prodNameComb.getItems().addAll(productNameList); - String productModel = target.getProperty("zt2_ProductModel"); - pmCombox.getSelectionModel().select(productModel); - assignBtn.setDisable(true); - ecnId.setText(target.getProperty("item_id")); - TCProperty[] properties = null; + if (target.getType().equals("ZT2_ProjectItem")) { + // ȡƷ + List ccpNameFromProject = KUtil.getCCPNameFromProject(target, session); + prodNameComb.getItems().addAll(ccpNameFromProject); + } else { + // Ϊʱ IDʱ䣬Ʒͺš + List productNameList = new ArrayList<>(); + productNameList = Util.getProductNames(target, productNameList); + prodNameComb.getItems().addAll(productNameList); + String productModel = target.getProperty("zt2_ProductModel"); + pmCombox.getSelectionModel().select(productModel); + assignBtn.setDisable(true); + ecnId.setText(target.getProperty("item_id")); + TCProperty[] properties = null; try { Date date = target.getDateProperty("zt2_ChangeDate"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); if (date != null) { changeDate.getEditor().setText(sdf.format(date)); } - //ʼѡй + // ʼѡй if (target.getType().equals("ZT2_Change")) { String[] changeUnit1 = target.getProperty("zt2_ChangeUnit1").split(";"); for (int j = 0; j < changeUnit1.length; j++) { @@ -591,8 +586,8 @@ public class CreateEcnController extends KFXPanelController { target.refresh(); properties = target.getTCProperties( new String[] { "zt2_ChangeDrawingNo", "zt2_Sign", "zt2_PlacesNo", "zt2_Partition", - "zt2_ChangeBefore1", "zt2_ChangeAfter1", "zt2_ChangeReason", "zt2_ProcessType1" ,"zt2_SZVersionbefore", - "zt2_SZRevisedversion", "zt2_SZProduct", "zt2_SZProcess"}); + "zt2_ChangeBefore1", "zt2_ChangeAfter1", "zt2_ChangeReason", "zt2_ProcessType1", + "zt2_SZVersionbefore", "zt2_SZRevisedversion", "zt2_SZProduct", "zt2_SZProcess" }); } catch (TCException e1) { e1.printStackTrace(); } @@ -608,7 +603,7 @@ public class CreateEcnController extends KFXPanelController { String[] szVersionAft = properties[9].getStringArrayValue(); String[] szProduct = properties[10].getStringArrayValue(); String[] szProcess = properties[11].getStringArrayValue(); - if(szProcess.length>0) { + if (szProcess.length > 0) { rb_Process.setSelected(szProcess[0].equals("N")); } String fileName = target.getProperty("zt2_FileName"); @@ -624,63 +619,66 @@ public class CreateEcnController extends KFXPanelController { int rowNum = 0; for (int j = 0; j < ChangeDrawingNo.length; j++) { rowNum++; - 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]); + 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]); ecnBeans.add(ecnBean); ecnBean.setProductSz(szProduct[j]); } - } - tableView.getItems().addAll(ecnBeans); - for(int i=0;i items = refTable.getItems(); - int i=0; - String refTableSql = "select * from CHINT_ECN_NOTIFICATION where \"ecncode\" = '"+ecnId.getText()+"' order by \"code\" asc , \"no\" asc "; - System.out.println("refTableSql==>"+refTableSql); - ResultSet read = SqlUtil.read(refTableSql); - while(read.next()) { + } + tableView.getItems().addAll(ecnBeans); + for (int i = 0; i < parts.size(); i++) { + CheckBox btn = new CheckBox(parts.get(i)); + partBtns.add(btn); + departPane.getChildren().add(btn); + if (unitList.contains(parts.get(i))) { + btn.setSelected(true); + } + } + + try { + SqlUtil.getTCDataConnection(database); + ObservableList items = refTable.getItems(); + int i = 0; + String refTableSql = "select * from CHINT_ECN_NOTIFICATION where \"ecncode\" = '" + ecnId.getText() + + "' order by \"code\" asc , \"no\" asc "; + System.out.println("refTableSql==>" + refTableSql); + ResultSet read = SqlUtil.read(refTableSql); + while (read.next()) { // \"result\",\"principal\",\"pctime\",\"remark\" - RefTableBean refTableBean = items.get(i); - refTableBean.setCompDate(read.getString("pctime")); - refTableBean.setMark(read.getString("remark")); - refTableBean.setUser(read.getString("principal")); - String result = read.getString("result"); - System.out.println("refTableSql==>"+read.getString("principal")); - if(result.equals("")) { - refTableBean.setShNo(true); - } - i=i+1; - } - refTable.setItems(items); + RefTableBean refTableBean = items.get(i); + refTableBean.setCompDate(read.getString("pctime")); + refTableBean.setMark(read.getString("remark")); + refTableBean.setUser(read.getString("principal")); + String result = read.getString("result"); + System.out.println("refTableSql==>" + read.getString("principal")); + if (result.equals("")) { + refTableBean.setShNo(true); + } + i = i + 1; + } + refTable.setItems(items); // if() // refTable.getItems().clear(); // refTable.getItems().addAll(items); - }catch(Exception e) { - e.printStackTrace(); - }finally { - SqlUtil.freeAll(); - } + } catch (Exception e) { + e.printStackTrace(); + } finally { + SqlUtil.freeAll(); + } } - /* - * - */ - /** - * @param type - * @param ̶1 - * @return ݼģ - * @throws TCException - * @function ͻȡݼģ - */ - protected TCComponentDataset getDataset(String type, int i) throws TCException { + + /* + * + */ + /** + * @param type + * @param ̶1 + * @return ݼģ + * @throws TCException + * @function ͻȡݼģ + */ + protected TCComponentDataset getDataset(String type, int i) throws TCException { TCComponentDataset dataset = null; TCComponentDataset newDataset = null; @@ -710,7 +708,7 @@ public class CreateEcnController extends KFXPanelController { // util.disconnect(conn, stmt, rs_get); } catch (SQLException e) { e.printStackTrace(); - }finally { + } finally { SqlUtil.freeAll(); } if (i == 0) { @@ -719,12 +717,13 @@ public class CreateEcnController extends KFXPanelController { return newDataset; } } - /** - * @param targetĿ - * @return ĵļ - * @function ȡĿĸĵļ - */ - private TCComponent getTargetFolder(TCComponent target) { + + /** + * @param targetĿ + * @return ĵļ + * @function ȡĿĸĵļ + */ + private TCComponent getTargetFolder(TCComponent target) { try { TCComponent[] folders = target.getRelatedComponents("IMAN_reference"); for (int i = 0; i < folders.length; i++) { @@ -742,52 +741,53 @@ public class CreateEcnController extends KFXPanelController { } return null; } - /** - * - * @function ʼӰı bean - */ - private void createDetailTable() { + + /** + * + * @function ʼӰı bean + */ + private void createDetailTable() { // TODO Auto-generated method stub - - TableColumn tc_beforChange = new TableColumn("ǰ"); - TableColumn tc_afterChange = new TableColumn("ĺ"); - TableColumn tc_afterVer = new TableColumn("ĺ汾"); - - TableColumn tc_drawNo = new TableColumn("ͼ"); - TableColumn tc_mark = new TableColumn(""); - TableColumn tc_xh = new TableColumn(""); - TableColumn> tc_wipTreat = new TableColumn>("Ʒ"); - TableColumn tc_beforVer = new TableColumn("ǰ汾"); - TableColumn> productSz = new TableColumn>("Եȼ"); - TableColumn> tc_reason = new TableColumn>("ԭ"); - TableColumn tc_poiNum = 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); - - tc_xh.setSortable(false); - tc_drawNo.setSortable(false); - tc_mark.setSortable(false); - tc_poiNum.setSortable(false); - tc_beforChange.setSortable(false); - tc_beforVer.setSortable(false); - tc_afterChange.setSortable(false); - tc_afterVer.setSortable(false); - tc_reason.setSortable(false); - productSz.setSortable(false); - tc_wipTreat.setSortable(false); - //аbean - tc_xh.setCellValueFactory(new PropertyValueFactory("num")); - tc_drawNo.setCellValueFactory(new PropertyValueFactory("drawNo")); - tc_mark.setCellValueFactory(new PropertyValueFactory("mark")); - tc_poiNum.setCellValueFactory(new PropertyValueFactory("poiNum")); - tc_beforChange.setCellValueFactory(new PropertyValueFactory("overChange")); - tc_beforVer.setCellValueFactory(new PropertyValueFactory("overVersion")); - tc_afterChange.setCellValueFactory(new PropertyValueFactory("afterChange")); - tc_afterVer.setCellValueFactory(new PropertyValueFactory("afterVersion")); - tc_reason.setCellValueFactory(new PropertyValueFactory>("changeReason")); - tc_wipTreat.setCellValueFactory(new PropertyValueFactory>("wipTreat")); - productSz.setCellValueFactory(new PropertyValueFactory>("productSz")); - + + TableColumn tc_beforChange = new TableColumn("ǰ"); + TableColumn tc_afterChange = new TableColumn("ĺ"); + TableColumn tc_afterVer = new TableColumn("ĺ汾"); + + TableColumn tc_drawNo = new TableColumn("ͼ"); + TableColumn tc_mark = new TableColumn(""); + TableColumn tc_xh = new TableColumn(""); + TableColumn> tc_wipTreat = new TableColumn>("Ʒ"); + TableColumn tc_beforVer = new TableColumn("ǰ汾"); + TableColumn> productSz = new TableColumn>("Եȼ"); + TableColumn> tc_reason = new TableColumn>("ԭ"); + TableColumn tc_poiNum = 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); + + tc_xh.setSortable(false); + tc_drawNo.setSortable(false); + tc_mark.setSortable(false); + tc_poiNum.setSortable(false); + tc_beforChange.setSortable(false); + tc_beforVer.setSortable(false); + tc_afterChange.setSortable(false); + tc_afterVer.setSortable(false); + tc_reason.setSortable(false); + productSz.setSortable(false); + tc_wipTreat.setSortable(false); + // аbean + tc_xh.setCellValueFactory(new PropertyValueFactory("num")); + tc_drawNo.setCellValueFactory(new PropertyValueFactory("drawNo")); + tc_mark.setCellValueFactory(new PropertyValueFactory("mark")); + tc_poiNum.setCellValueFactory(new PropertyValueFactory("poiNum")); + tc_beforChange.setCellValueFactory(new PropertyValueFactory("overChange")); + tc_beforVer.setCellValueFactory(new PropertyValueFactory("overVersion")); + tc_afterChange.setCellValueFactory(new PropertyValueFactory("afterChange")); + tc_afterVer.setCellValueFactory(new PropertyValueFactory("afterVersion")); + tc_reason.setCellValueFactory(new PropertyValueFactory>("changeReason")); + tc_wipTreat.setCellValueFactory(new PropertyValueFactory>("wipTreat")); + productSz.setCellValueFactory(new PropertyValueFactory>("productSz")); + tc_xh.prefWidthProperty().bind(tableView.widthProperty().multiply(0.06)); tc_drawNo.prefWidthProperty().bind(tableView.widthProperty().multiply(0.18)); tc_mark.prefWidthProperty().bind(tableView.widthProperty().multiply(0.06)); @@ -797,11 +797,12 @@ public class CreateEcnController extends KFXPanelController { tc_afterChange.prefWidthProperty().bind(tableView.widthProperty().multiply(0.10)); productSz.prefWidthProperty().bind(tableView.widthProperty().multiply(0.06)); tc_afterVer.prefWidthProperty().bind(tableView.widthProperty().multiply(0.06)); - tc_reason.prefWidthProperty().bind(tableView.widthProperty().multiply(0.14)); //0.4 + tc_reason.prefWidthProperty().bind(tableView.widthProperty().multiply(0.14)); // 0.4 tc_wipTreat.prefWidthProperty().bind(tableView.widthProperty().multiply(0.10)); } - @FXML - public TableView refTable; + + @FXML + public TableView refTable; /** * @@ -809,7 +810,7 @@ public class CreateEcnController extends KFXPanelController { */ private void createRefTable() { // TODO Auto-generated method stub - //Ӱ + // Ӱ // protected SimpleStringProperty depart;// // protected SimpleStringProperty message; //ж // protected CheckBox shYes = new CheckBox();// @@ -817,80 +818,82 @@ public class CreateEcnController extends KFXPanelController { // protected TextField user;//ǰ汾 // protected TextField compDate;//ĺ // protected TextField mark;//ĺ汾 - TableColumn deapart = new TableColumn(""); - TableColumn message = new TableColumn("жҪ֤ݣ"); - TableColumn shYes = new TableColumn(""); //Ҫֵƣ - TableColumn shNo = new TableColumn(""); - TableColumn user = new TableColumn(""); - TableColumn compDate = new TableColumn("ʱ"); // - TableColumn mark = new TableColumn("ע"); // - - deapart.setCellValueFactory(new PropertyValueFactory("depart")); - message.setCellValueFactory(new PropertyValueFactory("message")); - shYes.setCellValueFactory(new PropertyValueFactory("shYes")); - shNo.setCellValueFactory(new PropertyValueFactory("shNo")); - user.setCellValueFactory(new PropertyValueFactory("user")); - compDate.setCellValueFactory(new PropertyValueFactory("compDate")); - mark.setCellValueFactory(new PropertyValueFactory("mark")); - - deapart.setSortable(false); - message.setSortable(false); - shYes.setSortable(false); - shNo.setSortable(false); - user.setSortable(false); - compDate.setSortable(false); - mark.setSortable(false); - refTable.getColumns().addAll(deapart, message, shYes,shNo,user, compDate, mark); + TableColumn deapart = new TableColumn(""); + TableColumn message = new TableColumn("жҪ֤ݣ"); + TableColumn shYes = new TableColumn(""); // Ҫֵƣ + TableColumn shNo = new TableColumn(""); + TableColumn user = new TableColumn(""); + TableColumn compDate = new TableColumn("ʱ"); // + TableColumn mark = new TableColumn("ע"); // + + deapart.setCellValueFactory(new PropertyValueFactory("depart")); + message.setCellValueFactory(new PropertyValueFactory("message")); + shYes.setCellValueFactory(new PropertyValueFactory("shYes")); + shNo.setCellValueFactory(new PropertyValueFactory("shNo")); + user.setCellValueFactory(new PropertyValueFactory("user")); + compDate.setCellValueFactory(new PropertyValueFactory("compDate")); + mark.setCellValueFactory(new PropertyValueFactory("mark")); + + deapart.setSortable(false); + message.setSortable(false); + shYes.setSortable(false); + shNo.setSortable(false); + user.setSortable(false); + compDate.setSortable(false); + mark.setSortable(false); + refTable.getColumns().addAll(deapart, message, shYes, shNo, user, compDate, mark); // //ÿ - deapart.prefWidthProperty().bind(refTable.widthProperty().multiply(0.14)); - message.prefWidthProperty().bind(refTable.widthProperty().multiply(0.36)); - shYes.prefWidthProperty().bind(refTable.widthProperty().multiply(0.05)); - shNo.prefWidthProperty().bind(refTable.widthProperty().multiply(0.05)); - user.prefWidthProperty().bind(refTable.widthProperty().multiply(0.13)); - compDate.prefWidthProperty().bind(refTable.widthProperty().multiply(0.13)); - mark.prefWidthProperty().bind(refTable.widthProperty().multiply(0.14)); - List refTableBeans = new ArrayList(); - //ʼ д - refTableBeans.add(new RefTableBean(new SimpleStringProperty(""),new SimpleStringProperty("ƷͼĿ¼Ƶ"))); - refTableBeans.add(new RefTableBean(new SimpleStringProperty(""),new SimpleStringProperty("DFMEAƷҪȷּ"))); - refTableBeans.add(new RefTableBean(new SimpleStringProperty(""),new SimpleStringProperty("BOMϸ"))); - refTableBeans.add(new RefTableBean(new SimpleStringProperty(""),new SimpleStringProperty("װͼ/淶"))); - refTableBeans.add(new RefTableBean(new SimpleStringProperty(""),new SimpleStringProperty("ǩ"))); - refTableBeans.add(new RefTableBean(new SimpleStringProperty(""),new SimpleStringProperty("ͻŵļ"))); - refTableBeans.add(new RefTableBean(new SimpleStringProperty(""),new SimpleStringProperty("Ҫ"))); - - refTableBeans.add(new RefTableBean(new SimpleStringProperty("ղ"),new SimpleStringProperty("ͼPFMEA"))); - refTableBeans.add(new RefTableBean(new SimpleStringProperty("ղ"),new SimpleStringProperty("ҵָ顢װָ"))); - refTableBeans.add(new RefTableBean(new SimpleStringProperty("ղ"),new SimpleStringProperty("ͻŵعļ"))); - refTableBeans.add(new RefTableBean(new SimpleStringProperty("ղ"),new SimpleStringProperty("ģߡװ豸"))); - - refTableBeans.add(new RefTableBean(new SimpleStringProperty(""),new SimpleStringProperty("Ƽƻ"))); - refTableBeans.add(new RefTableBean(new SimpleStringProperty(""),new SimpleStringProperty("//Ʒļ"))); - refTableBeans.add(new RefTableBean(new SimpleStringProperty(""),new SimpleStringProperty("Ӧ̲Ʒ鱨"))); - refTableBeans.add(new RefTableBean(new SimpleStringProperty(""),new SimpleStringProperty("ͻŵļ"))); - - refTableBeans.add(new RefTableBean(new SimpleStringProperty(""),new SimpleStringProperty("ϵʶл"))); - refTableBeans.add(new RefTableBean(new SimpleStringProperty(""),new SimpleStringProperty("Ʒȷϼ"))); - refTableBeans.add(new RefTableBean(new SimpleStringProperty(""),new SimpleStringProperty("Ʒȷϼ"))); - refTableBeans.add(new RefTableBean(new SimpleStringProperty(""),new SimpleStringProperty("ƻȷϼ"))); - - refTableBeans.add(new RefTableBean(new SimpleStringProperty("ɹ"),new SimpleStringProperty("ɹ۸仯"))); - refTableBeans.add(new RefTableBean(new SimpleStringProperty("ɹ"),new SimpleStringProperty("Ϣ(ϡ۸)"))); - refTableBeans.add(new RefTableBean(new SimpleStringProperty("ɹ"),new SimpleStringProperty("ϸ񹩷ۣʱ"))); - refTableBeans.add(new RefTableBean(new SimpleStringProperty("ɹ"),new SimpleStringProperty("Ӧ̺ͬ޸"))); - refTableBeans.add(new RefTableBean(new SimpleStringProperty("ɹ"),new SimpleStringProperty("Ӧ̴Ʒȷ"))); - - refTableBeans.add(new RefTableBean(new SimpleStringProperty(""),new SimpleStringProperty("֪ͨͻ"))); - refTableBeans.add(new RefTableBean(new SimpleStringProperty(""),new SimpleStringProperty("ͻ׼"))); - refTableBeans.add(new RefTableBean(new SimpleStringProperty(""),new SimpleStringProperty("޸ĿͻЭ"))); - - refTableBeans.add(new RefTableBean(new SimpleStringProperty(""),new SimpleStringProperty("ۼ۸仯"))); - - refTable.getItems().addAll(refTableBeans); - - + deapart.prefWidthProperty().bind(refTable.widthProperty().multiply(0.14)); + message.prefWidthProperty().bind(refTable.widthProperty().multiply(0.36)); + shYes.prefWidthProperty().bind(refTable.widthProperty().multiply(0.05)); + shNo.prefWidthProperty().bind(refTable.widthProperty().multiply(0.05)); + user.prefWidthProperty().bind(refTable.widthProperty().multiply(0.13)); + compDate.prefWidthProperty().bind(refTable.widthProperty().multiply(0.13)); + mark.prefWidthProperty().bind(refTable.widthProperty().multiply(0.14)); + List refTableBeans = new ArrayList(); + // ʼ д + refTableBeans.add(new RefTableBean(new SimpleStringProperty(""), new SimpleStringProperty("ƷͼĿ¼Ƶ"))); + refTableBeans.add( + new RefTableBean(new SimpleStringProperty(""), new SimpleStringProperty("DFMEAƷҪȷּ"))); + refTableBeans.add(new RefTableBean(new SimpleStringProperty(""), new SimpleStringProperty("BOMϸ"))); + refTableBeans.add(new RefTableBean(new SimpleStringProperty(""), new SimpleStringProperty("װͼ/淶"))); + refTableBeans.add(new RefTableBean(new SimpleStringProperty(""), new SimpleStringProperty("ǩ"))); + refTableBeans.add(new RefTableBean(new SimpleStringProperty(""), new SimpleStringProperty("ͻŵļ"))); + refTableBeans.add(new RefTableBean(new SimpleStringProperty(""), new SimpleStringProperty("Ҫ"))); + + refTableBeans + .add(new RefTableBean(new SimpleStringProperty("ղ"), new SimpleStringProperty("ͼPFMEA"))); + refTableBeans.add(new RefTableBean(new SimpleStringProperty("ղ"), new SimpleStringProperty("ҵָ顢װָ"))); + refTableBeans.add(new RefTableBean(new SimpleStringProperty("ղ"), new SimpleStringProperty("ͻŵعļ"))); + refTableBeans.add(new RefTableBean(new SimpleStringProperty("ղ"), new SimpleStringProperty("ģߡװ豸"))); + + refTableBeans.add(new RefTableBean(new SimpleStringProperty(""), new SimpleStringProperty("Ƽƻ"))); + refTableBeans.add(new RefTableBean(new SimpleStringProperty(""), new SimpleStringProperty("//Ʒļ"))); + refTableBeans.add(new RefTableBean(new SimpleStringProperty(""), new SimpleStringProperty("Ӧ̲Ʒ鱨"))); + refTableBeans.add(new RefTableBean(new SimpleStringProperty(""), new SimpleStringProperty("ͻŵļ"))); + + refTableBeans.add(new RefTableBean(new SimpleStringProperty(""), new SimpleStringProperty("ϵʶл"))); + refTableBeans.add(new RefTableBean(new SimpleStringProperty(""), new SimpleStringProperty("Ʒȷϼ"))); + refTableBeans.add(new RefTableBean(new SimpleStringProperty(""), new SimpleStringProperty("Ʒȷϼ"))); + refTableBeans.add(new RefTableBean(new SimpleStringProperty(""), new SimpleStringProperty("ƻȷϼ"))); + + refTableBeans.add(new RefTableBean(new SimpleStringProperty("ɹ"), new SimpleStringProperty("ɹ۸仯"))); + refTableBeans.add(new RefTableBean(new SimpleStringProperty("ɹ"), new SimpleStringProperty("Ϣ(ϡ۸)"))); + refTableBeans.add(new RefTableBean(new SimpleStringProperty("ɹ"), new SimpleStringProperty("ϸ񹩷ۣʱ"))); + refTableBeans.add(new RefTableBean(new SimpleStringProperty("ɹ"), new SimpleStringProperty("Ӧ̺ͬ޸"))); + refTableBeans.add(new RefTableBean(new SimpleStringProperty("ɹ"), new SimpleStringProperty("Ӧ̴Ʒȷ"))); + + refTableBeans.add(new RefTableBean(new SimpleStringProperty(""), new SimpleStringProperty("֪ͨͻ"))); + refTableBeans.add(new RefTableBean(new SimpleStringProperty(""), new SimpleStringProperty("ͻ׼"))); + refTableBeans.add(new RefTableBean(new SimpleStringProperty(""), new SimpleStringProperty("޸ĿͻЭ"))); + + refTableBeans.add(new RefTableBean(new SimpleStringProperty(""), new SimpleStringProperty("ۼ۸仯"))); + + refTable.getItems().addAll(refTableBeans); + } - // + + // /** * @param frame * @function ҳļ @@ -898,143 +901,149 @@ public class CreateEcnController extends KFXPanelController { private void addWindListener(CreateEcnFrame frame) { // TODO Auto-generated method stub - frame.addComponentListener(new ComponentListener() { - + 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("=============="); double width = e.getComponent().getSize().getWidth(); // // double width = primaryStage.getWidth(); - System.out.println("width==>"+width); - scollPane.setPrefWidth(width * 0.98); - gridPane.setPrefWidth(width * 0.98); - tableView.setPrefWidth(width * 0.97); - refTable.setPrefWidth(width * 0.97); + System.out.println("width==>" + width); + scollPane.setPrefWidth(width * 0.98); + gridPane.setPrefWidth(width * 0.98); + tableView.setPrefWidth(width * 0.97); + 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 - + } }); - - SqlUtil.getTCDataConnection(database); - try { - - String sql = "select PART,REASON,MANAGE,DATASET,UNIT,GRADE from CHINT_ECN_TYPE where CODE = ?"; - ResultSet read = SqlUtil.read(sql, new String[] {SAPUtil.getGroupID()}); - if(read.next()) { - String part = read.getString(1); - String reason = read.getString(2); - String manage = read.getString(3); - String dataset = read.getString(4); - String factory = read.getString(5); - String grade = read.getString(6); - factoryText.setText(factory); - String[] partArray = part.split(";"); - String[] reasonArray = reason.split(";"); - String[] manageArray = manage.split(";"); - String[] grades = grade.split(";"); - parts = new ArrayList(Arrays.asList(partArray)); - reasons = new ArrayList(Arrays.asList(reasonArray)); - wips = new ArrayList(Arrays.asList(manageArray)); - products = new ArrayList(Arrays.asList(grades)); - } - - }catch(Exception e) { - e.printStackTrace(); - }finally { - SqlUtil.freeAll(); - } - + + SqlUtil.getTCDataConnection(database); + try { + + String sql = "select PART,REASON,MANAGE,DATASET,UNIT,GRADE from CHINT_ECN_TYPE where CODE = ?"; + ResultSet read = SqlUtil.read(sql, new String[] { SAPUtil.getGroupID() }); + if (read.next()) { + String part = read.getString(1); + String reason = read.getString(2); + String manage = read.getString(3); + String dataset = read.getString(4); + String factory = read.getString(5); + String grade = read.getString(6); + factoryText.setText(factory); + String[] partArray = part.split(";"); + String[] reasonArray = reason.split(";"); + String[] manageArray = manage.split(";"); + String[] grades = grade.split(";"); + parts = new ArrayList(Arrays.asList(partArray)); + reasons = new ArrayList(Arrays.asList(reasonArray)); + wips = new ArrayList(Arrays.asList(manageArray)); + products = new ArrayList(Arrays.asList(grades)); + } + + } catch (Exception e) { + e.printStackTrace(); + } finally { + SqlUtil.freeAll(); + } + } - + /** * @param event * @function 5 */ @FXML - void addRows(ActionEvent event) { - for(int i=0;i<5;i++) { - ecnBeans.add(new EcnBean(ecnBeans.size()+1, reasons, wips, products)); - } - ObservableList data = FXCollections.observableArrayList(ecnBeans); - tableView.getItems().clear(); + void addRows(ActionEvent event) { + for (int i = 0; i < 5; i++) { + ecnBeans.add(new EcnBean(ecnBeans.size() + 1, reasons, wips, products)); + } + ObservableList data = FXCollections.observableArrayList(ecnBeans); + tableView.getItems().clear(); tableView.setItems(data); - } - /** - * @param event - * @function - */ - @FXML - void addRow(ActionEvent event) { - ecnBeans.add(new EcnBean(ecnBeans.size()+1, reasons, wips, products)); - ObservableList data = FXCollections.observableArrayList(ecnBeans); - tableView.getItems().clear(); + } + + /** + * @param event + * @function + */ + @FXML + void addRow(ActionEvent event) { + ecnBeans.add(new EcnBean(ecnBeans.size() + 1, reasons, wips, products)); + ObservableList data = FXCollections.observableArrayList(ecnBeans); + tableView.getItems().clear(); tableView.setItems(data); - } - /** - * @param event - * @function ɾ - */ - @FXML - void deleteRow(ActionEvent event) { - int selectedIndex = tableView.getSelectionModel().getSelectedIndex(); - System.out.println("selectedIndex==>"+selectedIndex); - ecnBeans.remove(selectedIndex); - for(int i=selectedIndex;i data = FXCollections.observableArrayList(ecnBeans); - tableView.getItems().clear(); + } + + /** + * @param event + * @function ɾ + */ + @FXML + void deleteRow(ActionEvent event) { + int selectedIndex = tableView.getSelectionModel().getSelectedIndex(); + System.out.println("selectedIndex==>" + selectedIndex); + ecnBeans.remove(selectedIndex); + for (int i = selectedIndex; i < ecnBeans.size(); i++) { + ecnBeans.get(i).setNum(new SimpleIntegerProperty(i + 1)); + } + ObservableList data = FXCollections.observableArrayList(ecnBeans); + tableView.getItems().clear(); tableView.setItems(data); - } - /** - * @param event - * @function ָɰť - */ - @FXML - void assignClick(ActionEvent event) { + } + + /** + * @param event + * @function ָɰť + */ + @FXML + void assignClick(ActionEvent event) { // rb_tempChange // assignBtn ecnId - try { - AssignIdDialog dialog = new AssignIdDialog(session,SAPUtil.getGroupID(),ecnId,target,rb_tempChange.isSelected(),assignBtn); + try { + AssignIdDialog dialog = new AssignIdDialog(session, SAPUtil.getGroupID(), ecnId, target, + rb_tempChange.isSelected(), assignBtn); dialog.start(new Stage()); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } - } - @FXML - public TextField relateEcnText; - /** - * @param event - * @function 뵥ť - */ - @FXML - void relateClick(ActionEvent event) { - RelateEcnDialog dialog = new RelateEcnDialog(session,controller); - try { + } + + @FXML + public TextField relateEcnText; + + /** + * @param event + * @function 뵥ť + */ + @FXML + void relateClick(ActionEvent event) { + RelateEcnDialog dialog = new RelateEcnDialog(session, controller); + try { dialog.start(new Stage()); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } - - } + + } } diff --git a/com.connor.chint.wuhan/src/com/chint/plm/createEcn/CreateEcnFrame.java b/com.connor.chint.wuhan/src/com/chint/plm/createEcn/CreateEcnFrame.java index dbc02b6..fb76417 100644 --- a/com.connor.chint.wuhan/src/com/chint/plm/createEcn/CreateEcnFrame.java +++ b/com.connor.chint.wuhan/src/com/chint/plm/createEcn/CreateEcnFrame.java @@ -8,7 +8,7 @@ import com.chint.plm.fxUtil.KFrame; import javafx.embed.swing.JFXPanel; -public class CreateEcnFrame extends KFrame{ +public class CreateEcnFrame extends KFrame { public CreateEcnFrame() { super(); diff --git a/com.connor.chint.wuhan/src/com/chint/plm/createEcn/CreateEcnPanel.java b/com.connor.chint.wuhan/src/com/chint/plm/createEcn/CreateEcnPanel.java index 4ea8bd4..a80bf4c 100644 --- a/com.connor.chint.wuhan/src/com/chint/plm/createEcn/CreateEcnPanel.java +++ b/com.connor.chint.wuhan/src/com/chint/plm/createEcn/CreateEcnPanel.java @@ -4,10 +4,10 @@ import java.awt.Window; import com.chint.plm.fxUtil.KFXPanel; -public class CreateEcnPanel extends KFXPanel{ +public class CreateEcnPanel extends KFXPanel { public CreateEcnPanel(Window dialog) { - super(dialog,"ChangeNoticePanel.fxml"); + super(dialog, "ChangeNoticePanel.fxml"); // TODO Auto-generated constructor stub } } 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 988fb14..596ff89 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 @@ -1,6 +1,5 @@ package com.chint.plm.createEcn; - import java.util.ArrayList; import java.util.List; @@ -10,84 +9,87 @@ import javafx.scene.control.ComboBox; 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();//Ʒ - + 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();// Ʒ + public ComboBox getProductSz() { return productSz; } + public void setProductSz(String productSz) { this.productSz.getSelectionModel().select(productSz); } - EcnBean(int ind, List reasons, List wips,List products) { + + EcnBean(int ind, List reasons, List wips, List products) { num = new SimpleIntegerProperty(ind); - drawNo = new TextArea(); //ComboBoxTextArea + drawNo = new TextArea(); // ComboBoxTextArea drawNo.setPrefSize(200, 40); - - mark = new TextArea(); //ComboBoxTextArea + + mark = new TextArea(); // ComboBoxTextArea mark.setPrefSize(200, 40); - - poiNum = new TextArea(); //ComboBoxTextArea + + poiNum = new TextArea(); // ComboBoxTextArea poiNum.setPrefSize(200, 40); - - overChange = new TextArea(); //ComboBoxTextArea + + overChange = new TextArea(); // ComboBoxTextArea overChange.setPrefSize(200, 40); - - overVersion = new TextArea(); //ComboBoxTextArea + + overVersion = new TextArea(); // ComboBoxTextArea overVersion.setPrefSize(200, 40); - - afterChange = new TextArea(); //ComboBoxTextArea + + afterChange = new TextArea(); // ComboBoxTextArea afterChange.setPrefSize(200, 40); - - afterVersion = new TextArea(); //ComboBoxTextArea + + afterVersion = new TextArea(); // ComboBoxTextArea afterVersion.setPrefSize(200, 40); wipTreat.getItems().addAll(wips); productSz.getItems().addAll(products); productSz.getSelectionModel().selectFirst(); changeReason.getItems().addAll(reasons); } - EcnBean(int ind, List reasons, List wips, String drawNoVal, String markVal, - String placesNo, String changeBefore, String changeAfter, String reasonVal, String processType, - String szRevisionBef, String szRevisionAft) { + + EcnBean(int ind, List reasons, List wips, String drawNoVal, String markVal, String placesNo, + String changeBefore, String changeAfter, String reasonVal, String processType, String szRevisionBef, + String szRevisionAft) { num = new SimpleIntegerProperty(ind); - drawNo = new TextArea(); //ComboBoxTextArea + drawNo = new TextArea(); // ComboBoxTextArea drawNo.setPrefSize(200, 40); drawNo.setText(drawNoVal); - - mark = new TextArea(); //ComboBoxTextArea + + mark = new TextArea(); // ComboBoxTextArea mark.setPrefSize(200, 40); mark.setText(markVal); - - poiNum = new TextArea(); //ComboBoxTextArea + + poiNum = new TextArea(); // ComboBoxTextArea poiNum.setPrefSize(200, 40); poiNum.setText(placesNo); - - overChange = new TextArea(); //ComboBoxTextArea + + overChange = new TextArea(); // ComboBoxTextArea overChange.setPrefSize(200, 40); overChange.setText(changeBefore); - - overVersion = new TextArea(); //ComboBoxTextArea + + overVersion = new TextArea(); // ComboBoxTextArea overVersion.setPrefSize(200, 40); overVersion.setText(szRevisionBef); - - afterChange = new TextArea(); //ComboBoxTextArea + + afterChange = new TextArea(); // ComboBoxTextArea afterChange.setPrefSize(200, 40); afterChange.setText(changeAfter); - - afterVersion = new TextArea(); //ComboBoxTextArea + + afterVersion = new TextArea(); // ComboBoxTextArea afterVersion.setPrefSize(200, 40); afterVersion.setText(szRevisionAft); - + wipTreat.getItems().addAll(wips); wipTreat.getSelectionModel().select(processType); changeReason.getItems().addAll(reasons); @@ -174,6 +176,4 @@ public class EcnBean { this.wipTreat = wipTreat; } - - } diff --git a/com.connor.chint.wuhan/src/com/chint/plm/createEcn/Util.java b/com.connor.chint.wuhan/src/com/chint/plm/createEcn/Util.java index 1f56910..5e55766 100644 --- a/com.connor.chint.wuhan/src/com/chint/plm/createEcn/Util.java +++ b/com.connor.chint.wuhan/src/com/chint/plm/createEcn/Util.java @@ -18,6 +18,9 @@ import org.apache.poi.hssf.usermodel.HSSFSheet; import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.util.CellRangeAddress; +import org.apache.poi.xssf.usermodel.XSSFCell; +import org.apache.poi.xssf.usermodel.XSSFRow; +import org.apache.poi.xssf.usermodel.XSSFSheet; import com.connor.chint.sap2.util.KUtil; import com.connor.chint.sap2.util.POIUtil; @@ -26,6 +29,7 @@ import com.teamcenter.rac.kernel.TCComponent; import com.teamcenter.rac.kernel.TCComponentDataset; import com.teamcenter.rac.kernel.TCComponentTcFile; import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCPreferenceService; import com.teamcenter.rac.kernel.TCSession; import com.teamcenter.rac.util.MessageBox; @@ -52,6 +56,60 @@ public class Util { return conn; } + /** + * + * @param session + * @param PreServiceName:ѡ + * @param Filetype:excelͣMSExcelX + * @return + */ + public static File getFile(TCSession session,String PreServiceName,String Filetype) { + TCPreferenceService service = session.getPreferenceService(); + String puid = service.getStringValue(PreServiceName); + if (puid == null) + { + System.out.println("δҵѡ"); + return null; + } + TCComponentDataset dat; + try { + dat = (TCComponentDataset)session + .stringToComponent(puid); + + TCComponentTcFile[] tcFile = dat.getTcFiles(); + if(tcFile != null && tcFile.length == 0) + { + System.out.println("δҵļ"); + } + else + { + return tcFile[0].getFmsFile(); + } + } catch (TCException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + return null; + } + private static void setCellValue(XSSFCell cell2,int index,XSSFRow row0,String cellValue) { + // TODO Auto-generated method stub + + if(cell2 == null) { + cell2 = row0.createCell(index); + } + + cell2.setCellValue(cellValue); + + } + private static XSSFRow getRow(XSSFSheet sheetAt,int rowNum) { + // TODO Auto-generated method stub + + XSSFRow row = sheetAt.getRow(rowNum); + if(row ==null) { + row = sheetAt.createRow(rowNum); + } + return row; + } /** * @param dateset * @return ģļ