|
|
@ -8,6 +8,8 @@ import com.dreamworks.boditech.service.AccountService; |
|
|
|
import org.slf4j.Logger; |
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
|
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.Objects; |
|
|
|
public class TaskStartReset extends TaskBase { |
|
|
|
// mode : normal |
|
|
@ -114,22 +116,36 @@ public class TaskStartReset extends TaskBase { |
|
|
|
LOG.info("[reset] task finished, cost {}s", (System.currentTimeMillis() - startTime)/1000.00); |
|
|
|
} |
|
|
|
|
|
|
|
// clean incubator if error |
|
|
|
/** |
|
|
|
* 清理孵育盘, 孵育盘卡位状态由数据库获取,清理完成后重置数据库变量。 |
|
|
|
* 数据库变量由每次获取和释放孵育盘卡位时更新。 |
|
|
|
*/ |
|
|
|
private void cleanIncubatorIfError() { |
|
|
|
if ( !Objects.equals(this.mode, TaskStartReset.MODE_ERROR) ) { |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
this.analysisScanMotor.moveTo("analysisScanMotorDropCard"); |
|
|
|
ActIncubator incubatorMotor = (ActIncubator)device.getActuator(ActuatorModule.INCUBATOR_MOTOR); |
|
|
|
IncubatorSlot[] incubatorSlots = incubatorMotor.getSlots(); |
|
|
|
for ( IncubatorSlot incubatorSlot : incubatorSlots ) { |
|
|
|
incubatorMotor.moveTo(incubatorSlot.getExitLocation()); |
|
|
|
this.analysisScanMotor.moveTo("analysisScanMotorDropCard"); |
|
|
|
|
|
|
|
List<Map<String,Object>> slots = this.device.runtimeVariableService.getJson("DeviceIncubatorSlots", List.class); |
|
|
|
for ( Map<String,Object> slotInfo : slots ) { |
|
|
|
Boolean isFree = (Boolean)slotInfo.get("isFree"); |
|
|
|
if ( isFree ) { |
|
|
|
continue; |
|
|
|
} |
|
|
|
|
|
|
|
Integer index = (Integer)slotInfo.get("index"); |
|
|
|
IncubatorSlot slot = incubatorMotor.getSlotByIndex(index); |
|
|
|
LOG.info("[reset] incubator slot clean index {}", index); |
|
|
|
incubatorMotor.moveTo(slot.getExitLocation()); |
|
|
|
this.analysisPushMotor.moveTo("analysisPushMotorScanStart"); |
|
|
|
this.analysisPushMotor.moveTo("analysisPushMotorStandby"); |
|
|
|
} |
|
|
|
|
|
|
|
this.analysisScanMotor.moveTo("analysisScanMotorStandBy"); |
|
|
|
this.device.runtimeVariableService.setString("DeviceIncubatorSlots", "[]"); |
|
|
|
LOG.info("[reset] incubator clean finished"); |
|
|
|
} |
|
|
|
|
|
|
|
// clean analysis scan track if error |
|
|
|