|
|
|
@ -1422,6 +1422,29 @@ exports.getbatchnumbers = async (req, reply) => {
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
exports.getbatquotationsforparticularstore = async (req, reply) => {
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
const storeId = req.params.storeId;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let query = { storeId: storeId };
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Fetch data based on the query
|
|
|
|
|
|
|
|
const result = await SensorQuotation.find(query);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!result ) {
|
|
|
|
|
|
|
|
return reply.send({ status_code: 404, error: "not found" });
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
reply.send({ status_code: 200, data: result });
|
|
|
|
|
|
|
|
} catch (err) {
|
|
|
|
|
|
|
|
throw boom.boomify(err);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
exports.getiots = async (req, reply) => {
|
|
|
|
exports.getiots = async (req, reply) => {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
const storeId = req.params.storeId;
|
|
|
|
const storeId = req.params.storeId;
|
|
|
|
@ -1475,7 +1498,7 @@ exports.createquotationforSensor = async (req, reply) => {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
const i_id = await generatequatationId();
|
|
|
|
const i_id = await generatequatationId();
|
|
|
|
const quatationId = `AWQU${i_id}`;
|
|
|
|
const quatationId = `AWQU${i_id}`;
|
|
|
|
const { installationId } = req.params;
|
|
|
|
const { surveyId } = req.params;
|
|
|
|
const { customerId, masters, slaves, sensors, motor_switches, electricals } = req.body;
|
|
|
|
const { customerId, masters, slaves, sensors, motor_switches, electricals } = req.body;
|
|
|
|
|
|
|
|
|
|
|
|
// Format electricals field
|
|
|
|
// Format electricals field
|
|
|
|
@ -1518,8 +1541,8 @@ exports.createquotationforSensor = async (req, reply) => {
|
|
|
|
const newQuotation = new SensorQuotation({
|
|
|
|
const newQuotation = new SensorQuotation({
|
|
|
|
quatationId,
|
|
|
|
quatationId,
|
|
|
|
customerId,
|
|
|
|
customerId,
|
|
|
|
installationId,
|
|
|
|
surveyId,
|
|
|
|
quote_status: "sentfrominstaller",
|
|
|
|
quote_status: "sentfromsurvey",
|
|
|
|
masters,
|
|
|
|
masters,
|
|
|
|
slaves,
|
|
|
|
slaves,
|
|
|
|
sensors,
|
|
|
|
sensors,
|
|
|
|
|