Files
zimoyin f2ff4ae123 ai-chore(config): 调整流程配置及改进测试代码
- 将 FLOW_USE_CUSTOM_PROCESS 从 true 改为 false,禁用自定义流程
- 在 BlockTest 测试用例中改用 setBlockMode 方法设置阻断模式
- 设置统一的错误处理,将错误转为异常抛出
- 重命名 BlockTest 测试文件路径,优化测试组织结构
- 更新 IDE php include paths,调整依赖包引用顺序
- 删除无用的 tests/flow/Test.php 测试文件
- 微调 start.php、webman、windows.php 配置或代码模块
2026-03-11 13:48:40 +08:00

80 lines
1.7 KiB
PHP

<?php
namespace app\flow\context\bean;
/**
* 存储状态值对象
* 封装内镜的存储柜状态信息,不可变对象
*/
readonly class StorageStatus
{
public function __construct(
/** 内镜是否在存储柜中 */
public bool $isInStorage = false,
/** 最后一次存储操作类型:内镜放入/内镜取出 */
public string $lastAction = '',
/** 存储入库时间 */
public ?string $inTime = null,
) {}
/**
* 创建默认的存储状态(不在库中)
*/
public static function notInStorage(): self
{
return new self(isInStorage: false);
}
/**
* 创建入库状态
*/
public static function inStorage(string $inTime): self
{
return new self(
isInStorage: true,
lastAction: '内镜放入',
inTime: $inTime
);
}
/**
* 创建出库状态
*/
public static function outOfStorage(): self
{
return new self(
isInStorage: false,
lastAction: '内镜取出',
inTime: null
);
}
/**
* 判断是否已入库
*/
public function isStored(): bool
{
return $this->isInStorage;
}
/**
* 判断是否已出库
*/
public function isTakenOut(): bool
{
return !$this->isInStorage && $this->lastAction === '内镜取出';
}
/**
* 转换为数组
*/
public function toArray(): array
{
return [
'isInStorage' => $this->isInStorage,
'lastAction' => $this->lastAction,
'inTime' => $this->inTime,
];
}
}