This commit is contained in:
parent
38cc3c8b51
commit
71cbd4b04d
|
|
@ -362,80 +362,83 @@ class AllLogistics_AU(TailLogistics):
|
|||
return detail_amount
|
||||
|
||||
# TMS
|
||||
# class TMSLogistics_AU(TailLogistics):
|
||||
# country_code = 'AU'
|
||||
# country = 'Australia'
|
||||
# company = 'TMS'
|
||||
# currency = 'AUD'
|
||||
class TMSLogistics_AU(TailLogistics):
|
||||
country_code = 'AU'
|
||||
country = 'Australia'
|
||||
company = 'TMS'
|
||||
currency = 'AUD'
|
||||
|
||||
# _is_loaded = False
|
||||
# parent_current_directory = Path(__file__).parent.parent
|
||||
# remote_path = parent_current_directory.joinpath("data")
|
||||
# _postcode_files = remote_path.joinpath("澳洲三大渠道.xlsx")
|
||||
_is_loaded = False
|
||||
parent_current_directory = Path(__file__).parent.parent
|
||||
remote_path = parent_current_directory.joinpath("data")
|
||||
_postcode_files = remote_path.joinpath("澳洲三大渠道.xlsx")
|
||||
|
||||
# def __new__(cls):
|
||||
# """实现单例模式,只加载一次文件"""
|
||||
# if not cls._is_loaded:
|
||||
# cls._load_postcodes() # 第一次实例化时加载文件
|
||||
# cls._is_loaded = True # 标记文件已加载
|
||||
# return super().__new__(cls)
|
||||
# @classmethod
|
||||
# def _load_postcodes(cls):
|
||||
# """加载文件"""
|
||||
# cls.toll_zone = pd.read_excel(str(cls._postcode_files),sheet_name="toll_postcode",usecols="A:B")
|
||||
# cls.toll_price = pd.read_excel(str(cls._postcode_files),sheet_name="toll",usecols="A:D")
|
||||
# cls.toll_remote = pd.read_excel(str(cls._postcode_files),sheet_name="toll_remote",usecols="A:D")
|
||||
def __new__(cls):
|
||||
"""实现单例模式,只加载一次文件"""
|
||||
if not cls._is_loaded:
|
||||
cls._load_postcodes() # 第一次实例化时加载文件
|
||||
cls._is_loaded = True # 标记文件已加载
|
||||
return super().__new__(cls)
|
||||
@classmethod
|
||||
def _load_postcodes(cls):
|
||||
"""加载文件"""
|
||||
cls.tms_zone = pd.read_excel(str(cls._postcode_files),sheet_name="TMS_postcode",usecols="A:B")
|
||||
cls.tms_price = pd.read_excel(str(cls._postcode_files),sheet_name="TMS价格",usecols="A:D")
|
||||
|
||||
# def __init__(self):
|
||||
# super().__init__()
|
||||
# self.toll_zone = self.__class__.toll_zone
|
||||
# self.toll_price = self.__class__.toll_price
|
||||
# self.toll_remote = self.__class__.toll_remote
|
||||
# self.fuel_rate = 0.0725
|
||||
# self.oversize_fee = [15.5,62]
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
self.tms_zone = self.__class__.tms_zone
|
||||
self.tms_price = self.__class__.tms_price
|
||||
self.residential = 28.5
|
||||
self.fuel_rate = 0.17
|
||||
|
||||
# def is_remote(self, postcode):
|
||||
# """判断分区"""
|
||||
# # 先看邮编呐
|
||||
# self.toll_zone['postcode'] = self.toll_zone['postcode'].astype(str).str.zfill(4)
|
||||
# filtered_df = self.toll_zone[self.toll_zone['postcode'] == postcode]
|
||||
# if filtered_df.empty:
|
||||
# return "不支持配送"
|
||||
# post = filtered_df['post'].iloc[0] # 获取第一行的 '地区代码'
|
||||
# return post
|
||||
# def calculate_fee(self, packages, postcode):
|
||||
# # 抛重4000
|
||||
# detail_amount = {
|
||||
# "base":0.00,
|
||||
# "oversize":0.00,
|
||||
# "remote":0.00,
|
||||
# "fuel":0.00,
|
||||
# "tail_amount":0.00
|
||||
# }
|
||||
# if isinstance(postcode, str):
|
||||
# postcode = ''.join(filter(str.isdigit, postcode)) # 只保留数字部分
|
||||
# if postcode: # 确保postcode不是空字符串
|
||||
# postcode = str(int(postcode)).zfill(4) # 转换为整数再补齐4位
|
||||
# else:
|
||||
# detail_amount['tail_amount'] = 88888
|
||||
# return detail_amount
|
||||
# post = self.is_remote(postcode)
|
||||
# if post == "不支持配送":
|
||||
# detail_amount['tail_amount'] = 99999
|
||||
# return detail_amount
|
||||
# # 根据post筛选出对应行
|
||||
# row = self.toll_price[self.toll_price['post'] == post]
|
||||
# # 检查 row 是否为空
|
||||
# if row.empty:
|
||||
# detail_amount['tail_amount'] = 99999
|
||||
# return detail_amount
|
||||
def is_remote(self, postcode):
|
||||
"""判断分区"""
|
||||
# 先看邮编呐
|
||||
self.tms_zone['postcode'] = self.tms_zone['postcode'].astype(str).str.zfill(4)
|
||||
filtered_df = self.tms_zone[self.tms_zone['postcode'] == postcode]
|
||||
if filtered_df.empty:
|
||||
return "不支持配送"
|
||||
post = filtered_df['post'].iloc[0] # 获取第一行的 '地区代码'
|
||||
return post
|
||||
def calculate_fee(self, packages, postcode):
|
||||
# 抛重4000
|
||||
detail_amount = {
|
||||
"base":0.00,
|
||||
"fuel":0.00,
|
||||
"tail_amount":0.00
|
||||
}
|
||||
if isinstance(postcode, str):
|
||||
postcode = ''.join(filter(str.isdigit, postcode)) # 只保留数字部分
|
||||
if postcode: # 确保postcode不是空字符串
|
||||
postcode = str(int(postcode)).zfill(4) # 转换为整数再补齐4位
|
||||
else:
|
||||
detail_amount['tail_amount'] = 88888
|
||||
return detail_amount
|
||||
post = self.is_remote(postcode)
|
||||
if post == "不支持配送":
|
||||
detail_amount['tail_amount'] = 99999
|
||||
return detail_amount
|
||||
# 根据post筛选出对应行
|
||||
row = self.tms_price[self.tms_price['post'] == post]
|
||||
# 检查 row 是否为空
|
||||
if row.empty:
|
||||
detail_amount['tail_amount'] = 99999
|
||||
return detail_amount
|
||||
|
||||
# base = row['Base'].iloc[0]
|
||||
# per = self.toll_price[self.toll_price['post']==post]['Per'].iloc[0]
|
||||
# minimun = self.toll_price[self.toll_price['post']==post]['Minimun'].iloc[0]
|
||||
# for package in packages:
|
||||
|
||||
# return detail_amount
|
||||
base = row['Base'].iloc[0]
|
||||
per = self.tms_price[self.tms_price['post']==post]['Per'].iloc[0]
|
||||
minimun = self.tms_price[self.tms_price['post']==post]['Minimun'].iloc[0]
|
||||
for package in packages:
|
||||
volume_weight = package.get_volume_weight(4)
|
||||
billing_weight = max(package.weight,volume_weight)
|
||||
detail_amount['base'] += max(base + per * math.ceil(billing_weight/1000), minimun)
|
||||
if package.weight >= 100000 or package.fst_size >= 200:
|
||||
detail_amount['tail_amount'] = 99999 # ERP配置的超过这个尺寸就不派送这个了
|
||||
detail_amount['fuel'] = detail_amount['base'] * self.fuel_rate
|
||||
detail_amount['tail_amount'] = detail_amount['base'] + detail_amount['fuel']
|
||||
return detail_amount
|
||||
|
||||
if __name__ == '__main__':
|
||||
# 测试
|
||||
aau = PostLogistics_AU()
|
||||
|
|
|
|||
|
|
@ -209,7 +209,7 @@ class DPDZGLogistics(TailLogistics):
|
|||
super().__init__()
|
||||
self.base_fee:list #[5,10,30]
|
||||
self.operate_rate = 0.18
|
||||
self.fuel_rate = 0.125
|
||||
self.fuel_rate = 0.09
|
||||
self.remote_fee:float
|
||||
def is_remote(self,postcode):
|
||||
"""判断是否偏远,1偏远0非偏远"""
|
||||
|
|
@ -493,6 +493,7 @@ class KPGELLogistics(TailLogistics):
|
|||
self.responsibility = 1.85 # 责任保险,必收
|
||||
self.management = 2 # 订单管理费,必收
|
||||
self.toll = 0.024 # 过路过桥费,0.024*分段最大kg
|
||||
self.over_weight = 2 # 超重费,超过60KG的,收取2EUR
|
||||
|
||||
def is_remote(self,postcode):
|
||||
"""判断分区,德国只有1,法国有123,"""
|
||||
|
|
@ -502,6 +503,7 @@ class KPGELLogistics(TailLogistics):
|
|||
# 6000计费重
|
||||
detail_amount = {
|
||||
"base":0.00,
|
||||
"over_weight":0.00,
|
||||
"notify":0.00,
|
||||
"multiple_package":0.00,
|
||||
"responsibility":0.00,
|
||||
|
|
@ -522,6 +524,7 @@ class KPGELLogistics(TailLogistics):
|
|||
return detail_amount
|
||||
|
||||
total_weight = 0
|
||||
|
||||
for package in packages:
|
||||
if (package.fst_size > 320 or package.sed_size>170 or package.trd_size>120) and (self.country_code != "DE"):
|
||||
detail_amount['tail_amount'] = 99999
|
||||
|
|
@ -529,6 +532,9 @@ class KPGELLogistics(TailLogistics):
|
|||
if package.fst_size > 320 or package.sed_size>200 or package.trd_size>120:
|
||||
detail_amount['tail_amount'] = 99999
|
||||
return detail_amount
|
||||
# 实重>60KG,超重费
|
||||
if package.weight/1000 > 60:
|
||||
detail_amount['over_weight'] += 2
|
||||
billing_weight = max(package.weight/1000,package.get_volume_weight(6000))
|
||||
total_weight += billing_weight
|
||||
# 基础费用
|
||||
|
|
@ -539,7 +545,9 @@ class KPGELLogistics(TailLogistics):
|
|||
detail_amount['toll'] = self.toll * int(weight)
|
||||
break
|
||||
if total_weight > 300:
|
||||
detail_amount['base'] = detail_amount['base'] * total_weight
|
||||
detail_amount['base']=base_df[300].iloc[0]+base_df['300+'].iloc[0]* total_weight
|
||||
# detail_amount['base'] = detail_amount['base'] * total_weight
|
||||
detail_amount['toll'] = self.toll * 300
|
||||
|
||||
detail_amount['notify'] = self.notify
|
||||
detail_amount['multiple_package'] = self.multiple_package * len(packages) if len(packages) > 3 else 0
|
||||
|
|
@ -864,6 +872,7 @@ class EURZGLogistics_IR(EURZGLogistics):
|
|||
return 0
|
||||
|
||||
# DPD-NV,德国始发
|
||||
|
||||
class DPDNVLogistics(TailLogistics):
|
||||
"""DPD-NV"""
|
||||
currency = "EUR"
|
||||
|
|
@ -874,6 +883,7 @@ class DPDNVLogistics(TailLogistics):
|
|||
self.base_31= None
|
||||
self.oversize = 4.62
|
||||
self.big_package = 40.15
|
||||
self.fuel_rate = 0.125
|
||||
self.remote = 0
|
||||
def is_remote(self,postcode):
|
||||
"""判断是否偏远,1偏远0非偏远"""
|
||||
|
|
@ -885,6 +895,7 @@ class DPDNVLogistics(TailLogistics):
|
|||
"oversize":0.00,
|
||||
"big_package":0.00,
|
||||
"remote":0.00,
|
||||
"fuel":0.00,
|
||||
"tail_amount":0.00
|
||||
}
|
||||
isremote = self.is_remote(postcode)
|
||||
|
|
@ -903,11 +914,12 @@ class DPDNVLogistics(TailLogistics):
|
|||
detail_amount['big_package'] = self.big_package
|
||||
elif package.fst_size >= 120 or package.sed_size>=60 or package.volume>=150000:
|
||||
detail_amount['oversize'] = self.oversize
|
||||
|
||||
|
||||
|
||||
for key in detail_amount:
|
||||
if key != 'tail_amount':
|
||||
detail_amount['tail_amount'] += detail_amount[key]
|
||||
detail_amount["tail_amount"] += detail_amount[key]
|
||||
# detail_amount["fuel"] = total_fee * self.fuel_rate
|
||||
# detail_amount["tail_amount"] = total_fee + detail_amount["fuel"]
|
||||
return detail_amount
|
||||
class DPDNVLogistics_DE(DPDNVLogistics):
|
||||
country_code = 'DE'
|
||||
|
|
@ -967,4 +979,7 @@ class DPDNVLogistics_IR(DPDNVLogistics):
|
|||
self.base_20 = 18.45
|
||||
self.base_31= 22.375
|
||||
def is_remote(self,postcode):
|
||||
return 0
|
||||
return 0
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import pandas
|
|||
from logisticsClass.logisticsBaseClass import LogisticsType, TailLogistics
|
||||
|
||||
|
||||
class DPDLogistics_UK(TailLogistics):
|
||||
class ZGDPDLogistics_UK(TailLogistics):
|
||||
# 实重计费
|
||||
country_code = 'UK'
|
||||
country = 'United Kingdom'
|
||||
|
|
@ -37,7 +37,7 @@ class DPDLogistics_UK(TailLogistics):
|
|||
if package.weight >= 40000 or package.fst_size >= 175 or package.girth>=339:
|
||||
detail_amount['tail_amount'] =99999
|
||||
return detail_amount
|
||||
if package.weight >= 30000 or package.fst_size >= 100 or package.sed_size >=60:
|
||||
if package.weight > 30000 or package.fst_size >= 100 or package.sed_size >=60:
|
||||
detail_amount['oversize'] += self.oversize
|
||||
detail_amount['base'] += self.base_fee
|
||||
|
||||
|
|
@ -70,6 +70,77 @@ class DPDLogistics_UK(TailLogistics):
|
|||
postcodelist.append(postcodes) # 没有范围,直接添加
|
||||
return 1 if postcode in postcodelist else 0
|
||||
|
||||
class SAIRDPDLogistics_UK(TailLogistics):
|
||||
# 实重计费
|
||||
country_code = 'UK'
|
||||
country = 'United Kingdom'
|
||||
company = 'SAIR-DPD'
|
||||
currency = 'GBP'
|
||||
|
||||
parent_current_directory = Path(__file__).parent.parent
|
||||
price_path = parent_current_directory.joinpath("data")
|
||||
_price_files = price_path.joinpath("智谷物流费.xlsx")
|
||||
dpd_zone = None
|
||||
def __new__(cls):
|
||||
"""实现单例模式,只加载一次文件"""
|
||||
if cls.dpd_zone is None:
|
||||
# 取AB两列即可
|
||||
cls.dpd_zone = pandas.read_excel(cls._price_files,sheet_name="DPD-SAIR分区",usecols='A:B')
|
||||
return super().__new__(cls)
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
self.base = {
|
||||
'A': 3.5,
|
||||
'B': 10,
|
||||
'C': 12,
|
||||
'D': 16
|
||||
}
|
||||
self.transportation = 0.11 # 交通费,每单0.11
|
||||
self.remote_fee = 0.95 # 偏远费
|
||||
self.fuel_rate = 0.05 # 燃油费率
|
||||
def is_remote(self,postcode):
|
||||
"""根据邮编分区,返回分区"""
|
||||
postcode_prefix = postcode.split()[0].upper()
|
||||
postcode_prefix = str(postcode_prefix)
|
||||
# 取前缀的字母
|
||||
letters = ''.join(re.findall(r'[A-Za-z]', postcode.split()[0])).upper()
|
||||
letters=str(letters)
|
||||
# 先匹配字母,字母能找到就直接用,字母对应的找不到,再匹配带上数字的
|
||||
zone_df = self.dpd_zone[self.dpd_zone['邮编']== letters]
|
||||
if zone_df.empty:
|
||||
zone_df = self.dpd_zone[self.dpd_zone['邮编']== postcode_prefix]
|
||||
if not zone_df.empty:
|
||||
return zone_df['分区'].values[0]
|
||||
return "A"
|
||||
|
||||
def calculate_fee(self, packages, postcode):
|
||||
detail_amount = {
|
||||
"base":0.00,
|
||||
"transportation":0.00,
|
||||
"remote":0.00,
|
||||
"fuel":0.00,
|
||||
"tail_amount":0.00
|
||||
}
|
||||
zone = self.is_remote(postcode)
|
||||
if zone == "不在配送范围内":
|
||||
detail_amount['tail_amount'] = 99999
|
||||
return detail_amount
|
||||
base_fee = self.base[zone]
|
||||
postcode_prefix = postcode.split()[0].upper()
|
||||
postcode_prefix = str(postcode_prefix)
|
||||
if postcode_prefix in ['E1','EC1','EC2','EC3','EC4','NW1','SE1','SE11','SW1','SW3','SW7','W1','W10','W11','W2','W8','WC1','WC2']:
|
||||
detail_amount['remote'] = self.remote_fee
|
||||
for package in packages:
|
||||
if package.weight > 32000 or package.fst_size > 230:
|
||||
detail_amount['tail_amount'] =99999
|
||||
return detail_amount
|
||||
detail_amount["base"] += base_fee
|
||||
detail_amount['transportation']=self.transportation
|
||||
detail_amount['tail_amount'] = (detail_amount['base'] + detail_amount['transportation'] + detail_amount['remote'])*(1+self.fuel_rate)
|
||||
detail_amount['fuel']=self.fuel_rate*(detail_amount['base'] + detail_amount['transportation'] + detail_amount['remote'])
|
||||
return detail_amount
|
||||
|
||||
|
||||
class bigLogistics_UK(TailLogistics):
|
||||
# 计费重5000取大
|
||||
country_code = 'UK'
|
||||
|
|
@ -207,9 +278,11 @@ class KPZGLogistics_UK(TailLogistics):
|
|||
if detail_amount['base']==0:
|
||||
detail_amount['tail_amount'] = 99999
|
||||
return detail_amount
|
||||
# 计算托盘数 初始为1个
|
||||
nember = 0
|
||||
for package in packages:
|
||||
if package.fst_size > 180 or package.sed_size >120 or package.trd_size > 100:
|
||||
detail_amount['oversize'] = detail_amount['base']
|
||||
nember =nember + (int(package.fst_size/180)+int(package.sed_size/120)+int(package.weight/800000))
|
||||
detail_amount['oversize'] = detail_amount['base'] * nember
|
||||
detail_amount['tail_amount'] = detail_amount['base'] + detail_amount['oversize']
|
||||
return detail_amount
|
||||
|
||||
|
|
@ -228,8 +301,8 @@ class KPNVlogistics_UK(TailLogistics):
|
|||
def __new__(cls):
|
||||
"""实现单例模式,只加载一次文件"""
|
||||
if cls.ltl_cost is None or cls.ltl_zone is None:
|
||||
cls.ltl_cost = pandas.read_excel(cls._price_files,sheet_name="运费")
|
||||
cls.ltl_zone = pandas.read_excel(cls._price_files,sheet_name="分区")
|
||||
cls.ltl_cost = pandas.read_excel(cls._price_files,sheet_name="NV运费")
|
||||
cls.ltl_zone = pandas.read_excel(cls._price_files,sheet_name="NV分区")
|
||||
return super().__new__(cls)
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
|
|
@ -267,27 +340,147 @@ class KPNVlogistics_UK(TailLogistics):
|
|||
detail_amount['tail_amount'] = detail_amount['base']+detail_amount['fuel']
|
||||
return detail_amount
|
||||
|
||||
class ZGbigLogistics_UK(TailLogistics):
|
||||
country_code = 'UK'
|
||||
country = 'United Kingdom'
|
||||
company = '海GB-大件' # 分区的智谷大件
|
||||
currency = 'GBP'
|
||||
# logistics_type = LogisticsType.LTL
|
||||
parent_current_directory = Path(__file__).parent.parent
|
||||
price_path = parent_current_directory.joinpath("data")
|
||||
_price_files = price_path.joinpath("智谷物流费.xlsx")
|
||||
xl_zone = None
|
||||
def __new__(cls):
|
||||
"""实现单例模式,只加载一次文件"""
|
||||
if cls.xl_zone is None:
|
||||
# 取AB两列即可
|
||||
cls.xl_zone = pandas.read_excel(cls._price_files,sheet_name="大件分区",usecols='A:B')
|
||||
return super().__new__(cls)
|
||||
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
def is_remote(self,postcode):
|
||||
"""根据邮编分区,返回分区"""
|
||||
postcode_prefix = postcode.split()[0].upper()
|
||||
postcode_prefix = str(postcode_prefix)
|
||||
# 取前缀的字母
|
||||
letters = ''.join(re.findall(r'[A-Za-z]', postcode.split()[0])).upper()
|
||||
letters=str(letters)
|
||||
# 先匹配字母,字母能找到就直接用,字母对应的找不到,再匹配带上数字的
|
||||
zone_df = self.xl_zone[self.xl_zone['邮编']== letters]
|
||||
if zone_df.empty:
|
||||
zone_df = self.xl_zone[self.xl_zone['邮编']== postcode_prefix]
|
||||
if not zone_df.empty:
|
||||
return zone_df['分区'].values[0]
|
||||
return "不在配送范围内"
|
||||
def calculate_fee(self, packages, postcode):
|
||||
"""5000计费重 一票一件
|
||||
单个包裹实重上限150kg
|
||||
体积重上限600Kg
|
||||
尺寸上限: 300*180*180cm
|
||||
"""
|
||||
detail_amount = {
|
||||
"base":0.00,
|
||||
"fuel":0.00,
|
||||
"tail_amount":0.00
|
||||
}
|
||||
zone = self.is_remote(postcode)
|
||||
if zone == "不在配送范围内":
|
||||
detail_amount['tail_amount'] = 99999
|
||||
return detail_amount
|
||||
for package in packages:
|
||||
volume_weight = package.get_volume_weight(5000)
|
||||
if package.weight>=150000 or volume_weight>=600 or package.fst_size>300 or package.sed_size>180:
|
||||
detail_amount['tail_amount'] = 99999
|
||||
return detail_amount
|
||||
bill_weight = max(package.weight/1000, volume_weight)
|
||||
detail_amount['base'] += self.get_shipping_cost(zone, bill_weight)
|
||||
detail_amount['tail_amount'] = detail_amount['base']
|
||||
return detail_amount
|
||||
|
||||
def get_shipping_cost(self, zone, weight):
|
||||
"""获取运费"""
|
||||
price_table = {
|
||||
'A': [14, 19, 25, 50, 65, 85, 100, 120],
|
||||
'B': [19, 24, 30, 55, 70, 90, 105, 125],
|
||||
'C': [27, 30, 35, 60, 80, 95, 115, 135],
|
||||
'D': [36, 40, 45, 70, 90, 105, 125, 145]
|
||||
}
|
||||
weight_breaks = [30, 40, 50, 70, 90, 110, 130, 150]
|
||||
overweight_rate = 0.5 # 续重费率 GBP/KG
|
||||
|
||||
prices = price_table[zone]
|
||||
|
||||
# 150KG以内的标准费用
|
||||
for i, break_point in enumerate(weight_breaks):
|
||||
if weight < break_point:
|
||||
return prices[i]
|
||||
|
||||
# 超过150KG的部分:基础费用 + 续重费用
|
||||
if weight >= 150:
|
||||
base_cost = prices[-1] # 150KG对应的基础费用(120, 125, 135, 145)
|
||||
overweight = weight - 150
|
||||
return base_cost + overweight * overweight_rate
|
||||
return prices[-1] # 默认返回最后一个价格
|
||||
|
||||
# class KPDXLogistics_UK(TailLogistics):
|
||||
# BJS-SAIR
|
||||
# class BJSbigLogistics_UK(TailLogistics):
|
||||
# country_code = 'UK'
|
||||
# country = 'United Kingdom'
|
||||
# company = 'AIT-FUXIN'
|
||||
# company = 'BJS-SAIR'
|
||||
# currency = 'GBP'
|
||||
# # logistics_type = LogisticsType.LTL
|
||||
# logistics_type = LogisticsType.LTL
|
||||
# parent_current_directory = Path(__file__).parent.parent
|
||||
# price_path = parent_current_directory.joinpath("data")
|
||||
# _price_files = price_path.joinpath("")
|
||||
# xl_zone = None
|
||||
# def __new__(cls):
|
||||
# """实现单例模式,只加载一次文件"""
|
||||
# if cls.xl_zone is None:
|
||||
# # 取AB两列即可
|
||||
# cls.xl_zone = pandas.read_excel(cls._price_files,sheet_name="BJS分区",usecols='A:B')
|
||||
# return super().__new__(cls)
|
||||
|
||||
# def __init__(self):
|
||||
# super().__init__()
|
||||
# self.base_fee = 0
|
||||
# def is_remote(self,postcode):
|
||||
# """根据邮编分区,返回分区"""
|
||||
# postcode_prefix = postcode.split()[0].upper()
|
||||
# postcode_prefix = str(postcode_prefix)
|
||||
# # 取前缀的字母
|
||||
# letters = ''.join(re.findall(r'[A-Za-z]', postcode.split()[0])).upper()
|
||||
# letters=str(letters)
|
||||
# # 先匹配字母,字母能找到就直接用,字母对应的找不到,再匹配带上数字的
|
||||
# zone_df = self.xl_zone[self.xl_zone['邮编']== letters]
|
||||
# if zone_df.empty:
|
||||
# zone_df = self.xl_zone[self.xl_zone['邮编']== postcode_prefix]
|
||||
# if not zone_df.empty:
|
||||
# return zone_df['分区'].values[0]
|
||||
# return "不在配送范围内"
|
||||
# def calculate_fee(self, packages, postcode):
|
||||
# """5000计费重 一票一件
|
||||
# 单个包裹实重上限150kg
|
||||
# 体积重上限600Kg
|
||||
# 尺寸上限: 300*180*180cm
|
||||
# """
|
||||
# detail_amount = {
|
||||
# "base":0.00,
|
||||
# "oversize":0.00,
|
||||
# "base":0.00,
|
||||
# "fuel":0.00,
|
||||
# "tail_amount":0.00
|
||||
# }
|
||||
# }
|
||||
# zone = self.is_remote(postcode)
|
||||
# if zone == "不在配送范围内":
|
||||
# detail_amount['tail_amount'] = 99999
|
||||
# return detail_amount
|
||||
# for package in packages:
|
||||
# if package.weight>=250000 or package.volume>=1500000:
|
||||
# volume_weight = package.get_volume_weight(5000)
|
||||
# if package.weight>=150000 or volume_weight>=600 or package.fst_size>300 or package.sed_size>180:
|
||||
# detail_amount['tail_amount'] = 99999
|
||||
# return detail_amount
|
||||
# if
|
||||
# bill_weight = max(package.weight/1000, volume_weight)
|
||||
# detail_amount['base'] += self.get_shipping_cost(zone, bill_weight)
|
||||
# detail_amount['tail_amount'] = detail_amount['base']
|
||||
# return detail_amount
|
||||
|
||||
if __name__ == '__main__':
|
||||
# # 关闭渠道
|
||||
|
|
|
|||
|
|
@ -356,6 +356,46 @@ class FedexGROUDLogistics_US(FedexLogistics):
|
|||
self.bigpackage_peak =0 # 42.25# 大包裹旺季附加费
|
||||
self.return_package = 1325 # 超大包裹(不可发)
|
||||
self.fuel_rate = 0.18 # 燃油费率
|
||||
class FedexTESTLogistics_US(FedexLogistics):
|
||||
"""FedexTEST """
|
||||
company = "Fedex-TEST"
|
||||
|
||||
parent_current_directory = Path(__file__).parent.parent
|
||||
price_path = parent_current_directory.joinpath("data")
|
||||
_price_files = price_path.joinpath("美国快递.xlsx")
|
||||
base_price = None
|
||||
def __new__(cls):
|
||||
if cls.base_price is None:
|
||||
cls.base_price = pandas.read_excel(cls._price_files,sheet_name='FEDEX-TEST')
|
||||
return super().__new__(cls)
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
self.volume_weight_ratio = 250 # lbs抛重系数
|
||||
self.residential = 2.5
|
||||
self.residential_peak =0 # 0.57 0.31 # 报价表没写,账单有
|
||||
self.oversize_2 = 5.5
|
||||
self.oversize_3 = 6.0
|
||||
self.oversize_5 = 6.5
|
||||
self.oversize_7 = 7
|
||||
self.overweight_2 =8
|
||||
self.overweight_3 = 8.5
|
||||
self.overweight_5 =9.5
|
||||
self.overweight_7 = 10
|
||||
self.overhanding_2 = 8# 额外操作费
|
||||
self.overhanding_3 = 9
|
||||
self.overhanding_5 = 9.5
|
||||
self.overhanding_7 = 9.5
|
||||
self.ahs_peak = 0 #1.3 # 操作费旺季附加费
|
||||
self.residential_das =3.5 # 偏远费
|
||||
self.residential_extended = 4.5 # 超偏远费
|
||||
self.residential_remote = 8.5# 超超偏远费
|
||||
self.bigpackage_2 = 44.5 # 大包裹费
|
||||
self.bigpackage_3 = 48.5
|
||||
self.bigpackage_5 = 53.5
|
||||
self.bigpackage_7 = 56.5
|
||||
self.bigpackage_peak =0 # 42.25# 大包裹旺季附加费
|
||||
self.return_package = 814.5 # 超大包裹(不可发)
|
||||
self.fuel_rate = 0.18 # 燃油费率
|
||||
|
||||
class GIGALogistics_US(TailLogistics):
|
||||
"""卡派:GIGA,美东美西不变"""
|
||||
|
|
@ -952,6 +992,10 @@ class AMTEastLogistics_US(TailLogistics):
|
|||
if key!= 'tail_amount':
|
||||
detail_amount['tail_amount'] += detail_amount[key]
|
||||
return detail_amount
|
||||
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
FedexPPLogistics_US.close_logistics()
|
||||
print(1)
|
||||
|
|
@ -7,6 +7,7 @@ ACTIVE_LOGISTICS = {
|
|||
"FedexKHLogistics_US": False,# 需关闭
|
||||
"FedexHOMELogistics_US": True,
|
||||
"FedexGROUDLogistics_US": True,
|
||||
"FedexTESTLogistics_US":False, # 测试用,用完关闭
|
||||
"MetroLogistics_US": True,
|
||||
"GIGALogistics_US": False,# 需关闭
|
||||
"CEVALogistics_US": False,# 需关闭
|
||||
|
|
@ -14,18 +15,20 @@ ACTIVE_LOGISTICS = {
|
|||
"AMTWestLogistics_US":True,
|
||||
"AMTEastLogistics_US":True,
|
||||
# UK
|
||||
"DPDLogistics_UK": True,
|
||||
"bigLogistics_UK": True,
|
||||
"ZGDPDLogistics_UK": True,
|
||||
"SAIRDPDLogistics_UK":True,
|
||||
"bigLogistics_UK": False,
|
||||
"KPZGLogistics_UK": True,
|
||||
"KPNVlogistics_UK": False,# 需关闭
|
||||
"ZGbigLogistics_UK":True,
|
||||
|
||||
# EUR
|
||||
"DPDASLLogistics":False, # 需关闭
|
||||
"DPDNVLogistics":True,
|
||||
|
||||
# GB
|
||||
"KPZGLogistics_UK":True, # 需关闭
|
||||
"bigLogistics_UK":False, # 需关闭,智谷旧版大件,8,新版是分区的
|
||||
# AUD
|
||||
"TMSLogistics_AU":True,
|
||||
|
||||
|
||||
}
|
||||
def apply_active_config():
|
||||
|
|
|
|||
|
|
@ -22,6 +22,8 @@ logistics_name = {
|
|||
"空LAX-卡派":"Metro-SAIR",# 不确定的渠道,默认为Metro
|
||||
"易可达/WEST-USPS":"--", # 无法计算
|
||||
"易可达/WEST-UPS":"--", # 无法计算
|
||||
"海MS-METRO-SAIR-Q":"--",#待补
|
||||
|
||||
# AU
|
||||
"海SY-POST3":"POST",
|
||||
"海POST- TMS改重":"POST",
|
||||
|
|
@ -33,14 +35,20 @@ logistics_name = {
|
|||
"空SYD-TOLL1":"TOLL",
|
||||
"海SY-ALL": "ALL",
|
||||
"空SYD-ALL": "ALL",
|
||||
"海SY-TMS-AUSL":"TMS",
|
||||
|
||||
|
||||
# UK
|
||||
"空LHR-DPD":"智谷-DPD",
|
||||
"海GB-DPD2":"智谷-DPD",
|
||||
"海GB-卡派":"卡派-NV",
|
||||
"海GB-卡派":"卡派-ZG",
|
||||
"海GB-AIT-FX":"--", # 待补
|
||||
"空LHR-卡派":"卡派-ZG",
|
||||
"海GB-大件":"智谷-大件",
|
||||
"海GB-大件":"海GB-大件",
|
||||
"海GB-PW-SAIR":"--", # 待补
|
||||
"海GB-DPD-SAIR":"SAIR-DPD",
|
||||
"空LHR-DPD-SAIR":"SAIR-DPD",# 待补
|
||||
"海GB-BJS-SAIR":"--", # 待补
|
||||
|
||||
# 欧洲整体
|
||||
"空AMS-DPD":"DPD-ZG",
|
||||
|
|
|
|||
Loading…
Reference in New Issue