|
|
|
@ -1515,6 +1515,7 @@ exports.writeMotorStatus = async (req, reply) => {
|
|
|
|
|
const existingRecord = await Tank.findOne({ motor_id: motor_id });
|
|
|
|
|
|
|
|
|
|
if (existingRecord && (existingRecord.motor_stop_status === '1' || existingRecord.motor_stop_status === '2')) {
|
|
|
|
|
if (existingRecord.motor_stop_status === status) {
|
|
|
|
|
if (existingRecord.motor_status !== status) {
|
|
|
|
|
const result = await Tank.findOneAndUpdate(
|
|
|
|
|
{ motor_id: motor_id },
|
|
|
|
@ -1526,6 +1527,9 @@ exports.writeMotorStatus = async (req, reply) => {
|
|
|
|
|
} else {
|
|
|
|
|
reply.send({ status_code: 200, motor_status: status });
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
reply.send({ status_code: 200, message: 'Status and motor_stop_status are not the same.' });
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
reply.send({ status_code: 200, message: 'Motor stop status is not "on" or "off".' });
|
|
|
|
|
}
|
|
|
|
@ -1535,6 +1539,7 @@ exports.writeMotorStatus = async (req, reply) => {
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
exports.changeMotorStatus = async (req, reply) => {
|
|
|
|
|
try {
|
|
|
|
|
const motor_id = req.body.motor_id;
|
|
|
|
|