Subversion Repositories SmartDukaan

Rev

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

Rev 995 Rev 1113
Line 255... Line 255...
255
            order.shipping_timestamp = current_timestamp
255
            order.shipping_timestamp = current_timestamp
256
        session.commit()
256
        session.commit()
257
        return True
257
        return True
258
    except:
258
    except:
259
        return False
259
        return False
260
    
260
 
-
 
261
def mark_orders_as_picked_up(provider_id, pickup_details):
-
 
262
    for awb, pickup_timestamp in pickup_details.iteritems():
-
 
263
        order = Order.get_by(airwaybill_no=awb)
-
 
264
        if order == None:
-
 
265
            raise TransactionServiceException(102, "No order found for the awb: " + awb)
-
 
266
        order.status = OrderStatus.SHIPPED_TO_LOGST
-
 
267
        order.statusDescription = "Order picked up by Courier Company"
-
 
268
        order.pickup_timestamp = to_py_date(pickup_timestamp)
-
 
269
    session.commit()
-
 
270
    #FIXME: Add a check for shipping timestamp to be of yesterday
-
 
271
    orders_not_picked_up = Order.query.filter_by(logistics_provider_id = provider_id, status=OrderStatus.SHIPPED_FROM_WH).all()
-
 
272
    return orders_not_picked_up
261
    
273
 
262
def get_alerts(order_id, all):
274
def get_alerts(order_id, all):
263
    query = Alerts.query.filter_by(order_id=order_id)
275
    query = Alerts.query.filter_by(order_id=order_id)
264
    if not all:
276
    if not all:
265
        query = query.filter_by(valid=True)
277
        query = query.filter_by(valid=True)
266
    return query.all()
278
    return query.all()