|
|
@ -0,0 +1,863 @@
|
|
|
|
|
|
|
|
package com.chint.plm.qms;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.awt.Component;
|
|
|
|
|
|
|
|
import java.awt.event.ComponentEvent;
|
|
|
|
|
|
|
|
import java.awt.event.ComponentListener;
|
|
|
|
|
|
|
|
import java.sql.Connection;
|
|
|
|
|
|
|
|
import java.sql.PreparedStatement;
|
|
|
|
|
|
|
|
import java.sql.ResultSet;
|
|
|
|
|
|
|
|
import java.sql.SQLException;
|
|
|
|
|
|
|
|
import java.text.ParseException;
|
|
|
|
|
|
|
|
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.regex.Matcher;
|
|
|
|
|
|
|
|
import java.util.regex.Pattern;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.chint.plm.rdmCreate.KFXPanel;
|
|
|
|
|
|
|
|
import com.chint.plm.rdmCreate.KFXPanelController;
|
|
|
|
|
|
|
|
import com.chint.plm.rdmCreate.RdmCreateBean;
|
|
|
|
|
|
|
|
import com.connor.chint.sap2.util.KUtil;
|
|
|
|
|
|
|
|
import com.connor.chint.sap2.util.SAPUtil;
|
|
|
|
|
|
|
|
import com.connor.chint.sap2.util.SqlUtil;
|
|
|
|
|
|
|
|
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
|
|
|
|
|
|
|
import com.teamcenter.rac.aif.kernel.AIFComponentContext;
|
|
|
|
|
|
|
|
import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent;
|
|
|
|
|
|
|
|
import com.teamcenter.rac.aifrcp.AIFUtility;
|
|
|
|
|
|
|
|
import com.teamcenter.rac.kernel.TCComponent;
|
|
|
|
|
|
|
|
import com.teamcenter.rac.kernel.TCComponentContextList;
|
|
|
|
|
|
|
|
import com.teamcenter.rac.kernel.TCComponentFolder;
|
|
|
|
|
|
|
|
import com.teamcenter.rac.kernel.TCComponentGroup;
|
|
|
|
|
|
|
|
import com.teamcenter.rac.kernel.TCComponentGroupType;
|
|
|
|
|
|
|
|
import com.teamcenter.rac.kernel.TCComponentProject;
|
|
|
|
|
|
|
|
import com.teamcenter.rac.kernel.TCComponentProjectType;
|
|
|
|
|
|
|
|
import com.teamcenter.rac.kernel.TCComponentUser;
|
|
|
|
|
|
|
|
import com.teamcenter.rac.kernel.TCComponentUserType;
|
|
|
|
|
|
|
|
import com.teamcenter.rac.kernel.TCException;
|
|
|
|
|
|
|
|
import com.teamcenter.rac.kernel.TCSession;
|
|
|
|
|
|
|
|
import com.teamcenter.rac.util.MessageBox;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import javafx.application.Platform;
|
|
|
|
|
|
|
|
import javafx.beans.property.SimpleStringProperty;
|
|
|
|
|
|
|
|
import javafx.collections.FXCollections;
|
|
|
|
|
|
|
|
import javafx.collections.ObservableList;
|
|
|
|
|
|
|
|
import javafx.event.ActionEvent;
|
|
|
|
|
|
|
|
import javafx.event.Event;
|
|
|
|
|
|
|
|
import javafx.event.EventHandler;
|
|
|
|
|
|
|
|
import javafx.fxml.FXML;
|
|
|
|
|
|
|
|
import javafx.scene.control.Alert;
|
|
|
|
|
|
|
|
import javafx.scene.control.Button;
|
|
|
|
|
|
|
|
import javafx.scene.control.CheckBox;
|
|
|
|
|
|
|
|
import javafx.scene.control.ComboBox;
|
|
|
|
|
|
|
|
import javafx.scene.control.DatePicker;
|
|
|
|
|
|
|
|
import javafx.scene.control.ScrollPane;
|
|
|
|
|
|
|
|
import javafx.scene.control.SplitPane;
|
|
|
|
|
|
|
|
import javafx.scene.control.TableCell;
|
|
|
|
|
|
|
|
import javafx.scene.control.TableColumn;
|
|
|
|
|
|
|
|
import javafx.scene.control.TableRow;
|
|
|
|
|
|
|
|
import javafx.scene.control.TableView;
|
|
|
|
|
|
|
|
import javafx.scene.control.TextArea;
|
|
|
|
|
|
|
|
import javafx.scene.control.TextField;
|
|
|
|
|
|
|
|
import javafx.scene.control.TitledPane;
|
|
|
|
|
|
|
|
import javafx.scene.control.Alert.AlertType;
|
|
|
|
|
|
|
|
import javafx.scene.control.cell.PropertyValueFactory;
|
|
|
|
|
|
|
|
import javafx.scene.control.cell.TextFieldTableCell;
|
|
|
|
|
|
|
|
import javafx.scene.layout.AnchorPane;
|
|
|
|
|
|
|
|
import javafx.scene.layout.BorderPane;
|
|
|
|
|
|
|
|
import javafx.scene.layout.GridPane;
|
|
|
|
|
|
|
|
import javafx.scene.layout.Pane;
|
|
|
|
|
|
|
|
import javafx.util.Callback;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public class QMSController extends KFXPanelController {
|
|
|
|
|
|
|
|
private Connection conn;
|
|
|
|
|
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
|
|
|
|
|
private String PlanTime;//
|
|
|
|
|
|
|
|
private String lineSeparator = System.lineSeparator();// 换行符
|
|
|
|
|
|
|
|
private String[] prefs = null;
|
|
|
|
|
|
|
|
private double paneWidth;
|
|
|
|
|
|
|
|
private double paneHight;
|
|
|
|
|
|
|
|
ObservableList<QMSBean> data = null;
|
|
|
|
|
|
|
|
//ComboBox<String> plmvaluetype = new ComboBox<String>();
|
|
|
|
|
|
|
|
boolean isAdmin = false;
|
|
|
|
|
|
|
|
boolean isEdit = false;
|
|
|
|
|
|
|
|
String factory = "";
|
|
|
|
|
|
|
|
@FXML
|
|
|
|
|
|
|
|
private Button bc;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@FXML
|
|
|
|
|
|
|
|
private ScrollPane scroll;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@FXML
|
|
|
|
|
|
|
|
private TextField f1;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@FXML
|
|
|
|
|
|
|
|
private TextField f2;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@FXML
|
|
|
|
|
|
|
|
private TextField f3;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@FXML
|
|
|
|
|
|
|
|
private CheckBox c1;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@FXML
|
|
|
|
|
|
|
|
private CheckBox c2;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@FXML
|
|
|
|
|
|
|
|
private CheckBox c3;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@FXML
|
|
|
|
|
|
|
|
private Pane pane1;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@FXML
|
|
|
|
|
|
|
|
private Button cx;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@FXML
|
|
|
|
|
|
|
|
private Button cz;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@FXML
|
|
|
|
|
|
|
|
private Pane pane;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@FXML
|
|
|
|
|
|
|
|
private TableView<QMSBean> table;
|
|
|
|
|
|
|
|
// table的列
|
|
|
|
|
|
|
|
// private TableColumn<String, TextField> tc_1 = new TableColumn<String,
|
|
|
|
|
|
|
|
// TextField>("序号");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private QMSFrame frame;
|
|
|
|
|
|
|
|
protected AbstractAIFApplication app;
|
|
|
|
|
|
|
|
private TCSession session;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 初始化界面
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void initData(KFXPanel paramKFXPanel) throws Exception {
|
|
|
|
|
|
|
|
// TODO Auto-generated method stub
|
|
|
|
|
|
|
|
// 连接数据库 根据条件查询
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.app = AIFUtility.getCurrentApplication();
|
|
|
|
|
|
|
|
this.session = (TCSession) app.getSession();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.prefs = session.getPreferenceService().getStringValues("CHINT_SRM_SQL_CONNECT");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
f1.setPrefSize(180, 28);
|
|
|
|
|
|
|
|
f2.setPrefSize(180, 28);
|
|
|
|
|
|
|
|
f3.setPrefSize(180, 28);
|
|
|
|
|
|
|
|
System.out.println("===============开始连接tc数据库===============");
|
|
|
|
|
|
|
|
frame = (QMSFrame) paramKFXPanel.getParentDialog();
|
|
|
|
|
|
|
|
addWindListener(frame);
|
|
|
|
|
|
|
|
//填界table监听
|
|
|
|
|
|
|
|
table.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> {
|
|
|
|
|
|
|
|
if (newValue != null) {
|
|
|
|
|
|
|
|
int index = table.getSelectionModel().getSelectedIndex();
|
|
|
|
|
|
|
|
System.out.println("Selected row at index: " + index);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QMSBean item = table.getItems().get(index);
|
|
|
|
|
|
|
|
System.out.println("===================================================="+item.getQmsinspectioncode());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
factory = SAPUtil.getGroupID(session);
|
|
|
|
|
|
|
|
String[] pref = session.getPreferenceService().getStringValues("CHINT_QMS_INSPECIFICATION_CODE_RULE");
|
|
|
|
|
|
|
|
String userId = session.getUser().getUserId();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(userId.equalsIgnoreCase("admin")) {
|
|
|
|
|
|
|
|
isAdmin = true;
|
|
|
|
|
|
|
|
isEdit = true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 获取对应组织的流水码
|
|
|
|
|
|
|
|
for (int z = 0; z < pref.length; z++) {
|
|
|
|
|
|
|
|
String[] split = pref[z].split(":");
|
|
|
|
|
|
|
|
if(split[0].equalsIgnoreCase(factory)) {
|
|
|
|
|
|
|
|
if(split[1].contains(userId)) {
|
|
|
|
|
|
|
|
isEdit = true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(!isEdit) {
|
|
|
|
|
|
|
|
bc.setVisible(false);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
table.setEditable(true);
|
|
|
|
|
|
|
|
frame.setMaximumSize(frame.getMaximumSize());
|
|
|
|
|
|
|
|
System.out.println("frame==>" + frame);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TableColumn checkboxColumn = new TableColumn<>("");
|
|
|
|
|
|
|
|
checkboxColumn.setCellValueFactory(new PropertyValueFactory<QMSBean, CheckBox>("checkBox"));
|
|
|
|
|
|
|
|
checkboxColumn.prefWidthProperty().bind(table.widthProperty().multiply(0.03));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TableColumn<QMSBean, String> tc1 = new TableColumn<>("序号");
|
|
|
|
|
|
|
|
tc1.setCellValueFactory(new PropertyValueFactory<QMSBean, String>("xh"));
|
|
|
|
|
|
|
|
tc1.prefWidthProperty().bind(table.widthProperty().multiply(0.03));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TableColumn<QMSBean, String> tc2 = new TableColumn<>("检验项编码");
|
|
|
|
|
|
|
|
tc2.setCellValueFactory(new PropertyValueFactory<QMSBean, String>("qmsinspectioncode"));
|
|
|
|
|
|
|
|
tc2.prefWidthProperty().bind(table.widthProperty().multiply(0.1));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TableColumn<QMSBean, String> tc3 = new TableColumn<>("检验项名称");
|
|
|
|
|
|
|
|
tc3.setCellValueFactory(new PropertyValueFactory<QMSBean, String>("qmsinspectionname"));
|
|
|
|
|
|
|
|
tc3.prefWidthProperty().bind(table.widthProperty().multiply(0.1));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TableColumn<QMSBean, String> tc4 = new TableColumn<>("上级检验项");
|
|
|
|
|
|
|
|
tc4.setCellValueFactory(new PropertyValueFactory<QMSBean, String>("qmssuperiorinspectionname"));
|
|
|
|
|
|
|
|
tc4.prefWidthProperty().bind(table.widthProperty().multiply(0.1));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TableColumn<QMSBean, String> tc5 = new TableColumn<>("检验方案名称");
|
|
|
|
|
|
|
|
tc5.setCellValueFactory(new PropertyValueFactory<QMSBean, String>("qmsinspectionschemename"));
|
|
|
|
|
|
|
|
tc5.prefWidthProperty().bind(table.widthProperty().multiply(0.1));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TableColumn<QMSBean, String> tc6 = new TableColumn<>("QMS推送人员");
|
|
|
|
|
|
|
|
tc6.setCellValueFactory(new PropertyValueFactory<QMSBean, String>("qmspushuser"));
|
|
|
|
|
|
|
|
tc6.prefWidthProperty().bind(table.widthProperty().multiply(0.06));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TableColumn<QMSBean, ComboBox<String>> tc7 = new TableColumn<>("取值类型");
|
|
|
|
|
|
|
|
tc7.setCellValueFactory(new PropertyValueFactory<QMSBean, ComboBox<String>>("plmvaluetype"));
|
|
|
|
|
|
|
|
tc7.prefWidthProperty().bind(table.widthProperty().multiply(0.17));
|
|
|
|
|
|
|
|
//tc7.setSortable(false);
|
|
|
|
|
|
|
|
// tc7.setCellFactory(TextFieldTableCell.forTableColumn()); //
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// // 设置单元格工厂以监听修改
|
|
|
|
|
|
|
|
// tc7.setCellFactory(new Callback<TableColumn<QMSBean, TextField>, TableCell<QMSBean, TextField>>() {
|
|
|
|
|
|
|
|
// @Override
|
|
|
|
|
|
|
|
// public TableCell<QMSBean, TextField> call(TableColumn<QMSBean, TextField> param) {
|
|
|
|
|
|
|
|
// return new TableCell<QMSBean, TextField>() {
|
|
|
|
|
|
|
|
// @Override
|
|
|
|
|
|
|
|
// public void updateItem(TextField item, boolean empty) {
|
|
|
|
|
|
|
|
// //super.updateItem(item, empty);
|
|
|
|
|
|
|
|
// if (item == null) {
|
|
|
|
|
|
|
|
// //setText(null);
|
|
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
|
|
// // 当单元格内容修改时,这里会被调用
|
|
|
|
|
|
|
|
// //setText(item.getText());
|
|
|
|
|
|
|
|
// // 可以在这里添加你想要的逻辑,比如打印修改后的值
|
|
|
|
|
|
|
|
// System.out.println("Cell modified to: " + item.getText());
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// };
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// // 监听单元格编辑
|
|
|
|
|
|
|
|
// tc7.setOnEditCommit(event -> {
|
|
|
|
|
|
|
|
// // 获取编辑后的值
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// // 获取行索引
|
|
|
|
|
|
|
|
// int rowIndex = table.getSelectionModel().getSelectedIndex();
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// // 获取同一行的"Copy"列
|
|
|
|
|
|
|
|
// data = table.getItems();
|
|
|
|
|
|
|
|
// QMSBean item = data.get(rowIndex);
|
|
|
|
|
|
|
|
// item.setRed(true);
|
|
|
|
|
|
|
|
// System.out.println("bean================"+item.toString());
|
|
|
|
|
|
|
|
// System.out.println("red完成");
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// // 设置行的样式
|
|
|
|
|
|
|
|
// table.setRowFactory(tv -> {
|
|
|
|
|
|
|
|
// TableRow<QMSBean> row = new TableRow<>();
|
|
|
|
|
|
|
|
// row.itemProperty().addListener((obs, previousItem, newItem) -> {
|
|
|
|
|
|
|
|
// QMSBean qmsBean = row.getItem();
|
|
|
|
|
|
|
|
// System.out.println("newItem========================="+qmsBean);
|
|
|
|
|
|
|
|
// if (qmsBean != null && qmsBean.isRed()) {
|
|
|
|
|
|
|
|
// // 当行中有数据时设置样式
|
|
|
|
|
|
|
|
// row.setStyle("-fx-background-color: red;");
|
|
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
|
|
// // 当行为空时恢复默认样式
|
|
|
|
|
|
|
|
// row.setStyle("");
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
// return row ;
|
|
|
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
// table.refresh();
|
|
|
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TableColumn<QMSBean, String> tc8 = new TableColumn<>("PLM检验项编码");
|
|
|
|
|
|
|
|
tc8.setCellValueFactory(new PropertyValueFactory<QMSBean, String>("plminspectioncode"));
|
|
|
|
|
|
|
|
tc8.prefWidthProperty().bind(table.widthProperty().multiply(0.1));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TableColumn<QMSBean, TextField> tc9 = new TableColumn<>("参数代号");
|
|
|
|
|
|
|
|
tc9.setCellValueFactory(new PropertyValueFactory<QMSBean, TextField>("plmdesignation"));
|
|
|
|
|
|
|
|
tc9.prefWidthProperty().bind(table.widthProperty().multiply(0.1));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TableColumn<QMSBean, ComboBox<String>> tc10 = new TableColumn<>("规格位数(顺序)");
|
|
|
|
|
|
|
|
tc10.setCellValueFactory(new PropertyValueFactory<QMSBean, ComboBox<String>>("plmsequence"));
|
|
|
|
|
|
|
|
tc10.prefWidthProperty().bind(table.widthProperty().multiply(0.13));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TableColumn<QMSBean, String> tc11 = new TableColumn<>("检验项判定");
|
|
|
|
|
|
|
|
tc11.setCellValueFactory(new PropertyValueFactory<QMSBean, String>("result"));
|
|
|
|
|
|
|
|
tc11.prefWidthProperty().bind(table.widthProperty().multiply(0.13));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TableColumn<QMSBean, String> tc12 = new TableColumn<>("是否同步QMS");
|
|
|
|
|
|
|
|
tc12.setCellValueFactory(new PropertyValueFactory<QMSBean, String>("status"));
|
|
|
|
|
|
|
|
tc12.prefWidthProperty().bind(table.widthProperty().multiply(0.1));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TableColumn<QMSBean, String> tc13 = new TableColumn<>("保存时间");
|
|
|
|
|
|
|
|
tc13.setCellValueFactory(new PropertyValueFactory<QMSBean, String>("synctime"));
|
|
|
|
|
|
|
|
tc13.prefWidthProperty().bind(table.widthProperty().multiply(0.1));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TableColumn<QMSBean, String> tc14 = new TableColumn<>("修改账号");
|
|
|
|
|
|
|
|
tc14.setCellValueFactory(new PropertyValueFactory<QMSBean, String>("plmchangeuser"));
|
|
|
|
|
|
|
|
tc14.prefWidthProperty().bind(table.widthProperty().multiply(0.06));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//tc7.setCellFactory(TextFieldTableCell.forTableColumn()); // 设置单元格为可编辑
|
|
|
|
|
|
|
|
checkboxColumn.setEditable(isEdit);
|
|
|
|
|
|
|
|
tc7.setEditable(isEdit);
|
|
|
|
|
|
|
|
tc9.setEditable(isEdit);
|
|
|
|
|
|
|
|
tc10.setEditable(isEdit);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 把代码中定义的table列加入tableView
|
|
|
|
|
|
|
|
table.getColumns().addAll(checkboxColumn,tc1, tc2, tc3, tc4, tc5, tc6, tc7, tc8, tc9, tc10, tc11, tc12, tc13, tc14);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 设置文本框的高度
|
|
|
|
|
|
|
|
// jTextField1.setPrefHeight(30);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 表格列绑定bean对象
|
|
|
|
|
|
|
|
// tc_1.setSortable(false);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 列绑定bean对象
|
|
|
|
|
|
|
|
// tc_1.setCellValueFactory(new PropertyValueFactory<GzxqBean, TextArea>("xh"));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 设置table列宽度
|
|
|
|
|
|
|
|
// tc_1.prefWidthProperty().bind(table.widthProperty().multiply(0.04));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// //设置是否可编辑
|
|
|
|
|
|
|
|
// tc_1.setEditable(false);
|
|
|
|
|
|
|
|
// tc_2.setEditable(false);
|
|
|
|
|
|
|
|
// tc_3.setEditable(false);
|
|
|
|
|
|
|
|
// tc_4.setEditable(false);
|
|
|
|
|
|
|
|
// tc_5.setEditable(false);
|
|
|
|
|
|
|
|
// tc_6.setEditable(false);
|
|
|
|
|
|
|
|
// tc_7.setEditable(false);
|
|
|
|
|
|
|
|
// tc_8.setEditable(true);
|
|
|
|
|
|
|
|
// tc_9.setEditable(true);
|
|
|
|
|
|
|
|
// tc_10.setEditable(false);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// tableView.setMaxHeight(pageNum);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cx();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* @param frame
|
|
|
|
|
|
|
|
* @function 添加页面的监听
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
private void addWindListener(QMSFrame frame) {
|
|
|
|
|
|
|
|
// TODO Auto-generated method stub
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
frame.addComponentListener(new ComponentListener() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void componentShown(ComponentEvent e) {
|
|
|
|
|
|
|
|
// TODO Auto-generated method stub
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 最大化时把pane也设置大
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void componentResized(ComponentEvent e) {
|
|
|
|
|
|
|
|
// TODO Auto-generated method stub
|
|
|
|
|
|
|
|
System.out.println("==============");
|
|
|
|
|
|
|
|
Component component = e.getComponent();
|
|
|
|
|
|
|
|
//System.out.println("component==>" + component);
|
|
|
|
|
|
|
|
double width = component.getSize().getWidth();
|
|
|
|
|
|
|
|
double hight = component.getSize().getHeight();
|
|
|
|
|
|
|
|
paneWidth = pane.getWidth();
|
|
|
|
|
|
|
|
paneHight = pane.getHeight();
|
|
|
|
|
|
|
|
double widthxs = width/paneWidth;
|
|
|
|
|
|
|
|
double hightxs = hight/paneHight;
|
|
|
|
|
|
|
|
//System.out.println("Widthxs============"+widthxs);
|
|
|
|
|
|
|
|
// // double width = primaryStage.getWidth();
|
|
|
|
|
|
|
|
System.out.println("width=============>" + width);
|
|
|
|
|
|
|
|
System.out.println("pane==========="+pane.getWidth());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
System.out.println("pane1==========="+pane1.getWidth());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
System.out.println("scroll==========="+scroll.getWidth());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
System.out.println("table==========="+table.getWidth());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pane.setPrefWidth(width * 0.98);
|
|
|
|
|
|
|
|
pane.setPrefHeight(hight * 0.98);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pane1.setPrefWidth(width * 0.98);
|
|
|
|
|
|
|
|
//pane1.setPrefHeight(hight * 0.98);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
scroll.setPrefWidth(width * 0.96);
|
|
|
|
|
|
|
|
scroll.setPrefHeight((hight - 110) * 0.96);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
table.setPrefWidth(width * 0.95);
|
|
|
|
|
|
|
|
table.setPrefHeight((hight - 110) * 0.95);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
System.out.println("width2=============>" + width);
|
|
|
|
|
|
|
|
System.out.println("pane=2=========="+pane.getWidth());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
System.out.println("pane1==2========="+pane1.getWidth());
|
|
|
|
|
|
|
|
System.out.println("scroll==2========="+scroll.getWidth());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
System.out.println("table==2========="+table.getWidth());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// scroll.setPrefWidth(scroll.getWidth() * widthxs);
|
|
|
|
|
|
|
|
// scroll.setPrefHeight(scroll.getHeight() * hightxs);
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// pane1.setPrefWidth(pane1.getWidth() * widthxs);
|
|
|
|
|
|
|
|
// pane1.setPrefHeight(pane1.getHeight() * hightxs);
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//grid.setPrefWidth(width * 0.98);
|
|
|
|
|
|
|
|
//gridTop.setPrefWidth(width * 0.98);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// table.setPrefWidth(table.getWidth() * widthxs);
|
|
|
|
|
|
|
|
// table.setPrefHeight(table.getHeight() * hightxs);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void componentMoved(ComponentEvent e) {
|
|
|
|
|
|
|
|
// TODO Auto-generated method stub
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void componentHidden(ComponentEvent e) {
|
|
|
|
|
|
|
|
// TODO Auto-generated method stub
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 重置
|
|
|
|
|
|
|
|
@FXML
|
|
|
|
|
|
|
|
void czAction(ActionEvent event) {
|
|
|
|
|
|
|
|
c1.setSelected(false);
|
|
|
|
|
|
|
|
c2.setSelected(false);
|
|
|
|
|
|
|
|
c3.setSelected(false);
|
|
|
|
|
|
|
|
f1.setText("");
|
|
|
|
|
|
|
|
f2.setText("");
|
|
|
|
|
|
|
|
f3.setText("");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//查询
|
|
|
|
|
|
|
|
@FXML
|
|
|
|
|
|
|
|
void cxAction(ActionEvent event) throws TCException {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// SqlUtil.SRMGetTCDataConnection(prefs);
|
|
|
|
|
|
|
|
// //判断该用户是否有权限编辑界面
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// System.out.println("======================清除");
|
|
|
|
|
|
|
|
// table.getItems().clear();
|
|
|
|
|
|
|
|
// List<QMSBean> quotations = new ArrayList<QMSBean>();
|
|
|
|
|
|
|
|
// // 拼接查询语句
|
|
|
|
|
|
|
|
// String sql = "select * from CHINT_QMS_INSPECIFICATION_CODE_RULE where 1=1 ";
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// if (f1.getText() != null && !"".equals(f1.getText().trim())) {
|
|
|
|
|
|
|
|
// sql += "and \"qmsinspectioncode\" like '%" + f1.getText() + "%'";
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// if (f2.getText() != null && !"".equals(f2.getText().trim())) {
|
|
|
|
|
|
|
|
// sql += "and \"qmsinspectionname\" like '%" + f2.getText() + "%'";
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// if (f3.getText() != null && !"".equals(f3.getText().trim())) {
|
|
|
|
|
|
|
|
// sql += "and \"plmdesignation\" like '%" + f3.getText() + "%'";
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// if (c1.isSelected()) {
|
|
|
|
|
|
|
|
// sql += "and \"synctime\" is null";
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// if (c2.isSelected()) {
|
|
|
|
|
|
|
|
// sql += "and \"plmvaluetype\" = '参数化' ";
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// if (c2.isSelected()) {
|
|
|
|
|
|
|
|
// sql += "and \"plmvaluetype\" != '参数化' ";
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// sql += "order by \"qmsinspectioncode\" desc";
|
|
|
|
|
|
|
|
// System.out.println("sql:" + sql);
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
//// this.plmvaluetype.textProperty().addListener((observable, oldValue, newValue) -> {
|
|
|
|
|
|
|
|
//// System.out.println("Text changed from '" + oldValue + "' to '" + newValue + "'");
|
|
|
|
|
|
|
|
//// this.table.setRowFactory(tv -> {
|
|
|
|
|
|
|
|
//// TableRow<QMSBean> row = new TableRow<>();
|
|
|
|
|
|
|
|
//// row.itemProperty().addListener((obs, previousItem, newItem) -> {
|
|
|
|
|
|
|
|
//// QMSBean qmsBean = row.getItem();
|
|
|
|
|
|
|
|
//// System.out.println("newItem========================="+qmsBean);
|
|
|
|
|
|
|
|
//// if(qmsBean.getPlmvaluetype().getText().equals(oldValue)) {
|
|
|
|
|
|
|
|
//// String xh = qmsBean.getXh();
|
|
|
|
|
|
|
|
//// qmsBean.setRed(true);
|
|
|
|
|
|
|
|
//// System.out.println("xh==============="+xh);
|
|
|
|
|
|
|
|
//// if (qmsBean != null && qmsBean.isRed()) {
|
|
|
|
|
|
|
|
//// // 当行中有数据时设置样式
|
|
|
|
|
|
|
|
//// row.setStyle("-fx-background-color: red;");
|
|
|
|
|
|
|
|
//// } else {
|
|
|
|
|
|
|
|
//// // 当行为空时恢复默认样式
|
|
|
|
|
|
|
|
//// row.setStyle("");
|
|
|
|
|
|
|
|
//// }
|
|
|
|
|
|
|
|
//// }
|
|
|
|
|
|
|
|
////
|
|
|
|
|
|
|
|
//// });
|
|
|
|
|
|
|
|
//// return row ;
|
|
|
|
|
|
|
|
//// });
|
|
|
|
|
|
|
|
////
|
|
|
|
|
|
|
|
//// });
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// try {
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// ResultSet res = SqlUtil.read(sql);
|
|
|
|
|
|
|
|
// // 处理查询数据结果集
|
|
|
|
|
|
|
|
// int xh = 1;
|
|
|
|
|
|
|
|
// while (res.next()) {
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// QMSBean QMSBean = new QMSBean(isEdit, (Integer) res.getInt("code"), xh + "",
|
|
|
|
|
|
|
|
// res.getString("qmsinspectioncode") != null ? res.getString("qmsinspectioncode") : "",
|
|
|
|
|
|
|
|
// res.getString("qmsinspectionname") != null ? res.getString("qmsinspectionname") : "",
|
|
|
|
|
|
|
|
// res.getString("qmssuperiorinspectionname") != null ? res.getString("qmssuperiorinspectionname"): "",
|
|
|
|
|
|
|
|
// res.getString("qmsinspectionschemename") != null ? res.getString("qmsinspectionschemename"): "",
|
|
|
|
|
|
|
|
// res.getString("qmspushuser") != null ? res.getString("qmspushuser") : "",
|
|
|
|
|
|
|
|
// res.getString("plmvaluetype") != null ? res.getString("plmvaluetype") : "" ,
|
|
|
|
|
|
|
|
// res.getString("plminspectioncode") != null ? res.getString("plminspectioncode") : "",
|
|
|
|
|
|
|
|
// res.getString("plmdesignation") != null ? res.getString("plmdesignation") : "",
|
|
|
|
|
|
|
|
// res.getString("plmsequence") != null ? res.getString("plmsequence") : "",
|
|
|
|
|
|
|
|
// res.getString("result") != null ? res.getString("result") : "",
|
|
|
|
|
|
|
|
// res.getString("status") != null ? res.getString("status") : "",
|
|
|
|
|
|
|
|
// res.getDate("plmchangetime"),
|
|
|
|
|
|
|
|
// res.getString("plmchangeuser") != null ? res.getString("plmchangeuser") : "");
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// System.out.println("QMSBean===" + QMSBean);
|
|
|
|
|
|
|
|
// quotations.add(QMSBean);
|
|
|
|
|
|
|
|
// xh++;
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// } catch (Exception e) {
|
|
|
|
|
|
|
|
// // TODO: handle exception
|
|
|
|
|
|
|
|
// e.printStackTrace();
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// if (quotations.size() > 0) {
|
|
|
|
|
|
|
|
// // 组织界面数据
|
|
|
|
|
|
|
|
// data = FXCollections.observableArrayList(quotations);
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// table.getItems().clear();
|
|
|
|
|
|
|
|
// table.setItems(data);
|
|
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
|
|
// // 未查到数据
|
|
|
|
|
|
|
|
// Alert alert = new Alert(AlertType.INFORMATION);
|
|
|
|
|
|
|
|
// alert.setTitle("提示");
|
|
|
|
|
|
|
|
// alert.setHeaderText("未查到数据!");
|
|
|
|
|
|
|
|
// // alert.setContentText("导入完成");
|
|
|
|
|
|
|
|
// alert.showAndWait();
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
cx();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void cx(){
|
|
|
|
|
|
|
|
SqlUtil.SRMGetTCDataConnection(prefs);
|
|
|
|
|
|
|
|
//判断该用户是否有权限编辑界面
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
System.out.println("======================清除");
|
|
|
|
|
|
|
|
table.getItems().clear();
|
|
|
|
|
|
|
|
List<QMSBean> quotations = new ArrayList<QMSBean>();
|
|
|
|
|
|
|
|
// 拼接查询语句
|
|
|
|
|
|
|
|
String sql = "";
|
|
|
|
|
|
|
|
if(isAdmin) {
|
|
|
|
|
|
|
|
sql = "select * from CHINT_QMS_INSPECIFICATION_CODE_RULE where 1=1 ";
|
|
|
|
|
|
|
|
}else {
|
|
|
|
|
|
|
|
sql = "select * from CHINT_QMS_INSPECIFICATION_CODE_RULE where \"factory\"='"+factory+"' ";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (f1.getText() != null && !"".equals(f1.getText().trim())) {
|
|
|
|
|
|
|
|
sql += " and \"qmsinspectioncode\" like '%" + f1.getText() + "%'";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (f2.getText() != null && !"".equals(f2.getText().trim())) {
|
|
|
|
|
|
|
|
sql += " and \"qmsinspectionname\" like '%" + f2.getText() + "%'";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (f3.getText() != null && !"".equals(f3.getText().trim())) {
|
|
|
|
|
|
|
|
sql += " and \"plmdesignation\" like '%" + f3.getText() + "%'";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (c1.isSelected()) {
|
|
|
|
|
|
|
|
sql += " and \"plminspectioncode\" is null";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (c2.isSelected()) {
|
|
|
|
|
|
|
|
sql += " and \"plmvaluetype\" = '参数化' ";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (c3.isSelected()) {
|
|
|
|
|
|
|
|
sql += " and \"plmvaluetype\" != '参数化' ";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sql += " order by \"qmsinspectioncode\" desc";
|
|
|
|
|
|
|
|
System.out.println("sql:" + sql);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// this.plmvaluetype.textProperty().addListener((observable, oldValue, newValue) -> {
|
|
|
|
|
|
|
|
// System.out.println("Text changed from '" + oldValue + "' to '" + newValue + "'");
|
|
|
|
|
|
|
|
// this.table.setRowFactory(tv -> {
|
|
|
|
|
|
|
|
// TableRow<QMSBean> row = new TableRow<>();
|
|
|
|
|
|
|
|
// row.itemProperty().addListener((obs, previousItem, newItem) -> {
|
|
|
|
|
|
|
|
// QMSBean qmsBean = row.getItem();
|
|
|
|
|
|
|
|
// System.out.println("newItem========================="+qmsBean);
|
|
|
|
|
|
|
|
// if(qmsBean.getPlmvaluetype().getText().equals(oldValue)) {
|
|
|
|
|
|
|
|
// String xh = qmsBean.getXh();
|
|
|
|
|
|
|
|
// qmsBean.setRed(true);
|
|
|
|
|
|
|
|
// System.out.println("xh==============="+xh);
|
|
|
|
|
|
|
|
// if (qmsBean != null && qmsBean.isRed()) {
|
|
|
|
|
|
|
|
// // 当行中有数据时设置样式
|
|
|
|
|
|
|
|
// row.setStyle("-fx-background-color: red;");
|
|
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
|
|
// // 当行为空时恢复默认样式
|
|
|
|
|
|
|
|
// row.setStyle("");
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
// return row ;
|
|
|
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ResultSet res = SqlUtil.read(sql);
|
|
|
|
|
|
|
|
// 处理查询数据结果集
|
|
|
|
|
|
|
|
int xh = 1;
|
|
|
|
|
|
|
|
while (res.next()) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QMSBean QMSBean = new QMSBean(isEdit, (Integer) res.getInt("code"), xh + "",
|
|
|
|
|
|
|
|
res.getString("qmsinspectioncode") != null ? res.getString("qmsinspectioncode") : "",
|
|
|
|
|
|
|
|
res.getString("qmsinspectionname") != null ? res.getString("qmsinspectionname") : "",
|
|
|
|
|
|
|
|
res.getString("qmssuperiorinspectionname") != null ? res.getString("qmssuperiorinspectionname"): "",
|
|
|
|
|
|
|
|
res.getString("qmsinspectionschemename") != null ? res.getString("qmsinspectionschemename"): "",
|
|
|
|
|
|
|
|
res.getString("qmspushuser") != null ? res.getString("qmspushuser") : "",
|
|
|
|
|
|
|
|
res.getString("plmvaluetype") != null ? res.getString("plmvaluetype") : "" ,
|
|
|
|
|
|
|
|
res.getString("plminspectioncode") != null ? res.getString("plminspectioncode") : "",
|
|
|
|
|
|
|
|
res.getString("plmdesignation") != null ? res.getString("plmdesignation") : "",
|
|
|
|
|
|
|
|
res.getString("plmsequence") != null ? res.getString("plmsequence") : "",
|
|
|
|
|
|
|
|
res.getString("result") != null ? res.getString("result") : "",
|
|
|
|
|
|
|
|
res.getString("status") != null ? res.getString("status") : "",
|
|
|
|
|
|
|
|
res.getDate("plmchangetime"),
|
|
|
|
|
|
|
|
res.getString("plmchangeuser") != null ? res.getString("plmchangeuser") : "");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
System.out.println("QMSBean===" + QMSBean);
|
|
|
|
|
|
|
|
quotations.add(QMSBean);
|
|
|
|
|
|
|
|
xh++;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
|
|
// TODO: handle exception
|
|
|
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (quotations.size() > 0) {
|
|
|
|
|
|
|
|
// 组织界面数据
|
|
|
|
|
|
|
|
data = FXCollections.observableArrayList(quotations);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
table.getItems().clear();
|
|
|
|
|
|
|
|
table.setItems(data);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Platform.runLater(new Runnable() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void run() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 未查到数据
|
|
|
|
|
|
|
|
Alert alert = new Alert(AlertType.INFORMATION);
|
|
|
|
|
|
|
|
alert.setTitle("提示");
|
|
|
|
|
|
|
|
alert.setHeaderText("未查到数据!");
|
|
|
|
|
|
|
|
// alert.setContentText("导入完成");
|
|
|
|
|
|
|
|
alert.showAndWait();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//保存
|
|
|
|
|
|
|
|
@FXML
|
|
|
|
|
|
|
|
void bcAction(ActionEvent event) throws TCException {
|
|
|
|
|
|
|
|
ObservableList<QMSBean> items = table.getItems();
|
|
|
|
|
|
|
|
SqlUtil.SRMGetTCDataConnection(prefs);
|
|
|
|
|
|
|
|
String factory = SAPUtil.getGroupID(session);
|
|
|
|
|
|
|
|
int count = 0;
|
|
|
|
|
|
|
|
//保存之前循环判断值
|
|
|
|
|
|
|
|
for (int i = 0; i < items.size(); i++) {
|
|
|
|
|
|
|
|
QMSBean qmsBean = items.get(i);
|
|
|
|
|
|
|
|
boolean selected = qmsBean.getCheckBox().isSelected();
|
|
|
|
|
|
|
|
if(selected) {
|
|
|
|
|
|
|
|
String plmvaluetype = qmsBean.getPlmvaluetype().getValue() == null || qmsBean.getPlmvaluetype().getValue().isEmpty() ?"":qmsBean.getPlmvaluetype().getValue();
|
|
|
|
|
|
|
|
String plmdesignation =qmsBean.getPlmdesignation().getText() == null || qmsBean.getPlmdesignation().getText().isEmpty() ? "" : qmsBean.getPlmdesignation().getText();
|
|
|
|
|
|
|
|
String plmsequence =qmsBean.getPlmsequence().getValue() == null || qmsBean.getPlmsequence().getValue().isEmpty() ? "" : qmsBean.getPlmsequence().getValue();
|
|
|
|
|
|
|
|
if(plmvaluetype.equals("参数化") && plmdesignation.isEmpty()) {
|
|
|
|
|
|
|
|
Alert alert = new Alert(AlertType.INFORMATION);
|
|
|
|
|
|
|
|
alert.setTitle("提示");
|
|
|
|
|
|
|
|
alert.setHeaderText("第"+qmsBean.getXh()+"行的参数代号不能为空!");
|
|
|
|
|
|
|
|
//alert.setContentText("导入完成");
|
|
|
|
|
|
|
|
alert.showAndWait();
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}else if(plmvaluetype.contains("规格") && plmsequence.isEmpty()){
|
|
|
|
|
|
|
|
Alert alert = new Alert(AlertType.INFORMATION);
|
|
|
|
|
|
|
|
alert.setTitle("提示");
|
|
|
|
|
|
|
|
alert.setHeaderText("第"+qmsBean.getXh()+"行的规格位数(顺序)不能为空!");
|
|
|
|
|
|
|
|
//alert.setContentText("导入完成");
|
|
|
|
|
|
|
|
alert.showAndWait();
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < items.size(); i++) {
|
|
|
|
|
|
|
|
QMSBean qmsBean = items.get(i);
|
|
|
|
|
|
|
|
boolean selected = qmsBean.getCheckBox().isSelected();
|
|
|
|
|
|
|
|
if(selected) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//判断检验项编码是否为空 为空数据库获取流水号
|
|
|
|
|
|
|
|
String plminspectioncode = "";
|
|
|
|
|
|
|
|
plminspectioncode = qmsBean.getPlminspectioncode();
|
|
|
|
|
|
|
|
if(plminspectioncode == null || plminspectioncode.isEmpty()) {
|
|
|
|
|
|
|
|
//取数据库获取流水号
|
|
|
|
|
|
|
|
SqlUtil.SRMGetTCDataConnection(prefs);
|
|
|
|
|
|
|
|
String selectLSH = "select \"code\" from CHINT_QMS_INSPECIFICATION_NUMBER_RULE where \"factory\" = '"+factory+"'";
|
|
|
|
|
|
|
|
String lsh = "";
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ResultSet res = SqlUtil.read(selectLSH);
|
|
|
|
|
|
|
|
// 处理查询数据结果集
|
|
|
|
|
|
|
|
while (res.next()) {
|
|
|
|
|
|
|
|
lsh = res.getString(1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}catch (Exception e) {
|
|
|
|
|
|
|
|
// TODO: handle exception
|
|
|
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(lsh == null || lsh.isEmpty()) {
|
|
|
|
|
|
|
|
// 获取流水号的首选项
|
|
|
|
|
|
|
|
String[] lsmPref = session.getPreferenceService().getStringValues("CHINT_QMS_INSPECIFICATION_NUMBER_RULE");
|
|
|
|
|
|
|
|
// 获取对应组织的流水码
|
|
|
|
|
|
|
|
for (int z = 0; z < lsmPref.length; z++) {
|
|
|
|
|
|
|
|
String[] split = lsmPref[z].split(":");
|
|
|
|
|
|
|
|
// 判断当前组织与首选项是否相同
|
|
|
|
|
|
|
|
if (split[0].equals(factory)) {
|
|
|
|
|
|
|
|
lsh = split[1];
|
|
|
|
|
|
|
|
SqlUtil.SRMGetTCDataConnection(prefs);
|
|
|
|
|
|
|
|
//数据库中插入
|
|
|
|
|
|
|
|
String updateSql = "INSERT INTO CHINT_QMS_INSPECIFICATION_NUMBER_RULE (\"factory\",\"code\",\"flow\") VALUES ('"
|
|
|
|
|
|
|
|
+ factory + "','" + lsh + "','" + lsh +"')";
|
|
|
|
|
|
|
|
System.out.println("updateSql========"+updateSql);
|
|
|
|
|
|
|
|
SqlUtil.update(updateSql);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
plminspectioncode = lsh;
|
|
|
|
|
|
|
|
}else {
|
|
|
|
|
|
|
|
//流水号+1
|
|
|
|
|
|
|
|
// 正则表达式,匹配所有的字母和数字
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Pattern pattern = Pattern.compile("(\\D+)(\\d+)");
|
|
|
|
|
|
|
|
Matcher matcher = pattern.matcher(lsh);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (matcher.find()) {
|
|
|
|
|
|
|
|
String alphaPart = matcher.group(1); // 字母部分
|
|
|
|
|
|
|
|
String numericPartStr = matcher.group(2); // 数字部分字符串
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 将数字部分转换为整数,加1,再转回字符串
|
|
|
|
|
|
|
|
int numericPartInt = Integer.parseInt(numericPartStr);
|
|
|
|
|
|
|
|
numericPartInt++; // 加1
|
|
|
|
|
|
|
|
String newNumericPart = String.format("%0" + numericPartStr.length() + "d",
|
|
|
|
|
|
|
|
numericPartInt); // 保持原数字的长度,前面补0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 重新拼接字符串
|
|
|
|
|
|
|
|
lsh = alphaPart + newNumericPart;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
System.out.println("新组成的字符串: " + lsh);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
System.out.println("未在字符串中找到符合模式的部分。");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// 流水码+1 //设置流水号到数据库
|
|
|
|
|
|
|
|
SqlUtil.SRMGetTCDataConnection(prefs);
|
|
|
|
|
|
|
|
if (!lsh.isEmpty()) {
|
|
|
|
|
|
|
|
String updateSql = "update CHINT_QMS_INSPECIFICATION_NUMBER_RULE set \"code\" = '"+lsh+"' where \"factory\" = '"+factory+"'";
|
|
|
|
|
|
|
|
System.out.println("updateSql========"+updateSql);
|
|
|
|
|
|
|
|
SqlUtil.update(updateSql);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
plminspectioncode = lsh;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
count++;
|
|
|
|
|
|
|
|
//保存操作
|
|
|
|
|
|
|
|
String plmvaluetype = qmsBean.getPlmvaluetype().getValue() == null || qmsBean.getPlmvaluetype().getValue().isEmpty() ?"":qmsBean.getPlmvaluetype().getValue();
|
|
|
|
|
|
|
|
String plmdesignation =qmsBean.getPlmdesignation().getText() == null || qmsBean.getPlmdesignation().getText().isEmpty() ? "" : qmsBean.getPlmdesignation().getText();
|
|
|
|
|
|
|
|
String plmsequence =qmsBean.getPlmsequence().getValue() == null || qmsBean.getPlmsequence().getValue().isEmpty() ? "" : qmsBean.getPlmsequence().getValue();
|
|
|
|
|
|
|
|
String sql = "update CHINT_QMS_INSPECIFICATION_CODE_RULE set \"plmvaluetype\" = '"+plmvaluetype
|
|
|
|
|
|
|
|
+"',\"plmdesignation\" = '"+plmdesignation
|
|
|
|
|
|
|
|
+"',\"plmsequence\" = '"+plmsequence
|
|
|
|
|
|
|
|
+"',\"plminspectioncode\" = '"+ plminspectioncode +"' where \"code\"='"+qmsBean.getCode()+"'";
|
|
|
|
|
|
|
|
System.out.println("sql ========================"+sql);
|
|
|
|
|
|
|
|
SqlUtil.update(sql);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(count == 0) {
|
|
|
|
|
|
|
|
Alert alert = new Alert(AlertType.INFORMATION);
|
|
|
|
|
|
|
|
alert.setTitle("提示");
|
|
|
|
|
|
|
|
alert.setHeaderText("请勾选数据!");
|
|
|
|
|
|
|
|
//alert.setContentText("导入完成");
|
|
|
|
|
|
|
|
alert.showAndWait();
|
|
|
|
|
|
|
|
}else {
|
|
|
|
|
|
|
|
Alert alert = new Alert(AlertType.INFORMATION);
|
|
|
|
|
|
|
|
alert.setTitle("提示");
|
|
|
|
|
|
|
|
alert.setHeaderText("项目保存完成!");
|
|
|
|
|
|
|
|
//alert.setContentText("导入完成");
|
|
|
|
|
|
|
|
alert.showAndWait();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|