Subversion Repositories SmartDukaan

Rev

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

Rev 18444 Rev 18481
Line 25... Line 25...
25
bundleMap = {}
25
bundleMap = {}
26
inventoryMap = {}
26
inventoryMap = {}
27
memCon = None
27
memCon = None
28
maxQuantity = 20
28
maxQuantity = 20
29
flaggedItems = []
29
flaggedItems = []
-
 
30
itemPricingMap = []
30
 
31
 
31
def get_inventory_client():
32
def get_inventory_client():
32
    ic = InventoryClient("inventory_service_server_host2","inventory_service_server_port2").get_client()
33
    ic = InventoryClient("inventory_service_server_host2","inventory_service_server_port2").get_client()
33
    return ic
34
    return ic
34
 
35
 
Line 59... Line 60...
59
            print e
60
            print e
60
            print "Exception Identifier not valid for %d"%(item.get('_id'))
61
            print "Exception Identifier not valid for %d"%(item.get('_id'))
61
 
62
 
62
def addItemIdInfo():
63
def addItemIdInfo():
63
    global bundleMap
64
    global bundleMap
-
 
65
    global itemPricingMap
64
    try:
66
    try:
65
        CatalogDataService.initialize(db_hostname=options.hostname,setup=False)
67
        CatalogDataService.initialize(db_hostname=options.hostname,setup=False)
66
        totalLength = len(bundleMap.keys())
68
        totalLength = len(bundleMap.keys())
67
        fetch =100
69
        fetch =100
68
        start = 0
70
        start = 0
Line 84... Line 86...
84
                sellingPriceType = "Normal"
86
                sellingPriceType = "Normal"
85
                if d_privatedeal is not None and d_privatedeal.isActive==1 and d_privatedeal.startDate < datetime.now() and d_privatedeal.endDate > datetime.now() and d_privatedeal.dealPrice >0:
87
                if d_privatedeal is not None and d_privatedeal.isActive==1 and d_privatedeal.startDate < datetime.now() and d_privatedeal.endDate > datetime.now() and d_privatedeal.dealPrice >0:
86
                    sellingPrice = d_privatedeal.dealPrice
88
                    sellingPrice = d_privatedeal.dealPrice
87
                    sellingPriceType = "Private deal price"
89
                    sellingPriceType = "Private deal price"
88
                tempList.append({'item_id':d_item.id,'color':d_item.color,'sellingPrice':sellingPrice,'sellingPriceType':sellingPriceType,'minBuyQuantity':d_item.minimumBuyQuantity,'quantityStep':d_item.quantityStep,'maxQuantity':d_item.maximumBuyQuantity})
90
                tempList.append({'item_id':d_item.id,'color':d_item.color,'sellingPrice':sellingPrice,'sellingPriceType':sellingPriceType,'minBuyQuantity':d_item.minimumBuyQuantity,'quantityStep':d_item.quantityStep,'maxQuantity':d_item.maximumBuyQuantity})
-
 
91
                itemPricingMap[d_item.id] =sellingPrice
89
            if toBreak:
92
            if toBreak:
90
                print "Breaking"
93
                print "Breaking"
91
                break
94
                break
92
            start = fetch
95
            start = fetch
93
            fetch = start + fetch
96
            fetch = start + fetch
Line 134... Line 137...
134
        for item in v:
137
        for item in v:
135
            bulkPricing = bulkItemsMap.get(item.get('item_id'))
138
            bulkPricing = bulkItemsMap.get(item.get('item_id'))
136
            if bulkPricing is None:
139
            if bulkPricing is None:
137
                item['bulkPricing'] = []
140
                item['bulkPricing'] = []
138
            else:
141
            else:
-
 
142
                singleUnitPricing = False
-
 
143
                for temp in bulkPricing:
-
 
144
                    if temp.get('quantity') ==1:
-
 
145
                        singleUnitPricing = True
-
 
146
                if not singleUnitPricing:
-
 
147
                    bulkPricing.append({'quantity':1,'price':itemPricingMap.get(item.get('item_id'))})
139
                item['bulkPricing'] = bulkPricing 
148
                item['bulkPricing'] = bulkPricing 
140
 
149
 
141
    
150
    
142
def fetchItemAvailablity():
151
def fetchItemAvailablity():
143
    global inventoryMap
152
    global inventoryMap