fix(yunda): invert handover number filter to keep empty rows
The previous filter kept rows with non-empty handover numbers (派件/签收 scans), which were duplicate rows. The correct logic is to keep rows with empty handover numbers (到/接件 scans). - store.py: change != "" to == "" in ingest filter - compare.py: add same filter before comparison (previously missing) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -314,9 +314,10 @@ def _ingest_actual(cur, site):
|
||||
cm = ACTUAL_COLMAP[site]
|
||||
df = pd.read_excel(path, dtype=str).fillna("")
|
||||
if site == "韵达":
|
||||
# 韵达业务清洗:抛弃「交接单号」为空的行(派件/签收等其他扫描无交接单号),
|
||||
# 韵达业务清洗:保留「交接单号」为空的行(到/接件扫描),
|
||||
# 抛弃「交接单号」不为空的行(派件/签收等,属重复数据)。
|
||||
# 再按子单号去重(一件多扫只留一条;清洗后子单号已天然唯一,drop 为保险)。
|
||||
df = df[df["交接单号"].astype(str).str.strip() != ""]
|
||||
df = df[df["交接单号"].astype(str).str.strip() == ""]
|
||||
df = df.drop_duplicates(subset=[cm["piece"]], keep="last")
|
||||
rows = []
|
||||
for r in df.to_dict("records"):
|
||||
|
||||
Reference in New Issue
Block a user