|
|
@@ -19,7 +19,7 @@ from natsort import ns, natsorted
|
|
|
import threading
|
|
|
from concurrent.futures import ThreadPoolExecutor
|
|
|
from concurrent.futures import TimeoutError as THTimeoutError
|
|
|
-
|
|
|
+from middleware import UnicornException
|
|
|
|
|
|
# import math
|
|
|
from PIL import ImageFont
|
|
|
@@ -356,32 +356,35 @@ class DetailBase(object):
|
|
|
}
|
|
|
|
|
|
def get_text_value(self, key, subsection_len=0):
|
|
|
- text = ""
|
|
|
- if key in self.goods_no_value:
|
|
|
- if self.goods_no_value[key]:
|
|
|
- text = str(self.goods_no_value[key])
|
|
|
- text = text.replace(r"\n", "\n")
|
|
|
-
|
|
|
- # if key in ["跟高", "鞋宽", "帮高", "脚掌围", "鞋长"]:
|
|
|
- # if text:
|
|
|
- # text = text.split(".")[0]
|
|
|
-
|
|
|
- if subsection_len != 0:
|
|
|
- text = text.split("\n")
|
|
|
- text = [x for x in text if x]
|
|
|
- if len(text) == 2:
|
|
|
- text_1 = text[0]
|
|
|
- text_2 = text[1]
|
|
|
- return text_1, text_2
|
|
|
- else:
|
|
|
- if text:
|
|
|
+ try:
|
|
|
+ text = ""
|
|
|
+ if key in self.goods_no_value:
|
|
|
+ if self.goods_no_value[key]:
|
|
|
+ text = str(self.goods_no_value[key])
|
|
|
+ text = text.replace(r"\n", "\n")
|
|
|
+
|
|
|
+ # if key in ["跟高", "鞋宽", "帮高", "脚掌围", "鞋长"]:
|
|
|
+ # if text:
|
|
|
+ # text = text.split(".")[0]
|
|
|
+
|
|
|
+ if subsection_len != 0:
|
|
|
+ text = text.split("\n")
|
|
|
+ text = [x for x in text if x]
|
|
|
+ if len(text) == 2:
|
|
|
text_1 = text[0]
|
|
|
+ text_2 = text[1]
|
|
|
+ return text_1, text_2
|
|
|
else:
|
|
|
- text_1 = ""
|
|
|
- text_2 = ""
|
|
|
- return text_1, text_2
|
|
|
+ if text:
|
|
|
+ text_1 = text[0]
|
|
|
+ else:
|
|
|
+ text_1 = ""
|
|
|
+ text_2 = ""
|
|
|
+ return text_1, text_2
|
|
|
|
|
|
- return text
|
|
|
+ return text
|
|
|
+ except:
|
|
|
+ raise UnicornException(f"缺少货号资料:[{key}],请检查系统商品信息或excel是否缺少该字段")
|
|
|
|
|
|
def create_folder(self, path):
|
|
|
if not os.path.exists(path):
|