From 2e07d039080562036c78bd7666f1dc4081f1632c Mon Sep 17 00:00:00 2001 From: CodeSteak Date: Wed, 24 Jun 2020 01:48:33 +0200 Subject: [PATCH 1/3] Fix warehouse bookings on CreateOrderAction --- .../org/hso/ecommerce/action/shop/CreateOrderAction.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/prototype/src/main/java/org/hso/ecommerce/action/shop/CreateOrderAction.java b/prototype/src/main/java/org/hso/ecommerce/action/shop/CreateOrderAction.java index 854be3a..0102ced 100644 --- a/prototype/src/main/java/org/hso/ecommerce/action/shop/CreateOrderAction.java +++ b/prototype/src/main/java/org/hso/ecommerce/action/shop/CreateOrderAction.java @@ -13,6 +13,7 @@ import org.hso.ecommerce.entities.warehouse.WarehouseBookingPositionSlotEntry; import java.sql.Timestamp; import java.util.ArrayList; +import java.util.Comparator; import java.util.Date; import java.util.List; @@ -101,7 +102,14 @@ public class CreateOrderAction { for (OrderItem item : orderItems) { int needed = item.quantity; + // Sort for most empty slot first; + item.availableSlots.sort(Comparator.comparingInt(a -> a.newSumSlot)); + for (WarehouseBookingPositionSlotEntry slot : item.availableSlots) { + if (slot.newSumSlot == 0) { + continue; + } + int remove = Math.min(slot.newSumSlot, needed); needed -= remove; From 8bfe8b37f5c5da471bff770708dea578445c590d Mon Sep 17 00:00:00 2001 From: CodeSteak Date: Wed, 24 Jun 2020 02:00:37 +0200 Subject: [PATCH 2/3] Maybe Fix warehouse booking repo --- .../WarehouseBookingPositionSlotEntryRepository.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/prototype/src/main/java/org/hso/ecommerce/repos/warehouse/WarehouseBookingPositionSlotEntryRepository.java b/prototype/src/main/java/org/hso/ecommerce/repos/warehouse/WarehouseBookingPositionSlotEntryRepository.java index ba54b0f..79b6f01 100644 --- a/prototype/src/main/java/org/hso/ecommerce/repos/warehouse/WarehouseBookingPositionSlotEntryRepository.java +++ b/prototype/src/main/java/org/hso/ecommerce/repos/warehouse/WarehouseBookingPositionSlotEntryRepository.java @@ -11,10 +11,10 @@ import java.util.Optional; @Repository public interface WarehouseBookingPositionSlotEntryRepository extends JpaRepository { - @Query(value = "Select e.id, e.article_id, e.new_sum_slot, e.slot_id from warehouse_booking_position_entries as e, warehouse_slots as s where e.slot_id = s.id AND e.article_id = :article GROUP BY s.slot_num HAVING max(e.id)", nativeQuery = true) + @Query(value = "Select e.* from warehouse_booking_position_entries as e, warehouse_slots as s where e.slot_id = s.id AND e.article_id = :article GROUP BY s.slot_num HAVING max(e.id)", nativeQuery = true) List getByArticle(long article); - @Query(value = "Select e.id, e.article_id, e.new_sum_slot, e.slot_id from warehouse_booking_position_entries as e, warehouse_slots as s where e.slot_id = s.id AND s.slot_num = :slotnum GROUP BY s.slot_num HAVING max(e.id)", nativeQuery = true) + @Query(value = "Select e.* from warehouse_booking_position_entries as e, warehouse_slots as s where e.slot_id = s.id AND s.slot_num = :slotnum GROUP BY s.slot_num HAVING max(e.id)", nativeQuery = true) Optional getBySlotNum(long slotnum); } From f0c9823e4569ab84059c896012c2470da856d77b Mon Sep 17 00:00:00 2001 From: CodeSteak Date: Wed, 24 Jun 2020 09:53:19 +0200 Subject: [PATCH 3/3] Clearify Inventory view with text. --- .../resources/templates/intern/warehouse/slots/index.html | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/prototype/src/main/resources/templates/intern/warehouse/slots/index.html b/prototype/src/main/resources/templates/intern/warehouse/slots/index.html index 3d52f6b..b7e47f9 100644 --- a/prototype/src/main/resources/templates/intern/warehouse/slots/index.html +++ b/prototype/src/main/resources/templates/intern/warehouse/slots/index.html @@ -24,6 +24,10 @@
+

+ Es wird der Lagerstand angezeigt, der entsteht nachdem alle austehenden Lagerbuchungen auf der Packliste + angearbeitet wurden. +

Plätze in Verwendung