storageSingleReader; // 单读卡器模式不处理,由 StorageNode 统一处理 if ($singleReaderMode) { return CanHandleResult::cannotHandle(); } // 读卡器不是内镜取出类型,不处理 if (!$this->isMatchReaderType($context)) { return CanHandleResult::cannotHandle(); } // 获取内镜当前存储状态 $isInStorage = $context->getStorage()->isInStorage; // 如果内镜不在库中,则当前应该是入库操作,不处理 if (!$isInStorage) { Logger::debug('[StorageOutNode] 内镜不在库中,转由入库节点处理'); return CanHandleResult::cannotHandle(); } // 检查前置步骤要求:必须在库中才能出库 $validSteps = ['内镜放入', '结束']; if (!$this->isRequiredNode($context->getCurrentStep(), $validSteps)) { Logger::debug('[StorageOutNode] 当前步骤 {} 不符合出库条件', [$context->getCurrentStep()]); return CanHandleResult::cannotHandle(); } return CanHandleResult::canHandle(); } /** * 具体处理逻辑 */ protected function doHandle(ProcessContext $context): ProcessContext { Logger::debug('[StorageOutNode] 内镜出库成功 endoscope={}', [$context->getEndoscope()->name]); return $context->createModifyBuilder() ->setProcessType('存储') ->setCurrentStep(self::getName()) ->setStorage(StorageStatus::outOfStorage()) ->setNeedDatabaseOperation() ->setDbOperation(DbOperationType::INSERT) ->setNeedWebSocketNotify() ->build(); } }