Subversion Repositories SmartDukaan

Rev

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

Rev 4985 Rev 4992
Line 396... Line 396...
396
 
396
 
397
def __send_alert_for_negative_availability(item, availability, warehouse):
397
def __send_alert_for_negative_availability(item, availability, warehouse):
398
    itemName = " ".join([str(item.id), str(item.brand), str(item.model_name), str(item.model_number), str(item.color)])
398
    itemName = " ".join([str(item.id), str(item.brand), str(item.model_name), str(item.model_number), str(item.color)])
399
    EmailAttachmentSender.mail('cnc.center@shop2020.in', '5h0p2o2o', 'mandeep.dhir@shop2020.in', 'Negative availability ' + str(availability) + ' for Item id: ' + itemName + ' warehouse id: ' + str(warehouse.id), None)
399
    EmailAttachmentSender.mail('cnc.center@shop2020.in', '5h0p2o2o', 'mandeep.dhir@shop2020.in', 'Negative availability ' + str(availability) + ' for Item id: ' + itemName + ' warehouse id: ' + str(warehouse.id), None)
400
 
400
 
-
 
401
    # Let availability be auto-fixed from PLB for Hotspot warehouses
-
 
402
    if warehouse.id in [1, 2, 5]:
-
 
403
        for mapping in get_item_mappings(item.id):
-
 
404
            if mapping.vendor_id == 1:
-
 
405
                item_key = mapping.item_key
-
 
406
                break
-
 
407
 
-
 
408
        missedInventoryUpdate = MissedInventoryUpdate()
-
 
409
        missedInventoryUpdate.itemKey = item_key
-
 
410
        missedInventoryUpdate.quantity = 0
-
 
411
        missedInventoryUpdate.isIgnored = 0
-
 
412
        missedInventoryUpdate.timestamp = datetime.datetime.now()
-
 
413
        missedInventoryUpdate.warehouseId = warehouse.id
-
 
414
        session.commit()
-
 
415
 
401
def __send_mail_for_missing_key(item_key, quantity, warehouse_id):
416
def __send_mail_for_missing_key(item_key, quantity, warehouse_id):
402
    missedInventoryUpdate = MissedInventoryUpdate.get_by(itemKey = item_key, warehouseId = warehouse_id)
417
    missedInventoryUpdate = MissedInventoryUpdate.get_by(itemKey = item_key, warehouseId = warehouse_id)
403
    # One email per product key mismatch
418
    # One email per product key mismatch
404
    if not missedInventoryUpdate:
419
    if not missedInventoryUpdate:
405
        EmailAttachmentSender.mail('cnc.center@shop2020.in', '5h0p2o2o', ['mandeep.dhir@shop2020.in', 'chaitnaya.vats@shop2020.in'], 'Skipped inventory update for ' + item_key + ' quantity ' + str(quantity) + ' warehouse id: ' + str(warehouse_id), None)
420
        EmailAttachmentSender.mail('cnc.center@shop2020.in', '5h0p2o2o', ['mandeep.dhir@shop2020.in', 'chaitnaya.vats@shop2020.in'], 'Skipped inventory update for ' + item_key + ' quantity ' + str(quantity) + ' warehouse id: ' + str(warehouse_id), None)