Browse Source

大缓冲液属性整理

master
sige 2 years ago
parent
commit
4e6c299ded
  1. 36
      src/main/java/com/dreamworks/boditech/driver/consumable/CsmLargeBufferTube.java
  2. 22
      src/main/java/com/dreamworks/boditech/driver/consumable/CsmLargeBufferTubeManager.java
  3. 22
      src/main/java/com/dreamworks/boditech/service/DeviceService.java

36
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;

22
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);
}
}

22
src/main/java/com/dreamworks/boditech/service/DeviceService.java

@ -107,27 +107,7 @@ public class DeviceService {
// get status
public Map<String, Object> status() {
Map<String,Object> status = new HashMap<>();
// large buffer tube
List<CsmLargeBufferTube> largeBufferTubeList = this.device.largeBufferTubes.getAll();
CsmLargeBufferTube[] largeBufferTubes = new CsmLargeBufferTube[6];
for ( int i=0; i<largeBufferTubes.length; i++ ) {
largeBufferTubes[i] = new CsmLargeBufferTube(this.device.largeBufferTubes);
}
for ( CsmLargeBufferTube largeBufferTube : largeBufferTubeList ) {
Integer index = largeBufferTube.position;
largeBufferTubes[index].projectName = largeBufferTube.projectName;
}
status.put("largeBufferTubes", largeBufferTubes);
// buffer tube area
BufferTubeArea[] bufferTubeAreas = new BufferTubeArea[6];
for ( int i=0; i<bufferTubeAreas.length; i++ ) {
bufferTubeAreas[i] = new BufferTubeArea();
}
return status;
return new HashMap<>();
}
// start

Loading…
Cancel
Save