73 lines
1.6 KiB
PHP
73 lines
1.6 KiB
PHP
<?php
|
|
|
|
namespace app\flow\nodes;
|
|
|
|
use app\flow\DbOperationType;
|
|
use app\flow\ProcessContext;
|
|
use app\flow\VoiceMessage;
|
|
|
|
/**
|
|
* 虚拟清洗机节点
|
|
* 用于解析虚拟清洗机的刷卡数据,处理虚拟机洗流程
|
|
*/
|
|
class VirtualWashMachineNode extends AbstractProcessNode
|
|
{
|
|
/**
|
|
* 获取节点名称
|
|
*/
|
|
public static function getName(): string
|
|
{
|
|
return '虚拟清洗机';
|
|
}
|
|
|
|
/**
|
|
* 获取节点编码
|
|
*/
|
|
public function getCode(): string
|
|
{
|
|
return '虚拟清洗机';
|
|
}
|
|
|
|
/**
|
|
* 判断当前节点是否能处理该步骤
|
|
*/
|
|
public function canHandle(ProcessContext $context): bool
|
|
{
|
|
// 如果内镜未取出
|
|
if ($context->isInStorage) {
|
|
$context->expectedNextStep = VoiceMessage::PLEASE_SWIPE_STORAGE_OUT;
|
|
return false;
|
|
}
|
|
|
|
// 如果不是机洗
|
|
if ($context->readerType !== MachineWashNode::getName()) {
|
|
return false;
|
|
}
|
|
|
|
// TODO
|
|
return false;
|
|
}
|
|
|
|
/**
|
|
* 具体处理逻辑
|
|
*/
|
|
protected function doHandle(ProcessContext $context): ProcessContext
|
|
{
|
|
// 设置流程类型为虚拟清洗机
|
|
$context->processType = '虚拟清洗机';
|
|
|
|
// 更新步骤
|
|
$context->currentStep = '虚拟清洗机';
|
|
|
|
// 标记需要数据库操作
|
|
$context->needDatabaseOperation = true;
|
|
$context->dbOperation = DbOperationType::INSERT;
|
|
$context->needWebSocketNotify = true;
|
|
|
|
// 更新批次
|
|
$context->dbOperation = DbOperationType::UPDATE;
|
|
|
|
return $context;
|
|
}
|
|
}
|