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;
@ -13,12 +14,14 @@ 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) {
public ChildMessage(boolean onlyError, StringBuilder sqlTotal) {
super(); 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();
@ -28,7 +31,7 @@ public class ChildMessage extends Application {
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,84 +7,107 @@ 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() { 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 String getBatchNum() { public String getBatchNum() {
return batchNum.get(); return batchNum.get();
} }
public void setBatchNum(SimpleStringProperty batchNum) { public void setBatchNum(SimpleStringProperty batchNum) {
this.batchNum = batchNum; this.batchNum = batchNum;
} }
public String getProductMaterialNo() { public String getProductMaterialNo() {
return productMaterialNo.get(); return productMaterialNo.get();
} }
public void setProductMaterialNo(SimpleStringProperty productMaterialNo) { public void setProductMaterialNo(SimpleStringProperty productMaterialNo) {
this.productMaterialNo = productMaterialNo; this.productMaterialNo = productMaterialNo;
} }
public String getStatus() { public String getStatus() {
return status.get(); return status.get();
} }
public void setStatus(SimpleStringProperty status) { public void setStatus(SimpleStringProperty status) {
this.status = status; this.status = status;
} }
public String getCreateDate() { public String getCreateDate() {
return createDate.get(); return createDate.get();
} }
public void setCreateDate(SimpleStringProperty createDate) { public void setCreateDate(SimpleStringProperty createDate) {
this.createDate = createDate; this.createDate = createDate;
} }
public String getCreateTime() { public String getCreateTime() {
return createTime.get(); return createTime.get();
} }
public void setCreateTime(SimpleStringProperty createTime) { public void setCreateTime(SimpleStringProperty createTime) {
this.createTime = createTime; this.createTime = createTime;
} }
public String getReturnDate() { public String getReturnDate() {
return returnDate.get(); return returnDate.get();
} }
public void setReturnDate(SimpleStringProperty returnDate) { public void setReturnDate(SimpleStringProperty returnDate) {
this.returnDate = returnDate; this.returnDate = returnDate;
} }
public String getReturnTime() { public String getReturnTime() {
return returnTime.get(); return returnTime.get();
} }
public void setReturnTime(SimpleStringProperty returnTime) { public void setReturnTime(SimpleStringProperty returnTime) {
this.returnTime = returnTime; this.returnTime = returnTime;
} }
public String getWbsNo() { public String getWbsNo() {
return wbsNo.get(); return wbsNo.get();
} }
public void setWbsNo(SimpleStringProperty wbsNo) { public void setWbsNo(SimpleStringProperty wbsNo) {
this.wbsNo = wbsNo; this.wbsNo = wbsNo;
} }
public String getMessage() { public String getMessage() {
return message.get(); return message.get();
} }
public void setMessage(SimpleStringProperty message) { public void setMessage(SimpleStringProperty message) {
this.message = message; this.message = message;
} }
public String getPlmStatus() { public String getPlmStatus() {
return plmStatus.get(); return plmStatus.get();
} }
public void setPlmStatus(SimpleStringProperty plmStatus) { public void setPlmStatus(SimpleStringProperty plmStatus) {
this.plmStatus = plmStatus; this.plmStatus = plmStatus;
} }
public DetailsBean(SimpleIntegerProperty num, SimpleStringProperty batchNum, SimpleStringProperty productMaterialNo, public DetailsBean(SimpleIntegerProperty num, SimpleStringProperty batchNum, SimpleStringProperty productMaterialNo,
SimpleStringProperty wbsNo, SimpleStringProperty status, SimpleStringProperty message, SimpleStringProperty wbsNo, SimpleStringProperty status, SimpleStringProperty message,
SimpleStringProperty createDate, SimpleStringProperty createTime, SimpleStringProperty returnDate, SimpleStringProperty createDate, SimpleStringProperty createTime, SimpleStringProperty returnDate,
@ -103,7 +126,4 @@ public class DetailsBean {
this.plmStatus = plmStatus; 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,10 +50,6 @@ 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
* *
@ -106,9 +108,13 @@ public class DetailsController {
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<>(); // 记录全部数据
/**
* @param event
* @function
*/
@FXML @FXML
void firstAction(ActionEvent event) { void firstAction(ActionEvent event) {
pageNum = 0; pageNum = 0;
@ -117,6 +123,10 @@ public class DetailsController {
tableView.setItems(data); tableView.setItems(data);
} }
/**
* @param event
* @function
*/
@FXML @FXML
void lastAction(ActionEvent event) { void lastAction(ActionEvent event) {
if (pageNum > 0) { if (pageNum > 0) {
@ -127,6 +137,10 @@ public class DetailsController {
tableView.setItems(data); tableView.setItems(data);
} }
/**
* @param event
* @function
*/
@FXML @FXML
void nextAction(ActionEvent event) { void nextAction(ActionEvent event) {
if (pageNum < tableBeans.size() - 1) { if (pageNum < tableBeans.size() - 1) {
@ -137,6 +151,10 @@ public class DetailsController {
tableView.setItems(data); tableView.setItems(data);
} }
/**
* @param event
* @function
*/
@FXML @FXML
void tailAction(ActionEvent event) { void tailAction(ActionEvent event) {
pageNum = tableBeans.size() - 1; pageNum = tableBeans.size() - 1;
@ -190,9 +208,35 @@ public class DetailsController {
XSSFSheet sheetAt = wb.getSheet("SAP传递结果导出"); XSSFSheet sheetAt = wb.getSheet("SAP传递结果导出");
for (List<DetailsBean> detailList : tableBeans) { 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) { } catch (Exception e) {
// TODO Auto-generated catch block // TODO Auto-generated catch block
e.printStackTrace(); e.printStackTrace();
@ -200,14 +244,22 @@ public class DetailsController {
} }
private Stage primaryStage;
private StringBuilder sqlTotal; private StringBuilder sqlTotal;
/**
* @param primaryStage
* @param onlyError
* @param sqlTotal
* @function
*/
public void initData(Stage primaryStage, boolean onlyError, StringBuilder sqlTotal) { public void initData(Stage primaryStage, boolean onlyError, StringBuilder sqlTotal) {
// TODO Auto-generated method stub // TODO Auto-generated method stub
this.sqlTotal = sqlTotal; this.sqlTotal = sqlTotal;
this.app = AIFUtility.getCurrentApplication(); this.app = AIFUtility.getCurrentApplication();
this.session = (TCSession) app.getSession(); this.session = (TCSession) app.getSession();
// 表格列绑定bean对象 // 表格列绑定bean对象
this.primaryStage = primaryStage;
tc_xh.setSortable(false); tc_xh.setSortable(false);
tc_cDate.setSortable(false); tc_cDate.setSortable(false);
tc_msg.setSortable(false); tc_msg.setSortable(false);
@ -267,11 +319,14 @@ public class DetailsController {
// 更新GUI组件 // 更新GUI组件
// Platform.runLater(new Runnable() { // Platform.runLater(new Runnable() {
double width = primaryStage.getWidth(); double width = primaryStage.getWidth();
double height = primaryStage.getHeight();
System.out.println("width==>" + width); System.out.println("width==>" + width);
girdPane.setPrefWidth(width * 0.98); girdPane.setPrefWidth(width * 0.98);
flowPane.setPrefWidth(width * 0.98); flowPane.setPrefWidth(width * 0.98);
scrollPane.setPrefWidth(width * 0.98); scrollPane.setPrefWidth(width * 0.98);
tableView.setPrefWidth(width * 0.98); tableView.setPrefWidth(width * 0.98);
scrollPane.setPrefHeight(height*0.8);
tableView.setPrefHeight(height*0.8);
} }
}); });
primaryStage.setMaximized(true); primaryStage.setMaximized(true);
@ -295,16 +350,27 @@ public class DetailsController {
} }
} }
}); });
// 添加监听跳转页面
pageNumTxt.setOnKeyPressed(new EventHandler<KeyEvent>() { pageNumTxt.setOnKeyPressed(new EventHandler<KeyEvent>() {
@Override @Override
public void handle(KeyEvent event) { public void handle(KeyEvent event) {
if (event.getCode() == KeyCode.ENTER) { 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; private boolean flagEdit = true;

@ -7,7 +7,7 @@ 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();

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

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

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

@ -14,94 +14,116 @@ 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() { public Button getDetails() {
return details; return details;
} }
public Button getLogDownload() { public Button getLogDownload() {
return logDownload; return logDownload;
} }
public void setLogDownload(Button logDownload) { public void setLogDownload(Button logDownload) {
this.logDownload = logDownload; this.logDownload = logDownload;
} }
public void setDetails(Button details) { public void setDetails(Button details) {
this.details = details; this.details = details;
} }
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 String getTaskNo() { public String getTaskNo() {
return taskNo.get(); return taskNo.get();
} }
public void setTaskNo(SimpleStringProperty taskNo) { public void setTaskNo(SimpleStringProperty taskNo) {
this.taskNo = taskNo; this.taskNo = taskNo;
} }
public String getUser() { public String getUser() {
return user.get(); return user.get();
} }
public void setUser(SimpleStringProperty user) { public void setUser(SimpleStringProperty user) {
this.user = user; this.user = user;
} }
public String getStartTime() { public String getStartTime() {
return startTime.get(); return startTime.get();
} }
public void setStartTime(SimpleStringProperty startTime) { public void setStartTime(SimpleStringProperty startTime) {
this.startTime = startTime; this.startTime = startTime;
} }
public String getcTaskNum() { public String getcTaskNum() {
return cTaskNum.get(); return cTaskNum.get();
} }
public void setcTaskNum(SimpleStringProperty cTaskNum) { public void setcTaskNum(SimpleStringProperty cTaskNum) {
this.cTaskNum = cTaskNum; this.cTaskNum = cTaskNum;
} }
public String getSapResult() { public String getSapResult() {
return sapResult.get(); return sapResult.get();
} }
public void setSapResult(SimpleStringProperty sapResult) { public void setSapResult(SimpleStringProperty sapResult) {
this.sapResult = sapResult; this.sapResult = sapResult;
} }
public String getDataStatus() { public String getDataStatus() {
return dataStatus.get(); return dataStatus.get();
} }
public void setDataStatus(SimpleStringProperty dataStatus) { public void setDataStatus(SimpleStringProperty dataStatus) {
this.dataStatus = dataStatus; this.dataStatus = dataStatus;
} }
public String getPlmResult() { public String getPlmResult() {
return plmResult.get(); return plmResult.get();
} }
public void setPlmResult(SimpleStringProperty plmResult) { public void setPlmResult(SimpleStringProperty plmResult) {
this.plmResult = plmResult; this.plmResult = plmResult;
} }
private String url; private String url;
private String code; private String code;
private String[] prefs; private String[] prefs;
public SumTableBean(SimpleIntegerProperty num, SimpleStringProperty taskNo, SimpleStringProperty user, public SumTableBean(SimpleIntegerProperty num, SimpleStringProperty taskNo, SimpleStringProperty user,
SimpleStringProperty startTime, SimpleStringProperty cTaskNum, SimpleStringProperty sapResult, SimpleStringProperty startTime, SimpleStringProperty cTaskNum, SimpleStringProperty sapResult,
SimpleStringProperty dataStatus, SimpleStringProperty plmResult,boolean onlyError,StringBuilder detailSql, SimpleStringProperty dataStatus, SimpleStringProperty plmResult, boolean onlyError, StringBuilder detailSql,
String[] prefs,String code,String url) { String[] prefs, String code, String url) {
super(); super();
this.num = num; this.num = num;
this.taskNo = taskNo; this.taskNo = taskNo;
@ -120,8 +142,8 @@ public class SumTableBean {
logDownload.setText("日志下载"); logDownload.setText("日志下载");
logDownload.setOnAction(e -> { logDownload.setOnAction(e -> {
try { try {
if(!url.isEmpty()) { if (!url.isEmpty()) {
String replaceAll = url.replaceAll("\n","").replaceAll("\r", ""); String replaceAll = url.replaceAll("\n", "").replaceAll("\r", "");
System.out.println(replaceAll); System.out.println(replaceAll);
BomToSapUtil.browse2(replaceAll); BomToSapUtil.browse2(replaceAll);
} }
@ -131,13 +153,14 @@ public class SumTableBean {
} }
}); // 此按钮没有加入到图形中 }); // 此按钮没有加入到图形中
details.setOnAction(e -> { details.setOnAction(e -> {
System.out.println("Process print = "+this.taskNo+" onlyError = "+this.onlyError); System.out.println("Process print = " + this.taskNo + " onlyError = " + this.onlyError);
StringBuilder sqlTotal = new StringBuilder("select batchnumber,productmaterialno,WBSNO,status,message,createdate,createtime,returndate,returntime," StringBuilder sqlTotal = new StringBuilder(
"select batchnumber,productmaterialno,WBSNO,status,message,createdate,createtime,returndate,returntime,"
+ "PLMSTATUS from CHINT_BOM_TO_SAP_DETIALS where \"CODE\" = '"); + "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,12 +189,12 @@ 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();
} }

@ -13,7 +13,10 @@ import java.sql.Statement;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.HashMap;
import java.util.List; 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.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFRow; 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.usermodel.Sheet;
import org.apache.poi.ss.util.CellRangeAddress; import org.apache.poi.ss.util.CellRangeAddress;
import org.casic.javafx.control.DateTimePicker; 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.SearchSapResult.SumTableBean;
import com.chint.plm.fxUtil.KFXPanel; import com.chint.plm.fxUtil.KFXPanel;
import com.chint.plm.fxUtil.KFXPanelController; import com.chint.plm.fxUtil.KFXPanelController;
import com.connor.chint.JDBPackage.JDBFrame; 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.KUtil;
import com.connor.chint.sap2.util.POIUtil; import com.connor.chint.sap2.util.POIUtil;
import com.connor.chint.sap2.util.SAPUtil; import com.connor.chint.sap2.util.SAPUtil;
import com.connor.chint.sap2.util.SqlUtil; 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.AbstractAIFApplication;
import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent; import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent;
import com.teamcenter.rac.aifrcp.AIFUtility; import com.teamcenter.rac.aifrcp.AIFUtility;
@ -265,53 +277,54 @@ public class CreateEcnController extends KFXPanelController {
+ "\"actionstatement\",\"result\",\"principal\",\"pctime\",\"remark\") values (?,?,?,?,?,?,?,?,?)"; + "\"actionstatement\",\"result\",\"principal\",\"pctime\",\"remark\") values (?,?,?,?,?,?,?,?,?)";
ObservableList<RefTableBean> items = refTable.getItems(); ObservableList<RefTableBean> items = refTable.getItems();
// 1222 新增逻辑,责任人指派
for (int i = 0; i < 7; i++) { for (int i = 0; i < 7; i++) {
RefTableBean refTableBean = items.get(i); RefTableBean refTableBean = items.get(i);
String result = refTableBean.getShYes().isSelected() ? "是" : "否"; String result = refTableBean.getShYes().isSelected() ? "是" : "否";
SqlUtil.write(new String[] { endCode, "1", refTableBean.getDepart(), String.valueOf(i + 1), 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); refTableBean.getCompDate().getText(), refTableBean.getMark().getText() }, insertSql);
} }
for (int i = 7; i < 11; i++) { for (int i = 7; i < 11; i++) {
RefTableBean refTableBean = items.get(i); RefTableBean refTableBean = items.get(i);
String result = refTableBean.getShYes().isSelected() ? "是" : "否"; String result = refTableBean.getShYes().isSelected() ? "是" : "否";
SqlUtil.write(new String[] { endCode, "2", refTableBean.getDepart(), String.valueOf(i - 6), 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); refTableBean.getCompDate().getText(), refTableBean.getMark().getText() }, insertSql);
} }
for (int i = 11; i < 15; i++) { for (int i = 11; i < 15; i++) {
RefTableBean refTableBean = items.get(i); RefTableBean refTableBean = items.get(i);
String result = refTableBean.getShYes().isSelected() ? "是" : "否"; String result = refTableBean.getShYes().isSelected() ? "是" : "否";
SqlUtil.write(new String[] { endCode, "3", refTableBean.getDepart(), String.valueOf(i - 10), 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); refTableBean.getCompDate().getText(), refTableBean.getMark().getText() }, insertSql);
} }
for (int i = 15; i < 19; i++) { for (int i = 15; i < 19; i++) {
RefTableBean refTableBean = items.get(i); RefTableBean refTableBean = items.get(i);
String result = refTableBean.getShYes().isSelected() ? "是" : "否"; String result = refTableBean.getShYes().isSelected() ? "是" : "否";
SqlUtil.write(new String[] { endCode, "4", refTableBean.getDepart(), String.valueOf(i - 14), 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); refTableBean.getCompDate().getText(), refTableBean.getMark().getText() }, insertSql);
} }
for (int i = 19; i < 24; i++) { for (int i = 19; i < 24; i++) {
RefTableBean refTableBean = items.get(i); RefTableBean refTableBean = items.get(i);
String result = refTableBean.getShYes().isSelected() ? "是" : "否"; String result = refTableBean.getShYes().isSelected() ? "是" : "否";
SqlUtil.write(new String[] { endCode, "5", refTableBean.getDepart(), String.valueOf(i - 18), 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); refTableBean.getCompDate().getText(), refTableBean.getMark().getText() }, insertSql);
} }
for (int i = 24; i < 27; i++) { for (int i = 24; i < 27; i++) {
RefTableBean refTableBean = items.get(i); RefTableBean refTableBean = items.get(i);
String result = refTableBean.getShYes().isSelected() ? "是" : "否"; String result = refTableBean.getShYes().isSelected() ? "是" : "否";
SqlUtil.write(new String[] { endCode, "6", refTableBean.getDepart(), String.valueOf(i - 23), 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); refTableBean.getCompDate().getText(), refTableBean.getMark().getText() }, insertSql);
} }
for (int i = 27; i < 28; i++) { for (int i = 27; i < 28; i++) {
RefTableBean refTableBean = items.get(i); RefTableBean refTableBean = items.get(i);
String result = refTableBean.getShYes().isSelected() ? "是" : "否"; String result = refTableBean.getShYes().isSelected() ? "是" : "否";
SqlUtil.write(new String[] { endCode, "7", refTableBean.getDepart(), String.valueOf(i - 26), 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); refTableBean.getCompDate().getText(), refTableBean.getMark().getText() }, insertSql);
} }
} catch (Exception e) { } catch (Exception e) {
@ -649,7 +662,7 @@ public class CreateEcnController extends KFXPanelController {
RefTableBean refTableBean = items.get(i); RefTableBean refTableBean = items.get(i);
refTableBean.setCompDate(read.getString("pctime")); refTableBean.setCompDate(read.getString("pctime"));
refTableBean.setMark(read.getString("remark")); refTableBean.setMark(read.getString("remark"));
refTableBean.setUser(read.getString("principal")); refTableBean.setUserPane(read.getString("principal"));
String result = read.getString("result"); String result = read.getString("result");
System.out.println("refTableSql==>" + read.getString("principal")); System.out.println("refTableSql==>" + read.getString("principal"));
if (result.equals("否")) { if (result.equals("否")) {
@ -811,18 +824,12 @@ public class CreateEcnController extends KFXPanelController {
private void createRefTable() { private void createRefTable() {
// TODO Auto-generated method stub // TODO Auto-generated method stub
// 影响分析表格 // 影响分析表格
// protected SimpleStringProperty depart;//部门
// protected SimpleStringProperty 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> deapart = new TableColumn<RefTableBean, String>("部门");
TableColumn<RefTableBean, String> message = new TableColumn<RefTableBean, String>("行动(需要书面证据)"); TableColumn<RefTableBean, String> message = new TableColumn<RefTableBean, String>("行动(需要书面证据)");
TableColumn<RefTableBean, CheckBox> shYes = new TableColumn<RefTableBean, CheckBox>("是"); // 要求值(设计) TableColumn<RefTableBean, CheckBox> shYes = new TableColumn<RefTableBean, CheckBox>("是"); // 要求值(设计)
TableColumn<RefTableBean, CheckBox> shNo = new TableColumn<RefTableBean, CheckBox>("否"); TableColumn<RefTableBean, CheckBox> shNo = new TableColumn<RefTableBean, CheckBox>("否");
TableColumn<RefTableBean, TextField> user = new TableColumn<RefTableBean, TextField>("责任人"); TableColumn<RefTableBean, Object> user = new TableColumn<RefTableBean, Object>("责任人");
TableColumn<RefTableBean, TextField> compDate = new TableColumn<RefTableBean, TextField>("完成时间"); // TableColumn<RefTableBean, TextField> compDate = new TableColumn<RefTableBean, TextField>("完成时间"); //
TableColumn<RefTableBean, TextField> mark = new TableColumn<RefTableBean, TextField>("备注"); // TableColumn<RefTableBean, TextField> mark = new TableColumn<RefTableBean, TextField>("备注"); //
@ -830,7 +837,7 @@ public class CreateEcnController extends KFXPanelController {
message.setCellValueFactory(new PropertyValueFactory<RefTableBean, String>("message")); message.setCellValueFactory(new PropertyValueFactory<RefTableBean, String>("message"));
shYes.setCellValueFactory(new PropertyValueFactory<RefTableBean, CheckBox>("shYes")); shYes.setCellValueFactory(new PropertyValueFactory<RefTableBean, CheckBox>("shYes"));
shNo.setCellValueFactory(new PropertyValueFactory<RefTableBean, CheckBox>("shNo")); shNo.setCellValueFactory(new PropertyValueFactory<RefTableBean, CheckBox>("shNo"));
user.setCellValueFactory(new PropertyValueFactory<RefTableBean, TextField>("user")); user.setCellValueFactory(new PropertyValueFactory<RefTableBean, Object>("userPane"));
compDate.setCellValueFactory(new PropertyValueFactory<RefTableBean, TextField>("compDate")); compDate.setCellValueFactory(new PropertyValueFactory<RefTableBean, TextField>("compDate"));
mark.setCellValueFactory(new PropertyValueFactory<RefTableBean, TextField>("mark")); mark.setCellValueFactory(new PropertyValueFactory<RefTableBean, TextField>("mark"));
@ -844,53 +851,156 @@ public class CreateEcnController extends KFXPanelController {
refTable.getColumns().addAll(deapart, message, shYes, shNo, user, compDate, mark); refTable.getColumns().addAll(deapart, message, shYes, shNo, user, compDate, mark);
// //设置宽度 // //设置宽度
deapart.prefWidthProperty().bind(refTable.widthProperty().multiply(0.14)); deapart.prefWidthProperty().bind(refTable.widthProperty().multiply(0.14));
message.prefWidthProperty().bind(refTable.widthProperty().multiply(0.36)); message.prefWidthProperty().bind(refTable.widthProperty().multiply(0.30));
shYes.prefWidthProperty().bind(refTable.widthProperty().multiply(0.05)); shYes.prefWidthProperty().bind(refTable.widthProperty().multiply(0.05));
shNo.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)); compDate.prefWidthProperty().bind(refTable.widthProperty().multiply(0.13));
mark.prefWidthProperty().bind(refTable.widthProperty().multiply(0.14)); mark.prefWidthProperty().bind(refTable.widthProperty().multiply(0.14));
List<RefTableBean> refTableBeans = new ArrayList<RefTableBean>(); List<RefTableBean> refTableBeans = new ArrayList<RefTableBean>();
// 初始化数据 写死的 // 初始化数据 写死的
refTableBeans.add(new RefTableBean(new SimpleStringProperty("技术部"), new SimpleStringProperty("产品图样、目录、铭牌等"))); refTableBeans
.add(new RefTableBean(new SimpleStringProperty("技术部"), new SimpleStringProperty("产品图样、目录、铭牌等"), 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( refTableBeans.add(
new RefTableBean(new SimpleStringProperty("技术部"), new SimpleStringProperty("技术方案、DFMEA、产品质量特性重要度分级表"))); new RefTableBean(new SimpleStringProperty("工艺部"), new SimpleStringProperty("工艺流程图、PFMEA、工艺守则"), true));
refTableBeans.add(new RefTableBean(new SimpleStringProperty("技术部"), new SimpleStringProperty("BOM物料更改"))); refTableBeans
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
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("模具、工装、设备更改"), 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 refTableBeans
.add(new RefTableBean(new SimpleStringProperty("工艺部"), new SimpleStringProperty("工艺流程图、PFMEA、工艺守则"))); .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
refTableBeans.add(new RefTableBean(new SimpleStringProperty("质量部"), new SimpleStringProperty("进货/过程/成品检验文件"))); .add(new RefTableBean(new SimpleStringProperty("生产部"), new SimpleStringProperty("断点标识(物料切换)"), true));
refTableBeans.add(new RefTableBean(new SimpleStringProperty("质量部"), new SimpleStringProperty("供应商产品质量检验报告"))); refTableBeans
refTableBeans.add(new RefTableBean(new SimpleStringProperty("质量部"), new SimpleStringProperty("客户承诺相关质量文件"))); .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("采购价格变化"), true));
refTableBeans.add(new RefTableBean(new SimpleStringProperty("生产部"), new SimpleStringProperty("在制品确认及处理"))); refTableBeans.add(
refTableBeans.add(new RefTableBean(new SimpleStringProperty("生产部"), new SimpleStringProperty("成品确认及处理"))); new RefTableBean(new SimpleStringProperty("采购部"), new SimpleStringProperty("更改信息(资料、价格)传递"), false));
refTableBeans.add(new RefTableBean(new SimpleStringProperty("生产部"), new SimpleStringProperty("计划确认及调整"))); 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("通知客户"), true));
refTableBeans.add(new RefTableBean(new SimpleStringProperty("采购部"), new SimpleStringProperty("更改信息(资料、价格)传递"))); refTableBeans.add(new RefTableBean(new SimpleStringProperty("销售中心"), new SimpleStringProperty("客户批准"), false));
refTableBeans.add(new RefTableBean(new SimpleStringProperty("采购部"), new SimpleStringProperty("合格供方评价(新增时)"))); refTableBeans
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("销售价格变化"), true));
refTableBeans.add(new RefTableBean(new SimpleStringProperty("销售中心"), new SimpleStringProperty("客户批准"))); addAssignAction(refTableBeans);
refTableBeans.add(new RefTableBean(new SimpleStringProperty("销售中心"), new SimpleStringProperty("修改客户协议"))); 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.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;
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() { public String getDepart() {
return depart.get(); return depart.get();
@ -49,14 +87,6 @@ public class RefTableBean {
this.shNo.setSelected(shNo); this.shNo.setSelected(shNo);
} }
public TextField getUser() {
return user;
}
public void setUser(String user) {
this.user.setText(user);
}
public TextField getCompDate() { public TextField getCompDate() {
return compDate; return compDate;
} }
@ -74,15 +104,22 @@ public class RefTableBean {
} }
// protected ComboBox<String> changeReason = new ComboBox<String>();//¸ü¸ÄÔ­Òò // protected ComboBox<String> changeReason = new ComboBox<String>();//¸ü¸ÄÔ­Òò
public RefTableBean(SimpleStringProperty depart, SimpleStringProperty message) { public RefTableBean(SimpleStringProperty depart, SimpleStringProperty message, Boolean flag) {
super(); super();
this.depart = depart; this.depart = depart;
this.message = message; this.message = message;
// this.shYes = shYes;
// this.shNo = shNo; if (flag) {
// this.user = user; FlowPane userPane = new FlowPane();
// this.compDate = compDate; userText = new TextField();
// this.mark = mark; userBtn = new Button("指派");
userPane.getChildren().add(userText);
userPane.getChildren().add(userBtn);
this.userPane = userPane;
}else {
this.userPane = new SimpleStringProperty();
}
shNo.setSelected(true); shNo.setSelected(true);
shYes.selectedProperty().addListener(new ChangeListener<Boolean>() { shYes.selectedProperty().addListener(new ChangeListener<Boolean>() {
@ -91,7 +128,7 @@ public class RefTableBean {
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) {
shNo.setSelected(false); shNo.setSelected(false);
} }
} }
@ -102,7 +139,7 @@ public class RefTableBean {
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,40 +10,48 @@ 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) { public void setStatus(SimpleStringProperty status) {
this.status = status; this.status = status;
} }
public Button getLinkBtn() { public Button getLinkBtn() {
return linkBtn; return linkBtn;
} }
public void setLinkBtn(Button linkBtn) { public void setLinkBtn(Button linkBtn) {
this.linkBtn = linkBtn; this.linkBtn = linkBtn;
} }
public Button getImportBtn() { public Button getImportBtn() {
return importBtn; return importBtn;
} }
public void setImportBtn(Button importBtn) { public void setImportBtn(Button importBtn) {
this.importBtn = importBtn; this.importBtn = importBtn;
} }
public String getNum() { public String getNum() {
return num.get(); return num.get();
} }
public RelateEcnBean(SimpleStringProperty num, SimpleStringProperty contConde, SimpleStringProperty contName, public RelateEcnBean(SimpleStringProperty num, SimpleStringProperty contConde, SimpleStringProperty contName,
SimpleStringProperty requestNo, SimpleStringProperty prodModel, SimpleStringProperty applicant, 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(); super();
this.num = num; this.num = num;
this.contConde = contConde; this.contConde = contConde;
@ -52,18 +60,18 @@ public class RelateEcnBean {
this.prodModel = prodModel; this.prodModel = prodModel;
this.applicant = applicant; this.applicant = applicant;
this.status = status; this.status = status;
//变更单号 // 变更单号
String applyNo = read.getString("APPLYNO"); String applyNo = read.getString("APPLYNO");
//七种责任人 // 七种责任人
String designPal = read.getString("DESIGNPRINCIPAL"); String designPal = read.getString("DESIGNPRINCIPAL");
String techPal = read.getString("TECHPRINCIPAL"); String techPal = read.getString("TECHPRINCIPAL");
String quantityPal = read.getString("QUALITYPRINCIPAL"); String quantityPal = read.getString("QUALITYPRINCIPAL");
String producePal = read.getString("PRODUCEPRINCIPAL"); String producePal = read.getString("PRODUCEPRINCIPAL");
String purchasePal = read.getString("PURCHASEYPRINCIPAL"); String purchasePal = read.getString("PURCHASEYPRINCIPAL");
String customPal = read.getString("CUSTOMNOTICEPRINCIPAL");//FINAPRICEPRINCIPAL String customPal = read.getString("CUSTOMNOTICEPRINCIPAL");// FINAPRICEPRINCIPAL
String finaPal = read.getString("FINAPRICEPRINCIPAL"); String finaPal = read.getString("FINAPRICEPRINCIPAL");
String docuName = read.getString("DOCUNAME"); //文件代号及名称 String docuName = read.getString("DOCUNAME"); // 文件代号及名称
String designFile = read.getString("DESIGNFILE");//获取行动内容 String designFile = read.getString("DESIGNFILE");// 获取行动内容
linkBtn.setOnAction(e -> { linkBtn.setOnAction(e -> {
try { try {
BomToSapUtil.browse2(link); BomToSapUtil.browse2(link);
@ -75,26 +83,26 @@ public class RelateEcnBean {
importBtn.setOnAction(e -> { importBtn.setOnAction(e -> {
try { try {
ObservableList<RefTableBean> items = controller.refTable.getItems(); ObservableList<RefTableBean> items = controller.refTable.getItems();
for(int i=0;i<7;i++) { for (int i = 0; i < 7; i++) {
items.get(i).setUser(designPal); items.get(i).setUserPane(designPal);
} }
for(int i=7;i<11;i++) { for (int i = 7; i < 11; i++) {
items.get(i).setUser(techPal); items.get(i).setUserPane(techPal);
} }
for(int i=11;i<15;i++) { for (int i = 11; i < 15; i++) {
items.get(i).setUser(quantityPal); items.get(i).setUserPane(quantityPal);
} }
for(int i=15;i<19;i++) { for (int i = 15; i < 19; i++) {
items.get(i).setUser(producePal); items.get(i).setUserPane(producePal);
} }
for(int i=19;i<24;i++) { for (int i = 19; i < 24; i++) {
items.get(i).setUser(purchasePal); items.get(i).setUserPane(purchasePal);
} }
for(int i=24;i<27;i++) { for (int i = 24; i < 27; i++) {
items.get(i).setUser(customPal); items.get(i).setUserPane(customPal);
} }
for(int i=27;i<28;i++) { for (int i = 27; i < 28; i++) {
items.get(i).setUser(finaPal); items.get(i).setUserPane(finaPal);
} }
controller.markText.setText(docuName); controller.markText.setText(docuName);
controller.relateEcnText.setText(applyNo); controller.relateEcnText.setText(applyNo);
@ -105,40 +113,49 @@ public class RelateEcnBean {
} }
}); });
} }
public void setNum(SimpleStringProperty num) { public void setNum(SimpleStringProperty num) {
this.num = num; this.num = num;
} }
public String getContConde() { public String getContConde() {
return contConde.get(); return contConde.get();
} }
public void setContConde(SimpleStringProperty contConde) { public void setContConde(SimpleStringProperty contConde) {
this.contConde = contConde; this.contConde = contConde;
} }
public String getContName() { public String getContName() {
return contName.get(); return contName.get();
} }
public void setContName(SimpleStringProperty contName) { public void setContName(SimpleStringProperty contName) {
this.contName = contName; this.contName = contName;
} }
public String getRequestNo() { public String getRequestNo() {
return requestNo.get(); return requestNo.get();
} }
public void setRequestNo(SimpleStringProperty requestNo) { public void setRequestNo(SimpleStringProperty requestNo) {
this.requestNo = requestNo; this.requestNo = requestNo;
} }
public String getProdModel() { public String getProdModel() {
return prodModel.get(); return prodModel.get();
} }
public void setProdModel(SimpleStringProperty prodModel) { public void setProdModel(SimpleStringProperty prodModel) {
this.prodModel = prodModel; this.prodModel = prodModel;
} }
public String getApplicant() { public String getApplicant() {
return applicant.get(); return applicant.get();
} }
public void setApplicant(SimpleStringProperty applicant) { public void setApplicant(SimpleStringProperty applicant) {
this.applicant = 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
@ -93,6 +95,7 @@ public class RelateEcnController {
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) { public void initData(TCSession session, CreateEcnController controller) {
// TODO Auto-generated method stub // TODO Auto-generated method stub
this.controller = controller; this.controller = controller;
@ -106,18 +109,25 @@ public class RelateEcnController {
*/ */
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>(
"申请人");
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); numCol.setSortable(false);
contCondeCol.setSortable(false); contCondeCol.setSortable(false);
@ -128,16 +138,16 @@ public class RelateEcnController {
statusCol.setSortable(false); statusCol.setSortable(false);
linkBtnCol.setSortable(false); linkBtnCol.setSortable(false);
importBtnCol.setSortable(false); importBtnCol.setSortable(false);
//列绑定bean对象 // 列绑定bean对象
numCol.setCellValueFactory(new PropertyValueFactory<RelateEcnBean,SimpleStringProperty>("num")); numCol.setCellValueFactory(new PropertyValueFactory<RelateEcnBean, SimpleStringProperty>("num"));
contCondeCol.setCellValueFactory(new PropertyValueFactory<RelateEcnBean,SimpleStringProperty>("contConde")); contCondeCol.setCellValueFactory(new PropertyValueFactory<RelateEcnBean, SimpleStringProperty>("contConde"));
contNameCol.setCellValueFactory(new PropertyValueFactory<RelateEcnBean,SimpleStringProperty>("contName")); contNameCol.setCellValueFactory(new PropertyValueFactory<RelateEcnBean, SimpleStringProperty>("contName"));
requestNoCol.setCellValueFactory(new PropertyValueFactory<RelateEcnBean,SimpleStringProperty>("requestNo")); requestNoCol.setCellValueFactory(new PropertyValueFactory<RelateEcnBean, SimpleStringProperty>("requestNo"));
prodModelCol.setCellValueFactory(new PropertyValueFactory<RelateEcnBean,SimpleStringProperty>("prodModel")); prodModelCol.setCellValueFactory(new PropertyValueFactory<RelateEcnBean, SimpleStringProperty>("prodModel"));
applicantCol.setCellValueFactory(new PropertyValueFactory<RelateEcnBean,SimpleStringProperty>("applicant")); applicantCol.setCellValueFactory(new PropertyValueFactory<RelateEcnBean, SimpleStringProperty>("applicant"));
statusCol.setCellValueFactory(new PropertyValueFactory<RelateEcnBean,SimpleStringProperty>("status")); statusCol.setCellValueFactory(new PropertyValueFactory<RelateEcnBean, SimpleStringProperty>("status"));
linkBtnCol.setCellValueFactory(new PropertyValueFactory<RelateEcnBean,Button>("linkBtn")); linkBtnCol.setCellValueFactory(new PropertyValueFactory<RelateEcnBean, Button>("linkBtn"));
importBtnCol.setCellValueFactory(new PropertyValueFactory<RelateEcnBean,Button>("importBtn")); importBtnCol.setCellValueFactory(new PropertyValueFactory<RelateEcnBean, Button>("importBtn"));
numCol.prefWidthProperty().bind(tableView.widthProperty().multiply(0.06)); numCol.prefWidthProperty().bind(tableView.widthProperty().multiply(0.06));
contCondeCol.prefWidthProperty().bind(tableView.widthProperty().multiply(0.12)); contCondeCol.prefWidthProperty().bind(tableView.widthProperty().multiply(0.12));
@ -160,68 +170,72 @@ public class RelateEcnController {
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(); String endText = endTime.getEditor().getText();
if(!endText.isEmpty()) { 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') searchSqlBuff.append(" and to_date(APPLYDATE,'yyyy-mm-dd hh24:mi:ss') <= to_date('").append(endText)
System.out.println("endText==>"+endText); .append("','yyyy-mm-dd') "); // to_date(?,'yyyy-mm-ddhh24:mi:ss')
System.out.println("endText==>" + endText);
} }
int num = 1; int num = 1;
ResultSet read = SqlUtil.read(searchSqlBuff.toString()); ResultSet read = SqlUtil.read(searchSqlBuff.toString());
List<RelateEcnBean> ecnBeans = new ArrayList<>(); List<RelateEcnBean> ecnBeans = new ArrayList<>();
while(read.next()) { while (read.next()) {
String contConde = read.getString("CONTRACTNO"); String contConde = read.getString("CONTRACTNO");
String contName = read.getString("CONTRACTNAME"); String contName = read.getString("CONTRACTNAME");
String requestNo = read.getString("APPLYNO"); String requestNo = read.getString("APPLYNO");
String prodModel = read.getString("PRODUCTMODEL"); String prodModel = read.getString("PRODUCTMODEL");
String applicant = read.getString("APPLYUSER");//STATUS String applicant = read.getString("APPLYUSER");// STATUS
String status = read.getString("STATUS"); String status = read.getString("STATUS");
String link = read.getString("APPLYLINK"); String link = read.getString("APPLYLINK");
ecnBeans.add( ecnBeans.add(new RelateEcnBean(new SimpleStringProperty(num + ""), new SimpleStringProperty(contConde),
new RelateEcnBean(new SimpleStringProperty(num+""),new SimpleStringProperty(contConde), new SimpleStringProperty(contName), new SimpleStringProperty(requestNo),
new SimpleStringProperty(contName),new SimpleStringProperty(requestNo),new SimpleStringProperty(prodModel), new SimpleStringProperty(prodModel), new SimpleStringProperty(applicant),
new SimpleStringProperty(applicant),new SimpleStringProperty(status),link,controller,read)); new SimpleStringProperty(status), link, controller, read));
num++; num++;
} }
tableView.getItems().clear(); tableView.getItems().clear();
tableView.getItems().addAll(ecnBeans); tableView.getItems().addAll(ecnBeans);
}catch(Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
}finally { } finally {
SqlUtil.freeAll(); 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("%' ");
} }
} }

@ -17,11 +17,13 @@ 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();
@ -31,7 +33,7 @@ public class RelateEcnDialog extends Application {
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();
} }

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

@ -28,7 +28,7 @@ public abstract class KFXPanel extends Application {
// 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();
@ -73,13 +73,14 @@ public abstract class KFXPanel extends Application {
post(this.parentDialog, e.getMessage(), "", 1); post(this.parentDialog, e.getMessage(), "", 1);
} }
} }
protected void initUI(String fxmlName) { protected void initUI(String fxmlName) {
try { try {
FXMLLoader fxmlLoader = new FXMLLoader(); FXMLLoader fxmlLoader = new FXMLLoader();
String resource = fxmlName;//"SearchSapResultPanel.fxml"; String resource = fxmlName;// "SearchSapResultPanel.fxml";
fxmlLoader.setLocation(getClass().getResource(resource)); fxmlLoader.setLocation(getClass().getResource(resource));
this.root = (Parent)fxmlLoader.load(); this.root = (Parent) fxmlLoader.load();
this.aifController = (KFXPanelController)fxmlLoader.getController(); this.aifController = (KFXPanelController) fxmlLoader.getController();
if (this.cssForm != null) if (this.cssForm != null)
this.root.getStylesheets().add(this.cssForm); this.root.getStylesheets().add(this.cssForm);
} catch (Exception e) { } catch (Exception e) {
@ -87,13 +88,14 @@ public abstract class KFXPanel extends Application {
post(this.parentDialog, e.getMessage(), "", 1); post(this.parentDialog, e.getMessage(), "", 1);
} }
} }
protected void initUI() { protected void initUI() {
try { try {
FXMLLoader fxmlLoader = new FXMLLoader(); FXMLLoader fxmlLoader = new FXMLLoader();
String resource = "SearchSapResultPanel.fxml"; String resource = "SearchSapResultPanel.fxml";
fxmlLoader.setLocation(getClass().getResource(resource)); fxmlLoader.setLocation(getClass().getResource(resource));
this.root = (Parent)fxmlLoader.load(); this.root = (Parent) fxmlLoader.load();
this.aifController = (KFXPanelController)fxmlLoader.getController(); this.aifController = (KFXPanelController) fxmlLoader.getController();
if (this.cssForm != null) if (this.cssForm != null)
this.root.getStylesheets().add(this.cssForm); this.root.getStylesheets().add(this.cssForm);
} catch (Exception e) { } catch (Exception e) {
@ -117,6 +119,7 @@ public abstract class KFXPanel extends Application {
MessageBox.post(dialog, msg, title, msgType); 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();

@ -1,6 +1,5 @@
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;

@ -1,4 +1,5 @@
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;

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