修改导出 及明细

This commit is contained in:
haozq 2024-11-11 15:35:14 +08:00
parent 65696e950e
commit 16687b67b3
8 changed files with 392 additions and 29 deletions

View File

@ -149,7 +149,7 @@ public class ExportController {
exports.add(voo);
});
ExportParams exportParams = new ExportParams("全部发货", "全部发货", ExcelType.XSSF);
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, PlanApplyBean.class, exports);
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, ProNeedInfoExport.class, exports);
response.setContentType("application/vnd.ms-excel");
response.setHeader("content-disposition", "attachment;fileName=" + URLEncoder.encode("全部发货" + ".xlsx", "UTF-8"));
ServletOutputStream outputStream = response.getOutputStream();
@ -200,13 +200,16 @@ public class ExportController {
try {
List<ProNeedInfo> list = service.getDfhList(o);
List<ProNeedInfoWfhExport> exports=new ArrayList<>();
final int[] num = {1};
list.forEach(vo->{
ProNeedInfoWfhExport voo=new ProNeedInfoWfhExport();
voo.setXh(num[0]);
num[0]++;
BeanUtils.copyProperties(vo, voo);
exports.add(voo);
});
ExportParams exportParams = new ExportParams("需求计划量", "需求计划量", ExcelType.XSSF);
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, PlanApplyBean.class, exports);
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, ProNeedInfoWfhExport.class, exports);
response.setContentType("application/vnd.ms-excel");
response.setHeader("content-disposition", "attachment;fileName=" + URLEncoder.encode("需求计划量" + ".xlsx", "UTF-8"));
ServletOutputStream outputStream = response.getOutputStream();
@ -258,9 +261,14 @@ public class ExportController {
public void exportPcList(HttpServletRequest request, HttpServletResponse response,@RequestBody ProNeedInfo o) {
try {
List<ProNeedInfo> list = service.getOutDetailList(o);
final int[] num = {1};
list.forEach(vo->{
vo.setXh(num[0]);
num[0]++;
});
String day=o.getCurryDay();
ExportParams exportParams = new ExportParams(day+"批次发货", day+"批次发货", ExcelType.XSSF);
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, PlanApplyBean.class, list);
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, ProNeedInfo.class, list);
response.setContentType("application/vnd.ms-excel");
response.setHeader("content-disposition", "attachment;fileName=" + URLEncoder.encode(day+"批次发货" + ".xlsx", "UTF-8"));
ServletOutputStream outputStream = response.getOutputStream();
@ -276,6 +284,61 @@ public class ExportController {
/**
* 预警信息导出 -超库存量
* @param request
* @param response
* @param o
*/
@PostMapping("exportWarn")
public void exportWarn(HttpServletRequest request, HttpServletResponse response,@RequestBody ProNeedInfo o) {
try {
List<ProNeedInfo> list = service.getWarnInfoPage(o);
List<ProNeedInfoWarnExport> exports=new ArrayList<>();
List<ProNeedInfoWarnExport2> exports2=new ArrayList<>();
final int[] num = {1};
if("1".equals(o.getType())){
list.forEach(vo->{
ProNeedInfoWarnExport voo=new ProNeedInfoWarnExport();
BeanUtils.copyProperties(vo, voo);
voo.setXh(num[0]);
num[0]++;
exports.add(voo);
});
ExportParams exportParams = new ExportParams("超库存量", "超库存量", ExcelType.XSSF);
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, ProNeedInfoWarnExport.class, exports);
response.setContentType("application/vnd.ms-excel");
response.setHeader("content-disposition", "attachment;fileName=" + URLEncoder.encode("超库存量" + ".xlsx", "UTF-8"));
ServletOutputStream outputStream = response.getOutputStream();
workbook.write(outputStream);
outputStream.close();
workbook.close();
}else{
list.forEach(vo->{
ProNeedInfoWarnExport2 voo=new ProNeedInfoWarnExport2();
BeanUtils.copyProperties(vo, voo);
voo.setXh(num[0]);
num[0]++;
exports2.add(voo);
});
ExportParams exportParams = new ExportParams("计划外量", "计划外量", ExcelType.XSSF);
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, ProNeedInfoWarnExport2.class, exports2);
response.setContentType("application/vnd.ms-excel");
response.setHeader("content-disposition", "attachment;fileName=" + URLEncoder.encode("计划外量" + ".xlsx", "UTF-8"));
ServletOutputStream outputStream = response.getOutputStream();
workbook.write(outputStream);
outputStream.close();
workbook.close();
}
} catch (Exception e) {
log.error(e.toString(), e);
}
}
/**
* 文件统一下载

View File

@ -13,6 +13,8 @@ import java.util.List;
public class PlanApplyBean {
@Excel(name = "序号", width = 10.0, orderNum = "0")
private int xh;
private String id;
/**
* 计划编号

View File

@ -15,11 +15,12 @@ public class ProNeedInfo extends PageInfo {
* 主键
*/
@Excel(name = "序号", width = 10.0, orderNum = "0")
private int xh;
private String id;
/**
* 计划内外
*/
@Excel(name = "计划内/计划外", width = 10.0,height = 20.0, orderNum = "2")
private String typeName;
/**
* 工程id
@ -69,10 +70,6 @@ public class ProNeedInfo extends PageInfo {
@Excel(name = "单位", width = 10.0,height = 20.0, orderNum = "6")
private String unit;
/**
* 进度
*/
@Excel(name = "进度", width = 10.0,height = 20.0, orderNum = "7")
private String progress;
/**
* 规格id
@ -93,19 +90,20 @@ public class ProNeedInfo extends PageInfo {
/**
* 发货数量
*/
@Excel(name = "发货量", width = 10.0,height = 20.0, orderNum = "9")
@Excel(name = "本次发货量", width = 10.0,height = 20.0, orderNum = "9")
private int fhNum;
/**
* 差额
*/
@Excel(name = "待发货量", width = 10.0,height = 20.0, orderNum = "10")
private int diff;
/**
* 调整量
*/
@Excel(name = "调整", width = 10.0,height = 20.0, orderNum = "11")
@Excel(name = "不发货量", width = 10.0,height = 20.0, orderNum = "11")
private int tzNum;
/**
* 差额
*/
private int diff;
/**
* 备注
*/

View File

@ -15,10 +15,13 @@ public class ProNeedInfoExport extends PageInfo {
* 主键
*/
@Excel(name = "序号", width = 10.0, orderNum = "0")
private int xh;
private String id;
/**
* 计划内外
*/
@Excel(name = "计划内/计划外", width = 15.0, orderNum = "2")
private String typeName;
/**
* 工程id
@ -54,6 +57,7 @@ public class ProNeedInfoExport extends PageInfo {
/**
* 进度
*/
@Excel(name = "进度", width = 10.0, orderNum = "7")
private String progress;
/**
* 规格id
@ -74,17 +78,18 @@ public class ProNeedInfoExport extends PageInfo {
/**
* 发货数量
*/
@Excel(name = "本次发货量", width = 10.0,height = 20.0, orderNum = "9")
@Excel(name = "发货量", width = 10.0,height = 20.0, orderNum = "9")
private int fhNum;
/**
* 差额
*/
@Excel(name = "待发货量", width = 10.0,height = 20.0, orderNum = "10")
private int diff;
/**
* 调整量
*/
@Excel(name = "不发货", width = 10.0,height = 20.0, orderNum = "11")
@Excel(name = "调整", width = 10.0,height = 20.0, orderNum = "11")
private int tzNum;
/**
* 备注

View File

@ -0,0 +1,146 @@
package com.bonus.gzgqj.business.plan.entity;
import cn.afterturn.easypoi.excel.annotation.Excel;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 工程需要数据
* @author 黑子
*/
@EqualsAndHashCode(callSuper = true)
@Data
public class ProNeedInfoWarnExport extends PageInfo {
/**
* 主键
*/
@Excel(name = "序号", width = 10.0, orderNum = "0")
private int xh;
private String id;
/**
* 计划内外
*/
private String typeName;
/**
* 工程id
*/
private String proId;
/**
* 工程id
*/
private String curryDay;
/**
* 工程名称
*/
private String proName;
/**
* 未发货量
*/
private int wfhNum;
/**
* 库存量
*/
private int kuNum;
/**
* 差量
*/
private int clNum;
/**
* 类型
*/
@Excel(name = "物机类型", width = 10.0,height = 20.0, orderNum = "3")
private String type;
/**
* 名称
*/
@Excel(name = "物机名称", width = 10.0,height = 20.0, orderNum = "4")
private String name;
/**
* 规格型号
*/
@Excel(name = "规格型号", width = 10.0,height = 20.0, orderNum = "5")
private String module;
/**
* 单位
*/
@Excel(name = "单位", width = 10.0,height = 20.0, orderNum = "6")
private String unit;
private String progress;
/**
* 规格id
*/
private String moduleId;
/**
* 需求类型 1计划 2新增
*/
private String needType;
/**
* 需要数量
*/
@Excel(name = "需要量", width = 10.0,height = 20.0, orderNum = "8")
private int needNum;
/**
* 发货数量
*/
private int fhNum;
/**
* 调整量
*/
private int tzNum;
/**
* 备注
*/
@Excel(name = "备注", width = 10.0,height = 20.0, orderNum = "12")
private String remarks;
/**
* 备注
*/
private String outId;
/**
* 数据源 1 计划 2 新增
*/
private String dataType;
/**
*
*/
@Excel(name = "库存量", width = 10.0,height = 20.0, orderNum = "9")
private int num;
/**
* 差额
*/
@Excel(name = "超出量", width = 10.0,height = 20.0, orderNum = "10")
private int diff;
/**
* 计划数量
*/
private String planNum;
/**
* 工程数量
*/
private String proNum;
/**
* 工程数量
*/
private String typeSource;
}

View File

@ -0,0 +1,148 @@
package com.bonus.gzgqj.business.plan.entity;
import cn.afterturn.easypoi.excel.annotation.Excel;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 工程需要数据
* @author 黑子
*/
@EqualsAndHashCode(callSuper = true)
@Data
public class ProNeedInfoWarnExport2 extends PageInfo {
/**
* 主键
*/
@Excel(name = "序号", width = 10.0, orderNum = "0")
private int xh;
private String id;
/**
* 计划内外
*/
private String typeName;
/**
* 工程id
*/
private String proId;
/**
* 工程id
*/
private String curryDay;
/**
* 未发货量
*/
private int wfhNum;
/**
* 库存量
*/
private int kuNum;
/**
* 差量
*/
private int clNum;
/**
* 类型
*/
@Excel(name = "物机类型", width = 10.0,height = 20.0, orderNum = "3")
private String type;
/**
* 名称
*/
@Excel(name = "物机名称", width = 10.0,height = 20.0, orderNum = "4")
private String name;
/**
* 规格型号
*/
@Excel(name = "规格型号", width = 10.0,height = 20.0, orderNum = "5")
private String module;
/**
* 单位
*/
@Excel(name = "单位", width = 10.0,height = 20.0, orderNum = "6")
private String unit;
private String progress;
/**
* 规格id
*/
private String moduleId;
/**
* 需求类型 1计划 2新增
*/
private String needType;
/**
* 发货数量
*/
@Excel(name = "计划外发货量", width = 10.0,height = 20.0, orderNum = "7")
private int fhNum;
/**
* 工程名称
*/
@Excel(name = "工程名称", width = 10.0,height = 20.0, orderNum = "12")
private String proName;
/**
* 需要数量
*/
private int needNum;
/**
* 调整量
*/
private int tzNum;
/**
* 差额
*/
private int diff;
/**
* 备注
*/
private String remarks;
/**
* 备注
*/
private String outId;
/**
* 数据源 1 计划 2 新增
*/
private String dataType;
/**
* 调整数量
*/
private int num;
/**
* 计划数量
*/
private String planNum;
/**
* 工程数量
*/
private String proNum;
/**
* 工程数量
*/
private String typeSource;
}

View File

@ -15,6 +15,8 @@ public class ProNeedInfoWfhExport extends PageInfo {
* 主键
*/
@Excel(name = "序号", width = 10.0, orderNum = "0")
private int xh;
private String id;
/**
* 计划内外
@ -79,18 +81,17 @@ public class ProNeedInfoWfhExport extends PageInfo {
/**
* 差额
*/
@Excel(name = "未发货量", width = 10.0,height = 20.0, orderNum = "9")
private int diff;
/**
* 调整量
*/
@Excel(name = "不发货量", width = 10.0,height = 20.0, orderNum = "11")
private int tzNum;
/**
* 备注
*/
@Excel(name = "备注", width = 10.0,height = 20.0, orderNum = "12")
private String remarks;

View File

@ -165,16 +165,16 @@
</select>
<!--批次详情接口-->
<select id="getOutDetailList" resultType="com.bonus.gzgqj.business.plan.entity.ProNeedInfo">
select id,out_id id ,
type, name,
module, unit,
module_id moduleId, fh_num fhNum,
tz_num tzNum, remarks,
data_type dataType
from t_plan_out_detail pod
select pod.id,out_id id ,
pod.type, pod.name,
pod.module, pod.unit,
pod.module_id moduleId, pod.fh_num fhNum,
pod.tz_num tzNum, pod.remarks,
pod.data_type dataType,pni.need_num needNum
from t_plan_out_detail pod
left join t_pro_need_info pni on pni.module_id=pod.module_id
<where>
out_id=#{id}
pod.out_id=#{id}
<if test="module!=null and module!=''">
and pod.`module` like concat('%',#{module},'%')
</if>