start and stop

master
varun 3 years ago
parent c8768e3db6
commit 203ea714ce

@ -278,7 +278,7 @@ exports.motorAction = async (req, reply) => {
const supplier_tank_info1 = await Tank.findOne({ customerId ,tankName:supplier_tank,tankLocation:supplier_tank_type}); const supplier_tank_info1 = await Tank.findOne({ customerId ,tankName:supplier_tank,tankLocation:supplier_tank_type});
console.log(supplier_tank_info1) console.log(supplier_tank_info1)
initial_update = parseInt(supplier_tank_info1.capacity.replace(/,/g, ''), 10)-200; const initial_update = parseInt(supplier_tank_info1.capacity.replace(/,/g, ''), 10)-200;
await Tank.findOneAndUpdate({customerId, tankName: supplier_tank,tankLocation:supplier_tank_type}, { $set: { waterlevel: initial_update } }); await Tank.findOneAndUpdate({customerId, tankName: supplier_tank,tankLocation:supplier_tank_type}, { $set: { waterlevel: initial_update } });
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});
@ -443,7 +443,7 @@ exports.motorAction = async (req, reply) => {
// clearInterval(intervalId); // clearInterval(intervalId);
await Tank.findOneAndUpdate({customerId, tankName: receiver_tank,tankLocation:(req.body.to_type).toLowerCase()}, { $set: { motor_status: "0" } }); await Tank.findOneAndUpdate({customerId, tankName: receiver_tank,tankLocation:(req.body.to_type).toLowerCase()}, { $set: { motor_status: "0" } });
// reply.send({ status_code: 200, "stop time": stop_time}); reply.send({ status_code: 200, "stop time": stop_time});
} else { } else {
throw new Error("Invalid action"); throw new Error("Invalid action");
} }

Loading…
Cancel
Save