白凤吉 2 months ago
parent
commit
efeb2f0c24
  1. 2
      src/main/java/com/iflytop/gd/app/controller/CraftsController.java
  2. 7
      src/main/java/com/iflytop/gd/app/model/bo/status/device/TubeState.java
  3. 5
      src/main/java/com/iflytop/gd/app/model/dto/StartCraftsDTO.java
  4. 20
      src/main/java/com/iflytop/gd/app/service/api/CraftsService.java

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

@ -86,7 +86,7 @@ public class CraftsController {
@Operation(summary = "开始执行工艺") @Operation(summary = "开始执行工艺")
@PostMapping("/start") @PostMapping("/start")
public Result<SetCraftsVO> startCrafts(@Valid @RequestBody StartCraftsDTO startCraftsDTO) { public Result<SetCraftsVO> startCrafts(@Valid @RequestBody StartCraftsDTO startCraftsDTO) {
return Result.success(craftsService.startCrafts(startCraftsDTO.getCraftId(), startCraftsDTO.getHeatId()));
return Result.success(craftsService.startCrafts(startCraftsDTO));
} }
@Operation(summary = "暂停执行工艺") @Operation(summary = "暂停执行工艺")

7
src/main/java/com/iflytop/gd/app/model/bo/status/device/TubeState.java

@ -9,13 +9,12 @@ public class TubeState {
@Schema(description = "试管编号") @Schema(description = "试管编号")
private int tubeNum; private int tubeNum;
@Schema(description = "是否需要添加溶液 true需要")
private boolean addSolution = true;
@Schema(description = "是否添加过溶液 true添加过") @Schema(description = "是否添加过溶液 true添加过")
private boolean existSolution = false;
private boolean addSolution = false;
@Schema(description = "是否存在试管 true存在") @Schema(description = "是否存在试管 true存在")
private boolean exists = true; private boolean exists = true;
@Schema(description = "是否需要添加溶液 true需要")
private boolean needAddSolution = true;
} }

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

@ -1,6 +1,5 @@
package com.iflytop.gd.app.model.dto; 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 com.iflytop.gd.common.enums.HeatModuleCode;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;
@ -18,6 +17,6 @@ public class StartCraftsDTO {
@Schema(description = "加热区id,非必填,如果不传递则自动分配加热区") @Schema(description = "加热区id,非必填,如果不传递则自动分配加热区")
private HeatModuleCode heatId; private HeatModuleCode heatId;
@Schema(description = "试管")
private TubeState[] tubes;
@Schema(description = "需要加液的试管")
private int[] tubes;
} }

20
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.CraftsState;
import com.iflytop.gd.app.model.bo.status.device.HeatModuleState; 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.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.Crafts;
import com.iflytop.gd.app.model.entity.Ores; import com.iflytop.gd.app.model.entity.Ores;
import com.iflytop.gd.app.model.vo.CraftStatusVO; import com.iflytop.gd.app.model.vo.CraftStatusVO;
@ -29,7 +31,6 @@ import org.springframework.stereotype.Service;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutorService; import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
@ -97,7 +98,9 @@ public class CraftsService extends ServiceImpl<CraftsMapper, Crafts> {
/** /**
* 启动执行工艺 * 启动执行工艺
*/ */
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); Crafts craft = this.getById(craftId);
if (craft == null) { if (craft == null) {
throw new AppException(ResultCode.INVALID_PARAMETER); throw new AppException(ResultCode.INVALID_PARAMETER);
@ -106,7 +109,7 @@ public class CraftsService extends ServiceImpl<CraftsMapper, Crafts> {
if (ores == null) { if (ores == null) {
throw new AppException(ResultCode.INVALID_PARAMETER); 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); throw new AppException(ResultCode.SOLUTION_MODULE_NO_TRAY);
} }
//判断是否指定加热区id //判断是否指定加热区id
@ -152,6 +155,16 @@ public class CraftsService extends ServiceImpl<CraftsMapper, Crafts> {
futureMap.put(heatModuleCode, future); futureMap.put(heatModuleCode, future);
TrayState trayState = deviceStateService.getDeviceState().getTrayInSolutionModule(); TrayState trayState = deviceStateService.getDeviceState().getTrayInSolutionModule();
//配置可操作试管
TubeState[] tubeStateArr = trayState.getTubes();
List<Integer> needTubeNumArr = Arrays.stream(startCraftsDTO.getTubes()).boxed() .toList();
for (TubeState tubeState : tubeStateArr) {
if(!needTubeNumArr.contains(tubeState.getTubeNum())){
tubeState.setNeedAddSolution(false);
}
}
//配置状态
CraftsState craftsState = craftsStateObjectProvider.getObject(); CraftsState craftsState = craftsStateObjectProvider.getObject();
craftsState.setCraft(craft); craftsState.setCraft(craft);
craftsState.setOres(ores); craftsState.setOres(ores);
@ -160,6 +173,7 @@ public class CraftsService extends ServiceImpl<CraftsMapper, Crafts> {
trayState.setHeatModuleId(heatModuleCode); trayState.setHeatModuleId(heatModuleCode);
trayState.setCrafts(craftsState); trayState.setCrafts(craftsState);
//组装返回值
SetCraftsVO setCraftsVO = new SetCraftsVO(); SetCraftsVO setCraftsVO = new SetCraftsVO();
setCraftsVO.setHeatId(heatModuleCode); setCraftsVO.setHeatId(heatModuleCode);
setCraftsVO.setCraftsName(craft.getName()); setCraftsVO.setCraftsName(craft.getName());

Loading…
Cancel
Save