28 lines
873 B
Python
28 lines
873 B
Python
|
|
#!/usr/bin/env python
|
||
|
|
# -*- coding: utf-8 -*-
|
||
|
|
import asyncio
|
||
|
|
import sys
|
||
|
|
import traceback
|
||
|
|
sys.path.insert(0, 'ruoyi-fastapi-backend')
|
||
|
|
|
||
|
|
from sqlalchemy.ext.asyncio import create_async_engine, async_sessionmaker
|
||
|
|
from urllib.parse import quote_plus
|
||
|
|
|
||
|
|
DB_URL = f'mysql+asyncmy://cpy_admin:{quote_plus("Tgzz2025+")}@localhost:3307/ruoyi-fastapi'
|
||
|
|
|
||
|
|
async def test():
|
||
|
|
try:
|
||
|
|
from module_admin.service.warehouse_receipt_service import WarehouseReceiptService
|
||
|
|
|
||
|
|
engine = create_async_engine(DB_URL, echo=False)
|
||
|
|
AsyncSession = async_sessionmaker(engine, expire_on_commit=False)
|
||
|
|
|
||
|
|
async with AsyncSession() as db:
|
||
|
|
result = await WarehouseReceiptService.get_receipt_detail(db, 853)
|
||
|
|
print(f"Result: {result}")
|
||
|
|
except Exception as e:
|
||
|
|
print(f"Error: {e}")
|
||
|
|
traceback.print_exc()
|
||
|
|
|
||
|
|
asyncio.run(test())
|