明树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
160d5a87
Commit
160d5a87
authored
Dec 03, 2024
by
zfp1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
1eca7605
Changes
13
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
291 additions
and
190 deletions
+291
-190
agrMatController.js
controller/agrMatController.js
+15
-10
plantContoller.js
controller/plantContoller.js
+2
-166
productDeepController.js
controller/productDeepController.js
+62
-0
productDirPlantController.js
controller/productDirPlantController.js
+96
-0
productPreController.js
controller/productPreController.js
+61
-0
letianAgrMatInOut.js
db/models/letianAgrMatInOut.js
+12
-0
letianProductDeep.js
db/models/letianProductDeep.js
+4
-0
letianProductPlant.js
db/models/letianProductPlant.js
+6
-1
letianProductPre.js
db/models/letianProductPre.js
+4
-0
fileRouter.js
router/fileRouter.js
+4
-1
index.js
router/index.js
+3
-0
plantRouter.js
router/plantRouter.js
+15
-12
index.js
utils/index.js
+7
-0
No files found.
controller/agrMatController.js
View file @
160d5a87
...
...
@@ -303,14 +303,16 @@ async function importExcel(req, res, next) {
let
arr
=
[];
worksheet
.
eachRow
({
includeEmpty
:
false
},
function
(
row
,
rowNumber
)
{
console
.
log
(
rowNumber
)
//
console.log(rowNumber)
const
rowData
=
{};
if
(
rowNumber
>
1
)
{
let
keys
=
[
'type'
,
'name'
,
'count'
,
'spec'
,
'comment'
];
row
.
eachCell
({
includeEmpty
:
true
},
function
(
cell
,
colNumber
)
{
console
.
log
(
'colNumber: '
,
colNumber
)
rowData
[
cell
.
value
]
=
cell
.
value
;
//
console.log('colNumber: ', colNumber)
rowData
[
keys
[
colNumber
-
1
]
]
=
cell
.
value
;
});
// rowsData.push(rowData);
arr
.
push
(
rowData
);
}
});
res
.
sendData
({
...
...
@@ -350,6 +352,8 @@ async function inMat(req, res, next) {
status
:
1
,
currentTotalCount
:
check
.
totalCount
,
actualCount
:
element
.
count
,
spec
:
element
.
spec
,
comment
:
element
.
comment
,
});
}
else
{
await
DB
.
AgrMat
.
create
({
...
...
@@ -365,7 +369,8 @@ async function inMat(req, res, next) {
status
:
2
,
currentTotalCount
:
0
,
actualCount
:
element
.
count
,
spec
:
element
.
spec
,
comment
:
element
.
comment
,
});
}
}
...
...
@@ -380,14 +385,14 @@ async function outMat(req, res, next) {
let
body
=
req
.
body
;
let
creator
=
req
.
user
.
_id
;
let
materials
=
body
.
materials
||
[];
//
let fileInfo = body.fileInfo;
let
fileInfo
=
body
.
fileInfo
;
let
inApprovalId
=
new
mongoose
.
Types
.
ObjectId
();
let
inApproval
=
{
_id
:
inApprovalId
,
type
:
2
,
name
:
"出库单"
,
creator
,
//
file: fileInfo && fileInfo._id,
file
:
fileInfo
&&
fileInfo
.
_id
,
}
//创建单据
await
DB
.
AgrMatApproval
.
create
(
inApproval
);
...
...
controller/plantContoller.js
View file @
160d5a87
...
...
@@ -122,161 +122,9 @@ async function updatePlan(req, res, next) {
}
}
/**--------------------------------------------直接种植--------------------------------------------------------- */
async
function
createDirectPlant
(
req
,
res
,
next
)
{
try
{
//
const
body
=
req
.
body
;
let
ret
=
await
DB
.
ProductPlant
.
create
(
body
);
res
.
sendData
(
ret
);
}
catch
(
error
)
{
next
(
error
);
}
}
async
function
listDirectPlant
(
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
;
const
count
=
await
DB
.
ProductPlant
.
countDocuments
(
search
);
let
list
=
await
DB
.
ProductPlant
.
find
(
search
).
sort
({
_id
:
-
1
}).
skip
(
skip
).
limit
(
pageSize
);
res
.
sendData
({
count
,
list
});
}
catch
(
error
)
{
next
(
error
);
}
}
async
function
deleteDirectPlant
(
req
,
res
,
next
)
{
try
{
if
(
!
req
.
body
.
_id
)
{
return
res
.
sendError
(
errorMessage
.
resourceNotFound
);
}
let
ret
=
await
DB
.
ProductPlant
.
findOneAndUpdate
({
_id
:
req
.
body
.
_id
},
{
del
:
1
});
res
.
sendData
(
ret
);
}
catch
(
error
)
{
next
(
error
);
}
}
async
function
updateDirectPlant
(
req
,
res
,
next
)
{
try
{
if
(
!
req
.
body
.
_id
)
{
return
res
.
sendError
(
errorMessage
.
resourceNotFound
);
}
let
upInfo
=
{
...
req
.
body
,
_id
:
undefined
,
}
let
ret
=
await
DB
.
ProductPlant
.
findOneAndUpdate
({
_id
:
req
.
body
.
_id
},
upInfo
);
res
.
sendData
(
ret
);
}
catch
(
error
)
{
next
(
error
);
}
}
/**--------------------------------------------初加工--------------------------------------------------------- */
async
function
createPrePlant
(
req
,
res
,
next
)
{
try
{
//
const
body
=
req
.
body
;
let
ret
=
await
DB
.
ProductPre
.
create
(
body
);
res
.
sendData
(
ret
);
}
catch
(
error
)
{
next
(
error
);
}
}
async
function
listPrePlant
(
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
;
const
count
=
await
DB
.
ProductPre
.
countDocuments
(
search
);
let
list
=
await
DB
.
ProductPre
.
find
(
search
).
sort
({
_id
:
-
1
}).
skip
(
skip
).
limit
(
pageSize
);
res
.
sendData
({
count
,
list
});
}
catch
(
error
)
{
next
(
error
);
}
}
async
function
deletePrePlant
(
req
,
res
,
next
)
{
try
{
if
(
!
req
.
body
.
_id
)
{
return
res
.
sendError
(
errorMessage
.
resourceNotFound
);
}
let
ret
=
await
DB
.
ProductPre
.
findOneAndUpdate
({
_id
:
req
.
body
.
_id
},
{
del
:
1
});
res
.
sendData
(
ret
);
}
catch
(
error
)
{
next
(
error
);
}
}
async
function
updatePrePlant
(
req
,
res
,
next
)
{
try
{
if
(
!
req
.
body
.
_id
)
{
return
res
.
sendError
(
errorMessage
.
resourceNotFound
);
}
let
upInfo
=
{
...
req
.
body
,
_id
:
undefined
,
}
let
ret
=
await
DB
.
ProductPre
.
findOneAndUpdate
({
_id
:
req
.
body
.
_id
},
upInfo
);
res
.
sendData
(
ret
);
}
catch
(
error
)
{
next
(
error
);
}
}
/**--------------------------------------------深加工--------------------------------------------------------- */
async
function
createDeepPlant
(
req
,
res
,
next
)
{
try
{
//
const
body
=
req
.
body
;
let
ret
=
await
DB
.
ProductDeep
.
create
(
body
);
res
.
sendData
(
ret
);
}
catch
(
error
)
{
next
(
error
);
}
}
async
function
listDeepPlant
(
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
;
const
count
=
await
DB
.
ProductDeep
.
countDocuments
(
search
);
let
list
=
await
DB
.
ProductDeep
.
find
(
search
).
sort
({
_id
:
-
1
}).
skip
(
skip
).
limit
(
pageSize
);
res
.
sendData
({
count
,
list
});
}
catch
(
error
)
{
next
(
error
);
}
}
async
function
deleteDeepPlant
(
req
,
res
,
next
)
{
try
{
if
(
!
req
.
body
.
_id
)
{
return
res
.
sendError
(
errorMessage
.
resourceNotFound
);
}
let
ret
=
await
DB
.
ProductDeep
.
findOneAndUpdate
({
_id
:
req
.
body
.
_id
},
{
del
:
1
});
res
.
sendData
(
ret
);
}
catch
(
error
)
{
next
(
error
);
}
}
async
function
updateDeepPlant
(
req
,
res
,
next
)
{
try
{
if
(
!
req
.
body
.
_id
)
{
return
res
.
sendError
(
errorMessage
.
resourceNotFound
);
}
let
upInfo
=
{
...
req
.
body
,
_id
:
undefined
,
}
let
ret
=
await
DB
.
ProductDeep
.
findOneAndUpdate
({
_id
:
req
.
body
.
_id
},
upInfo
);
res
.
sendData
(
ret
);
}
catch
(
error
)
{
next
(
error
);
}
}
...
...
@@ -289,18 +137,6 @@ module.exports = {
createPlan
,
listPlan
,
deletePlan
,
updatePlan
,
createDirectPlant
,
listDirectPlant
,
deleteDirectPlant
,
updateDirectPlant
,
createPrePlant
,
listPrePlant
,
deletePrePlant
,
updatePrePlant
,
createDeepPlant
,
listDeepPlant
,
deleteDeepPlant
,
updateDeepPlant
,
updatePlan
}
\ No newline at end of file
controller/productDeepController.js
0 → 100644
View file @
160d5a87
/**--------------------------------------------深加工--------------------------------------------------------- */
async
function
createDeepPlant
(
req
,
res
,
next
)
{
try
{
//
const
body
=
req
.
body
;
let
count
=
await
DB
.
ProductDeep
.
count
();
//没有真实删除 永远递增
body
.
productNumber
=
count
;
let
ret
=
await
DB
.
ProductDeep
.
create
(
body
);
res
.
sendData
(
ret
);
}
catch
(
error
)
{
next
(
error
);
}
}
async
function
listDeepPlant
(
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
;
const
count
=
await
DB
.
ProductDeep
.
countDocuments
(
search
);
let
list
=
await
DB
.
ProductDeep
.
find
(
search
).
sort
({
_id
:
-
1
}).
skip
(
skip
).
limit
(
pageSize
);
res
.
sendData
({
count
,
list
});
}
catch
(
error
)
{
next
(
error
);
}
}
async
function
deleteDeepPlant
(
req
,
res
,
next
)
{
try
{
if
(
!
req
.
body
.
_id
)
{
return
res
.
sendError
(
errorMessage
.
resourceNotFound
);
}
let
ret
=
await
DB
.
ProductDeep
.
findOneAndUpdate
({
_id
:
req
.
body
.
_id
},
{
del
:
1
});
res
.
sendData
(
ret
);
}
catch
(
error
)
{
next
(
error
);
}
}
async
function
updateDeepPlant
(
req
,
res
,
next
)
{
try
{
if
(
!
req
.
body
.
_id
)
{
return
res
.
sendError
(
errorMessage
.
resourceNotFound
);
}
let
upInfo
=
{
...
req
.
body
,
_id
:
undefined
,
}
let
ret
=
await
DB
.
ProductDeep
.
findOneAndUpdate
({
_id
:
req
.
body
.
_id
},
upInfo
);
res
.
sendData
(
ret
);
}
catch
(
error
)
{
next
(
error
);
}
}
module
.
exports
=
{
createDeepPlant
,
listDeepPlant
,
deleteDeepPlant
,
updateDeepPlant
,
}
\ No newline at end of file
controller/productDirPlantController.js
0 → 100644
View file @
160d5a87
/**--------------------------------------------直接种植--------------------------------------------------------- */
async
function
createDirectPlant
(
req
,
res
,
next
)
{
try
{
//
const
body
=
req
.
body
;
let
count
=
await
DB
.
ProductPlant
.
count
();
//没有真实删除 永远递增
body
.
productNumber
=
count
;
let
ret
=
await
DB
.
ProductPlant
.
create
(
body
);
res
.
sendData
(
ret
);
}
catch
(
error
)
{
next
(
error
);
}
}
async
function
listDirectPlant
(
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
;
const
count
=
await
DB
.
ProductPlant
.
countDocuments
(
search
);
let
list
=
await
DB
.
ProductPlant
.
find
(
search
).
sort
({
_id
:
-
1
}).
skip
(
skip
).
limit
(
pageSize
);
res
.
sendData
({
count
,
list
});
}
catch
(
error
)
{
next
(
error
);
}
}
async
function
deleteDirectPlant
(
req
,
res
,
next
)
{
try
{
if
(
!
req
.
body
.
_id
)
{
return
res
.
sendError
(
errorMessage
.
resourceNotFound
);
}
let
ret
=
await
DB
.
ProductPlant
.
findOneAndUpdate
({
_id
:
req
.
body
.
_id
},
{
del
:
1
});
res
.
sendData
(
ret
);
}
catch
(
error
)
{
next
(
error
);
}
}
async
function
updateDirectPlant
(
req
,
res
,
next
)
{
try
{
if
(
!
req
.
body
.
_id
)
{
return
res
.
sendError
(
errorMessage
.
resourceNotFound
);
}
let
upInfo
=
{
...
req
.
body
,
_id
:
undefined
,
}
let
ret
=
await
DB
.
ProductPlant
.
findOneAndUpdate
({
_id
:
req
.
body
.
_id
},
upInfo
);
res
.
sendData
(
ret
);
}
catch
(
error
)
{
next
(
error
);
}
}
async
function
importExcel
(
req
,
res
,
next
)
{
try
{
throw
new
Error
(
'不适合做解析,直接录入'
);
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
,
productName
:
values
[
1
],
varieties
:
values
[
2
],
productIntro
:
values
[
3
],
qualityInfor
:
values
[
4
],
}
if
(
typeof
obj
.
time
==
'number'
)
{
obj
.
time
=
new
Date
(
1900
,
0
,
obj
.
time
-
1
,
0
,
0
,
0
);
}
if
(
obj
.
time
&&
obj
.
agrProName
)
{
arr
.
push
(
obj
)
}
}
if
(
arr
.
length
)
{
await
DB
.
AgrInputRecord
.
insertMany
(
arr
);
}
res
.
sendData
(
arr
);
}
catch
(
error
)
{
next
(
error
)
}
}
module
.
exports
=
{
createDirectPlant
,
listDirectPlant
,
deleteDirectPlant
,
updateDirectPlant
,
importExcel
,
}
\ No newline at end of file
controller/productPreController.js
0 → 100644
View file @
160d5a87
/**--------------------------------------------初加工--------------------------------------------------------- */
async
function
createPrePlant
(
req
,
res
,
next
)
{
try
{
//
const
body
=
req
.
body
;
let
count
=
await
DB
.
ProductPre
.
count
();
//没有真实删除 永远递增
body
.
productNumber
=
count
;
let
ret
=
await
DB
.
ProductPre
.
create
(
body
);
res
.
sendData
(
ret
);
}
catch
(
error
)
{
next
(
error
);
}
}
async
function
listPrePlant
(
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
;
const
count
=
await
DB
.
ProductPre
.
countDocuments
(
search
);
let
list
=
await
DB
.
ProductPre
.
find
(
search
).
sort
({
_id
:
-
1
}).
skip
(
skip
).
limit
(
pageSize
);
res
.
sendData
({
count
,
list
});
}
catch
(
error
)
{
next
(
error
);
}
}
async
function
deletePrePlant
(
req
,
res
,
next
)
{
try
{
if
(
!
req
.
body
.
_id
)
{
return
res
.
sendError
(
errorMessage
.
resourceNotFound
);
}
let
ret
=
await
DB
.
ProductPre
.
findOneAndUpdate
({
_id
:
req
.
body
.
_id
},
{
del
:
1
});
res
.
sendData
(
ret
);
}
catch
(
error
)
{
next
(
error
);
}
}
async
function
updatePrePlant
(
req
,
res
,
next
)
{
try
{
if
(
!
req
.
body
.
_id
)
{
return
res
.
sendError
(
errorMessage
.
resourceNotFound
);
}
let
upInfo
=
{
...
req
.
body
,
_id
:
undefined
,
}
let
ret
=
await
DB
.
ProductPre
.
findOneAndUpdate
({
_id
:
req
.
body
.
_id
},
upInfo
);
res
.
sendData
(
ret
);
}
catch
(
error
)
{
next
(
error
);
}
}
module
.
exports
=
{
createPrePlant
,
listPrePlant
,
deletePrePlant
,
updatePrePlant
,
}
\ No newline at end of file
db/models/letianAgrMatInOut.js
View file @
160d5a87
...
...
@@ -31,6 +31,18 @@ const AgrMaterialInOutSchema = new Schema({
type
:
Number
,
comment
:
"实际出入库数量--计算依据"
,
},
unit
:
{
type
:
String
,
comment
:
"农资单位"
},
comment
:
{
type
:
String
,
comment
:
"备注"
},
spec
:
{
type
:
String
,
commnet
:
"规格"
,
},
approval
:
{
type
:
mongoose
.
Types
.
ObjectId
,
...
...
db/models/letianProductDeep.js
View file @
160d5a87
...
...
@@ -45,6 +45,10 @@ const letianProductDeepSchema = new Schema({
type
:
String
,
comment
:
"质量信息"
},
productNumber
:
{
type
:
String
,
comment
:
"产品编号"
},
createdAt
:
{
type
:
Date
,
...
...
db/models/letianProductPlant.js
View file @
160d5a87
...
...
@@ -16,7 +16,8 @@ const letianProductPlantSchema = new Schema({
comment
:
"品种"
},
productPhotos
:
{
type
:
String
,
type
:
mongoose
.
Types
.
ObjectId
,
ref
:
'File'
,
comment
:
"产品照片"
},
productIntro
:
{
...
...
@@ -32,6 +33,10 @@ const letianProductPlantSchema = new Schema({
ref
:
'PlantPlan'
,
comment
:
"种植规划 关联信息 按照农作物的名称关联"
},
productNumber
:
{
type
:
String
,
comment
:
"产品编号"
},
createdAt
:
{
type
:
Date
,
...
...
db/models/letianProductPre.js
View file @
160d5a87
...
...
@@ -44,6 +44,10 @@ const letianProductPreSchema = new Schema({
type
:
String
,
comment
:
"质量信息"
},
productNumber
:
{
type
:
String
,
comment
:
"产品编号"
},
createdAt
:
{
type
:
Date
,
...
...
router/fileRouter.js
View file @
160d5a87
...
...
@@ -54,7 +54,10 @@ router.post('/:modelName/importExcel', upload.single('file'), async (req, res, n
'agrInputOther'
:
"agrInputOtherController"
,
'agrInputDetail'
:
"agrInputDetailController"
,
'agrInputEmploy'
:
"agrInputEmployController"
,
'agrMat'
:
'agrMatController'
,
'agrMat'
:
'agrMatController'
,
//库存解析
// 'productDirPlant': 'productDirPlantController', //直接种植
// 'productPre': 'productPreController', //初加工
// 'productDeep': 'productDeepController', // 深加工
}
let
controller
=
require
(
`../controller/
${
modelMap
[
modelName
]}
`
);
await
controller
.
importExcel
(
req
,
res
,
next
);
...
...
router/index.js
View file @
160d5a87
...
...
@@ -46,6 +46,9 @@ router.use('/statistics', statisticsRouter); // 统计 大屏
router
.
use
(
'/flow'
,
flowRouter
);
router
.
use
(
'/excelrecord'
,
excelrecordRouter
);
// 工业
...
...
router/plantRouter.js
View file @
160d5a87
...
...
@@ -3,6 +3,9 @@ const express = require('express');
const
router
=
express
.
Router
();
const
plantContoller
=
require
(
'../controller/plantContoller.js'
);
const
productDirPlantController
=
require
(
'../controller/productDirPlantController.js'
);
const
productPreController
=
require
(
'../controller/productPreController.js'
);
const
productDeepController
=
require
(
'../controller/productDeepController.js'
);
// 生长周期
router
.
post
(
'/cycle/create'
,
plantContoller
.
createPlantCycle
);
...
...
@@ -17,21 +20,21 @@ router.post('/plan/delete', plantContoller.deletePlan);
router
.
post
(
'/plan/update'
,
plantContoller
.
updatePlan
);
// 直接种植
router
.
post
(
'/product/direct/create'
,
p
lantCont
oller
.
createDirectPlant
);
router
.
post
(
'/product/direct/list'
,
p
lantCont
oller
.
listDirectPlant
);
router
.
post
(
'/product/direct/delete'
,
p
lantCont
oller
.
deleteDirectPlant
);
router
.
post
(
'/product/direct/update'
,
p
lantCont
oller
.
updateDirectPlant
);
router
.
post
(
'/product/direct/create'
,
p
roductDirPlantContr
oller
.
createDirectPlant
);
router
.
post
(
'/product/direct/list'
,
p
roductDirPlantContr
oller
.
listDirectPlant
);
router
.
post
(
'/product/direct/delete'
,
p
roductDirPlantContr
oller
.
deleteDirectPlant
);
router
.
post
(
'/product/direct/update'
,
p
roductDirPlantContr
oller
.
updateDirectPlant
);
// 初加工
router
.
post
(
'/product/pre/create'
,
p
lantCont
oller
.
createPrePlant
);
router
.
post
(
'/product/pre/list'
,
p
lantCont
oller
.
listPrePlant
);
router
.
post
(
'/product/pre/delete'
,
p
lantCont
oller
.
deletePrePlant
);
router
.
post
(
'/product/pre/update'
,
p
lantCont
oller
.
updatePrePlant
);
router
.
post
(
'/product/pre/create'
,
p
roductPreContr
oller
.
createPrePlant
);
router
.
post
(
'/product/pre/list'
,
p
roductPreContr
oller
.
listPrePlant
);
router
.
post
(
'/product/pre/delete'
,
p
roductPreContr
oller
.
deletePrePlant
);
router
.
post
(
'/product/pre/update'
,
p
roductPreContr
oller
.
updatePrePlant
);
// 深加工
router
.
post
(
'/product/deep/create'
,
p
lantCont
oller
.
createDeepPlant
);
router
.
post
(
'/product/deep/list'
,
p
lantCont
oller
.
listDeepPlant
);
router
.
post
(
'/product/deep/delete'
,
p
lantCont
oller
.
deleteDeepPlant
);
router
.
post
(
'/product/deep/update'
,
p
lantCont
oller
.
updateDeepPlant
);
router
.
post
(
'/product/deep/create'
,
p
roductDeepContr
oller
.
createDeepPlant
);
router
.
post
(
'/product/deep/list'
,
p
roductDeepContr
oller
.
listDeepPlant
);
router
.
post
(
'/product/deep/delete'
,
p
roductDeepContr
oller
.
deleteDeepPlant
);
router
.
post
(
'/product/deep/update'
,
p
roductDeepContr
oller
.
updateDeepPlant
);
module
.
exports
=
router
;
\ No newline at end of file
utils/index.js
View file @
160d5a87
...
...
@@ -66,6 +66,13 @@ function disTree(tree) {
return
parallel
}
function
genTracSourceCode
({
EnterpriseCode
,
type
,
date
,
batchNum
,
logisticsNum
})
{
// 企业代码(9) MA4W271Y8 + 产品代码【种植、初加工、深加工】(6)+ 生产/出厂日期(8)) + 批次号(8)+ 物流码 + 校验码(8)
//MA4W271Y8
date
=
date
&&
moment
().
format
(
'YYYYMMDD'
);
return
`
${
EnterpriseCode
}${
type
}${
date
}${
batchNum
}${
logisticsNum
}
`
;
}
module
.
exports
=
{
...
...
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