| 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
|
| 515 |
rajveer |
6 |
from shop2020.clients.WidgetClient import WidgetClient
|
| 511 |
rajveer |
7 |
|
|
|
8 |
inventory_client = InventoryClient()
|
|
|
9 |
|
| 596 |
rajveer |
10 |
#inventory_client.__start__()
|
| 511 |
rajveer |
11 |
|
|
|
12 |
client = inventory_client.get_client()
|
|
|
13 |
|
|
|
14 |
|
| 515 |
rajveer |
15 |
#For accessories
|
| 596 |
rajveer |
16 |
"""
|
|
|
17 |
wb = xlrd.open_workbook('/home/rajveer/Desktop/test1.xls')
|
| 515 |
rajveer |
18 |
sheet = wb.sheet_by_index(0)
|
|
|
19 |
|
|
|
20 |
count = 1
|
|
|
21 |
for rownum in range(sheet.nrows):
|
|
|
22 |
|
|
|
23 |
if count < 16:
|
|
|
24 |
count = count + 1
|
|
|
25 |
continue
|
|
|
26 |
print sheet.row_values(count)
|
|
|
27 |
item = Item()
|
|
|
28 |
item.catalogItemId = sheet.row_values(count)[0]
|
|
|
29 |
item.category = sheet.row_values(count)[1]
|
|
|
30 |
item.manufacturerName = sheet.row_values(count)[2]
|
|
|
31 |
item.modelNumber = sheet.row_values(count)[3]
|
|
|
32 |
item.modelName = sheet.row_values(count)[4]
|
|
|
33 |
item.mrp = sheet.row_values(count)[5]
|
|
|
34 |
item.sellingPrice = sheet.row_values(count)[6]
|
|
|
35 |
item.vendorItemId = str(long(sheet.row_values(count)[8]))
|
|
|
36 |
|
|
|
37 |
item.itemStatus = status.ACTIVE
|
|
|
38 |
client.addItem(item)
|
|
|
39 |
count = count + 1
|
|
|
40 |
|
|
|
41 |
"""
|
| 596 |
rajveer |
42 |
|
| 515 |
rajveer |
43 |
#For phones
|
| 511 |
rajveer |
44 |
wb = xlrd.open_workbook('/home/rajveer/Desktop/phone-models.xls')
|
|
|
45 |
sheet = wb.sheet_by_index(0)
|
|
|
46 |
|
|
|
47 |
count = 0
|
|
|
48 |
for rownum in range(sheet.nrows):
|
|
|
49 |
#print sheet.row_values(rownum)
|
| 596 |
rajveer |
50 |
|
|
|
51 |
item = Item()
|
|
|
52 |
|
|
|
53 |
item.catalogItemId = long(sheet.row_values(count)[0])
|
|
|
54 |
#item.category = sheet.row_values(count)[1]
|
|
|
55 |
#item.manufacturerName = sheet.row_values(count)[2]
|
|
|
56 |
#item.modelNumber = sheet.row_values(count)[3]
|
|
|
57 |
#item.modelName = sheet.row_values(count)[4]
|
|
|
58 |
#item.mrp = long(sheet.row_values(count)[5])
|
|
|
59 |
#item.sellingPrice = long(sheet.row_values(count)[6])
|
|
|
60 |
|
|
|
61 |
item.mrp = 981*(count+1)
|
|
|
62 |
item.sellingPrice = 819*(count+1)
|
|
|
63 |
item.vendorItemId = "CBHCC"+str(count)
|
| 511 |
rajveer |
64 |
item.itemStatus = status.ACTIVE
|
| 596 |
rajveer |
65 |
client.addItem(item)
|