| Line 501... |
Line 501... |
| 501 |
return get_item_availability_for_location(item_id, source_id)
|
501 |
return get_item_availability_for_location(item_id, source_id)
|
| 502 |
|
502 |
|
| 503 |
def clear_item_availability_cache(item_id = None):
|
503 |
def clear_item_availability_cache(item_id = None):
|
| 504 |
if item_id:
|
504 |
if item_id:
|
| 505 |
ItemAvailabilityCache.query.filter_by(itemId = item_id).delete()
|
505 |
ItemAvailabilityCache.query.filter_by(itemId = item_id).delete()
|
| - |
|
506 |
session.commit()
|
| 506 |
else:
|
507 |
else:
|
| 507 |
ItemAvailabilityCache.query.delete()
|
508 |
ItemAvailabilityCache.query.delete()
|
| 508 |
session.commit()
|
509 |
session.commit()
|
| - |
|
510 |
client = CatalogClient("catalog_service_server_host_master", "catalog_service_server_port").get_client()
|
| - |
|
511 |
for item in client.getItemsByRiskyFlag():
|
| - |
|
512 |
__update_item_availability_cache(None, 1, item)
|
| 509 |
|
513 |
|
| 510 |
def __update_item_availability_cache(item_id, source_id):
|
514 |
def __update_item_availability_cache(item_id, source_id, item=None):
|
| 511 |
"""
|
515 |
"""
|
| 512 |
Determines the warehouse that should be used to fulfil an order for the given item.
|
516 |
Determines the warehouse that should be used to fulfil an order for the given item.
|
| 513 |
Algorithm explained at https://sites.google.com/a/shop2020.in/virtual-w-h-and-inventory/technical-details
|
517 |
Algorithm explained at https://sites.google.com/a/shop2020.in/virtual-w-h-and-inventory/technical-details
|
| 514 |
|
518 |
|
| 515 |
It will be ensured that every item has either a preferred vendor specified or at least for one vendor its transfer price should be defined.
|
519 |
It will be ensured that every item has either a preferred vendor specified or at least for one vendor its transfer price should be defined.
|
| Line 539... |
Line 543... |
| 539 |
3. Id of the warehouse which was finally picked up.
|
543 |
3. Id of the warehouse which was finally picked up.
|
| 540 |
|
544 |
|
| 541 |
Parameters:
|
545 |
Parameters:
|
| 542 |
- itemId
|
546 |
- itemId
|
| 543 |
"""
|
547 |
"""
|
| - |
|
548 |
if item is None:
|
| 544 |
item = __get_item_from_source(item_id, source_id)
|
549 |
item = __get_item_from_source(item_id, source_id)
|
| 545 |
item_pricing = {}
|
550 |
item_pricing = {}
|
| 546 |
for vendorItemPricing in VendorItemPricing.query.filter_by(item_id=item_id).all():
|
551 |
for vendorItemPricing in VendorItemPricing.query.filter_by(item_id=item_id).all():
|
| 547 |
item_pricing[vendorItemPricing.vendor_id] = vendorItemPricing
|
552 |
item_pricing[vendorItemPricing.vendor_id] = vendorItemPricing
|
| 548 |
|
553 |
|
| 549 |
ignoredWhs = get_ignored_warehouses(item_id)
|
554 |
ignoredWhs = get_ignored_warehouses(item_id)
|