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

@ -1,4 +1,5 @@
package com.chint.plm.SearchSapResult; package com.chint.plm.SearchSapResult;
import java.io.IOException; import java.io.IOException;
import java.util.List; import java.util.List;
@ -9,26 +10,28 @@ import javafx.scene.Scene;
import javafx.scene.layout.StackPane; import javafx.scene.layout.StackPane;
import javafx.stage.Stage; import javafx.stage.Stage;
public class ChildMessage extends Application { public class ChildMessage extends Application {
// private List<List<DetailsBean>> tableBeans; // private List<List<DetailsBean>> tableBeans;
private boolean onlyError; private boolean onlyError;
private StringBuilder sqlTotal; private StringBuilder sqlTotal;
public ChildMessage(boolean onlyError,StringBuilder sqlTotal) {
super(); public ChildMessage(boolean onlyError, StringBuilder sqlTotal) {
super();
// this.tableBeans = tableBeans; // this.tableBeans = tableBeans;
this.onlyError = onlyError; this.onlyError = onlyError;
this.sqlTotal = sqlTotal; this.sqlTotal = sqlTotal;
} }
@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("SearchSapDetailPanel.fxml")); fxmlLoader.setLocation(getClass().getResource("SearchSapDetailPanel.fxml"));
Parent root = (Parent) fxmlLoader.load(); Parent root = (Parent) fxmlLoader.load();
Scene scene = new Scene(root, 1200.0, 800.0); Scene scene = new Scene(root, 1200.0, 800.0);
DetailsController controller = (DetailsController) fxmlLoader.getController(); DetailsController controller = (DetailsController) fxmlLoader.getController();
primaryStage.setTitle("SAP´«µÝ½á¹ûÃ÷ϸ"); primaryStage.setTitle("SAP´«µÝ½á¹ûÃ÷ϸ");
controller.initData(primaryStage,onlyError,sqlTotal); controller.initData(primaryStage, onlyError, sqlTotal);
primaryStage.setScene(scene); primaryStage.setScene(scene);
primaryStage.show(); primaryStage.show();
} }

@ -7,103 +7,123 @@ public class DetailsBean {
// batchnumber,productmaterialno,status,message,createdate,createtime,returndate,returntime," // batchnumber,productmaterialno,status,message,createdate,createtime,returndate,returntime,"
// + "PLMSTATUS // + "PLMSTATUS
//序号 // 序号
protected SimpleIntegerProperty num; protected SimpleIntegerProperty num;
protected SimpleStringProperty batchNum;//批次号 protected SimpleStringProperty batchNum;// 批次号
protected SimpleStringProperty productMaterialNo; //父物料号 protected SimpleStringProperty productMaterialNo; // 父物料号
protected SimpleStringProperty wbsNo; //父物料号 protected SimpleStringProperty wbsNo; // 父物料号
protected SimpleStringProperty status;//状态 protected SimpleStringProperty status;// 状态
protected SimpleStringProperty message;//状态 protected SimpleStringProperty message;// 状态
protected SimpleStringProperty createDate;//创建日期 protected SimpleStringProperty createDate;// 创建日期
protected SimpleStringProperty createTime;//创建时间 protected SimpleStringProperty createTime;// 创建时间
protected SimpleStringProperty returnDate;//回传日期 protected SimpleStringProperty returnDate;// 回传日期
protected SimpleStringProperty returnTime;//回传时间 protected SimpleStringProperty returnTime;// 回传时间
protected SimpleStringProperty plmStatus;//回传时间 protected SimpleStringProperty plmStatus;// 回传时间
public Integer getNum() {
return num.get(); public Integer getNum() {
} return num.get();
public void setNum(SimpleIntegerProperty num) { }
this.num = num;
} public void setNum(SimpleIntegerProperty num) {
public String getBatchNum() { this.num = num;
return batchNum.get(); }
}
public void setBatchNum(SimpleStringProperty batchNum) { public String getBatchNum() {
this.batchNum = batchNum; return batchNum.get();
} }
public String getProductMaterialNo() {
return productMaterialNo.get(); public void setBatchNum(SimpleStringProperty batchNum) {
} this.batchNum = batchNum;
public void setProductMaterialNo(SimpleStringProperty productMaterialNo) { }
this.productMaterialNo = productMaterialNo;
} public String getProductMaterialNo() {
public String getStatus() { return productMaterialNo.get();
return status.get(); }
}
public void setStatus(SimpleStringProperty status) { public void setProductMaterialNo(SimpleStringProperty productMaterialNo) {
this.status = status; this.productMaterialNo = productMaterialNo;
} }
public String getCreateDate() {
return createDate.get(); public String getStatus() {
} return status.get();
public void setCreateDate(SimpleStringProperty createDate) { }
this.createDate = createDate;
} public void setStatus(SimpleStringProperty status) {
public String getCreateTime() { this.status = status;
return createTime.get(); }
}
public void setCreateTime(SimpleStringProperty createTime) { public String getCreateDate() {
this.createTime = createTime; return createDate.get();
} }
public String getReturnDate() {
return returnDate.get(); public void setCreateDate(SimpleStringProperty createDate) {
} this.createDate = createDate;
public void setReturnDate(SimpleStringProperty returnDate) { }
this.returnDate = returnDate;
} public String getCreateTime() {
public String getReturnTime() { return createTime.get();
return returnTime.get(); }
}
public void setReturnTime(SimpleStringProperty returnTime) { public void setCreateTime(SimpleStringProperty createTime) {
this.returnTime = returnTime; this.createTime = createTime;
} }
public String getWbsNo() {
return wbsNo.get(); public String getReturnDate() {
} return returnDate.get();
public void setWbsNo(SimpleStringProperty wbsNo) { }
this.wbsNo = wbsNo;
} public void setReturnDate(SimpleStringProperty returnDate) {
public String getMessage() { this.returnDate = returnDate;
return message.get(); }
}
public void setMessage(SimpleStringProperty message) { public String getReturnTime() {
this.message = message; return returnTime.get();
} }
public String getPlmStatus() {
return plmStatus.get(); public void setReturnTime(SimpleStringProperty returnTime) {
} this.returnTime = returnTime;
public void setPlmStatus(SimpleStringProperty plmStatus) { }
this.plmStatus = plmStatus;
} public String getWbsNo() {
public DetailsBean(SimpleIntegerProperty num, SimpleStringProperty batchNum, SimpleStringProperty productMaterialNo, return wbsNo.get();
SimpleStringProperty wbsNo, SimpleStringProperty status, SimpleStringProperty message, }
SimpleStringProperty createDate, SimpleStringProperty createTime, SimpleStringProperty returnDate,
SimpleStringProperty returnTime, SimpleStringProperty plmStatus) { public void setWbsNo(SimpleStringProperty wbsNo) {
super(); this.wbsNo = wbsNo;
this.num = num; }
this.batchNum = batchNum;
this.productMaterialNo = productMaterialNo; public String getMessage() {
this.wbsNo = wbsNo; return message.get();
this.status = status; }
this.message = message;
this.createDate = createDate; public void setMessage(SimpleStringProperty message) {
this.createTime = createTime; this.message = message;
this.returnDate = returnDate; }
this.returnTime = returnTime;
this.plmStatus = plmStatus; public String getPlmStatus() {
} return plmStatus.get();
}
public void setPlmStatus(SimpleStringProperty plmStatus) {
this.plmStatus = plmStatus;
}
public DetailsBean(SimpleIntegerProperty num, SimpleStringProperty batchNum, SimpleStringProperty productMaterialNo,
SimpleStringProperty wbsNo, SimpleStringProperty status, SimpleStringProperty message,
SimpleStringProperty createDate, SimpleStringProperty createTime, SimpleStringProperty returnDate,
SimpleStringProperty returnTime, SimpleStringProperty plmStatus) {
super();
this.num = num;
this.batchNum = batchNum;
this.productMaterialNo = productMaterialNo;
this.wbsNo = wbsNo;
this.status = status;
this.message = message;
this.createDate = createDate;
this.createTime = createTime;
this.returnDate = returnDate;
this.returnTime = returnTime;
this.plmStatus = plmStatus;
}
} }

@ -2,12 +2,18 @@ package com.chint.plm.SearchSapResult;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date;
import java.util.List; import java.util.List;
import javax.swing.filechooser.FileSystemView;
import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet; import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.apache.poi.xssf.usermodel.XSSFWorkbook;
@ -44,340 +50,400 @@ import javafx.scene.layout.GridPane;
import javafx.scene.layout.StackPane; import javafx.scene.layout.StackPane;
import javafx.stage.Stage; import javafx.stage.Stage;
/**
* @author cyh
*
*/
/** /**
* @author cyh * @author cyh
* *
*/ */
public class DetailsController { public class DetailsController {
@FXML @FXML
private Button bt_last; private Button bt_last;
@FXML @FXML
private Button bt_next; private Button bt_next;
@FXML @FXML
private TableColumn<DetailsBean, String> tc_cDate; private TableColumn<DetailsBean, String> tc_cDate;
@FXML @FXML
private TableColumn<DetailsBean, String> tc_msg; private TableColumn<DetailsBean, String> tc_msg;
@FXML @FXML
private TableColumn<DetailsBean, String> tc_cTime; private TableColumn<DetailsBean, String> tc_cTime;
@FXML @FXML
private TableView<DetailsBean> tableView; private TableView<DetailsBean> tableView;
@FXML @FXML
private TableColumn<DetailsBean, String> tc_returnTime; private TableColumn<DetailsBean, String> tc_returnTime;
@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
private TableColumn<DetailsBean, String> tc_SapResult; private TableColumn<DetailsBean, String> tc_SapResult;
@FXML @FXML
private TableColumn<DetailsBean, Integer> tc_xh; private TableColumn<DetailsBean, Integer> tc_xh;
@FXML @FXML
private TableColumn<DetailsBean, String> tc_material; private TableColumn<DetailsBean, String> tc_material;
@FXML @FXML
private TableColumn<DetailsBean, String> tc_returnDate; private TableColumn<DetailsBean, String> tc_returnDate;
@FXML @FXML
private TableColumn<DetailsBean, String> tc_plm; private TableColumn<DetailsBean, String> tc_plm;
@FXML @FXML
private CheckBox cb_errBtn; private CheckBox cb_errBtn;
@FXML @FXML
private Label lb_page; private Label lb_page;
@FXML @FXML
private Button bt_first; private Button bt_first;
@FXML @FXML
private StackPane stackPane; private StackPane stackPane;
@FXML @FXML
private Button bt_tail; private Button bt_tail;
@FXML @FXML
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>> errMsgBeans = new ArrayList<>(); // 记录错误的数据
List<List<DetailsBean>> allMsgBeans; // 记录全部数据 List<List<DetailsBean>> allMsgBeans = new ArrayList<>(); // 记录全部数据
@FXML /**
void firstAction(ActionEvent event) { * @param event
pageNum = 0; * @function
ObservableList<DetailsBean> data = FXCollections.observableArrayList(tableBeans.get(0)); */
tableView.getItems().clear(); @FXML
tableView.setItems(data); void firstAction(ActionEvent event) {
} pageNum = 0;
ObservableList<DetailsBean> data = FXCollections.observableArrayList(tableBeans.get(0));
@FXML tableView.getItems().clear();
void lastAction(ActionEvent event) { tableView.setItems(data);
if (pageNum > 0) { }
pageNum = pageNum - 1;
} /**
ObservableList<DetailsBean> data = FXCollections.observableArrayList(tableBeans.get(pageNum)); * @param event
tableView.getItems().clear(); * @function
tableView.setItems(data); */
} @FXML
void lastAction(ActionEvent event) {
@FXML if (pageNum > 0) {
void nextAction(ActionEvent event) { pageNum = pageNum - 1;
if (pageNum < tableBeans.size() - 1) { }
pageNum = pageNum + 1; ObservableList<DetailsBean> data = FXCollections.observableArrayList(tableBeans.get(pageNum));
} tableView.getItems().clear();
ObservableList<DetailsBean> data = FXCollections.observableArrayList(tableBeans.get(pageNum)); tableView.setItems(data);
tableView.getItems().clear(); }
tableView.setItems(data);
} /**
* @param event
@FXML * @function
void tailAction(ActionEvent event) { */
pageNum = tableBeans.size() - 1; @FXML
ObservableList<DetailsBean> data = FXCollections.observableArrayList(tableBeans.get(pageNum)); void nextAction(ActionEvent event) {
tableView.getItems().clear(); if (pageNum < tableBeans.size() - 1) {
tableView.setItems(data); pageNum = pageNum + 1;
} }
ObservableList<DetailsBean> data = FXCollections.observableArrayList(tableBeans.get(pageNum));
@FXML tableView.getItems().clear();
private FlowPane flowPane; tableView.setItems(data);
@FXML }
private ScrollPane scrollPane;
@FXML /**
private GridPane girdPane; * @param event
* @function
/** */
* @param event @FXML
* @function void tailAction(ActionEvent event) {
*/ pageNum = tableBeans.size() - 1;
@FXML ObservableList<DetailsBean> data = FXCollections.observableArrayList(tableBeans.get(pageNum));
void allAction(ActionEvent event) { tableView.getItems().clear();
List<DetailsBean> allBeans = new ArrayList<DetailsBean>(); tableView.setItems(data);
for (int i = 0; i < tableBeans.size(); i++) { }
allBeans.addAll(tableBeans.get(i));
} @FXML
ObservableList<DetailsBean> data = FXCollections.observableArrayList(allBeans); private FlowPane flowPane;
tableView.getItems().clear(); @FXML
tableView.setItems(data); private ScrollPane scrollPane;
} @FXML
private GridPane girdPane;
protected AbstractAIFApplication app;
private TCSession session; /**
* @param event
/** * @function
* @param event */
* @function EXCEL @FXML
*/ void allAction(ActionEvent event) {
@FXML List<DetailsBean> allBeans = new ArrayList<DetailsBean>();
void outputAction(ActionEvent event) { for (int i = 0; i < tableBeans.size(); i++) {
allBeans.addAll(tableBeans.get(i));
// 获取首选项的文件 }
File tempFile = Util.getFile(session, "CHINT_BOM_RESULT_TEMPLATE", "MSExcelX"); ObservableList<DetailsBean> data = FXCollections.observableArrayList(allBeans);
if (tempFile == null) { tableView.getItems().clear();
MessageBox.post("未找到excel模板请检查CHINT_BOM_RESULT_TEMPLATE.", "失败", MessageBox.INFORMATION); tableView.setItems(data);
return; }
}
try { protected AbstractAIFApplication app;
FileInputStream in = new FileInputStream(tempFile); private TCSession session;
XSSFWorkbook wb = new XSSFWorkbook(in);
in.close(); /**
* @param event
XSSFSheet sheetAt = wb.getSheet("SAP传递结果导出"); * @function EXCEL
for (List<DetailsBean> detailList : tableBeans) { */
@FXML
} void outputAction(ActionEvent event) {
} catch (Exception e) { // 获取首选项的文件
// TODO Auto-generated catch block File tempFile = Util.getFile(session, "CHINT_BOM_RESULT_TEMPLATE", "MSExcelX");
e.printStackTrace(); if (tempFile == null) {
} MessageBox.post("未找到excel模板请检查CHINT_BOM_RESULT_TEMPLATE.", "失败", MessageBox.INFORMATION);
return;
} }
try {
private StringBuilder sqlTotal; FileInputStream in = new FileInputStream(tempFile);
XSSFWorkbook wb = new XSSFWorkbook(in);
public void initData(Stage primaryStage, boolean onlyError, StringBuilder sqlTotal) { in.close();
// TODO Auto-generated method stub
this.sqlTotal = sqlTotal; XSSFSheet sheetAt = wb.getSheet("SAP传递结果导出");
this.app = AIFUtility.getCurrentApplication(); for (List<DetailsBean> detailList : tableBeans) {
this.session = (TCSession) app.getSession(); // 导出excel设置值
// 表格列绑定bean对象 for (DetailsBean detailsBean : detailList) {
tc_xh.setSortable(false); XSSFRow row1 = Util.getRow(sheetAt, detailsBean.getNum());
tc_cDate.setSortable(false); Util.setCellValue(row1.getCell(0), 0, row1, detailsBean.getNum() + "");// 序号
tc_msg.setSortable(false); Util.setCellValue(row1.getCell(1), 1, row1, detailsBean.getBatchNum());// 批次号
tc_cTime.setSortable(false); Util.setCellValue(row1.getCell(2), 2, row1, detailsBean.getProductMaterialNo());// 父物料编码
tc_returnTime.setSortable(false); Util.setCellValue(row1.getCell(3), 3, row1, detailsBean.getWbsNo());// WBS
tc_batch.setSortable(false); Util.setCellValue(row1.getCell(4), 4, row1, detailsBean.getStatus());// SAP状态
tc_wbs.setSortable(false); Util.setCellValue(row1.getCell(5), 5, row1, detailsBean.getMessage());// 具体信息
tc_SapResult.setSortable(false); Util.setCellValue(row1.getCell(6), 6, row1, detailsBean.getCreateDate());// BOM创建日期
tc_plm.setSortable(false); Util.setCellValue(row1.getCell(7), 7, row1, detailsBean.getCreateTime());// BOM创建时间
tc_material.setSortable(false); Util.setCellValue(row1.getCell(8), 8, row1, detailsBean.getReturnDate());// BOM同步日期
tc_returnDate.setSortable(false); Util.setCellValue(row1.getCell(9), 9, row1, detailsBean.getReturnTime());// BOM同步时间
// 列绑定bean对象 Util.setCellValue(row1.getCell(9), 9, row1, detailsBean.getPlmStatus());// PLM状态
tc_xh.setCellValueFactory(new PropertyValueFactory<DetailsBean, Integer>("num")); }
tc_batch.setCellValueFactory(new PropertyValueFactory<DetailsBean, String>("batchNum")); }
tc_material.setCellValueFactory(new PropertyValueFactory<DetailsBean, String>("productMaterialNo")); // 桌面
tc_wbs.setCellValueFactory(new PropertyValueFactory<DetailsBean, String>("wbsNo")); File desktopDir = FileSystemView.getFileSystemView().getHomeDirectory();
tc_SapResult.setCellValueFactory(new PropertyValueFactory<DetailsBean, String>("status")); String desktopPath = desktopDir.getAbsolutePath();
tc_msg.setCellValueFactory(new PropertyValueFactory<>("message")); // 文件保存到桌面,名称:结果导出时间戳
SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmmss");
String pathName = "结果导出" + format.format(new Date()) + ".xlsx";
File file2 = new File(desktopPath + File.separator + pathName);
FileOutputStream os = new FileOutputStream(file2);
wb.write(os);
os.flush();
os.close();
Runtime.getRuntime().exec("cmd /c start "+desktopPath + File.separator + pathName);
// MessageBox.post("导出完成.","提示",2);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
private Stage primaryStage;
private StringBuilder sqlTotal;
/**
* @param primaryStage
* @param onlyError
* @param sqlTotal
* @function
*/
public void initData(Stage primaryStage, boolean onlyError, StringBuilder sqlTotal) {
// TODO Auto-generated method stub
this.sqlTotal = sqlTotal;
this.app = AIFUtility.getCurrentApplication();
this.session = (TCSession) app.getSession();
// 表格列绑定bean对象
this.primaryStage = primaryStage;
tc_xh.setSortable(false);
tc_cDate.setSortable(false);
tc_msg.setSortable(false);
tc_cTime.setSortable(false);
tc_returnTime.setSortable(false);
tc_batch.setSortable(false);
tc_wbs.setSortable(false);
tc_SapResult.setSortable(false);
tc_plm.setSortable(false);
tc_material.setSortable(false);
tc_returnDate.setSortable(false);
// 列绑定bean对象
tc_xh.setCellValueFactory(new PropertyValueFactory<DetailsBean, Integer>("num"));
tc_batch.setCellValueFactory(new PropertyValueFactory<DetailsBean, String>("batchNum"));
tc_material.setCellValueFactory(new PropertyValueFactory<DetailsBean, String>("productMaterialNo"));
tc_wbs.setCellValueFactory(new PropertyValueFactory<DetailsBean, String>("wbsNo"));
tc_SapResult.setCellValueFactory(new PropertyValueFactory<DetailsBean, String>("status"));
tc_msg.setCellValueFactory(new PropertyValueFactory<>("message"));
// tc_log.setCellValueFactory(new PropertyValueFactory<>("user")); // tc_log.setCellValueFactory(new PropertyValueFactory<>("user"));
tc_cDate.setCellValueFactory(new PropertyValueFactory<DetailsBean, String>("createDate")); tc_cDate.setCellValueFactory(new PropertyValueFactory<DetailsBean, String>("createDate"));
tc_cTime.setCellValueFactory(new PropertyValueFactory<DetailsBean, String>("createTime")); tc_cTime.setCellValueFactory(new PropertyValueFactory<DetailsBean, String>("createTime"));
tc_returnDate.setCellValueFactory(new PropertyValueFactory<DetailsBean, String>("returnDate")); tc_returnDate.setCellValueFactory(new PropertyValueFactory<DetailsBean, String>("returnDate"));
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));
tc_wbs.prefWidthProperty().bind(tableView.widthProperty().multiply(0.1)); tc_wbs.prefWidthProperty().bind(tableView.widthProperty().multiply(0.1));
tc_SapResult.prefWidthProperty().bind(tableView.widthProperty().multiply(0.1)); tc_SapResult.prefWidthProperty().bind(tableView.widthProperty().multiply(0.1));
tc_msg.prefWidthProperty().bind(tableView.widthProperty().multiply(0.35)); tc_msg.prefWidthProperty().bind(tableView.widthProperty().multiply(0.35));
tc_cDate.prefWidthProperty().bind(tableView.widthProperty().multiply(0.08)); tc_cDate.prefWidthProperty().bind(tableView.widthProperty().multiply(0.08));
tc_cTime.prefWidthProperty().bind(tableView.widthProperty().multiply(0.08)); tc_cTime.prefWidthProperty().bind(tableView.widthProperty().multiply(0.08));
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();
} catch (Exception e) { } catch (Exception e) {
// TODO Auto-generated catch block // TODO Auto-generated catch block
e.printStackTrace(); e.printStackTrace();
} }
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) {
// 更新GUI组件 // 更新GUI组件
// Platform.runLater(new Runnable() { // Platform.runLater(new Runnable() {
double width = primaryStage.getWidth(); double width = primaryStage.getWidth();
System.out.println("width==>" + width); double height = primaryStage.getHeight();
girdPane.setPrefWidth(width * 0.98); System.out.println("width==>" + width);
flowPane.setPrefWidth(width * 0.98); girdPane.setPrefWidth(width * 0.98);
scrollPane.setPrefWidth(width * 0.98); flowPane.setPrefWidth(width * 0.98);
tableView.setPrefWidth(width * 0.98); scrollPane.setPrefWidth(width * 0.98);
} tableView.setPrefWidth(width * 0.98);
}); scrollPane.setPrefHeight(height*0.8);
primaryStage.setMaximized(true); tableView.setPrefHeight(height*0.8);
cb_errBtn.selectedProperty().addListener(new ChangeListener<Boolean>() { }
@Override });
public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) { primaryStage.setMaximized(true);
// just show results cb_errBtn.selectedProperty().addListener(new ChangeListener<Boolean>() {
try { @Override
if (flagEdit) { public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) {
flagEdit = false; // just show results
searchErrMsg(); try {
Platform.runLater(() -> { if (flagEdit) {
flagEdit = true; flagEdit = false;
}); searchErrMsg();
} Platform.runLater(() -> {
} catch (Exception ex) { flagEdit = true;
ex.printStackTrace(); });
} finally { }
System.out.println("END" + sqlTotal.toString()); } catch (Exception ex) {
SqlUtil.freeAll(); 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) { pageNumTxt.setOnKeyPressed(new EventHandler<KeyEvent>() {
// showHistoryWords(querybox.getText()); @Override
} public void handle(KeyEvent event) {
} if (event.getCode() == KeyCode.ENTER) {
}); String text = pageNumTxt.getText();
int num = 0;
} try {
int parseInt = Integer.parseInt(text);
private boolean flagEdit = true; num = parseInt;
/** } catch (Exception e) {
* @param event }
* @function if (num > 0 && num <= tableBeans.size()) {
*/ pageNum = num;
ObservableList<DetailsBean> data = FXCollections.observableArrayList(tableBeans.get(num - 1));
tableView.getItems().clear();
tableView.setItems(data);
}
}
}
});
}
private boolean flagEdit = true;
/**
* @param event
* @function
*/
// @FXML // @FXML
// void errBtnAction(ActionEvent event) { // void errBtnAction(ActionEvent event) {
// //
// } // }
/** /**
* @throws Exception * @throws Exception
* @function * @function
*/ */
private void searchErrMsg() throws Exception { private void searchErrMsg() throws Exception {
// 单个BOM具体信息 : 全部状态. // 单个BOM具体信息 : 全部状态.
List<List<DetailsBean>> tableBeans = new ArrayList<List<DetailsBean>>(); List<List<DetailsBean>> tableBeans = new ArrayList<List<DetailsBean>>();
if (cb_errBtn.isSelected() && errMsgBeans.size() > 0) { if (cb_errBtn.isSelected() && errMsgBeans.size() > 0) {
tableBeans = errMsgBeans; tableBeans = errMsgBeans;
} else if (!cb_errBtn.isSelected() && allMsgBeans.size() > 0) { } else if (!cb_errBtn.isSelected() && allMsgBeans.size() > 0) {
tableBeans = allMsgBeans; tableBeans = allMsgBeans;
} else { } 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); String[] prefs = ChintPreferenceUtil.getPreferences("database_tc", session);
SqlUtil.getTCDataConnection(prefs); SqlUtil.getTCDataConnection(prefs);
System.out.println("cb_errBtn" + cb_errBtn.isSelected()); System.out.println("cb_errBtn" + cb_errBtn.isSelected());
System.out.println("sqlDetail" + sqlDetail.toString()); 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;
while (read.next()) { while (read.next()) {
// 分页 20 查询结果放入表格 // 分页 20 查询结果放入表格
DetailsBean sumBean = new DetailsBean(new SimpleIntegerProperty(i), DetailsBean sumBean = new DetailsBean(new SimpleIntegerProperty(i),
new SimpleStringProperty(read.getString(1)), new SimpleStringProperty(read.getString(2)), new SimpleStringProperty(read.getString(1)), new SimpleStringProperty(read.getString(2)),
new SimpleStringProperty(read.getString(3)), new SimpleStringProperty(read.getString(4)), new SimpleStringProperty(read.getString(3)), new SimpleStringProperty(read.getString(4)),
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 % 40 == 1) { if (i % 40 == 1) {
beanList = new ArrayList<DetailsBean>(); beanList = new ArrayList<DetailsBean>();
tableBeans.add(beanList); tableBeans.add(beanList);
} }
beanList.add(sumBean); beanList.add(sumBean);
i = i + 1; i = i + 1;
} }
SqlUtil.freeAll(); SqlUtil.freeAll();
if (tableBeans.size() == 0) { if (tableBeans.size() == 0) {
beanList = new ArrayList<DetailsBean>(); beanList = new ArrayList<DetailsBean>();
tableBeans.add(beanList); tableBeans.add(beanList);
} }
if (errMsgBeans.size() == 0 && cb_errBtn.isSelected()) { if (errMsgBeans.size() == 0 && cb_errBtn.isSelected()) {
errMsgBeans = tableBeans; errMsgBeans = tableBeans;
} else if (allMsgBeans.size() == 0 && !cb_errBtn.isSelected()) { } else if (allMsgBeans.size() == 0 && !cb_errBtn.isSelected()) {
allMsgBeans = tableBeans; 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"); pageNumTxt.setText("1");
} }
} }

@ -7,20 +7,20 @@ import com.chint.plm.fxUtil.KFrame;
import javafx.embed.swing.JFXPanel; import javafx.embed.swing.JFXPanel;
public class SapResultFrame extends KFrame{ public class SapResultFrame extends KFrame {
public SapResultFrame() { public SapResultFrame() {
super(); super();
} }
@Override @Override
protected void initUI() throws Exception { protected void initUI() throws Exception {
this.setTitle("SAP´«µÝ½á¹û²éѯ"); this.setTitle("SAP´«µÝ½á¹û²éѯ");
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
this.setPreferredSize(new Dimension(1200, 800)); this.setPreferredSize(new Dimension(1200, 800));
JFXPanel panel = new JFXPanel(); JFXPanel panel = new JFXPanel();
panel.setScene(new SapResultPanel(this).getScene()); panel.setScene(new SapResultPanel(this).getScene());
this.add(BorderLayout.CENTER, panel); this.add(BorderLayout.CENTER, panel);
} }
} }

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

@ -52,475 +52,475 @@ import javafx.scene.layout.StackPane;
public class SearchSapController extends KFXPanelController { public class SearchSapController extends KFXPanelController {
@FXML @FXML
private TitledPane tp_result; private TitledPane tp_result;
@FXML @FXML
private Button bt_closeAll; private Button bt_closeAll;
@FXML @FXML
private TitledPane mxtjPane; private TitledPane mxtjPane;
@FXML @FXML
private GridPane bt_cx; // 按钮的pane private GridPane bt_cx; // 按钮的pane
@FXML @FXML
private Button bt_close; // 关闭 private Button bt_close; // 关闭
@FXML @FXML
private Button bt_czcx;// 重置查询 private Button bt_czcx;// 重置查询
@FXML @FXML
private StackPane stackPane; private StackPane stackPane;
// table的列 // table的列
@FXML @FXML
private TableColumn<SumTableBean, String> tc_xh; private TableColumn<SumTableBean, String> tc_xh;
@FXML @FXML
private TableColumn<SumTableBean, String> tc_zrws; private TableColumn<SumTableBean, String> tc_zrws;
@FXML @FXML
private TableColumn<SumTableBean, String> tc_rwh; private TableColumn<SumTableBean, String> tc_rwh;
@FXML @FXML
private TableColumn<SumTableBean, String> tc_fqsj; private TableColumn<SumTableBean, String> tc_fqsj;
@FXML @FXML
private TableColumn<SumTableBean, String> tc_fqr; private TableColumn<SumTableBean, String> tc_fqr;
@FXML @FXML
private TableColumn<SumTableBean, String> tc_status; private TableColumn<SumTableBean, String> tc_status;
@FXML @FXML
private TableColumn<SumTableBean, Object> tc_log; private TableColumn<SumTableBean, Object> tc_log;
@FXML @FXML
private TableColumn<SumTableBean, String> tc_sapState; private TableColumn<SumTableBean, String> tc_sapState;
@FXML @FXML
private TableColumn<SumTableBean, String> tc_plm; private TableColumn<SumTableBean, String> tc_plm;
@FXML @FXML
private TableColumn<SumTableBean, Object> tc_result; private TableColumn<SumTableBean, Object> tc_result;
@FXML @FXML
private TitledPane tp_sxtj;// 筛选条件pane private TitledPane tp_sxtj;// 筛选条件pane
@FXML @FXML
private TitledPane rwtjPane; // 任务条件pane private TitledPane rwtjPane; // 任务条件pane
@FXML @FXML
private GridPane gridPane; // 第一个pane插入日期控件 private GridPane gridPane; // 第一个pane插入日期控件
@FXML @FXML
private TextField tx_bh; // 文本 任务编号 private TextField tx_bh; // 文本 任务编号
@FXML @FXML
private ComboBox<String> cb_factory; // 工厂下拉 private ComboBox<String> cb_factory; // 工厂下拉
@FXML @FXML
private TextField tx_wbs; // wbs号 private TextField tx_wbs; // wbs号
@FXML @FXML
private ComboBox<String> cb_status; // 数据状态 private ComboBox<String> cb_status; // 数据状态
@FXML @FXML
private TextField tx_user;// 发起人 private TextField tx_user;// 发起人
@FXML @FXML
private ComboBox<String> cb_sapState; // sap处理结果 private ComboBox<String> cb_sapState; // sap处理结果
@FXML @FXML
private TextField tx_projectName;// 项目名称 private TextField tx_projectName;// 项目名称
@FXML @FXML
private CheckBox bt_errTask;// 查询错误任务 private CheckBox bt_errTask;// 查询错误任务
@FXML @FXML
private CheckBox bt_errMsg; // 单个BOM错误信息 private CheckBox bt_errMsg; // 单个BOM错误信息
// 明细条件 // 明细条件
@FXML @FXML
private ComboBox<String> tx_sapStatus;// sap数据状态 private ComboBox<String> tx_sapStatus;// sap数据状态
@FXML @FXML
private TextField tx_pcode;// 父物料编码 private TextField tx_pcode;// 父物料编码
@FXML @FXML
private TextField tx_wbsMx;// wbs private TextField tx_wbsMx;// wbs
@FXML @FXML
private TextField tx_sapReturn;// sap返回信息 private TextField tx_sapReturn;// sap返回信息
@FXML @FXML
private TextField tx_batchNum;// 批次号 private TextField tx_batchNum;// 批次号
@FXML @FXML
private Button bt_wy; // 按钮尾页 private Button bt_wy; // 按钮尾页
@FXML @FXML
private Button bt_syy; // 上一页 private Button bt_syy; // 上一页
@FXML @FXML
private Button bt_xyy;// 下一页 private Button bt_xyy;// 下一页
@FXML @FXML
private Button bt_sy;// 首页 private Button bt_sy;// 首页
@FXML @FXML
private Button bt_search; private Button bt_search;
@FXML @FXML
private TableView<SumTableBean> tableView; private TableView<SumTableBean> tableView;
// 全部关闭 // 全部关闭
@FXML @FXML
void clossAll(ActionEvent event) { void clossAll(ActionEvent event) {
frame.dispose(); frame.dispose();
} }
String getCombText(Object comb) { String getCombText(Object comb) {
String textVal = ""; String textVal = "";
if (comb instanceof TextField) { if (comb instanceof TextField) {
textVal = ((TextField) comb).getText(); textVal = ((TextField) comb).getText();
} else if (comb instanceof ComboBox) { } else if (comb instanceof ComboBox) {
SingleSelectionModel<?> selectionModel = ((ComboBox<?>) comb).getSelectionModel(); SingleSelectionModel<?> selectionModel = ((ComboBox<?>) comb).getSelectionModel();
if (selectionModel.getSelectedIndex() >= 0) { if (selectionModel.getSelectedIndex() >= 0) {
textVal = ((ComboBox<?>) comb).getSelectionModel().getSelectedItem().toString(); textVal = ((ComboBox<?>) comb).getSelectionModel().getSelectedItem().toString();
} }
} else if (comb instanceof CheckBox) { } else if (comb instanceof CheckBox) {
boolean selected = ((CheckBox) comb).isSelected(); boolean selected = ((CheckBox) comb).isSelected();
} }
return textVal; return textVal;
} }
private int pageNum;// 分页显示当前第几页 private int pageNum;// 分页显示当前第几页
private List<List<SumTableBean>> tableBeans = new ArrayList<List<SumTableBean>>(); private List<List<SumTableBean>> tableBeans = new ArrayList<List<SumTableBean>>();
// 查询操作 // 查询操作
@FXML @FXML
void searchAction(ActionEvent event) { void searchAction(ActionEvent event) {
// 拼接查询语句 // 拼接查询语句
StringBuilder sql = new StringBuilder( StringBuilder sql = new StringBuilder(
"select \"CODE\",\"USER\",STARTTIME,\"NUMBER\",SAPRESULT,DATASTATUS,PLMRESULT,LOGURL from CHINT_BOM_TO_SAP_SUM where 1=1"); "select \"CODE\",\"USER\",STARTTIME,\"NUMBER\",SAPRESULT,DATASTATUS,PLMRESULT,LOGURL from CHINT_BOM_TO_SAP_SUM where 1=1");
String code = getCombText(tx_bh); String code = getCombText(tx_bh);
if (!code.isEmpty()) { if (!code.isEmpty()) {
sql.append(" and \"CODE\" = '").append(code).append("'"); sql.append(" and \"CODE\" = '").append(code).append("'");
} }
String factory = getCombText(cb_factory); String factory = getCombText(cb_factory);
if (!factory.isEmpty()) { if (!factory.isEmpty()) {
sql.append(" and factory = '").append(factory).append("'"); sql.append(" and factory = '").append(factory).append("'");
} }
String wbsno = getCombText(tx_wbs); String wbsno = getCombText(tx_wbs);
if (!wbsno.isEmpty()) { if (!wbsno.isEmpty()) {
sql.append(" and wbsno = '").append(wbsno).append("'"); sql.append(" and wbsno = '").append(wbsno).append("'");
} }
String datastatus = getCombText(cb_status); String datastatus = getCombText(cb_status);
if (!datastatus.isEmpty()) { if (!datastatus.isEmpty()) {
sql.append(" and datastatus = '").append(datastatus).append("'"); sql.append(" and datastatus = '").append(datastatus).append("'");
} }
String user = getCombText(tx_user); String user = getCombText(tx_user);
System.out.println("user==>" + user); System.out.println("user==>" + user);
if (!user.isEmpty()) { if (!user.isEmpty()) {
sql.append(" and \"USER\" = '").append(user).append("'"); sql.append(" and \"USER\" = '").append(user).append("'");
} }
String sapresult = getCombText(cb_sapState); String sapresult = getCombText(cb_sapState);
if (!sapresult.isEmpty()) { if (!sapresult.isEmpty()) {
sql.append(" and sapresult = '").append(sapresult).append("'"); sql.append(" and sapresult = '").append(sapresult).append("'");
} }
String projectno = getCombText(tx_projectName); String projectno = getCombText(tx_projectName);
if (!projectno.isEmpty()) { if (!projectno.isEmpty()) {
sql.append(" and projectno = '").append(projectno).append("'"); sql.append(" and projectno = '").append(projectno).append("'");
} }
if (bt_errTask.isSelected()) { if (bt_errTask.isSelected()) {
sql.append(" and SAPRESULT = '部分失败' "); sql.append(" and SAPRESULT = '部分失败' ");
} }
ObjectProperty<LocalDateTime> dateTimeProperty = dateTimeStart.dateTimeProperty(); ObjectProperty<LocalDateTime> dateTimeProperty = dateTimeStart.dateTimeProperty();
if (dateTimeProperty != null && dateTimeProperty.get() != null) { if (dateTimeProperty != null && dateTimeProperty.get() != null) {
String startTime = dateTimeProperty.get().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); String startTime = dateTimeProperty.get().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
sql.append(" and starttime >= to_date('").append(startTime).append("','yyyy-mm-ddhh24:mi:ss') "); // to_date(?,'yyyy-mm-ddhh24:mi:ss') sql.append(" and starttime >= to_date('").append(startTime).append("','yyyy-mm-ddhh24:mi:ss') "); // to_date(?,'yyyy-mm-ddhh24:mi:ss')
System.out.println("startTime==>" + startTime); System.out.println("startTime==>" + startTime);
} }
ObjectProperty<LocalDateTime> dateTimeProperty2 = dateTimeEnd.dateTimeProperty(); ObjectProperty<LocalDateTime> dateTimeProperty2 = dateTimeEnd.dateTimeProperty();
if (dateTimeProperty2 != null && dateTimeProperty2.get() != null) { if (dateTimeProperty2 != null && dateTimeProperty2.get() != null) {
String endTime = dateTimeProperty2.get().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); String endTime = dateTimeProperty2.get().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
sql.append(" and starttime <= to_date('").append(endTime).append("','yyyy-mm-ddhh24:mi:ss') "); // to_date(?,'yyyy-mm-ddhh24:mi:ss') sql.append(" and starttime <= to_date('").append(endTime).append("','yyyy-mm-ddhh24:mi:ss') "); // to_date(?,'yyyy-mm-ddhh24:mi:ss')
System.out.println("endTime==>" + endTime); System.out.println("endTime==>" + endTime);
} }
// 拼接DETAILS表的SQL信息 // 拼接DETAILS表的SQL信息
StringBuilder detailSql = new StringBuilder(""); StringBuilder detailSql = new StringBuilder("");
String batchNum = getCombText(tx_batchNum); String batchNum = getCombText(tx_batchNum);
if (!batchNum.isEmpty()) { if (!batchNum.isEmpty()) {
detailSql.append(" and batchnumber = '").append(batchNum).append("'"); detailSql.append(" and batchnumber = '").append(batchNum).append("'");
} }
String wbsnoDetail = getCombText(tx_wbsMx); String wbsnoDetail = getCombText(tx_wbsMx);
if (!wbsnoDetail.isEmpty()) { if (!wbsnoDetail.isEmpty()) {
detailSql.append(" and wbsno = '").append(wbsnoDetail).append("'"); detailSql.append(" and wbsno = '").append(wbsnoDetail).append("'");
} }
String message = getCombText(tx_sapReturn); String message = getCombText(tx_sapReturn);
if (!message.isEmpty()) { if (!message.isEmpty()) {
detailSql.append(" and message like '%").append(message).append("%'"); detailSql.append(" and message like '%").append(message).append("%'");
} }
String productmaterialno = getCombText(tx_pcode); String productmaterialno = getCombText(tx_pcode);
if (!productmaterialno.isEmpty()) { if (!productmaterialno.isEmpty()) {
detailSql.append(" and productmaterialno like '%").append(productmaterialno).append("%'"); detailSql.append(" and productmaterialno like '%").append(productmaterialno).append("%'");
} }
String status = getCombText(tx_sapStatus); String status = getCombText(tx_sapStatus);
if (!status.isEmpty()) { if (!status.isEmpty()) {
if (status.equals("成功")) { if (status.equals("成功")) {
status = "S"; status = "S";
} else { } else {
status = "E"; status = "E";
} }
detailSql.append(" and status = '").append(status).append("'"); detailSql.append(" and status = '").append(status).append("'");
} }
String[] prefs = ChintPreferenceUtil.getPreferences("database_tc", session); String[] prefs = ChintPreferenceUtil.getPreferences("database_tc", session);
SqlUtil.getTCDataConnection(prefs); SqlUtil.getTCDataConnection(prefs);
try { try {
tableBeans.clear(); tableBeans.clear();
sql.append(" order by \"CODE\" asc "); sql.append(" order by \"CODE\" asc ");
System.out.println("read==>" + sql); System.out.println("read==>" + sql);
ResultSet read = SqlUtil.read(sql.toString()); ResultSet read = SqlUtil.read(sql.toString());
int i = 1; int i = 1;
List<SumTableBean> beanList = null; List<SumTableBean> beanList = null;
while (read.next()) { while (read.next()) {
// 分页 20 查询结果放入表格 // 分页 20 查询结果放入表格
System.out.println("read==>" + read.getInt(4)); System.out.println("read==>" + read.getInt(4));
SumTableBean sumBean = new SumTableBean(new SimpleIntegerProperty(i), SumTableBean sumBean = new SumTableBean(new SimpleIntegerProperty(i),
new SimpleStringProperty(String.valueOf(read.getInt(1))), new SimpleStringProperty(String.valueOf(read.getInt(1))),
new SimpleStringProperty(read.getString(2)), new SimpleStringProperty(read.getString(3)), new SimpleStringProperty(read.getString(2)), new SimpleStringProperty(read.getString(3)),
new SimpleStringProperty(String.valueOf(read.getInt(4))), new SimpleStringProperty(String.valueOf(read.getInt(4))),
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)), bt_errMsg.isSelected(), detailSql, prefs, code, new SimpleStringProperty(read.getString(7)), bt_errMsg.isSelected(), detailSql, prefs, code,
read.getString(8)); read.getString(8));
if (i % 20 == 1) { if (i % 20 == 1) {
beanList = new ArrayList<SumTableBean>(); beanList = new ArrayList<SumTableBean>();
tableBeans.add(beanList); tableBeans.add(beanList);
} }
beanList.add(sumBean); beanList.add(sumBean);
i = i + 1; i = i + 1;
} }
if (tableBeans.size() == 0) { if (tableBeans.size() == 0) {
MessageBox.post(frame,"未查询到传递记录.", "提示", 2); MessageBox.post(frame, "未查询到传递记录.", "提示", 2);
beanList = new ArrayList<SumTableBean>(); beanList = new ArrayList<SumTableBean>();
tableBeans.add(beanList); tableBeans.add(beanList);
} }
pageNum = 0; pageNum = 0;
System.out.println("beanList==>" + beanList.size()); System.out.println("beanList==>" + beanList.size());
ObservableList<SumTableBean> data = FXCollections.observableArrayList(tableBeans.get(0)); ObservableList<SumTableBean> data = FXCollections.observableArrayList(tableBeans.get(0));
tableView.getItems().clear(); tableView.getItems().clear();
tableView.setItems(data); tableView.setItems(data);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} finally { } finally {
SqlUtil.freeAll(); SqlUtil.freeAll();
} }
// if(bt_errMsg) // if(bt_errMsg)
} }
@FXML @FXML
private ScrollPane scrollPane; private ScrollPane scrollPane;
@FXML @FXML
private BorderPane resultBorder; private BorderPane resultBorder;
@FXML @FXML
private BorderPane topBorder; private BorderPane topBorder;
private SapResultFrame frame; private SapResultFrame frame;
private DateTimePicker dateTimeStart; private DateTimePicker dateTimeStart;
private DateTimePicker dateTimeEnd; private DateTimePicker dateTimeEnd;
protected AbstractAIFApplication app; protected AbstractAIFApplication app;
private TCSession session; private TCSession session;
@Override @Override
public void initData(KFXPanel paramKFXPanel) throws Exception { public void initData(KFXPanel paramKFXPanel) throws Exception {
// TODO Auto-generated method stub // TODO Auto-generated method stub
frame = (SapResultFrame) paramKFXPanel.getParentDialog(); frame = (SapResultFrame) paramKFXPanel.getParentDialog();
addWindListener(frame); addWindListener(frame);
frame.setMaximumSize(frame.getMaximumSize()); 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();
dateTimeStart = new DateTimePicker(); dateTimeStart = new DateTimePicker();
dateTimeEnd = new DateTimePicker(); dateTimeEnd = new DateTimePicker();
gridPane.add(dateTimeStart, 1, 3); gridPane.add(dateTimeStart, 1, 3);
gridPane.add(dateTimeEnd, 1, 4); gridPane.add(dateTimeEnd, 1, 4);
initCombox(); initCombox();
// 表格列绑定bean对象 // 表格列绑定bean对象
tc_xh.setSortable(false); tc_xh.setSortable(false);
tc_zrws.setSortable(false); tc_zrws.setSortable(false);
tc_rwh.setSortable(false); tc_rwh.setSortable(false);
tc_fqsj.setSortable(false); tc_fqsj.setSortable(false);
tc_fqr.setSortable(false); tc_fqr.setSortable(false);
tc_status.setSortable(false); tc_status.setSortable(false);
tc_log.setSortable(false); tc_log.setSortable(false);
tc_sapState.setSortable(false); tc_sapState.setSortable(false);
tc_plm.setSortable(false); tc_plm.setSortable(false);
tc_result.setSortable(false); tc_result.setSortable(false);
// 列绑定bean对象 // 列绑定bean对象
tc_xh.setCellValueFactory(new PropertyValueFactory<SumTableBean, String>("num")); tc_xh.setCellValueFactory(new PropertyValueFactory<SumTableBean, String>("num"));
tc_zrws.setCellValueFactory(new PropertyValueFactory<SumTableBean, String>("cTaskNum"));// cTaskNum tc_zrws.setCellValueFactory(new PropertyValueFactory<SumTableBean, String>("cTaskNum"));// cTaskNum
tc_rwh.setCellValueFactory(new PropertyValueFactory<SumTableBean, String>("taskNo")); tc_rwh.setCellValueFactory(new PropertyValueFactory<SumTableBean, String>("taskNo"));
tc_fqsj.setCellValueFactory(new PropertyValueFactory<SumTableBean, String>("startTime")); tc_fqsj.setCellValueFactory(new PropertyValueFactory<SumTableBean, String>("startTime"));
tc_fqr.setCellValueFactory(new PropertyValueFactory<SumTableBean, String>("user")); tc_fqr.setCellValueFactory(new PropertyValueFactory<SumTableBean, String>("user"));
tc_status.setCellValueFactory(new PropertyValueFactory<>("dataStatus")); tc_status.setCellValueFactory(new PropertyValueFactory<>("dataStatus"));
tc_log.setCellValueFactory(new PropertyValueFactory<SumTableBean, Object>("logDownload")); tc_log.setCellValueFactory(new PropertyValueFactory<SumTableBean, Object>("logDownload"));
tc_sapState.setCellValueFactory(new PropertyValueFactory<SumTableBean, String>("sapResult")); tc_sapState.setCellValueFactory(new PropertyValueFactory<SumTableBean, String>("sapResult"));
tc_plm.setCellValueFactory(new PropertyValueFactory<SumTableBean, String>("plmResult")); tc_plm.setCellValueFactory(new PropertyValueFactory<SumTableBean, String>("plmResult"));
tc_result.setCellValueFactory(new PropertyValueFactory<SumTableBean, Object>("details")); tc_result.setCellValueFactory(new PropertyValueFactory<SumTableBean, Object>("details"));
tc_xh.prefWidthProperty().bind(tableView.widthProperty().multiply(0.05)); tc_xh.prefWidthProperty().bind(tableView.widthProperty().multiply(0.05));
tc_zrws.prefWidthProperty().bind(tableView.widthProperty().multiply(0.08)); tc_zrws.prefWidthProperty().bind(tableView.widthProperty().multiply(0.08));
tc_rwh.prefWidthProperty().bind(tableView.widthProperty().multiply(0.12)); tc_rwh.prefWidthProperty().bind(tableView.widthProperty().multiply(0.12));
tc_fqsj.prefWidthProperty().bind(tableView.widthProperty().multiply(0.1)); tc_fqsj.prefWidthProperty().bind(tableView.widthProperty().multiply(0.1));
tc_fqr.prefWidthProperty().bind(tableView.widthProperty().multiply(0.1)); tc_fqr.prefWidthProperty().bind(tableView.widthProperty().multiply(0.1));
tc_status.prefWidthProperty().bind(tableView.widthProperty().multiply(0.15)); tc_status.prefWidthProperty().bind(tableView.widthProperty().multiply(0.15));
tc_log.prefWidthProperty().bind(tableView.widthProperty().multiply(0.1)); tc_log.prefWidthProperty().bind(tableView.widthProperty().multiply(0.1));
tc_sapState.prefWidthProperty().bind(tableView.widthProperty().multiply(0.1)); tc_sapState.prefWidthProperty().bind(tableView.widthProperty().multiply(0.1));
tc_plm.prefWidthProperty().bind(tableView.widthProperty().multiply(0.1)); tc_plm.prefWidthProperty().bind(tableView.widthProperty().multiply(0.1));
tc_result.prefWidthProperty().bind(tableView.widthProperty().multiply(0.1)); tc_result.prefWidthProperty().bind(tableView.widthProperty().multiply(0.1));
tp_result.setCollapsible(false); tp_result.setCollapsible(false);
mxtjPane.setCollapsible(false); mxtjPane.setCollapsible(false);
tp_sxtj.setCollapsible(false); tp_sxtj.setCollapsible(false);
rwtjPane.setCollapsible(false); rwtjPane.setCollapsible(false);
tc_sapState.setCellFactory(column -> { tc_sapState.setCellFactory(column -> {
return new TableCell<SumTableBean, String>() { return new TableCell<SumTableBean, String>() {
@Override @Override
protected void updateItem(String item, boolean empty) { protected void updateItem(String item, boolean empty) {
super.updateItem(item, empty); super.updateItem(item, empty);
if (item != null && !empty && !item.isEmpty()) { if (item != null && !empty && !item.isEmpty()) {
// double contrastPrice = Double.parseDouble(item); // double contrastPrice = Double.parseDouble(item);
if (item.equals("未返回")) { if (item.equals("未返回")) {
// 不做格式 // 不做格式
setStyle("-fx-background-color: #ffff99;"); setStyle("-fx-background-color: #ffff99;");
} else if (item.equals("部分失败")) { } else if (item.equals("部分失败")) {
setStyle("-fx-background-color: #FF6600;"); setStyle("-fx-background-color: #FF6600;");
} else { } else {
setStyle("-fx-background-color: #A9D08E;"); setStyle("-fx-background-color: #A9D08E;");
} }
setText(getItem()); setText(getItem());
setAlignment(Pos.CENTER); // 设置单元格内容居中对齐 setAlignment(Pos.CENTER); // 设置单元格内容居中对齐
} else { } else {
setStyle(""); setStyle("");
setText(empty ? null : getItem()); setText(empty ? null : getItem());
setAlignment(Pos.CENTER); // 设置单元格内容居中对齐 setAlignment(Pos.CENTER); // 设置单元格内容居中对齐
} }
} }
}; };
}); });
// tableView.setMaxHeight(pageNum); // tableView.setMaxHeight(pageNum);
} }
// 初始化下拉框内容 // 初始化下拉框内容
private void initCombox() { private void initCombox() {
// TODO Auto-generated method stub // TODO Auto-generated method stub
List<String> factoryList = new ArrayList<String>(); List<String> factoryList = new ArrayList<String>();
factoryList.add("M040"); factoryList.add("M040");
cb_factory.getItems().addAll(factoryList); cb_factory.getItems().addAll(factoryList);
List<String> statusList = new ArrayList<String>(); List<String> statusList = new ArrayList<String>();
statusList.add("数据检查未通过"); statusList.add("数据检查未通过");
statusList.add("数据正常推送SAP"); statusList.add("数据正常推送SAP");
statusList.add("数据未正常推送SAP"); statusList.add("数据未正常推送SAP");
cb_status.getItems().addAll(statusList); cb_status.getItems().addAll(statusList);
List<String> sapStateList = new ArrayList<String>(); List<String> sapStateList = new ArrayList<String>();
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>();
sapStatusList.add("成功"); sapStatusList.add("成功");
sapStatusList.add("失败"); sapStatusList.add("失败");
tx_sapStatus.getItems().addAll(sapStatusList); tx_sapStatus.getItems().addAll(sapStatusList);
} }
// 跳转首页 // 跳转首页
@FXML @FXML
void firstBtnAction(ActionEvent event) { void firstBtnAction(ActionEvent event) {
pageNum = 0; pageNum = 0;
ObservableList<SumTableBean> data = FXCollections.observableArrayList(tableBeans.get(0)); ObservableList<SumTableBean> data = FXCollections.observableArrayList(tableBeans.get(0));
tableView.getItems().clear(); tableView.getItems().clear();
tableView.setItems(data); tableView.setItems(data);
} }
// 跳转上一页 // 跳转上一页
@FXML @FXML
void lastBtnAction(ActionEvent event) { void lastBtnAction(ActionEvent event) {
if (pageNum > 0) { if (pageNum > 0) {
pageNum = pageNum - 1; pageNum = pageNum - 1;
} }
ObservableList<SumTableBean> data = FXCollections.observableArrayList(tableBeans.get(pageNum)); ObservableList<SumTableBean> data = FXCollections.observableArrayList(tableBeans.get(pageNum));
tableView.getItems().clear(); tableView.getItems().clear();
tableView.setItems(data); tableView.setItems(data);
} }
// 跳转下一页 // 跳转下一页
@FXML @FXML
void nextBtnAction(ActionEvent event) { void nextBtnAction(ActionEvent event) {
if (pageNum < tableBeans.size() - 1) { if (pageNum < tableBeans.size() - 1) {
pageNum = pageNum + 1; pageNum = pageNum + 1;
} }
ObservableList<SumTableBean> data = FXCollections.observableArrayList(tableBeans.get(pageNum)); ObservableList<SumTableBean> data = FXCollections.observableArrayList(tableBeans.get(pageNum));
tableView.getItems().clear(); tableView.getItems().clear();
tableView.setItems(data); tableView.setItems(data);
} }
// 跳转尾页 // 跳转尾页
@FXML @FXML
void tailBtnAction(ActionEvent event) { void tailBtnAction(ActionEvent event) {
pageNum = tableBeans.size() - 1; pageNum = tableBeans.size() - 1;
ObservableList<SumTableBean> data = FXCollections.observableArrayList(tableBeans.get(pageNum)); ObservableList<SumTableBean> data = FXCollections.observableArrayList(tableBeans.get(pageNum));
tableView.getItems().clear(); tableView.getItems().clear();
tableView.setItems(data); tableView.setItems(data);
} }
/** /**
* @param frame * @param frame
* @function * @function
*/ */
private void addWindListener(SapResultFrame frame) { private void addWindListener(SapResultFrame frame) {
// TODO Auto-generated method stub // TODO Auto-generated method stub
frame.addComponentListener(new ComponentListener() { frame.addComponentListener(new ComponentListener() {
@Override @Override
public void componentShown(ComponentEvent e) { public void componentShown(ComponentEvent e) {
// TODO Auto-generated method stub // TODO Auto-generated method stub
} }
@Override @Override
public void componentResized(ComponentEvent e) { public void componentResized(ComponentEvent e) {
// TODO Auto-generated method stub // TODO Auto-generated method stub
// System.out.println("=============="); // System.out.println("==============");
Component component = e.getComponent(); Component component = e.getComponent();
System.out.println("component==>" + component); System.out.println("component==>" + component);
double width = component.getSize().getWidth(); double width = component.getSize().getWidth();
// // double width = primaryStage.getWidth(); // // double width = primaryStage.getWidth();
System.out.println("width==>" + width); System.out.println("width==>" + width);
scrollPane.setPrefWidth(width * 0.98); scrollPane.setPrefWidth(width * 0.98);
topBorder.setPrefWidth(width * 0.98); topBorder.setPrefWidth(width * 0.98);
tp_sxtj.setPrefWidth(width * 0.98); tp_sxtj.setPrefWidth(width * 0.98);
resultBorder.setPrefWidth(width * 0.98); resultBorder.setPrefWidth(width * 0.98);
gridPane.setPrefWidth(width * 0.98); gridPane.setPrefWidth(width * 0.98);
tableView.setPrefWidth(width * 0.97); tableView.setPrefWidth(width * 0.97);
// refTable.setPrefWidth(width * 0.97); // refTable.setPrefWidth(width * 0.97);
} }
@Override @Override
public void componentMoved(ComponentEvent e) { public void componentMoved(ComponentEvent e) {
// TODO Auto-generated method stub // TODO Auto-generated method stub
} }
@Override @Override
public void componentHidden(ComponentEvent e) { public void componentHidden(ComponentEvent e) {
// TODO Auto-generated method stub // TODO Auto-generated method stub
} }
}); });
} }
@FXML @FXML
void resetClick(ActionEvent event) { void resetClick(ActionEvent event) {
tx_bh.setText(""); tx_bh.setText("");
cb_sapState.getSelectionModel().clearSelection(); cb_sapState.getSelectionModel().clearSelection();
cb_factory.getSelectionModel().clearSelection(); cb_factory.getSelectionModel().clearSelection();
tx_user.setText(""); tx_user.setText("");
tx_wbs.setText(""); tx_wbs.setText("");
tx_projectName.setText(""); tx_projectName.setText("");
tx_pcode.setText(""); tx_pcode.setText("");
tx_wbsMx.setText(""); tx_wbsMx.setText("");
tx_batchNum.setText(""); tx_batchNum.setText("");
tx_sapReturn.setText(""); tx_sapReturn.setText("");
cb_status.getSelectionModel().clearSelection(); cb_status.getSelectionModel().clearSelection();
tx_sapStatus.getSelectionModel().clearSelection(); tx_sapStatus.getSelectionModel().clearSelection();
bt_errTask.setSelected(false); bt_errTask.setSelected(false);
bt_errMsg.setSelected(false); bt_errMsg.setSelected(false);
dateTimeStart.clearTimeProperty(); dateTimeStart.clearTimeProperty();
dateTimeEnd.clearTimeProperty(); dateTimeEnd.clearTimeProperty();
} }
@FXML @FXML
void closeClick(ActionEvent event) { void closeClick(ActionEvent event) {
frame.dispose(); frame.dispose();
} }
} }

@ -6,16 +6,16 @@ import com.teamcenter.rac.aif.AbstractAIFApplication;
public class SearchSapResultComd extends KCommand { public class SearchSapResultComd extends KCommand {
private boolean top = true; private boolean top = true;
public SearchSapResultComd(AbstractAIFApplication app, String commandId, String actionInfo) { public SearchSapResultComd(AbstractAIFApplication app, String commandId, String actionInfo) {
super(app, commandId, actionInfo); super(app, commandId, actionInfo);
try { try {
new SapResultFrame(); new SapResultFrame();
}catch(Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
// public DesignChangeCommand(AbstractAIFApplication app, String commandId, String actionInfo) { // public DesignChangeCommand(AbstractAIFApplication app, String commandId, String actionInfo) {
// super(app, commandId, actionInfo); // super(app, commandId, actionInfo);
// new DesignChangeFrame(new DesignChangeDialogController()); // new DesignChangeFrame(new DesignChangeDialogController());

@ -13,131 +13,154 @@ import javafx.scene.control.Button;
import javafx.stage.Stage; import javafx.stage.Stage;
public class SumTableBean { public class SumTableBean {
//序 号 // 序 号
protected SimpleIntegerProperty num; protected SimpleIntegerProperty num;
//任务号 // 任务号
protected SimpleStringProperty taskNo; protected SimpleStringProperty taskNo;
//发起人 // 发起人
protected SimpleStringProperty user; protected SimpleStringProperty user;
//发起时间 // 发起时间
protected SimpleStringProperty startTime; protected SimpleStringProperty startTime;
//子任务数 // 子任务数
protected SimpleStringProperty cTaskNum; protected SimpleStringProperty cTaskNum;
//SAP处理结果 // SAP处理结果
protected SimpleStringProperty sapResult; protected SimpleStringProperty sapResult;
//数据状态 // 数据状态
protected SimpleStringProperty dataStatus; protected SimpleStringProperty dataStatus;
//PLM处理进度 // PLM处理进度
protected SimpleStringProperty plmResult; protected SimpleStringProperty plmResult;
//结果明细 // 结果明细
protected Button details = new Button(); protected Button details = new Button();
protected Button logDownload = new Button(); protected Button logDownload = new Button();
private boolean onlyError; private boolean onlyError;
private StringBuilder detailSql; private StringBuilder detailSql;
public Button getDetails() {
return details; public Button getDetails() {
} return details;
public Button getLogDownload() { }
return logDownload;
} public Button getLogDownload() {
public void setLogDownload(Button logDownload) { return logDownload;
this.logDownload = logDownload; }
}
public void setDetails(Button details) { public void setLogDownload(Button logDownload) {
this.details = details; this.logDownload = logDownload;
} }
public Integer getNum() {
return num.get(); public void setDetails(Button details) {
} this.details = details;
public void setNum(SimpleIntegerProperty num) { }
this.num = num;
} public Integer getNum() {
public String getTaskNo() { return num.get();
return taskNo.get(); }
}
public void setTaskNo(SimpleStringProperty taskNo) { public void setNum(SimpleIntegerProperty num) {
this.taskNo = taskNo; this.num = num;
} }
public String getUser() {
return user.get(); public String getTaskNo() {
} return taskNo.get();
public void setUser(SimpleStringProperty user) { }
this.user = user;
} public void setTaskNo(SimpleStringProperty taskNo) {
public String getStartTime() { this.taskNo = taskNo;
return startTime.get(); }
}
public void setStartTime(SimpleStringProperty startTime) { public String getUser() {
this.startTime = startTime; return user.get();
} }
public String getcTaskNum() {
return cTaskNum.get(); public void setUser(SimpleStringProperty user) {
} this.user = user;
public void setcTaskNum(SimpleStringProperty cTaskNum) { }
this.cTaskNum = cTaskNum;
} public String getStartTime() {
public String getSapResult() { return startTime.get();
return sapResult.get(); }
}
public void setSapResult(SimpleStringProperty sapResult) { public void setStartTime(SimpleStringProperty startTime) {
this.sapResult = sapResult; this.startTime = startTime;
} }
public String getDataStatus() {
return dataStatus.get(); public String getcTaskNum() {
} return cTaskNum.get();
public void setDataStatus(SimpleStringProperty dataStatus) { }
this.dataStatus = dataStatus;
} public void setcTaskNum(SimpleStringProperty cTaskNum) {
public String getPlmResult() { this.cTaskNum = cTaskNum;
return plmResult.get(); }
}
public void setPlmResult(SimpleStringProperty plmResult) { public String getSapResult() {
this.plmResult = plmResult; return sapResult.get();
} }
private String url;
private String code; public void setSapResult(SimpleStringProperty sapResult) {
private String[] prefs; this.sapResult = sapResult;
public SumTableBean(SimpleIntegerProperty num, SimpleStringProperty taskNo, SimpleStringProperty user, }
SimpleStringProperty startTime, SimpleStringProperty cTaskNum, SimpleStringProperty sapResult,
SimpleStringProperty dataStatus, SimpleStringProperty plmResult,boolean onlyError,StringBuilder detailSql, public String getDataStatus() {
String[] prefs,String code,String url) { return dataStatus.get();
super(); }
this.num = num;
this.taskNo = taskNo; public void setDataStatus(SimpleStringProperty dataStatus) {
this.user = user; this.dataStatus = dataStatus;
this.startTime = startTime; }
this.cTaskNum = cTaskNum;
this.sapResult = sapResult; public String getPlmResult() {
this.dataStatus = dataStatus; return plmResult.get();
this.plmResult = plmResult; }
this.onlyError = onlyError;
this.detailSql = detailSql; public void setPlmResult(SimpleStringProperty plmResult) {
this.code = taskNo.get(); this.plmResult = plmResult;
this.prefs = prefs; }
this.url = url;
details.setText("查看明细"); private String url;
logDownload.setText("日志下载"); private String code;
logDownload.setOnAction(e -> { private String[] prefs;
try {
if(!url.isEmpty()) { public SumTableBean(SimpleIntegerProperty num, SimpleStringProperty taskNo, SimpleStringProperty user,
String replaceAll = url.replaceAll("\n","").replaceAll("\r", ""); SimpleStringProperty startTime, SimpleStringProperty cTaskNum, SimpleStringProperty sapResult,
System.out.println(replaceAll); SimpleStringProperty dataStatus, SimpleStringProperty plmResult, boolean onlyError, StringBuilder detailSql,
BomToSapUtil.browse2(replaceAll); String[] prefs, String code, String url) {
} super();
} catch (Exception e1) { this.num = num;
// TODO Auto-generated catch block this.taskNo = taskNo;
e1.printStackTrace(); this.user = user;
} this.startTime = startTime;
}); // 此按钮没有加入到图形中 this.cTaskNum = cTaskNum;
details.setOnAction(e -> { this.sapResult = sapResult;
System.out.println("Process print = "+this.taskNo+" onlyError = "+this.onlyError); this.dataStatus = dataStatus;
StringBuilder sqlTotal = new StringBuilder("select batchnumber,productmaterialno,WBSNO,status,message,createdate,createtime,returndate,returntime," this.plmResult = plmResult;
+ "PLMSTATUS from CHINT_BOM_TO_SAP_DETIALS where \"CODE\" = '"); this.onlyError = onlyError;
this.detailSql = detailSql;
this.code = taskNo.get();
this.prefs = prefs;
this.url = url;
details.setText("查看明细");
logDownload.setText("日志下载");
logDownload.setOnAction(e -> {
try {
if (!url.isEmpty()) {
String replaceAll = url.replaceAll("\n", "").replaceAll("\r", "");
System.out.println(replaceAll);
BomToSapUtil.browse2(replaceAll);
}
} catch (Exception e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}); // 此按钮没有加入到图形中
details.setOnAction(e -> {
System.out.println("Process print = " + this.taskNo + " onlyError = " + this.onlyError);
StringBuilder sqlTotal = new StringBuilder(
"select batchnumber,productmaterialno,WBSNO,status,message,createdate,createtime,returndate,returntime,"
+ "PLMSTATUS from CHINT_BOM_TO_SAP_DETIALS where \"CODE\" = '");
sqlTotal.append(this.code).append("' "); sqlTotal.append(this.code).append("' ");
sqlTotal.append(this.detailSql); sqlTotal.append(this.detailSql);
try { try {
//单个BOM具体信息 : 全部状态. // 单个BOM具体信息 : 全部状态.
// List<List<DetailsBean>> tableBeans = new ArrayList<List<DetailsBean>>(); // List<List<DetailsBean>> tableBeans = new ArrayList<List<DetailsBean>>();
// SqlUtil.getTCDataConnection(prefs); // SqlUtil.getTCDataConnection(prefs);
// String sqlDetail = ""; // String sqlDetail = "";
@ -166,17 +189,17 @@ public class SumTableBean {
// } // }
// //
// SqlUtil.freeAll(); // SqlUtil.freeAll();
ChildMessage open = new ChildMessage(this.onlyError,sqlTotal); ChildMessage open = new ChildMessage(this.onlyError, sqlTotal);
open.start(new Stage()); open.start(new Stage());
}catch(Exception ex){ } catch (Exception ex) {
ex.printStackTrace(); ex.printStackTrace();
}finally { } finally {
System.out.println("END"+sqlTotal.toString()); System.out.println("END" + sqlTotal.toString());
SqlUtil.freeAll(); SqlUtil.freeAll();
} }
}); // 此按钮没有加入到图形中 }); // 此按钮没有加入到图形中
// BomToSapUtil.downLoadTest(code); // BomToSapUtil.downLoadTest(code);
} }
} }

@ -27,223 +27,223 @@ 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 @FXML
private ComboBox<String> factoryComb; 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, public void initData(TCSession session, String groupID, TextField field, TCComponent tar, boolean flag,
Button assignBtn) { Button assignBtn) {
// TODO Auto-generated method stub // TODO Auto-generated method stub
this.groupID = groupID; this.groupID = groupID;
this.session = session; this.session = session;
this.field = field; this.field = field;
this.flag = flag; this.flag = flag;
this.tar = tar; this.tar = tar;
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;
String flow = searchWord; String flow = searchWord;
Connection conn = null; Connection conn = null;
conn = util.connect(conn, session); conn = util.connect(conn, session);
String query = "select FLOW from CHINT_ECN_CODE where CODE='" + searchWord + "'"; String query = "select FLOW from CHINT_ECN_CODE where CODE='" + searchWord + "'";
System.out.println(query); System.out.println(query);
Statement stmt; Statement stmt;
ResultSet rs_get; ResultSet rs_get;
try { try {
stmt = conn.createStatement(); stmt = conn.createStatement();
rs_get = null; rs_get = null;
rs_get = stmt.executeQuery(query); rs_get = stmt.executeQuery(query);
if (rs_get.next()) { if (rs_get.next()) {
String FLOW = rs_get.getString("FLOW"); String FLOW = rs_get.getString("FLOW");
flow = flow + FLOW; flow = flow + FLOW;
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')";
flow = flow + "0001"; flow = flow + "0001";
} }
field.setText(flow); field.setText(flow);
System.out.println(query); System.out.println(query);
if (rs_get != null) { if (rs_get != null) {
rs_get.close(); rs_get.close();
} }
rs_get = stmt.executeQuery(query); rs_get = stmt.executeQuery(query);
util.disconnect(conn, stmt, rs_get); util.disconnect(conn, stmt, rs_get);
} catch (SQLException e1) { } catch (SQLException e1) {
e1.printStackTrace(); e1.printStackTrace();
} }
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();
} }
@FXML @FXML
void selectDepart(ActionEvent event) { void selectDepart(ActionEvent event) {
} }
@FXML @FXML
void selectFactory(ActionEvent event) { 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 = "";
final Map<String, List<String>> foMap = new HashMap<>(); final Map<String, List<String>> foMap = new HashMap<>();
for (int i = 0; i < FO.length; i++) { for (int i = 0; i < FO.length; i++) {
String group = FO[i].split(":")[0]; String group = FO[i].split(":")[0];
if (group.indexOf("|") != -1) { if (group.indexOf("|") != -1) {
if (group.split("\\|")[0].equals(groupID)) { if (group.split("\\|")[0].equals(groupID)) {
first_FO = group.split("\\|")[1]; first_FO = group.split("\\|")[1];
} }
group = group.split("\\|")[1]; group = group.split("\\|")[1];
} }
// facList.add(FO[i].split(":")[0]); // facList.add(FO[i].split(":")[0]);
facList.add(group); facList.add(group);
List<String> list = new ArrayList<>(); List<String> list = new ArrayList<>();
String[] offices = FO[i].split(":")[1].split(";"); String[] offices = FO[i].split(":")[1].split(";");
for (int j = 0; j < offices.length; j++) { for (int j = 0; j < offices.length; j++) {
list.add(offices[j]); list.add(offices[j]);
} }
// 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;
String flow = searchWord; String flow = searchWord;
Connection conn = null; Connection conn = null;
conn = util.connect(conn, session); conn = util.connect(conn, session);
String query = "select FLOW from CHINT_ECN_CODE where CODE='" + searchWord + "'"; String query = "select FLOW from CHINT_ECN_CODE where CODE='" + searchWord + "'";
System.out.println(query); System.out.println(query);
Statement stmt; Statement stmt;
ResultSet rs_get; ResultSet rs_get;
try { try {
stmt = conn.createStatement(); stmt = conn.createStatement();
rs_get = null; rs_get = null;
rs_get = stmt.executeQuery(query); rs_get = stmt.executeQuery(query);
if (rs_get.next()) { if (rs_get.next()) {
String FLOW = rs_get.getString("FLOW"); String FLOW = rs_get.getString("FLOW");
flow = flow + FLOW; flow = flow + FLOW;
FLOW = String.format("%04d", Integer.valueOf(FLOW) + 1); FLOW = String.format("%04d", Integer.valueOf(FLOW) + 1);
} else { } else {
flow = flow + "0001"; flow = flow + "0001";
} }
ylText.setText(flow); ylText.setText(flow);
System.out.println(query); System.out.println(query);
if (rs_get != null) { if (rs_get != null) {
rs_get.close(); rs_get.close();
} }
util.disconnect(conn, stmt, rs_get); util.disconnect(conn, stmt, rs_get);
} catch (SQLException e1) { } catch (SQLException e1) {
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")) {
// String[] fo = null; // String[] fo = null;
// try { // try {
@ -261,7 +261,7 @@ public class AssignIdController {
// } else { // } else {
// //
// } // }
} }
private Util util = new Util(); private Util util = new Util();
} }

@ -36,36 +36,36 @@ 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, public AssignIdDialog(TCSession session, String groupID, TextField field, TCComponent tar, boolean flag,
Button assignBtn) { Button assignBtn) {
super(); super();
this.groupID = groupID; this.groupID = groupID;
this.session = session; this.session = session;
this.field = field; this.field = field;
this.tar = tar; this.tar = tar;
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();
} }
} }

@ -8,20 +8,20 @@ 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();
} }
} }
// public DesignChangeCommand(AbstractAIFApplication app, String commandId, String actionInfo) { // public DesignChangeCommand(AbstractAIFApplication app, String commandId, String actionInfo) {
// super(app, commandId, actionInfo); // super(app, commandId, actionInfo);
// new DesignChangeFrame(new DesignChangeDialogController()); // new DesignChangeFrame(new DesignChangeDialogController());

@ -10,17 +10,17 @@ import javafx.embed.swing.JFXPanel;
public class CreateEcnFrame extends KFrame { public class CreateEcnFrame extends KFrame {
public CreateEcnFrame() { public CreateEcnFrame() {
super(); super();
} }
@Override @Override
protected void initUI() throws Exception { protected void initUI() throws Exception {
this.setTitle("±ä¸ü¹ÜÀí"); this.setTitle("±ä¸ü¹ÜÀí");
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
this.setPreferredSize(new Dimension(1200, 800)); this.setPreferredSize(new Dimension(1200, 800));
JFXPanel panel = new JFXPanel(); JFXPanel panel = new JFXPanel();
panel.setScene(new CreateEcnPanel(this).getScene()); panel.setScene(new CreateEcnPanel(this).getScene());
this.add(BorderLayout.CENTER, panel); this.add(BorderLayout.CENTER, panel);
} }
} }

@ -6,8 +6,8 @@ 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
} }
} }

@ -10,170 +10,170 @@ 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, EcnBean(int ind, List<String> reasons, List<String> wips, String drawNoVal, String markVal, String placesNo,
String changeBefore, String changeAfter, String reasonVal, String processType, String szRevisionBef, String changeBefore, String changeAfter, String reasonVal, String processType, String szRevisionBef,
String szRevisionAft) { 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);
changeReason.getSelectionModel().select(reasonVal); changeReason.getSelectionModel().select(reasonVal);
} }
public Integer getNum() { public Integer getNum() {
return num.get(); return num.get();
} }
public void setNum(SimpleIntegerProperty num) { public void setNum(SimpleIntegerProperty num) {
this.num = num; this.num = num;
} }
public TextArea getDrawNo() { public TextArea getDrawNo() {
return drawNo; return drawNo;
} }
public void setDrawNo(TextArea drawNo) { public void setDrawNo(TextArea drawNo) {
this.drawNo = drawNo; this.drawNo = drawNo;
} }
public TextArea getMark() { public TextArea getMark() {
return mark; return mark;
} }
public void setMark(TextArea mark) { public void setMark(TextArea mark) {
this.mark = mark; this.mark = mark;
} }
public TextArea getPoiNum() { public TextArea getPoiNum() {
return poiNum; return poiNum;
} }
public void setPoiNum(TextArea poiNum) { public void setPoiNum(TextArea poiNum) {
this.poiNum = poiNum; this.poiNum = poiNum;
} }
public TextArea getOverChange() { public TextArea getOverChange() {
return overChange; return overChange;
} }
public void setOverChange(TextArea overChange) { public void setOverChange(TextArea overChange) {
this.overChange = overChange; this.overChange = overChange;
} }
public TextArea getOverVersion() { public TextArea getOverVersion() {
return overVersion; return overVersion;
} }
public void setOverVersion(TextArea overVersion) { public void setOverVersion(TextArea overVersion) {
this.overVersion = overVersion; this.overVersion = overVersion;
} }
public TextArea getAfterChange() { public TextArea getAfterChange() {
return afterChange; return afterChange;
} }
public void setAfterChange(TextArea afterChange) { public void setAfterChange(TextArea afterChange) {
this.afterChange = afterChange; this.afterChange = afterChange;
} }
public TextArea getAfterVersion() { public TextArea getAfterVersion() {
return afterVersion; return afterVersion;
} }
public void setAfterVersion(TextArea afterVersion) { public void setAfterVersion(TextArea afterVersion) {
this.afterVersion = afterVersion; this.afterVersion = afterVersion;
} }
public ComboBox<String> getChangeReason() { public ComboBox<String> getChangeReason() {
return changeReason; return changeReason;
} }
public void setChangeReason(ComboBox<String> changeReason) { public void setChangeReason(ComboBox<String> changeReason) {
this.changeReason = changeReason; this.changeReason = changeReason;
} }
public ComboBox<String> getWipTreat() { public ComboBox<String> getWipTreat() {
return wipTreat; return wipTreat;
} }
public void setWipTreat(ComboBox<String> wipTreat) { public void setWipTreat(ComboBox<String> wipTreat) {
this.wipTreat = wipTreat; this.wipTreat = wipTreat;
} }
} }

@ -3,110 +3,147 @@ package com.chint.plm.createEcn;
import javafx.beans.property.SimpleStringProperty; import javafx.beans.property.SimpleStringProperty;
import javafx.beans.value.ChangeListener; import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue; import javafx.beans.value.ObservableValue;
import javafx.collections.ObservableList;
import javafx.scene.Node;
import javafx.scene.control.Button;
import javafx.scene.control.CheckBox; import javafx.scene.control.CheckBox;
import javafx.scene.control.ComboBox; import javafx.scene.control.ComboBox;
import javafx.scene.control.TextArea; import javafx.scene.control.TextArea;
import javafx.scene.control.TextField; import javafx.scene.control.TextField;
import javafx.scene.layout.FlowPane;
public class RefTableBean { public class RefTableBean {
protected SimpleStringProperty depart;//部门 protected SimpleStringProperty depart;// 部门
protected SimpleStringProperty message; //行动 protected SimpleStringProperty message; // 行动
protected CheckBox shYes = new CheckBox();//是 protected CheckBox shYes = new CheckBox();// 是
protected CheckBox shNo = new CheckBox();//否 protected CheckBox shNo = new CheckBox();// 否
protected TextField user = new TextField();//更改前版本 // protected TextField user = new TextField();// 责任人
protected TextField compDate = new TextField();//更改后 protected TextField compDate = new TextField();// 更改后
protected TextField mark = new TextField();//更改后版本 protected Object userPane;
private TextField userText;
public String getDepart() { private Button userBtn;
return depart.get();
} public Button getUserBtn() {
return userBtn;
public void setDepart(SimpleStringProperty depart) { }
this.depart = depart; public void setUserBtn(Button userBtn) {
} this.userBtn = userBtn;
}
public String getMessage() { public Object getUserPane() {
return message.get(); if (userPane instanceof SimpleStringProperty) {
} SimpleStringProperty userProp = (SimpleStringProperty) userPane;
return userProp.get();
public void setMessage(SimpleStringProperty message) { }
this.message = message; return userPane;
} }
public String getUserVal() {
public CheckBox getShYes() { if (userPane instanceof SimpleStringProperty) {
return shYes; SimpleStringProperty userProp = (SimpleStringProperty) userPane;
} return userProp.get();
}
public void setShYes(CheckBox shYes) { return userText.getText();
this.shYes = shYes; }
} public void setUserPane(String val) {
if (userPane instanceof SimpleStringProperty) {
public CheckBox getShNo() { SimpleStringProperty userProp = (SimpleStringProperty) userPane;
return shNo; userProp.setValue(val);
} } else if (userPane instanceof FlowPane && userText != null) {
userText.setText(val);
public void setShNo(boolean shNo) { // flowPane.getc
this.shNo.setSelected(shNo); }
} }
public TextField getUser() { protected TextField mark = new TextField();// 更改后版本
return user;
} public String getDepart() {
return depart.get();
public void setUser(String user) { }
this.user.setText(user);
} public void setDepart(SimpleStringProperty depart) {
this.depart = depart;
public TextField getCompDate() { }
return compDate;
} public String getMessage() {
return message.get();
public void setCompDate(String compDate) { }
this.compDate.setText(compDate);
} public void setMessage(SimpleStringProperty message) {
this.message = message;
public TextField getMark() { }
return mark;
} public CheckBox getShYes() {
return shYes;
public void setMark(String mark) { }
this.mark.setText(mark);
} public void setShYes(CheckBox shYes) {
this.shYes = shYes;
// protected ComboBox<String> changeReason = new ComboBox<String>();//更改原因 }
public RefTableBean(SimpleStringProperty depart, SimpleStringProperty message) {
super(); public CheckBox getShNo() {
this.depart = depart; return shNo;
this.message = message; }
// this.shYes = shYes;
// this.shNo = shNo; public void setShNo(boolean shNo) {
// this.user = user; this.shNo.setSelected(shNo);
// this.compDate = compDate; }
// this.mark = mark;
shNo.setSelected(true); public TextField getCompDate() {
return compDate;
shYes.selectedProperty().addListener(new ChangeListener<Boolean>() { }
@Override public void setCompDate(String compDate) {
public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) { this.compDate.setText(compDate);
// TODO Auto-generated method stub }
public TextField getMark() {
return mark;
}
public void setMark(String mark) {
this.mark.setText(mark);
}
// protected ComboBox<String> changeReason = new ComboBox<String>();//更改原因
public RefTableBean(SimpleStringProperty depart, SimpleStringProperty message, Boolean flag) {
super();
this.depart = depart;
this.message = message;
if (flag) {
FlowPane userPane = new FlowPane();
userText = new TextField();
userBtn = new Button("指派");
userPane.getChildren().add(userText);
userPane.getChildren().add(userBtn);
this.userPane = userPane;
}else {
this.userPane = new SimpleStringProperty();
}
shNo.setSelected(true);
shYes.selectedProperty().addListener(new ChangeListener<Boolean>() {
@Override
public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) {
// TODO Auto-generated method stub
// System.out.println("oldValue"+oldValue); // System.out.println("oldValue"+oldValue);
if(newValue) { if (newValue) {
shNo.setSelected(false); shNo.setSelected(false);
} }
} }
}); });
shNo.selectedProperty().addListener(new ChangeListener<Boolean>() { shNo.selectedProperty().addListener(new ChangeListener<Boolean>() {
@Override @Override
public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) { public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) {
// TODO Auto-generated method stub // TODO Auto-generated method stub
// System.out.println("oldValue"+oldValue); // System.out.println("oldValue"+oldValue);
if(newValue) { if (newValue) {
shYes.setSelected(false); shYes.setSelected(false);
} }
} }
}); });
} }
} }

@ -10,135 +10,152 @@ import javafx.collections.ObservableList;
import javafx.scene.control.Button; import javafx.scene.control.Button;
public class RelateEcnBean { public class RelateEcnBean {
protected SimpleStringProperty num;//序号 protected SimpleStringProperty num;// 序号
protected SimpleStringProperty contConde;//合同代号 protected SimpleStringProperty contConde;// 合同代号
protected SimpleStringProperty contName; //合同名称 protected SimpleStringProperty contName; // 合同名称
protected SimpleStringProperty requestNo;//申请单号 protected SimpleStringProperty requestNo;// 申请单号
protected SimpleStringProperty prodModel; //产品型号 protected SimpleStringProperty prodModel; // 产品型号
protected SimpleStringProperty applicant; //申请人 protected SimpleStringProperty applicant; // 申请人
protected SimpleStringProperty status; //状态 protected SimpleStringProperty status; // 状态
protected Button linkBtn = new Button("查看"); protected Button linkBtn = new Button("查看");
protected Button importBtn = new Button("导入"); protected Button importBtn = new Button("导入");
public String getStatus() { public String getStatus() {
return status.get(); return status.get();
} }
public void setStatus(SimpleStringProperty status) {
this.status = status; public void setStatus(SimpleStringProperty status) {
} this.status = status;
public Button getLinkBtn() { }
return linkBtn;
} public Button getLinkBtn() {
public void setLinkBtn(Button linkBtn) { return linkBtn;
this.linkBtn = linkBtn; }
}
public Button getImportBtn() { public void setLinkBtn(Button linkBtn) {
return importBtn; this.linkBtn = linkBtn;
} }
public void setImportBtn(Button importBtn) {
this.importBtn = importBtn; public Button getImportBtn() {
} return importBtn;
public String getNum() { }
return num.get();
} public void setImportBtn(Button importBtn) {
public RelateEcnBean(SimpleStringProperty num, SimpleStringProperty contConde, SimpleStringProperty contName, this.importBtn = importBtn;
SimpleStringProperty requestNo, SimpleStringProperty prodModel, SimpleStringProperty applicant, }
SimpleStringProperty status, String link,CreateEcnController controller,ResultSet read) throws SQLException {
super(); public String getNum() {
this.num = num; return num.get();
this.contConde = contConde; }
this.contName = contName;
this.requestNo = requestNo; public RelateEcnBean(SimpleStringProperty num, SimpleStringProperty contConde, SimpleStringProperty contName,
this.prodModel = prodModel; SimpleStringProperty requestNo, SimpleStringProperty prodModel, SimpleStringProperty applicant,
this.applicant = applicant; SimpleStringProperty status, String link, CreateEcnController controller, ResultSet read)
this.status = status; throws SQLException {
//变更单号 super();
String applyNo = read.getString("APPLYNO"); this.num = num;
//七种责任人 this.contConde = contConde;
String designPal = read.getString("DESIGNPRINCIPAL"); this.contName = contName;
String techPal = read.getString("TECHPRINCIPAL"); this.requestNo = requestNo;
String quantityPal = read.getString("QUALITYPRINCIPAL"); this.prodModel = prodModel;
String producePal = read.getString("PRODUCEPRINCIPAL"); this.applicant = applicant;
String purchasePal = read.getString("PURCHASEYPRINCIPAL"); this.status = status;
String customPal = read.getString("CUSTOMNOTICEPRINCIPAL");//FINAPRICEPRINCIPAL // 变更单号
String finaPal = read.getString("FINAPRICEPRINCIPAL"); String applyNo = read.getString("APPLYNO");
String docuName = read.getString("DOCUNAME"); //文件代号及名称 // 七种责任人
String designFile = read.getString("DESIGNFILE");//获取行动内容 String designPal = read.getString("DESIGNPRINCIPAL");
linkBtn.setOnAction(e -> { String techPal = read.getString("TECHPRINCIPAL");
try { String quantityPal = read.getString("QUALITYPRINCIPAL");
BomToSapUtil.browse2(link); String producePal = read.getString("PRODUCEPRINCIPAL");
} catch (Exception e1) { String purchasePal = read.getString("PURCHASEYPRINCIPAL");
// TODO Auto-generated catch block String customPal = read.getString("CUSTOMNOTICEPRINCIPAL");// FINAPRICEPRINCIPAL
e1.printStackTrace(); String finaPal = read.getString("FINAPRICEPRINCIPAL");
} String docuName = read.getString("DOCUNAME"); // 文件代号及名称
}); String designFile = read.getString("DESIGNFILE");// 获取行动内容
importBtn.setOnAction(e -> { linkBtn.setOnAction(e -> {
try { try {
ObservableList<RefTableBean> items = controller.refTable.getItems(); BomToSapUtil.browse2(link);
for(int i=0;i<7;i++) { } catch (Exception e1) {
items.get(i).setUser(designPal); // TODO Auto-generated catch block
} e1.printStackTrace();
for(int i=7;i<11;i++) { }
items.get(i).setUser(techPal); });
} importBtn.setOnAction(e -> {
for(int i=11;i<15;i++) { try {
items.get(i).setUser(quantityPal); ObservableList<RefTableBean> items = controller.refTable.getItems();
} for (int i = 0; i < 7; i++) {
for(int i=15;i<19;i++) { items.get(i).setUserPane(designPal);
items.get(i).setUser(producePal); }
} for (int i = 7; i < 11; i++) {
for(int i=19;i<24;i++) { items.get(i).setUserPane(techPal);
items.get(i).setUser(purchasePal); }
} for (int i = 11; i < 15; i++) {
for(int i=24;i<27;i++) { items.get(i).setUserPane(quantityPal);
items.get(i).setUser(customPal); }
} for (int i = 15; i < 19; i++) {
for(int i=27;i<28;i++) { items.get(i).setUserPane(producePal);
items.get(i).setUser(finaPal); }
} for (int i = 19; i < 24; i++) {
controller.markText.setText(docuName); items.get(i).setUserPane(purchasePal);
controller.relateEcnText.setText(applyNo); }
controller.refTable.setItems(items); for (int i = 24; i < 27; i++) {
} catch (Exception e1) { items.get(i).setUserPane(customPal);
// TODO Auto-generated catch block }
e1.printStackTrace(); for (int i = 27; i < 28; i++) {
} items.get(i).setUserPane(finaPal);
}); }
} controller.markText.setText(docuName);
public void setNum(SimpleStringProperty num) { controller.relateEcnText.setText(applyNo);
this.num = num; controller.refTable.setItems(items);
} } catch (Exception e1) {
public String getContConde() { // TODO Auto-generated catch block
return contConde.get(); e1.printStackTrace();
} }
public void setContConde(SimpleStringProperty contConde) { });
this.contConde = contConde; }
}
public String getContName() { public void setNum(SimpleStringProperty num) {
return contName.get(); this.num = num;
} }
public void setContName(SimpleStringProperty contName) {
this.contName = contName; public String getContConde() {
} return contConde.get();
public String getRequestNo() { }
return requestNo.get();
} public void setContConde(SimpleStringProperty contConde) {
public void setRequestNo(SimpleStringProperty requestNo) { this.contConde = contConde;
this.requestNo = requestNo; }
}
public String getProdModel() { public String getContName() {
return prodModel.get(); return contName.get();
} }
public void setProdModel(SimpleStringProperty prodModel) {
this.prodModel = prodModel; public void setContName(SimpleStringProperty contName) {
} this.contName = contName;
public String getApplicant() { }
return applicant.get();
} public String getRequestNo() {
public void setApplicant(SimpleStringProperty applicant) { return requestNo.get();
this.applicant = applicant; }
}
public void setRequestNo(SimpleStringProperty requestNo) {
this.requestNo = requestNo;
}
public String getProdModel() {
return prodModel.get();
}
public void setProdModel(SimpleStringProperty prodModel) {
this.prodModel = prodModel;
}
public String getApplicant() {
return applicant.get();
}
public void setApplicant(SimpleStringProperty applicant) {
this.applicant = applicant;
}
} }

@ -1,4 +1,5 @@
package com.chint.plm.createEcn; package com.chint.plm.createEcn;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.ArrayList; import java.util.ArrayList;
@ -30,6 +31,7 @@ import javafx.scene.control.cell.PropertyValueFactory;
import javafx.scene.layout.GridPane; import javafx.scene.layout.GridPane;
import javafx.scene.layout.StackPane; import javafx.scene.layout.StackPane;
import javafx.stage.Stage; import javafx.stage.Stage;
public class RelateEcnController { public class RelateEcnController {
@FXML @FXML
@ -67,7 +69,7 @@ public class RelateEcnController {
@FXML @FXML
private TextField requestNoText; private TextField requestNoText;
@FXML @FXML
private TitledPane tp_product; private TitledPane tp_product;
@ -91,139 +93,151 @@ public class RelateEcnController {
@FXML @FXML
private TextField prodNameText; private TextField prodNameText;
private CreateEcnController controller; private CreateEcnController controller;
private TCSession session; private TCSession session;
public void initData(TCSession session, CreateEcnController controller) {
// TODO Auto-generated method stub public void initData(TCSession session, CreateEcnController controller) {
this.controller = controller; // TODO Auto-generated method stub
this.session = session; this.controller = controller;
initTable(); this.session = session;
} initTable();
}
/** /**
* *
* @function * @function
*/ */
private void initTable() { private void initTable() {
// TODO Auto-generated method stub // TODO Auto-generated method stub
TableColumn<RelateEcnBean,SimpleStringProperty> numCol = new TableColumn<RelateEcnBean,SimpleStringProperty>("序号"); TableColumn<RelateEcnBean, SimpleStringProperty> numCol = new TableColumn<RelateEcnBean, SimpleStringProperty>(
TableColumn<RelateEcnBean,SimpleStringProperty> contCondeCol = new TableColumn<RelateEcnBean,SimpleStringProperty>("合同代号"); "序号");
TableColumn<RelateEcnBean,SimpleStringProperty> contNameCol = new TableColumn<RelateEcnBean,SimpleStringProperty>("合同名称"); TableColumn<RelateEcnBean, SimpleStringProperty> contCondeCol = new TableColumn<RelateEcnBean, SimpleStringProperty>(
"合同代号");
TableColumn<RelateEcnBean,SimpleStringProperty> requestNoCol = new TableColumn<RelateEcnBean,SimpleStringProperty>("申请单号"); TableColumn<RelateEcnBean, SimpleStringProperty> contNameCol = new TableColumn<RelateEcnBean, SimpleStringProperty>(
TableColumn<RelateEcnBean,SimpleStringProperty> prodModelCol = new TableColumn<RelateEcnBean,SimpleStringProperty>("产品型号"); "合同名称");
TableColumn<RelateEcnBean,SimpleStringProperty> applicantCol = new TableColumn<RelateEcnBean,SimpleStringProperty>("申请人");
TableColumn<RelateEcnBean,SimpleStringProperty> statusCol = new TableColumn<RelateEcnBean,SimpleStringProperty>("状态"); TableColumn<RelateEcnBean, SimpleStringProperty> requestNoCol = new TableColumn<RelateEcnBean, SimpleStringProperty>(
TableColumn<RelateEcnBean,Button> linkBtnCol = new TableColumn<RelateEcnBean,Button>("更改申请单链接"); "申请单号");
TableColumn<RelateEcnBean,Button> importBtnCol = new TableColumn<RelateEcnBean,Button>("导入"); TableColumn<RelateEcnBean, SimpleStringProperty> prodModelCol = new TableColumn<RelateEcnBean, SimpleStringProperty>(
tableView.getColumns().addAll(numCol, contCondeCol, contNameCol,requestNoCol,prodModelCol, applicantCol, statusCol, "产品型号");
linkBtnCol,importBtnCol); TableColumn<RelateEcnBean, SimpleStringProperty> applicantCol = new TableColumn<RelateEcnBean, SimpleStringProperty>(
"申请人");
numCol.setSortable(false); TableColumn<RelateEcnBean, SimpleStringProperty> statusCol = new TableColumn<RelateEcnBean, SimpleStringProperty>(
contCondeCol.setSortable(false); "状态");
contNameCol.setSortable(false); TableColumn<RelateEcnBean, Button> linkBtnCol = new TableColumn<RelateEcnBean, Button>("更改申请单链接");
requestNoCol.setSortable(false); TableColumn<RelateEcnBean, Button> importBtnCol = new TableColumn<RelateEcnBean, Button>("导入");
prodModelCol.setSortable(false); tableView.getColumns().addAll(numCol, contCondeCol, contNameCol, requestNoCol, prodModelCol, applicantCol,
applicantCol.setSortable(false); statusCol, linkBtnCol, importBtnCol);
statusCol.setSortable(false);
linkBtnCol.setSortable(false); numCol.setSortable(false);
importBtnCol.setSortable(false); contCondeCol.setSortable(false);
//列绑定bean对象 contNameCol.setSortable(false);
numCol.setCellValueFactory(new PropertyValueFactory<RelateEcnBean,SimpleStringProperty>("num")); requestNoCol.setSortable(false);
contCondeCol.setCellValueFactory(new PropertyValueFactory<RelateEcnBean,SimpleStringProperty>("contConde")); prodModelCol.setSortable(false);
contNameCol.setCellValueFactory(new PropertyValueFactory<RelateEcnBean,SimpleStringProperty>("contName")); applicantCol.setSortable(false);
requestNoCol.setCellValueFactory(new PropertyValueFactory<RelateEcnBean,SimpleStringProperty>("requestNo")); statusCol.setSortable(false);
prodModelCol.setCellValueFactory(new PropertyValueFactory<RelateEcnBean,SimpleStringProperty>("prodModel")); linkBtnCol.setSortable(false);
applicantCol.setCellValueFactory(new PropertyValueFactory<RelateEcnBean,SimpleStringProperty>("applicant")); importBtnCol.setSortable(false);
statusCol.setCellValueFactory(new PropertyValueFactory<RelateEcnBean,SimpleStringProperty>("status")); // 列绑定bean对象
linkBtnCol.setCellValueFactory(new PropertyValueFactory<RelateEcnBean,Button>("linkBtn")); numCol.setCellValueFactory(new PropertyValueFactory<RelateEcnBean, SimpleStringProperty>("num"));
importBtnCol.setCellValueFactory(new PropertyValueFactory<RelateEcnBean,Button>("importBtn")); contCondeCol.setCellValueFactory(new PropertyValueFactory<RelateEcnBean, SimpleStringProperty>("contConde"));
contNameCol.setCellValueFactory(new PropertyValueFactory<RelateEcnBean, SimpleStringProperty>("contName"));
numCol.prefWidthProperty().bind(tableView.widthProperty().multiply(0.06)); requestNoCol.setCellValueFactory(new PropertyValueFactory<RelateEcnBean, SimpleStringProperty>("requestNo"));
contCondeCol.prefWidthProperty().bind(tableView.widthProperty().multiply(0.12)); prodModelCol.setCellValueFactory(new PropertyValueFactory<RelateEcnBean, SimpleStringProperty>("prodModel"));
contNameCol.prefWidthProperty().bind(tableView.widthProperty().multiply(0.12)); applicantCol.setCellValueFactory(new PropertyValueFactory<RelateEcnBean, SimpleStringProperty>("applicant"));
requestNoCol.prefWidthProperty().bind(tableView.widthProperty().multiply(0.12)); statusCol.setCellValueFactory(new PropertyValueFactory<RelateEcnBean, SimpleStringProperty>("status"));
prodModelCol.prefWidthProperty().bind(tableView.widthProperty().multiply(0.12)); linkBtnCol.setCellValueFactory(new PropertyValueFactory<RelateEcnBean, Button>("linkBtn"));
applicantCol.prefWidthProperty().bind(tableView.widthProperty().multiply(0.12)); importBtnCol.setCellValueFactory(new PropertyValueFactory<RelateEcnBean, Button>("importBtn"));
statusCol.prefWidthProperty().bind(tableView.widthProperty().multiply(0.1));
linkBtnCol.prefWidthProperty().bind(tableView.widthProperty().multiply(0.12)); numCol.prefWidthProperty().bind(tableView.widthProperty().multiply(0.06));
importBtnCol.prefWidthProperty().bind(tableView.widthProperty().multiply(0.10)); contCondeCol.prefWidthProperty().bind(tableView.widthProperty().multiply(0.12));
} contNameCol.prefWidthProperty().bind(tableView.widthProperty().multiply(0.12));
requestNoCol.prefWidthProperty().bind(tableView.widthProperty().multiply(0.12));
/** prodModelCol.prefWidthProperty().bind(tableView.widthProperty().multiply(0.12));
* @param event applicantCol.prefWidthProperty().bind(tableView.widthProperty().multiply(0.12));
* @function statusCol.prefWidthProperty().bind(tableView.widthProperty().multiply(0.1));
*/ linkBtnCol.prefWidthProperty().bind(tableView.widthProperty().multiply(0.12));
@FXML importBtnCol.prefWidthProperty().bind(tableView.widthProperty().multiply(0.10));
}
/**
* @param event
* @function
*/
@FXML
void searchClick(ActionEvent event) { void searchClick(ActionEvent event) {
String[] prefs = ChintPreferenceUtil.getPreferences("database_tc", session); String[] prefs = ChintPreferenceUtil.getPreferences("database_tc", session);
SqlUtil.getTCDataConnection(prefs); SqlUtil.getTCDataConnection(prefs);
try { try {
StringBuilder searchSqlBuff = new StringBuilder( "select * from CHINT_ECR_FROM_OA where 1=1 "); StringBuilder searchSqlBuff = new StringBuilder("select * from CHINT_ECR_FROM_OA where 1=1 ");
appendSqlBuild(searchSqlBuff,prodModelText,"PRODUCTMODEL"); appendSqlBuild(searchSqlBuff, prodModelText, "PRODUCTMODEL");
appendSqlBuild(searchSqlBuff,prodNameText,"PRODUCTNAME"); appendSqlBuild(searchSqlBuff, prodNameText, "PRODUCTNAME");
appendSqlBuild(searchSqlBuff,contCondeText,"CONTRACTNO"); appendSqlBuild(searchSqlBuff, contCondeText, "CONTRACTNO");
appendSqlBuild(searchSqlBuff,contNameText,"CONTRACTNAME"); appendSqlBuild(searchSqlBuff, contNameText, "CONTRACTNAME");
appendSqlBuild(searchSqlBuff,pattCodeText,"DESIGNNAME"); appendSqlBuild(searchSqlBuff, pattCodeText, "DESIGNNAME");
appendSqlBuild(searchSqlBuff,docCodeText,"DOCUNAME"); appendSqlBuild(searchSqlBuff, docCodeText, "DOCUNAME");
appendSqlBuild(searchSqlBuff,applicantText,"APPLYUSER"); appendSqlBuild(searchSqlBuff, applicantText, "APPLYUSER");
appendSqlBuild(searchSqlBuff,requestNoText,"APPLYNO"); appendSqlBuild(searchSqlBuff, requestNoText, "APPLYNO");
String startText = startTime.getEditor().getText(); String startText = startTime.getEditor().getText();
if(!startText.isEmpty()) { if (!startText.isEmpty()) {
searchSqlBuff.append(" and to_date(APPLYDATE,'yyyy-mm-dd hh24:mi:ss') >= to_date('").append(startText).append("','yyyy-mm-dd') "); //to_date(?,'yyyy-mm-ddhh24:mi:ss') searchSqlBuff.append(" and to_date(APPLYDATE,'yyyy-mm-dd hh24:mi:ss') >= to_date('").append(startText)
System.out.println("startText==>"+startText); .append("','yyyy-mm-dd') "); // to_date(?,'yyyy-mm-ddhh24:mi:ss')
} System.out.println("startText==>" + startText);
String endText = endTime.getEditor().getText(); }
if(!endText.isEmpty()) { String endText = endTime.getEditor().getText();
searchSqlBuff.append(" and to_date(APPLYDATE,'yyyy-mm-dd hh24:mi:ss') <= to_date('").append(endText).append("','yyyy-mm-dd') "); //to_date(?,'yyyy-mm-ddhh24:mi:ss') if (!endText.isEmpty()) {
System.out.println("endText==>"+endText); searchSqlBuff.append(" and to_date(APPLYDATE,'yyyy-mm-dd hh24:mi:ss') <= to_date('").append(endText)
} .append("','yyyy-mm-dd') "); // to_date(?,'yyyy-mm-ddhh24:mi:ss')
int num = 1; System.out.println("endText==>" + endText);
ResultSet read = SqlUtil.read(searchSqlBuff.toString()); }
List<RelateEcnBean> ecnBeans = new ArrayList<>(); int num = 1;
while(read.next()) { ResultSet read = SqlUtil.read(searchSqlBuff.toString());
String contConde = read.getString("CONTRACTNO"); List<RelateEcnBean> ecnBeans = new ArrayList<>();
String contName = read.getString("CONTRACTNAME"); while (read.next()) {
String requestNo = read.getString("APPLYNO"); String contConde = read.getString("CONTRACTNO");
String prodModel = read.getString("PRODUCTMODEL"); String contName = read.getString("CONTRACTNAME");
String applicant = read.getString("APPLYUSER");//STATUS String requestNo = read.getString("APPLYNO");
String status = read.getString("STATUS"); String prodModel = read.getString("PRODUCTMODEL");
String link = read.getString("APPLYLINK"); String applicant = read.getString("APPLYUSER");// STATUS
ecnBeans.add( String status = read.getString("STATUS");
new RelateEcnBean(new SimpleStringProperty(num+""),new SimpleStringProperty(contConde), String link = read.getString("APPLYLINK");
new SimpleStringProperty(contName),new SimpleStringProperty(requestNo),new SimpleStringProperty(prodModel), ecnBeans.add(new RelateEcnBean(new SimpleStringProperty(num + ""), new SimpleStringProperty(contConde),
new SimpleStringProperty(applicant),new SimpleStringProperty(status),link,controller,read)); new SimpleStringProperty(contName), new SimpleStringProperty(requestNo),
num++; new SimpleStringProperty(prodModel), new SimpleStringProperty(applicant),
} new SimpleStringProperty(status), link, controller, read));
tableView.getItems().clear(); num++;
tableView.getItems().addAll(ecnBeans); }
}catch(Exception e) { tableView.getItems().clear();
e.printStackTrace(); tableView.getItems().addAll(ecnBeans);
}finally { } catch (Exception e) {
SqlUtil.freeAll(); e.printStackTrace();
} } finally {
SqlUtil.freeAll();
}
} }
/** /**
* @param event * @param event
* @function * @function
*/ */
@FXML @FXML
void closeClick(ActionEvent event) { void closeClick(ActionEvent event) {
Stage stage = (Stage)prodModelText.getScene().getWindow(); Stage stage = (Stage) prodModelText.getScene().getWindow();
stage.close(); stage.close();
} }
/** /**
* @param searchSqlBuff sql * @param searchSqlBuff sql
* @param textField * @param textField
* @param baseName * @param baseName
* @function SQL * @function SQL
*/ */
void appendSqlBuild(StringBuilder searchSqlBuff,TextField textField,String baseName) { void appendSqlBuild(StringBuilder searchSqlBuff, TextField textField, String baseName) {
String text = textField.getText(); String text = textField.getText();
if (text!=null && !text.isEmpty() ) { if (text != null && !text.isEmpty()) {
searchSqlBuff.append(" and ").append(baseName).append(" like '%").append(text).append("%' "); searchSqlBuff.append(" and ").append(baseName).append(" like '%").append(text).append("%' ");
} }
} }
} }

@ -13,25 +13,27 @@ 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 RelateEcnDialog extends Application { public class RelateEcnDialog extends Application {
private String groupID; private String groupID;
private TCSession session; private TCSession session;
private CreateEcnController controller; private CreateEcnController controller;
public RelateEcnDialog(TCSession session, CreateEcnController controller) { public RelateEcnDialog(TCSession session, CreateEcnController controller) {
super(); super();
this.controller = controller; this.controller = controller;
this.session = session; this.session = session;
} }
@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("RelateApplyPane.fxml")); fxmlLoader.setLocation(getClass().getResource("RelateApplyPane.fxml"));
Parent root = (Parent) fxmlLoader.load(); Parent root = (Parent) fxmlLoader.load();
Scene scene = new Scene(root, 1200.0, 800.0); Scene scene = new Scene(root, 1200.0, 800.0);
RelateEcnController controller = (RelateEcnController) fxmlLoader.getController(); RelateEcnController controller = (RelateEcnController) fxmlLoader.getController();
primaryStage.setTitle("֪ͨµ¥±àºÅ"); primaryStage.setTitle("֪ͨµ¥±àºÅ");
controller.initData(session,this.controller); controller.initData(session, this.controller);
primaryStage.setScene(scene); primaryStage.setScene(scene);
primaryStage.show(); primaryStage.show();
} }

@ -34,408 +34,430 @@ import com.teamcenter.rac.kernel.TCSession;
import com.teamcenter.rac.util.MessageBox; import com.teamcenter.rac.util.MessageBox;
public class Util { public class Util {
public Connection connect(Connection conn, TCSession session) { public Connection connect(Connection conn, TCSession session) {
String[] database = session.getPreferenceService().getStringValues("database_tc"); String[] database = session.getPreferenceService().getStringValues("database_tc");
String JdbcDriverClass = "oracle.jdbc.driver.OracleDriver"; String JdbcDriverClass = "oracle.jdbc.driver.OracleDriver";
String strUrl = "jdbc:oracle:thin:@10.128.18.139:1521:testdb";// 测试系统 String strUrl = "jdbc:oracle:thin:@10.128.18.139:1521:testdb";// 测试系统
strUrl = "jdbc:oracle:thin:@" + database[0] + ":" + database[1] + ":" + database[2]; strUrl = "jdbc:oracle:thin:@" + database[0] + ":" + database[1] + ":" + database[2];
String strUserName = "infodba"; String strUserName = "infodba";
strUserName = database[3]; strUserName = database[3];
String strPassword = "infodba"; String strPassword = "infodba";
strPassword = database[4]; strPassword = database[4];
try { try {
Class.forName(JdbcDriverClass); Class.forName(JdbcDriverClass);
} catch (ClassNotFoundException e1) { } catch (ClassNotFoundException e1) {
e1.printStackTrace(); e1.printStackTrace();
} }
try { try {
conn = DriverManager.getConnection(strUrl, strUserName, strPassword); conn = DriverManager.getConnection(strUrl, strUserName, strPassword);
} catch (SQLException e) { } catch (SQLException e) {
e.printStackTrace(); e.printStackTrace();
} }
return conn; return conn;
} }
/**
* /**
* @param session *
* @param PreServiceName: * @param session
* @param Filetype:excelMSExcelX * @param PreServiceName:
* @return * @param Filetype:excelMSExcelX
*/ * @return
public static File getFile(TCSession session,String PreServiceName,String Filetype) { */
TCPreferenceService service = session.getPreferenceService(); public static File getFile(TCSession session, String PreServiceName, String Filetype) {
String puid = service.getStringValue(PreServiceName); TCPreferenceService service = session.getPreferenceService();
if (puid == null) String puid = service.getStringValue(PreServiceName);
{ if (puid == null) {
System.out.println("未找到首选项"); System.out.println("未找到首选项");
return null; return null;
} }
TCComponentDataset dat; TCComponentDataset dat;
try { try {
dat = (TCComponentDataset)session dat = (TCComponentDataset) session.stringToComponent(puid);
.stringToComponent(puid);
TCComponentTcFile[] tcFile = dat.getTcFiles();
TCComponentTcFile[] tcFile = dat.getTcFiles(); if (tcFile != null && tcFile.length == 0) {
if(tcFile != null && tcFile.length == 0) System.out.println("未找到配置文件");
{ } else {
System.out.println("未找到配置文件"); return tcFile[0].getFmsFile();
} }
else } catch (TCException e) {
{ // TODO Auto-generated catch block
return tcFile[0].getFmsFile(); e.printStackTrace();
} }
} catch (TCException e) { return null;
// TODO Auto-generated catch block }
e.printStackTrace();
} /**
return null; * @param cell2
} * @param index
private static void setCellValue(XSSFCell cell2,int index,XSSFRow row0,String cellValue) { * @param row0
// TODO Auto-generated method stub * @param cellValue
* @function
if(cell2 == null) { */
cell2 = row0.createCell(index); public static void setCellValue(XSSFCell cell2, int index, XSSFRow row0, String cellValue) {
} // TODO Auto-generated method stub
cell2.setCellValue(cellValue); if (cell2 == null) {
cell2 = row0.createCell(index);
} }
private static XSSFRow getRow(XSSFSheet sheetAt,int rowNum) {
// TODO Auto-generated method stub cell2.setCellValue(cellValue);
XSSFRow row = sheetAt.getRow(rowNum); }
if(row ==null) {
row = sheetAt.createRow(rowNum); /**
} * @param sheetAt
return row; * @param rowNum
} * @return excel
/** * @function
* @param dateset */
* @return public static XSSFRow getRow(XSSFSheet sheetAt, int rowNum) {
* @function // TODO Auto-generated method stub
*/
public static File getExcel(TCComponentDataset dateset) { XSSFRow row = sheetAt.getRow(rowNum);
File fmsFile = null; if (row == null) {
try { row = sheetAt.createRow(rowNum);
TCComponentTcFile[] file = dateset.getTcFiles(); }
if (file.length == 0 || file.length != 1) { return row;
MessageBox.post("数据集没有命名引用的文件或文件过多,请检查!", "WARNING", MessageBox.WARNING); }
return null;
} else { /**
fmsFile = file[0].getFmsFile(); * @param dateset
} * @return
} catch (Exception e) { * @function
e.printStackTrace(); */
} public static File getExcel(TCComponentDataset dateset) {
return fmsFile; File fmsFile = null;
} try {
/** TCComponentTcFile[] file = dateset.getTcFiles();
* @param target if (file.length == 0 || file.length != 1) {
* @return MessageBox.post("数据集没有命名引用的文件或文件过多,请检查!", "WARNING", MessageBox.WARNING);
* @function return null;
*/ } else {
public static String getProjectName(TCComponent target) { fmsFile = file[0].getFmsFile();
String name = ""; }
try { } catch (Exception e) {
if (target.getType().equals("ZT2_Change")) { e.printStackTrace();
name = target.getProperty("zt2_ContractName"); }
} else if (target.getType().equals("ZT2_ProjectItem")) { return fmsFile;
name = target.getProperty("object_name"); }
}
} catch (Exception e) { /**
e.printStackTrace(); * @param target
} * @return
return name; * @function
} */
/** public static String getProjectName(TCComponent target) {
* @param target String name = "";
* @return try {
* @function if (target.getType().equals("ZT2_Change")) {
*/ name = target.getProperty("zt2_ContractName");
public static String getProjectNo(TCComponent target) { } else if (target.getType().equals("ZT2_ProjectItem")) {
name = target.getProperty("object_name");
String no = ""; }
try { } catch (Exception e) {
if (target.getType().equals("ZT2_Change")) { e.printStackTrace();
no = target.getProperty("zt2_ContractNo"); }
} else if (target.getType().equals("ZT2_ProjectItem")) { return name;
}
String zt2_ProjectCode = target.getProperty("zt2_ProjectCode");
if (!KUtil.isEmpty(zt2_ProjectCode)) { /**
no = zt2_ProjectCode; * @param target
} else { * @return
no = target.getProperty("zt2_ProjectNo"); * @function
} */
public static String getProjectNo(TCComponent target) {
}
} catch (Exception e) { String no = "";
e.printStackTrace(); try {
} if (target.getType().equals("ZT2_Change")) {
return no; no = target.getProperty("zt2_ContractNo");
} } else if (target.getType().equals("ZT2_ProjectItem")) {
/**
* @param target String zt2_ProjectCode = target.getProperty("zt2_ProjectCode");
* @param productModelList if (!KUtil.isEmpty(zt2_ProjectCode)) {
* @return no = zt2_ProjectCode;
* @function } else {
*/ no = target.getProperty("zt2_ProjectNo");
public static List<String> getProductNames(TCComponent target, List<String> productModelList) { }
// 如果选中的是变更单,通过引用往上找到项目
try { }
if (target.getType().equals("ZT2_Change")) { } catch (Exception e) {
AIFComponentContext[] a1 = target.whereReferenced();// 更改单文件夹 e.printStackTrace();
if (a1 == null || a1.length < 1) { }
String zt2_ProductModel = target.getProperty("zt2_ProductModel"); return no;
productModelList.add(zt2_ProductModel); }
return productModelList;
} /**
* @param target
AIFComponentContext[] a2 = ((TCComponent) a1[0].getComponent()).whereReferenced();// 项目监控文件夹 * @param productModelList
try { * @return
if (a2.length < 1 || !a2[0].getComponent().getProperty("object_name").contains("项目监控")) { * @function
String zt2_ProductModel = target.getProperty("zt2_ProductModel");//zt2_ProductName 新的属性 */
productModelList.add(zt2_ProductModel); public static List<String> getProductNames(TCComponent target, List<String> productModelList) {
return productModelList; // 如果选中的是变更单,通过引用往上找到项目
} try {
} catch (Exception e) { if (target.getType().equals("ZT2_Change")) {
e.printStackTrace(); AIFComponentContext[] a1 = target.whereReferenced();// 更改单文件夹
} if (a1 == null || a1.length < 1) {
String zt2_ProductModel = target.getProperty("zt2_ProductModel");
AIFComponentContext[] a3 = ((TCComponent) a2[0].getComponent()).whereReferenced();// 项目零组件 productModelList.add(zt2_ProductModel);
target = (TCComponent) a3[0].getComponent(); return productModelList;
} }
} catch (TCException e1) {
e1.printStackTrace(); AIFComponentContext[] a2 = ((TCComponent) a1[0].getComponent()).whereReferenced();// 项目监控文件夹
} try {
try { if (a2.length < 1 || !a2[0].getComponent().getProperty("object_name").contains("项目监控")) {
TCComponent[] folders = target.getRelatedComponents("IMAN_reference"); String zt2_ProductModel = target.getProperty("zt2_ProductModel");// zt2_ProductName 新的属性
for (int i = 0; i < folders.length; i++) { productModelList.add(zt2_ProductModel);
if (folders[i].getProperty("object_name").contains("项目启动")) { return productModelList;
}
TCComponent[] folders2 = folders[i].getRelatedComponents("contents"); } catch (Exception e) {
for (int j = 0; j < folders2.length; j++) { e.printStackTrace();
if (folders2[j].getProperty("object_name").contains("产成品")) { }
TCComponent[] ccbh = folders2[j].getRelatedComponents("contents");
for (int k = 0; k < ccbh.length; k++) { AIFComponentContext[] a3 = ((TCComponent) a2[0].getComponent()).whereReferenced();// 项目零组件
if (ccbh[k].getType().equals("Part")) { target = (TCComponent) a3[0].getComponent();
productModelList.add(ccbh[k].getProperty("object_name")); }
} } catch (TCException e1) {
} e1.printStackTrace();
} }
} try {
} TCComponent[] folders = target.getRelatedComponents("IMAN_reference");
} for (int i = 0; i < folders.length; i++) {
} catch (TCException e) { if (folders[i].getProperty("object_name").contains("项目启动")) {
e.printStackTrace();
} TCComponent[] folders2 = folders[i].getRelatedComponents("contents");
for (int j = 0; j < folders2.length; j++) {
return productModelList; if (folders2[j].getProperty("object_name").contains("产成品")) {
} TCComponent[] ccbh = folders2[j].getRelatedComponents("contents");
/** for (int k = 0; k < ccbh.length; k++) {
* @param target if (ccbh[k].getType().equals("Part")) {
* @param productModelList productModelList.add(ccbh[k].getProperty("object_name"));
* @return }
* @function }
*/ }
public static List<String> getproductModel(TCComponent target, List<String> productModelList) { }
// 如果选中的是变更单,通过引用往上找到项目 }
try { }
if (target.getType().equals("ZT2_Change")) { } catch (TCException e) {
AIFComponentContext[] a1 = target.whereReferenced();// 更改单文件夹 e.printStackTrace();
if (a1 == null || a1.length < 1) { }
String zt2_ProductModel = target.getProperty("zt2_ProductModel");
productModelList.add(zt2_ProductModel); return productModelList;
return productModelList; }
}
/**
AIFComponentContext[] a2 = ((TCComponent) a1[0].getComponent()).whereReferenced();// 项目监控文件夹 * @param target
try { * @param productModelList
if (a2.length < 1 || !a2[0].getComponent().getProperty("object_name").contains("项目监控")) { * @return
String zt2_ProductModel = target.getProperty("zt2_ProductModel"); * @function
productModelList.add(zt2_ProductModel); */
return productModelList; public static List<String> getproductModel(TCComponent target, List<String> productModelList) {
} // 如果选中的是变更单,通过引用往上找到项目
} catch (Exception e) { try {
e.printStackTrace(); if (target.getType().equals("ZT2_Change")) {
} AIFComponentContext[] a1 = target.whereReferenced();// 更改单文件夹
if (a1 == null || a1.length < 1) {
AIFComponentContext[] a3 = ((TCComponent) a2[0].getComponent()).whereReferenced();// 项目零组件 String zt2_ProductModel = target.getProperty("zt2_ProductModel");
target = (TCComponent) a3[0].getComponent(); productModelList.add(zt2_ProductModel);
} return productModelList;
} catch (TCException e1) { }
e1.printStackTrace();
} AIFComponentContext[] a2 = ((TCComponent) a1[0].getComponent()).whereReferenced();// 项目监控文件夹
try { try {
TCComponent[] folders = target.getRelatedComponents("IMAN_reference"); if (a2.length < 1 || !a2[0].getComponent().getProperty("object_name").contains("项目监控")) {
for (int i = 0; i < folders.length; i++) { String zt2_ProductModel = target.getProperty("zt2_ProductModel");
if (folders[i].getProperty("object_name").contains("项目启动")) { productModelList.add(zt2_ProductModel);
return productModelList;
TCComponent[] folders2 = folders[i].getRelatedComponents("contents"); }
for (int j = 0; j < folders2.length; j++) { } catch (Exception e) {
if (folders2[j].getProperty("object_name").contains("产成品")) { e.printStackTrace();
TCComponent[] ccbh = folders2[j].getRelatedComponents("contents"); }
for (int k = 0; k < ccbh.length; k++) {
if (ccbh[k].getType().equals("Part")) { AIFComponentContext[] a3 = ((TCComponent) a2[0].getComponent()).whereReferenced();// 项目零组件
productModelList.add(ccbh[k].getProperty("object_name")); target = (TCComponent) a3[0].getComponent();
} }
} } catch (TCException e1) {
} e1.printStackTrace();
} }
} try {
} TCComponent[] folders = target.getRelatedComponents("IMAN_reference");
} catch (TCException e) { for (int i = 0; i < folders.length; i++) {
e.printStackTrace(); if (folders[i].getProperty("object_name").contains("项目启动")) {
}
TCComponent[] folders2 = folders[i].getRelatedComponents("contents");
return productModelList; for (int j = 0; j < folders2.length; j++) {
} if (folders2[j].getProperty("object_name").contains("产成品")) {
public void disconnect(Connection conn, Statement stmt, ResultSet rs_get) { TCComponent[] ccbh = folders2[j].getRelatedComponents("contents");
try { for (int k = 0; k < ccbh.length; k++) {
if (rs_get != null) { if (ccbh[k].getType().equals("Part")) {
rs_get.close(); productModelList.add(ccbh[k].getProperty("object_name"));
} }
}
if (stmt != null) { }
stmt.close(); }
} }
if (conn != null) { }
conn.close(); } catch (TCException e) {
} e.printStackTrace();
} catch (SQLException e) { }
e.printStackTrace();
} return productModelList;
} }
/**
* @param sourthPath public void disconnect(Connection conn, Statement stmt, ResultSet rs_get) {
* @param filePath try {
* @param pages if (rs_get != null) {
* @function rs_get.close();
*/ }
public static void deMerge(String sourthPath, String filePath, int pages) {
try { if (stmt != null) {
FileInputStream fis = new FileInputStream(sourthPath); stmt.close();
HSSFWorkbook workBook = new HSSFWorkbook(fis); }
HSSFSheet sheet = workBook.getSheetAt(0); if (conn != null) {
for (int i = 0; i < sheet.getNumMergedRegions(); ++i) { conn.close();
CellRangeAddress range = sheet.getMergedRegion(i); }
if (range.getFirstRow() > 23 * pages + 2) { } catch (SQLException e) {
sheet.removeMergedRegion(i); e.printStackTrace();
} }
} }
File file2 = null;
file2 = new File(filePath); /**
FileOutputStream fos = new FileOutputStream(file2); * @param sourthPath
workBook.write(fos); * @param filePath
} catch (Exception e) { * @param pages
e.printStackTrace(); * @function
} */
try { public static void deMerge(String sourthPath, String filePath, int pages) {
FileInputStream fis = new FileInputStream(filePath); try {
HSSFWorkbook workBook = new HSSFWorkbook(fis); FileInputStream fis = new FileInputStream(sourthPath);
HSSFSheet sheet = workBook.getSheetAt(0); HSSFWorkbook workBook = new HSSFWorkbook(fis);
boolean loop = false; HSSFSheet sheet = workBook.getSheetAt(0);
for (int i = 0; i < sheet.getNumMergedRegions(); ++i) { for (int i = 0; i < sheet.getNumMergedRegions(); ++i) {
if (loop == true) { CellRangeAddress range = sheet.getMergedRegion(i);
continue; if (range.getFirstRow() > 23 * pages + 2) {
} sheet.removeMergedRegion(i);
CellRangeAddress range = sheet.getMergedRegion(i); }
if (range.getFirstRow() > 23 * pages + 2) { }
loop = true; File file2 = null;
break; file2 = new File(filePath);
} FileOutputStream fos = new FileOutputStream(file2);
} workBook.write(fos);
if (loop == true) { } catch (Exception e) {
deMerge(filePath, filePath, pages); e.printStackTrace();
} }
} catch (Exception e) { try {
e.printStackTrace(); FileInputStream fis = new FileInputStream(filePath);
} HSSFWorkbook workBook = new HSSFWorkbook(fis);
} HSSFSheet sheet = workBook.getSheetAt(0);
/** boolean loop = false;
* @param sourcePath for (int i = 0; i < sheet.getNumMergedRegions(); ++i) {
* @param filePath if (loop == true) {
* @param pages continue;
* @function excel }
*/ CellRangeAddress range = sheet.getMergedRegion(i);
public static void delete(String sourcePath, String filePath, int pages) { if (range.getFirstRow() > 23 * pages + 2) {
try { loop = true;
FileInputStream fis = new FileInputStream(sourcePath); break;
HSSFWorkbook workBook = new HSSFWorkbook(fis); }
HSSFSheet sheet = workBook.getSheetAt(0); }
int rowCount = sheet.getLastRowNum(); if (loop == true) {
for (int i = rowCount; i > pages * 23 + 1; i--) { deMerge(filePath, filePath, pages);
sheet.shiftRows(i, i, -1); }
} } catch (Exception e) {
File file2 = null; e.printStackTrace();
System.out.println(filePath); }
file2 = new File(filePath); }
FileOutputStream fos = new FileOutputStream(file2);
workBook.write(fos); /**
} catch (Exception e) { * @param sourcePath
e.printStackTrace(); * @param filePath
} * @param pages
} * @function excel
/** */
* @return yyyy-MM-dd-HH-mm public static void delete(String sourcePath, String filePath, int pages) {
* @function try {
*/ FileInputStream fis = new FileInputStream(sourcePath);
public static String GetNowDate() { HSSFWorkbook workBook = new HSSFWorkbook(fis);
String temp_str = ""; HSSFSheet sheet = workBook.getSheetAt(0);
Date dt = new Date(); int rowCount = sheet.getLastRowNum();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd-HH-mm"); for (int i = rowCount; i > pages * 23 + 1; i--) {
temp_str = sdf.format(dt); sheet.shiftRows(i, i, -1);
return temp_str; }
} File file2 = null;
/** System.out.println(filePath);
* @param sheet file2 = new File(filePath);
* @param startRow FileOutputStream fos = new FileOutputStream(file2);
* @param endRow workBook.write(fos);
* @return } catch (Exception e) {
* @function e.printStackTrace();
*/ }
public static List<CellRangeAddress> getMergeRegions(Sheet sheet, int startRow, int endRow) { }
List<CellRangeAddress> list = new ArrayList<>();
for (int i = 0; i < sheet.getNumMergedRegions(); ++i) { /**
org.apache.poi.ss.util.CellRangeAddress oldRange = sheet.getMergedRegion(i); * @return yyyy-MM-dd-HH-mm
if (oldRange.getFirstRow() >= startRow && oldRange.getLastRow() <= endRow) { * @function
list.add(oldRange); */
} public static String GetNowDate() {
} String temp_str = "";
return list; Date dt = new Date();
} SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd-HH-mm");
/** temp_str = sdf.format(dt);
* @param page return temp_str;
* @param lists }
* @param sheet
* @param wb /**
* @function excel * @param sheet
*/ * @param startRow
public static void addExcelPage(int page, List<CellRangeAddress> lists, HSSFSheet sheet, HSSFWorkbook wb) { * @param endRow
HSSFRow row; * @return
for (int i = 2; i < 24; i++) { * @function
row = sheet.createRow(page * 23 + i); */
for (int j = 0; j < 17; j++) { public static List<CellRangeAddress> getMergeRegions(Sheet sheet, int startRow, int endRow) {
row.createCell(j); List<CellRangeAddress> list = new ArrayList<>();
} for (int i = 0; i < sheet.getNumMergedRegions(); ++i) {
POIUtil.copyRow(wb, sheet.getRow(i), row, true); org.apache.poi.ss.util.CellRangeAddress oldRange = sheet.getMergedRegion(i);
} if (oldRange.getFirstRow() >= startRow && oldRange.getLastRow() <= endRow) {
for (int i = 0; i < lists.size(); i++) { list.add(oldRange);
CellRangeAddress range = lists.get(i); }
CellRangeAddress newMergedRegion = new CellRangeAddress(range.getFirstRow() + page * 23, }
range.getLastRow() + page * 23, range.getFirstColumn(), range.getLastColumn()); return list;
sheet.addMergedRegion(newMergedRegion); }
}
} /**
/* * @param page
* public static void writeECNExcel(File file,String zt2_ContractNo) throws * @param lists
* Exception { HSSFSheet sheet; HSSFWorkbook workBook; InputStream fis; * @param sheet
* OutputStream fos; fis = new FileInputStream(file) ; workBook = new * @param wb
* HSSFWorkbook(fis); sheet =workBook.getSheetAt(0); HSSFCellStyle cellStyle = * @function excel
* sheet.getRow(2).getCell(11).getCellStyle(); */
* sheet.getRow(3).getCell(11).setCellValue(zt2_ContractNo); if(cellStyle!=null) public static void addExcelPage(int page, List<CellRangeAddress> lists, HSSFSheet sheet, HSSFWorkbook wb) {
* sheet.getRow(3).getCell(11).setCellStyle(cellStyle); fos = new HSSFRow row;
* FileOutputStream(file.getAbsolutePath()); workBook.write(fos); fos.flush(); for (int i = 2; i < 24; i++) {
* fos.close(); fis.close(); } row = sheet.createRow(page * 23 + i);
*/ for (int j = 0; j < 17; j++) {
row.createCell(j);
}
POIUtil.copyRow(wb, sheet.getRow(i), row, true);
}
for (int i = 0; i < lists.size(); i++) {
CellRangeAddress range = lists.get(i);
CellRangeAddress newMergedRegion = new CellRangeAddress(range.getFirstRow() + page * 23,
range.getLastRow() + page * 23, range.getFirstColumn(), range.getLastColumn());
sheet.addMergedRegion(newMergedRegion);
}
}
/*
* public static void writeECNExcel(File file,String zt2_ContractNo) throws
* Exception { HSSFSheet sheet; HSSFWorkbook workBook; InputStream fis;
* OutputStream fos; fis = new FileInputStream(file) ; workBook = new
* HSSFWorkbook(fis); sheet =workBook.getSheetAt(0); HSSFCellStyle cellStyle =
* sheet.getRow(2).getCell(11).getCellStyle();
* sheet.getRow(3).getCell(11).setCellValue(zt2_ContractNo); if(cellStyle!=null)
* sheet.getRow(3).getCell(11).setCellStyle(cellStyle); fos = new
* FileOutputStream(file.getAbsolutePath()); workBook.write(fos); fos.flush();
* fos.close(); fis.close(); }
*/
} }

@ -13,120 +13,123 @@ import javafx.stage.Stage;
//import sun.util.logging.PlatformLogger; //import sun.util.logging.PlatformLogger;
public abstract class KFXPanel extends Application { public abstract class KFXPanel extends Application {
protected Scene scene; protected Scene scene;
protected KFXPanelController aifController; protected KFXPanelController aifController;
protected Parent root; protected Parent root;
protected String cssForm; protected String cssForm;
protected Window parentDialog; protected Window parentDialog;
static { static {
Platform.setImplicitExit(false); Platform.setImplicitExit(false);
// Logging.getCSSLogger().setLevel(Platform.class...STYLESHEET_CASPIAN....Level.OFF); // Logging.getCSSLogger().setLevel(Platform.class...STYLESHEET_CASPIAN....Level.OFF);
} }
public KFXPanel(Window dialog,String fxmlName) { public KFXPanel(Window dialog, String fxmlName) {
setParentDialog(dialog); setParentDialog(dialog);
initUI(fxmlName); initUI(fxmlName);
initData(); initData();
} }
public KFXPanel(Window dialog, Class<?> c, String css) { public KFXPanel(Window dialog, Class<?> c, String css) {
setParentDialog(dialog); setParentDialog(dialog);
this.cssForm = c.getResource(css).toExternalForm(); this.cssForm = c.getResource(css).toExternalForm();
initUI(); initUI();
initData(); initData();
} }
public void setParentDialog(Window dialog) { public void setParentDialog(Window dialog) {
this.parentDialog = dialog; this.parentDialog = dialog;
} }
public Window getParentDialog() { public Window getParentDialog() {
return this.parentDialog; return this.parentDialog;
} }
public Parent getRoot() { public Parent getRoot() {
return this.root; return this.root;
} }
public KFXPanelController getController() { public KFXPanelController getController() {
return this.aifController; return this.aifController;
} }
public Scene getScene() { public Scene getScene() {
if (this.scene == null) { if (this.scene == null) {
this.scene = new Scene(this.root); this.scene = new Scene(this.root);
this.scene.setFill(null); this.scene.setFill(null);
} }
return this.scene; return this.scene;
} }
public void initData() { public void initData() {
try { try {
this.aifController.initData(this); this.aifController.initData(this);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
post(this.parentDialog, e.getMessage(), "", 1); post(this.parentDialog, e.getMessage(), "", 1);
} }
} }
protected void initUI(String fxmlName) {
try { protected void initUI(String fxmlName) {
FXMLLoader fxmlLoader = new FXMLLoader(); try {
String resource = fxmlName;//"SearchSapResultPanel.fxml"; FXMLLoader fxmlLoader = new FXMLLoader();
fxmlLoader.setLocation(getClass().getResource(resource)); String resource = fxmlName;// "SearchSapResultPanel.fxml";
this.root = (Parent)fxmlLoader.load(); fxmlLoader.setLocation(getClass().getResource(resource));
this.aifController = (KFXPanelController)fxmlLoader.getController(); this.root = (Parent) fxmlLoader.load();
if (this.cssForm != null) this.aifController = (KFXPanelController) fxmlLoader.getController();
this.root.getStylesheets().add(this.cssForm); if (this.cssForm != null)
} catch (Exception e) { this.root.getStylesheets().add(this.cssForm);
e.printStackTrace(); } catch (Exception e) {
post(this.parentDialog, e.getMessage(), "", 1); e.printStackTrace();
} post(this.parentDialog, e.getMessage(), "", 1);
} }
protected void initUI() { }
try {
FXMLLoader fxmlLoader = new FXMLLoader(); protected void initUI() {
String resource = "SearchSapResultPanel.fxml"; try {
fxmlLoader.setLocation(getClass().getResource(resource)); FXMLLoader fxmlLoader = new FXMLLoader();
this.root = (Parent)fxmlLoader.load(); String resource = "SearchSapResultPanel.fxml";
this.aifController = (KFXPanelController)fxmlLoader.getController(); fxmlLoader.setLocation(getClass().getResource(resource));
if (this.cssForm != null) this.root = (Parent) fxmlLoader.load();
this.root.getStylesheets().add(this.cssForm); this.aifController = (KFXPanelController) fxmlLoader.getController();
} catch (Exception e) { if (this.cssForm != null)
e.printStackTrace(); this.root.getStylesheets().add(this.cssForm);
post(this.parentDialog, e.getMessage(), "", 1); } catch (Exception e) {
} e.printStackTrace();
} post(this.parentDialog, e.getMessage(), "", 1);
}
public static void post(Window dialog, final String msg, final String title, int msgType) { }
if (dialog == null) {
Platform.runLater(new Runnable() { public static void post(Window dialog, final String msg, final String title, int msgType) {
public void run() { if (dialog == null) {
Alert alert = new Alert(Alert.AlertType.INFORMATION); Platform.runLater(new Runnable() {
alert.setTitle(title); public void run() {
alert.setHeaderText(""); Alert alert = new Alert(Alert.AlertType.INFORMATION);
alert.setContentText(msg); alert.setTitle(title);
alert.showAndWait(); alert.setHeaderText("");
} alert.setContentText(msg);
}); alert.showAndWait();
} else { }
MessageBox.post(dialog, msg, title, msgType); });
} } else {
} MessageBox.post(dialog, msg, title, msgType);
}
}
// protected Stage primaryStage; // protected Stage primaryStage;
public void start(Stage primaryStage) throws Exception { public void start(Stage primaryStage) throws Exception {
initUI(); initUI();
initData(); initData();
// this.primaryStage = primaryStage; // this.primaryStage = primaryStage;
primaryStage.setScene(getScene()); primaryStage.setScene(getScene());
primaryStage.show(); primaryStage.show();
} }
public static void main(String[] args) { public static void main(String[] args) {
launch(args); launch(args);
} }
} }

@ -1,28 +1,27 @@
package com.chint.plm.fxUtil; package com.chint.plm.fxUtil;
import javafx.application.Platform; import javafx.application.Platform;
import javafx.fxml.FXML; import javafx.fxml.FXML;
import javafx.scene.layout.AnchorPane; import javafx.scene.layout.AnchorPane;
public abstract class KFXPanelController { public abstract class KFXPanelController {
@FXML @FXML
protected AnchorPane coverPane; protected AnchorPane coverPane;
public abstract void initData(KFXPanel paramKFXPanel) throws Exception; public abstract void initData(KFXPanel paramKFXPanel) throws Exception;
public void setCoverVisible(final boolean visible) { public void setCoverVisible(final boolean visible) {
if (this.coverPane != null) { if (this.coverPane != null) {
Platform.runLater(new Runnable() { Platform.runLater(new Runnable() {
public void run() { public void run() {
KFXPanelController.this.coverPane.setVisible(visible); KFXPanelController.this.coverPane.setVisible(visible);
}
});
try {
Thread.sleep(10L);
} catch (Exception e) {
e.printStackTrace();
} }
}); }
try { }
Thread.sleep(10L);
} catch (Exception e) {
e.printStackTrace();
}
}
}
} }

@ -1,28 +1,29 @@
package com.chint.plm.fxUtil; package com.chint.plm.fxUtil;
import com.teamcenter.rac.util.MessageBox; import com.teamcenter.rac.util.MessageBox;
import com.teamcenter.rac.util.UIUtilities; import com.teamcenter.rac.util.UIUtilities;
import javax.swing.JFrame; import javax.swing.JFrame;
public abstract class KFrame extends JFrame { public abstract class KFrame extends JFrame {
// protected KDialogController controller; // protected KDialogController controller;
public KFrame() { public KFrame() {
try { try {
// if (!this.controller.init()) // if (!this.controller.init())
// return; // return;
initUI(); initUI();
showFrame(); showFrame();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
MessageBox.post(this, e); MessageBox.post(this, e);
} }
} }
public void showFrame() { public void showFrame() {
pack(); pack();
UIUtilities.centerToScreen(this); UIUtilities.centerToScreen(this);
setVisible(true); setVisible(true);
} }
protected abstract void initUI() throws Exception; protected abstract void initUI() throws Exception;
} }

@ -114,7 +114,6 @@ public class BomSendSapOp extends AbstractAIFOperation {
if(MATNR!=null) { if(MATNR!=null) {
attributeValue = attributeValue+",ÔÚ"+MATNR+"BOMÖÐ"; attributeValue = attributeValue+",ÔÚ"+MATNR+"BOMÖÐ";
} }
// String gbk = new String(attributeValue.getBytes("GBK"), "UTF-8");
System.out.println(attributeValue); System.out.println(attributeValue);
errBuffer.append(attributeValue).append("\n"); errBuffer.append(attributeValue).append("\n");
} }

Loading…
Cancel
Save