明树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
5c0dbc31
Commit
5c0dbc31
authored
Mar 13, 2025
by
zfp1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add: 原材料、包装材料纪录
parent
64a4e296
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
994 additions
and
0 deletions
+994
-0
packMatInListController.js
controller/packMatInListController.js
+148
-0
packMatOutListController.js
controller/packMatOutListController.js
+154
-0
rawMatProlistController.js
controller/rawMatProlistController.js
+150
-0
rawMatReqlistController.js
controller/rawMatReqlistController.js
+149
-0
index.js
db/index.js
+11
-0
letianPackMatInList.js
db/models/letianPackMatInList.js
+78
-0
letianPackMatOutList.js
db/models/letianPackMatOutList.js
+87
-0
letianRawMatProList.js
db/models/letianRawMatProList.js
+78
-0
letianRawMatReqList.js
db/models/letianRawMatReqList.js
+87
-0
fileRouter.js
router/fileRouter.js
+8
-0
index.js
router/index.js
+3
-0
rawmatRouter.js
router/rawmatRouter.js
+41
-0
No files found.
controller/packMatInListController.js
0 → 100644
View file @
5c0dbc31
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
.
agrProName
=
{
$regex
:
req
.
body
.
name
};
}
if
(
req
.
body
.
startTime
)
{
search
.
indate
=
search
.
indate
||
{};
search
.
indate
.
$gte
=
req
.
body
.
startTime
;
}
if
(
req
.
body
.
endTime
)
{
search
.
indate
=
search
.
indate
||
{};
search
.
indate
.
$lte
=
req
.
body
.
endTime
}
let
count
=
await
DB
.
PackMatInList
.
countDocuments
(
search
)
let
list
=
await
DB
.
PackMatInList
.
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
.
PackMatInList
.
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
.
PackMatInList
.
findOneAndUpdate
({
_id
:
req
.
body
.
_id
},
updateInfo
);
res
.
sendData
(
ret
);
}
catch
(
error
)
{
next
(
error
)
}
}
async
function
deleteOne
(
req
,
res
,
next
)
{
try
{
let
ret
=
await
DB
.
PackMatInList
.
findOneAndUpdate
({
_id
:
req
.
body
.
_id
},
{
del
:
1
});
res
.
sendData
(
ret
);
}
catch
(
error
)
{
next
(
error
)
}
}
async
function
importExcel
(
req
,
res
,
next
)
{
try
{
let
workbook
=
new
ExcelJS
.
Workbook
();
await
workbook
.
xlsx
.
readFile
(
req
.
file
.
path
);
let
worksheet
=
workbook
.
getWorksheet
(
1
);
let
arr
=
[];
for
(
let
index
=
2
;
index
<=
worksheet
.
actualRowCount
;
index
++
)
{
let
values
=
worksheet
.
getRow
(
index
).
values
;
let
obj
=
{
creator
:
req
.
user
.
_id
,
serialNumber
:
values
[
1
],
name
:
values
[
2
],
spec
:
values
[
3
],
unit
:
values
[
4
],
indate
:
values
[
5
],
inNum
:
Number
(
values
[
6
])
||
0
,
}
if
(
typeof
obj
.
indate
==
'number'
)
{
obj
.
indate
=
new
Date
(
1900
,
0
,
obj
.
indate
-
1
,
0
,
0
,
0
);
}
arr
.
push
(
obj
)
}
if
(
arr
.
length
)
{
await
DB
.
PackMatInList
.
insertMany
(
arr
);
}
res
.
sendData
(
arr
);
}
catch
(
error
)
{
next
(
error
)
}
}
async
function
exportExcel
(
req
,
res
,
next
)
{
try
{
let
search
=
{
del
:
0
};
if
(
req
.
body
.
name
)
{
search
.
name
=
{
$regex
:
req
.
body
.
name
};
}
if
(
req
.
body
.
startTime
)
{
search
.
time
=
search
.
time
||
{};
search
.
time
.
$gte
=
req
.
body
.
startTime
;
}
if
(
req
.
body
.
endTime
)
{
search
.
time
=
search
.
time
||
{};
search
.
time
.
$lte
=
req
.
body
.
endTime
}
let
ret
=
await
DB
.
ExcelRecord
.
create
({
creator
:
req
.
user
.
_id
,
type
:
2
,
modleName
:
'PackMatInList'
,
search
,
})
res
.
sendData
(
ret
);
}
catch
(
error
)
{
next
(
error
);
}
}
module
.
exports
=
{
list
,
create
,
importExcel
,
deleteOne
,
updateOne
,
exportExcel
,
}
\ No newline at end of file
controller/packMatOutListController.js
0 → 100644
View file @
5c0dbc31
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
.
agrProName
)
{
search
.
agrProName
=
{
$regex
:
req
.
body
.
agrProName
};
}
if
(
req
.
body
.
name
)
{
search
.
agrProName
=
{
$regex
:
req
.
body
.
name
};
}
if
(
req
.
body
.
startTime
)
{
search
.
outdate
=
search
.
outdate
||
{};
search
.
outdate
.
$gte
=
req
.
body
.
startTime
;
}
if
(
req
.
body
.
endTime
)
{
search
.
outdate
=
search
.
outdate
||
{};
search
.
outdate
.
$lte
=
req
.
body
.
endTime
}
let
count
=
await
DB
.
PackMatOutList
.
countDocuments
(
search
)
let
list
=
await
DB
.
PackMatOutList
.
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
.
PackMatOutList
.
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
.
PackMatOutList
.
findOneAndUpdate
({
_id
:
req
.
body
.
_id
},
updateInfo
);
res
.
sendData
(
ret
);
}
catch
(
error
)
{
next
(
error
)
}
}
async
function
deleteOne
(
req
,
res
,
next
)
{
try
{
let
ret
=
await
DB
.
PackMatOutList
.
findOneAndUpdate
({
_id
:
req
.
body
.
_id
},
{
del
:
1
});
res
.
sendData
(
ret
);
}
catch
(
error
)
{
next
(
error
)
}
}
async
function
importExcel
(
req
,
res
,
next
)
{
try
{
let
workbook
=
new
ExcelJS
.
Workbook
();
await
workbook
.
xlsx
.
readFile
(
req
.
file
.
path
);
let
worksheet
=
workbook
.
getWorksheet
(
1
);
let
arr
=
[];
for
(
let
index
=
2
;
index
<=
worksheet
.
actualRowCount
;
index
++
)
{
let
values
=
worksheet
.
getRow
(
index
).
values
;
let
obj
=
{
creator
:
req
.
user
.
_id
,
serialNumber
:
values
[
1
],
name
:
values
[
2
],
spec
:
values
[
3
],
unit
:
values
[
4
],
purpose
:
values
[
5
],
receivePerson
:
values
[
6
],
outdate
:
values
[
7
],
outNum
:
Number
(
values
[
8
])
||
0
,
}
if
(
typeof
obj
.
outdate
==
'number'
)
{
obj
.
outdate
=
new
Date
(
1900
,
0
,
obj
.
outdate
-
1
,
0
,
0
,
0
);
}
arr
.
push
(
obj
)
}
if
(
arr
.
length
)
{
await
DB
.
PackMatOutList
.
insertMany
(
arr
);
}
res
.
sendData
(
arr
);
}
catch
(
error
)
{
next
(
error
)
}
}
async
function
exportExcel
(
req
,
res
,
next
)
{
try
{
let
search
=
{
del
:
0
};
if
(
req
.
body
.
agrProName
)
{
search
.
agrProName
=
{
$regex
:
req
.
body
.
agrProName
};
}
if
(
req
.
body
.
name
)
{
search
.
name
=
{
$regex
:
req
.
body
.
name
};
}
if
(
req
.
body
.
startTime
)
{
search
.
time
=
search
.
time
||
{};
search
.
time
.
$gte
=
req
.
body
.
startTime
;
}
if
(
req
.
body
.
endTime
)
{
search
.
time
=
search
.
time
||
{};
search
.
time
.
$lte
=
req
.
body
.
endTime
}
let
ret
=
await
DB
.
ExcelRecord
.
create
({
creator
:
req
.
user
.
_id
,
type
:
2
,
modleName
:
'PackMatOutList'
,
search
,
})
res
.
sendData
(
ret
);
}
catch
(
error
)
{
next
(
error
);
}
}
module
.
exports
=
{
list
,
create
,
importExcel
,
deleteOne
,
updateOne
,
exportExcel
,
}
\ No newline at end of file
controller/rawMatProlistController.js
0 → 100644
View file @
5c0dbc31
// 原材料入库(采购)明细表
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
.
agrProName
=
{
$regex
:
req
.
body
.
name
};
}
if
(
req
.
body
.
startTime
)
{
search
.
indate
=
search
.
indate
||
{};
search
.
indate
.
$gte
=
req
.
body
.
startTime
;
}
if
(
req
.
body
.
endTime
)
{
search
.
indate
=
search
.
indate
||
{};
search
.
indate
.
$lte
=
req
.
body
.
endTime
}
let
count
=
await
DB
.
RawMatProList
.
countDocuments
(
search
)
let
list
=
await
DB
.
RawMatProList
.
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
.
RawMatProList
.
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
.
RawMatProList
.
findOneAndUpdate
({
_id
:
req
.
body
.
_id
},
updateInfo
);
res
.
sendData
(
ret
);
}
catch
(
error
)
{
next
(
error
)
}
}
async
function
deleteOne
(
req
,
res
,
next
)
{
try
{
let
ret
=
await
DB
.
RawMatProList
.
findOneAndUpdate
({
_id
:
req
.
body
.
_id
},
{
del
:
1
});
res
.
sendData
(
ret
);
}
catch
(
error
)
{
next
(
error
)
}
}
async
function
importExcel
(
req
,
res
,
next
)
{
try
{
let
workbook
=
new
ExcelJS
.
Workbook
();
await
workbook
.
xlsx
.
readFile
(
req
.
file
.
path
);
let
worksheet
=
workbook
.
getWorksheet
(
1
);
let
arr
=
[];
for
(
let
index
=
2
;
index
<=
worksheet
.
actualRowCount
;
index
++
)
{
let
values
=
worksheet
.
getRow
(
index
).
values
;
// console.log(values)
let
obj
=
{
creator
:
req
.
user
.
_id
,
serialNumber
:
values
[
1
],
name
:
values
[
2
],
spec
:
values
[
3
],
unit
:
values
[
4
],
indate
:
values
[
5
],
inNum
:
Number
(
values
[
6
])
||
0
,
}
if
(
typeof
obj
.
indate
==
'number'
)
{
obj
.
indate
=
new
Date
(
1900
,
0
,
obj
.
indate
-
1
,
0
,
0
,
0
);
}
arr
.
push
(
obj
)
}
// console.log(arr);
if
(
arr
.
length
)
{
await
DB
.
RawMatProList
.
insertMany
(
arr
);
}
res
.
sendData
(
arr
);
}
catch
(
error
)
{
next
(
error
)
}
}
async
function
exportExcel
(
req
,
res
,
next
)
{
try
{
let
search
=
{
del
:
0
};
if
(
req
.
body
.
name
)
{
search
.
name
=
{
$regex
:
req
.
body
.
name
};
}
if
(
req
.
body
.
startTime
)
{
search
.
time
=
search
.
time
||
{};
search
.
time
.
$gte
=
req
.
body
.
startTime
;
}
if
(
req
.
body
.
endTime
)
{
search
.
time
=
search
.
time
||
{};
search
.
time
.
$lte
=
req
.
body
.
endTime
}
let
ret
=
await
DB
.
ExcelRecord
.
create
({
creator
:
req
.
user
.
_id
,
type
:
2
,
modleName
:
'RawMatProList'
,
search
,
})
res
.
sendData
(
ret
);
}
catch
(
error
)
{
next
(
error
);
}
}
module
.
exports
=
{
list
,
create
,
importExcel
,
deleteOne
,
updateOne
,
exportExcel
,
}
\ No newline at end of file
controller/rawMatReqlistController.js
0 → 100644
View file @
5c0dbc31
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
.
agrProName
=
{
$regex
:
req
.
body
.
name
};
}
if
(
req
.
body
.
startTime
)
{
search
.
outdate
=
search
.
outdate
||
{};
search
.
outdate
.
$gte
=
req
.
body
.
startTime
;
}
if
(
req
.
body
.
endTime
)
{
search
.
outdate
=
search
.
outdate
||
{};
search
.
outdate
.
$lte
=
req
.
body
.
endTime
}
let
count
=
await
DB
.
RawMatReqList
.
countDocuments
(
search
)
let
list
=
await
DB
.
RawMatReqList
.
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
.
RawMatReqList
.
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
.
RawMatReqList
.
findOneAndUpdate
({
_id
:
req
.
body
.
_id
},
updateInfo
);
res
.
sendData
(
ret
);
}
catch
(
error
)
{
next
(
error
)
}
}
async
function
deleteOne
(
req
,
res
,
next
)
{
try
{
let
ret
=
await
DB
.
RawMatReqList
.
findOneAndUpdate
({
_id
:
req
.
body
.
_id
},
{
del
:
1
});
res
.
sendData
(
ret
);
}
catch
(
error
)
{
next
(
error
)
}
}
async
function
importExcel
(
req
,
res
,
next
)
{
try
{
let
workbook
=
new
ExcelJS
.
Workbook
();
await
workbook
.
xlsx
.
readFile
(
req
.
file
.
path
);
let
worksheet
=
workbook
.
getWorksheet
(
1
);
let
arr
=
[];
for
(
let
index
=
2
;
index
<=
worksheet
.
actualRowCount
;
index
++
)
{
let
values
=
worksheet
.
getRow
(
index
).
values
;
let
obj
=
{
creator
:
req
.
user
.
_id
,
serialNumber
:
values
[
1
],
name
:
values
[
2
],
spec
:
values
[
3
],
unit
:
values
[
4
],
receiveDepart
:
values
[
5
],
receivePerson
:
values
[
6
],
outdate
:
values
[
7
],
outNum
:
Number
(
values
[
8
])
||
0
,
}
if
(
typeof
obj
.
outdate
==
'number'
)
{
obj
.
outdate
=
new
Date
(
1900
,
0
,
obj
.
outdate
-
1
,
0
,
0
,
0
);
}
arr
.
push
(
obj
)
}
if
(
arr
.
length
)
{
await
DB
.
RawMatReqList
.
insertMany
(
arr
);
}
res
.
sendData
(
arr
);
}
catch
(
error
)
{
next
(
error
)
}
}
async
function
exportExcel
(
req
,
res
,
next
)
{
try
{
let
search
=
{
del
:
0
};
if
(
req
.
body
.
name
)
{
search
.
name
=
{
$regex
:
req
.
body
.
name
};
}
if
(
req
.
body
.
startTime
)
{
search
.
time
=
search
.
time
||
{};
search
.
time
.
$gte
=
req
.
body
.
startTime
;
}
if
(
req
.
body
.
endTime
)
{
search
.
time
=
search
.
time
||
{};
search
.
time
.
$lte
=
req
.
body
.
endTime
}
let
ret
=
await
DB
.
ExcelRecord
.
create
({
creator
:
req
.
user
.
_id
,
type
:
2
,
modleName
:
'RawMatReqList'
,
search
,
})
res
.
sendData
(
ret
);
}
catch
(
error
)
{
next
(
error
);
}
}
module
.
exports
=
{
list
,
create
,
importExcel
,
deleteOne
,
updateOne
,
exportExcel
,
}
\ No newline at end of file
db/index.js
View file @
5c0dbc31
...
@@ -77,6 +77,13 @@ const IndRawMatIn = require('./models/letianIndRawMatIn'); //工业-原料品投
...
@@ -77,6 +77,13 @@ const IndRawMatIn = require('./models/letianIndRawMatIn'); //工业-原料品投
const
CompanyInfo
=
require
(
'./models/letianCompanyInfo'
);
//公司信息 用作扫码处展示
const
CompanyInfo
=
require
(
'./models/letianCompanyInfo'
);
//公司信息 用作扫码处展示
// 原材料、包装材料、
const
RawMatProList
=
require
(
"./models/letianRawMatProList"
);
const
RawMatReqList
=
require
(
"./models/letianRawMatReqList"
);
const
PackMatInList
=
require
(
"./models/letianPackMatInList"
);
const
PackMatOutList
=
require
(
"./models/letianPackMatOutList"
);
global
.
DB
=
{
global
.
DB
=
{
File
,
File
,
User
,
User
,
...
@@ -125,6 +132,10 @@ global.DB = {
...
@@ -125,6 +132,10 @@ global.DB = {
IndRawMatIn
,
IndRawMatIn
,
HeavyMetal
,
HeavyMetal
,
CompanyInfo
,
CompanyInfo
,
RawMatProList
,
RawMatReqList
,
PackMatInList
,
PackMatOutList
,
}
}
...
...
db/models/letianPackMatInList.js
0 → 100644
View file @
5c0dbc31
// 包装材料入库(采购)明细表
const
mongoose
=
require
(
'mongoose'
);
const
Schema
=
mongoose
.
Schema
;
const
moment
=
require
(
'moment'
);
// const autoIncrement = require('mongoose-auto-increment');
// autoIncrement.initialize(mongoose.connection);
/**
* 包装材料入库(采购)明细表
*/
const
letianPackMatInListSchema
=
new
Schema
({
serialNumber
:
{
type
:
String
,
comment
:
"序号"
,
},
name
:
{
type
:
String
,
comment
:
"物品名称"
,
},
spec
:
{
type
:
String
,
comment
:
"规格型号"
,
},
unit
:
{
type
:
String
,
comment
:
"单位"
,
},
indate
:
{
type
:
Date
,
default
:
Date
.
now
,
get
:
v
=>
moment
(
v
).
format
(
"YYYY-MM-DD HH:mm:ss"
),
comment
:
"入库日期"
},
inNum
:
{
type
:
Number
,
comment
:
"入库数量"
,
},
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
PackMatInList
=
mongoose
.
model
(
'PackMatInList'
,
letianPackMatInListSchema
,
'letianPackMatInList'
);
module
.
exports
=
PackMatInList
;
// letianPackMatInListSchema.plugin(autoIncrement.plugin, {
// model: 'PackMatInList',
// field: 'serialNumber',
// startAt: 1,
// incrementBy: 1
// });
\ No newline at end of file
db/models/letianPackMatOutList.js
0 → 100644
View file @
5c0dbc31
//包装材料出库(领用)明细表
const
mongoose
=
require
(
'mongoose'
);
const
Schema
=
mongoose
.
Schema
;
const
moment
=
require
(
'moment'
);
// const autoIncrement = require('mongoose-auto-increment');
// autoIncrement.initialize(mongoose.connection);
/**
* //包装材料出库(领用)明细表
*/
const
letianPackMatOutListSchema
=
new
Schema
({
serialNumber
:
{
type
:
String
,
comment
:
"序号"
,
},
name
:
{
type
:
String
,
comment
:
"物品名称"
,
},
spec
:
{
type
:
String
,
comment
:
"规格型号"
,
},
unit
:
{
type
:
String
,
comment
:
"单位"
,
},
purpose
:
{
type
:
String
,
comment
:
"用途"
,
},
receivePerson
:
{
type
:
String
,
comment
:
"领用人"
,
},
outdate
:
{
type
:
Date
,
get
:
v
=>
moment
(
v
).
format
(
"YYYY-MM-DD HH:mm:ss"
),
comment
:
"出库日期"
,
},
outNum
:
{
type
:
Number
,
comment
:
"出库数量"
,
},
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
PackMatOutList
=
mongoose
.
model
(
'PackMatOutList'
,
letianPackMatOutListSchema
,
'letianPackMatOutList'
);
module
.
exports
=
PackMatOutList
;
// letianPackMatOutListSchema.plugin(autoIncrement.plugin, {
// model: 'PackMatOutList',
// field: 'serialNumber',
// startAt: 1,
// incrementBy: 1
// });
\ No newline at end of file
db/models/letianRawMatProList.js
0 → 100644
View file @
5c0dbc31
// 原材料入库(采购)明细表
const
mongoose
=
require
(
'mongoose'
);
const
Schema
=
mongoose
.
Schema
;
const
moment
=
require
(
'moment'
);
// const autoIncrement = require('mongoose-auto-increment');
// autoIncrement.initialize(mongoose.connection);
/**
* 原材料入库(采购)明细表
*/
const
letianRawMatProListSchema
=
new
Schema
({
serialNumber
:
{
type
:
String
,
comment
:
"序号"
,
},
name
:
{
type
:
String
,
comment
:
"物品名称"
,
},
spec
:
{
type
:
String
,
comment
:
"规格型号"
,
},
unit
:
{
type
:
String
,
comment
:
"单位"
,
},
indate
:
{
type
:
Date
,
default
:
Date
.
now
,
get
:
v
=>
moment
(
v
).
format
(
"YYYY-MM-DD HH:mm:ss"
),
comment
:
"入库日期"
},
inNum
:
{
type
:
Number
,
comment
:
"入库数量"
,
},
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
RawMatProList
=
mongoose
.
model
(
'RawMatProList'
,
letianRawMatProListSchema
,
'letianRawMatProList'
);
module
.
exports
=
RawMatProList
;
// letianRawMatProListSchema.plugin(autoIncrement.plugin, {
// model: 'RawMatProList',
// field: 'serialNumber',
// startAt: 1,
// incrementBy: 1
// });
\ No newline at end of file
db/models/letianRawMatReqList.js
0 → 100644
View file @
5c0dbc31
//原材料出库(领用)明细表
const
mongoose
=
require
(
'mongoose'
);
const
Schema
=
mongoose
.
Schema
;
const
moment
=
require
(
'moment'
);
// const autoIncrement = require('mongoose-auto-increment');
// autoIncrement.initialize(mongoose.connection);
/**
* //原材料出库(领用)明细表
*/
const
letianRawMatReqListSchema
=
new
Schema
({
serialNumber
:
{
type
:
String
,
comment
:
"序号"
,
},
name
:
{
type
:
String
,
comment
:
"物品名称"
,
},
spec
:
{
type
:
String
,
comment
:
"规格型号"
,
},
unit
:
{
type
:
String
,
comment
:
"单位"
,
},
receiveDepart
:
{
type
:
String
,
comment
:
"领用部门"
,
},
receivePerson
:
{
type
:
String
,
comment
:
"领用人"
,
},
outdate
:
{
type
:
Date
,
get
:
v
=>
moment
(
v
).
format
(
"YYYY-MM-DD HH:mm:ss"
),
comment
:
"出库日期"
,
},
outNum
:
{
type
:
Number
,
comment
:
"出库数量"
,
},
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
RawMatReqList
=
mongoose
.
model
(
'RawMatReqList'
,
letianRawMatReqListSchema
,
'letianRawMatReqList'
);
module
.
exports
=
RawMatReqList
;
// letianRawMatReqListSchema.plugin(autoIncrement.plugin, {
// model: 'RawMatReqList',
// field: 'serialNumber',
// startAt: 1,
// incrementBy: 1
// });
\ No newline at end of file
router/fileRouter.js
View file @
5c0dbc31
...
@@ -59,6 +59,10 @@ router.post('/:modelName/importExcel', upload.single('file'), async (req, res, n
...
@@ -59,6 +59,10 @@ router.post('/:modelName/importExcel', upload.single('file'), async (req, res, n
// 'productPre': 'productPreController', //初加工
// 'productPre': 'productPreController', //初加工
// 'productDeep': 'productDeepController', // 深加工
// 'productDeep': 'productDeepController', // 深加工
'rawMat'
:
'indRawMatController'
,
//原料品投入
'rawMat'
:
'indRawMatController'
,
//原料品投入
'rawMatPro'
:
'rawMatProlistController'
,
//原材料入库(采购)明细表
'rawMatReq'
:
'rawMatReqlistController'
,
//原材料出库(领用)明细表
'packMatIn'
:
'packMatInListController'
,
//包装材料入库(采购)明细表
'packMatOut'
:
'packMatOutListController'
,
//包装材料出库(领用)明细表
}
}
let
controller
=
require
(
`../controller/
${
modelMap
[
modelName
]}
`
);
let
controller
=
require
(
`../controller/
${
modelMap
[
modelName
]}
`
);
await
controller
.
importExcel
(
req
,
res
,
next
);
await
controller
.
importExcel
(
req
,
res
,
next
);
...
@@ -77,6 +81,10 @@ router.post('/:modelName/exportExcel', async (req, res, next) => {
...
@@ -77,6 +81,10 @@ router.post('/:modelName/exportExcel', async (req, res, next) => {
'agrInputOther'
:
"agrInputOtherController"
,
'agrInputOther'
:
"agrInputOtherController"
,
'agrInputDetail'
:
"agrInputDetailController"
,
'agrInputDetail'
:
"agrInputDetailController"
,
'agrInputEmploy'
:
"agrInputEmployController"
,
'agrInputEmploy'
:
"agrInputEmployController"
,
'rawMatPro'
:
'rawMatProlistController'
,
//原材料入库(采购)明细表
'rawMatReq'
:
'rawMatReqlistController'
,
//原材料出库(领用)明细表
'packMatIn'
:
'packMatInListController'
,
//包装材料入库(采购)明细表
'packMatOut'
:
'packMatOutListController'
,
//包装材料出库(领用)明细表
}
}
console
.
log
(
modelMap
[
modelName
]);
console
.
log
(
modelMap
[
modelName
]);
let
controller
=
require
(
`../controller/
${
modelMap
[
modelName
]}
`
);
let
controller
=
require
(
`../controller/
${
modelMap
[
modelName
]}
`
);
...
...
router/index.js
View file @
5c0dbc31
...
@@ -23,6 +23,7 @@ const excelrecordRouter = require('./excelrecordRouter');
...
@@ -23,6 +23,7 @@ const excelrecordRouter = require('./excelrecordRouter');
const
inductryRouter
=
require
(
'./inductryRouter'
);
const
inductryRouter
=
require
(
'./inductryRouter'
);
const
heavyMetalRouter
=
require
(
'./externalRouter'
);
const
heavyMetalRouter
=
require
(
'./externalRouter'
);
const
compInfoRouter
=
require
(
'./compInfoRouter'
);
const
compInfoRouter
=
require
(
'./compInfoRouter'
);
const
rawmatRouter
=
require
(
'./rawmatRouter'
);
router
.
use
(
'/user'
,
userRouter
);
// 用户 角色
router
.
use
(
'/user'
,
userRouter
);
// 用户 角色
...
@@ -54,6 +55,8 @@ router.use('/ind', inductryRouter);
...
@@ -54,6 +55,8 @@ router.use('/ind', inductryRouter);
router
.
use
(
'/company'
,
compInfoRouter
);
router
.
use
(
'/company'
,
compInfoRouter
);
router
.
use
(
'/mat'
,
rawmatRouter
);
module
.
exports
=
router
;
module
.
exports
=
router
;
\ No newline at end of file
router/rawmatRouter.js
0 → 100644
View file @
5c0dbc31
const
express
=
require
(
'express'
);
const
router
=
express
.
Router
();
const
rawMatProlistController
=
require
(
'../controller/rawMatProlistController'
);
const
rawMatReqlistController
=
require
(
'../controller/rawMatReqlistController'
);
//原材料入库(采购)明细表
router
.
post
(
'/rawMatPro/create'
,
rawMatProlistController
.
create
);
router
.
post
(
'/rawMatPro/update'
,
rawMatProlistController
.
updateOne
);
router
.
post
(
'/rawMatPro/delete'
,
rawMatProlistController
.
deleteOne
);
router
.
post
(
'/rawMatPro/list'
,
rawMatProlistController
.
list
);
//原材料出库(领用)明细表
router
.
post
(
'/rawMatReq/create'
,
rawMatReqlistController
.
create
);
router
.
post
(
'/rawMatReq/update'
,
rawMatReqlistController
.
updateOne
);
router
.
post
(
'/rawMatReq/delete'
,
rawMatReqlistController
.
deleteOne
);
router
.
post
(
'/rawMatReq/list'
,
rawMatReqlistController
.
list
);
const
packMatInListController
=
require
(
'../controller/packMatInListController'
);
const
packMatOutListController
=
require
(
'../controller/packMatOutListController'
);
//包装材料入库(采购)明细表
router
.
post
(
'/packMatIn/create'
,
packMatInListController
.
create
);
router
.
post
(
'/packMatIn/update'
,
packMatInListController
.
updateOne
);
router
.
post
(
'/packMatIn/delete'
,
packMatInListController
.
deleteOne
);
router
.
post
(
'/packMatIn/list'
,
packMatInListController
.
list
);
// 包装材料出库(领用)明细表
router
.
post
(
'/packMatOut/create'
,
packMatOutListController
.
create
);
router
.
post
(
'/packMatOut/update'
,
packMatOutListController
.
updateOne
);
router
.
post
(
'/packMatOut/delete'
,
packMatOutListController
.
deleteOne
);
router
.
post
(
'/packMatOut/list'
,
packMatOutListController
.
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