Merge remote-tracking branch 'origin/master'

# Conflicts:
#	src/Main.java
master
Your Name 8 months ago
commit 57005e40d4

@ -8,7 +8,6 @@ import javafx.scene.control.*;
import javafx.scene.layout.*; import javafx.scene.layout.*;
import javafx.stage.Stage; import javafx.stage.Stage;
import view.InboundView; import view.InboundView;
import view.InventoryView;
import view.OutboundView; import view.OutboundView;
public class Main extends Application { public class Main extends Application {
@ -154,10 +153,10 @@ public class Main extends Application {
// 为出库管理菜单项添加事件处理。 // 为出库管理菜单项添加事件处理。
outboundItem.setOnAction(e -> showOutboundView()); outboundItem.setOnAction(e -> showOutboundView());
// inventoryViewItem.setOnAction(e -> showInventoryView());
menuBar.getMenus().addAll(systemMenu, inventoryMenu, goodsMenu, reportMenu); menuBar.getMenus().addAll(systemMenu, inventoryMenu, goodsMenu, reportMenu);
return menuBar; return menuBar;
} }
private TreeView<String> createNavigationTree() { private TreeView<String> createNavigationTree() {
TreeItem<String> root = new TreeItem<>("功能导航"); TreeItem<String> root = new TreeItem<>("功能导航");
root.setExpanded(true); root.setExpanded(true);
@ -193,9 +192,6 @@ public class Main extends Application {
TreeItem<String> item = tree.getSelectionModel().getSelectedItem(); TreeItem<String> item = tree.getSelectionModel().getSelectedItem();
if (item != null) { if (item != null) {
switch (item.getValue()){ switch (item.getValue()){
case "库存查询":
showInventoryView();
break;
case "入库管理": case "入库管理":
showInboundView(); showInboundView();
break; break;
@ -220,10 +216,6 @@ public class Main extends Application {
OutboundView outboundView = new OutboundView(); OutboundView outboundView = new OutboundView();
contentArea.setCenter(outboundView); contentArea.setCenter(outboundView);
} }
private void showInventoryView() {
InventoryView inventoryView = new InventoryView();
contentArea.setCenter(inventoryView);
}
public static void main(String[] args) { public static void main(String[] args) {
launch(args); launch(args);
} }

@ -71,6 +71,18 @@ public class DataManager {
} }
} }
public static List<InventoryReport> generateInventoryReport() {
List<InventoryReport> reports = new ArrayList<>();
// 这里可以调用数据库或其他数据源获取库存数据
// 示例数据
reports.add(new InventoryReport("G001", "商品A", 100, "供应商A", "无"));
reports.add(new InventoryReport("G002", "商品B", 200, "供应商B", "无"));
reports.add(new InventoryReport("G003", "商品C", 150, "供应商C", "无"));
return reports;
}
public Goods getGoods(String id) { public Goods getGoods(String id) {
return goodsMap.get(id); return goodsMap.get(id);
} }

@ -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…
Cancel
Save