|
|
@ -31,6 +31,7 @@ import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
import java.time.LocalDateTime; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.Arrays; |
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
/** |
|
|
@ -100,11 +101,9 @@ public class CraftsStepService { |
|
|
|
log.info("工艺{},-------------------------------------加稀硝酸-------------------------------------", heatModuleCode); |
|
|
|
/*工艺监控*/ |
|
|
|
log.info("工艺{},工艺监控", heatModuleCode); |
|
|
|
JSONObject result = new JSONObject(); |
|
|
|
List<Integer> finishColumns = new ArrayList<>(); |
|
|
|
result.set(ResultCode.SUCCESS.getCode(), finishColumns); |
|
|
|
craftMonitor.setCurrentStepResult(String.valueOf(result)); |
|
|
|
craftMonitorService.saveOrUpdate(craftMonitor); |
|
|
|
craftMonitor.setCurrentStepResult(CraftsMonitorResultCode.add_liquid_column.getDescription() + Arrays.toString(finishColumns.toArray())); |
|
|
|
craftMonitorService.saveMonitor(craftMonitor); |
|
|
|
/*工艺监控结束*/ |
|
|
|
|
|
|
|
/*获取配置信息*/ |
|
|
@ -213,10 +212,9 @@ public class CraftsStepService { |
|
|
|
solutionModuleService.solutionMotorMoveZero();//加液机械臂上升 |
|
|
|
/*工艺监控开始*/ |
|
|
|
finishColumns.add(i); |
|
|
|
result.set("columns", finishColumns);//添加到结果 |
|
|
|
craftMonitor.setCurrentStepResult(String.valueOf(result)); |
|
|
|
craftMonitor.setCurrentStepResult(CraftsMonitorResultCode.add_liquid_column.getDescription() + Arrays.toString(finishColumns.toArray())); |
|
|
|
craftMonitor.setDeviceState(JSONUtil.toJsonStr(deviceStateService.getDeviceState())); |
|
|
|
craftMonitorService.saveOrUpdate(craftMonitor); |
|
|
|
craftMonitorService.saveMonitor(craftMonitor); |
|
|
|
/*工艺监控结束*/ |
|
|
|
} |
|
|
|
solutionModuleService.liquidPumpMove(-backFlowDistance);//预充 |
|
|
@ -256,11 +254,9 @@ public class CraftsStepService { |
|
|
|
log.info("工艺{},------------------------------加浓硝酸---------------------------", heatModuleCode); |
|
|
|
/*工艺监控*/ |
|
|
|
log.info("工艺{},工艺监控", heatModuleCode); |
|
|
|
JSONObject result = new JSONObject(); |
|
|
|
List<Integer> finishColumns = new ArrayList<>(); |
|
|
|
result.set(ResultCode.SUCCESS.getCode(), finishColumns); |
|
|
|
craftMonitor.setCurrentStepResult(String.valueOf(result)); |
|
|
|
craftMonitorService.saveOrUpdate(craftMonitor); |
|
|
|
craftMonitor.setCurrentStepResult(CraftsMonitorResultCode.add_liquid_column.getDescription() + Arrays.toString(finishColumns.toArray())); |
|
|
|
craftMonitorService.saveMonitor(craftMonitor); |
|
|
|
/*工艺监控结束*/ |
|
|
|
|
|
|
|
/*获取配置信息*/ |
|
|
@ -411,10 +407,9 @@ public class CraftsStepService { |
|
|
|
solutionModuleService.solutionMotorMoveZero();//加液机械臂上升 |
|
|
|
/*工艺监控开始*/ |
|
|
|
finishColumns.add(i); |
|
|
|
result.set("columns", finishColumns);//添加到结果 |
|
|
|
craftMonitor.setCurrentStepResult(String.valueOf(result)); |
|
|
|
craftMonitor.setCurrentStepResult(CraftsMonitorResultCode.add_liquid_column.getDescription() + Arrays.toString(finishColumns.toArray())); |
|
|
|
craftMonitor.setDeviceState(JSONUtil.toJsonStr(deviceStateService.getDeviceState())); |
|
|
|
craftMonitorService.saveOrUpdate(craftMonitor); |
|
|
|
craftMonitorService.saveMonitor(craftMonitor); |
|
|
|
/*工艺监控结束*/ |
|
|
|
} |
|
|
|
solutionModuleService.liquidPumpMove(-backFlowDistance);//预充 |
|
|
@ -453,9 +448,9 @@ public class CraftsStepService { |
|
|
|
* */ |
|
|
|
public boolean heat(HeatModuleCode heatModuleCode, JSONObject params, CraftMonitor craftMonitor) throws Exception { |
|
|
|
/*工艺监控清理上步的记录*/ |
|
|
|
JSONObject result = new JSONObject(); |
|
|
|
craftMonitor.setCurrentStepResult(String.valueOf(result)); |
|
|
|
craftMonitorService.saveOrUpdate(craftMonitor); |
|
|
|
craftMonitor.setDeviceState(JSONUtil.toJsonStr(deviceStateService.getDeviceState())); |
|
|
|
craftMonitor.setCurrentStepResult(CraftsMonitorResultCode.heat_time.getDescription() + ":0"); |
|
|
|
craftMonitorService.saveMonitor(craftMonitor); |
|
|
|
/*工艺监控清理上步的记录*/ |
|
|
|
Double temperature = params.getDouble("temperature");//温度 |
|
|
|
Integer time = params.getInt("time");//秒 |
|
|
@ -485,10 +480,9 @@ public class CraftsStepService { |
|
|
|
cycle--; |
|
|
|
clock = clock + 60; |
|
|
|
/*保存到工艺监控*/ |
|
|
|
result.set("time", clock);//添加到结果 |
|
|
|
craftMonitor.setCurrentStepResult(String.valueOf(result)); |
|
|
|
craftMonitor.setDeviceState(JSONUtil.toJsonStr(deviceStateService.getDeviceState())); |
|
|
|
craftMonitorService.saveOrUpdate(craftMonitor);//保存到监控 |
|
|
|
craftMonitor.setCurrentStepResult(CraftsMonitorResultCode.heat_time.getDescription() + ":" + clock / 60); |
|
|
|
craftMonitorService.saveMonitor(craftMonitor); |
|
|
|
/*保存到工艺监控*/ |
|
|
|
} |
|
|
|
delay(seconds); |
|
|
@ -497,9 +491,6 @@ public class CraftsStepService { |
|
|
|
deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).setTargetTime(null);//加热器目标加热时间 |
|
|
|
deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).setHeatingType(HeatingType.finish); //加热完成 |
|
|
|
log.info("工艺{},加热结束", heatModuleCode); |
|
|
|
craftMonitor.setCurrentStepResult(String.valueOf(result)); |
|
|
|
craftMonitor.setDeviceState(JSONUtil.toJsonStr(deviceStateService.getDeviceState())); |
|
|
|
craftMonitorService.saveOrUpdate(craftMonitor);//保存到监控 |
|
|
|
webSocketService.pushCraftsDebug(CraftsDebugGenerator.generateJson(heatModuleCode.toString(), "加热结束,持续时间", time)); |
|
|
|
return true; |
|
|
|
} |
|
|
@ -511,9 +502,9 @@ public class CraftsStepService { |
|
|
|
try { |
|
|
|
log.info("工艺{},----------------------------------清洗---------------------------------------------", heatModuleCode); |
|
|
|
/*保存到监控开始*/ |
|
|
|
JSONObject result = new JSONObject(); |
|
|
|
craftMonitor.setCurrentStepResult(String.valueOf(result)); |
|
|
|
craftMonitorService.saveOrUpdate(craftMonitor);//保存到监控 |
|
|
|
craftMonitor.setDeviceState(JSONUtil.toJsonStr(deviceStateService.getDeviceState())); |
|
|
|
craftMonitor.setCurrentStepResult(CraftsMonitorResultCode.clean_cycle.getDescription() + ":0"); |
|
|
|
craftMonitorService.saveMonitor(craftMonitor); |
|
|
|
/*保存到监控结束*/ |
|
|
|
|
|
|
|
/*获取参数开始*/ |
|
|
@ -651,10 +642,9 @@ public class CraftsStepService { |
|
|
|
log.info("工艺{},加液模块上升至最高,移出试管", heatModuleCode); |
|
|
|
solutionModuleService.solutionMotorMoveZero();//加液模块上升至最高,移出试管 |
|
|
|
} |
|
|
|
result.set("cycle", i + 1);//添加到结果 |
|
|
|
craftMonitor.setCurrentStepResult(String.valueOf(result)); |
|
|
|
craftMonitor.setDeviceState(JSONUtil.toJsonStr(deviceStateService.getDeviceState())); |
|
|
|
craftMonitorService.saveOrUpdate(craftMonitor);//保存到监控 |
|
|
|
craftMonitor.setCurrentStepResult(CraftsMonitorResultCode.clean_cycle.getDescription() + ":" + (i + 1)); |
|
|
|
craftMonitorService.saveMonitor(craftMonitor); |
|
|
|
|
|
|
|
} |
|
|
|
/*清洗结束*/ |
|
|
@ -685,9 +675,9 @@ public class CraftsStepService { |
|
|
|
* */ |
|
|
|
public boolean dry(HeatModuleCode heatModuleCode, JSONObject params, CraftMonitor craftMonitor) throws Exception { |
|
|
|
/*工艺监控清理上步的记录*/ |
|
|
|
JSONObject result = new JSONObject(); |
|
|
|
craftMonitor.setCurrentStepResult(String.valueOf(result)); |
|
|
|
craftMonitorService.saveOrUpdate(craftMonitor); |
|
|
|
craftMonitor.setDeviceState(JSONUtil.toJsonStr(deviceStateService.getDeviceState())); |
|
|
|
craftMonitor.setCurrentStepResult(CraftsMonitorResultCode.heat_time.getDescription() + ":0"); |
|
|
|
craftMonitorService.saveMonitor(craftMonitor); |
|
|
|
/*工艺监控清理上步的记录*/ |
|
|
|
|
|
|
|
|
|
|
@ -707,19 +697,15 @@ public class CraftsStepService { |
|
|
|
deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).setStartHeatTime(LocalDateTime.now());//开始加热时间 |
|
|
|
deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).setTargetTime(time);//加热器目标加热时间 |
|
|
|
int clock = 0; |
|
|
|
result.set("time", clock);//添加到结果 |
|
|
|
craftMonitor.setCurrentStepResult(String.valueOf(result)); |
|
|
|
craftMonitorService.saveOrUpdate(craftMonitor);//保存到监控 |
|
|
|
int cycle = time / 60; |
|
|
|
int seconds = time % 60; |
|
|
|
while (cycle > 0) { |
|
|
|
delay(60); |
|
|
|
cycle--; |
|
|
|
clock = clock + 60; |
|
|
|
result.set("time", clock);//添加到结果 |
|
|
|
craftMonitor.setCurrentStepResult(String.valueOf(result)); |
|
|
|
craftMonitor.setDeviceState(JSONUtil.toJsonStr(deviceStateService.getDeviceState())); |
|
|
|
craftMonitorService.saveOrUpdate(craftMonitor);//保存到监控 |
|
|
|
craftMonitor.setCurrentStepResult(CraftsMonitorResultCode.heat_time.getDescription() + ":" + clock / 60); |
|
|
|
craftMonitorService.saveMonitor(craftMonitor); |
|
|
|
} |
|
|
|
log.info("工艺{},恒温中", heatModuleCode); |
|
|
|
delay(seconds); |
|
|
@ -739,9 +725,9 @@ public class CraftsStepService { |
|
|
|
* */ |
|
|
|
public synchronized boolean anneal(HeatModuleCode heatModuleCode, JSONObject params, CraftMonitor craftMonitor) throws Exception { |
|
|
|
try { |
|
|
|
JSONObject result = new JSONObject(); |
|
|
|
craftMonitor.setCurrentStepResult(String.valueOf(result)); |
|
|
|
craftMonitorService.saveOrUpdate(craftMonitor); |
|
|
|
craftMonitor.setDeviceState(JSONUtil.toJsonStr(deviceStateService.getDeviceState())); |
|
|
|
craftMonitor.setCurrentStepResult(CraftsMonitorResultCode.heat_time.getDescription() + ":0"); |
|
|
|
craftMonitorService.saveMonitor(craftMonitor); |
|
|
|
Double temperature = params.getDouble("temperature");//退火温度 |
|
|
|
Integer time = params.getInt("time");//秒 |
|
|
|
boolean heatModuleTrayExist = deviceSensorService.getTrayStateByHeatModuleCode(heatModuleCode); |
|
|
@ -796,19 +782,15 @@ public class CraftsStepService { |
|
|
|
deviceStateService.getDeviceState().getHeatModuleByCode(HeatModuleCode.heat_module_04).setStartHeatTime(LocalDateTime.now());//开始加热时间 |
|
|
|
deviceStateService.getDeviceState().getHeatModuleByCode(HeatModuleCode.heat_module_04).setTargetTime(time);//加热器目标加热时间 |
|
|
|
int clock = 0; |
|
|
|
result.set("time", clock);//添加到结果 |
|
|
|
craftMonitor.setCurrentStepResult(String.valueOf(result)); |
|
|
|
craftMonitorService.saveOrUpdate(craftMonitor);//保存到监控 |
|
|
|
int cycle = time / 60; |
|
|
|
int seconds = time % 60; |
|
|
|
while (cycle > 0) { |
|
|
|
delay(60); |
|
|
|
cycle--; |
|
|
|
clock = clock + 60; |
|
|
|
result.set("time", clock);//添加到结果 |
|
|
|
craftMonitor.setDeviceState(JSONUtil.toJsonStr(deviceStateService.getDeviceState())); |
|
|
|
craftMonitor.setCurrentStepResult(String.valueOf(result)); |
|
|
|
craftMonitorService.saveOrUpdate(craftMonitor);//保存到监控 |
|
|
|
craftMonitor.setCurrentStepResult(CraftsMonitorResultCode.heat_time.getDescription() + ":" + clock / 60); |
|
|
|
craftMonitorService.saveMonitor(craftMonitor); |
|
|
|
} |
|
|
|
log.info("工艺{},恒温中", HeatModuleCode.heat_module_04); |
|
|
|
delay(seconds); |
|
|
|