master
Varun 9 months ago
parent 031754f948
commit b09357dee3

@ -1188,13 +1188,13 @@ const generateBatchNo = (type, hardwareIdCompany) => {
const companyPrefix = hardwareIdCompany.slice(0, 2).toUpperCase();
const randomNumbers = Math.floor(100 + Math.random() * 900).toString(); // 3 random digits
if (type === 'slave') {
if (type === 'SLAVE') {
return `SL${ddmmyy}${companyPrefix}${randomNumbers}`;
}
if (type === 'master') {
if (type === 'MASTER') {
return `MA${ddmmyy}${companyPrefix}${randomNumbers}`;
}
if (type === 'motor_switch') {
if (type === 'MOTOR_SWITCH') {
return `MS${ddmmyy}${companyPrefix}${randomNumbers}`;
}
// Add other type conditions if needed
@ -1202,7 +1202,7 @@ const generateBatchNo = (type, hardwareIdCompany) => {
};
exports.createSensor = async (req, reply) => {
try {
try {
const storeId = req.params.storeId;
const { indate, batchno, hardwareId_company, quantity, model, type } = req.body;

Loading…
Cancel
Save