From e835467af59fb26ca36c21b68e92f4e24d692308 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=87=91=E5=AE=89=E6=B0=91?= <3233449392@qq.com> Date: Wed, 18 Dec 2024 19:48:40 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9C=80=E7=BB=88=E7=89=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db/dbuml.db3 | Bin 86016 -> 90112 bytes src/Main.java | 2 +- src/model/DataGoods.java | 4 ++-- src/model/DataManager.java | 4 ++-- src/view/GoodsManagementView.java | 4 ++-- src/view/InboundView.java | 8 ++++---- src/view/OutboundView.java | 2 +- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/db/dbuml.db3 b/db/dbuml.db3 index 29f8488d73b129d46fe7b7bb912f98a3ff529524..a1ff7e0952b834b81b7e0236cec11c613ad2f166 100644 GIT binary patch delta 1574 zcmaJ>UuauZ9KNUb-rQ_mayql74Ha5t5k^RI|KdRh)y=ZcS zO&Z&3%5BYbIMdO&I;6B*p|O89D=1^IGDH!48l&gl7KGu8FTQwgZgP7YQSy}U{F3iG z-}n7ap-vaRr>g_>7(o!x*`X0Iw)(~*eEKN7hXEoA|Av3TKj9zHf{)>dyAyGGbmi_hCdKF<^h4nelxb3o@(n(zx-=m56!tN`s*sKJ%yia8EE!6bN_~N=CRkYQ9?4 z!(iO}^?DkRCF-QX)Ca@VGF77r)Z5f6R2Drvycs8DFTi5o}s!mu_(|cQA_3bt)yN$wrc?PZB z`*8IwT`4bHC0{*sp=Nej{L-QpJ_>ImNyO?w=7SFzaK;25zrQYAHTlKQvc;i9; zv9qeiDH-Mh=y+;^_a#_<;ix>Ze-HJ(r5r7%{by|1}Peif>!cKF~ANAE5& zm@R_YB0e^EpHO)nhk!~e4pkqfk~CgS;YD)~+^g3fz5t>xq2(L6o7iOZ(RDQO4Q51( zWy@T`h+EhXiUG&)MD{&DO>;k8Bi$N0Oz$?CobriEhso}c|9V`<<#3Pnc#&=u>&yXJ zYwKONqu{?8*6z*uDVxReF6?hrZT2jP@ZM_bu_EO}i5s3iB*b}V kTqd_Qj*8Q+3Ms{@YKMydsFo+e?NyWfh*R2f3BL>f0AD~=Ef$b z24==)76t~EX{dr`CWaQq#wj3M5Guif2Fa5ZD}*<5RqSAA0qNO%tlmz5OO2s{fqw?S z8Q-(XJQLhEhbAoGo&0s~eMZsESLf+7GS{;loy@*KezM7e2b0+XLpDb(JjFDbGOPc;roKcj|!pQu^`o<@_w>|A$$armfpc$jm eb`NvLJsixEi~-Zx9T-hEHi7Lw70w diff --git a/src/Main.java b/src/Main.java index e0d6006..6d5d939 100644 --- a/src/Main.java +++ b/src/Main.java @@ -142,7 +142,7 @@ public class Main extends Application { statusBar.setStyle("-fx-background-color: #e8e8e8;"); Label statusLabel = new Label("就绪"); - Label userLabel = new Label("当前用户:管理员"); + Label userLabel = new Label("当前用户:系统管理员"); Label timeLabel = new Label(getCurrentTime()); Region spacer = new Region(); diff --git a/src/model/DataGoods.java b/src/model/DataGoods.java index b270ed9..7f54225 100644 --- a/src/model/DataGoods.java +++ b/src/model/DataGoods.java @@ -100,7 +100,7 @@ public class DataGoods { pstmt.executeUpdate(); addGoods(goods); // 同步内存中的数据 - DataManager.getInstance().addOperationLog("新增", goods.getId(), "当前用户", "新增货物: " + goods.getName()); + DataManager.getInstance().addOperationLog("新增", goods.getId(), "系统管理员", "新增货物: " + goods.getName()); } catch (SQLException e) { e.printStackTrace(); DataManager.showAlert("错误", "添加货物失败:" + e.getMessage()); @@ -128,7 +128,7 @@ public class DataGoods { pstmt.executeUpdate(); addGoods(goods); // 同步内存中的数据 - DataManager.getInstance().addOperationLog("更新", goods.getId(), "当前用户", "更新货物: " + goods.getName()); + DataManager.getInstance().addOperationLog("更新", goods.getId(), "系统管理员", "更新货物: " + goods.getName()); } catch (SQLException e) { e.printStackTrace(); DataManager.showAlert("错误", "更新货物失败:" + e.getMessage()); diff --git a/src/model/DataManager.java b/src/model/DataManager.java index db9bbb2..01dae6c 100644 --- a/src/model/DataManager.java +++ b/src/model/DataManager.java @@ -324,7 +324,7 @@ public class DataManager { // 将操作日志类型从"新增"改为"修改" System.out.println("正在添加操作日志: " + "修改" + " - " + "修改货物: " + goods.getName()); - addOperationLog("修改", goods.getId(), "当前用户", "修改货物: " + goods.getName()); + addOperationLog("修改", goods.getId(), "系统管理员", "修改货物: " + goods.getName()); } catch (SQLException e) { e.printStackTrace(); showAlert("错误", "添加货物失败:" + e.getMessage()); @@ -347,7 +347,7 @@ public class DataManager { pstmt.executeUpdate(); System.out.println("正在添加操作日志: " + "更新" + " - " + "更新货物: " + goods.getName()); - addOperationLog("更新", goods.getId(), "当前用户", "更新货物: " + goods.getName()); + addOperationLog("更新", goods.getId(), "系统管理员", "更新货物: " + goods.getName()); } catch (SQLException e) { e.printStackTrace(); showAlert("错误", "更新货物失败:" + e.getMessage()); diff --git a/src/view/GoodsManagementView.java b/src/view/GoodsManagementView.java index bd0270d..62ee508 100644 --- a/src/view/GoodsManagementView.java +++ b/src/view/GoodsManagementView.java @@ -229,11 +229,11 @@ public class GoodsManagementView extends BorderPane { "(id, operation_type, operation_target, operator, operation_time, details) " + "VALUES (?, ?, ?, ?, ?, ?)"; try (PreparedStatement logStmt = conn.prepareStatement(logSql)) { - String logId = "LOG" + System.currentTimeMillis(); + String logId = String.format("LOG%014d", System.currentTimeMillis()); logStmt.setString(1, logId); logStmt.setString(2, "修改"); logStmt.setString(3, name); - logStmt.setString(4, "当前用户"); + logStmt.setString(4, "系统管理员"); logStmt.setString(5, LocalDateTime.now().toString()); logStmt.setString(6, String.format("修改货物信息:%s,数量:%d,供应商:%s", name, quantity, supplier)); diff --git a/src/view/InboundView.java b/src/view/InboundView.java index e485037..ec78443 100644 --- a/src/view/InboundView.java +++ b/src/view/InboundView.java @@ -182,7 +182,7 @@ public class InboundView extends BorderPane { } // 创建入库记录 - String id = String.format("NO%014d", System.currentTimeMillis()); + String id = String.format("IN%014d", System.currentTimeMillis()); LocalDateTime now = LocalDateTime.now(); // 修改数据库连接为相对路径 @@ -197,7 +197,7 @@ public class InboundView extends BorderPane { pstmt.setInt(3, quantity); pstmt.setString(4, supplier); pstmt.setString(5, now.toString()); - pstmt.setString(6, "当前用户"); + pstmt.setString(6, "系统管理员"); pstmt.setString(7, remark); pstmt.executeUpdate(); @@ -211,7 +211,7 @@ public class InboundView extends BorderPane { quantity, supplier, now, - "当前用户", + "系统管理员", remark ); @@ -227,7 +227,7 @@ public class InboundView extends BorderPane { // 添加操作日志 String details = String.format("入库货物:%s,数量:%d,供应商:%s", goodsName, quantity, supplier); - DataManager.getInstance().addOperationLog("入库", goodsName, "当前用户", details); + DataManager.getInstance().addOperationLog("入库", goodsName, "系统管理员", details); showAlert("成功", "入库记录已保存!"); diff --git a/src/view/OutboundView.java b/src/view/OutboundView.java index 6b45e12..dae1f34 100644 --- a/src/view/OutboundView.java +++ b/src/view/OutboundView.java @@ -249,7 +249,7 @@ public class OutboundView extends BorderPane { System.out.println("正在添加出库日志: " + details); try { - DataManager.getInstance().addOperationLog("出库", goodsName, "当前用户", details); + DataManager.getInstance().addOperationLog("出库", goodsName, "系统管理员", details); System.out.println("出库日志添加成功"); } catch (Exception e) { System.err.println("添加出库日志失败: " + e.getMessage());