9 changed files with 154 additions and 8 deletions
-
1src/main/java/com/iflytop/sgs/app/cmd/control/AnnealStopCommand.java
-
2src/main/java/com/iflytop/sgs/app/cmd/control/LiquidAddCommand.java
-
62src/main/java/com/iflytop/sgs/app/cmd/control/LiquidPreFillStartCommand.java
-
52src/main/java/com/iflytop/sgs/app/cmd/control/LiquidPreFillStopCommand.java
-
4src/main/java/com/iflytop/sgs/app/model/entity/Solutions.java
-
9src/main/java/com/iflytop/sgs/app/service/device/module/SolutionModuleService.java
-
18src/main/java/com/iflytop/sgs/common/enums/data/DevicePositionCode.java
-
1src/main/java/com/iflytop/sgs/common/result/ResultCode.java
-
13src/main/resources/sql/init.sql
@ -0,0 +1,62 @@ |
|||||
|
package com.iflytop.sgs.app.cmd.control; |
||||
|
|
||||
|
import cn.hutool.core.lang.Assert; |
||||
|
import cn.hutool.json.JSONArray; |
||||
|
import cn.hutool.json.JSONObject; |
||||
|
import com.iflytop.sgs.app.core.BaseCommandHandler; |
||||
|
import com.iflytop.sgs.app.model.bo.Point3D; |
||||
|
import com.iflytop.sgs.app.model.bo.status.device.TransferModuleState; |
||||
|
import com.iflytop.sgs.app.model.dto.CmdDTO; |
||||
|
import com.iflytop.sgs.app.model.entity.Solutions; |
||||
|
import com.iflytop.sgs.app.service.api.DevicePositionService; |
||||
|
import com.iflytop.sgs.app.service.api.SolutionsService; |
||||
|
import com.iflytop.sgs.app.service.api.SystemConfigService; |
||||
|
import com.iflytop.sgs.app.service.device.DeviceStateService; |
||||
|
import com.iflytop.sgs.app.service.device.module.SolutionModuleService; |
||||
|
import com.iflytop.sgs.app.service.device.module.TransferModuleService; |
||||
|
import com.iflytop.sgs.common.annotation.CommandMapping; |
||||
|
import com.iflytop.sgs.common.enums.ValveStateCode; |
||||
|
import com.iflytop.sgs.common.enums.data.DevicePositionCode; |
||||
|
import com.iflytop.sgs.common.exception.AppException; |
||||
|
import com.iflytop.sgs.common.result.ResultCode; |
||||
|
import lombok.RequiredArgsConstructor; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.springframework.stereotype.Component; |
||||
|
|
||||
|
import java.util.concurrent.CompletableFuture; |
||||
|
|
||||
|
/** |
||||
|
* 添加溶液 |
||||
|
*/ |
||||
|
@Slf4j |
||||
|
@Component |
||||
|
@RequiredArgsConstructor |
||||
|
@CommandMapping("liquid_pre_fill_start")//业务指令注解 |
||||
|
public class LiquidPreFillStartCommand extends BaseCommandHandler { |
||||
|
private final SolutionModuleService solutionModuleService; |
||||
|
private final DeviceStateService deviceStateService; |
||||
|
private final DevicePositionService devicePositionService; |
||||
|
private final TransferModuleService transferModuleService; |
||||
|
private final SystemConfigService systemConfigService; |
||||
|
private final SolutionsService solutionsService; |
||||
|
|
||||
|
@Override |
||||
|
public CompletableFuture<Void> handle(CmdDTO cmdDTO) { |
||||
|
Assert.isTrue(deviceStateService.getDeviceState().getSolutionModule().isIdle(), () -> new AppException(ResultCode.SOLUTION_MODULE_IS_BUSY));//判断当前加液区状态 |
||||
|
Integer solutionId = cmdDTO.getIntegerParam("solutionId");//解析参数酸液Id |
||||
|
Solutions solutions = solutionsService.getById(solutionId);//数据库获取酸液信息 |
||||
|
Assert.notNull(solutions, () -> new AppException(ResultCode.OPERATION_NOT_ALLOWED));//检验参数 |
||||
|
ValveStateCode valveStateCode = ValveStateCode.valueOf(solutions.getCode());//获取对应的电磁阀通道 |
||||
|
Point3D liquidAreaTrayPoint = devicePositionService.getPosition(DevicePositionCode.liquidAreaTrayPoint).getPoint3D(); //获取加液区上方点位 |
||||
|
double position=devicePositionService.getPosition(DevicePositionCode.solutionPreFillDistance).getDistance();//预充开始 |
||||
|
return runAsync(() -> { |
||||
|
deviceStateService.getDeviceState().getSolutionModule().setIdle(true);//设置占用 |
||||
|
deviceStateService.getDeviceState().getSolutionModule().setPumping(true);//设置正在加液 |
||||
|
solutionModuleService.liquidValveSwitch(cmdDTO.getCommandId(), cmdDTO.getCommand(), valveStateCode);//电磁阀对应的酸液通道打开 |
||||
|
solutionModuleService.solutionMotorMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), 0);//加液机械臂上升 |
||||
|
transferModuleService.transferMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), liquidAreaTrayPoint);//移动至加液位置 |
||||
|
solutionModuleService.liquidPumpMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), position);//预充开始 |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
|
@ -0,0 +1,52 @@ |
|||||
|
package com.iflytop.sgs.app.cmd.control; |
||||
|
|
||||
|
import cn.hutool.core.lang.Assert; |
||||
|
import cn.hutool.json.JSONArray; |
||||
|
import cn.hutool.json.JSONObject; |
||||
|
import com.iflytop.sgs.app.core.BaseCommandHandler; |
||||
|
import com.iflytop.sgs.app.model.bo.Point3D; |
||||
|
import com.iflytop.sgs.app.model.bo.status.device.TransferModuleState; |
||||
|
import com.iflytop.sgs.app.model.dto.CmdDTO; |
||||
|
import com.iflytop.sgs.app.model.entity.Solutions; |
||||
|
import com.iflytop.sgs.app.service.api.DevicePositionService; |
||||
|
import com.iflytop.sgs.app.service.api.SolutionsService; |
||||
|
import com.iflytop.sgs.app.service.api.SystemConfigService; |
||||
|
import com.iflytop.sgs.app.service.device.DeviceStateService; |
||||
|
import com.iflytop.sgs.app.service.device.module.SolutionModuleService; |
||||
|
import com.iflytop.sgs.app.service.device.module.TransferModuleService; |
||||
|
import com.iflytop.sgs.common.annotation.CommandMapping; |
||||
|
import com.iflytop.sgs.common.enums.ValveStateCode; |
||||
|
import com.iflytop.sgs.common.enums.data.DevicePositionCode; |
||||
|
import com.iflytop.sgs.common.exception.AppException; |
||||
|
import com.iflytop.sgs.common.result.ResultCode; |
||||
|
import lombok.RequiredArgsConstructor; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.springframework.stereotype.Component; |
||||
|
|
||||
|
import java.util.concurrent.CompletableFuture; |
||||
|
|
||||
|
/** |
||||
|
* 添加溶液 |
||||
|
*/ |
||||
|
@Slf4j |
||||
|
@Component |
||||
|
@RequiredArgsConstructor |
||||
|
@CommandMapping("liquid_add")//业务指令注解 |
||||
|
public class LiquidPreFillStopCommand extends BaseCommandHandler { |
||||
|
private final SolutionModuleService solutionModuleService; |
||||
|
private final DeviceStateService deviceStateService; |
||||
|
private final DevicePositionService devicePositionService; |
||||
|
private final TransferModuleService transferModuleService; |
||||
|
private final SystemConfigService systemConfigService; |
||||
|
private final SolutionsService solutionsService; |
||||
|
|
||||
|
@Override |
||||
|
public CompletableFuture<Void> handle(CmdDTO cmdDTO) { |
||||
|
return runAsync(() -> { |
||||
|
solutionModuleService.liquidPumpStop(cmdDTO.getCommandId(), cmdDTO.getCommand());//停止预充 |
||||
|
deviceStateService.getDeviceState().getSolutionModule().setIdle(false);//设置占用解除 |
||||
|
deviceStateService.getDeviceState().getSolutionModule().setPumping(false);//设置加液结束 |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
|
Write
Preview
Loading…
Cancel
Save
Reference in new issue