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

@ -1,4 +1,5 @@
package com.chint.plm.SearchSapResult;
import java.io.IOException;
import java.util.List;
@ -13,12 +14,14 @@ public class ChildMessage extends Application {
// private List<List<DetailsBean>> tableBeans;
private boolean onlyError;
private StringBuilder sqlTotal;
public ChildMessage(boolean onlyError,StringBuilder sqlTotal) {
public ChildMessage(boolean onlyError, StringBuilder sqlTotal) {
super();
// this.tableBeans = tableBeans;
this.onlyError = onlyError;
this.sqlTotal = sqlTotal;
}
@Override
public void start(Stage primaryStage) throws IOException {
// StackPane root = new StackPane();
@ -28,7 +31,7 @@ public class ChildMessage extends Application {
Scene scene = new Scene(root, 1200.0, 800.0);
DetailsController controller = (DetailsController) fxmlLoader.getController();
primaryStage.setTitle("SAP´«µÝ½á¹ûÃ÷ϸ");
controller.initData(primaryStage,onlyError,sqlTotal);
controller.initData(primaryStage, onlyError, sqlTotal);
primaryStage.setScene(scene);
primaryStage.show();
}

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

@ -2,12 +2,18 @@ package com.chint.plm.SearchSapResult;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
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.XSSFWorkbook;
@ -44,10 +50,6 @@ import javafx.scene.layout.GridPane;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;
/**
* @author cyh
*
*/
/**
* @author cyh
*
@ -106,9 +108,13 @@ public class DetailsController {
int pageNum = 0;
List<List<DetailsBean>> tableBeans; // 记录表格里面的数据
List<List<DetailsBean>> errMsgBeans; // 记录错误的数据
List<List<DetailsBean>> allMsgBeans; // 记录全部数据
List<List<DetailsBean>> errMsgBeans = new ArrayList<>(); // 记录错误的数据
List<List<DetailsBean>> allMsgBeans = new ArrayList<>(); // 记录全部数据
/**
* @param event
* @function
*/
@FXML
void firstAction(ActionEvent event) {
pageNum = 0;
@ -117,6 +123,10 @@ public class DetailsController {
tableView.setItems(data);
}
/**
* @param event
* @function
*/
@FXML
void lastAction(ActionEvent event) {
if (pageNum > 0) {
@ -127,6 +137,10 @@ public class DetailsController {
tableView.setItems(data);
}
/**
* @param event
* @function
*/
@FXML
void nextAction(ActionEvent event) {
if (pageNum < tableBeans.size() - 1) {
@ -137,6 +151,10 @@ public class DetailsController {
tableView.setItems(data);
}
/**
* @param event
* @function
*/
@FXML
void tailAction(ActionEvent event) {
pageNum = tableBeans.size() - 1;
@ -190,9 +208,35 @@ public class DetailsController {
XSSFSheet sheetAt = wb.getSheet("SAP传递结果导出");
for (List<DetailsBean> detailList : tableBeans) {
// 导出excel设置值
for (DetailsBean detailsBean : detailList) {
XSSFRow row1 = Util.getRow(sheetAt, detailsBean.getNum());
Util.setCellValue(row1.getCell(0), 0, row1, detailsBean.getNum() + "");// 序号
Util.setCellValue(row1.getCell(1), 1, row1, detailsBean.getBatchNum());// 批次号
Util.setCellValue(row1.getCell(2), 2, row1, detailsBean.getProductMaterialNo());// 父物料编码
Util.setCellValue(row1.getCell(3), 3, row1, detailsBean.getWbsNo());// WBS
Util.setCellValue(row1.getCell(4), 4, row1, detailsBean.getStatus());// SAP状态
Util.setCellValue(row1.getCell(5), 5, row1, detailsBean.getMessage());// 具体信息
Util.setCellValue(row1.getCell(6), 6, row1, detailsBean.getCreateDate());// BOM创建日期
Util.setCellValue(row1.getCell(7), 7, row1, detailsBean.getCreateTime());// BOM创建时间
Util.setCellValue(row1.getCell(8), 8, row1, detailsBean.getReturnDate());// BOM同步日期
Util.setCellValue(row1.getCell(9), 9, row1, detailsBean.getReturnTime());// BOM同步时间
Util.setCellValue(row1.getCell(9), 9, row1, detailsBean.getPlmStatus());// PLM状态
}
}
// 桌面
File desktopDir = FileSystemView.getFileSystemView().getHomeDirectory();
String desktopPath = desktopDir.getAbsolutePath();
// 文件保存到桌面,名称:结果导出时间戳
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();
@ -200,14 +244,22 @@ public class DetailsController {
}
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);
@ -267,11 +319,14 @@ public class DetailsController {
// 更新GUI组件
// Platform.runLater(new Runnable() {
double width = primaryStage.getWidth();
double height = primaryStage.getHeight();
System.out.println("width==>" + width);
girdPane.setPrefWidth(width * 0.98);
flowPane.setPrefWidth(width * 0.98);
scrollPane.setPrefWidth(width * 0.98);
tableView.setPrefWidth(width * 0.98);
scrollPane.setPrefHeight(height*0.8);
tableView.setPrefHeight(height*0.8);
}
});
primaryStage.setMaximized(true);
@ -295,16 +350,27 @@ public class DetailsController {
}
}
});
// 添加监听跳转页面
pageNumTxt.setOnKeyPressed(new EventHandler<KeyEvent>() {
@Override
public void handle(KeyEvent event) {
if (event.getCode() == KeyCode.ENTER) {
// showHistoryWords(querybox.getText());
String text = pageNumTxt.getText();
int num = 0;
try {
int parseInt = Integer.parseInt(text);
num = parseInt;
} catch (Exception e) {
}
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;

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

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

@ -272,7 +272,7 @@ public class SearchSapController extends KFXPanelController {
i = i + 1;
}
if (tableBeans.size() == 0) {
MessageBox.post(frame,"未查询到传递记录.", "提示", 2);
MessageBox.post(frame, "未查询到传递记录.", "提示", 2);
beanList = new ArrayList<SumTableBean>();
tableBeans.add(beanList);
}

@ -12,7 +12,7 @@ public class SearchSapResultComd extends KCommand {
super(app, commandId, actionInfo);
try {
new SapResultFrame();
}catch(Exception e) {
} catch (Exception e) {
e.printStackTrace();
}
}

@ -14,94 +14,116 @@ import javafx.stage.Stage;
public class SumTableBean {
//序 号
// 序 号
protected SimpleIntegerProperty num;
//任务号
// 任务号
protected SimpleStringProperty taskNo;
//发起人
// 发起人
protected SimpleStringProperty user;
//发起时间
// 发起时间
protected SimpleStringProperty startTime;
//子任务数
// 子任务数
protected SimpleStringProperty cTaskNum;
//SAP处理结果
// SAP处理结果
protected SimpleStringProperty sapResult;
//数据状态
// 数据状态
protected SimpleStringProperty dataStatus;
//PLM处理进度
// PLM处理进度
protected SimpleStringProperty plmResult;
//结果明细
// 结果明细
protected Button details = new Button();
protected Button logDownload = new Button();
private boolean onlyError;
private StringBuilder detailSql;
public Button getDetails() {
return details;
}
public Button getLogDownload() {
return logDownload;
}
public void setLogDownload(Button logDownload) {
this.logDownload = logDownload;
}
public void setDetails(Button details) {
this.details = details;
}
public Integer getNum() {
return num.get();
}
public void setNum(SimpleIntegerProperty num) {
this.num = num;
}
public String getTaskNo() {
return taskNo.get();
}
public void setTaskNo(SimpleStringProperty taskNo) {
this.taskNo = taskNo;
}
public String getUser() {
return user.get();
}
public void setUser(SimpleStringProperty user) {
this.user = user;
}
public String getStartTime() {
return startTime.get();
}
public void setStartTime(SimpleStringProperty startTime) {
this.startTime = startTime;
}
public String getcTaskNum() {
return cTaskNum.get();
}
public void setcTaskNum(SimpleStringProperty cTaskNum) {
this.cTaskNum = cTaskNum;
}
public String getSapResult() {
return sapResult.get();
}
public void setSapResult(SimpleStringProperty sapResult) {
this.sapResult = sapResult;
}
public String getDataStatus() {
return dataStatus.get();
}
public void setDataStatus(SimpleStringProperty dataStatus) {
this.dataStatus = dataStatus;
}
public String getPlmResult() {
return plmResult.get();
}
public void setPlmResult(SimpleStringProperty plmResult) {
this.plmResult = plmResult;
}
private String url;
private String code;
private String[] prefs;
public SumTableBean(SimpleIntegerProperty num, SimpleStringProperty taskNo, SimpleStringProperty user,
SimpleStringProperty startTime, SimpleStringProperty cTaskNum, SimpleStringProperty sapResult,
SimpleStringProperty dataStatus, SimpleStringProperty plmResult,boolean onlyError,StringBuilder detailSql,
String[] prefs,String code,String url) {
SimpleStringProperty dataStatus, SimpleStringProperty plmResult, boolean onlyError, StringBuilder detailSql,
String[] prefs, String code, String url) {
super();
this.num = num;
this.taskNo = taskNo;
@ -120,8 +142,8 @@ public class SumTableBean {
logDownload.setText("日志下载");
logDownload.setOnAction(e -> {
try {
if(!url.isEmpty()) {
String replaceAll = url.replaceAll("\n","").replaceAll("\r", "");
if (!url.isEmpty()) {
String replaceAll = url.replaceAll("\n", "").replaceAll("\r", "");
System.out.println(replaceAll);
BomToSapUtil.browse2(replaceAll);
}
@ -131,13 +153,14 @@ public class SumTableBean {
}
}); // 此按钮没有加入到图形中
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,"
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.detailSql);
try {
//单个BOM具体信息 : 全部状态.
// 单个BOM具体信息 : 全部状态.
// List<List<DetailsBean>> tableBeans = new ArrayList<List<DetailsBean>>();
// SqlUtil.getTCDataConnection(prefs);
// String sqlDetail = "";
@ -166,12 +189,12 @@ public class SumTableBean {
// }
//
// SqlUtil.freeAll();
ChildMessage open = new ChildMessage(this.onlyError,sqlTotal);
ChildMessage open = new ChildMessage(this.onlyError, sqlTotal);
open.start(new Stage());
}catch(Exception ex){
} catch (Exception ex) {
ex.printStackTrace();
}finally {
System.out.println("END"+sqlTotal.toString());
} finally {
System.out.println("END" + sqlTotal.toString());
SqlUtil.freeAll();
}

@ -13,7 +13,10 @@ import java.sql.Statement;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFRow;
@ -22,15 +25,24 @@ import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.util.CellRangeAddress;
import org.casic.javafx.control.DateTimePicker;
import org.dom4j.Document;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
import com.chint.plm.SearchSapResult.SumTableBean;
import com.chint.plm.fxUtil.KFXPanel;
import com.chint.plm.fxUtil.KFXPanelController;
import com.connor.chint.JDBPackage.JDBFrame;
import com.connor.chint.sap2.util.BomToSapUtil;
import com.connor.chint.sap2.util.KUtil;
import com.connor.chint.sap2.util.POIUtil;
import com.connor.chint.sap2.util.SAPUtil;
import com.connor.chint.sap2.util.SqlUtil;
import com.squareup.okhttp.MediaType;
import com.squareup.okhttp.OkHttpClient;
import com.squareup.okhttp.Request;
import com.squareup.okhttp.RequestBody;
import com.squareup.okhttp.Response;
import com.teamcenter.rac.aif.AbstractAIFApplication;
import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent;
import com.teamcenter.rac.aifrcp.AIFUtility;
@ -265,53 +277,54 @@ public class CreateEcnController extends KFXPanelController {
+ "\"actionstatement\",\"result\",\"principal\",\"pctime\",\"remark\") values (?,?,?,?,?,?,?,?,?)";
ObservableList<RefTableBean> items = refTable.getItems();
// 1222 新增逻辑,责任人指派
for (int i = 0; i < 7; i++) {
RefTableBean refTableBean = items.get(i);
String result = refTableBean.getShYes().isSelected() ? "是" : "否";
SqlUtil.write(new String[] { endCode, "1", refTableBean.getDepart(), String.valueOf(i + 1),
refTableBean.getMessage(), result, refTableBean.getUser().getText(),
refTableBean.getMessage(), result, refTableBean.getUserVal(),
refTableBean.getCompDate().getText(), refTableBean.getMark().getText() }, insertSql);
}
for (int i = 7; i < 11; i++) {
RefTableBean refTableBean = items.get(i);
String result = refTableBean.getShYes().isSelected() ? "是" : "否";
SqlUtil.write(new String[] { endCode, "2", refTableBean.getDepart(), String.valueOf(i - 6),
refTableBean.getMessage(), result, refTableBean.getUser().getText(),
refTableBean.getMessage(), result, refTableBean.getUserVal(),
refTableBean.getCompDate().getText(), refTableBean.getMark().getText() }, insertSql);
}
for (int i = 11; i < 15; i++) {
RefTableBean refTableBean = items.get(i);
String result = refTableBean.getShYes().isSelected() ? "是" : "否";
SqlUtil.write(new String[] { endCode, "3", refTableBean.getDepart(), String.valueOf(i - 10),
refTableBean.getMessage(), result, refTableBean.getUser().getText(),
refTableBean.getMessage(), result, refTableBean.getUserVal(),
refTableBean.getCompDate().getText(), refTableBean.getMark().getText() }, insertSql);
}
for (int i = 15; i < 19; i++) {
RefTableBean refTableBean = items.get(i);
String result = refTableBean.getShYes().isSelected() ? "是" : "否";
SqlUtil.write(new String[] { endCode, "4", refTableBean.getDepart(), String.valueOf(i - 14),
refTableBean.getMessage(), result, refTableBean.getUser().getText(),
refTableBean.getMessage(), result, refTableBean.getUserVal(),
refTableBean.getCompDate().getText(), refTableBean.getMark().getText() }, insertSql);
}
for (int i = 19; i < 24; i++) {
RefTableBean refTableBean = items.get(i);
String result = refTableBean.getShYes().isSelected() ? "是" : "否";
SqlUtil.write(new String[] { endCode, "5", refTableBean.getDepart(), String.valueOf(i - 18),
refTableBean.getMessage(), result, refTableBean.getUser().getText(),
refTableBean.getMessage(), result, refTableBean.getUserVal(),
refTableBean.getCompDate().getText(), refTableBean.getMark().getText() }, insertSql);
}
for (int i = 24; i < 27; i++) {
RefTableBean refTableBean = items.get(i);
String result = refTableBean.getShYes().isSelected() ? "是" : "否";
SqlUtil.write(new String[] { endCode, "6", refTableBean.getDepart(), String.valueOf(i - 23),
refTableBean.getMessage(), result, refTableBean.getUser().getText(),
refTableBean.getMessage(), result, refTableBean.getUserVal(),
refTableBean.getCompDate().getText(), refTableBean.getMark().getText() }, insertSql);
}
for (int i = 27; i < 28; i++) {
RefTableBean refTableBean = items.get(i);
String result = refTableBean.getShYes().isSelected() ? "是" : "否";
SqlUtil.write(new String[] { endCode, "7", refTableBean.getDepart(), String.valueOf(i - 26),
refTableBean.getMessage(), result, refTableBean.getUser().getText(),
refTableBean.getMessage(), result, refTableBean.getUserVal(),
refTableBean.getCompDate().getText(), refTableBean.getMark().getText() }, insertSql);
}
} catch (Exception e) {
@ -649,7 +662,7 @@ public class CreateEcnController extends KFXPanelController {
RefTableBean refTableBean = items.get(i);
refTableBean.setCompDate(read.getString("pctime"));
refTableBean.setMark(read.getString("remark"));
refTableBean.setUser(read.getString("principal"));
refTableBean.setUserPane(read.getString("principal"));
String result = read.getString("result");
System.out.println("refTableSql==>" + read.getString("principal"));
if (result.equals("否")) {
@ -811,18 +824,12 @@ public class CreateEcnController extends KFXPanelController {
private void createRefTable() {
// TODO Auto-generated method stub
// 影响分析表格
// protected SimpleStringProperty depart;//部门
// protected SimpleStringProperty message; //行动
// protected CheckBox shYes = new CheckBox();//是
// protected CheckBox shNo = new CheckBox();//否
// protected TextField user;//更改前版本
// protected TextField compDate;//更改后
// protected TextField mark;//更改后版本
TableColumn<RefTableBean, String> deapart = new TableColumn<RefTableBean, String>("部门");
TableColumn<RefTableBean, String> message = new TableColumn<RefTableBean, String>("行动(需要书面证据)");
TableColumn<RefTableBean, CheckBox> shYes = new TableColumn<RefTableBean, CheckBox>("是"); // 要求值(设计)
TableColumn<RefTableBean, CheckBox> shNo = new TableColumn<RefTableBean, CheckBox>("否");
TableColumn<RefTableBean, TextField> user = new TableColumn<RefTableBean, TextField>("责任人");
TableColumn<RefTableBean, Object> user = new TableColumn<RefTableBean, Object>("责任人");
TableColumn<RefTableBean, TextField> compDate = new TableColumn<RefTableBean, TextField>("完成时间"); //
TableColumn<RefTableBean, TextField> mark = new TableColumn<RefTableBean, TextField>("备注"); //
@ -830,7 +837,7 @@ public class CreateEcnController extends KFXPanelController {
message.setCellValueFactory(new PropertyValueFactory<RefTableBean, String>("message"));
shYes.setCellValueFactory(new PropertyValueFactory<RefTableBean, CheckBox>("shYes"));
shNo.setCellValueFactory(new PropertyValueFactory<RefTableBean, CheckBox>("shNo"));
user.setCellValueFactory(new PropertyValueFactory<RefTableBean, TextField>("user"));
user.setCellValueFactory(new PropertyValueFactory<RefTableBean, Object>("userPane"));
compDate.setCellValueFactory(new PropertyValueFactory<RefTableBean, TextField>("compDate"));
mark.setCellValueFactory(new PropertyValueFactory<RefTableBean, TextField>("mark"));
@ -844,53 +851,156 @@ public class CreateEcnController extends KFXPanelController {
refTable.getColumns().addAll(deapart, message, shYes, shNo, user, compDate, mark);
// //设置宽度
deapart.prefWidthProperty().bind(refTable.widthProperty().multiply(0.14));
message.prefWidthProperty().bind(refTable.widthProperty().multiply(0.36));
message.prefWidthProperty().bind(refTable.widthProperty().multiply(0.30));
shYes.prefWidthProperty().bind(refTable.widthProperty().multiply(0.05));
shNo.prefWidthProperty().bind(refTable.widthProperty().multiply(0.05));
user.prefWidthProperty().bind(refTable.widthProperty().multiply(0.13));
user.prefWidthProperty().bind(refTable.widthProperty().multiply(0.19));
compDate.prefWidthProperty().bind(refTable.widthProperty().multiply(0.13));
mark.prefWidthProperty().bind(refTable.widthProperty().multiply(0.14));
List<RefTableBean> refTableBeans = new ArrayList<RefTableBean>();
// 初始化数据 写死的
refTableBeans.add(new RefTableBean(new SimpleStringProperty("技术部"), new SimpleStringProperty("产品图样、目录、铭牌等")));
refTableBeans
.add(new RefTableBean(new SimpleStringProperty("技术部"), new SimpleStringProperty("产品图样、目录、铭牌等"), true));
// 第一个部门增加指派按钮
refTableBeans.add(new RefTableBean(new SimpleStringProperty("技术部"),
new SimpleStringProperty("技术方案、DFMEA、产品质量特性重要度分级表"), false));
refTableBeans
.add(new RefTableBean(new SimpleStringProperty("技术部"), new SimpleStringProperty("BOM物料更改"), false));
refTableBeans
.add(new RefTableBean(new SimpleStringProperty("技术部"), new SimpleStringProperty("包装图样/规范"), false));
refTableBeans.add(new RefTableBean(new SimpleStringProperty("技术部"), new SimpleStringProperty("发货标签更改"), false));
refTableBeans
.add(new RefTableBean(new SimpleStringProperty("技术部"), new SimpleStringProperty("客户承诺相关设计文件"), false));
refTableBeans.add(new RefTableBean(new SimpleStringProperty("技术部"), new SimpleStringProperty("环保要求更改"), false));
refTableBeans.add(
new RefTableBean(new SimpleStringProperty("技术部"), new SimpleStringProperty("技术方案、DFMEA、产品质量特性重要度分级表")));
refTableBeans.add(new RefTableBean(new SimpleStringProperty("技术部"), new SimpleStringProperty("BOM物料更改")));
refTableBeans.add(new RefTableBean(new SimpleStringProperty("技术部"), new SimpleStringProperty("包装图样/规范")));
refTableBeans.add(new RefTableBean(new SimpleStringProperty("技术部"), new SimpleStringProperty("发货标签更改")));
refTableBeans.add(new RefTableBean(new SimpleStringProperty("技术部"), new SimpleStringProperty("客户承诺相关设计文件")));
refTableBeans.add(new RefTableBean(new SimpleStringProperty("技术部"), new SimpleStringProperty("环保要求更改")));
new RefTableBean(new SimpleStringProperty("工艺部"), new SimpleStringProperty("工艺流程图、PFMEA、工艺守则"), true));
refTableBeans
.add(new RefTableBean(new SimpleStringProperty("工艺部"), new SimpleStringProperty("作业指导书、包装指导书"), false));
refTableBeans
.add(new RefTableBean(new SimpleStringProperty("工艺部"), new SimpleStringProperty("客户承诺相关工艺文件"), false));
refTableBeans
.add(new RefTableBean(new SimpleStringProperty("工艺部"), new SimpleStringProperty("模具、工装、设备更改"), false));
refTableBeans.add(new RefTableBean(new SimpleStringProperty("质量部"), new SimpleStringProperty("控制计划"), true));
refTableBeans.add(
new RefTableBean(new SimpleStringProperty("质量部"), new SimpleStringProperty("进货/过程/成品检验文件"), false));
refTableBeans
.add(new RefTableBean(new SimpleStringProperty("质量部"), new SimpleStringProperty("供应商产品质量检验报告"), false));
refTableBeans
.add(new RefTableBean(new SimpleStringProperty("工艺部"), new SimpleStringProperty("工艺流程图、PFMEA、工艺守则")));
refTableBeans.add(new RefTableBean(new SimpleStringProperty("工艺部"), new SimpleStringProperty("作业指导书、包装指导书")));
refTableBeans.add(new RefTableBean(new SimpleStringProperty("工艺部"), new SimpleStringProperty("客户承诺相关工艺文件")));
refTableBeans.add(new RefTableBean(new SimpleStringProperty("工艺部"), new SimpleStringProperty("模具、工装、设备更改")));
.add(new RefTableBean(new SimpleStringProperty("质量部"), new SimpleStringProperty("客户承诺相关质量文件"), false));
refTableBeans.add(new RefTableBean(new SimpleStringProperty("质量部"), new SimpleStringProperty("控制计划")));
refTableBeans.add(new RefTableBean(new SimpleStringProperty("质量部"), new SimpleStringProperty("进货/过程/成品检验文件")));
refTableBeans.add(new RefTableBean(new SimpleStringProperty("质量部"), new SimpleStringProperty("供应商产品质量检验报告")));
refTableBeans.add(new RefTableBean(new SimpleStringProperty("质量部"), new SimpleStringProperty("客户承诺相关质量文件")));
refTableBeans
.add(new RefTableBean(new SimpleStringProperty("生产部"), new SimpleStringProperty("断点标识(物料切换)"), true));
refTableBeans
.add(new RefTableBean(new SimpleStringProperty("生产部"), new SimpleStringProperty("在制品确认及处理"), false));
refTableBeans
.add(new RefTableBean(new SimpleStringProperty("生产部"), new SimpleStringProperty("成品确认及处理"), false));
refTableBeans
.add(new RefTableBean(new SimpleStringProperty("生产部"), new SimpleStringProperty("计划确认及调整"), false));
refTableBeans.add(new RefTableBean(new SimpleStringProperty("生产部"), new SimpleStringProperty("断点标识(物料切换)")));
refTableBeans.add(new RefTableBean(new SimpleStringProperty("生产部"), new SimpleStringProperty("在制品确认及处理")));
refTableBeans.add(new RefTableBean(new SimpleStringProperty("生产部"), new SimpleStringProperty("成品确认及处理")));
refTableBeans.add(new RefTableBean(new SimpleStringProperty("生产部"), new SimpleStringProperty("计划确认及调整")));
refTableBeans.add(new RefTableBean(new SimpleStringProperty("采购部"), new SimpleStringProperty("采购价格变化"), true));
refTableBeans.add(
new RefTableBean(new SimpleStringProperty("采购部"), new SimpleStringProperty("更改信息(资料、价格)传递"), false));
refTableBeans
.add(new RefTableBean(new SimpleStringProperty("采购部"), new SimpleStringProperty("合格供方评价(新增时)"), false));
refTableBeans
.add(new RefTableBean(new SimpleStringProperty("采购部"), new SimpleStringProperty("供应商合同修改"), false));
refTableBeans
.add(new RefTableBean(new SimpleStringProperty("采购部"), new SimpleStringProperty("供应商处产品确认"), false));
refTableBeans.add(new RefTableBean(new SimpleStringProperty("采购部"), new SimpleStringProperty("采购价格变化")));
refTableBeans.add(new RefTableBean(new SimpleStringProperty("采购部"), new SimpleStringProperty("更改信息(资料、价格)传递")));
refTableBeans.add(new RefTableBean(new SimpleStringProperty("采购部"), new SimpleStringProperty("合格供方评价(新增时)")));
refTableBeans.add(new RefTableBean(new SimpleStringProperty("采购部"), new SimpleStringProperty("供应商合同修改")));
refTableBeans.add(new RefTableBean(new SimpleStringProperty("采购部"), new SimpleStringProperty("供应商处产品确认")));
refTableBeans.add(new RefTableBean(new SimpleStringProperty("销售中心"), new SimpleStringProperty("通知客户"), true));
refTableBeans.add(new RefTableBean(new SimpleStringProperty("销售中心"), new SimpleStringProperty("客户批准"), false));
refTableBeans
.add(new RefTableBean(new SimpleStringProperty("销售中心"), new SimpleStringProperty("修改客户协议"), false));
refTableBeans.add(new RefTableBean(new SimpleStringProperty("销售中心"), new SimpleStringProperty("通知客户")));
refTableBeans.add(new RefTableBean(new SimpleStringProperty("销售中心"), new SimpleStringProperty("客户批准")));
refTableBeans.add(new RefTableBean(new SimpleStringProperty("销售中心"), new SimpleStringProperty("修改客户协议")));
refTableBeans.add(new RefTableBean(new SimpleStringProperty("财务部"), new SimpleStringProperty("销售价格变化"), true));
addAssignAction(refTableBeans);
refTable.getItems().addAll(refTableBeans);
refTableBeans.add(new RefTableBean(new SimpleStringProperty("财务部"), new SimpleStringProperty("销售价格变化")));
}
refTable.getItems().addAll(refTableBeans);
/**
* @param refTableBeans
* @function
*/
private void addAssignAction(List<RefTableBean> refTableBeans) {
// TODO Auto-generated method stub
Button userBtn = refTableBeans.get(0).getUserBtn();
String userVal = refTableBeans.get(0).getUserVal();
assignBtnAction(userBtn, 0, 7, userVal, refTableBeans);
assignBtnAction(refTableBeans.get(7).getUserBtn(), 7, 11, refTableBeans.get(7).getUserVal(), refTableBeans);
assignBtnAction(refTableBeans.get(11).getUserBtn(), 11, 15, refTableBeans.get(11).getUserVal(), refTableBeans);
assignBtnAction(refTableBeans.get(15).getUserBtn(), 15, 19, refTableBeans.get(15).getUserVal(), refTableBeans);
assignBtnAction(refTableBeans.get(19).getUserBtn(), 19, 24, refTableBeans.get(19).getUserVal(), refTableBeans);
assignBtnAction(refTableBeans.get(24).getUserBtn(), 24, 27, refTableBeans.get(24).getUserVal(), refTableBeans);
assignBtnAction(refTableBeans.get(27).getUserBtn(), 27, 28, refTableBeans.get(27).getUserVal(), refTableBeans);
}
/**
* @param userBtn
* @param start
* @param end
* @param userVal
* @param refTableBeans
* @function
*/
private void assignBtnAction(Button userBtn, int start, int end, String userVal, List<RefTableBean> refTableBeans) {
// TODO Auto-generated method stub
userBtn.setOnAction(e -> {
try {
Map<String, String> userItemMap = getUserItemOA(userVal);
for (int i = start; i < end; i++) {
refTableBeans.get(i).setUserPane(userItemMap.keySet().iterator().next());
}
} catch (Exception e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
});
}
/**
* @param name
* @return Emailidmap
* @throws Exception
* @function OA9ID
*/
Map<String, String> getUserItemOA(String name) throws Exception {
OkHttpClient client = new OkHttpClient();
Map<String, String> emailMap = new HashMap<>();
MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded");
RequestBody body = RequestBody.create(mediaType, "Name=" + name + "&Email=");
Request request = new Request.Builder()
.url("http://10.207.0.245:8012/Portal/Webservices/EH/EH_Q_BPM_Two_Service.asmx/GetUserItems")
.method("POST", body).addHeader("Content-Type", "application/x-www-form-urlencoded").build();
Response response = client.newCall(request).execute();
String string = response.body().string();
Document document = DocumentHelper.parseText(string);
Element rootElement = document.getRootElement();
String type = rootElement.elementText("TYPE");
String message = rootElement.elementText("MESSAGE");
if (type.equals("S")) {
List<Element> elements = rootElement.elements("items");
for (Element element : elements) {
Element userItemCs = element.element("EH_HR_UserItems_CS");
String email = userItemCs.elementText("Email");
String status = userItemCs.elementText("ObjectID");
emailMap.put(email, status);
}
if (emailMap.size() > 0) {
} else {
// String key = emailMap.keySet().iterator().next();
// return emailMap.get(key);
}
} else {
MessageBox.post("指派失败:" + message, "提示", 2);
}
// Element element = body.element("MT_MATERIAL_BOP_REQ");
// Element INTERGRATIONLIST = element.addElement("INTERGRATIONLIST");
return emailMap;
}
// 最大化

@ -3,19 +3,57 @@ package com.chint.plm.createEcn;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.value.ChangeListener;
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.ComboBox;
import javafx.scene.control.TextArea;
import javafx.scene.control.TextField;
import javafx.scene.layout.FlowPane;
public class RefTableBean {
protected SimpleStringProperty depart;//部门
protected SimpleStringProperty message; //行动
protected CheckBox shYes = new CheckBox();//是
protected CheckBox shNo = new CheckBox();//否
protected TextField user = new TextField();//更改前版本
protected TextField compDate = new TextField();//更改后
protected TextField mark = new TextField();//更改后版本
protected SimpleStringProperty depart;// 部门
protected SimpleStringProperty message; // 行动
protected CheckBox shYes = new CheckBox();// 是
protected CheckBox shNo = new CheckBox();// 否
// protected TextField user = new TextField();// 责任人
protected TextField compDate = new TextField();// 更改后
protected Object userPane;
private TextField userText;
private Button userBtn;
public Button getUserBtn() {
return userBtn;
}
public void setUserBtn(Button userBtn) {
this.userBtn = userBtn;
}
public Object getUserPane() {
if (userPane instanceof SimpleStringProperty) {
SimpleStringProperty userProp = (SimpleStringProperty) userPane;
return userProp.get();
}
return userPane;
}
public String getUserVal() {
if (userPane instanceof SimpleStringProperty) {
SimpleStringProperty userProp = (SimpleStringProperty) userPane;
return userProp.get();
}
return userText.getText();
}
public void setUserPane(String val) {
if (userPane instanceof SimpleStringProperty) {
SimpleStringProperty userProp = (SimpleStringProperty) userPane;
userProp.setValue(val);
} else if (userPane instanceof FlowPane && userText != null) {
userText.setText(val);
// flowPane.getc
}
}
protected TextField mark = new TextField();// 更改后版本
public String getDepart() {
return depart.get();
@ -49,14 +87,6 @@ public class RefTableBean {
this.shNo.setSelected(shNo);
}
public TextField getUser() {
return user;
}
public void setUser(String user) {
this.user.setText(user);
}
public TextField getCompDate() {
return compDate;
}
@ -74,15 +104,22 @@ public class RefTableBean {
}
// protected ComboBox<String> changeReason = new ComboBox<String>();//¸ü¸ÄÔ­Òò
public RefTableBean(SimpleStringProperty depart, SimpleStringProperty message) {
public RefTableBean(SimpleStringProperty depart, SimpleStringProperty message, Boolean flag) {
super();
this.depart = depart;
this.message = message;
// this.shYes = shYes;
// this.shNo = shNo;
// this.user = user;
// this.compDate = compDate;
// this.mark = mark;
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>() {
@ -91,7 +128,7 @@ public class RefTableBean {
public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) {
// TODO Auto-generated method stub
// System.out.println("oldValue"+oldValue);
if(newValue) {
if (newValue) {
shNo.setSelected(false);
}
}
@ -102,7 +139,7 @@ public class RefTableBean {
public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) {
// TODO Auto-generated method stub
// System.out.println("oldValue"+oldValue);
if(newValue) {
if (newValue) {
shYes.setSelected(false);
}
}

@ -10,40 +10,48 @@ import javafx.collections.ObservableList;
import javafx.scene.control.Button;
public class RelateEcnBean {
protected SimpleStringProperty num;//序号
protected SimpleStringProperty contConde;//合同代号
protected SimpleStringProperty contName; //合同名称
protected SimpleStringProperty requestNo;//申请单号
protected SimpleStringProperty prodModel; //产品型号
protected SimpleStringProperty applicant; //申请人
protected SimpleStringProperty status; //状态
protected SimpleStringProperty num;// 序号
protected SimpleStringProperty contConde;// 合同代号
protected SimpleStringProperty contName; // 合同名称
protected SimpleStringProperty requestNo;// 申请单号
protected SimpleStringProperty prodModel; // 产品型号
protected SimpleStringProperty applicant; // 申请人
protected SimpleStringProperty status; // 状态
protected Button linkBtn = new Button("²é¿´");
protected Button importBtn = new Button("µ¼Èë");
public String getStatus() {
return status.get();
}
public void setStatus(SimpleStringProperty status) {
this.status = status;
}
public Button getLinkBtn() {
return linkBtn;
}
public void setLinkBtn(Button linkBtn) {
this.linkBtn = linkBtn;
}
public Button getImportBtn() {
return importBtn;
}
public void setImportBtn(Button importBtn) {
this.importBtn = importBtn;
}
public String getNum() {
return num.get();
}
public RelateEcnBean(SimpleStringProperty num, SimpleStringProperty contConde, SimpleStringProperty contName,
SimpleStringProperty requestNo, SimpleStringProperty prodModel, SimpleStringProperty applicant,
SimpleStringProperty status, String link,CreateEcnController controller,ResultSet read) throws SQLException {
SimpleStringProperty status, String link, CreateEcnController controller, ResultSet read)
throws SQLException {
super();
this.num = num;
this.contConde = contConde;
@ -52,18 +60,18 @@ public class RelateEcnBean {
this.prodModel = prodModel;
this.applicant = applicant;
this.status = status;
//变更单号
// 变更单号
String applyNo = read.getString("APPLYNO");
//七种责任人
// 七种责任人
String designPal = read.getString("DESIGNPRINCIPAL");
String techPal = read.getString("TECHPRINCIPAL");
String quantityPal = read.getString("QUALITYPRINCIPAL");
String producePal = read.getString("PRODUCEPRINCIPAL");
String purchasePal = read.getString("PURCHASEYPRINCIPAL");
String customPal = read.getString("CUSTOMNOTICEPRINCIPAL");//FINAPRICEPRINCIPAL
String customPal = read.getString("CUSTOMNOTICEPRINCIPAL");// FINAPRICEPRINCIPAL
String finaPal = read.getString("FINAPRICEPRINCIPAL");
String docuName = read.getString("DOCUNAME"); //文件代号及名称
String designFile = read.getString("DESIGNFILE");//获取行动内容
String docuName = read.getString("DOCUNAME"); // 文件代号及名称
String designFile = read.getString("DESIGNFILE");// 获取行动内容
linkBtn.setOnAction(e -> {
try {
BomToSapUtil.browse2(link);
@ -75,26 +83,26 @@ public class RelateEcnBean {
importBtn.setOnAction(e -> {
try {
ObservableList<RefTableBean> items = controller.refTable.getItems();
for(int i=0;i<7;i++) {
items.get(i).setUser(designPal);
for (int i = 0; i < 7; i++) {
items.get(i).setUserPane(designPal);
}
for(int i=7;i<11;i++) {
items.get(i).setUser(techPal);
for (int i = 7; i < 11; i++) {
items.get(i).setUserPane(techPal);
}
for(int i=11;i<15;i++) {
items.get(i).setUser(quantityPal);
for (int i = 11; i < 15; i++) {
items.get(i).setUserPane(quantityPal);
}
for(int i=15;i<19;i++) {
items.get(i).setUser(producePal);
for (int i = 15; i < 19; i++) {
items.get(i).setUserPane(producePal);
}
for(int i=19;i<24;i++) {
items.get(i).setUser(purchasePal);
for (int i = 19; i < 24; i++) {
items.get(i).setUserPane(purchasePal);
}
for(int i=24;i<27;i++) {
items.get(i).setUser(customPal);
for (int i = 24; i < 27; i++) {
items.get(i).setUserPane(customPal);
}
for(int i=27;i<28;i++) {
items.get(i).setUser(finaPal);
for (int i = 27; i < 28; i++) {
items.get(i).setUserPane(finaPal);
}
controller.markText.setText(docuName);
controller.relateEcnText.setText(applyNo);
@ -105,40 +113,49 @@ public class RelateEcnBean {
}
});
}
public void setNum(SimpleStringProperty num) {
this.num = num;
}
public String getContConde() {
return contConde.get();
}
public void setContConde(SimpleStringProperty contConde) {
this.contConde = contConde;
}
public String getContName() {
return contName.get();
}
public void setContName(SimpleStringProperty contName) {
this.contName = contName;
}
public String getRequestNo() {
return requestNo.get();
}
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;
import java.sql.ResultSet;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
@ -30,6 +31,7 @@ import javafx.scene.control.cell.PropertyValueFactory;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;
public class RelateEcnController {
@FXML
@ -93,6 +95,7 @@ public class RelateEcnController {
private TextField prodNameText;
private CreateEcnController controller;
private TCSession session;
public void initData(TCSession session, CreateEcnController controller) {
// TODO Auto-generated method stub
this.controller = controller;
@ -106,18 +109,25 @@ public class RelateEcnController {
*/
private void initTable() {
// TODO Auto-generated method stub
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> requestNoCol = 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,Button> linkBtnCol = new TableColumn<RelateEcnBean,Button>("更改申请单链接");
TableColumn<RelateEcnBean,Button> importBtnCol = new TableColumn<RelateEcnBean,Button>("导入");
tableView.getColumns().addAll(numCol, contCondeCol, contNameCol,requestNoCol,prodModelCol, applicantCol, statusCol,
linkBtnCol,importBtnCol);
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> requestNoCol = 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, Button> linkBtnCol = new TableColumn<RelateEcnBean, Button>("更改申请单链接");
TableColumn<RelateEcnBean, Button> importBtnCol = new TableColumn<RelateEcnBean, Button>("导入");
tableView.getColumns().addAll(numCol, contCondeCol, contNameCol, requestNoCol, prodModelCol, applicantCol,
statusCol, linkBtnCol, importBtnCol);
numCol.setSortable(false);
contCondeCol.setSortable(false);
@ -128,16 +138,16 @@ public class RelateEcnController {
statusCol.setSortable(false);
linkBtnCol.setSortable(false);
importBtnCol.setSortable(false);
//列绑定bean对象
numCol.setCellValueFactory(new PropertyValueFactory<RelateEcnBean,SimpleStringProperty>("num"));
contCondeCol.setCellValueFactory(new PropertyValueFactory<RelateEcnBean,SimpleStringProperty>("contConde"));
contNameCol.setCellValueFactory(new PropertyValueFactory<RelateEcnBean,SimpleStringProperty>("contName"));
requestNoCol.setCellValueFactory(new PropertyValueFactory<RelateEcnBean,SimpleStringProperty>("requestNo"));
prodModelCol.setCellValueFactory(new PropertyValueFactory<RelateEcnBean,SimpleStringProperty>("prodModel"));
applicantCol.setCellValueFactory(new PropertyValueFactory<RelateEcnBean,SimpleStringProperty>("applicant"));
statusCol.setCellValueFactory(new PropertyValueFactory<RelateEcnBean,SimpleStringProperty>("status"));
linkBtnCol.setCellValueFactory(new PropertyValueFactory<RelateEcnBean,Button>("linkBtn"));
importBtnCol.setCellValueFactory(new PropertyValueFactory<RelateEcnBean,Button>("importBtn"));
// 列绑定bean对象
numCol.setCellValueFactory(new PropertyValueFactory<RelateEcnBean, SimpleStringProperty>("num"));
contCondeCol.setCellValueFactory(new PropertyValueFactory<RelateEcnBean, SimpleStringProperty>("contConde"));
contNameCol.setCellValueFactory(new PropertyValueFactory<RelateEcnBean, SimpleStringProperty>("contName"));
requestNoCol.setCellValueFactory(new PropertyValueFactory<RelateEcnBean, SimpleStringProperty>("requestNo"));
prodModelCol.setCellValueFactory(new PropertyValueFactory<RelateEcnBean, SimpleStringProperty>("prodModel"));
applicantCol.setCellValueFactory(new PropertyValueFactory<RelateEcnBean, SimpleStringProperty>("applicant"));
statusCol.setCellValueFactory(new PropertyValueFactory<RelateEcnBean, SimpleStringProperty>("status"));
linkBtnCol.setCellValueFactory(new PropertyValueFactory<RelateEcnBean, Button>("linkBtn"));
importBtnCol.setCellValueFactory(new PropertyValueFactory<RelateEcnBean, Button>("importBtn"));
numCol.prefWidthProperty().bind(tableView.widthProperty().multiply(0.06));
contCondeCol.prefWidthProperty().bind(tableView.widthProperty().multiply(0.12));
@ -160,68 +170,72 @@ public class RelateEcnController {
SqlUtil.getTCDataConnection(prefs);
try {
StringBuilder searchSqlBuff = new StringBuilder( "select * from CHINT_ECR_FROM_OA where 1=1 ");
appendSqlBuild(searchSqlBuff,prodModelText,"PRODUCTMODEL");
appendSqlBuild(searchSqlBuff,prodNameText,"PRODUCTNAME");
appendSqlBuild(searchSqlBuff,contCondeText,"CONTRACTNO");
appendSqlBuild(searchSqlBuff,contNameText,"CONTRACTNAME");
appendSqlBuild(searchSqlBuff,pattCodeText,"DESIGNNAME");
appendSqlBuild(searchSqlBuff,docCodeText,"DOCUNAME");
appendSqlBuild(searchSqlBuff,applicantText,"APPLYUSER");
appendSqlBuild(searchSqlBuff,requestNoText,"APPLYNO");
StringBuilder searchSqlBuff = new StringBuilder("select * from CHINT_ECR_FROM_OA where 1=1 ");
appendSqlBuild(searchSqlBuff, prodModelText, "PRODUCTMODEL");
appendSqlBuild(searchSqlBuff, prodNameText, "PRODUCTNAME");
appendSqlBuild(searchSqlBuff, contCondeText, "CONTRACTNO");
appendSqlBuild(searchSqlBuff, contNameText, "CONTRACTNAME");
appendSqlBuild(searchSqlBuff, pattCodeText, "DESIGNNAME");
appendSqlBuild(searchSqlBuff, docCodeText, "DOCUNAME");
appendSqlBuild(searchSqlBuff, applicantText, "APPLYUSER");
appendSqlBuild(searchSqlBuff, requestNoText, "APPLYNO");
String startText = startTime.getEditor().getText();
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')
System.out.println("startText==>"+startText);
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')
System.out.println("startText==>" + startText);
}
String endText = endTime.getEditor().getText();
if(!endText.isEmpty()) {
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')
System.out.println("endText==>"+endText);
if (!endText.isEmpty()) {
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')
System.out.println("endText==>" + endText);
}
int num = 1;
ResultSet read = SqlUtil.read(searchSqlBuff.toString());
List<RelateEcnBean> ecnBeans = new ArrayList<>();
while(read.next()) {
while (read.next()) {
String contConde = read.getString("CONTRACTNO");
String contName = read.getString("CONTRACTNAME");
String requestNo = read.getString("APPLYNO");
String prodModel = read.getString("PRODUCTMODEL");
String applicant = read.getString("APPLYUSER");//STATUS
String applicant = read.getString("APPLYUSER");// STATUS
String status = read.getString("STATUS");
String link = read.getString("APPLYLINK");
ecnBeans.add(
new RelateEcnBean(new SimpleStringProperty(num+""),new SimpleStringProperty(contConde),
new SimpleStringProperty(contName),new SimpleStringProperty(requestNo),new SimpleStringProperty(prodModel),
new SimpleStringProperty(applicant),new SimpleStringProperty(status),link,controller,read));
ecnBeans.add(new RelateEcnBean(new SimpleStringProperty(num + ""), new SimpleStringProperty(contConde),
new SimpleStringProperty(contName), new SimpleStringProperty(requestNo),
new SimpleStringProperty(prodModel), new SimpleStringProperty(applicant),
new SimpleStringProperty(status), link, controller, read));
num++;
}
tableView.getItems().clear();
tableView.getItems().addAll(ecnBeans);
}catch(Exception e) {
} catch (Exception e) {
e.printStackTrace();
}finally {
} finally {
SqlUtil.freeAll();
}
}
/**
* @param event
* @function
*/
@FXML
void closeClick(ActionEvent event) {
Stage stage = (Stage)prodModelText.getScene().getWindow();
Stage stage = (Stage) prodModelText.getScene().getWindow();
stage.close();
}
/**
* @param searchSqlBuff sql
* @param textField
* @param baseName
* @function SQL
*/
void appendSqlBuild(StringBuilder searchSqlBuff,TextField textField,String baseName) {
void appendSqlBuild(StringBuilder searchSqlBuff, TextField textField, String baseName) {
String text = textField.getText();
if (text!=null && !text.isEmpty() ) {
if (text != null && !text.isEmpty()) {
searchSqlBuff.append(" and ").append(baseName).append(" like '%").append(text).append("%' ");
}
}

@ -17,11 +17,13 @@ public class RelateEcnDialog extends Application {
private String groupID;
private TCSession session;
private CreateEcnController controller;
public RelateEcnDialog(TCSession session, CreateEcnController controller) {
super();
this.controller = controller;
this.session = session;
}
@Override
public void start(Stage primaryStage) throws IOException {
// StackPane root = new StackPane();
@ -31,7 +33,7 @@ public class RelateEcnDialog extends Application {
Scene scene = new Scene(root, 1200.0, 800.0);
RelateEcnController controller = (RelateEcnController) fxmlLoader.getController();
primaryStage.setTitle("֪ͨµ¥±àºÅ");
controller.initData(session,this.controller);
controller.initData(session, this.controller);
primaryStage.setScene(scene);
primaryStage.show();
}

@ -56,6 +56,7 @@ public class Util {
return conn;
}
/**
*
* @param session
@ -63,26 +64,21 @@ public class Util {
* @param Filetype:excelMSExcelX
* @return
*/
public static File getFile(TCSession session,String PreServiceName,String Filetype) {
public static File getFile(TCSession session, String PreServiceName, String Filetype) {
TCPreferenceService service = session.getPreferenceService();
String puid = service.getStringValue(PreServiceName);
if (puid == null)
{
if (puid == null) {
System.out.println("未找到首选项");
return null;
}
TCComponentDataset dat;
try {
dat = (TCComponentDataset)session
.stringToComponent(puid);
dat = (TCComponentDataset) session.stringToComponent(puid);
TCComponentTcFile[] tcFile = dat.getTcFiles();
if(tcFile != null && tcFile.length == 0)
{
if (tcFile != null && tcFile.length == 0) {
System.out.println("未找到配置文件");
}
else
{
} else {
return tcFile[0].getFmsFile();
}
} catch (TCException e) {
@ -91,25 +87,41 @@ public class Util {
}
return null;
}
private static void setCellValue(XSSFCell cell2,int index,XSSFRow row0,String cellValue) {
/**
* @param cell2
* @param index
* @param row0
* @param cellValue
* @function
*/
public static void setCellValue(XSSFCell cell2, int index, XSSFRow row0, String cellValue) {
// TODO Auto-generated method stub
if(cell2 == null) {
if (cell2 == null) {
cell2 = row0.createCell(index);
}
cell2.setCellValue(cellValue);
}
private static XSSFRow getRow(XSSFSheet sheetAt,int rowNum) {
/**
* @param sheetAt
* @param rowNum
* @return excel
* @function
*/
public static XSSFRow getRow(XSSFSheet sheetAt, int rowNum) {
// TODO Auto-generated method stub
XSSFRow row = sheetAt.getRow(rowNum);
if(row ==null) {
if (row == null) {
row = sheetAt.createRow(rowNum);
}
return row;
}
/**
* @param dateset
* @return
@ -130,6 +142,7 @@ public class Util {
}
return fmsFile;
}
/**
* @param target
* @return
@ -148,6 +161,7 @@ public class Util {
}
return name;
}
/**
* @param target
* @return
@ -174,6 +188,7 @@ public class Util {
}
return no;
}
/**
* @param target
* @param productModelList
@ -194,7 +209,7 @@ public class Util {
AIFComponentContext[] a2 = ((TCComponent) a1[0].getComponent()).whereReferenced();// 项目监控文件夹
try {
if (a2.length < 1 || !a2[0].getComponent().getProperty("object_name").contains("项目监控")) {
String zt2_ProductModel = target.getProperty("zt2_ProductModel");//zt2_ProductName еÄÊôÐÔ
String zt2_ProductModel = target.getProperty("zt2_ProductModel");// zt2_ProductName 新的属性
productModelList.add(zt2_ProductModel);
return productModelList;
}
@ -232,6 +247,7 @@ public class Util {
return productModelList;
}
/**
* @param target
* @param productModelList
@ -290,6 +306,7 @@ public class Util {
return productModelList;
}
public void disconnect(Connection conn, Statement stmt, ResultSet rs_get) {
try {
if (rs_get != null) {
@ -306,6 +323,7 @@ public class Util {
e.printStackTrace();
}
}
/**
* @param sourthPath
* @param filePath
@ -352,6 +370,7 @@ public class Util {
e.printStackTrace();
}
}
/**
* @param sourcePath
* @param filePath
@ -376,6 +395,7 @@ public class Util {
e.printStackTrace();
}
}
/**
* @return yyyy-MM-dd-HH-mm
* @function
@ -387,6 +407,7 @@ public class Util {
temp_str = sdf.format(dt);
return temp_str;
}
/**
* @param sheet
* @param startRow
@ -404,6 +425,7 @@ public class Util {
}
return list;
}
/**
* @param page
* @param lists

@ -28,7 +28,7 @@ public abstract class KFXPanel extends Application {
// Logging.getCSSLogger().setLevel(Platform.class...STYLESHEET_CASPIAN....Level.OFF);
}
public KFXPanel(Window dialog,String fxmlName) {
public KFXPanel(Window dialog, String fxmlName) {
setParentDialog(dialog);
initUI(fxmlName);
initData();
@ -73,13 +73,14 @@ public abstract class KFXPanel extends Application {
post(this.parentDialog, e.getMessage(), "", 1);
}
}
protected void initUI(String fxmlName) {
try {
FXMLLoader fxmlLoader = new FXMLLoader();
String resource = fxmlName;//"SearchSapResultPanel.fxml";
String resource = fxmlName;// "SearchSapResultPanel.fxml";
fxmlLoader.setLocation(getClass().getResource(resource));
this.root = (Parent)fxmlLoader.load();
this.aifController = (KFXPanelController)fxmlLoader.getController();
this.root = (Parent) fxmlLoader.load();
this.aifController = (KFXPanelController) fxmlLoader.getController();
if (this.cssForm != null)
this.root.getStylesheets().add(this.cssForm);
} catch (Exception e) {
@ -87,13 +88,14 @@ public abstract class KFXPanel extends Application {
post(this.parentDialog, e.getMessage(), "", 1);
}
}
protected void initUI() {
try {
FXMLLoader fxmlLoader = new FXMLLoader();
String resource = "SearchSapResultPanel.fxml";
fxmlLoader.setLocation(getClass().getResource(resource));
this.root = (Parent)fxmlLoader.load();
this.aifController = (KFXPanelController)fxmlLoader.getController();
this.root = (Parent) fxmlLoader.load();
this.aifController = (KFXPanelController) fxmlLoader.getController();
if (this.cssForm != null)
this.root.getStylesheets().add(this.cssForm);
} catch (Exception e) {
@ -117,6 +119,7 @@ public abstract class KFXPanel extends Application {
MessageBox.post(dialog, msg, title, msgType);
}
}
// protected Stage primaryStage;
public void start(Stage primaryStage) throws Exception {
initUI();

@ -1,6 +1,5 @@
package com.chint.plm.fxUtil;
import javafx.application.Platform;
import javafx.fxml.FXML;
import javafx.scene.layout.AnchorPane;

@ -1,4 +1,5 @@
package com.chint.plm.fxUtil;
import com.teamcenter.rac.util.MessageBox;
import com.teamcenter.rac.util.UIUtilities;
import javax.swing.JFrame;

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

Loading…
Cancel
Save