增加明细和汇总的接口

This commit is contained in:
jishenghua
2024-04-07 00:33:42 +08:00
parent 4f8524e688
commit 822eca0cdf
4 changed files with 283 additions and 5 deletions

View File

@@ -135,11 +135,13 @@ public class DepotHeadController {
map.put("total", total);
//存放数据json数组
if (null != list) {
for (DepotHeadVo4InDetail dhd : list) {
resList.add(dhd);
}
resList.addAll(list);
}
map.put("rows", resList);
DepotHeadVo4InDetail statistic = depotHeadService.findInOutDetailStatistic(beginTime, endTime, type, creatorArray, organArray, forceFlag, inOutManageFlag,
StringUtil.toNull(materialParam), depotList, oId, StringUtil.toNull(number), creator, remark);
map.put("operNumberTotal", statistic.getOperNumber());
map.put("allPriceTotal", statistic.getAllPrice());
res.code = 200;
res.data = map;
} catch(Exception e){
@@ -151,7 +153,7 @@ public class DepotHeadController {
}
/**
* 入库出库统计接口
* 入库出库汇总接口
* @param currentPage
* @param pageSize
* @param oId
@@ -164,7 +166,7 @@ public class DepotHeadController {
* @return
*/
@GetMapping(value = "/findInOutMaterialCount")
@ApiOperation(value = "入库出库统计接口")
@ApiOperation(value = "入库出库汇总接口")
public BaseResponseInfo findInOutMaterialCount(@RequestParam("currentPage") Integer currentPage,
@RequestParam("pageSize") Integer pageSize,
@RequestParam(value = "organId", required = false) Integer oId,
@@ -202,6 +204,10 @@ public class DepotHeadController {
StringUtil.toNull(materialParam), depotList, organizationId, oId);
map.put("total", total);
map.put("rows", list);
DepotHeadVo4InOutMCount statistic = depotHeadService.findInOutMaterialCountStatistic(beginTime, endTime, type, forceFlag, inOutManageFlag,
StringUtil.toNull(materialParam), depotList, organizationId, oId);
map.put("numSumTotal", statistic.getNumSum());
map.put("priceSumTotal", statistic.getPriceSum());
res.code = 200;
res.data = map;
} catch(Exception e){
@@ -281,6 +287,10 @@ public class DepotHeadController {
creatorArray, forceFlag, StringUtil.toNull(materialParam), depotList, depotFList, remark);
map.put("rows", list);
map.put("total", total);
DepotHeadVo4InDetail statistic = depotHeadService.findAllocationStatistic(beginTime, endTime, subType, StringUtil.toNull(number),
creatorArray, forceFlag, StringUtil.toNull(materialParam), depotList, depotFList, remark);
map.put("operNumberTotal", statistic.getOperNumber());
map.put("allPriceTotal", statistic.getAllPrice());
res.code = 200;
res.data = map;
} catch(Exception e){

View File

@@ -97,6 +97,21 @@ public interface DepotHeadMapperEx {
@Param("creator") Long creator,
@Param("remark") String remark);
List<DepotHeadVo4InDetail> findInOutDetailStatistic(
@Param("beginTime") String beginTime,
@Param("endTime") String endTime,
@Param("type") String type,
@Param("creatorArray") String[] creatorArray,
@Param("organArray") String[] organArray,
@Param("forceFlag") Boolean forceFlag,
@Param("inOutManageFlag") Boolean inOutManageFlag,
@Param("materialParam") String materialParam,
@Param("depotList") List<Long> depotList,
@Param("oId") Integer oId,
@Param("number") String number,
@Param("creator") Long creator,
@Param("remark") String remark);
List<DepotHeadVo4InOutMCount> findInOutMaterialCount(
@Param("beginTime") String beginTime,
@Param("endTime") String endTime,
@@ -125,6 +140,18 @@ public interface DepotHeadMapperEx {
@Param("creatorArray") String[] creatorArray,
@Param("organArray") String[] organArray);
List<DepotHeadVo4InOutMCount> findInOutMaterialCountStatistic(
@Param("beginTime") String beginTime,
@Param("endTime") String endTime,
@Param("type") String type,
@Param("forceFlag") Boolean forceFlag,
@Param("inOutManageFlag") Boolean inOutManageFlag,
@Param("materialParam") String materialParam,
@Param("depotList") List<Long> depotList,
@Param("oId") Integer oId,
@Param("creatorArray") String[] creatorArray,
@Param("organArray") String[] organArray);
List<DepotHeadVo4InDetail> findAllocationDetail(
@Param("beginTime") String beginTime,
@Param("endTime") String endTime,
@@ -153,6 +180,18 @@ public interface DepotHeadMapperEx {
@Param("depotFList") List<Long> depotFList,
@Param("remark") String remark);
List<DepotHeadVo4InDetail> findAllocationStatistic(
@Param("beginTime") String beginTime,
@Param("endTime") String endTime,
@Param("subType") String subType,
@Param("number") String number,
@Param("creatorArray") String[] creatorArray,
@Param("forceFlag") Boolean forceFlag,
@Param("materialParam") String materialParam,
@Param("depotList") List<Long> depotList,
@Param("depotFList") List<Long> depotFList,
@Param("remark") String remark);
List<DepotHeadVo4StatementAccount> getStatementAccount(
@Param("beginTime") String beginTime,
@Param("endTime") String endTime,

View File

@@ -701,6 +701,24 @@ public class DepotHeadService {
return result;
}
public DepotHeadVo4InDetail findInOutDetailStatistic(String beginTime, String endTime, String type, String [] creatorArray,
String [] organArray, Boolean forceFlag, Boolean inOutManageFlag,
String materialParam, List<Long> depotList, Integer oId, String number,
Long creator, String remark) throws Exception{
DepotHeadVo4InDetail item = new DepotHeadVo4InDetail();
try{
List<DepotHeadVo4InDetail> list =depotHeadMapperEx.findInOutDetailStatistic(beginTime, endTime, type, creatorArray, organArray, forceFlag, inOutManageFlag,
materialParam, depotList, oId, number, creator, remark);
if(list.size()>0) {
item.setOperNumber(list.get(0).getOperNumber());
item.setAllPrice(list.get(0).getAllPrice());
}
}catch(Exception e){
JshException.readFail(logger, e);
}
return item;
}
public List<DepotHeadVo4InOutMCount> findInOutMaterialCount(String beginTime, String endTime, String type,
Boolean forceFlag, Boolean inOutManageFlag, String materialParam,
List<Long> depotList, Long organizationId, Integer oId, String column, String order,
@@ -740,6 +758,29 @@ public class DepotHeadService {
return result;
}
public DepotHeadVo4InOutMCount findInOutMaterialCountStatistic(String beginTime, String endTime, String type,
Boolean forceFlag, Boolean inOutManageFlag, String materialParam,
List<Long> depotList, Long organizationId, Integer oId) throws Exception {
DepotHeadVo4InOutMCount item = new DepotHeadVo4InOutMCount();
try{
String [] creatorArray = getCreatorArray();
if(creatorArray == null && organizationId != null) {
creatorArray = getCreatorArrayByOrg(organizationId);
}
String subType = "出库".equals(type)? "销售" : "";
String [] organArray = getOrganArray(subType, "");
List<DepotHeadVo4InOutMCount> list = depotHeadMapperEx.findInOutMaterialCountStatistic(beginTime, endTime, type,
forceFlag, inOutManageFlag, materialParam, depotList, oId, creatorArray, organArray);
if(list.size()>0) {
item.setNumSum(list.get(0).getNumSum());
item.setPriceSum(list.get(0).getPriceSum());
}
}catch(Exception e){
JshException.readFail(logger, e);
}
return item;
}
public List<DepotHeadVo4InDetail> findAllocationDetail(String beginTime, String endTime, String subType, String number,
String [] creatorArray, Boolean forceFlag, String materialParam, List<Long> depotList, List<Long> depotFList,
String remark, String column, String order, Integer offset, Integer rows) throws Exception{
@@ -766,6 +807,23 @@ public class DepotHeadService {
return result;
}
public DepotHeadVo4InDetail findAllocationStatistic(String beginTime, String endTime, String subType, String number,
String [] creatorArray, Boolean forceFlag, String materialParam, List<Long> depotList, List<Long> depotFList,
String remark) throws Exception{
DepotHeadVo4InDetail item = new DepotHeadVo4InDetail();
try{
List<DepotHeadVo4InDetail> list =depotHeadMapperEx.findAllocationStatistic(beginTime, endTime, subType, number, creatorArray, forceFlag,
materialParam, depotList, depotFList, remark);
if(list.size()>0) {
item.setOperNumber(list.get(0).getOperNumber());
item.setAllPrice(list.get(0).getAllPrice());
}
}catch(Exception e){
JshException.readFail(logger, e);
}
return item;
}
public List<DepotHeadVo4StatementAccount> getStatementAccount(String beginTime, String endTime, Integer organId, String [] organArray,
String supplierType, String type, String subType, String typeBack, String subTypeBack, String billType, Integer offset, Integer rows) {
List<DepotHeadVo4StatementAccount> list = null;

View File

@@ -416,6 +416,66 @@
and ifnull(dh.delete_flag,'0') !='1'
</select>
<select id="findInOutDetailStatistic" parameterType="com.jsh.erp.datasource.entities.DepotItemExample" resultMap="ResultWithInfoExMap">
select sum(di.oper_number) operNumber, sum(di.all_price) allPrice
from jsh_depot_head dh
left join jsh_depot_item di on di.header_id=dh.id and ifnull(di.delete_flag,'0') !='1'
left join jsh_material m on m.id=di.material_id and ifnull(m.delete_flag,'0') !='1'
left join jsh_material_extend me on me.id=di.material_extend_id and ifnull(me.delete_Flag,'0') !='1'
left join jsh_supplier s on s.id=dh.organ_id and ifnull(s.delete_Flag,'0') !='1'
left join (select id,name as dName,delete_Flag from jsh_depot ) d on d.id=di.depot_id and ifnull(d.delete_Flag,'0') !='1'
where dh.oper_time >=#{beginTime} and dh.oper_time &lt;=#{endTime}
<if test="oId != null">
and dh.organ_id = #{oId}
</if>
<if test="depotList.size()>0">
and di.depot_id in
<foreach collection="depotList" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</if>
<if test="type != null">
and dh.type=#{type}
</if>
<if test="inOutManageFlag">
and (dh.sub_type!='采购' and dh.sub_type!='采购退货' and dh.sub_type!='销售' and dh.sub_type!='销售退货')
</if>
<if test="creatorArray != null">
and dh.creator in (
<foreach collection="creatorArray" item="creator" separator=",">
#{creator}
</foreach>
)
</if>
<if test="organArray != null and organArray !=''">
and (dh.organ_id in (
<foreach collection="organArray" item="organId" separator=",">
#{organId}
</foreach>
) or dh.sub_type='采购退货' or dh.sub_type='零售' or dh.sub_type='其它')
</if>
<if test="forceFlag">
and dh.status = '1'
</if>
<if test="number != null and number !=''">
<bind name="bindNumber" value="'%'+number+'%'"/>
and dh.number like #{bindNumber}
</if>
<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="creator != null">
and dh.creator=#{creator}
</if>
<if test="remark != null and remark !=''">
<bind name="bindRemark" value="'%'+remark+'%'"/>
and (dh.remark like #{bindRemark} or di.remark like #{bindRemark})
</if>
and dh.sub_type!='调拨'
and ifnull(dh.delete_flag,'0') !='1'
</select>
<select id="findInOutMaterialCount" parameterType="com.jsh.erp.datasource.entities.DepotItemExample" resultMap="ResultInOutMaterialCount">
select di.material_id materialId, me.bar_code barCode, m.name mName,m.model,m.standard,mc.name categoryName,concat_ws('', m.unit, u.basic_unit) materialUnit,
sum(di.basic_number) numSum,
@@ -549,6 +609,67 @@
group by di.material_id) a
</select>
<select id="findInOutMaterialCountStatistic" parameterType="com.jsh.erp.datasource.entities.DepotItemExample" resultMap="ResultInOutMaterialCount">
select sum(di.basic_number) numSum, sum(di.all_price) priceSum
from jsh_depot_head dh
left join jsh_depot_item di on dh.id=di.header_id and ifnull(di.delete_flag,'0') !='1'
left join jsh_material m on m.id=di.material_id and ifnull(m.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_material_extend me on me.material_id=m.id and ifnull(me.delete_Flag,'0') !='1'
left join jsh_material_category mc on m.category_id=mc.Id and ifnull(mc.delete_flag,'0') !='1'
where me.default_flag=1
and (dh.type=#{type} or dh.sub_type='调拨') and dh.oper_time >=#{beginTime} and dh.oper_time &lt;=#{endTime}
<if test="oId != null">
and dh.organ_id = #{oId}
</if>
<if test="creatorArray != null">
and dh.creator in (
<foreach collection="creatorArray" item="creator" separator=",">
#{creator}
</foreach>
)
</if>
<if test="organArray != null and organArray !=''">
and (dh.organ_id in (
<foreach collection="organArray" item="organId" separator=",">
#{organId}
</foreach>
) or dh.sub_type='采购退货' or dh.sub_type='零售' or dh.sub_type='其它')
</if>
<if test="depotList.size()>0">
<if test="type == '入库'">
and ((
dh.sub_type!='调拨' and di.depot_id in
<foreach collection="depotList" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
) or (
dh.sub_type='调拨' and di.another_depot_id in
<foreach collection="depotList" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
))
</if>
<if test="type == '出库'">
and di.depot_id in
<foreach collection="depotList" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</if>
</if>
<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="forceFlag">
and (dh.status = '1' or dh.status = '2' or dh.status = '3')
</if>
<if test="inOutManageFlag">
and (dh.sub_type!='采购' and dh.sub_type!='采购退货' and dh.sub_type!='销售' and dh.sub_type!='销售退货')
</if>
and ifnull(dh.delete_flag,'0') !='1'
</select>
<select id="findAllocationDetail" parameterType="com.jsh.erp.datasource.entities.DepotItemExample" resultMap="ResultWithInfoExMap">
select dh.number,me.bar_code barCode, m.name mname,m.model,m.standard,di.unit_price unitPrice,di.material_unit as mUnit,
di.oper_number operNumber,di.all_price allPrice,sname, d.dName dname,date_format(dh.oper_time, '%Y-%m-%d') operTime,
@@ -658,6 +779,56 @@
and ifnull(dh.delete_flag,'0') !='1'
</select>
<select id="findAllocationStatistic" parameterType="com.jsh.erp.datasource.entities.DepotItemExample" resultMap="ResultWithInfoExMap">
select sum(di.oper_number) operNumber, sum(di.all_price) allPrice
from jsh_depot_head dh
left join jsh_depot_item di on di.header_id=dh.id and ifnull(di.delete_flag,'0') !='1'
left join jsh_material m on m.id=di.material_id and ifnull(m.delete_flag,'0') !='1'
left join jsh_material_extend me on me.id=di.material_extend_id and ifnull(me.delete_Flag,'0') !='1'
left join (select id,name as dName,delete_Flag from jsh_depot ) d on d.id=di.depot_id and ifnull(d.delete_Flag,'0') !='1'
<!-- 调出仓库名查询 -->
left join (select id as aid,name as sname,delete_Flag as adelete_Flag from jsh_depot ) ddd on ddd.aid=di.another_depot_id and ifnull(ddd.adelete_Flag,'0') !='1'
where dh.oper_time >=#{beginTime} and dh.oper_time &lt;=#{endTime}
<if test="depotFList.size()>0">
and di.depot_id in
<foreach collection="depotFList" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</if>
<if test="depotList.size()>0">
and di.another_depot_id in
<foreach collection="depotList" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</if>
<if test="subType != null">
and dh.sub_type=#{subType}
</if>
<if test="number != null and number !=''">
<bind name="bindNumber" value="'%'+number+'%'"/>
and dh.number like #{bindNumber}
</if>
<if test="creatorArray != null">
and dh.creator in (
<foreach collection="creatorArray" item="creator" separator=",">
#{creator}
</foreach>
)
</if>
<if test="forceFlag">
and dh.status = '1'
</if>
<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} or dh.remark like #{bindKey})
</if>
<if test="remark != null and remark !=''">
<bind name="bindRemark" value="'%'+remark+'%'"/>
and (dh.remark like #{bindRemark} or di.remark like #{bindRemark})
</if>
and ifnull(dh.delete_flag,'0') !='1'
</select>
<select id="getStatementAccount" resultType="com.jsh.erp.datasource.vo.DepotHeadVo4StatementAccount">
select * from
(select s.id, s.supplier, s.contacts, s.telephone, s.phone_num, s.email,