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

@ -46,6 +46,15 @@ public class AssignIdController{
@FXML
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) {
// 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<String> 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<String>(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;
}
}

@ -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);
@ -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 contractName;//ºÏͬÃû³Æ
private String productModel; //²úÆ·ÐͺÅ

@ -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<RelateEcnBean,SimpleStringProperty> numCol = new TableColumn<RelateEcnBean,SimpleStringProperty>("ÐòºÅ");
@ -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();

@ -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

Loading…
Cancel
Save