Subversion Repositories SmartDukaan

Rev

Rev 511 | Rev 596 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

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