51 changed files with 961 additions and 357 deletions
-
12src/main/java/com/iflytop/gd/app/command/control/FanStartCommand.java
-
12src/main/java/com/iflytop/gd/app/command/control/FanStopCommand.java
-
1src/main/java/com/iflytop/gd/app/command/control/FilledSolutionStartCommand.java
-
2src/main/java/com/iflytop/gd/app/command/control/FilledSolutionStopCommand.java
-
23src/main/java/com/iflytop/gd/app/command/control/HeatStartCommand.java
-
19src/main/java/com/iflytop/gd/app/command/control/HeatStopCommand.java
-
23src/main/java/com/iflytop/gd/app/command/control/MoveToHeatAreaCommand.java
-
25src/main/java/com/iflytop/gd/app/command/control/MoveToSolutionAreaCommand.java
-
55src/main/java/com/iflytop/gd/app/command/control/SolutionAddCommand.java
-
35src/main/java/com/iflytop/gd/app/command/control/TrayDownCommand.java
-
24src/main/java/com/iflytop/gd/app/command/control/TrayUpCommand.java
-
40src/main/java/com/iflytop/gd/app/command/control/WarmUpStartCommand.java
-
6src/main/java/com/iflytop/gd/app/command/selftest/MoveTestCommand.java
-
1src/main/java/com/iflytop/gd/app/command/selftest/TrayOutCommand.java
-
11src/main/java/com/iflytop/gd/app/controller/CraftsController.java
-
9src/main/java/com/iflytop/gd/app/controller/DeviceParamController.java
-
10src/main/java/com/iflytop/gd/app/controller/HeatController.java
-
3src/main/java/com/iflytop/gd/app/controller/SelfTestController.java
-
87src/main/java/com/iflytop/gd/app/controller/TestController.java
-
2src/main/java/com/iflytop/gd/app/controller/TrayController.java
-
19src/main/java/com/iflytop/gd/app/core/CommandPoolManager.java
-
18src/main/java/com/iflytop/gd/app/core/CraftsContext.java
-
30src/main/java/com/iflytop/gd/app/model/bo/status/CommandMutexState.java
-
18src/main/java/com/iflytop/gd/app/model/bo/status/device/DeviceState.java
-
14src/main/java/com/iflytop/gd/app/model/bo/status/device/HeatModuleState.java
-
16src/main/java/com/iflytop/gd/app/model/dto/AllSensorDTO.java
-
3src/main/java/com/iflytop/gd/app/model/dto/PauseCraftsDto.java
-
3src/main/java/com/iflytop/gd/app/model/dto/ResumeCraftsDTO.java
-
16src/main/java/com/iflytop/gd/app/model/dto/SetHeatDTO.java
-
5src/main/java/com/iflytop/gd/app/model/dto/StartCraftsDTO.java
-
3src/main/java/com/iflytop/gd/app/model/dto/StopCraftsDTO.java
-
3src/main/java/com/iflytop/gd/app/model/vo/CraftStatusVO.java
-
3src/main/java/com/iflytop/gd/app/model/vo/SetCraftsVO.java
-
149src/main/java/com/iflytop/gd/app/service/api/CraftsService.java
-
6src/main/java/com/iflytop/gd/app/service/api/HeatService.java
-
48src/main/java/com/iflytop/gd/app/service/api/TestService.java
-
6src/main/java/com/iflytop/gd/app/service/api/TrayService.java
-
60src/main/java/com/iflytop/gd/app/service/crafts/CraftsStepService.java
-
88src/main/java/com/iflytop/gd/app/service/device/DeviceCommandTempUtilService.java
-
38src/main/java/com/iflytop/gd/app/service/device/DeviceEmergencyStopService.java
-
39src/main/java/com/iflytop/gd/app/service/device/DeviceInitService.java
-
5src/main/java/com/iflytop/gd/app/service/device/DeviceStateService.java
-
168src/main/java/com/iflytop/gd/app/service/device/module/CapModuleService.java
-
29src/main/java/com/iflytop/gd/app/service/device/module/HeatModuleService.java
-
45src/main/java/com/iflytop/gd/app/service/device/module/SolutionModuleService.java
-
12src/main/java/com/iflytop/gd/app/service/scheduled/FetchTemperatureScheduledTask.java
-
13src/main/java/com/iflytop/gd/app/ws/client/DeviceEmergencyStopConfig.java
-
13src/main/java/com/iflytop/gd/common/enums/HeatingType.java
-
6src/main/java/com/iflytop/gd/common/result/ResultCode.java
-
8src/main/java/com/iflytop/gd/monitor/controller/CraftsMonitorController.java
@ -0,0 +1,40 @@ |
|||
package com.iflytop.gd.app.command.control; |
|||
|
|||
import com.iflytop.gd.app.core.BaseCommandHandler; |
|||
import com.iflytop.gd.app.model.dto.CmdDTO; |
|||
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.HeatingType; |
|||
import lombok.RequiredArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
import java.util.concurrent.CompletableFuture; |
|||
|
|||
/** |
|||
* 开始预热 |
|||
*/ |
|||
@Slf4j |
|||
@Component |
|||
@RequiredArgsConstructor |
|||
@CommandMapping("warm_up_start")//业务指令注解 |
|||
public class WarmUpStartCommand extends BaseCommandHandler { |
|||
private final HeatModuleService heatModuleService; |
|||
private final DeviceStateService deviceStateService; |
|||
|
|||
@Override |
|||
public CompletableFuture<Void> handle(CmdDTO cmdDTO) { |
|||
String heatId = cmdDTO.getStringParam("heatId"); |
|||
HeatModuleCode heatModuleCode = HeatModuleCode.valueOf(heatId); |
|||
Double temperature = cmdDTO.getDoubleParam("temperature"); |
|||
return runAsync(() -> { |
|||
heatModuleService.heatRodOpen(cmdDTO.getCommandId(), cmdDTO.getCommand(), heatModuleCode, temperature); |
|||
deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).setWarmUpTemperature(temperature); |
|||
deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).setTargetTemperature(temperature); |
|||
deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).setHeatingType(HeatingType.warm_up); |
|||
}); |
|||
} |
|||
} |
|||
|
@ -0,0 +1,87 @@ |
|||
package com.iflytop.gd.app.controller; |
|||
|
|||
import com.iflytop.gd.app.model.bo.status.CommandMutexState; |
|||
import com.iflytop.gd.app.model.dto.AllSensorDTO; |
|||
import com.iflytop.gd.app.service.api.TestService; |
|||
import com.iflytop.gd.app.service.device.DeviceEmergencyStopService; |
|||
import com.iflytop.gd.app.service.device.DeviceStateService; |
|||
import com.iflytop.gd.app.service.device.module.CapModuleService; |
|||
import com.iflytop.gd.app.service.device.module.SolutionModuleService; |
|||
import com.iflytop.gd.common.result.Result; |
|||
import com.iflytop.gd.hardware.exception.HardwareException; |
|||
import io.swagger.v3.oas.annotations.Operation; |
|||
import io.swagger.v3.oas.annotations.tags.Tag; |
|||
import lombok.RequiredArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.web.bind.annotation.GetMapping; |
|||
import org.springframework.web.bind.annotation.PostMapping; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 测试用 |
|||
*/ |
|||
@Tag(name = "测试用") |
|||
@RestController |
|||
@RequestMapping("/api/test") |
|||
@RequiredArgsConstructor |
|||
@Slf4j |
|||
public class TestController { |
|||
private final TestService testService; |
|||
private final CapModuleService capModuleService; |
|||
private final DeviceStateService deviceStateService; |
|||
private final SolutionModuleService solutionModuleService; |
|||
private final DeviceEmergencyStopService deviceEmergencyStopService; |
|||
|
|||
@Operation(summary = "获取所有传感器读数") |
|||
@GetMapping("/all-sensor") |
|||
public Result<List<AllSensorDTO>> getAllSensor() throws HardwareException { |
|||
return Result.success(testService.getAllSensor()); |
|||
} |
|||
|
|||
@Operation(summary = "将拍子升降区抬升至可以获取的位置") |
|||
@PostMapping("/cap-up-balance") |
|||
public Result<?> capUpBalance() throws Exception { |
|||
capModuleService.capUpBalance(); |
|||
return Result.success(); |
|||
} |
|||
|
|||
|
|||
@Operation(summary = "调整拍子升降电机位置") |
|||
@PostMapping("/cap-motor-move-by-num") |
|||
public Result<?> capMotorMoveByNum(int num) throws Exception { |
|||
capModuleService.capMotorMoveByNum(num); |
|||
return Result.success(); |
|||
} |
|||
|
|||
|
|||
@Operation(summary = "获取指令互斥状态") |
|||
@GetMapping("/mutex-state") |
|||
public Result<CommandMutexState> getCommandMutexState() throws HardwareException { |
|||
return Result.success(deviceStateService.getCommandMutexState().get()); |
|||
} |
|||
|
|||
@Operation(summary = "重置状态") |
|||
@PostMapping("/reset") |
|||
public Result<?> reset() throws Exception { |
|||
testService.reset(); |
|||
return Result.success(); |
|||
} |
|||
|
|||
|
|||
@Operation(summary = "触发急停") |
|||
@PostMapping("/press-emergency-stop") |
|||
public Result<?> pressEmergencyStop() throws Exception { |
|||
deviceEmergencyStopService.press(); |
|||
return Result.success(); |
|||
} |
|||
|
|||
@Operation(summary = "解除急停") |
|||
@PostMapping("/release-emergency-stop") |
|||
public Result<?> releaseEmergencyStop() throws Exception { |
|||
deviceEmergencyStopService.release(); |
|||
return Result.success(); |
|||
} |
|||
} |
@ -0,0 +1,16 @@ |
|||
package com.iflytop.gd.app.model.dto; |
|||
|
|||
import com.iflytop.gd.hardware.type.IO.InputIOMId; |
|||
import io.swagger.v3.oas.annotations.media.Schema; |
|||
import lombok.Data; |
|||
|
|||
@Data |
|||
public class AllSensorDTO { |
|||
private InputIOMId inputIOMId; |
|||
private Boolean state; |
|||
|
|||
public AllSensorDTO(InputIOMId inputIOMId, Boolean state) { |
|||
this.inputIOMId = inputIOMId; |
|||
this.state = state; |
|||
} |
|||
} |
@ -0,0 +1,48 @@ |
|||
package com.iflytop.gd.app.service.api; |
|||
|
|||
import com.iflytop.gd.app.model.dto.AllSensorDTO; |
|||
import com.iflytop.gd.app.service.device.DeviceStateService; |
|||
import com.iflytop.gd.hardware.exception.HardwareException; |
|||
import com.iflytop.gd.hardware.service.GDDeviceStatusService; |
|||
import com.iflytop.gd.hardware.type.IO.InputIOMId; |
|||
import lombok.RequiredArgsConstructor; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.util.ArrayList; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 测试用 |
|||
*/ |
|||
@Service |
|||
@RequiredArgsConstructor |
|||
public class TestService { |
|||
private final GDDeviceStatusService gdDeviceStatusService; |
|||
private final DeviceStateService deviceStateService; |
|||
|
|||
public List<AllSensorDTO> getAllSensor() throws HardwareException { |
|||
List<AllSensorDTO> allSensorDTOList = new ArrayList<>(); |
|||
allSensorDTOList.add(new AllSensorDTO(InputIOMId.HEAT_MODULE01_EXIST, gdDeviceStatusService.getInputState(InputIOMId.HEAT_MODULE01_EXIST))); |
|||
allSensorDTOList.add(new AllSensorDTO(InputIOMId.HEAT_MODULE02_EXIST, gdDeviceStatusService.getInputState(InputIOMId.HEAT_MODULE02_EXIST))); |
|||
allSensorDTOList.add(new AllSensorDTO(InputIOMId.HEAT_MODULE03_EXIST, gdDeviceStatusService.getInputState(InputIOMId.HEAT_MODULE03_EXIST))); |
|||
allSensorDTOList.add(new AllSensorDTO(InputIOMId.HEAT_MODULE04_EXIST, gdDeviceStatusService.getInputState(InputIOMId.HEAT_MODULE04_EXIST))); |
|||
allSensorDTOList.add(new AllSensorDTO(InputIOMId.HEAT_MODULE05_EXIST, gdDeviceStatusService.getInputState(InputIOMId.HEAT_MODULE05_EXIST))); |
|||
allSensorDTOList.add(new AllSensorDTO(InputIOMId.HEAT_MODULE06_EXIST, gdDeviceStatusService.getInputState(InputIOMId.HEAT_MODULE06_EXIST))); |
|||
allSensorDTOList.add(new AllSensorDTO(InputIOMId.HEAT_MODULE06_EXIST, gdDeviceStatusService.getInputState(InputIOMId.HEAT_MODULE06_EXIST))); |
|||
|
|||
allSensorDTOList.add(new AllSensorDTO(InputIOMId.CAP01_EXIST, gdDeviceStatusService.getInputState(InputIOMId.CAP01_EXIST))); |
|||
allSensorDTOList.add(new AllSensorDTO(InputIOMId.CAP02_EXIST, gdDeviceStatusService.getInputState(InputIOMId.CAP02_EXIST))); |
|||
allSensorDTOList.add(new AllSensorDTO(InputIOMId.CAP03_EXIST, gdDeviceStatusService.getInputState(InputIOMId.CAP03_EXIST))); |
|||
allSensorDTOList.add(new AllSensorDTO(InputIOMId.CAP04_EXIST, gdDeviceStatusService.getInputState(InputIOMId.CAP04_EXIST))); |
|||
allSensorDTOList.add(new AllSensorDTO(InputIOMId.CAP05_EXIST, gdDeviceStatusService.getInputState(InputIOMId.CAP05_EXIST))); |
|||
allSensorDTOList.add(new AllSensorDTO(InputIOMId.CAP06_EXIST, gdDeviceStatusService.getInputState(InputIOMId.CAP06_EXIST))); |
|||
|
|||
return allSensorDTOList; |
|||
} |
|||
|
|||
public void reset(){ |
|||
deviceStateService.getCommandMutexState().get().reset(); |
|||
deviceStateService.getDeviceState().reset(); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,38 @@ |
|||
package com.iflytop.gd.app.service.device; |
|||
|
|||
import com.iflytop.gd.app.core.CommandPoolManager; |
|||
import com.iflytop.gd.app.service.api.CraftsService; |
|||
import lombok.RequiredArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
/** |
|||
* 设备急停 |
|||
*/ |
|||
@Slf4j |
|||
@Service |
|||
@RequiredArgsConstructor |
|||
public class DeviceEmergencyStopService { |
|||
private final DeviceStepCommandService stepCommandService; |
|||
private final DeviceStateService deviceStateService; |
|||
private final CommandPoolManager commandPoolManager; |
|||
private final CraftsService craftsService; |
|||
|
|||
/** |
|||
* 处理按下急停 |
|||
*/ |
|||
public void press() throws Exception { |
|||
commandPoolManager.forceShutdownAll();//强制终止现在运行的所有指令 |
|||
craftsService.stopAllCrafts();//停止所有工艺 |
|||
stepCommandService.stopAll(); |
|||
deviceStateService.getDeviceState().setEmergencyStop(true); |
|||
} |
|||
|
|||
/** |
|||
* 处理接触急停 |
|||
*/ |
|||
public void release(){ |
|||
commandPoolManager.restartExecutor(); |
|||
deviceStateService.getDeviceState().setEmergencyStop(false); |
|||
} |
|||
} |
@ -0,0 +1,13 @@ |
|||
package com.iflytop.gd.common.enums; |
|||
|
|||
import lombok.Getter; |
|||
|
|||
/** |
|||
* 加热状态类型 |
|||
*/ |
|||
@Getter |
|||
public enum HeatingType { |
|||
stop, |
|||
warm_up, |
|||
thermostatic, |
|||
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue