Subversion Repositories SmartDukaan

Rev

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

Rev 4555 Rev 4556
Line 1996... Line 1996...
1996
    orderInv.estimate = estimate
1996
    orderInv.estimate = estimate
1997
    orderInv.itemId = itemId
1997
    orderInv.itemId = itemId
1998
    orderInv.timestamp = datetime.datetime.now()
1998
    orderInv.timestamp = datetime.datetime.now()
1999
    orderInv.quantity = quantity
1999
    orderInv.quantity = quantity
2000
    
2000
    
2001
    
2001
'''    
2002
def mark_orders_as_timeout(vendorId):
2002
def mark_orders_as_timeout(vendorId):
2003
    ret_timeouts = {}
2003
    ret_timeouts = {}
2004
    orderInvs = OrderInventory.query.all()
2004
    orderInvs = OrderInventory.query.all()
2005
    for orderInv in orderInvs:
2005
    for orderInv in orderInvs:
2006
        if orderInv.timestamp +  timedelta(days=orderInv.estimate) < datetime.datetime.now():
2006
        if orderInv.timestamp +  timedelta(days=orderInv.estimate) < datetime.datetime.now():
Line 2035... Line 2035...
2035
                orderInv.order.statusDescription = "Reversal Initiated Timeout"
2035
                orderInv.order.statusDescription = "Reversal Initiated Timeout"
2036
            else:
2036
            else:
2037
                orderInv.delete()
2037
                orderInv.delete()
2038
    session.commit()
2038
    session.commit()
2039
    return ret_timeouts
2039
    return ret_timeouts
-
 
2040
'''
-
 
2041
    
-
 
2042
    
-
 
2043
def mark_orders_as_timeout(vendorId):
-
 
2044
    ret_timeouts = {}
-
 
2045
    orderInvs = OrderInventory.query.all()
-
 
2046
    for orderInv in orderInvs:
-
 
2047
        if not ret_timeouts.has_key(orderInv.itemId):
-
 
2048
            timeout = TimeoutSummary()
-
 
2049
            ret_timeouts[orderInv.itemId] = timeout
-
 
2050
        else:
-
 
2051
            timeout = ret_timeouts.get(orderInv.itemId)
-
 
2052
        if orderInv.hotspotAction == HotspotAction.PO_RAISED and orderInv.order.status == OrderStatus.LOW_INV_PO_RAISED:
-
 
2053
            if timeout.poRaised:
-
 
2054
                timeout.poRaised += 1
-
 
2055
            else:
-
 
2056
                timeout.poRaised = 1
-
 
2057
                
-
 
2058
            if timeout.poEstimate:
-
 
2059
                timeout.poEstimate = max(orderInv.estimate, timeout.poEstimate)
-
 
2060
            else:
-
 
2061
                timeout.poEstimate = orderInv.estimate
-
 
2062
        elif orderInv.hotspotAction == HotspotAction.REVERSAL_INITIATED and orderInv.order.status == OrderStatus.LOW_INV_REVERSAL_IN_PROCESS:
-
 
2063
            if timeout.reversalInitiated:
-
 
2064
                timeout.reversalInitiated += 1
-
 
2065
            else:
-
 
2066
                timeout.reversalInitiated = 1
-
 
2067
                
-
 
2068
            if timeout.reversalEstimate:
-
 
2069
                timeout.reversalEstimate = max(orderInv.estimate, timeout.reversalEstimate)
-
 
2070
            else:
-
 
2071
                timeout.reversalEstimate = orderInv.estimate
-
 
2072
        orderInv.order.status = OrderStatus.INVENTORY_LOW
-
 
2073
        orderInv.order.statusDescription = "Low Inventory"
-
 
2074
        orderInv.delete()
-
 
2075
    session.commit()
-
 
2076
    return ret_timeouts
2040
            
2077
         
2041
def get_order_for_awb(awb):
2078
def get_order_for_awb(awb):
2042
    order = Order.get_by(airwaybill_no=awb)
2079
    order = Order.get_by(airwaybill_no=awb)
2043
    if not order:
2080
    if not order:
2044
        raise TransactionServiceException(108, "no such order")
2081
        raise TransactionServiceException(108, "no such order")
2045
    
2082