明树Git Lab

Commit 9206edf6 authored by zfp1's avatar zfp1

update

parent 47a41c6d
......@@ -22,7 +22,7 @@ async function listDeepPlant(req, res, next) {
search.preProductName = {$regex: req.body.name}
}
const count = await DB.ProductDeep.countDocuments(search);
let list = await DB.ProductDeep.find(search).populate({path: "productPhotos"}).populate({path: "sourcePlantProduct"}).populate({path: "qualityInsReportImgs"}).sort({_id: -1}).skip(skip).limit(pageSize);
let list = await DB.ProductDeep.find(search).populate({path: "productPhotos"}).populate({path: "sourcePlantProduct"}).populate({path: "qualityInsReportImgs"}).populate({path: "monitorInfo.device"}).sort({_id: -1}).skip(skip).limit(pageSize).lean().exec();
res.sendData({ count, list });
} catch (error) {
next(error);
......
......@@ -23,7 +23,7 @@ async function listDirectPlant(req, res, next) {
}
const count = await DB.ProductPlant.countDocuments(search);
let list = await DB.ProductPlant.find(search).populate({path: "productPhotos"}).populate({path: "plantPlan"}).populate({path: "qualityInsReportImgs"}).sort({_id: -1}).skip(skip).limit(pageSize);
let list = await DB.ProductPlant.find(search).populate({path: "productPhotos"}).populate({path: "plantPlan"}).populate({path: "qualityInsReportImgs"}).populate({path: "monitorInfo.device"}).sort({_id: -1}).skip(skip).limit(pageSize).lean().exec();
res.sendData({ count, list });
} catch (error) {
next(error);
......
......@@ -23,7 +23,7 @@ async function listPrePlant(req, res, next) {
search.preProductName = {$regex: req.body.name}
}
const count = await DB.ProductPre.countDocuments(search);
let list = await DB.ProductPre.find(search).populate({path: "productPhotos"}).populate({path: "sourcePlantProduct"}).populate({path: "qualityInsReportImgs"}).sort({_id: -1}).skip(skip).limit(pageSize);
let list = await DB.ProductPre.find(search).populate({path: "productPhotos"}).populate({path: "sourcePlantProduct"}).populate({path: "qualityInsReportImgs"}).populate({path: "monitorInfo.device"}).sort({_id: -1}).skip(skip).limit(pageSize).lean().exec();
res.sendData({ count, list });
} catch (error) {
next(error);
......
......@@ -82,7 +82,7 @@ async function getTraceCode(req, res, next) {
let sourceId = traccode.source;
let source = null;
if(traccode.type && traccode.type == 1) {
source = await DB.ProductPlant.findOne({_id: sourceId}).populate({path: "productPhotos"}).populate({path: "plantPlan"}).populate({path: "qualityInsReportImgs"}).lean();
source = await DB.ProductPlant.findOne({_id: sourceId}).populate({path: "productPhotos"}).populate({path: "plantPlan"}).populate({path: "qualityInsReportImgs"}).populate({path: "monitorInfo.device"}).lean().exec();
if(source && source.plantPlan && source.plantPlan.land) {
let devices = await DB.Device.find({land: {$in: source.plantPlan.land}, deviceHQType: 5}).lean();
source.devices = devices;
......@@ -90,15 +90,15 @@ async function getTraceCode(req, res, next) {
source.devices = [];
}
} else if(traccode.type && traccode.type == 2) {
source = await DB.ProductPre.findOne({_id: sourceId}).populate({path: "productPhotos"}).populate({path: "qualityInsReportImgs"}).lean();
source = await DB.ProductPre.findOne({_id: sourceId}).populate({path: "productPhotos"}).populate({path: "qualityInsReportImgs"}).populate({path: "monitorInfo.device"}).lean().exec();
} else if(traccode.type && traccode.type == 3) {
source = await DB.ProductDeep.findOne({_id: sourceId}).populate({path: "productPhotos"}).populate({path: "qualityInsReportImgs"}).lean();
source = await DB.ProductDeep.findOne({_id: sourceId}).populate({path: "productPhotos"}).populate({path: "qualityInsReportImgs"}).populate({path: "monitorInfo.device"}).lean().exec();
}
console.log(source, "==")
traccode.source = source;
//请求公司信息
let companyInfo = await DB.CompanyInfo.findOne({});
let companyInfo = await DB.CompanyInfo.findOne({}).lean().exec();
traccode.companyInfo = companyInfo || {};
res.sendData(traccode);
} catch (error) {
......
......@@ -58,6 +58,22 @@ const letianProductDeepSchema = new Schema({
comment: "质检报告图"
}
],
monitorInfo: {
type: [
{
name: String,
deviceSectorType: {
type: Number,
comment: "1, 农业 2 工业"
},
device: {
type: mongoose.Types.ObjectId,
ref: 'Device',
comment: "设备"
}
}
]
},
createdAt: {
type: Date,
......
......@@ -52,6 +52,22 @@ const letianProductPlantSchema = new Schema({
comment: "质检报告图"
}
],
monitorInfo: {
type: [
{
name: String,
deviceSectorType: {
type: Number,
comment: "1, 农业 2 工业"
},
device: {
type: mongoose.Types.ObjectId,
ref: 'Device',
comment: "设备"
}
}
]
},
createdAt: {
type: Date,
......
......@@ -59,6 +59,22 @@ const letianProductPreSchema = new Schema({
comment: "质检报告图"
}
],
monitorInfo: {
type: [
{
name: String,
deviceSectorType: {
type: Number,
comment: "1, 农业 2 工业"
},
device: {
type: mongoose.Types.ObjectId,
ref: 'Device',
comment: "设备"
}
}
]
},
createdAt: {
type: Date,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment