f2ff4ae123
- 将 FLOW_USE_CUSTOM_PROCESS 从 true 改为 false,禁用自定义流程 - 在 BlockTest 测试用例中改用 setBlockMode 方法设置阻断模式 - 设置统一的错误处理,将错误转为异常抛出 - 重命名 BlockTest 测试文件路径,优化测试组织结构 - 更新 IDE php include paths,调整依赖包引用顺序 - 删除无用的 tests/flow/Test.php 测试文件 - 微调 start.php、webman、windows.php 配置或代码模块
76 lines
1.9 KiB
PHP
76 lines
1.9 KiB
PHP
<?php
|
|
|
|
namespace app\flow\context\bean;
|
|
|
|
use app\model\EctActions;
|
|
|
|
/**
|
|
* 流程状态值对象
|
|
* 封装流程执行过程中的状态信息(不可变)
|
|
*/
|
|
readonly class ProcessStatus
|
|
{
|
|
public function __construct(
|
|
/** 当前操作步骤 */
|
|
public string $currentStep = '',
|
|
/** 流程类型 */
|
|
public string $processType = '',
|
|
/** 批次号 */
|
|
public string $batchNo = '',
|
|
/** 操作开始时间 */
|
|
public string $actionStartTime = '',
|
|
/** 操作时长(秒) 计算方式为上下文创建的时间减去上个操作的开始时间(此时上个操作的结束时间不存在,需要等待此次刷卡流程结束) */
|
|
public ?int $duration = null,
|
|
/** 上一个操作记录 */
|
|
public ?EctActions $previousAction = null,
|
|
) {}
|
|
|
|
/**
|
|
* 创建空状态
|
|
*/
|
|
public static function empty(): self
|
|
{
|
|
return new self();
|
|
}
|
|
|
|
/**
|
|
* 检查是否可以开始新流程
|
|
*/
|
|
public function canStartNewProcess(): bool
|
|
{
|
|
$validSteps = ['', '结束', '内镜取出', '测漏正常', '测漏异常'];
|
|
return in_array($this->currentStep, $validSteps);
|
|
}
|
|
|
|
/**
|
|
* 检查是否已完成清洗流程
|
|
*/
|
|
public function isWashProcessCompleted(): bool
|
|
{
|
|
return $this->currentStep === '结束';
|
|
}
|
|
|
|
/**
|
|
* 是否有上一个操作
|
|
*/
|
|
public function hasPreviousAction(): bool
|
|
{
|
|
return $this->previousAction !== null;
|
|
}
|
|
|
|
/**
|
|
* 转换为数组
|
|
*/
|
|
public function toArray(): array
|
|
{
|
|
return [
|
|
'currentStep' => $this->currentStep,
|
|
'processType' => $this->processType,
|
|
'batchNo' => $this->batchNo,
|
|
'actionStartTime' => $this->actionStartTime,
|
|
'duration' => $this->duration,
|
|
'previousActionId' => $this->previousAction?->action_id,
|
|
];
|
|
}
|
|
}
|