|
@@ -88,6 +88,7 @@ async def forwardRequest(request: HlmForwardRequest):
|
|
|
|
|
|
|
|
def fromExcelHandler(params: HandlerDetail):
|
|
def fromExcelHandler(params: HandlerDetail):
|
|
|
excel_path = params.excel_path
|
|
excel_path = params.excel_path
|
|
|
|
|
+ token = "Bearer " + params.token
|
|
|
excel_df = pd.read_excel(excel_path, sheet_name=0, header=0)
|
|
excel_df = pd.read_excel(excel_path, sheet_name=0, header=0)
|
|
|
handler_result = []
|
|
handler_result = []
|
|
|
handler_result_folder = ""
|
|
handler_result_folder = ""
|
|
@@ -95,19 +96,28 @@ def fromExcelHandler(params: HandlerDetail):
|
|
|
raise UnicornException("缺失 [文件夹名称] 列")
|
|
raise UnicornException("缺失 [文件夹名称] 列")
|
|
|
if "商品货号" not in excel_df.columns:
|
|
if "商品货号" not in excel_df.columns:
|
|
|
raise UnicornException("缺失 [商品货号] 列")
|
|
raise UnicornException("缺失 [商品货号] 列")
|
|
|
|
|
+ if "款号" not in excel_df.columns:
|
|
|
|
|
+ raise UnicornException("缺失 [款号] 列")
|
|
|
|
|
+ goods_art_dirs = excel_df.groupby(excel_df["款号"])
|
|
|
|
|
+ obj = None
|
|
|
|
|
+ run_main = RunMain(obj, token)
|
|
|
for index, row in excel_df.iterrows():
|
|
for index, row in excel_df.iterrows():
|
|
|
goods_art_no_image_dir = str(row["文件夹名称"])
|
|
goods_art_no_image_dir = str(row["文件夹名称"])
|
|
|
goods_art_no = str(row["商品货号"])
|
|
goods_art_no = str(row["商品货号"])
|
|
|
|
|
+ print("货号数据", goods_art_no)
|
|
|
|
|
+ goods_no = str(row["款号"])
|
|
|
|
|
+ a001_df = goods_art_dirs.get_group(goods_no)
|
|
|
|
|
+ goods_art_nos = a001_df["商品货号"].tolist()
|
|
|
|
|
+ print("goods_art_nos", goods_art_nos)
|
|
|
try:
|
|
try:
|
|
|
if not goods_art_no:
|
|
if not goods_art_no:
|
|
|
raise UnicornException("货号不能为空")
|
|
raise UnicornException("货号不能为空")
|
|
|
- token = "Bearer " + params.token
|
|
|
|
|
session = SqlQuery()
|
|
session = SqlQuery()
|
|
|
pr = CRUD(PhotoRecord)
|
|
pr = CRUD(PhotoRecord)
|
|
|
images = pr.read_all(session, conditions={"goods_art_no": goods_art_no})
|
|
images = pr.read_all(session, conditions={"goods_art_no": goods_art_no})
|
|
|
if not images:
|
|
if not images:
|
|
|
raise UnicornException("没有可用货号数据")
|
|
raise UnicornException("没有可用货号数据")
|
|
|
- image_dir = "{}/data/".format(os.getcwd()).replace("\\", "/")
|
|
|
|
|
|
|
+ image_dir = "{}/data/{}".format(os.getcwd(), goods_no).replace("\\", "/")
|
|
|
check_path(image_dir)
|
|
check_path(image_dir)
|
|
|
for itemImg in images:
|
|
for itemImg in images:
|
|
|
if itemImg.image_path == "" or itemImg.image_path == None:
|
|
if itemImg.image_path == "" or itemImg.image_path == None:
|
|
@@ -140,6 +150,7 @@ def fromExcelHandler(params: HandlerDetail):
|
|
|
"image_dir": path,
|
|
"image_dir": path,
|
|
|
"image_order": params.template_image_order,
|
|
"image_order": params.template_image_order,
|
|
|
"goods_art_no": goods_art_no,
|
|
"goods_art_no": goods_art_no,
|
|
|
|
|
+ "goods_art_nos": goods_art_nos,
|
|
|
"is_check_number": False,
|
|
"is_check_number": False,
|
|
|
"resize_image_view": "后跟",
|
|
"resize_image_view": "后跟",
|
|
|
"cutout_mode": settings.CUTOUT_MODE,
|
|
"cutout_mode": settings.CUTOUT_MODE,
|
|
@@ -170,8 +181,6 @@ def fromExcelHandler(params: HandlerDetail):
|
|
|
temp_class_dict[key] = cls
|
|
temp_class_dict[key] = cls
|
|
|
|
|
|
|
|
config_data["temp_class"] = temp_class_dict
|
|
config_data["temp_class"] = temp_class_dict
|
|
|
- obj = None
|
|
|
|
|
- run_main = RunMain(obj, token)
|
|
|
|
|
return_data = run_main.check_before_cutout(config_data)
|
|
return_data = run_main.check_before_cutout(config_data)
|
|
|
cutout_res = run_main.check_for_cutout_image_first_call_back(return_data)
|
|
cutout_res = run_main.check_for_cutout_image_first_call_back(return_data)
|
|
|
check_for_detail_first_res = None
|
|
check_for_detail_first_res = None
|
|
@@ -280,6 +289,7 @@ async def handle_detail(request: Request, params: HandlerDetail):
|
|
|
else params.template_image_order
|
|
else params.template_image_order
|
|
|
),
|
|
),
|
|
|
"goods_art_no": goods_art_no,
|
|
"goods_art_no": goods_art_no,
|
|
|
|
|
+ "goods_art_nos": [goods_art_no],
|
|
|
"is_check_number": False,
|
|
"is_check_number": False,
|
|
|
"resize_image_view": "后跟",
|
|
"resize_image_view": "后跟",
|
|
|
"cutout_mode": settings.CUTOUT_MODE,
|
|
"cutout_mode": settings.CUTOUT_MODE,
|