diff --git a/src/engine/db/handlers/dbWarehouseHandler.java b/src/engine/db/handlers/dbWarehouseHandler.java index 139303e8..49ec1e8b 100644 --- a/src/engine/db/handlers/dbWarehouseHandler.java +++ b/src/engine/db/handlers/dbWarehouseHandler.java @@ -186,20 +186,27 @@ public class dbWarehouseHandler extends dbHandlerBase { public void LOAD_WORKORDERS() { - ArrayList deleteList = new ArrayList<>(); + ArrayList submitList = new ArrayList<>(); try (Connection connection = DbManager.getConnection(); PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `dyn_workorders`;"); ResultSet rs = preparedStatement.executeQuery()) { while (rs.next()) { - int workOrderID = rs.getInt("workOrderID"); JSONObject jsonObject = new JSONObject(rs.getString("workorder")); WorkOrder workOrder = new WorkOrder(jsonObject); - deleteList.add(workOrder); + submitList.add(workOrder); } } catch (Exception e) { Logger.error(e); } + + // Delete the old records + + for (WorkOrder workOrder : submitList) + DbManager.WarehouseQueries.DELETE_WORKORDER(workOrder); + + // Pass the new workOrders to the ForgeManager + } } diff --git a/src/engine/loot/WorkOrder.java b/src/engine/loot/WorkOrder.java index bc2a0dfd..f1fc288f 100644 --- a/src/engine/loot/WorkOrder.java +++ b/src/engine/loot/WorkOrder.java @@ -49,6 +49,7 @@ public class WorkOrder implements Delayed { public WorkOrder(JSONObject jsonWorkOrder) { + this.workOrderID = jsonWorkOrder.getInt("workOrderID"); this.vendor = NPC.getNPC(jsonWorkOrder.getInt("vendor")); this.slots_used = jsonWorkOrder.getInt("slots_used"); this.total_to_produce = jsonWorkOrder.getInt("total_to_produce");