Subversion Repositories SmartDukaan

Rev

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

Rev 4435 Rev 4444
Line 787... Line 787...
787
            continue
787
            continue
788
            #raise TransactionServiceException(103, "No order found for the awb:" + awb)
788
            #raise TransactionServiceException(103, "No order found for the awb:" + awb)
789
        order.statusDescription = reason
789
        order.statusDescription = reason
790
    session.commit()
790
    session.commit()
791
 
791
 
792
def get_alerts(type, status, timestamp):
792
def get_alerts(type, warehouseId, status, timestamp):
-
 
793
    query = Alert.query.filter(Alert.warehouseId == warehouseId)
-
 
794
    if type != -1 :
793
    query = Alert.query.filter(Alert.type == type)
795
        query = query.filter(Alert.type == type)
-
 
796
    if status != -1 :
794
    query = query.filter(Alert.status == status)
797
        query = query.filter(Alert.status == status)
795
    if timestamp:
798
    if timestamp:
796
        query = query.filter(Alert.timestamp >= to_py_date(timestamp))
799
        query = query.filter(Alert.timestamp >= to_py_date(timestamp))
797
    query = query.order_by(desc(Alert.timestamp))
800
    query = query.order_by(desc(Alert.timestamp))
798
    return query.all()
801
    return query.all()
799
 
802
 
Line 801... Line 804...
801
    alert = Alert()
804
    alert = Alert()
802
    alert.type = type
805
    alert.type = type
803
    alert.status = 1
806
    alert.status = 1
804
    alert.description = description
807
    alert.description = description
805
    alert.timestamp = datetime.datetime.now()
808
    alert.timestamp = datetime.datetime.now()
806
    session.commit()    
809
    session.commit()
807
 
810
 
-
 
811
def mark_alerts_as_seen(warehouseId):
-
 
812
    query = Alert.query.filter(Alert.warehouseId == warehouseId).filter(Alert.status == 1)
-
 
813
    alerts = query.all()
-
 
814
    for alert in alerts:
-
 
815
        alert.status = 0    
-
 
816
    session.commit()
-
 
817
    
808
def get_valid_order_count():
818
def get_valid_order_count():
809
    '''
819
    '''
810
    Returns the number of orders which we processed. The reshipped orders are not
820
    Returns the number of orders which we processed. The reshipped orders are not
811
    counted since there'll always be a new compensating order present.
821
    counted since there'll always be a new compensating order present.
812
    '''
822
    '''