Compare commits

...

6 Commits

6
.gitignore vendored

@ -0,0 +1,6 @@
/bin/
/.idea/
/.metadata/
/com.connor.chint.sap2/bin/
/com.connor.chint.sap2/.settings
RemoteSystemsTempFiles/*

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<classpath> <classpath>
<classpathentry exported="true" kind="lib" path="json_lib/jfxrt.jar"/>
<classpathentry exported="true" kind="lib" path="poi/okhttp-2.7.4.jar"/> <classpathentry exported="true" kind="lib" path="poi/okhttp-2.7.4.jar"/>
<classpathentry exported="true" kind="lib" path="json_lib/JavaFx-DateTimePicker-0.0.1.jar"/> <classpathentry exported="true" kind="lib" path="json_lib/JavaFx-DateTimePicker-0.0.1.jar"/>
<classpathentry exported="true" kind="lib" path="json_lib/jfxrt.jar"/>
<classpathentry exported="true" kind="lib" path="json_lib/commons-beanutils-1.7.0.jar"/> <classpathentry exported="true" kind="lib" path="json_lib/commons-beanutils-1.7.0.jar"/>
<classpathentry exported="true" kind="lib" path="json_lib/commons-collections-3.2.jar"/> <classpathentry exported="true" kind="lib" path="json_lib/commons-collections-3.2.jar"/>
<classpathentry exported="true" kind="lib" path="json_lib/commons-lang-2.4.jar"/> <classpathentry exported="true" kind="lib" path="json_lib/commons-lang-2.4.jar"/>

@ -113,6 +113,6 @@ Bundle-ClassPath: .,
poi/woden-impl-dom-1.0M9.jar, poi/woden-impl-dom-1.0M9.jar,
poi/wsdl4j-1.6.2.jar, poi/wsdl4j-1.6.2.jar,
poi/wstx-asl-3.2.9.jar, poi/wstx-asl-3.2.9.jar,
json_lib/jfxrt.jar,
json_lib/JavaFx-DateTimePicker-0.0.1.jar, json_lib/JavaFx-DateTimePicker-0.0.1.jar,
poi/okhttp-2.7.4.jar poi/okhttp-2.7.4.jar,
json_lib/jfxrt.jar

@ -10,7 +10,7 @@
<StackPane fx:id="stackPane" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="800.0" prefWidth="1200.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.chint.plm.SearchSapResult.DetailsController"> <StackPane fx:id="stackPane" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="800.0" prefWidth="1200.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.chint.plm.SearchSapResult.DetailsController">
<children> <children>
<GridPane> <GridPane fx:id="girdPane">
<columnConstraints> <columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" /> <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
</columnConstraints> </columnConstraints>
@ -20,14 +20,14 @@
<RowConstraints maxHeight="100.0" minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" /> <RowConstraints maxHeight="100.0" minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
</rowConstraints> </rowConstraints>
<children> <children>
<FlowPane alignment="TOP_CENTER" prefHeight="200.0" prefWidth="200.0" style="-fx-padding: 5;"> <FlowPane fx:id="flowPane" alignment="TOP_CENTER" prefHeight="200.0" prefWidth="200.0" style="-fx-padding: 5;">
<children> <children>
<CheckBox fx:id="cb_errBtn" mnemonicParsing="false" onAction="#errBtnAction" text="仅显示错误数据" /> <CheckBox fx:id="cb_errBtn" mnemonicParsing="false" onAction="#errBtnAction" text="仅显示错误数据" />
</children> </children>
</FlowPane> </FlowPane>
<ScrollPane prefHeight="1200.0" prefWidth="1200.0" style="-fx-padding: 5;" GridPane.rowIndex="1"> <ScrollPane fx:id="scrollPane" prefHeight="1200.0" prefWidth="1200.0" style="-fx-padding: 5;" GridPane.rowIndex="1">
<content> <content>
<TableView fx:id="tableView" prefHeight="700.0" prefWidth="1190.0" style="-fx-faint-focus-color: transparent;"> <TableView fx:id="tableView" prefHeight="660.0" prefWidth="1180.0" style="-fx-faint-focus-color: transparent;">
<columns> <columns>
<TableColumn fx:id="tc_xh" prefWidth="75.0" text="序号" /> <TableColumn fx:id="tc_xh" prefWidth="75.0" text="序号" />
<TableColumn fx:id="tc_batch" prefWidth="75.0" text="批次号" /> <TableColumn fx:id="tc_batch" prefWidth="75.0" text="批次号" />
@ -65,7 +65,7 @@
<right> <right>
<FlowPane alignment="TOP_CENTER" prefHeight="140.0" prefWidth="589.0" BorderPane.alignment="CENTER"> <FlowPane alignment="TOP_CENTER" prefHeight="140.0" prefWidth="589.0" BorderPane.alignment="CENTER">
<children> <children>
<TextField alignment="TOP_RIGHT" prefHeight="30.0" prefWidth="154.0" text="1" /> <TextField fx:id="pageNumTxt" alignment="TOP_RIGHT" prefHeight="30.0" prefWidth="154.0" text="1" />
<Label fx:id="lb_page" prefWidth="80.0" text="/" /> <Label fx:id="lb_page" prefWidth="80.0" text="/" />
<Button mnemonicParsing="false" onAction="#outputAction" text="结果导出" /> <Button mnemonicParsing="false" onAction="#outputAction" text="结果导出" />
</children> </children>

@ -10,9 +10,9 @@
<StackPane fx:id="stackPane" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="1600.0" prefWidth="1200.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.chint.plm.SearchSapResult.SearchSapController"> <StackPane fx:id="stackPane" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="1600.0" prefWidth="1200.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.chint.plm.SearchSapResult.SearchSapController">
<children> <children>
<ScrollPane prefHeight="200.0"> <ScrollPane fx:id="scrollPane" prefHeight="200.0">
<content> <content>
<BorderPane prefHeight="200.0" prefWidth="200.0"> <BorderPane fx:id="topBorder" prefHeight="200.0" prefWidth="200.0">
<top> <top>
<TitledPane fx:id="tp_sxtj" prefHeight="650.0" text="筛选条件" BorderPane.alignment="CENTER"> <TitledPane fx:id="tp_sxtj" prefHeight="650.0" text="筛选条件" BorderPane.alignment="CENTER">
<padding> <padding>
@ -114,9 +114,9 @@
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" /> <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
</rowConstraints> </rowConstraints>
<children> <children>
<Button fx:id="bt_close" mnemonicParsing="false" text="关闭" GridPane.columnIndex="3" /> <Button fx:id="bt_close" mnemonicParsing="false" onAction="#closeClick" text="关闭" GridPane.columnIndex="3" />
<Button fx:id="bt_search" mnemonicParsing="false" onAction="#searchAction" text="查询" GridPane.columnIndex="1" /> <Button fx:id="bt_search" mnemonicParsing="false" onAction="#searchAction" text="查询" GridPane.columnIndex="1" />
<Button fx:id="bt_czcx" mnemonicParsing="false" text="重置查询" GridPane.columnIndex="2" /> <Button fx:id="bt_czcx" mnemonicParsing="false" onAction="#resetClick" text="重置查询" GridPane.columnIndex="2" />
</children> </children>
</GridPane> </GridPane>
</bottom> </bottom>
@ -125,7 +125,7 @@
</TitledPane> </TitledPane>
</top> </top>
<center> <center>
<BorderPane prefHeight="800.0" prefWidth="1200.0" BorderPane.alignment="CENTER"> <BorderPane fx:id="resultBorder" prefHeight="800.0" prefWidth="1200.0" BorderPane.alignment="CENTER">
<top> <top>
<TitledPane fx:id="tp_result" prefHeight="600.0" prefWidth="200.0" text="结果" BorderPane.alignment="CENTER"> <TitledPane fx:id="tp_result" prefHeight="600.0" prefWidth="200.0" text="结果" BorderPane.alignment="CENTER">
<padding> <padding>

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<?import tornadofx.control.*?>
<?import java.lang.*?> <?import java.lang.*?>
<?import javafx.geometry.*?> <?import javafx.geometry.*?>
<?import javafx.scene.control.*?> <?import javafx.scene.control.*?>
@ -27,7 +26,7 @@
<FlowPane alignment="CENTER_LEFT" hgap="12.0" prefHeight="80.0" prefWidth="400.0" style="-fx-border-color: black;" BorderPane.alignment="CENTER"> <FlowPane alignment="CENTER_LEFT" hgap="12.0" prefHeight="80.0" prefWidth="400.0" style="-fx-border-color: black;" BorderPane.alignment="CENTER">
<children> <children>
<Label text="单位:" /> <Label text="单位:" />
<TextField /> <TextField fx:id="factoryText" />
</children> </children>
<BorderPane.margin> <BorderPane.margin>
<Insets /> <Insets />
@ -87,13 +86,10 @@
<Insets left="5.0" /> <Insets left="5.0" />
</padding> </padding>
</FlowPane> </FlowPane>
<FlowPane alignment="CENTER_LEFT" hgap="15.0" prefHeight="200.0" prefWidth="200.0" GridPane.rowIndex="1"> <FlowPane alignment="CENTER_LEFT" hgap="100.0" prefHeight="200.0" prefWidth="200.0" GridPane.rowIndex="1">
<children> <children>
<RadioButton fx:id="rb_product" mnemonicParsing="false" text="产品" /> <RadioButton fx:id="rb_product" mnemonicParsing="false" text="产品" />
<Label text="产品特性:" /> <RadioButton fx:id="rb_Process" mnemonicParsing="false" text="过程" />
<RadioButton mnemonicParsing="false" text="A" />
<RadioButton mnemonicParsing="false" text="B" />
<RadioButton mnemonicParsing="false" text="C" />
</children> </children>
<GridPane.margin> <GridPane.margin>
<Insets /> <Insets />
@ -103,13 +99,6 @@
</padding> </padding>
</FlowPane> </FlowPane>
<FlowPane alignment="CENTER_LEFT" hgap="15.0" prefHeight="200.0" prefWidth="200.0" GridPane.columnIndex="1" GridPane.rowIndex="1"> <FlowPane alignment="CENTER_LEFT" hgap="15.0" prefHeight="200.0" prefWidth="200.0" GridPane.columnIndex="1" GridPane.rowIndex="1">
<children>
<RadioButton fx:id="rb_Process" mnemonicParsing="false" text="过程" />
<Label text="过程特性:" />
<RadioButton mnemonicParsing="false" text="A" />
<RadioButton mnemonicParsing="false" text="B" />
<RadioButton mnemonicParsing="false" text="C" />
</children>
<padding> <padding>
<Insets left="5.0" /> <Insets left="5.0" />
</padding> </padding>
@ -266,7 +255,7 @@
</TitledPane> </TitledPane>
<FlowPane alignment="TOP_CENTER" hgap="40.0" prefHeight="200.0" prefWidth="200.0" GridPane.rowIndex="1"> <FlowPane alignment="TOP_CENTER" hgap="40.0" prefHeight="200.0" prefWidth="200.0" GridPane.rowIndex="1">
<children> <children>
<Button mnemonicParsing="false" onAction="#createClick" text="确定" /> <Button fx:id="createBtn" mnemonicParsing="false" onAction="#createClick" text="确定" />
<Button alignment="CENTER" mnemonicParsing="false" onAction="#disposeClick" text="取消" /> <Button alignment="CENTER" mnemonicParsing="false" onAction="#disposeClick" text="取消" />
</children> </children>
<GridPane.margin> <GridPane.margin>

@ -81,6 +81,6 @@ bin.includes = plugin.xml,\
json_lib/json-lib-2.2.2-jdk15.jar,\ json_lib/json-lib-2.2.2-jdk15.jar,\
json_lib/json-lib-2.2.3-jdk13.jar,\ json_lib/json-lib-2.2.3-jdk13.jar,\
json_lib/xom-1.2.5.jar,\ json_lib/xom-1.2.5.jar,\
json_lib/jfxrt.jar,\
json_lib/JavaFx-DateTimePicker-0.0.1.jar,\ json_lib/JavaFx-DateTimePicker-0.0.1.jar,\
poi/okhttp-2.7.4.jar poi/okhttp-2.7.4.jar,\
json_lib/jfxrt.jar

@ -65,27 +65,27 @@
</menuContribution> </menuContribution>
<menuContribution locationURI="menu:com.connor.chint.sap2.menu.whgc?after=additions"> <menuContribution locationURI="menu:com.connor.chint.sap2.menu.whgc?after=additions">
<command commandId = "com.chint.plm.createEcn.CreateEcnCommond" id = "com.chint.plm.createEcn.CreateEcnCommond"> <command commandId = "com.connor.plm.CostListManagement" id = "com.connor.plm.CostListManagement">
<visibleWhen> <visibleWhen>
<and> <and>
<or> <or>
<reference definitionId="com.teamcenter.rac.ui.inMainPerspective"/> <reference definitionId="com.teamcenter.rac.ui.inMainPerspective"/>
<reference definitionId="com.teamcenter.rac.pse.inMainView"/> <reference definitionId="com.teamcenter.rac.pse.inMainView"/>
</or> </or>
<with <with
variable="rac_command_suppression"> variable="rac_command_suppression">
<not> <not>
<iterate <iterate
operator="or"> operator="or">
<equals <equals
value="com.chint.plm.createEcn.CreateEcnCommond"> value="com.connor.plm.CostListManagement">
</equals> </equals>
</iterate> </iterate>
</not> </not>
</with> </with>
</and> </and>
</visibleWhen> </visibleWhen>
</command> </command>
<command commandId = "com.connor.chint.yunpi.command.TestCommand" id = "com.connor.chint.yunpi.command.TestCommand"> <command commandId = "com.connor.chint.yunpi.command.TestCommand" id = "com.connor.chint.yunpi.command.TestCommand">
<visibleWhen> <visibleWhen>
<and> <and>
@ -410,7 +410,7 @@
</and> </and>
</visibleWhen> </visibleWhen>
</command> </command>
<command commandId = "com.connor.plm.sendGXToMOM" id = "com.connor.plm.sendGXToMOM"> <command commandId = "com.chint.plm.createEcn.CreateEcnCommond" id = "com.chint.plm.createEcn.CreateEcnCommond">
<visibleWhen> <visibleWhen>
<and> <and>
<or> <or>
@ -423,7 +423,7 @@
<iterate <iterate
operator="or"> operator="or">
<equals <equals
value="com.connor.plm.sendGXToMOM"> value="com.chint.plm.createEcn.CreateEcnCommond">
</equals> </equals>
</iterate> </iterate>
</not> </not>
@ -431,7 +431,7 @@
</and> </and>
</visibleWhen> </visibleWhen>
</command> </command>
<command commandId = "com.connor.plm.CostListManagement" id = "com.connor.plm.CostListManagement"> <command commandId = "com.connor.plm.sendGXToMOM" id = "com.connor.plm.sendGXToMOM">
<visibleWhen> <visibleWhen>
<and> <and>
<or> <or>
@ -444,7 +444,7 @@
<iterate <iterate
operator="or"> operator="or">
<equals <equals
value="com.connor.plm.CostListManagement"> value="com.connor.plm.sendGXToMOM">
</equals> </equals>
</iterate> </iterate>
</not> </not>
@ -452,6 +452,7 @@
</and> </and>
</visibleWhen> </visibleWhen>
</command> </command>
<command commandId = "com.connor.chint.sap2.projectTest.VersionCommandWh" id = "com.connor.chint.sap2.projectTest.VersionCommandWh"> <command commandId = "com.connor.chint.sap2.projectTest.VersionCommandWh" id = "com.connor.chint.sap2.projectTest.VersionCommandWh">
<visibleWhen> <visibleWhen>
<and> <and>

@ -10,12 +10,12 @@ import javafx.scene.layout.StackPane;
import javafx.stage.Stage; import javafx.stage.Stage;
public class ChildMessage extends Application { public class ChildMessage extends Application {
private List<List<DetailsBean>> tableBeans; // private List<List<DetailsBean>> tableBeans;
private boolean onlyError; private boolean onlyError;
private StringBuilder sqlTotal; private StringBuilder sqlTotal;
public ChildMessage(List<List<DetailsBean>> tableBeans,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;
} }
@ -28,7 +28,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,tableBeans,onlyError,sqlTotal); controller.initData(primaryStage,onlyError,sqlTotal);
primaryStage.setScene(scene); primaryStage.setScene(scene);
primaryStage.show(); primaryStage.show();
} }

@ -1,6 +1,7 @@
package com.chint.plm.SearchSapResult; package com.chint.plm.SearchSapResult;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -12,6 +13,8 @@ import com.teamcenter.rac.kernel.TCSession;
import javafx.beans.property.SimpleIntegerProperty; import javafx.beans.property.SimpleIntegerProperty;
import javafx.beans.property.SimpleStringProperty; import javafx.beans.property.SimpleStringProperty;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.collections.FXCollections; import javafx.collections.FXCollections;
import javafx.collections.ObservableList; import javafx.collections.ObservableList;
import javafx.event.ActionEvent; import javafx.event.ActionEvent;
@ -19,205 +22,291 @@ import javafx.fxml.FXML;
import javafx.scene.control.Button; import javafx.scene.control.Button;
import javafx.scene.control.CheckBox; import javafx.scene.control.CheckBox;
import javafx.scene.control.Label; import javafx.scene.control.Label;
import javafx.scene.control.ScrollPane;
import javafx.scene.control.TableColumn; import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView; import javafx.scene.control.TableView;
import javafx.scene.control.TextField;
import javafx.scene.control.cell.PropertyValueFactory; import javafx.scene.control.cell.PropertyValueFactory;
import javafx.scene.layout.FlowPane;
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
*
*/
public class DetailsController { public class DetailsController {
@FXML @FXML
private Button bt_last; private Button bt_last;
@FXML
private Button bt_next;
@FXML @FXML
private TableColumn<DetailsBean, String> tc_cDate; private Button bt_next;
@FXML @FXML
private TableColumn<DetailsBean, String> tc_msg; private TableColumn<DetailsBean, String> tc_cDate;
@FXML @FXML
private TableColumn<DetailsBean, String> tc_cTime; private TableColumn<DetailsBean, String> tc_msg;
@FXML
private TableColumn<DetailsBean, String> tc_cTime;
@FXML @FXML
private TableView<DetailsBean> tableView; private TableView<DetailsBean> tableView;
@FXML @FXML
private TableColumn<DetailsBean, String> tc_returnTime; private TableColumn<DetailsBean, String> tc_returnTime;
@FXML @FXML
private TableColumn<DetailsBean, String> tc_batch; private TableColumn<DetailsBean, String> tc_batch;
@FXML @FXML
private TableColumn<DetailsBean, String> tc_wbs; private TextField pageNumTxt;
@FXML @FXML
private TableColumn<DetailsBean, String> tc_SapResult; private TableColumn<DetailsBean, String> tc_wbs;
@FXML
private TableColumn<DetailsBean, String> tc_SapResult;
@FXML @FXML
private TableColumn<DetailsBean, Integer> tc_xh; private TableColumn<DetailsBean, Integer> tc_xh;
@FXML @FXML
private TableColumn<DetailsBean, String> tc_material; private TableColumn<DetailsBean, String> tc_material;
@FXML @FXML
private TableColumn<DetailsBean, String> tc_returnDate; private TableColumn<DetailsBean, String> tc_returnDate;
@FXML @FXML
private TableColumn<DetailsBean, String> tc_plm; private TableColumn<DetailsBean, String> tc_plm;
@FXML @FXML
private CheckBox cb_errBtn; private CheckBox cb_errBtn;
@FXML @FXML
private Label lb_page; private Label lb_page;
@FXML @FXML
private Button bt_first; private Button bt_first;
@FXML @FXML
private StackPane stackPane; private StackPane stackPane;
@FXML @FXML
private Button bt_tail; private Button bt_tail;
@FXML @FXML
private Button bt_all; private Button bt_all;
int pageNum = 0; int pageNum = 0;
List<List<DetailsBean>> tableBeans; List<List<DetailsBean>> tableBeans;
@FXML
void firstAction(ActionEvent event) { @FXML
pageNum = 0; void firstAction(ActionEvent event) {
ObservableList<DetailsBean> data = FXCollections.observableArrayList(tableBeans.get(0)); pageNum = 0;
ObservableList<DetailsBean> data = FXCollections.observableArrayList(tableBeans.get(0));
tableView.getItems().clear(); tableView.getItems().clear();
tableView.setItems(data); tableView.setItems(data);
} }
@FXML @FXML
void lastAction(ActionEvent event) { void lastAction(ActionEvent event) {
if(pageNum>0) { if (pageNum > 0) {
pageNum = pageNum -1; pageNum = pageNum - 1;
} }
ObservableList<DetailsBean> data = FXCollections.observableArrayList(tableBeans.get(pageNum)); ObservableList<DetailsBean> data = FXCollections.observableArrayList(tableBeans.get(pageNum));
tableView.getItems().clear(); tableView.getItems().clear();
tableView.setItems(data); tableView.setItems(data);
} }
@FXML @FXML
void nextAction(ActionEvent event) { void nextAction(ActionEvent event) {
if(pageNum<tableBeans.size()-1) { if (pageNum < tableBeans.size() - 1) {
pageNum = pageNum +1; pageNum = pageNum + 1;
} }
ObservableList<DetailsBean> data = FXCollections.observableArrayList(tableBeans.get(pageNum)); ObservableList<DetailsBean> data = FXCollections.observableArrayList(tableBeans.get(pageNum));
tableView.getItems().clear(); tableView.getItems().clear();
tableView.setItems(data); tableView.setItems(data);
} }
@FXML @FXML
void tailAction(ActionEvent event) { void tailAction(ActionEvent event) {
pageNum = tableBeans.size()-1; pageNum = tableBeans.size() - 1;
ObservableList<DetailsBean> data = FXCollections.observableArrayList(tableBeans.get(pageNum)); ObservableList<DetailsBean> data = FXCollections.observableArrayList(tableBeans.get(pageNum));
tableView.getItems().clear(); tableView.getItems().clear();
tableView.setItems(data); tableView.setItems(data);
} }
@FXML @FXML
void allAction(ActionEvent event) { private FlowPane flowPane;
List<DetailsBean> allBeans = new ArrayList<DetailsBean>(); @FXML
for(int i=0;i<tableBeans.size();i++) { private ScrollPane scrollPane;
allBeans.addAll(tableBeans.get(i)); @FXML
} private GridPane girdPane;
ObservableList<DetailsBean> data = FXCollections.observableArrayList(tableBeans.get(0));
/**
* @param event
* @function
*/
@FXML
void allAction(ActionEvent event) {
List<DetailsBean> allBeans = new ArrayList<DetailsBean>();
for (int i = 0; i < tableBeans.size(); i++) {
allBeans.addAll(tableBeans.get(i));
}
ObservableList<DetailsBean> data = FXCollections.observableArrayList(allBeans);
tableView.getItems().clear(); tableView.getItems().clear();
tableView.setItems(data); tableView.setItems(data);
} }
protected AbstractAIFApplication app;
private TCSession session; protected AbstractAIFApplication app;
@FXML private TCSession session;
void outputAction(ActionEvent event) {
}
private StringBuilder sqlTotal; /**
public void initData(Stage primaryStage,List<List<DetailsBean>> tableBeans,boolean onlyError,StringBuilder sqlTotal) { * @param event
* @function
*/
@FXML
void outputAction(ActionEvent event) {
}
private 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对象
tc_xh.setSortable(false); tc_xh.setSortable(false);
tc_cDate.setSortable(false); tc_cDate.setSortable(false);
tc_msg.setSortable(false); tc_msg.setSortable(false);
tc_cTime.setSortable(false); tc_cTime.setSortable(false);
tc_returnTime.setSortable(false); tc_returnTime.setSortable(false);
tc_batch.setSortable(false); tc_batch.setSortable(false);
tc_wbs.setSortable(false); tc_wbs.setSortable(false);
tc_SapResult.setSortable(false); tc_SapResult.setSortable(false);
tc_plm.setSortable(false); tc_plm.setSortable(false);
tc_material.setSortable(false); tc_material.setSortable(false);
tc_returnDate.setSortable(false); tc_returnDate.setSortable(false);
//列绑定bean对象 // 列绑定bean对象
tc_xh.setCellValueFactory(new PropertyValueFactory<DetailsBean,Integer>("num")); tc_xh.setCellValueFactory(new PropertyValueFactory<DetailsBean, Integer>("num"));
tc_batch.setCellValueFactory(new PropertyValueFactory<DetailsBean,String>("batchNum")); tc_batch.setCellValueFactory(new PropertyValueFactory<DetailsBean, String>("batchNum"));
tc_material.setCellValueFactory(new PropertyValueFactory<DetailsBean,String>("productMaterialNo")); tc_material.setCellValueFactory(new PropertyValueFactory<DetailsBean, String>("productMaterialNo"));
tc_wbs.setCellValueFactory(new PropertyValueFactory<DetailsBean,String>("wbsNo")); tc_wbs.setCellValueFactory(new PropertyValueFactory<DetailsBean, String>("wbsNo"));
tc_SapResult.setCellValueFactory(new PropertyValueFactory<DetailsBean,String>("status")); tc_SapResult.setCellValueFactory(new PropertyValueFactory<DetailsBean, String>("status"));
tc_msg.setCellValueFactory(new PropertyValueFactory<>("message")); tc_msg.setCellValueFactory(new PropertyValueFactory<>("message"));
// tc_log.setCellValueFactory(new PropertyValueFactory<>("user")); // tc_log.setCellValueFactory(new PropertyValueFactory<>("user"));
tc_cDate.setCellValueFactory(new PropertyValueFactory<DetailsBean,String>("createDate")); tc_cDate.setCellValueFactory(new PropertyValueFactory<DetailsBean, String>("createDate"));
tc_cTime.setCellValueFactory(new PropertyValueFactory<DetailsBean,String>("createTime")); tc_cTime.setCellValueFactory(new PropertyValueFactory<DetailsBean, String>("createTime"));
tc_returnDate.setCellValueFactory(new PropertyValueFactory<DetailsBean,String>("returnDate")); tc_returnDate.setCellValueFactory(new PropertyValueFactory<DetailsBean, String>("returnDate"));
tc_returnTime.setCellValueFactory(new PropertyValueFactory<DetailsBean,String>("returnTime")); tc_returnTime.setCellValueFactory(new PropertyValueFactory<DetailsBean, String>("returnTime"));
tc_plm.setCellValueFactory(new PropertyValueFactory<DetailsBean,String>("plmStatus")); tc_plm.setCellValueFactory(new PropertyValueFactory<DetailsBean, String>("plmStatus"));
//绑定列宽
tc_xh.prefWidthProperty().bind(tableView.widthProperty().multiply(0.05));
tc_batch.prefWidthProperty().bind(tableView.widthProperty().multiply(0.08));
tc_material.prefWidthProperty().bind(tableView.widthProperty().multiply(0.12));
tc_wbs.prefWidthProperty().bind(tableView.widthProperty().multiply(0.1));
tc_SapResult.prefWidthProperty().bind(tableView.widthProperty().multiply(0.1));
tc_msg.prefWidthProperty().bind(tableView.widthProperty().multiply(0.35));
tc_cDate.prefWidthProperty().bind(tableView.widthProperty().multiply(0.08));
tc_cTime.prefWidthProperty().bind(tableView.widthProperty().multiply(0.08));
tc_returnDate.prefWidthProperty().bind(tableView.widthProperty().multiply(0.08));
tc_returnTime.prefWidthProperty().bind(tableView.widthProperty().multiply(0.08));
tc_plm.prefWidthProperty().bind(tableView.widthProperty().multiply(0.07));
//触发查询,默认错误数据
try {
cb_errBtn.setSelected(true);
searchErrMsg();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
ObservableList<DetailsBean> data = FXCollections.observableArrayList(tableBeans.get(0)); ObservableList<DetailsBean> data = FXCollections.observableArrayList(tableBeans.get(0));
tableView.getItems().clear(); tableView.getItems().clear();
tableView.setItems(data); tableView.setItems(data);
lb_page.setText("/"+tableBeans.size());
this.tableBeans = tableBeans; // this.tableBeans = tableBeans;
//最大化绑定
primaryStage.widthProperty().addListener(new ChangeListener<Number>() {
@Override
public void changed(ObservableValue<? extends Number> observable, Number oldValue, Number newValue) {
// 更新GUI组件
// Platform.runLater(new Runnable() {
double width = primaryStage.getWidth();
System.out.println("width==>" + width);
girdPane.setPrefWidth(width * 0.98);
flowPane.setPrefWidth(width * 0.98);
scrollPane.setPrefWidth(width * 0.98);
tableView.setPrefWidth(width * 0.98);
}
});
primaryStage.setMaximized(true);
} }
@FXML /**
void errBtnAction(ActionEvent event) { * @param event
* @function
try { */
String[] prefs = ChintPreferenceUtil.getPreferences("database_tc", session); @FXML
//单个BOM具体信息 : 全部状态. void errBtnAction(ActionEvent event) {
List<List<DetailsBean>> tableBeans = new ArrayList<List<DetailsBean>>();
SqlUtil.getTCDataConnection(prefs); try {
String sqlDetail = ""; cb_errBtn.setDisable(true);
if(cb_errBtn.isSelected()) { searchErrMsg();
sqlDetail = sqlTotal.toString()+" and status = 'E' "; cb_errBtn.setDisable(false);
}else { } catch (Exception ex) {
sqlDetail = sqlTotal.toString()+" and status = 'S' "; ex.printStackTrace();
} } finally {
ResultSet read = SqlUtil.read(sqlDetail); System.out.println("END" + sqlTotal.toString());
int i=1; SqlUtil.freeAll();
List<DetailsBean> beanList = null; }
while(read.next()) { }
//分页 20 查询结果放入表格
DetailsBean sumBean = new DetailsBean(new SimpleIntegerProperty(i),
new SimpleStringProperty(read.getString(1)),new SimpleStringProperty(read.getString(2)),
new SimpleStringProperty(read.getString(3)),new SimpleStringProperty(read.getString(4)),
new SimpleStringProperty(read.getString(5)),new SimpleStringProperty(read.getString(6)),
new SimpleStringProperty(read.getString(7)),new SimpleStringProperty(read.getString(8)),
new SimpleStringProperty(read.getString(9)),new SimpleStringProperty(read.getString(10)));
if(i % 20 ==1) {
beanList = new ArrayList<DetailsBean>();
tableBeans.add(beanList);
}
beanList.add(sumBean);
i=i+1;
}
SqlUtil.freeAll();
if(tableBeans.size()==0) {
beanList = new ArrayList<DetailsBean>();
tableBeans.add(beanList);
}
ObservableList<DetailsBean> data = FXCollections.observableArrayList(tableBeans.get(0));
tableView.getItems().clear();
tableView.setItems(data);
pageNum = 0;
}catch(Exception ex){
ex.printStackTrace();
}finally {
System.out.println("END"+sqlTotal.toString());
SqlUtil.freeAll();
}
}
/**
* @throws Exception
* @function
*/
private void searchErrMsg() throws Exception {
String[] prefs = ChintPreferenceUtil.getPreferences("database_tc", session);
// 单个BOM具体信息 : 全部状态.
List<List<DetailsBean>> tableBeans = new ArrayList<List<DetailsBean>>();
SqlUtil.getTCDataConnection(prefs);
String sqlDetail = "";
if (cb_errBtn.isSelected()) {
sqlDetail = sqlTotal.toString() + " and status = 'E' ";
} else {
sqlDetail = sqlTotal.toString();// + " and status = 'S' ";
}
ResultSet read = SqlUtil.read(sqlDetail);
int i = 1;
List<DetailsBean> beanList = null;
while (read.next()) {
// 分页 20 查询结果放入表格
DetailsBean sumBean = new DetailsBean(new SimpleIntegerProperty(i),
new SimpleStringProperty(read.getString(1)), new SimpleStringProperty(read.getString(2)),
new SimpleStringProperty(read.getString(3)), new SimpleStringProperty(read.getString(4)),
new SimpleStringProperty(read.getString(5)), new SimpleStringProperty(read.getString(6)),
new SimpleStringProperty(read.getString(7)), new SimpleStringProperty(read.getString(8)),
new SimpleStringProperty(read.getString(9)), new SimpleStringProperty(read.getString(10)));
if (i % 20 == 1) {
beanList = new ArrayList<DetailsBean>();
tableBeans.add(beanList);
}
beanList.add(sumBean);
i = i + 1;
}
SqlUtil.freeAll();
if (tableBeans.size() == 0) {
beanList = new ArrayList<DetailsBean>();
tableBeans.add(beanList);
}
ObservableList<DetailsBean> data = FXCollections.observableArrayList(tableBeans.get(0));
tableView.getItems().clear();
tableView.setItems(data);
pageNum = 0;
this.tableBeans = tableBeans;
lb_page.setText("/"+tableBeans.size());
}
} }

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

@ -10,7 +10,7 @@
<StackPane fx:id="stackPane" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="800.0" prefWidth="1200.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.chint.plm.SearchSapResult.DetailsController"> <StackPane fx:id="stackPane" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="800.0" prefWidth="1200.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.chint.plm.SearchSapResult.DetailsController">
<children> <children>
<GridPane> <GridPane fx:id="girdPane">
<columnConstraints> <columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" /> <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
</columnConstraints> </columnConstraints>
@ -20,14 +20,14 @@
<RowConstraints maxHeight="100.0" minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" /> <RowConstraints maxHeight="100.0" minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
</rowConstraints> </rowConstraints>
<children> <children>
<FlowPane alignment="TOP_CENTER" prefHeight="200.0" prefWidth="200.0" style="-fx-padding: 5;"> <FlowPane fx:id="flowPane" alignment="TOP_CENTER" prefHeight="200.0" prefWidth="200.0" style="-fx-padding: 5;">
<children> <children>
<CheckBox fx:id="cb_errBtn" mnemonicParsing="false" onAction="#errBtnAction" text="仅显示错误数据" /> <CheckBox fx:id="cb_errBtn" mnemonicParsing="false" onAction="#errBtnAction" text="仅显示错误数据" />
</children> </children>
</FlowPane> </FlowPane>
<ScrollPane prefHeight="1200.0" prefWidth="1200.0" style="-fx-padding: 5;" GridPane.rowIndex="1"> <ScrollPane fx:id="scrollPane" prefHeight="1200.0" prefWidth="1200.0" style="-fx-padding: 5;" GridPane.rowIndex="1">
<content> <content>
<TableView fx:id="tableView" prefHeight="700.0" prefWidth="1190.0" style="-fx-faint-focus-color: transparent;"> <TableView fx:id="tableView" prefHeight="660.0" prefWidth="1180.0" style="-fx-faint-focus-color: transparent;">
<columns> <columns>
<TableColumn fx:id="tc_xh" prefWidth="75.0" text="序号" /> <TableColumn fx:id="tc_xh" prefWidth="75.0" text="序号" />
<TableColumn fx:id="tc_batch" prefWidth="75.0" text="批次号" /> <TableColumn fx:id="tc_batch" prefWidth="75.0" text="批次号" />
@ -65,7 +65,7 @@
<right> <right>
<FlowPane alignment="TOP_CENTER" prefHeight="140.0" prefWidth="589.0" BorderPane.alignment="CENTER"> <FlowPane alignment="TOP_CENTER" prefHeight="140.0" prefWidth="589.0" BorderPane.alignment="CENTER">
<children> <children>
<TextField alignment="TOP_RIGHT" prefHeight="30.0" prefWidth="154.0" text="1" /> <TextField fx:id="pageNumTxt" alignment="TOP_RIGHT" prefHeight="30.0" prefWidth="154.0" text="1" />
<Label fx:id="lb_page" prefWidth="80.0" text="/" /> <Label fx:id="lb_page" prefWidth="80.0" text="/" />
<Button mnemonicParsing="false" onAction="#outputAction" text="结果导出" /> <Button mnemonicParsing="false" onAction="#outputAction" text="结果导出" />
</children> </children>

@ -10,9 +10,9 @@
<StackPane fx:id="stackPane" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="1600.0" prefWidth="1200.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.chint.plm.SearchSapResult.SearchSapController"> <StackPane fx:id="stackPane" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="1600.0" prefWidth="1200.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.chint.plm.SearchSapResult.SearchSapController">
<children> <children>
<ScrollPane prefHeight="200.0"> <ScrollPane fx:id="scrollPane" prefHeight="200.0">
<content> <content>
<BorderPane prefHeight="200.0" prefWidth="200.0"> <BorderPane fx:id="topBorder" prefHeight="200.0" prefWidth="200.0">
<top> <top>
<TitledPane fx:id="tp_sxtj" prefHeight="650.0" text="筛选条件" BorderPane.alignment="CENTER"> <TitledPane fx:id="tp_sxtj" prefHeight="650.0" text="筛选条件" BorderPane.alignment="CENTER">
<padding> <padding>
@ -114,9 +114,9 @@
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" /> <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
</rowConstraints> </rowConstraints>
<children> <children>
<Button fx:id="bt_close" mnemonicParsing="false" text="关闭" GridPane.columnIndex="3" /> <Button fx:id="bt_close" mnemonicParsing="false" onAction="#closeClick" text="关闭" GridPane.columnIndex="3" />
<Button fx:id="bt_search" mnemonicParsing="false" onAction="#searchAction" text="查询" GridPane.columnIndex="1" /> <Button fx:id="bt_search" mnemonicParsing="false" onAction="#searchAction" text="查询" GridPane.columnIndex="1" />
<Button fx:id="bt_czcx" mnemonicParsing="false" text="重置查询" GridPane.columnIndex="2" /> <Button fx:id="bt_czcx" mnemonicParsing="false" onAction="#resetClick" text="重置查询" GridPane.columnIndex="2" />
</children> </children>
</GridPane> </GridPane>
</bottom> </bottom>
@ -125,7 +125,7 @@
</TitledPane> </TitledPane>
</top> </top>
<center> <center>
<BorderPane prefHeight="800.0" prefWidth="1200.0" BorderPane.alignment="CENTER"> <BorderPane fx:id="resultBorder" prefHeight="800.0" prefWidth="1200.0" BorderPane.alignment="CENTER">
<top> <top>
<TitledPane fx:id="tp_result" prefHeight="600.0" prefWidth="200.0" text="结果" BorderPane.alignment="CENTER"> <TitledPane fx:id="tp_result" prefHeight="600.0" prefWidth="200.0" text="结果" BorderPane.alignment="CENTER">
<padding> <padding>

@ -138,35 +138,35 @@ public class SumTableBean {
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 = "";
if(onlyError) { // if(onlyError) {
sqlDetail = sqlTotal.toString()+" and status = 'E' "; // sqlDetail = sqlTotal.toString()+" and status = 'E' ";
}else { // }else {
sqlDetail = sqlTotal.toString()+" and status = 'S' "; // sqlDetail = sqlTotal.toString()+" and status = 'S' ";
} // }
ResultSet read = SqlUtil.read(sqlDetail); // ResultSet read = SqlUtil.read(sqlDetail);
int i=1; // int i=1;
List<DetailsBean> beanList = null; // List<DetailsBean> beanList = null;
while(read.next()) { // while(read.next()) {
//·ÖÒ³ 20 ²éѯ½á¹û·ÅÈë±í¸ñ // //·ÖÒ³ 20 ²éѯ½á¹û·ÅÈë±í¸ñ
DetailsBean sumBean = new DetailsBean(new SimpleIntegerProperty(i), // DetailsBean sumBean = new DetailsBean(new SimpleIntegerProperty(i),
new SimpleStringProperty(read.getString(1)),new SimpleStringProperty(read.getString(2)), // new SimpleStringProperty(read.getString(1)),new SimpleStringProperty(read.getString(2)),
new SimpleStringProperty(read.getString(3)),new SimpleStringProperty(read.getString(4)), // new SimpleStringProperty(read.getString(3)),new SimpleStringProperty(read.getString(4)),
new SimpleStringProperty(read.getString(5)),new SimpleStringProperty(read.getString(6)), // new SimpleStringProperty(read.getString(5)),new SimpleStringProperty(read.getString(6)),
new SimpleStringProperty(read.getString(7)),new SimpleStringProperty(read.getString(8)), // new SimpleStringProperty(read.getString(7)),new SimpleStringProperty(read.getString(8)),
new SimpleStringProperty(read.getString(9)),new SimpleStringProperty(read.getString(10))); // new SimpleStringProperty(read.getString(9)),new SimpleStringProperty(read.getString(10)));
if(i % 20 ==1) { // if(i % 20 ==1) {
beanList = new ArrayList<DetailsBean>(); // beanList = new ArrayList<DetailsBean>();
tableBeans.add(beanList); // tableBeans.add(beanList);
} // }
beanList.add(sumBean); // beanList.add(sumBean);
i=i+1; // i=i+1;
} // }
//
SqlUtil.freeAll(); // SqlUtil.freeAll();
ChildMessage open = new ChildMessage(tableBeans,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();

@ -122,6 +122,8 @@ public class AssignIdController{
} }
assignBtnTop.setDisable(true);// 只能指派一次 assignBtnTop.setDisable(true);// 只能指派一次
assignBtn.setDisable(true);// 只能指派一次 assignBtn.setDisable(true);// 只能指派一次
Stage stage = (Stage)closeBtn.getScene().getWindow();
stage.close();
} }
@FXML @FXML

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<?import tornadofx.control.*?>
<?import java.lang.*?> <?import java.lang.*?>
<?import javafx.geometry.*?> <?import javafx.geometry.*?>
<?import javafx.scene.control.*?> <?import javafx.scene.control.*?>
@ -27,7 +26,7 @@
<FlowPane alignment="CENTER_LEFT" hgap="12.0" prefHeight="80.0" prefWidth="400.0" style="-fx-border-color: black;" BorderPane.alignment="CENTER"> <FlowPane alignment="CENTER_LEFT" hgap="12.0" prefHeight="80.0" prefWidth="400.0" style="-fx-border-color: black;" BorderPane.alignment="CENTER">
<children> <children>
<Label text="单位:" /> <Label text="单位:" />
<TextField /> <TextField fx:id="factoryText" />
</children> </children>
<BorderPane.margin> <BorderPane.margin>
<Insets /> <Insets />
@ -87,13 +86,10 @@
<Insets left="5.0" /> <Insets left="5.0" />
</padding> </padding>
</FlowPane> </FlowPane>
<FlowPane alignment="CENTER_LEFT" hgap="15.0" prefHeight="200.0" prefWidth="200.0" GridPane.rowIndex="1"> <FlowPane alignment="CENTER_LEFT" hgap="100.0" prefHeight="200.0" prefWidth="200.0" GridPane.rowIndex="1">
<children> <children>
<RadioButton fx:id="rb_product" mnemonicParsing="false" text="产品" /> <RadioButton fx:id="rb_product" mnemonicParsing="false" text="产品" />
<Label text="产品特性:" /> <RadioButton fx:id="rb_Process" mnemonicParsing="false" text="过程" />
<RadioButton mnemonicParsing="false" text="A" />
<RadioButton mnemonicParsing="false" text="B" />
<RadioButton mnemonicParsing="false" text="C" />
</children> </children>
<GridPane.margin> <GridPane.margin>
<Insets /> <Insets />
@ -103,13 +99,6 @@
</padding> </padding>
</FlowPane> </FlowPane>
<FlowPane alignment="CENTER_LEFT" hgap="15.0" prefHeight="200.0" prefWidth="200.0" GridPane.columnIndex="1" GridPane.rowIndex="1"> <FlowPane alignment="CENTER_LEFT" hgap="15.0" prefHeight="200.0" prefWidth="200.0" GridPane.columnIndex="1" GridPane.rowIndex="1">
<children>
<RadioButton fx:id="rb_Process" mnemonicParsing="false" text="过程" />
<Label text="过程特性:" />
<RadioButton mnemonicParsing="false" text="A" />
<RadioButton mnemonicParsing="false" text="B" />
<RadioButton mnemonicParsing="false" text="C" />
</children>
<padding> <padding>
<Insets left="5.0" /> <Insets left="5.0" />
</padding> </padding>
@ -266,7 +255,7 @@
</TitledPane> </TitledPane>
<FlowPane alignment="TOP_CENTER" hgap="40.0" prefHeight="200.0" prefWidth="200.0" GridPane.rowIndex="1"> <FlowPane alignment="TOP_CENTER" hgap="40.0" prefHeight="200.0" prefWidth="200.0" GridPane.rowIndex="1">
<children> <children>
<Button mnemonicParsing="false" onAction="#createClick" text="确定" /> <Button fx:id="createBtn" mnemonicParsing="false" onAction="#createClick" text="确定" />
<Button alignment="CENTER" mnemonicParsing="false" onAction="#disposeClick" text="取消" /> <Button alignment="CENTER" mnemonicParsing="false" onAction="#disposeClick" text="取消" />
</children> </children>
<GridPane.margin> <GridPane.margin>

@ -100,27 +100,29 @@ public class CreateEcnController extends KFXPanelController {
private List<String> parts = new ArrayList<String>(); private List<String> parts = new ArrayList<String>();
private List<String> reasons = new ArrayList<String>(); private List<String> reasons = new ArrayList<String>();
private List<String> wips = new ArrayList<String>(); private List<String> wips = new ArrayList<String>();
private List<String> products = new ArrayList<String>();
private List<EcnBean> ecnBeans = new ArrayList<EcnBean>(); private List<EcnBean> ecnBeans = new ArrayList<EcnBean>();
protected AbstractAIFApplication app; protected AbstractAIFApplication app;
private TCSession session; private TCSession session;
private TCComponent target; private TCComponent target;
@FXML @FXML
private RadioButton rb_formalChange; //正式更改通知单 private RadioButton rb_formalChange; //正式更改通知单
@FXML
private TextField factoryText;
@FXML @FXML
private GridPane productPane; private GridPane productPane;
@FXML @FXML
private TextField htNameText; private TextField htNameText;
@FXML @FXML
private TextField markText; public TextField markText;
@FXML @FXML
private TextField contractText; private TextField contractText;
@FXML @FXML
private ComboBox<String> prodNameComb; private ComboBox<String> prodNameComb;
@FXML @FXML
private FlowPane departPane; private FlowPane departPane;
private List<RadioButton> partBtns = new ArrayList<>(); private List<CheckBox> partBtns = new ArrayList<>();
@FXML @FXML
private ComboBox<String> pmCombox; private ComboBox<String> pmCombox;
private CreateEcnController controller; private CreateEcnController controller;
@ -159,6 +161,8 @@ public class CreateEcnController extends KFXPanelController {
initText(); initText();
} }
@FXML
private Button createBtn;
/** /**
* @param event * @param event
* @throws Exception * @throws Exception
@ -253,7 +257,6 @@ public class CreateEcnController extends KFXPanelController {
//影响分析信息 保存到CHINT_ECN_NOTIFICATION中 //影响分析信息 保存到CHINT_ECN_NOTIFICATION中
try { try {
String groupID = SAPUtil.getGroupID();
SqlUtil.getTCDataConnection(database); SqlUtil.getTCDataConnection(database);
String deleteSql = "delete CHINT_ECN_NOTIFICATION where \"ecncode\" = ? "; String deleteSql = "delete CHINT_ECN_NOTIFICATION where \"ecncode\" = ? ";
String endCode = ecnId.getText(); String endCode = ecnId.getText();
@ -266,7 +269,7 @@ public class CreateEcnController extends KFXPanelController {
RefTableBean refTableBean = items.get(i); RefTableBean refTableBean = items.get(i);
String result = refTableBean.getShYes().isSelected()?"是":"否"; String result = refTableBean.getShYes().isSelected()?"是":"否";
SqlUtil.write( SqlUtil.write(
new String[] {endCode,"1",groupID,String.valueOf(i+1), new String[] {endCode,"1",refTableBean.getDepart(),String.valueOf(i+1),
refTableBean.getMessage(),result,refTableBean.getUser().getText(), refTableBean.getMessage(),result,refTableBean.getUser().getText(),
refTableBean.getCompDate().getText(),refTableBean.getMark().getText()}, insertSql); refTableBean.getCompDate().getText(),refTableBean.getMark().getText()}, insertSql);
} }
@ -274,7 +277,7 @@ public class CreateEcnController extends KFXPanelController {
RefTableBean refTableBean = items.get(i); RefTableBean refTableBean = items.get(i);
String result = refTableBean.getShYes().isSelected()?"是":"否"; String result = refTableBean.getShYes().isSelected()?"是":"否";
SqlUtil.write( SqlUtil.write(
new String[] {endCode,"2",groupID,String.valueOf(i-6), new String[] {endCode,"2",refTableBean.getDepart(),String.valueOf(i-6),
refTableBean.getMessage(),result,refTableBean.getUser().getText(), refTableBean.getMessage(),result,refTableBean.getUser().getText(),
refTableBean.getCompDate().getText(),refTableBean.getMark().getText()}, insertSql); refTableBean.getCompDate().getText(),refTableBean.getMark().getText()}, insertSql);
} }
@ -282,7 +285,7 @@ public class CreateEcnController extends KFXPanelController {
RefTableBean refTableBean = items.get(i); RefTableBean refTableBean = items.get(i);
String result = refTableBean.getShYes().isSelected()?"是":"否"; String result = refTableBean.getShYes().isSelected()?"是":"否";
SqlUtil.write( SqlUtil.write(
new String[] {endCode,"3",groupID,String.valueOf(i-10), new String[] {endCode,"3",refTableBean.getDepart(),String.valueOf(i-10),
refTableBean.getMessage(),result,refTableBean.getUser().getText(), refTableBean.getMessage(),result,refTableBean.getUser().getText(),
refTableBean.getCompDate().getText(),refTableBean.getMark().getText()}, insertSql); refTableBean.getCompDate().getText(),refTableBean.getMark().getText()}, insertSql);
} }
@ -290,7 +293,7 @@ public class CreateEcnController extends KFXPanelController {
RefTableBean refTableBean = items.get(i); RefTableBean refTableBean = items.get(i);
String result = refTableBean.getShYes().isSelected()?"是":"否"; String result = refTableBean.getShYes().isSelected()?"是":"否";
SqlUtil.write( SqlUtil.write(
new String[] {endCode,"4",groupID,String.valueOf(i-14), new String[] {endCode,"4",refTableBean.getDepart(),String.valueOf(i-14),
refTableBean.getMessage(),result,refTableBean.getUser().getText(), refTableBean.getMessage(),result,refTableBean.getUser().getText(),
refTableBean.getCompDate().getText(),refTableBean.getMark().getText()}, insertSql); refTableBean.getCompDate().getText(),refTableBean.getMark().getText()}, insertSql);
} }
@ -298,7 +301,7 @@ public class CreateEcnController extends KFXPanelController {
RefTableBean refTableBean = items.get(i); RefTableBean refTableBean = items.get(i);
String result = refTableBean.getShYes().isSelected()?"是":"否"; String result = refTableBean.getShYes().isSelected()?"是":"否";
SqlUtil.write( SqlUtil.write(
new String[] {endCode,"5",groupID,String.valueOf(i-18), new String[] {endCode,"5",refTableBean.getDepart(),String.valueOf(i-18),
refTableBean.getMessage(),result,refTableBean.getUser().getText(), refTableBean.getMessage(),result,refTableBean.getUser().getText(),
refTableBean.getCompDate().getText(),refTableBean.getMark().getText()}, insertSql); refTableBean.getCompDate().getText(),refTableBean.getMark().getText()}, insertSql);
} }
@ -306,7 +309,7 @@ public class CreateEcnController extends KFXPanelController {
RefTableBean refTableBean = items.get(i); RefTableBean refTableBean = items.get(i);
String result = refTableBean.getShYes().isSelected()?"是":"否"; String result = refTableBean.getShYes().isSelected()?"是":"否";
SqlUtil.write( SqlUtil.write(
new String[] {endCode,"6",groupID,String.valueOf(i-23), new String[] {endCode,"6",refTableBean.getDepart(),String.valueOf(i-23),
refTableBean.getMessage(),result,refTableBean.getUser().getText(), refTableBean.getMessage(),result,refTableBean.getUser().getText(),
refTableBean.getCompDate().getText(),refTableBean.getMark().getText()}, insertSql); refTableBean.getCompDate().getText(),refTableBean.getMark().getText()}, insertSql);
} }
@ -314,7 +317,7 @@ public class CreateEcnController extends KFXPanelController {
RefTableBean refTableBean = items.get(i); RefTableBean refTableBean = items.get(i);
String result = refTableBean.getShYes().isSelected()?"是":"否"; String result = refTableBean.getShYes().isSelected()?"是":"否";
SqlUtil.write( SqlUtil.write(
new String[] {endCode,"7",groupID,String.valueOf(i-26), new String[] {endCode,"7",refTableBean.getDepart(),String.valueOf(i-26),
refTableBean.getMessage(),result,refTableBean.getUser().getText(), refTableBean.getMessage(),result,refTableBean.getUser().getText(),
refTableBean.getCompDate().getText(),refTableBean.getMark().getText()}, insertSql); refTableBean.getCompDate().getText(),refTableBean.getMark().getText()}, insertSql);
} }
@ -323,7 +326,7 @@ public class CreateEcnController extends KFXPanelController {
}finally { }finally {
SqlUtil.freeAll(); SqlUtil.freeAll();
} }
createBtn.setDisable(true);
} }
/** /**
* @param * @param
@ -435,11 +438,16 @@ public class CreateEcnController extends KFXPanelController {
contractNo = contractText.getText(); //合同代号 contractNo = contractText.getText(); //合同代号
contractName = htNameText.getText();//合同名称 contractName = htNameText.getText();//合同名称
productModel = pmCombox.getSelectionModel().getSelectedItem(); //产品型号 productModel = pmCombox.getSelectionModel().getSelectedItem(); //产品型号
String productName = prodNameComb.getSelectionModel().getSelectedItem();
String fileName = markText.getText();
changeType = changeName; //正式临时 changeType = changeName; //正式临时
item.setProperty("zt2_ContractNo", contractNo); item.setProperty("zt2_ContractNo", contractNo);
item.setProperty("zt2_ContractName", contractName); item.setProperty("zt2_ContractName", contractName);
item.setProperty("zt2_ProductModel", productModel); item.setProperty("zt2_ProductModel", productModel);
item.setProperty("zt2_ChangeType", changeType); item.setProperty("zt2_ChangeType", changeType);
item.setProperty("zt2_FileName", fileName);
item.setProperty("zt2_ProductName", productName);
item.setProperty("zt2_ChangRequestNo", relateEcnText.getText());
changeTime = changeDate.getEditor().getText(); changeTime = changeDate.getEditor().getText();
SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-M-dd"); SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-M-dd");
if (changeTime.length() > 0) { if (changeTime.length() > 0) {
@ -448,7 +456,7 @@ public class CreateEcnController extends KFXPanelController {
} }
StringBuilder unit = new StringBuilder(""); StringBuilder unit = new StringBuilder("");
for(int j=0;j<partBtns.size();j++) { for(int j=0;j<partBtns.size();j++) {
RadioButton radioButton = partBtns.get(j); CheckBox radioButton = partBtns.get(j);
if(radioButton.isSelected()) { if(radioButton.isSelected()) {
if (unit.length() > 0) { if (unit.length() > 0) {
unit.append(";").append(radioButton.getText()); unit.append(";").append(radioButton.getText());
@ -471,7 +479,12 @@ public class CreateEcnController extends KFXPanelController {
changeAfter1 = new String[rowCount]; changeAfter1 = new String[rowCount];
changeReason = new String[rowCount]; changeReason = new String[rowCount];
processType1 = new String[rowCount]; processType1 = new String[rowCount];
szVersionBefs = new String[rowCount];
szVersionAfts = new String[rowCount];
productSzs = new String[rowCount];
processSzs = new String[rowCount];
int modulus = changeDrawingNo.length % 5; int modulus = changeDrawingNo.length % 5;
int dlivery = changeDrawingNo.length / 5; int dlivery = changeDrawingNo.length / 5;
if (modulus == 0) { if (modulus == 0) {
@ -488,8 +501,14 @@ public class CreateEcnController extends KFXPanelController {
partition[i] = ecnBean.getPoiNum().getText(); partition[i] = ecnBean.getPoiNum().getText();
changeBefore1[i] = ecnBean.getOverChange().getText(); changeBefore1[i] = ecnBean.getOverChange().getText();
changeAfter1[i] = ecnBean.getAfterChange().getText(); changeAfter1[i] = ecnBean.getAfterChange().getText();
changeReason[i] = ecnBean.getChangeReason().getSelectionModel().getSelectedItem(); String reasonItem = ecnBean.getChangeReason().getSelectionModel().getSelectedItem();
processType1[i] = ecnBean.getWipTreat().getSelectionModel().getSelectedItem(); changeReason[i] = reasonItem==null?"":reasonItem;
String processTypeItem = ecnBean.getWipTreat().getSelectionModel().getSelectedItem();
processType1[i] = processTypeItem==null?"":processTypeItem;
szVersionBefs[i] = ecnBean.getOverVersion().getText();
szVersionAfts[i] = ecnBean.getAfterVersion().getText();
productSzs[i] = ecnBean.getProductSz().getSelectionModel().getSelectedItem();
processSzs[i] = rb_product.isSelected() ? "Y":"N";
} }
item.getTCProperty("zt2_ChangeDrawingNo").setStringValueArray(changeDrawingNo); item.getTCProperty("zt2_ChangeDrawingNo").setStringValueArray(changeDrawingNo);
item.getTCProperty("zt2_Sign").setStringValueArray(sign); item.getTCProperty("zt2_Sign").setStringValueArray(sign);
@ -498,6 +517,10 @@ public class CreateEcnController extends KFXPanelController {
item.getTCProperty("zt2_ChangeAfter1").setStringValueArray(changeAfter1); item.getTCProperty("zt2_ChangeAfter1").setStringValueArray(changeAfter1);
item.getTCProperty("zt2_ChangeReason").setStringValueArray(changeReason); item.getTCProperty("zt2_ChangeReason").setStringValueArray(changeReason);
item.getTCProperty("zt2_ProcessType1").setStringValueArray(processType1); item.getTCProperty("zt2_ProcessType1").setStringValueArray(processType1);
item.getTCProperty("zt2_SZVersionbefore").setStringValueArray(szVersionBefs);
item.getTCProperty("zt2_SZRevisedversion").setStringValueArray(szVersionAfts);
item.getTCProperty("zt2_SZProduct").setStringValueArray(productSzs);
item.getTCProperty("zt2_SZProcess").setStringValueArray(processSzs);
} }
private int pages = 0; private int pages = 0;
private String[] changeDrawingNo; //属性zt2_ChangeDrawingNo private String[] changeDrawingNo; //属性zt2_ChangeDrawingNo
@ -508,6 +531,10 @@ public class CreateEcnController extends KFXPanelController {
private String[] changeAfter1; //属性zt2_ChangeAfter1 private String[] changeAfter1; //属性zt2_ChangeAfter1
private String[] changeReason; //属性zt2_ChangeReason private String[] changeReason; //属性zt2_ChangeReason
private String[] processType1; //属性zt2_ProcessType1 private String[] processType1; //属性zt2_ProcessType1
private String[] szVersionBefs; // 变更前版本
private String[] szVersionAfts; // 变更后版本
private String[] productSzs; // 变更后版本
private String[] processSzs; // 变更后版本
/** /**
* @param event * @param event
* @function * @function
@ -524,13 +551,15 @@ public class CreateEcnController extends KFXPanelController {
private void initText() throws Exception { private void initText() throws Exception {
List<String> productModelList = new ArrayList<>(); List<String> productModelList = new ArrayList<>();
productModelList = Util.getproductModel(target, productModelList); productModelList = Util.getproductModel(target, productModelList);
factoryText.setEditable(false);
pmCombox.getItems().addAll(productModelList); pmCombox.getItems().addAll(productModelList);
List<String> unitList = new ArrayList<>(); List<String> unitList = new ArrayList<>();
contractText.setText(Util.getProjectNo(target)); contractText.setText(Util.getProjectNo(target));
contractText.setEditable(false); contractText.setEditable(false);
htNameText.setText(Util.getProjectName(target)); htNameText.setText(Util.getProjectName(target));
htNameText.setEditable(false); htNameText.setEditable(false);
ecnId.setEditable(false);
rb_product.setSelected(true);
if(target.getType().equals("ZT2_ProjectItem")) { if(target.getType().equals("ZT2_ProjectItem")) {
//获取产成品的名称 //获取产成品的名称
List<String> ccpNameFromProject = KUtil.getCCPNameFromProject(target, session); List<String> ccpNameFromProject = KUtil.getCCPNameFromProject(target, session);
@ -562,7 +591,8 @@ public class CreateEcnController extends KFXPanelController {
target.refresh(); target.refresh();
properties = target.getTCProperties( properties = target.getTCProperties(
new String[] { "zt2_ChangeDrawingNo", "zt2_Sign", "zt2_PlacesNo", "zt2_Partition", new String[] { "zt2_ChangeDrawingNo", "zt2_Sign", "zt2_PlacesNo", "zt2_Partition",
"zt2_ChangeBefore1", "zt2_ChangeAfter1", "zt2_ChangeReason", "zt2_ProcessType1" }); "zt2_ChangeBefore1", "zt2_ChangeAfter1", "zt2_ChangeReason", "zt2_ProcessType1" ,"zt2_SZVersionbefore",
"zt2_SZRevisedversion", "zt2_SZProduct", "zt2_SZProcess"});
} catch (TCException e1) { } catch (TCException e1) {
e1.printStackTrace(); e1.printStackTrace();
} }
@ -574,16 +604,35 @@ public class CreateEcnController extends KFXPanelController {
String[] ChangeAfter1 = properties[5].getStringArrayValue(); String[] ChangeAfter1 = properties[5].getStringArrayValue();
String[] ChangeReason = properties[6].getStringArrayValue(); String[] ChangeReason = properties[6].getStringArrayValue();
String[] ProcessType1 = properties[7].getStringArrayValue(); String[] ProcessType1 = properties[7].getStringArrayValue();
String[] szVersionBef = properties[8].getStringArrayValue();
String[] szVersionAft = properties[9].getStringArrayValue();
String[] szProduct = properties[10].getStringArrayValue();
String[] szProcess = properties[11].getStringArrayValue();
if(szProcess.length>0) {
rb_Process.setSelected(szProcess[0].equals("N"));
}
String fileName = target.getProperty("zt2_FileName");
String productName = target.getProperty("zt2_ProductName");
String changRequestNo = target.getProperty("zt2_ChangRequestNo");// relateEcnText.getText()
prodNameComb.getSelectionModel().select(productName);
markText.setText(fileName);
relateEcnText.setText(changRequestNo);
// String productName = prodNameComb.getSelectionModel().getSelectedItem();
// String fileName = markText.getText();
// item.setProperty("zt2_FileName", fileName);
// item.setProperty("zt2_ProductName", productName);
int rowNum = 0; int rowNum = 0;
for (int j = 0; j < ChangeDrawingNo.length; j++) { for (int j = 0; j < ChangeDrawingNo.length; j++) {
rowNum++; rowNum++;
ecnBeans.add(new EcnBean(rowNum, reasons, wips, ChangeDrawingNo[j], sign[j], placesNo[j] EcnBean ecnBean = new EcnBean(rowNum, reasons, wips, ChangeDrawingNo[j], sign[j], placesNo[j]
, ChangeBefore1[j], ChangeAfter1[j], ChangeReason[j], ProcessType1[j])); , ChangeBefore1[j], ChangeAfter1[j], ChangeReason[j], ProcessType1[j], szVersionBef[j], szVersionAft[j]);
ecnBeans.add(ecnBean);
ecnBean.setProductSz(szProduct[j]);
} }
} }
tableView.getItems().addAll(ecnBeans); tableView.getItems().addAll(ecnBeans);
for(int i=0;i<parts.size();i++) { for(int i=0;i<parts.size();i++) {
RadioButton btn = new RadioButton(parts.get(i)); CheckBox btn = new CheckBox(parts.get(i));
partBtns.add(btn); partBtns.add(btn);
departPane.getChildren().add(btn); departPane.getChildren().add(btn);
if(unitList.contains(parts.get(i))) { if(unitList.contains(parts.get(i))) {
@ -709,10 +758,11 @@ public class CreateEcnController extends KFXPanelController {
TableColumn<EcnBean,Integer> tc_xh = new TableColumn<EcnBean,Integer>("序号"); TableColumn<EcnBean,Integer> tc_xh = new TableColumn<EcnBean,Integer>("序号");
TableColumn<EcnBean,ComboBox<String>> tc_wipTreat = new TableColumn<EcnBean,ComboBox<String>>("在制品处理"); TableColumn<EcnBean,ComboBox<String>> tc_wipTreat = new TableColumn<EcnBean,ComboBox<String>>("在制品处理");
TableColumn<EcnBean,TextArea> tc_beforVer = new TableColumn<EcnBean,TextArea>("更改前版本"); TableColumn<EcnBean,TextArea> tc_beforVer = new TableColumn<EcnBean,TextArea>("更改前版本");
TableColumn<EcnBean,ComboBox<String>> productSz = new TableColumn<EcnBean,ComboBox<String>>("特性等级");
TableColumn<EcnBean,ComboBox<String>> tc_reason = new TableColumn<EcnBean,ComboBox<String>>("更改原因"); TableColumn<EcnBean,ComboBox<String>> tc_reason = new TableColumn<EcnBean,ComboBox<String>>("更改原因");
TableColumn<EcnBean,TextArea> tc_poiNum = new TableColumn<EcnBean,TextArea>("处数"); TableColumn<EcnBean,TextArea> tc_poiNum = new TableColumn<EcnBean,TextArea>("处数");
tableView.getColumns().addAll(tc_xh, tc_drawNo, tc_mark,tc_poiNum,tc_beforChange, tc_beforVer, tc_afterChange, tableView.getColumns().addAll(tc_xh, tc_drawNo, tc_mark,tc_poiNum,tc_beforChange, tc_beforVer, tc_afterChange,
tc_afterVer,tc_reason,tc_wipTreat); tc_afterVer,productSz,tc_reason,tc_wipTreat);
tc_xh.setSortable(false); tc_xh.setSortable(false);
tc_drawNo.setSortable(false); tc_drawNo.setSortable(false);
@ -723,6 +773,7 @@ public class CreateEcnController extends KFXPanelController {
tc_afterChange.setSortable(false); tc_afterChange.setSortable(false);
tc_afterVer.setSortable(false); tc_afterVer.setSortable(false);
tc_reason.setSortable(false); tc_reason.setSortable(false);
productSz.setSortable(false);
tc_wipTreat.setSortable(false); tc_wipTreat.setSortable(false);
//列绑定bean对象 //列绑定bean对象
tc_xh.setCellValueFactory(new PropertyValueFactory<EcnBean,Integer>("num")); tc_xh.setCellValueFactory(new PropertyValueFactory<EcnBean,Integer>("num"));
@ -735,17 +786,18 @@ public class CreateEcnController extends KFXPanelController {
tc_afterVer.setCellValueFactory(new PropertyValueFactory<EcnBean,TextArea>("afterVersion")); tc_afterVer.setCellValueFactory(new PropertyValueFactory<EcnBean,TextArea>("afterVersion"));
tc_reason.setCellValueFactory(new PropertyValueFactory<EcnBean,ComboBox<String>>("changeReason")); tc_reason.setCellValueFactory(new PropertyValueFactory<EcnBean,ComboBox<String>>("changeReason"));
tc_wipTreat.setCellValueFactory(new PropertyValueFactory<EcnBean,ComboBox<String>>("wipTreat")); tc_wipTreat.setCellValueFactory(new PropertyValueFactory<EcnBean,ComboBox<String>>("wipTreat"));
productSz.setCellValueFactory(new PropertyValueFactory<EcnBean,ComboBox<String>>("productSz"));
tc_xh.prefWidthProperty().bind(tableView.widthProperty().multiply(0.06)); tc_xh.prefWidthProperty().bind(tableView.widthProperty().multiply(0.06));
tc_drawNo.prefWidthProperty().bind(tableView.widthProperty().multiply(0.20)); tc_drawNo.prefWidthProperty().bind(tableView.widthProperty().multiply(0.18));
tc_mark.prefWidthProperty().bind(tableView.widthProperty().multiply(0.06)); tc_mark.prefWidthProperty().bind(tableView.widthProperty().multiply(0.06));
tc_poiNum.prefWidthProperty().bind(tableView.widthProperty().multiply(0.06)); tc_poiNum.prefWidthProperty().bind(tableView.widthProperty().multiply(0.06));
tc_beforChange.prefWidthProperty().bind(tableView.widthProperty().multiply(0.10)); tc_beforChange.prefWidthProperty().bind(tableView.widthProperty().multiply(0.10));
tc_beforVer.prefWidthProperty().bind(tableView.widthProperty().multiply(0.08)); tc_beforVer.prefWidthProperty().bind(tableView.widthProperty().multiply(0.06));
tc_afterChange.prefWidthProperty().bind(tableView.widthProperty().multiply(0.08)); tc_afterChange.prefWidthProperty().bind(tableView.widthProperty().multiply(0.10));
productSz.prefWidthProperty().bind(tableView.widthProperty().multiply(0.06));
tc_afterVer.prefWidthProperty().bind(tableView.widthProperty().multiply(0.1)); tc_afterVer.prefWidthProperty().bind(tableView.widthProperty().multiply(0.06));
tc_reason.prefWidthProperty().bind(tableView.widthProperty().multiply(0.14)); tc_reason.prefWidthProperty().bind(tableView.widthProperty().multiply(0.14)); //0.4
tc_wipTreat.prefWidthProperty().bind(tableView.widthProperty().multiply(0.10)); tc_wipTreat.prefWidthProperty().bind(tableView.widthProperty().multiply(0.10));
} }
@FXML @FXML
@ -883,19 +935,24 @@ public class CreateEcnController extends KFXPanelController {
SqlUtil.getTCDataConnection(database); SqlUtil.getTCDataConnection(database);
try { try {
String sql = "select PART,REASON,MANAGE,DATASET from CHINT_ECN_TYPE where CODE = ?"; String sql = "select PART,REASON,MANAGE,DATASET,UNIT,GRADE from CHINT_ECN_TYPE where CODE = ?";
ResultSet read = SqlUtil.read(sql, new String[] {SAPUtil.getGroupID()}); ResultSet read = SqlUtil.read(sql, new String[] {SAPUtil.getGroupID()});
if(read.next()) { if(read.next()) {
String part = read.getString(1); String part = read.getString(1);
String reason = read.getString(2); String reason = read.getString(2);
String manage = read.getString(3); String manage = read.getString(3);
String dataset = read.getString(4); String dataset = read.getString(4);
String factory = read.getString(5);
String grade = read.getString(6);
factoryText.setText(factory);
String[] partArray = part.split(";"); String[] partArray = part.split(";");
String[] reasonArray = reason.split(";"); String[] reasonArray = reason.split(";");
String[] manageArray = manage.split(";"); String[] manageArray = manage.split(";");
String[] grades = grade.split(";");
parts = new ArrayList<String>(Arrays.asList(partArray)); parts = new ArrayList<String>(Arrays.asList(partArray));
reasons = new ArrayList<String>(Arrays.asList(reasonArray)); reasons = new ArrayList<String>(Arrays.asList(reasonArray));
wips = new ArrayList<String>(Arrays.asList(manageArray)); wips = new ArrayList<String>(Arrays.asList(manageArray));
products = new ArrayList<String>(Arrays.asList(grades));
} }
}catch(Exception e) { }catch(Exception e) {
@ -913,7 +970,7 @@ public class CreateEcnController extends KFXPanelController {
@FXML @FXML
void addRows(ActionEvent event) { void addRows(ActionEvent event) {
for(int i=0;i<5;i++) { for(int i=0;i<5;i++) {
ecnBeans.add(new EcnBean(ecnBeans.size()+1,reasons,wips)); ecnBeans.add(new EcnBean(ecnBeans.size()+1, reasons, wips, products));
} }
ObservableList<EcnBean> data = FXCollections.observableArrayList(ecnBeans); ObservableList<EcnBean> data = FXCollections.observableArrayList(ecnBeans);
tableView.getItems().clear(); tableView.getItems().clear();
@ -925,7 +982,7 @@ public class CreateEcnController extends KFXPanelController {
*/ */
@FXML @FXML
void addRow(ActionEvent event) { void addRow(ActionEvent event) {
ecnBeans.add(new EcnBean(ecnBeans.size()+1,reasons,wips)); ecnBeans.add(new EcnBean(ecnBeans.size()+1, reasons, wips, products));
ObservableList<EcnBean> data = FXCollections.observableArrayList(ecnBeans); ObservableList<EcnBean> data = FXCollections.observableArrayList(ecnBeans);
tableView.getItems().clear(); tableView.getItems().clear();
tableView.setItems(data); tableView.setItems(data);

@ -1,6 +1,7 @@
package com.chint.plm.createEcn; package com.chint.plm.createEcn;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import javafx.beans.property.SimpleIntegerProperty; import javafx.beans.property.SimpleIntegerProperty;
@ -16,12 +17,19 @@ public class EcnBean {
protected TextArea poiNum; //处数 protected TextArea poiNum; //处数
protected TextArea overChange;//更改前 protected TextArea overChange;//更改前
protected TextArea overVersion;//更改前版本 protected TextArea overVersion;//更改前版本
protected TextArea afterChange;//更改后
protected TextArea afterVersion;//更改后版本 protected TextArea afterVersion;//更改后版本
protected TextArea afterChange;//更改后
protected ComboBox<String> productSz = new ComboBox<String>();//特性等级
protected ComboBox<String> changeReason = new ComboBox<String>();//更改原因 protected ComboBox<String> changeReason = new ComboBox<String>();//更改原因
protected ComboBox<String> wipTreat = new ComboBox<String>();;//在制品处理 protected ComboBox<String> wipTreat = new ComboBox<String>();//在制品处理
EcnBean(int ind, List<String> reasons, List<String> wips) { public ComboBox<String> getProductSz() {
return productSz;
}
public void setProductSz(String productSz) {
this.productSz.getSelectionModel().select(productSz);
}
EcnBean(int ind, List<String> reasons, List<String> wips,List<String> products) {
num = new SimpleIntegerProperty(ind); num = new SimpleIntegerProperty(ind);
drawNo = new TextArea(); //ComboBoxTextArea drawNo = new TextArea(); //ComboBoxTextArea
drawNo.setPrefSize(200, 40); drawNo.setPrefSize(200, 40);
@ -44,10 +52,13 @@ public class EcnBean {
afterVersion = new TextArea(); //ComboBoxTextArea afterVersion = new TextArea(); //ComboBoxTextArea
afterVersion.setPrefSize(200, 40); afterVersion.setPrefSize(200, 40);
wipTreat.getItems().addAll(wips); wipTreat.getItems().addAll(wips);
productSz.getItems().addAll(products);
productSz.getSelectionModel().selectFirst();
changeReason.getItems().addAll(reasons); changeReason.getItems().addAll(reasons);
} }
EcnBean(int ind, List<String> reasons, List<String> wips, String drawNoVal, String markVal, EcnBean(int ind, List<String> reasons, List<String> wips, String drawNoVal, String markVal,
String placesNo, String changeBefore, String changeAfter, String reasonVal, String processType) { String placesNo, String changeBefore, String changeAfter, String reasonVal, String processType,
String szRevisionBef, String szRevisionAft) {
num = new SimpleIntegerProperty(ind); num = new SimpleIntegerProperty(ind);
drawNo = new TextArea(); //ComboBoxTextArea drawNo = new TextArea(); //ComboBoxTextArea
drawNo.setPrefSize(200, 40); drawNo.setPrefSize(200, 40);
@ -67,6 +78,7 @@ public class EcnBean {
overVersion = new TextArea(); //ComboBoxTextArea overVersion = new TextArea(); //ComboBoxTextArea
overVersion.setPrefSize(200, 40); overVersion.setPrefSize(200, 40);
overVersion.setText(szRevisionBef);
afterChange = new TextArea(); //ComboBoxTextArea afterChange = new TextArea(); //ComboBoxTextArea
afterChange.setPrefSize(200, 40); afterChange.setPrefSize(200, 40);
@ -74,6 +86,8 @@ public class EcnBean {
afterVersion = new TextArea(); //ComboBoxTextArea afterVersion = new TextArea(); //ComboBoxTextArea
afterVersion.setPrefSize(200, 40); afterVersion.setPrefSize(200, 40);
afterVersion.setText(szRevisionAft);
wipTreat.getItems().addAll(wips); wipTreat.getItems().addAll(wips);
wipTreat.getSelectionModel().select(processType); wipTreat.getSelectionModel().select(processType);
changeReason.getItems().addAll(reasons); changeReason.getItems().addAll(reasons);

@ -83,7 +83,7 @@ public class RefTableBean {
// this.user = user; // this.user = user;
// this.compDate = compDate; // this.compDate = compDate;
// this.mark = mark; // this.mark = mark;
shYes.setSelected(true); shNo.setSelected(true);
shYes.selectedProperty().addListener(new ChangeListener<Boolean>() { shYes.selectedProperty().addListener(new ChangeListener<Boolean>() {

@ -52,7 +52,9 @@ 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");
@ -60,6 +62,8 @@ public class RelateEcnBean {
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 designFile = read.getString("DESIGNFILE");//获取行动内容
linkBtn.setOnAction(e -> { linkBtn.setOnAction(e -> {
try { try {
BomToSapUtil.browse2(link); BomToSapUtil.browse2(link);
@ -92,6 +96,7 @@ public class RelateEcnBean {
for(int i=27;i<28;i++) { for(int i=27;i<28;i++) {
items.get(i).setUser(finaPal); items.get(i).setUser(finaPal);
} }
controller.markText.setText(docuName);
controller.relateEcnText.setText(applyNo); controller.relateEcnText.setText(applyNo);
controller.refTable.setItems(items); controller.refTable.setItems(items);
} catch (Exception e1) { } catch (Exception e1) {

Loading…
Cancel
Save