| Line 283... |
Line 283... |
| 283 |
ds_item.category = similar_item.category
|
283 |
ds_item.category = similar_item.category
|
| 284 |
ds_item.status = similar_item.status
|
284 |
ds_item.status = similar_item.status
|
| 285 |
ds_item.status_description = similar_item.status_description
|
285 |
ds_item.status_description = similar_item.status_description
|
| 286 |
|
286 |
|
| 287 |
session.commit();
|
287 |
session.commit();
|
| 288 |
return ds_item.id
|
288 |
return ds_item.id
|
| - |
|
289 |
|
| - |
|
290 |
def update_inventory_history(warehouse_id, timestamp, availability):
|
| - |
|
291 |
warehouse = get_Warehouse(warehouse_id)
|
| - |
|
292 |
if not warehouse:
|
| - |
|
293 |
raise InventoryServiceException(107, "Warehouse? Where?")
|
| - |
|
294 |
vendor = warehouse.vendor
|
| - |
|
295 |
time = datetime.datetime.now()
|
| - |
|
296 |
for item_key, quantity in availability.iteritems():
|
| - |
|
297 |
try:
|
| - |
|
298 |
vendor_item_mapping = VendorItemMapping.query.filter_by(vendor=vendor, item_key=item_key).one();
|
| - |
|
299 |
item = vendor_item_mapping.item
|
| - |
|
300 |
except:
|
| - |
|
301 |
continue
|
| - |
|
302 |
try:
|
| - |
|
303 |
item_inventory_history = ItemInventoryHistory()
|
| - |
|
304 |
item_inventory_history.warehouse = warehouse
|
| - |
|
305 |
item_inventory_history.item = item
|
| - |
|
306 |
item_inventory_history.timestamp = time
|
| - |
|
307 |
item_inventory_history.availibility = quantity
|
| - |
|
308 |
except:
|
| - |
|
309 |
raise InventoryServiceException(108, "Some unforeseen error while updating inventory")
|
| - |
|
310 |
session.commit()
|
| 289 |
|
311 |
|
| 290 |
def update_inventory(warehouse_id, timestamp, availability):
|
312 |
def update_inventory(warehouse_id, timestamp, availability):
|
| 291 |
warehouse = get_Warehouse(warehouse_id)
|
313 |
warehouse = get_Warehouse(warehouse_id)
|
| 292 |
if not warehouse:
|
314 |
if not warehouse:
|
| 293 |
raise InventoryServiceException(107, "Warehouse? Where?")
|
315 |
raise InventoryServiceException(107, "Warehouse? Where?")
|
| Line 302... |
Line 324... |
| 302 |
vendor_item_mapping = VendorItemMapping.query.filter_by(vendor=vendor, item_key=item_key).one();
|
324 |
vendor_item_mapping = VendorItemMapping.query.filter_by(vendor=vendor, item_key=item_key).one();
|
| 303 |
item = vendor_item_mapping.item
|
325 |
item = vendor_item_mapping.item
|
| 304 |
except:
|
326 |
except:
|
| 305 |
continue
|
327 |
continue
|
| 306 |
try:
|
328 |
try:
|
| 307 |
item_inventory_history = ItemInventoryHistory()
|
- |
|
| 308 |
item_inventory_history.warehouse = warehouse
|
- |
|
| 309 |
item_inventory_history.item = item
|
- |
|
| 310 |
item_inventory_history.timestamp = time
|
- |
|
| 311 |
item_inventory_history.availibility = quantity
|
- |
|
| 312 |
|
- |
|
| 313 |
current_inventory_snapshot = CurrentInventorySnapshot.get_by(item=item, warehouse=warehouse)
|
329 |
current_inventory_snapshot = CurrentInventorySnapshot.get_by(item=item, warehouse=warehouse)
|
| 314 |
if not current_inventory_snapshot:
|
330 |
if not current_inventory_snapshot:
|
| 315 |
current_inventory_snapshot = CurrentInventorySnapshot()
|
331 |
current_inventory_snapshot = CurrentInventorySnapshot()
|
| 316 |
current_inventory_snapshot.item = item
|
332 |
current_inventory_snapshot.item = item
|
| 317 |
current_inventory_snapshot.warehouse = warehouse
|
333 |
current_inventory_snapshot.warehouse = warehouse
|