getStorage()->isInStorage) { return CanHandleResult::no(VoiceMessage::PLEASE_SWIPE_STORAGE_OUT); } if (!$this->isMatchReaderType($context)) { if ($context->getCurrentStep() === WashNode::getName()) { return CanHandleResult::no(VoiceMessage::PLEASE_SWIPE_MACHINE_WASH); } return CanHandleResult::no(); } // 需要晨洗但未完成:提示先进行晨洗 if ($context->getMorningWash()->needMorningWash && !$context->getMorningWash()->morningWashed) { return CanHandleResult::no(VoiceMessage::PLEASE_SWIPE_MORNING_WASH); } // 机洗可以在多个步骤后执行:空步骤(新流程)、结束、内镜取出、清洗,晨洗 if (!$this->isRequiredNode($context->getCurrentStep(), ['', '结束', '内镜取出', '清洗', MachineWashNode::getName()])) { if ($context->getCurrentStep() === EndNode::getName()) { return CanHandleResult::no(VoiceMessage::PLEASE_SWIPE_MACHINE_WASH); } return CanHandleResult::no(VoiceMessage::PLEASE_SWIPE_END); } return CanHandleResult::yes(); } /** * 具体处理逻辑 */ protected function doHandle(ProcessContext $context): ProcessContext { return $context->builder() ->withProcessType('机洗') ->withCurrentStep('机洗') ->needDatabaseOperation() ->dbOperation(DbOperationType::INSERT) ->dbOperation(DbOperationType::UPDATE) ->needWebSocketNotify() ->build(); } }