|
|
@@ -142,27 +142,30 @@ async def forwardRequest(request: HlmForwardRequest):
|
|
|
|
|
|
def __createExcelGoodsArray(excel_path):
|
|
|
'''创建通过excel形式得货号组数据'''
|
|
|
- excel_df = pd.read_excel(excel_path, sheet_name=0, header=0)
|
|
|
- if "文件夹名称" not in excel_df.columns:
|
|
|
- raise UnicornException("缺失 [文件夹名称] 列")
|
|
|
- if "商品货号" not in excel_df.columns:
|
|
|
- raise UnicornException("缺失 [商品货号] 列")
|
|
|
- if "款号" not in excel_df.columns:
|
|
|
- raise UnicornException("缺失 [款号] 列")
|
|
|
- goods_art_dirs = excel_df.groupby(excel_df["款号"])
|
|
|
- # 抠图时用到的货号列表,与生成详情图有所区别
|
|
|
- goods_art_no_arrays = []
|
|
|
- # # 详情图生成需要对同款商品进行分组,保证详情图可以生成多个色
|
|
|
- goods_art_no_group_arrays = []
|
|
|
- for _, goods_row in excel_df.iterrows():
|
|
|
- goods_art_no = str(goods_row["商品货号"])
|
|
|
- goods_art_no_arrays.append(goods_art_no)
|
|
|
- goods_no = str(goods_row["款号"])
|
|
|
- a001_df = goods_art_dirs.get_group(goods_no)
|
|
|
- goods_art_groups = a001_df["商品货号"].tolist()
|
|
|
- if goods_art_groups in goods_art_no_group_arrays:
|
|
|
- continue
|
|
|
- goods_art_no_group_arrays.append(goods_art_groups)
|
|
|
+ try:
|
|
|
+ excel_df = pd.read_excel(excel_path, sheet_name=0, header=0)
|
|
|
+ if "文件夹名称" not in excel_df.columns:
|
|
|
+ raise UnicornException("缺失 [文件夹名称] 列")
|
|
|
+ if "商品货号" not in excel_df.columns:
|
|
|
+ raise UnicornException("缺失 [商品货号] 列")
|
|
|
+ if "款号" not in excel_df.columns:
|
|
|
+ raise UnicornException("缺失 [款号] 列")
|
|
|
+ goods_art_dirs = excel_df.groupby(excel_df["款号"])
|
|
|
+ # 抠图时用到的货号列表,与生成详情图有所区别
|
|
|
+ goods_art_no_arrays = []
|
|
|
+ # # 详情图生成需要对同款商品进行分组,保证详情图可以生成多个色
|
|
|
+ goods_art_no_group_arrays = []
|
|
|
+ for _, goods_row in excel_df.iterrows():
|
|
|
+ goods_art_no = str(goods_row["商品货号"])
|
|
|
+ goods_art_no_arrays.append(goods_art_no)
|
|
|
+ goods_no = str(goods_row["款号"])
|
|
|
+ a001_df = goods_art_dirs.get_group(goods_no)
|
|
|
+ goods_art_groups = a001_df["商品货号"].tolist()
|
|
|
+ if goods_art_groups in goods_art_no_group_arrays:
|
|
|
+ continue
|
|
|
+ goods_art_no_group_arrays.append(goods_art_groups)
|
|
|
+ except Exception as e:
|
|
|
+ raise UnicornException("Excel文件解析失败,请检查是否缺少列")
|
|
|
return goods_art_no_arrays,excel_df,goods_art_no_group_arrays
|
|
|
|
|
|
|
|
|
@@ -350,7 +353,7 @@ async def process_handle_detail(request: Request, params: HandlerDetail):
|
|
|
else:
|
|
|
await sendAsyncMessage(
|
|
|
msg="处理结束",
|
|
|
- data={"output_folder": f"{handler_result_folder}/{current_day}", "list": handler_result},
|
|
|
+ data={"output_folder": f"{handler_result_folder}", "list": handler_result},
|
|
|
status="处理结束",
|
|
|
msg_type="detail_result_progress",
|
|
|
)
|
|
|
@@ -524,7 +527,7 @@ async def _process_cutout(run_main, config_data, goods_art_no_arrays, move_folde
|
|
|
"current":len(have_handler_keys),
|
|
|
"total":len(goods_art_no_arrays),
|
|
|
"error":0,
|
|
|
- "goods_art_no":list(have_handler_keys)
|
|
|
+ "goods_art_no":None
|
|
|
}
|
|
|
await sendAsyncMessage(
|
|
|
msg="正在处理",
|