代码更新
This commit is contained in:
@@ -1,17 +1,22 @@
|
||||
package org.nl.wms.st.returns.rest;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.modules.logging.annotation.Log;
|
||||
import org.nl.modules.wql.util.SpringContextHolder;
|
||||
import org.nl.wms.st.outbill.service.impl.CheckOutBillServiceImpl;
|
||||
import org.nl.wms.st.returns.service.InAndOutReturnService;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@@ -62,4 +67,11 @@ public class InAndOutReturnlController {
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@ApiOperation("导出数据")
|
||||
@GetMapping(value = "/download")
|
||||
public void download(HttpServletResponse response, @RequestParam Map whereJson) throws IOException {
|
||||
JSONArray outBillDis = SpringContextHolder.getBean(CheckOutBillServiceImpl.class).getOutBillDis(whereJson);
|
||||
inAndOutReturnService.download(outBillDis, response);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -4,6 +4,8 @@ import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
|
||||
public interface InAndOutReturnService {
|
||||
@@ -24,4 +26,6 @@ public interface InAndOutReturnService {
|
||||
|
||||
void disupload(JSONObject whereJson);
|
||||
|
||||
void download(JSONArray arr, HttpServletResponse response) throws IOException;
|
||||
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.modules.common.utils.FileUtil;
|
||||
import org.nl.system.service.param.impl.SysParamServiceImpl;
|
||||
import org.nl.system.service.user.ISysUserService;
|
||||
import org.nl.system.service.user.dao.SysUser;
|
||||
@@ -32,9 +33,9 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.transaction.support.TransactionCallbackWithoutResult;
|
||||
import org.springframework.transaction.support.TransactionTemplate;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* PC端出入库新增
|
||||
@@ -675,6 +676,40 @@ public class InAndOutRetrunServiceImpl implements InAndOutReturnService {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void download(JSONArray array, HttpServletResponse response) throws IOException {
|
||||
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
|
||||
for (int i = 0; i < array.size(); i++) {
|
||||
JSONObject json = array.getJSONObject(i);
|
||||
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
|
||||
map.put("物料编码", json.getString("material_code"));
|
||||
map.put("物料名称", json.getString("material_name"));
|
||||
map.put("子卷批次号", json.getString("pcsn"));
|
||||
map.put("sap批次", json.getString("sap_pcsn"));
|
||||
map.put("箱号", json.getString("box_no"));
|
||||
map.put("重量", json.getString("real_qty"));
|
||||
map.put("仓位", json.getString("struct_code"));
|
||||
|
||||
String statusName = "";
|
||||
if (StrUtil.equals(json.getString("work_status"), "00")) {
|
||||
statusName = "未生成";
|
||||
} else if (StrUtil.equals(json.getString("work_status"), "01")) {
|
||||
statusName = "生成";
|
||||
} else if (StrUtil.equals(json.getString("work_status"), "02")) {
|
||||
statusName = "执行中";
|
||||
} else if (StrUtil.equals(json.getString("work_status"), "99")) {
|
||||
statusName = "完成";
|
||||
}
|
||||
map.put("状态", statusName);
|
||||
list.add(map);
|
||||
}
|
||||
FileUtil.downloadExcel(list, response);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void upload(JSONObject whereJson) {
|
||||
//出库分配表
|
||||
|
||||
@@ -208,6 +208,18 @@
|
||||
>
|
||||
不回传
|
||||
</el-button>
|
||||
<el-button
|
||||
slot="right"
|
||||
class="filter-item"
|
||||
type="success"
|
||||
icon="el-icon-thumb"
|
||||
size="mini"
|
||||
:loading="showDtlLoading"
|
||||
:disabled="crud.selections.length !== 1"
|
||||
@click="downdtl"
|
||||
>
|
||||
导出
|
||||
</el-button>
|
||||
</crudOperation>
|
||||
<!--表格渲染-->
|
||||
<el-table
|
||||
@@ -267,6 +279,8 @@ import crudOperation from '@crud/CRUD.operation'
|
||||
import pagination from '@crud/Pagination'
|
||||
import ViewDialog from '@/views/wms/st/inAndOutReturn/ViewDialog'
|
||||
import crudUserStor from '@/views/wms/basedata/st/userStor/userStor'
|
||||
import { download } from '@/api/data'
|
||||
import { downloadFile } from '@/utils'
|
||||
|
||||
export default {
|
||||
name: 'Return',
|
||||
@@ -295,7 +309,8 @@ export default {
|
||||
mstrow: {},
|
||||
fullscreenLoading: false,
|
||||
storlist: [],
|
||||
billtypelist: []
|
||||
billtypelist: [],
|
||||
showDtlLoading: false
|
||||
}
|
||||
},
|
||||
mounted: function() {
|
||||
@@ -453,6 +468,18 @@ export default {
|
||||
} else if (row.upload_sap === '1') {
|
||||
return '是'
|
||||
}
|
||||
},
|
||||
downdtl() {
|
||||
const _selectData = this.$refs.table.selection
|
||||
if (this.currentRow !== null) {
|
||||
crud.downloadLoading = true
|
||||
download('/api/inandoutreturn/download', { 'iostorinv_id': _selectData[0].iostorinv_id }).then(result => {
|
||||
downloadFile(result, '出入库单据明细', 'xlsx')
|
||||
crud.downloadLoading = false
|
||||
}).catch(() => {
|
||||
crud.downloadLoading = false
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user