refactor(context): 重命名上下文构建器及更新相关方法命名

- 将 ProcessContext 中的 builder() 重命名为 createModifyBuilder() 并添加调用栈日志
- ProcessContextBuilder 中所有 with* 方法统一改为 set* 命名风格
- Flow 各节点及流程处理器中调用 builder() 替换为 createModifyBuilder()
- 虚拟测试环境相关 ContextBuilder 中方法同步改名保持一致
- 优化流程节点中上下文修改代码调用,提升代码规范性
- 添加Config中加载自定义流程配置的占位注释及代码
- 无功能改动,纯代码风格及命名规范调整
This commit is contained in:
zimoyin
2026-03-13 18:51:02 +08:00
parent 8e617d06bc
commit 177c3ae9b2
27 changed files with 176 additions and 163 deletions
+8 -8
View File
@@ -82,25 +82,25 @@ class StorageNode extends AbstractProcessNode
*/
protected function doHandle(ProcessContext $context): ProcessContext
{
$builder = $context->builder()->withProcessType('存储');
$builder = $context->createModifyBuilder()->setProcessType('存储');
// 根据当前状态判断执行入库还是出库(canHandle 已经验证过状态)
if (!$context->getStorage()->isInStorage) {
// 入库操作
Logger::debug('[StorageNode] 内镜入库成功 endoscope={}', [$context->getEndoscope()->name]);
$builder->withCurrentStep('内镜放入')
->withStorage(StorageStatus::inStorage(date('Y-m-d H:i:s')));
$builder->setCurrentStep('内镜放入')
->setStorage(StorageStatus::inStorage(date('Y-m-d H:i:s')));
} else {
// 出库操作
Logger::debug('[StorageNode] 内镜出库成功 endoscope={}', [$context->getEndoscope()->name]);
$builder->withCurrentStep('内镜取出')
->withStorage(StorageStatus::outOfStorage());
$builder->setCurrentStep('内镜取出')
->setStorage(StorageStatus::outOfStorage());
}
return $builder
->needDatabaseOperation()
->dbOperation(DbOperationType::INSERT)
->needWebSocketNotify()
->setNeedDatabaseOperation()
->setDbOperation(DbOperationType::INSERT)
->setNeedWebSocketNotify()
->build();
}
}