Subversion Repositories SmartDukaan

Rev

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

Rev 1730 Rev 2341
Line 24... Line 24...
24
 
24
 
25
def get_providers():
25
def get_providers():
26
    providers = Provider.query.all()
26
    providers = Provider.query.all()
27
    return providers 
27
    return providers 
28
 
28
 
29
def get_logistics_estimation(destination_pin, item_selling_price):
29
def get_logistics_estimation(destination_pin, item_selling_price, warehouse_location=None):
-
 
30
    if warehouse_location is None:
30
    try:
31
        try:
31
        warehouse_location = WarehouseAllocation.get_by(pincode = destination_pin).primary_warehouse_location
32
            warehouse_location = WarehouseAllocation.get_by(pincode = destination_pin).primary_warehouse_location
32
    except:
33
        except:
33
        print "Unexpected error:", sys.exc_info()[0]
34
            print "Unexpected error:", sys.exc_info()[0]
34
        raise LogisticsServiceException(101, "No Warehouse assigned to this pincode: " + destination_pin)
35
            raise LogisticsServiceException(101, "No Warehouse assigned to this pincode: " + destination_pin)
35
    
36
    
36
    query_provider = DestinationProviderAllocation.query.filter_by(destination_pin = destination_pin)
37
    query_provider = DestinationProviderAllocation.query.filter_by(destination_pin = destination_pin)
37
    query_provider = query_provider.filter_by(warehouse_location = warehouse_location)
38
    query_provider = query_provider.filter_by(warehouse_location = warehouse_location)
38
    try:
39
    try:
39
        if (item_selling_price <= 5000):
40
        if (item_selling_price <= 5000):