Subversion Repositories SmartDukaan

Rev

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

Rev 7431 Rev 7438
Line 121... Line 121...
121
        t_item_shipping_info.quantity = availability
121
        t_item_shipping_info.quantity = availability
122
    except InventoryServiceException:
122
    except InventoryServiceException:
123
        print "[ERROR] Unexpected error:", sys.exc_info()[0]
123
        print "[ERROR] Unexpected error:", sys.exc_info()[0]
124
    return t_item_shipping_info
124
    return t_item_shipping_info
125
 
125
 
-
 
126
def get_items_status(item_ids):
-
 
127
    itemsStatus = dict()
-
 
128
    for item_id in item_ids:
-
 
129
        try:
-
 
130
            item = get_item(item_id)
-
 
131
            client = InventoryClient().get_client()
-
 
132
            itemInfo = client.getItemAvailabilityAtLocation(item.id, sourceId)
-
 
133
            warehouse_id = itemInfo[0]
-
 
134
            if item.risky and item.status == status.ACTIVE:
-
 
135
                availability = client.getItemAvailibilityAtWarehouse(warehouse_id, item_id)
-
 
136
                if availability <= 0:
-
 
137
                    item.status = status.PAUSED_BY_RISK
-
 
138
            itemsStatus[item_id] = (item.status == status.ACTIVE)
-
 
139
        except InventoryServiceException:
-
 
140
            print "[ERROR] Unexpected error:", sys.exc_info()[0]
-
 
141
    return itemsStatus
-
 
142
 
126
def get_item_status_description(itemId):
143
def get_item_status_description(itemId):
127
    item = get_item(itemId)
144
    item = get_item(itemId)
128
    return item.status_description
145
    return item.status_description
129
 
146
 
130
def update_item(item):
147
def update_item(item):