diff --git a/db/dbuml.db3 b/db/dbuml.db3 index 29f8488..a1ff7e0 100644 Binary files a/db/dbuml.db3 and b/db/dbuml.db3 differ 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());