feat(库存汇总报表-新):新增存汇总报表-新

This commit is contained in:
chengzhaofeng 2025-03-13 15:17:41 +08:00
parent b5e0779e6a
commit c4d0e97830
8 changed files with 514 additions and 3 deletions

View File

@ -0,0 +1,72 @@
package com.foreverwin.mom.wms.dto;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data;
/**
* 库存(物料批次)
*
* @author philip
* @date 2022-10-29 09:03:07
*/
@Data
@ExcelIgnoreUnannotated
public class InventorySummaryReportNewOneDTO {
/**
* 站点
*/
@ExcelProperty("站点")
private String site;
/**
* 仓库
*/
@ExcelProperty("仓库")
private String erpStorageLocation;
/**
* 状态
*/
@ExcelIgnore
private String status;
/**
* 状态描述
*/
@ExcelProperty("状态")
private String statusDescription;
/**
* 物料
*/
@ExcelProperty("物料")
private String item;
/**
* 物料描述
*/
@ExcelProperty("物料描述")
private String itemDescription;
/**
* 单位
*/
@ExcelProperty("单位")
private String unitOfMeasure;
/**
* 汇总支数
*/
@ExcelProperty("汇总支数")
private String branchSum;
/**
* 汇总米数
*/
@ExcelProperty("汇总米数")
private String qtySum;
}

View File

@ -0,0 +1,84 @@
package com.foreverwin.mom.wms.dto;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data;
/**
* 库存(物料批次)3
*
* @author philip
* @date 2022-10-29 09:03:07
*/
@Data
@ExcelIgnoreUnannotated
public class InventorySummaryReportNewThreeDTO {
/**
* 站点
*/
@ExcelProperty("站点")
private String site;
/**
* 仓库
*/
@ExcelProperty("仓库")
private String erpStorageLocation;
/**
* 卷号(托)
*/
@ExcelProperty("卷号(托)")
private String inventoryId;
/**
* 状态
*/
@ExcelIgnore
private String status;
/**
* 状态描述
*/
@ExcelProperty("状态")
private String statusDescription;
/**
* 物料
*/
@ExcelProperty("物料")
private String item;
/**
* 物料描述
*/
@ExcelProperty("物料描述")
private String itemDescription;
/**
* 单位
*/
@ExcelProperty("单位")
private String unitOfMeasure;
/**
* 等级
*/
@ExcelIgnore
private String qualityInspectionStatus;
/**
* 等级
*/
@ExcelProperty("等级")
private String qualityInspectionStatusDesc;
/**
* 米数
*/
@ExcelProperty("米数")
private String qty;
}

View File

@ -0,0 +1,96 @@
package com.foreverwin.mom.wms.dto;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data;
/**
* 库存(物料批次)2
*
* @author philip
* @date 2022-10-29 09:03:07
*/
@Data
@ExcelIgnoreUnannotated
public class InventorySummaryReportNewTwoDTO {
/**
* 站点
*/
@ExcelProperty("站点")
private String site;
/**
* 仓库
*/
@ExcelProperty("仓库")
private String erpStorageLocation;
/**
* 状态
*/
@ExcelIgnore
private String status;
/**
* 状态描述
*/
@ExcelProperty("状态")
private String statusDescription;
/**
* 物料
*/
@ExcelProperty("物料")
private String item;
/**
* 物料描述
*/
@ExcelProperty("物料描述")
private String itemDescription;
/**
* 等级
*/
@ExcelIgnore
private String qualityInspectionStatus;
/**
* 等级
*/
@ExcelProperty("等级")
private String qualityInspectionStatusDesc;
/**
* 规格(长度)
*/
@ExcelProperty("规格(长度)")
private String specifications;
/**
* 长度
*/
@ExcelProperty("长度")
private String qty;
/**
* 支数
*/
@ExcelProperty("支数")
private String branch;
/**
* 单位
*/
@ExcelProperty("单位")
private String unitOfMeasure;
/**
* 汇总米数
*/
@ExcelProperty("汇总米数")
private String qtySum;
}

View File

@ -5,8 +5,12 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.foreverwin.iep.common.base.FrontPage;
import com.foreverwin.mom.common.core.util.R;
import com.foreverwin.mom.common.data.tenant.TenantContextHolder;
import com.foreverwin.mom.common.excel.annotation.ResponseExcel;
import com.foreverwin.mom.wms.dto.InventoryQueryReportDto;
import com.foreverwin.mom.wms.dto.InventorySummaryReportDTO;
import com.foreverwin.mom.wms.dto.InventorySummaryReportNewThreeDTO;
import com.foreverwin.mom.wms.dto.InventorySummaryReportNewTwoDTO;
import com.foreverwin.mom.wms.dto.InventorySummaryReportNewOneDTO;
import com.foreverwin.mom.wms.service.InventoryQueryReportService;
import com.foreverwin.mom.wms.util.ExcelCellWidthStyleStrategy;
import io.swagger.annotations.Api;
@ -205,5 +209,77 @@ public class InventoryQueryReportController {
EasyExcel.write(response.getOutputStream(), InventorySummaryReportDTO.class).registerWriteHandler(widthStyleStrategy).autoCloseStream(Boolean.FALSE).sheet(fileName)
.doWrite(data);
}
/**
* 库存汇总表-新1
* 2025年3月12日15点21分
* @return R
*/
@ResponseBody
@PostMapping("/pageInventorySummaryReportNewOne")
public R pageInventorySummaryReportNewOne(Page<InventorySummaryReportNewOneDTO> page, @RequestBody InventorySummaryReportNewOneDTO dto) {
dto.setSite(TenantContextHolder.getTenantId());
return R.ok(inventoryQueryReportService.pageInventorySummaryReportNewOne(page, dto));
}
/**
* 库存汇总表-新2
* 2025年3月12日15点21分
* @return R
*/
@ResponseBody
@PostMapping("/pageInventorySummaryReportNewTwo")
public R pageInventorySummaryReportNewTwo(Page<InventorySummaryReportNewTwoDTO> page, @RequestBody InventorySummaryReportNewTwoDTO dto) {
dto.setSite(TenantContextHolder.getTenantId());
return R.ok(inventoryQueryReportService.pageInventorySummaryReportNewTwo(page, dto));
}
/**
* 库存汇总表-新3
* 2025年3月12日15点21分
* @return R
*/
@ResponseBody
@PostMapping("/pageInventorySummaryReportNewThree")
public R pageInventorySummaryReportNewThree(Page<InventorySummaryReportNewThreeDTO> page, @RequestBody InventorySummaryReportNewThreeDTO dto) {
dto.setSite(TenantContextHolder.getTenantId());
return R.ok(inventoryQueryReportService.pageInventorySummaryReportNewThree(page, dto));
}
/**
* 导出excel 表格1
*
* @param inventorySummaryReportNewOne 查询条件
* @return excel 文件流
*/
@ResponseExcel
@GetMapping("/exportOne")
public List<InventorySummaryReportNewOneDTO> exportOne(InventorySummaryReportNewOneDTO inventorySummaryReportNewOne) {
return inventoryQueryReportService.exportOne(inventorySummaryReportNewOne);
}
/**
* 导出excel 表格2
*
* @param inventorySummaryReportNewTwo 查询条件
* @return excel 文件流
*/
@ResponseExcel
@GetMapping("/exportTwo")
public List<InventorySummaryReportNewTwoDTO> exportTwo(InventorySummaryReportNewTwoDTO inventorySummaryReportNewTwo) {
return inventoryQueryReportService.exportTwo(inventorySummaryReportNewTwo);
}
/**
* 导出excel 表格3
*
* @param inventorySummaryReportNewThree 查询条件
* @return excel 文件流
*/
@ResponseExcel
@GetMapping("/exportThree")
public List<InventorySummaryReportNewThreeDTO> exportThree(InventorySummaryReportNewThreeDTO inventorySummaryReportNewThree) {
return inventoryQueryReportService.exportThree(inventorySummaryReportNewThree);
}
}

View File

@ -1,8 +1,12 @@
package com.foreverwin.mom.wms.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.foreverwin.mom.wms.dto.InventoryQueryReportDto;
import com.foreverwin.mom.wms.dto.InventorySummaryReportDTO;
import com.foreverwin.mom.wms.dto.InventorySummaryReportNewOneDTO;
import com.foreverwin.mom.wms.dto.InventorySummaryReportNewThreeDTO;
import com.foreverwin.mom.wms.dto.InventorySummaryReportNewTwoDTO;
import java.util.List;
@ -64,5 +68,16 @@ public interface InventoryQueryReportService {
IPage<InventorySummaryReportDTO> pageInventorySummaryReport(IPage page, String site, InventorySummaryReportDTO dto);
List<InventorySummaryReportDTO> selectInventorySummaryReport(String site, InventorySummaryReportDTO dto);
Page<InventorySummaryReportNewOneDTO> pageInventorySummaryReportNewOne(Page<InventorySummaryReportNewOneDTO> page, InventorySummaryReportNewOneDTO dto);
Page<InventorySummaryReportNewTwoDTO> pageInventorySummaryReportNewTwo(Page<InventorySummaryReportNewTwoDTO> page, InventorySummaryReportNewTwoDTO dto);
Page<InventorySummaryReportNewThreeDTO> pageInventorySummaryReportNewThree(Page<InventorySummaryReportNewThreeDTO> page, InventorySummaryReportNewThreeDTO dto);
List<InventorySummaryReportNewOneDTO> exportOne(InventorySummaryReportNewOneDTO inventorySummaryReportNewOne);
List<InventorySummaryReportNewTwoDTO> exportTwo(InventorySummaryReportNewTwoDTO inventorySummaryReportNewOne);
List<InventorySummaryReportNewThreeDTO> exportThree(InventorySummaryReportNewThreeDTO inventorySummaryReportNewOne);
}

View File

@ -3,9 +3,13 @@ package com.foreverwin.mom.wms.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.foreverwin.mom.common.data.tenant.TenantContextHolder;
import com.foreverwin.mom.wms.dto.InventoryQueryReportDto;
import com.foreverwin.mom.wms.dto.InventorySummaryReportDTO;
import com.foreverwin.mom.wms.dto.InventorySummaryReportNewOneDTO;
import com.foreverwin.mom.wms.dto.InventorySummaryReportNewThreeDTO;
import com.foreverwin.mom.wms.dto.InventorySummaryReportNewTwoDTO;
import com.foreverwin.mom.wms.mapper.InventoryQueryReportMapper;
import com.foreverwin.mom.wms.service.InventoryQueryReportService;
import lombok.AllArgsConstructor;
@ -13,6 +17,7 @@ import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
/**
@ -1014,4 +1019,42 @@ public class InventoryQueryReportServiceImpl implements InventoryQueryReportServ
List<String> itemList = splitSearchField(dto.getItem());
return inventoryQueryReportMapper.selectInventorySummaryReport(site, erpStorageLocationList, itemList);
}
@Override
public Page<InventorySummaryReportNewOneDTO> pageInventorySummaryReportNewOne(
Page<InventorySummaryReportNewOneDTO> page, InventorySummaryReportNewOneDTO dto) {
return inventoryQueryReportMapper.pageInventorySummaryReportNewOne(page, dto);
}
@Override
public Page<InventorySummaryReportNewTwoDTO> pageInventorySummaryReportNewTwo(
Page<InventorySummaryReportNewTwoDTO> page, InventorySummaryReportNewTwoDTO dto) {
return inventoryQueryReportMapper.pageInventorySummaryReportNewTwo(page, dto);
}
@Override
public Page<InventorySummaryReportNewThreeDTO> pageInventorySummaryReportNewThree(
Page<InventorySummaryReportNewThreeDTO> page, InventorySummaryReportNewThreeDTO dto) {
return inventoryQueryReportMapper.pageInventorySummaryReportNewThree(page, dto);
}
@Override
public List<InventorySummaryReportNewOneDTO> exportOne(
InventorySummaryReportNewOneDTO inventorySummaryReportNewOne) {
List<InventorySummaryReportNewOneDTO> inventorySummaryReportNewOneDTOS = inventoryQueryReportMapper.pageInventorySummaryReportNewOne(
inventorySummaryReportNewOne);
return inventorySummaryReportNewOneDTOS;
}
@Override
public List<InventorySummaryReportNewTwoDTO> exportTwo(
InventorySummaryReportNewTwoDTO inventorySummaryReportNewTwo) {
return inventoryQueryReportMapper.pageInventorySummaryReportNewTwo(inventorySummaryReportNewTwo);
}
@Override
public List<InventorySummaryReportNewThreeDTO> exportThree(
InventorySummaryReportNewThreeDTO inventorySummaryReportNewThree) {
return inventoryQueryReportMapper.pageInventorySummaryReportNewThree(inventorySummaryReportNewThree);
}
}

View File

@ -7,6 +7,9 @@ import com.foreverwin.mom.wms.dto.InvenotryFullReportDTO;
import com.foreverwin.mom.wms.dto.InventoryQueryReportDto;
import com.foreverwin.mom.wms.dto.InventoryStatisticsReportDTO;
import com.foreverwin.mom.wms.dto.InventorySummaryReportDTO;
import com.foreverwin.mom.wms.dto.InventorySummaryReportNewOneDTO;
import com.foreverwin.mom.wms.dto.InventorySummaryReportNewThreeDTO;
import com.foreverwin.mom.wms.dto.InventorySummaryReportNewTwoDTO;
import com.foreverwin.mom.wms.entity.Inventory;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -58,5 +61,16 @@ public interface InventoryQueryReportMapper extends BaseMapper<Inventory> {
IPage<InventorySummaryReportDTO> selectInventorySummaryReport(IPage page, @Param("site") String site, @Param("erpStorageLocationList") List<String> erpStorageLocationList, @Param("itemList") List<String> itemList);
List<InventorySummaryReportDTO> selectInventorySummaryReport(@Param("site") String site, @Param("erpStorageLocationList") List<String> erpStorageLocationList, @Param("itemList") List<String> itemList);
Page<InventorySummaryReportNewOneDTO> pageInventorySummaryReportNewOne(Page<InventorySummaryReportNewOneDTO> page, @Param("dto") InventorySummaryReportNewOneDTO dto);
Page<InventorySummaryReportNewTwoDTO> pageInventorySummaryReportNewTwo(Page<InventorySummaryReportNewTwoDTO> page, @Param("dto") InventorySummaryReportNewTwoDTO dto);
Page<InventorySummaryReportNewThreeDTO> pageInventorySummaryReportNewThree(Page<InventorySummaryReportNewThreeDTO> page, @Param("dto") InventorySummaryReportNewThreeDTO dto);
List<InventorySummaryReportNewOneDTO> pageInventorySummaryReportNewOne(@Param("dto") InventorySummaryReportNewOneDTO dto);
List<InventorySummaryReportNewTwoDTO> pageInventorySummaryReportNewTwo(@Param("dto") InventorySummaryReportNewTwoDTO dto);
List<InventorySummaryReportNewThreeDTO> pageInventorySummaryReportNewThree(@Param("dto") InventorySummaryReportNewThreeDTO dto);
}

View File

@ -1489,4 +1489,115 @@
)AS WI
ORDER BY WI.ERP_STORAGE_LOCATION, ITEM, WI.STATUS, WI.BATCH_NO, WI.DN_ORDER, WI.DN_ORDER_SEQ , WI.QUALITY_INSPECTION_STATUS
</select>
<select id="pageInventorySummaryReportNewOne"
resultType="com.foreverwin.mom.wms.dto.InventorySummaryReportNewOneDTO">
with a as (select wi.SITE,
wi.ERP_STORAGE_LOCATION,
wi.STATUS,
wi.ITEM_BO,
count(wi.INVENTORY_ID) as branchSum,
round(sum(wi.QTY_ON_HAND), 3) as qtySum
from wms.wms_inventory wi
where wi.site = #{dto.site} and wi.ERP_STORAGE_LOCATION is not null
<if test="dto.erpStorageLocation != null and dto.erpStorageLocation != ''">
and wi.ERP_STORAGE_LOCATION = #{dto.erpStorageLocation}
</if>
<if test="dto.status != null and dto.status != ''">
and wi.STATUS = #{dto.status}
</if>
<if test="dto.item != null and dto.item != ''">
and wi.ITEM_BO = concat('ItemBO:', #{dto.site}, ',', #{dto.item}, ',1')
</if>
group by wi.SITE,
wi.ERP_STORAGE_LOCATION,
wi.STATUS,
wi.ITEM_BO)
select a.site,
a.ERP_STORAGE_LOCATION,
a.status,
sdi.LABEL as STATUS_DESCRIPTION,
i.ITEM,
i.DESCRIPTION as ITEM_DESCRIPTION,
a.branchSum,
a.qtySum,
i.UNIT_OF_MEASURE
from a
left join wip.item i on a.ITEM_BO = i.HANDLE
left join momx.sys_dict_item sdi on sdi.DICT_TYPE = 'INVENTORY_ID_STATUS' and sdi.DEL_FLAG = '0' and sdi.TENANT_ID = a.site and a.status = sdi.ITEM_VALUE
</select>
<select id="pageInventorySummaryReportNewTwo"
resultType="com.foreverwin.mom.wms.dto.InventorySummaryReportNewTwoDTO">
with a as (
select
wi.site,
wi.STATUS,
wi.QUALITY_INSPECTION_STATUS,
round(wi.QTY_ON_HAND, 3) qty,
count(wi.QTY_ON_HAND) branch,
concat(round(wi.QTY_ON_HAND, 3), '米 X ', count(wi.QTY_ON_HAND), '支') specifications,
round(sum(wi.QTY_ON_HAND), 3) qtySum
from wms.wms_inventory wi
where wi.ERP_STORAGE_LOCATION is not null and wi.SITE = #{dto.site} and wi.STATUS = #{dto.status} and
wi.ERP_STORAGE_LOCATION = #{dto.erpStorageLocation} and wi.ITEM_BO = concat('ItemBO:', #{dto.site}, ',',
#{dto.item}, ',1')
group by
wi.QUALITY_INSPECTION_STATUS, wi.QTY_ON_HAND)
select
a.site,
a.STATUS,
sdi.LABEL as STATUS_DESCRIPTION,
a.QUALITY_INSPECTION_STATUS,
sdi2.LABEL as QUALITY_INSPECTION_STATUS_DESC,
#{dto.erpStorageLocation} as erpStorageLocation,
#{dto.item} as item,
#{dto.itemDescription} as itemDescription,
#{dto.unitOfMeasure} as unitOfMeasure,
a.qty,
a.branch,
a.specifications,
a.qtySum
from a
left join momx.sys_dict_item sdi on sdi.DICT_TYPE = 'INVENTORY_ID_STATUS' and sdi.DEL_FLAG = '0' and sdi.TENANT_ID = a.site and a.status = sdi.ITEM_VALUE
left join momx.sys_dict_item sdi2 on sdi2.DICT_TYPE = 'INSPEC_LEVEL' and sdi2.DEL_FLAG = '0' and sdi2.TENANT_ID = a.site and a.QUALITY_INSPECTION_STATUS = sdi2.ITEM_VALUE
where 1 = 1
<if test="dto.qualityInspectionStatus != null and dto.qualityInspectionStatus != ''">
and a.QUALITY_INSPECTION_STATUS = #{dto.qualityInspectionStatus}
</if>
<if test="dto.qty != null and dto.qty != ''">
and a.qty = #{dto.qty}
</if>
<if test="dto.branch != null and dto.branch != ''">
and a.branch = #{dto.branch}
</if>
</select>
<select id="pageInventorySummaryReportNewThree"
resultType="com.foreverwin.mom.wms.dto.InventorySummaryReportNewThreeDTO">
select wi.site,
wi.INVENTORY_ID,
#{dto.erpStorageLocation} as erpStorageLocation,
#{dto.item} as item,
#{dto.itemDescription} as itemDescription,
#{dto.unitOfMeasure} as unitOfMeasure,
#{dto.qty} as qty,
wi.STATUS,
sdi.LABEL as STATUS_DESCRIPTION,
wi.QUALITY_INSPECTION_STATUS,
sdi2.LABEL as QUALITY_INSPECTION_STATUS_DESC
from wms.wms_inventory wi
left join momx.sys_dict_item sdi on sdi.DICT_TYPE = 'INVENTORY_ID_STATUS' and sdi.DEL_FLAG = '0' and sdi.TENANT_ID = wi.site and wi.status = sdi.ITEM_VALUE
left join momx.sys_dict_item sdi2 on sdi2.DICT_TYPE = 'INSPEC_LEVEL' and sdi2.DEL_FLAG = '0' and sdi2.TENANT_ID = wi.site and wi.QUALITY_INSPECTION_STATUS = sdi2.ITEM_VALUE
where wi.ERP_STORAGE_LOCATION is not null
and wi.SITE = #{dto.site}
and wi.STATUS = #{dto.status}
and wi.ERP_STORAGE_LOCATION = #{dto.erpStorageLocation}
and wi.ITEM_BO = concat('ItemBO:', #{dto.site}, ',', #{dto.item}, ',1')
and wi.QTY_ON_HAND = #{dto.qty}
<if test="dto.qualityInspectionStatus != null and dto.qualityInspectionStatus != ''">
and wi.QUALITY_INSPECTION_STATUS = #{dto.qualityInspectionStatus}
</if>
<if test="dto.qualityInspectionStatus == null and dto.qualityInspectionStatus == ''">
and wi.QUALITY_INSPECTION_STATUS is null
</if>
order by wi.INVENTORY_ID asc
</select>
</mapper>