2023-05-27 15:47:41 +08:00
|
|
|
# coding=utf-8
|
|
|
|
import inspect
|
|
|
|
from imp import reload
|
2023-05-29 17:27:23 +08:00
|
|
|
|
2023-05-27 15:47:41 +08:00
|
|
|
from sde_sync import SdeSynchronous
|
|
|
|
from logger import Logger
|
|
|
|
from functions import *
|
|
|
|
from sys_config import SysConfig
|
|
|
|
|
|
|
|
reload(sys)
|
|
|
|
sys.setdefaultencoding('utf8')
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
"""程序入口"""
|
|
|
|
# 获取当前路径
|
|
|
|
caller_file = inspect.getfile(inspect.currentframe())
|
|
|
|
work_pathname = os.path.abspath(os.path.dirname(caller_file))
|
|
|
|
# 同步开始时间
|
|
|
|
curr_sync_date = time.strftime("%Y-%m-%d", time.localtime())
|
|
|
|
curr_sync_time = time.strftime("%H-%M-%S", time.localtime())
|
|
|
|
# 设置当前工作路径
|
|
|
|
config = SysConfig()
|
|
|
|
config.pathname = work_pathname
|
|
|
|
config.curr_sync_datetime = curr_sync_date + " " + curr_sync_time
|
|
|
|
# 日志记录
|
|
|
|
create_dir(work_pathname + "\\log")
|
|
|
|
config.logfile_name = work_pathname + "\\log\\" + config.curr_sync_datetime + "-SdeSynchronous.txt"
|
|
|
|
logger = Logger(config.logfile_name)
|
|
|
|
logger.log("==SdeSynchronous Started==")
|
|
|
|
logger.log("Process begin at " + str(curr_sync_date) + " " + str(curr_sync_time) + ".")
|
|
|
|
|
|
|
|
sde_db_sync = SdeSynchronous(config, logger)
|
|
|
|
sde_db_sync.run()
|
|
|
|
|
|
|
|
# 同步结束时间
|
|
|
|
end_date = time.strftime("%Y-%m-%d", time.localtime())
|
|
|
|
end_time = time.strftime("%H-%M-%S", time.localtime())
|
|
|
|
logger.log("Process completed at " + str(end_date) + " " + str(end_time) + ".")
|