|
|
@ -67,6 +67,7 @@ public class CraftsStepService { |
|
|
|
case "shaking" -> shaking(heatModuleCode, params); |
|
|
|
case "startHeating" -> heating(heatModuleCode, params); |
|
|
|
case "takePhoto" -> takePhoto(heatModuleCode); |
|
|
|
case "delay" -> delay(params); |
|
|
|
default -> true; |
|
|
|
}; |
|
|
|
} |
|
|
@ -138,7 +139,7 @@ public class CraftsStepService { |
|
|
|
Long solutionId = addLiquid.getLong("solutionId"); |
|
|
|
Double volume = addLiquid.getDouble("volume"); |
|
|
|
Double offset = addLiquid.getDouble("offset"); |
|
|
|
if(offset != null){ |
|
|
|
if (offset != null) { |
|
|
|
volume += offset; |
|
|
|
} |
|
|
|
Container container = containerService.getContainerBySolutionId(solutionId); |
|
|
@ -168,7 +169,7 @@ public class CraftsStepService { |
|
|
|
Integer second = params.getInt("second"); |
|
|
|
log.info("工艺{},开始摇匀", heatModuleCode); |
|
|
|
solutionModuleService.shakeStart();//开始摇匀 |
|
|
|
delay(second); |
|
|
|
sleep(second); |
|
|
|
log.info("工艺{},停止摇匀", heatModuleCode); |
|
|
|
solutionModuleService.shakeStop();//停止摇匀 |
|
|
|
return true; |
|
|
@ -200,13 +201,13 @@ public class CraftsStepService { |
|
|
|
deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).setFanOpen(true); |
|
|
|
log.info("工艺{},等待降温", heatModuleCode); |
|
|
|
while (deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).getTemperature() - 1 > targetTemperature) { |
|
|
|
delay(1); |
|
|
|
sleep(1); |
|
|
|
} |
|
|
|
heatModuleService.fanClose(heatModuleCode); |
|
|
|
deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).setFanOpen(false); |
|
|
|
heatModuleService.heatRodOpen(heatModuleCode, targetTemperature); |
|
|
|
} else { |
|
|
|
if( deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).isFanOpen()){ |
|
|
|
if (deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).isFanOpen()) { |
|
|
|
heatModuleService.fanClose(heatModuleCode);//工艺加热前,尝试关闭风扇 |
|
|
|
deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).setFanOpen(false); |
|
|
|
} |
|
|
@ -216,7 +217,7 @@ public class CraftsStepService { |
|
|
|
log.info("工艺{},等待升温", heatModuleCode); |
|
|
|
if (inTemperature != null) { |
|
|
|
while (deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).getTemperature() + 1 < inTemperature) { |
|
|
|
delay(1); |
|
|
|
sleep(1); |
|
|
|
} |
|
|
|
log.info("工艺{},温度达到可以放入的温度,下降加热模块托盘", heatModuleCode); |
|
|
|
heatModuleService.heaterMotorMove(heatModuleCode, trayLower);//下降加热模块托盘 |
|
|
@ -224,7 +225,7 @@ public class CraftsStepService { |
|
|
|
deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).setStartHeatTime(LocalDateTime.now()); |
|
|
|
} |
|
|
|
while (deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).getTemperature() + 1 < targetTemperature) { |
|
|
|
delay(1); |
|
|
|
sleep(1); |
|
|
|
} |
|
|
|
} |
|
|
|
log.info("工艺{},恒温中", heatModuleCode); |
|
|
@ -239,7 +240,7 @@ public class CraftsStepService { |
|
|
|
LocalDateTime startHeatTime = deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).getStartHeatTime(); |
|
|
|
LocalDateTime endHeatTime = startHeatTime.plusSeconds(second); |
|
|
|
while (LocalDateTime.now().isBefore(endHeatTime)) { |
|
|
|
delay(1); |
|
|
|
sleep(1); |
|
|
|
} |
|
|
|
deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).setStartHeatTime(null); |
|
|
|
deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).setTargetTime(null); |
|
|
@ -251,7 +252,7 @@ public class CraftsStepService { |
|
|
|
deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).setStartHeatTime(LocalDateTime.now()); |
|
|
|
deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).setTargetTime(coolingSecond); |
|
|
|
deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).setHeatingType(HeatingType.trayCooling); |
|
|
|
delay(coolingSecond); |
|
|
|
sleep(coolingSecond); |
|
|
|
deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).setStartHeatTime(null); |
|
|
|
deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).setTargetTime(null); |
|
|
|
return true; |
|
|
@ -276,7 +277,19 @@ public class CraftsStepService { |
|
|
|
/** |
|
|
|
* 延时等待 |
|
|
|
*/ |
|
|
|
private boolean delay(int seconds) { |
|
|
|
private boolean delay(JSONObject params) { |
|
|
|
Integer seconds = params.getInt("seconds", 0); |
|
|
|
sleep(seconds); |
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 延时等待 |
|
|
|
*/ |
|
|
|
private boolean sleep(Integer seconds) { |
|
|
|
if (seconds == null) { |
|
|
|
return true; |
|
|
|
} |
|
|
|
try { |
|
|
|
Thread.sleep(seconds * 1000L); |
|
|
|
} catch (InterruptedException e) { |
|
|
|