no-bomasyn
陈翼晖 2 years ago
parent d25571ebe1
commit b8a133df93

@ -22,7 +22,7 @@
<children> <children>
<FlowPane fx:id="flowPane" alignment="TOP_CENTER" prefHeight="200.0" prefWidth="200.0" style="-fx-padding: 5;"> <FlowPane fx:id="flowPane" alignment="TOP_CENTER" prefHeight="200.0" prefWidth="200.0" style="-fx-padding: 5;">
<children> <children>
<CheckBox fx:id="cb_errBtn" mnemonicParsing="false" onAction="#errBtnAction" text="仅显示错误数据" /> <CheckBox fx:id="cb_errBtn" mnemonicParsing="false" text="仅显示错误数据" />
</children> </children>
</FlowPane> </FlowPane>
<ScrollPane fx:id="scrollPane" prefHeight="1200.0" prefWidth="1200.0" style="-fx-padding: 5;" GridPane.rowIndex="1"> <ScrollPane fx:id="scrollPane" prefHeight="1200.0" prefWidth="1200.0" style="-fx-padding: 5;" GridPane.rowIndex="1">

@ -1,16 +1,25 @@
package com.chint.plm.SearchSapResult; package com.chint.plm.SearchSapResult;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; 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.ChintPreferenceUtil;
import com.connor.chint.sap2.util.SqlUtil; import com.connor.chint.sap2.util.SqlUtil;
import com.teamcenter.rac.aif.AbstractAIFApplication; import com.teamcenter.rac.aif.AbstractAIFApplication;
import com.teamcenter.rac.aifrcp.AIFUtility; import com.teamcenter.rac.aifrcp.AIFUtility;
import com.teamcenter.rac.kernel.TCSession; 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.SimpleIntegerProperty;
import javafx.beans.property.SimpleStringProperty; import javafx.beans.property.SimpleStringProperty;
import javafx.beans.value.ChangeListener; import javafx.beans.value.ChangeListener;
@ -18,6 +27,7 @@ import javafx.beans.value.ObservableValue;
import javafx.collections.FXCollections; import javafx.collections.FXCollections;
import javafx.collections.ObservableList; import javafx.collections.ObservableList;
import javafx.event.ActionEvent; import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.fxml.FXML; import javafx.fxml.FXML;
import javafx.scene.control.Button; import javafx.scene.control.Button;
import javafx.scene.control.CheckBox; import javafx.scene.control.CheckBox;
@ -27,6 +37,8 @@ import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView; import javafx.scene.control.TableView;
import javafx.scene.control.TextField; import javafx.scene.control.TextField;
import javafx.scene.control.cell.PropertyValueFactory; 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.FlowPane;
import javafx.scene.layout.GridPane; import javafx.scene.layout.GridPane;
import javafx.scene.layout.StackPane; import javafx.scene.layout.StackPane;
@ -62,8 +74,8 @@ public class DetailsController {
@FXML @FXML
private TableColumn<DetailsBean, String> tc_batch; private TableColumn<DetailsBean, String> tc_batch;
@FXML @FXML
private TextField pageNumTxt; private TextField pageNumTxt;
@FXML @FXML
private TableColumn<DetailsBean, String> tc_wbs; private TableColumn<DetailsBean, String> tc_wbs;
@FXML @FXML
@ -92,7 +104,10 @@ public class DetailsController {
private Button bt_all; private Button bt_all;
int pageNum = 0; int pageNum = 0;
List<List<DetailsBean>> tableBeans; List<List<DetailsBean>> tableBeans; // 记录表格里面的数据
List<List<DetailsBean>> errMsgBeans; // 记录错误的数据
List<List<DetailsBean>> allMsgBeans; // 记录全部数据
@FXML @FXML
void firstAction(ActionEvent event) { void firstAction(ActionEvent event) {
@ -155,23 +170,41 @@ public class DetailsController {
protected AbstractAIFApplication app; protected AbstractAIFApplication app;
private TCSession session; private TCSession session;
/** /**
* @param event * @param event
* @function * @function EXCEL
*/ */
@FXML @FXML
void outputAction(ActionEvent event) { 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<DetailsBean> detailList : tableBeans) {
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} }
private StringBuilder sqlTotal; private StringBuilder sqlTotal;
public void initData(Stage primaryStage, boolean onlyError, public void initData(Stage primaryStage, boolean onlyError, StringBuilder sqlTotal) {
StringBuilder sqlTotal) {
// TODO Auto-generated method stub // TODO Auto-generated method stub
this.sqlTotal = sqlTotal; this.sqlTotal = sqlTotal;
this.app = AIFUtility.getCurrentApplication(); this.app = AIFUtility.getCurrentApplication();
this.session = (TCSession) app.getSession(); this.session = (TCSession) app.getSession();
// 表格列绑定bean对象 // 表格列绑定bean对象
@ -200,7 +233,7 @@ public class DetailsController {
tc_returnTime.setCellValueFactory(new PropertyValueFactory<DetailsBean, String>("returnTime")); tc_returnTime.setCellValueFactory(new PropertyValueFactory<DetailsBean, String>("returnTime"));
tc_plm.setCellValueFactory(new PropertyValueFactory<DetailsBean, String>("plmStatus")); tc_plm.setCellValueFactory(new PropertyValueFactory<DetailsBean, String>("plmStatus"));
//绑定列宽 // 绑定列宽
tc_xh.prefWidthProperty().bind(tableView.widthProperty().multiply(0.05)); tc_xh.prefWidthProperty().bind(tableView.widthProperty().multiply(0.05));
tc_batch.prefWidthProperty().bind(tableView.widthProperty().multiply(0.08)); tc_batch.prefWidthProperty().bind(tableView.widthProperty().multiply(0.08));
tc_material.prefWidthProperty().bind(tableView.widthProperty().multiply(0.12)); 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_returnDate.prefWidthProperty().bind(tableView.widthProperty().multiply(0.08));
tc_returnTime.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)); tc_plm.prefWidthProperty().bind(tableView.widthProperty().multiply(0.07));
//触发查询,默认错误数据 // 触发查询,默认错误数据
try { try {
cb_errBtn.setSelected(true); cb_errBtn.setSelected(true);
searchErrMsg(); searchErrMsg();
@ -224,10 +257,10 @@ public class DetailsController {
ObservableList<DetailsBean> data = FXCollections.observableArrayList(tableBeans.get(0)); ObservableList<DetailsBean> data = FXCollections.observableArrayList(tableBeans.get(0));
tableView.getItems().clear(); tableView.getItems().clear();
tableView.setItems(data); tableView.setItems(data);
lb_page.setText("/"+tableBeans.size()); lb_page.setText("/" + tableBeans.size());
// this.tableBeans = tableBeans; // this.tableBeans = tableBeans;
//最大化绑定 // 最大化绑定
primaryStage.widthProperty().addListener(new ChangeListener<Number>() { primaryStage.widthProperty().addListener(new ChangeListener<Number>() {
@Override @Override
public void changed(ObservableValue<? extends Number> observable, Number oldValue, Number newValue) { public void changed(ObservableValue<? extends Number> observable, Number oldValue, Number newValue) {
@ -242,71 +275,109 @@ public class DetailsController {
} }
}); });
primaryStage.setMaximized(true); primaryStage.setMaximized(true);
cb_errBtn.selectedProperty().addListener(new ChangeListener<Boolean>() {
@Override
public void changed(ObservableValue<? extends Boolean> 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<KeyEvent>() {
@Override
public void handle(KeyEvent event) {
if (event.getCode() == KeyCode.ENTER) {
// showHistoryWords(querybox.getText());
}
}
});
} }
private boolean flagEdit = true;
/** /**
* @param event * @param event
* @function * @function
*/ */
@FXML // @FXML
void errBtnAction(ActionEvent event) { // 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 * @throws Exception
* @function * @function
*/ */
private void searchErrMsg() throws Exception { private void searchErrMsg() throws Exception {
String[] prefs = ChintPreferenceUtil.getPreferences("database_tc", session);
// 单个BOM具体信息 : 全部状态. // 单个BOM具体信息 : 全部状态.
List<List<DetailsBean>> tableBeans = new ArrayList<List<DetailsBean>>(); List<List<DetailsBean>> tableBeans = new ArrayList<List<DetailsBean>>();
SqlUtil.getTCDataConnection(prefs); if (cb_errBtn.isSelected() && errMsgBeans.size() > 0) {
String sqlDetail = ""; tableBeans = errMsgBeans;
if (cb_errBtn.isSelected()) { } else if (!cb_errBtn.isSelected() && allMsgBeans.size() > 0) {
sqlDetail = sqlTotal.toString() + " and status = 'E' "; tableBeans = allMsgBeans;
} else { } else {
sqlDetail = sqlTotal.toString();// + " and status = 'S' "; String sqlDetail = "";
} if (cb_errBtn.isSelected()) {
ResultSet read = SqlUtil.read(sqlDetail); sqlDetail = sqlTotal.toString() + " and status = 'E' ";
int i = 1; } else {
List<DetailsBean> beanList = null; sqlDetail = sqlTotal.toString();// + " and status = 'S' ";
while (read.next()) { }
// 分页 20 查询结果放入表格 String[] prefs = ChintPreferenceUtil.getPreferences("database_tc", session);
DetailsBean sumBean = new DetailsBean(new SimpleIntegerProperty(i), SqlUtil.getTCDataConnection(prefs);
new SimpleStringProperty(read.getString(1)), new SimpleStringProperty(read.getString(2)), System.out.println("cb_errBtn" + cb_errBtn.isSelected());
new SimpleStringProperty(read.getString(3)), new SimpleStringProperty(read.getString(4)), System.out.println("sqlDetail" + sqlDetail.toString());
new SimpleStringProperty(read.getString(5)), new SimpleStringProperty(read.getString(6)), ResultSet read = SqlUtil.read(sqlDetail);
new SimpleStringProperty(read.getString(7)), new SimpleStringProperty(read.getString(8)), int i = 1;
new SimpleStringProperty(read.getString(9)), new SimpleStringProperty(read.getString(10))); List<DetailsBean> beanList = null;
if (i % 20 == 1) { 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<DetailsBean>();
tableBeans.add(beanList);
}
beanList.add(sumBean);
i = i + 1;
}
SqlUtil.freeAll();
if (tableBeans.size() == 0) {
beanList = new ArrayList<DetailsBean>(); beanList = new ArrayList<DetailsBean>();
tableBeans.add(beanList); tableBeans.add(beanList);
} }
beanList.add(sumBean); if (errMsgBeans.size() == 0 && cb_errBtn.isSelected()) {
i = i + 1; errMsgBeans = tableBeans;
} } else if (allMsgBeans.size() == 0 && !cb_errBtn.isSelected()) {
SqlUtil.freeAll(); allMsgBeans = tableBeans;
if (tableBeans.size() == 0) { }
beanList = new ArrayList<DetailsBean>();
tableBeans.add(beanList);
} }
ObservableList<DetailsBean> data = FXCollections.observableArrayList(tableBeans.get(0)); ObservableList<DetailsBean> data = FXCollections.observableArrayList(tableBeans.get(0));
tableView.getItems().clear(); tableView.getItems().clear();
tableView.setItems(data); tableView.setItems(data);
pageNum = 0; pageNum = 0;
this.tableBeans = tableBeans; this.tableBeans = tableBeans;
lb_page.setText("/"+tableBeans.size()); lb_page.setText("/" + tableBeans.size());
pageNumTxt.setText("1");
} }
} }

@ -272,7 +272,7 @@ public class SearchSapController extends KFXPanelController {
i = i + 1; i = i + 1;
} }
if (tableBeans.size() == 0) { if (tableBeans.size() == 0) {
MessageBox.post("未查询到传递记录.", "提示", 2); MessageBox.post(frame,"未查询到传递记录.", "提示", 2);
beanList = new ArrayList<SumTableBean>(); beanList = new ArrayList<SumTableBean>();
tableBeans.add(beanList); tableBeans.add(beanList);
} }
@ -308,7 +308,7 @@ public class SearchSapController extends KFXPanelController {
frame = (SapResultFrame) paramKFXPanel.getParentDialog(); frame = (SapResultFrame) paramKFXPanel.getParentDialog();
addWindListener(frame); addWindListener(frame);
frame.setExtendedState(JFrame.MAXIMIZED_BOTH); frame.setMaximumSize(frame.getMaximumSize());
System.out.println("frame==>" + frame); System.out.println("frame==>" + frame);
this.app = AIFUtility.getCurrentApplication(); this.app = AIFUtility.getCurrentApplication();
this.session = (TCSession) app.getSession(); this.session = (TCSession) app.getSession();
@ -383,7 +383,7 @@ public class SearchSapController extends KFXPanelController {
} }
}; };
}); });
// tableView.setMaxHeight(pageNum); // tableView.setMaxHeight(pageNum);
} }
@ -402,7 +402,7 @@ public class SearchSapController extends KFXPanelController {
sapStateList.add("PLM数据检查未通过"); sapStateList.add("PLM数据检查未通过");
sapStateList.add("未返回"); sapStateList.add("未返回");
sapStateList.add("处理中"); sapStateList.add("处理中");
sapStateList.add("全部返回"); sapStateList.add("全部成功");
sapStateList.add("部分失败"); sapStateList.add("部分失败");
cb_sapState.getItems().addAll(sapStateList); cb_sapState.getItems().addAll(sapStateList);
List<String> sapStatusList = new ArrayList<String>(); List<String> sapStatusList = new ArrayList<String>();

@ -22,7 +22,7 @@
<children> <children>
<FlowPane fx:id="flowPane" alignment="TOP_CENTER" prefHeight="200.0" prefWidth="200.0" style="-fx-padding: 5;"> <FlowPane fx:id="flowPane" alignment="TOP_CENTER" prefHeight="200.0" prefWidth="200.0" style="-fx-padding: 5;">
<children> <children>
<CheckBox fx:id="cb_errBtn" mnemonicParsing="false" onAction="#errBtnAction" text="仅显示错误数据" /> <CheckBox fx:id="cb_errBtn" mnemonicParsing="false" text="仅显示错误数据" />
</children> </children>
</FlowPane> </FlowPane>
<ScrollPane fx:id="scrollPane" prefHeight="1200.0" prefWidth="1200.0" style="-fx-padding: 5;" GridPane.rowIndex="1"> <ScrollPane fx:id="scrollPane" prefHeight="1200.0" prefWidth="1200.0" style="-fx-padding: 5;" GridPane.rowIndex="1">

@ -26,36 +26,38 @@ import javafx.scene.control.ComboBox;
import javafx.scene.control.TextField; import javafx.scene.control.TextField;
import javafx.stage.Stage; import javafx.stage.Stage;
public class AssignIdController{ public class AssignIdController {
private String groupID; private String groupID;
private TCSession session; private TCSession session;
private TextField field; private TextField field;
private TCComponent tar; private TCComponent tar;
private boolean flag; private boolean flag;
@FXML @FXML
private Button assignBtn; private Button assignBtn;
private Button assignBtnTop; //变更管理中的指派按钮 private Button assignBtnTop; // 变更管理中的指派按钮
@FXML @FXML
private TextField ylText; private TextField ylText;
@FXML @FXML
private Button closeBtn; private Button closeBtn;
@FXML @FXML
private ComboBox<String> bmComb; private ComboBox<String> bmComb;
@FXML
private ComboBox<String> factoryComb;
@FXML
private ComboBox<String> factoryComb;
/** /**
* @param session * @param session
* @param groupID ID * @param groupID ID
* @param field * @param field
* @param tar * @param tar
* @param flag * @param flag
* @param assignBtn * @param assignBtn
* @function * @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;
this.session = session; this.session = session;
@ -65,21 +67,22 @@ public class AssignIdController{
this.assignBtnTop = assignBtn; this.assignBtnTop = assignBtn;
getCombox(); getCombox();
} }
@FXML
void okBtnClick(ActionEvent event) { @FXML
SimpleDateFormat sdf = new SimpleDateFormat("yy"); void okBtnClick(ActionEvent event) {
SimpleDateFormat sdf = new SimpleDateFormat("yy");
String year = sdf.format(new Date()); String year = sdf.format(new Date());
String fac = factoryComb.getSelectionModel().getSelectedItem(); String fac = factoryComb.getSelectionModel().getSelectedItem();
String off = bmComb.getSelectionModel().getSelectedItem(); String off = bmComb.getSelectionModel().getSelectedItem();
if(off.equals("-")) { if (off.equals("-")) {
off = ""; off = "";
} }
String TF = ""; String TF = "";
/// if(1==1) /// if(1==1)
// return; // return;
if (flag) { //临时 if (flag) { // 临时
TF = "L"; TF = "L";
} else { //if (TF.trim().equals("正式更改通知单")) } else { // if (TF.trim().equals("正式更改通知单"))
TF = ""; TF = "";
} }
String searchWord = fac.split("-")[0] + off.split("-")[0] + "-" + year + 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); FLOW = String.format("%04d", Integer.valueOf(FLOW) + 1);
query = "update CHINT_ECN_CODE set FLOW='" + FLOW + "' where CODE='" + searchWord + "'"; query = "update CHINT_ECN_CODE set FLOW='" + FLOW + "' where CODE='" + searchWord + "'";
} else { } else {
query = "insert into CHINT_ECN_CODE (FACTORY,OFFICE,CODE,FLOW) VALUES('" + fac + "','" + off query = "insert into CHINT_ECN_CODE (FACTORY,OFFICE,CODE,FLOW) VALUES('" + fac + "','" + off + "','"
+ "','" + searchWord + "','0002')"; + searchWord + "','0002')";
// query = "insert into CHINT_ECN_CODE (FACTORY,OFFICE,CODE,FLOW) VALUES('" + // query = "insert into CHINT_ECN_CODE (FACTORY,OFFICE,CODE,FLOW) VALUES('" +
// fac + "','" + off // fac + "','" + off
// + "','" + searchWord + "','0002')"; // + "','" + searchWord + "','0002')";
@ -122,32 +125,32 @@ public class AssignIdController{
} }
assignBtnTop.setDisable(true);// 只能指派一次 assignBtnTop.setDisable(true);// 只能指派一次
assignBtn.setDisable(true);// 只能指派一次 assignBtn.setDisable(true);// 只能指派一次
Stage stage = (Stage)closeBtn.getScene().getWindow(); Stage stage = (Stage) closeBtn.getScene().getWindow();
stage.close(); stage.close();
} }
@FXML
void cancelBtnClick(ActionEvent event) {
Stage stage = (Stage)closeBtn.getScene().getWindow();
stage.close();
}
@FXML @FXML
void selectDepart(ActionEvent event) { 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 * @function
*/ */
public void getCombox() { public void getCombox() {
//根据首选项获取工厂和部门 // 根据首选项获取工厂和部门
String[] FO = session.getPreferenceService().getStringValues("CHINT_FAC_OFF"); String[] FO = session.getPreferenceService().getStringValues("CHINT_FAC_OFF");
List<String> facList = new ArrayList<>(); List<String> facList = new ArrayList<>();
String first_FO = ""; String first_FO = "";
@ -171,40 +174,40 @@ public class AssignIdController{
// foMap.put(FO[i].split(":")[0], list); // foMap.put(FO[i].split(":")[0], list);
foMap.put(group, list); foMap.put(group, list);
} }
//初始化下拉框的逻辑 // 初始化下拉框的逻辑
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();
List<String> vector = foMap.get(index); List<String> vector = foMap.get(index);
bmComb.getItems().clear(); bmComb.getItems().clear();
bmComb.getItems().addAll(vector); bmComb.getItems().addAll(vector);
if(vector.size()==1 && vector.get(0).equals("-")) { if (vector.size() == 1 && vector.get(0).equals("-")) {
bmComb.setVisible(false); bmComb.setVisible(false);
}else { } else {
bmComb.setVisible(true); bmComb.setVisible(true);
} }
}); });
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");
String year = sdf.format(new Date()); String year = sdf.format(new Date());
String fac = factoryComb.getSelectionModel().getSelectedItem(); String fac = factoryComb.getSelectionModel().getSelectedItem();
String off = bmComb.getSelectionModel().getSelectedItem(); String off = bmComb.getSelectionModel().getSelectedItem();
if(off.equals("-")) { if (off.equals("-")) {
off = ""; off = "";
} }
String TF = ""; String TF = "";
if (flag) { //临时 if (flag) { // 临时
TF = "L"; TF = "L";
} else { //if (TF.trim().equals("正式更改通知单")) } else { // if (TF.trim().equals("正式更改通知单"))
TF = ""; TF = "";
} }
String searchWord = fac.split("-")[0] + off.split("-")[0] + "-" + year + TF; String searchWord = fac.split("-")[0] + off.split("-")[0] + "-" + year + TF;
@ -238,7 +241,7 @@ public class AssignIdController{
e1.printStackTrace(); e1.printStackTrace();
} }
}); });
// 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")) {
@ -259,5 +262,6 @@ public class AssignIdController{
// //
// } // }
} }
private Util util = new Util(); private Util util = new Util();
} }

@ -35,14 +35,16 @@ import javafx.scene.control.Button;
import javafx.scene.control.TextField; import javafx.scene.control.TextField;
import javafx.stage.Stage; import javafx.stage.Stage;
public class AssignIdDialog extends Application { public class AssignIdDialog extends Application {
private String groupID; private String groupID;
private TCSession session; private TCSession session;
private TextField field; private TextField field;
private TCComponent tar; private TCComponent tar;
private Button assignBtn; private Button assignBtn;
private boolean flag; 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(); super();
this.groupID = groupID; this.groupID = groupID;
this.session = session; this.session = session;
@ -51,19 +53,19 @@ public class AssignIdDialog extends Application {
this.flag = flag; this.flag = flag;
this.assignBtn = assignBtn; this.assignBtn = assignBtn;
} }
@Override @Override
public void start(Stage primaryStage) throws IOException { public void start(Stage primaryStage) throws IOException {
// StackPane root = new StackPane(); // StackPane root = new StackPane();
FXMLLoader fxmlLoader = new FXMLLoader(); FXMLLoader fxmlLoader = new FXMLLoader();
fxmlLoader.setLocation(getClass().getResource("AssignIdPane.fxml")); fxmlLoader.setLocation(getClass().getResource("AssignIdPane.fxml"));
Parent root = (Parent) fxmlLoader.load(); Parent root = (Parent) fxmlLoader.load();
Scene scene = new Scene(root, 400.0, 240.0); Scene scene = new Scene(root, 400.0, 240.0);
AssignIdController controller = (AssignIdController) fxmlLoader.getController(); AssignIdController controller = (AssignIdController) fxmlLoader.getController();
primaryStage.setTitle("֪ͨµ¥±àºÅ"); primaryStage.setTitle("֪ͨµ¥±àºÅ");
controller.initData(session,groupID,field,tar,flag,assignBtn); controller.initData(session, groupID, field, tar, flag, assignBtn);
primaryStage.setScene(scene); primaryStage.setScene(scene);
primaryStage.show(); primaryStage.show();
} }
} }

@ -7,18 +7,18 @@ import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent;
import com.teamcenter.rac.util.MessageBox; import com.teamcenter.rac.util.MessageBox;
public class CreateEcnCommond extends KCommand { public class CreateEcnCommond extends KCommand {
public CreateEcnCommond(AbstractAIFApplication app, String commandId, String actionInfo) { public CreateEcnCommond(AbstractAIFApplication app, String commandId, String actionInfo) {
super(app, commandId, actionInfo); super(app, commandId, actionInfo);
try { try {
InterfaceAIFComponent targetComponent = app.getTargetComponent(); 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(); new CreateEcnFrame();
}else { } else {
MessageBox.post("请选中项目零组件或者更改通知单或文件夹", "", MessageBox.ERROR); MessageBox.post("请选中项目零组件或者更改通知单或文件夹", "", MessageBox.ERROR);
} }
}catch(Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
} }

@ -8,7 +8,7 @@ import com.chint.plm.fxUtil.KFrame;
import javafx.embed.swing.JFXPanel; import javafx.embed.swing.JFXPanel;
public class CreateEcnFrame extends KFrame{ public class CreateEcnFrame extends KFrame {
public CreateEcnFrame() { public CreateEcnFrame() {
super(); super();

@ -4,10 +4,10 @@ import java.awt.Window;
import com.chint.plm.fxUtil.KFXPanel; import com.chint.plm.fxUtil.KFXPanel;
public class CreateEcnPanel extends KFXPanel{ public class CreateEcnPanel extends KFXPanel {
public CreateEcnPanel(Window dialog) { public CreateEcnPanel(Window dialog) {
super(dialog,"ChangeNoticePanel.fxml"); super(dialog, "ChangeNoticePanel.fxml");
// TODO Auto-generated constructor stub // TODO Auto-generated constructor stub
} }
} }

@ -1,6 +1,5 @@
package com.chint.plm.createEcn; package com.chint.plm.createEcn;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -10,84 +9,87 @@ import javafx.scene.control.ComboBox;
import javafx.scene.control.TextArea; import javafx.scene.control.TextArea;
public class EcnBean { public class EcnBean {
protected SimpleIntegerProperty num; protected SimpleIntegerProperty num;
protected TextArea drawNo;//图样代号 protected TextArea drawNo;// 图样代号
protected TextArea mark; //标记 protected TextArea mark; // 标记
protected TextArea poiNum; //处数 protected TextArea poiNum; // 处数
protected TextArea overChange;//更改前 protected TextArea overChange;// 更改前
protected TextArea overVersion;//更改前版本 protected TextArea overVersion;// 更改前版本
protected TextArea afterVersion;//更改后版本 protected TextArea afterVersion;// 更改后版本
protected TextArea afterChange;//更改后 protected TextArea afterChange;// 更改后
protected ComboBox<String> productSz = new ComboBox<String>();//特性等级 protected ComboBox<String> productSz = new ComboBox<String>();// 特性等级
protected ComboBox<String> changeReason = new ComboBox<String>();//更改原因 protected ComboBox<String> changeReason = new ComboBox<String>();// 更改原因
protected ComboBox<String> wipTreat = new ComboBox<String>();//在制品处理 protected ComboBox<String> wipTreat = new ComboBox<String>();// 在制品处理
public ComboBox<String> getProductSz() { public ComboBox<String> getProductSz() {
return productSz; return productSz;
} }
public void setProductSz(String productSz) { public void setProductSz(String productSz) {
this.productSz.getSelectionModel().select(productSz); this.productSz.getSelectionModel().select(productSz);
} }
EcnBean(int ind, List<String> reasons, List<String> wips,List<String> products) {
EcnBean(int ind, List<String> reasons, List<String> wips, List<String> products) {
num = new SimpleIntegerProperty(ind); num = new SimpleIntegerProperty(ind);
drawNo = new TextArea(); //ComboBoxTextArea drawNo = new TextArea(); // ComboBoxTextArea
drawNo.setPrefSize(200, 40); drawNo.setPrefSize(200, 40);
mark = new TextArea(); //ComboBoxTextArea mark = new TextArea(); // ComboBoxTextArea
mark.setPrefSize(200, 40); mark.setPrefSize(200, 40);
poiNum = new TextArea(); //ComboBoxTextArea poiNum = new TextArea(); // ComboBoxTextArea
poiNum.setPrefSize(200, 40); poiNum.setPrefSize(200, 40);
overChange = new TextArea(); //ComboBoxTextArea overChange = new TextArea(); // ComboBoxTextArea
overChange.setPrefSize(200, 40); overChange.setPrefSize(200, 40);
overVersion = new TextArea(); //ComboBoxTextArea overVersion = new TextArea(); // ComboBoxTextArea
overVersion.setPrefSize(200, 40); overVersion.setPrefSize(200, 40);
afterChange = new TextArea(); //ComboBoxTextArea afterChange = new TextArea(); // ComboBoxTextArea
afterChange.setPrefSize(200, 40); afterChange.setPrefSize(200, 40);
afterVersion = new TextArea(); //ComboBoxTextArea afterVersion = new TextArea(); // ComboBoxTextArea
afterVersion.setPrefSize(200, 40); afterVersion.setPrefSize(200, 40);
wipTreat.getItems().addAll(wips); wipTreat.getItems().addAll(wips);
productSz.getItems().addAll(products); productSz.getItems().addAll(products);
productSz.getSelectionModel().selectFirst(); productSz.getSelectionModel().selectFirst();
changeReason.getItems().addAll(reasons); changeReason.getItems().addAll(reasons);
} }
EcnBean(int ind, List<String> reasons, List<String> wips, String drawNoVal, String markVal,
String placesNo, String changeBefore, String changeAfter, String reasonVal, String processType, EcnBean(int ind, List<String> reasons, List<String> wips, String drawNoVal, String markVal, String placesNo,
String szRevisionBef, String szRevisionAft) { String changeBefore, String changeAfter, String reasonVal, String processType, String szRevisionBef,
String szRevisionAft) {
num = new SimpleIntegerProperty(ind); num = new SimpleIntegerProperty(ind);
drawNo = new TextArea(); //ComboBoxTextArea drawNo = new TextArea(); // ComboBoxTextArea
drawNo.setPrefSize(200, 40); drawNo.setPrefSize(200, 40);
drawNo.setText(drawNoVal); drawNo.setText(drawNoVal);
mark = new TextArea(); //ComboBoxTextArea mark = new TextArea(); // ComboBoxTextArea
mark.setPrefSize(200, 40); mark.setPrefSize(200, 40);
mark.setText(markVal); mark.setText(markVal);
poiNum = new TextArea(); //ComboBoxTextArea poiNum = new TextArea(); // ComboBoxTextArea
poiNum.setPrefSize(200, 40); poiNum.setPrefSize(200, 40);
poiNum.setText(placesNo); poiNum.setText(placesNo);
overChange = new TextArea(); //ComboBoxTextArea overChange = new TextArea(); // ComboBoxTextArea
overChange.setPrefSize(200, 40); overChange.setPrefSize(200, 40);
overChange.setText(changeBefore); overChange.setText(changeBefore);
overVersion = new TextArea(); //ComboBoxTextArea overVersion = new TextArea(); // ComboBoxTextArea
overVersion.setPrefSize(200, 40); overVersion.setPrefSize(200, 40);
overVersion.setText(szRevisionBef); overVersion.setText(szRevisionBef);
afterChange = new TextArea(); //ComboBoxTextArea afterChange = new TextArea(); // ComboBoxTextArea
afterChange.setPrefSize(200, 40); afterChange.setPrefSize(200, 40);
afterChange.setText(changeAfter); afterChange.setText(changeAfter);
afterVersion = new TextArea(); //ComboBoxTextArea afterVersion = new TextArea(); // ComboBoxTextArea
afterVersion.setPrefSize(200, 40); afterVersion.setPrefSize(200, 40);
afterVersion.setText(szRevisionAft); afterVersion.setText(szRevisionAft);
wipTreat.getItems().addAll(wips); wipTreat.getItems().addAll(wips);
wipTreat.getSelectionModel().select(processType); wipTreat.getSelectionModel().select(processType);
changeReason.getItems().addAll(reasons); changeReason.getItems().addAll(reasons);
@ -174,6 +176,4 @@ public class EcnBean {
this.wipTreat = wipTreat; this.wipTreat = wipTreat;
} }
} }

@ -18,6 +18,9 @@ import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.util.CellRangeAddress; 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.KUtil;
import com.connor.chint.sap2.util.POIUtil; 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.TCComponentDataset;
import com.teamcenter.rac.kernel.TCComponentTcFile; import com.teamcenter.rac.kernel.TCComponentTcFile;
import com.teamcenter.rac.kernel.TCException; import com.teamcenter.rac.kernel.TCException;
import com.teamcenter.rac.kernel.TCPreferenceService;
import com.teamcenter.rac.kernel.TCSession; import com.teamcenter.rac.kernel.TCSession;
import com.teamcenter.rac.util.MessageBox; import com.teamcenter.rac.util.MessageBox;
@ -52,6 +56,60 @@ public class Util {
return conn; return conn;
} }
/**
*
* @param session
* @param PreServiceName:
* @param Filetype:excelMSExcelX
* @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 * @param dateset
* @return ±ä¸üµ¥Ä£°åÎļþ * @return ±ä¸üµ¥Ä£°åÎļþ

Loading…
Cancel
Save