陈翼晖 1 year ago
commit fa86106be6

@ -141,7 +141,7 @@ public class ButtonCellEditor extends AbstractCellEditor implements TableCellEdi
resultSet1.getString("traweight"), resultSet1.getString("totweight"), resultSet1.getString("traweight"), resultSet1.getString("totweight"),
QuotationUtil.formatString(resultSet1.getString("copconsumption")), QuotationUtil.formatString(resultSet1.getString("copconsumption")),
QuotationUtil.formatString(resultSet1.getString("cmarketprice")), QuotationUtil.formatString(resultSet1.getString("cmarketprice")),
resultSet1.getString("vollevel"), resultSet1.getString("factory")); resultSet1.getString("vollevel"), resultSet1.getString("factory"),resultSet1.getString("changereason"));
break; break;
} }
@ -197,6 +197,8 @@ public class ButtonCellEditor extends AbstractCellEditor implements TableCellEdi
quotationMX.setUnitprice(new SimpleStringProperty( quotationMX.setUnitprice(new SimpleStringProperty(
QuotationUtil.formatString(resultSet2.getString("unitprice")))); QuotationUtil.formatString(resultSet2.getString("unitprice"))));
quotationMX.setNo(new SimpleStringProperty(resultSet2.getString("no"))); quotationMX.setNo(new SimpleStringProperty(resultSet2.getString("no")));
quotationMX.setComparedQuantityColumn(new SimpleStringProperty(""));
quotationMX.setComparedUnitPriceColumn(new SimpleStringProperty(""));
quotationMX.setContrastPrice(new SimpleStringProperty("")); quotationMX.setContrastPrice(new SimpleStringProperty(""));
quotationMX.setTotalprice(new SimpleStringProperty( quotationMX.setTotalprice(new SimpleStringProperty(
QuotationUtil.formatString(resultSet2.getString("totalprice")))); QuotationUtil.formatString(resultSet2.getString("totalprice"))));

@ -30,6 +30,7 @@ import com.teamcenter.rac.kernel.TCComponentProject;
import com.teamcenter.rac.kernel.TCException; import com.teamcenter.rac.kernel.TCException;
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 com.teamcenter.rac.util.ResizablePopupMenu;
import javafx.beans.property.SimpleStringProperty; import javafx.beans.property.SimpleStringProperty;
@ -150,7 +151,8 @@ public class CostListManagementHandler extends AbstractHandler {
QuotationUtil.formatString( QuotationUtil.formatString(
resultSet1.getString("cmarketprice")), resultSet1.getString("cmarketprice")),
resultSet1.getString("vollevel"), resultSet1.getString("vollevel"),
resultSet1.getString("factory")); resultSet1.getString("factory"),
resultSet1.getString("changereason"));
tennumber = resultSet1.getString("tennumber"); tennumber = resultSet1.getString("tennumber");
break; break;
} }
@ -219,6 +221,8 @@ public class CostListManagementHandler extends AbstractHandler {
resultSet2.getString("unitprice")))); resultSet2.getString("unitprice"))));
quotationMX.setNo(new SimpleStringProperty( quotationMX.setNo(new SimpleStringProperty(
resultSet2.getString("no"))); resultSet2.getString("no")));
quotationMX.setComparedQuantityColumn(new SimpleStringProperty(""));
quotationMX.setComparedUnitPriceColumn(new SimpleStringProperty(""));
quotationMX.setContrastPrice(new SimpleStringProperty("")); quotationMX.setContrastPrice(new SimpleStringProperty(""));
quotationMX.setTotalprice( quotationMX.setTotalprice(
new SimpleStringProperty(QuotationUtil.formatString( new SimpleStringProperty(QuotationUtil.formatString(

@ -20,11 +20,12 @@ public class Cusquotation {
private String cmarketprice; private String cmarketprice;
private String vollevel; private String vollevel;
private String factory; private String factory;
private String changereason;
public Cusquotation(String cbdlx, String projectid, String revision, String proname, String tennumber, public Cusquotation(String cbdlx, String projectid, String revision, String proname, String tennumber,
String promanager, String quantity, String tramodel, String capfactor, String volratio, String noloadloss, String promanager, String quantity, String tramodel, String capfactor, String volratio, String noloadloss,
String loadloss, String impvoltage, String traweight, String totweight, String copconsumption, String loadloss, String impvoltage, String traweight, String totweight, String copconsumption,
String cmarketprice, String vollevel, String factory) { String cmarketprice, String vollevel, String factory,String changereason) {
super(); super();
this.cbdlx = cbdlx; this.cbdlx = cbdlx;
this.projectid = projectid; this.projectid = projectid;
@ -45,8 +46,20 @@ public class Cusquotation {
this.cmarketprice = cmarketprice; this.cmarketprice = cmarketprice;
this.vollevel = vollevel; this.vollevel = vollevel;
this.factory = factory; this.factory = factory;
this.changereason = changereason;
} }
public String getChangereason() {
return changereason;
}
public void setChangereason(String changereason) {
this.changereason = changereason;
}
public String getCbdlx() { public String getCbdlx() {
return cbdlx; return cbdlx;
} }
@ -199,6 +212,7 @@ public class Cusquotation {
this.factory = factory; this.factory = factory;
} }
@Override @Override
public String toString() { public String toString() {
return "Cusquotation [cbdlx=" + cbdlx + ", projectid=" + projectid + ", revision=" + revision + ", proname=" return "Cusquotation [cbdlx=" + cbdlx + ", projectid=" + projectid + ", revision=" + revision + ", proname="
@ -206,7 +220,9 @@ public class Cusquotation {
+ ", tramodel=" + tramodel + ", capfactor=" + capfactor + ", volratio=" + volratio + ", noloadloss=" + ", tramodel=" + tramodel + ", capfactor=" + capfactor + ", volratio=" + volratio + ", noloadloss="
+ noloadloss + ", loadloss=" + loadloss + ", impvoltage=" + impvoltage + ", traweight=" + traweight + noloadloss + ", loadloss=" + loadloss + ", impvoltage=" + impvoltage + ", traweight=" + traweight
+ ", totweight=" + totweight + ", copconsumption=" + copconsumption + ", cmarketprice=" + cmarketprice + ", totweight=" + totweight + ", copconsumption=" + copconsumption + ", cmarketprice=" + cmarketprice
+ ", vollevel=" + vollevel + ", factory=" + factory + "]"; + ", vollevel=" + vollevel + ", factory=" + factory + ", changereason=" + changereason + "]";
} }
} }

@ -18,6 +18,8 @@ public class QuotationMX {
private SimpleStringProperty utilizationRateColumn; private SimpleStringProperty utilizationRateColumn;
private SimpleStringProperty unitColumn; private SimpleStringProperty unitColumn;
private SimpleStringProperty amomoney; private SimpleStringProperty amomoney;
private SimpleStringProperty comparedQuantityColumn;
private SimpleStringProperty comparedUnitPriceColumn;
private SimpleStringProperty unitPriceColumn; private SimpleStringProperty unitPriceColumn;
private SimpleStringProperty no; private SimpleStringProperty no;
private SimpleStringProperty totalprice; private SimpleStringProperty totalprice;
@ -147,6 +149,22 @@ public class QuotationMX {
this.amomoney = amomoney; this.amomoney = amomoney;
} }
public String getComparedQuantityColumn() {
return comparedQuantityColumn.get();
}
public void setComparedQuantityColumn(SimpleStringProperty comparedQuantityColumn) {
this.comparedQuantityColumn = comparedQuantityColumn;
}
public String getComparedUnitPriceColumn() {
return comparedUnitPriceColumn.get();
}
public void setComparedUnitPriceColumn(SimpleStringProperty comparedUnitPriceColumn) {
this.comparedUnitPriceColumn = comparedUnitPriceColumn;
}
public String getUnitprice() { public String getUnitprice() {
return unitPriceColumn.get(); return unitPriceColumn.get();
} }

@ -1,36 +1,29 @@
package com.connor.plm.CreateOuotation; package com.connor.plm.CreateOuotation;
import java.awt.Component;
import java.awt.event.ComponentEvent;
import java.awt.event.ComponentListener;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import javax.swing.JOptionPane; import javax.swing.JOptionPane;
import javax.swing.SwingUtilities;
import com.connor.chint.sap2.util.SqlUtil; import com.connor.chint.sap2.util.SqlUtil;
import com.connor.plm.CostListManagement.ButtonCellEditor; import com.connor.plm.CostListManagement.ButtonCellEditor;
import com.connor.plm.CostListManagement.QuotationUtil; import com.connor.plm.CostListManagement.QuotationUtil;
import com.connor.plm.CostListManagement.pojo.QuotationMX; import com.connor.plm.CostListManagement.pojo.QuotationMX;
import com.itextpdf.text.pdf.PdfStructTreeController.returnType;
import com.teamcenter.rac.kernel.TCComponentItem; import com.teamcenter.rac.kernel.TCComponentItem;
import com.teamcenter.rac.kernel.TCComponentItemType; import com.teamcenter.rac.kernel.TCComponentItemType;
import com.teamcenter.rac.kernel.TCException; import com.teamcenter.rac.kernel.TCException;
import com.teamcenter.rac.util.MessageBox; import com.teamcenter.rac.util.MessageBox;
import javafx.application.Platform;
import javafx.beans.property.SimpleStringProperty; import javafx.beans.property.SimpleStringProperty;
import javafx.collections.FXCollections; import javafx.collections.FXCollections;
import javafx.collections.ObservableList; import javafx.collections.ObservableList;
import javafx.embed.swing.JFXPanel;
import javafx.fxml.FXML; import javafx.fxml.FXML;
import javafx.geometry.Pos; import javafx.geometry.Pos;
import javafx.scene.control.Button; import javafx.scene.control.Button;
@ -39,6 +32,7 @@ import javafx.scene.control.Label;
import javafx.scene.control.TableCell; 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.TextArea;
import javafx.scene.control.TextField; import javafx.scene.control.TextField;
import javafx.scene.control.cell.PropertyValueFactory; import javafx.scene.control.cell.PropertyValueFactory;
import javafx.scene.layout.AnchorPane; import javafx.scene.layout.AnchorPane;
@ -46,8 +40,25 @@ import javafx.scene.layout.BorderPane;
import javafx.scene.layout.FlowPane; import javafx.scene.layout.FlowPane;
import javafx.scene.layout.GridPane; import javafx.scene.layout.GridPane;
import javafx.scene.layout.Pane; import javafx.scene.layout.Pane;
import javafx.stage.Window;
import javafx.util.Callback; /**
*
* @ClassName: MyController
* @Description:
* @author hcj
* @date 20231120
* @change 1.
* @change 2.
* @change 3.
* @change 4. -绿+
* @change 5.
* @change 6. 绿
* @change 7.
* @change 8. 1. 2. ()3.
* ()4. ()5. ()
* @changeDate 20231229
*
*/
public class MyController extends KFXPanelController { public class MyController extends KFXPanelController {
private List<String> dbRevList = null; private List<String> dbRevList = null;
@ -59,6 +70,7 @@ public class MyController extends KFXPanelController {
private List<String> dbunitpriceList = null; private List<String> dbunitpriceList = null;
private List<String> DbnoList = null; private List<String> DbnoList = null;
private List<String> dbtotalpriceList = null; private List<String> dbtotalpriceList = null;
private final static String[] QUOTATIONTYPE = { "报价成本单", "报审成本单(电磁部分)", "报审成本单(结构部分)", "设计成本单(电磁)", "设计成本单(布置)" };
@FXML @FXML
private AnchorPane coverPane; private AnchorPane coverPane;
@ -228,6 +240,12 @@ public class MyController extends KFXPanelController {
@FXML @FXML
private TableColumn<QuotationMX, String> amountColumn; private TableColumn<QuotationMX, String> amountColumn;
@FXML
private TableColumn<QuotationMX, String> comparedQuantityColumn;
@FXML
private TableColumn<QuotationMX, String> comparedUnitPriceColumn;
@FXML @FXML
private TableColumn<QuotationMX, String> comparedResultColumn; private TableColumn<QuotationMX, String> comparedResultColumn;
@ -240,10 +258,15 @@ public class MyController extends KFXPanelController {
@FXML @FXML
private TextField totalPriceCompareTextField; private TextField totalPriceCompareTextField;
@FXML
private TextArea changeReason;
private DecimalFormat df = new DecimalFormat("#.00"); private DecimalFormat df = new DecimalFormat("#.00");
private String rev = "01"; private String rev = "01";
private String operationType;
public void editWrite() { public void editWrite() {
materialsTable.setEditable(true); materialsTable.setEditable(true);
// 头表 // 头表
@ -274,7 +297,72 @@ public class MyController extends KFXPanelController {
utilizationRateColumn.setCellFactory((tableColumn) -> new EditingCell<QuotationMX>()); utilizationRateColumn.setCellFactory((tableColumn) -> new EditingCell<QuotationMX>());
unitColumn.setCellFactory((tableColumn) -> new EditingCell<QuotationMX>()); unitColumn.setCellFactory((tableColumn) -> new EditingCell<QuotationMX>());
unitPriceColumn.setCellFactory((tableColumn) -> new EditingCell<QuotationMX>()); unitPriceColumn.setCellFactory((tableColumn) -> new EditingCell<QuotationMX>());
amountColumn.setCellFactory((tableColumn) -> new EditingCellOR<QuotationMX>()); amountColumn.setCellFactory(column -> {
return new TableCell<QuotationMX, String>() {
@Override
protected void updateItem(String item, boolean empty) {
super.updateItem(item, empty);
if (item != null && !empty && !item.isEmpty()) {
BigDecimal decimal = new BigDecimal(item);
int roundedInt = decimal.setScale(0, BigDecimal.ROUND_HALF_UP).intValue();
setText(roundedInt+"");
setAlignment(Pos.CENTER); // 设置单元格内容居中对齐
}
}
};
});
comparedQuantityColumn.setCellFactory(column -> {
return new TableCell<QuotationMX, 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 (contrastPrice == 0) {
// 不做格式
setStyle("");
} else if (contrastPrice < 0) {
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); // 设置单元格内容居中对齐
}
}
};
});
comparedUnitPriceColumn.setCellFactory(column -> {
return new TableCell<QuotationMX, 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 (contrastPrice == 0) {
// 不做格式
setStyle("");
} else if (contrastPrice < 0) {
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); // 设置单元格内容居中对齐
}
}
};
});
comparedResultColumn.setCellFactory(column -> { comparedResultColumn.setCellFactory(column -> {
return new TableCell<QuotationMX, String>() { return new TableCell<QuotationMX, String>() {
@Override @Override
@ -334,7 +422,72 @@ public class MyController extends KFXPanelController {
utilizationRateColumn.setCellFactory((tableColumn) -> new EditingCellOR<QuotationMX>()); utilizationRateColumn.setCellFactory((tableColumn) -> new EditingCellOR<QuotationMX>());
unitColumn.setCellFactory((tableColumn) -> new EditingCellOR<QuotationMX>()); unitColumn.setCellFactory((tableColumn) -> new EditingCellOR<QuotationMX>());
unitPriceColumn.setCellFactory((tableColumn) -> new EditingCellOR<QuotationMX>()); unitPriceColumn.setCellFactory((tableColumn) -> new EditingCellOR<QuotationMX>());
amountColumn.setCellFactory((tableColumn) -> new EditingCellOR<QuotationMX>()); amountColumn.setCellFactory(column -> {
return new TableCell<QuotationMX, String>() {
@Override
protected void updateItem(String item, boolean empty) {
super.updateItem(item, empty);
if (item != null && !empty && !item.isEmpty()) {
BigDecimal decimal = new BigDecimal(item);
int roundedInt = decimal.setScale(0, BigDecimal.ROUND_HALF_UP).intValue();
setText(roundedInt+"");
setAlignment(Pos.CENTER); // 设置单元格内容居中对齐
}
}
};
});
comparedQuantityColumn.setCellFactory(column -> {
return new TableCell<QuotationMX, 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 (contrastPrice == 0) {
// 不做格式
setStyle("");
} else if (contrastPrice < 0) {
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); // 设置单元格内容居中对齐
}
}
};
});
comparedUnitPriceColumn.setCellFactory(column -> {
return new TableCell<QuotationMX, 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 (contrastPrice == 0) {
// 不做格式
setStyle("");
} else if (contrastPrice < 0) {
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); // 设置单元格内容居中对齐
}
}
};
});
comparedResultColumn.setCellFactory(column -> { comparedResultColumn.setCellFactory(column -> {
return new TableCell<QuotationMX, String>() { return new TableCell<QuotationMX, String>() {
@Override @Override
@ -366,17 +519,19 @@ public class MyController extends KFXPanelController {
@Override @Override
public void initData(KFXPanel paramKFXPanel) throws Exception { public void initData(KFXPanel paramKFXPanel) throws Exception {
// 设置表格单元格的间距比例 // 设置表格单元格的间距比例
no.prefWidthProperty().bind(materialsTable.widthProperty().multiply(0.06)); no.prefWidthProperty().bind(materialsTable.widthProperty().multiply(0.05));
materialNameColumn.prefWidthProperty().bind(materialsTable.widthProperty().multiply(0.1)); materialNameColumn.prefWidthProperty().bind(materialsTable.widthProperty().multiply(0.07));
relatedMaterialColumn.prefWidthProperty().bind(materialsTable.widthProperty().multiply(0.1)); relatedMaterialColumn.prefWidthProperty().bind(materialsTable.widthProperty().multiply(0.07));
specificationColumn.prefWidthProperty().bind(materialsTable.widthProperty().multiply(0.2)); specificationColumn.prefWidthProperty().bind(materialsTable.widthProperty().multiply(0.17));
manufacturerColumn.prefWidthProperty().bind(materialsTable.widthProperty().multiply(0.15)); manufacturerColumn.prefWidthProperty().bind(materialsTable.widthProperty().multiply(0.16));
quantityColumn.prefWidthProperty().bind(materialsTable.widthProperty().multiply(0.07)); quantityColumn.prefWidthProperty().bind(materialsTable.widthProperty().multiply(0.06));
utilizationRateColumn.prefWidthProperty().bind(materialsTable.widthProperty().multiply(0.05)); utilizationRateColumn.prefWidthProperty().bind(materialsTable.widthProperty().multiply(0.05));
unitColumn.prefWidthProperty().bind(materialsTable.widthProperty().multiply(0.05)); unitColumn.prefWidthProperty().bind(materialsTable.widthProperty().multiply(0.05));
unitPriceColumn.prefWidthProperty().bind(materialsTable.widthProperty().multiply(0.06)); unitPriceColumn.prefWidthProperty().bind(materialsTable.widthProperty().multiply(0.06));
amountColumn.prefWidthProperty().bind(materialsTable.widthProperty().multiply(0.07)); amountColumn.prefWidthProperty().bind(materialsTable.widthProperty().multiply(0.06));
comparedResultColumn.prefWidthProperty().bind(materialsTable.widthProperty().multiply(0.09)); comparedQuantityColumn.prefWidthProperty().bind(materialsTable.widthProperty().multiply(0.06));
comparedUnitPriceColumn.prefWidthProperty().bind(materialsTable.widthProperty().multiply(0.06));
comparedResultColumn.prefWidthProperty().bind(materialsTable.widthProperty().multiply(0.08));
String sql1 = "SELECT DISTINCT \"cbdlx\" FROM \"CHINT_ QUOTATION_LOV\""; String sql1 = "SELECT DISTINCT \"cbdlx\" FROM \"CHINT_ QUOTATION_LOV\"";
System.out.println(sql1); System.out.println(sql1);
@ -389,6 +544,8 @@ public class MyController extends KFXPanelController {
costSheetTypeComboBox.getSelectionModel().select(type.indexOf("报价成本单")); costSheetTypeComboBox.getSelectionModel().select(type.indexOf("报价成本单"));
operationType = "报价成本单";
// 查询版次 // 查询版次
String sql2 = "SELECT \"revision\" FROM \"CHINT_ CUSQUOTATION_TITLE_TEMPLATE\" where \"projectid\" = '" String sql2 = "SELECT \"revision\" FROM \"CHINT_ CUSQUOTATION_TITLE_TEMPLATE\" where \"projectid\" = '"
@ -439,8 +596,15 @@ public class MyController extends KFXPanelController {
voltageLevelTextField.setText(ButtonCellEditor.cusquotation.getVollevel()); voltageLevelTextField.setText(ButtonCellEditor.cusquotation.getVollevel());
if (ButtonCellEditor.cusquotation.getChangereason() == null) {
ButtonCellEditor.cusquotation.setChangereason("");
}
changeReason.setText(ButtonCellEditor.cusquotation.getChangereason());
if (ButtonCellEditor.tableList.size() > 0) { if (ButtonCellEditor.tableList.size() > 0) {
totalPriceTextField.setText(ButtonCellEditor.tableList.get(0).getTotalprice()); BigDecimal decimal = new BigDecimal(ButtonCellEditor.tableList.get(0).getTotalprice());
int roundedInt = decimal.setScale(0, BigDecimal.ROUND_HALF_UP).intValue();
totalPriceTextField.setText(roundedInt + "");
} }
// 设置只读 // 设置只读
@ -481,6 +645,12 @@ public class MyController extends KFXPanelController {
amountColumn.setCellValueFactory(new PropertyValueFactory<>("amomoney")); amountColumn.setCellValueFactory(new PropertyValueFactory<>("amomoney"));
amountColumn.setSortable(false); amountColumn.setSortable(false);
comparedQuantityColumn.setCellValueFactory(new PropertyValueFactory<>("comparedQuantityColumn"));
comparedQuantityColumn.setSortable(false);
comparedUnitPriceColumn.setCellValueFactory(new PropertyValueFactory<>("comparedUnitPriceColumn"));
comparedUnitPriceColumn.setSortable(false);
comparedResultColumn.setCellValueFactory(new PropertyValueFactory<>("contrastPrice")); comparedResultColumn.setCellValueFactory(new PropertyValueFactory<>("contrastPrice"));
comparedResultColumn.setSortable(false); comparedResultColumn.setSortable(false);
@ -503,20 +673,15 @@ public class MyController extends KFXPanelController {
// 成本单类型下拉框,按钮监听 // 成本单类型下拉框,按钮监听
costSheetTypeComboBox.setOnAction(event -> { costSheetTypeComboBox.setOnAction(event -> {
String selectedItemType = costSheetTypeComboBox.getSelectionModel().getSelectedItem(); operationType = costSheetTypeComboBox.getSelectionModel().getSelectedItem();
// 根据选择的成本单类型刷新版本下拉框 // 根据选择的成本单类型刷新版本下拉框
try { try {
String revsql = "SELECT \"revision\" FROM \"CHINT_ CUSQUOTATION_TITLE_TEMPLATE\" where \"projectid\" = '"
+ ButtonCellEditor.cusquotation.getProjectid() + "' and \"cbdlx\" = '" + selectedItemType
+ "' order by \"revision\" asc";
System.out.println(revsql);
ResultSet resultRev = SqlUtil.read(revsql);
List<String> revisions = new ArrayList<String>(); List<String> revisions = new ArrayList<String>();
while (resultRev.next()) { // 递归获取成本单数据
revisions.add(resultRev.getString("revision")); getOperationData(paramKFXPanel, revisions);
}
// 清空版本下拉框 // 清空版本下拉框
editionComboBox.getItems().clear(); editionComboBox.getItems().clear();
if (revisions.size() > 0) { if (revisions.size() > 0) {
@ -537,9 +702,9 @@ public class MyController extends KFXPanelController {
// 开始刷新数据,设置只能查看数据 // 开始刷新数据,设置只能查看数据
System.out.println("开始刷新头表数据"); System.out.println("开始刷新头表数据");
String selSQL = "SELECT \"cbdlx\",\"projectid\",\"revision\",\"factory\",\"proname\",\"tennumber\",\"promanager\",\"quantity\",\"tramodel\",\"capfactor\",\"volratio\",\"noloadloss\",\"loadloss\",\"impvoltage\",\"traweight\",\"totweight\",\"copconsumption\",\"cmarketprice\",\"vollevel\" FROM \"CHINT_ CUSQUOTATION_TITLE_TEMPLATE\" where \"projectid\" = '" String selSQL = "SELECT \"cbdlx\",\"projectid\",\"revision\",\"factory\",\"proname\",\"tennumber\",\"promanager\",\"quantity\",\"tramodel\",\"capfactor\",\"volratio\",\"noloadloss\",\"loadloss\",\"impvoltage\",\"traweight\",\"totweight\",\"copconsumption\",\"cmarketprice\",\"vollevel\",\"changereason\" FROM \"CHINT_ CUSQUOTATION_TITLE_TEMPLATE\" where \"projectid\" = '"
+ ButtonCellEditor.cusquotation.getProjectid() + "' and \"revision\" = '" + rev + ButtonCellEditor.cusquotation.getProjectid() + "' and \"revision\" = '" + rev
+ "' and \"cbdlx\" = '" + costSheetTypeComboBox.getSelectionModel().getSelectedItem() + "'"; + "' and \"cbdlx\" = '" + operationType + "'";
// 根据查询结果更新数据 // 根据查询结果更新数据
System.out.println(selSQL); System.out.println(selSQL);
try { try {
@ -561,6 +726,13 @@ public class MyController extends KFXPanelController {
copperAmountTextField.setText(QuotationUtil.formatString(result.getString("copconsumption"))); copperAmountTextField.setText(QuotationUtil.formatString(result.getString("copconsumption")));
copperMarketPriceTextField.setText(QuotationUtil.formatString(result.getString("cmarketprice"))); copperMarketPriceTextField.setText(QuotationUtil.formatString(result.getString("cmarketprice")));
voltageLevelTextField.setText(result.getString("vollevel")); voltageLevelTextField.setText(result.getString("vollevel"));
// 处理更改原因字段
if (result.getString("changereason") == null) {
changeReason.setText("");
} else {
changeReason.setText(result.getString("changereason"));
}
} }
} catch (SQLException e1) { } catch (SQLException e1) {
// TODO Auto-generated catch block // TODO Auto-generated catch block
@ -570,8 +742,8 @@ public class MyController extends KFXPanelController {
System.out.println("开始刷新明细数据"); System.out.println("开始刷新明细数据");
try { try {
String reSql = "SELECT * FROM \"CHINT_ CUSQUOTATION_ DETAILS_TEMPLATE\" WHERE \"projectid\"='" String reSql = "SELECT * FROM \"CHINT_ CUSQUOTATION_ DETAILS_TEMPLATE\" WHERE \"projectid\"='"
+ ButtonCellEditor.cusquotation.getProjectid() + "' and \"cbdlx\" = '" + ButtonCellEditor.cusquotation.getProjectid() + "' and \"cbdlx\" = '" + operationType
+ costSheetTypeComboBox.getSelectionModel().getSelectedItem() + "' and \"revision\" = '" + rev + "' and \"revision\" = '" + rev
+ "' order by \"matgroup\" asc,TO_NUMBER(\"mgsnumber\") asc ,TO_NUMBER(\"matcnumber\") asc,TO_NUMBER(\"no\") asc"; + "' order by \"matgroup\" asc,TO_NUMBER(\"mgsnumber\") asc ,TO_NUMBER(\"matcnumber\") asc,TO_NUMBER(\"no\") asc";
System.out.println("reSql:" + reSql); System.out.println("reSql:" + reSql);
ResultSet reSql1 = SqlUtil.read(reSql); ResultSet reSql1 = SqlUtil.read(reSql);
@ -599,6 +771,8 @@ public class MyController extends KFXPanelController {
quotationMX.setUnitprice( quotationMX.setUnitprice(
new SimpleStringProperty(QuotationUtil.formatString(reSql1.getString("unitprice")))); new SimpleStringProperty(QuotationUtil.formatString(reSql1.getString("unitprice"))));
quotationMX.setNo(new SimpleStringProperty(reSql1.getString("no"))); quotationMX.setNo(new SimpleStringProperty(reSql1.getString("no")));
quotationMX.setComparedQuantityColumn(new SimpleStringProperty(""));
quotationMX.setComparedUnitPriceColumn(new SimpleStringProperty(""));
quotationMX.setContrastPrice(new SimpleStringProperty("")); quotationMX.setContrastPrice(new SimpleStringProperty(""));
quotationMX.setTotalprice( quotationMX.setTotalprice(
new SimpleStringProperty(QuotationUtil.formatString(reSql1.getString("totalprice")))); new SimpleStringProperty(QuotationUtil.formatString(reSql1.getString("totalprice"))));
@ -627,6 +801,8 @@ public class MyController extends KFXPanelController {
quotationMX.setAmomoney(new SimpleStringProperty(tableList.get(j).getAmomoney())); quotationMX.setAmomoney(new SimpleStringProperty(tableList.get(j).getAmomoney()));
quotationMX.setUnitprice(new SimpleStringProperty(tableList.get(j).getUnitprice())); quotationMX.setUnitprice(new SimpleStringProperty(tableList.get(j).getUnitprice()));
quotationMX.setNo(new SimpleStringProperty(tableList.get(j).getNo())); quotationMX.setNo(new SimpleStringProperty(tableList.get(j).getNo()));
quotationMX.setComparedQuantityColumn(new SimpleStringProperty(""));
quotationMX.setComparedUnitPriceColumn(new SimpleStringProperty(""));
quotationMX.setContrastPrice(new SimpleStringProperty("")); quotationMX.setContrastPrice(new SimpleStringProperty(""));
// quotationMX.setTotalprice(new // quotationMX.setTotalprice(new
// SimpleStringProperty(reSql1.getString("totalprice"))); // SimpleStringProperty(reSql1.getString("totalprice")));
@ -634,12 +810,16 @@ public class MyController extends KFXPanelController {
} }
System.out.println("刷新表格"); System.out.println("刷新表格");
materialsTable.refresh(); materialsTable.refresh();
totalPriceTextField.setText(tableList.get(0).getTotalprice()); BigDecimal decimal = new BigDecimal(tableList.get(0).getTotalprice());
int roundedInt = decimal.setScale(0, BigDecimal.ROUND_HALF_UP).intValue();
totalPriceTextField.setText(roundedInt + "");
} else { } else {
System.out.println("没有找到明细数据,清空金额和对比结果数据"); System.out.println("没有找到明细数据,清空金额和对比结果数据");
// 计算金额 // 计算金额
for (QuotationMX quotationMX : materialsTable.getItems()) { for (QuotationMX quotationMX : materialsTable.getItems()) {
quotationMX.setAmomoney((new SimpleStringProperty(""))); quotationMX.setAmomoney((new SimpleStringProperty("")));
quotationMX.setComparedQuantityColumn(new SimpleStringProperty(""));
quotationMX.setComparedUnitPriceColumn(new SimpleStringProperty(""));
quotationMX.setContrastPrice((new SimpleStringProperty(""))); quotationMX.setContrastPrice((new SimpleStringProperty("")));
} }
materialsTable.refresh(); materialsTable.refresh();
@ -654,15 +834,16 @@ public class MyController extends KFXPanelController {
}); });
// 版本下拉框,按钮监听 // 版本下拉框,按钮监听
editionComboBox.setOnAction(event -> { editionComboBox.setOnAction(event -> {
String selectedItem = editionComboBox.getSelectionModel().getSelectedItem(); String selectedItem = editionComboBox.getSelectionModel().getSelectedItem();
// 开始刷新数据,设置只能查看数据 // 开始刷新数据,设置只能查看数据
System.out.println("开始刷新头表数据"); System.out.println("开始刷新头表数据");
String selSQL = "SELECT \"cbdlx\",\"projectid\",\"revision\",\"factory\",\"proname\",\"tennumber\",\"promanager\",\"quantity\",\"tramodel\",\"capfactor\",\"volratio\",\"noloadloss\",\"loadloss\",\"impvoltage\",\"traweight\",\"totweight\",\"copconsumption\",\"cmarketprice\",\"vollevel\" FROM \"CHINT_ CUSQUOTATION_TITLE_TEMPLATE\" where \"projectid\" = '" String selSQL = "SELECT \"cbdlx\",\"projectid\",\"revision\",\"factory\",\"proname\",\"tennumber\",\"promanager\",\"quantity\",\"tramodel\",\"capfactor\",\"volratio\",\"noloadloss\",\"loadloss\",\"impvoltage\",\"traweight\",\"totweight\",\"copconsumption\",\"cmarketprice\",\"vollevel\",\"changereason\" FROM \"CHINT_ CUSQUOTATION_TITLE_TEMPLATE\" where \"projectid\" = '"
+ ButtonCellEditor.cusquotation.getProjectid() + "' and \"revision\" = '" + selectedItem + ButtonCellEditor.cusquotation.getProjectid() + "' and \"revision\" = '" + selectedItem
+ "' and \"cbdlx\" = '" + costSheetTypeComboBox.getSelectionModel().getSelectedItem() + "'"; + "' and \"cbdlx\" = '" + operationType + "'";
// 根据查询结果更新数据 // 根据查询结果更新数据
System.out.println(selSQL); System.out.println(selSQL);
try { try {
@ -684,6 +865,12 @@ public class MyController extends KFXPanelController {
copperAmountTextField.setText(QuotationUtil.formatString(result.getString("copconsumption"))); copperAmountTextField.setText(QuotationUtil.formatString(result.getString("copconsumption")));
copperMarketPriceTextField.setText(QuotationUtil.formatString(result.getString("cmarketprice"))); copperMarketPriceTextField.setText(QuotationUtil.formatString(result.getString("cmarketprice")));
voltageLevelTextField.setText(result.getString("vollevel")); voltageLevelTextField.setText(result.getString("vollevel"));
// 处理更改原因字段
if (result.getString("changereason") == null) {
changeReason.setText("");
} else {
changeReason.setText(result.getString("changereason"));
}
} }
} catch (SQLException e1) { } catch (SQLException e1) {
// TODO Auto-generated catch block // TODO Auto-generated catch block
@ -693,9 +880,8 @@ public class MyController extends KFXPanelController {
System.out.println("开始刷新明细数据"); System.out.println("开始刷新明细数据");
try { try {
String reSql = "SELECT * FROM \"CHINT_ CUSQUOTATION_ DETAILS_TEMPLATE\" WHERE \"projectid\"='" String reSql = "SELECT * FROM \"CHINT_ CUSQUOTATION_ DETAILS_TEMPLATE\" WHERE \"projectid\"='"
+ ButtonCellEditor.cusquotation.getProjectid() + "' and \"cbdlx\" = '" + ButtonCellEditor.cusquotation.getProjectid() + "' and \"cbdlx\" = '" + operationType
+ costSheetTypeComboBox.getSelectionModel().getSelectedItem() + "' and \"revision\" = '" + "' and \"revision\" = '" + selectedItem
+ selectedItem
+ "' order by \"matgroup\" asc,TO_NUMBER(\"mgsnumber\") asc ,TO_NUMBER(\"matcnumber\") asc,TO_NUMBER(\"no\") asc"; + "' order by \"matgroup\" asc,TO_NUMBER(\"mgsnumber\") asc ,TO_NUMBER(\"matcnumber\") asc,TO_NUMBER(\"no\") asc";
System.out.println("reSql:" + reSql); System.out.println("reSql:" + reSql);
ResultSet reSql1 = SqlUtil.read(reSql); ResultSet reSql1 = SqlUtil.read(reSql);
@ -723,6 +909,8 @@ public class MyController extends KFXPanelController {
quotationMX.setUnitprice( quotationMX.setUnitprice(
new SimpleStringProperty(QuotationUtil.formatString(reSql1.getString("unitprice")))); new SimpleStringProperty(QuotationUtil.formatString(reSql1.getString("unitprice"))));
quotationMX.setNo(new SimpleStringProperty(reSql1.getString("no"))); quotationMX.setNo(new SimpleStringProperty(reSql1.getString("no")));
quotationMX.setComparedQuantityColumn(new SimpleStringProperty(""));
quotationMX.setComparedUnitPriceColumn(new SimpleStringProperty(""));
quotationMX.setContrastPrice(new SimpleStringProperty("")); quotationMX.setContrastPrice(new SimpleStringProperty(""));
quotationMX.setTotalprice( quotationMX.setTotalprice(
new SimpleStringProperty(QuotationUtil.formatString(reSql1.getString("totalprice")))); new SimpleStringProperty(QuotationUtil.formatString(reSql1.getString("totalprice"))));
@ -751,6 +939,8 @@ public class MyController extends KFXPanelController {
quotationMX.setAmomoney(new SimpleStringProperty(tableList.get(j).getAmomoney())); quotationMX.setAmomoney(new SimpleStringProperty(tableList.get(j).getAmomoney()));
quotationMX.setUnitprice(new SimpleStringProperty(tableList.get(j).getUnitprice())); quotationMX.setUnitprice(new SimpleStringProperty(tableList.get(j).getUnitprice()));
quotationMX.setNo(new SimpleStringProperty(tableList.get(j).getNo())); quotationMX.setNo(new SimpleStringProperty(tableList.get(j).getNo()));
quotationMX.setComparedQuantityColumn(new SimpleStringProperty(""));
quotationMX.setComparedUnitPriceColumn(new SimpleStringProperty(""));
quotationMX.setContrastPrice(new SimpleStringProperty("")); quotationMX.setContrastPrice(new SimpleStringProperty(""));
// quotationMX.setTotalprice(new // quotationMX.setTotalprice(new
// SimpleStringProperty(reSql1.getString("totalprice"))); // SimpleStringProperty(reSql1.getString("totalprice")));
@ -758,12 +948,16 @@ public class MyController extends KFXPanelController {
} }
System.out.println("刷新表格"); System.out.println("刷新表格");
materialsTable.refresh(); materialsTable.refresh();
totalPriceTextField.setText(tableList.get(0).getTotalprice()); BigDecimal decimal = new BigDecimal(tableList.get(0).getTotalprice());
int roundedInt = decimal.setScale(0, BigDecimal.ROUND_HALF_UP).intValue();
totalPriceTextField.setText(roundedInt + "");
} else { } else {
System.out.println("没有找到明细数据,清空金额和对比结果数据"); System.out.println("没有找到明细数据,清空金额和对比结果数据");
// 计算金额 // 计算金额
for (QuotationMX quotationMX : materialsTable.getItems()) { for (QuotationMX quotationMX : materialsTable.getItems()) {
quotationMX.setAmomoney((new SimpleStringProperty(""))); quotationMX.setAmomoney((new SimpleStringProperty("")));
quotationMX.setComparedQuantityColumn(new SimpleStringProperty(""));
quotationMX.setComparedUnitPriceColumn(new SimpleStringProperty(""));
quotationMX.setContrastPrice((new SimpleStringProperty(""))); quotationMX.setContrastPrice((new SimpleStringProperty("")));
} }
materialsTable.refresh(); materialsTable.refresh();
@ -797,8 +991,16 @@ public class MyController extends KFXPanelController {
// MessageBox.post("不能选择“报价成本单”进行保存", "提示", MessageBox.INFORMATION); // MessageBox.post("不能选择“报价成本单”进行保存", "提示", MessageBox.INFORMATION);
return; return;
} }
// 计算金额
calculate(paramKFXPanel);
// 自动对比
if (moneyList != null && selectedItem != null && !"".equals(selectedItem)) {
compare(paramKFXPanel);
}
// 保存或者更新头表 // 保存或者更新头表
String newCbdlx = costSheetTypeComboBox.getSelectionModel().getSelectedItem(); String newCbdlx = selectedItem;
String newProjectid = ButtonCellEditor.cusquotation.getProjectid(); String newProjectid = ButtonCellEditor.cusquotation.getProjectid();
String newRevision = editionComboBox.getSelectionModel().getSelectedItem(); String newRevision = editionComboBox.getSelectionModel().getSelectedItem();
String newFactory = ButtonCellEditor.cusquotation.getFactory(); String newFactory = ButtonCellEditor.cusquotation.getFactory();
@ -817,12 +1019,12 @@ public class MyController extends KFXPanelController {
String newCopconsumption = copperAmountTextField.getText(); String newCopconsumption = copperAmountTextField.getText();
String newCmarketprice = copperMarketPriceTextField.getText(); String newCmarketprice = copperMarketPriceTextField.getText();
String newVollevel = voltageLevelTextField.getText(); String newVollevel = voltageLevelTextField.getText();
String newchangeReason = changeReason.getText();
// 判断数据库中是否已经存在表行 // 判断数据库中是否已经存在表行
boolean isExist = true; boolean isExist = true;
String set = "select * from \"CHINT_ CUSQUOTATION_TITLE_TEMPLATE\" where \"cbdlx\" = '" String set = "select * from \"CHINT_ CUSQUOTATION_TITLE_TEMPLATE\" where \"cbdlx\" = '" + selectedItem
+ costSheetTypeComboBox.getSelectionModel().getSelectedItem() + "' and \"projectid\" = '" + "' and \"projectid\" = '" + ButtonCellEditor.cusquotation.getProjectid()
+ ButtonCellEditor.cusquotation.getProjectid() + "' and \"revision\" = '" + "' and \"revision\" = '" + editionComboBox.getSelectionModel().getSelectedItem() + "'";
+ editionComboBox.getSelectionModel().getSelectedItem() + "'";
System.out.println("set:" + set); System.out.println("set:" + set);
try { try {
ResultSet read = SqlUtil.read(set); ResultSet read = SqlUtil.read(set);
@ -832,15 +1034,15 @@ public class MyController extends KFXPanelController {
String updateTop = "UPDATE \"CHINT_ CUSQUOTATION_TITLE_TEMPLATE\" SET \"cbdlx\" = '" + newCbdlx String updateTop = "UPDATE \"CHINT_ CUSQUOTATION_TITLE_TEMPLATE\" SET \"cbdlx\" = '" + newCbdlx
+ "', \"projectid\" = '" + newProjectid + "', \"revision\" = '" + newRevision + "', \"projectid\" = '" + newProjectid + "', \"revision\" = '" + newRevision
+ "', \"factory\" = '" + newFactory + "', \"proname\" = '" + newProname + "', \"factory\" = '" + newFactory + "', \"proname\" = '" + newProname
+ "', \"tennumber\" = '" + newTennumber + "', \"promanager\" = '" + newPromanager + "', \"changereason\" = '" + newchangeReason + "', \"tennumber\" = '" + newTennumber
+ "', \"quantity\" = '" + newQuantity + "', \"tramodel\" = '" + newTramodel + "', \"promanager\" = '" + newPromanager + "', \"quantity\" = '" + newQuantity
+ "', \"capfactor\" = '" + newCapfactor + "', \"volratio\" = '" + newVolratio + "', \"tramodel\" = '" + newTramodel + "', \"capfactor\" = '" + newCapfactor
+ "', \"noloadloss\" = '" + newNoloadloss + "', \"loadloss\" = '" + newLoadloss + "', \"volratio\" = '" + newVolratio + "', \"noloadloss\" = '" + newNoloadloss
+ "', \"impvoltage\" = '" + newImpvoltage + "', \"traweight\" = '" + newTraweight + "', \"loadloss\" = '" + newLoadloss + "', \"impvoltage\" = '" + newImpvoltage
+ "', \"totweight\" = '" + newTotweight + "', \"copconsumption\" = '" + newCopconsumption + "', \"traweight\" = '" + newTraweight + "', \"totweight\" = '" + newTotweight
+ "', \"cmarketprice\" = '" + newCmarketprice + "', \"vollevel\" = '" + newVollevel + "', \"copconsumption\" = '" + newCopconsumption + "', \"cmarketprice\" = '"
+ "' where \"cbdlx\" = '" + costSheetTypeComboBox.getSelectionModel().getSelectedItem() + newCmarketprice + "', \"vollevel\" = '" + newVollevel + "' where \"cbdlx\" = '"
+ "' and \"projectid\" = '" + ButtonCellEditor.cusquotation.getProjectid() + selectedItem + "' and \"projectid\" = '" + ButtonCellEditor.cusquotation.getProjectid()
+ "' and \"revision\" = '" + editionComboBox.getSelectionModel().getSelectedItem() + "'"; + "' and \"revision\" = '" + editionComboBox.getSelectionModel().getSelectedItem() + "'";
System.out.println("insertTop:" + updateTop); System.out.println("insertTop:" + updateTop);
SqlUtil.update(updateTop); SqlUtil.update(updateTop);
@ -849,26 +1051,25 @@ public class MyController extends KFXPanelController {
// 将关联的明细表数据删除,重新插入数据 // 将关联的明细表数据删除,重新插入数据
String deleSql = "DELETE FROM \"CHINT_ CUSQUOTATION_ DETAILS_TEMPLATE\" where \"cbdlx\" = '" String deleSql = "DELETE FROM \"CHINT_ CUSQUOTATION_ DETAILS_TEMPLATE\" where \"cbdlx\" = '"
+ costSheetTypeComboBox.getSelectionModel().getSelectedItem() + "' and \"projectid\" = '" + selectedItem + "' and \"projectid\" = '" + ButtonCellEditor.cusquotation.getProjectid()
+ ButtonCellEditor.cusquotation.getProjectid() + "' and \"revision\" = '" + "' and \"revision\" = '" + editionComboBox.getSelectionModel().getSelectedItem() + "'";
+ editionComboBox.getSelectionModel().getSelectedItem() + "'";
SqlUtil.delete(deleSql); SqlUtil.delete(deleSql);
// 将关联的对比结果信息表删除,重新插入数据 // 将关联的对比结果信息表删除,重新插入数据
String deleteDataSql = "DELETE FROM \"CHINT_DBCUSQUOTATION_ DETAILS_TEMPLATE\" where \"cbdlx\" = '" String deleteDataSql = "DELETE FROM \"CHINT_DBCUSQUOTATION_ DETAILS_TEMPLATE\" where \"cbdlx\" = '"
+ costSheetTypeComboBox.getSelectionModel().getSelectedItem() + "' and \"projectid\" = '" + selectedItem + "' and \"projectid\" = '" + ButtonCellEditor.cusquotation.getProjectid()
+ ButtonCellEditor.cusquotation.getProjectid() + "' and \"revision\" = '" + "' and \"revision\" = '" + editionComboBox.getSelectionModel().getSelectedItem()
+ editionComboBox.getSelectionModel().getSelectedItem() + "' and \"dbcbdlx\" = '" + "' and \"dbcbdlx\" = '" + comparedCostSheetTextField.getText() + "'";
+ comparedCostSheetTextField.getText() + "'";
SqlUtil.delete(deleteDataSql); SqlUtil.delete(deleteDataSql);
} else { } else {
// 插入数据 // 插入数据
String insertTop = "INSERT INTO \"CHINT_ CUSQUOTATION_TITLE_TEMPLATE\"(\"cbdlx\",\"projectid\",\"revision\",\"factory\",\"proname\",\"tennumber\",\"promanager\",\"quantity\",\"tramodel\",\"capfactor\",\"volratio\",\"noloadloss\",\"loadloss\",\"impvoltage\",\"traweight\",\"totweight\",\"copconsumption\",\"cmarketprice\",\"vollevel\") values('" String insertTop = "INSERT INTO \"CHINT_ CUSQUOTATION_TITLE_TEMPLATE\"(\"cbdlx\",\"projectid\",\"revision\",\"factory\",\"proname\",\"tennumber\",\"promanager\",\"quantity\",\"tramodel\",\"capfactor\",\"volratio\",\"noloadloss\",\"loadloss\",\"impvoltage\",\"traweight\",\"totweight\",\"copconsumption\",\"cmarketprice\",\"vollevel\",\"changereason\") values('"
+ newCbdlx + "','" + newProjectid + "','" + newRevision + "','" + newFactory + "','" + newCbdlx + "','" + newProjectid + "','" + newRevision + "','" + newFactory + "','"
+ newProname + "','" + newTennumber + "','" + newPromanager + "','" + newQuantity + "','" + newProname + "','" + newTennumber + "','" + newPromanager + "','" + newQuantity + "','"
+ newTramodel + "','" + newCapfactor + "','" + newVolratio + "','" + newNoloadloss + "','" + newTramodel + "','" + newCapfactor + "','" + newVolratio + "','" + newNoloadloss + "','"
+ newLoadloss + "','" + newImpvoltage + "','" + newTraweight + "','" + newTotweight + "','" + newLoadloss + "','" + newImpvoltage + "','" + newTraweight + "','" + newTotweight + "','"
+ newCopconsumption + "','" + newCmarketprice + "','" + newVollevel + "')"; + newCopconsumption + "','" + newCmarketprice + "','" + newVollevel + "','"
+ newchangeReason + "')";
System.out.println("insertTop:" + insertTop); System.out.println("insertTop:" + insertTop);
SqlUtil.write(insertTop); SqlUtil.write(insertTop);
System.out.println("插入数据成功"); System.out.println("插入数据成功");
@ -943,10 +1144,17 @@ public class MyController extends KFXPanelController {
if (quotationMX.getContrastPrice() != null) { if (quotationMX.getContrastPrice() != null) {
dbjg = quotationMX.getContrastPrice(); dbjg = quotationMX.getContrastPrice();
} }
String dbjgquantity = "";
if (quotationMX.getComparedQuantityColumn() != null) {
dbjgquantity = quotationMX.getComparedQuantityColumn();
}
String dbjgunit = "";
if (quotationMX.getComparedUnitPriceColumn() != null) {
dbjgunit = quotationMX.getComparedUnitPriceColumn();
}
// 保存明细表 // 保存明细表
String insert = "INSERT INTO \"CHINT_ CUSQUOTATION_ DETAILS_TEMPLATE\"(\"cbdlx\",\"projectid\",\"revision\",\"matgroup\",\"mgsnumber\",\"matcname\",\"matcnumber\",\"matcatname\",\"specifications\",\"manufacturer\",\"nwquantity\",\"utirate\",\"unit\",\"amomoney\",\"unitprice\",\"no\",\"totalprice\") values('" String insert = "INSERT INTO \"CHINT_ CUSQUOTATION_ DETAILS_TEMPLATE\"(\"cbdlx\",\"projectid\",\"revision\",\"matgroup\",\"mgsnumber\",\"matcname\",\"matcnumber\",\"matcatname\",\"specifications\",\"manufacturer\",\"nwquantity\",\"utirate\",\"unit\",\"amomoney\",\"unitprice\",\"no\",\"totalprice\") values('"
+ costSheetTypeComboBox.getSelectionModel().getSelectedItem() + "','" + selectedItem + "','" + ButtonCellEditor.cusquotation.getProjectid() + "','"
+ ButtonCellEditor.cusquotation.getProjectid() + "','"
+ editionComboBox.getSelectionModel().getSelectedItem() + "','" + group + "','" + Mgsnumber + editionComboBox.getSelectionModel().getSelectedItem() + "','" + group + "','" + Mgsnumber
+ "','" + Matcname + "','" + Matcnumber + "','" + Matcatname + "','" + Specifications + "','" + "','" + Matcname + "','" + Matcnumber + "','" + Matcatname + "','" + Specifications + "','"
+ Manufacturer + "','" + Nwquantity + "','" + Utirate + "','" + Unit + "','" + Amomoney + "','" + Manufacturer + "','" + Nwquantity + "','" + Utirate + "','" + Unit + "','" + Amomoney + "','"
@ -959,9 +1167,8 @@ public class MyController extends KFXPanelController {
if (dbmatcatnameList != null && dbmatcatnameList.size() > 0) { if (dbmatcatnameList != null && dbmatcatnameList.size() > 0) {
// 保存成本单对比结果信息表 // 保存成本单对比结果信息表
// 保存明细表 // 保存明细表
String insert1 = "INSERT INTO \"CHINT_DBCUSQUOTATION_ DETAILS_TEMPLATE\"(\"cbdlx\",\"dbcbdlx\",\"projectid\",\"revision\",\"dbrevision\",\"dbjg\",\"factory\",\"matgroup\",\"mgsnumber\",\"matcname\",\"matcnumber\",\"matcatname\",\"dbmatcatname\",\"specifications\",\"manufacturer\",\"nwquantity\",\"dbnwquantity\",\"utirate\",\"dbutirate\",\"unit\",\"dbunit\",\"amomoney\",\"dbamomoney\",\"unitprice\",\"dbunitprice\",\"no\",\"Dbno\",\"totalprice\",\"dbtotalprice\") values('" String insert1 = "INSERT INTO \"CHINT_DBCUSQUOTATION_ DETAILS_TEMPLATE\"(\"cbdlx\",\"dbcbdlx\",\"projectid\",\"revision\",\"dbrevision\",\"dbjg\",\"factory\",\"matgroup\",\"mgsnumber\",\"matcname\",\"matcnumber\",\"matcatname\",\"dbmatcatname\",\"specifications\",\"manufacturer\",\"nwquantity\",\"dbnwquantity\",\"utirate\",\"dbutirate\",\"unit\",\"dbunit\",\"amomoney\",\"dbamomoney\",\"unitprice\",\"dbunitprice\",\"no\",\"Dbno\",\"totalprice\",\"dbtotalprice\",\"dbjgquantity\",\"dbjgunit\") values('"
+ costSheetTypeComboBox.getSelectionModel().getSelectedItem() + "','" + selectedItem + "','" + comparedCostSheetTextField.getText() + "','"
+ comparedCostSheetTextField.getText() + "','"
+ ButtonCellEditor.cusquotation.getProjectid() + "','" + ButtonCellEditor.cusquotation.getProjectid() + "','"
+ editionComboBox.getSelectionModel().getSelectedItem() + "','" + dbRevList.get(a) + "','" + editionComboBox.getSelectionModel().getSelectedItem() + "','" + dbRevList.get(a) + "','"
+ dbjg + "','" + newFactory + "','" + group + "','" + Mgsnumber + "','" + Matcname + "','" + dbjg + "','" + newFactory + "','" + group + "','" + Mgsnumber + "','" + Matcname + "','"
@ -970,7 +1177,7 @@ public class MyController extends KFXPanelController {
+ Utirate + "','" + dbutirateList.get(a) + "','" + Unit + "','" + dbunitList.get(a) + "','" + Utirate + "','" + dbutirateList.get(a) + "','" + Unit + "','" + dbunitList.get(a) + "','"
+ Amomoney + "','" + moneyList.get(a) + "','" + Unitprice + "','" + dbunitpriceList.get(a) + Amomoney + "','" + moneyList.get(a) + "','" + Unitprice + "','" + dbunitpriceList.get(a)
+ "','" + No + "','" + DbnoList.get(a) + "','" + Totalprice + "','" + "','" + No + "','" + DbnoList.get(a) + "','" + Totalprice + "','"
+ dbtotalpriceList.get(a) + "')"; + dbtotalpriceList.get(a) + "','" + dbjgquantity + "','" + dbjgunit + "')";
System.out.println("insert:" + insert1); System.out.println("insert:" + insert1);
System.out.println("插入数据库:" + insert1); System.out.println("插入数据库:" + insert1);
@ -986,10 +1193,9 @@ public class MyController extends KFXPanelController {
.getTypeComponent("ZT2_COSTSHEET"); .getTypeComponent("ZT2_COSTSHEET");
String itemId = tccomponentitemtype.getNewID(); String itemId = tccomponentitemtype.getNewID();
String itemRev = tccomponentitemtype.getNewRev(null); String itemRev = tccomponentitemtype.getNewRev(null);
TCComponentItem item = tccomponentitemtype.create(itemId, itemRev, "ZT2_COSTSHEET", TCComponentItem item = tccomponentitemtype.create(itemId, itemRev, "ZT2_COSTSHEET", selectedItem,
costSheetTypeComboBox.getSelectionModel().getSelectedItem(), "", null); "", null);
item.getLatestItemRevision().setProperty("zt2_cbdlx", item.getLatestItemRevision().setProperty("zt2_cbdlx", selectedItem);
costSheetTypeComboBox.getSelectionModel().getSelectedItem());
item.getLatestItemRevision().setProperty("object_desc", item.getLatestItemRevision().setProperty("object_desc",
ButtonCellEditor.cusquotation.getProjectid()); ButtonCellEditor.cusquotation.getProjectid());
// 挂在选中的文件夹下面 // 挂在选中的文件夹下面
@ -1007,35 +1213,7 @@ public class MyController extends KFXPanelController {
// 计算金额按钮 // 计算金额按钮
calculateButton.setOnAction(event -> { calculateButton.setOnAction(event -> {
// 计算金额 calculate(paramKFXPanel);
for (QuotationMX quotationMX : materialsTable.getItems()) {
if (quotationMX.getUnitprice() == null || "".equals(quotationMX.getUnitprice())
|| quotationMX.getNwquantity() == null || "".equals(quotationMX.getNwquantity())
|| quotationMX.getUtirate() == null || "".equals(quotationMX.getUtirate())
|| quotationMX.getUnit() == null || "".equals(quotationMX.getUnit())) {
MessageBox.post(paramKFXPanel.getParentDialog(), "数量、单价、利用率、单位存在为空。请检查", "提示",
MessageBox.INFORMATION);
// MessageBox.post("数量、单价、利用率、单位存在为空。请检查", "提示", MessageBox.INFORMATION);
return;
}
double price = Double.valueOf(quotationMX.getUnitprice());
double quantity = Double.valueOf(quotationMX.getNwquantity());
double utirate = Double.valueOf(quotationMX.getUtirate());
double amomoney = (price * quantity) / utirate;
quotationMX.setAmomoney(new SimpleStringProperty(QuotationUtil.formatString(df.format(amomoney) + "")));
}
materialsTable.refresh();
// 计算总价
Double total = 0.00;
for (QuotationMX quotationMX : materialsTable.getItems()) {
String amomoney = quotationMX.getAmomoney();
if (amomoney == null || "".equals(amomoney)) {
amomoney = "0";
}
Double money = Double.valueOf(amomoney);
total += money;
}
totalPriceTextField.setText(QuotationUtil.formatString(total + ""));
}); });
@ -1062,14 +1240,8 @@ public class MyController extends KFXPanelController {
} }
// 弹出对比窗口 // 弹出对比窗口
System.out.println("弹出对比窗口"); System.out.println("弹出对比窗口");
// //获取父窗口
// Window parentWindow = selectComparisonButton.getScene().getWindow();
// java.awt.Window awtWindow = null;
// if (Platform.isFxApplicationThread()) {
// awtWindow = new java.awt.Window((java.awt.Frame) SwingUtilities.getAncestorOfClass(java.awt.Frame.class, new JFXPanel()));
// }
String[] options = selectType.toArray(new String[selectType.size()]); String[] options = selectType.toArray(new String[selectType.size()]);
// String[] options = { "Option 1", "Option 2", "Option 3" };
String selectedOption = (String) JOptionPane.showInputDialog(paramKFXPanel.getParentDialog(), "选择要对比的成本单", String selectedOption = (String) JOptionPane.showInputDialog(paramKFXPanel.getParentDialog(), "选择要对比的成本单",
"选择成本单", JOptionPane.PLAIN_MESSAGE, null, options, options[0]); "选择成本单", JOptionPane.PLAIN_MESSAGE, null, options, options[0]);
@ -1119,6 +1291,7 @@ public class MyController extends KFXPanelController {
moneyList.add(resultSet4.getString("amomoney")); moneyList.add(resultSet4.getString("amomoney"));
dbunitpriceList.add(resultSet4.getString("unitprice")); dbunitpriceList.add(resultSet4.getString("unitprice"));
DbnoList.add(resultSet4.getString("no")); DbnoList.add(resultSet4.getString("no"));
if (zjdbjg) { if (zjdbjg) {
dbtotalpriceList.add("0"); dbtotalpriceList.add("0");
} else { } else {
@ -1149,17 +1322,20 @@ public class MyController extends KFXPanelController {
if (revList.size() > 0) { if (revList.size() > 0) {
try { try {
String reSql = "SELECT \"dbjg\" FROM \"CHINT_DBCUSQUOTATION_ DETAILS_TEMPLATE\" WHERE \"projectid\"='" String reSql = "SELECT \"dbjg\",\"dbjgquantity\",\"dbjgunit\" FROM \"CHINT_DBCUSQUOTATION_ DETAILS_TEMPLATE\" WHERE \"projectid\"='"
+ ButtonCellEditor.cusquotation.getProjectid() + "' and \"cbdlx\" = '" + ButtonCellEditor.cusquotation.getProjectid() + "' and \"cbdlx\" = '" + operationType
+ costSheetTypeComboBox.getSelectionModel().getSelectedItem() + "' and \"revision\" = '" + "' and \"revision\" = '" + editionComboBox.getSelectionModel().getSelectedItem()
+ editionComboBox.getSelectionModel().getSelectedItem() + "' and \"dbrevision\" = '" + "' and \"dbrevision\" = '" + revList.get(0) + "' and \"dbcbdlx\"='" + selectedOption
+ revList.get(0) + "' and \"dbcbdlx\"='" + selectedOption
+ "' order by \"matgroup\" asc,TO_NUMBER(\"mgsnumber\") asc ,TO_NUMBER(\"matcnumber\") asc,TO_NUMBER(\"no\") asc"; + "' order by \"matgroup\" asc,TO_NUMBER(\"mgsnumber\") asc ,TO_NUMBER(\"matcnumber\") asc,TO_NUMBER(\"no\") asc";
System.out.println("reSql:" + reSql); System.out.println("reSql:" + reSql);
ResultSet reSql1 = SqlUtil.read(reSql); ResultSet reSql1 = SqlUtil.read(reSql);
ArrayList<String> tableList = new ArrayList<String>(); ArrayList<String> tableList = new ArrayList<String>();
ArrayList<String> dbjgquantityList = new ArrayList<String>();
ArrayList<String> dbjgunitlList = new ArrayList<String>();
while (reSql1.next()) { while (reSql1.next()) {
tableList.add(QuotationUtil.formatString(reSql1.getString("dbjg"))); tableList.add(QuotationUtil.formatString(reSql1.getString("dbjg")));
dbjgquantityList.add(QuotationUtil.formatString(reSql1.getString("dbjgquantity")));
dbjgunitlList.add(QuotationUtil.formatString(reSql1.getString("dbjgunit")));
} }
if (tableList.size() > 0) { if (tableList.size() > 0) {
System.out.println("查询到了对比结果明细数据,开始插入"); System.out.println("查询到了对比结果明细数据,开始插入");
@ -1169,7 +1345,19 @@ public class MyController extends KFXPanelController {
if (tableList.get(j) == null || "".equals(tableList.get(j))) { if (tableList.get(j) == null || "".equals(tableList.get(j))) {
tableList.set(j, "0"); tableList.set(j, "0");
} }
if (dbjgquantityList.get(j) == null || "".equals(dbjgquantityList.get(j))) {
dbjgquantityList.set(j, "0");
}
if (dbjgunitlList.get(j) == null || "".equals(dbjgunitlList.get(j))) {
dbjgunitlList.set(j, "0");
}
System.out.println(tableList.get(j)); System.out.println(tableList.get(j));
System.out.println(dbjgquantityList.get(j));
System.out.println(dbjgunitlList.get(j));
quotationMX.setComparedQuantityColumn(
new SimpleStringProperty(QuotationUtil.formatString(dbjgquantityList.get(j))));
quotationMX.setComparedUnitPriceColumn(
new SimpleStringProperty(QuotationUtil.formatString(dbjgunitlList.get(j))));
quotationMX.setContrastPrice( quotationMX.setContrastPrice(
new SimpleStringProperty(QuotationUtil.formatString(tableList.get(j)))); new SimpleStringProperty(QuotationUtil.formatString(tableList.get(j))));
} }
@ -1208,79 +1396,212 @@ public class MyController extends KFXPanelController {
return; return;
} }
if (costSheetTypeComboBox.getSelectionModel().getSelectedItem() == null if (operationType == null || "".equals(operationType)) {
|| "".equals(costSheetTypeComboBox.getSelectionModel().getSelectedItem())) {
MessageBox.post(paramKFXPanel.getParentDialog(), "请选择对比成本单", "提示", MessageBox.INFORMATION); MessageBox.post(paramKFXPanel.getParentDialog(), "请选择对比成本单", "提示", MessageBox.INFORMATION);
// MessageBox.post("请选择对比成本单", "提示", MessageBox.INFORMATION); // MessageBox.post("请选择对比成本单", "提示", MessageBox.INFORMATION);
return; return;
} }
// 判断数量、利用率、单价是否为数字 compare(paramKFXPanel);
for (int i = 0; i < materialsTable.getItems().size(); i++) {
QuotationMX quotationMX = materialsTable.getItems().get(i);
String nwquantity = quotationMX.getNwquantity();
try {
Double.parseDouble(nwquantity);
} catch (NumberFormatException e) {
MessageBox.post(paramKFXPanel.getParentDialog(), "表格数量存在非法数,请修正", "提示", MessageBox.INFORMATION);
return;
}
String utirate = quotationMX.getUtirate(); });
try {
Double.parseDouble(utirate);
} catch (NumberFormatException e) {
MessageBox.post(paramKFXPanel.getParentDialog(), "表格利用率存在非法数,请修正", "提示", MessageBox.INFORMATION);
return;
}
String unitprice = quotationMX.getUnitprice(); }
try {
Double.parseDouble(unitprice); /**
} catch (NumberFormatException e) { *
MessageBox.post(paramKFXPanel.getParentDialog(), "表格单价存在非法数,请修正", "提示", MessageBox.INFORMATION); * @param revisions
return; * @param operationType
* @Title: getOperationData
* @Description:
* @param
* @return void
* @throws SQLException
* @throws
*/
private void getOperationData(KFXPanel paramKFXPanel, List<String> revisions)
throws SQLException {
// TODO Auto-generated method stub
String revsql = "SELECT \"revision\" FROM \"CHINT_ CUSQUOTATION_TITLE_TEMPLATE\" where \"projectid\" = '"
+ ButtonCellEditor.cusquotation.getProjectid() + "' and \"cbdlx\" = '" + operationType
+ "' order by \"revision\" asc";
System.out.println(revsql);
ResultSet resultRev = SqlUtil.read(revsql);
while (resultRev.next()) {
revisions.add(resultRev.getString("revision"));
}
if (revisions.size() == 0) {
// 查找目标字符串在数组中的索引
int index = -1;
for (int i = 0; i < QUOTATIONTYPE.length; i++) {
if (QUOTATIONTYPE[i].equals(operationType)) {
index = i;
break;
} }
} }
if (index > 0) {
String previousString = QUOTATIONTYPE[index - 1];
operationType = previousString;
getOperationData(paramKFXPanel, revisions);
} else {
MessageBox.post(paramKFXPanel.getParentDialog(), "查询报价单出了问题,请联系管理员查看数据库类型数据是否为" + QUOTATIONTYPE, "提示",
MessageBox.INFORMATION);
return;
}
System.out.println("表格长度:" + materialsTable.getItems().size()); }
// 获取当前表格用户填写情况 }
for (int i = 0; i < materialsTable.getItems().size(); i++) {
QuotationMX quotationMX = materialsTable.getItems().get(i); /**
String amomoney = quotationMX.getAmomoney(); *
if (amomoney == null || "".equals(amomoney.trim())) { * @Title: calculate
amomoney = "0"; * @Description:
} * @param @param paramKFXPanel
BigDecimal newjine = new BigDecimal(Double.valueOf(amomoney)); * @return void
if (moneyList.get(i) == null || "".equals(moneyList.get(i))) { * @throws
moneyList.set(i, "0"); */
} public void calculate(KFXPanel paramKFXPanel) {
BigDecimal oldjine = new BigDecimal(Double.valueOf(moneyList.get(i))); // 计算金额
double absPercent = newjine.subtract(oldjine).doubleValue(); // 减法 for (QuotationMX quotationMX : materialsTable.getItems()) {
System.out.println(absPercent + ""); if (quotationMX.getUnitprice() == null || "".equals(quotationMX.getUnitprice())
quotationMX.setContrastPrice( || quotationMX.getNwquantity() == null || "".equals(quotationMX.getNwquantity())
new SimpleStringProperty(QuotationUtil.formatString(df.format(absPercent) + ""))); || quotationMX.getUtirate() == null || "".equals(quotationMX.getUtirate())
|| quotationMX.getUnit() == null || "".equals(quotationMX.getUnit())) {
MessageBox.post(paramKFXPanel.getParentDialog(), "数量、单价、利用率、单位存在为空。请检查", "提示", MessageBox.INFORMATION);
// MessageBox.post("数量、单价、利用率、单位存在为空。请检查", "提示", MessageBox.INFORMATION);
return;
} }
materialsTable.refresh(); double price = Double.valueOf(quotationMX.getUnitprice());
// 计算总价 double quantity = Double.valueOf(quotationMX.getNwquantity());
Double total = 0.00; double utirate = Double.valueOf(quotationMX.getUtirate());
for (String amomoney : moneyList) { double amomoney = (price * quantity) / utirate;
if (amomoney == null || "".equals(amomoney.trim())) { quotationMX.setAmomoney(new SimpleStringProperty(QuotationUtil.formatString(df.format(amomoney) + "")));
amomoney = "0"; }
} materialsTable.refresh();
System.out.println(amomoney); // 计算总价
Double money = Double.valueOf(amomoney); Double total = 0.00;
total += money; for (QuotationMX quotationMX : materialsTable.getItems()) {
String amomoney = quotationMX.getAmomoney();
if (amomoney == null || "".equals(amomoney)) {
amomoney = "0";
} }
BigDecimal newTotalPrice = new BigDecimal(Double.valueOf(totalPriceTextField.getText())); Double money = Double.valueOf(amomoney);
System.out.println("当前页面选择的对比单总金额为:" + newTotalPrice.toString()); total += money;
BigDecimal oldTotalPrice = new BigDecimal(total); }
System.out.println("选择的要对比的对比单单总金额为:" + oldTotalPrice.toString()); totalPriceTextField.setText(QuotationUtil.formatString(total + ""));
double absPercent = newTotalPrice.subtract(oldTotalPrice).doubleValue(); // 减法 }
System.out.println("当前对比单减选择的对比单得:" + absPercent);
totalPriceCompareTextField.setText(QuotationUtil.formatString(absPercent + ""));
}); /**
*
* @Title: compare
* @Description:
* @param @param paramKFXPanel
* @return void
* @throws
*/
public void compare(KFXPanel paramKFXPanel) {
// 判断数量、利用率、单价是否为数字
for (int i = 0; i < materialsTable.getItems().size(); i++) {
QuotationMX quotationMX = materialsTable.getItems().get(i);
String nwquantity = quotationMX.getNwquantity();
try {
Double.parseDouble(nwquantity);
} catch (NumberFormatException e) {
MessageBox.post(paramKFXPanel.getParentDialog(), "表格数量存在非法数,请修正", "提示", MessageBox.INFORMATION);
return;
}
String utirate = quotationMX.getUtirate();
try {
Double.parseDouble(utirate);
} catch (NumberFormatException e) {
MessageBox.post(paramKFXPanel.getParentDialog(), "表格利用率存在非法数,请修正", "提示", MessageBox.INFORMATION);
return;
}
String unitprice = quotationMX.getUnitprice();
try {
Double.parseDouble(unitprice);
} catch (NumberFormatException e) {
MessageBox.post(paramKFXPanel.getParentDialog(), "表格单价存在非法数,请修正", "提示", MessageBox.INFORMATION);
return;
}
}
System.out.println("表格长度:" + materialsTable.getItems().size());
// 获取当前表格用户填写情况
for (int i = 0; i < materialsTable.getItems().size(); i++) {
QuotationMX quotationMX = materialsTable.getItems().get(i);
// 获取对比数量
String quantity = quotationMX.getNwquantity();
if (quantity == null || "".equals(quantity.trim())) {
quantity = "0";
}
BigDecimal newquantity = new BigDecimal(Double.valueOf(quantity));
if (dbnwquantityList.get(i) == null || "".equals(dbnwquantityList.get(i))) {
dbnwquantityList.set(i, "0");
}
BigDecimal oldquantity = new BigDecimal(Double.valueOf(dbnwquantityList.get(i)));
double dbQuantity = newquantity.subtract(oldquantity).doubleValue(); // 减法
System.out.println(dbQuantity + "");
// 获取对比单价
String unitPrice = quotationMX.getUnitprice();
if (unitPrice == null || "".equals(unitPrice.trim())) {
unitPrice = "0";
}
BigDecimal newunitPrice = new BigDecimal(Double.valueOf(unitPrice));
if (dbunitpriceList.get(i) == null || "".equals(dbunitpriceList.get(i))) {
dbunitpriceList.set(i, "0");
}
BigDecimal oldunitPrice = new BigDecimal(Double.valueOf(dbunitpriceList.get(i)));
double dbUnitPriceResult = newunitPrice.subtract(oldunitPrice).doubleValue(); // 减法
System.out.println(dbUnitPriceResult + "");
// 获取对比金额
String amomoney = quotationMX.getAmomoney();
if (amomoney == null || "".equals(amomoney.trim())) {
amomoney = "0";
}
BigDecimal newjine = new BigDecimal(Double.valueOf(amomoney));
if (moneyList.get(i) == null || "".equals(moneyList.get(i))) {
moneyList.set(i, "0");
}
BigDecimal oldjine = new BigDecimal(Double.valueOf(moneyList.get(i)));
double absPercent = newjine.subtract(oldjine).doubleValue(); // 减法
System.out.println(absPercent + "");
quotationMX.setComparedQuantityColumn(
new SimpleStringProperty(QuotationUtil.formatString(df.format(dbQuantity) + "")));
quotationMX.setComparedUnitPriceColumn(
new SimpleStringProperty(QuotationUtil.formatString(df.format(dbUnitPriceResult) + "")));
quotationMX
.setContrastPrice(new SimpleStringProperty(QuotationUtil.formatString(df.format(absPercent) + "")));
materialsTable.refresh();
}
// 计算总价
Double total = 0.00;
for (String amomoney : moneyList) {
if (amomoney == null || "".equals(amomoney.trim())) {
amomoney = "0";
}
System.out.println(amomoney);
Double money = Double.valueOf(amomoney);
total += money;
}
BigDecimal newTotalPrice = new BigDecimal(Double.valueOf(totalPriceTextField.getText()));
System.out.println("当前页面选择的对比单总金额为:" + newTotalPrice.toString());
BigDecimal oldTotalPrice = new BigDecimal(total);
System.out.println("选择的要对比的对比单单总金额为:" + oldTotalPrice.toString());
double absPercent = newTotalPrice.subtract(oldTotalPrice).doubleValue(); // 减法
System.out.println("当前对比单减选择的对比单得:" + absPercent);
totalPriceCompareTextField.setText(QuotationUtil.formatString(absPercent + ""));
} }
} }

@ -6,6 +6,7 @@
<?import javafx.scene.control.Label?> <?import javafx.scene.control.Label?>
<?import javafx.scene.control.TableColumn?> <?import javafx.scene.control.TableColumn?>
<?import javafx.scene.control.TableView?> <?import javafx.scene.control.TableView?>
<?import javafx.scene.control.TextArea?>
<?import javafx.scene.control.TextField?> <?import javafx.scene.control.TextField?>
<?import javafx.scene.layout.AnchorPane?> <?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.BorderPane?> <?import javafx.scene.layout.BorderPane?>
@ -78,17 +79,19 @@
<center> <center>
<TableView fx:id="materialsTable" prefHeight="320.0" prefWidth="1302.0" BorderPane.alignment="CENTER"> <TableView fx:id="materialsTable" prefHeight="320.0" prefWidth="1302.0" BorderPane.alignment="CENTER">
<columns> <columns>
<TableColumn fx:id="no" prefWidth="75.0" /> <TableColumn fx:id="no" prefWidth="54.0" />
<TableColumn fx:id="materialNameColumn" prefWidth="126.0" text="材料名称" /> <TableColumn fx:id="materialNameColumn" prefWidth="78.0" text="材料名称" />
<TableColumn fx:id="relatedMaterialColumn" prefWidth="122.0" text="材料名称" /> <TableColumn fx:id="relatedMaterialColumn" prefWidth="76.0" text="材料名称" />
<TableColumn fx:id="specificationColumn" prefWidth="250.0" text="规格" /> <TableColumn fx:id="specificationColumn" prefWidth="223.0" text="规格" />
<TableColumn fx:id="manufacturerColumn" minWidth="0.0" prefWidth="203.0" text="制造厂商" /> <TableColumn fx:id="manufacturerColumn" minWidth="0.0" prefWidth="215.0" text="制造厂商" />
<TableColumn fx:id="quantityColumn" prefWidth="91.0" text="数量(净重)" /> <TableColumn fx:id="quantityColumn" prefWidth="81.0" text="数量(净重)" />
<TableColumn fx:id="utilizationRateColumn" prefWidth="69.0" text="利用率" /> <TableColumn fx:id="utilizationRateColumn" prefWidth="71.0" text="利用率" />
<TableColumn fx:id="unitColumn" prefWidth="70.0" text="单位" /> <TableColumn fx:id="unitColumn" prefWidth="60.0" text="单位" />
<TableColumn fx:id="unitPriceColumn" prefWidth="86.0" text="单价(元)" /> <TableColumn fx:id="unitPriceColumn" prefWidth="89.0" text="单价(元)" />
<TableColumn fx:id="amountColumn" prefWidth="94.0" text="金额(元)" /> <TableColumn fx:id="amountColumn" prefWidth="85.0" text="金额(元)" />
<TableColumn fx:id="comparedResultColumn" prefWidth="115.0" text="对比结果(元)" /> <TableColumn fx:id="comparedQuantityColumn" prefWidth="74.0" text="对比数量" />
<TableColumn fx:id="comparedUnitPriceColumn" prefWidth="75.0" text="对比单价" />
<TableColumn fx:id="comparedResultColumn" prefWidth="114.0" text="对比结果(元)" />
</columns> </columns>
</TableView> </TableView>
</center> </center>
@ -97,13 +100,42 @@
<center> <center>
<FlowPane alignment="CENTER_RIGHT" prefHeight="200.0" prefWidth="200.0" BorderPane.alignment="CENTER"> <FlowPane alignment="CENTER_RIGHT" prefHeight="200.0" prefWidth="200.0" BorderPane.alignment="CENTER">
<children> <children>
<FlowPane alignment="CENTER" prefHeight="43.0" prefWidth="447.0">
<children>
<Label alignment="CENTER" contentDisplay="CENTER" nodeOrientation="LEFT_TO_RIGHT" text="颜色备注:">
<FlowPane.margin>
<Insets top="10.0" />
</FlowPane.margin>
</Label>
<TextField editable="false" prefHeight="20.0" prefWidth="37.0" style="-fx-background-color: #FF6600;">
<FlowPane.margin>
<Insets top="10.0" />
</FlowPane.margin>
</TextField>
<Label text=":代表亏损 ">
<FlowPane.margin>
<Insets top="10.0" />
</FlowPane.margin>
</Label>
<TextField editable="false" prefHeight="20.0" prefWidth="37.0" style="-fx-background-color: #A9D08E;">
<FlowPane.margin>
<Insets top="10.0" />
</FlowPane.margin>
</TextField>
<Label text=":代表盈利 ">
<FlowPane.margin>
<Insets top="10.0" />
</FlowPane.margin>
</Label>
</children>
</FlowPane>
<Label prefWidth="86.0" text=" 总价:" /> <Label prefWidth="86.0" text=" 总价:" />
<TextField fx:id="totalPriceTextField" prefHeight="30.0" prefWidth="131.0" /> <TextField fx:id="totalPriceTextField" prefHeight="30.0" prefWidth="131.0" />
</children> </children>
</FlowPane> </FlowPane>
</center> </center>
<bottom> <bottom>
<FlowPane alignment="CENTER_RIGHT" prefHeight="50.0" prefWidth="314.0" BorderPane.alignment="CENTER"> <FlowPane alignment="CENTER_RIGHT" prefHeight="50.0" prefWidth="1237.0" BorderPane.alignment="CENTER">
<children> <children>
<Label text="总价对比结果:" /> <Label text="总价对比结果:" />
<TextField fx:id="totalPriceCompareTextField" prefHeight="30.0" prefWidth="131.0" /> <TextField fx:id="totalPriceCompareTextField" prefHeight="30.0" prefWidth="131.0" />
@ -150,6 +182,8 @@
<Insets right="15.0" /> <Insets right="15.0" />
</padding> </padding>
</GridPane> </GridPane>
<TextArea fx:id="changeReason" layoutX="106.0" layoutY="794.0" prefHeight="106.0" prefWidth="450.0" AnchorPane.bottomAnchor="1.0" />
<Label layoutX="37.0" layoutY="796.0" text="更改原因:" AnchorPane.bottomAnchor="90.0" />
</children> </children>
<padding> <padding>
<Insets bottom="30.0" left="5.0" right="5.0" top="10.0" /> <Insets bottom="30.0" left="5.0" right="5.0" top="10.0" />

@ -2,7 +2,7 @@ package com.connor.plm.CreateOuotation;
public class test { public class test {
public static void main(String[] args) { public static void main(String[] args) {
double contrastPrice = Double.parseDouble("0"); double contrastPrice = Double.parseDouble("0.00");
System.out.println(contrastPrice == 0); System.out.println(contrastPrice == 0);
} }

@ -23,7 +23,14 @@ import com.teamcenter.rac.kernel.TCComponentItem;
import com.teamcenter.rac.kernel.TCComponentItemRevision; import com.teamcenter.rac.kernel.TCComponentItemRevision;
import com.teamcenter.rac.kernel.TCSession; import com.teamcenter.rac.kernel.TCSession;
import com.teamcenter.rac.util.MessageBox; import com.teamcenter.rac.util.MessageBox;
/**
*
* @ClassName: sendGXToMOMOperation
* @Description: MOM
* @author hcj
* @date 202415
*
*/
public class sendGXToMOMOperation extends AbstractAIFOperation { public class sendGXToMOMOperation extends AbstractAIFOperation {
private TCSession session; private TCSession session;
private TCComponentItemRevision revision; private TCComponentItemRevision revision;
@ -57,7 +64,7 @@ public class sendGXToMOMOperation extends AbstractAIFOperation {
System.out.println("获取工作中心"); System.out.println("获取工作中心");
String center = revision.getStringProperty("zt2_WorkCenter"); String center = revision.getStringProperty("zt2_WorkCenter");
System.out.println(center); System.out.println(center);
process.setProcessCode(center); process.setWorkCenter(center);
System.out.println("获取工序类型"); System.out.println("获取工序类型");
String type = revision.getStringProperty("object_type"); String type = revision.getStringProperty("object_type");

Loading…
Cancel
Save