27 lines
919 B
Python
27 lines
919 B
Python
#!/usr/bin/env python
|
|
# -*- coding: utf-8 -*-
|
|
import asyncio
|
|
import sys
|
|
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():
|
|
from module_admin.dao.warehouse_receipt_dao import WarehouseReceiptDao
|
|
|
|
engine = create_async_engine(DB_URL, echo=False)
|
|
AsyncSession = async_sessionmaker(engine, expire_on_commit=False)
|
|
|
|
async with AsyncSession() as db:
|
|
# 测试生成单号
|
|
receipt_no = await WarehouseReceiptDao.generate_receipt_no(db, 2026, 0)
|
|
print(f"Generated receipt_no: {receipt_no}")
|
|
|
|
receipt_no2 = await WarehouseReceiptDao.generate_receipt_no(db, 2026, 0)
|
|
print(f"Generated receipt_no (2nd): {receipt_no2}")
|
|
|
|
asyncio.run(test())
|