You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
iTi-Flask/iti/applications/service/erp/__init__.py

48 lines
1.2 KiB
Python

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

"""
ERP集成模块
提供ODBC和API两种方式访问ERP系统
"""
from .odbc_manager import erp_odbc, ERPODBCManager, PyODBCConnectionPool
from .api_manager import erp_api, ERPAPIManager
from .exceptions import (
ERPException,
ERPConnectionError,
ERPAuthenticationError,
ERPTimeoutError,
ERPDataError,
)
__all__ = [
'erp_odbc',
'erp_api',
'ERPODBCManager',
'ERPAPIManager',
'PyODBCConnectionPool',
'ERPException',
'ERPConnectionError',
'ERPAuthenticationError',
'ERPTimeoutError',
'ERPDataError',
]
def init_erp(app) -> None:
"""初始化ERP管理器ODBC和API"""
import logging
logger = logging.getLogger(__name__)
# 初始化ODBC管理器失败不中断启动
try:
erp_odbc.init_app(app)
except Exception as e:
logger.error(f"ERP ODBC管理器初始化失败: {e}", exc_info=True)
logger.warning("应用将继续启动但ODBC功能将不可用")
# 初始化API管理器失败不中断启动
try:
erp_api.init_app(app)
except Exception as e:
logger.error(f"ERP API管理器初始化失败: {e}", exc_info=True)
logger.warning("应用将继续启动但API功能将不可用")