getStorage()->isInStorage) { return CanHandleResult::cannotHandle(VoiceMessage::PLEASE_SWIPE_STORAGE_OUT); } if (!$this->isMatchReaderType($context)) { if ($context->getCurrentStep() === DryNode::getName() || $context->getCurrentStep() === FinalRinseNode::getName()) { return CanHandleResult::cannotHandle(VoiceMessage::PLEASE_SWIPE_END); } return CanHandleResult::cannotHandle(); } // 上一个步骤必须是干燥、终末漂洗或机洗 if (!$this->isRequiredNode($context->getCurrentStep(), ['干燥', '终末漂洗', '机洗'])) { if ($context->getCurrentStep() === FinalRinseNode::getName()) { return CanHandleResult::cannotHandle(VoiceMessage::PLEASE_SWIPE_WASH); } return CanHandleResult::cannotHandle(); } return CanHandleResult::canHandle(); } /** * 具体处理逻辑 */ protected function doHandle(ProcessContext $context): ProcessContext { return $context->builder() ->withCurrentStep('结束') ->needDatabaseOperation() ->dbOperation(DbOperationType::INSERT) ->needWebSocketNotify() ->build(); } }