no-bomasyn
陈翼晖 2 years ago
parent 9ff0ba569d
commit 797a584fa6

@ -46,6 +46,15 @@ public class AssignIdController{
@FXML @FXML
private ComboBox<String> factoryComb; private ComboBox<String> 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) { public void initData(TCSession session,String groupID,TextField field,TCComponent tar,boolean flag,Button assignBtn) {
// TODO Auto-generated method stub // TODO Auto-generated method stub
this.groupID = groupID; this.groupID = groupID;
@ -131,6 +140,10 @@ public class AssignIdController{
} }
/**
*
* @function
*/
public void getCombox() { public void getCombox() {
//根据首选项获取工厂和部门 //根据首选项获取工厂和部门
String[] FO = session.getPreferenceService().getStringValues("CHINT_FAC_OFF"); String[] FO = session.getPreferenceService().getStringValues("CHINT_FAC_OFF");
@ -159,6 +172,7 @@ public class AssignIdController{
//初始化下拉框的逻辑 //初始化下拉框的逻辑
factoryComb.getItems().addAll(facList); factoryComb.getItems().addAll(facList);
factoryComb.getSelectionModel().select(first_FO); factoryComb.getSelectionModel().select(first_FO);
//添加监听 动态设置下拉框内容
factoryComb.valueProperty().addListener((obs, oldVal, newVal) -> { factoryComb.valueProperty().addListener((obs, oldVal, newVal) -> {
System.out.println("选择了:" + newVal); System.out.println("选择了:" + newVal);
String index = factoryComb.getSelectionModel().getSelectedItem(); String index = factoryComb.getSelectionModel().getSelectedItem();
@ -175,6 +189,7 @@ public class AssignIdController{
List<String> init = foMap.get(factoryComb.getSelectionModel().getSelectedItem()); List<String> init = foMap.get(factoryComb.getSelectionModel().getSelectedItem());
bmComb.getItems().addAll(init); bmComb.getItems().addAll(init);
//添加监听 预览信息
bmComb.valueProperty().addListener((obs, oldVal, newVal) -> { bmComb.valueProperty().addListener((obs, oldVal, newVal) -> {
System.out.println("选择了:" + newVal); System.out.println("选择了:" + newVal);
SimpleDateFormat sdf = new SimpleDateFormat("yy"); SimpleDateFormat sdf = new SimpleDateFormat("yy");
@ -224,51 +239,23 @@ public class AssignIdController{
// comBoxOffice = new JComboBox(new DefaultComboBoxModel<String>(init.toArray(new String[init.size()]))); // comBoxOffice = new JComboBox(new DefaultComboBoxModel<String>(init.toArray(new String[init.size()])));
System.out.println("first_FO:" + first_FO); System.out.println("first_FO:" + first_FO);
if (tar.getType().equals("ZT2_Change")) { // if (tar.getType().equals("ZT2_Change")) {
String[] fo = null; // String[] fo = null;
try { // try {
fo = selectFO(tar.getProperty("item_id").split("-")[0]); // fo = selectFO(tar.getProperty("item_id").split("-")[0]);
} catch (TCException e1) { // } catch (TCException e1) {
e1.printStackTrace(); // e1.printStackTrace();
} // }
factoryComb.getSelectionModel().select(fo[0]); // factoryComb.getSelectionModel().select(fo[0]);
bmComb.getSelectionModel().select(fo[1]); // bmComb.getSelectionModel().select(fo[1]);
factoryComb.setDisable(true); // factoryComb.setDisable(true);
bmComb.setDisable(true); // bmComb.setDisable(true);
} // }
if (tar.getType().equals("ZT2_Change")) { // if (tar.getType().equals("ZT2_Change")) {
assignBtn.setDisable(true); // assignBtn.setDisable(true);
} else { // } else {
//
} // }
} }
private Util util = new Util(); 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;
}
} }

@ -191,11 +191,11 @@ public class CreateEcnController extends KFXPanelController {
} }
// dataset=(TCComponentDataset) item.getRelatedComponents("IMAN_reference")[0]; // dataset=(TCComponentDataset) item.getRelatedComponents("IMAN_reference")[0];
TCComponentDataset datasetM = getDataset(type, 0); TCComponentDataset datasetM = getDataset(type, 0);
file = getExcel(datasetM); file = Util.getExcel(datasetM);
createOrReplace(dataset, file, changeName); createOrReplace(dataset, file, changeName);
} else { } else {
dataset = getDataset(type, 1); dataset = getDataset(type, 1);
file = getExcel(dataset); file = Util.getExcel(dataset);
createOrReplace(dataset, file, changeName); createOrReplace(dataset, file, changeName);
item.setRelated("IMAN_reference", new TCComponent[] { dataset }); item.setRelated("IMAN_reference", new TCComponent[] { dataset });
} }
@ -240,7 +240,7 @@ public class CreateEcnController extends KFXPanelController {
dataset = getDataset(type, 1); dataset = getDataset(type, 1);
item.setProperty("zt2_WBSNo", zt2_WBSNo); item.setProperty("zt2_WBSNo", zt2_WBSNo);
File file = getExcel(dataset); File file = Util.getExcel(dataset);
createOrReplace(dataset, file, changeName); createOrReplace(dataset, file, changeName);
@ -417,27 +417,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 contractNo; //ºÏͬ´úºÅ
private String contractName;//ºÏͬÃû³Æ private String contractName;//ºÏͬÃû³Æ
private String productModel; //²úÆ·ÐͺŠprivate String productModel; //²úÆ·ÐͺÅ

@ -98,11 +98,11 @@ public class RelateEcnController {
this.controller = controller; this.controller = controller;
this.session = session; this.session = session;
initTable(); initTable();
} }
/* /**
* bean *
* @function
*/ */
private void initTable() { private void initTable() {
// TODO Auto-generated method stub // TODO Auto-generated method stub
@ -150,6 +150,10 @@ public class RelateEcnController {
importBtnCol.prefWidthProperty().bind(tableView.widthProperty().multiply(0.10)); importBtnCol.prefWidthProperty().bind(tableView.widthProperty().multiply(0.10));
} }
/**
* @param event
* @function
*/
@FXML @FXML
void searchClick(ActionEvent event) { void searchClick(ActionEvent event) {
String[] prefs = ChintPreferenceUtil.getPreferences("database_tc", session); String[] prefs = ChintPreferenceUtil.getPreferences("database_tc", session);
@ -200,16 +204,20 @@ public class RelateEcnController {
SqlUtil.freeAll(); SqlUtil.freeAll();
} }
} }
/* /**
* * @param event
* @function
*/ */
@FXML @FXML
void closeClick(ActionEvent event) { void closeClick(ActionEvent event) {
Stage stage = (Stage)prodModelText.getScene().getWindow(); Stage stage = (Stage)prodModelText.getScene().getWindow();
stage.close(); stage.close();
} }
/* /**
* SQL * @param searchSqlBuff sql
* @param textField
* @param baseName
* @function SQL
*/ */
void appendSqlBuild(StringBuilder searchSqlBuff,TextField textField,String baseName) { void appendSqlBuild(StringBuilder searchSqlBuff,TextField textField,String baseName) {
String text = textField.getText(); String text = textField.getText();

@ -23,8 +23,11 @@ import com.connor.chint.sap2.util.KUtil;
import com.connor.chint.sap2.util.POIUtil; import com.connor.chint.sap2.util.POIUtil;
import com.teamcenter.rac.aif.kernel.AIFComponentContext; import com.teamcenter.rac.aif.kernel.AIFComponentContext;
import com.teamcenter.rac.kernel.TCComponent; 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.TCException;
import com.teamcenter.rac.kernel.TCSession; import com.teamcenter.rac.kernel.TCSession;
import com.teamcenter.rac.util.MessageBox;
public class Util { public class Util {
public Connection connect(Connection conn, TCSession session) { public Connection connect(Connection conn, TCSession session) {
@ -49,7 +52,26 @@ public class Util {
return conn; 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 * @param target
* @return * @return

Loading…
Cancel
Save