明树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
64602711
Commit
64602711
authored
Mar 11, 2025
by
zfp1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
bd340c96
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
120 additions
and
29 deletions
+120
-29
productDeepController.js
controller/productDeepController.js
+2
-1
productDirPlantController.js
controller/productDirPlantController.js
+2
-1
productPreController.js
controller/productPreController.js
+2
-1
productTracController.js
controller/productTracController.js
+3
-3
letianProTraceCode.js
db/models/letianProTraceCode.js
+0
-23
letianProductDeep.js
db/models/letianProductDeep.js
+37
-0
letianProductPlant.js
db/models/letianProductPlant.js
+37
-0
letianProductPre.js
db/models/letianProductPre.js
+37
-0
No files found.
controller/productDeepController.js
View file @
64602711
...
...
@@ -6,6 +6,7 @@ async function createDeepPlant(req, res, next) {
let
count
=
await
DB
.
ProductDeep
.
countDocuments
();
//没有真实删除 永远递增
body
.
productNumber
=
count
;
body
.
qualityInsReportImgs
=
(
body
.
qualityInsReportImgs
||
[]).
map
(
o
=>
{
return
o
&&
o
.
_id
||
o
});
body
.
flourMerchantImgs
=
(
body
.
flourMerchantImgs
||
[]).
map
(
o
=>
{
return
o
&&
o
.
_id
||
o
});
let
ret
=
await
DB
.
ProductDeep
.
create
(
body
);
res
.
sendData
(
ret
);
}
catch
(
error
)
{
...
...
@@ -22,7 +23,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"
}).
populate
({
path
:
"monitorInfo.device"
}).
sort
({
_id
:
-
1
}).
skip
(
skip
).
limit
(
pageSize
).
lean
().
exec
();
let
list
=
await
DB
.
ProductDeep
.
find
(
search
).
populate
({
path
:
"productPhotos"
}).
populate
({
path
:
"sourcePlantProduct"
}).
populate
({
path
:
"qualityInsReportImgs"
}).
populate
({
path
:
"
flourMerchantImgs"
}).
populate
({
path
:
"
monitorInfo.device"
}).
sort
({
_id
:
-
1
}).
skip
(
skip
).
limit
(
pageSize
).
lean
().
exec
();
res
.
sendData
({
count
,
list
});
}
catch
(
error
)
{
next
(
error
);
...
...
controller/productDirPlantController.js
View file @
64602711
...
...
@@ -6,6 +6,7 @@ async function createDirectPlant(req, res, next) {
let
count
=
await
DB
.
ProductPlant
.
countDocuments
();
//没有真实删除 永远递增
body
.
productNumber
=
count
;
body
.
qualityInsReportImgs
=
(
body
.
qualityInsReportImgs
||
[]).
map
(
o
=>
{
return
o
&&
o
.
_id
||
o
});
body
.
flourMerchantImgs
=
(
body
.
flourMerchantImgs
||
[]).
map
(
o
=>
{
return
o
&&
o
.
_id
||
o
});
let
ret
=
await
DB
.
ProductPlant
.
create
(
body
);
res
.
sendData
(
ret
);
}
catch
(
error
)
{
...
...
@@ -23,7 +24,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"
}).
populate
({
path
:
"monitorInfo.device"
}).
sort
({
_id
:
-
1
}).
skip
(
skip
).
limit
(
pageSize
).
lean
().
exec
();
let
list
=
await
DB
.
ProductPlant
.
find
(
search
).
populate
({
path
:
"productPhotos"
}).
populate
({
path
:
"plantPlan"
}).
populate
({
path
:
"qualityInsReportImgs"
}).
populate
({
path
:
"
flourMerchantImgs"
}).
populate
({
path
:
"
monitorInfo.device"
}).
sort
({
_id
:
-
1
}).
skip
(
skip
).
limit
(
pageSize
).
lean
().
exec
();
res
.
sendData
({
count
,
list
});
}
catch
(
error
)
{
next
(
error
);
...
...
controller/productPreController.js
View file @
64602711
...
...
@@ -7,6 +7,7 @@ async function createPrePlant(req, res, next) {
let
count
=
await
DB
.
ProductPre
.
countDocuments
();
//没有真实删除 永远递增
body
.
productNumber
=
count
;
body
.
qualityInsReportImgs
=
(
body
.
qualityInsReportImgs
||
[]).
map
(
o
=>
{
return
o
&&
o
.
_id
||
o
});
body
.
flourMerchantImgs
=
(
body
.
flourMerchantImgs
||
[]).
map
(
o
=>
{
return
o
&&
o
.
_id
||
o
});
let
ret
=
await
DB
.
ProductPre
.
create
(
body
);
res
.
sendData
(
ret
);
}
catch
(
error
)
{
...
...
@@ -23,7 +24,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"
}).
populate
({
path
:
"monitorInfo.device"
}).
sort
({
_id
:
-
1
}).
skip
(
skip
).
limit
(
pageSize
).
lean
().
exec
();
let
list
=
await
DB
.
ProductPre
.
find
(
search
).
populate
({
path
:
"productPhotos"
}).
populate
({
path
:
"sourcePlantProduct"
}).
populate
({
path
:
"qualityInsReportImgs"
}).
populate
({
path
:
"
flourMerchantImgs"
}).
populate
({
path
:
"
monitorInfo.device"
}).
sort
({
_id
:
-
1
}).
skip
(
skip
).
limit
(
pageSize
).
lean
().
exec
();
res
.
sendData
({
count
,
list
});
}
catch
(
error
)
{
next
(
error
);
...
...
controller/productTracController.js
View file @
64602711
...
...
@@ -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"
}).
populate
({
path
:
"monitorInfo.device"
}).
lean
().
exec
();
source
=
await
DB
.
ProductPlant
.
findOne
({
_id
:
sourceId
}).
populate
({
path
:
"productPhotos"
}).
populate
({
path
:
"plantPlan"
}).
populate
({
path
:
"qualityInsReportImgs"
}).
populate
({
path
:
"
flourMerchantImgs"
}).
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,9 +90,9 @@ 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"
}).
populate
({
path
:
"monitorInfo.device"
}).
lean
().
exec
();
source
=
await
DB
.
ProductPre
.
findOne
({
_id
:
sourceId
}).
populate
({
path
:
"productPhotos"
}).
populate
({
path
:
"qualityInsReportImgs"
}).
populate
({
path
:
"
flourMerchantImgs"
}).
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"
}).
populate
({
path
:
"monitorInfo.device"
}).
lean
().
exec
();
source
=
await
DB
.
ProductDeep
.
findOne
({
_id
:
sourceId
}).
populate
({
path
:
"productPhotos"
}).
populate
({
path
:
"qualityInsReportImgs"
}).
populate
({
path
:
"
flourMerchantImgs"
}).
populate
({
path
:
"
monitorInfo.device"
}).
lean
().
exec
();
}
console
.
log
(
source
,
"=="
)
...
...
db/models/letianProTraceCode.js
View file @
64602711
...
...
@@ -23,29 +23,6 @@ const letianProTraceCodeSchema = new Schema({
get
:
v
=>
moment
(
v
).
format
(
"YYYY-MM-DD"
),
comment
:
"产品出库日期"
},
agrProVar
:
{
type
:
String
,
comment
:
"农产品品种"
},
agrPlantBase
:
{
type
:
String
,
comment
:
"农产品种植基地"
},
harvestDate
:
{
type
:
Date
,
default
:
Date
.
now
,
get
:
v
=>
moment
(
v
).
format
(
"YYYY-MM-DD"
),
comment
:
"采收时间"
},
flourMerchant
:
{
type
:
String
,
comment
:
"面粉商"
},
batchNumber
:
{
type
:
String
,
comment
:
"批次号"
},
brand
:
String
,
//品牌
manufactureDate
:
{
type
:
Date
,
default
:
Date
.
now
,
...
...
db/models/letianProductDeep.js
View file @
64602711
...
...
@@ -75,6 +75,43 @@ const letianProductDeepSchema = new Schema({
]
},
//原料信息
agrProVar
:
{
type
:
String
,
comment
:
"农产品品种"
},
agrPlantBase
:
{
type
:
String
,
comment
:
"农产品种植基地"
},
harvestDate
:
{
type
:
Date
,
default
:
Date
.
now
,
get
:
v
=>
moment
(
v
).
format
(
"YYYY-MM-DD"
),
comment
:
"采收时间"
},
flourMerchant
:
{
type
:
String
,
comment
:
"面粉商"
},
batchNumber
:
{
type
:
String
,
comment
:
"批次号"
},
manufactureDate
:
{
type
:
Date
,
default
:
Date
.
now
,
get
:
v
=>
moment
(
v
).
format
(
"YYYY-MM-DD"
),
comment
:
"生产日期"
},
flourMerchantImgs
:
[
{
type
:
mongoose
.
Types
.
ObjectId
,
ref
:
'File'
,
comment
:
"面粉商原料检测报告图"
}
],
createdAt
:
{
type
:
Date
,
default
:
Date
.
now
,
...
...
db/models/letianProductPlant.js
View file @
64602711
...
...
@@ -69,6 +69,43 @@ const letianProductPlantSchema = new Schema({
]
},
//原料信息
agrProVar
:
{
type
:
String
,
comment
:
"农产品品种"
},
agrPlantBase
:
{
type
:
String
,
comment
:
"农产品种植基地"
},
harvestDate
:
{
type
:
Date
,
default
:
Date
.
now
,
get
:
v
=>
moment
(
v
).
format
(
"YYYY-MM-DD"
),
comment
:
"采收时间"
},
flourMerchant
:
{
type
:
String
,
comment
:
"面粉商"
},
batchNumber
:
{
type
:
String
,
comment
:
"批次号"
},
manufactureDate
:
{
type
:
Date
,
default
:
Date
.
now
,
get
:
v
=>
moment
(
v
).
format
(
"YYYY-MM-DD"
),
comment
:
"生产日期"
},
flourMerchantImgs
:
[
{
type
:
mongoose
.
Types
.
ObjectId
,
ref
:
'File'
,
comment
:
"面粉商原料检测报告图"
}
],
createdAt
:
{
type
:
Date
,
default
:
Date
.
now
,
...
...
db/models/letianProductPre.js
View file @
64602711
...
...
@@ -76,6 +76,43 @@ const letianProductPreSchema = new Schema({
]
},
//原料信息
agrProVar
:
{
type
:
String
,
comment
:
"农产品品种"
},
agrPlantBase
:
{
type
:
String
,
comment
:
"农产品种植基地"
},
harvestDate
:
{
type
:
Date
,
default
:
Date
.
now
,
get
:
v
=>
moment
(
v
).
format
(
"YYYY-MM-DD"
),
comment
:
"采收时间"
},
flourMerchant
:
{
type
:
String
,
comment
:
"面粉商"
},
batchNumber
:
{
type
:
String
,
comment
:
"批次号"
},
manufactureDate
:
{
type
:
Date
,
default
:
Date
.
now
,
get
:
v
=>
moment
(
v
).
format
(
"YYYY-MM-DD"
),
comment
:
"生产日期"
},
flourMerchantImgs
:
[
{
type
:
mongoose
.
Types
.
ObjectId
,
ref
:
'File'
,
comment
:
"面粉商原料检测报告图"
}
],
createdAt
:
{
type
:
Date
,
default
:
Date
.
now
,
...
...
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