明树Git Lab
Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
L
letian_backend
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zengfanpei
letian_backend
Commits
b8cae0ca
Commit
b8cae0ca
authored
May 16, 2025
by
zfp1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
9377401a
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
70 additions
and
5 deletions
+70
-5
productTracController.js
controller/productTracController.js
+18
-3
letianProductDeep.js
db/models/letianProductDeep.js
+16
-0
letianProductPlant.js
db/models/letianProductPlant.js
+16
-1
letianProductPre.js
db/models/letianProductPre.js
+17
-1
plantRouter.js
router/plantRouter.js
+3
-0
No files found.
controller/productTracController.js
View file @
b8cae0ca
...
...
@@ -195,11 +195,11 @@ async function getJiankong(req, res, next) {
console
.
log
(
sourceId
,
"==="
)
let
source
=
null
;
if
(
traccode
.
type
&&
traccode
.
type
==
1
)
{
source
=
await
DB
.
ProductPlant
.
findOne
({
_id
:
sourceId
},
{
monitorInfo
:
1
}).
populate
({
path
:
"monitorInfo
.device"
}).
lean
();
source
=
await
DB
.
ProductPlant
.
findOne
({
_id
:
sourceId
},
{
monitorInfo
:
1
,
monitorInfoForInt
:
1
}).
populate
({
path
:
"monitorInfo.device"
}).
populate
({
path
:
"monitorInfoForInt
.device"
}).
lean
();
}
else
if
(
traccode
.
type
&&
traccode
.
type
==
2
)
{
source
=
await
DB
.
ProductPre
.
findOne
({
_id
:
sourceId
},
{
monitorInfo
:
1
}).
populate
({
path
:
"monitorInfo
.device"
}).
lean
();
source
=
await
DB
.
ProductPre
.
findOne
({
_id
:
sourceId
},
{
monitorInfo
:
1
,
monitorInfoForInt
:
1
}).
populate
({
path
:
"monitorInfo.device"
}).
populate
({
path
:
"monitorInfoForInt
.device"
}).
lean
();
}
else
if
(
traccode
.
type
&&
traccode
.
type
==
3
)
{
source
=
await
DB
.
ProductDeep
.
findOne
({
_id
:
sourceId
},
{
monitorInfo
:
1
}).
populate
({
path
:
"monitorInfo
.device"
}).
lean
();
source
=
await
DB
.
ProductDeep
.
findOne
({
_id
:
sourceId
},
{
monitorInfo
:
1
,
monitorInfoForInt
:
1
}).
populate
({
path
:
"monitorInfo.device"
}).
populate
({
path
:
"monitorInfoForInt
.device"
}).
lean
();
}
//查询一下土壤采集数据
...
...
@@ -246,6 +246,20 @@ async function getZhijian(req, res, next) {
next
(
error
);
}
}
async
function
batchAgrEnvOnOff
(
req
,
res
,
next
)
{
try
{
let
ids
=
req
.
body
.
_ids
;
if
(
_
.
isBoolean
(
req
.
body
.
agrOnOff
))
{
await
DB
.
ProTraceCode
.
updateMany
({
_id
:
{
$in
:
ids
}},
{
agrOnOff
:
req
.
body
.
agrOnOff
});
}
if
(
_
.
isBoolean
(
req
.
body
.
indEnvOnOff
))
{
await
DB
.
ProTraceCode
.
updateMany
({
_id
:
{
$in
:
ids
}},
{
indEnvOnOff
:
req
.
body
.
indEnvOnOff
});
}
res
.
sendData
();
}
catch
(
error
)
{
next
(
error
);
}
}
...
...
@@ -259,4 +273,5 @@ module.exports = {
getsuyuanBase
,
getJiankong
,
getZhijian
,
batchAgrEnvOnOff
,
}
\ No newline at end of file
db/models/letianProductDeep.js
View file @
b8cae0ca
...
...
@@ -102,6 +102,22 @@ const letianProductDeepSchema = new Schema({
}
]
},
monitorInfoForInt
:
{
//工业
type
:
[
{
name
:
String
,
// deviceSectorType: {
// type: Number,
// comment: "1, 农业 2 工业"
// },
device
:
{
type
:
mongoose
.
Types
.
ObjectId
,
ref
:
'collectDevice'
,
comment
:
"设备"
}
}
]
},
productSpec
:
{
type
:
String
,
comment
:
"产品规格"
...
...
db/models/letianProductPlant.js
View file @
b8cae0ca
...
...
@@ -96,7 +96,22 @@ const letianProductPlantSchema = new Schema({
}
]
},
monitorInfoForInt
:
{
//工业
type
:
[
{
name
:
String
,
// deviceSectorType: {
// type: Number,
// comment: "1, 农业 2 工业"
// },
device
:
{
type
:
mongoose
.
Types
.
ObjectId
,
ref
:
'collectDevice'
,
comment
:
"设备"
}
}
]
},
//原料信息
agrProVar
:
{
type
:
String
,
...
...
db/models/letianProductPre.js
View file @
b8cae0ca
...
...
@@ -86,7 +86,7 @@ const letianProductPreSchema = new Schema({
comment
:
"农残质检报告"
}
],
monitorInfo
:
{
monitorInfo
:
{
//农业
type
:
[
{
name
:
String
,
...
...
@@ -102,6 +102,22 @@ const letianProductPreSchema = new Schema({
}
]
},
monitorInfoForInt
:
{
//工业
type
:
[
{
name
:
String
,
// deviceSectorType: {
// type: Number,
// comment: "1, 农业 2 工业"
// },
device
:
{
type
:
mongoose
.
Types
.
ObjectId
,
ref
:
'collectDevice'
,
comment
:
"设备"
}
}
]
},
//原料信息
agrProVar
:
{
...
...
router/plantRouter.js
View file @
b8cae0ca
...
...
@@ -50,5 +50,8 @@ router.post('/product/trace/info2', productTracController.getTraceCode2); //溯
router
.
post
(
'/product/trace/suyuan'
,
productTracController
.
getsuyuanBase
);
// 溯源信息
router
.
post
(
'/product/trace/jiankong'
,
productTracController
.
getJiankong
);
// 实时监控
router
.
post
(
'/product/trace/zhijian'
,
productTracController
.
getZhijian
);
// 质量检测报告
router
.
post
(
'/product/trace/onoff'
,
productTracController
.
batchAgrEnvOnOff
);
// 质量检测报告
module
.
exports
=
router
;
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment