明树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
e018818f
Commit
e018818f
authored
Mar 18, 2025
by
zfp1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
fe79b0c2
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
162 additions
and
1 deletion
+162
-1
techProcessController.js
controller/techProcessController.js
+77
-0
index.js
db/index.js
+2
-0
letianTechProcess.js
db/models/letianTechProcess.js
+65
-0
index.js
router/index.js
+4
-1
techProRouter.js
router/techProRouter.js
+14
-0
No files found.
controller/techProcessController.js
0 → 100644
View file @
e018818f
const
ExcelJS
=
require
(
'exceljs'
);
const
_
=
require
(
'lodash'
);
const
fs
=
require
(
'fs'
);
async
function
list
(
req
,
res
,
next
)
{
try
{
let
search
=
{
del
:
0
};
let
page
=
req
.
body
.
page
||
1
;
let
pageSize
=
req
.
body
.
pageSize
||
10
;
let
skip
=
(
page
-
1
)
*
pageSize
;
if
(
req
.
body
.
name
)
{
search
.
name
=
req
.
body
.
name
;
}
let
count
=
await
DB
.
TechProcess
.
countDocuments
(
search
)
let
list
=
await
DB
.
TechProcess
.
find
(
search
).
skip
(
skip
).
limit
(
pageSize
).
sort
({
_id
:
-
1
}).
lean
().
exec
();
res
.
sendData
({
count
,
list
});
}
catch
(
error
)
{
next
(
error
)
}
}
async
function
create
(
req
,
res
,
next
)
{
try
{
let
ret
=
await
DB
.
TechProcess
.
create
(
req
.
body
)
res
.
sendData
(
ret
);
}
catch
(
error
)
{
next
(
error
)
}
}
async
function
updateOne
(
req
,
res
,
next
)
{
try
{
let
updateInfo
=
{
...
req
.
body
,
}
let
ret
=
await
DB
.
TechProcess
.
findOneAndUpdate
({
_id
:
req
.
body
.
_id
},
updateInfo
);
res
.
sendData
(
ret
);
}
catch
(
error
)
{
next
(
error
)
}
}
async
function
deleteOne
(
req
,
res
,
next
)
{
try
{
let
ret
=
await
DB
.
TechProcess
.
findOneAndUpdate
({
_id
:
req
.
body
.
_id
},
{
del
:
1
});
res
.
sendData
(
ret
);
}
catch
(
error
)
{
next
(
error
)
}
}
module
.
exports
=
{
list
,
create
,
deleteOne
,
updateOne
,
}
\ No newline at end of file
db/index.js
View file @
e018818f
...
...
@@ -85,6 +85,7 @@ const PackMatOutList = require("./models/letianPackMatOutList");
//营养成分表
const
SuppFact
=
require
(
"./models/letianSuppFact"
);
const
TechProcess
=
require
(
"./models/letianTechProcess"
);
global
.
DB
=
{
...
...
@@ -141,6 +142,7 @@ global.DB = {
PackMatOutList
,
SuppFact
,
TechProcess
,
}
...
...
db/models/letianTechProcess.js
0 → 100644
View file @
e018818f
const
mongoose
=
require
(
'mongoose'
);
const
Schema
=
mongoose
.
Schema
;
const
moment
=
require
(
'moment'
);
/**
* //工艺流程表 不做树结构
*/
const
letianTechProcessSchema
=
new
Schema
({
proType
:
{
type
:
String
,
comment
:
"加工类型"
,
},
proClassification
:
{
type
:
String
,
comment
:
"流程分类(非必填)"
,
},
nodeName
:
{
type
:
String
,
comment
:
"流程节点名称"
,
},
subProcess
:
[
{
nodeName
:
String
,
}
]
,
corMonitEqui
:
{
type
:
mongoose
.
Types
.
ObjectId
,
ref
:
'collectDevice'
,
comment
:
"对应监控设备(非必填)"
,
},
sort
:
Number
,
creator
:
{
type
:
mongoose
.
Types
.
ObjectId
,
ref
:
'User'
,
comment1
:
"创建人"
},
createdAt
:
{
type
:
Date
,
default
:
Date
.
now
,
get
:
v
=>
moment
(
v
).
format
(
"YYYY-MM-DD HH:mm:ss"
),
},
updatedAt
:
{
type
:
Date
,
default
:
Date
.
now
,
get
:
v
=>
moment
(
v
).
format
(
"YYYY-MM-DD HH:mm:ss"
),
},
del
:
{
type
:
Number
,
default
:
0
,
comment1
:
'默认0 , 1:表示删除, 若有其他隐藏业务 不要混用此字段。'
}
},
{
toJSON
:
{
getters
:
true
}
});
const
TechProcess
=
mongoose
.
model
(
'TechProcess'
,
letianTechProcessSchema
,
'letianTechProcess'
);
module
.
exports
=
TechProcess
;
\ No newline at end of file
router/index.js
View file @
e018818f
...
...
@@ -25,6 +25,7 @@ const heavyMetalRouter = require('./externalRouter');
const
compInfoRouter
=
require
(
'./compInfoRouter'
);
const
rawmatRouter
=
require
(
'./rawmatRouter'
);
const
nutrRouter
=
require
(
'./nutrRouter'
);
const
techProRouter
=
require
(
'./techProRouter'
);
router
.
use
(
'/user'
,
userRouter
);
// 用户 角色
...
...
@@ -58,7 +59,9 @@ router.use('/company', compInfoRouter);//公司信息
router
.
use
(
'/mat'
,
rawmatRouter
);
//原材料 包材
router
.
use
(
'/nutrients'
,
nutrRouter
);
router
.
use
(
'/nutrients'
,
nutrRouter
);
//营养成分
router
.
use
(
'/tech'
,
techProRouter
);
...
...
router/techProRouter.js
0 → 100644
View file @
e018818f
const
express
=
require
(
'express'
);
const
router
=
express
.
Router
();
const
techProcessController
=
require
(
'../controller/techProcessController'
);
router
.
post
(
'/suppFact/create'
,
techProcessController
.
create
);
router
.
post
(
'/suppFact/update'
,
techProcessController
.
updateOne
);
router
.
post
(
'/suppFact/delete'
,
techProcessController
.
deleteOne
);
router
.
post
(
'/suppFact/list'
,
techProcessController
.
list
);
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