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 dba562c..62d21f4 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/CreateEcnController$1.class b/com.connor.chint.wuhan/bin/com/chint/plm/createEcn/CreateEcnController$1.class index 410fd7d..8525b2c 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 931aa04..500c196 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/RelateEcnController.class b/com.connor.chint.wuhan/bin/com/chint/plm/createEcn/RelateEcnController.class index 3ee2fe7..ea8bdea 100644 Binary files a/com.connor.chint.wuhan/bin/com/chint/plm/createEcn/RelateEcnController.class and b/com.connor.chint.wuhan/bin/com/chint/plm/createEcn/RelateEcnController.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 eb0660a..3b11a7e 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/src/com/chint/plm/createEcn/AssignIdController.java b/com.connor.chint.wuhan/src/com/chint/plm/createEcn/AssignIdController.java index b042a05..f645c1a 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 @@ -46,6 +46,15 @@ public class AssignIdController{ @FXML private ComboBox factoryComb; + /** + * @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) { // TODO Auto-generated method stub this.groupID = groupID; @@ -131,6 +140,10 @@ public class AssignIdController{ } + /** + * + * @function 根据首选项获取工厂和部门 + */ public void getCombox() { //根据首选项获取工厂和部门 String[] FO = session.getPreferenceService().getStringValues("CHINT_FAC_OFF"); @@ -159,6 +172,7 @@ public class AssignIdController{ //初始化下拉框的逻辑 factoryComb.getItems().addAll(facList); factoryComb.getSelectionModel().select(first_FO); + //添加监听 动态设置下拉框内容 factoryComb.valueProperty().addListener((obs, oldVal, newVal) -> { System.out.println("选择了:" + newVal); String index = factoryComb.getSelectionModel().getSelectedItem(); @@ -175,6 +189,7 @@ public class AssignIdController{ 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"); @@ -224,51 +239,23 @@ public class AssignIdController{ // comBoxOffice = new JComboBox(new DefaultComboBoxModel(init.toArray(new String[init.size()]))); System.out.println("first_FO:" + first_FO); - if (tar.getType().equals("ZT2_Change")) { - String[] fo = null; - try { - fo = selectFO(tar.getProperty("item_id").split("-")[0]); - } catch (TCException e1) { - e1.printStackTrace(); - } - factoryComb.getSelectionModel().select(fo[0]); - bmComb.getSelectionModel().select(fo[1]); - factoryComb.setDisable(true); - bmComb.setDisable(true); - } - if (tar.getType().equals("ZT2_Change")) { - assignBtn.setDisable(true); - } else { - - } +// if (tar.getType().equals("ZT2_Change")) { +// String[] fo = null; +// try { +// fo = selectFO(tar.getProperty("item_id").split("-")[0]); +// } catch (TCException e1) { +// e1.printStackTrace(); +// } +// factoryComb.getSelectionModel().select(fo[0]); +// bmComb.getSelectionModel().select(fo[1]); +// factoryComb.setDisable(true); +// bmComb.setDisable(true); +// } +// if (tar.getType().equals("ZT2_Change")) { +// assignBtn.setDisable(true); +// } else { +// +// } } private Util util = new Util(); - private String[] selectFO(String searchword) { - String[] FO = new String[2]; - try { - Connection conn = null; - conn = util.connect(conn, session); - String query = "select FACTORY,OFFICE from CHINT_ECN_CODE where CODE like '" + searchword + "-%'"; - System.out.println(query); - - Statement stmt = conn.createStatement(); - ResultSet rs_get = null; - rs_get = stmt.executeQuery(query); - if (rs_get.next()) { - String FACTORY = rs_get.getString("FACTORY"); - FO[0] = FACTORY; - String OFFICE = rs_get.getString("OFFICE"); - FO[1] = OFFICE; - } - if (rs_get != null) { - rs_get.close(); - } - util.disconnect(conn, stmt, rs_get); - } catch (SQLException e1) { - e1.printStackTrace(); - } catch (Exception e2) { - e2.printStackTrace(); - } - return FO; - } } 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 25bd501..1a0fc87 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 @@ -191,11 +191,11 @@ public class CreateEcnController extends KFXPanelController { } // dataset=(TCComponentDataset) item.getRelatedComponents("IMAN_reference")[0]; TCComponentDataset datasetM = getDataset(type, 0); - file = getExcel(datasetM); + file = Util.getExcel(datasetM); createOrReplace(dataset, file, changeName); } else { dataset = getDataset(type, 1); - file = getExcel(dataset); + file = Util.getExcel(dataset); createOrReplace(dataset, file, changeName); item.setRelated("IMAN_reference", new TCComponent[] { dataset }); } @@ -240,7 +240,7 @@ public class CreateEcnController extends KFXPanelController { dataset = getDataset(type, 1); item.setProperty("zt2_WBSNo", zt2_WBSNo); - File file = getExcel(dataset); + File file = Util.getExcel(dataset); createOrReplace(dataset, file, changeName); @@ -416,27 +416,6 @@ public class CreateEcnController extends KFXPanelController { } } - - - /* - * 获取变更单模板文件 - */ - private File getExcel(TCComponentDataset dateset) { - File fmsFile = null; - try { - TCComponentTcFile[] file = dateset.getTcFiles(); - if (file.length == 0 || file.length != 1) { - MessageBox.post("数据集没有命名引用的文件或文件过多,请检查!", "WARNING", MessageBox.WARNING); - return null; - } else { - fmsFile = file[0].getFmsFile(); - } - } catch (Exception e) { - e.printStackTrace(); - } - return fmsFile; - } - private String contractNo; //合同代号 private String contractName;//合同名称 diff --git a/com.connor.chint.wuhan/src/com/chint/plm/createEcn/RelateEcnController.java b/com.connor.chint.wuhan/src/com/chint/plm/createEcn/RelateEcnController.java index 9cbd805..78a3da3 100644 --- a/com.connor.chint.wuhan/src/com/chint/plm/createEcn/RelateEcnController.java +++ b/com.connor.chint.wuhan/src/com/chint/plm/createEcn/RelateEcnController.java @@ -98,12 +98,12 @@ public class RelateEcnController { this.controller = controller; this.session = session; initTable(); - } - /* - * 初始化表头,绑定bean对象 - */ + /** + * + * @function 初始化表格 + */ private void initTable() { // TODO Auto-generated method stub TableColumn numCol = new TableColumn("序号"); @@ -150,6 +150,10 @@ public class RelateEcnController { importBtnCol.prefWidthProperty().bind(tableView.widthProperty().multiply(0.10)); } + /** + * @param event + * @function 查询功能 + */ @FXML void searchClick(ActionEvent event) { String[] prefs = ChintPreferenceUtil.getPreferences("database_tc", session); @@ -200,16 +204,20 @@ public class RelateEcnController { SqlUtil.freeAll(); } } - /* - *关闭页面 + /** + * @param event + * @function 关闭页面 */ @FXML void closeClick(ActionEvent event) { Stage stage = (Stage)prodModelText.getScene().getWindow(); stage.close(); } - /* - * 根据组件拼接SQL + /** + * @param searchSqlBuff sql + * @param textField 文本 + * @param baseName 数据表中列名 + * @function 根据组件拼接SQL */ void appendSqlBuild(StringBuilder searchSqlBuff,TextField textField,String baseName) { String text = textField.getText(); 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 55525c9..1f56910 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 @@ -23,8 +23,11 @@ import com.connor.chint.sap2.util.KUtil; import com.connor.chint.sap2.util.POIUtil; import com.teamcenter.rac.aif.kernel.AIFComponentContext; 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.TCSession; +import com.teamcenter.rac.util.MessageBox; public class Util { public Connection connect(Connection conn, TCSession session) { @@ -49,7 +52,26 @@ public class Util { return conn; } - + /** + * @param dateset + * @return 变更单模板文件 + * @function 获取变更单模板文件 + */ + public static File getExcel(TCComponentDataset dateset) { + File fmsFile = null; + try { + TCComponentTcFile[] file = dateset.getTcFiles(); + if (file.length == 0 || file.length != 1) { + MessageBox.post("数据集没有命名引用的文件或文件过多,请检查!", "WARNING", MessageBox.WARNING); + return null; + } else { + fmsFile = file[0].getFmsFile(); + } + } catch (Exception e) { + e.printStackTrace(); + } + return fmsFile; + } /** * @param target项目或变更对象 * @return 项目名称