| 511 |
rajveer |
1 |
from shop2020.thriftpy.model.v1.catalog.ttypes import Item, status, Warehouse
|
|
|
2 |
import datetime
|
|
|
3 |
from shop2020.clients.InventoryClient import InventoryClient
|
|
|
4 |
from shop2020.utils.Utils import to_java_date
|
|
|
5 |
import xlrd
|
|
|
6 |
|
|
|
7 |
inventory_client = InventoryClient()
|
|
|
8 |
|
|
|
9 |
inventory_client.__start__()
|
|
|
10 |
|
|
|
11 |
client = inventory_client.get_client()
|
|
|
12 |
items = client.getAllItems(False);
|
|
|
13 |
|
|
|
14 |
|
|
|
15 |
wb = xlrd.open_workbook('/home/rajveer/Desktop/phone-models.xls')
|
|
|
16 |
sheet = wb.sheet_by_index(0)
|
|
|
17 |
|
|
|
18 |
count = 0
|
|
|
19 |
for rownum in range(sheet.nrows):
|
|
|
20 |
#print sheet.row_values(rownum)
|
|
|
21 |
print sheet.row_values(count)
|
|
|
22 |
count = count + 1
|
|
|
23 |
|
|
|
24 |
count = 1
|
|
|
25 |
for item in items:
|
|
|
26 |
item.catalogItemId = sheet.row_values(count)[0]
|
|
|
27 |
item.category = sheet.row_values(count)[1]
|
|
|
28 |
item.manufacturerName = sheet.row_values(count)[2]
|
|
|
29 |
item.modelNumber = sheet.row_values(count)[3]
|
|
|
30 |
item.modelName = sheet.row_values(count)[4]
|
|
|
31 |
item.mrp = sheet.row_values(count)[5]
|
|
|
32 |
item.sellingPrice = sheet.row_values(count)[6]
|
|
|
33 |
item.itemStatus = status.ACTIVE
|
|
|
34 |
count = count + 1
|
|
|
35 |
client.updateItem(item)
|
|
|
36 |
|