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