|
@ -5,6 +5,8 @@ import cn.hutool.json.JSONObject; |
|
|
import com.iflytop.gd.app.core.CraftsDebugGenerator; |
|
|
import com.iflytop.gd.app.core.CraftsDebugGenerator; |
|
|
import com.iflytop.gd.app.model.bo.CraftsStep; |
|
|
import com.iflytop.gd.app.model.bo.CraftsStep; |
|
|
import com.iflytop.gd.app.model.bo.Point3D; |
|
|
import com.iflytop.gd.app.model.bo.Point3D; |
|
|
|
|
|
import com.iflytop.gd.app.model.bo.status.device.TrayState; |
|
|
|
|
|
import com.iflytop.gd.app.model.bo.status.device.TubeState; |
|
|
import com.iflytop.gd.app.model.entity.Container; |
|
|
import com.iflytop.gd.app.model.entity.Container; |
|
|
import com.iflytop.gd.app.service.api.ContainerService; |
|
|
import com.iflytop.gd.app.service.api.ContainerService; |
|
|
import com.iflytop.gd.app.service.api.DevicePositionService; |
|
|
import com.iflytop.gd.app.service.api.DevicePositionService; |
|
@ -66,7 +68,6 @@ public class CraftsStepService { |
|
|
* 将托盘从加热区移动至加液区并且添加溶液 |
|
|
* 将托盘从加热区移动至加液区并且添加溶液 |
|
|
*/ |
|
|
*/ |
|
|
private boolean addLiquid(HeatModuleCode heatModuleCode, JSONObject params) throws Exception { |
|
|
private boolean addLiquid(HeatModuleCode heatModuleCode, JSONObject params) throws Exception { |
|
|
//TODO 判断加液区是否有托盘,如果没有托盘的话,判断加热区是否有托盘,然后将其移动至加液区 |
|
|
|
|
|
if((deviceStateService.getDeviceState().getSolutionModule().getTrayStatus() == 0 ) |
|
|
if((deviceStateService.getDeviceState().getSolutionModule().getTrayStatus() == 0 ) |
|
|
&& deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).getTrayStatus() == 0) { |
|
|
&& deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).getTrayStatus() == 0) { |
|
|
throw new AppException(ResultCode.CRAFT_NO_TRAY); |
|
|
throw new AppException(ResultCode.CRAFT_NO_TRAY); |
|
@ -75,25 +76,17 @@ public class CraftsStepService { |
|
|
&& deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).getTrayStatus() == 1) { |
|
|
&& deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).getTrayStatus() == 1) { |
|
|
moveToSolutionModule(heatModuleCode); |
|
|
moveToSolutionModule(heatModuleCode); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
JSONArray tubeNums = params.getJSONArray("tubeNums"); |
|
|
|
|
|
for (int i = 0; i < tubeNums.size(); i++) { |
|
|
|
|
|
JSONObject tubeSol = tubeNums.getJSONObject(i); |
|
|
|
|
|
Integer tubeNum = tubeSol.getInt("tubeNum"); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
JSONArray tubeSolList = params.getJSONArray("tubeSolList"); |
|
|
|
|
|
for (int i = 0; i < tubeSolList.size(); i++) { |
|
|
|
|
|
JSONObject tubeSol = tubeSolList.getJSONObject(i); |
|
|
|
|
|
Integer tubeNum = tubeSol.getInt("tubeNum"); |
|
|
|
|
|
JSONArray addLiquidList = tubeSol.getJSONArray("addLiquidList"); |
|
|
|
|
|
for (int j = 0; j < addLiquidList.size(); j++) { |
|
|
|
|
|
JSONObject addLiquid = addLiquidList.getJSONObject(j); |
|
|
|
|
|
Long solId = addLiquid.getLong("solId"); |
|
|
|
|
|
|
|
|
JSONArray addLiquidList = params.getJSONArray("addLiquidList"); |
|
|
|
|
|
TrayState trayState = deviceStateService.getDeviceState().getTrayStateByHeatModuleCode(heatModuleCode); |
|
|
|
|
|
TubeState[] tubeArray = trayState.getTubes(); |
|
|
|
|
|
for (TubeState tubeState : tubeArray) { |
|
|
|
|
|
int tubeNum = tubeState.getTubeNum(); |
|
|
|
|
|
if(tubeNum > 0){ |
|
|
|
|
|
for (int i = 0; i < addLiquidList.size(); i++) { |
|
|
|
|
|
JSONObject addLiquid = addLiquidList.getJSONObject(i); |
|
|
|
|
|
Long containerId = addLiquid.getLong("containerId"); |
|
|
Double volume = addLiquid.getDouble("volume"); |
|
|
Double volume = addLiquid.getDouble("volume"); |
|
|
Container container = containerService.getContainerBySolutionId(solId); |
|
|
|
|
|
|
|
|
Container container = containerService.getById(containerId); |
|
|
if (container == null) { |
|
|
if (container == null) { |
|
|
throw new AppException(ResultCode.CONTAINER_NOT_FOUND);//未找到对应溶液容器 |
|
|
throw new AppException(ResultCode.CONTAINER_NOT_FOUND);//未找到对应溶液容器 |
|
|
} |
|
|
} |
|
@ -104,6 +97,7 @@ public class CraftsStepService { |
|
|
CommandUtil.wait(deviceCommandFuture); |
|
|
CommandUtil.wait(deviceCommandFuture); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
|
solutionModuleService.dualRobotOrigin(); |
|
|
solutionModuleService.dualRobotOrigin(); |
|
|
return true; |
|
|
return true; |
|
|
} |
|
|
} |
|
@ -112,7 +106,7 @@ public class CraftsStepService { |
|
|
* 摇匀操作 |
|
|
* 摇匀操作 |
|
|
*/ |
|
|
*/ |
|
|
private boolean shaking(HeatModuleCode heatModuleCode, JSONObject params) throws Exception { |
|
|
private boolean shaking(HeatModuleCode heatModuleCode, JSONObject params) throws Exception { |
|
|
if (deviceStateService.getDeviceState().getSolutionModule().getTrayStatus() == 0) {//TODO 实际应该从传感器获取托盘状态 |
|
|
|
|
|
|
|
|
if (deviceStateService.getDeviceState().getSolutionModule().getTrayStatus() == 0) { |
|
|
moveToSolutionModule(heatModuleCode); |
|
|
moveToSolutionModule(heatModuleCode); |
|
|
} |
|
|
} |
|
|
Integer second = params.getInt("second"); |
|
|
Integer second = params.getInt("second"); |
|
@ -154,7 +148,7 @@ public class CraftsStepService { |
|
|
moveToSolutionModule(heatModuleCode); |
|
|
moveToSolutionModule(heatModuleCode); |
|
|
} |
|
|
} |
|
|
webSocketService.pushCraftsDebug(CraftsDebugGenerator.generateJson(heatModuleCode.toString(), "开启补光灯", 100.0)); |
|
|
webSocketService.pushCraftsDebug(CraftsDebugGenerator.generateJson(heatModuleCode.toString(), "开启补光灯", 100.0)); |
|
|
solutionModuleService.fillLightOpen(100.0);//TODO 开启补光灯 亮度从数据库获取 |
|
|
|
|
|
|
|
|
solutionModuleService.fillLightOpen(100.0); |
|
|
webSocketService.pushCraftsDebug(CraftsDebugGenerator.generateJson(heatModuleCode.toString(), "拍照", null)); |
|
|
webSocketService.pushCraftsDebug(CraftsDebugGenerator.generateJson(heatModuleCode.toString(), "拍照", null)); |
|
|
solutionModuleService.takePhoto();//拍照 |
|
|
solutionModuleService.takePhoto();//拍照 |
|
|
webSocketService.pushCraftsDebug(CraftsDebugGenerator.generateJson(heatModuleCode.toString(), "关闭补光灯", null)); |
|
|
webSocketService.pushCraftsDebug(CraftsDebugGenerator.generateJson(heatModuleCode.toString(), "关闭补光灯", null)); |
|
|