@Override
protected void preProcessJob(Machine machine) {
Set<PlacementSolution> solutions;
// Machine machine = configuration.getMachine();
Head head = machine.getHeads().get(0);
JobPlanner jobPlanner = machine.getJobPlanner();
for (BoardLocation jobBoard : job.getBoardLocations()) {
Board board = jobBoard.getBoard();
for (Placement placement : board.getPlacements()) {
if (placement.getSide() != jobBoard.getSide()) {
continue;
}
Part part = placement.getPart();
if (part == null) {
fireJobEncounteredError(JobError.PartError, String.format("Part not found for Board %s, Placement %s", board.getName(), placement.getId()));
return;
}
}
// Dry run of solutions to look for errors
jobPlanner.setJob(job);
while ((solutions = jobPlanner.getNextPlacementSolutions(head)) != null) {
for (PlacementSolution solution : solutions) {
BoardLocation bl = solution.boardLocation;
Part part = solution.placement.getPart();
Feeder feeder = solution.feeder;