package com.fzzy.igds.export;
|
|
|
import com.fzzy.igds.ReportInDetailPR;
|
import com.fzzy.igds.ReportOutDetailPR;
|
import com.fzzy.igds.SuperInventoryReportPR;
|
import com.fzzy.igds.data.InoutParam;
|
import com.fzzy.igds.data.SuperInventoryReportData;
|
import com.fzzy.igds.data.SuperInventoryReportParam;
|
import com.fzzy.igds.domain.Company;
|
import com.fzzy.igds.domain.Depot;
|
import com.fzzy.igds.domain.Dept;
|
import com.fzzy.igds.domain.InoutRecord;
|
import com.fzzy.igds.service.*;
|
import com.fzzy.igds.utils.ContextUtil;
|
import com.ruoyi.common.core.domain.AjaxResult;
|
import com.ruoyi.common.core.domain.entity.SysDept;
|
import com.ruoyi.common.utils.StringUtils;
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.stereotype.Controller;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
import javax.annotation.Resource;
|
import java.util.ArrayList;
|
import java.util.HashMap;
|
import java.util.List;
|
import java.util.Map;
|
|
|
/**
|
* 数据导出EXCEL入口
|
*
|
* @author sgj
|
* @date 2025/12/24
|
*/
|
@Controller
|
@RequestMapping("export")
|
public class ReportController {
|
|
|
@Resource
|
private InoutRecordService inoutReportService;
|
|
@Resource
|
private SysDeptService sysDeptService;
|
|
|
@Resource
|
private CoreDeptService coreDeptService;
|
@Resource
|
private DepotService depotService;
|
|
@Resource
|
private CoreCompanyService coreCompanyService;
|
|
|
@Autowired
|
private ReportInDetailPR reportInDetailPR;
|
|
@Autowired
|
private ReportOutDetailPR reportOutDetailPR;
|
@Autowired
|
private SuperInventoryReportPR superInventoryReportPR;
|
|
|
|
|
|
|
/**
|
* 出入库报表导出
|
* @return
|
*/
|
@RequestMapping("/inOutReport-excel")
|
@ResponseBody
|
public AjaxResult inOutReport(InoutParam param) {
|
//设置标题
|
String sheetName = "报表数据";
|
//查询数据
|
List<InoutRecord> list = new ArrayList<>();
|
|
if (StringUtils.isNotEmpty(param.getType()) && "IN".equals(param.getType())) {
|
sheetName = "入库报表数据";
|
list = reportInDetailPR.listRecord(param);
|
}
|
|
if (StringUtils.isNotEmpty(param.getType()) && "OUT".equals(param.getType())) {
|
sheetName = "出库报表数据";
|
list = reportOutDetailPR.listRecord(param);
|
}
|
|
//获取分库编码对应的分库名称
|
String deptName = "";
|
SysDept subDept = sysDeptService.getCacheDept(null, ContextUtil.subDeptId(null));
|
if (null != subDept) {
|
deptName = subDept.getDeptName();
|
}
|
|
//导出
|
ExcelUtil<InoutRecord> util = new ExcelUtil<InoutRecord>(InoutRecord.class);
|
return util.exportExcel(list, sheetName, deptName);
|
}
|
|
|
/**
|
* 库存报表导出
|
* @return
|
*/
|
@RequestMapping("/superInventoryReport-excel")
|
@ResponseBody
|
public AjaxResult superInventoryReport(SuperInventoryReportParam param) {
|
//设置标题
|
String sheetName = "库存报表数据";
|
//查询数据
|
List<SuperInventoryReportData> list = superInventoryReportPR.getReportData(param);
|
//获取分库编码对应的分库名称
|
String deptName = "";
|
SysDept subDept = sysDeptService.getCacheDept(null, ContextUtil.subDeptId(null));
|
if (null != subDept) {
|
deptName = subDept.getDeptName();
|
}
|
|
//导出
|
ExcelUtil<SuperInventoryReportData> util = new ExcelUtil<SuperInventoryReportData>(SuperInventoryReportData.class);
|
return util.exportExcel(list, sheetName, deptName);
|
}
|
|
}
|