|
|
@ -186,20 +186,27 @@ public class dbWarehouseHandler extends dbHandlerBase { |
|
|
|
|
|
|
|
|
|
|
|
public void LOAD_WORKORDERS() { |
|
|
|
public void LOAD_WORKORDERS() { |
|
|
|
|
|
|
|
|
|
|
|
ArrayList<WorkOrder> deleteList = new ArrayList<>(); |
|
|
|
ArrayList<WorkOrder> submitList = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
|
|
try (Connection connection = DbManager.getConnection(); |
|
|
|
try (Connection connection = DbManager.getConnection(); |
|
|
|
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `dyn_workorders`;"); |
|
|
|
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `dyn_workorders`;"); |
|
|
|
ResultSet rs = preparedStatement.executeQuery()) { |
|
|
|
ResultSet rs = preparedStatement.executeQuery()) { |
|
|
|
|
|
|
|
|
|
|
|
while (rs.next()) { |
|
|
|
while (rs.next()) { |
|
|
|
int workOrderID = rs.getInt("workOrderID"); |
|
|
|
|
|
|
|
JSONObject jsonObject = new JSONObject(rs.getString("workorder")); |
|
|
|
JSONObject jsonObject = new JSONObject(rs.getString("workorder")); |
|
|
|
WorkOrder workOrder = new WorkOrder(jsonObject); |
|
|
|
WorkOrder workOrder = new WorkOrder(jsonObject); |
|
|
|
deleteList.add(workOrder); |
|
|
|
submitList.add(workOrder); |
|
|
|
} |
|
|
|
} |
|
|
|
} catch (Exception e) { |
|
|
|
} catch (Exception e) { |
|
|
|
Logger.error(e); |
|
|
|
Logger.error(e); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Delete the old records
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (WorkOrder workOrder : submitList) |
|
|
|
|
|
|
|
DbManager.WarehouseQueries.DELETE_WORKORDER(workOrder); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Pass the new workOrders to the ForgeManager
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|