getStorage()->isInStorage) { return CanHandleResult::cannotHandle(VoiceMessage::PLEASE_SWIPE_STORAGE_OUT); } // 只有需要晨洗且未完成晨洗时才处理 if (!$context->getMorningWash()->needMorningWash || $context->getMorningWash()->morningWashed) { return CanHandleResult::cannotHandle(); } // 检查当前读卡器类型是否匹配 if (!$this->isRequiredNode($context->getReader()->type, ['漂洗', '机洗'])){ return CanHandleResult::cannotHandle(VoiceMessage::PLEASE_SWIPE_MORNING_WASH); } return CanHandleResult::canHandle(); } /** * 具体处理逻辑 */ protected function doHandle(ProcessContext $context): ProcessContext { Logger::debug("处理晨洗节点"); // 标记晨洗已开始 $morningWash = new MorningWashStatus( needMorningWash: $context->getMorningWash()->needMorningWash, morningWashed: true, startTime: $context->getMorningWash()->startTime, todayWashRecords: $context->getMorningWash()->todayWashRecords ); // 设置流程类型 $processType = $context->getReader()->type === '机洗' ? '机洗(晨洗)' : '手工洗(晨洗)'; return $context->createModifyBuilder() ->setMorningWash($morningWash) ->setProcessType($processType) ->setCurrentStep(self::getName()) ->setNeedDatabaseOperation() ->setDbOperation(DbOperationType::INSERT) ->setNeedWebSocketNotify() ->build(); } }