Browse Source

库存记录报表导出

master
psh 3 months ago
parent
commit
761ca93d04
  1. 15
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/data/controller/MaterialDataController.java
  2. 2
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/data/service/MaterialDataService.java
  3. 39
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/data/service/impl/MaterialDataServiceImpl.java
  4. 2
      lms/nladmin-ui/src/views/wms/sch/data/index.vue

15
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/data/controller/MaterialDataController.java

@ -3,6 +3,7 @@ package org.nl.wms.sch.data.controller;
import org.nl.common.base.TableDataInfo;
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.dto.MaterialDataDto;
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.web.bind.annotation.*;
import io.swagger.annotations.*;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import java.util.Map;
import lombok.extern.slf4j.Slf4j;
/**
@ -35,8 +38,16 @@ public class MaterialDataController {
@GetMapping
@ApiOperation("查询data")
//@PreAuthorize("@el.check('materialData:list')")
public ResponseEntity<Object> query(MaterialDataRequest whereJson, PageQuery page){
return new ResponseEntity<>(TableDataInfo.build(materialDataService.queryAll(whereJson,page)),HttpStatus.OK);
public ResponseEntity<Object> query(MaterialDataRequest whereJson, PageQuery page) {
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);
}
}

2
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/data/service/MaterialDataService.java

@ -30,5 +30,7 @@ public interface MaterialDataService extends IService<MaterialDataDto> {
*/
IPage<MaterialDataResponse> queryAll(MaterialDataRequest whereJson, PageQuery pageable);
void download(MaterialDataRequest whereJson, PageQuery pageable, HttpServletResponse response) throws IOException;
}

39
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/data/service/impl/MaterialDataServiceImpl.java

@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.RequiredArgsConstructor;
import org.nl.common.domain.query.PageQuery;
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.dao.mapper.MaterialDataMapper;
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.report.service.dto.ReportDto;
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.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.data.domain.Pageable;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.io.IOException;
import java.util.*;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
@ -33,6 +34,8 @@ import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import cn.hutool.core.util.ObjectUtil;
import javax.servlet.http.HttpServletResponse;
/**
* @description 服务实现
* @author psh
@ -53,4 +56,34 @@ public class MaterialDataServiceImpl extends ServiceImpl<MaterialDataMapper, Mat
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);
}
}

2
lms/nladmin-ui/src/views/wms/sch/data/index.vue

@ -126,7 +126,7 @@ export default {
add: false,
edit: false,
del: false,
download: false,
download: true,
reset: false
},
query: {

Loading…
Cancel
Save