Browse Source

调整自检逻辑

master
白凤吉 2 months ago
parent
commit
ecb3854aae
  1. 11
      src/main/java/com/iflytop/gd/app/controller/CraftsController.java
  2. 4
      src/main/java/com/iflytop/gd/app/controller/SelfTestController.java
  3. 7
      src/main/java/com/iflytop/gd/app/model/dto/StartCraftsDTO.java
  4. 4
      src/main/java/com/iflytop/gd/app/model/vo/GetRequireOutTrayVO.java
  5. 9
      src/main/java/com/iflytop/gd/app/service/device/SelfTestService.java

11
src/main/java/com/iflytop/gd/app/controller/CraftsController.java

@ -73,16 +73,17 @@ public class CraftsController {
return Result.failed();
}
@Operation(summary = "配置加热区工艺")
@PostMapping("/set")
public Result<SetCraftsVO> setCrafts(@Valid @RequestBody SetCraftsDTO setCraftsDTO) {
return Result.success(craftsService.setCraft(setCraftsDTO.getCraftId(), setCraftsDTO.getHeatId()));
}
// @Operation(summary = "配置加热区工艺")
// @PostMapping("/set")
// public Result<SetCraftsVO> setCrafts(@Valid @RequestBody SetCraftsDTO setCraftsDTO) {
// return Result.success(craftsService.setCraft(setCraftsDTO.getCraftId(), setCraftsDTO.getHeatId()));
// }
@Operation(summary = "开始执行工艺")
@PostMapping("/start")
public Result<String> startCrafts(@Valid @RequestBody StartCraftsDTO startCraftsDTO) {
craftsService.setCraft(startCraftsDTO.getCraftId(), startCraftsDTO.getHeatId());
craftsService.startCrafts(startCraftsDTO.getHeatId());
return Result.success();
}

4
src/main/java/com/iflytop/gd/app/controller/SelfTestController.java

@ -1,7 +1,7 @@
package com.iflytop.gd.app.controller;
import com.iflytop.gd.app.model.bo.status.SelfTestState;
import com.iflytop.gd.app.model.vo.GetRequireOutTray;
import com.iflytop.gd.app.model.vo.GetRequireOutTrayVO;
import com.iflytop.gd.app.service.device.SelfTestService;
import com.iflytop.gd.app.service.device.DeviceStateService;
import com.iflytop.gd.app.service.device.module.CapModuleService;
@ -35,7 +35,7 @@ public class SelfTestController {
@Operation(summary = "是否存在需要移除的托盘")
@GetMapping("/require-out-tray")
public Result<List<GetRequireOutTray>> getRequireOutTray() {
public Result<List<GetRequireOutTrayVO>> getRequireOutTray() {
return Result.success(selfTestService.getRequireOutTray());
}

7
src/main/java/com/iflytop/gd/app/model/dto/StartCraftsDTO.java

@ -2,12 +2,17 @@ package com.iflytop.gd.app.model.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Positive;
import lombok.Data;
@Schema(description = "开始工艺")
@Data
public class StartCraftsDTO {
@Positive(message = "工艺ID 必须是正数")
@NotNull
@Schema(description = "加热区id")
@Schema(description = "工艺id")
private Long craftId;
@Schema(description = "加热区id,如果不传递则自动分配加热区")
private String heatId;
}

4
src/main/java/com/iflytop/gd/app/model/vo/GetRequireOutTray.java → src/main/java/com/iflytop/gd/app/model/vo/GetRequireOutTrayVO.java

@ -6,7 +6,7 @@ import lombok.Data;
@Schema(description = "是否存在需要移除的托盘")
@Data
public class GetRequireOutTray {
public class GetRequireOutTrayVO {
@Schema(description = "加热模块CODE")
private HeatModuleCode moduleCode;
@ -17,7 +17,7 @@ public class GetRequireOutTray {
@Schema(description = "是否存在拍子")
private boolean capExist;
public GetRequireOutTray(HeatModuleCode moduleCode, boolean trayExist, boolean capExist) {
public GetRequireOutTrayVO(HeatModuleCode moduleCode, boolean trayExist, boolean capExist) {
this.moduleCode = moduleCode;
this.trayExist = trayExist;
this.capExist = capExist;

9
src/main/java/com/iflytop/gd/app/service/device/SelfTestService.java

@ -2,7 +2,7 @@ package com.iflytop.gd.app.service.device;
import com.iflytop.gd.app.model.bo.status.SelfTestState;
import com.iflytop.gd.app.model.bo.status.device.HeatModuleState;
import com.iflytop.gd.app.model.vo.GetRequireOutTray;
import com.iflytop.gd.app.model.vo.GetRequireOutTrayVO;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@ -25,11 +25,12 @@ public class SelfTestService {
/**
* 是否存在需要移除的托盘
*/
public List<GetRequireOutTray> getRequireOutTray() {
List<GetRequireOutTray> getRequireOutTrayList = new ArrayList<>();
public List<GetRequireOutTrayVO> getRequireOutTray() {
List<GetRequireOutTrayVO> getRequireOutTrayList = new ArrayList<>();
List<HeatModuleState> heatModuleStateList = deviceStateService.getDeviceState().getHeatModule();
for (HeatModuleState heatModuleState : heatModuleStateList) {
getRequireOutTrayList.add(new GetRequireOutTray(heatModuleState.getModuleCode(),heatModuleState.getTrayStatus() == 1,heatModuleState.isCapExist()));
//TODO 只获取存在托盘的
getRequireOutTrayList.add(new GetRequireOutTrayVO(heatModuleState.getModuleCode(),heatModuleState.getTrayStatus() == 1,heatModuleState.isCapExist()));
}
return getRequireOutTrayList;
}

Loading…
Cancel
Save