|
|
@ -45,44 +45,45 @@ public enum ForgeManager implements Runnable { |
|
|
|
Logger.error(e); |
|
|
|
Logger.error(e); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (workOrder == null) { |
|
|
|
// Null workOrders should not exist.
|
|
|
|
Logger.error("NULL workOrder in queue"); |
|
|
|
// Perhaps log?
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (workOrder == null) |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Completed or canceled work orders are not re-enqueued
|
|
|
|
// Completed or canceled work orders are not re-enqueued
|
|
|
|
|
|
|
|
|
|
|
|
if (workOrder.runCanceled || workOrder.runCompleted) |
|
|
|
if (workOrder.runCanceled || workOrder.runCompleted) |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
|
|
|
|
|
|
|
|
// Create in memory items to add to collections
|
|
|
|
// Create in memory items to add to collections
|
|
|
|
forgeItems(workOrder); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Logger.info("item forged:" + workOrder.workOrderID + " (" + workOrder.total_produced + "/" + workOrder.total_to_produce + ")"); |
|
|
|
forgeItems(workOrder); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Logger.info("item forged:" + workOrder.workOrderID + " (" + workOrder.total_produced + "/" + workOrder.total_to_produce + ")"); |
|
|
|
|
|
|
|
|
|
|
|
if (workOrder.total_produced >= workOrder.total_to_produce) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Logger.info("workOrder has completed: " + workOrder.workOrderID); |
|
|
|
if (workOrder.total_produced >= workOrder.total_to_produce) { |
|
|
|
|
|
|
|
|
|
|
|
// Persist current items that are currently building for this
|
|
|
|
Logger.info("workOrder has completed: " + workOrder.workOrderID); |
|
|
|
// worker after first removing the negative id item from all
|
|
|
|
|
|
|
|
// collections.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Add new item to the vendors inventory
|
|
|
|
// Persist current items that are currently building for this
|
|
|
|
|
|
|
|
// worker after first removing the negative id item from all
|
|
|
|
|
|
|
|
// collections.
|
|
|
|
|
|
|
|
|
|
|
|
workOrder.runCompleted = true; |
|
|
|
// Add new item to the vendors inventory
|
|
|
|
workOrder.vendor.workOrders.remove(workOrder); |
|
|
|
|
|
|
|
continue; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
workOrder.runCompleted = true; |
|
|
|
|
|
|
|
workOrder.vendor.workOrders.remove(workOrder); |
|
|
|
|
|
|
|
continue; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// enQueue this workOrder again; back into the oven
|
|
|
|
// enQueue this workOrder again; back into the oven
|
|
|
|
// until all items for this workOrder are completed.
|
|
|
|
// until all items for this workOrder are completed.
|
|
|
|
|
|
|
|
|
|
|
|
workOrder.completionTime = System.currentTimeMillis() + workOrder.rollingDuration; |
|
|
|
workOrder.completionTime = System.currentTimeMillis() + workOrder.rollingDuration; |
|
|
|
forge.add(workOrder); |
|
|
|
forge.add(workOrder); |
|
|
|
Logger.info(workOrder.toString()); |
|
|
|
Logger.info(workOrder.toString()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|