todo(flow): 新增虚拟清洗机节点支持
This commit is contained in:
@@ -63,6 +63,7 @@ class StepsConfig extends AbstractConfig
|
|||||||
new StepConfig('干燥', 'DryNode'),
|
new StepConfig('干燥', 'DryNode'),
|
||||||
new StepConfig('结束', 'EndNode'),
|
new StepConfig('结束', 'EndNode'),
|
||||||
new StepConfig('机洗', 'MachineWashNode'),
|
new StepConfig('机洗', 'MachineWashNode'),
|
||||||
|
new StepConfig('虚拟清洗机', 'VirtualWashMachineNode'),
|
||||||
new StepConfig('存储', 'StorageNode'),
|
new StepConfig('存储', 'StorageNode'),
|
||||||
new StepConfig('内镜放入', 'StorageInNode'),
|
new StepConfig('内镜放入', 'StorageInNode'),
|
||||||
new StepConfig('内镜取出', 'StorageOutNode'),
|
new StepConfig('内镜取出', 'StorageOutNode'),
|
||||||
|
|||||||
@@ -307,7 +307,7 @@ abstract class AbstractProcessNode implements ProcessNodeInterface
|
|||||||
abstract static public function getName(): string;
|
abstract static public function getName(): string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取节点编码
|
* 获取节点编码(节点编码要和 process 表中 process_name 字段的一致)
|
||||||
*/
|
*/
|
||||||
abstract public function getCode(): string;
|
abstract public function getCode(): string;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,72 @@
|
|||||||
|
<?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;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user