Files
tcpserver-flow/app/flow/nodes/FinalRinseNode.php
T
2026-03-08 22:58:56 +08:00

67 lines
1.6 KiB
PHP

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