Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
JSH ERP
Commits
8d85df5d
Commit
8d85df5d
authored
Dec 27, 2020
by
季圣华
Browse files
优化库存预警报表
parent
c4db0705
Changes
4
Hide whitespace changes
Inline
Side-by-side
erp_web/pages/reports/stock_warning_report.html
View file @
8d85df5d
...
...
@@ -202,16 +202,14 @@
pageSize
:
10
,
pageList
:
[
10
,
50
,
100
],
columns
:
[[
{
title
:
'
名称
'
,
field
:
'
m
aterialN
ame
'
,
width
:
160
},
{
title
:
'
规格
'
,
field
:
'
m
aterialS
tandard
'
,
width
:
80
},
{
title
:
'
型号
'
,
field
:
'
m
aterialM
odel
'
,
width
:
80
},
{
title
:
'
名称
'
,
field
:
'
m
n
ame
'
,
width
:
160
},
{
title
:
'
规格
'
,
field
:
'
m
s
tandard
'
,
width
:
80
},
{
title
:
'
型号
'
,
field
:
'
m
m
odel
'
,
width
:
80
},
{
title
:
'
扩展信息
'
,
field
:
'
materialOther
'
,
width
:
150
},
{
title
:
'
单位
'
,
field
:
'
materialUnit
'
,
width
:
80
},
{
title
:
'
入库数量
'
,
field
:
'
basicInNumber
'
,
width
:
80
},
{
title
:
'
出库数量
'
,
field
:
'
basicOutNumber
'
,
width
:
80
},
{
title
:
'
库存数量
'
,
field
:
'
basicNumber
'
,
width
:
80
},
{
title
:
'
安全库存量
'
,
field
:
'
safetystock
'
,
width
:
80
},
{
title
:
'
临界库存量
'
,
field
:
'
basicLinjieNumber
'
,
width
:
80
}
{
title
:
'
安全存量
'
,
field
:
'
safetystock
'
,
width
:
80
},
{
title
:
'
当前库存
'
,
field
:
'
currentNumber
'
,
width
:
80
},
{
title
:
'
建议入库量
'
,
field
:
'
linjieNumber
'
,
width
:
80
}
]],
onLoadError
:
function
()
{
$
.
messager
.
alert
(
'
页面加载提示
'
,
'
页面加载异常,请稍后再试!
'
,
'
error
'
);
...
...
src/main/java/com/jsh/erp/controller/DepotItemController.java
View file @
8d85df5d
...
...
@@ -591,6 +591,7 @@ public class DepotItemController {
diEx
.
setMOtherField2
(
disw
.
getMOtherField2
());
diEx
.
setMOtherField3
(
disw
.
getMOtherField3
());
disw
.
setMaterialOther
(
getOtherInfo
(
mpArr
,
diEx
));
disw
.
setMaterialUnit
(
getUName
(
disw
.
getMaterialUnit
(),
disw
.
getUnitName
()));
}
}
int
total
=
depotItemService
.
findStockWarningCountTotal
(
pid
);
...
...
@@ -628,7 +629,7 @@ public class DepotItemController {
List
<
DepotItemStockWarningCount
>
dataList
=
depotItemService
.
findStockWarningCount
((
currentPage
-
1
)
*
pageSize
,
pageSize
,
projectId
);
//存放数据json数组
Integer
pid
=
projectId
;
String
[]
names
=
{
"名称"
,
"规格"
,
"型号"
,
"扩展信息"
,
"单位"
,
"
入库数量"
,
"出库数量"
,
"库存数
量"
,
"
安全
库存
量
"
,
"
临界库存
量"
};
String
[]
names
=
{
"名称"
,
"规格"
,
"型号"
,
"扩展信息"
,
"单位"
,
"
安全存
量"
,
"
当前
库存"
,
"
建议入库
量"
};
String
title
=
"库存预警报表"
;
List
<
String
[]>
objects
=
new
ArrayList
<
String
[]>();
if
(
null
!=
dataList
)
{
...
...
@@ -639,17 +640,16 @@ public class DepotItemController {
diVI
.
setMOtherField2
(
diEx
.
getMOtherField2
());
diVI
.
setMOtherField3
(
diEx
.
getMOtherField3
());
String
materialOther
=
getOtherInfo
(
mpArr
,
diVI
);
String
[]
objs
=
new
String
[
10
];
objs
[
0
]
=
diEx
.
getMaterialName
();
objs
[
1
]
=
diEx
.
getMaterialStandard
();
objs
[
2
]
=
diEx
.
getMaterialModel
();
String
unitName
=
getUName
(
diEx
.
getMaterialUnit
(),
diEx
.
getUnitName
());
String
[]
objs
=
new
String
[
8
];
objs
[
0
]
=
diEx
.
getMName
();
objs
[
1
]
=
diEx
.
getMStandard
();
objs
[
2
]
=
diEx
.
getMModel
();
objs
[
3
]
=
materialOther
;
objs
[
4
]
=
diEx
.
getMaterialUnit
();
objs
[
5
]
=
diEx
.
getBasicInNumber
().
toString
();
objs
[
6
]
=
diEx
.
getBasicOutNumber
()
==
null
?
"0"
:
diEx
.
getBasicOutNumber
().
toString
();
objs
[
7
]
=
diEx
.
getBasicNumber
()
==
null
?
"0"
:
diEx
.
getBasicNumber
().
toString
();
objs
[
8
]
=
diEx
.
getSafetystock
()
==
null
?
"0"
:
diEx
.
getSafetystock
().
toString
();
objs
[
9
]
=
diEx
.
getBasicLinjieNumber
()
==
null
?
"0"
:
diEx
.
getBasicLinjieNumber
().
toString
();
objs
[
4
]
=
unitName
;
objs
[
5
]
=
diEx
.
getSafetystock
()
==
null
?
"0"
:
diEx
.
getSafetystock
().
toString
();
objs
[
6
]
=
diEx
.
getCurrentNumber
()
==
null
?
"0"
:
diEx
.
getCurrentNumber
().
toString
();
objs
[
7
]
=
diEx
.
getLinjieNumber
()
==
null
?
"0"
:
diEx
.
getLinjieNumber
().
toString
();
objects
.
add
(
objs
);
}
}
...
...
src/main/java/com/jsh/erp/datasource/vo/DepotItemStockWarningCount.java
View file @
8d85df5d
...
...
@@ -5,15 +5,21 @@ import java.math.BigDecimal;
public
class
DepotItemStockWarningCount
{
private
String
MaterialName
;
private
Long
MId
;
private
String
M
aterialModel
;
private
String
M
Name
;
private
String
MaterialStandard
;
private
String
MModel
;
private
String
MaterialUnit
;
private
String
MColor
;
private
String
MStandard
;
private
String
MMfrs
;
private
String
category
Name
;
private
String
unit
Name
;
private
String
MaterialOther
;
...
...
@@ -23,41 +29,58 @@ public class DepotItemStockWarningCount {
private
String
MOtherField3
;
private
String
MaterialUnit
;
private
BigDecimal
safetystock
;
//安全库存量
private
BigDecimal
BasicInNumber
;
//入库量
private
BigDecimal
currentNumber
;
//库存
private
BigDecimal
linjieNumber
;
//临界库存
public
Long
getMId
()
{
return
MId
;
}
private
BigDecimal
BasicOutNumber
;
//出库量
public
void
setMId
(
Long
MId
)
{
this
.
MId
=
MId
;
}
public
String
getMName
()
{
return
MName
;
}
private
BigDecimal
BasicNumber
;
//库存
public
void
setMName
(
String
MName
)
{
this
.
MName
=
MName
;
}
private
BigDecimal
BasicLinjieNumber
;
//临界库存
public
String
getMModel
()
{
return
MModel
;
}
public
String
getMaterialName
(
)
{
return
MaterialName
;
public
void
setMModel
(
String
MModel
)
{
this
.
MModel
=
MModel
;
}
public
void
s
etMaterial
Name
(
String
materialName
)
{
MaterialName
=
m
aterial
Name
;
public
String
g
etMaterial
Unit
(
)
{
return
M
aterial
Unit
;
}
public
String
g
etMaterial
Model
(
)
{
return
M
aterial
Model
;
public
void
s
etMaterial
Unit
(
String
materialUnit
)
{
MaterialUnit
=
m
aterial
Unit
;
}
public
void
setMaterialModel
(
String
materialModel
)
{
MaterialModel
=
materialModel
;
public
String
getMColor
(
)
{
return
MColor
;
}
public
String
getMaterialStandard
(
)
{
return
MaterialStandard
;
public
void
setMColor
(
String
MColor
)
{
this
.
MColor
=
MColor
;
}
public
void
setMaterialStandard
(
String
materialStandard
)
{
MaterialStandard
=
materialStandard
;
public
String
getMStandard
()
{
return
MStandard
;
}
public
void
setMStandard
(
String
MStandard
)
{
this
.
MStandard
=
MStandard
;
}
public
String
getMMfrs
()
{
...
...
@@ -68,12 +91,12 @@ public class DepotItemStockWarningCount {
this
.
MMfrs
=
MMfrs
;
}
public
String
get
Category
Name
()
{
return
category
Name
;
public
String
get
Unit
Name
()
{
return
unit
Name
;
}
public
void
set
Category
Name
(
String
category
Name
)
{
this
.
categoryName
=
category
Name
;
public
void
set
Unit
Name
(
String
unit
Name
)
{
this
.
unitName
=
unit
Name
;
}
public
String
getMaterialOther
()
{
...
...
@@ -108,14 +131,6 @@ public class DepotItemStockWarningCount {
this
.
MOtherField3
=
MOtherField3
;
}
public
String
getMaterialUnit
()
{
return
MaterialUnit
;
}
public
void
setMaterialUnit
(
String
materialUnit
)
{
MaterialUnit
=
materialUnit
;
}
public
BigDecimal
getSafetystock
()
{
return
safetystock
;
}
...
...
@@ -124,35 +139,19 @@ public class DepotItemStockWarningCount {
this
.
safetystock
=
safetystock
;
}
public
BigDecimal
getBasicInNumber
()
{
return
BasicInNumber
;
}
public
void
setBasicInNumber
(
BigDecimal
basicInNumber
)
{
BasicInNumber
=
basicInNumber
;
}
public
BigDecimal
getBasicOutNumber
()
{
return
BasicOutNumber
;
}
public
void
setBasicOutNumber
(
BigDecimal
basicOutNumber
)
{
BasicOutNumber
=
basicOutNumber
;
}
public
BigDecimal
getBasicNumber
()
{
return
BasicNumber
;
public
BigDecimal
getCurrentNumber
()
{
return
currentNumber
;
}
public
void
set
Basic
Number
(
BigDecimal
basic
Number
)
{
Basic
Number
=
basic
Number
;
public
void
set
Current
Number
(
BigDecimal
current
Number
)
{
this
.
current
Number
=
current
Number
;
}
public
BigDecimal
get
Basic
LinjieNumber
()
{
return
BasicL
injieNumber
;
public
BigDecimal
getLinjieNumber
()
{
return
l
injieNumber
;
}
public
void
set
Basic
LinjieNumber
(
BigDecimal
basicL
injieNumber
)
{
BasicL
injieNumber
=
basicL
injieNumber
;
public
void
setLinjieNumber
(
BigDecimal
l
injieNumber
)
{
this
.
l
injieNumber
=
l
injieNumber
;
}
}
src/main/resources/mapper_xml/DepotItemMapperEx.xml
View file @
8d85df5d
...
...
@@ -50,20 +50,19 @@
</resultMap>
<resultMap
id=
"ResultStockWarningCount"
type=
"com.jsh.erp.datasource.vo.DepotItemStockWarningCount"
>
<result
column=
"MaterialName"
jdbcType=
"VARCHAR"
property=
"MaterialName"
/>
<result
column=
"MaterialModel"
jdbcType=
"VARCHAR"
property=
"MaterialModel"
/>
<result
column=
"MaterialStandard"
jdbcType=
"VARCHAR"
property=
"MaterialStandard"
/>
<result
column=
"MId"
jdbcType=
"VARCHAR"
property=
"MId"
/>
<result
column=
"MName"
jdbcType=
"VARCHAR"
property=
"MName"
/>
<result
column=
"MMfrs"
jdbcType=
"VARCHAR"
property=
"MMfrs"
/>
<result
column=
"categoryName"
jdbcType=
"VARCHAR"
property=
"categoryName"
/>
<result
column=
"MModel"
jdbcType=
"VARCHAR"
property=
"MModel"
/>
<result
column=
"MStandard"
jdbcType=
"VARCHAR"
property=
"MStandard"
/>
<result
column=
"MaterialUnit"
jdbcType=
"VARCHAR"
property=
"MaterialUnit"
/>
<result
column=
"MOtherField1"
jdbcType=
"VARCHAR"
property=
"MOtherField1"
/>
<result
column=
"MOtherField2"
jdbcType=
"VARCHAR"
property=
"MOtherField2"
/>
<result
column=
"MOtherField3"
jdbcType=
"VARCHAR"
property=
"MOtherField3"
/>
<result
column=
"unit_name"
jdbcType=
"VARCHAR"
property=
"unitName"
/>
<result
column=
"safetystock"
jdbcType=
"DECIMAL"
property=
"safetystock"
/>
<result
column=
"BasicInNumber"
jdbcType=
"DECIMAL"
property=
"BasicInNumber"
/>
<result
column=
"BasicOutNumber"
jdbcType=
"DECIMAL"
property=
"BasicOutNumber"
/>
<result
column=
"BasicNumber"
jdbcType=
"DECIMAL"
property=
"BasicNumber"
/>
<result
column=
"BasicLinjieNumber"
jdbcType=
"DECIMAL"
property=
"BasicLinjieNumber"
/>
<result
column=
"current_number"
jdbcType=
"DECIMAL"
property=
"currentNumber"
/>
<result
column=
"linjieNumber"
jdbcType=
"DECIMAL"
property=
"linjieNumber"
/>
</resultMap>
<resultMap
id=
"StockMap"
type=
"com.jsh.erp.datasource.vo.DepotItemVo4Stock"
>
...
...
@@ -372,61 +371,23 @@
</select>
<select
id=
"findStockWarningCount"
parameterType=
"com.jsh.erp.datasource.entities.DepotItemExample"
resultMap=
"ResultStockWarningCount"
>
SELECT
m.name MaterialName,
m.model MaterialModel,
m.standard MaterialStandard,
m.mfrs MMfrs,
select m.id MId, m.name MName, m.mfrs MMfrs, m.model MModel, m.standard MStandard,m.color MColor,
m.other_field1 MOtherField1,m.other_field2 MOtherField2,m.other_field3 MOtherField3,
mc.`Name` categoryName,
m.unit MaterialUnit,
ifnull(m.safety_stock,0) safetystock,
IFNULL(intype.BasicInNumber ,0) BasicInNumber,
IFNULL(outtype.BasicOutNumber ,0) BasicOutNumber,
(
IFNULL(intype.BasicInNumber ,0) - IFNULL(outtype.BasicOutNumber ,0)
) BasicNumber,
(IFNULL(intype.BasicInNumber ,0) - IFNULL(outtype.BasicOutNumber ,0) - ifnull(m.safety_stock,0)) BasicLinjieNumber
FROM
jsh_material m
LEFT JOIN jsh_material_category mc ON mc.id = m.category_id
LEFT JOIN (
SELECT
di.material_id,
ifnull(sum(basic_number), 0) AS BasicInNumber
FROM
jsh_depot_head dh
INNER JOIN jsh_depot_item di ON dh.id = di.header_id
AND ifnull(di.delete_flag, '0') != '1'
WHERE
dh.type = '入库'
<if
test=
"pid != null"
>
and di.depot_id= ${pid}
</if>
AND ifnull(dh.delete_flag, '0') != '1' group by di.material_id
) intype ON intype.material_id = m.id
LEFT JOIN (
SELECT
di.material_id,
ifnull(sum(basic_number), 0) AS BasicOutNumber
FROM
jsh_depot_head dh
INNER JOIN jsh_depot_item di ON dh.id = di.header_id
AND ifnull(di.delete_flag, '0') != '1'
WHERE
dh.type = '出库'
AND dh.sub_type != '调拨'
m.unit MaterialUnit, u.name unit_name,mcs.current_number,ifnull(m.safety_stock,0) safetystock,
(ifnull(m.safety_stock,0)-mcs.current_number) linjieNumber
from jsh_material m
left join jsh_material_current_stock mcs on mcs.material_id=m.id and ifnull(mcs.delete_Flag,'0') !='1'
left join jsh_depot_item di on di.material_id=m.id and ifnull(di.delete_Flag,'0') !='1'
left join jsh_depot_head dh on di.header_id=dh.id and ifnull(dh.delete_flag,'0') !='1'
left join jsh_unit u on m.unit_id=u.id and ifnull(u.delete_Flag,'0') !='1'
where 1=1
and ifnull(m.delete_flag,'0') !='1'
and ifnull(m.safety_stock,0) > mcs.current_number
<if
test=
"pid != null"
>
and
di
.depot_id= ${pid}
and
mcs
.depot_id= ${pid}
</if>
AND ifnull(dh.delete_flag, '0') != '1' group by di.material_id
) outtype ON outtype.material_id = m.id
WHERE
1 = 1
AND ifnull(m.delete_flag, '0') != '1'
AND intype.BasicInNumber > 0
ORDER BY
(IFNULL(intype.BasicInNumber ,0) - IFNULL(outtype.BasicOutNumber ,0) - ifnull(m.safety_stock,0))
group by m.id,m.name, m.model, m.unit, m.color, u.name
order by linjieNumber desc
<if
test=
"offset != null and rows != null"
>
limit #{offset},#{rows}
</if>
...
...
@@ -434,26 +395,18 @@
<select
id=
"findStockWarningCountTotal"
resultType=
"java.lang.Integer"
>
select count(1) from
jsh_material m
LEFT JOIN (
SELECT
di.material_id,
ifnull(sum(basic_number), 0) AS BasicInNumber
FROM
jsh_depot_head dh
INNER JOIN jsh_depot_item di ON dh.id = di.header_id
AND ifnull(di.delete_flag, '0') != '1'
WHERE
dh.type = '入库'
(select m.id
from jsh_material m
left join jsh_material_current_stock mcs on mcs.material_id=m.id and ifnull(mcs.delete_Flag,'0') !='1'
left join jsh_depot_item di on di.material_id=m.id and ifnull(di.delete_Flag,'0') !='1'
left join jsh_depot_head dh on di.header_id=dh.id and ifnull(dh.delete_flag,'0') !='1'
left join jsh_unit u on m.unit_id=u.id and ifnull(u.delete_Flag,'0') !='1'
where 1=1
and ifnull(m.delete_flag,'0') !='1'
and ifnull(m.safety_stock,0) > mcs.current_number
<if
test=
"pid != null"
>
and
di
.depot_id= ${pid}
and
mcs
.depot_id= ${pid}
</if>
AND ifnull(dh.delete_flag, '0') != '1' group by di.material_id
) intype ON intype.material_id = m.id
WHERE
1 = 1
AND ifnull(m.delete_Flag, '0') != '1'
AND intype.BasicInNumber > 0
group by m.id,m.name, m.model, m.unit, m.color, u.name) tb
</select>
</mapper>
Write
Preview
Supports
Markdown
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