Browse Source

fix:数据库id应该为Long型

master
白凤吉 1 week ago
parent
commit
f898a7a2f2
  1. 2
      src/main/java/com/iflytop/colortitration/app/command/control/pipeline/PipelineCleanStartCommand.java
  2. 2
      src/main/java/com/iflytop/colortitration/app/command/control/pipeline/PipelineCleanStopCommand.java
  3. 2
      src/main/java/com/iflytop/colortitration/app/command/control/pipeline/PipelineDrainStartCommand.java
  4. 2
      src/main/java/com/iflytop/colortitration/app/command/control/pipeline/PipelineDrainStopCommand.java
  5. 2
      src/main/java/com/iflytop/colortitration/app/command/control/pipeline/PipelinePreFillStartCommand.java
  6. 2
      src/main/java/com/iflytop/colortitration/app/command/control/pipeline/PipelinePreFillStopCommand.java
  7. 2
      src/main/java/com/iflytop/colortitration/app/command/control/solution/SolutionAddCommand.java
  8. 2
      src/main/java/com/iflytop/colortitration/app/command/control/solution/SolutionStopCommand.java
  9. 5
      src/main/java/com/iflytop/colortitration/app/common/enums/AddSolutionType.java
  10. 5
      src/main/java/com/iflytop/colortitration/app/common/enums/TubeCurrentLocal.java
  11. 14
      src/main/java/com/iflytop/colortitration/app/controller/CraftsController.java
  12. 29
      src/main/java/com/iflytop/colortitration/app/core/crafts/CraftsContext.java
  13. 87
      src/main/java/com/iflytop/colortitration/app/core/crafts/CraftsDispatcher.java
  14. 100
      src/main/java/com/iflytop/colortitration/app/core/crafts/CraftsExecutionService.java
  15. 10
      src/main/java/com/iflytop/colortitration/app/core/crafts/CraftsStep.java
  16. 6
      src/main/java/com/iflytop/colortitration/app/model/dto/CommandDTO.java
  17. 18
      src/main/java/com/iflytop/colortitration/app/service/module/TitrationModuleService.java
  18. 2
      src/main/java/com/iflytop/colortitration/common/model/entity/Container.java
  19. 4
      src/main/java/com/iflytop/colortitration/common/service/CraftsService.java

2
src/main/java/com/iflytop/colortitration/app/command/control/pipeline/PipelineCleanStartCommand.java

@ -27,7 +27,7 @@ public class PipelineCleanStartCommand extends BaseCommandHandler {
@Override
public CompletableFuture<Void> handle(CommandDTO commandDTO) {
Integer solutionId = commandDTO.getIntegerParam("solutionId");
Long solutionId = commandDTO.getLongParam("solutionId");
String titrationModuleCodeStr = commandDTO.getStringParam("titrationModuleCode");
if (StringUtils.isEmpty(titrationModuleCodeStr) || solutionId == null) {
throw new AppException(ResultCode.INVALID_PARAMETER);//参数缺失

2
src/main/java/com/iflytop/colortitration/app/command/control/pipeline/PipelineCleanStopCommand.java

@ -26,7 +26,7 @@ public class PipelineCleanStopCommand extends BaseCommandHandler {
@Override
public CompletableFuture<Void> handle(CommandDTO commandDTO) {
Integer solutionId = commandDTO.getIntegerParam("solutionId");
Long solutionId = commandDTO.getLongParam("solutionId");
String titrationModuleCodeStr = commandDTO.getStringParam("titrationModuleCode");
if (StringUtils.isEmpty(titrationModuleCodeStr) || solutionId == null) {
throw new AppException(ResultCode.INVALID_PARAMETER);//参数缺失

2
src/main/java/com/iflytop/colortitration/app/command/control/pipeline/PipelineDrainStartCommand.java

@ -26,7 +26,7 @@ public class PipelineDrainStartCommand extends BaseCommandHandler {
@Override
public CompletableFuture<Void> handle(CommandDTO commandDTO) {
Integer solutionId = commandDTO.getIntegerParam("solutionId");
Long solutionId = commandDTO.getLongParam("solutionId");
String titrationModuleCodeStr = commandDTO.getStringParam("titrationModuleCode");
if (StringUtils.isEmpty(titrationModuleCodeStr) || solutionId == null) {
throw new AppException(ResultCode.INVALID_PARAMETER);//参数缺失

2
src/main/java/com/iflytop/colortitration/app/command/control/pipeline/PipelineDrainStopCommand.java

@ -26,7 +26,7 @@ public class PipelineDrainStopCommand extends BaseCommandHandler {
@Override
public CompletableFuture<Void> handle(CommandDTO commandDTO) {
Integer solutionId = commandDTO.getIntegerParam("solutionId");
Long solutionId = commandDTO.getLongParam("solutionId");
String motorCode = commandDTO.getStringParam("titrationModuleCode");
if (StringUtils.isEmpty(motorCode) || solutionId == null) {
throw new AppException(ResultCode.INVALID_PARAMETER);

2
src/main/java/com/iflytop/colortitration/app/command/control/pipeline/PipelinePreFillStartCommand.java

@ -26,7 +26,7 @@ public class PipelinePreFillStartCommand extends BaseCommandHandler {
@Override
public CompletableFuture<Void> handle(CommandDTO commandDTO) {
Integer solutionId = commandDTO.getIntegerParam("solutionId");
Long solutionId = commandDTO.getLongParam("solutionId");
String titrationModuleCodeStr = commandDTO.getStringParam("titrationModuleCode");
if (StringUtils.isEmpty(titrationModuleCodeStr) || solutionId == null) {
throw new AppException(ResultCode.INVALID_PARAMETER);//参数缺失

2
src/main/java/com/iflytop/colortitration/app/command/control/pipeline/PipelinePreFillStopCommand.java

@ -26,7 +26,7 @@ public class PipelinePreFillStopCommand extends BaseCommandHandler {
@Override
public CompletableFuture<Void> handle(CommandDTO commandDTO) {
Integer solutionId = commandDTO.getIntegerParam("solutionId");
Long solutionId = commandDTO.getLongParam("solutionId");
String titrationModuleCodeStr = commandDTO.getStringParam("titrationModuleCode");
if (StringUtils.isEmpty(titrationModuleCodeStr) || solutionId == null) {
throw new AppException(ResultCode.INVALID_PARAMETER);//参数缺失

2
src/main/java/com/iflytop/colortitration/app/command/control/solution/SolutionAddCommand.java

@ -27,7 +27,7 @@ public class SolutionAddCommand extends BaseCommandHandler {
@Override
public CompletableFuture<Void> handle(CommandDTO commandDTO) {
String moduleCodeStr = commandDTO.getStringParam("titrationModuleCode");
Integer solutionId = commandDTO.getIntegerParam("solutionId");
Long solutionId = commandDTO.getLongParam("solutionId");
Double volume = commandDTO.getDoubleParam("volume");
String type = commandDTO.getStringParam("type");
if (type.equals("drop")) {

2
src/main/java/com/iflytop/colortitration/app/command/control/solution/SolutionStopCommand.java

@ -27,7 +27,7 @@ public class SolutionStopCommand extends BaseCommandHandler {
@Override
public CompletableFuture<Void> handle(CommandDTO commandDTO) {
String moduleCodeStr = commandDTO.getStringParam("titrationModuleCode");
Integer solutionId = commandDTO.getIntegerParam("solutionId");
Long solutionId = commandDTO.getLongParam("solutionId");
if (StringUtils.isEmpty(moduleCodeStr) || solutionId == null) {
throw new AppException(ResultCode.INVALID_PARAMETER);//参数缺失
}

5
src/main/java/com/iflytop/colortitration/app/common/enums/AddSolutionType.java

@ -0,0 +1,5 @@
package com.iflytop.colortitration.app.common.enums;
public enum AddSolutionType {
fixed,segmented,titration
}

5
src/main/java/com/iflytop/colortitration/app/common/enums/TubeCurrentLocal.java

@ -0,0 +1,5 @@
package com.iflytop.colortitration.app.common.enums;
public enum TubeCurrentLocal {
TRAY, TITRATION, HEAT
}

14
src/main/java/com/iflytop/colortitration/app/controller/CraftsController.java

@ -2,6 +2,7 @@ package com.iflytop.colortitration.app.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.iflytop.colortitration.app.core.crafts.CraftsDispatcher;
import com.iflytop.colortitration.app.core.state.DeviceState;
import com.iflytop.colortitration.app.model.dto.SetCraftsDTO;
import com.iflytop.colortitration.common.base.BasePageQuery;
import com.iflytop.colortitration.common.model.entity.Crafts;
@ -28,6 +29,7 @@ import java.util.Arrays;
public class CraftsController {
private final CraftsService craftsService;
private final CraftsDispatcher craftsDispatcher;
private final DeviceState deviceState;
@Operation(summary = "分页查询工艺列表")
@ -80,21 +82,27 @@ public class CraftsController {
@Operation(summary = "暂停执行工艺")
@PostMapping("/pause")
public Result<?> pauseCrafts() {
craftsDispatcher.pause();
deviceState.setCraftsPaused(true);
return Result.success();
}
@Operation(summary = "恢复执行工艺")
@PostMapping("/resume")
public Result<?> resumeCrafts() {
craftsDispatcher.resume();
deviceState.setCraftsPaused(false);
return Result.success();
}
@Operation(summary = "停止执行工艺")
@PostMapping("/stop")
public Result<String> stopCrafts() {
craftsDispatcher.stop();
craftsDispatcher.clearQueue();
deviceState.getTrayTubeStateMap().forEach((key, value) -> {
value.setCraftsId(null);
value.setCraftsName(null);
value.setTitrationModuleCodes(null);
value.setQueueNum(null);
});
return Result.success();
}

29
src/main/java/com/iflytop/colortitration/app/core/crafts/CraftsJob.java → src/main/java/com/iflytop/colortitration/app/core/crafts/CraftsContext.java

@ -1,6 +1,7 @@
package com.iflytop.colortitration.app.core.crafts;
import com.iflytop.colortitration.app.common.enums.MultipleModuleCode;
import com.iflytop.colortitration.app.common.enums.TubeCurrentLocal;
import com.iflytop.colortitration.common.model.entity.Crafts;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
@ -14,19 +15,27 @@ import java.util.List;
@Component
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
@Data
public class CraftsJob {
public class CraftsContext {
private int tubeNum;
private List<MultipleModuleCode> selectedModules;
private Crafts crafts;
private List<MultipleModuleCode> selectedModules;
private int currentCommandCount = 0;
private int historyCommandCount = 0;
private MultipleModuleCode currentTitrationModuleCode;
private MultipleModuleCode currentHeatModuleCode;
private TubeCurrentLocal tubeCurrentLocal;
public void executeSteps(CraftsDispatcher dispatcher) {
log.info("执行工艺开始,试管{}", tubeNum);
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
log.info("执行工艺结束,试管{}", tubeNum);
/**
* 自增当前指令计数器
*/
public int incrementCurrentCommandCount() {
return currentCommandCount++;
}
/**
* 自增历史指令计数器
*/
public int incrementHistoryCommandCount() {
return historyCommandCount++;
}
}

87
src/main/java/com/iflytop/colortitration/app/core/crafts/CraftsDispatcher.java

@ -1,6 +1,7 @@
package com.iflytop.colortitration.app.core.crafts;
import com.iflytop.colortitration.app.common.enums.MultipleModuleCode;
import com.iflytop.colortitration.app.common.enums.TitrationStatus;
import com.iflytop.colortitration.app.core.state.DeviceState;
import jakarta.annotation.PostConstruct;
import lombok.RequiredArgsConstructor;
@ -12,8 +13,6 @@ import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.ReentrantLock;
/**
* 动态为每个滴定位模块创建独立队列和工作线程
@ -22,12 +21,12 @@ import java.util.concurrent.locks.ReentrantLock;
@Component
@RequiredArgsConstructor
public class CraftsDispatcher {
private final BlockingQueue<CraftsJob> jobQueue = new LinkedBlockingQueue<>();
private final BlockingQueue<CraftsContext> contextQueue = new LinkedBlockingQueue<>();
private ExecutorService executor;
private final AtomicInteger threadCounter = new AtomicInteger(0);
private final ReentrantLock pauseLock = new ReentrantLock();
private final Condition pauseCondition = pauseLock.newCondition();
private final DeviceState deviceState;
private final CraftsExecutionService craftsStepService;
@PostConstruct
public void init() {
@ -50,9 +49,11 @@ public class CraftsDispatcher {
return () -> {
while (true) {
try {
CraftsJob job = jobQueue.take();
job.executeSteps(this);
log.info("试管编号 {} 的任务执行成功。", job.getTubeNum());
CraftsContext craftsContext = contextQueue.take();
deviceState.getTrayTubeStateMap().get(craftsContext.getTubeNum()).setTitrationStatus(TitrationStatus.IN_PROGRESS);
craftsStepService.executeStep(craftsContext);
deviceState.getTrayTubeStateMap().get(craftsContext.getTubeNum()).setTitrationStatus(TitrationStatus.COMPLETED);
log.info("试管编号 {} 的任务执行成功。", craftsContext.getTubeNum());
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
log.warn("工作线程被中断,停止执行。");
@ -67,9 +68,9 @@ public class CraftsDispatcher {
/**
* 将新的待执行工艺添加至队列
*/
public void addCraftsJob(CraftsJob craftsJob) {
public void addCraftsJob(CraftsContext craftsJob) {
try {
jobQueue.put(craftsJob);
contextQueue.put(craftsJob);
log.info("试管编号 {} 的任务已添加到队列中。", craftsJob.getTubeNum());
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
@ -80,8 +81,8 @@ public class CraftsDispatcher {
/**
* 获取所有待执行的任务
*/
public BlockingQueue<CraftsJob> getAllJobs() {
return jobQueue;
public BlockingQueue<CraftsContext> getAllJobs() {
return contextQueue;
}
/**
@ -89,9 +90,9 @@ public class CraftsDispatcher {
*/
public void removeCraftsJob(int tubeNum) {
boolean removed = false;
for (CraftsJob job : jobQueue) {
for (CraftsContext job : contextQueue) {
if (job.getTubeNum() == tubeNum) {
jobQueue.remove(job); // 删除任务
contextQueue.remove(job); // 删除任务
removed = true;
log.info("试管编号 {} 的任务已从队列中删除。", tubeNum);
}
@ -101,62 +102,8 @@ public class CraftsDispatcher {
}
}
/**
* 如果暂停线程将进入等待状态
*
* @throws InterruptedException 如果线程被中断
*/
public void waitIfPaused() throws InterruptedException {
pauseLock.lock();
try {
while (deviceState.isCraftsPaused()) {
// 如果已暂停当前线程将被挂起直到调用 notifyAll() 唤醒
pauseCondition.await();
}
} finally {
pauseLock.unlock();
}
}
/**
* 暂停所有任务
*/
public void pause() {
pauseLock.lock();
try {
deviceState.setCraftsPaused(true);
log.info("所有任务已暂停。");
} finally {
pauseLock.unlock();
}
}
/**
* 恢复所有任务
*/
public void resume() {
pauseLock.lock();
try {
deviceState.setCraftsPaused(false);
pauseCondition.signalAll(); // 唤醒所有等待的线程
log.info("所有任务已恢复。");
} finally {
pauseLock.unlock();
}
}
/**
* 停止工艺
*/
public void stop(){
//TODO 发送停止指令
jobQueue.clear();
deviceState.getTrayTubeStateMap().forEach((key, value) -> {
value.setCraftsId(null);
value.setCraftsName(null);
value.setTitrationModuleCodes(null);
value.setQueueNum(null);
});
public void clearQueue() {
contextQueue.clear();
}
}

100
src/main/java/com/iflytop/colortitration/app/core/crafts/CraftsExecutionService.java

@ -0,0 +1,100 @@
package com.iflytop.colortitration.app.core.crafts;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.iflytop.colortitration.app.common.enums.AddSolutionType;
import com.iflytop.colortitration.app.common.utils.CommandUtil;
import com.iflytop.colortitration.app.core.command.CommandFuture;
import com.iflytop.colortitration.app.service.DeviceCommandService;
import com.iflytop.colortitration.app.service.module.TitrationModuleService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 工艺步骤执行服务
*/
@Slf4j
@Service
@RequiredArgsConstructor
public class CraftsExecutionService {
private final DeviceCommandService deviceCommandService;
private final TitrationModuleService titrationModuleService;
/**
* 执行工艺步骤直接从 CraftsContext 中获取步骤
*/
public boolean executeStep(CraftsContext craftsContext) throws Exception {
craftsContext.setCurrentCommandCount(0);
List<CraftsStep> craftsStepList = JSONUtil.parseArray(craftsContext.getCrafts().getSteps()).toList(CraftsStep.class);
for (CraftsStep craftsStep : craftsStepList) {
String method = craftsStep.getMethod();
JSONObject params = craftsStep.getParams();
return switch (method) {
case "addSolution" -> addSolution(craftsContext, params);
case "heat" -> heat(craftsContext, params);
case "addMagnet" -> addMagnet(craftsContext, params);
case "waiting" -> waiting(craftsContext, params);
default -> true;
};
}
return true;
}
private boolean addSolution(CraftsContext craftsContext, JSONObject params) throws Exception {
moveToTitration();//移动至滴定
//TODO 调用相机判断滴定位是否存在试管
Long solutionId = params.getLong("solutionId");//使用的溶液id
Double amount = params.getDouble("amount");//加液量
Long colorId = params.getLong("colorId");//终点颜色
String type = params.getStr("type");//加液方式
AddSolutionType addSolutionType = AddSolutionType.valueOf(type);
Integer waitTime = params.getInt("waitTime");//加液后等待时长
Double maxAmount = params.getDouble("maxAmount");//滴定最大体积
Boolean stirFlag = params.getBool("stirFlag");//是否搅拌
if(AddSolutionType.fixed.equals(addSolutionType)){//定量加液
titrationModuleService.addSolutionStart(craftsContext.getCurrentTitrationModuleCode(), solutionId, amount);
}else if(AddSolutionType.segmented.equals(addSolutionType)){//分段加液
}else if(AddSolutionType.titration.equals(addSolutionType)){//滴定加液
}
return true;
}
private boolean heat(CraftsContext craftsContext, JSONObject params) {
moveToHeat();//移动至加热
//TODO 调用传感器判断加热位是否存在试管
return true;
}
private boolean addMagnet(CraftsContext craftsContext, JSONObject params) {
return true;
}
private boolean waiting(CraftsContext craftsContext, JSONObject params) {
return true;
}
//移动至滴定
private void moveToTitration(){
//动态分配使用的模块
}
//移动至加热
private void moveToHeat(){
//动态分配使用的模块
}
private void wait(CraftsContext craftsContext, CommandFuture... futures) throws Exception {
wait(craftsContext, null, futures);
}
private void wait(CraftsContext craftsContext, Long timeout, CommandFuture... futures) throws Exception {
CommandUtil.wait(timeout, futures);
craftsContext.incrementCurrentCommandCount();
craftsContext.incrementHistoryCommandCount();
}
}

10
src/main/java/com/iflytop/colortitration/app/core/crafts/CraftsStep.java

@ -0,0 +1,10 @@
package com.iflytop.colortitration.app.core.crafts;
import cn.hutool.json.JSONObject;
import lombok.Data;
@Data
public class CraftsStep {
private String method;
private JSONObject params;
}

6
src/main/java/com/iflytop/colortitration/app/model/dto/CommandDTO.java

@ -43,6 +43,12 @@ public class CommandDTO {
return (value != null && !value.isEmpty()) ? Integer.parseInt(value) : null;
}
// 获取 Long 类型的参数null 或空字符串时返回 null
public Long getLongParam(String key) {
String value = getStringParam(key);
return (value != null && !value.isEmpty()) ? Long.parseLong(value) : null;
}
// 获取 Boolean 类型的参数null 或空字符串时返回 null
public Boolean getBooleanParam(String key) {
String value = getStringParam(key);

18
src/main/java/com/iflytop/colortitration/app/service/module/TitrationModuleService.java

@ -36,7 +36,7 @@ public class TitrationModuleService {
/**
* 添加溶液开始
*/
public void addSolutionStart(MultipleModuleCode titrationModuleCode, Integer solutionId, double volume) {
public void addSolutionStart(MultipleModuleCode titrationModuleCode, Long solutionId, double volume) {
//找到泵
Device deviceCode = getPumpCode(titrationModuleCode, solutionId);
DeviceCommand deviceCommand = switch (deviceCode) {
@ -64,7 +64,7 @@ public class TitrationModuleService {
/**
* 添加溶液结束
*/
public void addSolutionStop(MultipleModuleCode titrationModuleCode, Integer solutionId) {
public void addSolutionStop(MultipleModuleCode titrationModuleCode, Long solutionId) {
//找到泵
Device deviceCode = getPumpCode(titrationModuleCode, solutionId);
DeviceCommand deviceCommand = switch (deviceCode) {
@ -92,7 +92,7 @@ public class TitrationModuleService {
/**
* 预充开始
*/
public void preFillStart(MultipleModuleCode titrationModuleCode, Integer solutionId) {
public void preFillStart(MultipleModuleCode titrationModuleCode, Long solutionId) {
//找到泵
Device deviceCode = getPumpCode(titrationModuleCode, solutionId);
DeviceCommand deviceCommand = switch (deviceCode) {
@ -120,7 +120,7 @@ public class TitrationModuleService {
/**
* 预充结束
*/
public void preFillStop(MultipleModuleCode titrationModuleCode, Integer solutionId) {
public void preFillStop(MultipleModuleCode titrationModuleCode, Long solutionId) {
//找到泵
Device deviceCode = getPumpCode(titrationModuleCode, solutionId);
DeviceCommand deviceCommand = switch (deviceCode) {
@ -148,7 +148,7 @@ public class TitrationModuleService {
/**
* 清洗开始
*/
public void cleanStart(MultipleModuleCode titrationModuleCode, Integer solutionId) {
public void cleanStart(MultipleModuleCode titrationModuleCode, Long solutionId) {
//找到泵
Device deviceCode = getPumpCode(titrationModuleCode, solutionId);
DeviceCommand deviceCommand = switch (deviceCode) {
@ -176,7 +176,7 @@ public class TitrationModuleService {
/**
* 清洗结束
*/
public void cleanStop(MultipleModuleCode titrationModuleCode, Integer solutionId) {
public void cleanStop(MultipleModuleCode titrationModuleCode, Long solutionId) {
//找到泵
Device deviceCode = getPumpCode(titrationModuleCode, solutionId);
DeviceCommand deviceCommand = switch (deviceCode) {
@ -204,7 +204,7 @@ public class TitrationModuleService {
/**
* 排空溶液开始
*/
public void drainStart(MultipleModuleCode titrationModuleCode, Integer solutionId) {
public void drainStart(MultipleModuleCode titrationModuleCode, Long solutionId) {
Device deviceCode = getPumpCode(titrationModuleCode, solutionId);
DeviceCommand deviceCommand = switch (deviceCode) {
case Device.BRUSHLESS_PUMP_1 -> DeviceCommandGenerator.brushlessPump1BackwardRotate();
@ -231,7 +231,7 @@ public class TitrationModuleService {
/**
* 排空结束
*/
public void drainStop(MultipleModuleCode titrationModuleCode, Integer solutionId) {
public void drainStop(MultipleModuleCode titrationModuleCode, Long solutionId) {
//找到泵
Device deviceCode = getPumpCode(titrationModuleCode, solutionId);
DeviceCommand deviceCommand = switch (deviceCode) {
@ -259,7 +259,7 @@ public class TitrationModuleService {
/**
* 获取泵的code值
*/
public Device getPumpCode(MultipleModuleCode titrationModuleCode, Integer solutionId) {
public Device getPumpCode(MultipleModuleCode titrationModuleCode, Long solutionId) {
Container container = containerService.getOne(new LambdaQueryWrapper<>(Container.class).eq(Container::getSolutionId, solutionId));
if (container != null) {
Pump pump = pumpService.getOne(new LambdaQueryWrapper<>(Pump.class).eq(Pump::getContainerId, container.getId()).eq(Pump::getSolutionModule, titrationModuleCode.name()));

2
src/main/java/com/iflytop/colortitration/common/model/entity/Container.java

@ -16,7 +16,7 @@ public class Container extends BaseEntity {
private String name;
@Schema(description = "关联的溶液ID")
private Integer solutionId;
private Long solutionId;
@Schema(description = "总容量")
private Integer capacityTotal;

4
src/main/java/com/iflytop/colortitration/common/service/CraftsService.java

@ -3,8 +3,8 @@ package com.iflytop.colortitration.common.service;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.iflytop.colortitration.app.common.enums.TitrationStatus;
import com.iflytop.colortitration.app.core.crafts.CraftsContext;
import com.iflytop.colortitration.app.core.crafts.CraftsDispatcher;
import com.iflytop.colortitration.app.core.crafts.CraftsJob;
import com.iflytop.colortitration.app.core.state.DeviceState;
import com.iflytop.colortitration.app.core.state.TubeState;
import com.iflytop.colortitration.app.model.dto.SetCraftsDTO;
@ -40,7 +40,7 @@ public class CraftsService extends ServiceImpl<CraftsMapper, Crafts> {
tubeState.setCraftsName(crafts.getName());
tubeState.setTitrationModuleCodes(startCraftsDTO.getModuleCodes());
CraftsJob job = new CraftsJob();
CraftsContext job = new CraftsContext();
job.setTubeNum(tubeNum);
job.setCrafts(crafts);
job.setSelectedModules(startCraftsDTO.getModuleCodes());

Loading…
Cancel
Save