Subversion Repositories SmartDukaan

Rev

Rev 7754 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
7754 rajveer 1
#!/bin/bash
11839 amit.gupta 2
TOEMAIL="anikendra.das@shop2020.in,amit.gupta@shop2020.in,rajneesh.arora@shop2020.in"
7754 rajveer 3
 
4
mysql -u root -pshop2020 -h 192.168.190.114 transaction -e "select i.warehouse_id, i.item_id, r.warehouse_id, r.item_id, IFNULL(SUM(r.reserved),0) as reservationsR, IFNULL(i.reserved,0) reservationI from inventory.currentreservationsnapshot r left join inventory.currentinventorysnapshot i on i.warehouse_id = r.warehouse_id and i.item_id = r.item_id group by r.warehouse_id, r.item_id having reservationsR != reservationI UNION select i.warehouse_id, i.item_id, r.warehouse_id, r.item_id, IFNULL(SUM(r.reserved),0) as reservationsR, IFNULL(i.reserved,0) reservationI from inventory.currentinventorysnapshot i left join inventory.currentreservationsnapshot r on i.warehouse_id = r.warehouse_id and i.item_id = r.item_id group by i.warehouse_id, i.item_id having reservationsR != reservationI" > /tmp/reservation-mismatch.txt
5
 
6
mysql -u root -pshop2020 -h 192.168.190.114 transaction -e "select o.id, o.status, o.statusDescription, l.item_id, o.fulfilmentWarehouseId, r.order_id, r.item_id, r.warehouse_id from transaction.order o join transaction.lineitem l on o.id = l.order_id left join inventory.currentreservationsnapshot r on l.item_id = r.item_id and r.warehouse_id = o.fulfilmentWarehouseId and r.order_id = o.id where status in (2, 3, 4, 5, 35, 36, 37, 38, 39, 8, 13, 14) and r.warehouse_id is null UNION select o.id, o.status, o.statusDescription, l.item_id, o.fulfilmentWarehouseId, r.order_id, r.item_id, r.warehouse_id from transaction.order o join transaction.lineitem l on o.id = l.order_id right join inventory.currentreservationsnapshot r on l.item_id = r.item_id and r.warehouse_id = o.fulfilmentWarehouseId and r.order_id = o.id and status in (2, 3, 4, 5, 35, 36, 37, 38, 39, 8, 13, 14) where o.id is null" >> /tmp/reservation-mismatch.txt
7
 
8
s=`du /tmp/reservation-mismatch.txt | cut -c 1`
9
if [ $s != 0 ]
10
then
11
	sendEmail -f "build@shop2020.in" -s smtp.gmail.com:587 -xu "build@shop2020.in" -xp "cafe@nes" -t $TOEMAIL -o tls=yes -u "ALERT : RESERVATION MISMATCH" -m "Reservation Mismatch file attached" -a /tmp/reservation-mismatch.txt
12
fi