From 018418576400b94032731f9dd66c1b6a96a56bae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=9F=8E?= <2304508674@qq.com> Date: Thu, 21 Nov 2024 22:28:47 +0800 Subject: [PATCH] 1 --- .gitignore | 29 +++ .idea/.gitignore | 3 + .idea/dbnavigator.xml | 403 ++++++++++++++++++++++++++++++++++++++++++ .idea/misc.xml | 6 + .idea/modules.xml | 8 + .idea/vcs.xml | 6 + src/Main.java | 171 ++++++++++++++++++ uml.iml | 11 ++ 8 files changed, 637 insertions(+) create mode 100644 .gitignore create mode 100644 .idea/.gitignore create mode 100644 .idea/dbnavigator.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/vcs.xml create mode 100644 src/Main.java create mode 100644 uml.iml diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f68d109 --- /dev/null +++ b/.gitignore @@ -0,0 +1,29 @@ +### IntelliJ IDEA ### +out/ +!**/src/main/**/out/ +!**/src/test/**/out/ + +### Eclipse ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache +bin/ +!**/src/main/**/bin/ +!**/src/test/**/bin/ + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ + +### VS Code ### +.vscode/ + +### Mac OS ### +.DS_Store \ No newline at end of file diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..359bb53 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# 默认忽略的文件 +/shelf/ +/workspace.xml diff --git a/.idea/dbnavigator.xml b/.idea/dbnavigator.xml new file mode 100644 index 0000000..6dafaf6 --- /dev/null +++ b/.idea/dbnavigator.xml @@ -0,0 +1,403 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..0548357 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..7596a8b --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/src/Main.java b/src/Main.java new file mode 100644 index 0000000..32d5fef --- /dev/null +++ b/src/Main.java @@ -0,0 +1,171 @@ +package src; + +import javafx.application.Application; +import javafx.geometry.Insets; +import javafx.scene.Scene; +import javafx.scene.control.*; +import javafx.scene.layout.*; +import javafx.stage.Stage; + +public class Main extends Application { + + private BorderPane contentArea; + + @Override + public void start(Stage primaryStage) { + try { + // 创建主布局 + BorderPane mainLayout = new BorderPane(); + + // 创建菜单栏 + MenuBar menuBar = createMenuBar(); + mainLayout.setTop(menuBar); + + // 创建左侧导航栏 + VBox leftPanel = createLeftPanel(); + mainLayout.setLeft(leftPanel); + + // 创建内容区域 + contentArea = new BorderPane(); + contentArea.setStyle("-fx-background-color: #f4f4f4;"); + contentArea.setPadding(new Insets(10)); + + // 设置默认欢迎页面 + showWelcomePage(); + + mainLayout.setCenter(contentArea); + + // 创建状态栏 + HBox statusBar = createStatusBar(); + mainLayout.setBottom(statusBar); + + // 设置场景 + Scene scene = new Scene(mainLayout, 1200, 800); + primaryStage.setScene(scene); + primaryStage.setTitle("仓库管理系统"); + primaryStage.show(); + + } catch (Exception e) { + e.printStackTrace(); + } + } + + private VBox createLeftPanel() { + VBox leftPanel = new VBox(10); + leftPanel.setPadding(new Insets(10)); + leftPanel.setStyle("-fx-background-color: #e8e8e8;"); + leftPanel.setPrefWidth(200); + + // 创建搜索框 + TextField searchField = new TextField(); + searchField.setPromptText("搜索..."); + + // 创建导航树 + TreeView navigationTree = createNavigationTree(); + + // 添加到左侧面板 + leftPanel.getChildren().addAll(searchField, navigationTree); + VBox.setVgrow(navigationTree, Priority.ALWAYS); + + return leftPanel; + } + + private void showWelcomePage() { + VBox welcomeBox = new VBox(20); + welcomeBox.setAlignment(javafx.geometry.Pos.CENTER); + + Label welcomeLabel = new Label("欢迎使用仓库管理系统"); + welcomeLabel.setStyle("-fx-font-size: 24px; -fx-font-weight: bold;"); + + Label infoLabel = new Label("请从左侧菜单选择要使用的功能"); + infoLabel.setStyle("-fx-font-size: 14px;"); + + welcomeBox.getChildren().addAll(welcomeLabel, infoLabel); + contentArea.setCenter(welcomeBox); + } + + private HBox createStatusBar() { + HBox statusBar = new HBox(10); + statusBar.setPadding(new Insets(5)); + statusBar.setStyle("-fx-background-color: #e8e8e8;"); + + Label statusLabel = new Label("就绪"); + Label userLabel = new Label("当前用户:管理员"); + Label timeLabel = new Label("2024-03-14 10:30:00"); + + Region spacer = new Region(); + HBox.setHgrow(spacer, Priority.ALWAYS); + + statusBar.getChildren().addAll(statusLabel, spacer, userLabel, timeLabel); + + return statusBar; + } + + private MenuBar createMenuBar() { + MenuBar menuBar = new MenuBar(); + + // 系统菜单 + Menu systemMenu = new Menu("系统"); + MenuItem settingsItem = new MenuItem("系统设置"); + MenuItem exitItem = new MenuItem("退出"); + systemMenu.getItems().addAll(settingsItem, exitItem); + + // 库存管理菜单 + Menu inventoryMenu = new Menu("库存管理"); + MenuItem inboundItem = new MenuItem("入库管理"); + MenuItem outboundItem = new MenuItem("出库管理"); + MenuItem queryItem = new MenuItem("库存查询"); + inventoryMenu.getItems().addAll(inboundItem, outboundItem, queryItem); + + // 货物管理菜单 + Menu goodsMenu = new Menu("货物管理"); + MenuItem goodsInfoItem = new MenuItem("货物信息"); + MenuItem categoryItem = new MenuItem("分类管理"); + goodsMenu.getItems().addAll(goodsInfoItem, categoryItem); + + // 报表菜单 + Menu reportMenu = new Menu("报表统计"); + MenuItem inventoryReportItem = new MenuItem("库存报表"); + MenuItem logItem = new MenuItem("操作日志"); + reportMenu.getItems().addAll(inventoryReportItem, logItem); + + menuBar.getMenus().addAll(systemMenu, inventoryMenu, goodsMenu, reportMenu); + return menuBar; + } + + private TreeView createNavigationTree() { + TreeItem root = new TreeItem<>("功能导航"); + root.setExpanded(true); + + // 库存管理 + TreeItem inventory = new TreeItem<>("库存管理"); + inventory.getChildren().addAll( + new TreeItem<>("入库管理"), + new TreeItem<>("出库管理"), + new TreeItem<>("库存查询") + ); + + // 货物管理 + TreeItem goods = new TreeItem<>("货物管理"); + goods.getChildren().addAll( + new TreeItem<>("货物信息"), + new TreeItem<>("分类管理") + ); + + // 报表统计 + TreeItem report = new TreeItem<>("报表统计"); + report.getChildren().addAll( + new TreeItem<>("库存报表"), + new TreeItem<>("操作日志") + ); + + root.getChildren().addAll(inventory, goods, report); + + TreeView tree = new TreeView<>(root); + return tree; + } + + public static void main(String[] args) { + launch(args); + } +} \ No newline at end of file diff --git a/uml.iml b/uml.iml new file mode 100644 index 0000000..c90834f --- /dev/null +++ b/uml.iml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file