diff --git a/src/main/java/com/iflytop/gd/app/controller/CraftsController.java b/src/main/java/com/iflytop/gd/app/controller/CraftsController.java index 122c42d..727a954 100644 --- a/src/main/java/com/iflytop/gd/app/controller/CraftsController.java +++ b/src/main/java/com/iflytop/gd/app/controller/CraftsController.java @@ -86,7 +86,7 @@ public class CraftsController { @Operation(summary = "开始执行工艺") @PostMapping("/start") public Result startCrafts(@Valid @RequestBody StartCraftsDTO startCraftsDTO) { - return Result.success(craftsService.startCrafts(startCraftsDTO.getCraftId(), startCraftsDTO.getHeatId())); + return Result.success(craftsService.startCrafts(startCraftsDTO)); } @Operation(summary = "暂停执行工艺") diff --git a/src/main/java/com/iflytop/gd/app/model/bo/status/device/TubeState.java b/src/main/java/com/iflytop/gd/app/model/bo/status/device/TubeState.java index f47f554..c8615ad 100644 --- a/src/main/java/com/iflytop/gd/app/model/bo/status/device/TubeState.java +++ b/src/main/java/com/iflytop/gd/app/model/bo/status/device/TubeState.java @@ -9,13 +9,12 @@ public class TubeState { @Schema(description = "试管编号") private int tubeNum; - @Schema(description = "是否需要添加溶液 true需要") - private boolean addSolution = true; - @Schema(description = "是否添加过溶液 true添加过") - private boolean existSolution = false; + private boolean addSolution = false; @Schema(description = "是否存在试管 true存在") private boolean exists = true; + @Schema(description = "是否需要添加溶液 true需要") + private boolean needAddSolution = true; } diff --git a/src/main/java/com/iflytop/gd/app/model/dto/StartCraftsDTO.java b/src/main/java/com/iflytop/gd/app/model/dto/StartCraftsDTO.java index 9866983..ff44743 100644 --- a/src/main/java/com/iflytop/gd/app/model/dto/StartCraftsDTO.java +++ b/src/main/java/com/iflytop/gd/app/model/dto/StartCraftsDTO.java @@ -1,6 +1,5 @@ package com.iflytop.gd.app.model.dto; -import com.iflytop.gd.app.model.bo.status.device.TubeState; import com.iflytop.gd.common.enums.HeatModuleCode; import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotNull; @@ -18,6 +17,6 @@ public class StartCraftsDTO { @Schema(description = "加热区id,非必填,如果不传递则自动分配加热区") private HeatModuleCode heatId; - @Schema(description = "试管") - private TubeState[] tubes; + @Schema(description = "需要加液的试管") + private int[] tubes; } diff --git a/src/main/java/com/iflytop/gd/app/service/api/CraftsService.java b/src/main/java/com/iflytop/gd/app/service/api/CraftsService.java index bf90a0d..3b0c18a 100644 --- a/src/main/java/com/iflytop/gd/app/service/api/CraftsService.java +++ b/src/main/java/com/iflytop/gd/app/service/api/CraftsService.java @@ -7,6 +7,8 @@ import com.iflytop.gd.app.mapper.CraftsMapper; import com.iflytop.gd.app.model.bo.status.device.CraftsState; import com.iflytop.gd.app.model.bo.status.device.HeatModuleState; 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.dto.StartCraftsDTO; import com.iflytop.gd.app.model.entity.Crafts; import com.iflytop.gd.app.model.entity.Ores; import com.iflytop.gd.app.model.vo.CraftStatusVO; @@ -29,7 +31,6 @@ import org.springframework.stereotype.Service; import java.util.Arrays; import java.util.List; -import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; @@ -97,7 +98,9 @@ public class CraftsService extends ServiceImpl { /** * 启动执行工艺 */ - public synchronized SetCraftsVO startCrafts(Long craftId, HeatModuleCode heatModuleCode) { + public synchronized SetCraftsVO startCrafts(StartCraftsDTO startCraftsDTO) { + long craftId = startCraftsDTO.getCraftId(); + HeatModuleCode heatModuleCode = startCraftsDTO.getHeatId(); Crafts craft = this.getById(craftId); if (craft == null) { throw new AppException(ResultCode.INVALID_PARAMETER); @@ -106,7 +109,7 @@ public class CraftsService extends ServiceImpl { if (ores == null) { throw new AppException(ResultCode.INVALID_PARAMETER); } - if(deviceStateService.getDeviceState().getSolutionModule().getTrayStatus() == 0){ + if (deviceStateService.getDeviceState().getSolutionModule().getTrayStatus() == 0) { throw new AppException(ResultCode.SOLUTION_MODULE_NO_TRAY); } //判断是否指定加热区id @@ -152,6 +155,16 @@ public class CraftsService extends ServiceImpl { futureMap.put(heatModuleCode, future); TrayState trayState = deviceStateService.getDeviceState().getTrayInSolutionModule(); + //配置可操作试管 + TubeState[] tubeStateArr = trayState.getTubes(); + List needTubeNumArr = Arrays.stream(startCraftsDTO.getTubes()).boxed() .toList(); + for (TubeState tubeState : tubeStateArr) { + if(!needTubeNumArr.contains(tubeState.getTubeNum())){ + tubeState.setNeedAddSolution(false); + } + } + + //配置状态 CraftsState craftsState = craftsStateObjectProvider.getObject(); craftsState.setCraft(craft); craftsState.setOres(ores); @@ -160,6 +173,7 @@ public class CraftsService extends ServiceImpl { trayState.setHeatModuleId(heatModuleCode); trayState.setCrafts(craftsState); + //组装返回值 SetCraftsVO setCraftsVO = new SetCraftsVO(); setCraftsVO.setHeatId(heatModuleCode); setCraftsVO.setCraftsName(craft.getName());