73 lines
1.3 KiB
Python
73 lines
1.3 KiB
Python
# -*- coding: utf-8 -*-
|
|
"""
|
|
Created on Tue Dec 17 10:45:10 2024
|
|
|
|
@author: ym
|
|
"""
|
|
import os
|
|
import numpy as np
|
|
import pandas as pd
|
|
from pathlib import Path
|
|
|
|
|
|
|
|
|
|
|
|
xpath = r"\\192.168.1.28\share\模型\部署相关\永辉金源广场店商品信息.xlsx"
|
|
xroot, xfilename = os.path.split(xpath)
|
|
xfile, ext = os.path.splitext(xfilename)
|
|
spath = os.path.join(xroot, xfile+'_diff.xlsx')
|
|
|
|
|
|
df = pd.read_excel(xpath)
|
|
barcodes = df["商品条码"].tolist()
|
|
names_caojq = df["商品名称"].tolist()
|
|
|
|
stdpath = r"\\192.168.1.28\share\数据\已完成数据\比对数据\barcode\all_totalBarocde\totalBarcode"
|
|
|
|
stdpath = Path(stdpath)
|
|
stdBarcodes = [int(f.stem) for f in stdpath.iterdir() if f.is_dir() and f.stem.isdigit() and len(f.stem)>=8]
|
|
|
|
|
|
barcodes_s = set(barcodes)
|
|
stdBarcodes_s = set(stdBarcodes)
|
|
|
|
A = barcodes_s - stdBarcodes_s
|
|
|
|
record_bcd, record_name = [], []
|
|
for bcd in A:
|
|
if np.isnan(bcd): continue
|
|
try:
|
|
index = barcodes.index(bcd)
|
|
name = names_caojq[index]
|
|
|
|
record_bcd.append(bcd)
|
|
record_name.append(name)
|
|
except ValueError:
|
|
print(f"元素 {bcd} 不在列表中")
|
|
|
|
df_save = pd.DataFrame({
|
|
'商品条码': record_bcd,
|
|
'商品名称': record_name
|
|
})
|
|
|
|
df.to_excel(spath, index=False)
|
|
|
|
print("Done")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|