修改导出 及明细

This commit is contained in:
haozq 2024-11-11 10:58:01 +08:00
parent 255a8e0b63
commit 1dc4dc1b5e
7 changed files with 175 additions and 15 deletions

View File

@ -3,10 +3,7 @@ package com.bonus.gzgqj.business.plan.controller;
import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.entity.ExportParams;
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
import com.bonus.gzgqj.business.plan.entity.PlanApplyBean;
import com.bonus.gzgqj.business.plan.entity.PlanDataDetailBean;
import com.bonus.gzgqj.business.plan.entity.ProNeedInfo;
import com.bonus.gzgqj.business.plan.entity.ProPlanInfoVo;
import com.bonus.gzgqj.business.plan.entity.*;
import com.bonus.gzgqj.business.plan.service.PlanApplicationService;
import com.bonus.gzgqj.business.plan.service.PlanOutService;
import com.bonus.gzgqj.business.utils.FileUploadService;
@ -15,6 +12,7 @@ import com.bonus.gzgqj.manager.webResult.StringUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.FileUtils;
import org.apache.poi.ss.usermodel.Workbook;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
@ -143,9 +141,16 @@ public class ExportController {
@PostMapping("exportAllFhList")
public void exportAllFhList(HttpServletRequest request, HttpServletResponse response, ProNeedInfo o) {
try {
List<ProNeedInfo> list = service.getPorInfoDetail2(o);;
List<ProNeedInfo> list = service.getPorInfoDetail2(o);
List<ProNeedInfoExport> exports=new ArrayList<>();
list.forEach(vo->{
ProNeedInfoExport voo=new ProNeedInfoExport();
BeanUtils.copyProperties(vo, voo);
exports.add(voo);
});
ExportParams exportParams = new ExportParams("全部发货", "全部发货", ExcelType.XSSF);
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, PlanApplyBean.class, list);
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, PlanApplyBean.class, exports);
response.setContentType("application/vnd.ms-excel");
response.setHeader("content-disposition", "attachment;fileName=" + URLEncoder.encode("全部发货" + ".xlsx", "UTF-8"));
ServletOutputStream outputStream = response.getOutputStream();
@ -159,6 +164,32 @@ public class ExportController {
/**
* 导出 全部发货 -批次
* @param request
* @param response
* @param o
*/
@PostMapping("exportPcList")
public void exportPcList(HttpServletRequest request, HttpServletResponse response, ProNeedInfo o) {
try {
List<ProNeedInfo> list = service.getOutDetailList(o);
ExportParams exportParams = new ExportParams("全部发货", "全部发货", ExcelType.XSSF);
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, PlanApplyBean.class, list);
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

@ -145,7 +145,8 @@ public class PlanOutController {
@DecryptAndVerify(decryptedClass = ProNeedInfo.class)
public PageInfo<ProNeedInfo> getOutDetailList(EncryptedReq<ProNeedInfo> dto) {
PageHelper.startPage(dto.getPageNum(),dto.getPageSize());
PageInfo<ProNeedInfo> pageInfo = service.getOutDetailList(dto.getData());;
List<ProNeedInfo> list = service.getOutDetailList(dto.getData());;
PageInfo<ProNeedInfo> pageInfo = new PageInfo<>(list);
return pageInfo;
}
/**

View File

@ -0,0 +1,128 @@
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 ProNeedInfoExport extends PageInfo {
/**
* 主键
*/
@Excel(name = "序号", width = 10.0, orderNum = "0")
private String id;
/**
* 计划内外
*/
private String typeName;
/**
* 工程id
*/
private String proId;
/**
* 工程名称
*/
private String proName;
/**
* 类型
*/
@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;
/**
* 发货数量
*/
@Excel(name = "本次发货量", width = 10.0,height = 20.0, orderNum = "9")
private int fhNum;
/**
* 差额
*/
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;
/**
* 备注
*/
private String outId;
/**
* 数据源 1 计划 2 新增
*/
private String dataType;
/**
* 调整数量
*/
private int num;
/**
* 计划数量
*/
private String planNum;
/**
* 工程数量
*/
private String proNum;
/**
* 工程数量
*/
private String typeSource;
}

View File

@ -167,7 +167,7 @@ public interface PlanOutMapper {
* @param data
* @return
*/
PlanApplyBean getDataInfoDetails(PlanApplyBean data);
ProNeedInfo getDataInfoDetails(PlanApplyBean data);
/**
* 超库存量

View File

@ -74,7 +74,7 @@ public interface PlanOutService {
* @param data
* @return
*/
PageInfo<ProNeedInfo> getOutDetailList(ProNeedInfo data);
List<ProNeedInfo> getOutDetailList(ProNeedInfo data);
/**
*

View File

@ -96,15 +96,15 @@ public class PlanOutServiceImpl implements PlanOutService{
* @return
*/
@Override
public PageInfo<ProNeedInfo> getOutDetailList(ProNeedInfo data) {
public List<ProNeedInfo> getOutDetailList(ProNeedInfo data) {
List<ProNeedInfo> list = new ArrayList<>();
try {
list = mapper.getOutDetailList(data);
} catch (Exception e) {
log.error(e.toString(),e);
}
PageInfo<ProNeedInfo> pageInfo = new PageInfo<>(list);
return pageInfo;
return list;
}
/**
@ -471,7 +471,7 @@ public class PlanOutServiceImpl implements PlanOutService{
@Override
public ServerResponse getDataInfoDetails(PlanApplyBean data) {
try {
PlanApplyBean bean=mapper.getDataInfoDetails(data);
ProNeedInfo bean=mapper.getDataInfoDetails(data);
return ServerResponse.createSuccess(bean);
}catch (Exception e) {
log.error(e.toString(), e);

View File

@ -287,8 +287,8 @@
<!--查询模型-->
<select id="getDataInfoDetails" resultType="com.bonus.gzgqj.business.plan.entity.PlanApplyBean">
select pni.id,pni.type,pni.name,pni.module,pni.module_id moduleId,pni.need_num,pni.fh_num,pni.tz_num,
<select id="getDataInfoDetails" resultType="com.bonus.gzgqj.business.plan.entity.ProNeedInfo">
select pni.id,pni.type,pni.name,pni.module,pni.module_id moduleId,pni.need_num needNum,pni.fh_num,pni.tz_num tzNum,
pro.num proNum,plan.num planNum,pni.unit
from t_pro_need_info pni
LEFT JOIN(