| Line 15... |
Line 15... |
| 15 |
def generateScanMismatches(date):
|
15 |
def generateScanMismatches(date):
|
| 16 |
warehouseClient = WarehouseClient().get_client()
|
16 |
warehouseClient = WarehouseClient().get_client()
|
| 17 |
return warehouseClient.fetchScansPerInvoiceNumber(to_java_date(datetime.datetime.strptime(date, '%Y-%m-%d')))
|
17 |
return warehouseClient.fetchScansPerInvoiceNumber(to_java_date(datetime.datetime.strptime(date, '%Y-%m-%d')))
|
| 18 |
|
18 |
|
| 19 |
def reportMismatches(mismatches, date):
|
19 |
def reportMismatches(mismatches, date):
|
| - |
|
20 |
print mismatches
|
| 20 |
body = ["\t".join(['Date', 'Invoice Number', 'Supplier', 'No. of Items as per Invoice', 'No. of Items actually scanned'])]
|
21 |
body = ["\t".join(['Date', 'Invoice Number', 'Supplier', 'No. of Items as per Invoice', 'No. of Items actually scanned'])]
|
| 21 |
unscannedCount = 0
|
22 |
unscannedCount = 0
|
| 22 |
for invoiceScan in mismatches:
|
23 |
for invoiceScan in mismatches:
|
| 23 |
body.append("\t".join([date, invoiceScan.invoiceNumber, invoiceScan.supplierName, str(invoiceScan.numItems), str(invoiceScan.scannedQuantity)]))
|
24 |
body.append("\t".join([date, invoiceScan.invoiceNumber, invoiceScan.supplierName, str(invoiceScan.numItems), str(invoiceScan.scannedQuantity)]))
|
| 24 |
unscannedCount += invoiceScan.numItems - invoiceScan.scannedQuantity
|
25 |
unscannedCount += invoiceScan.numItems - invoiceScan.scannedQuantity
|
| Line 27... |
Line 28... |
| 27 |
subject = date + ': ' + str(abs(unscannedCount))
|
28 |
subject = date + ': ' + str(abs(unscannedCount))
|
| 28 |
if unscannedCount > 0:
|
29 |
if unscannedCount > 0:
|
| 29 |
subject += ' items not scanned IN yet'
|
30 |
subject += ' items not scanned IN yet'
|
| 30 |
else:
|
31 |
else:
|
| 31 |
subject += ' extra items got scanned IN'
|
32 |
subject += ' extra items got scanned IN'
|
| 32 |
EmailAttachmentSender.mail('cnc.center@shop2020.in', '5h0p2o2o', ['mandeep.dhir@shop2020.in', 'amit.kumar@shop2020.in', 'ashutosh.saxena@shop2020.in', 'sandeep.sachdeva@shop2020.in','amar.kumar@shop2020.in'], subject, "\n".join(body))
|
33 |
EmailAttachmentSender.mail('cnc.center@shop2020.in', '5h0p2o2o', ['amar.kumar@shop2020.in'], subject, "\n".join(body))
|
| 33 |
|
34 |
|
| 34 |
def generateAndReportScanMismatches(date):
|
35 |
def generateAndReportScanMismatches(date):
|
| 35 |
reportMismatches(generateScanMismatches(date), date)
|
36 |
reportMismatches(generateScanMismatches(date), date)
|
| 36 |
|
37 |
|
| 37 |
def main():
|
38 |
def main():
|