Browse Source

fix:当工艺异常、停止状态时,可以进行手动操作

master
白凤吉 2 months ago
parent
commit
191d08e39e
  1. 6
      src/main/java/com/iflytop/gd/app/command/control/FanStartCommand.java
  2. 6
      src/main/java/com/iflytop/gd/app/command/control/FanStopCommand.java
  3. 6
      src/main/java/com/iflytop/gd/app/command/control/HeatStartCommand.java
  4. 6
      src/main/java/com/iflytop/gd/app/command/control/HeatStopCommand.java
  5. 17
      src/main/java/com/iflytop/gd/app/command/control/ShakeStartCommand.java
  6. 6
      src/main/java/com/iflytop/gd/app/command/control/ShakeStopCommand.java
  7. 6
      src/main/java/com/iflytop/gd/app/command/control/SolutionAddCommand.java
  8. 8
      src/main/java/com/iflytop/gd/app/command/control/TrayDownCommand.java
  9. 8
      src/main/java/com/iflytop/gd/app/command/control/TrayUpCommand.java
  10. 6
      src/main/java/com/iflytop/gd/app/command/control/WarmUpStartCommand.java
  11. 2
      src/main/java/com/iflytop/gd/app/controller/PhotoController.java

6
src/main/java/com/iflytop/gd/app/command/control/FanStartCommand.java

@ -7,6 +7,7 @@ import com.iflytop.gd.app.service.device.DeviceStateService;
import com.iflytop.gd.app.service.device.module.HeatModuleService;
import com.iflytop.gd.common.annotation.CommandMapping;
import com.iflytop.gd.common.enums.HeatModuleCode;
import com.iflytop.gd.common.enums.automaton.CraftStates;
import com.iflytop.gd.common.exception.AppException;
import com.iflytop.gd.common.result.ResultCode;
import lombok.RequiredArgsConstructor;
@ -32,7 +33,10 @@ public class FanStartCommand extends BaseCommandHandler {
HeatModuleCode heatModuleCode = HeatModuleCode.valueOf(heatId);
TrayState trayState = deviceStateService.getDeviceState().getTrayStateByHeatModuleCode(heatModuleCode);
if (trayState != null && trayState.getCrafts() != null) {
throw new AppException(ResultCode.CRAFT_RUNNING);
CraftStates craftStates = trayState.getCrafts().getState();
if(!(CraftStates.ERROR.equals(craftStates) || CraftStates.STOPPED.equals(craftStates))){
throw new AppException(ResultCode.CRAFT_RUNNING);
}
}
return runAsync(() -> {
heatModuleService.fanStart(cmdDTO.getCommandId(), cmdDTO.getCommand(), heatModuleCode);

6
src/main/java/com/iflytop/gd/app/command/control/FanStopCommand.java

@ -7,6 +7,7 @@ import com.iflytop.gd.app.service.device.DeviceStateService;
import com.iflytop.gd.app.service.device.module.HeatModuleService;
import com.iflytop.gd.common.annotation.CommandMapping;
import com.iflytop.gd.common.enums.HeatModuleCode;
import com.iflytop.gd.common.enums.automaton.CraftStates;
import com.iflytop.gd.common.exception.AppException;
import com.iflytop.gd.common.result.ResultCode;
import lombok.RequiredArgsConstructor;
@ -32,7 +33,10 @@ public class FanStopCommand extends BaseCommandHandler {
HeatModuleCode heatModuleCode = HeatModuleCode.valueOf(heatId);
TrayState trayState = deviceStateService.getDeviceState().getTrayStateByHeatModuleCode(heatModuleCode);
if (trayState != null && trayState.getCrafts() != null) {
throw new AppException(ResultCode.CRAFT_RUNNING);
CraftStates craftStates = trayState.getCrafts().getState();
if(!(CraftStates.ERROR.equals(craftStates) || CraftStates.STOPPED.equals(craftStates))){
throw new AppException(ResultCode.CRAFT_RUNNING);
}
}
return runAsync(() -> {
heatModuleService.fanClose(cmdDTO.getCommandId(), cmdDTO.getCommand(), heatModuleCode);

6
src/main/java/com/iflytop/gd/app/command/control/HeatStartCommand.java

@ -9,6 +9,7 @@ import com.iflytop.gd.app.service.device.module.HeatModuleService;
import com.iflytop.gd.common.annotation.CommandMapping;
import com.iflytop.gd.common.enums.HeatModuleCode;
import com.iflytop.gd.common.enums.HeatingType;
import com.iflytop.gd.common.enums.automaton.CraftStates;
import com.iflytop.gd.common.enums.data.DevicePositionCode;
import com.iflytop.gd.common.exception.AppException;
import com.iflytop.gd.common.result.ResultCode;
@ -41,7 +42,10 @@ public class HeatStartCommand extends BaseCommandHandler {
HeatModuleCode heatModuleCode = HeatModuleCode.valueOf(heatId);
TrayState trayState = deviceStateService.getDeviceState().getTrayStateByHeatModuleCode(heatModuleCode);
if (trayState != null && trayState.getCrafts() != null) {
throw new AppException(ResultCode.CRAFT_RUNNING);
CraftStates craftStates = trayState.getCrafts().getState();
if(!(CraftStates.ERROR.equals(craftStates) || CraftStates.STOPPED.equals(craftStates))){
throw new AppException(ResultCode.CRAFT_RUNNING);
}
}
return runAsync(() -> {
heatModuleService.heatRodOpen(cmdDTO.getCommandId(), cmdDTO.getCommand(), heatModuleCode, temperature);

6
src/main/java/com/iflytop/gd/app/command/control/HeatStopCommand.java

@ -8,6 +8,7 @@ import com.iflytop.gd.app.service.device.module.HeatModuleService;
import com.iflytop.gd.common.annotation.CommandMapping;
import com.iflytop.gd.common.enums.HeatModuleCode;
import com.iflytop.gd.common.enums.HeatingType;
import com.iflytop.gd.common.enums.automaton.CraftStates;
import com.iflytop.gd.common.exception.AppException;
import com.iflytop.gd.common.result.ResultCode;
import lombok.RequiredArgsConstructor;
@ -34,7 +35,10 @@ public class HeatStopCommand extends BaseCommandHandler {
HeatModuleCode heatModuleCode = HeatModuleCode.valueOf(heatId);
TrayState trayState = deviceStateService.getDeviceState().getTrayStateByHeatModuleCode(heatModuleCode);
if (trayState != null && trayState.getCrafts() != null) {
throw new AppException(ResultCode.CRAFT_RUNNING);
CraftStates craftStates = trayState.getCrafts().getState();
if(!(CraftStates.ERROR.equals(craftStates) || CraftStates.STOPPED.equals(craftStates))){
throw new AppException(ResultCode.CRAFT_RUNNING);
}
}
return runAsync(() -> {
//关闭加热

17
src/main/java/com/iflytop/gd/app/command/control/ShakeStartCommand.java

@ -6,6 +6,7 @@ import com.iflytop.gd.app.model.dto.CmdDTO;
import com.iflytop.gd.app.service.device.DeviceStateService;
import com.iflytop.gd.app.service.device.module.SolutionModuleService;
import com.iflytop.gd.common.annotation.CommandMapping;
import com.iflytop.gd.common.enums.automaton.CraftStates;
import com.iflytop.gd.common.exception.AppException;
import com.iflytop.gd.common.result.ResultCode;
import lombok.RequiredArgsConstructor;
@ -38,12 +39,20 @@ public class ShakeStartCommand extends BaseCommandHandler {
}
TrayState trayState = deviceStateService.getDeviceState().getTrayInSolutionModule();
if (trayState != null && trayState.getCrafts() != null) {
throw new AppException(ResultCode.CRAFT_RUNNING);
CraftStates craftStates = trayState.getCrafts().getState();
if (!(CraftStates.ERROR.equals(craftStates) || CraftStates.STOPPED.equals(craftStates))) {
throw new AppException(ResultCode.CRAFT_RUNNING);
}
}
deviceStateService.getCommandMutexState().get().setShakeStartCommandExecuting(true);
deviceStateService.getDeviceState().getSolutionModule().setShaking(true);
return runAsync(() -> {
deviceStateService.getCommandMutexState().get().setShakeStartCommandExecuting(true);
solutionModuleService.shakeStart(cmdDTO.getCommandId(), cmdDTO.getCommand());//开始摇匀
deviceStateService.getDeviceState().getSolutionModule().setShaking(true);
try {
solutionModuleService.shakeStart(cmdDTO.getCommandId(), cmdDTO.getCommand());//开始摇匀
} catch (Exception e) {
deviceStateService.getCommandMutexState().get().setShakeStartCommandExecuting(false);
deviceStateService.getDeviceState().getSolutionModule().setShaking(false);
}
});
}
}

6
src/main/java/com/iflytop/gd/app/command/control/ShakeStopCommand.java

@ -6,6 +6,7 @@ import com.iflytop.gd.app.model.dto.CmdDTO;
import com.iflytop.gd.app.service.device.DeviceStateService;
import com.iflytop.gd.app.service.device.module.SolutionModuleService;
import com.iflytop.gd.common.annotation.CommandMapping;
import com.iflytop.gd.common.enums.automaton.CraftStates;
import com.iflytop.gd.common.exception.AppException;
import com.iflytop.gd.common.result.ResultCode;
import lombok.RequiredArgsConstructor;
@ -29,7 +30,10 @@ public class ShakeStopCommand extends BaseCommandHandler {
public CompletableFuture<Void> handle(CmdDTO cmdDTO) {
TrayState trayState = deviceStateService.getDeviceState().getTrayInSolutionModule();
if (trayState != null && trayState.getCrafts() != null) {
throw new AppException(ResultCode.CRAFT_RUNNING);
CraftStates craftStates = trayState.getCrafts().getState();
if(!(CraftStates.ERROR.equals(craftStates) || CraftStates.STOPPED.equals(craftStates))){
throw new AppException(ResultCode.CRAFT_RUNNING);
}
}
return runAsync(() -> {
solutionModuleService.shakeStop(cmdDTO.getCommandId(), cmdDTO.getCommand());//停止摇匀

6
src/main/java/com/iflytop/gd/app/command/control/SolutionAddCommand.java

@ -13,6 +13,7 @@ import com.iflytop.gd.app.service.device.module.SolutionModuleService;
import com.iflytop.gd.common.annotation.CommandMapping;
import com.iflytop.gd.common.command.CommandFuture;
import com.iflytop.gd.common.enums.AcidPumpDeviceCode;
import com.iflytop.gd.common.enums.automaton.CraftStates;
import com.iflytop.gd.common.exception.AppException;
import com.iflytop.gd.common.result.ResultCode;
import com.iflytop.gd.common.utils.CommandUtil;
@ -53,7 +54,10 @@ public class SolutionAddCommand extends BaseCommandHandler {
}
TrayState trayState = deviceStateService.getDeviceState().getTrayInSolutionModule();
if (trayState != null && trayState.getCrafts() != null) {
throw new AppException(ResultCode.CRAFT_RUNNING);
CraftStates craftStates = trayState.getCrafts().getState();
if(!(CraftStates.ERROR.equals(craftStates) || CraftStates.STOPPED.equals(craftStates))){
throw new AppException(ResultCode.CRAFT_RUNNING);
}
}
deviceStateService.getCommandMutexState().get().setSolutionAddCommandExecuting(true);
deviceStateService.getDeviceState().getSolutionModule().setPumping(true);

8
src/main/java/com/iflytop/gd/app/command/control/TrayDownCommand.java

@ -9,6 +9,7 @@ import com.iflytop.gd.app.service.device.module.HeatModuleService;
import com.iflytop.gd.common.annotation.CommandMapping;
import com.iflytop.gd.common.enums.HeatModuleCode;
import com.iflytop.gd.common.enums.HeatingType;
import com.iflytop.gd.common.enums.automaton.CraftStates;
import com.iflytop.gd.common.enums.data.DevicePositionCode;
import com.iflytop.gd.common.exception.AppException;
import com.iflytop.gd.common.result.ResultCode;
@ -40,9 +41,12 @@ public class TrayDownCommand extends BaseCommandHandler {
String heatId = cmdDTO.getStringParam("heatId");
HeatModuleCode heatModuleCode = HeatModuleCode.valueOf(heatId);
TrayState trayState = deviceStateService.getDeviceState().getTrayInSolutionModule();
TrayState trayState = deviceStateService.getDeviceState().getTrayStateByHeatModuleCode(heatModuleCode);
if (trayState != null && trayState.getCrafts() != null) {
throw new AppException(ResultCode.CRAFT_RUNNING);
CraftStates craftStates = trayState.getCrafts().getState();
if(!(CraftStates.ERROR.equals(craftStates) || CraftStates.STOPPED.equals(craftStates))){
throw new AppException(ResultCode.CRAFT_RUNNING);
}
}
//从数据库获取加热位下降托盘位置
double trayLower = devicePositionService.getPosition(DevicePositionCode.trayLower).getDistance();

8
src/main/java/com/iflytop/gd/app/command/control/TrayUpCommand.java

@ -8,6 +8,7 @@ import com.iflytop.gd.app.service.device.DeviceStateService;
import com.iflytop.gd.app.service.device.module.HeatModuleService;
import com.iflytop.gd.common.annotation.CommandMapping;
import com.iflytop.gd.common.enums.HeatModuleCode;
import com.iflytop.gd.common.enums.automaton.CraftStates;
import com.iflytop.gd.common.enums.data.DevicePositionCode;
import com.iflytop.gd.common.exception.AppException;
import com.iflytop.gd.common.result.ResultCode;
@ -38,9 +39,12 @@ public class TrayUpCommand extends BaseCommandHandler {
String heatId = cmdDTO.getStringParam("heatId");
HeatModuleCode heatModuleCode = HeatModuleCode.valueOf(heatId);
TrayState trayState = deviceStateService.getDeviceState().getTrayInSolutionModule();
TrayState trayState = deviceStateService.getDeviceState().getTrayStateByHeatModuleCode(heatModuleCode);
if (trayState != null && trayState.getCrafts() != null) {
throw new AppException(ResultCode.CRAFT_RUNNING);
CraftStates craftStates = trayState.getCrafts().getState();
if(!(CraftStates.ERROR.equals(craftStates) || CraftStates.STOPPED.equals(craftStates))){
throw new AppException(ResultCode.CRAFT_RUNNING);
}
}
//获取加热位抬升托盘位置
double trayLift = devicePositionService.getPosition(DevicePositionCode.trayLift).getDistance();

6
src/main/java/com/iflytop/gd/app/command/control/WarmUpStartCommand.java

@ -8,6 +8,7 @@ import com.iflytop.gd.app.service.device.module.HeatModuleService;
import com.iflytop.gd.common.annotation.CommandMapping;
import com.iflytop.gd.common.enums.HeatModuleCode;
import com.iflytop.gd.common.enums.HeatingType;
import com.iflytop.gd.common.enums.automaton.CraftStates;
import com.iflytop.gd.common.exception.AppException;
import com.iflytop.gd.common.result.ResultCode;
import lombok.RequiredArgsConstructor;
@ -34,7 +35,10 @@ public class WarmUpStartCommand extends BaseCommandHandler {
Double temperature = cmdDTO.getDoubleParam("temperature");
TrayState trayState = deviceStateService.getDeviceState().getTrayStateByHeatModuleCode(heatModuleCode);
if (trayState != null && trayState.getCrafts() != null) {
throw new AppException(ResultCode.CRAFT_RUNNING);
CraftStates craftStates = trayState.getCrafts().getState();
if(!(CraftStates.ERROR.equals(craftStates) || CraftStates.STOPPED.equals(craftStates))){
throw new AppException(ResultCode.CRAFT_RUNNING);
}
}
return runAsync(() -> {
heatModuleService.heatRodOpen(cmdDTO.getCommandId(), cmdDTO.getCommand(), heatModuleCode, temperature);

2
src/main/java/com/iflytop/gd/app/controller/PhotoController.java

@ -19,7 +19,7 @@ import java.util.List;
/**
* 照片接口
*/
@Tag(name = "认证")
@Tag(name = "照片")
@RestController
@RequestMapping("/api/photo")
@RequiredArgsConstructor

Loading…
Cancel
Save