logistics/utils/apply_active_config.py

43 lines
1.2 KiB
Python

from logisticsClass.logisticsBaseClass import HeadLogistics, PortType, TailLogistics,BaseLogistics
# logistics_config.py
ACTIVE_LOGISTICS = {
# US
"FedexPPLogistics_US": False,# 需关闭
"FedexKHLogistics_US": False,# 需关闭
"FedexHOMELogistics_US": True,
"FedexGROUDLogistics_US": True,
"FedexTESTLogistics_US":False, # 测试用,用完关闭
"MetroLogistics_US": True,
"GIGALogistics_US": False,# 需关闭
"CEVALogistics_US": False,# 需关闭
"XmilesLogistics_US":True,
"AMTWestLogistics_US":True,
"AMTEastLogistics_US":True,
# UK
"ZGDPDLogistics_UK": True,
"SAIRDPDLogistics_UK":True,
"bigLogistics_UK": False,
"KPZGLogistics_UK": True,
"KPNVlogistics_UK": False,# 需关闭
"ZGbigLogistics_UK":True,
# EUR
"DPDASLLogistics":False, # 需关闭
"DPDNVLogistics":True,
# AUD
"TMSLogistics_AU":True,
}
def apply_active_config():
stack = list(BaseLogistics.__subclasses__())
while stack:
subclass = stack.pop()
name = subclass.__name__
if name in ACTIVE_LOGISTICS:
subclass.active = ACTIVE_LOGISTICS[name]
# 否则保持默认的 active
stack.extend(subclass.__subclasses__())