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
c9ac3d21
Commit
c9ac3d21
authored
Oct 31, 2021
by
季圣华
Browse files
优化库存预警报表的查询逻辑
parent
1698b1fd
Changes
3
Hide whitespace changes
Inline
Side-by-side
jshERP-boot/src/main/java/com/jsh/erp/controller/DepotItemController.java
View file @
c9ac3d21
...
...
@@ -554,6 +554,14 @@ public class DepotItemController {
diEx
.
setMOtherField3
(
disw
.
getMOtherField3
());
disw
.
setMaterialOther
(
getOtherInfo
(
mpArr
,
diEx
));
disw
.
setMaterialUnit
(
getUName
(
disw
.
getMaterialUnit
(),
disw
.
getUnitName
()));
if
(
disw
.
getCurrentNumber
().
compareTo
(
disw
.
getLowSafeStock
())<
0
)
{
disw
.
setLowCritical
(
disw
.
getLowSafeStock
().
subtract
(
disw
.
getCurrentNumber
()));
disw
.
setHighCritical
(
BigDecimal
.
ZERO
);
}
if
(
disw
.
getCurrentNumber
().
compareTo
(
disw
.
getHighSafeStock
())>
0
)
{
disw
.
setLowCritical
(
BigDecimal
.
ZERO
);
disw
.
setHighCritical
(
disw
.
getCurrentNumber
().
subtract
(
disw
.
getHighSafeStock
()));
}
}
}
int
total
=
depotItemService
.
findStockWarningCountTotal
(
materialParam
,
depotId
);
...
...
jshERP-boot/src/main/java/com/jsh/erp/datasource/vo/DepotItemStockWarningCount.java
View file @
c9ac3d21
...
...
@@ -31,11 +31,17 @@ public class DepotItemStockWarningCount {
private
String
MOtherField3
;
private
BigDecimal
safetystock
;
//安全库存量
private
String
depotName
;
private
BigDecimal
currentNumber
;
//库存
private
BigDecimal
currentNumber
;
private
BigDecimal
linjieNumber
;
//临界库存
private
BigDecimal
lowSafeStock
;
private
BigDecimal
highSafeStock
;
private
BigDecimal
lowCritical
;
private
BigDecimal
highCritical
;
public
Long
getMId
()
{
return
MId
;
...
...
@@ -141,12 +147,12 @@ public class DepotItemStockWarningCount {
this
.
MOtherField3
=
MOtherField3
;
}
public
BigDecimal
getSafetystock
()
{
return
safetystock
;
public
String
getDepotName
()
{
return
depotName
;
}
public
void
set
Safetystock
(
BigDecimal
safetystock
)
{
this
.
safetystock
=
safetystock
;
public
void
set
DepotName
(
String
depotName
)
{
this
.
depotName
=
depotName
;
}
public
BigDecimal
getCurrentNumber
()
{
...
...
@@ -157,11 +163,35 @@ public class DepotItemStockWarningCount {
this
.
currentNumber
=
currentNumber
;
}
public
BigDecimal
getLinjieNumber
()
{
return
linjieNumber
;
public
BigDecimal
getLowSafeStock
()
{
return
lowSafeStock
;
}
public
void
setLowSafeStock
(
BigDecimal
lowSafeStock
)
{
this
.
lowSafeStock
=
lowSafeStock
;
}
public
BigDecimal
getHighSafeStock
()
{
return
highSafeStock
;
}
public
void
setHighSafeStock
(
BigDecimal
highSafeStock
)
{
this
.
highSafeStock
=
highSafeStock
;
}
public
BigDecimal
getLowCritical
()
{
return
lowCritical
;
}
public
void
setLowCritical
(
BigDecimal
lowCritical
)
{
this
.
lowCritical
=
lowCritical
;
}
public
BigDecimal
getHighCritical
()
{
return
highCritical
;
}
public
void
set
LinjieNumber
(
BigDecimal
linjieNumber
)
{
this
.
linjieNumber
=
linjieNumber
;
public
void
set
HighCritical
(
BigDecimal
highCritical
)
{
this
.
highCritical
=
highCritical
;
}
}
jshERP-boot/src/main/resources/mapper_xml/DepotItemMapperEx.xml
View file @
c9ac3d21
...
...
@@ -67,9 +67,9 @@
<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=
"current_number"
jdbcType=
"DECIMAL"
property=
"currentNumber"
/>
<result
column=
"linjieNumber"
jdbcType=
"DECIMAL"
property=
"linjieNumber"
/>
<result
column=
"low_safe_stock"
jdbcType=
"DECIMAL"
property=
"lowSafeStock"
/>
<result
column=
"high_safe_stock"
jdbcType=
"DECIMAL"
property=
"highSafeStock"
/>
</resultMap>
<resultMap
id=
"stockMap"
type=
"com.jsh.erp.datasource.vo.DepotItemVo4Stock"
>
...
...
@@ -420,29 +420,28 @@
<select
id=
"findStockWarningCount"
parameterType=
"com.jsh.erp.datasource.entities.DepotItemExample"
resultMap=
"ResultStockWarningCount"
>
select m.id MId, m.name MName, me.bar_code, m.mfrs MMfrs, m.model MModel, m.standard MStandard,m.color MColor,
m.other_field1 MOtherField1,m.other_field2 MOtherField2,m.other_field3 MOtherField3,
m.unit MaterialUnit, u.name unit_name,mcs.current_number,
ifnull(mis.low_safe_stock,0) safetystock,
(
ifnull(mis.low_safe_stock,0)
-mcs.current_number) linjieNumber
m.other_field1 MOtherField1,m.other_field2 MOtherField2,m.other_field3 MOtherField3,
d.name depotName,
m.unit MaterialUnit, u.name unit_name,mcs.current_number,
ifnull(mis.low_safe_stock,0)
low_safe_stock, ifnull(mis.high_safe_stock,0) high_safe_stock
from jsh_material m
left join jsh_material_extend me on me.material_id=m.id and ifnull(me.delete_Flag,'0') !='1'
left join jsh_material_initial_stock mis on mis.material_id=m.id and ifnull(mis.delete_Flag,'0') !='1'
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'
left join jsh_depot d on d.id=mis.depot_id and ifnull(u.delete_flag,'0') !='1'
where 1=1
and me.default_flag=1
and ifnull(m.delete_flag,'0') !='1'
and ifnull(mis.low_safe_stock,0) > mcs.current_number
and mis.depot_id=mcs.depot_id
and (mcs.current_number
<
ifnull(mis.low_safe_stock,0) or mcs.current_number > ifnull(mis.high_safe_stock,0))
<if
test=
"materialParam != null and materialParam !=''"
>
<bind
name=
"bindKey"
value=
"'%'+materialParam+'%'"
/>
and (me.bar_code like #{bindKey} or m.name like #{bindKey} or m.standard like #{bindKey} or m.model like #{bindKey})
</if>
<if
test=
"depotId != null"
>
and m
c
s.depot_id= #{depotId}
and m
i
s.depot_id= #{depotId}
</if>
group by m.id,m.name, m.model, m.unit, m.color, u.name
order by linjieNumber desc
order by depotName asc
<if
test=
"offset != null and rows != null"
>
limit #{offset},#{rows}
</if>
...
...
@@ -455,21 +454,21 @@
left join jsh_material_extend me on me.material_id=m.id and ifnull(me.delete_Flag,'0') !='1'
left join jsh_material_initial_stock mis on mis.material_id=m.id and ifnull(mis.delete_Flag,'0') !='1'
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'
left join jsh_depot d on d.id=mis.depot_id and ifnull(u.delete_flag,'0') !='1'
where 1=1
and me.default_flag=1
and ifnull(m.delete_flag,'0') !='1'
and ifnull(mis.low_safe_stock,0) > mcs.current_number
and mis.depot_id=mcs.depot_id
and (mcs.current_number
<
ifnull(mis.low_safe_stock,0) or mcs.current_number > ifnull(mis.high_safe_stock,0))
<if
test=
"materialParam != null and materialParam !=''"
>
<bind
name=
"bindKey"
value=
"'%'+materialParam+'%'"
/>
and (me.bar_code like #{bindKey} or m.name like #{bindKey} or m.standard like #{bindKey} or m.model like #{bindKey})
</if>
<if
test=
"depotId != null"
>
and m
c
s.depot_id= #{depotId}
and m
i
s.depot_id= #{depotId}
</if>
group by m.id,m.name, m.model, m.unit, m.color, u.name
) tb
) tb
</select>
<select
id=
"getFinishNumber"
resultType=
"java.math.BigDecimal"
>
...
...
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