明树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
e467eeee
Commit
e467eeee
authored
Oct 25, 2024
by
zengfanpei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
1e34c1bc
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
712 additions
and
28 deletions
+712
-28
local.json
config/local.json
+1
-1
agrInputDetailController.js
controller/agrInputDetailController.js
+115
-0
agrInputEmployController.js
controller/agrInputEmployController.js
+115
-0
agrInputOtherController.js
controller/agrInputOtherController.js
+115
-0
agrInputRecordController.js
controller/agrInputRecordController.js
+37
-8
deviceController.js
controller/deviceController.js
+3
-0
index.js
db/index.js
+12
-11
collectDevice.js
db/models/collectDevice.js
+5
-1
letianAgrInputDetail.js
db/models/letianAgrInputDetail.js
+96
-0
letianAgrInputEmploy.js
db/models/letianAgrInputEmploy.js
+80
-0
letianAgrInputOther.js
db/models/letianAgrInputOther.js
+80
-0
letianAgrInputRecord.js
db/models/letianAgrInputRecord.js
+21
-4
agrRouter.js
router/agrRouter.js
+32
-3
No files found.
config/local.json
View file @
e467eeee
...
...
@@ -38,6 +38,6 @@
"getAllDevice"
:
false
,
"collectDeviceInfo"
:
false
,
"collectDeviceInfo4"
:
false
,
"excel"
:
tru
e
"excel"
:
fals
e
}
}
\ No newline at end of file
controller/agrInputDetailController.js
0 → 100644
View file @
e467eeee
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
;
let
count
=
await
DB
.
AgrInputDetail
.
countDocuments
(
search
)
let
list
=
await
DB
.
AgrInputDetail
.
find
(
search
).
skip
(
skip
).
limit
(
pageSize
).
lean
().
exec
();
res
.
sendData
({
count
,
list
});
}
catch
(
error
)
{
next
(
error
)
}
}
async
function
create
(
req
,
res
,
next
)
{
try
{
let
ret
=
await
DB
.
AgrInputDetail
.
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
.
AgrInputDetail
.
findOneAndUpdate
({
_id
:
req
.
body
.
_id
},
updateInfo
);
res
.
sendData
(
ret
);
}
catch
(
error
)
{
next
(
error
)
}
}
async
function
deleteOne
(
req
,
res
,
next
)
{
try
{
let
ret
=
await
DB
.
AgrInputDetail
.
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
,
time
:
values
[
1
],
agrProName
:
values
[
2
],
name
:
values
[
3
],
type
:
values
[
4
],
total
:
values
[
5
],
unit
:
values
[
6
],
totalCost
:
values
[
7
],
dilutionRatio
:
values
[
8
],
waterConsumption
:
values
[
9
],
area
:
values
[
10
],
dosage
:
values
[
11
],
land
:
values
[
12
],
notes
:
values
[
13
],
}
if
(
obj
.
time
&&
obj
.
agrProName
)
{
arr
.
push
(
obj
)
}
}
if
(
arr
.
length
)
{
await
DB
.
AgrInputDetail
.
insertMany
(
arr
);
}
res
.
sendData
(
arr
);
}
catch
(
error
)
{
next
(
error
)
}
}
module
.
exports
=
{
list
,
create
,
importExcel
,
deleteOne
,
updateOne
}
\ No newline at end of file
controller/agrInputEmployController.js
0 → 100644
View file @
e467eeee
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
;
let
count
=
await
DB
.
AgrInputEmploy
.
countDocuments
(
search
)
let
list
=
await
DB
.
AgrInputEmploy
.
find
(
search
).
skip
(
skip
).
limit
(
pageSize
).
lean
().
exec
();
res
.
sendData
({
count
,
list
});
}
catch
(
error
)
{
next
(
error
)
}
}
async
function
create
(
req
,
res
,
next
)
{
try
{
let
ret
=
await
DB
.
AgrInputEmploy
.
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
.
AgrInputEmploy
.
findOneAndUpdate
({
_id
:
req
.
body
.
_id
},
updateInfo
);
res
.
sendData
(
ret
);
}
catch
(
error
)
{
next
(
error
)
}
}
async
function
deleteOne
(
req
,
res
,
next
)
{
try
{
let
ret
=
await
DB
.
AgrInputEmploy
.
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
,
time
:
values
[
1
],
agrProName
:
values
[
2
],
name
:
values
[
3
],
type
:
values
[
4
],
total
:
values
[
5
],
unit
:
values
[
6
],
totalCost
:
values
[
7
],
dilutionRatio
:
values
[
8
],
waterConsumption
:
values
[
9
],
area
:
values
[
10
],
dosage
:
values
[
11
],
land
:
values
[
12
],
notes
:
values
[
13
],
}
if
(
obj
.
time
&&
obj
.
agrProName
)
{
arr
.
push
(
obj
)
}
}
if
(
arr
.
length
)
{
await
DB
.
AgrInputEmploy
.
insertMany
(
arr
);
}
res
.
sendData
(
arr
);
}
catch
(
error
)
{
next
(
error
)
}
}
module
.
exports
=
{
list
,
create
,
importExcel
,
deleteOne
,
updateOne
}
\ No newline at end of file
controller/agrInputOtherController.js
0 → 100644
View file @
e467eeee
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
;
let
count
=
await
DB
.
AgrInputOther
.
countDocuments
(
search
)
let
list
=
await
DB
.
AgrInputOther
.
find
(
search
).
skip
(
skip
).
limit
(
pageSize
).
lean
().
exec
();
res
.
sendData
({
count
,
list
});
}
catch
(
error
)
{
next
(
error
)
}
}
async
function
create
(
req
,
res
,
next
)
{
try
{
let
ret
=
await
DB
.
AgrInputOther
.
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
.
AgrInputOther
.
findOneAndUpdate
({
_id
:
req
.
body
.
_id
},
updateInfo
);
res
.
sendData
(
ret
);
}
catch
(
error
)
{
next
(
error
)
}
}
async
function
deleteOne
(
req
,
res
,
next
)
{
try
{
let
ret
=
await
DB
.
AgrInputOther
.
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
,
time
:
values
[
1
],
agrProName
:
values
[
2
],
name
:
values
[
3
],
type
:
values
[
4
],
total
:
values
[
5
],
unit
:
values
[
6
],
totalCost
:
values
[
7
],
dilutionRatio
:
values
[
8
],
waterConsumption
:
values
[
9
],
area
:
values
[
10
],
dosage
:
values
[
11
],
land
:
values
[
12
],
notes
:
values
[
13
],
}
if
(
obj
.
time
&&
obj
.
agrProName
)
{
arr
.
push
(
obj
)
}
}
if
(
arr
.
length
)
{
await
DB
.
AgrInputOther
.
insertMany
(
arr
);
}
res
.
sendData
(
arr
);
}
catch
(
error
)
{
next
(
error
)
}
}
module
.
exports
=
{
list
,
create
,
importExcel
,
deleteOne
,
updateOne
}
\ No newline at end of file
controller/agrInputRecordController.js
View file @
e467eeee
...
...
@@ -4,6 +4,7 @@
const
ExcelJS
=
require
(
'exceljs'
);
const
_
=
require
(
'lodash'
);
const
fs
=
require
(
'fs'
);
...
...
@@ -32,17 +33,37 @@ async function create(req, res, next) {
}
}
async
function
updateOne
(
req
,
res
,
next
)
{
try
{
let
updateInfo
=
{
...
req
.
body
,
}
let
ret
=
await
DB
.
AgrInputRecord
.
findOneAndUpdate
({
_id
:
req
.
body
.
_id
},
updateInfo
);
res
.
sendData
(
ret
);
}
catch
(
error
)
{
next
(
error
)
}
}
async
function
deleteOne
(
req
,
res
,
next
)
{
try
{
let
ret
=
await
DB
.
AgrInputRecord
.
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
();
console
.
log
(
req
.
file
)
await
workbook
.
xlsx
.
readFile
(
req
.
file
.
path
);
let
worksheet
=
workbook
.
getWorksheet
(
1
);
console
.
log
(
worksheet
.
actualRowCount
);
let
arr
=
[];
for
(
let
index
=
2
;
index
<
worksheet
.
actualRowCount
;
index
++
)
{
for
(
let
index
=
2
;
index
<
=
worksheet
.
actualRowCount
;
index
++
)
{
let
values
=
worksheet
.
getRow
(
index
).
values
;
let
obj
=
{
creator
:
req
.
user
.
_id
,
...
...
@@ -52,11 +73,17 @@ async function importExcel(req, res, next) {
type
:
values
[
4
],
total
:
values
[
5
],
unit
:
values
[
6
],
land
:
values
[
7
],
area
:
values
[
8
],
dosage
:
values
[
9
],
totalCost
:
values
[
7
],
dilutionRatio
:
values
[
8
],
waterConsumption
:
values
[
9
],
area
:
values
[
10
],
dosage
:
values
[
11
],
land
:
values
[
12
],
notes
:
values
[
13
],
}
if
(
obj
.
time
&&
obj
.
agrProName
)
{
arr
.
push
(
obj
)
}
arr
.
push
(
obj
)
}
if
(
arr
.
length
)
{
await
DB
.
AgrInputRecord
.
insertMany
(
arr
);
...
...
@@ -82,5 +109,7 @@ async function importExcel(req, res, next) {
module
.
exports
=
{
list
,
create
,
importExcel
importExcel
,
deleteOne
,
updateOne
}
\ No newline at end of file
controller/deviceController.js
View file @
e467eeee
...
...
@@ -15,6 +15,9 @@ async function list(req, res, next) {
if
(
req
.
body
.
name
)
{
search
.
name
=
{
$regex
:
req
.
body
.
name
};
}
if
(
req
.
body
.
deviceHQType
)
{
search
.
deviceHQType
=
req
.
body
.
deviceHQType
;
}
const
count
=
await
DB
.
Device
.
countDocuments
(
search
);
let
list
=
await
DB
.
Device
.
find
(
search
).
skip
(
skip
).
limit
(
pageSize
).
populate
({
path
:
"land"
}).
lean
().
exec
();
let
deviceNumbers
=
[];
...
...
db/index.js
View file @
e467eeee
...
...
@@ -5,7 +5,7 @@ const dbURI = sysConfig.dbURI || 'mongodb://localhost:27017/letian';
// 连接数据库
console
.
log
(
dbURI
,
"000-0-0-0-0-0-0"
)
mongoose
.
connect
(
dbURI
,
{
useNewUrlParser
:
true
,
useUnifiedTopology
:
true
})
mongoose
.
connect
(
dbURI
,
{
useNewUrlParser
:
true
,
useUnifiedTopology
:
true
})
.
then
(()
=>
console
.
log
(
'MongoDB Connected'
))
.
catch
(
err
=>
console
.
log
(
err
));
...
...
@@ -41,12 +41,14 @@ const FlowDefRelation = require('./models/systemFlowDefRelation');
const
Land
=
require
(
'./models/letianLand'
);
const
Zone
=
require
(
'./models/letianZone'
);
const
AgrInputRecord
=
require
(
'./models/letianAgrInputRecord'
);
const
AreaRecord
=
require
(
'./models/letianAreaRecord'
);
const
AgrInputDetail
=
require
(
'./models/letianAgrInputDetail'
);
const
AgrInputEmploy
=
require
(
'./models/letianAgrInputEmploy'
);
const
AgrInputOther
=
require
(
'./models/letianAgrInputOther'
);
const
AgrMatType
=
require
(
'./models/letianAgrMatType'
);
const
AgrMatApproval
=
require
(
'./models/letianAgrMatApproval'
);
const
AgrMatInOut
=
require
(
'./models/letianAgrMatInOut'
);
const
FileTemplate
=
require
(
'./models/letianFileTemplate'
);
const
AreaRecord
=
require
(
'./models/letianAreaRecord'
);
const
ExcelRecord
=
require
(
'./models/letianExcelRecord'
);
...
...
@@ -57,7 +59,6 @@ const CollectIPS = require('./models/collectIPS');
const
CollectIPSResult
=
require
(
'./models/collectIPSResult'
);
const
CollectIPSType
=
require
(
'./models/collectIPSType'
);
const
CollectIPSPlan
=
require
(
'./models/collectIPSPlan'
);
const
CollectWS
=
require
(
'./models/collectWS'
);
const
CollectAttribute
=
require
(
'./models/collectAttribute'
);
const
CollectThreshold
=
require
(
'./models/collectThreshold'
);
...
...
@@ -69,11 +70,9 @@ global.DB = {
User
,
Role
,
Menu
,
Device
,
Depart
,
Notice
,
FlowDef
,
FlowDefNode
,
FlowDefRelation
,
...
...
@@ -81,22 +80,24 @@ global.DB = {
Land
,
Zone
,
AgrInputRecord
,
AreaRecord
,
AgrInputDetail
,
AgrInputEmploy
,
AgrInputOther
,
AgrMatType
,
AgrMatApproval
,
AgrMatInOut
,
FileTemplate
,
AreaRecord
,
ExcelRecord
,
Device
,
CollectThreshold
,
CollectSMC
,
CollectIPS
,
CollectIPSResult
,
CollectIPSType
,
CollectIPSPlan
,
CollectAttribute
,
CollectWS
,
RequestLog
,
...
...
db/models/collectDevice.js
View file @
e467eeee
...
...
@@ -80,6 +80,10 @@ const deviceSchema = new Schema({
comment
:
"设备上次清洁时间"
,
get
:
v
=>
moment
(
v
).
format
(
"YYYY-MM-DD HH:mm:ss"
),
},
channel
:
{
type
:
Number
,
comment
:
"频道号"
},
/* -------------设备与地块的信息----------------- */
...
...
@@ -97,7 +101,7 @@ const deviceSchema = new Schema({
// },
deviceHQType
:
{
type
:
Number
,
comment
:
"用来获取数据的设备类型-(接口文档): 1.土壤温湿度、土壤氮磷钾, 2土壤ph、土壤电导率, 3 气象站, 4虫情"
,
comment
:
"用来获取数据的设备类型-(接口文档): 1.土壤温湿度、土壤氮磷钾, 2土壤ph、土壤电导率, 3 气象站, 4虫情
, 5摄像头
"
,
},
deviceDPType
:
{
type
:
Number
,
...
...
db/models/letianAgrInputDetail.js
0 → 100644
View file @
e467eeee
// 购买日期 产品名称 规格 单位 成分 购买数量 单位 单价(元) 合计金额(元) 总购买量 单位 代理商 备注
const
mongoose
=
require
(
'mongoose'
);
const
Schema
=
mongoose
.
Schema
;
const
moment
=
require
(
'moment'
);
/**
* 乐田 农资投入详情表
*/
const
letianAgrInputDetailSchema
=
new
Schema
({
time
:
{
type
:
Date
,
get
:
v
=>
moment
(
v
).
format
(
"YYYY-MM-DD HH:mm:ss"
),
comment
:
"购买日期"
,
},
name
:
{
type
:
String
,
commnet
:
"产品名称"
,
},
spec
:
{
type
:
String
,
commnet
:
"规格"
,
},
proUnit
:
{
type
:
String
,
comment
:
"单位"
},
component
:
{
type
:
String
,
comment
:
"成分"
},
buyNum
:
{
type
:
Number
,
comment
:
"购买数量"
},
buyUnti
:
{
type
:
String
,
comment
:
"单位"
},
unitPrice
:
{
type
:
Number
,
comment
:
"单价(元)"
},
totalAmount
:
{
type
:
Number
,
comment
:
"合计金额(元)"
},
totalBuyNum
:
{
type
:
Number
,
comment
:
"总购买量"
},
totalBuyUnit
:
{
type
:
String
,
comment
:
"单位"
},
agent
:
{
type
:
String
,
comment
:
"代理商"
},
notes
:
{
type
:
String
,
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:表示删除,若有其他隐藏业务 不要混用此字段。'
}
},
{
id
:
false
,
toJSON
:
{
getters
:
true
,
}
});
const
AgrInputDetail
=
mongoose
.
model
(
'letianAgrInputDetail'
,
letianAgrInputDetailSchema
,
'letianAgrInputDetail'
);
module
.
exports
=
AgrInputDetail
;
\ No newline at end of file
db/models/letianAgrInputEmploy.js
0 → 100644
View file @
e467eeee
const
mongoose
=
require
(
'mongoose'
);
const
Schema
=
mongoose
.
Schema
;
const
moment
=
require
(
'moment'
);
/**
* 乐田 农场其他投入品记录表
* 日期 类别/名称 规格 数量 单位 单价 税额 总额 代理商/厂家 备注
*/
const
letianAgrInputEmploySchema
=
new
Schema
({
time
:
{
type
:
Date
,
get
:
v
=>
moment
(
v
).
format
(
"YYYY-MM-DD HH:mm:ss"
),
comment
:
"日期"
,
},
name
:
{
type
:
String
,
commnet
:
"类别/名称"
,
},
spec
:
{
type
:
String
,
commnet
:
"规格"
,
},
buyNum
:
{
type
:
Number
,
comment
:
"数量"
},
unitPrice
:
{
type
:
Number
,
comment
:
"单价(元)"
},
taxAmount
:
{
type
:
Number
,
comment
:
"税额(元)"
},
totalAmount
:
{
type
:
Number
,
comment
:
"总额(元)"
},
agent
:
{
type
:
String
,
comment
:
"代理商/厂家"
},
notes
:
{
type
:
String
,
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:表示删除,若有其他隐藏业务 不要混用此字段。'
}
},
{
id
:
false
,
toJSON
:
{
getters
:
true
,
}
});
const
AgrInputEmploy
=
mongoose
.
model
(
'letianAgrInputEmploy'
,
letianAgrInputEmploySchema
,
'letianAgrInputEmploy'
);
module
.
exports
=
AgrInputEmploy
;
\ No newline at end of file
db/models/letianAgrInputOther.js
0 → 100644
View file @
e467eeee
const
mongoose
=
require
(
'mongoose'
);
const
Schema
=
mongoose
.
Schema
;
const
moment
=
require
(
'moment'
);
/**
* 乐田 农场其他投入品记录表
* 日期 类别/名称 规格 数量 单位 单价 税额 总额 代理商/厂家 备注
*/
const
letianAgrInputOtherSchema
=
new
Schema
({
time
:
{
type
:
Date
,
get
:
v
=>
moment
(
v
).
format
(
"YYYY-MM-DD HH:mm:ss"
),
comment
:
"日期"
,
},
name
:
{
type
:
String
,
commnet
:
"类别/名称"
,
},
spec
:
{
type
:
String
,
commnet
:
"规格"
,
},
buyNum
:
{
type
:
Number
,
comment
:
"数量"
},
unitPrice
:
{
type
:
Number
,
comment
:
"单价(元)"
},
taxAmount
:
{
type
:
Number
,
comment
:
"税额(元)"
},
totalAmount
:
{
type
:
Number
,
comment
:
"总额(元)"
},
agent
:
{
type
:
String
,
comment
:
"代理商/厂家"
},
notes
:
{
type
:
String
,
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:表示删除,若有其他隐藏业务 不要混用此字段。'
}
},
{
id
:
false
,
toJSON
:
{
getters
:
true
,
}
});
const
AgrInputOther
=
mongoose
.
model
(
'letianAgrInputOther'
,
letianAgrInputOtherSchema
,
'letianAgrInputOther'
);
module
.
exports
=
AgrInputOther
;
\ No newline at end of file
db/models/letianAgrInputRecord.js
View file @
e467eeee
...
...
@@ -3,7 +3,7 @@ const Schema = mongoose.Schema;
const
moment
=
require
(
'moment'
);
/**
* 乐田
农业投入品 出入库记录表 时间 生产投入品名称 投入品类别 总投入品使用数量 单位
* 乐田
生产投入品使用详情表
*/
const
letianAgrInputRecordSchema
=
new
Schema
({
...
...
@@ -32,19 +32,36 @@ const letianAgrInputRecordSchema = new Schema({
type
:
String
,
commnet
:
"单位"
,
},
land
:
{
totalCost
:
{
type
:
String
,
comment
:
"作业区"
comment
:
"总投入品成本(元)"
},
dilutionRatio
:
{
type
:
String
,
comment
:
"稀释倍数/倍"
},
waterConsumption
:
{
type
:
String
,
comment
:
"用水量"
},
area
:
{
type
:
String
,
comment
:
"面积/亩"
},
dosage
:
{
type
:
String
,
comment
:
"用量/亩"
},
land
:
{
type
:
String
,
comment
:
"作业区"
},
notes
:
{
type
:
String
,
comment
:
"备注"
},
...
...
router/agrRouter.js
View file @
e467eeee
...
...
@@ -3,11 +3,40 @@ const express = require('express');
const
router
=
express
.
Router
();
const
agrInputRecordController
=
require
(
'../controller/agrInputRecordController'
);
const
agrMatController
=
require
(
'../controller/agrMatController'
);
const
agrInputOtherController
=
require
(
'../controller/agrInputOtherController'
);
const
agrInputDetailController
=
require
(
'../controller/agrInputDetailController'
);
const
agrInputEmployController
=
require
(
'../controller/agrInputEmployController'
);
// excel采集信息上传 甲方要求
//1. 青皮柚农业投入品使用情况
router
.
post
(
'/input/list'
,
agrInputRecordController
.
list
);
// router.post('/update', fileController.update);
// router.post('/upload', fileController.list);
router
.
post
(
'/inputRecord/update'
,
agrInputRecordController
.
updateOne
);
router
.
post
(
'/inputRecord/delete'
,
agrInputRecordController
.
deleteOne
);
router
.
post
(
'/inputRecord/create'
,
agrInputRecordController
.
create
);
//2. 农场其他投入品使用情况
router
.
post
(
'/inputOther/list'
,
agrInputOtherController
.
list
);
router
.
post
(
'/inputOther/update'
,
agrInputOtherController
.
updateOne
);
router
.
post
(
'/inputOther/delete'
,
agrInputOtherController
.
deleteOne
);
router
.
post
(
'/inputOther/create'
,
agrInputOtherController
.
create
);
//3. 农资投入详情
router
.
post
(
'/inputDetail/list'
,
agrInputDetailController
.
list
);
router
.
post
(
'/inputDetail/update'
,
agrInputDetailController
.
updateOne
);
router
.
post
(
'/inputDetail/delete'
,
agrInputDetailController
.
deleteOne
);
router
.
post
(
'/inputDetail/create'
,
agrInputDetailController
.
create
);
//4. 用工明细
router
.
post
(
'/inputEmploy/list'
,
agrInputEmployController
.
list
);
router
.
post
(
'/inputEmploy/update'
,
agrInputEmployController
.
updateOne
);
router
.
post
(
'/inputEmploy/delete'
,
agrInputEmployController
.
deleteOne
);
router
.
post
(
'/inputEmploy/create'
,
agrInputEmployController
.
create
);
const
agrMatController
=
require
(
'../controller/agrMatController'
);
/**
* 农资
...
...
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