| Line 41... |
Line 41... |
| 41 |
|
41 |
|
| 42 |
for rownum in range(1, num_rows):
|
42 |
for rownum in range(1, num_rows):
|
| 43 |
print sheet.row_values(rownum)
|
43 |
print sheet.row_values(rownum)
|
| 44 |
|
44 |
|
| 45 |
if supplied_product_group != None and supplied_product_group != '':
|
45 |
if supplied_product_group != None and supplied_product_group != '':
|
| 46 |
our_brand, our_model_number, our_color,\
|
46 |
our_brand, our_model_number, our_model_name, our_color,\
|
| 47 |
brand, model_number, model_name, color,\
|
47 |
brand, model_number, model_name, color,\
|
| 48 |
dp, mrp, mop, sp,\
|
48 |
dp, mrp, mop, sp, xfer_price,\
|
| 49 |
comments, hotspot_category, unused_feature, xfer_price, weight, start_date, deal_text, deal_value,\
|
49 |
comments, weight, start_date, deal_text, deal_value,\
|
| 50 |
warranty_period, defaultWarehouse, preferredVendor = sheet.row_values(rownum)[0:22]
|
50 |
warranty_period, defaultWarehouse, preferredVendor = sheet.row_values(rownum)[0:21]
|
| 51 |
product_group = supplied_product_group
|
51 |
product_group = supplied_product_group
|
| 52 |
else:
|
52 |
else:
|
| 53 |
our_brand, our_model_number, our_color,\
|
53 |
our_brand, our_model_number, our_model_name, our_color,\
|
| 54 |
product_group, brand, model_number, model_name, color,\
|
54 |
product_group, brand, model_number, model_name, color,\
|
| 55 |
dp, mrp, mop, sp,\
|
55 |
dp, mrp, mop, sp, xfer_price,\
|
| 56 |
comments, hotspot_category, unused_feature, xfer_price, weight, start_date, deal_text, deal_value,\
|
56 |
comments, weight, start_date, deal_text, deal_value,\
|
| 57 |
warranty_period, defaultWarehouse, preferredVendor = sheet.row_values(rownum)[0:23]
|
57 |
warranty_period, defaultWarehouse, preferredVendor = sheet.row_values(rownum)[0:22]
|
| 58 |
|
58 |
|
| 59 |
print product_group
|
59 |
print product_group
|
| 60 |
|
60 |
|
| 61 |
if isinstance(model_number, float):
|
61 |
if isinstance(model_number, float):
|
| 62 |
model_number = str(int(model_number))
|
62 |
model_number = str(int(model_number))
|
| 63 |
|
63 |
|
| 64 |
if our_brand == '':
|
64 |
if our_brand == '':
|
| 65 |
our_brand = brand
|
65 |
our_brand = brand
|
| 66 |
if our_model_number == '':
|
66 |
if our_model_number == '':
|
| 67 |
our_model_number = model_number
|
67 |
our_model_number = model_number
|
| - |
|
68 |
if our_model_name == '':
|
| - |
|
69 |
our_model_name = model_name
|
| 68 |
if our_color == '':
|
70 |
if our_color == '':
|
| 69 |
our_color = color
|
71 |
our_color = color
|
| 70 |
|
72 |
|
| 71 |
if sp == '':
|
73 |
if sp == '':
|
| 72 |
sp = mop
|
74 |
sp = mop
|
| Line 77... |
Line 79... |
| 77 |
key = product_group.strip().lower() + '|' + brand.strip().lower() + '|' + model_number.strip().lower() + '|' + color.strip().lower()
|
79 |
key = product_group.strip().lower() + '|' + brand.strip().lower() + '|' + model_number.strip().lower() + '|' + color.strip().lower()
|
| 78 |
if key in existing_vendor_item_mappings_set:
|
80 |
if key in existing_vendor_item_mappings_set:
|
| 79 |
existing_vendor_item_mappings_set.remove(key)
|
81 |
existing_vendor_item_mappings_set.remove(key)
|
| 80 |
|
82 |
|
| 81 |
# Check if a similar items already exists in our database
|
83 |
# Check if a similar items already exists in our database
|
| 82 |
similar_items = Item.query.filter_by(brand=our_brand.strip(), model_number=our_model_number.strip(), model_name=model_name.strip()).all()
|
84 |
similar_items = Item.query.filter_by(brand=our_brand.strip(), model_number=our_model_number.strip(), model_name=our_model_name.strip()).all()
|
| 83 |
|
85 |
|
| 84 |
# Check if a similar item already exists in our database
|
86 |
# Check if a similar item already exists in our database
|
| 85 |
for old_item in similar_items:
|
87 |
for old_item in similar_items:
|
| 86 |
if old_item.color != None and old_item.color.strip().lower() == our_color.strip().lower():
|
88 |
if old_item.color != None and old_item.color.strip().lower() == our_color.strip().lower():
|
| 87 |
item = old_item
|
89 |
item = old_item
|
| Line 123... |
Line 125... |
| 123 |
new_items.append(rownum)
|
125 |
new_items.append(rownum)
|
| 124 |
item = Item()
|
126 |
item = Item()
|
| 125 |
item.product_group = product_group.strip()
|
127 |
item.product_group = product_group.strip()
|
| 126 |
item.brand = our_brand.strip()
|
128 |
item.brand = our_brand.strip()
|
| 127 |
item.model_number = our_model_number.strip()
|
129 |
item.model_number = our_model_number.strip()
|
| 128 |
item.model_name = model_name.strip()
|
130 |
item.model_name = our_model_name.strip()
|
| 129 |
item.color = our_color.strip()
|
131 |
item.color = our_color.strip()
|
| 130 |
item.status = status.IN_PROCESS
|
132 |
item.status = status.IN_PROCESS
|
| 131 |
item.status_description = "This item is in process"
|
133 |
item.status_description = "This item is in process"
|
| 132 |
item.addedOn = updatedOn
|
134 |
item.addedOn = updatedOn
|
| 133 |
item.hotspotCategory = category
|
135 |
item.hotspotCategory = category
|