Subversion Repositories SmartDukaan

Rev

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

Rev 8925 Rev 8954
Line 487... Line 487...
487
        ItemAvailabilityCache.query.delete()
487
        ItemAvailabilityCache.query.delete()
488
    session.commit()
488
    session.commit()
489
 
489
 
490
def __update_item_availability_cache(item_id, source_id):
490
def __update_item_availability_cache(item_id, source_id):
491
    """
491
    """
492
    Determines the warehouse that should be used to fulfill an order for the given item.
492
    Determines the warehouse that should be used to fulfil an order for the given item.
493
    Algorithm explained at https://sites.google.com/a/shop2020.in/virtual-w-h-and-inventory/technical-details
493
    Algorithm explained at https://sites.google.com/a/shop2020.in/virtual-w-h-and-inventory/technical-details
494
 
494
 
495
    It will be ensured that every item has either a preferred vendor specified or at least for one vendor its transfer price should be defined.
495
    It will be ensured that every item has either a preferred vendor specified or at least for one vendor its transfer price should be defined.
496
    This is needed to associate an item with at least one vendor so that in default case when its available no where, we know from where to procure it.
496
    This is needed to associate an item with at least one vendor so that in default case when its available no where, we know from where to procure it.
497
    
497
    
Line 1213... Line 1213...
1213
    warehouseId=[]
1213
    warehouseId=[]
1214
    x= session.query(Warehouse.id).filter(Warehouse.id==Warehouse.billingWarehouseId).filter(Warehouse.warehouseType=='OURS').filter(Warehouse.state_id==1).all()
1214
    x= session.query(Warehouse.id).filter(Warehouse.id==Warehouse.billingWarehouseId).filter(Warehouse.warehouseType=='OURS').filter(Warehouse.state_id==1).all()
1215
    for id in x:
1215
    for id in x:
1216
        warehouseId.append(id[0])
1216
        warehouseId.append(id[0])
1217
    return session.query(Warehouse.id).filter(Warehouse.inventoryType=='GOOD').filter(Warehouse.warehouseType=='OURS').filter(Warehouse.billingWarehouseId.in_(warehouseId)).all()
1217
    return session.query(Warehouse.id).filter(Warehouse.inventoryType=='GOOD').filter(Warehouse.warehouseType=='OURS').filter(Warehouse.billingWarehouseId.in_(warehouseId)).all()
-
 
1218
 
-
 
1219
def get_holdinventorydetail_forItem_forWarehouseId_exceptsource(item_id,warehouse_id,source):
-
 
1220
    holddetails = HoldInventoryDetail.query.filter(HoldInventoryDetail.item_id == item_id).all()
-
 
1221
    print holddetails
-
 
1222
    hold = 0
-
 
1223
    for holddetail in holddetails:
-
 
1224
        if holddetail.source !=source and holddetail.warehouse_id == warehouse_id:
-
 
1225
            hold = hold + holddetail.held
-
 
1226
    return hold        
-
 
1227
        
-
 
1228
        
-
 
1229
    
-
 
1230