made sump to sump start and stop

master
varun 2 years ago
parent 214abaa4f5
commit 0c275de032

@ -373,6 +373,15 @@ exports.motorAction = async (req, reply) => {
if(supplier_tank_type==="sump" && receiver_type === "sump"){ if(supplier_tank_type==="sump" && receiver_type === "sump"){
const receiver_capacity = parseInt(receiver_tank_info.capacity.replace(/,/g, ''), 10) const receiver_capacity = parseInt(receiver_tank_info.capacity.replace(/,/g, ''), 10)
const sumpTank = await Tank.findOne({ customerId, tankName: receiver_tank, tankLocation: receiver_type });
const connection = sumpTank.connections.inputConnections.find((conn) => conn.inputConnections === supplier_tank);
if (connection) {
connection.motor_status = "1";
await sumpTank.save();
}
// console.log(receiver_capacity,"0",receiver_tank_info.tankName) // console.log(receiver_capacity,"0",receiver_tank_info.tankName)
await Tank.findOneAndUpdate({customerId, tankName: receiver_tank,tankLocation:receiver_type}, { $set: { motor_status: "1" } }); await Tank.findOneAndUpdate({customerId, tankName: receiver_tank,tankLocation:receiver_type}, { $set: { motor_status: "1" } });
const supplier_tank_info = await Tank.findOne({ customerId ,tankName:supplier_tank,tankLocation:supplier_tank_type}); const supplier_tank_info = await Tank.findOne({ customerId ,tankName:supplier_tank,tankLocation:supplier_tank_type});

Loading…
Cancel
Save