getStorage()->isInStorage) { return CanHandleResult::cannotHandle(VoiceMessage::PLEASE_SWIPE_STORAGE_OUT); } // 期望当前读卡器为漂洗 if (!$this->isMatchReaderType($context)) { // 当前步骤是清洗且读卡器不符:说明清洗完了应该刷漂洗 if ($context->getCurrentStep() === WashNode::getName()) { return CanHandleResult::cannotHandle(VoiceMessage::PLEASE_SWIPE_RINSE); } return CanHandleResult::cannotHandle(); } // 上一个步骤必须是清洗 if (!$this->isRequiredNode($context->getCurrentStep(), [WashNode::getName()])) { return CanHandleResult::cannotHandle(VoiceMessage::PLEASE_SWIPE_WASH); } return CanHandleResult::canHandle(); } /** * 具体处理逻辑 */ protected function doHandle(ProcessContext $context): ProcessContext { return $context->createModifyBuilder() ->setCurrentStep('漂洗') ->setNeedDatabaseOperation() ->setDbOperation(DbOperationType::INSERT) ->setNeedWebSocketNotify() ->build(); } }