库存可视化div内新增规格字段;库存查询新增查询条件和导出EXCEL功能

This commit is contained in:
2023-04-03 11:27:48 +08:00
parent fd19c38bd5
commit 431682131a
7 changed files with 206 additions and 94 deletions

View File

@@ -14,6 +14,7 @@ import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Map;
@@ -53,4 +54,10 @@ public class StructIvtController {
return new ResponseEntity<>(structivtService.queryIvt(whereJson, page), HttpStatus.OK);
}
@Log("导出数据")
@ApiOperation("导出数据")
@GetMapping(value = "/download")
public void download(@RequestParam Map map, HttpServletResponse response) throws IOException {
structivtService.download(map, response);
}
}

View File

@@ -3,6 +3,8 @@ package org.nl.wms.st.ivt.service;
import org.springframework.data.domain.Pageable;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Map;
/**
@@ -30,4 +32,5 @@ public interface StructIvtService {
Map<String, Object> queryIvt(Map whereJson, Pageable page);
void download(Map map, HttpServletResponse response) throws IOException;
}

View File

@@ -2,18 +2,23 @@
package org.nl.wms.st.ivt.service.impl;
import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONArray;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import com.alibaba.fastjson.JSONObject;
import org.nl.utils.FileUtil;
import org.nl.wms.st.ivt.service.StructIvtService;
import org.nl.wql.WQL;
import org.nl.wql.util.WqlUtil;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.*;
/**
* @author ldjun
@@ -38,6 +43,9 @@ public class StructIvtServiceImpl implements StructIvtService {
json.put("col_num", whereJson.get("col_num"));
json.put("layer_num", whereJson.get("layer_num"));
json.put("barcode", whereJson.get("barcode"));
json.put("pcsn", whereJson.get("pcsn"));
json.put("begin_time", whereJson.get("begin_time"));
json.put("end_time", whereJson.get("end_time"));
JSONObject result = WQL.getWO("QST_structIvt_01").addParamMap(json).pageQuery(WqlUtil.getHttpContext(page), "ivt.barcode");
return result;
}
@@ -54,23 +62,62 @@ public class StructIvtServiceImpl implements StructIvtService {
@Override
public Map<String, Object> queryIvt(Map whereJson, Pageable page) {
HashMap json = new HashMap<>();
json.put("flag","2");
json.put("flag", "2");
String search = (String) whereJson.get("search");
String sect_uuid = (String) whereJson.get("sect_uuid");
String store_uuid = (String) whereJson.get("store_uuid");
if(!StrUtil.isEmpty(search)) {
json.put("search",search);
if (!StrUtil.isEmpty(search)) {
json.put("search", search);
}
if(!StrUtil.isEmpty(sect_uuid)) {
json.put("sect_uuid",sect_uuid);
if (!StrUtil.isEmpty(sect_uuid)) {
json.put("sect_uuid", sect_uuid);
}
if(!StrUtil.isEmpty(store_uuid)) {
json.put("store_uuid",store_uuid);
if (!StrUtil.isEmpty(store_uuid)) {
json.put("store_uuid", store_uuid);
}
JSONObject result = WQL.getWO("QST_structIvt_01").addParamMap(json).pageQuery(WqlUtil.getHttpContext(page), "mater.material_code desc");
return result;
}
@Override
public void download(Map whereJson, HttpServletResponse response) throws IOException {
//QST_structIvt_01
HashMap map = new HashMap<>();
map.put("flag", "1");
map.put("material_blury", whereJson.get("material_blury"));
map.put("struct_blury", whereJson.get("struct_blury"));
map.put("vehicle_code", whereJson.get("vehicle_code"));
map.put("sect_uuid", whereJson.get("sect_uuid"));
map.put("row_num", whereJson.get("row_num"));
map.put("col_num", whereJson.get("col_num"));
map.put("layer_num", whereJson.get("layer_num"));
map.put("barcode", whereJson.get("barcode"));
map.put("pcsn", whereJson.get("pcsn"));
map.put("begin_time", whereJson.get("begin_time"));
map.put("end_time", whereJson.get("end_time"));
JSONArray result = WQL.getWO("QST_structIvt_01").addParamMap(map).process().getResultJSONArray(0);
List<Map<String, Object>> list = new ArrayList<>();
for (int i = 0; i < result.size(); i++) {
JSONObject json = result.getJSONObject(i);
Map<String, Object> mp = new LinkedHashMap<>();
mp.put("物料编码", json.getString("material_code"));
mp.put("物料名称", json.getString("material_name"));
mp.put("物料规格", json.getString("material_spec"));
mp.put("批次", json.getString("pcsn"));
mp.put("仓位编码", json.getString("struct_code"));
mp.put("仓位名称", json.getString("struct_name"));
mp.put("载具号", json.getString("vehicle_code"));
mp.put("条形码", json.getString("barcode"));
mp.put("库区名称", json.getString("sect_name"));
mp.put("可用数量", json.getString("canuse_qty"));
mp.put("数量单位", json.getString("qty_unit_name"));
mp.put("质检状态", json.getString("quality_status"));
mp.put("入库时间", json.getString("instorage_time"));
list.add(mp);
}
FileUtil.downloadExcel(list, response);
}
}

View File

@@ -24,6 +24,9 @@
输入.sect_uuid TYPEAS s_string
输入.store_uuid TYPEAS s_string
输入.search TYPEAS s_string
输入.pcsn TYPEAS s_string
输入.begin_time TYPEAS s_string
输入.end_time TYPEAS s_string
输入.barcode TYPEAS barcode
[临时表]
@@ -99,6 +102,15 @@
ENDOPTION
OPTION 输入.barcode <> ""
ivt.barcode like "%" 输入.barcode "%"
ENDOPTION
OPTION 输入.begin_time <> ""
ivt.instorage_time >= 输入.begin_time
ENDOPTION
OPTION 输入.end_time <> ""
ivt.instorage_time <= 输入.end_time
ENDOPTION
OPTION 输入.pcsn <> ""
ivt.pcsn like "%" 输入.pcsn "%"
ENDOPTION
ENDSELECT
ENDPAGEQUERY