From 5099dfcf8e015c35a2f81986101e08e93a7d7944 Mon Sep 17 00:00:00 2001
From: L <L@123>
Date: 星期一, 13 十月 2025 17:09:01 +0800
Subject: [PATCH] *

---
 src/main/java/com/zy/asrs/utils/GroupedLockerOptimizerUtils.java |   84 +++++++++++++++++++++--------------------
 1 files changed, 43 insertions(+), 41 deletions(-)

diff --git a/src/main/java/com/zy/asrs/utils/GroupedLockerOptimizerUtils.java b/src/main/java/com/zy/asrs/utils/GroupedLockerOptimizerUtils.java
index 0512ba1..e09d705 100644
--- a/src/main/java/com/zy/asrs/utils/GroupedLockerOptimizerUtils.java
+++ b/src/main/java/com/zy/asrs/utils/GroupedLockerOptimizerUtils.java
@@ -28,6 +28,7 @@
     static class Locker {
         int id;
         double remainingSpace;
+        long bindingTags;
         Map<String, Integer> contents;
         Set<String> itemTypes; // 褰撳墠鍌ㄧ墿鏌滀腑鐨勭墿鍝佺绫�
 
@@ -36,6 +37,7 @@
             this.remainingSpace = 1.0;
             this.contents = new HashMap<>();
             this.itemTypes = new HashSet<>();
+            this.bindingTags = System.currentTimeMillis();
         }
 
         public boolean canAdd(Item item, int quantity) {
@@ -122,60 +124,60 @@
         }
     }
 
-//    public static void main(String[] args) {
-//        Scanner scanner = new Scanner(System.in);
-//
-//        System.out.println("璇疯緭鍏ョ墿鍝佺绫绘暟閲�:");
-//        int itemTypes = scanner.nextInt();
-//        scanner.nextLine();
-//
-//        List<Item> items = new ArrayList<>();
-//
-//        for (int i = 0; i < itemTypes; i++) {
-//            System.out.println("\n璇疯緭鍏ョ" + (i + 1) + "绉嶇墿鍝佺殑淇℃伅:");
-//            System.out.print("鐗╁搧鍚嶇О: ");
-//            String name = scanner.nextLine();
-//
-//            System.out.print("鍗曠瀛樻斁鏈�澶ф暟閲�: ");
-//            int maxCapacity = scanner.nextInt();
-//
-//            System.out.print("搴撳瓨鏁伴噺: ");
-//            int stock = scanner.nextInt();
-//            scanner.nextLine();
-//
-//            items.add(new Item(name, maxCapacity, stock));
-//        }
-//
-//        // 浣跨敤鍒嗙粍浼樺厛绠楁硶
-//        PackingSolution solution = packItemsWithGrouping(items);
-//
-//        System.out.println("\n" + solution);
-//
-//        scanner.close();
-//    }
     public static void main(String[] args) {
-        int itemTypes = 5;
+        Scanner scanner = new Scanner(System.in);
+
+        System.out.println("璇疯緭鍏ョ墿鍝佺绫绘暟閲�:");
+        int itemTypes = scanner.nextInt();
+        scanner.nextLine();
 
         List<Item> items = new ArrayList<>();
 
         for (int i = 0; i < itemTypes; i++) {
-            String name = i+"a";
-            int maxCapacity = i*10;
-            int stock = i*11;
+            System.out.println("\n璇疯緭鍏ョ" + (i + 1) + "绉嶇墿鍝佺殑淇℃伅:");
+            System.out.print("鐗╁搧鍚嶇О: ");
+            String name = scanner.nextLine();
+
+            System.out.print("鍗曠瀛樻斁鏈�澶ф暟閲�: ");
+            int maxCapacity = scanner.nextInt();
+
+            System.out.print("搴撳瓨鏁伴噺: ");
+            int stock = scanner.nextInt();
+            scanner.nextLine();
+
             items.add(new Item(name, maxCapacity, stock));
         }
 
         // 浣跨敤鍒嗙粍浼樺厛绠楁硶
         PackingSolution solution = packItemsWithGrouping(items);
-        for (Locker locker:solution.lockers) {
-            for (String mantnr : locker.contents.keySet()){
-                System.out.println(mantnr+"<===>"+locker.contents.get(mantnr));
-            }
-        }
+
         System.out.println("\n" + solution);
 
-//        scanner.close();
+        scanner.close();
     }
+//    public static void main(String[] args) {
+//        int itemTypes = 5;
+//
+//        List<Item> items = new ArrayList<>();
+//
+//        for (int i = 0; i < itemTypes; i++) {
+//            String name = i+"a";
+//            int maxCapacity = i*10;
+//            int stock = i*11;
+//            items.add(new Item(name, maxCapacity, stock));
+//        }
+//
+//        // 浣跨敤鍒嗙粍浼樺厛绠楁硶
+//        PackingSolution solution = packItemsWithGrouping(items);
+//        for (Locker locker:solution.lockers) {
+//            for (String mantnr : locker.contents.keySet()){
+//                System.out.println(mantnr+"<===>"+locker.contents.get(mantnr));
+//            }
+//        }
+//        System.out.println("\n" + solution);
+//
+////        scanner.close();
+//    }
 
     /**
      * 鍒嗙粍浼樺厛瑁呯绠楁硶

--
Gitblit v1.9.1