20 changed files with 655 additions and 53 deletions
@ -0,0 +1,68 @@
|
||||
/* |
||||
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved. |
||||
* |
||||
* Redistribution and use in source and binary forms, with or without |
||||
* modification, are permitted provided that the following conditions are met: |
||||
* |
||||
* Redistributions of source code must retain the above copyright notice, |
||||
* this list of conditions and the following disclaimer. |
||||
* Redistributions in binary form must reproduce the above copyright |
||||
* notice, this list of conditions and the following disclaimer in the |
||||
* documentation and/or other materials provided with the distribution. |
||||
* Neither the name of the dreamlu.net developer nor the names of its |
||||
* contributors may be used to endorse or promote products derived from |
||||
* this software without specific prior written permission. |
||||
* Author: Chill 庄骞 (smallchill@163.com) |
||||
*/ |
||||
package com.logpm.report.controller; |
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
||||
import com.logpm.report.service.ReportStockService; |
||||
import com.logpm.report.vo.StockDetailsVO; |
||||
import io.swagger.annotations.Api; |
||||
import io.swagger.annotations.ApiOperation; |
||||
import lombok.AllArgsConstructor; |
||||
import org.springblade.core.boot.ctrl.BladeController; |
||||
import org.springblade.core.mp.support.Query; |
||||
import org.springblade.core.tool.api.R; |
||||
import org.springframework.web.bind.annotation.GetMapping; |
||||
import org.springframework.web.bind.annotation.RequestMapping; |
||||
import org.springframework.web.bind.annotation.RestController; |
||||
|
||||
import javax.servlet.http.HttpServletResponse; |
||||
|
||||
/** |
||||
* 配送报表 控制器 |
||||
* |
||||
* @author cyz |
||||
* @since 2023-06-08 |
||||
*/ |
||||
@RestController |
||||
@AllArgsConstructor |
||||
@RequestMapping("/stock") |
||||
@Api(value = "库存报表", tags = "库存报表") |
||||
public class ReportStockController extends BladeController { |
||||
|
||||
private final ReportStockService stockService; |
||||
|
||||
@GetMapping("/details") |
||||
@ApiOperationSupport(order = 1) |
||||
@ApiOperation(value = "库存品表", notes = "库存品表") |
||||
public R<IPage<StockDetailsVO>> detailsPage(StockDetailsVO vo, Query query) { |
||||
IPage<StockDetailsVO> pages = stockService.detailsPage(vo, query); |
||||
return R.data(pages); |
||||
} |
||||
|
||||
@GetMapping("/exportDetails") |
||||
@ApiOperationSupport(order = 2) |
||||
@ApiOperation(value = "导出配送明细报表", notes = "导出配送明细报表") |
||||
public void exportDetails(HttpServletResponse response, StockDetailsVO vo) { |
||||
try { |
||||
stockService.exportDetails(response, vo); |
||||
} catch (Exception e) { |
||||
e.printStackTrace(); |
||||
} |
||||
} |
||||
|
||||
} |
@ -0,0 +1,21 @@
|
||||
package com.logpm.report.mapper; |
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import com.logpm.report.vo.StockDetailsVO; |
||||
import org.apache.ibatis.annotations.Mapper; |
||||
import org.apache.ibatis.annotations.Param; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @author zhaoqiaobo |
||||
* @create 2024-03-06 15:54 |
||||
*/ |
||||
@Mapper |
||||
public interface ReportStockMapeer extends BaseMapper { |
||||
|
||||
List<StockDetailsVO> getDetailPage(IPage<StockDetailsVO> page,@Param("ew") QueryWrapper<StockDetailsVO> queryWrapper); |
||||
|
||||
} |
@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
<mapper namespace="com.logpm.report.mapper.ReportStockMapeer"> |
||||
|
||||
<select id="getDetailPage" resultType="com.logpm.report.vo.StockDetailsVO"> |
||||
select * |
||||
from (select t.warehouse_name, |
||||
t.market_name, |
||||
case |
||||
when t.service_type = 2 then '市内库存品' |
||||
when t.service_type = 3 then '自提库存品' end service_type, |
||||
t.cargo_number, |
||||
t.description_goods, |
||||
t.quantity_stock, |
||||
t.outbound_quantity, |
||||
t.quantity_stock - t.outbound_quantity current_quantity, |
||||
t.quantity_occupied, |
||||
t.quantity_stock - t.outbound_quantity - t.quantity_occupied usable_quantity, |
||||
lwug.allocation_title |
||||
from logpm_distribution_stock_list t |
||||
left join (select group_concat(t.allocation_title) allocation_title, t.association_value |
||||
from logpm_warehouse_updown_goods t |
||||
where t.association_type = 4 |
||||
group by t.association_value) lwug on lwug.association_value = t.cargo_number |
||||
) t ${ew.customSqlSegment} |
||||
</select> |
||||
</mapper> |
@ -0,0 +1,35 @@
|
||||
package com.logpm.report.reader; |
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||
import com.logpm.report.mapper.ReportBillLoadingMapper; |
||||
import com.logpm.report.service.ExportReaderService; |
||||
import org.apache.poi.ss.formula.functions.T; |
||||
import org.springframework.stereotype.Component; |
||||
|
||||
import javax.annotation.Resource; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @author zhaoqiaobo |
||||
* @create 2024-03-08 9:50 |
||||
*/ |
||||
@Component |
||||
public class BillLoadingDetailsReader implements ExportReaderService { |
||||
|
||||
@Resource |
||||
private ReportBillLoadingMapper billLoadingMapper; |
||||
|
||||
@Override |
||||
public Long getCount(QueryWrapper query) { |
||||
Page page = new Page(1, 1); |
||||
billLoadingMapper.getDetailsPage(page, query); |
||||
return page.getTotal(); |
||||
} |
||||
|
||||
@Override |
||||
public List<T> findList(Page page, QueryWrapper query) { |
||||
return billLoadingMapper.getDetailsPage(page, query); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,36 @@
|
||||
package com.logpm.report.reader; |
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||
import com.logpm.report.mapper.ReportStockMapeer; |
||||
import com.logpm.report.service.ExportReaderService; |
||||
import org.apache.poi.ss.formula.functions.T; |
||||
import org.springframework.stereotype.Component; |
||||
|
||||
import javax.annotation.Resource; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* |
||||
* @author zhaoqiaobo |
||||
* @create 2024-03-08 9:50 |
||||
*/ |
||||
@Component |
||||
public class DeliveryStockReader implements ExportReaderService { |
||||
|
||||
@Resource |
||||
private ReportStockMapeer reportStockMapeer; |
||||
|
||||
@Override |
||||
public Long getCount(QueryWrapper query) { |
||||
Page page = new Page(1, 1); |
||||
reportStockMapeer.getDetailPage(page, query); |
||||
return page.getTotal(); |
||||
} |
||||
|
||||
@Override |
||||
public List<T> findList(Page page, QueryWrapper query) { |
||||
return reportStockMapeer.getDetailPage(page,query); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,20 @@
|
||||
package com.logpm.report.service; |
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import com.logpm.report.vo.StockDetailsVO; |
||||
import org.springblade.core.mp.support.Query; |
||||
|
||||
import javax.servlet.http.HttpServletResponse; |
||||
import java.io.IOException; |
||||
|
||||
/** |
||||
* @author zhaoqiaobo |
||||
* @create 2024-03-06 15:51 |
||||
*/ |
||||
public interface ReportStockService { |
||||
|
||||
IPage<StockDetailsVO> detailsPage(StockDetailsVO vo, Query query); |
||||
|
||||
void exportDetails(HttpServletResponse response, StockDetailsVO vo) throws InterruptedException, IOException; |
||||
|
||||
} |
@ -0,0 +1,46 @@
|
||||
package com.logpm.report.service.impl; |
||||
|
||||
import cn.hutool.core.bean.BeanUtil; |
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import com.logpm.report.mapper.ReportStockMapeer; |
||||
import com.logpm.report.reader.DeliveryStockReader; |
||||
import com.logpm.report.service.ReportStockService; |
||||
import com.logpm.report.util.ReportExcelUtil; |
||||
import com.logpm.report.vo.StockDetailsVO; |
||||
import lombok.AllArgsConstructor; |
||||
import org.springblade.core.mp.support.Condition; |
||||
import org.springblade.core.mp.support.Query; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
import javax.servlet.http.HttpServletResponse; |
||||
import java.io.IOException; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* @author zhaoqiaobo |
||||
* @create 2024-03-06 15:52 |
||||
*/ |
||||
@Service |
||||
@AllArgsConstructor |
||||
public class ReportStockServiceImpl implements ReportStockService { |
||||
|
||||
private final ReportStockMapeer reportStockMapeer; |
||||
private final DeliveryStockReader deliveryStockReader; |
||||
|
||||
@Override |
||||
public IPage<StockDetailsVO> detailsPage(StockDetailsVO vo, Query query) { |
||||
IPage<StockDetailsVO> page = Condition.getPage(query); |
||||
Map<String, Object> stringObjectMap = BeanUtil.beanToMap(vo); |
||||
QueryWrapper<StockDetailsVO> queryWrapper = Condition.getQueryWrapper(stringObjectMap, StockDetailsVO.class); |
||||
return page.setRecords(reportStockMapeer.getDetailPage(page, queryWrapper)); |
||||
} |
||||
|
||||
@Override |
||||
public void exportDetails(HttpServletResponse response,StockDetailsVO vo) throws InterruptedException, IOException { |
||||
Map<String, Object> stringObjectMap = BeanUtil.beanToMap(vo); |
||||
QueryWrapper<StockDetailsVO> queryWrapper = Condition.getQueryWrapper(stringObjectMap, StockDetailsVO.class); |
||||
new ReportExcelUtil().export(response, deliveryStockReader, StockDetailsVO.class, queryWrapper, "库存品表"); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,104 @@
|
||||
package com.logpm.report.vo; |
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty; |
||||
import com.alibaba.excel.annotation.write.style.ColumnWidth; |
||||
import com.alibaba.excel.annotation.write.style.ContentRowHeight; |
||||
import com.alibaba.excel.annotation.write.style.HeadRowHeight; |
||||
import io.swagger.annotations.ApiModel; |
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.Data; |
||||
|
||||
import java.io.Serializable; |
||||
|
||||
/** |
||||
* 自提明细 报表 vo |
||||
* |
||||
* @author zhaoqiaobo |
||||
* @create 2024-03-06 16:02 |
||||
*/ |
||||
@ColumnWidth(25) |
||||
@HeadRowHeight(20) |
||||
@ContentRowHeight(18) |
||||
@ApiModel(value = "自提明细报表", description = "自提明细报表") |
||||
@Data |
||||
public class BillLoadingDetailsVO implements Serializable { |
||||
|
||||
private static final long serialVersionUID = 1L; |
||||
|
||||
@ApiModelProperty(value = "自提批次号") |
||||
@ExcelProperty("自提批次号") |
||||
private String pickupBatch; |
||||
|
||||
@ApiModelProperty(value = "仓库") |
||||
@ExcelProperty("仓库") |
||||
private String warehouse; |
||||
|
||||
@ApiModelProperty(value = "收货单位") |
||||
@ExcelProperty("收货单位") |
||||
private String consigneeUnit; |
||||
|
||||
@ApiModelProperty(value = "运单号") |
||||
@ExcelProperty("运单号") |
||||
private String waybillNumber; |
||||
|
||||
@ApiModelProperty(value = "订单自编码") |
||||
@ExcelProperty("订单自编码") |
||||
private String orderCode; |
||||
|
||||
@ApiModelProperty(value = "包条") |
||||
@ExcelProperty("包条") |
||||
private String packetBarCode; |
||||
|
||||
@ApiModelProperty(value = "客户车次号") |
||||
@ExcelProperty("客户车次号") |
||||
private String trainNumber; |
||||
|
||||
@ApiModelProperty(value = "一级品") |
||||
@ExcelProperty("一级品") |
||||
private String firsts; |
||||
|
||||
@ApiModelProperty(value = "二级品") |
||||
@ExcelProperty("二级品") |
||||
private String second; |
||||
|
||||
@ApiModelProperty(value = "三级品") |
||||
@ExcelProperty("三级品") |
||||
private String thirdProduct; |
||||
|
||||
@ApiModelProperty(value = "物料编码") |
||||
@ExcelProperty("物料编码") |
||||
private String materialCode; |
||||
|
||||
@ApiModelProperty(value = "物料名称") |
||||
@ExcelProperty("物料名称") |
||||
private String materialName; |
||||
|
||||
@ApiModelProperty(value = "始发仓入库日期") |
||||
@ExcelProperty("始发仓入库日期") |
||||
private String startWareInTime; |
||||
|
||||
@ApiModelProperty(value = "始发仓发货日期") |
||||
@ExcelProperty("始发仓发货日期") |
||||
private String startWareOutTime; |
||||
|
||||
@ApiModelProperty(value = "入库时间") |
||||
@ExcelProperty("入库时间") |
||||
private String warehouseEntryTimeEnd; |
||||
|
||||
@ApiModelProperty(value = "提货扫码人") |
||||
@ExcelProperty("提货扫码人") |
||||
private String scanUser; |
||||
|
||||
@ApiModelProperty(value = "提货扫描时间") |
||||
@ExcelProperty("提货扫描时间") |
||||
private String scanTime; |
||||
|
||||
@ApiModelProperty(value = "文员复核时间") |
||||
@ExcelProperty("文员复核时间") |
||||
private String examineTime; |
||||
|
||||
@ApiModelProperty(value = "文员复核人") |
||||
@ExcelProperty("文员复核人") |
||||
private String examineUser; |
||||
|
||||
} |
@ -0,0 +1,72 @@
|
||||
package com.logpm.report.vo; |
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty; |
||||
import com.alibaba.excel.annotation.write.style.ColumnWidth; |
||||
import com.alibaba.excel.annotation.write.style.ContentRowHeight; |
||||
import com.alibaba.excel.annotation.write.style.HeadRowHeight; |
||||
import io.swagger.annotations.ApiModel; |
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.Data; |
||||
|
||||
import java.io.Serializable; |
||||
|
||||
/** |
||||
* 库存品表 vo |
||||
* |
||||
* @author zhaoqiaobo |
||||
* @create 2024-03-06 16:02 |
||||
*/ |
||||
@ColumnWidth(25) |
||||
@HeadRowHeight(20) |
||||
@ContentRowHeight(18) |
||||
@ApiModel(value = "库存品表", description = "库存品表") |
||||
@Data |
||||
public class StockDetailsVO implements Serializable { |
||||
|
||||
private static final long serialVersionUID = 1L; |
||||
|
||||
@ApiModelProperty(value = "仓库") |
||||
@ExcelProperty("仓库") |
||||
private String warehouseName; |
||||
|
||||
@ApiModelProperty(value = "商场名称") |
||||
@ExcelProperty("商场名称") |
||||
private String marketName; |
||||
|
||||
@ApiModelProperty(value = "类型") |
||||
@ExcelProperty("类型") |
||||
private String serviceType; |
||||
|
||||
@ApiModelProperty(value = "物料编码") |
||||
@ExcelProperty("物料编码") |
||||
private String cargoNumber; |
||||
|
||||
@ApiModelProperty(value = "物料名称") |
||||
@ExcelProperty("物料名称") |
||||
private String descriptionGoods; |
||||
|
||||
@ApiModelProperty(value = "入库总数") |
||||
@ExcelProperty("入库总数") |
||||
private String quantityStock; |
||||
|
||||
@ApiModelProperty(value = "出库总数") |
||||
@ExcelProperty("出库总数") |
||||
private String outboundQuantity; |
||||
|
||||
@ApiModelProperty(value = "当前库存") |
||||
@ExcelProperty("当前库存") |
||||
private String currentQuantity; |
||||
|
||||
@ApiModelProperty(value = "占用数") |
||||
@ExcelProperty("占用数") |
||||
private String quantityOccupied; |
||||
|
||||
@ApiModelProperty(value = "可用数") |
||||
@ExcelProperty("可用数") |
||||
private String usableQuantity; |
||||
|
||||
@ApiModelProperty(value = "货位信息") |
||||
@ExcelProperty("货位信息") |
||||
private String allocationTitle; |
||||
|
||||
} |
Loading…
Reference in new issue