Subversion Repositories SmartDukaan

Rev

Rev 511 | Rev 596 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 511 Rev 515
Line 1... Line 1...
1
from shop2020.thriftpy.model.v1.catalog.ttypes import Item, status, Warehouse
1
from shop2020.thriftpy.model.v1.catalog.ttypes import Item, status, Warehouse
2
import datetime
2
import datetime
3
from shop2020.clients.InventoryClient import InventoryClient
3
from shop2020.clients.InventoryClient import InventoryClient
4
from shop2020.utils.Utils import to_java_date
4
from shop2020.utils.Utils import to_java_date
5
import xlrd
5
import xlrd
-
 
6
from shop2020.clients.WidgetClient import WidgetClient
6
 
7
 
7
inventory_client = InventoryClient()
8
inventory_client = InventoryClient()
8
 
9
 
9
inventory_client.__start__()
10
inventory_client.__start__()
10
 
11
 
11
client = inventory_client.get_client()
12
client = inventory_client.get_client()
12
items = client.getAllItems(False);
-
 
13
 
13
 
14
 
14
 
-
 
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
15
wb = xlrd.open_workbook('/home/rajveer/Desktop/phone-models.xls')
42
wb = xlrd.open_workbook('/home/rajveer/Desktop/phone-models.xls')
16
sheet = wb.sheet_by_index(0)
43
sheet = wb.sheet_by_index(0)
17
 
44
 
18
count = 0
45
count = 0
19
for rownum in range(sheet.nrows):
46
for rownum in range(sheet.nrows):
20
    #print sheet.row_values(rownum)
47
    #print sheet.row_values(rownum)
21
    print sheet.row_values(count)
48
    print sheet.row_values(count)
22
    count = count + 1
49
    count = count + 1
23
 
50
 
24
count = 1    
51
count = 1
-
 
52
items = client.getAllItems(False);    
25
for item in items:
53
for item in items:
26
    item.catalogItemId = sheet.row_values(count)[0]
54
    item.catalogItemId = sheet.row_values(count)[0]
27
    item.category = sheet.row_values(count)[1]
55
    item.category = sheet.row_values(count)[1]
28
    item.manufacturerName = sheet.row_values(count)[2]
56
    item.manufacturerName = sheet.row_values(count)[2]
29
    item.modelNumber = sheet.row_values(count)[3]
57
    item.modelNumber = sheet.row_values(count)[3]
Line 31... Line 59...
31
    item.mrp = sheet.row_values(count)[5]
59
    item.mrp = sheet.row_values(count)[5]
32
    item.sellingPrice = sheet.row_values(count)[6]
60
    item.sellingPrice = sheet.row_values(count)[6]
33
    item.itemStatus = status.ACTIVE
61
    item.itemStatus = status.ACTIVE
34
    count = count + 1
62
    count = count + 1
35
    client.updateItem(item)
63
    client.updateItem(item)
36
    
-
 
37
64
""" 
-
 
65
38
66