Commit 8da26578 by larosa

add str

parent b53035f6
......@@ -74,9 +74,9 @@ class HandleCSV:
ladder_item_map = dict()
data = df.loc[i, title_arr[j]]
if title_arr[j] == 'Manufacturer Name':
table['brand_name'] = data
table['brand_name'] = str(data)
elif title_arr[j] == 'Part Number':
table['goods_name'] = data
table['goods_name'] = str(data)
elif title_arr[j] == 'Stock EMEA' or \
title_arr[j] == 'Stock USA' or \
title_arr[j] == 'Stock APAC' or \
......@@ -110,6 +110,8 @@ class HandleCSV:
else:
batch_sn_map[key] = int(value)
table['batch_sn'] = batch_sn_map
# 统一字符串处理
table['stock'] = str(table['stock'])
json_str = json.dumps(table, ensure_ascii=False)
self.push_to_mq(json_str)
print(json_str)
......
......@@ -78,9 +78,9 @@ class HandleCSV:
ladder_item_map = dict()
if title[i] in title_map:
if title[i] == 'Part Number':
table['goods_name'] = arr[i]
table['goods_name'] = str(arr[i])
elif title[i] == 'Manufacturer':
table['brand_name'] = arr[i]
table['brand_name'] = str(arr[i])
elif title[i] == 'Stock EMEA' or \
title[i] == 'Stock USA' or \
title[i] == 'Stock APAC' or \
......@@ -91,9 +91,9 @@ class HandleCSV:
else:
table['stock'] += int(arr[i])
elif title[i] == 'MOQ':
table['moq'] = arr[i]
table['moq'] = str(arr[i])
elif title[i] == 'Multiplier':
table['multiple'] = arr[i]
table['multiple'] = str(arr[i])
elif title[i] in ladder_map:
if len(str(arr[i]).strip()) != 0:
ladder_item_map['purchases'] = int(arr[i])
......@@ -116,6 +116,8 @@ class HandleCSV:
else:
batch_sn_map[key] = int(value)
table['batch_sn'] = batch_sn_map
# 统一字符串处理
table['stock'] = str(table['stock'])
return json.dumps(table, ensure_ascii=False)
def push_to_mq(self, msg: str):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment