明树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
de023961
Commit
de023961
authored
Sep 22, 2024
by
zengfanpei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
39b6fbbc
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
10 deletions
+10
-10
agrMatController.js
controller/agrMatController.js
+5
-5
letianAgrMatApproval.js
db/models/letianAgrMatApproval.js
+2
-2
letianAgrMatType.js
db/models/letianAgrMatType.js
+3
-3
No files found.
controller/agrMatController.js
View file @
de023961
...
@@ -80,8 +80,8 @@ async function queryMatApprList(req, res, next) {
...
@@ -80,8 +80,8 @@ async function queryMatApprList(req, res, next) {
let
page
=
req
.
body
.
page
||
1
;
let
page
=
req
.
body
.
page
||
1
;
let
pageSize
=
req
.
body
.
pageSize
||
10
;
let
pageSize
=
req
.
body
.
pageSize
||
10
;
let
skip
=
(
page
-
1
)
*
pageSize
;
let
skip
=
(
page
-
1
)
*
pageSize
;
let
count
=
await
DB
.
AgrMat
erial
Approval
.
countDocuments
(
search
)
let
count
=
await
DB
.
AgrMatApproval
.
countDocuments
(
search
)
let
list
=
await
DB
.
AgrMat
erial
Approval
.
find
(
search
).
skip
(
skip
).
limit
(
pageSize
).
lean
().
exec
();
let
list
=
await
DB
.
AgrMatApproval
.
find
(
search
).
skip
(
skip
).
limit
(
pageSize
).
lean
().
exec
();
res
.
sendData
({
count
,
list
});
res
.
sendData
({
count
,
list
});
}
catch
(
error
)
{
}
catch
(
error
)
{
next
(
error
)
next
(
error
)
...
@@ -115,7 +115,7 @@ async function saveMatAppr(req, res, next) {
...
@@ -115,7 +115,7 @@ async function saveMatAppr(req, res, next) {
if
(
matInOutList
.
length
>
0
)
{
if
(
matInOutList
.
length
>
0
)
{
await
DB
.
AgrMatInOut
.
insertMany
(
matInOutList
);
// 插入清单
await
DB
.
AgrMatInOut
.
insertMany
(
matInOutList
);
// 插入清单
}
}
let
matApr
=
await
DB
.
AgrMat
erial
Approval
.
create
({
// 创建单据
let
matApr
=
await
DB
.
AgrMatApproval
.
create
({
// 创建单据
_id
:
matAprId
,
_id
:
matAprId
,
type
:
type
,
type
:
type
,
materials
:
matIds
,
materials
:
matIds
,
...
@@ -123,7 +123,7 @@ async function saveMatAppr(req, res, next) {
...
@@ -123,7 +123,7 @@ async function saveMatAppr(req, res, next) {
return
res
.
sendData
(
matApr
);
return
res
.
sendData
(
matApr
);
}
else
{
}
else
{
// 更新
// 更新
let
existsMatApr
=
await
DB
.
AgrMat
erial
Approval
.
findOne
({
_id
:
req
.
body
.
_id
});
let
existsMatApr
=
await
DB
.
AgrMatApproval
.
findOne
({
_id
:
req
.
body
.
_id
});
if
(
!
existsMatApr
)
{
if
(
!
existsMatApr
)
{
return
res
.
sendError
(
errorMessage
.
resourceNotFound
);
return
res
.
sendError
(
errorMessage
.
resourceNotFound
);
}
}
...
@@ -152,7 +152,7 @@ async function saveMatAppr(req, res, next) {
...
@@ -152,7 +152,7 @@ async function saveMatAppr(req, res, next) {
if
(
matInOutList
.
length
>
0
)
{
if
(
matInOutList
.
length
>
0
)
{
await
Promise
.
all
(
matInOutList
);
await
Promise
.
all
(
matInOutList
);
}
}
let
matApr
=
await
DB
.
AgrMat
erial
Approval
.
findOneAndUpdate
({
_id
},{
let
matApr
=
await
DB
.
AgrMatApproval
.
findOneAndUpdate
({
_id
},{
type
:
type
,
type
:
type
,
materials
:
matIds
,
materials
:
matIds
,
});
});
...
...
db/models/letianAgrMatApproval.js
View file @
de023961
...
@@ -76,5 +76,5 @@ function setNameToApproval(v) {
...
@@ -76,5 +76,5 @@ function setNameToApproval(v) {
}
}
const
AgrMaterialApproval
=
mongoose
.
model
(
'AgrMaterialApproval'
,
AgrMaterialApprovalSchema
,
'letianAgrMaterialApproval'
);
const
AgrMatApproval
=
mongoose
.
model
(
'AgrMatApproval'
,
AgrMaterialApprovalSchema
,
'letianAgrMaterialApproval'
);
module
.
exports
=
AgrMaterialApproval
;
module
.
exports
=
AgrMatApproval
;
\ No newline at end of file
\ No newline at end of file
db/models/letianAgrMatType.js
View file @
de023961
...
@@ -5,7 +5,7 @@ const moment = require('moment');
...
@@ -5,7 +5,7 @@ const moment = require('moment');
/**
/**
* 农资管理-农资类型
* 农资管理-农资类型
*/
*/
const
AgrMaterialSchema
=
new
Schema
({
const
AgrMaterial
Type
Schema
=
new
Schema
({
name
:
{
name
:
{
type
:
String
,
type
:
String
,
...
@@ -41,5 +41,5 @@ const AgrMaterialSchema = new Schema({
...
@@ -41,5 +41,5 @@ const AgrMaterialSchema = new Schema({
});
});
const
AgrMaterial
=
mongoose
.
model
(
'AgrMaterial'
,
AgrMaterialSchema
,
'letianAgrMaterial'
);
const
AgrMatType
=
mongoose
.
model
(
'AgrMatType'
,
AgrMaterialTypeSchema
,
'letianAgrMaterialType'
);
module
.
exports
=
AgrMaterial
;
module
.
exports
=
AgrMatType
;
\ No newline at end of file
\ 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