add:库存查看
This commit is contained in:
@@ -18,7 +18,9 @@ package org.nl.common.utils;
|
||||
import cn.hutool.core.io.IoUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.poi.excel.BigExcelWriter;
|
||||
import cn.hutool.poi.excel.ExcelReader;
|
||||
import cn.hutool.poi.excel.ExcelUtil;
|
||||
import cn.hutool.poi.excel.ExcelWriter;
|
||||
import org.apache.poi.xssf.streaming.SXSSFSheet;
|
||||
import org.apache.tomcat.util.http.fileupload.IOUtils;
|
||||
import org.nl.common.domain.exception.BadRequestException;
|
||||
@@ -30,6 +32,7 @@ import javax.servlet.ServletOutputStream;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.*;
|
||||
import java.net.URLEncoder;
|
||||
import java.security.MessageDigest;
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
@@ -207,7 +210,7 @@ public class FileUtil extends cn.hutool.core.io.FileUtil {
|
||||
public static void downloadExcel(List<Map<String, Object>> list, HttpServletResponse response) throws IOException {
|
||||
String tempPath = SYS_TEM_DIR + IdUtil.fastSimpleUUID() + ".xlsx";
|
||||
File file = new File(tempPath);
|
||||
BigExcelWriter writer = ExcelUtil.getBigWriter(file);
|
||||
BigExcelWriter writer = ExcelUtil.getBigWriter(file);
|
||||
// 一次性写出内容,使用默认样式,强制输出标题
|
||||
writer.write(list, true);
|
||||
SXSSFSheet sheet = (SXSSFSheet)writer.getSheet();
|
||||
@@ -217,8 +220,9 @@ public class FileUtil extends cn.hutool.core.io.FileUtil {
|
||||
writer.autoSizeColumnAll();
|
||||
//response为HttpServletResponse对象
|
||||
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8");
|
||||
response.resetBuffer();
|
||||
//test.xls是弹出下载对话框的文件名,不能为中文,中文请自行编码
|
||||
response.setHeader("Content-Disposition", "attachment;filename=file.xlsx");
|
||||
response.setHeader("Content-Disposition", "attachment;fileName=" + URLEncoder.encode("file.xlsx", "UTF-8"));
|
||||
ServletOutputStream out = response.getOutputStream();
|
||||
// 终止后删除临时文件
|
||||
file.deleteOnExit();
|
||||
@@ -226,6 +230,22 @@ public class FileUtil extends cn.hutool.core.io.FileUtil {
|
||||
//此处记得关闭输出Servlet流
|
||||
IoUtil.close(out);
|
||||
}
|
||||
public static void downloadExcel2(List<Map<String, Object>> list, HttpServletResponse response) throws IOException {
|
||||
String tempPath = SYS_TEM_DIR + IdUtil.fastSimpleUUID() + ".xlsx";
|
||||
File file = new File(tempPath);
|
||||
BigExcelWriter writer = ExcelUtil.getBigWriter(file);
|
||||
writer.write(list, true);
|
||||
SXSSFSheet sheet = (SXSSFSheet)writer.getSheet();
|
||||
sheet.trackAllColumnsForAutoSizing();
|
||||
writer.autoSizeColumnAll();
|
||||
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8");
|
||||
response.setHeader("Content-Disposition", "attachment;filename=file.xlsx");
|
||||
ServletOutputStream out = response.getOutputStream();
|
||||
file.deleteOnExit();
|
||||
writer.flush(out, true);
|
||||
IoUtil.close(out);
|
||||
|
||||
}
|
||||
|
||||
public static String getFileType(String type) {
|
||||
String documents = "txt doc pdf ppt pps xlsx xls docx";
|
||||
|
||||
@@ -107,6 +107,12 @@ public class DeviceManageController {
|
||||
if (CollectionUtils.isEmpty(item)){
|
||||
throw new BadRequestException(String.format(vehicleCode+"载具组盘信息不存在"));
|
||||
}
|
||||
for (MdPbVehicleMaterVo materVo : item) {
|
||||
if (materVo.getQty().intValue() == 0){
|
||||
throw new BadRequestException(String.format(vehicleCode+"组盘异常,确认是否出库后组盘"));
|
||||
}
|
||||
}
|
||||
|
||||
wmsToAcsService.toCommand(device_code,"1",vehicleInfo.getH());
|
||||
return new ResponseEntity<>(TableDataInfo.build(),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@@ -18,6 +18,12 @@
|
||||
and (struct.struct_code LIKE '%${query.search}%'
|
||||
or struct.struct_name LIKE '%${query.search}%')
|
||||
</if>
|
||||
<if test="query.start_time != null and query.start_time != ''">
|
||||
and struct_flow.update_time >= #{query.start_time}
|
||||
</if>
|
||||
<if test="query.end_time != null and query.end_time != ''">
|
||||
and #{query.end_time} >= struct_flow.update_time
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -4,19 +4,24 @@ import cn.hutool.core.date.DateUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.nl.common.TableDataInfo;
|
||||
import org.nl.common.anno.Log;
|
||||
import org.nl.common.domain.entity.PageQuery;
|
||||
import org.nl.common.utils.IdUtil;
|
||||
import org.nl.common.utils.ListOf;
|
||||
import org.nl.common.utils.MapOf;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.wms.stor_manage.struct.service.IStIvtStructattrService;
|
||||
import org.nl.wms.stor_manage.struct.service.dao.StIvtStructattr;
|
||||
import org.nl.wms.stor_manage.struct.service.dto.StructattrQuery;
|
||||
import org.nl.wms.system_manage.service.tableData.ColumnInfoService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -34,6 +39,8 @@ public class StIvtStructattrController {
|
||||
|
||||
@Autowired
|
||||
private IStIvtStructattrService structattrService;
|
||||
@Autowired
|
||||
private ColumnInfoService columnInfoService;
|
||||
|
||||
@GetMapping
|
||||
@Log("仓位查询")
|
||||
@@ -88,4 +95,16 @@ public class StIvtStructattrController {
|
||||
public ResponseEntity<Object> getStructIvt(StructattrQuery query, PageQuery page) {
|
||||
return new ResponseEntity<>(structattrService.getStructIvt(query,page), HttpStatus.OK);
|
||||
}
|
||||
@PostMapping("/exportFile")
|
||||
public void exportFile(@RequestBody StructattrQuery query, HttpServletResponse response) {
|
||||
PageQuery page = new PageQuery();
|
||||
page.setPage(0);page.setSize(99999);
|
||||
TableDataInfo<Map> structIvt = structattrService.getStructIvt(query, page);
|
||||
List<Map> maps = structIvt.getContent();
|
||||
columnInfoService.exportFile("",maps,response,
|
||||
null,
|
||||
MapOf.linkOf("stor_code","仓库编码","struct_code","仓位","vehicle_code","载具编码",
|
||||
"material_code","物料编号","material_code","物料名称","pcsn","批号"
|
||||
,"forzen_qty","冻结数量","qty","库存数量","create_time","组盘入库时间"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.nl.wms.stor_manage.struct.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.common.TableDataInfo;
|
||||
import org.nl.wms.stor_manage.struct.service.dao.StIvtStructattr;
|
||||
import org.nl.common.domain.entity.PageQuery;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
@@ -52,7 +53,7 @@ public interface IStIvtStructattrService extends IService<StIvtStructattr> {
|
||||
|
||||
List<StructattrVechielDto> structVehicle(Map query);
|
||||
|
||||
Object getStructIvt(StructattrQuery query, PageQuery page);
|
||||
TableDataInfo<Map> getStructIvt(StructattrQuery query, PageQuery page);
|
||||
|
||||
List<StructAssignQty> getStructIvtAssign(List<String> materials, String stor_code);
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
<if test="query.has_vehicle == true">
|
||||
and struct.vehicle_code is not null
|
||||
</if>
|
||||
|
||||
<if test="query.has == false">
|
||||
and struct.vehicle_code is null and struct.lock_type = '00'
|
||||
</if>
|
||||
@@ -121,7 +122,8 @@
|
||||
vm.unit_id,
|
||||
vm.parent_vehicle_code,
|
||||
material.material_code,
|
||||
material.material_name
|
||||
material.material_name,
|
||||
vm.create_time
|
||||
FROM
|
||||
st_ivt_structattr struct
|
||||
left join md_pb_vehicleMater vm on struct.vehicle_code = vm.vehicle_code
|
||||
@@ -137,6 +139,12 @@
|
||||
and (material.material_code LIKE '%${query.material}%'
|
||||
or material.material_name LIKE '%${query.material}%')
|
||||
</if>
|
||||
<if test="query.start_time != null and query.start_time != ''">
|
||||
and vm.create_time >= #{query.start_time}
|
||||
</if>
|
||||
<if test="query.end_time != null and query.end_time != ''">
|
||||
and #{query.end_time} >= vm.create_time
|
||||
</if>
|
||||
<if test="query.pcsn != null and query.pcsn != ''">
|
||||
and vm.pcsn = #{query.pcsn}
|
||||
</if>
|
||||
|
||||
@@ -198,7 +198,7 @@ public class StIvtStructattrServiceImpl extends ServiceImpl<StIvtStructattrMappe
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getStructIvt(StructattrQuery query, PageQuery pageQuery) {
|
||||
public TableDataInfo<Map> getStructIvt(StructattrQuery query, PageQuery pageQuery) {
|
||||
Page<Object> page = PageHelper.startPage(pageQuery.getPage() + 1, pageQuery.getSize());
|
||||
page.setOrderBy("struct.create_time DESC");
|
||||
List<Map> mst_detail = this.baseMapper.getStructIvt(query, pageQuery);
|
||||
|
||||
@@ -1,22 +1,31 @@
|
||||
package org.nl.wms.system_manage.service.tableData;
|
||||
|
||||
import cn.hutool.poi.excel.ExcelUtil;
|
||||
import cn.hutool.poi.excel.ExcelWriter;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.poi.ss.formula.functions.T;
|
||||
import org.apache.poi.ss.usermodel.Cell;
|
||||
import org.apache.poi.ss.usermodel.Row;
|
||||
import org.apache.poi.ss.usermodel.Sheet;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import org.nl.common.utils.FileUtil;
|
||||
import org.nl.wms.system_manage.service.tableData.dao.mapper.ColumnMapper;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.ServletOutputStream;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.lang.reflect.Field;
|
||||
import java.net.BindException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -59,13 +68,13 @@ public class ColumnInfoService {
|
||||
}
|
||||
List<Map<String, Object>> excel_lst = new ArrayList<>();
|
||||
Map t = data.get(0);
|
||||
if (tableName == null){
|
||||
throw new BindException("导出失败,未获取到表名");
|
||||
}
|
||||
Map<String,String> map = this.TableColumn(tableName);
|
||||
if (!CollectionUtils.isEmpty(passParam)){
|
||||
for (Object s : passParam) {
|
||||
map.remove(s);
|
||||
Map<String,String> map = new LinkedHashMap<>();
|
||||
if (!StringUtils.isEmpty(tableName)){
|
||||
map = this.TableColumn(tableName);
|
||||
if (!CollectionUtils.isEmpty(passParam)){
|
||||
for (Object s : passParam) {
|
||||
map.remove(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
map.putAll(customizMap);
|
||||
@@ -73,7 +82,7 @@ public class ColumnInfoService {
|
||||
throw new BindException("导出失败,表结构信息失败"+tableName);
|
||||
}
|
||||
for (Map item : data) {
|
||||
Map<String, Object> excelMap = new HashMap<>();
|
||||
Map<String, Object> excelMap = new LinkedHashMap<>();
|
||||
for (Map.Entry<String, String> entry : map.entrySet()) {
|
||||
excelMap.put(entry.getValue(),item.get(entry.getKey()));
|
||||
}
|
||||
@@ -82,7 +91,7 @@ public class ColumnInfoService {
|
||||
if (CollectionUtils.isEmpty(excel_lst)){
|
||||
throw new BindException("导出失败,没有获取到导出参数"+data.size());
|
||||
}
|
||||
FileUtil.downloadExcel(excel_lst, response);
|
||||
FileUtil.downloadExcel(excel_lst,response);
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user