Files
tcpserver-flow/app/flow/nodes/DryNode.php
T
zimoyin 966ee0185b fix(flow): 添加内镜未取出时的处理逻辑
- 在多个流程节点的 canHandle 方法中增加检测 isInStorage 状态的判断
- 当内镜未取出时设置预期下一步为提示刷出库卡语音信息
- 阻止流程节点处理,确保流程按正确顺序执行
- 统一改动覆盖消毒、干燥、终末、终末漂洗、机洗、晨洗、漂洗及清洗节点
2026-03-08 23:02:15 +08:00

78 lines
1.9 KiB
PHP

<?php
namespace app\flow\nodes;
use app\flow\DbOperationType;
use app\flow\ProcessContext;
use app\flow\VoiceMessage;
use app\utils\Logger;
/**
* 干燥节点
* 处理干燥步骤
*
*/
class DryNode extends AbstractProcessNode
{
/**
* 获取节点名称
*/
public static function getName(): string
{
return "干燥";
}
/**
* 获取节点编码
*/
public function getCode(): string
{
return self::getName();
}
/**
* 判断当前节点是否能处理该步骤
*/
public function canHandle(ProcessContext $context): bool
{
// 如果内镜未取出
if ($context->isInStorage) {
$context->expectedNextStep = VoiceMessage::PLEASE_SWIPE_STORAGE_OUT;
return false;
}
if (!$this->isMatchReaderType($context)) {
if ($context->currentStep === FinalRinseNode::getName()) {
if (!$context->success) Logger::debug("[DryNode] 刷卡错误,当前步骤是终末漂洗,但是刷的读卡器类型不是终末漂洗,对用户进行语音提示刷终末漂洗读卡器");
$context->expectedNextStep = VoiceMessage::PLEASE_SWIPE_DRY;
}
return false;
}
// 上一个步骤必须是终末漂洗
if (!$this->isRequiredNode($context->currentStep, [FinalRinseNode::getName()])) {
$context->expectedNextStep = VoiceMessage::PLEASE_SWIPE_DISINFECT;
return false;
}
return true;
}
/**
* 具体处理逻辑
*/
protected function doHandle(ProcessContext $context): ProcessContext
{
// 更新步骤
$context->currentStep = '干燥';
$context->needDatabaseOperation = true;
$context->dbOperation = DbOperationType::INSERT;
$context->needWebSocketNotify = true;
return $context;
}
}