Subversion Repositories SmartDukaan

Rev

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

Rev 6979 Rev 7038
Line 47... Line 47...
47
        else:
47
        else:
48
            diffMinutes =int((time.mktime(now.timetuple()) - time.mktime(data[0].timetuple()))/60)
48
            diffMinutes =int((time.mktime(now.timetuple()) - time.mktime(data[0].timetuple()))/60)
49
            print "Diff",diffMinutes
49
            print "Diff",diffMinutes
50
        if ( diffMinutes > checkInterval):
50
        if ( diffMinutes > checkInterval):
51
            print "Diffcheck"
51
            print "Diffcheck"
-
 
52
            minutes=diffMinutes%60
-
 
53
            hours=int(diffMinutes/60)
-
 
54
            checkHours=int(checkInterval/60)
52
            mailText = "Warehouse "+warehouseName+" Id = "+str(warehouseId)+" was last checked "+str(diffMinutes)+" minutes ago while its interval is "+str(checkInterval)+" minutes"+"\n\n"
55
            mailText = "Warehouse "+warehouseName+" Id = "+str(warehouseId)+" was last checked "+str(hours)+" hours and "+str(minutes)+" minutes ago while its interval is "+str(checkHours)+" hours"+"\n\n"
53
            print mailText
56
            print mailText
54
            MESSAGE.append(mailText)
57
            MESSAGE.append(mailText)
55
            print "checking timediff"
58
            print "checking timediff"
56
    
59
    
57
    except:
60
    except:
Line 75... Line 78...
75
    smtpServer.set_debuglevel(1)
78
    smtpServer.set_debuglevel(1)
76
    msg = MIMEText(msg)
79
    msg = MIMEText(msg)
77
    sender = 'inventory-monitor@shop2020.in'
80
    sender = 'inventory-monitor@shop2020.in'
78
    recipients = ['rajneesh.arora@shop2020.in','rajveer.singh@shop2020.in','kshitij.sood@shop2020.in',
81
    recipients = ['rajneesh.arora@shop2020.in','rajveer.singh@shop2020.in','kshitij.sood@shop2020.in',
79
                  'vikram.raghav@shop2020.in','amar.kumar@shop2020.in','amit.gupta@shop2020.in',
82
                  'vikram.raghav@shop2020.in','amar.kumar@shop2020.in','amit.gupta@shop2020.in',
80
                  'anupam.singh@shop2020.in']
83
                  'anupam.singh@shop2020.in','khushal.bhatia@shop2020.in','chandan.kumar@shop2020.in','sandeep.sachdeva@shop2020.in']
81
    msg['Subject'] = "Warehouse Inventory Monitor"
84
    msg['Subject'] = "Warehouse Inventory Monitor"
82
    msg['From'] = sender
85
    msg['From'] = sender
83
    msg['To'] = ", ".join(recipients)
86
    msg['To'] = ", ".join(recipients)
84
    
87
    
85
    try:
88
    try:
Line 108... Line 111...
108
    finally:
111
    finally:
109
        print "Closing db connection"
112
        print "Closing db connection"
110
        db.close()  
113
        db.close()  
111
        
114
        
112
if __name__ == "__main__":
115
if __name__ == "__main__":
113
    main()
-
 
114
116
    main()
-
 
117