|
|
@@ -239,21 +239,21 @@ async def handle_detail(request: Request, params: HandlerDetail):
|
|
|
image_counts = len(images)
|
|
|
if image_counts < detail_counts:
|
|
|
raise UnicornException(
|
|
|
- f"货号:[{goods_art_no}],实际照片数量:{image_counts}张,小于详情图要求数量:{detail_counts}张"
|
|
|
- )
|
|
|
+ f"货号:[{goods_art_no}],实际照片数量:{image_counts}张,小于详情图要求数量:{detail_counts}张"
|
|
|
+ )
|
|
|
image_dir = "{}/data/".format(os.getcwd()).replace("\\", "/")
|
|
|
check_path(image_dir)
|
|
|
for itemImg in images:
|
|
|
if itemImg.image_path == "" or itemImg.image_path == None:
|
|
|
raise UnicornException(
|
|
|
- f"货号【{goods_art_no}】存在没有拍摄完成的图片,请重拍或删除后重试"
|
|
|
- )
|
|
|
+ f"货号【{goods_art_no}】存在没有拍摄完成的图片,请重拍或删除后重试"
|
|
|
+ )
|
|
|
if not os.path.exists(image_dir + "/" + os.path.basename(itemImg.image_path)):
|
|
|
shutil.copy(itemImg.image_path, image_dir)
|
|
|
dealImage = DealImage(image_dir)
|
|
|
resFlag, path = dealImage.dealMoveImage(
|
|
|
- image_dir=image_dir, callback_func=None, goods_art_no=goods_art_no
|
|
|
- )
|
|
|
+ image_dir=image_dir, callback_func=None, goods_art_no=goods_art_no
|
|
|
+ )
|
|
|
if not resFlag:
|
|
|
raise UnicornException(path)
|
|
|
temp_class = {}
|
|
|
@@ -263,7 +263,12 @@ async def handle_detail(request: Request, params: HandlerDetail):
|
|
|
temp_name_list.append(tempItem.template_id)
|
|
|
config_data = {
|
|
|
"image_dir": path,
|
|
|
- "image_order": params.template_image_order,
|
|
|
+ "image_order": (
|
|
|
+ "俯视,侧视,后跟,鞋底,内里"
|
|
|
+ if params.template_image_order == None
|
|
|
+ or params.template_image_order == ""
|
|
|
+ else params.template_image_order
|
|
|
+ ),
|
|
|
"goods_art_no": goods_art_no,
|
|
|
"is_check_number": False,
|
|
|
"resize_image_view": "后跟",
|
|
|
@@ -308,19 +313,19 @@ async def handle_detail(request: Request, params: HandlerDetail):
|
|
|
# print("out_put_dir_path", out_put_dir_path)
|
|
|
handler_result_folder = os.path.dirname(out_put_dir_path)
|
|
|
handler_result.append(
|
|
|
- {"goods_art_no": goods_art_no, "success": True, "info": "处理成功"}
|
|
|
- )
|
|
|
+ {"goods_art_no": goods_art_no, "success": True, "info": "处理成功"}
|
|
|
+ )
|
|
|
# print("检测到需要裁剪图片,开始裁剪图片", return_data)
|
|
|
continue
|
|
|
if cutout_res == True:
|
|
|
return_data_check_before_detail = run_main.check_before_detail(config_data)
|
|
|
print(
|
|
|
- "return_data_check_before_detail======> 测试 ==>",
|
|
|
- return_data_check_before_detail,
|
|
|
- )
|
|
|
+ "return_data_check_before_detail======> 测试 ==>",
|
|
|
+ return_data_check_before_detail,
|
|
|
+ )
|
|
|
check_for_detail_first_res = run_main.check_for_detail_first_call_back(
|
|
|
- return_data_check_before_detail
|
|
|
- )
|
|
|
+ return_data_check_before_detail
|
|
|
+ )
|
|
|
if isinstance(check_for_detail_first_res, partial):
|
|
|
result = check_for_detail_first_res()
|
|
|
try:
|
|
|
@@ -336,11 +341,11 @@ async def handle_detail(request: Request, params: HandlerDetail):
|
|
|
print("to_deal_dir", to_deal_dir)
|
|
|
if os.path.exists(to_deal_dir):
|
|
|
upload_pic = UploadPic(
|
|
|
- windows=None,
|
|
|
- to_deal_dir=to_deal_dir,
|
|
|
- config_data=config_data,
|
|
|
- token=token,
|
|
|
- )
|
|
|
+ windows=None,
|
|
|
+ to_deal_dir=to_deal_dir,
|
|
|
+ config_data=config_data,
|
|
|
+ token=token,
|
|
|
+ )
|
|
|
upload_pic.run()
|
|
|
out_put_dir = config_data["out_put_dir"]
|
|
|
out_put_dir_path = "{}/{}".format(os.getcwd(), out_put_dir).replace("\\", "/")
|