parent
feb70545b9
commit
6f7b275d85
@ -0,0 +1,29 @@
|
||||
package model;
|
||||
|
||||
public class InventoryReport {
|
||||
private String goodsId;
|
||||
private String goodsName;
|
||||
private int totalQuantity;
|
||||
private String supplier;
|
||||
private String remark;
|
||||
|
||||
public InventoryReport(String goodsId, String goodsName, int totalQuantity, String supplier, String remark) {
|
||||
this.goodsId = goodsId;
|
||||
this.goodsName = goodsName;
|
||||
this.totalQuantity = totalQuantity;
|
||||
this.supplier = supplier;
|
||||
this.remark = remark;
|
||||
}
|
||||
|
||||
public String getGoodsId() { return goodsId; }
|
||||
public void setGoodsId(String goodsId) { this.goodsId = goodsId; }
|
||||
public String getGoodsName() { return goodsName; }
|
||||
public void setGoodsName(String goodsName) { this.goodsName = goodsName; }
|
||||
public int getTotalQuantity() { return totalQuantity; }
|
||||
public void setTotalQuantity(int totalQuantity) { this.totalQuantity = totalQuantity; }
|
||||
public String getSupplier() { return supplier; }
|
||||
public void setSupplier(String supplier) { this.supplier = supplier; }
|
||||
public String getRemark() { return remark; }
|
||||
public void setRemark(String remark) { this.remark = remark; }
|
||||
}
|
||||
|
@ -0,0 +1,64 @@
|
||||
package view;
|
||||
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.geometry.Insets;
|
||||
import javafx.geometry.Pos;
|
||||
import javafx.scene.control.*;
|
||||
import javafx.scene.layout.*;
|
||||
import javafx.scene.control.cell.PropertyValueFactory;
|
||||
import model.InventoryReport;
|
||||
import model.DataManager;
|
||||
import java.util.List;
|
||||
|
||||
public class InventoryReportView extends BorderPane {
|
||||
|
||||
private TableView<InventoryReport> tableView;
|
||||
|
||||
public InventoryReportView() {
|
||||
initializeUI();
|
||||
}
|
||||
|
||||
private void initializeUI() {
|
||||
// 顶部标题区域
|
||||
Label titleLabel = new Label("库存报表");
|
||||
titleLabel.setStyle("-fx-font-size: 20px; -fx-font-weight: bold;");
|
||||
titleLabel.setAlignment(Pos.CENTER);
|
||||
setTop(titleLabel);
|
||||
|
||||
// 中间表格区域
|
||||
tableView = createTableView();
|
||||
setCenter(tableView);
|
||||
|
||||
// 加载库存报表数据
|
||||
loadInventoryReportData();
|
||||
}
|
||||
|
||||
private TableView<InventoryReport> createTableView() {
|
||||
TableView<InventoryReport> table = new TableView<>();
|
||||
|
||||
TableColumn<InventoryReport, String> goodsIdCol = new TableColumn<>("货物编号");
|
||||
goodsIdCol.setCellValueFactory(new PropertyValueFactory<>("goodsId"));
|
||||
|
||||
TableColumn<InventoryReport, String> goodsNameCol = new TableColumn<>("货物名称");
|
||||
goodsNameCol.setCellValueFactory(new PropertyValueFactory<>("goodsName"));
|
||||
|
||||
TableColumn<InventoryReport, Integer> totalQuantityCol = new TableColumn<>("总数量");
|
||||
totalQuantityCol.setCellValueFactory(new PropertyValueFactory<>("totalQuantity"));
|
||||
|
||||
TableColumn<InventoryReport, String> supplierCol = new TableColumn<>("供应商");
|
||||
supplierCol.setCellValueFactory(new PropertyValueFactory<>("supplier"));
|
||||
|
||||
TableColumn<InventoryReport, String> remarkCol = new TableColumn<>("备注");
|
||||
remarkCol.setCellValueFactory(new PropertyValueFactory<>("remark"));
|
||||
|
||||
table.getColumns().addAll(goodsIdCol, goodsNameCol, totalQuantityCol, supplierCol, remarkCol);
|
||||
|
||||
return table;
|
||||
}
|
||||
|
||||
private void loadInventoryReportData() {
|
||||
List<InventoryReport> reports = DataManager.generateInventoryReport();
|
||||
tableView.setItems(FXCollections.observableArrayList(reports));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in new issue