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;
@ -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));
@ -213,7 +246,7 @@ public class DetailsController {
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,19 +275,18 @@ 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) {
* @param event // just show results
* @function
*/
@FXML
void errBtnAction(ActionEvent event) {
try { try {
cb_errBtn.setDisable(true); if (flagEdit) {
flagEdit = false;
searchErrMsg(); searchErrMsg();
cb_errBtn.setDisable(false); Platform.runLater(() -> {
flagEdit = true;
});
}
} catch (Exception ex) { } catch (Exception ex) {
ex.printStackTrace(); ex.printStackTrace();
} finally { } finally {
@ -262,22 +294,53 @@ public class DetailsController {
SqlUtil.freeAll(); 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
* @function
*/
// @FXML
// void errBtnAction(ActionEvent event) {
//
// }
/** /**
* @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) {
tableBeans = errMsgBeans;
} else if (!cb_errBtn.isSelected() && allMsgBeans.size() > 0) {
tableBeans = allMsgBeans;
} else {
String sqlDetail = ""; String sqlDetail = "";
if (cb_errBtn.isSelected()) { if (cb_errBtn.isSelected()) {
sqlDetail = sqlTotal.toString() + " and status = 'E' "; sqlDetail = sqlTotal.toString() + " and status = 'E' ";
} else { } else {
sqlDetail = sqlTotal.toString();// + " and status = 'S' "; sqlDetail = sqlTotal.toString();// + " and status = 'S' ";
} }
String[] prefs = ChintPreferenceUtil.getPreferences("database_tc", session);
SqlUtil.getTCDataConnection(prefs);
System.out.println("cb_errBtn" + cb_errBtn.isSelected());
System.out.println("sqlDetail" + sqlDetail.toString());
ResultSet read = SqlUtil.read(sqlDetail); ResultSet read = SqlUtil.read(sqlDetail);
int i = 1; int i = 1;
List<DetailsBean> beanList = null; List<DetailsBean> beanList = null;
@ -289,7 +352,7 @@ public class DetailsController {
new SimpleStringProperty(read.getString(5)), new SimpleStringProperty(read.getString(6)), new SimpleStringProperty(read.getString(5)), new SimpleStringProperty(read.getString(6)),
new SimpleStringProperty(read.getString(7)), new SimpleStringProperty(read.getString(8)), new SimpleStringProperty(read.getString(7)), new SimpleStringProperty(read.getString(8)),
new SimpleStringProperty(read.getString(9)), new SimpleStringProperty(read.getString(10))); new SimpleStringProperty(read.getString(9)), new SimpleStringProperty(read.getString(10)));
if (i % 20 == 1) { if (i % 40 == 1) {
beanList = new ArrayList<DetailsBean>(); beanList = new ArrayList<DetailsBean>();
tableBeans.add(beanList); tableBeans.add(beanList);
} }
@ -301,12 +364,20 @@ public class DetailsController {
beanList = new ArrayList<DetailsBean>(); beanList = new ArrayList<DetailsBean>();
tableBeans.add(beanList); tableBeans.add(beanList);
} }
if (errMsgBeans.size() == 0 && cb_errBtn.isSelected()) {
errMsgBeans = tableBeans;
} else if (allMsgBeans.size() == 0 && !cb_errBtn.isSelected()) {
allMsgBeans = tableBeans;
}
}
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();
@ -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,7 +26,7 @@ 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;
@ -34,7 +34,7 @@ public class AssignIdController{
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;
@ -46,6 +46,7 @@ public class AssignIdController{
@FXML @FXML
private ComboBox<String> factoryComb; private ComboBox<String> factoryComb;
/** /**
* @param session * @param session
* @param groupID ID * @param groupID ID
@ -55,7 +56,8 @@ public class AssignIdController{
* @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 @FXML
void okBtnClick(ActionEvent event) { void okBtnClick(ActionEvent event) {
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(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,13 +125,13 @@ 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 @FXML
void cancelBtnClick(ActionEvent event) { void cancelBtnClick(ActionEvent event) {
Stage stage = (Stage)closeBtn.getScene().getWindow(); Stage stage = (Stage) closeBtn.getScene().getWindow();
stage.close(); stage.close();
} }
@ -147,7 +150,7 @@ public class AssignIdController{
* @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,19 +174,19 @@ 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);
} }
}); });
@ -191,20 +194,20 @@ 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");
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;
@ -259,5 +262,6 @@ public class AssignIdController{
// //
// } // }
} }
private Util util = new Util(); private Util util = new Util();
} }

@ -42,7 +42,9 @@ public class AssignIdDialog extends Application {
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,6 +53,7 @@ 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();
@ -60,10 +63,9 @@ public class AssignIdDialog extends Application {
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();
} }
} }

@ -12,13 +12,13 @@ public class CreateEcnCommond extends KCommand {
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();
} }
} }

@ -88,7 +88,7 @@ public class CreateEcnController extends KFXPanelController {
@FXML @FXML
private GridPane gridPane; private GridPane gridPane;
@FXML @FXML
private RadioButton rb_tempChange; //临时更改通知单 private RadioButton rb_tempChange; // 临时更改通知单
@FXML @FXML
private RadioButton rb_Process; private RadioButton rb_Process;
@FXML @FXML
@ -106,7 +106,7 @@ public class CreateEcnController extends KFXPanelController {
private TCSession session; private TCSession session;
private TCComponent target; private TCComponent target;
@FXML @FXML
private RadioButton rb_formalChange; //正式更改通知单 private RadioButton rb_formalChange; // 正式更改通知单
@FXML @FXML
private TextField factoryText; private TextField factoryText;
@FXML @FXML
@ -134,20 +134,20 @@ public class CreateEcnController extends KFXPanelController {
// TODO Auto-generated method stub // TODO Auto-generated method stub
this.app = AIFUtility.getCurrentApplication(); this.app = AIFUtility.getCurrentApplication();
this.session = (TCSession) app.getSession(); this.session = (TCSession) app.getSession();
target = (TCComponent)app.getTargetComponent(); target = (TCComponent) app.getTargetComponent();
database = session.getPreferenceService().getStringValues("database_tc"); database = session.getPreferenceService().getStringValues("database_tc");
CreateEcnFrame frame = (CreateEcnFrame)paramKFXPanel.getParentDialog(); CreateEcnFrame frame = (CreateEcnFrame) paramKFXPanel.getParentDialog();
this.frame = frame; this.frame = frame;
addWindListener(frame); addWindListener(frame);
//过程组 // 过程组
ToggleGroup group = new ToggleGroup(); //变更类型组 ToggleGroup group = new ToggleGroup(); // 变更类型组
//实现单选功能 // 实现单选功能
rb_formalChange.setToggleGroup(group); rb_formalChange.setToggleGroup(group);
rb_tempChange.setToggleGroup(group); rb_tempChange.setToggleGroup(group);
rb_formalChange.setSelected(true); rb_formalChange.setSelected(true);
referencePane.setExpanded(false); referencePane.setExpanded(false);
ToggleGroup groupGc = new ToggleGroup(); //变更类型组 ToggleGroup groupGc = new ToggleGroup(); // 变更类型组
rb_product.setToggleGroup(groupGc); rb_product.setToggleGroup(groupGc);
rb_Process.setToggleGroup(groupGc); rb_Process.setToggleGroup(groupGc);
tp_product.setCollapsible(false); tp_product.setCollapsible(false);
@ -156,13 +156,15 @@ public class CreateEcnController extends KFXPanelController {
createDetailTable(); createDetailTable();
createRefTable(); createRefTable();
//获取选中的对象 // 获取选中的对象
initText(); initText();
} }
@FXML @FXML
private Button createBtn; private Button createBtn;
/** /**
* @param event * @param event
* @throws Exception * @throws Exception
@ -170,17 +172,17 @@ public class CreateEcnController extends KFXPanelController {
*/ */
@FXML @FXML
void createClick(ActionEvent event) throws Exception { void createClick(ActionEvent event) throws Exception {
if(ecnId.getText().isEmpty()) { if (ecnId.getText().isEmpty()) {
MessageBox.post("请先指派变更单ID","提示",2); MessageBox.post("请先指派变更单ID", "提示", 2);
return; return;
} }
String changeName = "临时更改通知单"; String changeName = "临时更改通知单";
if(rb_formalChange.isSelected()) { if (rb_formalChange.isSelected()) {
changeName = "正式更改通知单"; changeName = "正式更改通知单";
} }
if (target.getType().equals("ZT2_Change")) { if (target.getType().equals("ZT2_Change")) {
TCComponentItem item = (TCComponentItem) target; TCComponentItem item = (TCComponentItem) target;
setItemProperty(item,changeName); setItemProperty(item, changeName);
String type = item.getProperty("zt2_Template"); String type = item.getProperty("zt2_Template");
TCComponentDataset dataset = null; TCComponentDataset dataset = null;
@ -207,10 +209,8 @@ public class CreateEcnController extends KFXPanelController {
} else if (target.getType().equals("ZT2_ProjectItem")) { } else if (target.getType().equals("ZT2_ProjectItem")) {
String zt2_WBSNo = target.getProperty("zt2_WBSNo"); String zt2_WBSNo = target.getProperty("zt2_WBSNo");
// 针对新建, // 针对新建,
TCComponentItemType itemType = (TCComponentItemType) session TCComponentItemType itemType = (TCComponentItemType) session.getTypeComponent("ZT2_Change");
.getTypeComponent("ZT2_Change"); TCComponentItem item = itemType.create(ecnId.getText(), null, "ZT2_Change", changeName, "", null);
TCComponentItem item = itemType.create(ecnId.getText(), null, "ZT2_Change",
changeName, "", null);
// 设置属性 // 设置属性
boolean flag = true; boolean flag = true;
try { try {
@ -255,84 +255,77 @@ public class CreateEcnController extends KFXPanelController {
} }
//影响分析信息 保存到CHINT_ECN_NOTIFICATION中 // 影响分析信息 保存到CHINT_ECN_NOTIFICATION中
try { try {
SqlUtil.getTCDataConnection(database); SqlUtil.getTCDataConnection(database);
String deleteSql = "delete CHINT_ECN_NOTIFICATION where \"ecncode\" = ? "; String deleteSql = "delete CHINT_ECN_NOTIFICATION where \"ecncode\" = ? ";
String endCode = ecnId.getText(); String endCode = ecnId.getText();
SqlUtil.delete(deleteSql,new String[] {endCode}); SqlUtil.delete(deleteSql, new String[] { endCode });
String insertSql = "insert into CHINT_ECN_NOTIFICATION (\"ecncode\", \"code\", \"section\", \"no\" ," String insertSql = "insert into CHINT_ECN_NOTIFICATION (\"ecncode\", \"code\", \"section\", \"no\" ,"
+ "\"actionstatement\",\"result\",\"principal\",\"pctime\",\"remark\") values (?,?,?,?,?,?,?,?,?)"; + "\"actionstatement\",\"result\",\"principal\",\"pctime\",\"remark\") values (?,?,?,?,?,?,?,?,?)";
ObservableList<RefTableBean> items = refTable.getItems(); ObservableList<RefTableBean> items = refTable.getItems();
for(int i=0;i<7;i++) { for (int i = 0; i < 7; i++) {
RefTableBean refTableBean = items.get(i); RefTableBean refTableBean = items.get(i);
String result = refTableBean.getShYes().isSelected()?"是":"否"; String result = refTableBean.getShYes().isSelected() ? "是" : "否";
SqlUtil.write( SqlUtil.write(new String[] { endCode, "1", refTableBean.getDepart(), String.valueOf(i + 1),
new String[] {endCode,"1",refTableBean.getDepart(),String.valueOf(i+1), refTableBean.getMessage(), result, refTableBean.getUser().getText(),
refTableBean.getMessage(),result,refTableBean.getUser().getText(), refTableBean.getCompDate().getText(), refTableBean.getMark().getText() }, insertSql);
refTableBean.getCompDate().getText(),refTableBean.getMark().getText()}, insertSql);
} }
for(int i=7;i<11;i++) { for (int i = 7; i < 11; i++) {
RefTableBean refTableBean = items.get(i); RefTableBean refTableBean = items.get(i);
String result = refTableBean.getShYes().isSelected()?"是":"否"; String result = refTableBean.getShYes().isSelected() ? "是" : "否";
SqlUtil.write( SqlUtil.write(new String[] { endCode, "2", refTableBean.getDepart(), String.valueOf(i - 6),
new String[] {endCode,"2",refTableBean.getDepart(),String.valueOf(i-6), refTableBean.getMessage(), result, refTableBean.getUser().getText(),
refTableBean.getMessage(),result,refTableBean.getUser().getText(), refTableBean.getCompDate().getText(), refTableBean.getMark().getText() }, insertSql);
refTableBean.getCompDate().getText(),refTableBean.getMark().getText()}, insertSql);
} }
for(int i=11;i<15;i++) { for (int i = 11; i < 15; i++) {
RefTableBean refTableBean = items.get(i); RefTableBean refTableBean = items.get(i);
String result = refTableBean.getShYes().isSelected()?"是":"否"; String result = refTableBean.getShYes().isSelected() ? "是" : "否";
SqlUtil.write( SqlUtil.write(new String[] { endCode, "3", refTableBean.getDepart(), String.valueOf(i - 10),
new String[] {endCode,"3",refTableBean.getDepart(),String.valueOf(i-10), refTableBean.getMessage(), result, refTableBean.getUser().getText(),
refTableBean.getMessage(),result,refTableBean.getUser().getText(), refTableBean.getCompDate().getText(), refTableBean.getMark().getText() }, insertSql);
refTableBean.getCompDate().getText(),refTableBean.getMark().getText()}, insertSql);
} }
for(int i=15;i<19;i++) { for (int i = 15; i < 19; i++) {
RefTableBean refTableBean = items.get(i); RefTableBean refTableBean = items.get(i);
String result = refTableBean.getShYes().isSelected()?"是":"否"; String result = refTableBean.getShYes().isSelected() ? "是" : "否";
SqlUtil.write( SqlUtil.write(new String[] { endCode, "4", refTableBean.getDepart(), String.valueOf(i - 14),
new String[] {endCode,"4",refTableBean.getDepart(),String.valueOf(i-14), refTableBean.getMessage(), result, refTableBean.getUser().getText(),
refTableBean.getMessage(),result,refTableBean.getUser().getText(), refTableBean.getCompDate().getText(), refTableBean.getMark().getText() }, insertSql);
refTableBean.getCompDate().getText(),refTableBean.getMark().getText()}, insertSql);
} }
for(int i=19;i<24;i++) { for (int i = 19; i < 24; i++) {
RefTableBean refTableBean = items.get(i); RefTableBean refTableBean = items.get(i);
String result = refTableBean.getShYes().isSelected()?"是":"否"; String result = refTableBean.getShYes().isSelected() ? "是" : "否";
SqlUtil.write( SqlUtil.write(new String[] { endCode, "5", refTableBean.getDepart(), String.valueOf(i - 18),
new String[] {endCode,"5",refTableBean.getDepart(),String.valueOf(i-18), refTableBean.getMessage(), result, refTableBean.getUser().getText(),
refTableBean.getMessage(),result,refTableBean.getUser().getText(), refTableBean.getCompDate().getText(), refTableBean.getMark().getText() }, insertSql);
refTableBean.getCompDate().getText(),refTableBean.getMark().getText()}, insertSql);
} }
for(int i=24;i<27;i++) { for (int i = 24; i < 27; i++) {
RefTableBean refTableBean = items.get(i); RefTableBean refTableBean = items.get(i);
String result = refTableBean.getShYes().isSelected()?"是":"否"; String result = refTableBean.getShYes().isSelected() ? "是" : "否";
SqlUtil.write( SqlUtil.write(new String[] { endCode, "6", refTableBean.getDepart(), String.valueOf(i - 23),
new String[] {endCode,"6",refTableBean.getDepart(),String.valueOf(i-23), refTableBean.getMessage(), result, refTableBean.getUser().getText(),
refTableBean.getMessage(),result,refTableBean.getUser().getText(), refTableBean.getCompDate().getText(), refTableBean.getMark().getText() }, insertSql);
refTableBean.getCompDate().getText(),refTableBean.getMark().getText()}, insertSql);
} }
for(int i=27;i<28;i++) { for (int i = 27; i < 28; i++) {
RefTableBean refTableBean = items.get(i); RefTableBean refTableBean = items.get(i);
String result = refTableBean.getShYes().isSelected()?"是":"否"; String result = refTableBean.getShYes().isSelected() ? "是" : "否";
SqlUtil.write( SqlUtil.write(new String[] { endCode, "7", refTableBean.getDepart(), String.valueOf(i - 26),
new String[] {endCode,"7",refTableBean.getDepart(),String.valueOf(i-26), refTableBean.getMessage(), result, refTableBean.getUser().getText(),
refTableBean.getMessage(),result,refTableBean.getUser().getText(), refTableBean.getCompDate().getText(), refTableBean.getMark().getText() }, insertSql);
refTableBean.getCompDate().getText(),refTableBean.getMark().getText()}, insertSql);
} }
}catch(Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
}finally { } finally {
SqlUtil.freeAll(); SqlUtil.freeAll();
} }
createBtn.setDisable(true); createBtn.setDisable(true);
} }
/** /**
* @param * @param
* @param * @param
* @param * @param excel
* excel
*/ */
protected void createOrReplace(TCComponentDataset dataset, File file, String changeName) { protected void createOrReplace(TCComponentDataset dataset, File file, String changeName) {
// 20200407新增删除多余的 // 20200407新增删除多余的
@ -420,12 +413,12 @@ public class CreateEcnController extends KFXPanelController {
} }
private String contractNo; //合同代号 private String contractNo; // 合同代号
private String contractName;//合同名称 private String contractName;// 合同名称
private String productModel; //产品型号 private String productModel; // 产品型号
private String changeType; //正式临时 private String changeType; // 正式临时
private String changeTime;//更改实施日期 private String changeTime;// 更改实施日期
private String changeUnit1; //属性变更发往部门 private String changeUnit1; // 属性变更发往部门
/** /**
* @param item * @param item
@ -435,12 +428,12 @@ public class CreateEcnController extends KFXPanelController {
*/ */
protected void setItemProperty(TCComponentItem item, String changeName) throws Exception { protected void setItemProperty(TCComponentItem item, String changeName) throws Exception {
contractNo = contractText.getText(); //合同代号 contractNo = contractText.getText(); // 合同代号
contractName = htNameText.getText();//合同名称 contractName = htNameText.getText();// 合同名称
productModel = pmCombox.getSelectionModel().getSelectedItem(); //产品型号 productModel = pmCombox.getSelectionModel().getSelectedItem(); // 产品型号
String productName = prodNameComb.getSelectionModel().getSelectedItem(); String productName = prodNameComb.getSelectionModel().getSelectedItem();
String fileName = markText.getText(); String fileName = markText.getText();
changeType = changeName; //正式临时 changeType = changeName; // 正式临时
item.setProperty("zt2_ContractNo", contractNo); item.setProperty("zt2_ContractNo", contractNo);
item.setProperty("zt2_ContractName", contractName); item.setProperty("zt2_ContractName", contractName);
item.setProperty("zt2_ProductModel", productModel); item.setProperty("zt2_ProductModel", productModel);
@ -455,9 +448,9 @@ public class CreateEcnController extends KFXPanelController {
item.setDateProperty("zt2_ChangeDate", date); item.setDateProperty("zt2_ChangeDate", date);
} }
StringBuilder unit = new StringBuilder(""); StringBuilder unit = new StringBuilder("");
for(int j=0;j<partBtns.size();j++) { for (int j = 0; j < partBtns.size(); j++) {
CheckBox radioButton = partBtns.get(j); CheckBox radioButton = partBtns.get(j);
if(radioButton.isSelected()) { if (radioButton.isSelected()) {
if (unit.length() > 0) { if (unit.length() > 0) {
unit.append(";").append(radioButton.getText()); unit.append(";").append(radioButton.getText());
} else { } else {
@ -465,7 +458,7 @@ public class CreateEcnController extends KFXPanelController {
} }
} }
} }
changeUnit1 = unit.toString(); //属性变更发往部门 changeUnit1 = unit.toString(); // 属性变更发往部门
item.setProperty("zt2_ChangeUnit1", changeUnit1); item.setProperty("zt2_ChangeUnit1", changeUnit1);
ObservableList<EcnBean> items = tableView.getItems(); ObservableList<EcnBean> items = tableView.getItems();
int rowCount = items.size(); int rowCount = items.size();
@ -502,17 +495,17 @@ public class CreateEcnController extends KFXPanelController {
changeBefore1[i] = ecnBean.getOverChange().getText(); changeBefore1[i] = ecnBean.getOverChange().getText();
changeAfter1[i] = ecnBean.getAfterChange().getText(); changeAfter1[i] = ecnBean.getAfterChange().getText();
String reasonItem = ecnBean.getChangeReason().getSelectionModel().getSelectedItem(); String reasonItem = ecnBean.getChangeReason().getSelectionModel().getSelectedItem();
changeReason[i] = reasonItem==null?"":reasonItem; changeReason[i] = reasonItem == null ? "" : reasonItem;
String processTypeItem = ecnBean.getWipTreat().getSelectionModel().getSelectedItem(); String processTypeItem = ecnBean.getWipTreat().getSelectionModel().getSelectedItem();
processType1[i] = processTypeItem==null?"":processTypeItem; processType1[i] = processTypeItem == null ? "" : processTypeItem;
szVersionBefs[i] = ecnBean.getOverVersion().getText(); szVersionBefs[i] = ecnBean.getOverVersion().getText();
szVersionAfts[i] = ecnBean.getAfterVersion().getText(); szVersionAfts[i] = ecnBean.getAfterVersion().getText();
productSzs[i] = ecnBean.getProductSz().getSelectionModel().getSelectedItem(); productSzs[i] = ecnBean.getProductSz().getSelectionModel().getSelectedItem();
processSzs[i] = rb_product.isSelected() ? "Y":"N"; processSzs[i] = rb_product.isSelected() ? "Y" : "N";
} }
item.getTCProperty("zt2_ChangeDrawingNo").setStringValueArray(changeDrawingNo); item.getTCProperty("zt2_ChangeDrawingNo").setStringValueArray(changeDrawingNo);
item.getTCProperty("zt2_Sign").setStringValueArray(sign); item.getTCProperty("zt2_Sign").setStringValueArray(sign);
item.getTCProperty("zt2_PlacesNo").setStringValueArray(partition); //处数 item.getTCProperty("zt2_PlacesNo").setStringValueArray(partition); // 处数
item.getTCProperty("zt2_ChangeBefore1").setStringValueArray(changeBefore1); item.getTCProperty("zt2_ChangeBefore1").setStringValueArray(changeBefore1);
item.getTCProperty("zt2_ChangeAfter1").setStringValueArray(changeAfter1); item.getTCProperty("zt2_ChangeAfter1").setStringValueArray(changeAfter1);
item.getTCProperty("zt2_ChangeReason").setStringValueArray(changeReason); item.getTCProperty("zt2_ChangeReason").setStringValueArray(changeReason);
@ -522,19 +515,21 @@ public class CreateEcnController extends KFXPanelController {
item.getTCProperty("zt2_SZProduct").setStringValueArray(productSzs); item.getTCProperty("zt2_SZProduct").setStringValueArray(productSzs);
item.getTCProperty("zt2_SZProcess").setStringValueArray(processSzs); item.getTCProperty("zt2_SZProcess").setStringValueArray(processSzs);
} }
private int pages = 0; private int pages = 0;
private String[] changeDrawingNo; //属性zt2_ChangeDrawingNo private String[] changeDrawingNo; // 属性zt2_ChangeDrawingNo
private String[] sign; //属性zt2_Sign private String[] sign; // 属性zt2_Sign
// private String[] placesNo; //属性zt2_PlacesNo // private String[] placesNo; //属性zt2_PlacesNo
private String[] partition; //属性zt2_Partition private String[] partition; // 属性zt2_Partition
private String[] changeBefore1; //属性zt2_ChangeBefore1 private String[] changeBefore1; // 属性zt2_ChangeBefore1
private String[] changeAfter1; //属性zt2_ChangeAfter1 private String[] changeAfter1; // 属性zt2_ChangeAfter1
private String[] changeReason; //属性zt2_ChangeReason private String[] changeReason; // 属性zt2_ChangeReason
private String[] processType1; //属性zt2_ProcessType1 private String[] processType1; // 属性zt2_ProcessType1
private String[] szVersionBefs; // 变更前版本 private String[] szVersionBefs; // 变更前版本
private String[] szVersionAfts; // 变更后版本 private String[] szVersionAfts; // 变更后版本
private String[] productSzs; // 变更后版本 private String[] productSzs; // 变更后版本
private String[] processSzs; // 变更后版本 private String[] processSzs; // 变更后版本
/** /**
* @param event * @param event
* @function * @function
@ -560,12 +555,12 @@ public class CreateEcnController extends KFXPanelController {
htNameText.setEditable(false); htNameText.setEditable(false);
ecnId.setEditable(false); ecnId.setEditable(false);
rb_product.setSelected(true); rb_product.setSelected(true);
if(target.getType().equals("ZT2_ProjectItem")) { if (target.getType().equals("ZT2_ProjectItem")) {
//获取产成品的名称 // 获取产成品的名称
List<String> ccpNameFromProject = KUtil.getCCPNameFromProject(target, session); List<String> ccpNameFromProject = KUtil.getCCPNameFromProject(target, session);
prodNameComb.getItems().addAll(ccpNameFromProject); prodNameComb.getItems().addAll(ccpNameFromProject);
}else { } else {
//对象类型为变更对象时 设置ID时间产品型号、 // 对象类型为变更对象时 设置ID时间产品型号、
List<String> productNameList = new ArrayList<>(); List<String> productNameList = new ArrayList<>();
productNameList = Util.getProductNames(target, productNameList); productNameList = Util.getProductNames(target, productNameList);
prodNameComb.getItems().addAll(productNameList); prodNameComb.getItems().addAll(productNameList);
@ -580,7 +575,7 @@ public class CreateEcnController extends KFXPanelController {
if (date != null) { if (date != null) {
changeDate.getEditor().setText(sdf.format(date)); changeDate.getEditor().setText(sdf.format(date));
} }
//初始化选中工厂 // 初始化选中工厂
if (target.getType().equals("ZT2_Change")) { if (target.getType().equals("ZT2_Change")) {
String[] changeUnit1 = target.getProperty("zt2_ChangeUnit1").split(";"); String[] changeUnit1 = target.getProperty("zt2_ChangeUnit1").split(";");
for (int j = 0; j < changeUnit1.length; j++) { for (int j = 0; j < changeUnit1.length; j++) {
@ -591,8 +586,8 @@ public class CreateEcnController extends KFXPanelController {
target.refresh(); target.refresh();
properties = target.getTCProperties( properties = target.getTCProperties(
new String[] { "zt2_ChangeDrawingNo", "zt2_Sign", "zt2_PlacesNo", "zt2_Partition", new String[] { "zt2_ChangeDrawingNo", "zt2_Sign", "zt2_PlacesNo", "zt2_Partition",
"zt2_ChangeBefore1", "zt2_ChangeAfter1", "zt2_ChangeReason", "zt2_ProcessType1" ,"zt2_SZVersionbefore", "zt2_ChangeBefore1", "zt2_ChangeAfter1", "zt2_ChangeReason", "zt2_ProcessType1",
"zt2_SZRevisedversion", "zt2_SZProduct", "zt2_SZProcess"}); "zt2_SZVersionbefore", "zt2_SZRevisedversion", "zt2_SZProduct", "zt2_SZProcess" });
} catch (TCException e1) { } catch (TCException e1) {
e1.printStackTrace(); e1.printStackTrace();
} }
@ -608,7 +603,7 @@ public class CreateEcnController extends KFXPanelController {
String[] szVersionAft = properties[9].getStringArrayValue(); String[] szVersionAft = properties[9].getStringArrayValue();
String[] szProduct = properties[10].getStringArrayValue(); String[] szProduct = properties[10].getStringArrayValue();
String[] szProcess = properties[11].getStringArrayValue(); String[] szProcess = properties[11].getStringArrayValue();
if(szProcess.length>0) { if (szProcess.length > 0) {
rb_Process.setSelected(szProcess[0].equals("N")); rb_Process.setSelected(szProcess[0].equals("N"));
} }
String fileName = target.getProperty("zt2_FileName"); String fileName = target.getProperty("zt2_FileName");
@ -624,18 +619,19 @@ public class CreateEcnController extends KFXPanelController {
int rowNum = 0; int rowNum = 0;
for (int j = 0; j < ChangeDrawingNo.length; j++) { for (int j = 0; j < ChangeDrawingNo.length; j++) {
rowNum++; rowNum++;
EcnBean ecnBean = new EcnBean(rowNum, reasons, wips, ChangeDrawingNo[j], sign[j], placesNo[j] EcnBean ecnBean = new EcnBean(rowNum, reasons, wips, ChangeDrawingNo[j], sign[j], placesNo[j],
, ChangeBefore1[j], ChangeAfter1[j], ChangeReason[j], ProcessType1[j], szVersionBef[j], szVersionAft[j]); ChangeBefore1[j], ChangeAfter1[j], ChangeReason[j], ProcessType1[j], szVersionBef[j],
szVersionAft[j]);
ecnBeans.add(ecnBean); ecnBeans.add(ecnBean);
ecnBean.setProductSz(szProduct[j]); ecnBean.setProductSz(szProduct[j]);
} }
} }
tableView.getItems().addAll(ecnBeans); tableView.getItems().addAll(ecnBeans);
for(int i=0;i<parts.size();i++) { for (int i = 0; i < parts.size(); i++) {
CheckBox btn = new CheckBox(parts.get(i)); CheckBox btn = new CheckBox(parts.get(i));
partBtns.add(btn); partBtns.add(btn);
departPane.getChildren().add(btn); departPane.getChildren().add(btn);
if(unitList.contains(parts.get(i))) { if (unitList.contains(parts.get(i))) {
btn.setSelected(true); btn.setSelected(true);
} }
} }
@ -643,33 +639,35 @@ public class CreateEcnController extends KFXPanelController {
try { try {
SqlUtil.getTCDataConnection(database); SqlUtil.getTCDataConnection(database);
ObservableList<RefTableBean> items = refTable.getItems(); ObservableList<RefTableBean> items = refTable.getItems();
int i=0; int i = 0;
String refTableSql = "select * from CHINT_ECN_NOTIFICATION where \"ecncode\" = '"+ecnId.getText()+"' order by \"code\" asc , \"no\" asc "; String refTableSql = "select * from CHINT_ECN_NOTIFICATION where \"ecncode\" = '" + ecnId.getText()
System.out.println("refTableSql==>"+refTableSql); + "' order by \"code\" asc , \"no\" asc ";
System.out.println("refTableSql==>" + refTableSql);
ResultSet read = SqlUtil.read(refTableSql); ResultSet read = SqlUtil.read(refTableSql);
while(read.next()) { while (read.next()) {
// \"result\",\"principal\",\"pctime\",\"remark\" // \"result\",\"principal\",\"pctime\",\"remark\"
RefTableBean refTableBean = items.get(i); RefTableBean refTableBean = items.get(i);
refTableBean.setCompDate(read.getString("pctime")); refTableBean.setCompDate(read.getString("pctime"));
refTableBean.setMark(read.getString("remark")); refTableBean.setMark(read.getString("remark"));
refTableBean.setUser(read.getString("principal")); refTableBean.setUser(read.getString("principal"));
String result = read.getString("result"); String result = read.getString("result");
System.out.println("refTableSql==>"+read.getString("principal")); System.out.println("refTableSql==>" + read.getString("principal"));
if(result.equals("否")) { if (result.equals("否")) {
refTableBean.setShNo(true); refTableBean.setShNo(true);
} }
i=i+1; i = i + 1;
} }
refTable.setItems(items); refTable.setItems(items);
// if() // if()
// refTable.getItems().clear(); // refTable.getItems().clear();
// refTable.getItems().addAll(items); // refTable.getItems().addAll(items);
}catch(Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
}finally { } finally {
SqlUtil.freeAll(); SqlUtil.freeAll();
} }
} }
/* /*
* *
*/ */
@ -710,7 +708,7 @@ public class CreateEcnController extends KFXPanelController {
// util.disconnect(conn, stmt, rs_get); // util.disconnect(conn, stmt, rs_get);
} catch (SQLException e) { } catch (SQLException e) {
e.printStackTrace(); e.printStackTrace();
}finally { } finally {
SqlUtil.freeAll(); SqlUtil.freeAll();
} }
if (i == 0) { if (i == 0) {
@ -719,6 +717,7 @@ public class CreateEcnController extends KFXPanelController {
return newDataset; return newDataset;
} }
} }
/** /**
* @param target * @param target
* @return * @return
@ -742,6 +741,7 @@ public class CreateEcnController extends KFXPanelController {
} }
return null; return null;
} }
/** /**
* *
* @function bean * @function bean
@ -749,20 +749,20 @@ public class CreateEcnController extends KFXPanelController {
private void createDetailTable() { private void createDetailTable() {
// TODO Auto-generated method stub // TODO Auto-generated method stub
TableColumn<EcnBean,TextArea> tc_beforChange = new TableColumn<EcnBean,TextArea>("更改前"); TableColumn<EcnBean, TextArea> tc_beforChange = new TableColumn<EcnBean, TextArea>("更改前");
TableColumn<EcnBean,TextArea> tc_afterChange = new TableColumn<EcnBean,TextArea>("更改后"); TableColumn<EcnBean, TextArea> tc_afterChange = new TableColumn<EcnBean, TextArea>("更改后");
TableColumn<EcnBean,TextArea> tc_afterVer = new TableColumn<EcnBean,TextArea>("更改后版本"); TableColumn<EcnBean, TextArea> tc_afterVer = new TableColumn<EcnBean, TextArea>("更改后版本");
TableColumn<EcnBean,TextArea> tc_drawNo = new TableColumn<EcnBean,TextArea>("图样代号"); TableColumn<EcnBean, TextArea> tc_drawNo = new TableColumn<EcnBean, TextArea>("图样代号");
TableColumn<EcnBean,TextArea> tc_mark = new TableColumn<EcnBean,TextArea>("标记"); TableColumn<EcnBean, TextArea> tc_mark = new TableColumn<EcnBean, TextArea>("标记");
TableColumn<EcnBean,Integer> tc_xh = new TableColumn<EcnBean,Integer>("序号"); TableColumn<EcnBean, Integer> tc_xh = new TableColumn<EcnBean, Integer>("序号");
TableColumn<EcnBean,ComboBox<String>> tc_wipTreat = new TableColumn<EcnBean,ComboBox<String>>("在制品处理"); TableColumn<EcnBean, ComboBox<String>> tc_wipTreat = new TableColumn<EcnBean, ComboBox<String>>("在制品处理");
TableColumn<EcnBean,TextArea> tc_beforVer = new TableColumn<EcnBean,TextArea>("更改前版本"); TableColumn<EcnBean, TextArea> tc_beforVer = new TableColumn<EcnBean, TextArea>("更改前版本");
TableColumn<EcnBean,ComboBox<String>> productSz = new TableColumn<EcnBean,ComboBox<String>>("特性等级"); TableColumn<EcnBean, ComboBox<String>> productSz = new TableColumn<EcnBean, ComboBox<String>>("特性等级");
TableColumn<EcnBean,ComboBox<String>> tc_reason = new TableColumn<EcnBean,ComboBox<String>>("更改原因"); TableColumn<EcnBean, ComboBox<String>> tc_reason = new TableColumn<EcnBean, ComboBox<String>>("更改原因");
TableColumn<EcnBean,TextArea> tc_poiNum = new TableColumn<EcnBean,TextArea>("处数"); TableColumn<EcnBean, TextArea> tc_poiNum = new TableColumn<EcnBean, TextArea>("处数");
tableView.getColumns().addAll(tc_xh, tc_drawNo, tc_mark,tc_poiNum,tc_beforChange, tc_beforVer, tc_afterChange, tableView.getColumns().addAll(tc_xh, tc_drawNo, tc_mark, tc_poiNum, tc_beforChange, tc_beforVer, tc_afterChange,
tc_afterVer,productSz,tc_reason,tc_wipTreat); tc_afterVer, productSz, tc_reason, tc_wipTreat);
tc_xh.setSortable(false); tc_xh.setSortable(false);
tc_drawNo.setSortable(false); tc_drawNo.setSortable(false);
@ -775,18 +775,18 @@ public class CreateEcnController extends KFXPanelController {
tc_reason.setSortable(false); tc_reason.setSortable(false);
productSz.setSortable(false); productSz.setSortable(false);
tc_wipTreat.setSortable(false); tc_wipTreat.setSortable(false);
//列绑定bean对象 // 列绑定bean对象
tc_xh.setCellValueFactory(new PropertyValueFactory<EcnBean,Integer>("num")); tc_xh.setCellValueFactory(new PropertyValueFactory<EcnBean, Integer>("num"));
tc_drawNo.setCellValueFactory(new PropertyValueFactory<EcnBean,TextArea>("drawNo")); tc_drawNo.setCellValueFactory(new PropertyValueFactory<EcnBean, TextArea>("drawNo"));
tc_mark.setCellValueFactory(new PropertyValueFactory<EcnBean,TextArea>("mark")); tc_mark.setCellValueFactory(new PropertyValueFactory<EcnBean, TextArea>("mark"));
tc_poiNum.setCellValueFactory(new PropertyValueFactory<EcnBean,TextArea>("poiNum")); tc_poiNum.setCellValueFactory(new PropertyValueFactory<EcnBean, TextArea>("poiNum"));
tc_beforChange.setCellValueFactory(new PropertyValueFactory<EcnBean,TextArea>("overChange")); tc_beforChange.setCellValueFactory(new PropertyValueFactory<EcnBean, TextArea>("overChange"));
tc_beforVer.setCellValueFactory(new PropertyValueFactory<EcnBean,TextArea>("overVersion")); tc_beforVer.setCellValueFactory(new PropertyValueFactory<EcnBean, TextArea>("overVersion"));
tc_afterChange.setCellValueFactory(new PropertyValueFactory<EcnBean,TextArea>("afterChange")); tc_afterChange.setCellValueFactory(new PropertyValueFactory<EcnBean, TextArea>("afterChange"));
tc_afterVer.setCellValueFactory(new PropertyValueFactory<EcnBean,TextArea>("afterVersion")); tc_afterVer.setCellValueFactory(new PropertyValueFactory<EcnBean, TextArea>("afterVersion"));
tc_reason.setCellValueFactory(new PropertyValueFactory<EcnBean,ComboBox<String>>("changeReason")); tc_reason.setCellValueFactory(new PropertyValueFactory<EcnBean, ComboBox<String>>("changeReason"));
tc_wipTreat.setCellValueFactory(new PropertyValueFactory<EcnBean,ComboBox<String>>("wipTreat")); tc_wipTreat.setCellValueFactory(new PropertyValueFactory<EcnBean, ComboBox<String>>("wipTreat"));
productSz.setCellValueFactory(new PropertyValueFactory<EcnBean,ComboBox<String>>("productSz")); productSz.setCellValueFactory(new PropertyValueFactory<EcnBean, ComboBox<String>>("productSz"));
tc_xh.prefWidthProperty().bind(tableView.widthProperty().multiply(0.06)); tc_xh.prefWidthProperty().bind(tableView.widthProperty().multiply(0.06));
tc_drawNo.prefWidthProperty().bind(tableView.widthProperty().multiply(0.18)); tc_drawNo.prefWidthProperty().bind(tableView.widthProperty().multiply(0.18));
@ -797,9 +797,10 @@ public class CreateEcnController extends KFXPanelController {
tc_afterChange.prefWidthProperty().bind(tableView.widthProperty().multiply(0.10)); tc_afterChange.prefWidthProperty().bind(tableView.widthProperty().multiply(0.10));
productSz.prefWidthProperty().bind(tableView.widthProperty().multiply(0.06)); productSz.prefWidthProperty().bind(tableView.widthProperty().multiply(0.06));
tc_afterVer.prefWidthProperty().bind(tableView.widthProperty().multiply(0.06)); tc_afterVer.prefWidthProperty().bind(tableView.widthProperty().multiply(0.06));
tc_reason.prefWidthProperty().bind(tableView.widthProperty().multiply(0.14)); //0.4 tc_reason.prefWidthProperty().bind(tableView.widthProperty().multiply(0.14)); // 0.4
tc_wipTreat.prefWidthProperty().bind(tableView.widthProperty().multiply(0.10)); tc_wipTreat.prefWidthProperty().bind(tableView.widthProperty().multiply(0.10));
} }
@FXML @FXML
public TableView<RefTableBean> refTable; public TableView<RefTableBean> refTable;
@ -809,7 +810,7 @@ public class CreateEcnController extends KFXPanelController {
*/ */
private void createRefTable() { private void createRefTable() {
// TODO Auto-generated method stub // TODO Auto-generated method stub
//影响分析表格 // 影响分析表格
// protected SimpleStringProperty depart;//部门 // protected SimpleStringProperty depart;//部门
// protected SimpleStringProperty message; //行动 // protected SimpleStringProperty message; //行动
// protected CheckBox shYes = new CheckBox();//是 // protected CheckBox shYes = new CheckBox();//是
@ -817,21 +818,21 @@ public class CreateEcnController extends KFXPanelController {
// protected TextField user;//更改前版本 // protected TextField user;//更改前版本
// protected TextField compDate;//更改后 // protected TextField compDate;//更改后
// protected TextField mark;//更改后版本 // protected TextField mark;//更改后版本
TableColumn<RefTableBean,String> deapart = new TableColumn<RefTableBean,String>("部门"); TableColumn<RefTableBean, String> deapart = new TableColumn<RefTableBean, String>("部门");
TableColumn<RefTableBean,String> message = new TableColumn<RefTableBean,String>("行动(需要书面证据)"); TableColumn<RefTableBean, String> message = new TableColumn<RefTableBean, String>("行动(需要书面证据)");
TableColumn<RefTableBean,CheckBox> shYes = new TableColumn<RefTableBean,CheckBox>("是"); //要求值(设计) TableColumn<RefTableBean, CheckBox> shYes = new TableColumn<RefTableBean, CheckBox>("是"); // 要求值(设计)
TableColumn<RefTableBean,CheckBox> shNo = new TableColumn<RefTableBean,CheckBox>("否"); TableColumn<RefTableBean, CheckBox> shNo = new TableColumn<RefTableBean, CheckBox>("否");
TableColumn<RefTableBean,TextField> user = new TableColumn<RefTableBean,TextField>("责任人"); TableColumn<RefTableBean, TextField> user = new TableColumn<RefTableBean, TextField>("责任人");
TableColumn<RefTableBean,TextField> compDate = new TableColumn<RefTableBean,TextField>("完成时间"); // TableColumn<RefTableBean, TextField> compDate = new TableColumn<RefTableBean, TextField>("完成时间"); //
TableColumn<RefTableBean,TextField> mark = new TableColumn<RefTableBean,TextField>("备注"); // TableColumn<RefTableBean, TextField> mark = new TableColumn<RefTableBean, TextField>("备注"); //
deapart.setCellValueFactory(new PropertyValueFactory<RefTableBean,String>("depart")); deapart.setCellValueFactory(new PropertyValueFactory<RefTableBean, String>("depart"));
message.setCellValueFactory(new PropertyValueFactory<RefTableBean,String>("message")); message.setCellValueFactory(new PropertyValueFactory<RefTableBean, String>("message"));
shYes.setCellValueFactory(new PropertyValueFactory<RefTableBean,CheckBox>("shYes")); shYes.setCellValueFactory(new PropertyValueFactory<RefTableBean, CheckBox>("shYes"));
shNo.setCellValueFactory(new PropertyValueFactory<RefTableBean,CheckBox>("shNo")); shNo.setCellValueFactory(new PropertyValueFactory<RefTableBean, CheckBox>("shNo"));
user.setCellValueFactory(new PropertyValueFactory<RefTableBean,TextField>("user")); user.setCellValueFactory(new PropertyValueFactory<RefTableBean, TextField>("user"));
compDate.setCellValueFactory(new PropertyValueFactory<RefTableBean,TextField>("compDate")); compDate.setCellValueFactory(new PropertyValueFactory<RefTableBean, TextField>("compDate"));
mark.setCellValueFactory(new PropertyValueFactory<RefTableBean,TextField>("mark")); mark.setCellValueFactory(new PropertyValueFactory<RefTableBean, TextField>("mark"));
deapart.setSortable(false); deapart.setSortable(false);
message.setSortable(false); message.setSortable(false);
@ -840,7 +841,7 @@ public class CreateEcnController extends KFXPanelController {
user.setSortable(false); user.setSortable(false);
compDate.setSortable(false); compDate.setSortable(false);
mark.setSortable(false); mark.setSortable(false);
refTable.getColumns().addAll(deapart, message, shYes,shNo,user, compDate, mark); refTable.getColumns().addAll(deapart, message, shYes, shNo, user, compDate, mark);
// //设置宽度 // //设置宽度
deapart.prefWidthProperty().bind(refTable.widthProperty().multiply(0.14)); deapart.prefWidthProperty().bind(refTable.widthProperty().multiply(0.14));
message.prefWidthProperty().bind(refTable.widthProperty().multiply(0.36)); message.prefWidthProperty().bind(refTable.widthProperty().multiply(0.36));
@ -850,47 +851,49 @@ public class CreateEcnController extends KFXPanelController {
compDate.prefWidthProperty().bind(refTable.widthProperty().multiply(0.13)); compDate.prefWidthProperty().bind(refTable.widthProperty().multiply(0.13));
mark.prefWidthProperty().bind(refTable.widthProperty().multiply(0.14)); mark.prefWidthProperty().bind(refTable.widthProperty().multiply(0.14));
List<RefTableBean> refTableBeans = new ArrayList<RefTableBean>(); List<RefTableBean> refTableBeans = new ArrayList<RefTableBean>();
//初始化数据 写死的 // 初始化数据 写死的
refTableBeans.add(new RefTableBean(new SimpleStringProperty("技术部"),new SimpleStringProperty("产品图样、目录、铭牌等"))); refTableBeans.add(new RefTableBean(new SimpleStringProperty("技术部"), new SimpleStringProperty("产品图样、目录、铭牌等")));
refTableBeans.add(new RefTableBean(new SimpleStringProperty("技术部"),new SimpleStringProperty("技术方案、DFMEA、产品质量特性重要度分级表"))); refTableBeans.add(
refTableBeans.add(new RefTableBean(new SimpleStringProperty("技术部"),new SimpleStringProperty("BOM物料更改"))); new RefTableBean(new SimpleStringProperty("技术部"), new SimpleStringProperty("技术方案、DFMEA、产品质量特性重要度分级表")));
refTableBeans.add(new RefTableBean(new SimpleStringProperty("技术部"),new SimpleStringProperty("包装图样/规范"))); refTableBeans.add(new RefTableBean(new SimpleStringProperty("技术部"), new SimpleStringProperty("BOM物料更改")));
refTableBeans.add(new RefTableBean(new SimpleStringProperty("技术部"),new SimpleStringProperty("发货标签更改"))); refTableBeans.add(new RefTableBean(new SimpleStringProperty("技术部"), new SimpleStringProperty("包装图样/规范")));
refTableBeans.add(new RefTableBean(new SimpleStringProperty("技术部"),new SimpleStringProperty("客户承诺相关设计文件"))); refTableBeans.add(new RefTableBean(new SimpleStringProperty("技术部"), new SimpleStringProperty("发货标签更改")));
refTableBeans.add(new RefTableBean(new SimpleStringProperty("技术部"),new SimpleStringProperty("环保要求更改"))); refTableBeans.add(new RefTableBean(new SimpleStringProperty("技术部"), new SimpleStringProperty("客户承诺相关设计文件")));
refTableBeans.add(new RefTableBean(new SimpleStringProperty("技术部"), new SimpleStringProperty("环保要求更改")));
refTableBeans.add(new RefTableBean(new SimpleStringProperty("工艺部"),new SimpleStringProperty("工艺流程图、PFMEA、工艺守则")));
refTableBeans.add(new RefTableBean(new SimpleStringProperty("工艺部"),new SimpleStringProperty("作业指导书、包装指导书"))); refTableBeans
refTableBeans.add(new RefTableBean(new SimpleStringProperty("工艺部"),new SimpleStringProperty("客户承诺相关工艺文件"))); .add(new RefTableBean(new SimpleStringProperty("工艺部"), new SimpleStringProperty("工艺流程图、PFMEA、工艺守则")));
refTableBeans.add(new RefTableBean(new SimpleStringProperty("工艺部"),new SimpleStringProperty("模具、工装、设备更改"))); refTableBeans.add(new RefTableBean(new SimpleStringProperty("工艺部"), new SimpleStringProperty("作业指导书、包装指导书")));
refTableBeans.add(new RefTableBean(new SimpleStringProperty("工艺部"), new SimpleStringProperty("客户承诺相关工艺文件")));
refTableBeans.add(new RefTableBean(new SimpleStringProperty("质量部"),new SimpleStringProperty("控制计划"))); refTableBeans.add(new RefTableBean(new SimpleStringProperty("工艺部"), new SimpleStringProperty("模具、工装、设备更改")));
refTableBeans.add(new RefTableBean(new SimpleStringProperty("质量部"),new SimpleStringProperty("进货/过程/成品检验文件")));
refTableBeans.add(new RefTableBean(new SimpleStringProperty("质量部"),new SimpleStringProperty("供应商产品质量检验报告"))); refTableBeans.add(new RefTableBean(new SimpleStringProperty("质量部"), new SimpleStringProperty("控制计划")));
refTableBeans.add(new RefTableBean(new SimpleStringProperty("质量部"),new SimpleStringProperty("客户承诺相关质量文件"))); refTableBeans.add(new RefTableBean(new SimpleStringProperty("质量部"), new SimpleStringProperty("进货/过程/成品检验文件")));
refTableBeans.add(new RefTableBean(new SimpleStringProperty("质量部"), new SimpleStringProperty("供应商产品质量检验报告")));
refTableBeans.add(new RefTableBean(new SimpleStringProperty("生产部"),new SimpleStringProperty("断点标识(物料切换)"))); refTableBeans.add(new RefTableBean(new SimpleStringProperty("质量部"), new SimpleStringProperty("客户承诺相关质量文件")));
refTableBeans.add(new RefTableBean(new SimpleStringProperty("生产部"),new SimpleStringProperty("在制品确认及处理")));
refTableBeans.add(new RefTableBean(new SimpleStringProperty("生产部"),new SimpleStringProperty("成品确认及处理"))); refTableBeans.add(new RefTableBean(new SimpleStringProperty("生产部"), new SimpleStringProperty("断点标识(物料切换)")));
refTableBeans.add(new RefTableBean(new SimpleStringProperty("生产部"),new SimpleStringProperty("计划确认及调整"))); refTableBeans.add(new RefTableBean(new SimpleStringProperty("生产部"), new SimpleStringProperty("在制品确认及处理")));
refTableBeans.add(new RefTableBean(new SimpleStringProperty("生产部"), new SimpleStringProperty("成品确认及处理")));
refTableBeans.add(new RefTableBean(new SimpleStringProperty("采购部"),new SimpleStringProperty("采购价格变化"))); refTableBeans.add(new RefTableBean(new SimpleStringProperty("生产部"), new SimpleStringProperty("计划确认及调整")));
refTableBeans.add(new RefTableBean(new SimpleStringProperty("采购部"),new SimpleStringProperty("更改信息(资料、价格)传递")));
refTableBeans.add(new RefTableBean(new SimpleStringProperty("采购部"),new SimpleStringProperty("合格供方评价(新增时)"))); refTableBeans.add(new RefTableBean(new SimpleStringProperty("采购部"), new SimpleStringProperty("采购价格变化")));
refTableBeans.add(new RefTableBean(new SimpleStringProperty("采购部"),new SimpleStringProperty("供应商合同修改"))); refTableBeans.add(new RefTableBean(new SimpleStringProperty("采购部"), new SimpleStringProperty("更改信息(资料、价格)传递")));
refTableBeans.add(new RefTableBean(new SimpleStringProperty("采购部"),new SimpleStringProperty("供应商处产品确认"))); refTableBeans.add(new RefTableBean(new SimpleStringProperty("采购部"), new SimpleStringProperty("合格供方评价(新增时)")));
refTableBeans.add(new RefTableBean(new SimpleStringProperty("采购部"), new SimpleStringProperty("供应商合同修改")));
refTableBeans.add(new RefTableBean(new SimpleStringProperty("销售中心"),new SimpleStringProperty("通知客户"))); refTableBeans.add(new RefTableBean(new SimpleStringProperty("采购部"), new SimpleStringProperty("供应商处产品确认")));
refTableBeans.add(new RefTableBean(new SimpleStringProperty("销售中心"),new SimpleStringProperty("客户批准")));
refTableBeans.add(new RefTableBean(new SimpleStringProperty("销售中心"),new SimpleStringProperty("修改客户协议"))); refTableBeans.add(new RefTableBean(new SimpleStringProperty("销售中心"), new SimpleStringProperty("通知客户")));
refTableBeans.add(new RefTableBean(new SimpleStringProperty("销售中心"), new SimpleStringProperty("客户批准")));
refTableBeans.add(new RefTableBean(new SimpleStringProperty("财务部"),new SimpleStringProperty("销售价格变化"))); refTableBeans.add(new RefTableBean(new SimpleStringProperty("销售中心"), new SimpleStringProperty("修改客户协议")));
refTableBeans.add(new RefTableBean(new SimpleStringProperty("财务部"), new SimpleStringProperty("销售价格变化")));
refTable.getItems().addAll(refTableBeans); refTable.getItems().addAll(refTableBeans);
} }
//最大化
// 最大化
/** /**
* @param frame * @param frame
* @function * @function
@ -912,7 +915,7 @@ public class CreateEcnController extends KFXPanelController {
// System.out.println("=============="); // System.out.println("==============");
double width = e.getComponent().getSize().getWidth(); double width = e.getComponent().getSize().getWidth();
// // double width = primaryStage.getWidth(); // // double width = primaryStage.getWidth();
System.out.println("width==>"+width); System.out.println("width==>" + width);
scollPane.setPrefWidth(width * 0.98); scollPane.setPrefWidth(width * 0.98);
gridPane.setPrefWidth(width * 0.98); gridPane.setPrefWidth(width * 0.98);
tableView.setPrefWidth(width * 0.97); tableView.setPrefWidth(width * 0.97);
@ -936,8 +939,8 @@ public class CreateEcnController extends KFXPanelController {
try { try {
String sql = "select PART,REASON,MANAGE,DATASET,UNIT,GRADE from CHINT_ECN_TYPE where CODE = ?"; String sql = "select PART,REASON,MANAGE,DATASET,UNIT,GRADE from CHINT_ECN_TYPE where CODE = ?";
ResultSet read = SqlUtil.read(sql, new String[] {SAPUtil.getGroupID()}); ResultSet read = SqlUtil.read(sql, new String[] { SAPUtil.getGroupID() });
if(read.next()) { if (read.next()) {
String part = read.getString(1); String part = read.getString(1);
String reason = read.getString(2); String reason = read.getString(2);
String manage = read.getString(3); String manage = read.getString(3);
@ -955,9 +958,9 @@ public class CreateEcnController extends KFXPanelController {
products = new ArrayList<String>(Arrays.asList(grades)); products = new ArrayList<String>(Arrays.asList(grades));
} }
}catch(Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
}finally { } finally {
SqlUtil.freeAll(); SqlUtil.freeAll();
} }
@ -969,24 +972,26 @@ public class CreateEcnController extends KFXPanelController {
*/ */
@FXML @FXML
void addRows(ActionEvent event) { void addRows(ActionEvent event) {
for(int i=0;i<5;i++) { for (int i = 0; i < 5; i++) {
ecnBeans.add(new EcnBean(ecnBeans.size()+1, reasons, wips, products)); ecnBeans.add(new EcnBean(ecnBeans.size() + 1, reasons, wips, products));
} }
ObservableList<EcnBean> data = FXCollections.observableArrayList(ecnBeans); ObservableList<EcnBean> data = FXCollections.observableArrayList(ecnBeans);
tableView.getItems().clear(); tableView.getItems().clear();
tableView.setItems(data); tableView.setItems(data);
} }
/** /**
* @param event * @param event
* @function * @function
*/ */
@FXML @FXML
void addRow(ActionEvent event) { void addRow(ActionEvent event) {
ecnBeans.add(new EcnBean(ecnBeans.size()+1, reasons, wips, products)); ecnBeans.add(new EcnBean(ecnBeans.size() + 1, reasons, wips, products));
ObservableList<EcnBean> data = FXCollections.observableArrayList(ecnBeans); ObservableList<EcnBean> data = FXCollections.observableArrayList(ecnBeans);
tableView.getItems().clear(); tableView.getItems().clear();
tableView.setItems(data); tableView.setItems(data);
} }
/** /**
* @param event * @param event
* @function * @function
@ -994,15 +999,16 @@ public class CreateEcnController extends KFXPanelController {
@FXML @FXML
void deleteRow(ActionEvent event) { void deleteRow(ActionEvent event) {
int selectedIndex = tableView.getSelectionModel().getSelectedIndex(); int selectedIndex = tableView.getSelectionModel().getSelectedIndex();
System.out.println("selectedIndex==>"+selectedIndex); System.out.println("selectedIndex==>" + selectedIndex);
ecnBeans.remove(selectedIndex); ecnBeans.remove(selectedIndex);
for(int i=selectedIndex;i<ecnBeans.size();i++) { for (int i = selectedIndex; i < ecnBeans.size(); i++) {
ecnBeans.get(i).setNum(new SimpleIntegerProperty(i+1)); ecnBeans.get(i).setNum(new SimpleIntegerProperty(i + 1));
} }
ObservableList<EcnBean> data = FXCollections.observableArrayList(ecnBeans); ObservableList<EcnBean> data = FXCollections.observableArrayList(ecnBeans);
tableView.getItems().clear(); tableView.getItems().clear();
tableView.setItems(data); tableView.setItems(data);
} }
/** /**
* @param event * @param event
* @function * @function
@ -1012,22 +1018,25 @@ public class CreateEcnController extends KFXPanelController {
// rb_tempChange // rb_tempChange
// assignBtn ecnId // assignBtn ecnId
try { try {
AssignIdDialog dialog = new AssignIdDialog(session,SAPUtil.getGroupID(),ecnId,target,rb_tempChange.isSelected(),assignBtn); AssignIdDialog dialog = new AssignIdDialog(session, SAPUtil.getGroupID(), ecnId, target,
rb_tempChange.isSelected(), assignBtn);
dialog.start(new Stage()); dialog.start(new Stage());
} catch (Exception e) { } catch (Exception e) {
// TODO Auto-generated catch block // TODO Auto-generated catch block
e.printStackTrace(); e.printStackTrace();
} }
} }
@FXML @FXML
public TextField relateEcnText; public TextField relateEcnText;
/** /**
* @param event * @param event
* @function * @function
*/ */
@FXML @FXML
void relateClick(ActionEvent event) { void relateClick(ActionEvent event) {
RelateEcnDialog dialog = new RelateEcnDialog(session,controller); RelateEcnDialog dialog = new RelateEcnDialog(session, controller);
try { try {
dialog.start(new Stage()); dialog.start(new Stage());
} catch (IOException e) { } catch (IOException e) {

@ -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;
@ -12,79 +11,82 @@ 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);
@ -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