diff --git a/.claude/settings.local.json b/.claude/settings.local.json
new file mode 100644
index 0000000..787b5db
--- /dev/null
+++ b/.claude/settings.local.json
@@ -0,0 +1,7 @@
+{
+ "permissions": {
+ "allow": [
+ "Bash(python -c \":*)"
+ ]
+ }
+}
diff --git a/config/database.json b/config/database.json
new file mode 100644
index 0000000..a41e3f8
--- /dev/null
+++ b/config/database.json
@@ -0,0 +1,13 @@
+{
+ "database": {
+ "host": "192.168.100.33",
+ "port": 3306,
+ "username": "zhenggantian",
+ "password": "123456",
+ "database": "logistics",
+ "charset": "utf8mb4",
+ "pool_size": 10,
+ "max_overflow": 5,
+ "pool_recycle": 3600
+ }
+}
diff --git a/data/售价尾端价格.xlsx b/data/售价尾端价格.xlsx
index 38f6ef5..7799a17 100644
--- a/data/售价尾端价格.xlsx
+++ b/data/售价尾端价格.xlsx
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
-oid sha256:113c7466854323029ab62c4a5dfb25858b37efd7a793d97724070a45f1f65628
-size 17380
+oid sha256:d8f576400e843049aa2536eff26c44580ef6fa63a01d568fd91d682e8d492bdf
+size 18366
diff --git a/dataaccess/__init__.py b/dataaccess/__init__.py
new file mode 100644
index 0000000..7d0521d
--- /dev/null
+++ b/dataaccess/__init__.py
@@ -0,0 +1,4 @@
+"""数据访问层模块"""
+from dataaccess.base_dao import BaseDAO
+
+__all__ = ["BaseDAO"]
diff --git a/dataaccess/base_dao.py b/dataaccess/base_dao.py
new file mode 100644
index 0000000..e780396
--- /dev/null
+++ b/dataaccess/base_dao.py
@@ -0,0 +1,65 @@
+"""基础数据访问类"""
+import pandas as pd
+from typing import Any, Dict, List, Optional
+from utils.gtools import MySQLconnect
+
+
+class BaseDAO:
+ """基础数据访问对象"""
+
+ _cache: Dict[str, pd.DataFrame] = {}
+ _cache_enabled: bool = True
+
+ def __init__(self, table_name: str):
+ self.table_name = table_name
+
+ def _get_connection(self, dbname: str = None) -> MySQLconnect:
+ """获取数据库连接"""
+ return MySQLconnect(dbname)
+
+ def get_all(self, dbname: str = None) -> pd.DataFrame:
+ """获取所有数据"""
+ cache_key = f"{dbname}:{self.table_name}"
+
+ if self._cache_enabled and cache_key in self._cache:
+ return self._cache[cache_key]
+
+ with self._get_connection(dbname) as conn:
+ df = pd.read_sql(f"SELECT * FROM {self.table_name}", conn.con)
+
+ if self._cache_enabled:
+ self._cache[cache_key] = df
+
+ return df
+
+ def get_by_condition(self, conditions: Dict[str, Any], dbname: str = None) -> pd.DataFrame:
+ """根据条件查询数据"""
+ where_clause = " AND ".join([f"{k} = '{v}'" for k, v in conditions.items()])
+ query = f"SELECT * FROM {self.table_name} WHERE {where_clause}"
+
+ with self._get_connection(dbname) as conn:
+ df = pd.read_sql(query, conn.con)
+
+ return df
+
+ def execute_query(self, query: str, dbname: str = None) -> pd.DataFrame:
+ """执行自定义查询"""
+ with self._get_connection(dbname) as conn:
+ df = pd.read_sql(query, conn.con)
+
+ return df
+
+ @classmethod
+ def clear_cache(cls):
+ """清空缓存"""
+ cls._cache.clear()
+
+ @classmethod
+ def disable_cache(cls):
+ """禁用缓存"""
+ cls._cache_enabled = False
+
+ @classmethod
+ def enable_cache(cls):
+ """启用缓存"""
+ cls._cache_enabled = True
diff --git a/dataaccess/company_dao.py b/dataaccess/company_dao.py
new file mode 100644
index 0000000..15b272a
--- /dev/null
+++ b/dataaccess/company_dao.py
@@ -0,0 +1,49 @@
+"""物流公司数据访问类"""
+import pandas as pd
+from typing import Dict, List, Optional
+from dataaccess.base_dao import BaseDAO
+
+
+class CompanyDAO(BaseDAO):
+ """物流公司数据访问"""
+
+ def __init__(self):
+ super().__init__("logistics_company")
+
+ def get_all_companies(self, country: str = None, active_only: bool = True) -> List[Dict]:
+ """获取所有物流公司"""
+ conditions = {}
+ if country:
+ conditions["country"] = country
+ if active_only:
+ conditions["active"] = 1
+
+ if conditions:
+ df = self.get_by_condition(conditions)
+ else:
+ df = self.get_all()
+
+ if df.empty:
+ return []
+
+ return df.to_dict("records")
+
+ def get_company_info(self, company_code: str) -> Optional[Dict]:
+ """获取物流公司详细信息"""
+ df = self.get_by_condition({"company_code": company_code})
+ if df.empty:
+ return None
+ return df.iloc[0].to_dict()
+
+ def get_companies_by_type(self, country: str, logistics_type: str) -> List[Dict]:
+ """根据物流类型获取公司列表"""
+ query = f"""
+ SELECT * FROM {self.table_name}
+ WHERE country = '{country}'
+ AND logistics_type = '{logistics_type}'
+ AND active = 1
+ """
+ df = self.execute_query(query)
+ if df.empty:
+ return []
+ return df.to_dict("records")
diff --git a/dataaccess/uk_price_dao.py b/dataaccess/uk_price_dao.py
new file mode 100644
index 0000000..b880bbe
--- /dev/null
+++ b/dataaccess/uk_price_dao.py
@@ -0,0 +1,65 @@
+"""英国物流价格数据访问类"""
+import pandas as pd
+from typing import Dict, List, Optional
+from dataaccess.base_dao import BaseDAO
+
+
+class UKPriceDAO(BaseDAO):
+ """英国物流价格数据访问"""
+
+ def __init__(self):
+ super().__init__("uk_logistics_price")
+
+ def get_all_companies(self) -> List[str]:
+ """获取所有英国物流公司"""
+ df = self.get_all()
+ if df.empty:
+ return []
+ return df["company"].unique().tolist()
+
+ def get_company_price(self, company: str) -> pd.DataFrame:
+ """获取指定物流公司的价格数据"""
+ return self.get_by_condition({"company": company})
+
+ def get_company_config(self, company: str) -> Dict:
+ """获取物流公司配置信息"""
+ df = self.get_by_condition({"company": company})
+ if df.empty:
+ return {}
+
+ config = {}
+ for _, row in df.iterrows():
+ key = row.get("config_key")
+ value = row.get("config_value")
+ if key:
+ config[key] = value
+
+ return config
+
+
+class UKPostcodeDAO(BaseDAO):
+ """英国邮编分区数据访问"""
+
+ def __init__(self):
+ super().__init__("uk_postcode_zone")
+
+ def get_zone(self, postcode: str) -> Optional[str]:
+ """根据邮编获取分区"""
+ postcode_prefix = postcode.split()[0].upper()
+ df = self.get_by_condition({"postcode_prefix": postcode_prefix})
+
+ if df.empty:
+ return None
+
+ return df.iloc[0].get("zone")
+
+ def is_remote(self, postcode: str) -> bool:
+ """判断是否偏远"""
+ postcode_prefix = postcode.split()[0].upper()
+ remote_prefixes = ["BT", "IM", "JE", "ZE", "GY", "HS", "PO", "IV", "KA", "KW", "PH", "PA"]
+
+ if not any(postcode_prefix.startswith(p) for p in remote_prefixes):
+ return False
+
+ df = self.get_by_condition({"postcode_prefix": postcode_prefix, "is_remote": "1"})
+ return not df.empty
diff --git a/dataaccess/us_price_dao.py b/dataaccess/us_price_dao.py
new file mode 100644
index 0000000..407ea77
--- /dev/null
+++ b/dataaccess/us_price_dao.py
@@ -0,0 +1,70 @@
+"""美国物流价格数据访问类"""
+import pandas as pd
+from typing import Dict, List, Optional
+from dataaccess.base_dao import BaseDAO
+
+
+class USPriceDAO(BaseDAO):
+ """美国物流价格数据访问"""
+
+ def __init__(self):
+ super().__init__("us_logistics_price")
+
+ def get_all_companies(self) -> List[str]:
+ """获取所有美国物流公司"""
+ df = self.get_all()
+ if df.empty:
+ return []
+ return df["company"].unique().tolist()
+
+ def get_company_price(self, company: str) -> pd.DataFrame:
+ """获取指定物流公司的价格数据"""
+ return self.get_by_condition({"company": company})
+
+ def get_company_config(self, company: str) -> Dict:
+ """获取物流公司配置信息"""
+ df = self.get_by_condition({"company": company})
+ if df.empty:
+ return {}
+
+ config = {}
+ for _, row in df.iterrows():
+ key = row.get("config_key")
+ value = row.get("config_value")
+ if key:
+ config[key] = value
+
+ return config
+
+
+class USPostcodeDAO(BaseDAO):
+ """美国邮编分区数据访问"""
+
+ def __init__(self):
+ super().__init__("us_postcode_zone")
+
+ def get_zone(self, postcode: str, port: str = "west") -> Optional[str]:
+ """根据邮编获取分区"""
+ postcode_5 = postcode[:5]
+ df = self.get_by_condition({"postcode": postcode_5, "port": port})
+
+ if df.empty:
+ return None
+
+ return df.iloc[0].get("zone")
+
+ def get_remote_type(self, postcode: str) -> int:
+ """获取偏远类型: 0-非偏远, 1-偏远, 2-超偏远, 3-超超偏远"""
+ postcode_5 = postcode[:5]
+ df = self.get_by_condition({"postcode": postcode_5})
+
+ if df.empty:
+ return 0
+
+ return int(df.iloc[0].get("remote_type", 0))
+
+ def is_contiguous(self, postcode: str) -> bool:
+ """判断是否在本土范围内"""
+ postcode_5 = postcode[:5]
+ df = self.get_by_condition({"postcode": postcode_5})
+ return not df.empty
diff --git a/login_for_cookie.py b/login_for_cookie.py
index 6514451..9bbe4ab 100644
--- a/login_for_cookie.py
+++ b/login_for_cookie.py
@@ -5,14 +5,15 @@ import re
import pytesseract
from PIL import Image
from tempfile import NamedTemporaryFile
-from selenium.webdriver.chrome.service import Service
-from selenium.webdriver.common.by import By
-from selenium.webdriver.remote.file_detector import UselessFileDetector #跳过文件检测 1
-from selenium import webdriver
+
import redis
def vercode(cookie=None):
- urls = 'https://cp.maso.hk:4433/index.php?main=login&act=vercode'#图片链接(每秒更新,距离当前时间最近的时间戳最近为可使用图片)
+ urls = 'https://cp.baycheer.com:4433/index.php?main=login&act=vercode'#图片链接(每秒更新,距离当前时间最近的时间戳最近为可使用图片)
+
+
+
+
if cookie is not None:
haders = {
'Cookie': cookie #使用之前的图片链接Cooike
@@ -43,7 +44,7 @@ def Vc(user='honghuayuan',pswd= 'a12345'):
try :
r = redis.StrictRedis(host='192.168.100.44', port=7379, db=11,password="123456")
viewcookie = r.get('cpmasosessid'+user)
- url="https://cp.maso.hk/index.php?main=panel"#主页
+ url="https://cp.baycheer.com/index.php?main=panel"#主页
header={'Cookie':viewcookie.decode('utf8')}
resp = requests.get(url=url,headers=header)
exists = re.findall(r'欢迎进入本公司后台管理系统',resp.text)
@@ -57,7 +58,7 @@ def Vc(user='honghuayuan',pswd= 'a12345'):
while resetcookie ==1:
- urls = 'https://cp.maso.hk:4433/index.php?main=login&act=vercode'#图片链接(每秒更新,距离当前时间最近的时间戳最近为可使用图片)
+ urls = 'https://cp.baycheer.com:4433/index.php?main=login&act=vercode'#图片链接(每秒更新,距离当前时间最近的时间戳最近为可使用图片)
res = requests.post(url=urls)
ress = re.findall('Cookie (.*?) for',str(res.cookies))#获取图片链接Cooike,图片Cooike必须和登录请求的Cooike保持一致
f1 = NamedTemporaryFile(mode='wb+',suffix='.png')
@@ -77,7 +78,7 @@ def Vc(user='honghuayuan',pswd= 'a12345'):
bim.save(f2)#处理完成导入
f2.seek(0)
text = pytesseract.image_to_string(Image.open(f2))#开始识别
- url = 'https://cp.maso.hk:4433/index.php?main=login&act=check'
+ url = 'https://cp.baycheer.com:4433/index.php?main=login&act=check'
haders = {
'Cookie': ress[0] #使用之前的图片链接Cooike
}
@@ -204,9 +205,9 @@ def zenid():
options.add_argument('--disable-gpu')
options.add_argument(' -port=9222')
driver=webdriver.Remote(service.service_url,options=options)
- mainurl='http://cp.maso.hk/index.php?main=main'
- panelUrl = "http://cp.maso.hk/index.php?main=panel"#地址
- remoteurl='http://cp.maso.hk/index.php?main=sys_remote_login&act=remotelogin&id=303'
+ mainurl='http://cp.baycheer.com/index.php?main=main'
+ panelUrl = "http://cp.baycheer.com/index.php?main=panel"#地址
+ remoteurl='http://cp.baycheer.com/index.php?main=sys_remote_login&act=remotelogin&id=303'
driver.get(mainurl)
driver.delete_all_cookies()
driver.add_cookie({'name':'sessid','value':f'{t}'})
diff --git a/logisticsClass/logisticsTail_UK.py b/logisticsClass/logisticsTail_UK.py
index aa46d8e..2d1eac7 100644
--- a/logisticsClass/logisticsTail_UK.py
+++ b/logisticsClass/logisticsTail_UK.py
@@ -5,6 +5,7 @@ import re
import pandas
from logisticsClass.logisticsBaseClass import LogisticsType, TailLogistics
+from utils.gtools import MySQLconnect
class DPDLogistics_UK(TailLogistics):
@@ -218,53 +219,75 @@ class KPNVlogistics_UK(TailLogistics):
country = 'United Kingdom'
company = '卡派-NV'
currency = 'GBP'
- logistics_type = LogisticsType.COURIER
+ logistics_type = LogisticsType.COURIER
+
+ # 数据库表数据(内存缓存)
+ _zone_cache = None # 邮编分区缓存
+ _price_cache = None # 价格缓存
- parent_current_directory = Path(__file__).parent.parent
- price_path = parent_current_directory.joinpath("data")
- _price_files = price_path.joinpath("英国卡派.xlsx")
- ltl_cost = None
- ltl_zone = None
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="分区")
+ """实现单例模式,从数据库加载数据"""
+ if cls._zone_cache is None or cls._price_cache is None:
+ cls._load_from_db()
return super().__new__(cls)
+
+ @classmethod
+ def _load_from_db(cls):
+ """从数据库加载分区和价格数据"""
+ conn = MySQLconnect('logistics')
+ with conn as c:
+ # 加载分区表
+ c.cur.execute("SELECT `邮编`, `区域` FROM uk_XLCarrier_postcode_partition")
+ cls._zone_cache = {}
+ for row in c.cur.fetchall():
+ postcode = str(row[0]) if row[0] else ""
+ zone = str(row[1]) if row[1] else ""
+ cls._zone_cache[postcode] = zone
+
+ # 加载价格表
+ c.cur.execute("SELECT `分区`, `托盘`, `运费` FROM uk_XLCarrier_postcode_fee")
+ cls._price_cache = {}
+ for row in c.cur.fetchall():
+ zone = str(row[0]) if row[0] else ""
+ tuopan = int(row[1]) if row[1] else 0
+ fee = float(row[2]) if row[2] else 0
+ cls._price_cache[(zone, tuopan)] = fee
+
def __init__(self):
super().__init__()
self.base_fee = 0
self.fuel_rate = 0.1
- def is_remote(self,postcode):
+
+ def is_remote(self, postcode):
"""根据邮编分区,返回分区"""
postcode_prefix = postcode.split()[0].upper()
- postcode_prefix = str(postcode_prefix)
- zone_df = self.ltl_zone[self.ltl_zone['邮编']== postcode_prefix]
- if not zone_df.empty:
- return zone_df['区域'].values[0]
+ zone = self._zone_cache.get(postcode_prefix)
+ if zone:
+ return zone
return "不在配送范围内"
+
def calculate_fee(self, packages, postcode):
detail_amount = {
- "base":0.00,
- "fuel":0.00,
- "tail_amount":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:
- tuopan = math.ceil(package.fst_size/120)
+ tuopan = math.ceil(package.fst_size / 120)
tuopan = min(tuopan, 7)
- base_df = self.ltl_cost[(self.ltl_cost['分区']==zone)&(self.ltl_cost['托盘']==tuopan)]
- if base_df.empty:
+ fee = self._price_cache.get((zone, tuopan))
+ if fee is None:
detail_amount['tail_amount'] = 99999
return detail_amount
- self.base_fee = base_df['运费'].values[0]
- price = self.base_fee * tuopan/len(packages)
+ self.base_fee = fee
+ price = self.base_fee * tuopan / len(packages)
detail_amount['base'] += price
detail_amount['fuel'] = detail_amount['base'] * self.fuel_rate
- detail_amount['tail_amount'] = detail_amount['base']+detail_amount['fuel']
+ detail_amount['tail_amount'] = detail_amount['base'] + detail_amount['fuel']
return detail_amount
# class KPDXLogistics_UK(TailLogistics):
diff --git a/logisticsClass/logisticsTail_US.py b/logisticsClass/logisticsTail_US.py
index 96124d8..1dd281b 100644
--- a/logisticsClass/logisticsTail_US.py
+++ b/logisticsClass/logisticsTail_US.py
@@ -5,6 +5,7 @@ import pandas
from logisticsClass.logisticsBaseClass import LogisticsType, TailLogistics
from data.us_zone import zone_west, zone_east
from pathlib import Path
+from utils.gtools import MySQLconnect
"""
port:west(default),east
@@ -84,6 +85,10 @@ class FedexLogistics(WestLogistics_US):
"""Fedex"""
country = "United States"
country_code = "US"
+
+ # 价格缓存(子类可覆盖)
+ _price_cache = None
+
def __init__(self):
super().__init__()
self.volume_weight_ratio:int # lbs抛重系数
@@ -109,6 +114,16 @@ class FedexLogistics(WestLogistics_US):
self.bigpackage_2:float # 大包裹费
self.bigpackage_3:float
self.bigpackage_5:float
+
+ def get_price(self, lbs: int, zone: int) -> float:
+ """获取价格(子类可覆盖)"""
+ if self._price_cache is not None:
+ return self._price_cache.get(lbs, {}).get(zone, 0)
+ # 默认从DataFrame获取(兼容旧代码)
+ if self.base_price is not None:
+ result = self.base_price[self.base_price['lbs.'] == lbs][zone]
+ return result.values[0] if len(result) > 0 else 0
+ return 0
self.bigpackage_7:float
self.bigpackage_peak:float # 大包裹旺季附加费
self.return_package:float # 超大包裹(不可发)
@@ -185,8 +200,8 @@ class FedexLogistics(WestLogistics_US):
detail_amount['big_package_peak'] += self.bigpackage_peak if package.girth_inch >130 or package.fst_inch >96 else 0
detail_amount['residential_delivery'] += self.residential
detail_amount['residential_peak'] += self.residential_peak
-
- detail_amount['base'] +=self.base_price[self.base_price['lbs.']==math.ceil(cal_weight)][zone].values[0]
+
+ detail_amount['base'] += self.get_price(math.ceil(cal_weight), zone)
for key in detail_amount:
if key!= 'tail_amount' and key!= 'fuel':
@@ -198,18 +213,37 @@ class FedexLogistics(WestLogistics_US):
class FedexPPLogistics_US(FedexLogistics):
company="Fedex-彩虹小马"
- parent_current_directory = Path(__file__).parent.parent
- price_path = parent_current_directory.joinpath("data")
- _price_files = price_path.joinpath("美国快递.xlsx")
- base_price = None
+ # 数据库价格缓存
+ _price_cache = None
+
def __new__(cls):
- if cls.base_price is None:
- cls.base_price = pandas.read_excel(cls._price_files,sheet_name='邮差小马')
+ if cls._price_cache is None:
+ cls._load_from_db()
return super().__new__(cls)
+
+ @classmethod
+ def _load_from_db(cls):
+ """从数据库加载价格数据"""
+ conn = MySQLconnect('logistics')
+ with conn as c:
+ c.cur.execute("SELECT `lbs.`, `2`, `3`, `4`, `5`, `6`, `7`, `8` FROM us_delivery_postpony")
+ cls._price_cache = {}
+ for row in c.cur.fetchall():
+ lbs = int(row[0])
+ cls._price_cache[lbs] = {
+ 2: float(row[1]) if row[1] else 0,
+ 3: float(row[2]) if row[2] else 0,
+ 4: float(row[3]) if row[3] else 0,
+ 5: float(row[4]) if row[4] else 0,
+ 6: float(row[5]) if row[5] else 0,
+ 7: float(row[6]) if row[6] else 0,
+ 8: float(row[7]) if row[7] else 0,
+ }
+
def __init__(self):
super().__init__()
self.volume_weight_ratio=250 # lbs抛重系数
- self.residential = 6.38
+ self.residential = 6.38
self.residential_peak = 0 # 0.33 0.6 # 报价表没写,账单有
self.oversize_2 = 4.50
self.oversize_3 = 4.99
@@ -231,7 +265,7 @@ class FedexPPLogistics_US(FedexLogistics):
self.bigpackage_3 = 36.16
self.bigpackage_5 = 38.57
self.bigpackage_7 = 41.78
- self.bigpackage_peak = 0 # 45.26 53.56# 大包裹旺季附加费
+ self.bigpackage_peak = 0 # 45.26 53.56# 大包裹旺季附加费
self.fuel_rate = 0.16 # 燃油费率
self.return_package = 1419.34 # 超大包裹(不可发)
@@ -239,14 +273,33 @@ class FedexKHLogistics_US(FedexLogistics):
"""金宏亚"""
company = "Fedex-金宏亚"
- parent_current_directory = Path(__file__).parent.parent
- price_path = parent_current_directory.joinpath("data")
- _price_files = price_path.joinpath("美国快递.xlsx")
- base_price = None
+ # 数据库价格缓存
+ _price_cache = None
+
def __new__(cls):
- if cls.base_price is None:
- cls.base_price = pandas.read_excel(cls._price_files,sheet_name='金宏亚')
+ if cls._price_cache is None:
+ cls._load_from_db()
return super().__new__(cls)
+
+ @classmethod
+ def _load_from_db(cls):
+ """从数据库加载价格数据"""
+ conn = MySQLconnect('logistics')
+ with conn as c:
+ c.cur.execute("SELECT `lbs.`, `2`, `3`, `4`, `5`, `6`, `7`, `8` FROM us_delivery_kinghood")
+ cls._price_cache = {}
+ for row in c.cur.fetchall():
+ lbs = int(row[0])
+ cls._price_cache[lbs] = {
+ 2: float(row[1]) if row[1] else 0,
+ 3: float(row[2]) if row[2] else 0,
+ 4: float(row[3]) if row[3] else 0,
+ 5: float(row[4]) if row[4] else 0,
+ 6: float(row[5]) if row[5] else 0,
+ 7: float(row[6]) if row[6] else 0,
+ 8: float(row[7]) if row[7] else 0,
+ }
+
def __init__(self):
super().__init__()
self.volume_weight_ratio = 250 # lbs抛重系数
@@ -280,14 +333,33 @@ class FedexHOMELogistics_US(FedexLogistics):
"""FEDEX-HOME (1-35%-30%)"""
company = "Fedex-HOME"
- parent_current_directory = Path(__file__).parent.parent
- price_path = parent_current_directory.joinpath("data")
- _price_files = price_path.joinpath("美国快递.xlsx")
- base_price = None
+ # 数据库价格缓存
+ _price_cache = None
+
def __new__(cls):
- if cls.base_price is None:
- cls.base_price = pandas.read_excel(cls._price_files,sheet_name='FEDEX')
+ if cls._price_cache is None:
+ cls._load_from_db()
return super().__new__(cls)
+
+ @classmethod
+ def _load_from_db(cls):
+ """从数据库加载价格数据"""
+ conn = MySQLconnect('logistics')
+ with conn as c:
+ c.cur.execute("SELECT `lbs.`, `2`, `3`, `4`, `5`, `6`, `7`, `8` FROM us_fedex_home")
+ cls._price_cache = {}
+ for row in c.cur.fetchall():
+ lbs = int(row[0])
+ cls._price_cache[lbs] = {
+ 2: float(row[1]) if row[1] else 0,
+ 3: float(row[2]) if row[2] else 0,
+ 4: float(row[3]) if row[3] else 0,
+ 5: float(row[4]) if row[4] else 0,
+ 6: float(row[5]) if row[5] else 0,
+ 7: float(row[6]) if row[6] else 0,
+ 8: float(row[7]) if row[7] else 0,
+ }
+
def __init__(self):
super().__init__()
self.volume_weight_ratio = 250 # lbs抛重系数
@@ -316,18 +388,38 @@ class FedexHOMELogistics_US(FedexLogistics):
self.bigpackage_peak =0 # 42.25# 大包裹旺季附加费
self.return_package = 1325 # 超大包裹(不可发)
self.fuel_rate = 0.18 # 燃油费率
+
class FedexGROUDLogistics_US(FedexLogistics):
"""FEDEX-GROUD (1-35%-30%)"""
company = "Fedex-GROUD"
- parent_current_directory = Path(__file__).parent.parent
- price_path = parent_current_directory.joinpath("data")
- _price_files = price_path.joinpath("美国快递.xlsx")
- base_price = None
+ # 数据库价格缓存(与FedexHOMELogistics_US共享us_fedex_home表)
+ _price_cache = None
+
def __new__(cls):
- if cls.base_price is None:
- cls.base_price = pandas.read_excel(cls._price_files,sheet_name='FEDEX')
+ if cls._price_cache is None:
+ cls._load_from_db()
return super().__new__(cls)
+
+ @classmethod
+ def _load_from_db(cls):
+ """从数据库加载价格数据"""
+ conn = MySQLconnect('logistics')
+ with conn as c:
+ c.cur.execute("SELECT `lbs.`, `2`, `3`, `4`, `5`, `6`, `7`, `8` FROM us_fedex_home")
+ cls._price_cache = {}
+ for row in c.cur.fetchall():
+ lbs = int(row[0])
+ cls._price_cache[lbs] = {
+ 2: float(row[1]) if row[1] else 0,
+ 3: float(row[2]) if row[2] else 0,
+ 4: float(row[3]) if row[3] else 0,
+ 5: float(row[4]) if row[4] else 0,
+ 6: float(row[5]) if row[5] else 0,
+ 7: float(row[6]) if row[6] else 0,
+ 8: float(row[7]) if row[7] else 0,
+ }
+
def __init__(self):
super().__init__()
self.volume_weight_ratio = 250 # lbs抛重系数
diff --git a/logistics_service.py b/logistics_service.py
new file mode 100644
index 0000000..d2a97ad
--- /dev/null
+++ b/logistics_service.py
@@ -0,0 +1,165 @@
+"""物流费用计算统一入口服务"""
+import re
+from typing import Dict, List, Any, Optional
+
+from utils.Package import Package, Package_group
+from utils.countryOperator import OperateCountry
+from logisticsClass.logisticsBaseClass import PortType
+
+
+class LogisticsService:
+ """物流费用计算统一服务"""
+
+ @staticmethod
+ def _detect_country(postcode: str) -> str:
+ """根据邮编格式自动识别国家"""
+ postcode = postcode.strip().upper()
+
+ # 英国邮编格式:字母+数字(+字母)+空格+数字+字母
+ # 支持格式: SW1A 1AA, M1 1AA, BT1 1AA, AA11 1AA 等
+ if re.match(r'^[A-Z]{1,2}[0-9][A-Z0-9]?\s?[0-9][A-Z]{2}$', postcode):
+ return "UK"
+
+ # 美国邮编格式:5位数字或5位-4位
+ if re.match(r'^\d{5}(-\d{4})?$', postcode):
+ return "US"
+
+ # 澳洲邮编格式:4位数字
+ if re.match(r'^\d{4}$', postcode):
+ return "AU"
+
+ # 欧洲格式(德国、法国等)
+ if re.match(r'^\d{5}$', postcode):
+ return "DE" # 默认德国
+
+ raise ValueError(f"无法识别的邮编格式: {postcode}")
+
+ @staticmethod
+ def _parse_packages(packages_data: List[Dict]) -> Package_group:
+ """解析包裹数据"""
+ packages = []
+ for i, pkg in enumerate(packages_data):
+ name = pkg.get("name", f"包裹{i+1}")
+ length = pkg.get("length", 0)
+ width = pkg.get("width", 0)
+ height = pkg.get("height", 0)
+ weight = pkg.get("weight", 0)
+
+ package = Package(name, length, width, height, weight)
+ packages.append(package)
+
+ return Package_group(packages)
+
+ @staticmethod
+ def calculate(postcode: str, packages_data: List[Dict],
+ port: PortType = PortType.DEFAULT) -> Dict[str, Any]:
+ """
+ 计算物流费用并返回最优渠道
+
+ Args:
+ postcode: 收件人邮编
+ packages_data: 包裹数据列表,格式为:
+ [
+ {"length": 63, "width": 59, "height": 48, "weight": 8000}, # 单位:cm, g
+ ...
+ ]
+ port: 港口类型,默认DEFAULT
+
+ Returns:
+ 包含最优渠道和所有渠道费用的字典
+ """
+ # 1. 识别国家
+ country = LogisticsService._detect_country(postcode)
+
+ # 2. 解析包裹
+ packages = LogisticsService._parse_packages(packages_data)
+
+ # 3. 创建国家操作对象
+ op_country = OperateCountry(country, port, packages, postcode)
+
+ # 4. 获取所有渠道费用
+ all_fees = op_country.get_all_tail_info()
+
+ # 5. 找出最优渠道
+ valid_fees = {k: v for k, v in all_fees.items() if v < 99999}
+ if not valid_fees:
+ return {
+ "country": country,
+ "postcode": postcode,
+ "optimal_channel": None,
+ "optimal_fee": None,
+ "currency": None,
+ "all_channels": all_fees,
+ "error": "所有渠道均不可用"
+ }
+
+ optimal_channel = min(valid_fees, key=valid_fees.get)
+ optimal_fee = valid_fees[optimal_channel]
+ currency = op_country.get_tail_currency(optimal_channel)
+
+ # 6. 构建结果
+ result = {
+ "country": country,
+ "postcode": postcode,
+ "optimal_channel": optimal_channel,
+ "optimal_fee": optimal_fee,
+ "currency": currency,
+ "all_channels": {},
+ "package_count": len(packages_data),
+ "total_weight": sum(p.weight for p in packages) / 1000, # kg
+ }
+
+ # 7. 添加所有渠道详情
+ for company, fee in all_fees.items():
+ company_type = op_country.get_logistic_type(company)
+ company_currency = op_country.get_tail_currency(company)
+ result["all_channels"][company] = {
+ "fee": fee if fee < 99999 else None,
+ "currency": company_currency,
+ "type": company_type,
+ "available": fee < 99999
+ }
+
+ return result
+
+ @staticmethod
+ def calculate_us(postcode: str, packages_data: List[Dict],
+ port: PortType = PortType.DEFAULT) -> Dict[str, Any]:
+ """计算美国物流费用"""
+ return LogisticsService.calculate(postcode, packages_data, port)
+
+ @staticmethod
+ def calculate_uk(postcode: str, packages_data: List[Dict],
+ port: PortType = PortType.DEFAULT) -> Dict[str, Any]:
+ """计算英国物流费用"""
+ return LogisticsService.calculate(postcode, packages_data, port)
+
+ @staticmethod
+ def calculate_au(postcode: str, packages_data: List[Dict],
+ port: PortType = PortType.DEFAULT) -> Dict[str, Any]:
+ """计算澳洲物流费用"""
+ return LogisticsService.calculate(postcode, packages_data, port)
+
+ @staticmethod
+ def calculate_eur(postcode: str, packages_data: List[Dict],
+ port: PortType = PortType.DEFAULT) -> Dict[str, Any]:
+ """计算欧洲物流费用"""
+ return LogisticsService.calculate(postcode, packages_data, port)
+
+ @staticmethod
+ def get_company_detail(postcode: str, packages_data: List[Dict],
+ company_name: str) -> Dict[str, Any]:
+ """获取指定物流公司的费用明细"""
+ country = LogisticsService._detect_country(postcode)
+ packages = LogisticsService._parse_packages(packages_data)
+ op_country = OperateCountry(country, PortType.DEFAULT, packages, postcode)
+
+ detail = op_country.get_detail_amount(company_name, packages, postcode)
+ currency = op_country.get_tail_currency(company_name)
+
+ return {
+ "company": company_name,
+ "currency": currency,
+ "detail": detail,
+ "total": detail.get("tail_amount", 0)
+ }
diff --git a/scripts/import_data.py b/scripts/import_data.py
new file mode 100644
index 0000000..38eea91
--- /dev/null
+++ b/scripts/import_data.py
@@ -0,0 +1,469 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+"""
+数据导入脚本
+将XLSX文件中的数据导入到数据库
+"""
+import pandas as pd
+import numpy as np
+from pathlib import Path
+from utils.gtools import MySQLconnect
+from utils.config_manager import config
+
+
+class DataImporter:
+ """数据导入类"""
+
+ def __init__(self):
+ self.data_dir = Path(__file__).parent.parent / "data"
+
+ def get_connection(self, dbname: str = None):
+ """获取数据库连接"""
+ return MySQLconnect(dbname)
+
+ def execute_sql(self, sql: str, dbname: str = None):
+ """执行SQL语句"""
+ with self.get_connection(dbname) as conn:
+ conn.cur.execute(sql)
+ conn.con.commit()
+
+ def execute_many(self, sql: str, data: list, dbname: str = None):
+ """批量执行SQL"""
+ with self.get_connection(dbname) as conn:
+ conn.cur.executemany(sql, data)
+ conn.con.commit()
+
+ def truncate_table(self, table_name: str, dbname: str = None):
+ """清空表"""
+ self.execute_sql(f"TRUNCATE TABLE {table_name}", dbname)
+
+ # ==================== 英国数据导入 ====================
+
+ def import_uk_postcode_zone(self):
+ """导入英国邮编分区"""
+ print("导入英国邮编分区...")
+ df = pd.read_excel(self.data_dir / "英国卡派.xlsx", sheet_name="分区")
+ df.columns = ["postcode_prefix", "zone"]
+
+ data = []
+ for _, row in df.iterrows():
+ postcode = str(row["postcode_prefix"]).strip()
+ zone = str(row["zone"]).strip()
+ is_remote = 0
+ data.append((postcode, zone, is_remote))
+
+ sql = "INSERT IGNORE INTO uk_postcode_zone (postcode_prefix, zone, is_remote) VALUES (%s, %s, %s)"
+ self.execute_many(sql, data)
+ print(f" 已导入 {len(data)} 条记录")
+
+ def import_uk_kp_nv_price(self):
+ """导入英国卡派NV运费"""
+ print("导入英国卡派NV运费...")
+ df = pd.read_excel(self.data_dir / "英国卡派.xlsx", sheet_name="运费")
+ df.columns = ["zone", "tuopan", "fee"]
+
+ data = []
+ for _, row in df.iterrows():
+ zone = str(row["zone"]).strip()
+ tuopan = int(row["tuopan"])
+ fee = float(row["fee"])
+ data.append((zone, tuopan, fee))
+
+ sql = "INSERT INTO uk_kp_nv_price (zone, tuopan, fee) VALUES (%s, %s, %s)"
+ self.execute_many(sql, data)
+ print(f" 已导入 {len(data)} 条记录")
+
+ # ==================== 美国数据导入 ====================
+
+ def import_us_fedex_pp_price(self):
+ """导入美国Fedex邮差小马价格"""
+ print("导入美国Fedex邮差小马价格...")
+ df = pd.read_excel(self.data_dir / "美国快递.xlsx", sheet_name="邮差小马")
+
+ # 转换列名
+ cols = ["lbs"] + [str(c) for c in df.columns[1:]]
+ df.columns = cols
+
+ data = []
+ for _, row in df.iterrows():
+ lbs = int(row["lbs"])
+ row_data = [lbs]
+ for i in range(2, 9):
+ val = row.get(str(i), 0)
+ row_data.append(float(val) if pd.notna(val) else 0)
+ data.append(tuple(row_data))
+
+ sql = """INSERT INTO us_fedex_pp_price
+ (lbs, zone_2, zone_3, zone_4, zone_5, zone_6, zone_7, zone_8)
+ VALUES (%s, %s, %s, %s, %s, %s, %s, %s)"""
+ self.execute_many(sql, data)
+ print(f" 已导入 {len(data)} 条记录")
+
+ def import_us_fedex_kh_price(self):
+ """导入美国Fedex金宏亚价格"""
+ print("导入美国Fedex金宏亚价格...")
+ df = pd.read_excel(self.data_dir / "美国快递.xlsx", sheet_name="金宏亚")
+
+ cols = ["lbs"] + [str(c) for c in df.columns[1:]]
+ df.columns = cols
+
+ data = []
+ for _, row in df.iterrows():
+ lbs = int(row["lbs"])
+ row_data = [lbs]
+ for i in range(2, 9):
+ val = row.get(str(i), 0)
+ row_data.append(float(val) if pd.notna(val) else 0)
+ data.append(tuple(row_data))
+
+ sql = """INSERT INTO us_fedex_kh_price
+ (lbs, zone_2, zone_3, zone_4, zone_5, zone_6, zone_7, zone_8)
+ VALUES (%s, %s, %s, %s, %s, %s, %s, %s)"""
+ self.execute_many(sql, data)
+ print(f" 已导入 {len(data)} 条记录")
+
+ def import_us_fedex_price(self):
+ """导入美国Fedex价格"""
+ print("导入美国Fedex价格...")
+
+ for sheet_name in ["FEDEX", "FEDEX国内"]:
+ try:
+ df = pd.read_excel(self.data_dir / "美国快递.xlsx", sheet_name=sheet_name)
+ if "lbs." in df.columns:
+ cols = ["lbs"] + [str(c) for c in df.columns[1:8]]
+ df.columns = cols
+
+ data = []
+ for _, row in df.iterrows():
+ lbs = int(row["lbs"])
+ row_data = [lbs]
+ for i in range(2, 9):
+ val = row.get(str(i), 0)
+ row_data.append(float(val) if pd.notna(val) else 0)
+ data.append(tuple(row_data))
+
+ table = "us_fedex_price" if "FEDEX" in sheet_name and "国内" not in sheet_name else "us_fedex_price"
+ sql = f"""INSERT INTO {table}
+ (lbs, zone_2, zone_3, zone_4, zone_5, zone_6, zone_7, zone_8)
+ VALUES (%s, %s, %s, %s, %s, %s, %s, %s)"""
+ self.execute_many(sql, data)
+ print(f" 已导入 {len(data)} 条记录 ({sheet_name})")
+ except Exception as e:
+ print(f" 跳过 {sheet_name}: {e}")
+
+ def import_us_giga_price(self):
+ """导入美国GIGA价格"""
+ print("导入美国GIGA价格...")
+ df = pd.read_excel(self.data_dir / "GIGA base_fee_20240607223514.xlsx", sheet_name="Local Fee Data")
+
+ data = []
+ for _, row in df.iterrows():
+ zip_code = str(int(row["Zip Code"])) if pd.notna(row["Zip Code"]) else ""
+ delivery_warehouse = str(row["Delivery Warehouse"]) if pd.notna(row["Delivery Warehouse"]) else ""
+ general_area = str(row["General Area"]) if pd.notna(row["General Area"]) else ""
+ fee_type = str(row["Fee Type"]) if pd.notna(row["Fee Type"]) else ""
+ zone = str(row["Zone"]) if pd.notna(row["Zone"]) else ""
+ local_pickup_fee = float(row["Local Pickup Fee"]) if pd.notna(row["Local Pickup Fee"]) else 0
+ warehouse_handling_fee = float(row["Warehouse Handling Fee"]) if pd.notna(row["Warehouse Handling Fee"]) else 0
+ delivery_fee_rate = float(row["Delivery Fee Rate"]) if pd.notna(row["Delivery Fee Rate"]) else 0
+ additional_delivery_fee = float(row["Additional Delivery Fee"]) if pd.notna(row["Additional Delivery Fee"]) else 0
+ assembly_fee = float(row["Assembly Fee"]) if pd.notna(row["Assembly Fee"]) else 0
+
+ data.append((zip_code, delivery_warehouse, general_area, fee_type, zone,
+ local_pickup_fee, warehouse_handling_fee, delivery_fee_rate,
+ additional_delivery_fee, assembly_fee))
+
+ sql = """INSERT INTO us_giga_price
+ (zip_code, delivery_warehouse, general_area, fee_type, zone,
+ local_pickup_fee, warehouse_handling_fee, delivery_fee_rate,
+ additional_delivery_fee, assembly_fee)
+ VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)"""
+ self.execute_many(sql, data)
+ print(f" 已导入 {len(data)} 条记录")
+
+ def import_us_ceva_price(self):
+ """导入美国CEVA价格"""
+ print("导入美国CEVA价格...")
+
+ # CEVA base rate
+ df = pd.read_excel(self.data_dir / "CEVA.xlsx", sheet_name="ceva_base_rate")
+ df.columns = ["ceva_weight"] + list(df.columns[1:])
+
+ data = []
+ for _, row in df.iterrows():
+ ceva_weight = row["ceva_weight"]
+ if pd.isna(ceva_weight):
+ continue
+ row_data = [ceva_weight]
+ for col in df.columns[1:]:
+ val = row[col]
+ row_data.append(float(val) if pd.notna(val) else 0)
+ data.append(tuple(row_data))
+
+ sql = """INSERT INTO us_ceva_price
+ (ceva_weight, zone_ca, zone_wa, zone_or, zone_nv, zone_az,
+ zone_co, zone_ut, zone_nm, remote_area_surcharge)
+ VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)"""
+ self.execute_many(sql, data)
+ print(f" 已导入 {len(data)} 条记录 (ceva_base_rate)")
+
+ # CEVA remote zone
+ df = pd.read_excel(self.data_dir / "CEVA.xlsx", sheet_name="remote_zone")
+ df.columns = ["postal_code", "state", "beyond_zone", "remote_type"]
+
+ data = []
+ for _, row in df.iterrows():
+ postal_code = str(int(row["postal_code"])) if pd.notna(row["postal_code"]) else ""
+ state = str(row["state"]) if pd.notna(row["state"]) else ""
+ beyond_zone = str(row["beyond_zone"]) if pd.notna(row["beyond_zone"]) else ""
+ remote_type = str(row["remote_type"]) if pd.notna(row["remote_type"]) else "standard"
+ data.append((postal_code, state, beyond_zone, remote_type))
+
+ sql = "INSERT IGNORE INTO us_ceva_zone (postal_code, state, beyond_zone, remote_type) VALUES (%s, %s, %s, %s)"
+ self.execute_many(sql, data)
+ print(f" 已导入 {len(data)} 条记录 (remote_zone)")
+
+ def import_us_metro_price(self):
+ """导入美国Metro价格"""
+ print("导入美国Metro价格...")
+
+ for sheet_name in ["cuft_25", "cuft_35", "over35_per_cuft", "over35_min"]:
+ try:
+ df = pd.read_excel(self.data_dir / "Metro.xlsx", sheet_name=sheet_name)
+ if "Origins" not in df.columns:
+ continue
+
+ data = []
+ for _, row in df.iterrows():
+ origins = str(row["Origins"]) if pd.notna(row["Origins"]) else ""
+ row_data = [origins]
+ for col in df.columns[1:]:
+ val = row[col]
+ row_data.append(float(val) if pd.notna(val) else 0)
+ data.append(tuple(row_data))
+
+ cols = ", ".join([f"zone_{i}l" for i in range(1, 10)])
+ sql = f"INSERT INTO us_metro_price (origins, {cols}) VALUES (%s, {cols.replace('zone_', 'zone_')})"
+ # 简化处理
+ sql = "INSERT INTO us_metro_price (origins, zone_1l, zone_2l, zone_3l, zone_4l, zone_5l, zone_6l, zone_7l, zone_8l, zone_9l) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)"
+ self.execute_many(sql, data)
+ print(f" 已导入 {len(data)} 条记录 ({sheet_name})")
+ except Exception as e:
+ print(f" 跳过 {sheet_name}: {e}")
+
+ # Metro zone table
+ try:
+ df = pd.read_excel(self.data_dir / "Metro.xlsx", sheet_name="zone_table")
+ df.columns = ["zip_code", "new_zone_name"]
+
+ data = []
+ for _, row in df.iterrows():
+ zip_code = str(int(row["zip_code"])) if pd.notna(row["zip_code"]) else ""
+ zone = str(row["new_zone_name"]) if pd.notna(row["new_zone_name"]) else ""
+ data.append((zip_code, zone))
+
+ sql = "INSERT IGNORE INTO us_metro_zone (zip_code, new_zone_name) VALUES (%s, %s)"
+ self.execute_many(sql, data)
+ print(f" 已导入 {len(data)} 条记录 (zone_table)")
+ except Exception as e:
+ print(f" zone_table: {e}")
+
+ def import_us_xmiles_zone(self):
+ """导入美国XMILES邮编"""
+ print("导入美国XMILES邮编...")
+ df = pd.read_excel(self.data_dir / "XMILES.xlsx", sheet_name="postcode_table")
+
+ # 处理可能的列名问题
+ cols = df.columns.tolist()
+ if len(cols) >= 2:
+ df.columns = ["postcode", "area"]
+
+ data = []
+ for _, row in df.iterrows():
+ postcode = str(int(row["postcode"])) if pd.notna(row["postcode"]) else ""
+ area = str(row["area"]) if pd.notna(row["area"]) else ""
+ data.append((postcode, area))
+
+ sql = "INSERT IGNORE INTO us_xmiles_zone (postcode, area) VALUES (%s, %s)"
+ self.execute_many(sql, data)
+ print(f" 已导入 {len(data)} 条记录")
+
+ def import_us_am_price(self):
+ """导入美国AM卡派价格"""
+ print("导入美国AM卡派价格...")
+
+ # price表
+ df = pd.read_excel(self.data_dir / "美国卡派-AM.xlsx", sheet_name="price")
+ df.columns = ["pu_zone", "dl_zone", "zone_combo", "minimum", "maximum",
+ "fee_without_sc", "shipping_cost", "internalid", "externalid", "surcharge"]
+
+ data = []
+ for _, row in df.iterrows():
+ pu_zone = str(row["pu_zone"]) if pd.notna(row["pu_zone"]) else ""
+ dl_zone = str(row["dl_zone"]) if pd.notna(row["dl_zone"]) else ""
+ zone_combo = str(row["zone_combo"]) if pd.notna(row["zone_combo"]) else ""
+ minimum = float(row["minimum"]) if pd.notna(row["minimum"]) else 0
+ maximum = float(row["maximum"]) if pd.notna(row["maximum"]) else 0
+ fee_without_sc = float(row["fee_without_sc"]) if pd.notna(row["fee_without_sc"]) else 0
+ shipping_cost = float(row["shipping_cost"]) if pd.notna(row["shipping_cost"]) else 0
+ surcharge = float(row["surcharge"]) if pd.notna(row["surcharge"]) else 0
+
+ data.append((pu_zone, dl_zone, zone_combo, minimum, maximum,
+ fee_without_sc, shipping_cost, surcharge))
+
+ sql = """INSERT INTO us_am_price
+ (pu_zone, dl_zone, zone_combo, minimum_weight, maximum_weight,
+ fee_without_sc, shipping_cost, surcharge)
+ VALUES (%s, %s, %s, %s, %s, %s, %s, %s)"""
+ self.execute_many(sql, data)
+ print(f" 已导入 {len(data)} 条记录 (price)")
+
+ # postcode表
+ df = pd.read_excel(self.data_dir / "美国卡派-AM.xlsx", sheet_name="postcode_table")
+ df.columns = ["zip_code", "zone"]
+
+ data = []
+ for _, row in df.iterrows():
+ zip_code = str(int(row["zip_code"])) if pd.notna(row["zip_code"]) else ""
+ zone = str(row["zone"]) if pd.notna(row["zone"]) else ""
+ data.append((zip_code, zone))
+
+ sql = "INSERT IGNORE INTO us_am_postcode (zip_code, zone) VALUES (%s, %s)"
+ self.execute_many(sql, data)
+ print(f" 已导入 {len(data)} 条记录 (postcode_table)")
+
+ # ==================== 澳洲数据导入 ====================
+
+ def import_au_eparcel_price(self):
+ """导入澳洲eparcel价格"""
+ print("导入澳洲eparcel价格...")
+ df = pd.read_excel(self.data_dir / "澳洲三大渠道.xlsx", sheet_name="eparcel")
+
+ cols = ["post"] + [str(c) for c in df.columns[1:]]
+ df.columns = cols
+
+ data = []
+ for _, row in df.iterrows():
+ post = str(row["post"]) if pd.notna(row["post"]) else ""
+ row_data = [post]
+ for col in cols[1:]:
+ val = row.get(col, 0)
+ row_data.append(float(val) if pd.notna(val) else 0)
+ data.append(tuple(row_data))
+
+ sql = """INSERT INTO au_eparcel_price
+ (post, weight_0_5, weight_1, weight_2, weight_3, weight_4,
+ weight_5, weight_7, weight_10, weight_15)
+ VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)"""
+ self.execute_many(sql, data)
+ print(f" 已导入 {len(data)} 条记录")
+
+ def import_au_all(self):
+ """导入澳洲toll和allied数据"""
+ print("导入澳洲toll和allied数据...")
+
+ # toll
+ try:
+ df = pd.read_excel(self.data_dir / "澳洲三大渠道.xlsx", sheet_name="toll")
+ df.columns = ["post", "zone_1", "zone_2", "zone_3", "zone_4"]
+
+ data = []
+ for _, row in df.iterrows():
+ post = str(row["post"]) if pd.notna(row["post"]) else ""
+ data.append((post,
+ float(row["zone_1"]) if pd.notna(row["zone_1"]) else 0,
+ float(row["zone_2"]) if pd.notna(row["zone_2"]) else 0,
+ float(row["zone_3"]) if pd.notna(row["zone_3"]) else 0,
+ float(row["zone_4"]) if pd.notna(row["zone_4"]) else 0))
+
+ sql = "INSERT INTO au_toll_price (post, zone_1, zone_2, zone_3, zone_4) VALUES (%s, %s, %s, %s, %s)"
+ self.execute_many(sql, data)
+ print(f" 已导入 {len(data)} 条记录 (toll)")
+ except Exception as e:
+ print(f" toll: {e}")
+
+ # allied
+ try:
+ df = pd.read_excel(self.data_dir / "澳洲三大渠道.xlsx", sheet_name="allied")
+ df.columns = ["post", "zone_1", "zone_2", "zone_3", "zone_4"]
+
+ data = []
+ for _, row in df.iterrows():
+ post = str(row["post"]) if pd.notna(row["post"]) else ""
+ data.append((post,
+ float(row["zone_1"]) if pd.notna(row["zone_1"]) else 0,
+ float(row["zone_2"]) if pd.notna(row["zone_2"]) else 0,
+ float(row["zone_3"]) if pd.notna(row["zone_3"]) else 0,
+ float(row["zone_4"]) if pd.notna(row["zone_4"]) else 0))
+
+ sql = "INSERT INTO au_allied_price (post, zone_1, zone_2, zone_3, zone_4) VALUES (%s, %s, %s, %s, %s)"
+ self.execute_many(sql, data)
+ print(f" 已导入 {len(data)} 条记录 (allied)")
+ except Exception as e:
+ print(f" allied: {e}")
+
+ # ==================== 欧洲数据导入 ====================
+
+ def import_eur_dhl_price(self):
+ """导入欧洲DHL价格"""
+ print("导入欧洲DHL价格...")
+
+ try:
+ df = pd.read_excel(self.data_dir / "欧洲卡派.xlsx", sheet_name="DHL卡派IP报价")
+ df.columns = ["type", "country", "postalcode", "country_postalcode",
+ "ip_1", "ip_2", "ip_3", "ip_4", "ip_5", "ip_6"]
+
+ data = []
+ for _, row in df.iterrows():
+ price_type = str(row["type"]) if pd.notna(row["type"]) else ""
+ country = str(row["country"]) if pd.notna(row["country"]) else ""
+ postalcode = str(row["postalcode"]) if pd.notna(row["postalcode"]) else ""
+ data.append((price_type, country, postalcode,
+ float(row["ip_1"]) if pd.notna(row["ip_1"]) else 0,
+ float(row["ip_2"]) if pd.notna(row["ip_2"]) else 0,
+ float(row["ip_3"]) if pd.notna(row["ip_3"]) else 0,
+ float(row["ip_4"]) if pd.notna(row["ip_4"]) else 0,
+ float(row["ip_5"]) if pd.notna(row["ip_5"]) else 0,
+ float(row["ip_6"]) if pd.notna(row["ip_6"]) else 0))
+
+ sql = """INSERT INTO eur_dhl_price
+ (price_type, country, postalcode, ip_1, ip_2, ip_3, ip_4, ip_5, ip_6)
+ VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s)"""
+ self.execute_many(sql, data)
+ print(f" 已导入 {len(data)} 条记录")
+ except Exception as e:
+ print(f" 欧洲DHL: {e}")
+
+ # ==================== 主函数 ====================
+
+ def import_all(self):
+ """导入所有数据"""
+ print("开始导入数据...")
+
+ # 英国
+ self.import_uk_postcode_zone()
+ self.import_uk_kp_nv_price()
+
+ # 美国
+ self.import_us_fedex_pp_price()
+ self.import_us_fedex_kh_price()
+ self.import_us_fedex_price()
+ self.import_us_giga_price()
+ self.import_us_ceva_price()
+ self.import_us_metro_price()
+ self.import_us_xmiles_zone()
+ self.import_us_am_price()
+
+ # 澳洲
+ self.import_au_eparcel_price()
+ self.import_au_all()
+
+ # 欧洲
+ self.import_eur_dhl_price()
+
+ print("\n数据导入完成!")
+
+
+if __name__ == "__main__":
+ importer = DataImporter()
+ importer.import_all()
diff --git a/sell/logistic_price/uk_price.py b/sell/logistic_price/uk_price.py
index 7a998b0..3c5b6ab 100644
--- a/sell/logistic_price/uk_price.py
+++ b/sell/logistic_price/uk_price.py
@@ -1,11 +1,37 @@
# 英国海运订单费用,返回单个sku的订单费用和订单类型
-def uk_ocean_order_price(packages,k):
+import sys
+sys.path.append(r'D:\workspace\dags\logistics')
+import pandas as pd
+
+import math
+from utils.Package import Package, Package_group
+import re
+def uk_ocean_order_price(packages_dict_str,k):
"""
入参:packages的类型是Package_group,里面包含多个Package,这是一个类,这个类今天在群里发过
入参:k是物流分摊费,也就是k
出参: 订单物流费,订单类型
"""
+
+ packages = Package_group()
+ def extract_number(value):
+ # 提取字符串中的第一个数字
+ match = re.search(r"[-+]?\d*\.\d+|\d+", str(value))
+ return float(match.group()) if match else 0.0
+ packages_dict = eval(packages_dict_str)
+ if len(packages_dict) == 0:
+ return (0,0)
+ for key, package in packages_dict.items():
+ package['长'] = extract_number(package['长'])
+ package['宽'] = extract_number(package['宽'])
+ package['高'] = extract_number(package['高'])
+ package['重量'] = extract_number(package['重量'])
+
+ if package['长'] == 0 or package['宽'] == 0 or package['高'] == 0 or package['重量'] == 0:
+ return (0,0)
+ packages.add_package(Package(key,package['长'], package['宽'], package['高'], package['重量']))
+
# 计算uk经济直达费用
order_fee = 0
express_fee = 0
@@ -20,7 +46,7 @@ def uk_ocean_order_price(packages,k):
base_fee = 3.7/0.359*1.3-k-0.8*package.get_volume_weight(6000)
else:
base_fee = 999999
- if package.fst_size >=100 and package.sed_size >=60 and package.weight >=30000:
+ if package.fst_size >=100 or package.sed_size >=60 or package.weight >=30000:
other_fee1 =45
order_type1 += '大包裹'
@@ -44,4 +70,45 @@ def uk_ocean_order_price(packages,k):
else:
order_fee = ltl_fee
order_type = order_type2
- return max(round(order_fee,2),2), order_type
\ No newline at end of file
+ return max(round(order_fee,2),2), order_type
+if __name__ == '__main__':
+ import sys
+ sys.path.append(r'D:\workspace\dags\logistics')
+
+ sql = """SELECT
+ t1.*,
+ t2.`物流分摊`
+ FROM
+ `dim_erp_sku_package_vol_info`t1 left join ods.stg_bayshop_litfad_sku t2 on t1.erp_sku = t2.SKU
+ where id >=%s AND id <=%s
+ AND uk_price IS NULL
+ AND `物流分摊` IS NOT NULL
+ """
+ from utils.gtools import MySQLconnect
+ from tqdm import tqdm
+ import pandas as pd
+ with MySQLconnect('dwd') as db:
+ for i in tqdm(range(0,150)):
+ # count=0
+ print(i,"开始")
+ dfsql = sql % (i*100000, (i+1)*100000-1)
+ df = pd.read_sql(dfsql, db.engine())
+ if len(df) == 0:
+ continue
+ df[['us_price','logitcs_type']] = df.apply(lambda x: uk_ocean_order_price(x['erp_package_vol'],x['物流分摊']), axis=1, result_type='expand')
+ pd.io.sql.to_sql(df, "temp_update",db.eng, if_exists='replace', index=False )
+ #添加主键ID
+ modifysql = """ALTER TABLE `temp_update` ADD PRIMARY KEY (`id`)
+ """
+ db.cur.execute(modifysql)
+
+ # se = [tuple([round(x['us_price'],2),x['id']]) for y,x in df.iterrows()]
+ update_sql = """
+ UPDATE dim_erp_sku_package_vol_info AS target
+ JOIN temp_update AS src
+ ON target.id = src.id -- 根据主键关联
+ SET target.uk_price = src.us_price;"""
+ # db.cur.executemany(update_sql, se)
+ db.cur.execute(update_sql)
+ db.con.commit()
+ print(i,"结束")
\ No newline at end of file
diff --git a/sell/logistic_price/us_price.py b/sell/logistic_price/us_price.py
index 36689e1..9bb4806 100644
--- a/sell/logistic_price/us_price.py
+++ b/sell/logistic_price/us_price.py
@@ -1,6 +1,11 @@
+import sys
+sys.path.append(r'D:\workspace\dags\logistics')
import pandas as pd
+
import math
-express_price = pd.read_excel(r'D:\test\logistics\data\售价尾端价格.xlsx', sheet_name='Sheet1')
+from utils.Package import Package, Package_group
+import re
+express_price = pd.read_excel(r'D:\workspace\dags\logistics\data\售价尾端价格.xlsx', sheet_name='Sheet1')
key_column = express_price.iloc[:, 8] # 第 I 列
value_column = express_price.iloc[:, 9] # 第 J 列
small_column = express_price.iloc[:, 10] # 第 K 列
@@ -9,7 +14,26 @@ air_small_dict = dict(zip(key_column, small_column))
air_big_dict = dict(zip(key_column, big_column))
# 转换成字典
ocean_price_dict = dict(zip(key_column, value_column))
-def ocean_order_price(packages):
+def ocean_order_price(packages_dict_str):
+
+ packages = Package_group()
+ def extract_number(value):
+ # 提取字符串中的第一个数字
+ match = re.search(r"[-+]?\d*\.\d+|\d+", str(value))
+ return float(match.group()) if match else 0.0
+ packages_dict = eval(packages_dict_str)
+ if len(packages_dict) == 0:
+ return (0,0)
+ for key, package in packages_dict.items():
+ package['长'] = extract_number(package['长'])
+ package['宽'] = extract_number(package['宽'])
+ package['高'] = extract_number(package['高'])
+ package['重量'] = extract_number(package['重量'])
+
+ if package['长'] == 0 or package['宽'] == 0 or package['高'] == 0 or package['重量'] == 0:
+ return (0,0)
+ packages.add_package(Package(key,package['长'], package['宽'], package['高'], package['重量']))
+
express_fee = 0 # 快递基础费
long_fee = 0 # 超长费
weight_fee = 0 # 超重费
@@ -19,7 +43,8 @@ def ocean_order_price(packages):
express_type_length = ''
for package in packages:
for key, value in ocean_price_dict.items():
- if package.weight <=key:
+
+ if max(package.get_volume_weight(8500)*1000, package.weight) <=key:
express_fee+=value
break
if package.fst_size>=116 or package.sed_size>=71 or package.girth>=251:
@@ -32,6 +57,7 @@ def ocean_order_price(packages):
if package.fst_size>=238 or package.girth>=315:
big_fee+=61.6
express_type_length ="大包裹"
+ express_fee = 9999999 if express_fee ==0 else express_fee
express_fee = express_fee + long_fee + weight_fee + big_fee
express_type = express_type_length + express_type_weight
@@ -127,4 +153,34 @@ def air_order_price(packages):
else:
express_fee+=(((min(max(package.density,37),337)*0.093+27.7-1.08)/6+0.65-1.06)*package.get_volume_weight(8500))/0.45+price
express_type='FEDEX'
- return express_fee, express_type
\ No newline at end of file
+ return express_fee, express_type
+
+if __name__ == '__main__':
+ sql = "SELECT * FROM `dim_erp_sku_package_vol_info` where id >=%s AND id <=%s AND logis_type IS NULL"
+ from utils.gtools import MySQLconnect
+ from tqdm import tqdm
+ with MySQLconnect('dwd') as db:
+ for i in tqdm(range(1,150)):
+ # count=0
+ print(i,"开始")
+ dfsql = sql % (i*100000, (i+1)*100000-1)
+ df = pd.read_sql(dfsql, db.engine())
+ if len(df) == 0:
+ continue
+ df[['us_price','logitcs_type']] = df.apply(lambda x: ocean_order_price(x['erp_package_vol']), axis=1, result_type='expand')
+ pd.io.sql.to_sql(df, "temp_update",db.eng, if_exists='replace', index=False )
+ #添加主键ID
+ modifysql = """ALTER TABLE `temp_update` ADD PRIMARY KEY (`id`)
+ """
+ db.cur.execute(modifysql)
+
+ # se = [tuple([round(x['us_price'],2),x['id']]) for y,x in df.iterrows()]
+ update_sql = """
+ UPDATE dim_erp_sku_package_vol_info AS target
+ JOIN temp_update AS src
+ ON target.id = src.id -- 根据主键关联
+ SET target.logis_type = src.logitcs_type;"""
+ # db.cur.executemany(update_sql, se)
+ db.cur.execute(update_sql)
+ db.con.commit()
+ print(i,"结束")
\ No newline at end of file
diff --git a/sql/create_tables.sql b/sql/create_tables.sql
new file mode 100644
index 0000000..be1ff04
--- /dev/null
+++ b/sql/create_tables.sql
@@ -0,0 +1,337 @@
+-- 物流费用计算系统数据库表结构
+-- 创建数据库: logistics
+
+-- ============================================
+-- 物流公司配置表
+-- ============================================
+CREATE TABLE IF NOT EXISTS logistics_company (
+ id INT AUTO_INCREMENT PRIMARY KEY,
+ company_code VARCHAR(50) NOT NULL COMMENT '公司代码',
+ company_name VARCHAR(100) NOT NULL COMMENT '公司名称',
+ country VARCHAR(10) NOT NULL COMMENT '国家代码: US, UK, AU, DE等',
+ logistics_type VARCHAR(20) NOT NULL COMMENT '物流类型: EXPRESS, COURIER, OCEAN, AIR',
+ port VARCHAR(20) DEFAULT 'DEFAULT' COMMENT '港口: DEFAULT, WEST, EAST等',
+ currency VARCHAR(10) DEFAULT 'USD' COMMENT '货币',
+ active TINYINT DEFAULT 1 COMMENT '是否启用: 0-禁用, 1-启用',
+ created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
+ updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ UNIQUE KEY uk_company_code (company_code)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='物流公司配置表';
+
+-- ============================================
+-- 英国物流价格表
+-- ============================================
+
+-- 英国卡派-分区表
+CREATE TABLE IF NOT EXISTS uk_postcode_zone (
+ id INT AUTO_INCREMENT PRIMARY KEY,
+ postcode_prefix VARCHAR(10) NOT NULL COMMENT '邮编前缀',
+ zone VARCHAR(10) NOT NULL COMMENT '分区',
+ is_remote TINYINT DEFAULT 0 COMMENT '是否偏远: 0-否, 1-是',
+ UNIQUE KEY uk_postcode (postcode_prefix)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='英国邮编分区表';
+
+-- 英国卡派-运费表
+CREATE TABLE IF NOT EXISTS uk_kp_nv_price (
+ id INT AUTO_INCREMENT PRIMARY KEY,
+ zone VARCHAR(10) NOT NULL COMMENT '分区',
+ tuopan INT NOT NULL COMMENT '托盘数',
+ fee DECIMAL(10,2) NOT NULL COMMENT '运费',
+ INDEX idx_zone (zone)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='英国卡派NV运费表';
+
+-- ============================================
+-- 美国物流价格表
+-- ============================================
+
+-- 美国邮编分区表
+CREATE TABLE IF NOT EXISTS us_postcode_zone (
+ id INT AUTO_INCREMENT PRIMARY KEY,
+ postcode VARCHAR(5) NOT NULL COMMENT '邮编(5位)',
+ port VARCHAR(20) DEFAULT 'west' COMMENT '港口: west, east',
+ zone VARCHAR(10) COMMENT '分区',
+ remote_type INT DEFAULT 0 COMMENT '偏远类型: 0-非偏远, 1-偏远, 2-超偏远, 3-超超偏远',
+ INDEX idx_postcode (postcode)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='美国邮编分区表';
+
+-- 美国快递-邮差小马 价格表
+CREATE TABLE IF NOT EXISTS us_fedex_pp_price (
+ id INT AUTO_INCREMENT PRIMARY KEY,
+ lbs INT NOT NULL COMMENT '重量(磅)',
+ zone_2 DECIMAL(10,2) COMMENT '2区价格',
+ zone_3 DECIMAL(10,2) COMMENT '3区价格',
+ zone_4 DECIMAL(10,2) COMMENT '4区价格',
+ zone_5 DECIMAL(10,2) COMMENT '5区价格',
+ zone_6 DECIMAL(10,2) COMMENT '6区价格',
+ zone_7 DECIMAL(10,2) COMMENT '7区价格',
+ zone_8 DECIMAL(10,2) COMMENT '8区价格',
+ INDEX idx_lbs (lbs)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='美国Fedex邮差小马价格表';
+
+-- 美国快递-金宏亚 价格表
+CREATE TABLE IF NOT EXISTS us_fedex_kh_price (
+ id INT AUTO_INCREMENT PRIMARY KEY,
+ lbs INT NOT NULL COMMENT '重量(磅)',
+ zone_2 DECIMAL(10,2) COMMENT '2区价格',
+ zone_3 DECIMAL(10,2) COMMENT '3区价格',
+ zone_4 DECIMAL(10,2) COMMENT '4区价格',
+ zone_5 DECIMAL(10,2) COMMENT '5区价格',
+ zone_6 DECIMAL(10,2) COMMENT '6区价格',
+ zone_7 DECIMAL(10,2) COMMENT '7区价格',
+ zone_8 DECIMAL(10,2) COMMENT '8区价格',
+ INDEX idx_lbs (lbs)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='美国Fedex金宏亚价格表';
+
+-- 美国快递-FEDEX 价格表
+CREATE TABLE IF NOT EXISTS us_fedex_price (
+ id INT AUTO_INCREMENT PRIMARY KEY,
+ lbs INT NOT NULL COMMENT '重量(磅)',
+ zone_2 DECIMAL(10,2) COMMENT '2区价格',
+ zone_3 DECIMAL(10,2) COMMENT '3区价格',
+ zone_4 DECIMAL(10,2) COMMENT '4区价格',
+ zone_5 DECIMAL(10,2) COMMENT '5区价格',
+ zone_6 DECIMAL(10,2) COMMENT '6区价格',
+ zone_7 DECIMAL(10,2) COMMENT '7区价格',
+ zone_8 DECIMAL(10,2) COMMENT '8区价格',
+ INDEX idx_lbs (lbs)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='美国FEDEX价格表';
+
+-- 美国卡派-GIGA 价格表
+CREATE TABLE IF NOT EXISTS us_giga_price (
+ id INT AUTO_INCREMENT PRIMARY KEY,
+ zip_code VARCHAR(5) NOT NULL COMMENT '邮编',
+ delivery_warehouse VARCHAR(50) COMMENT '仓库',
+ general_area VARCHAR(50) COMMENT '地区',
+ fee_type VARCHAR(20) COMMENT '费用类型',
+ zone VARCHAR(10) COMMENT '分区',
+ local_pickup_fee DECIMAL(10,2) COMMENT '本地取货费',
+ warehouse_handling_fee DECIMAL(10,2) COMMENT '仓库操作费',
+ delivery_fee_rate DECIMAL(10,2) COMMENT '配送费率',
+ additional_delivery_fee DECIMAL(10,2) COMMENT '额外配送费',
+ assembly_fee DECIMAL(10,2) COMMENT '装配费',
+ INDEX idx_zip (zip_code)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='美国GIGA价格表';
+
+-- 美国卡派-CEVA 价格表
+CREATE TABLE IF NOT EXISTS us_ceva_price (
+ id INT AUTO_INCREMENT PRIMARY KEY,
+ ceva_weight INT NOT NULL COMMENT 'CEVA重量',
+ zone_ca DECIMAL(10,2) COMMENT 'CA区价格',
+ zone_wa DECIMAL(10,2) COMMENT 'WA区价格',
+ zone_or DECIMAL(10,2) COMMENT 'OR区价格',
+ zone_nv DECIMAL(10,2) COMMENT 'NV区价格',
+ zone_az DECIMAL(10,2) COMMENT 'AZ区价格',
+ zone_co DECIMAL(10,2) COMMENT 'CO区价格',
+ zone_ut DECIMAL(10,2) COMMENT 'UT区价格',
+ zone_nm DECIMAL(10,2) COMMENT 'NM区价格',
+ remote_area_surcharge DECIMAL(10,2) COMMENT '偏远地区附加费',
+ INDEX idx_weight (ceva_weight)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='美国CEVA价格表';
+
+-- 美国卡派-CEVA 邮编分区表
+CREATE TABLE IF NOT EXISTS us_ceva_zone (
+ id INT AUTO_INCREMENT PRIMARY KEY,
+ postal_code VARCHAR(5) NOT NULL COMMENT '邮编',
+ state VARCHAR(20) COMMENT '州',
+ beyond_zone VARCHAR(10) COMMENT '超出分区',
+ remote_type VARCHAR(20) DEFAULT 'standard' COMMENT '偏远类型: standard, remote',
+ INDEX idx_postal (postal_code)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='美国CEVA邮编分区表';
+
+-- 美国卡派-CEVA 分区表
+CREATE TABLE IF NOT EXISTS us_ceva_zone_grade (
+ id INT AUTO_INCREMENT PRIMARY KEY,
+ to_state VARCHAR(20) NOT NULL COMMENT '目的地州',
+ ca DECIMAL(10,2) COMMENT 'CA分区',
+ wa DECIMAL(10,2) COMMENT 'WA分区',
+ INDEX idx_state (to_state)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='美国CEVA分区等级表';
+
+-- 美国卡派-Metro 价格表
+CREATE TABLE IF NOT EXISTS us_metro_price (
+ id INT AUTO_INCREMENT PRIMARY KEY,
+ origins VARCHAR(20) NOT NULL COMMENT '出发地',
+ zone_1l DECIMAL(10,2) COMMENT 'Zone 1L价格',
+ zone_2l DECIMAL(10,2) COMMENT 'Zone 2L价格',
+ zone_3l DECIMAL(10,2) COMMENT 'Zone 3L价格',
+ zone_4l DECIMAL(10,2) COMMENT 'Zone 4L价格',
+ zone_5l DECIMAL(10,2) COMMENT 'Zone 5L价格',
+ zone_6l DECIMAL(10,2) COMMENT 'Zone 6L价格',
+ zone_7l DECIMAL(10,2) COMMENT 'Zone 7L价格',
+ zone_8l DECIMAL(10,2) COMMENT 'Zone 8L价格',
+ zone_9l DECIMAL(10,2) COMMENT 'Zone 9L价格',
+ INDEX idx_origins (origins)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='美国Metro价格表';
+
+-- 美国卡派-Metro 邮编分区表
+CREATE TABLE IF NOT EXISTS us_metro_zone (
+ id INT AUTO_INCREMENT PRIMARY KEY,
+ zip_code VARCHAR(5) NOT NULL COMMENT '邮编',
+ new_zone_name VARCHAR(20) COMMENT '新分区名',
+ INDEX idx_zip (zip_code)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='美国Metro邮编分区表';
+
+-- 美国卡派-Metro 偏远表
+CREATE TABLE IF NOT EXISTS us_metro_remote (
+ id INT AUTO_INCREMENT PRIMARY KEY,
+ zip_code VARCHAR(5) NOT NULL COMMENT '邮编',
+ area_type VARCHAR(50) COMMENT '区域类型',
+ INDEX idx_zip (zip_code)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='美国Metro偏远表';
+
+-- 美国卡派-XMILES 邮编表
+CREATE TABLE IF NOT EXISTS us_xmiles_zone (
+ id INT AUTO_INCREMENT PRIMARY KEY,
+ postcode VARCHAR(5) NOT NULL COMMENT '邮编',
+ area VARCHAR(20) COMMENT '地区',
+ INDEX idx_postcode (postcode)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='美国XMILES邮编分区表';
+
+-- 美国卡派-AM 价格表
+CREATE TABLE IF NOT EXISTS us_am_price (
+ id INT AUTO_INCREMENT PRIMARY KEY,
+ pu_zone VARCHAR(5) NOT NULL COMMENT 'PU区',
+ dl_zone VARCHAR(5) NOT NULL COMMENT 'DL区',
+ zone_combo VARCHAR(10) NOT NULL COMMENT '分区组合',
+ minimum_weight DECIMAL(10,2) NOT NULL COMMENT '最小重量',
+ maximum_weight DECIMAL(10,2) NOT NULL COMMENT '最大重量',
+ fee_without_sc DECIMAL(10,2) COMMENT '无附加费价格',
+ shipping_cost DECIMAL(10,2) COMMENT '运费',
+ surcharge DECIMAL(10,2) DEFAULT 0 COMMENT '附加费',
+ INDEX idx_zone_combo (zone_combo)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='美国AM卡派价格表';
+
+-- 美国卡派-AM 邮编表
+CREATE TABLE IF NOT EXISTS us_am_postcode (
+ id INT AUTO_INCREMENT PRIMARY KEY,
+ zip_code VARCHAR(5) NOT NULL COMMENT '邮编',
+ zone VARCHAR(5) NOT NULL COMMENT '分区',
+ INDEX idx_zip (zip_code)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='美国AM卡派邮编表';
+
+-- ============================================
+-- 澳洲物流价格表
+-- ============================================
+
+-- 澳洲eparcel价格表
+CREATE TABLE IF NOT EXISTS au_eparcel_price (
+ id INT AUTO_INCREMENT PRIMARY KEY,
+ post VARCHAR(20) NOT NULL COMMENT '邮寄方式',
+ weight_0_5 DECIMAL(10,2) COMMENT '0.5kg价格',
+ weight_1 DECIMAL(10,2) COMMENT '1kg价格',
+ weight_2 DECIMAL(10,2) COMMENT '2kg价格',
+ weight_3 DECIMAL(10,2) COMMENT '3kg价格',
+ weight_4 DECIMAL(10,2) COMMENT '4kg价格',
+ weight_5 DECIMAL(10,2) COMMENT '5kg价格',
+ weight_7 DECIMAL(10,2) COMMENT '7kg价格',
+ weight_10 DECIMAL(10,2) COMMENT '10kg价格',
+ weight_15 DECIMAL(10,2) COMMENT '15kg价格',
+ INDEX idx_post (post)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='澳洲eparcel价格表';
+
+-- 澳洲eparcel邮编表
+CREATE TABLE IF NOT EXISTS au_eparcel_zone (
+ id INT AUTO_INCREMENT PRIMARY KEY,
+ postcode VARCHAR(10) NOT NULL COMMENT '邮编',
+ zone VARCHAR(10) COMMENT '分区',
+ INDEX idx_postcode (postcode)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='澳洲eparcel邮编表';
+
+-- 澳洲toll价格表
+CREATE TABLE IF NOT EXISTS au_toll_price (
+ id INT AUTO_INCREMENT PRIMARY KEY,
+ post VARCHAR(20) NOT NULL COMMENT '邮寄方式',
+ zone_1 DECIMAL(10,2) COMMENT '1区价格',
+ zone_2 DECIMAL(10,2) COMMENT '2区价格',
+ zone_3 DECIMAL(10,2) COMMENT '3区价格',
+ zone_4 DECIMAL(10,2) COMMENT '4区价格',
+ INDEX idx_post (post)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='澳洲toll价格表';
+
+-- 澳洲toll邮编表
+CREATE TABLE IF NOT EXISTS au_toll_zone (
+ id INT AUTO_INCREMENT PRIMARY KEY,
+ postcode VARCHAR(10) NOT NULL COMMENT '邮编',
+ zone VARCHAR(10) COMMENT '分区',
+ INDEX idx_postcode (postcode)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='澳洲toll邮编表';
+
+-- 澳洲toll偏远表
+CREATE TABLE IF NOT EXISTS au_toll_remote (
+ id INT AUTO_INCREMENT PRIMARY KEY,
+ postcode VARCHAR(10) NOT NULL COMMENT '邮编',
+ remote_type VARCHAR(20) COMMENT '偏远类型',
+ INDEX idx_postcode (postcode)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='澳洲toll偏远表';
+
+-- 澳洲allied价格表
+CREATE TABLE IF NOT EXISTS au_allied_price (
+ id INT AUTO_INCREMENT PRIMARY KEY,
+ post VARCHAR(20) NOT NULL COMMENT '邮寄方式',
+ zone_1 DECIMAL(10,2) COMMENT '1区价格',
+ zone_2 DECIMAL(10,2) COMMENT '2区价格',
+ zone_3 DECIMAL(10,2) COMMENT '3区价格',
+ zone_4 DECIMAL(10,2) COMMENT '4区价格',
+ INDEX idx_post (post)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='澳洲allied价格表';
+
+-- 澳洲allied邮编表
+CREATE TABLE IF NOT EXISTS au_allied_zone (
+ id INT AUTO_INCREMENT PRIMARY KEY,
+ postcode VARCHAR(10) NOT NULL COMMENT '邮编',
+ zone VARCHAR(10) COMMENT '分区',
+ remote_zone VARCHAR(10) COMMENT '偏远分区',
+ INDEX idx_postcode (postcode)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='澳洲allied邮编表';
+
+-- 澳洲allied偏远表
+CREATE TABLE IF NOT EXISTS au_allied_remote (
+ id INT AUTO_INCREMENT PRIMARY KEY,
+ postcode VARCHAR(10) NOT NULL COMMENT '邮编',
+ remote_type VARCHAR(20) COMMENT '偏远类型',
+ INDEX idx_postcode (postcode)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='澳洲allied偏远表';
+
+-- ============================================
+-- 欧洲物流价格表
+-- ============================================
+
+-- 欧洲卡派-DHL价格表
+CREATE TABLE IF NOT EXISTS eur_dhl_price (
+ id INT AUTO_INCREMENT PRIMARY KEY,
+ price_type VARCHAR(20) NOT NULL COMMENT '价格类型',
+ country VARCHAR(50) NOT NULL COMMENT '国家',
+ postalcode VARCHAR(10) COMMENT '邮编',
+ ip_1 DECIMAL(10,2) COMMENT '1IP价格',
+ ip_2 DECIMAL(10,2) COMMENT '2IP价格',
+ ip_3 DECIMAL(10,2) COMMENT '3IP价格',
+ ip_4 DECIMAL(10,2) COMMENT '4IP价格',
+ ip_5 DECIMAL(10,2) COMMENT '5IP价格',
+ ip_6 DECIMAL(10,2) COMMENT '6IP价格',
+ INDEX idx_country (country)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='欧洲DHL卡派价格表';
+
+-- ============================================
+-- 物流公司配置数据
+-- ============================================
+INSERT INTO logistics_company (company_code, company_name, country, logistics_type, port, currency) VALUES
+-- 英国
+('UK_DPD', '智谷-DPD', 'UK', 'EXPRESS', 'DEFAULT', 'GBP'),
+('UK_BIG', '智谷-大件', 'UK', 'COURIER', 'DEFAULT', 'GBP'),
+('UK_KPZG', '海GB-卡派', 'UK', 'COURIER', 'DEFAULT', 'GBP'),
+('UK_KPNV', '卡派-NV', 'UK', 'COURIER', 'DEFAULT', 'GBP'),
+-- 美国
+('US_FEDEX_PP', 'Fedex-邮差小马', 'US', 'EXPRESS', 'WEST', 'USD'),
+('US_FEDEX_KH', 'Fedex-金宏亚', 'US', 'EXPRESS', 'WEST', 'USD'),
+('US_FEDEX_HOME', 'Fedex-HOME', 'US', 'EXPRESS', 'WEST', 'USD'),
+('US_FEDEX_GROUND', 'Fedex-GROUND', 'US', 'EXPRESS', 'WEST', 'USD'),
+('US_GIGA', '大健-GIGA', 'US', 'COURIER', 'DEFAULT', 'USD'),
+('US_CEVA', '大健-CEVA', 'US', 'COURIER', 'DEFAULT', 'USD'),
+('US_METRO', 'Metro-SAIR', 'US', 'COURIER', 'DEFAULT', 'USD'),
+('US_XMILES', 'XMILES-SAIR', 'US', 'COURIER', 'DEFAULT', 'USD'),
+('US_AM_WEST', 'AM-美西', 'US', 'COURIER', 'WEST', 'USD'),
+('US_AM_EAST', 'AM-美东', 'US', 'COURIER', 'EAST', 'USD'),
+-- 澳洲
+('AU_EPARCEL', 'AU-eparcel', 'AU', 'EXPRESS', 'DEFAULT', 'AUD'),
+('AU_TOLL', 'AU-Toll', 'AU', 'COURIER', 'DEFAULT', 'AUD'),
+('AU_ALLIED', 'AU-Allied', 'AU', 'COURIER', 'DEFAULT', 'AUD');
diff --git a/tests/test_logistics_service.py b/tests/test_logistics_service.py
new file mode 100644
index 0000000..b360a82
--- /dev/null
+++ b/tests/test_logistics_service.py
@@ -0,0 +1,176 @@
+"""物流费用计算服务测试文件"""
+import pytest
+from logistics_service import LogisticsService
+from logisticsClass.logisticsBaseClass import PortType
+
+
+class TestLogisticsService:
+ """物流服务测试类"""
+
+ def test_detect_country_uk(self):
+ """测试英国邮编识别"""
+ assert LogisticsService._detect_country("PA2 9BF") == "UK"
+ assert LogisticsService._detect_country("SW1A 1AA") == "UK"
+ assert LogisticsService._detect_country("BT1 1AA") == "UK"
+
+ def test_detect_country_us(self):
+ """测试美国邮编识别"""
+ assert LogisticsService._detect_country("10001") == "US"
+ assert LogisticsService._detect_country("10001-1234") == "US"
+ assert LogisticsService._detect_country("90210") == "US"
+
+ def test_detect_country_au(self):
+ """测试澳洲邮编识别"""
+ assert LogisticsService._detect_country("2000") == "AU"
+ assert LogisticsService._detect_country("3000") == "AU"
+
+ def test_parse_packages(self):
+ """测试包裹解析"""
+ packages_data = [
+ {"name": "包裹1", "length": 63, "width": 59, "height": 48, "weight": 8000},
+ {"name": "包裹2", "length": 50, "width": 40, "height": 30, "weight": 5000},
+ ]
+ packages = LogisticsService._parse_packages(packages_data)
+
+ assert len(packages.packages) == 2
+ assert packages.packages[0].fst_size == 63
+ assert packages.packages[1].fst_size == 50
+
+ def test_parse_packages_default_name(self):
+ """测试包裹解析-默认名称"""
+ packages_data = [
+ {"length": 63, "width": 59, "height": 48, "weight": 8000},
+ ]
+ packages = LogisticsService._parse_packages(packages_data)
+
+ assert len(packages.packages) == 1
+
+ def test_calculate_uk(self):
+ """测试英国物流费用计算"""
+ packages = [{"length": 63, "width": 59, "height": 48, "weight": 8000}]
+ result = LogisticsService.calculate_uk("PA2 9BF", packages)
+
+ assert result["country"] == "UK"
+ assert result["postcode"] == "PA2 9BF"
+ assert result["optimal_channel"] is not None
+ assert result["optimal_fee"] is not None
+ assert result["currency"] == "GBP"
+ assert len(result["all_channels"]) > 0
+
+ def test_calculate_uk_london(self):
+ """测试英国伦敦邮编"""
+ packages = [{"length": 30, "width": 20, "height": 10, "weight": 2000}]
+ result = LogisticsService.calculate_uk("SW1A 1AA", packages)
+
+ assert result["country"] == "UK"
+ assert result["optimal_channel"] is not None
+
+ def test_calculate_us(self):
+ """测试美国物流费用计算"""
+ packages = [{"length": 63, "width": 59, "height": 48, "weight": 8000}]
+ result = LogisticsService.calculate_us("10001", packages)
+
+ assert result["country"] == "US"
+ assert result["postcode"] == "10001"
+ assert result["optimal_channel"] is not None
+ assert result["optimal_fee"] is not None
+ assert result["currency"] == "USD"
+
+ def test_calculate_us_west(self):
+ """测试美国美西邮编"""
+ packages = [{"length": 50, "width": 40, "height": 30, "weight": 5000}]
+ result = LogisticsService.calculate_us("90001", packages)
+
+ assert result["country"] == "US"
+ assert result["optimal_channel"] is not None
+
+ def test_calculate_auto_detect(self):
+ """测试自动识别国家"""
+ packages = [{"length": 63, "width": 59, "height": 48, "weight": 8000}]
+
+ # 英国
+ result_uk = LogisticsService.calculate("PA2 9BF", packages)
+ assert result_uk["country"] == "UK"
+
+ # 美国
+ result_us = LogisticsService.calculate("10001", packages)
+ assert result_us["country"] == "US"
+
+ def test_calculate_multiple_packages(self):
+ """测试多包裹计算"""
+ packages = [
+ {"length": 63, "width": 59, "height": 48, "weight": 8000},
+ {"length": 50, "width": 40, "height": 30, "weight": 5000},
+ {"length": 40, "width": 30, "height": 20, "weight": 3000},
+ ]
+ result = LogisticsService.calculate_uk("PA2 9BF", packages)
+
+ assert result["package_count"] == 3
+ assert result["total_weight"] == 16.0 # kg
+
+ def test_get_company_detail(self):
+ """测试获取指定物流公司详情"""
+ packages = [{"length": 63, "width": 59, "height": 48, "weight": 8000}]
+ detail = LogisticsService.get_company_detail("PA2 9BF", packages, "智谷-DPD")
+
+ assert detail["company"] == "智谷-DPD"
+ assert detail["currency"] == "GBP"
+ assert "detail" in detail
+ assert "total" in detail
+
+ def test_invalid_postcode(self):
+ """测试无效邮编"""
+ packages = [{"length": 63, "width": 59, "height": 48, "weight": 8000}]
+
+ with pytest.raises(ValueError):
+ LogisticsService.calculate("invalid", packages)
+
+ def test_result_structure(self):
+ """测试返回结果结构"""
+ packages = [{"length": 63, "width": 59, "height": 48, "weight": 8000}]
+ result = LogisticsService.calculate_uk("PA2 9BF", packages)
+
+ # 验证必需字段
+ required_fields = [
+ "country", "postcode", "optimal_channel", "optimal_fee",
+ "currency", "all_channels", "package_count", "total_weight"
+ ]
+ for field in required_fields:
+ assert field in result, f"缺少字段: {field}"
+
+ # 验证渠道详情结构
+ for company, info in result["all_channels"].items():
+ assert "fee" in info
+ assert "currency" in info
+ assert "type" in info
+ assert "available" in info
+
+
+class TestPackageCalculation:
+ """包裹计算测试类"""
+
+ def test_small_package(self):
+ """测试小包裹"""
+ packages = [{"length": 20, "width": 15, "height": 10, "weight": 500}]
+ result = LogisticsService.calculate_uk("SW1A 1AA", packages)
+
+ assert result["optimal_fee"] is not None
+
+ def test_large_package(self):
+ """测试大包裹"""
+ packages = [{"length": 200, "width": 100, "height": 80, "weight": 50000}]
+ result = LogisticsService.calculate_uk("PA2 9BF", packages)
+
+ # 大包裹可能被某些渠道拒绝
+ assert result is not None
+
+ def test_heavy_package(self):
+ """测试重包裹"""
+ packages = [{"length": 50, "width": 40, "height": 30, "weight": 80000}]
+ result = LogisticsService.calculate_us("10001", packages)
+
+ assert result is not None
+
+
+if __name__ == "__main__":
+ pytest.main([__file__, "-v"])
diff --git a/utils/config_manager.py b/utils/config_manager.py
new file mode 100644
index 0000000..94a97cd
--- /dev/null
+++ b/utils/config_manager.py
@@ -0,0 +1,53 @@
+"""配置管理模块"""
+import json
+import os
+from pathlib import Path
+from typing import Any, Dict
+
+
+class ConfigManager:
+ """配置管理器"""
+
+ _instance = None
+ _config: Dict[str, Any] = {}
+
+ def __new__(cls):
+ if cls._instance is None:
+ cls._instance = super().__new__(cls)
+ return cls._instance
+
+ def __init__(self):
+ if not self._config:
+ self._load_config()
+
+ def _load_config(self):
+ """加载配置文件"""
+ config_dir = Path(__file__).parent.parent / "config"
+ config_file = config_dir / "database.json"
+
+ if not config_file.exists():
+ raise FileNotFoundError(f"配置文件不存在: {config_file}")
+
+ with open(config_file, "r", encoding="utf-8") as f:
+ self._config = json.load(f)
+
+ def get(self, key: str, default: Any = None) -> Any:
+ """获取配置项"""
+ keys = key.split(".")
+ value = self._config
+ for k in keys:
+ if isinstance(value, dict):
+ value = value.get(k)
+ if value is None:
+ return default
+ else:
+ return default
+ return value
+
+ def get_database_config(self) -> Dict[str, Any]:
+ """获取数据库配置"""
+ return self._config.get("database", {})
+
+
+# 全局配置实例
+config = ConfigManager()
diff --git a/utils/gtools.py b/utils/gtools.py
index c55a174..bcf81cd 100644
--- a/utils/gtools.py
+++ b/utils/gtools.py
@@ -1,13 +1,22 @@
import pymysql
from sqlalchemy import create_engine
+from utils.config_manager import config
class MySQLconnect():
- def __init__(self, dbname: str):
- if isinstance(dbname, str):
- self.dbname = dbname
- self.host = '192.168.100.33'
- else:
+ def __init__(self, dbname: str = None):
+ db_config = config.get_database_config()
+ self.host = db_config.get("host", "192.168.100.33")
+ self.port = db_config.get("port", 3306)
+ self.user = db_config.get("username", "zhenggantian")
+ self.password = db_config.get("password", "123456")
+ self.dbname = dbname or db_config.get("database", "logistics")
+ self.charset = db_config.get("charset", "utf8")
+ self.pool_size = db_config.get("pool_size", 10)
+ self.max_overflow = db_config.get("max_overflow", 5)
+ self.pool_recycle = db_config.get("pool_recycle", 3600)
+
+ if not isinstance(self.dbname, str):
raise TypeError("dbname must be a string")
def __enter__(self):
@@ -24,9 +33,19 @@ class MySQLconnect():
raise
def engine(self):
- return create_engine("mysql+pymysql://zhenggantian:123456@" + self.host + f":3306/{self.dbname}",
- pool_size=10, max_overflow=5, pool_recycle=3600)
+ return create_engine(
+ f"mysql+pymysql://{self.user}:{self.password}@{self.host}:{self.port}/{self.dbname}",
+ pool_size=self.pool_size,
+ max_overflow=self.max_overflow,
+ pool_recycle=self.pool_recycle
+ )
def connect(self):
- return pymysql.connect(host=self.host, port=3306, database=self.dbname, user="zhenggantian", password="123456",
- charset="utf8")
+ return pymysql.connect(
+ host=self.host,
+ port=self.port,
+ database=self.dbname,
+ user=self.user,
+ password=self.password,
+ charset=self.charset
+ )
diff --git a/~$单包裹SKU售价分析1.xlsx b/~$单包裹SKU售价分析1.xlsx
deleted file mode 100644
index 234494c..0000000
--- a/~$单包裹SKU售价分析1.xlsx
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:e4ba04959837c27019a2349015543802439e152ddc4baf4e8c7b9d2b483362a8
-size 165
diff --git a/~$表头更新方案.xlsx b/~$表头更新方案.xlsx
deleted file mode 100644
index 234494c..0000000
--- a/~$表头更新方案.xlsx
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:e4ba04959837c27019a2349015543802439e152ddc4baf4e8c7b9d2b483362a8
-size 165
diff --git a/拦截数据/~$1-3月利润分段.xlsx b/拦截数据/~$1-3月利润分段.xlsx
deleted file mode 100644
index 234494c..0000000
--- a/拦截数据/~$1-3月利润分段.xlsx
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:e4ba04959837c27019a2349015543802439e152ddc4baf4e8c7b9d2b483362a8
-size 165
diff --git a/拦截数据/~$batch_release.xlsx b/拦截数据/~$batch_release.xlsx
deleted file mode 100644
index 234494c..0000000
--- a/拦截数据/~$batch_release.xlsx
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:e4ba04959837c27019a2349015543802439e152ddc4baf4e8c7b9d2b483362a8
-size 165
diff --git a/拦截数据/~$product_property_data.xlsx b/拦截数据/~$product_property_data.xlsx
deleted file mode 100644
index 234494c..0000000
--- a/拦截数据/~$product_property_data.xlsx
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:e4ba04959837c27019a2349015543802439e152ddc4baf4e8c7b9d2b483362a8
-size 165
diff --git a/拦截数据/~$工作日报-文雪茜.xlsx b/拦截数据/~$工作日报-文雪茜.xlsx
deleted file mode 100644
index 234494c..0000000
--- a/拦截数据/~$工作日报-文雪茜.xlsx
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:e4ba04959837c27019a2349015543802439e152ddc4baf4e8c7b9d2b483362a8
-size 165
diff --git a/拦截数据/~$拦截总表.xlsx b/拦截数据/~$拦截总表.xlsx
deleted file mode 100644
index 234494c..0000000
--- a/拦截数据/~$拦截总表.xlsx
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:e4ba04959837c27019a2349015543802439e152ddc4baf4e8c7b9d2b483362a8
-size 165
diff --git a/拦截数据/~$拦截订单登记明细.xlsx b/拦截数据/~$拦截订单登记明细.xlsx
deleted file mode 100644
index 234494c..0000000
--- a/拦截数据/~$拦截订单登记明细.xlsx
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:e4ba04959837c27019a2349015543802439e152ddc4baf4e8c7b9d2b483362a8
-size 165
diff --git a/拦截数据/~$订单数据.xlsx b/拦截数据/~$订单数据.xlsx
deleted file mode 100644
index 234494c..0000000
--- a/拦截数据/~$订单数据.xlsx
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:e4ba04959837c27019a2349015543802439e152ddc4baf4e8c7b9d2b483362a8
-size 165
diff --git a/自动化跟单11.ipynb b/自动化跟单11.ipynb
index 7bb3526..fcbc7b7 100644
--- a/自动化跟单11.ipynb
+++ b/自动化跟单11.ipynb
@@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 34,
"metadata": {
"ExecuteTime": {
"end_time": "2025-05-16T14:28:31.802210Z",
@@ -16,17 +16,17 @@
"from login_for_cookie import Vc\n",
"import pendulum\n",
"import json\n",
- "from utils/gtools import MySQLconnect \n",
- "from lxml import etree\n",
+ "\n",
+ "from utils.gtools import MySQLconnect \n",
"from pathlib import Path\n",
"from datetime import datetime\n",
- "cookie = Vc(user='robot1',pswd= 'xi%26SiH4LbJ')\n",
+ "cookie = Vc(user='robot1',pswd= 'a123456')\n",
"headers = {\"Cookie\":cookie}"
]
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 35,
"metadata": {
"ExecuteTime": {
"end_time": "2025-05-16T10:32:48.135119Z",
@@ -36,83 +36,4169 @@
"outputs": [],
"source": [
"def get_fs(row):\n",
- " data = row[\"采购单号\"]\n",
- " buy_url = \"http://cp.maso.hk/index.php?main=store_in_receive\"\n",
+ " try:\n",
+ " print(row[\"采购单号\"])\n",
+ " data = row[\"采购单号\"]\n",
+ " buy_url = \"http://cp.baycheer.com/index.php?main=store_in_receive\"\n",
"\n",
- " payload = {\n",
- " \"s_pid\": 2867159,\n",
- " \"s_suborderid\": \"\",\n",
- " \"pdt_standard_id\": \"\",\n",
- " \"s_store\": -1,\n",
- " \"s_status[0]\": 0,\n",
- " \"s_sort\": \"desc\",\n",
- " \"Submit\": \"查询\",\n",
- " \"synergy_sign\": -1,\n",
- " \"start_dep\": \"\",\n",
- " \"start_user\": \"\",\n",
- " \"to_dep\": \"\",\n",
- " \"to_user\": \"\",\n",
- " \"swebid\": 0,\n",
- " \"local_pdt_id\": 0,\n",
- " \"sadd_time\": \"\",\n",
- " \"sadd_time_end\": \"\",\n",
- " \"sreal_express_no\": \"\",\n",
- " \"sweb_id\": \"\",\n",
- " \"sof\": 0,\n",
- " \"soe\": 0,\n",
- " \"sod\": \"\",\n",
- " \"tsid\": -1,\n",
- " \"tsdid\": -1,\n",
- " \"tsst\": -1,\n",
- " \"order_cate\": -1,\n",
- " \"error_status\": -1,\n",
- " \"web_uid\": -1,\n",
- " \"team_id\": -1,\n",
- " \"handle\": -1,\n",
- " \"handle_uid\": 0,\n",
- " \"handle_time_start\": \"\",\n",
- " \"handle_time_end\": \"\",\n",
- " \"shiping_time_start\": \"\",\n",
- " \"shiping_time_end\": \"\",\n",
- " \"trade_time_start\": \"\",\n",
- " \"trade_time_end\": \"\",\n",
- " \"order_express_fee\": -1,\n",
- " \"web_type\": -1,\n",
- " \"shipping_type\": -1,\n",
- " \"maintain_add_time_s\": \"\",\n",
- " \"maintain_add_time_e\": \"\",\n",
- " \"maintain_comfirm_time_s\": \"\",\n",
- " \"maintain_comfirm_time_e\": \"\",\n",
- " \"dispense_user_id\": \"\",\n",
- " \"export_page\": 1\n",
- " }\n",
- " payload[\"s_pid\"] = data\n",
- " resp = requests.post(url = buy_url ,headers=headers , data=payload)\n",
- " buy_df_list = pd.read_html(resp.text,match=\"所属网站ID\")\n",
- " buy_df = buy_df_list[1]\n",
- " buy_df.columns = buy_df.loc[0,:]\n",
- " trade_id = buy_df[\"交易ID\"][1]\n",
- " #交易明细里头\n",
- " trade_url = f\"http://cp.maso.hk/index.php?main=store_tradelist_info&trade_id={trade_id}\"\n",
- " resp2 = requests.get(url = trade_url ,headers=headers )\n",
- " df_list2 = pd.read_html(resp2.text,match=\"下单发货时间\")\n",
- " df2 = df_list2[0]\n",
- " df2.columns = df2.loc[0,:]\n",
- " 下单发货时间 = int(df2.iloc[2,1][0].replace(\"--\",\"0\"))\n",
- " 维护发货时间 = int(df2.iloc[2,3].replace(\"--\",\"0\"))\n",
- " 支付时间 = pendulum.parse(df2.iloc[3,3])\n",
- " 最大发货时间 = 支付时间.add(days=max(下单发货时间,维护发货时间))\n",
- " #交易列表\n",
- " trade_list_url = f\"http://cp.maso.hk/index.php?main=store_in_receive&navlist=trade_list&s_trade_id={trade_id}\"\n",
- " resp3 = requests.get(url = trade_list_url ,headers=headers )\n",
- " df_list3 = pd.read_html(resp3.text,match=\"涨幅\")\n",
- " df3 = df_list3[0]\n",
- " df3.columns = df3.loc[0,:]\n",
- " 交易平台 = df3[\"交易平台\"][1]\n",
- " 交易号 = df3[\"交易号\"][1]\n",
- " 交易平台订单号 = df3[\"交易平台订单号\"][1]\n",
+ " payload = {\n",
+ " \"s_pid\": 2867159,\n",
+ " \"s_suborderid\": \"\",\n",
+ " \"pdt_standard_id\": \"\",\n",
+ " \"s_store\": -1,\n",
+ " \"s_status[0]\": 0,\n",
+ " \"s_sort\": \"desc\",\n",
+ " \"Submit\": \"查询\",\n",
+ " \"synergy_sign\": -1,\n",
+ " \"start_dep\": \"\",\n",
+ " \"start_user\": \"\",\n",
+ " \"to_dep\": \"\",\n",
+ " \"to_user\": \"\",\n",
+ " \"swebid\": 0,\n",
+ " \"local_pdt_id\": 0,\n",
+ " \"sadd_time\": \"\",\n",
+ " \"sadd_time_end\": \"\",\n",
+ " \"sreal_express_no\": \"\",\n",
+ " \"sweb_id\": \"\",\n",
+ " \"sof\": 0,\n",
+ " \"soe\": 0,\n",
+ " \"sod\": \"\",\n",
+ " \"tsid\": -1,\n",
+ " \"tsdid\": -1,\n",
+ " \"tsst\": -1,\n",
+ " \"order_cate\": -1,\n",
+ " \"error_status\": -1,\n",
+ " \"web_uid\": -1,\n",
+ " \"team_id\": -1,\n",
+ " \"handle\": -1,\n",
+ " \"handle_uid\": 0,\n",
+ " \"handle_time_start\": \"\",\n",
+ " \"handle_time_end\": \"\",\n",
+ " \"shiping_time_start\": \"\",\n",
+ " \"shiping_time_end\": \"\",\n",
+ " \"trade_time_start\": \"\",\n",
+ " \"trade_time_end\": \"\",\n",
+ " \"order_express_fee\": -1,\n",
+ " \"web_type\": -1,\n",
+ " \"shipping_type\": -1,\n",
+ " \"maintain_add_time_s\": \"\",\n",
+ " \"maintain_add_time_e\": \"\",\n",
+ " \"maintain_comfirm_time_s\": \"\",\n",
+ " \"maintain_comfirm_time_e\": \"\",\n",
+ " \"dispense_user_id\": \"\",\n",
+ " \"export_page\": 1\n",
+ " }\n",
+ " payload[\"s_pid\"] = data\n",
+ " resp = requests.post(url = buy_url ,headers=headers , data=payload)\n",
+ " buy_df_list = pd.read_html(resp.text,match=\"所属网站ID\")\n",
+ " buy_df = buy_df_list[1]\n",
+ " buy_df.columns = buy_df.loc[0,:]\n",
+ " trade_id = buy_df[\"交易ID\"][1]\n",
+ " #交易明细里头\n",
+ " if trade_id ==\"无记录\":\n",
+ " return pd.Series([None,None,None,None,None,None,None,None])\n",
+ " trade_url = f\"http://cp.baycheer.com/index.php?main=store_tradelist_info&trade_id={trade_id}\"\n",
+ " resp2 = requests.get(url = trade_url ,headers=headers )\n",
+ " df_list2 = pd.read_html(resp2.text,match=\"下单发货时间\")\n",
+ " df2 = df_list2[0]\n",
+ " df2.columns = df2.loc[0,:]\n",
+ " 下单发货时间 = int(df2.iloc[2,1][0].replace(\"--\",\"0\"))\n",
+ " 维护发货时间 = int(df2.iloc[2,3].replace(\"--\",\"0\"))\n",
+ " 支付时间 = pendulum.parse(df2.iloc[3,3])\n",
+ " 最大发货时间 = 支付时间.add(days=max(下单发货时间,维护发货时间))\n",
+ " #交易列表\n",
+ " trade_list_url = f\"http://cp.baycheer.com/index.php?main=store_in_receive&navlist=trade_list&s_trade_id={trade_id}\"\n",
+ " resp3 = requests.get(url = trade_list_url ,headers=headers )\n",
+ " df_list3 = pd.read_html(resp3.text,match=\"涨幅\")\n",
+ " df3 = df_list3[0]\n",
+ " df3.columns = df3.loc[0,:]\n",
+ " 交易平台 = df3[\"交易平台\"][1]\n",
+ " 交易号 = df3[\"交易号\"][1]\n",
+ " 交易平台订单号 = df3[\"交易平台订单号\"][1]\n",
" \n",
- " return pd.Series([trade_id,下单发货时间, 维护发货时间,支付时间,最大发货时间,交易平台,交易号,交易平台订单号])"
+ " return pd.Series([trade_id,下单发货时间, 维护发货时间,支付时间,最大发货时间,交易平台,交易号,交易平台订单号])\n",
+ " except:\n",
+ " return pd.Series([None,None,None,None,None,None,None,None])"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 47,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "resultdf_ori = pd.read_excel(r\"跟单测试源文件.xlsx\")\n",
+ "#resultdf_ori = pd.read_excel(r\"跟单测试源文件.xlsx\")[[\"跟单任务ID\", \"采购单号\"]]\n",
+ "# 扩展 get_fs"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 49,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "application/vnd.microsoft.datawrangler.viewer.v0+json": {
+ "columns": [
+ {
+ "name": "index",
+ "rawType": "int64",
+ "type": "integer"
+ },
+ {
+ "name": "跟单任务ID",
+ "rawType": "int64",
+ "type": "integer"
+ },
+ {
+ "name": "任务组",
+ "rawType": "object",
+ "type": "string"
+ },
+ {
+ "name": "指派人员",
+ "rawType": "object",
+ "type": "string"
+ },
+ {
+ "name": "跟单人员",
+ "rawType": "float64",
+ "type": "float"
+ },
+ {
+ "name": "创建时间",
+ "rawType": "datetime64[ns]",
+ "type": "datetime"
+ },
+ {
+ "name": "跟单时间",
+ "rawType": "float64",
+ "type": "float"
+ },
+ {
+ "name": "状态",
+ "rawType": "object",
+ "type": "string"
+ },
+ {
+ "name": "审核时间",
+ "rawType": "float64",
+ "type": "float"
+ },
+ {
+ "name": "审核人",
+ "rawType": "float64",
+ "type": "float"
+ },
+ {
+ "name": "包裹数量",
+ "rawType": "int64",
+ "type": "integer"
+ },
+ {
+ "name": "约定时间",
+ "rawType": "float64",
+ "type": "float"
+ },
+ {
+ "name": "约定发货地址",
+ "rawType": "float64",
+ "type": "float"
+ },
+ {
+ "name": "是否需要退货",
+ "rawType": "object",
+ "type": "string"
+ },
+ {
+ "name": "是否需要退款",
+ "rawType": "object",
+ "type": "string"
+ },
+ {
+ "name": "是否需要找货",
+ "rawType": "object",
+ "type": "string"
+ },
+ {
+ "name": "备注",
+ "rawType": "float64",
+ "type": "float"
+ },
+ {
+ "name": "任务类型",
+ "rawType": "object",
+ "type": "string"
+ },
+ {
+ "name": "采购单号",
+ "rawType": "int64",
+ "type": "integer"
+ },
+ {
+ "name": "该类型的跟单次数",
+ "rawType": "int64",
+ "type": "integer"
+ }
+ ],
+ "ref": "3e728e3c-40c0-4182-9485-e423ac97a4cf",
+ "rows": [
+ [
+ "0",
+ "359974",
+ "未发货-跟单组",
+ "机器人1",
+ null,
+ "2025-05-30 09:13:08",
+ null,
+ "待处理",
+ null,
+ null,
+ "0",
+ null,
+ null,
+ "否",
+ "否",
+ "否",
+ null,
+ "已付款,待发货-未约定发货时间",
+ "2902619",
+ "1"
+ ],
+ [
+ "1",
+ "359970",
+ "未发货-跟单组",
+ "机器人1",
+ null,
+ "2025-05-30 09:13:08",
+ null,
+ "待处理",
+ null,
+ null,
+ "0",
+ null,
+ null,
+ "否",
+ "否",
+ "否",
+ null,
+ "已付款,待发货-未约定发货时间",
+ "2902615",
+ "1"
+ ],
+ [
+ "2",
+ "359964",
+ "未发货-跟单组",
+ "机器人1",
+ null,
+ "2025-05-30 09:13:08",
+ null,
+ "待处理",
+ null,
+ null,
+ "0",
+ null,
+ null,
+ "否",
+ "否",
+ "否",
+ null,
+ "已付款,待发货-未约定发货时间",
+ "2902607",
+ "1"
+ ],
+ [
+ "3",
+ "359957",
+ "未发货-跟单组",
+ "机器人1",
+ null,
+ "2025-05-30 09:13:07",
+ null,
+ "待处理",
+ null,
+ null,
+ "0",
+ null,
+ null,
+ "否",
+ "否",
+ "否",
+ null,
+ "已付款,待发货-未约定发货时间",
+ "2902596",
+ "1"
+ ],
+ [
+ "4",
+ "359952",
+ "未发货-跟单组",
+ "机器人1",
+ null,
+ "2025-05-30 09:13:07",
+ null,
+ "待处理",
+ null,
+ null,
+ "0",
+ null,
+ null,
+ "否",
+ "否",
+ "否",
+ null,
+ "已付款,待发货-未约定发货时间",
+ "2902588",
+ "1"
+ ],
+ [
+ "5",
+ "359948",
+ "未发货-跟单组",
+ "机器人1",
+ null,
+ "2025-05-30 09:13:06",
+ null,
+ "待处理",
+ null,
+ null,
+ "0",
+ null,
+ null,
+ "否",
+ "否",
+ "否",
+ null,
+ "已付款,待发货-未约定发货时间",
+ "2902584",
+ "1"
+ ],
+ [
+ "6",
+ "359945",
+ "未发货-跟单组",
+ "机器人1",
+ null,
+ "2025-05-30 09:13:06",
+ null,
+ "待处理",
+ null,
+ null,
+ "0",
+ null,
+ null,
+ "否",
+ "否",
+ "否",
+ null,
+ "已付款,待发货-未约定发货时间",
+ "2902579",
+ "1"
+ ],
+ [
+ "7",
+ "359942",
+ "未发货-跟单组",
+ "机器人1",
+ null,
+ "2025-05-30 09:13:06",
+ null,
+ "待处理",
+ null,
+ null,
+ "0",
+ null,
+ null,
+ "否",
+ "否",
+ "否",
+ null,
+ "已付款,待发货-未约定发货时间",
+ "2902574",
+ "1"
+ ],
+ [
+ "8",
+ "359939",
+ "未发货-跟单组",
+ "机器人1",
+ null,
+ "2025-05-30 09:13:05",
+ null,
+ "待处理",
+ null,
+ null,
+ "0",
+ null,
+ null,
+ "否",
+ "否",
+ "否",
+ null,
+ "已付款,待发货-未约定发货时间",
+ "2902570",
+ "1"
+ ],
+ [
+ "9",
+ "359935",
+ "未发货-跟单组",
+ "机器人1",
+ null,
+ "2025-05-30 09:13:05",
+ null,
+ "待处理",
+ null,
+ null,
+ "0",
+ null,
+ null,
+ "否",
+ "否",
+ "否",
+ null,
+ "已付款,待发货-未约定发货时间",
+ "2902565",
+ "1"
+ ],
+ [
+ "10",
+ "359932",
+ "未发货-跟单组",
+ "机器人1",
+ null,
+ "2025-05-30 09:13:05",
+ null,
+ "待处理",
+ null,
+ null,
+ "0",
+ null,
+ null,
+ "否",
+ "否",
+ "否",
+ null,
+ "已付款,待发货-未约定发货时间",
+ "2902561",
+ "1"
+ ],
+ [
+ "11",
+ "359926",
+ "未发货-跟单组",
+ "机器人1",
+ null,
+ "2025-05-30 09:13:04",
+ null,
+ "待处理",
+ null,
+ null,
+ "0",
+ null,
+ null,
+ "否",
+ "否",
+ "否",
+ null,
+ "已付款,待发货-未约定发货时间",
+ "2902553",
+ "1"
+ ],
+ [
+ "12",
+ "359923",
+ "未发货-跟单组",
+ "机器人1",
+ null,
+ "2025-05-30 09:13:04",
+ null,
+ "待处理",
+ null,
+ null,
+ "0",
+ null,
+ null,
+ "否",
+ "否",
+ "否",
+ null,
+ "已付款,待发货-未约定发货时间",
+ "2902550",
+ "1"
+ ],
+ [
+ "13",
+ "359920",
+ "未发货-跟单组",
+ "机器人1",
+ null,
+ "2025-05-30 09:13:04",
+ null,
+ "待处理",
+ null,
+ null,
+ "0",
+ null,
+ null,
+ "否",
+ "否",
+ "否",
+ null,
+ "已付款,待发货-未约定发货时间",
+ "2902547",
+ "1"
+ ],
+ [
+ "14",
+ "359916",
+ "未发货-跟单组",
+ "机器人1",
+ null,
+ "2025-05-30 09:13:03",
+ null,
+ "待处理",
+ null,
+ null,
+ "0",
+ null,
+ null,
+ "否",
+ "否",
+ "否",
+ null,
+ "已付款,待发货-未约定发货时间",
+ "2902543",
+ "1"
+ ],
+ [
+ "15",
+ "359906",
+ "未发货-跟单组",
+ "机器人1",
+ null,
+ "2025-05-30 09:13:03",
+ null,
+ "待处理",
+ null,
+ null,
+ "0",
+ null,
+ null,
+ "否",
+ "否",
+ "否",
+ null,
+ "已付款,待发货-未约定发货时间",
+ "2902531",
+ "1"
+ ],
+ [
+ "16",
+ "359902",
+ "未发货-跟单组",
+ "机器人1",
+ null,
+ "2025-05-30 09:13:02",
+ null,
+ "待处理",
+ null,
+ null,
+ "0",
+ null,
+ null,
+ "否",
+ "否",
+ "否",
+ null,
+ "已付款,待发货-未约定发货时间",
+ "2902527",
+ "1"
+ ],
+ [
+ "17",
+ "359899",
+ "未发货-跟单组",
+ "机器人1",
+ null,
+ "2025-05-30 09:13:02",
+ null,
+ "待处理",
+ null,
+ null,
+ "0",
+ null,
+ null,
+ "否",
+ "否",
+ "否",
+ null,
+ "已付款,待发货-未约定发货时间",
+ "2902524",
+ "1"
+ ],
+ [
+ "18",
+ "359893",
+ "未发货-跟单组",
+ "机器人1",
+ null,
+ "2025-05-30 09:13:01",
+ null,
+ "待处理",
+ null,
+ null,
+ "0",
+ null,
+ null,
+ "否",
+ "否",
+ "否",
+ null,
+ "已付款,待发货-未约定发货时间",
+ "2902517",
+ "1"
+ ],
+ [
+ "19",
+ "359885",
+ "未发货-跟单组",
+ "机器人1",
+ null,
+ "2025-05-30 09:13:01",
+ null,
+ "待处理",
+ null,
+ null,
+ "0",
+ null,
+ null,
+ "否",
+ "否",
+ "否",
+ null,
+ "已付款,待发货-未约定发货时间",
+ "2902504",
+ "1"
+ ],
+ [
+ "20",
+ "359879",
+ "未发货-跟单组",
+ "机器人1",
+ null,
+ "2025-05-30 09:13:00",
+ null,
+ "待处理",
+ null,
+ null,
+ "0",
+ null,
+ null,
+ "否",
+ "否",
+ "否",
+ null,
+ "已付款,待发货-未约定发货时间",
+ "2902496",
+ "1"
+ ],
+ [
+ "21",
+ "359876",
+ "未发货-跟单组",
+ "机器人1",
+ null,
+ "2025-05-30 09:13:00",
+ null,
+ "待处理",
+ null,
+ null,
+ "0",
+ null,
+ null,
+ "否",
+ "否",
+ "否",
+ null,
+ "已付款,待发货-未约定发货时间",
+ "2902491",
+ "1"
+ ],
+ [
+ "22",
+ "359871",
+ "未发货-跟单组",
+ "机器人1",
+ null,
+ "2025-05-30 09:13:00",
+ null,
+ "待处理",
+ null,
+ null,
+ "0",
+ null,
+ null,
+ "否",
+ "否",
+ "否",
+ null,
+ "已付款,待发货-未约定发货时间",
+ "2902484",
+ "1"
+ ],
+ [
+ "23",
+ "359865",
+ "未发货-跟单组",
+ "机器人1",
+ null,
+ "2025-05-30 09:12:59",
+ null,
+ "待处理",
+ null,
+ null,
+ "0",
+ null,
+ null,
+ "否",
+ "否",
+ "否",
+ null,
+ "已付款,待发货-未约定发货时间",
+ "2902476",
+ "1"
+ ],
+ [
+ "24",
+ "359862",
+ "未发货-跟单组",
+ "机器人1",
+ null,
+ "2025-05-30 09:12:59",
+ null,
+ "待处理",
+ null,
+ null,
+ "0",
+ null,
+ null,
+ "否",
+ "否",
+ "否",
+ null,
+ "已付款,待发货-未约定发货时间",
+ "2902473",
+ "1"
+ ],
+ [
+ "25",
+ "359858",
+ "未发货-跟单组",
+ "机器人1",
+ null,
+ "2025-05-30 09:12:58",
+ null,
+ "待处理",
+ null,
+ null,
+ "0",
+ null,
+ null,
+ "否",
+ "否",
+ "否",
+ null,
+ "已付款,待发货-未约定发货时间",
+ "2902469",
+ "1"
+ ],
+ [
+ "26",
+ "359854",
+ "未发货-跟单组",
+ "机器人1",
+ null,
+ "2025-05-30 09:12:58",
+ null,
+ "待处理",
+ null,
+ null,
+ "0",
+ null,
+ null,
+ "否",
+ "否",
+ "否",
+ null,
+ "已付款,待发货-未约定发货时间",
+ "2902465",
+ "1"
+ ],
+ [
+ "27",
+ "359851",
+ "未发货-跟单组",
+ "机器人1",
+ null,
+ "2025-05-30 09:12:58",
+ null,
+ "待处理",
+ null,
+ null,
+ "0",
+ null,
+ null,
+ "否",
+ "否",
+ "否",
+ null,
+ "已付款,待发货-未约定发货时间",
+ "2902462",
+ "1"
+ ],
+ [
+ "28",
+ "359847",
+ "未发货-跟单组",
+ "机器人1",
+ null,
+ "2025-05-30 09:12:58",
+ null,
+ "待处理",
+ null,
+ null,
+ "0",
+ null,
+ null,
+ "否",
+ "否",
+ "否",
+ null,
+ "已付款,待发货-未约定发货时间",
+ "2902458",
+ "1"
+ ],
+ [
+ "29",
+ "359841",
+ "未发货-跟单组",
+ "机器人1",
+ null,
+ "2025-05-30 09:12:57",
+ null,
+ "待处理",
+ null,
+ null,
+ "0",
+ null,
+ null,
+ "否",
+ "否",
+ "否",
+ null,
+ "已付款,待发货-未约定发货时间",
+ "2902452",
+ "1"
+ ],
+ [
+ "30",
+ "359838",
+ "未发货-跟单组",
+ "机器人1",
+ null,
+ "2025-05-30 09:12:57",
+ null,
+ "待处理",
+ null,
+ null,
+ "0",
+ null,
+ null,
+ "否",
+ "否",
+ "否",
+ null,
+ "已付款,待发货-未约定发货时间",
+ "2902449",
+ "1"
+ ],
+ [
+ "31",
+ "359829",
+ "未发货-跟单组",
+ "机器人1",
+ null,
+ "2025-05-30 09:12:56",
+ null,
+ "待处理",
+ null,
+ null,
+ "0",
+ null,
+ null,
+ "否",
+ "否",
+ "否",
+ null,
+ "已付款,待发货-未约定发货时间",
+ "2902438",
+ "1"
+ ],
+ [
+ "32",
+ "359825",
+ "未发货-跟单组",
+ "机器人1",
+ null,
+ "2025-05-30 09:12:56",
+ null,
+ "待处理",
+ null,
+ null,
+ "0",
+ null,
+ null,
+ "否",
+ "否",
+ "否",
+ null,
+ "已付款,待发货-未约定发货时间",
+ "2902432",
+ "1"
+ ],
+ [
+ "33",
+ "359822",
+ "未发货-跟单组",
+ "机器人1",
+ null,
+ "2025-05-30 09:12:56",
+ null,
+ "待处理",
+ null,
+ null,
+ "0",
+ null,
+ null,
+ "否",
+ "否",
+ "否",
+ null,
+ "已付款,待发货-未约定发货时间",
+ "2902429",
+ "1"
+ ],
+ [
+ "34",
+ "359818",
+ "未发货-跟单组",
+ "机器人1",
+ null,
+ "2025-05-30 09:12:55",
+ null,
+ "待处理",
+ null,
+ null,
+ "0",
+ null,
+ null,
+ "否",
+ "否",
+ "否",
+ null,
+ "已付款,待发货-未约定发货时间",
+ "2902424",
+ "1"
+ ],
+ [
+ "35",
+ "359814",
+ "未发货-跟单组",
+ "机器人1",
+ null,
+ "2025-05-30 09:12:55",
+ null,
+ "待处理",
+ null,
+ null,
+ "0",
+ null,
+ null,
+ "否",
+ "否",
+ "否",
+ null,
+ "已付款,待发货-未约定发货时间",
+ "2902420",
+ "1"
+ ],
+ [
+ "36",
+ "359810",
+ "未发货-跟单组",
+ "机器人1",
+ null,
+ "2025-05-30 09:12:55",
+ null,
+ "待处理",
+ null,
+ null,
+ "0",
+ null,
+ null,
+ "否",
+ "否",
+ "否",
+ null,
+ "已付款,待发货-未约定发货时间",
+ "2902416",
+ "1"
+ ],
+ [
+ "37",
+ "359807",
+ "未发货-跟单组",
+ "机器人1",
+ null,
+ "2025-05-30 09:12:55",
+ null,
+ "待处理",
+ null,
+ null,
+ "0",
+ null,
+ null,
+ "否",
+ "否",
+ "否",
+ null,
+ "已付款,待发货-未约定发货时间",
+ "2902413",
+ "1"
+ ],
+ [
+ "38",
+ "359804",
+ "未发货-跟单组",
+ "机器人1",
+ null,
+ "2025-05-30 09:12:54",
+ null,
+ "待处理",
+ null,
+ null,
+ "0",
+ null,
+ null,
+ "否",
+ "否",
+ "否",
+ null,
+ "已付款,待发货-未约定发货时间",
+ "2902410",
+ "1"
+ ],
+ [
+ "39",
+ "359801",
+ "未发货-跟单组",
+ "机器人1",
+ null,
+ "2025-05-30 09:12:54",
+ null,
+ "待处理",
+ null,
+ null,
+ "0",
+ null,
+ null,
+ "否",
+ "否",
+ "否",
+ null,
+ "已付款,待发货-未约定发货时间",
+ "2902407",
+ "1"
+ ],
+ [
+ "40",
+ "359797",
+ "未发货-跟单组",
+ "机器人1",
+ null,
+ "2025-05-30 09:12:54",
+ null,
+ "待处理",
+ null,
+ null,
+ "0",
+ null,
+ null,
+ "否",
+ "否",
+ "否",
+ null,
+ "已付款,待发货-未约定发货时间",
+ "2902401",
+ "1"
+ ],
+ [
+ "41",
+ "359793",
+ "未发货-跟单组",
+ "机器人1",
+ null,
+ "2025-05-30 09:12:53",
+ null,
+ "待处理",
+ null,
+ null,
+ "0",
+ null,
+ null,
+ "否",
+ "否",
+ "否",
+ null,
+ "已付款,待发货-未约定发货时间",
+ "2902396",
+ "1"
+ ],
+ [
+ "42",
+ "359788",
+ "未发货-跟单组",
+ "机器人1",
+ null,
+ "2025-05-30 09:12:53",
+ null,
+ "待处理",
+ null,
+ null,
+ "0",
+ null,
+ null,
+ "否",
+ "否",
+ "否",
+ null,
+ "已付款,待发货-未约定发货时间",
+ "2902390",
+ "1"
+ ],
+ [
+ "43",
+ "359784",
+ "未发货-跟单组",
+ "机器人1",
+ null,
+ "2025-05-30 09:12:53",
+ null,
+ "待处理",
+ null,
+ null,
+ "0",
+ null,
+ null,
+ "否",
+ "否",
+ "否",
+ null,
+ "已付款,待发货-未约定发货时间",
+ "2902386",
+ "1"
+ ],
+ [
+ "44",
+ "359781",
+ "未发货-跟单组",
+ "机器人1",
+ null,
+ "2025-05-30 09:12:52",
+ null,
+ "待处理",
+ null,
+ null,
+ "0",
+ null,
+ null,
+ "否",
+ "否",
+ "否",
+ null,
+ "已付款,待发货-未约定发货时间",
+ "2902382",
+ "1"
+ ],
+ [
+ "45",
+ "359767",
+ "未发货-跟单组",
+ "机器人1",
+ null,
+ "2025-05-30 09:12:52",
+ null,
+ "待处理",
+ null,
+ null,
+ "0",
+ null,
+ null,
+ "否",
+ "否",
+ "否",
+ null,
+ "已付款,待发货-未约定发货时间",
+ "2902368",
+ "1"
+ ],
+ [
+ "46",
+ "359763",
+ "未发货-跟单组",
+ "机器人1",
+ null,
+ "2025-05-30 09:12:51",
+ null,
+ "待处理",
+ null,
+ null,
+ "0",
+ null,
+ null,
+ "否",
+ "否",
+ "否",
+ null,
+ "已付款,待发货-未约定发货时间",
+ "2902364",
+ "1"
+ ],
+ [
+ "47",
+ "359758",
+ "未发货-跟单组",
+ "机器人1",
+ null,
+ "2025-05-30 09:12:51",
+ null,
+ "待处理",
+ null,
+ null,
+ "0",
+ null,
+ null,
+ "否",
+ "否",
+ "否",
+ null,
+ "已付款,待发货-未约定发货时间",
+ "2902357",
+ "1"
+ ],
+ [
+ "48",
+ "359752",
+ "未发货-跟单组",
+ "机器人1",
+ null,
+ "2025-05-30 09:12:51",
+ null,
+ "待处理",
+ null,
+ null,
+ "0",
+ null,
+ null,
+ "否",
+ "否",
+ "否",
+ null,
+ "已付款,待发货-未约定发货时间",
+ "2902351",
+ "1"
+ ],
+ [
+ "49",
+ "359748",
+ "未发货-跟单组",
+ "机器人1",
+ null,
+ "2025-05-30 09:12:50",
+ null,
+ "待处理",
+ null,
+ null,
+ "0",
+ null,
+ null,
+ "否",
+ "否",
+ "否",
+ null,
+ "已付款,待发货-未约定发货时间",
+ "2902344",
+ "1"
+ ]
+ ],
+ "shape": {
+ "columns": 19,
+ "rows": 98
+ }
+ },
+ "text/html": [
+ "
\n",
+ "\n",
+ "
\n",
+ " \n",
+ " \n",
+ " | \n",
+ " 跟单任务ID | \n",
+ " 任务组 | \n",
+ " 指派人员 | \n",
+ " 跟单人员 | \n",
+ " 创建时间 | \n",
+ " 跟单时间 | \n",
+ " 状态 | \n",
+ " 审核时间 | \n",
+ " 审核人 | \n",
+ " 包裹数量 | \n",
+ " 约定时间 | \n",
+ " 约定发货地址 | \n",
+ " 是否需要退货 | \n",
+ " 是否需要退款 | \n",
+ " 是否需要找货 | \n",
+ " 备注 | \n",
+ " 任务类型 | \n",
+ " 采购单号 | \n",
+ " 该类型的跟单次数 | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " | 0 | \n",
+ " 359974 | \n",
+ " 未发货-跟单组 | \n",
+ " 机器人1 | \n",
+ " NaN | \n",
+ " 2025-05-30 09:13:08 | \n",
+ " NaN | \n",
+ " 待处理 | \n",
+ " NaN | \n",
+ " NaN | \n",
+ " 0 | \n",
+ " NaN | \n",
+ " NaN | \n",
+ " 否 | \n",
+ " 否 | \n",
+ " 否 | \n",
+ " NaN | \n",
+ " 已付款,待发货-未约定发货时间 | \n",
+ " 2902619 | \n",
+ " 1 | \n",
+ "
\n",
+ " \n",
+ " | 1 | \n",
+ " 359970 | \n",
+ " 未发货-跟单组 | \n",
+ " 机器人1 | \n",
+ " NaN | \n",
+ " 2025-05-30 09:13:08 | \n",
+ " NaN | \n",
+ " 待处理 | \n",
+ " NaN | \n",
+ " NaN | \n",
+ " 0 | \n",
+ " NaN | \n",
+ " NaN | \n",
+ " 否 | \n",
+ " 否 | \n",
+ " 否 | \n",
+ " NaN | \n",
+ " 已付款,待发货-未约定发货时间 | \n",
+ " 2902615 | \n",
+ " 1 | \n",
+ "
\n",
+ " \n",
+ " | 2 | \n",
+ " 359964 | \n",
+ " 未发货-跟单组 | \n",
+ " 机器人1 | \n",
+ " NaN | \n",
+ " 2025-05-30 09:13:08 | \n",
+ " NaN | \n",
+ " 待处理 | \n",
+ " NaN | \n",
+ " NaN | \n",
+ " 0 | \n",
+ " NaN | \n",
+ " NaN | \n",
+ " 否 | \n",
+ " 否 | \n",
+ " 否 | \n",
+ " NaN | \n",
+ " 已付款,待发货-未约定发货时间 | \n",
+ " 2902607 | \n",
+ " 1 | \n",
+ "
\n",
+ " \n",
+ " | 3 | \n",
+ " 359957 | \n",
+ " 未发货-跟单组 | \n",
+ " 机器人1 | \n",
+ " NaN | \n",
+ " 2025-05-30 09:13:07 | \n",
+ " NaN | \n",
+ " 待处理 | \n",
+ " NaN | \n",
+ " NaN | \n",
+ " 0 | \n",
+ " NaN | \n",
+ " NaN | \n",
+ " 否 | \n",
+ " 否 | \n",
+ " 否 | \n",
+ " NaN | \n",
+ " 已付款,待发货-未约定发货时间 | \n",
+ " 2902596 | \n",
+ " 1 | \n",
+ "
\n",
+ " \n",
+ " | 4 | \n",
+ " 359952 | \n",
+ " 未发货-跟单组 | \n",
+ " 机器人1 | \n",
+ " NaN | \n",
+ " 2025-05-30 09:13:07 | \n",
+ " NaN | \n",
+ " 待处理 | \n",
+ " NaN | \n",
+ " NaN | \n",
+ " 0 | \n",
+ " NaN | \n",
+ " NaN | \n",
+ " 否 | \n",
+ " 否 | \n",
+ " 否 | \n",
+ " NaN | \n",
+ " 已付款,待发货-未约定发货时间 | \n",
+ " 2902588 | \n",
+ " 1 | \n",
+ "
\n",
+ " \n",
+ " | ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ "
\n",
+ " \n",
+ " | 93 | \n",
+ " 359509 | \n",
+ " 未发货-跟单组 | \n",
+ " 机器人1 | \n",
+ " NaN | \n",
+ " 2025-05-30 09:12:35 | \n",
+ " NaN | \n",
+ " 待处理 | \n",
+ " NaN | \n",
+ " NaN | \n",
+ " 0 | \n",
+ " NaN | \n",
+ " NaN | \n",
+ " 否 | \n",
+ " 否 | \n",
+ " 否 | \n",
+ " NaN | \n",
+ " 已付款,待发货-未约定发货时间 | \n",
+ " 2902095 | \n",
+ " 1 | \n",
+ "
\n",
+ " \n",
+ " | 94 | \n",
+ " 359506 | \n",
+ " 未发货-跟单组 | \n",
+ " 机器人1 | \n",
+ " NaN | \n",
+ " 2025-05-30 09:12:35 | \n",
+ " NaN | \n",
+ " 待处理 | \n",
+ " NaN | \n",
+ " NaN | \n",
+ " 0 | \n",
+ " NaN | \n",
+ " NaN | \n",
+ " 否 | \n",
+ " 否 | \n",
+ " 否 | \n",
+ " NaN | \n",
+ " 已付款,待发货-未约定发货时间 | \n",
+ " 2902092 | \n",
+ " 1 | \n",
+ "
\n",
+ " \n",
+ " | 95 | \n",
+ " 359501 | \n",
+ " 未发货-跟单组 | \n",
+ " 机器人1 | \n",
+ " NaN | \n",
+ " 2025-05-30 09:12:35 | \n",
+ " NaN | \n",
+ " 待处理 | \n",
+ " NaN | \n",
+ " NaN | \n",
+ " 0 | \n",
+ " NaN | \n",
+ " NaN | \n",
+ " 否 | \n",
+ " 否 | \n",
+ " 否 | \n",
+ " NaN | \n",
+ " 已付款,待发货-未约定发货时间 | \n",
+ " 2902087 | \n",
+ " 1 | \n",
+ "
\n",
+ " \n",
+ " | 96 | \n",
+ " 359488 | \n",
+ " 未发货-跟单组 | \n",
+ " 机器人1 | \n",
+ " NaN | \n",
+ " 2025-05-30 09:12:34 | \n",
+ " NaN | \n",
+ " 待处理 | \n",
+ " NaN | \n",
+ " NaN | \n",
+ " 0 | \n",
+ " NaN | \n",
+ " NaN | \n",
+ " 否 | \n",
+ " 否 | \n",
+ " 否 | \n",
+ " NaN | \n",
+ " 已付款,待发货-未约定发货时间 | \n",
+ " 2901999 | \n",
+ " 1 | \n",
+ "
\n",
+ " \n",
+ " | 97 | \n",
+ " 359486 | \n",
+ " 未发货-跟单组 | \n",
+ " 机器人1 | \n",
+ " NaN | \n",
+ " 2025-05-30 09:12:34 | \n",
+ " NaN | \n",
+ " 待处理 | \n",
+ " NaN | \n",
+ " NaN | \n",
+ " 0 | \n",
+ " NaN | \n",
+ " NaN | \n",
+ " 否 | \n",
+ " 否 | \n",
+ " 否 | \n",
+ " NaN | \n",
+ " 已付款,待发货-未约定发货时间 | \n",
+ " 2901997 | \n",
+ " 1 | \n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
98 rows × 19 columns
\n",
+ "
"
+ ],
+ "text/plain": [
+ " 跟单任务ID 任务组 指派人员 跟单人员 创建时间 跟单时间 状态 审核时间 审核人 \\\n",
+ "0 359974 未发货-跟单组 机器人1 NaN 2025-05-30 09:13:08 NaN 待处理 NaN NaN \n",
+ "1 359970 未发货-跟单组 机器人1 NaN 2025-05-30 09:13:08 NaN 待处理 NaN NaN \n",
+ "2 359964 未发货-跟单组 机器人1 NaN 2025-05-30 09:13:08 NaN 待处理 NaN NaN \n",
+ "3 359957 未发货-跟单组 机器人1 NaN 2025-05-30 09:13:07 NaN 待处理 NaN NaN \n",
+ "4 359952 未发货-跟单组 机器人1 NaN 2025-05-30 09:13:07 NaN 待处理 NaN NaN \n",
+ ".. ... ... ... ... ... ... ... ... ... \n",
+ "93 359509 未发货-跟单组 机器人1 NaN 2025-05-30 09:12:35 NaN 待处理 NaN NaN \n",
+ "94 359506 未发货-跟单组 机器人1 NaN 2025-05-30 09:12:35 NaN 待处理 NaN NaN \n",
+ "95 359501 未发货-跟单组 机器人1 NaN 2025-05-30 09:12:35 NaN 待处理 NaN NaN \n",
+ "96 359488 未发货-跟单组 机器人1 NaN 2025-05-30 09:12:34 NaN 待处理 NaN NaN \n",
+ "97 359486 未发货-跟单组 机器人1 NaN 2025-05-30 09:12:34 NaN 待处理 NaN NaN \n",
+ "\n",
+ " 包裹数量 约定时间 约定发货地址 是否需要退货 是否需要退款 是否需要找货 备注 任务类型 采购单号 \\\n",
+ "0 0 NaN NaN 否 否 否 NaN 已付款,待发货-未约定发货时间 2902619 \n",
+ "1 0 NaN NaN 否 否 否 NaN 已付款,待发货-未约定发货时间 2902615 \n",
+ "2 0 NaN NaN 否 否 否 NaN 已付款,待发货-未约定发货时间 2902607 \n",
+ "3 0 NaN NaN 否 否 否 NaN 已付款,待发货-未约定发货时间 2902596 \n",
+ "4 0 NaN NaN 否 否 否 NaN 已付款,待发货-未约定发货时间 2902588 \n",
+ ".. ... ... ... ... ... ... .. ... ... \n",
+ "93 0 NaN NaN 否 否 否 NaN 已付款,待发货-未约定发货时间 2902095 \n",
+ "94 0 NaN NaN 否 否 否 NaN 已付款,待发货-未约定发货时间 2902092 \n",
+ "95 0 NaN NaN 否 否 否 NaN 已付款,待发货-未约定发货时间 2902087 \n",
+ "96 0 NaN NaN 否 否 否 NaN 已付款,待发货-未约定发货时间 2901999 \n",
+ "97 0 NaN NaN 否 否 否 NaN 已付款,待发货-未约定发货时间 2901997 \n",
+ "\n",
+ " 该类型的跟单次数 \n",
+ "0 1 \n",
+ "1 1 \n",
+ "2 1 \n",
+ "3 1 \n",
+ "4 1 \n",
+ ".. ... \n",
+ "93 1 \n",
+ "94 1 \n",
+ "95 1 \n",
+ "96 1 \n",
+ "97 1 \n",
+ "\n",
+ "[98 rows x 19 columns]"
+ ]
+ },
+ "execution_count": 49,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "resultdf_ori"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 48,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "application/vnd.microsoft.datawrangler.viewer.v0+json": {
+ "columns": [
+ {
+ "name": "index",
+ "rawType": "int64",
+ "type": "integer"
+ },
+ {
+ "name": "跟单任务ID",
+ "rawType": "int64",
+ "type": "integer"
+ },
+ {
+ "name": "采购单号",
+ "rawType": "int64",
+ "type": "integer"
+ }
+ ],
+ "ref": "42fe9f0e-dc5f-47b3-a032-0f7f436a8166",
+ "rows": [
+ [
+ "0",
+ "359974",
+ "2902619"
+ ],
+ [
+ "1",
+ "359970",
+ "2902615"
+ ],
+ [
+ "2",
+ "359964",
+ "2902607"
+ ],
+ [
+ "3",
+ "359957",
+ "2902596"
+ ],
+ [
+ "4",
+ "359952",
+ "2902588"
+ ],
+ [
+ "5",
+ "359948",
+ "2902584"
+ ],
+ [
+ "6",
+ "359945",
+ "2902579"
+ ],
+ [
+ "7",
+ "359942",
+ "2902574"
+ ],
+ [
+ "8",
+ "359939",
+ "2902570"
+ ],
+ [
+ "9",
+ "359935",
+ "2902565"
+ ],
+ [
+ "10",
+ "359932",
+ "2902561"
+ ],
+ [
+ "11",
+ "359926",
+ "2902553"
+ ],
+ [
+ "12",
+ "359923",
+ "2902550"
+ ],
+ [
+ "13",
+ "359920",
+ "2902547"
+ ],
+ [
+ "14",
+ "359916",
+ "2902543"
+ ],
+ [
+ "15",
+ "359906",
+ "2902531"
+ ],
+ [
+ "16",
+ "359902",
+ "2902527"
+ ],
+ [
+ "17",
+ "359899",
+ "2902524"
+ ],
+ [
+ "18",
+ "359893",
+ "2902517"
+ ],
+ [
+ "19",
+ "359885",
+ "2902504"
+ ],
+ [
+ "20",
+ "359879",
+ "2902496"
+ ],
+ [
+ "21",
+ "359876",
+ "2902491"
+ ],
+ [
+ "22",
+ "359871",
+ "2902484"
+ ],
+ [
+ "23",
+ "359865",
+ "2902476"
+ ],
+ [
+ "24",
+ "359862",
+ "2902473"
+ ],
+ [
+ "25",
+ "359858",
+ "2902469"
+ ],
+ [
+ "26",
+ "359854",
+ "2902465"
+ ],
+ [
+ "27",
+ "359851",
+ "2902462"
+ ],
+ [
+ "28",
+ "359847",
+ "2902458"
+ ],
+ [
+ "29",
+ "359841",
+ "2902452"
+ ],
+ [
+ "30",
+ "359838",
+ "2902449"
+ ],
+ [
+ "31",
+ "359829",
+ "2902438"
+ ],
+ [
+ "32",
+ "359825",
+ "2902432"
+ ],
+ [
+ "33",
+ "359822",
+ "2902429"
+ ],
+ [
+ "34",
+ "359818",
+ "2902424"
+ ],
+ [
+ "35",
+ "359814",
+ "2902420"
+ ],
+ [
+ "36",
+ "359810",
+ "2902416"
+ ],
+ [
+ "37",
+ "359807",
+ "2902413"
+ ],
+ [
+ "38",
+ "359804",
+ "2902410"
+ ],
+ [
+ "39",
+ "359801",
+ "2902407"
+ ],
+ [
+ "40",
+ "359797",
+ "2902401"
+ ],
+ [
+ "41",
+ "359793",
+ "2902396"
+ ],
+ [
+ "42",
+ "359788",
+ "2902390"
+ ],
+ [
+ "43",
+ "359784",
+ "2902386"
+ ],
+ [
+ "44",
+ "359781",
+ "2902382"
+ ],
+ [
+ "45",
+ "359767",
+ "2902368"
+ ],
+ [
+ "46",
+ "359763",
+ "2902364"
+ ],
+ [
+ "47",
+ "359758",
+ "2902357"
+ ],
+ [
+ "48",
+ "359752",
+ "2902351"
+ ],
+ [
+ "49",
+ "359748",
+ "2902344"
+ ]
+ ],
+ "shape": {
+ "columns": 2,
+ "rows": 98
+ }
+ },
+ "text/html": [
+ "\n",
+ "\n",
+ "
\n",
+ " \n",
+ " \n",
+ " | \n",
+ " 跟单任务ID | \n",
+ " 采购单号 | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " | 0 | \n",
+ " 359974 | \n",
+ " 2902619 | \n",
+ "
\n",
+ " \n",
+ " | 1 | \n",
+ " 359970 | \n",
+ " 2902615 | \n",
+ "
\n",
+ " \n",
+ " | 2 | \n",
+ " 359964 | \n",
+ " 2902607 | \n",
+ "
\n",
+ " \n",
+ " | 3 | \n",
+ " 359957 | \n",
+ " 2902596 | \n",
+ "
\n",
+ " \n",
+ " | 4 | \n",
+ " 359952 | \n",
+ " 2902588 | \n",
+ "
\n",
+ " \n",
+ " | ... | \n",
+ " ... | \n",
+ " ... | \n",
+ "
\n",
+ " \n",
+ " | 93 | \n",
+ " 359509 | \n",
+ " 2902095 | \n",
+ "
\n",
+ " \n",
+ " | 94 | \n",
+ " 359506 | \n",
+ " 2902092 | \n",
+ "
\n",
+ " \n",
+ " | 95 | \n",
+ " 359501 | \n",
+ " 2902087 | \n",
+ "
\n",
+ " \n",
+ " | 96 | \n",
+ " 359488 | \n",
+ " 2901999 | \n",
+ "
\n",
+ " \n",
+ " | 97 | \n",
+ " 359486 | \n",
+ " 2901997 | \n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
98 rows × 2 columns
\n",
+ "
"
+ ],
+ "text/plain": [
+ " 跟单任务ID 采购单号\n",
+ "0 359974 2902619\n",
+ "1 359970 2902615\n",
+ "2 359964 2902607\n",
+ "3 359957 2902596\n",
+ "4 359952 2902588\n",
+ ".. ... ...\n",
+ "93 359509 2902095\n",
+ "94 359506 2902092\n",
+ "95 359501 2902087\n",
+ "96 359488 2901999\n",
+ "97 359486 2901997\n",
+ "\n",
+ "[98 rows x 2 columns]"
+ ]
+ },
+ "execution_count": 48,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "resultdf"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 32,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "application/vnd.microsoft.datawrangler.viewer.v0+json": {
+ "columns": [
+ {
+ "name": "index",
+ "rawType": "int64",
+ "type": "integer"
+ },
+ {
+ "name": "交易ID",
+ "rawType": "object",
+ "type": "unknown"
+ },
+ {
+ "name": "下单发货时间",
+ "rawType": "float64",
+ "type": "float"
+ },
+ {
+ "name": "维护发货时间",
+ "rawType": "float64",
+ "type": "float"
+ },
+ {
+ "name": "支付时间",
+ "rawType": "datetime64[ns, UTC]",
+ "type": "unknown"
+ },
+ {
+ "name": "最大发货时间",
+ "rawType": "datetime64[ns, UTC]",
+ "type": "unknown"
+ },
+ {
+ "name": "交易平台",
+ "rawType": "object",
+ "type": "unknown"
+ },
+ {
+ "name": "交易号",
+ "rawType": "object",
+ "type": "unknown"
+ },
+ {
+ "name": "交易平台订单号",
+ "rawType": "object",
+ "type": "unknown"
+ }
+ ],
+ "ref": "6bbcfc6d-5ce7-4209-95a5-92505322ae4b",
+ "rows": [
+ [
+ "0",
+ "1871514",
+ "5.0",
+ "0.0",
+ "2025-05-29 17:49:40+00:00",
+ "2025-06-03 17:49:40+00:00",
+ "淘天",
+ "2586394887255538788",
+ "501566-187151429026196065"
+ ],
+ [
+ "1",
+ "1871511",
+ "5.0",
+ "3.0",
+ "2025-05-29 17:45:57+00:00",
+ "2025-06-03 17:45:57+00:00",
+ "1688",
+ "2586866558699340655",
+ "2586866558699340655"
+ ],
+ [
+ "2",
+ "1871510",
+ "4.0",
+ "5.0",
+ "2025-05-29 17:38:32+00:00",
+ "2025-06-03 17:38:32+00:00",
+ "淘天",
+ "2586724428509538788",
+ "501566-187151029026079158"
+ ],
+ [
+ "3",
+ "1871507",
+ "4.0",
+ "2.0",
+ "2025-05-29 17:31:48+00:00",
+ "2025-06-02 17:31:48+00:00",
+ "1688",
+ "2586369831696340655",
+ "2586369831696340655"
+ ],
+ [
+ "4",
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null
+ ],
+ [
+ "5",
+ "1871487",
+ "5.0",
+ "0.0",
+ "2025-05-29 17:28:01+00:00",
+ "2025-06-03 17:28:01+00:00",
+ "1688",
+ "2586712116394340655",
+ "2586712116394340655"
+ ],
+ [
+ "6",
+ "1871489",
+ "5.0",
+ "0.0",
+ "2025-05-29 17:27:31+00:00",
+ "2025-06-03 17:27:31+00:00",
+ "1688",
+ "2586843158361340655",
+ "2586843158361340655"
+ ],
+ [
+ "7",
+ "1871504",
+ "5.0",
+ "0.0",
+ "2025-05-29 18:00:00+00:00",
+ "2025-06-03 18:00:00+00:00",
+ "淘天",
+ "2586391611043219261",
+ "1748511690120"
+ ],
+ [
+ "8",
+ "1871464",
+ "4.0",
+ "0.0",
+ "2025-05-29 16:21:00+00:00",
+ "2025-06-02 16:21:00+00:00",
+ "淘天",
+ "2586603684278538788",
+ "501566-187146429025706383"
+ ],
+ [
+ "9",
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null
+ ],
+ [
+ "10",
+ "1871446",
+ "4.0",
+ "0.0",
+ "2025-05-29 16:07:18+00:00",
+ "2025-06-02 16:07:18+00:00",
+ "1688",
+ "2586713774989340655",
+ "2586713774989340655"
+ ],
+ [
+ "11",
+ "1871492",
+ "5.0",
+ "0.0",
+ "2025-05-29 17:58:47+00:00",
+ "2025-06-03 17:58:47+00:00",
+ "淘天",
+ "2587422217794219261",
+ "1748511214446"
+ ],
+ [
+ "12",
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null
+ ],
+ [
+ "13",
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null
+ ],
+ [
+ "14",
+ "1871438",
+ "5.0",
+ "0.0",
+ "2025-05-29 17:16:28+00:00",
+ "2025-06-03 17:16:28+00:00",
+ "淘天",
+ "2586693324476219261",
+ "1748510063327"
+ ],
+ [
+ "15",
+ "1871398",
+ "5.0",
+ "0.0",
+ "2025-05-29 15:24:42+00:00",
+ "2025-06-03 15:24:42+00:00",
+ "淘天",
+ "2587229653074538788",
+ "501566-187139829025312437"
+ ],
+ [
+ "16",
+ "1871388",
+ "4.0",
+ "0.0",
+ "2025-05-29 14:52:40+00:00",
+ "2025-06-02 14:52:40+00:00",
+ "1688",
+ "2586139179096340655",
+ "2586139179096340655"
+ ],
+ [
+ "17",
+ "1871418",
+ "5.0",
+ "0.0",
+ "2025-05-29 16:52:00+00:00",
+ "2025-06-03 16:52:00+00:00",
+ "淘天",
+ "2587321165625219261",
+ "1748507467551"
+ ],
+ [
+ "18",
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null
+ ],
+ [
+ "19",
+ "1871417",
+ "5.0",
+ "0.0",
+ "2025-05-29 16:59:34+00:00",
+ "2025-06-03 16:59:34+00:00",
+ "淘天",
+ "2586615528437219261",
+ "1748507336231"
+ ],
+ [
+ "20",
+ "1871353",
+ "5.0",
+ "0.0",
+ "2025-05-29 13:50:02+00:00",
+ "2025-06-03 13:50:02+00:00",
+ "淘天",
+ "2587088497261538788",
+ "501566-187135329024968677"
+ ],
+ [
+ "21",
+ "1871348",
+ "5.0",
+ "0.0",
+ "2025-05-29 13:38:38+00:00",
+ "2025-06-03 13:38:38+00:00",
+ "淘天",
+ "2587071793982538788",
+ "501566-187134829024913484"
+ ],
+ [
+ "22",
+ "1871345",
+ "5.0",
+ "0.0",
+ "2025-05-29 13:37:24+00:00",
+ "2025-06-03 13:37:24+00:00",
+ "1688",
+ "2586508466020340655",
+ "2586508466020340655"
+ ],
+ [
+ "23",
+ "1871336",
+ "4.0",
+ "0.0",
+ "2025-05-29 13:16:17+00:00",
+ "2025-06-02 13:16:17+00:00",
+ "淘天",
+ "2586347292443538788",
+ "501566-187133629024764267"
+ ],
+ [
+ "24",
+ "1871333",
+ "5.0",
+ "0.0",
+ "2025-05-29 13:13:58+00:00",
+ "2025-06-03 13:13:58+00:00",
+ "1688",
+ "2586340380550340655",
+ "2586340380550340655"
+ ],
+ [
+ "25",
+ "1871376",
+ "4.0",
+ "2.0",
+ "2025-05-29 14:39:00+00:00",
+ "2025-06-02 14:39:00+00:00",
+ "1688",
+ "2586448056601340655",
+ "2586448056601340655"
+ ],
+ [
+ "26",
+ "1871328",
+ "5.0",
+ "0.0",
+ "2025-05-29 13:08:21+00:00",
+ "2025-06-03 13:08:21+00:00",
+ "淘天",
+ "2585944419692538788",
+ "501566-187132829024652036"
+ ],
+ [
+ "27",
+ "1871325",
+ "5.0",
+ "0.0",
+ "2025-05-29 13:13:12+00:00",
+ "2025-06-03 13:13:12+00:00",
+ "1688",
+ "2586259956829340655",
+ "2586259956829340655"
+ ],
+ [
+ "28",
+ "1871321",
+ "5.0",
+ "0.0",
+ "2025-05-29 13:09:21+00:00",
+ "2025-06-03 13:09:21+00:00",
+ "淘天",
+ "2586950761285538788",
+ "501566-187132129024582904"
+ ],
+ [
+ "29",
+ "1871427",
+ "5.0",
+ "0.0",
+ "2025-05-29 17:53:42+00:00",
+ "2025-06-03 17:53:42+00:00",
+ "1688",
+ "2587394317530340655",
+ "2587394317530340655"
+ ],
+ [
+ "30",
+ "1871311",
+ "3.0",
+ "0.0",
+ "2025-05-29 15:24:37+00:00",
+ "2025-06-01 15:24:37+00:00",
+ "淘天",
+ "2587197865978219261",
+ "1748502201757"
+ ],
+ [
+ "31",
+ "1871279",
+ "5.0",
+ "0.0",
+ "2025-05-29 13:22:05+00:00",
+ "2025-06-03 13:22:05+00:00",
+ "1688",
+ "2586172152427340655",
+ "2586172152427340655"
+ ],
+ [
+ "32",
+ "1871275",
+ "5.0",
+ "0.0",
+ "2025-05-29 11:32:47+00:00",
+ "2025-06-03 11:32:47+00:00",
+ "淘天",
+ "2586173376131538788",
+ "501566-187127529024321722"
+ ],
+ [
+ "33",
+ "1871488",
+ "4.0",
+ "3.0",
+ "2025-05-29 17:24:19+00:00",
+ "2025-06-02 17:24:19+00:00",
+ "淘天",
+ "2586701748701538788",
+ "501566-187148829024292162"
+ ],
+ [
+ "34",
+ "1871271",
+ "5.0",
+ "0.0",
+ "2025-05-29 15:12:41+00:00",
+ "2025-06-03 15:12:41+00:00",
+ "淘天",
+ "2586574490907219261",
+ "1748500080517"
+ ],
+ [
+ "35",
+ "1871264",
+ "5.0",
+ "0.0",
+ "2025-05-29 13:46:25+00:00",
+ "2025-06-03 13:46:25+00:00",
+ "1688",
+ "2587078993310340655",
+ "2587078993310340655"
+ ],
+ [
+ "36",
+ "1871237",
+ "5.0",
+ "0.0",
+ "2025-05-29 11:39:23+00:00",
+ "2025-06-03 11:39:23+00:00",
+ "1688",
+ "2586290990951340655",
+ "2586290990951340655"
+ ],
+ [
+ "37",
+ "1871285",
+ "5.0",
+ "0.0",
+ "2025-05-29 17:01:31+00:00",
+ "2025-06-03 17:01:31+00:00",
+ "1688",
+ "2586572256272340655",
+ "2586572256272340655"
+ ],
+ [
+ "38",
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null
+ ],
+ [
+ "39",
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null
+ ],
+ [
+ "40",
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null
+ ],
+ [
+ "41",
+ "1871229",
+ "5.0",
+ "0.0",
+ "2025-05-29 11:12:41+00:00",
+ "2025-06-03 11:12:41+00:00",
+ "1688",
+ "2586266222731340655",
+ "2586266222731340655"
+ ],
+ [
+ "42",
+ "1871224",
+ "5.0",
+ "0.0",
+ "2025-05-29 11:04:09+00:00",
+ "2025-06-03 11:04:09+00:00",
+ "1688",
+ "2586250310081340655",
+ "2586250310081340655"
+ ],
+ [
+ "43",
+ "1871494",
+ "5.0",
+ "3.0",
+ "2025-05-29 17:55:54+00:00",
+ "2025-06-03 17:55:54+00:00",
+ "1688",
+ "2587438345355340655",
+ "2587438345355340655"
+ ],
+ [
+ "44",
+ "1871211",
+ "5.0",
+ "0.0",
+ "2025-05-29 10:53:54+00:00",
+ "2025-06-03 10:53:54+00:00",
+ "1688",
+ "2586085464690340655",
+ "2586085464690340655"
+ ],
+ [
+ "45",
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null
+ ],
+ [
+ "46",
+ "1871217",
+ "5.0",
+ "0.0",
+ "2025-05-29 13:11:46+00:00",
+ "2025-06-03 13:11:46+00:00",
+ "淘天",
+ "4361308743534622839",
+ "1748495352189"
+ ],
+ [
+ "47",
+ "1871423",
+ "5.0",
+ "5.0",
+ "2025-05-29 17:27:11+00:00",
+ "2025-06-03 17:27:11+00:00",
+ "1688",
+ "2587381285816340655",
+ "2587381285816340655"
+ ],
+ [
+ "48",
+ "1871181",
+ "5.0",
+ "0.0",
+ "2025-05-29 10:30:13+00:00",
+ "2025-06-03 10:30:13+00:00",
+ "1688",
+ "2585723127206340655",
+ "2585723127206340655"
+ ],
+ [
+ "49",
+ "1871175",
+ "5.0",
+ "0.0",
+ "2025-05-29 10:42:17+00:00",
+ "2025-06-03 10:42:17+00:00",
+ "淘天",
+ "2586047844742538788",
+ "501566-187117529023447247"
+ ]
+ ],
+ "shape": {
+ "columns": 8,
+ "rows": 118
+ }
+ },
+ "text/html": [
+ "\n",
+ "\n",
+ "
\n",
+ " \n",
+ " \n",
+ " | \n",
+ " 交易ID | \n",
+ " 下单发货时间 | \n",
+ " 维护发货时间 | \n",
+ " 支付时间 | \n",
+ " 最大发货时间 | \n",
+ " 交易平台 | \n",
+ " 交易号 | \n",
+ " 交易平台订单号 | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " | 0 | \n",
+ " 1871514 | \n",
+ " 5.0 | \n",
+ " 0.0 | \n",
+ " 2025-05-29 17:49:40+00:00 | \n",
+ " 2025-06-03 17:49:40+00:00 | \n",
+ " 淘天 | \n",
+ " 2586394887255538788 | \n",
+ " 501566-187151429026196065 | \n",
+ "
\n",
+ " \n",
+ " | 1 | \n",
+ " 1871511 | \n",
+ " 5.0 | \n",
+ " 3.0 | \n",
+ " 2025-05-29 17:45:57+00:00 | \n",
+ " 2025-06-03 17:45:57+00:00 | \n",
+ " 1688 | \n",
+ " 2586866558699340655 | \n",
+ " 2586866558699340655 | \n",
+ "
\n",
+ " \n",
+ " | 2 | \n",
+ " 1871510 | \n",
+ " 4.0 | \n",
+ " 5.0 | \n",
+ " 2025-05-29 17:38:32+00:00 | \n",
+ " 2025-06-03 17:38:32+00:00 | \n",
+ " 淘天 | \n",
+ " 2586724428509538788 | \n",
+ " 501566-187151029026079158 | \n",
+ "
\n",
+ " \n",
+ " | 3 | \n",
+ " 1871507 | \n",
+ " 4.0 | \n",
+ " 2.0 | \n",
+ " 2025-05-29 17:31:48+00:00 | \n",
+ " 2025-06-02 17:31:48+00:00 | \n",
+ " 1688 | \n",
+ " 2586369831696340655 | \n",
+ " 2586369831696340655 | \n",
+ "
\n",
+ " \n",
+ " | 4 | \n",
+ " None | \n",
+ " NaN | \n",
+ " NaN | \n",
+ " NaT | \n",
+ " NaT | \n",
+ " None | \n",
+ " None | \n",
+ " None | \n",
+ "
\n",
+ " \n",
+ " | ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ "
\n",
+ " \n",
+ " | 113 | \n",
+ " None | \n",
+ " NaN | \n",
+ " NaN | \n",
+ " NaT | \n",
+ " NaT | \n",
+ " None | \n",
+ " None | \n",
+ " None | \n",
+ "
\n",
+ " \n",
+ " | 114 | \n",
+ " None | \n",
+ " NaN | \n",
+ " NaN | \n",
+ " NaT | \n",
+ " NaT | \n",
+ " None | \n",
+ " None | \n",
+ " None | \n",
+ "
\n",
+ " \n",
+ " | 115 | \n",
+ " None | \n",
+ " NaN | \n",
+ " NaN | \n",
+ " NaT | \n",
+ " NaT | \n",
+ " None | \n",
+ " None | \n",
+ " None | \n",
+ "
\n",
+ " \n",
+ " | 116 | \n",
+ " None | \n",
+ " NaN | \n",
+ " NaN | \n",
+ " NaT | \n",
+ " NaT | \n",
+ " None | \n",
+ " None | \n",
+ " None | \n",
+ "
\n",
+ " \n",
+ " | 117 | \n",
+ " None | \n",
+ " NaN | \n",
+ " NaN | \n",
+ " NaT | \n",
+ " NaT | \n",
+ " None | \n",
+ " None | \n",
+ " None | \n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
118 rows × 8 columns
\n",
+ "
"
+ ],
+ "text/plain": [
+ " 交易ID 下单发货时间 维护发货时间 支付时间 \\\n",
+ "0 1871514 5.0 0.0 2025-05-29 17:49:40+00:00 \n",
+ "1 1871511 5.0 3.0 2025-05-29 17:45:57+00:00 \n",
+ "2 1871510 4.0 5.0 2025-05-29 17:38:32+00:00 \n",
+ "3 1871507 4.0 2.0 2025-05-29 17:31:48+00:00 \n",
+ "4 None NaN NaN NaT \n",
+ ".. ... ... ... ... \n",
+ "113 None NaN NaN NaT \n",
+ "114 None NaN NaN NaT \n",
+ "115 None NaN NaN NaT \n",
+ "116 None NaN NaN NaT \n",
+ "117 None NaN NaN NaT \n",
+ "\n",
+ " 最大发货时间 交易平台 交易号 \\\n",
+ "0 2025-06-03 17:49:40+00:00 淘天 2586394887255538788 \n",
+ "1 2025-06-03 17:45:57+00:00 1688 2586866558699340655 \n",
+ "2 2025-06-03 17:38:32+00:00 淘天 2586724428509538788 \n",
+ "3 2025-06-02 17:31:48+00:00 1688 2586369831696340655 \n",
+ "4 NaT None None \n",
+ ".. ... ... ... \n",
+ "113 NaT None None \n",
+ "114 NaT None None \n",
+ "115 NaT None None \n",
+ "116 NaT None None \n",
+ "117 NaT None None \n",
+ "\n",
+ " 交易平台订单号 \n",
+ "0 501566-187151429026196065 \n",
+ "1 2586866558699340655 \n",
+ "2 501566-187151029026079158 \n",
+ "3 2586369831696340655 \n",
+ "4 None \n",
+ ".. ... \n",
+ "113 None \n",
+ "114 None \n",
+ "115 None \n",
+ "116 None \n",
+ "117 None \n",
+ "\n",
+ "[118 rows x 8 columns]"
+ ]
+ },
+ "execution_count": 32,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "fs_cols"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "fs_cols = resultdf.apply(lambda x: get_fs(x), axis=1, result_type=\"expand\")"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 39,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "fs_cols.columns = [\"交易ID\",'下单发货时间', '维护发货时间','支付时间','最大发货时间','交易平台','交易号','交易平台订单号']\n",
+ "resultdf = pd.concat([resultdf, fs_cols], axis=1)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 40,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "application/vnd.microsoft.datawrangler.viewer.v0+json": {
+ "columns": [
+ {
+ "name": "index",
+ "rawType": "int64",
+ "type": "integer"
+ },
+ {
+ "name": "跟单任务ID",
+ "rawType": "int64",
+ "type": "integer"
+ },
+ {
+ "name": "采购单号",
+ "rawType": "int64",
+ "type": "integer"
+ },
+ {
+ "name": "交易ID",
+ "rawType": "object",
+ "type": "string"
+ },
+ {
+ "name": "下单发货时间",
+ "rawType": "float64",
+ "type": "float"
+ },
+ {
+ "name": "维护发货时间",
+ "rawType": "float64",
+ "type": "float"
+ },
+ {
+ "name": "支付时间",
+ "rawType": "datetime64[ns, UTC]",
+ "type": "unknown"
+ },
+ {
+ "name": "最大发货时间",
+ "rawType": "datetime64[ns, UTC]",
+ "type": "unknown"
+ },
+ {
+ "name": "交易平台",
+ "rawType": "object",
+ "type": "string"
+ },
+ {
+ "name": "交易号",
+ "rawType": "object",
+ "type": "string"
+ },
+ {
+ "name": "交易平台订单号",
+ "rawType": "object",
+ "type": "string"
+ }
+ ],
+ "ref": "cb539345-eef0-47c0-b4c1-578a3eb97ce2",
+ "rows": [
+ [
+ "0",
+ "359974",
+ "2902619",
+ "1871514",
+ "5.0",
+ "0.0",
+ "2025-05-29 17:49:40+00:00",
+ "2025-06-03 17:49:40+00:00",
+ "淘天",
+ "2586394887255538788",
+ "501566-187151429026196065"
+ ],
+ [
+ "1",
+ "359970",
+ "2902615",
+ "1871511",
+ "5.0",
+ "3.0",
+ "2025-05-29 17:45:57+00:00",
+ "2025-06-03 17:45:57+00:00",
+ "1688",
+ "2586866558699340655",
+ "2586866558699340655"
+ ]
+ ],
+ "shape": {
+ "columns": 10,
+ "rows": 2
+ }
+ },
+ "text/html": [
+ "\n",
+ "\n",
+ "
\n",
+ " \n",
+ " \n",
+ " | \n",
+ " 跟单任务ID | \n",
+ " 采购单号 | \n",
+ " 交易ID | \n",
+ " 下单发货时间 | \n",
+ " 维护发货时间 | \n",
+ " 支付时间 | \n",
+ " 最大发货时间 | \n",
+ " 交易平台 | \n",
+ " 交易号 | \n",
+ " 交易平台订单号 | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " | 0 | \n",
+ " 359974 | \n",
+ " 2902619 | \n",
+ " 1871514 | \n",
+ " 5.0 | \n",
+ " 0.0 | \n",
+ " 2025-05-29 17:49:40+00:00 | \n",
+ " 2025-06-03 17:49:40+00:00 | \n",
+ " 淘天 | \n",
+ " 2586394887255538788 | \n",
+ " 501566-187151429026196065 | \n",
+ "
\n",
+ " \n",
+ " | 1 | \n",
+ " 359970 | \n",
+ " 2902615 | \n",
+ " 1871511 | \n",
+ " 5.0 | \n",
+ " 3.0 | \n",
+ " 2025-05-29 17:45:57+00:00 | \n",
+ " 2025-06-03 17:45:57+00:00 | \n",
+ " 1688 | \n",
+ " 2586866558699340655 | \n",
+ " 2586866558699340655 | \n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
"
+ ],
+ "text/plain": [
+ " 跟单任务ID 采购单号 交易ID 下单发货时间 维护发货时间 支付时间 \\\n",
+ "0 359974 2902619 1871514 5.0 0.0 2025-05-29 17:49:40+00:00 \n",
+ "1 359970 2902615 1871511 5.0 3.0 2025-05-29 17:45:57+00:00 \n",
+ "\n",
+ " 最大发货时间 交易平台 交易号 \\\n",
+ "0 2025-06-03 17:49:40+00:00 淘天 2586394887255538788 \n",
+ "1 2025-06-03 17:45:57+00:00 1688 2586866558699340655 \n",
+ "\n",
+ " 交易平台订单号 \n",
+ "0 501566-187151429026196065 \n",
+ "1 2586866558699340655 "
+ ]
+ },
+ "execution_count": 40,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "resultdf[:2]"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 43,
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "状态码: 201\n",
+ "响应内容: {'message': '录入成功'}\n"
+ ]
+ }
+ ],
+ "source": [
+ "data = resultdf[:2].to_dict(orient='records')\n",
+ "headers = {\"Content-Type\": \"application/json; charset=utf-8\"}\n",
+ "url = \"http://192.168.100.44/rpaapi/followup\" \n",
+ "response = requests.post(url, headers=headers, data=json.dumps(data))\n",
+ "print(\"状态码:\", response.status_code)\n",
+ "print(\"响应内容:\", response.json())"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 45,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "application/vnd.microsoft.datawrangler.viewer.v0+json": {
+ "columns": [
+ {
+ "name": "index",
+ "rawType": "int64",
+ "type": "integer"
+ },
+ {
+ "name": "跟单任务ID",
+ "rawType": "int64",
+ "type": "integer"
+ },
+ {
+ "name": "采购单号",
+ "rawType": "int64",
+ "type": "integer"
+ },
+ {
+ "name": "交易ID",
+ "rawType": "object",
+ "type": "unknown"
+ },
+ {
+ "name": "下单发货时间",
+ "rawType": "float64",
+ "type": "float"
+ },
+ {
+ "name": "维护发货时间",
+ "rawType": "float64",
+ "type": "float"
+ },
+ {
+ "name": "支付时间",
+ "rawType": "object",
+ "type": "unknown"
+ },
+ {
+ "name": "最大发货时间",
+ "rawType": "object",
+ "type": "unknown"
+ },
+ {
+ "name": "交易平台",
+ "rawType": "object",
+ "type": "unknown"
+ },
+ {
+ "name": "交易号",
+ "rawType": "object",
+ "type": "unknown"
+ },
+ {
+ "name": "交易平台订单号",
+ "rawType": "object",
+ "type": "unknown"
+ },
+ {
+ "name": "pay_date",
+ "rawType": "object",
+ "type": "unknown"
+ }
+ ],
+ "ref": "149160c6-811d-4ecb-b083-f13e17485053",
+ "rows": [
+ [
+ "0",
+ "359974",
+ "2902619",
+ "1871514",
+ "5.0",
+ "0.0",
+ "2025-05-29",
+ "2025-06-03",
+ "淘天",
+ "2586394887255538788",
+ "501566-187151429026196065",
+ "2025-05-29"
+ ],
+ [
+ "1",
+ "359970",
+ "2902615",
+ "1871511",
+ "5.0",
+ "3.0",
+ "2025-05-29",
+ "2025-06-03",
+ "1688",
+ "2586866558699340655",
+ "2586866558699340655",
+ "2025-05-29"
+ ],
+ [
+ "2",
+ "359964",
+ "2902607",
+ "1871510",
+ "4.0",
+ "5.0",
+ "2025-05-29",
+ "2025-06-03",
+ "淘天",
+ "2586724428509538788",
+ "501566-187151029026079158",
+ "2025-05-29"
+ ],
+ [
+ "3",
+ "359957",
+ "2902596",
+ "1871507",
+ "4.0",
+ "2.0",
+ "2025-05-29",
+ "2025-06-02",
+ "1688",
+ "2586369831696340655",
+ "2586369831696340655",
+ "2025-05-29"
+ ],
+ [
+ "4",
+ "359952",
+ "2902588",
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null
+ ],
+ [
+ "5",
+ "359948",
+ "2902584",
+ "1871487",
+ "5.0",
+ "0.0",
+ "2025-05-29",
+ "2025-06-03",
+ "1688",
+ "2586712116394340655",
+ "2586712116394340655",
+ "2025-05-29"
+ ],
+ [
+ "6",
+ "359945",
+ "2902579",
+ "1871489",
+ "5.0",
+ "0.0",
+ "2025-05-29",
+ "2025-06-03",
+ "1688",
+ "2586843158361340655",
+ "2586843158361340655",
+ "2025-05-29"
+ ],
+ [
+ "7",
+ "359942",
+ "2902574",
+ "1871504",
+ "5.0",
+ "0.0",
+ "2025-05-29",
+ "2025-06-03",
+ "淘天",
+ "2586391611043219261",
+ "1748511690120",
+ "2025-05-29"
+ ],
+ [
+ "8",
+ "359939",
+ "2902570",
+ "1871464",
+ "4.0",
+ "0.0",
+ "2025-05-29",
+ "2025-06-02",
+ "淘天",
+ "2586603684278538788",
+ "501566-187146429025706383",
+ "2025-05-29"
+ ],
+ [
+ "9",
+ "359935",
+ "2902565",
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null
+ ],
+ [
+ "10",
+ "359932",
+ "2902561",
+ "1871446",
+ "4.0",
+ "0.0",
+ "2025-05-29",
+ "2025-06-02",
+ "1688",
+ "2586713774989340655",
+ "2586713774989340655",
+ "2025-05-29"
+ ],
+ [
+ "11",
+ "359926",
+ "2902553",
+ "1871492",
+ "5.0",
+ "0.0",
+ "2025-05-29",
+ "2025-06-03",
+ "淘天",
+ "2587422217794219261",
+ "1748511214446",
+ "2025-05-29"
+ ],
+ [
+ "12",
+ "359923",
+ "2902550",
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null
+ ],
+ [
+ "13",
+ "359920",
+ "2902547",
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null
+ ],
+ [
+ "14",
+ "359916",
+ "2902543",
+ "1871438",
+ "5.0",
+ "0.0",
+ "2025-05-29",
+ "2025-06-03",
+ "淘天",
+ "2586693324476219261",
+ "1748510063327",
+ "2025-05-29"
+ ],
+ [
+ "15",
+ "359906",
+ "2902531",
+ "1871398",
+ "5.0",
+ "0.0",
+ "2025-05-29",
+ "2025-06-03",
+ "淘天",
+ "2587229653074538788",
+ "501566-187139829025312437",
+ "2025-05-29"
+ ],
+ [
+ "16",
+ "359902",
+ "2902527",
+ "1871388",
+ "4.0",
+ "0.0",
+ "2025-05-29",
+ "2025-06-02",
+ "1688",
+ "2586139179096340655",
+ "2586139179096340655",
+ "2025-05-29"
+ ],
+ [
+ "17",
+ "359899",
+ "2902524",
+ "1871418",
+ "5.0",
+ "0.0",
+ "2025-05-29",
+ "2025-06-03",
+ "淘天",
+ "2587321165625219261",
+ "1748507467551",
+ "2025-05-29"
+ ],
+ [
+ "18",
+ "359893",
+ "2902517",
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null
+ ],
+ [
+ "19",
+ "359885",
+ "2902504",
+ "1871417",
+ "5.0",
+ "0.0",
+ "2025-05-29",
+ "2025-06-03",
+ "淘天",
+ "2586615528437219261",
+ "1748507336231",
+ "2025-05-29"
+ ],
+ [
+ "20",
+ "359879",
+ "2902496",
+ "1871353",
+ "5.0",
+ "0.0",
+ "2025-05-29",
+ "2025-06-03",
+ "淘天",
+ "2587088497261538788",
+ "501566-187135329024968677",
+ "2025-05-29"
+ ],
+ [
+ "21",
+ "359876",
+ "2902491",
+ "1871348",
+ "5.0",
+ "0.0",
+ "2025-05-29",
+ "2025-06-03",
+ "淘天",
+ "2587071793982538788",
+ "501566-187134829024913484",
+ "2025-05-29"
+ ],
+ [
+ "22",
+ "359871",
+ "2902484",
+ "1871345",
+ "5.0",
+ "0.0",
+ "2025-05-29",
+ "2025-06-03",
+ "1688",
+ "2586508466020340655",
+ "2586508466020340655",
+ "2025-05-29"
+ ],
+ [
+ "23",
+ "359865",
+ "2902476",
+ "1871336",
+ "4.0",
+ "0.0",
+ "2025-05-29",
+ "2025-06-02",
+ "淘天",
+ "2586347292443538788",
+ "501566-187133629024764267",
+ "2025-05-29"
+ ],
+ [
+ "24",
+ "359862",
+ "2902473",
+ "1871333",
+ "5.0",
+ "0.0",
+ "2025-05-29",
+ "2025-06-03",
+ "1688",
+ "2586340380550340655",
+ "2586340380550340655",
+ "2025-05-29"
+ ],
+ [
+ "25",
+ "359858",
+ "2902469",
+ "1871376",
+ "4.0",
+ "2.0",
+ "2025-05-29",
+ "2025-06-02",
+ "1688",
+ "2586448056601340655",
+ "2586448056601340655",
+ "2025-05-29"
+ ],
+ [
+ "26",
+ "359854",
+ "2902465",
+ "1871328",
+ "5.0",
+ "0.0",
+ "2025-05-29",
+ "2025-06-03",
+ "淘天",
+ "2585944419692538788",
+ "501566-187132829024652036",
+ "2025-05-29"
+ ],
+ [
+ "27",
+ "359851",
+ "2902462",
+ "1871325",
+ "5.0",
+ "0.0",
+ "2025-05-29",
+ "2025-06-03",
+ "1688",
+ "2586259956829340655",
+ "2586259956829340655",
+ "2025-05-29"
+ ],
+ [
+ "28",
+ "359847",
+ "2902458",
+ "1871321",
+ "5.0",
+ "0.0",
+ "2025-05-29",
+ "2025-06-03",
+ "淘天",
+ "2586950761285538788",
+ "501566-187132129024582904",
+ "2025-05-29"
+ ],
+ [
+ "29",
+ "359841",
+ "2902452",
+ "1871427",
+ "5.0",
+ "0.0",
+ "2025-05-29",
+ "2025-06-03",
+ "1688",
+ "2587394317530340655",
+ "2587394317530340655",
+ "2025-05-29"
+ ],
+ [
+ "30",
+ "359838",
+ "2902449",
+ "1871311",
+ "3.0",
+ "0.0",
+ "2025-05-29",
+ "2025-06-01",
+ "淘天",
+ "2587197865978219261",
+ "1748502201757",
+ "2025-05-29"
+ ],
+ [
+ "31",
+ "359829",
+ "2902438",
+ "1871279",
+ "5.0",
+ "0.0",
+ "2025-05-29",
+ "2025-06-03",
+ "1688",
+ "2586172152427340655",
+ "2586172152427340655",
+ "2025-05-29"
+ ],
+ [
+ "32",
+ "359825",
+ "2902432",
+ "1871275",
+ "5.0",
+ "0.0",
+ "2025-05-29",
+ "2025-06-03",
+ "淘天",
+ "2586173376131538788",
+ "501566-187127529024321722",
+ "2025-05-29"
+ ],
+ [
+ "33",
+ "359822",
+ "2902429",
+ "1871488",
+ "4.0",
+ "3.0",
+ "2025-05-29",
+ "2025-06-02",
+ "淘天",
+ "2586701748701538788",
+ "501566-187148829024292162",
+ "2025-05-29"
+ ],
+ [
+ "34",
+ "359818",
+ "2902424",
+ "1871271",
+ "5.0",
+ "0.0",
+ "2025-05-29",
+ "2025-06-03",
+ "淘天",
+ "2586574490907219261",
+ "1748500080517",
+ "2025-05-29"
+ ],
+ [
+ "35",
+ "359814",
+ "2902420",
+ "1871264",
+ "5.0",
+ "0.0",
+ "2025-05-29",
+ "2025-06-03",
+ "1688",
+ "2587078993310340655",
+ "2587078993310340655",
+ "2025-05-29"
+ ],
+ [
+ "36",
+ "359810",
+ "2902416",
+ "1871237",
+ "5.0",
+ "0.0",
+ "2025-05-29",
+ "2025-06-03",
+ "1688",
+ "2586290990951340655",
+ "2586290990951340655",
+ "2025-05-29"
+ ],
+ [
+ "37",
+ "359807",
+ "2902413",
+ "1871285",
+ "5.0",
+ "0.0",
+ "2025-05-29",
+ "2025-06-03",
+ "1688",
+ "2586572256272340655",
+ "2586572256272340655",
+ "2025-05-29"
+ ],
+ [
+ "38",
+ "359804",
+ "2902410",
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null
+ ],
+ [
+ "39",
+ "359801",
+ "2902407",
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null
+ ],
+ [
+ "40",
+ "359797",
+ "2902401",
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null
+ ],
+ [
+ "41",
+ "359793",
+ "2902396",
+ "1871229",
+ "5.0",
+ "0.0",
+ "2025-05-29",
+ "2025-06-03",
+ "1688",
+ "2586266222731340655",
+ "2586266222731340655",
+ "2025-05-29"
+ ],
+ [
+ "42",
+ "359788",
+ "2902390",
+ "1871224",
+ "5.0",
+ "0.0",
+ "2025-05-29",
+ "2025-06-03",
+ "1688",
+ "2586250310081340655",
+ "2586250310081340655",
+ "2025-05-29"
+ ],
+ [
+ "43",
+ "359784",
+ "2902386",
+ "1871494",
+ "5.0",
+ "3.0",
+ "2025-05-29",
+ "2025-06-03",
+ "1688",
+ "2587438345355340655",
+ "2587438345355340655",
+ "2025-05-29"
+ ],
+ [
+ "44",
+ "359781",
+ "2902382",
+ "1871211",
+ "5.0",
+ "0.0",
+ "2025-05-29",
+ "2025-06-03",
+ "1688",
+ "2586085464690340655",
+ "2586085464690340655",
+ "2025-05-29"
+ ],
+ [
+ "45",
+ "359767",
+ "2902368",
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null
+ ],
+ [
+ "46",
+ "359763",
+ "2902364",
+ "1871217",
+ "5.0",
+ "0.0",
+ "2025-05-29",
+ "2025-06-03",
+ "淘天",
+ "4361308743534622839",
+ "1748495352189",
+ "2025-05-29"
+ ],
+ [
+ "47",
+ "359758",
+ "2902357",
+ "1871423",
+ "5.0",
+ "5.0",
+ "2025-05-29",
+ "2025-06-03",
+ "1688",
+ "2587381285816340655",
+ "2587381285816340655",
+ "2025-05-29"
+ ],
+ [
+ "48",
+ "359752",
+ "2902351",
+ "1871181",
+ "5.0",
+ "0.0",
+ "2025-05-29",
+ "2025-06-03",
+ "1688",
+ "2585723127206340655",
+ "2585723127206340655",
+ "2025-05-29"
+ ],
+ [
+ "49",
+ "359748",
+ "2902344",
+ "1871175",
+ "5.0",
+ "0.0",
+ "2025-05-29",
+ "2025-06-03",
+ "淘天",
+ "2586047844742538788",
+ "501566-187117529023447247",
+ "2025-05-29"
+ ]
+ ],
+ "shape": {
+ "columns": 11,
+ "rows": 98
+ }
+ },
+ "text/html": [
+ "\n",
+ "\n",
+ "
\n",
+ " \n",
+ " \n",
+ " | \n",
+ " 跟单任务ID | \n",
+ " 采购单号 | \n",
+ " 交易ID | \n",
+ " 下单发货时间 | \n",
+ " 维护发货时间 | \n",
+ " 支付时间 | \n",
+ " 最大发货时间 | \n",
+ " 交易平台 | \n",
+ " 交易号 | \n",
+ " 交易平台订单号 | \n",
+ " pay_date | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " | 0 | \n",
+ " 359974 | \n",
+ " 2902619 | \n",
+ " 1871514 | \n",
+ " 5.0 | \n",
+ " 0.0 | \n",
+ " 2025-05-29 | \n",
+ " 2025-06-03 | \n",
+ " 淘天 | \n",
+ " 2586394887255538788 | \n",
+ " 501566-187151429026196065 | \n",
+ " 2025-05-29 | \n",
+ "
\n",
+ " \n",
+ " | 1 | \n",
+ " 359970 | \n",
+ " 2902615 | \n",
+ " 1871511 | \n",
+ " 5.0 | \n",
+ " 3.0 | \n",
+ " 2025-05-29 | \n",
+ " 2025-06-03 | \n",
+ " 1688 | \n",
+ " 2586866558699340655 | \n",
+ " 2586866558699340655 | \n",
+ " 2025-05-29 | \n",
+ "
\n",
+ " \n",
+ " | 2 | \n",
+ " 359964 | \n",
+ " 2902607 | \n",
+ " 1871510 | \n",
+ " 4.0 | \n",
+ " 5.0 | \n",
+ " 2025-05-29 | \n",
+ " 2025-06-03 | \n",
+ " 淘天 | \n",
+ " 2586724428509538788 | \n",
+ " 501566-187151029026079158 | \n",
+ " 2025-05-29 | \n",
+ "
\n",
+ " \n",
+ " | 3 | \n",
+ " 359957 | \n",
+ " 2902596 | \n",
+ " 1871507 | \n",
+ " 4.0 | \n",
+ " 2.0 | \n",
+ " 2025-05-29 | \n",
+ " 2025-06-02 | \n",
+ " 1688 | \n",
+ " 2586369831696340655 | \n",
+ " 2586369831696340655 | \n",
+ " 2025-05-29 | \n",
+ "
\n",
+ " \n",
+ " | 4 | \n",
+ " 359952 | \n",
+ " 2902588 | \n",
+ " None | \n",
+ " NaN | \n",
+ " NaN | \n",
+ " NaN | \n",
+ " NaN | \n",
+ " None | \n",
+ " None | \n",
+ " None | \n",
+ " NaN | \n",
+ "
\n",
+ " \n",
+ " | ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ "
\n",
+ " \n",
+ " | 93 | \n",
+ " 359509 | \n",
+ " 2902095 | \n",
+ " 1871080 | \n",
+ " 5.0 | \n",
+ " 0.0 | \n",
+ " 2025-05-29 | \n",
+ " 2025-06-03 | \n",
+ " 淘天 | \n",
+ " 4361008359464622839 | \n",
+ " 1748485588596 | \n",
+ " 2025-05-29 | \n",
+ "
\n",
+ " \n",
+ " | 94 | \n",
+ " 359506 | \n",
+ " 2902092 | \n",
+ " 1870874 | \n",
+ " 4.0 | \n",
+ " 0.0 | \n",
+ " 2025-05-29 | \n",
+ " 2025-06-02 | \n",
+ " 淘天 | \n",
+ " 2585831448930538788 | \n",
+ " 501566-187087429020924340 | \n",
+ " 2025-05-29 | \n",
+ "
\n",
+ " \n",
+ " | 95 | \n",
+ " 359501 | \n",
+ " 2902087 | \n",
+ " 1871429 | \n",
+ " 4.0 | \n",
+ " 5.0 | \n",
+ " 2025-05-29 | \n",
+ " 2025-06-03 | \n",
+ " 淘天 | \n",
+ " 2586690554346538788 | \n",
+ " 501566-187142929020871576 | \n",
+ " 2025-05-29 | \n",
+ "
\n",
+ " \n",
+ " | 96 | \n",
+ " 359488 | \n",
+ " 2901999 | \n",
+ " 1871419 | \n",
+ " 5.0 | \n",
+ " 5.0 | \n",
+ " 2025-05-29 | \n",
+ " 2025-06-03 | \n",
+ " 1688 | \n",
+ " 2587375417379340655 | \n",
+ " 2587375417379340655 | \n",
+ " 2025-05-29 | \n",
+ "
\n",
+ " \n",
+ " | 97 | \n",
+ " 359486 | \n",
+ " 2901997 | \n",
+ " 1871419 | \n",
+ " 5.0 | \n",
+ " 5.0 | \n",
+ " 2025-05-29 | \n",
+ " 2025-06-03 | \n",
+ " 1688 | \n",
+ " 2587375417379340655 | \n",
+ " 2587375417379340655 | \n",
+ " 2025-05-29 | \n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
98 rows × 11 columns
\n",
+ "
"
+ ],
+ "text/plain": [
+ " 跟单任务ID 采购单号 交易ID 下单发货时间 维护发货时间 支付时间 最大发货时间 交易平台 \\\n",
+ "0 359974 2902619 1871514 5.0 0.0 2025-05-29 2025-06-03 淘天 \n",
+ "1 359970 2902615 1871511 5.0 3.0 2025-05-29 2025-06-03 1688 \n",
+ "2 359964 2902607 1871510 4.0 5.0 2025-05-29 2025-06-03 淘天 \n",
+ "3 359957 2902596 1871507 4.0 2.0 2025-05-29 2025-06-02 1688 \n",
+ "4 359952 2902588 None NaN NaN NaN NaN None \n",
+ ".. ... ... ... ... ... ... ... ... \n",
+ "93 359509 2902095 1871080 5.0 0.0 2025-05-29 2025-06-03 淘天 \n",
+ "94 359506 2902092 1870874 4.0 0.0 2025-05-29 2025-06-02 淘天 \n",
+ "95 359501 2902087 1871429 4.0 5.0 2025-05-29 2025-06-03 淘天 \n",
+ "96 359488 2901999 1871419 5.0 5.0 2025-05-29 2025-06-03 1688 \n",
+ "97 359486 2901997 1871419 5.0 5.0 2025-05-29 2025-06-03 1688 \n",
+ "\n",
+ " 交易号 交易平台订单号 pay_date \n",
+ "0 2586394887255538788 501566-187151429026196065 2025-05-29 \n",
+ "1 2586866558699340655 2586866558699340655 2025-05-29 \n",
+ "2 2586724428509538788 501566-187151029026079158 2025-05-29 \n",
+ "3 2586369831696340655 2586369831696340655 2025-05-29 \n",
+ "4 None None NaN \n",
+ ".. ... ... ... \n",
+ "93 4361008359464622839 1748485588596 2025-05-29 \n",
+ "94 2585831448930538788 501566-187087429020924340 2025-05-29 \n",
+ "95 2586690554346538788 501566-187142929020871576 2025-05-29 \n",
+ "96 2587375417379340655 2587375417379340655 2025-05-29 \n",
+ "97 2587375417379340655 2587375417379340655 2025-05-29 \n",
+ "\n",
+ "[98 rows x 11 columns]"
+ ]
+ },
+ "execution_count": 45,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "resultdf"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 44,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "[{'跟单任务ID': 359974,\n",
+ " '采购单号': 2902619,\n",
+ " '交易ID': '1871514',\n",
+ " '下单发货时间': 5.0,\n",
+ " '维护发货时间': 0.0,\n",
+ " '支付时间': '2025-05-29',\n",
+ " '最大发货时间': '2025-06-03',\n",
+ " '交易平台': '淘天',\n",
+ " '交易号': '2586394887255538788',\n",
+ " '交易平台订单号': '501566-187151429026196065',\n",
+ " 'pay_date': '2025-05-29'},\n",
+ " {'跟单任务ID': 359970,\n",
+ " '采购单号': 2902615,\n",
+ " '交易ID': '1871511',\n",
+ " '下单发货时间': 5.0,\n",
+ " '维护发货时间': 3.0,\n",
+ " '支付时间': '2025-05-29',\n",
+ " '最大发货时间': '2025-06-03',\n",
+ " '交易平台': '1688',\n",
+ " '交易号': '2586866558699340655',\n",
+ " '交易平台订单号': '2586866558699340655',\n",
+ " 'pay_date': '2025-05-29'}]"
+ ]
+ },
+ "execution_count": 44,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "data"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 21,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "resultdf = pd.concat([resultdf, fs_cols], axis=1)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 42,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "for col in ['支付时间', '最大发货时间']:\n",
+ " resultdf[col] = pd.to_datetime(resultdf[col], errors='coerce')\n",
+ " resultdf[col] = resultdf[col].dt.strftime('%Y-%m-%d')\n",
+ "resultdf['pay_date'] = resultdf['支付时间']"
]
},
{
@@ -319,6 +4405,36 @@
"rows_as_dict_list"
]
},
+ {
+ "cell_type": "code",
+ "execution_count": 50,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "url = \"http://192.168.100.44/rpaapi/followup\" \n",
+ "response = requests.get(url).json()\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 51,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "{'key': None, 'task_id': None}"
+ ]
+ },
+ "execution_count": 51,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "response"
+ ]
+ },
{
"cell_type": "code",
"execution_count": null,
@@ -375,7 +4491,7 @@
},
{
"cell_type": "code",
- "execution_count": 1,
+ "execution_count": null,
"metadata": {
"ExecuteTime": {
"end_time": "2025-05-16T15:38:46.563968Z",
@@ -398,7 +4514,7 @@
},
{
"cell_type": "code",
- "execution_count": 2,
+ "execution_count": null,
"metadata": {},
"outputs": [],
"source": [
@@ -412,7 +4528,7 @@
},
{
"cell_type": "code",
- "execution_count": 3,
+ "execution_count": null,
"metadata": {},
"outputs": [],
"source": [
@@ -431,7 +4547,7 @@
},
{
"cell_type": "code",
- "execution_count": 15,
+ "execution_count": null,
"metadata": {
"ExecuteTime": {
"end_time": "2025-05-16T15:38:58.960899Z",
@@ -446,7 +4562,7 @@
},
{
"cell_type": "code",
- "execution_count": 16,
+ "execution_count": null,
"metadata": {
"ExecuteTime": {
"end_time": "2025-05-16T15:39:01.808655Z",
@@ -454,772 +4570,7 @@
},
"collapsed": false
},
- "outputs": [
- {
- "data": {
- "text/html": [
- "\n",
- "\n",
- "
\n",
- " \n",
- " \n",
- " | \n",
- " cpmaso_task_id | \n",
- " buy_id | \n",
- " trade_id | \n",
- " trade_platform_order_num | \n",
- " pay_date | \n",
- " maintain_date | \n",
- " last_task_id | \n",
- " follow_type | \n",
- " max_logis_date | \n",
- " agreed_delivery_time | \n",
- " trans_id | \n",
- " payment_datetime | \n",
- " platform | \n",
- " task_status | \n",
- " need_refund | \n",
- " has_image | \n",
- " clearly_specify_the_delivery_time | \n",
- " one_more_time | \n",
- " create_date | \n",
- " upload_cpmaso | \n",
- "
\n",
- " \n",
- " \n",
- " \n",
- " | 0 | \n",
- " 343636 | \n",
- " 2896029 | \n",
- " 2896029 | \n",
- " 2896029 | \n",
- " 2025-05-20 | \n",
- " 0 | \n",
- " 0 | \n",
- " 1 | \n",
- " 2025-05-21 | \n",
- " None | \n",
- " 1863624 | \n",
- " 1 | \n",
- " 淘天 | \n",
- " 0 | \n",
- " 0 | \n",
- " 0 | \n",
- " 0 | \n",
- " 0 | \n",
- " 2025-05-21 | \n",
- " 0 | \n",
- "
\n",
- " \n",
- " | 1 | \n",
- " 343650 | \n",
- " 2896044 | \n",
- " 2896044 | \n",
- " 2896044 | \n",
- " 2025-05-20 | \n",
- " 0 | \n",
- " 0 | \n",
- " 1 | \n",
- " 2025-05-27 | \n",
- " None | \n",
- " 1863645 | \n",
- " 7 | \n",
- " 淘天 | \n",
- " 0 | \n",
- " 0 | \n",
- " 0 | \n",
- " 0 | \n",
- " 0 | \n",
- " 2025-05-21 | \n",
- " 0 | \n",
- "
\n",
- " \n",
- " | 2 | \n",
- " 345441 | \n",
- " 2896633 | \n",
- " 2896633 | \n",
- " 2896633 | \n",
- " 2025-05-21 | \n",
- " 0 | \n",
- " 0 | \n",
- " 1 | \n",
- " 2025-05-22 | \n",
- " None | \n",
- " 1864349 | \n",
- " 1 | \n",
- " 淘天 | \n",
- " 0 | \n",
- " 0 | \n",
- " 0 | \n",
- " 0 | \n",
- " 0 | \n",
- " 2025-05-22 | \n",
- " 0 | \n",
- "
\n",
- " \n",
- " | 3 | \n",
- " 345460 | \n",
- " 2896653 | \n",
- " 896653 | \n",
- " 896653 | \n",
- " 2025-05-21 | \n",
- " 0 | \n",
- " 0 | \n",
- " 1 | \n",
- " 2025-05-22 | \n",
- " None | \n",
- " 1864373 | \n",
- " 1 | \n",
- " 淘天 | \n",
- " 0 | \n",
- " 0 | \n",
- " 0 | \n",
- " 0 | \n",
- " 0 | \n",
- " 2025-05-22 | \n",
- " 0 | \n",
- "
\n",
- " \n",
- " | 4 | \n",
- " 345510 | \n",
- " 2896706 | \n",
- " 2896706 | \n",
- " 2896706 | \n",
- " 2025-05-21 | \n",
- " 0 | \n",
- " 0 | \n",
- " 1 | \n",
- " 2025-05-23 | \n",
- " None | \n",
- " 1864440 | \n",
- " 2 | \n",
- " 淘天 | \n",
- " 0 | \n",
- " 0 | \n",
- " 0 | \n",
- " 0 | \n",
- " 0 | \n",
- " 2025-05-22 | \n",
- " 0 | \n",
- "
\n",
- " \n",
- " | 5 | \n",
- " 347335 | \n",
- " 2897332 | \n",
- " 2897332 | \n",
- " 2897332 | \n",
- " 2025-05-22 | \n",
- " 0 | \n",
- " 0 | \n",
- " 1 | \n",
- " 2025-05-25 | \n",
- " None | \n",
- " 1865297 | \n",
- " 3 | \n",
- " 淘天 | \n",
- " 0 | \n",
- " 0 | \n",
- " 0 | \n",
- " 0 | \n",
- " 0 | \n",
- " 2025-05-23 | \n",
- " 0 | \n",
- "
\n",
- " \n",
- " | 6 | \n",
- " 347339 | \n",
- " 2897336 | \n",
- " 2897336 | \n",
- " 2897336 | \n",
- " 2025-05-22 | \n",
- " 0 | \n",
- " 0 | \n",
- " 1 | \n",
- " 2025-05-27 | \n",
- " None | \n",
- " 1865301 | \n",
- " 5 | \n",
- " 淘天 | \n",
- " 0 | \n",
- " 0 | \n",
- " 0 | \n",
- " 0 | \n",
- " 0 | \n",
- " 2025-05-23 | \n",
- " 0 | \n",
- "
\n",
- " \n",
- " | 7 | \n",
- " 347345 | \n",
- " 2897342 | \n",
- " 2897342 | \n",
- " 2897342 | \n",
- " 2025-05-22 | \n",
- " 0 | \n",
- " 0 | \n",
- " 1 | \n",
- " 2025-05-25 | \n",
- " None | \n",
- " 1865307 | \n",
- " 3 | \n",
- " 淘天 | \n",
- " 0 | \n",
- " 0 | \n",
- " 0 | \n",
- " 0 | \n",
- " 0 | \n",
- " 2025-05-23 | \n",
- " 0 | \n",
- "
\n",
- " \n",
- " | 8 | \n",
- " 347348 | \n",
- " 2897345 | \n",
- " 2897345 | \n",
- " 2897345 | \n",
- " 2025-05-22 | \n",
- " 0 | \n",
- " 0 | \n",
- " 1 | \n",
- " 2025-05-24 | \n",
- " None | \n",
- " 1865308 | \n",
- " 2 | \n",
- " 淘天 | \n",
- " 0 | \n",
- " 0 | \n",
- " 0 | \n",
- " 0 | \n",
- " 0 | \n",
- " 2025-05-23 | \n",
- " 0 | \n",
- "
\n",
- " \n",
- " | 9 | \n",
- " 347415 | \n",
- " 2897416 | \n",
- " 2897416 | \n",
- " 2897416 | \n",
- " 2025-05-22 | \n",
- " 0 | \n",
- " 0 | \n",
- " 1 | \n",
- " 2025-05-27 | \n",
- " None | \n",
- " 1865406 | \n",
- " 5 | \n",
- " 淘天 | \n",
- " 0 | \n",
- " 0 | \n",
- " 0 | \n",
- " 0 | \n",
- " 0 | \n",
- " 2025-05-23 | \n",
- " 0 | \n",
- "
\n",
- " \n",
- " | 10 | \n",
- " 349155 | \n",
- " 2898014 | \n",
- " 2578499365301538788 | \n",
- " 1747991280236 | \n",
- " 2025-05-23 | \n",
- " 7 | \n",
- " 532 | \n",
- " 1 | \n",
- " 2025-05-30 | \n",
- " None | \n",
- " 1866518 | \n",
- " 7 | \n",
- " 淘天 | \n",
- " 0 | \n",
- " 0 | \n",
- " 0 | \n",
- " 0 | \n",
- " 0 | \n",
- " 2025-05-24 | \n",
- " 0 | \n",
- "
\n",
- " \n",
- " | 11 | \n",
- " 349191 | \n",
- " 2898060 | \n",
- " 2577712694448538788 | \n",
- " 501566-186639528980603464 | \n",
- " 2025-05-23 | \n",
- " 3 | \n",
- " 533 | \n",
- " 1 | \n",
- " 2025-05-28 | \n",
- " None | \n",
- " 1866395 | \n",
- " 5 | \n",
- " 淘天 | \n",
- " 0 | \n",
- " 0 | \n",
- " 0 | \n",
- " 0 | \n",
- " 0 | \n",
- " 2025-05-24 | \n",
- " 0 | \n",
- "
\n",
- " \n",
- " | 12 | \n",
- " 349219 | \n",
- " 2898090 | \n",
- " 2898090 | \n",
- " 2898090 | \n",
- " 2025-05-23 | \n",
- " 0 | \n",
- " 0 | \n",
- " 1 | \n",
- " 2025-05-30 | \n",
- " None | \n",
- " 1866272 | \n",
- " 7 | \n",
- " 淘天 | \n",
- " 0 | \n",
- " 0 | \n",
- " 0 | \n",
- " 0 | \n",
- " 0 | \n",
- " 2025-05-24 | \n",
- " 0 | \n",
- "
\n",
- " \n",
- " | 13 | \n",
- " 349350 | \n",
- " 2898239 | \n",
- " 2898239 | \n",
- " 2898239 | \n",
- " 2025-05-23 | \n",
- " 0 | \n",
- " 0 | \n",
- " 1 | \n",
- " 2025-05-28 | \n",
- " None | \n",
- " 1866500 | \n",
- " 5 | \n",
- " 淘天 | \n",
- " 0 | \n",
- " 0 | \n",
- " 0 | \n",
- " 0 | \n",
- " 0 | \n",
- " 2025-05-24 | \n",
- " 0 | \n",
- "
\n",
- " \n",
- " | 14 | \n",
- " 352340 | \n",
- " 2899178 | \n",
- " 2579933964195538788 | \n",
- " 501566-186750228991783425 | \n",
- " 2025-05-25 | \n",
- " 0 | \n",
- " 537 | \n",
- " 1 | \n",
- " 2025-05-30 | \n",
- " None | \n",
- " 1867502 | \n",
- " 5 | \n",
- " 淘天 | \n",
- " 0 | \n",
- " 0 | \n",
- " 0 | \n",
- " 0 | \n",
- " 0 | \n",
- " 2025-05-26 | \n",
- " 0 | \n",
- "
\n",
- " \n",
- " | 15 | \n",
- " 352363 | \n",
- " 2899201 | \n",
- " 4354718580547688148 | \n",
- " 1748139827823 | \n",
- " 2025-05-25 | \n",
- " 5 | \n",
- " 540 | \n",
- " 1 | \n",
- " 2025-05-30 | \n",
- " None | \n",
- " 1867773 | \n",
- " 3 | \n",
- " 淘天 | \n",
- " 0 | \n",
- " 0 | \n",
- " 0 | \n",
- " 0 | \n",
- " 0 | \n",
- " 2025-05-26 | \n",
- " 0 | \n",
- "
\n",
- " \n",
- " | 16 | \n",
- " 352392 | \n",
- " 2899231 | \n",
- " 2580629125407538788 | \n",
- " 501566-186754728992314910 | \n",
- " 2025-05-25 | \n",
- " 0 | \n",
- " 542 | \n",
- " 1 | \n",
- " 2025-05-30 | \n",
- " None | \n",
- " 1867547 | \n",
- " 5 | \n",
- " 淘天 | \n",
- " 0 | \n",
- " 0 | \n",
- " 0 | \n",
- " 0 | \n",
- " 0 | \n",
- " 2025-05-26 | \n",
- " 0 | \n",
- "
\n",
- " \n",
- " | 17 | \n",
- " 352494 | \n",
- " 2899334 | \n",
- " 2579651619722538788 | \n",
- " 501566-186769728993341037 | \n",
- " 2025-05-25 | \n",
- " 0 | \n",
- " 553 | \n",
- " 1 | \n",
- " 2025-05-30 | \n",
- " None | \n",
- " 1867697 | \n",
- " 5 | \n",
- " 淘天 | \n",
- " 0 | \n",
- " 0 | \n",
- " 0 | \n",
- " 0 | \n",
- " 0 | \n",
- " 2025-05-26 | \n",
- " 0 | \n",
- "
\n",
- " \n",
- " | 18 | \n",
- " 352504 | \n",
- " 2899345 | \n",
- " 2580008664490538788 | \n",
- " 501566-186771428993459718 | \n",
- " 2025-05-25 | \n",
- " 0 | \n",
- " 555 | \n",
- " 1 | \n",
- " 2025-05-30 | \n",
- " None | \n",
- " 1867714 | \n",
- " 5 | \n",
- " 淘天 | \n",
- " 0 | \n",
- " 0 | \n",
- " 0 | \n",
- " 0 | \n",
- " 0 | \n",
- " 2025-05-26 | \n",
- " 0 | \n",
- "
\n",
- " \n",
- " | 19 | \n",
- " 352526 | \n",
- " 2899368 | \n",
- " 2579710119285538788 | \n",
- " 501566-186775328993689331 | \n",
- " 2025-05-25 | \n",
- " 0 | \n",
- " 558 | \n",
- " 1 | \n",
- " 2025-05-30 | \n",
- " None | \n",
- " 1867753 | \n",
- " 5 | \n",
- " 淘天 | \n",
- " 0 | \n",
- " 0 | \n",
- " 0 | \n",
- " 0 | \n",
- " 0 | \n",
- " 2025-05-26 | \n",
- " 0 | \n",
- "
\n",
- " \n",
- " | 20 | \n",
- " 352631 | \n",
- " 2899481 | \n",
- " 2579924751782538788 | \n",
- " 501566-186789228994817432 | \n",
- " 2025-05-25 | \n",
- " 0 | \n",
- " 580 | \n",
- " 1 | \n",
- " 2025-05-30 | \n",
- " None | \n",
- " 1867892 | \n",
- " 5 | \n",
- " 淘天 | \n",
- " 0 | \n",
- " 0 | \n",
- " 0 | \n",
- " 0 | \n",
- " 0 | \n",
- " 2025-05-26 | \n",
- " 0 | \n",
- "
\n",
- " \n",
- " | 21 | \n",
- " 352649 | \n",
- " 2899501 | \n",
- " 2899501 | \n",
- " 2899501 | \n",
- " 2025-05-25 | \n",
- " 0 | \n",
- " 0 | \n",
- " 1 | \n",
- " 2025-05-28 | \n",
- " None | \n",
- " 1867913 | \n",
- " 3 | \n",
- " 淘天 | \n",
- " 0 | \n",
- " 0 | \n",
- " 0 | \n",
- " 0 | \n",
- " 0 | \n",
- " 2025-05-26 | \n",
- " 0 | \n",
- "
\n",
- " \n",
- " | 22 | \n",
- " 352698 | \n",
- " 2899552 | \n",
- " 4355089779147463948 | \n",
- " 1748152477497 | \n",
- " 2025-05-25 | \n",
- " 5 | \n",
- " 594 | \n",
- " 1 | \n",
- " 2025-05-30 | \n",
- " None | \n",
- " 1867983 | \n",
- " 5 | \n",
- " 淘天 | \n",
- " 0 | \n",
- " 0 | \n",
- " 0 | \n",
- " 0 | \n",
- " 0 | \n",
- " 2025-05-26 | \n",
- " 0 | \n",
- "
\n",
- " \n",
- " | 23 | \n",
- " 352735 | \n",
- " 2899590 | \n",
- " 2580755954053538788 | \n",
- " 501566-186804028995900068 | \n",
- " 2025-05-25 | \n",
- " 0 | \n",
- " 601 | \n",
- " 1 | \n",
- " 2025-05-30 | \n",
- " None | \n",
- " 1868040 | \n",
- " 5 | \n",
- " 淘天 | \n",
- " 0 | \n",
- " 0 | \n",
- " 0 | \n",
- " 0 | \n",
- " 0 | \n",
- " 2025-05-26 | \n",
- " 0 | \n",
- "
\n",
- " \n",
- " | 24 | \n",
- " 352741 | \n",
- " 2899596 | \n",
- " 2580765530729538788 | \n",
- " 501566-186804828995968241 | \n",
- " 2025-05-25 | \n",
- " 5 | \n",
- " 603 | \n",
- " 1 | \n",
- " 2025-05-30 | \n",
- " None | \n",
- " 1868048 | \n",
- " 5 | \n",
- " 淘天 | \n",
- " 0 | \n",
- " 0 | \n",
- " 0 | \n",
- " 0 | \n",
- " 0 | \n",
- " 2025-05-26 | \n",
- " 0 | \n",
- "
\n",
- " \n",
- "
\n",
- "
"
- ],
- "text/plain": [
- " cpmaso_task_id buy_id trade_id trade_platform_order_num \\\n",
- "0 343636 2896029 2896029 2896029 \n",
- "1 343650 2896044 2896044 2896044 \n",
- "2 345441 2896633 2896633 2896633 \n",
- "3 345460 2896653 896653 896653 \n",
- "4 345510 2896706 2896706 2896706 \n",
- "5 347335 2897332 2897332 2897332 \n",
- "6 347339 2897336 2897336 2897336 \n",
- "7 347345 2897342 2897342 2897342 \n",
- "8 347348 2897345 2897345 2897345 \n",
- "9 347415 2897416 2897416 2897416 \n",
- "10 349155 2898014 2578499365301538788 1747991280236 \n",
- "11 349191 2898060 2577712694448538788 501566-186639528980603464 \n",
- "12 349219 2898090 2898090 2898090 \n",
- "13 349350 2898239 2898239 2898239 \n",
- "14 352340 2899178 2579933964195538788 501566-186750228991783425 \n",
- "15 352363 2899201 4354718580547688148 1748139827823 \n",
- "16 352392 2899231 2580629125407538788 501566-186754728992314910 \n",
- "17 352494 2899334 2579651619722538788 501566-186769728993341037 \n",
- "18 352504 2899345 2580008664490538788 501566-186771428993459718 \n",
- "19 352526 2899368 2579710119285538788 501566-186775328993689331 \n",
- "20 352631 2899481 2579924751782538788 501566-186789228994817432 \n",
- "21 352649 2899501 2899501 2899501 \n",
- "22 352698 2899552 4355089779147463948 1748152477497 \n",
- "23 352735 2899590 2580755954053538788 501566-186804028995900068 \n",
- "24 352741 2899596 2580765530729538788 501566-186804828995968241 \n",
- "\n",
- " pay_date maintain_date last_task_id follow_type max_logis_date \\\n",
- "0 2025-05-20 0 0 1 2025-05-21 \n",
- "1 2025-05-20 0 0 1 2025-05-27 \n",
- "2 2025-05-21 0 0 1 2025-05-22 \n",
- "3 2025-05-21 0 0 1 2025-05-22 \n",
- "4 2025-05-21 0 0 1 2025-05-23 \n",
- "5 2025-05-22 0 0 1 2025-05-25 \n",
- "6 2025-05-22 0 0 1 2025-05-27 \n",
- "7 2025-05-22 0 0 1 2025-05-25 \n",
- "8 2025-05-22 0 0 1 2025-05-24 \n",
- "9 2025-05-22 0 0 1 2025-05-27 \n",
- "10 2025-05-23 7 532 1 2025-05-30 \n",
- "11 2025-05-23 3 533 1 2025-05-28 \n",
- "12 2025-05-23 0 0 1 2025-05-30 \n",
- "13 2025-05-23 0 0 1 2025-05-28 \n",
- "14 2025-05-25 0 537 1 2025-05-30 \n",
- "15 2025-05-25 5 540 1 2025-05-30 \n",
- "16 2025-05-25 0 542 1 2025-05-30 \n",
- "17 2025-05-25 0 553 1 2025-05-30 \n",
- "18 2025-05-25 0 555 1 2025-05-30 \n",
- "19 2025-05-25 0 558 1 2025-05-30 \n",
- "20 2025-05-25 0 580 1 2025-05-30 \n",
- "21 2025-05-25 0 0 1 2025-05-28 \n",
- "22 2025-05-25 5 594 1 2025-05-30 \n",
- "23 2025-05-25 0 601 1 2025-05-30 \n",
- "24 2025-05-25 5 603 1 2025-05-30 \n",
- "\n",
- " agreed_delivery_time trans_id payment_datetime platform task_status \\\n",
- "0 None 1863624 1 淘天 0 \n",
- "1 None 1863645 7 淘天 0 \n",
- "2 None 1864349 1 淘天 0 \n",
- "3 None 1864373 1 淘天 0 \n",
- "4 None 1864440 2 淘天 0 \n",
- "5 None 1865297 3 淘天 0 \n",
- "6 None 1865301 5 淘天 0 \n",
- "7 None 1865307 3 淘天 0 \n",
- "8 None 1865308 2 淘天 0 \n",
- "9 None 1865406 5 淘天 0 \n",
- "10 None 1866518 7 淘天 0 \n",
- "11 None 1866395 5 淘天 0 \n",
- "12 None 1866272 7 淘天 0 \n",
- "13 None 1866500 5 淘天 0 \n",
- "14 None 1867502 5 淘天 0 \n",
- "15 None 1867773 3 淘天 0 \n",
- "16 None 1867547 5 淘天 0 \n",
- "17 None 1867697 5 淘天 0 \n",
- "18 None 1867714 5 淘天 0 \n",
- "19 None 1867753 5 淘天 0 \n",
- "20 None 1867892 5 淘天 0 \n",
- "21 None 1867913 3 淘天 0 \n",
- "22 None 1867983 5 淘天 0 \n",
- "23 None 1868040 5 淘天 0 \n",
- "24 None 1868048 5 淘天 0 \n",
- "\n",
- " need_refund has_image clearly_specify_the_delivery_time one_more_time \\\n",
- "0 0 0 0 0 \n",
- "1 0 0 0 0 \n",
- "2 0 0 0 0 \n",
- "3 0 0 0 0 \n",
- "4 0 0 0 0 \n",
- "5 0 0 0 0 \n",
- "6 0 0 0 0 \n",
- "7 0 0 0 0 \n",
- "8 0 0 0 0 \n",
- "9 0 0 0 0 \n",
- "10 0 0 0 0 \n",
- "11 0 0 0 0 \n",
- "12 0 0 0 0 \n",
- "13 0 0 0 0 \n",
- "14 0 0 0 0 \n",
- "15 0 0 0 0 \n",
- "16 0 0 0 0 \n",
- "17 0 0 0 0 \n",
- "18 0 0 0 0 \n",
- "19 0 0 0 0 \n",
- "20 0 0 0 0 \n",
- "21 0 0 0 0 \n",
- "22 0 0 0 0 \n",
- "23 0 0 0 0 \n",
- "24 0 0 0 0 \n",
- "\n",
- " create_date upload_cpmaso \n",
- "0 2025-05-21 0 \n",
- "1 2025-05-21 0 \n",
- "2 2025-05-22 0 \n",
- "3 2025-05-22 0 \n",
- "4 2025-05-22 0 \n",
- "5 2025-05-23 0 \n",
- "6 2025-05-23 0 \n",
- "7 2025-05-23 0 \n",
- "8 2025-05-23 0 \n",
- "9 2025-05-23 0 \n",
- "10 2025-05-24 0 \n",
- "11 2025-05-24 0 \n",
- "12 2025-05-24 0 \n",
- "13 2025-05-24 0 \n",
- "14 2025-05-26 0 \n",
- "15 2025-05-26 0 \n",
- "16 2025-05-26 0 \n",
- "17 2025-05-26 0 \n",
- "18 2025-05-26 0 \n",
- "19 2025-05-26 0 \n",
- "20 2025-05-26 0 \n",
- "21 2025-05-26 0 \n",
- "22 2025-05-26 0 \n",
- "23 2025-05-26 0 \n",
- "24 2025-05-26 0 "
- ]
- },
- "execution_count": 16,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
+ "outputs": [],
"source": [
"df = pd.read_sql(sql,mdm.engine())\n",
"df"
@@ -1227,7 +4578,7 @@
},
{
"cell_type": "code",
- "execution_count": 17,
+ "execution_count": null,
"metadata": {
"ExecuteTime": {
"end_time": "2025-05-15T15:26:13.035452Z",
@@ -1251,7 +4602,7 @@
},
{
"cell_type": "code",
- "execution_count": 18,
+ "execution_count": null,
"metadata": {
"ExecuteTime": {
"end_time": "2025-05-16T15:45:35.889562Z",
@@ -1501,17 +4852,750 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 60,
"metadata": {
"collapsed": false
},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "{'success': True,\n",
+ " 'msg': '成功获取会话任务详情',\n",
+ " 'url': 'https://distributor.taobao.global/apps/open/imchat?loginToken=7OXaq3%2B20t8Fslz9ewVQmJvp%2F6nWulgUe1UVHUURSfP5dyPsFgpb%2Babr2%2BnnUUN9RmP0iZ9aq6fVttswuHtXvJxK%2FCP8OpkHIR%2BytvG9q%2F0%3D&sellerId=NTg3OTUxMDY5',\n",
+ " 'text': '平台交易号:3275492124464538788,您好,之前联系过您多次,仍未收到回复。03月12日前可以发货吗?如果近期无法发货,我们只能申请退款处理。',\n",
+ " 'shopname': '首选家具专盈店'}"
+ ]
+ },
+ "execution_count": 60,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ " \n",
+ "def get_session_task_detail(task_id):\n",
+ " \"\"\"获取会话任务详情\"\"\"\n",
+ " url = f\"http://192.168.100.44/rpaapi/get_session_task_detail/{task_id}\"\n",
+ " try:\n",
+ " response = requests.get(url, timeout=10)\n",
+ " res = response.json()\n",
+ " if res.get('message') == \"success\":\n",
+ " return {\n",
+ " \"success\": True,\n",
+ " \"msg\": \"成功获取会话任务详情\",\n",
+ " \"url\": res['url'],\n",
+ " \"text\": res['text'],\n",
+ " \"shopname\": res['shopname']\n",
+ " }\n",
+ " else:\n",
+ " return {\n",
+ " \"success\": False,\n",
+ " \"msg\": f\"获取会话任务详情失败: {res['message']}\",\n",
+ " \"url\": None,\n",
+ " \"text\": None,\n",
+ " \"shopname\": None\n",
+ " }\n",
+ " except Exception as e:\n",
+ " print(e)\n",
+ " return {\n",
+ " \"success\": False,\n",
+ " \"msg\": f\"获取会话任务详情失败: {e}\",\n",
+ " \"url\": None,\n",
+ " \"text\": None,\n",
+ " \"shopname\": None\n",
+ " }\n",
+ "\n",
+ "get_session_task_detail(43439)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 61,
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stderr",
+ "output_type": "stream",
+ "text": [
+ "<>:23: SyntaxWarning: invalid escape sequence '\\/'\n",
+ "<>:23: SyntaxWarning: invalid escape sequence '\\/'\n",
+ "C:\\Users\\joker\\AppData\\Local\\Temp\\ipykernel_96992\\365462581.py:23: SyntaxWarning: invalid escape sequence '\\/'\n",
+ " !function(t){function e(a){if(n[a])return n[a].exports;var o=n[a]={exports:{},id:a,loaded:!1};return t[a].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var n={};return e.m=t,e.c=n,e.p=\"\",e(0)}([function(t,e,n){t.exports=n(1)},function(t,e,n){\"use strict\";n(2).initGlobal(window),function(){var t=n(4);n(156)(t)}()},function(t,e,n){\"use strict\";var a,o=n(3),r=o.APLUS,i=o.APLUS_QUEUE,s=o.GOLDLOG,u=o.GOLDLOG_QUEUE,c=!1;try{\"undefined\"!=typeof window&&(a=window,c=!0)}catch(t){a={},c=!1}e.getContext=function(){return a},e.isWeb=function(){return\"undefined\"!=typeof window&&window},e.initGlobal=function(t){a=t?t:{v:1,aplus:{},aplus_queue:[]};var e,n;if(c)try{e=a.aplus||a.goldlog||(a.aplus={});var o=a.goldlog_queue||(a.goldlog_queue=[]);n=a.aplus_queue||(a.aplus_queue=[]),n=o.concat(n)}catch(t){}else e=a.aplus,n=a.aplus_queue;return a.aplus=a.goldlog=e,a.aplus_queue=a.goldlog_queue=n,a};var l=function(t){if(t===r||t===s){var e=a[r]||a[s];return e||(e=a[r]=a[s]={}),e}var n=u,o=i;if(t===o||t===n){var c=a[o]||a[n];return c||(c=a[o]=a[n]=[]),c}};e.getGlobalValue=l,e.setGlobalValue=function(t,e){a[t]=e};var p=function(t){var e;try{var n=l(r);e=n[t]}catch(t){e=\"\"}finally{return e}};e.getGoldlogVal=p;var f=function(t,e){var n=!1;try{var a=l(r);t&&(a[t]=e,n=!0)}catch(t){n=!1}finally{return n}};e.setGoldlogVal=f,e.getClientInfo=function(){return p(\"_aplus_client\")||{}}},function(t,e){var n=\"aplus\",a=\"goldlog\",o=n+\"_queue\",r=a+\"_queue\",i=\"mw_change\",s=\"MetaInfo\",u=\"append\"+s,c=\"set\"+s,l=\"http\",p=\"_pubsub\",f=\"other\",g=\"2101\",d=\"2201\",m=\"2202\",_=\"19999\",h=\"1023\",v=\"1010\",b=3e4,y=18e5,S=\"ekvs\",A=1e4,E=1,T=1,I=3e3,P=\"$$_page_start\",w=\"$$_page_end\",C=\"$$_app_start\",M=\"$$_app_end\",x=\"aplus_user_profile\",O=\"imprint\",L=n+\"-idtype\",U=n+\"-jsbridge-only\",k=n+\"-page-config\",R=n+\"-skip-apv-rules\",N=n+\"-rhost-v\",G=n+\"-rhost-g\",D=n+\"-forward-domain\",V=n+\"-forward-event-filter\",j=\"autoGetOpenid\",F=n+\"-forward-appkey\";t.exports={PAGE_ENTER:\"PAGE_ENTER\",ETAG_EVENT_NAME:\"etag\",CURRENT_PAGE_CONFIG:\"CURRENT_PAGE_CONFIG\",_ANONY_ID:\"_anony_id\",_DEV_ID:\"_dev_id\",_USER_ID:\"_user_id\",_CNA:\"cna\",DEFAULT_CODE:f,OTHER:_,EVENT_MAP:{2101:\"click\",2201:\"exposure\",2202:\"exposure\",19999:f,1023:\"app_show\",1010:\"app_hide_or_unload\"},EVENT_ID_MAP:{EXP:d,IMPEXP:m,CLK:g,OTHER:_,SHOW:h,H_OR_U:v},APLUS:n,APLUS_CONFIG:\"APLUS_CONFIG\",GOLDLOG:a,UNSUBSCRIBE:n+\".\"+n+p+\".unsubscribe\",SUBSCRIBE:n+\".\"+n+p+\".subscribe\",PUBLISH:n+\".\"+n+p+\".publish\",CACHE_PUBS:n+\".\"+n+p+\".cachePubs\",APLUS_UNIVERSAL:n+\"_universal\",APLUS_QUEUE:o,GOLDLOG_QUEUE:r,COMPLETE:\"complete\",PV_CODE:\"2001\",EXP_CODE:d,CLK_CODE:g,OTHER_CODE:_,CLK:\"CLK\",EXP:\"EXP\",SPM_CNT:\"spm-cnt\",SPM_URL:\"spm-url\",SPM_PRE:\"spm-pre\",MW_CHANGE_PV:i+\"_pv\",MW_CHANGE_HJLJ:i+\"_hjlj\",HTTP:l+\":\",HTTPS:\"https:\",APPEND_META_INFO:u,SET_META_INFO:c,APLUS_APPEND_META_INFO:n+\".\"+u,APLUS_SET_META_INFO:n+\".\"+c,PVID:\"pvid\",openAPIs:[\"send\",\"enter\",\"sendPV\",\"record\",\"combineRecord\",\"recordUdata\",\"requestVTConfig\",\"requestRemoteConfig\",\"setPageSPM\",\"setMetaInfo\",\"appendMetaInfo\",\"updatePageProperties\",\"updateNextPageProperties\",\"updatePageUtparam\",\"updateNextPageUtparam\",\"pageAppear\",\"pageDisappear\",\"pageDisAppear\",\"skipPage\",\"updatePageName\",\"updatePageUrl\",\"requestPageAllProperties\",\"updateSessionProperties\",\"getPageSpmUrl\",\"getPageSpmPre\",\"updateNextPageUtparamCnt\",\"setPageName\",\"getElementSPM\",\"getAutoElementSPM\",\"setUserProfile\",\"getUserProfile\",\"getCna\"],SESSION_INTERVAL:b,SESSION_PAUSE_TIME:\"session_pause_time\",IMPRINT:\"imprint\",CURRENT_SESSION:\"current_session\",MAX_EVENTID_LENGTH:128,MAX_PROPERTY_KEY_LENGTH:256,MAX_PROPERTY_KEYS_COUNT:100,FAILED_REQUESTS:\"failed_requests\",REQUESTS:\"requests\",SHARES:\"shares\",APLUS_SSRC:\"_aplus_ssrc\",ARMS_TRACE:\"_arms_trace\",EKVS:S,EVENT_MAX_COUNT:A,MEMORY_MAX_COUNT:E,MAX_QUEUE_COUNT:T,EVENT_SEND_DEFAULT_INTERVAL:I,PAGE_START:P,PAGE_END:w,APP_START:C,APP_END:M,USER_PROFILE_KEY:x,SHARE_CACHE_INTERVAL:y,IMPRINT:O,ID_TYPE:L,GLOBAL_PROPERTY:\"globalproperty\",JSBRIDGE_ONLY:U,PAGE_CONFIG:k,APLUS_SKIP_APV_RULES:R,APLUS_PV_DOMAIN:N,APLUS_EKV_DOMAIN:G,APLUS_FORWARD_DOMAIN:D,APLUS_IMPRINT_VERSION:\"APLUS_IMPRINT_VERSION\",APLUS_REMOTE_CONFIG:\"APLUS_REMOTE_CONFIG\",RANK:\"ekv_rank\",WEB_EVENT_SUFFIX:\"/web_logs\",WEB_PC_PV_SUFFIX:\"v.gif\",WEB_WAP_PV_SUFFIX:\"m.gif\",PAGE_LEAVE:\"$$_page_leave\",APLUS_DOM_CHANGE:\"APLUS_DOM_CHANGE\",APLUS_PAGE_CHANGE:\"APLUS_PAGE_CHANGE\",PERFORMANCE_WARING:\"$$_perf_warning\",START_ID:\"START_ID\",AUTO_GET_OPENID:j,APLUS_LATEAST_UTM:\"APLUS_LATEAST_UTM\",APLUS_FORWARD_EVENT_FILTER:V,APLUS_FORWARD_APPKEY:F,APLUS_RHOST_V:n+\"-rhost-v\",APLUS_CPVDATA:n+\"-cpvdata\",APLUS_EXDATA:n+\"-exdata\",APLUS_EXINFO:n+\"-exinfo\",APLUS_LOG_PIPE:n+\"-log-pipe\",APLUS_TRACK_COMBINE:n+\"-track-combine\",APLUS_COOKIES:n+\"-cookies\",APLUS_CODELESS_TRACK_CONFIG:\"_\"+n+\"_codeless_track_config\",APLUS_AUTO_CLK:n+\"-auto-clk\",APLUS_AUTO_EXP:n+\"-auto-exp\",APLUS_AUTO_PV:n+\"-auto-pv\",APLUS_BRIDGE_NAME:n+\"-bridge-name\",APLUS_MINI_REQUEST_TIMEOUT:n+\"-request-timeout\",APLUS_VT_CONFIG_URL:n+\"-vt-cfg-url\",APLUS_EXPOSURE_EVENT_CAN_REPEAT:n+\"-exposure-event-can-repeat\",APLUS_IGNORE_LIFECYCLES:n+\"-ignore-lifecycles\",APLUS_TRACK_DEBUG_ID:n+\"-track-debug-id\",APLUS_SINGLE_RECORD_LOGKEYS:n+\"-single-record-logkeys\",APLUS_GOKEY_ISOLATE:n+\"-gokey-isolate\",APLUS_AUTOTRACK_ENABLED:n+\"-autotrack-enabled\",APLUS_AUTOTRACK_ENABLED_REMOTE:n+\"-autotrack-enabled-remote\",APLUS_AUTOTRACK_CONFIG:n+\"-autotrack-config\",APLUS_AUTO_TRACK_CONFIG_IMPORT:n+\"-auto-track-config-import\",APLUS_AUTOTRACK_CONFIG_REMOTE:n+\"-autotrack-config-remote\",APLUS_EVENT_LIMITRATES:n+\"-event-limitrates\",APLUS_DISABLE_AUTOEVENT:n+\"-disable-autoevent\",APLUS_DISABLE_AUTOEVENT_REMOTE:n+\"-disable-autoevent\",APLUS_DISABLE_AUTOPV:n+\"-disable-apv\",APLUS_DISABLE_AUTOPV_REMOTE:n+\"-disable-apv-remote\",APLUS_DEVICE_ENABLE:n+\"-device-enable\",APLUS_USER_PROFILE:n+\"-user-profile\",APLUS_CNA_ENABLE:n+\"-cna-enable\",APLUS_CNA_MODE:n+\"-cna-mode\",APLUS_ETAG_TIMEOUT:n+\"-etag-timeout\",APLUS_SPA_TYPE:n+\"-spa-type\",APLUS_MONITOR_ENABLE:n+\"-monitor-enable\",APLUS_OBSERVATIONS:\"_\"+n+\"_observations\",APLUS_REPORT_RATE:n+\"-report-rate\",APLUS_CNA_MONITOR:n+\"-cna-monitor\",APLUS_MMSTAT_TIMEOUT:n+\"-mmstat-timeout\",APLUS_REMOTE_CONTROL:n+\"-remote-control\",APLUS_CNA_STABILITY:n+\"-cna-stability\",APLUS_AUTO_PID:n+\"-auto-pid\"}},function(t,e,n){t.exports={metaInfo:{\"aplus-ifr-pv\":\"0\",\"aplus-rhost-v\":\"log.mmstat.com\",\"aplus-rhost-g\":\"gm.mmstat.com\",\"aplus-channel\":\"WS\",appId:\"60506758\",sdkId:\"customSdkId\",\"aplus-cpvdata\":{},\"aplus-exdata\":{},\"aplus-globaldata\":{},\"aplus-mmstat-timeout\":\"10000\",\"aplus-toUT\":\"auto\",\"aplus-track-combine\":\"on\",\"aplus-vt-auto-userfn-enable\":\"on\",\"aplus-cna-enable\":\"on\",\"aplus-cna-mode\":\"CK\",\"aplus-auto-track-config-import\":\"off\",\"aplus-form-track\":\"off\",\"aplus-gokey-isolate\":\"on\",\"aplus-only-update-page-properties\":\"off\",\"aplus-spm-from-url\":\"on\",\"aplus-user-profile\":{},\"aplus-report-rate\":{},\"aplus-single-record-logkeys\":[],\"aplus-cross-day-auto-pv\":\"off\",\"aplus-cna-monitor\":\"off\",\"aplus-cna-stability\":\"off\",\"aplus-auto-pid\":\"on\",\"aplus-monitor-enable\":\"off\",\"aplus-remote-control\":\"on\"},globalConfig:{isAli:!0,APLUS_QUEUE:\"aplus_queue\",ETAG_STORAGE_KEY:\"__ETAG__CNA__ID__\",script_name:\"aplus.js\",NAME_STORAGE_KEYS:{REFERRER:\"wm_referrer\",REFERRER_PV_ID:\"refer_pv_id\",LOST_PV_PAGE_DURATION:\"lost_pv_page_duration\",LOST_PV_PAGE_SPMAB:\"lost_pv_page_spmab\",LOST_PV_PAGE:\"lost_pv_page\",LOST_PV_PAGE_MSG:\"lost_pv_page_msg\"},lver:\"1.13.27\"},plugins:[{name:\"aplus_body_ready\",path:n(5)},{name:\"pubsub\",path:n(6)},{name:\"aplus_client\",path:n(11)},{name:\"aplus_meta_inject\",path:n(15)},{name:\"aplus_remote_control\",path:n(49)},{name:\"aplus_observer\",path:n(51)},{name:\"aplus_ac\",path:n(53)},{name:\"aplus_ae\",path:n(72)},{name:\"name_storage\",path:n(80)},{name:\"record_lost_pv\",path:n(83),config:{lostPvRecordRatio:.01}},{name:\"aplus_monitor\",path:n(85),config:{obsoleteInterRecordRatio:\"0.01\",jsErrorRecordRatio:\"0.01\",browserSupportRatio:\"0.01\"}},{name:\"aplus_web_http_ali\",path:n(92)},{name:\"aplus_log_inject\",path:n(95),deps:[\"aplus_meta_inject\"],config:{plugins:{pv:[{name:\"etag\",path:n(96)},{name:\"pha_trackinfo\",path:n(100)},{name:\"when_to_sendpv\",path:n(101),config:{aplusWaiting:\"\"}},{name:\"where_to_send\",path:n(102),config:{method:\"GET\",url:\"//log.mmstat.com/v.gif\"}},{name:\"what_to_send\",path:n(103),config:{pvdataToUt:{}}},{name:\"cookie_data\",path:n(104)},{name:\"what_to_sendpv_userdata\",path:n(105),deps:[\"what_to_send\"]},{name:\"what_to_sendpv_userdata_web\",path:n(106),deps:[\"what_to_send\",\"what_to_sendpv_userdata\"]},{name:\"what_to_sendpv_ut2\",path:n(108),deps:[\"what_to_send\"]},{name:\"can_to_sendpv\",path:n(109),config:{flag:\"NO\"}},{name:\"after_pv\",path:n(114)}],hjlj:[{name:\"etag\",path:n(96)},{name:\"pha_trackinfo\",path:n(100)},{name:\"where_to_send\",path:n(102),deps:[],config:{method:\"GET\",url:\"//gm.mmstat.com/\",ac_atpanel:\"//ac.mmstat.com/\",tblogUrl:\"//log.mmstat.com/\"}},{name:\"what_to_send\",path:n(103),deps:[]},{name:\"cookie_data\",path:n(104)},{name:\"what_to_hjlj_userdata\",path:n(115),deps:[\"what_to_send\"]},{name:\"what_to_hjlj_userdata_web\",path:n(116),deps:[\"what_to_send\",\"what_to_hjlj_userdata\"]},{name:\"what_to_hjlj_ut2\",path:n(117),deps:[\"what_to_send\"]}]}}},{name:\"aplus_spm_inject\",path:n(118)},{name:\"aplus_api\",path:n(132)},{name:\"meta_queue\",path:n(141)},{name:\"etag\",path:n(96)},{name:\"etag_web_sync\",path:n(143)},{name:\"aplus_queue\",path:n(144)},{name:\"hot_loader\",path:n(145),config:{urlRules:[{id:\"aplus_webvt_messager\",rule:\"aplus_webvt_messager\",cacheType:\"sessionStorage\",cdnPath:[\"https://d.alicdn.com/alilog/mlog/aplus_webvt_messager.js\",\"https://d.alicdn.com/alilog/mlog/aplus_track_debug.js\"]},{id:\"aplus_track_debug_id\",cacheType:\"sessionStorage\",rule:\"aplus_track_debug_id\",cdnPath:[\"https://d.alicdn.com/alilog/mlog/aplus_track_debug.js\"]},{id:\"aplus_auto_register\",rule:\"aplus_auto_register=true\",cacheType:\"sessionStorage\",allowIframeLoad:!0,cdnPath:[\"https://d.alicdn.com/alilog/aplus/1.13.9/plugin/aplus_auto_register.js\"]},{id:\"aplus_heat\",rule:\"aplus_heat=true\",cacheType:\"cookie\",allowIframeLoad:!0,cdnPath:[\"https://o.alicdn.com/alilog/aplus-visual-client/heat.js\"]}]}},{name:\"hot_sufei_pc\",path:n(146)},{name:\"aplus_apv\",path:n(147),deps:[\"aplus_log_inject\",\"aplus_api\"]},{name:\"aplus_form_track\",path:n(150)}]}},function(t,e){\"use strict\";t.exports=function(){return{run:function(t,e){var n=setInterval(function(){document.getElementsByTagName(\"body\").length&&(clearInterval(n),n=null,e())},50);return setTimeout(function(){n&&clearInterval(n)},1e3),1e3}}}},function(t,e,n){var a=n(7),o=n(2);t.exports=function(){return{run:function(){var t=o.getGlobalValue(\"aplus\");t.aplus_pubsub||(t.aplus_pubsub=a.create())}}}},function(t,e,n){var a=n(8);t.exports=a.extend({subscribeOnce:function(t,e){this.callable(e);var n,a=this;return this.subscribe.call(this,t,n=function(){a.unsubscribe.call(a,t,n);var o=Array.prototype.slice.call(arguments);e.apply(a,o)}),this}})},function(t,e,n){\"use strict\";var a=n(9),o=n(10),r=function(t){for(var e=t.length,n=new Array(e-1),a=1;a0){for(var a=0;a0)for(var i=0;i\",A=u&&u.createElement(\"div\"),E=[],T={isAliapp:!1,webkit:void 0,edge:void 0,trident:void 0,gecko:void 0,presto:void 0,chrome:void 0,safari:void 0,firefox:void 0,ie:void 0,ieMode:void 0,opera:void 0,mobile:void 0,core:void 0,shell:void 0,phantomjs:void 0,os:void 0,ipad:void 0,iphone:void 0,ipod:void 0,ios:void 0,android:void 0,nodejs:void 0,extraName:void 0,extraVersion:void 0};if(A&&A.getElementsByTagName&&(A.innerHTML=S.replace(y,\"\"),E=A.getElementsByTagName(\"s\")),E.length>0){for(d(t,T),i=b[0],s=b[1];i<=s;i++)if(A.innerHTML=S.replace(y,i),E.length>0){T[v=\"ie\"]=i;break}!T.ie&&(r=m(t))&&(T[v=\"ie\"]=r)}else((o=t.match(/AppleWebKit\\/*\\s*([\\d.]*)/i))||(o=t.match(/Safari\\/([\\d.]*)/)))&&o[1]?(T[h=\"webkit\"]=g(o[1]),(o=t.match(/OPR\\/(\\d+\\.\\d+)/))&&o[1]?T[v=\"opera\"]=g(o[1]):(o=t.match(/Chrome\\/([\\d.]*)/))&&o[1]?T[v=\"chrome\"]=g(o[1]):(o=t.match(/\\/([\\d.]*) Safari/))&&o[1]?T[v=\"safari\"]=g(o[1]):T.safari=T.webkit,(o=t.match(/Edge\\/([\\d.]*)/))&&o[1]&&(h=v=\"edge\",T[h]=g(o[1])),/ Mobile\\//.test(t)&&t.match(/iPad|iPod|iPhone/)?(T.mobile=\"apple\",o=t.match(/OS ([^\\s]*)/),o&&o[1]&&(T.ios=g(o[1].replace(\"_\",\".\"))),a=\"ios\",o=t.match(/iPad|iPod|iPhone/),o&&o[0]&&(T[o[0].toLowerCase()]=T.ios)):/ Android/i.test(t)?(/Mobile/.test(t)&&(a=T.mobile=\"android\"),o=t.match(/Android ([^\\s]*);/),o&&o[1]&&(T.android=g(o[1]))):(o=t.match(/NokiaN[^\\/]*|Android \\d\\.\\d|webOS\\/\\d\\.\\d/))&&(T.mobile=o[0].toLowerCase()),(o=t.match(/PhantomJS\\/([^\\s]*)/))&&o[1]&&(T.phantomjs=g(o[1]))):(o=t.match(/Presto\\/([\\d.]*)/))&&o[1]?(T[h=\"presto\"]=g(o[1]),(o=t.match(/Opera\\/([\\d.]*)/))&&o[1]&&(T[v=\"opera\"]=g(o[1]),(o=t.match(/Opera\\/.* Version\\/([\\d.]*)/))&&o[1]&&(T[v]=g(o[1])),(o=t.match(/Opera Mini[^;]*/))&&o?T.mobile=o[0].toLowerCase():(o=t.match(/Opera Mobi[^;]*/))&&o&&(T.mobile=o[0]))):(r=m(t))?(T[v=\"ie\"]=r,d(t,T)):(o=t.match(/Gecko/))&&(T[h=\"gecko\"]=.1,(o=t.match(/rv:([\\d.]*)/))&&o[1]&&(T[h]=g(o[1]),/Mobile|Tablet/.test(t)&&(T.mobile=\"firefox\")),(o=t.match(/Firefox\\/([\\d.]*)/))&&o[1]&&(T[v=\"firefox\"]=g(o[1])));if(!T[v]){var I=t.match(/Ali\\w+\\(\\w+\\/(\\d+\\.)+\\d+\\)/);if(I){T.isAliapp=!0;var P=I[0],w=\"\",C=\"\",M=P.match(/(\\d+\\.)+\\d+/);M&&(w=M[0],C=P.replace(\"/\"+w,\"\").replace(/\\(|\\)/g,\"\")),T[v=C]=w}}a||(a=e());var x,O,L;if(!n(\"type\",\"application/vnd.chromium.remoting-viewer\")){x=\"scoped\"in u.createElement(\"style\"),L=\"v8Locale\"in c;try{O=c.external||void 0}catch(t){}if(o=t.match(/360SE/))l=\"360\";else if((o=t.match(/SE\\s([\\d.]*)/))||O&&\"SEVersion\"in O)l=\"sougou\",f=g(o[1])||.1;else if((o=t.match(/Maxthon(?:\\/)+([\\d.]*)/))&&O){l=\"maxthon\";try{f=g(O.max_version||o[1])}catch(t){f=.1}}else x&&L?l=\"360se\":x||L||!/Gecko\\)\\s+Chrome/.test(p)||T.opera||T.edge||(l=\"360ee\")}(o=t.match(/TencentTraveler\\s([\\d.]*)|QQBrowser\\/([\\d.]*)/))?(l=\"tt\",f=g(o[2])||.1):(o=t.match(/LBBROWSER/))||O&&\"LiebaoGetVersion\"in O?l=\"liebao\":(o=t.match(/TheWorld/))?(l=\"theworld\",f=3):(o=t.match(/TaoBrowser\\/([\\d.]*)/))?(l=\"taobao\",f=g(o[1])||.1):(o=t.match(/UCBrowser\\/([\\d.]*)/))&&(l=\"uc\",f=g(o[1])||.1),T.os=a,T.core=T.core||h,T.shell=v,T.ieMode=T.ie&&u.documentMode||T.ie,T.extraName=l,T.extraVersion=f;var U=c.screen.width,k=c.screen.height;return T.resolution=U+\"x\"+k,T}function o(t){function e(t){return Object.prototype.toString.call(t)}function n(t,n,a){if(\"[object Function]\"==e(n)&&(n=n(a)),!n)return null;var o={name:t,version:\"\"},r=e(n);if(n===!0)return o;if(\"[object String]\"===r){if(a.indexOf(n)!==-1)return o}else if(n.exec){var i=n.exec(a);if(i)return i.length>=2&&i[1]?o.version=i[1].replace(/_/g,\".\"):o.version=\"\",o}}var a={name:\"other\",version:\"\"};t=(t||\"\").toLowerCase();for(var o=[[\"nokia\",function(t){return t.indexOf(\"nokia \")!==-1?/\\bnokia ([0-9]+)?/:/\\bnokia([a-z0-9]+)?/}],[\"samsung\",function(t){return t.indexOf(\"samsung\")!==-1?/\\bsamsung(?:[ \\-](?:sgh|gt|sm))?-([a-z0-9]+)/:/\\b(?:sgh|sch|gt|sm)-([a-z0-9]+)/}],[\"wp\",function(t){return t.indexOf(\"windows phone \")!==-1||t.indexOf(\"xblwp\")!==-1||t.indexOf(\"zunewp\")!==-1||t.indexOf(\"windows ce\")!==-1}],[\"pc\",\"windows\"],[\"ipad\",\"ipad\"],[\"ipod\",\"ipod\"],[\"iphone\",/\\biphone\\b|\\biph(\\d)/],[\"mac\",\"macintosh\"],[\"mi\",/\\bmi[ \\-]?([a-z0-9 ]+(?= build|\\)))/],[\"hongmi\",/\\bhm[ \\-]?([a-z0-9]+)/],[\"aliyun\",/\\baliyunos\\b(?:[\\-](\\d+))?/],[\"meizu\",function(t){return t.indexOf(\"meizu\")>=0?/\\bmeizu[\\/ ]([a-z0-9]+)\\b/:/\\bm([0-9x]{1,3})\\b/}],[\"nexus\",/\\bnexus ([0-9s.]+)/],[\"huawei\",function(t){var e=/\\bmediapad (.+?)(?= build\\/huaweimediapad\\b)/;return t.indexOf(\"huawei-huawei\")!==-1?/\\bhuawei\\-huawei\\-([a-z0-9\\-]+)/:e.test(t)?e:/\\bhuawei[ _\\-]?([a-z0-9]+)/}],[\"lenovo\",function(t){return t.indexOf(\"lenovo-lenovo\")!==-1?/\\blenovo\\-lenovo[ \\-]([a-z0-9]+)/:/\\blenovo[ \\-]?([a-z0-9]+)/}],[\"zte\",function(t){return/\\bzte\\-[tu]/.test(t)?/\\bzte-[tu][ _\\-]?([a-su-z0-9\\+]+)/:/\\bzte[ _\\-]?([a-su-z0-9\\+]+)/}],[\"vivo\",/\\bvivo(?: ([a-z0-9]+))?/],[\"htc\",function(t){return/\\bhtc[a-z0-9 _\\-]+(?= build\\b)/.test(t)?/\\bhtc[ _\\-]?([a-z0-9 ]+(?= build))/:/\\bhtc[ _\\-]?([a-z0-9 ]+)/}],[\"oppo\",/\\boppo[_]([a-z0-9]+)/],[\"konka\",/\\bkonka[_\\-]([a-z0-9]+)/],[\"sonyericsson\",/\\bmt([a-z0-9]+)/],[\"coolpad\",/\\bcoolpad[_ ]?([a-z0-9]+)/],[\"lg\",/\\blg[\\-]([a-z0-9]+)/],[\"android\",/\\bandroid\\b|\\badr\\b/],[\"blackberry\",function(t){return t.indexOf(\"blackberry\")>=0?/\\bblackberry\\s?(\\d+)/:\"bb10\"}]],r=0;rc.length?u:c,a=decodeURIComponent(a)}else n=e.match(o),a=n&&2===n.length?n[1]:\"\"}catch(t){}finally{return a}}function o(t,e){var n,a,o,r,i,s=e||location.href,c=\"&\",l=[];return u(t,function(t,e){new RegExp(t+\"=\").test(s)||l.push(t+\"=\"+e)}),0===l.length?s:(s.indexOf(\"#\")!==-1&&(o=s.split(\"#\"),s=o.shift(),a=o.join(\"#\")),r=s.split(\"?\"),i=r.length-1,o=r[0].split(\"//\"),o=o[o.length-1].split(\"/\"),i>0&&(n=r.pop(),s=r.join(\"?\")),n&&i>1&&n.indexOf(\"&\")==-1&&n.indexOf(\"%\")!==-1&&(c=\"%26\"),s=s+\"?\"+l.join(\"&\")+(n?c+n:\"\")+(a?\"#\"+a:\"\"))}function r(t){var e=s(location.hash)+\"\";c.pushIntoGoldlogQueue(\"aplus.on\",[window,\"hashchange\",function(){e!==s(location.hash)&&(e=s(location.hash)+\"\",t&&\"function\"==typeof t&&t(e,p))}])}function i(t){function e(e){var a=\"\";if(e){a=e&&e.arguments&&e.arguments.length>2&&e.arguments[2];var o=/^http|https/.test(a)?a:location.protocol+\"//\"+location.host+a;location.href!==o&&setTimeout(function(){t&&\"function\"==typeof t&&t(a,f)},0)}else a=location.pathname+location.search,a!==n&&setTimeout(function(){t&&\"function\"==typeof t&&t(a,f)},0);n=a}var n=location.pathname+location.search;if(history.pushState&&window.addEventListener){c.pushIntoGoldlogQueue(\"aplus.on\",[window,\"pushState\",function(t){e(t)}]),c.pushIntoGoldlogQueue(\"aplus.on\",[window,\"popstate\",function(){e()}]);var a=l.getMetaCnt(\"aplus-track-replacestate\")||aplus.getMetaInfo&&aplus.getMetaInfo(\"aplus-track-replacestate\");a&&c.pushIntoGoldlogQueue(\"aplus.on\",[window,\"replaceState\",function(t){e(t)}])}}function s(t){var e=\"\";return t&&(e=t.indexOf(\"?\")!=-1?t.split(\"?\")[0]:t),e}var u=n(18);e.addParamsIntoUrl=o,e.getParamFromUrl=a,e.getSPMFromUrl=function(t){return a(\"spm\",t)},e.getQueryFromUrl=function(){function t(t){for(var e=decodeURIComponent(t),n=e.indexOf(\"?\")+1,a=e.substring(n),o=Object.create(null),r=a.split(\"&\"),i=0;i-1)try{S[e]=JSON.parse(n)}catch(t){g.logger({msg:\"the content of meta<\"+e+\"> is invalid json string\"})}if(e===A)try{u=S[e]=JSON.parse(h.getMetaCnt(e))}catch(t){}}}),d(E,function(t){S[t]=h.getMetaCnt(t)}),S.spm_protocol=o(t),u&&(S=p.assign(S,u));var e,n,i=[\"aplus-rate-ahot\"],s=i.length;for(e=0;e\n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " TaoWorld跨境供货平台\n",
+ " \n",
+ " \n",
+ " \n",
+ "\n",
+ "\n",
+ "\n",
+ " \n",
+ " \n",
+ " \n",
+ "\n",
+ " \n",
+ " \n",
+ " \n",
+ "\n",
+ "\n",
+ " \n",
+ " 
喜欢的亲亲抓紧购买吧,今日下单还有好礼相送哦! https://item.taobao.com/item.htm?id=752045743811 \u0006
最近联系过

双十二活动倒计时最后一天活动截止到今晚23:59分结束 宝宝有选好可以咨询客服下单哟
最近联系过

/:087亲,再打扰您一下,双十二活动还剩最后一天了哦/:066\n",
+ "心动不如行动,看上的别犹豫,活动过了价格会全面上涨的呢~/:^x^\n",
+ "遇到喜欢的东西,就把它买下来吧,钱并不是真的花掉了/:087\n",
+ "我们支持365天延迟发货的哦/:066
最近联系过

双十二活动接近尾声了,家具还有哪些顾虑呢,消费券可以叠加立减,提前订购没装修好,也支持延迟发货哟/:081
最近联系过

🔥亲亲,今晚双12秒杀狂欢夜了哦,您之前看中的家具可以入手啦!\n",
+ "✅全店商品立减12% + 店铺优惠券 + 大额消费券,最高500元!\n",
+ "⏰晚上20:00-23:59 还有超低折扣秒杀价,售卖4小时\n",
+ "🛒现在提前加入购物车锁定优惠特权,定好闹钟准时付款\n",
+ "🎁本店所有商品均支持【等通知发货】\n",
+ " \u0006
最近联系过

/:066天猫双12狂欢节最后一天倒计时!\n",
+ "\n",
+ "今晚8点!为庆祝活动最终冲刺,我们将开启最后一波限时95折抢购福利!! 8-12点 ,只限4个小时!全场灯具, 价格直降+店铺券+限时95折+官方立减12%(上不封顶)+满额赠送安装服务,买灯即送LED三色光源一套,365天保价,让你购物无忧,而且,以上优惠可以叠加使用,力度空前巨大!\n",
+ "\n",
+ "只有4个小时,只有4个小时哦!快来抢购吧!\n",
+ "别再错过了,不然再等一年哦!/:066\n",
+ " \u0006
最近联系过

亲主要在考虑什么呢?货物早拍下早发货的哦~而且咱们这边售后都是专业一对一的,不用担心货物收到没有保险哦~
最近联系过

亲,您是在挑选款式呢,还是挑好款式准备下单呢 ? \n",
+ "/:^x^现在双十二活动, 喜欢就下手了哦/:-F
最近联系过

/:$双十二福利来袭,亲爱的不要错过活动福利哦!!\n",
+ "\n",
+ "12月8日 0点——12月14日 24 点:\n",
+ "①.全店商品无需凑单,下单享官方立减12%!\n",
+ "②.更有店铺券满 200 减25,可与官方立减叠加使用,上不封顶哈!\n",
+ "③.下单即送限量精美台灯/抱枕哦!\n",
+ "④.活动期间购买,可优先安排发货,还能享受 30 天保价服务呢~ https://item.taobao.com/item.htm?id=838023940983 \u0006
最近联系过

✈️88VIP领券链接:https://pages-fast.m.taobao.com/wow/z/blackvip/v/home?x-ssr=true&disableNav \u0006
最近联系过

/:066/:066/:066/:clock今晚0:00-1:00,限时1小时95折秒杀!!!\n",
+ "/:$全店商品均享超低折扣价,更有店铺专属大额优惠劵,叠加官方立减13%!!!/:081/:081/:081\n",
+ "赶快将心仪好物加入购物车,火速下单吧!!!/:809/:809/:809 \u0006
最近联系过

依诺家居生活馆yn
\n",
+ " TaoWorld跨境供货平台,链接天猫淘宝海量货源,为跨境卖家、代采代购商提供全链路的解决方案。
\n",
+ " \n",
+ " \n",
+ "\n",
+ "使用快捷键Ctrl+Shift+4快速唤起
或在设置中重新启用(永久关闭则不支持此网站快捷键唤起使用)