diff --git a/src/main/java/com/dreamworks/boditech/driver/consumable/CsmLargeBufferTube.java b/src/main/java/com/dreamworks/boditech/driver/consumable/CsmLargeBufferTube.java index c5e3008..177efbc 100644 --- a/src/main/java/com/dreamworks/boditech/driver/consumable/CsmLargeBufferTube.java +++ b/src/main/java/com/dreamworks/boditech/driver/consumable/CsmLargeBufferTube.java @@ -1,59 +1,45 @@ package com.dreamworks.boditech.driver.consumable; -public class CsmLargeBufferTube { +import com.fasterxml.jackson.annotation.JsonIgnore; +public class CsmLargeBufferTube extends ConsumableBase { + // manager + private final CsmLargeBufferTubeManager manager; + // index of tube : 0 - 5 public Integer index = -1; // if the tube is loaded public Boolean isLoaded = false; - - - // position - public Integer position = -1; - // project id - public Integer projectId = 0; - // project name - public String projectName = ""; - // project color - public String projectColor = ""; // amount public Integer amount; - - public static final String STATUS_NOT_LOADED = "NOT_LOADED"; - public static final String STATUS_LOADED = "LOADED"; - // status - public String status = CsmLargeBufferTube.STATUS_NOT_LOADED; - - // exists - public Boolean exists = false; - - // manager - private final CsmLargeBufferTubeManager manager; - // constructor public CsmLargeBufferTube(CsmLargeBufferTubeManager manager) { this.manager = manager; } // get location x + @JsonIgnore public Integer getLocationX() { Integer startLocation = this.manager.getDevice().getLocationByName("largeBufferTubeAspirationStart.x"); Integer distance = this.manager.getDevice().getLocationByName("largeBufferTubeAspirationDistanceX"); - return startLocation - distance * (this.position % 3); + return startLocation - distance * (this.index % 3); } // get location y + @JsonIgnore public Integer getLocationY() { Integer startLocation = this.manager.getDevice().getLocationByName("largeBufferTubeAspirationStart.y"); Integer distance = this.manager.getDevice().getLocationByName("largeBufferTubeAspirationDistanceY"); - return startLocation - distance * (this.position / 2); + return startLocation - distance * (this.index / 2); } // get location z + @JsonIgnore public Integer getLocationZ() { return this.manager.getDevice().getLocationByName("largeBufferTuebAspirationDepth"); } // get if the tube is empty + @JsonIgnore public boolean isEmpty() { // @TODO : check if the tube is empty return false; diff --git a/src/main/java/com/dreamworks/boditech/driver/consumable/CsmLargeBufferTubeManager.java b/src/main/java/com/dreamworks/boditech/driver/consumable/CsmLargeBufferTubeManager.java index 2649f30..310ef72 100644 --- a/src/main/java/com/dreamworks/boditech/driver/consumable/CsmLargeBufferTubeManager.java +++ b/src/main/java/com/dreamworks/boditech/driver/consumable/CsmLargeBufferTubeManager.java @@ -16,9 +16,7 @@ public class CsmLargeBufferTubeManager { this.device = device; for ( int i=0; i<6; i++ ) { CsmLargeBufferTube tube = new CsmLargeBufferTube(this); - tube.position = i; tube.index = i; - tube.status = CsmLargeBufferTube.STATUS_NOT_LOADED; this.largeBufferTubes.add(tube); } } @@ -50,12 +48,10 @@ public class CsmLargeBufferTubeManager { } CsmLargeBufferTube box = this.largeBufferTubes.get(index); - box.projectName = project.name; - box.projectId = project.id; - box.projectColor = project.color; + box.setProject(project); + box.lotCode = lotCode; box.amount = 25; box.isLoaded = true; - box.status = CsmLargeBufferTube.STATUS_LOADED; } @@ -99,9 +95,9 @@ public class CsmLargeBufferTubeManager { public CsmLargeBufferTube getTubeByProjectName( String projectName ) { CsmLargeBufferTube tube = null; for ( CsmLargeBufferTube tmp : this.largeBufferTubes ) { - if ( !tmp.projectName.equals(projectName) ) { - continue ; - } +// if ( !tmp.projectName.equals(projectName) ) { +// continue ; +// } if ( tmp.isEmpty() ) { continue; } @@ -117,11 +113,11 @@ public class CsmLargeBufferTubeManager { // update large buffer tube public void update(ParamLargeBufferTubeUpdate param ) { // delete all large buffer tubes with matched position - this.largeBufferTubes.removeIf(largeBufferTube -> largeBufferTube.position.equals(param.position)); +// this.largeBufferTubes.removeIf(largeBufferTube -> largeBufferTube.position.equals(param.position)); - CsmLargeBufferTube largeBufferTube = new CsmLargeBufferTube(this); - largeBufferTube.position = param.position; +// CsmLargeBufferTube largeBufferTube = new CsmLargeBufferTube(this); +// largeBufferTube.position = param.position; // largeBufferTube.projectName = param.projectName; - this.largeBufferTubes.add(largeBufferTube); +// this.largeBufferTubes.add(largeBufferTube); } } diff --git a/src/main/java/com/dreamworks/boditech/service/DeviceService.java b/src/main/java/com/dreamworks/boditech/service/DeviceService.java index 86349ca..9ccb801 100644 --- a/src/main/java/com/dreamworks/boditech/service/DeviceService.java +++ b/src/main/java/com/dreamworks/boditech/service/DeviceService.java @@ -107,27 +107,7 @@ public class DeviceService { // get status public Map status() { - Map status = new HashMap<>(); - - // large buffer tube - List largeBufferTubeList = this.device.largeBufferTubes.getAll(); - CsmLargeBufferTube[] largeBufferTubes = new CsmLargeBufferTube[6]; - for ( int i=0; i(); } // start