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
7d208afe
Commit
7d208afe
authored
Dec 07, 2021
by
季圣华
Browse files
优化进销存统计报表的查询速度
parent
e7d7666b
Changes
3
Hide whitespace changes
Inline
Side-by-side
jshERP-boot/docs/数据库更新记录-首次安装请勿使用.txt
View file @
7d208afe
...
...
@@ -1307,4 +1307,11 @@ where (ub.type='RoleFunctions') and r.tenant_id is not null;
alter table jsh_unit add other_unit_two varchar(50) DEFAULT NULL COMMENT '副单位2' after other_unit;
alter table jsh_unit add other_unit_three varchar(50) DEFAULT NULL COMMENT '副单位3' after other_unit_two;
alter table jsh_unit add ratio_two int(11) DEFAULT NULL COMMENT '比例2' after ratio;
alter table jsh_unit add ratio_three int(11) DEFAULT NULL COMMENT '比例3' after ratio_two;
\ No newline at end of file
alter table jsh_unit add ratio_three int(11) DEFAULT NULL COMMENT '比例3' after ratio_two;
-- --------------------------------------------------------
-- 时间 2021年12月07日
-- by jishenghua
-- 更新菜单名称-进货统计改为采购统计
-- --------------------------------------------------------
update jsh_function set name='采购统计' where name='进货统计';
\ No newline at end of file
jshERP-boot/src/main/java/com/jsh/erp/controller/DepotItemController.java
View file @
7d208afe
...
...
@@ -317,9 +317,10 @@ public class DepotItemController {
item
.
put
(
"materialColor"
,
diEx
.
getMColor
());
item
.
put
(
"unitName"
,
diEx
.
getMaterialUnit
());
BigDecimal
prevSum
=
depotItemService
.
getStockByParamWithDepotList
(
depotList
,
mId
,
null
,
timeA
);
BigDecimal
inSum
=
depotItemService
.
getInNumByParamWithDepotList
(
depotList
,
mId
,
timeA
,
timeB
);
BigDecimal
outSum
=
depotItemService
.
getOutNumByParamWithDepotList
(
depotList
,
mId
,
timeA
,
timeB
);
BigDecimal
thisSum
=
depotItemService
.
getStockByParamWithDepotList
(
depotList
,
mId
,
null
,
timeB
);
Map
<
String
,
BigDecimal
>
intervalMap
=
depotItemService
.
getIntervalMapByParamWithDepotList
(
depotList
,
mId
,
timeA
,
timeB
);
BigDecimal
inSum
=
intervalMap
.
get
(
"inSum"
);
BigDecimal
outSum
=
intervalMap
.
get
(
"outSum"
);
BigDecimal
thisSum
=
prevSum
.
add
(
inSum
).
subtract
(
outSum
);
item
.
put
(
"prevSum"
,
prevSum
);
item
.
put
(
"inSum"
,
inSum
);
item
.
put
(
"outSum"
,
outSum
);
...
...
@@ -426,6 +427,7 @@ public class DepotItemController {
BigDecimal
OutSum
=
depotItemService
.
buyOrSale
(
"出库"
,
"采购退货"
,
diEx
.
getMId
(),
monthTime
,
"number"
);
BigDecimal
InSumPrice
=
depotItemService
.
buyOrSale
(
"入库"
,
"采购"
,
diEx
.
getMId
(),
monthTime
,
"price"
);
BigDecimal
OutSumPrice
=
depotItemService
.
buyOrSale
(
"出库"
,
"采购退货"
,
diEx
.
getMId
(),
monthTime
,
"price"
);
BigDecimal
InOutSumPrice
=
InSumPrice
.
subtract
(
OutSumPrice
);
item
.
put
(
"barCode"
,
diEx
.
getBarCode
());
item
.
put
(
"materialName"
,
diEx
.
getMName
());
item
.
put
(
"materialModel"
,
diEx
.
getMModel
());
...
...
@@ -440,6 +442,7 @@ public class DepotItemController {
item
.
put
(
"outSum"
,
OutSum
);
item
.
put
(
"inSumPrice"
,
InSumPrice
);
item
.
put
(
"outSumPrice"
,
OutSumPrice
);
item
.
put
(
"inOutSumPrice"
,
InOutSumPrice
);
//实际采购金额
dataArray
.
add
(
item
);
}
}
...
...
jshERP-boot/src/main/java/com/jsh/erp/service/depotItem/DepotItemService.java
View file @
7d208afe
...
...
@@ -28,10 +28,7 @@ import org.springframework.transaction.annotation.Transactional;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletRequest
;
import
java.math.BigDecimal
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.*
;
@Service
public
class
DepotItemService
{
...
...
@@ -628,45 +625,41 @@ public class DepotItemService {
}
/**
*
入库
统计-多仓库
* 统计
时间段内的入库和出库数量
-多仓库
* @param depotList
* @param mId
* @param beginTime
* @param endTime
* @return
*/
public
BigDecimal
getInNumByParamWithDepotList
(
List
<
Long
>
depotList
,
Long
mId
,
String
beginTime
,
String
endTime
){
public
Map
<
String
,
BigDecimal
>
getIntervalMapByParamWithDepotList
(
List
<
Long
>
depotList
,
Long
mId
,
String
beginTime
,
String
endTime
){
Map
<
String
,
BigDecimal
>
intervalMap
=
new
HashMap
<>();
BigDecimal
inSum
=
BigDecimal
.
ZERO
;
BigDecimal
outSum
=
BigDecimal
.
ZERO
;
//盘点复盘后数量的变动
BigDecimal
stockCheckSum
=
depotItemMapperEx
.
getStockCheckSumByDepotList
(
depotList
,
mId
,
beginTime
,
endTime
);
DepotItemVo4Stock
stockObj
=
depotItemMapperEx
.
getStockByParamWithDepotList
(
depotList
,
mId
,
beginTime
,
endTime
);
BigDecimal
stockSum
=
BigDecimal
.
ZERO
;
if
(
stockObj
!=
null
)
{
BigDecimal
inTotal
=
stockObj
.
getInTotal
();
BigDecimal
transfInTotal
=
stockObj
.
getTransfInTotal
();
BigDecimal
assemInTotal
=
stockObj
.
getAssemInTotal
();
BigDecimal
disAssemInTotal
=
stockObj
.
getDisAssemInTotal
();
stockSum
=
inTotal
.
add
(
transfInTotal
).
add
(
assemInTotal
).
add
(
disAssemInTotal
);
}
return
stockSum
;
}
/**
* 出库统计-多仓库
* @param depotList
* @param mId
* @param beginTime
* @param endTime
* @return
*/
public
BigDecimal
getOutNumByParamWithDepotList
(
List
<
Long
>
depotList
,
Long
mId
,
String
beginTime
,
String
endTime
){
DepotItemVo4Stock
stockObj
=
depotItemMapperEx
.
getStockByParamWithDepotList
(
depotList
,
mId
,
beginTime
,
endTime
);
BigDecimal
stockSum
=
BigDecimal
.
ZERO
;
if
(
stockObj
!=
null
)
{
inSum
=
inTotal
.
add
(
transfInTotal
).
add
(
assemInTotal
).
add
(
disAssemInTotal
);
BigDecimal
outTotal
=
stockObj
.
getOutTotal
();
BigDecimal
transfOutTotal
=
stockObj
.
getTransfOutTotal
();
BigDecimal
assemOutTotal
=
stockObj
.
getAssemOutTotal
();
BigDecimal
disAssemOutTotal
=
stockObj
.
getDisAssemOutTotal
();
stock
Sum
=
outTotal
.
subtract
(
transfOutTotal
).
subtract
(
assemOutTotal
).
subtract
(
disAssemOutTotal
);
out
Sum
=
outTotal
.
subtract
(
transfOutTotal
).
subtract
(
assemOutTotal
).
subtract
(
disAssemOutTotal
);
}
return
stockSum
;
if
(
stockCheckSum
.
compareTo
(
BigDecimal
.
ZERO
)>
0
)
{
inSum
=
inSum
.
add
(
stockCheckSum
);
}
else
{
//盘点复盘数量为负数代表出库
outSum
=
outSum
.
subtract
(
stockCheckSum
);
}
intervalMap
.
put
(
"inSum"
,
inSum
);
intervalMap
.
put
(
"outSum"
,
outSum
);
return
intervalMap
;
}
/**
...
...
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