Subversion Repositories SmartDukaan

Rev

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

Rev 7972 Rev 8019
Line 547... Line 547...
547
        expectedDelay = 0
547
        expectedDelay = 0
548
    else:
548
    else:
549
        expectedDelay = int(item.expectedDelay)
549
        expectedDelay = int(item.expectedDelay)
550
 
550
 
551
    if total_availability <= 0:
551
    if total_availability <= 0:
552
        if item.preferredVendor in [1, 5]:
552
        if item.preferredVendor in [1, 5, 61, 62]:
553
            expectedDelay = expectedDelay + 3
553
            expectedDelay = expectedDelay + 3
554
        else:
554
        else:
555
            expectedDelay = expectedDelay + 2
555
            expectedDelay = expectedDelay + 2
556
    else:
556
    else:
557
        if warehouse.transferDelayInHours:
557
        if warehouse.transferDelayInHours:
Line 1077... Line 1077...
1077
    
1077
    
1078
    client = TransactionClient().get_client()
1078
    client = TransactionClient().get_client()
1079
    
1079
    
1080
    #Gets physical orders in the last day
1080
    #Gets physical orders in the last day
1081
    orders = client.getPhysicalOrders(to_java_date(cartAdditionStartDate), to_java_date(oosDate))
1081
    orders = client.getPhysicalOrders(to_java_date(cartAdditionStartDate), to_java_date(oosDate))
1082
    
1082
    rtoOrders = client.getAllOrders([20], 0, 0, 0)
1083
    orderCountByItemId = {}
1083
    orderCountByItemId = {}
-
 
1084
    rtoOrderCountByItemId = {}
-
 
1085
    
1084
    for order in orders:
1086
    for order in orders:
1085
        if orderCountByItemId.has_key(order.lineitems[0].item_id):
1087
        if orderCountByItemId.has_key(order.lineitems[0].item_id):
1086
            orderCountByItemId[order.lineitems[0].item_id] = orderCountByItemId[order.lineitems[0].item_id] + 1 
1088
            orderCountByItemId[order.lineitems[0].item_id] = orderCountByItemId[order.lineitems[0].item_id] + 1 
1087
        else:
1089
        else:
1088
            orderCountByItemId[order.lineitems[0].item_id] = 1
1090
            orderCountByItemId[order.lineitems[0].item_id] = 1
-
 
1091
            
-
 
1092
    for order in rtoOrders:
-
 
1093
        if rtoOrderCountByItemId.has_key(order.lineitems[0].item_id):
-
 
1094
            rtoOrderCountByItemId[order.lineitems[0].item_id] = rtoOrderCountByItemId[order.lineitems[0].item_id] + 1 
-
 
1095
        else:
-
 
1096
            rtoOrderCountByItemId[order.lineitems[0].item_id] = 1
1089
    
1097
    
1090
    for itemId, status in oosStatusMap.iteritems():
1098
    for itemId, status in oosStatusMap.iteritems():
1091
        if OOSStatus.query.filter_by(item_id = itemId, date = oosDate).first() is None: 
1099
        if OOSStatus.query.filter_by(item_id = itemId, date = oosDate).first() is None: 
1092
            oosStatus = OOSStatus()
1100
            oosStatus = OOSStatus()
1093
            oosStatus.item_id = itemId
1101
            oosStatus.item_id = itemId
1094
            oosStatus.date = oosDate
1102
            oosStatus.date = oosDate
1095
            oosStatus.is_oos = status
1103
            oosStatus.is_oos = status
1096
            order_count = 0
1104
            order_count = 0
-
 
1105
            rto_count = 0
1097
            if status == False:
1106
            if status == False:
1098
                if orderCountByItemId.has_key(itemId):
1107
                if orderCountByItemId.has_key(itemId):
1099
                    order_count = orderCountByItemId[itemId]
1108
                    order_count = orderCountByItemId[itemId]
-
 
1109
            if rtoOrderCountByItemId.has_key(itemId):
-
 
1110
                rto_count = rtoOrderCountByItemId[itemId]
1100
            oosStatus.num_orders = order_count
1111
            oosStatus.num_orders = order_count
-
 
1112
            oosStatus.rto_orders = rto_count
1101
            session.commit()
1113
            session.commit()
1102
        else:
1114
        else:
1103
            print "OOS Status already exists for ItemID:"+str(itemId)
1115
            print "OOS Status already exists for ItemID:"+str(itemId)
1104
            """raise InventoryServiceException(101, "OOS Status already exists for ItemID:"+str(itemId) + " & Date:"+oosDate)"""
1116
            """raise InventoryServiceException(101, "OOS Status already exists for ItemID:"+str(itemId) + " & Date:"+oosDate)"""
1105
        
1117