diff --git a/src/main/java/com/bonus/gzgqj/business/plan/controller/ExportController.java b/src/main/java/com/bonus/gzgqj/business/plan/controller/ExportController.java index 847109a..d1533ad 100644 --- a/src/main/java/com/bonus/gzgqj/business/plan/controller/ExportController.java +++ b/src/main/java/com/bonus/gzgqj/business/plan/controller/ExportController.java @@ -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 list = service.getDfhList(o); List 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 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 list = service.getWarnInfoPage(o); + List exports=new ArrayList<>(); + List 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); + } + } + /** * 文件统一下载 diff --git a/src/main/java/com/bonus/gzgqj/business/plan/entity/PlanApplyBean.java b/src/main/java/com/bonus/gzgqj/business/plan/entity/PlanApplyBean.java index a8787d2..34e4674 100644 --- a/src/main/java/com/bonus/gzgqj/business/plan/entity/PlanApplyBean.java +++ b/src/main/java/com/bonus/gzgqj/business/plan/entity/PlanApplyBean.java @@ -13,6 +13,8 @@ import java.util.List; public class PlanApplyBean { @Excel(name = "序号", width = 10.0, orderNum = "0") + private int xh; + private String id; /** * 计划编号 diff --git a/src/main/java/com/bonus/gzgqj/business/plan/entity/ProNeedInfo.java b/src/main/java/com/bonus/gzgqj/business/plan/entity/ProNeedInfo.java index 7a4a348..25c5089 100644 --- a/src/main/java/com/bonus/gzgqj/business/plan/entity/ProNeedInfo.java +++ b/src/main/java/com/bonus/gzgqj/business/plan/entity/ProNeedInfo.java @@ -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; + /** * 备注 */ diff --git a/src/main/java/com/bonus/gzgqj/business/plan/entity/ProNeedInfoExport.java b/src/main/java/com/bonus/gzgqj/business/plan/entity/ProNeedInfoExport.java index 6cc98cf..6ab02ce 100644 --- a/src/main/java/com/bonus/gzgqj/business/plan/entity/ProNeedInfoExport.java +++ b/src/main/java/com/bonus/gzgqj/business/plan/entity/ProNeedInfoExport.java @@ -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; /** * 备注 diff --git a/src/main/java/com/bonus/gzgqj/business/plan/entity/ProNeedInfoWarnExport.java b/src/main/java/com/bonus/gzgqj/business/plan/entity/ProNeedInfoWarnExport.java new file mode 100644 index 0000000..df31b14 --- /dev/null +++ b/src/main/java/com/bonus/gzgqj/business/plan/entity/ProNeedInfoWarnExport.java @@ -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; + + +} diff --git a/src/main/java/com/bonus/gzgqj/business/plan/entity/ProNeedInfoWarnExport2.java b/src/main/java/com/bonus/gzgqj/business/plan/entity/ProNeedInfoWarnExport2.java new file mode 100644 index 0000000..5d56e13 --- /dev/null +++ b/src/main/java/com/bonus/gzgqj/business/plan/entity/ProNeedInfoWarnExport2.java @@ -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; + + +} diff --git a/src/main/java/com/bonus/gzgqj/business/plan/entity/ProNeedInfoWfhExport.java b/src/main/java/com/bonus/gzgqj/business/plan/entity/ProNeedInfoWfhExport.java index cec78d4..e5acdac 100644 --- a/src/main/java/com/bonus/gzgqj/business/plan/entity/ProNeedInfoWfhExport.java +++ b/src/main/java/com/bonus/gzgqj/business/plan/entity/ProNeedInfoWfhExport.java @@ -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; diff --git a/src/main/resources/mappers/plan/PlanOutMapper.xml b/src/main/resources/mappers/plan/PlanOutMapper.xml index b6ff1d7..e14b222 100644 --- a/src/main/resources/mappers/plan/PlanOutMapper.xml +++ b/src/main/resources/mappers/plan/PlanOutMapper.xml @@ -165,16 +165,16 @@