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