库存记录报表导出
This commit is contained in:
@@ -3,6 +3,7 @@ package org.nl.wms.sch.data.controller;
|
|||||||
|
|
||||||
import org.nl.common.base.TableDataInfo;
|
import org.nl.common.base.TableDataInfo;
|
||||||
import org.nl.common.domain.query.PageQuery;
|
import org.nl.common.domain.query.PageQuery;
|
||||||
|
import org.nl.common.logging.annotation.Log;
|
||||||
import org.nl.wms.sch.data.service.MaterialDataService;
|
import org.nl.wms.sch.data.service.MaterialDataService;
|
||||||
import org.nl.wms.sch.data.service.dto.MaterialDataDto;
|
import org.nl.wms.sch.data.service.dto.MaterialDataDto;
|
||||||
import org.nl.wms.sch.data.service.dto.MaterialDataRequest;
|
import org.nl.wms.sch.data.service.dto.MaterialDataRequest;
|
||||||
@@ -14,9 +15,11 @@ import org.springframework.http.ResponseEntity;
|
|||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import io.swagger.annotations.*;
|
import io.swagger.annotations.*;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -35,8 +38,16 @@ public class MaterialDataController {
|
|||||||
@GetMapping
|
@GetMapping
|
||||||
@ApiOperation("查询data")
|
@ApiOperation("查询data")
|
||||||
//@PreAuthorize("@el.check('materialData:list')")
|
//@PreAuthorize("@el.check('materialData:list')")
|
||||||
public ResponseEntity<Object> query(MaterialDataRequest whereJson, PageQuery page){
|
public ResponseEntity<Object> query(MaterialDataRequest whereJson, PageQuery page) {
|
||||||
return new ResponseEntity<>(TableDataInfo.build(materialDataService.queryAll(whereJson,page)),HttpStatus.OK);
|
return new ResponseEntity<>(TableDataInfo.build(materialDataService.queryAll(whereJson, page)), HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Log("导出接口方法地址")
|
||||||
|
@ApiOperation("导出接口方法地址")
|
||||||
|
@GetMapping(value = "/download")
|
||||||
|
//@PreAuthorize("@el.check('Address:list')")
|
||||||
|
public void download(HttpServletResponse response, MaterialDataRequest whereJson, PageQuery page) throws IOException {
|
||||||
|
materialDataService.download(whereJson, page, response);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,5 +30,7 @@ public interface MaterialDataService extends IService<MaterialDataDto> {
|
|||||||
*/
|
*/
|
||||||
IPage<MaterialDataResponse> queryAll(MaterialDataRequest whereJson, PageQuery pageable);
|
IPage<MaterialDataResponse> queryAll(MaterialDataRequest whereJson, PageQuery pageable);
|
||||||
|
|
||||||
|
void download(MaterialDataRequest whereJson, PageQuery pageable, HttpServletResponse response) throws IOException;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.nl.common.domain.query.PageQuery;
|
import org.nl.common.domain.query.PageQuery;
|
||||||
import org.nl.common.exception.BadRequestException;
|
import org.nl.common.exception.BadRequestException;
|
||||||
|
import org.nl.common.utils.FileUtil;
|
||||||
import org.nl.wms.sch.data.service.MaterialDataService;
|
import org.nl.wms.sch.data.service.MaterialDataService;
|
||||||
import org.nl.wms.sch.data.service.dao.mapper.MaterialDataMapper;
|
import org.nl.wms.sch.data.service.dao.mapper.MaterialDataMapper;
|
||||||
import org.nl.wms.sch.data.service.dto.MaterialDataDto;
|
import org.nl.wms.sch.data.service.dto.MaterialDataDto;
|
||||||
@@ -16,15 +17,15 @@ import org.nl.wms.sch.material.service.dao.Material;
|
|||||||
import org.nl.wms.sch.material.service.dao.mapper.MaterialMapper;
|
import org.nl.wms.sch.material.service.dao.mapper.MaterialMapper;
|
||||||
import org.nl.wms.sch.report.service.dto.ReportDto;
|
import org.nl.wms.sch.report.service.dto.ReportDto;
|
||||||
import org.nl.wms.sch.report.service.dto.ReportQuery;
|
import org.nl.wms.sch.report.service.dto.ReportQuery;
|
||||||
|
import org.nl.wms.sch.report.service.dto.YlDto;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.io.IOException;
|
||||||
import java.util.List;
|
import java.util.*;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.util.IdUtil;
|
import cn.hutool.core.util.IdUtil;
|
||||||
@@ -33,6 +34,8 @@ import com.alibaba.fastjson.JSONObject;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description 服务实现
|
* @description 服务实现
|
||||||
* @author psh
|
* @author psh
|
||||||
@@ -53,4 +56,34 @@ public class MaterialDataServiceImpl extends ServiceImpl<MaterialDataMapper, Mat
|
|||||||
return pages;
|
return pages;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void download(MaterialDataRequest query, PageQuery pageQuery, HttpServletResponse response) throws IOException {
|
||||||
|
pageQuery.setSize(99999);
|
||||||
|
IPage<MaterialDataResponse> pages = new Page<>(pageQuery.getPage() + 1, pageQuery.getSize());
|
||||||
|
materialDataMapper.set();
|
||||||
|
pages = materialDataMapper.queryAll(pages, query);
|
||||||
|
List<Map<String, Object>> list = new ArrayList<>();
|
||||||
|
for(MaterialDataResponse materialDataResponse:pages.getRecords()){
|
||||||
|
Map<String, Object> mp = new LinkedHashMap<>();
|
||||||
|
mp.put("客户编码",materialDataResponse.getSupplierCode());
|
||||||
|
mp.put("客户名称",materialDataResponse.getSupplierName());
|
||||||
|
mp.put("物料编码",materialDataResponse.getProductName());
|
||||||
|
mp.put("日期",materialDataResponse.getDate());
|
||||||
|
mp.put("规格",materialDataResponse.getSpecification());
|
||||||
|
mp.put("来料批次",materialDataResponse.getBatch());
|
||||||
|
mp.put("棒源等级",materialDataResponse.getBarLevel());
|
||||||
|
mp.put("昨日结存实际长度(mm)",materialDataResponse.getSc_length());
|
||||||
|
mp.put("昨日结存实际重量(KG)",materialDataResponse.getSy_weight());
|
||||||
|
mp.put("来料入库实际长度(mm)",materialDataResponse.getLl_length());
|
||||||
|
mp.put("来料入库实际重量(KG)",materialDataResponse.getLl_weight());
|
||||||
|
mp.put("领料批次",materialDataResponse.getPickingBatch());
|
||||||
|
mp.put("生产领料实际长度(mm)",materialDataResponse.getSc_length());
|
||||||
|
mp.put("生产领料实际重量(KG)",materialDataResponse.getSc_weight());
|
||||||
|
mp.put("结存实际长度(mm)",materialDataResponse.getJc_length());
|
||||||
|
mp.put("结存实际重量(KG)",materialDataResponse.getJc_weight());
|
||||||
|
list.add(mp);
|
||||||
|
}
|
||||||
|
FileUtil.downloadExcel(list, response);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ export default {
|
|||||||
add: false,
|
add: false,
|
||||||
edit: false,
|
edit: false,
|
||||||
del: false,
|
del: false,
|
||||||
download: false,
|
download: true,
|
||||||
reset: false
|
reset: false
|
||||||
},
|
},
|
||||||
query: {
|
query: {
|
||||||
|
|||||||
Reference in New Issue
Block a user