| Line 118... |
Line 118... |
| 118 |
sheet = workbook.sheet_by_index(0)
|
118 |
sheet = workbook.sheet_by_index(0)
|
| 119 |
num_rows = sheet.nrows
|
119 |
num_rows = sheet.nrows
|
| 120 |
for rownum in range(1, num_rows):
|
120 |
for rownum in range(1, num_rows):
|
| 121 |
print sheet.row_values(rownum)
|
121 |
print sheet.row_values(rownum)
|
| 122 |
try:
|
122 |
try:
|
| 123 |
item_id = int(sheet.row_values(rownum)[0])
|
- |
|
| 124 |
print "sku is",item_id
|
- |
|
| 125 |
supc = sheet.row_values(rownum)[1]
|
123 |
supc = sheet.row_values(rownum)[1]
|
| 126 |
print "supc is",supc
|
124 |
item_id = int(sheet.row_values(rownum)[0])
|
| 127 |
item = Item.query.filter_by(id=item_id).one()
|
125 |
item = Item.query.filter_by(id=item_id).one()
|
| 128 |
except Exception as e:
|
126 |
except Exception as e:
|
| 129 |
print "No item found.Maybe due to snapdeal item code in place of our sku id.Lets try again."
|
127 |
print "No item found.Maybe due to snapdeal item code in place of our sku id.Lets try again."
|
| 130 |
print e
|
128 |
print e
|
| 131 |
try:
|
129 |
try:
|
| 132 |
item_id = sheet.row_values(rownum)[0]
|
130 |
item_id = sheet.row_values(rownum)[0]
|
| 133 |
print "sku is",item_id
|
- |
|
| 134 |
snapdeal_item = SnapdealItem.query.filter_by(skuAtSnapdeal=item_id).one()
|
131 |
snapdeal_item = SnapdealItem.query.filter_by(skuAtSnapdeal=item_id).one()
|
| 135 |
item = Item.query.filter_by(id=snapdeal_item.item_id).one()
|
132 |
item = Item.query.filter_by(id=snapdeal_item.item_id).one()
|
| 136 |
print "item is",item.id
|
- |
|
| 137 |
except Exception as ex:
|
133 |
except Exception as ex:
|
| 138 |
print "Ahh...Still unable to find"
|
- |
|
| 139 |
print ex
|
134 |
print ex
|
| 140 |
one_line = _SnapdealItemInfo(sheet.row_values(rownum)[0], '', '', 0, '', '','', '', 0, '', False,"item_related")
|
135 |
one_line = _SnapdealItemInfo(sheet.row_values(rownum)[0], '', '', 0, '', '','', '', 0, '', False,"item_related")
|
| 141 |
print "appending supc",supc
|
- |
|
| 142 |
all_supc.append(supc)
|
136 |
all_supc.append(supc)
|
| 143 |
all_lines.append(one_line)
|
137 |
all_lines.append(one_line)
|
| 144 |
continue
|
138 |
continue
|
| 145 |
|
139 |
|
| 146 |
category = Category.query.filter_by(id=item.category).one()
|
140 |
category = Category.query.filter_by(id=item.category).one()
|
| Line 157... |
Line 151... |
| 157 |
|
151 |
|
| 158 |
#TO BE USED LATER
|
152 |
#TO BE USED LATER
|
| 159 |
#inventory_snapshot = iclient.getInventorySnapshot(0)
|
153 |
#inventory_snapshot = iclient.getInventorySnapshot(0)
|
| 160 |
#warehouses_ours = iclient.getWarehouses(WarehouseType._NAMES_TO_VALUES.get("OURS"), InventoryType._NAMES_TO_VALUES.get("GOOD"), 0,0,0)
|
154 |
#warehouses_ours = iclient.getWarehouses(WarehouseType._NAMES_TO_VALUES.get("OURS"), InventoryType._NAMES_TO_VALUES.get("GOOD"), 0,0,0)
|
| 161 |
#warehouses_third_party = iclient.getWarehouses(WarehouseType._NAMES_TO_VALUES.get("THIRD_PARTY "), InventoryType._NAMES_TO_VALUES.get("GOOD"), 0,0,0)
|
155 |
#warehouses_third_party = iclient.getWarehouses(WarehouseType._NAMES_TO_VALUES.get("THIRD_PARTY "), InventoryType._NAMES_TO_VALUES.get("GOOD"), 0,0,0)
|
| 162 |
print "supc is final append",supc
|
- |
|
| 163 |
print "item id",one_line.item_id
|
- |
|
| 164 |
all_supc.append(supc)
|
156 |
all_supc.append(supc)
|
| 165 |
all_lines.append(one_line)
|
157 |
all_lines.append(one_line)
|
| 166 |
write_report("/tmp/snapdeal_running.xls", all_lines, all_supc)
|
158 |
write_report("/tmp/snapdeal_running.xls", all_lines, all_supc)
|
| 167 |
|
159 |
|
| 168 |
|
160 |
|