代码更新
This commit is contained in:
@@ -16,6 +16,8 @@ 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;
|
||||
|
||||
/**
|
||||
@@ -90,4 +92,11 @@ public class StructivtController {
|
||||
return new ResponseEntity<>(structivtService.getUnits(),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("导出数据")
|
||||
@ApiOperation("导出数据")
|
||||
@GetMapping(value = "/download")
|
||||
public void download(@RequestParam Map map, HttpServletResponse response) throws IOException {
|
||||
structivtService.download(map, response);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -6,6 +6,8 @@ import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.wms.basedata.st.service.dto.StructivtDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -69,4 +71,6 @@ public interface StructivtService {
|
||||
JSONObject getStructById(JSONObject param);
|
||||
|
||||
JSONArray getUnits();
|
||||
|
||||
void download(Map map, HttpServletResponse response) throws IOException;
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.common.utils.FileUtil;
|
||||
import org.nl.modules.common.utils.SecurityUtils;
|
||||
import org.nl.wms.basedata.master.service.ClassstandardService;
|
||||
import org.nl.wms.basedata.st.service.StructivtService;
|
||||
@@ -24,6 +25,10 @@ import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -168,4 +173,68 @@ public class StructivtServiceImpl implements StructivtService {
|
||||
return resultJSONArray;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void download(Map whereJson, HttpServletResponse response) throws IOException {
|
||||
String material = MapUtil.getStr(whereJson, "material");
|
||||
String struct = MapUtil.getStr(whereJson, "struct");
|
||||
String stor_id = MapUtil.getStr(whereJson, "stor_id");
|
||||
String pcsn = MapUtil.getStr(whereJson, "pcsn");
|
||||
String sap_pcsn = MapUtil.getStr(whereJson, "sap_pcsn");
|
||||
String package_box_sn = MapUtil.getStr(whereJson, "package_box_sn");
|
||||
String sale_order_name = MapUtil.getStr(whereJson, "sale_order_name");
|
||||
JSONObject map = new JSONObject();
|
||||
map.put("flag", "1");
|
||||
map.put("stor_id", stor_id);
|
||||
if (StrUtil.isNotEmpty(material)) {
|
||||
map.put("material", "%" + material + "%");
|
||||
}
|
||||
if (StrUtil.isNotEmpty(struct)) {
|
||||
map.put("struct", "%" + struct + "%");
|
||||
}
|
||||
if (StrUtil.isNotEmpty(pcsn)) {
|
||||
map.put("pcsn", "%" + pcsn + "%");
|
||||
}
|
||||
if (StrUtil.isNotEmpty(sap_pcsn)) {
|
||||
map.put("sap_pcsn", "%" + sap_pcsn + "%");
|
||||
}
|
||||
if (StrUtil.isNotEmpty(package_box_sn)) {
|
||||
map.put("package_box_sn", "%" + package_box_sn + "%");
|
||||
}
|
||||
if (StrUtil.isNotEmpty(sale_order_name)) {
|
||||
map.put("sale_order_name", "%" + sale_order_name + "%");
|
||||
}
|
||||
|
||||
//获取人员对应的仓库
|
||||
UserStorServiceImpl userStorService = new UserStorServiceImpl();
|
||||
String in_stor_id = userStorService.getInStor();
|
||||
|
||||
if (ObjectUtil.isNotEmpty(in_stor_id)) map.put("in_stor_id",in_stor_id);
|
||||
|
||||
JSONArray resultJSONArray = WQL.getWO("QST_STRUCTIVT001").addParamMap(map).process().getResultJSONArray(0);
|
||||
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
for (int i = 0; i < resultJSONArray.size(); i++) {
|
||||
JSONObject json = resultJSONArray.getJSONObject(i);
|
||||
Map<String, Object> mp = new LinkedHashMap<>();
|
||||
|
||||
mp.put("仓位编码", json.getString("struct_code"));
|
||||
mp.put("仓位名称", json.getString("struct_name"));
|
||||
mp.put("仓库", json.getString("stor_name"));
|
||||
mp.put("库区", json.getString("sect_name"));
|
||||
mp.put("物料编码", json.getString("material_code"));
|
||||
mp.put("物料名称", json.getString("material_name"));
|
||||
mp.put("木箱码", json.getString("package_box_sn"));
|
||||
mp.put("子卷号", json.getString("pcsn"));
|
||||
mp.put("sap批次", json.getString("sap_pcsn"));
|
||||
mp.put("可用数", json.getString("canuse_qty"));
|
||||
mp.put("冻结数", json.getString("frozen_qty"));
|
||||
mp.put("库存数", json.getString("ivt_qty"));
|
||||
mp.put("待入数", json.getString("warehousing_qty"));
|
||||
mp.put("计量单位", json.getString("unit_name"));
|
||||
mp.put("入库时间", json.getString("instorage_time"));
|
||||
list.add(mp);
|
||||
}
|
||||
FileUtil.downloadExcel(list, response);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -92,7 +92,18 @@
|
||||
</el-form>
|
||||
</div>
|
||||
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
|
||||
<crudOperation :permission="permission" />
|
||||
<crudOperation :permission="permission">
|
||||
<el-button
|
||||
slot="right"
|
||||
class="filter-item"
|
||||
type="success"
|
||||
icon="el-icon-check"
|
||||
size="mini"
|
||||
@click="downdtl"
|
||||
>
|
||||
导出Excel
|
||||
</el-button>
|
||||
</crudOperation>
|
||||
<!--表格渲染-->
|
||||
<el-table ref="table" v-loading="crud.loading" :data="crud.data" size="mini" style="width: 100%;" @selection-change="crud.selectionChangeHandler">
|
||||
<el-table-column type="selection" width="55" />
|
||||
@@ -134,6 +145,8 @@ import pagination from '@crud/Pagination'
|
||||
import crudPoint from '@/views/wms/sch/point/point'
|
||||
import crudStorattr from '@/views/wms/basedata/st/stor/storattr'
|
||||
import crudUserStor from '@/views/wms/basedata/st/userStor/userStor'
|
||||
import { download } from '@/api/data'
|
||||
import { downloadFile } from '@/utils'
|
||||
|
||||
const defaultForm = { stockrecord_id: null, cascader: null, struct_id: null, struct_code: null, struct_name: null, workprocedure_id: null, material_id: null, material_code: null, quality_scode: null, pcsn: null, canuse_qty: null, frozen_qty: null, ivt_qty: null, warehousing_qty: null, qty_unit_id: null, instorage_time: null, sale_id: null }
|
||||
export default {
|
||||
@@ -177,6 +190,18 @@ export default {
|
||||
},
|
||||
hand(value) {
|
||||
this.crud.toQuery()
|
||||
},
|
||||
downdtl() {
|
||||
if (this.currentRow !== null) {
|
||||
crud.downloadLoading = true
|
||||
download('/api/structivt/download', this.crud.query).then(result => {
|
||||
debugger
|
||||
downloadFile(result, '成品库存', 'xlsx')
|
||||
crud.downloadLoading = false
|
||||
}).catch(() => {
|
||||
crud.downloadLoading = false
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user