|
|
@ -2,7 +2,6 @@ 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.state.DeviceState; |
|
|
@ -14,6 +13,8 @@ import lombok.RequiredArgsConstructor; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
/** |
|
|
|
* 工艺接口服务 |
|
|
|
*/ |
|
|
@ -31,21 +32,18 @@ public class CraftsService extends ServiceImpl<CraftsMapper, Crafts> { |
|
|
|
/** |
|
|
|
* 设置试管的工艺 |
|
|
|
*/ |
|
|
|
public void setCrafts(SetCraftsDTO startCraftsDTO) { |
|
|
|
Crafts crafts = this.getById(startCraftsDTO.getCraftId()); |
|
|
|
for (Integer tubeNum : startCraftsDTO.getTubeNums()) { |
|
|
|
TubeState tubeState = deviceState.getTrayTubeStateMap().get(tubeNum); |
|
|
|
if (tubeState != null && tubeState.getTitrationStatus() == TitrationStatus.NOT_STARTED) { |
|
|
|
tubeState.setCraftsId(crafts.getId()); |
|
|
|
tubeState.setCraftsName(crafts.getName()); |
|
|
|
tubeState.setTitrationModuleCodes(startCraftsDTO.getModuleCodes()); |
|
|
|
|
|
|
|
CraftsContext job = new CraftsContext(); |
|
|
|
job.setTubeNum(tubeNum); |
|
|
|
job.setCrafts(crafts); |
|
|
|
job.setSelectedModules(startCraftsDTO.getModuleCodes()); |
|
|
|
craftsDispatcher.addCraftsJob(job); |
|
|
|
} |
|
|
|
public void setCrafts(List<SetCraftsDTO> startCraftsDTOList) { |
|
|
|
for (SetCraftsDTO startCraftsDTO : startCraftsDTOList) { |
|
|
|
TubeState tubeState = deviceState.getTrayTubeStateMap().get(startCraftsDTO.getTubeNum()); |
|
|
|
Crafts crafts = this.getById(startCraftsDTO.getCraftsId()); |
|
|
|
tubeState.setCraftsId(crafts.getId()); |
|
|
|
tubeState.setCraftsName(crafts.getName()); |
|
|
|
tubeState.setTitrationModuleCodes(startCraftsDTO.getTitrationModuleCodes()); |
|
|
|
CraftsContext job = new CraftsContext(); |
|
|
|
job.setTubeNum(startCraftsDTO.getTubeNum()); |
|
|
|
job.setCrafts(crafts); |
|
|
|
job.setSelectedModules(startCraftsDTO.getTitrationModuleCodes()); |
|
|
|
craftsDispatcher.addCraftsJob(job); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|