代码更新

This commit is contained in:
2023-04-07 17:26:34 +08:00
parent e1d62ea255
commit 93e64bf6d4
8 changed files with 202 additions and 9 deletions

View File

@@ -17,6 +17,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;
/**
@@ -62,4 +64,11 @@ public class InBillQueryController {
inBillQueryService.deleteAll(ids);
return new ResponseEntity<>(HttpStatus.OK);
}
@Log("导出数据")
@ApiOperation("导出数据")
@GetMapping(value = "/download")
public void download(@RequestParam Map map, HttpServletResponse response) throws IOException {
inBillQueryService.download(map, response);
}
}

View File

@@ -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;
/**
@@ -61,4 +63,11 @@ public class OutBillQueryController {
outBillQueryService.deleteAll(ids);
return new ResponseEntity<>(HttpStatus.OK);
}
@Log("导出数据")
@ApiOperation("导出数据")
@GetMapping(value = "/download")
public void download(@RequestParam Map map, HttpServletResponse response) throws IOException {
outBillQueryService.download(map, response);
}
}

View File

@@ -5,6 +5,8 @@ import com.alibaba.fastjson.JSONObject;
import org.nl.wms.sch.service.dto.PointDto;
import org.springframework.data.domain.Pageable;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
import java.util.Map;
@@ -53,4 +55,5 @@ public interface InBillQueryService {
*/
void deleteAll(Long[] ids);
void download(Map map, HttpServletResponse response) throws IOException;
}

View File

@@ -5,6 +5,8 @@ import com.alibaba.fastjson.JSONObject;
import org.nl.wms.sch.service.dto.PointDto;
import org.springframework.data.domain.Pageable;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
import java.util.Map;
@@ -53,4 +55,5 @@ public interface OutBillQueryService {
*/
void deleteAll(Long[] ids);
void download(Map map, HttpServletResponse response) throws IOException;
}

View File

@@ -12,6 +12,7 @@ import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.common.utils.SecurityUtils;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.common.utils.FileUtil;
import org.nl.modules.wql.WQL;
import org.nl.modules.wql.core.bean.WQLObject;
import org.nl.modules.wql.util.WqlUtil;
@@ -24,9 +25,9 @@ import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.*;
/**
* @author Liuxy
@@ -95,4 +96,52 @@ public class InBillQueryServiceImpl implements InBillQueryService {
wo.update(param);
}
}
@Override
public void download(Map map, HttpServletResponse response) throws IOException {
String stor_id = MapUtil.getStr(map, "stor_id");
String bill_type = MapUtil.getStr(map, "bill_type");
String with = MapUtil.getStr(map, "with"); // 厚度*幅宽
String begin_time = MapUtil.getStr(map, "begin_time");
String end_time = MapUtil.getStr(map, "end_time");
JSONObject mapParam = new JSONObject();
mapParam.put("flag", "1");
mapParam.put("stor_id",stor_id);
mapParam.put("bill_type",bill_type);
mapParam.put("with",with);
mapParam.put("begin_time",begin_time);
mapParam.put("end_time",end_time);
JSONArray resultJSONArray = WQL.getWO("ST_IVT_INBILLQUERY").addParamMap(mapParam).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("stor_name"));
mp.put("库区", json.getString("sect_name"));
mp.put("仓位编码", json.getString("struct_code"));
mp.put("仓位名称", json.getString("struct_name"));
mp.put("木箱号", json.getString("box_no"));
mp.put("物料编码", json.getString("material_code"));
mp.put("物料名称", json.getString("material_name"));
mp.put("子卷号", json.getString("pcsn"));
mp.put("sap批次", json.getString("sap_pcsn"));
mp.put("净重", json.getString("net_weight"));
mp.put("单位", json.getString("qty_unit_name"));
mp.put("客户编码", json.getString("customer_name"));
mp.put("客户名称", json.getString("customer_description"));
mp.put("销售订单", json.getString("sale_order_name"));
mp.put("入库日期", json.getString("input_time"));
mp.put("生产日期", json.getString("date_of_production"));
mp.put("产品规格", json.getString("width"));
mp.put("产品厚度", json.getString("thickness"));
mp.put("单位面积", json.getString("mass_per_unit_area"));
mp.put("制单人", json.getString("input_optname"));
mp.put("备注", json.getString("remark"));
list.add(mp);
}
FileUtil.downloadExcel(list, response);
}
}

View File

@@ -8,6 +8,7 @@ import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.common.utils.SecurityUtils;
import org.nl.modules.common.utils.FileUtil;
import org.nl.modules.wql.WQL;
import org.nl.modules.wql.core.bean.WQLObject;
import org.nl.modules.wql.util.WqlUtil;
@@ -18,6 +19,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;
@@ -90,4 +95,56 @@ public class OutBillQueryServiceImpl implements OutBillQueryService {
wo.update(param);
}
}
@Override
public void download(Map map, HttpServletResponse response) throws IOException {
String stor_id = MapUtil.getStr(map, "stor_id");
String bill_type = MapUtil.getStr(map, "bill_type");
String with = MapUtil.getStr(map, "with"); // 厚度*幅宽
String begin_time = MapUtil.getStr(map, "begin_time");
String end_time = MapUtil.getStr(map, "end_time");
String customer_name = MapUtil.getStr(map, "customer_name");
JSONObject mapParam = new JSONObject();
mapParam.put("flag", "1");
mapParam.put("stor_id",stor_id);
mapParam.put("bill_type",bill_type);
mapParam.put("with",with);
mapParam.put("begin_time",begin_time);
mapParam.put("end_time",end_time);
if (ObjectUtil.isNotEmpty(customer_name)) mapParam.put("customer_name","%"+customer_name+"%");
JSONArray resultJSONArray = WQL.getWO("ST_IVT_OUTBILLQUERY").addParamMap(mapParam).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("stor_name"));
mp.put("库区", json.getString("sect_name"));
mp.put("交货单号", json.getString("vbeln"));
mp.put("物流公司", json.getString("cust_name"));
mp.put("运费", json.getString("estimated_freight"));
mp.put("木箱号", json.getString("box_no"));
mp.put("物料编码", json.getString("material_code"));
mp.put("物料名称", json.getString("material_name"));
mp.put("子卷号", json.getString("pcsn"));
mp.put("sap批次", json.getString("sap_pcsn"));
mp.put("净重", json.getString("net_weight"));
mp.put("单位", json.getString("qty_unit_name"));
mp.put("客户编码", json.getString("customer_name"));
mp.put("发货客户名称", json.getString("customer_description"));
mp.put("销售订单", json.getString("sale_order_name"));
mp.put("出库日期", json.getString("input_time"));
mp.put("产品规格", json.getString("width"));
mp.put("产品厚度", json.getString("thickness"));
mp.put("单位面积", json.getString("mass_per_unit_area"));
mp.put("制单人", json.getString("input_optname"));
mp.put("备注", json.getString("remark"));
list.add(mp);
}
FileUtil.downloadExcel(list, response);
}
}

View File

@@ -72,7 +72,19 @@
</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-thumb"
size="mini"
:loading="showDtlLoading"
@click="downdtl"
>
导出
</el-button>
</crudOperation>
<!--表格渲染-->
<el-table
ref="table"
@@ -120,6 +132,8 @@ import pagination from '@crud/Pagination'
import DateRangePicker from '@/components/DateRangePicker/index'
import crudUserStor from '@/views/wms/basedata/st/userStor/userStor'
import crudInbillquery from '@/views/wms/stat/inbillquery/inbillquery'
import { download } from '@/api/data'
import { downloadFile } from '@/utils'
export default {
name: 'InQuery',
@@ -139,7 +153,8 @@ export default {
data() {
return {
height: document.documentElement.clientHeight - 180 + 'px;',
storlist: []
storlist: [],
showDtlLoading: false
}
},
mounted: function() {
@@ -157,7 +172,23 @@ export default {
bill_typeFormat(row, column) {
return this.dict.label.ST_INV_IN_TYPE[row.bill_type]
},
[CRUD.HOOK.beforeRefresh]() {
downdtl() {
if (this.currentRow !== null) {
crud.downloadLoading = true
const data = {
'stor_id': this.crud.query.stor_id,
'bill_type': this.crud.query.bill_type,
'with': this.crud.query.with,
'begin_time': this.crud.query.createTime[0],
'end_time': this.crud.query.createTime[1]
}
download('/api/in/InQuery/download', data).then(result => {
downloadFile(result, '成品入库查询', 'xlsx')
crud.downloadLoading = false
}).catch(() => {
crud.downloadLoading = false
})
}
}
}
}

View File

@@ -81,7 +81,19 @@
</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-thumb"
size="mini"
:loading="showDtlLoading"
@click="downdtl"
>
导出
</el-button>
</crudOperation>
<!--表格渲染-->
<el-table
ref="table"
@@ -129,6 +141,8 @@ import pagination from '@crud/Pagination'
import DateRangePicker from '@/components/DateRangePicker/index'
import crudUserStor from '@/views/wms/basedata/st/userStor/userStor'
import crudOutbillquery from '@/views/wms/stat/outbillquery/outbillquery'
import { download } from '@/api/data'
import { downloadFile } from '@/utils'
export default {
name: 'OutQuery',
@@ -148,7 +162,8 @@ export default {
data() {
return {
height: document.documentElement.clientHeight - 180 + 'px;',
storlist: []
storlist: [],
showDtlLoading: false
}
},
mounted: function() {
@@ -166,7 +181,24 @@ export default {
bill_typeFormat(row, column) {
return this.dict.label.ST_INV_OUT_TYPE[row.bill_type]
},
[CRUD.HOOK.beforeRefresh]() {
downdtl() {
if (this.currentRow !== null) {
crud.downloadLoading = true
const data = {
'stor_id': this.crud.query.stor_id,
'bill_type': this.crud.query.bill_type,
'with': this.crud.query.with,
'customer_name': this.crud.query.customer_name,
'begin_time': this.crud.query.createTime[0],
'end_time': this.crud.query.createTime[1]
}
download('/api/out/OutQuery/download', data).then(result => {
downloadFile(result, '成品出库查询', 'xlsx')
crud.downloadLoading = false
}).catch(() => {
crud.downloadLoading = false
})
}
}
}
}