| Line 253... |
Line 253... |
| 253 |
transaction_requiring_extra_processing = TransactionRequiringExtraProcessing()
|
253 |
transaction_requiring_extra_processing = TransactionRequiringExtraProcessing()
|
| 254 |
transaction_requiring_extra_processing.category = 'COD_VERIFICATION'
|
254 |
transaction_requiring_extra_processing.category = 'COD_VERIFICATION'
|
| 255 |
transaction_requiring_extra_processing.transaction_id = transaction_id
|
255 |
transaction_requiring_extra_processing.transaction_id = transaction_id
|
| 256 |
session.commit()
|
256 |
session.commit()
|
| 257 |
except Exception as e:
|
257 |
except Exception as e:
|
| 258 |
print "Error inserting transaction Id: " + transaction_id + " due to "+ e
|
258 |
print "Error inserting transaction Id: " + str(transaction_id) + " due to " + str(e)
|
| 259 |
|
259 |
|
| 260 |
return True
|
260 |
return True
|
| 261 |
|
261 |
|
| 262 |
def __get_holidays(start_time=0L, to_time=-1L):
|
262 |
def __get_holidays(start_time=0L, to_time=-1L):
|
| 263 |
'''
|
263 |
'''
|
| Line 1353... |
Line 1353... |
| 1353 |
transaction_requiring_extra_processing = TransactionRequiringExtraProcessing()
|
1353 |
transaction_requiring_extra_processing = TransactionRequiringExtraProcessing()
|
| 1354 |
transaction_requiring_extra_processing.category = 'DELAYED_DELIVERY'
|
1354 |
transaction_requiring_extra_processing.category = 'DELAYED_DELIVERY'
|
| 1355 |
transaction_requiring_extra_processing.transaction_id = order.transaction_id
|
1355 |
transaction_requiring_extra_processing.transaction_id = order.transaction_id
|
| 1356 |
session.commit()
|
1356 |
session.commit()
|
| 1357 |
except Exception as e:
|
1357 |
except Exception as e:
|
| 1358 |
print 'Could not persist transaction id: ' + order.transaction_id + ' for further processing due to: ' + e
|
1358 |
print 'Could not persist transaction id: ' + str(order.transaction_id) + ' for further processing due to: ' + str(e)
|
| 1359 |
|
1359 |
|
| 1360 |
return True
|
1360 |
return True
|
| 1361 |
except:
|
1361 |
except:
|
| 1362 |
print sys.exc_info()[0]
|
1362 |
print sys.exc_info()[0]
|
| 1363 |
return False
|
1363 |
return False
|
| Line 1400... |
Line 1400... |
| 1400 |
session.commit()
|
1400 |
session.commit()
|
| 1401 |
|
1401 |
|
| 1402 |
return unprocessed_awbs
|
1402 |
return unprocessed_awbs
|
| 1403 |
|
1403 |
|
| 1404 |
def get_transactions_requiring_extra_processing(category):
|
1404 |
def get_transactions_requiring_extra_processing(category):
|
| - |
|
1405 |
"""
|
| - |
|
1406 |
Returns the list of transaction ids that require some extra processing and
|
| - |
|
1407 |
which belong to a particular category. This is currently used by CRM
|
| - |
|
1408 |
application. If no such transaction ids are present, it returns an empty list.
|
| - |
|
1409 |
"""
|
| 1405 |
transactions = []
|
1410 |
query = TransactionRequiringExtraProcessing.query
|
| 1406 |
|
1411 |
|
| 1407 |
if category is None:
|
1412 |
if category is not None:
|
| 1408 |
transactions = [a.transaction_id for a in TransactionRequiringExtraProcessing.query.all()]
|
- |
|
| 1409 |
else:
|
- |
|
| 1410 |
transactions = [a.transaction_id for a in TransactionRequiringExtraProcessing.query.filter_by(category = ExtraTransactionProcessingType._VALUES_TO_NAMES.get(category)).all()]
|
1413 |
query = query.filter_by(category = ExtraTransactionProcessingType._VALUES_TO_NAMES.get(category))
|
| 1411 |
|
1414 |
|
| 1412 |
return transactions
|
1415 |
return [a.transaction_id for a in query.all()]
|
| 1413 |
|
1416 |
|
| 1414 |
def mark_transaction_as_processed(transactionId, category):
|
1417 |
def mark_transaction_as_processed(transactionId, category):
|
| - |
|
1418 |
"""
|
| - |
|
1419 |
Marks a particular transaction as processed for a particular cateogory.
|
| - |
|
1420 |
It essentially deletes the transaction id record for a particular
|
| - |
|
1421 |
processing type category (if present) from DB.
|
| - |
|
1422 |
This is currently used by CRM application.
|
| - |
|
1423 |
"""
|
| 1415 |
TransactionRequiringExtraProcessing.query.filter_by(transaction_id = transactionId).filter_by(category = ExtraTransactionProcessingType._VALUES_TO_NAMES.get(category)).delete()
|
1424 |
TransactionRequiringExtraProcessing.query.filter_by(transaction_id = transactionId).filter_by(category = ExtraTransactionProcessingType._VALUES_TO_NAMES.get(category)).delete()
|
| 1416 |
session.commit()
|
1425 |
session.commit()
|
| 1417 |
return
|
- |
|
| 1418 |
|
1426 |
|
| 1419 |
def get_item_wise_risky_orders_count():
|
1427 |
def get_item_wise_risky_orders_count():
|
| 1420 |
"""
|
1428 |
"""
|
| 1421 |
Returns a map containing the number of risky orders keyed by item id. A risky order
|
1429 |
Returns a map containing the number of risky orders keyed by item id. A risky order
|
| 1422 |
is defined as one whose shipping date is about to expire.
|
1430 |
is defined as one whose shipping date is about to expire.
|