add:外协发货功能修改

This commit is contained in:
zhangzhiqiang
2023-01-11 17:19:03 +08:00
parent 310a5931d2
commit 10348780b4
6 changed files with 231 additions and 6 deletions

View File

@@ -13,6 +13,7 @@ import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.Map;
/**
@@ -116,4 +117,10 @@ public class StatisticalReportController {
query4(whereJson),HttpStatus.OK);
}
@ApiOperation("导出数据")
@GetMapping(value = "/download")
public void download(HttpServletResponse response, @RequestParam Map whereJson){
statisticalReportService.download(response, whereJson);
}
}

View File

@@ -3,6 +3,7 @@ package org.nl.wms.statistics.service;
import com.alibaba.fastjson.JSONArray;
import org.springframework.data.domain.Pageable;
import javax.servlet.http.HttpServletResponse;
import java.util.Map;
/**
@@ -57,4 +58,11 @@ public interface StatisticalReportService {
* @return Map<String, Object>
*/
Map<String, Object> confirmOutStore(JSONArray jsonObject);
/**
* 导出外协数据
* @param response
* @param whereJson
*/
void download(HttpServletResponse response,Map whereJson);
}

View File

@@ -8,21 +8,29 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.nl.exception.BadRequestException;
import org.nl.modules.system.domain.Dept;
import org.nl.modules.system.repository.DeptRepository;
import org.nl.modules.system.service.DeptService;
import org.nl.modules.system.service.UserService;
import org.nl.modules.system.service.dto.UserDto;
import org.nl.pda.exception.PdaRequestException;
import org.nl.utils.FileUtil;
import org.nl.utils.SecurityUtils;
import org.nl.wms.common.util.DataAuthUtil;
import org.nl.wms.statistics.service.StatisticalReportService;
import org.nl.wql.WQL;
import org.nl.wql.core.bean.WQLObject;
import org.nl.wql.util.WqlUtil;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.servlet.http.HttpServletResponse;
import java.util.*;
import java.util.stream.Collectors;
@@ -32,6 +40,7 @@ import java.util.stream.Collectors;
public class StatisticalReportServiceImpl implements StatisticalReportService {
private final UserService userService;
private final DeptRepository deptService;
@Override
public Map<String, Object> sendOutQuery(Map whereJson, Pageable page) {
@@ -70,7 +79,7 @@ public class StatisticalReportServiceImpl implements StatisticalReportService {
map.put("is_send0", "0");
}
}else if (StrUtil.isEmpty(is_send)) {
map.put("is_send0", "0");
// map.put("is_send0", "0");
}
map.put("flag", "5");
JSONObject jo = WQL.getWO("statistical_report_query_02").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "send_date,material_code,pcsn");
@@ -603,4 +612,36 @@ public class StatisticalReportServiceImpl implements StatisticalReportService {
returnjo.put("desc", "操作成功!");
return returnjo;
}
@Override
@SneakyThrows
public void download(HttpServletResponse response, Map whereJson) {
Map<String, Object> result = this.sendOutQuery(new HashMap(), PageRequest.of(0,99999));
Object content = result.get("content");
if (content !=null){
List<Dept> depts = deptService.findAll();
Map<Long, String> deptInfo = depts.stream().collect(Collectors.toMap(Dept::getId, Dept::getName));
JSONArray list = (JSONArray) content;
List<Map<String, Object>> excelData = new ArrayList<>();
for (int i = 0; i < list.size(); i++) {
Map<String, Object> dtl_map = new LinkedHashMap<>();
JSONObject row = (JSONObject)list.get(i);
dtl_map.put("序号", i+1);
dtl_map.put("物料编码", row.getString("material_code"));
dtl_map.put("批次号", row.getString("pcsn"));
dtl_map.put("重量", row.getString("total_qty"));
dtl_map.put("桶数", row.getString("num_bucket"));
dtl_map.put("计划发货时间", row.getString("send_date"));
String clientName = "";
if (!StringUtils.isEmpty(row.getString("org_id"))){
clientName = deptInfo.get(row.getLong("org_id"));
}
dtl_map.put("客户名称", clientName);
dtl_map.put("备注", "");
excelData.add(dtl_map);
}
FileUtil.downloadExcel(excelData, response);
}
}
}

View File

@@ -195,7 +195,6 @@
SELECT
procedureoffline2.num_bucket,
procedureoffline2.total_qty,
procedureoffline.diskrecord_id,
procedureoffline.storagevehicle_code,
procedureoffline.is_send AS is_send,
procedureoffline.send_name AS send_name,
@@ -258,6 +257,7 @@
OPTION 输入.is_send12 <> ""
(procedureoffline.is_send = 输入.is_send12)
ENDOPTION
GROUP BY workorder.workorder_id,workorder.pcsn,procedureoffline.storagevehicle_code
ENDSELECT
ENDPAGEQUERY
ENDIF

View File

@@ -0,0 +1,135 @@
<template>
<el-dialog
title="库存明细桶查询"
append-to-body
:visible.sync="dialogVisible"
destroy-on-close
width="1000px"
@close="close"
@open="open"
>
<div class="head-container">
<!--如果想在工具栏加入更多按钮可以使用插槽方式 slot = 'left' or 'right'-->
<crudOperation />
<!--表格渲染-->
<el-table
ref="deviceTable"
v-loading="crud.loading"
:data="crud.data"
style="width: 100%;"
size="mini"
@selection-change="crud.selectionChangeHandler"
>
<el-table-column show-overflow-tooltip prop="storagevehicle_code" label="托盘号" />
<el-table-column show-overflow-tooltip prop="bucketunique" label="桶号" width="150px">
<template slot-scope="scope">
<el-link type="warning" @click="openBag(scope.row)">{{ scope.row.bucketunique }}</el-link>
</template>
</el-table-column>
<el-table-column show-overflow-tooltip min-width="130" prop="material_code" label="物料编码" />
<el-table-column show-overflow-tooltip min-width="130" prop="material_name" label="物料名称" />
<el-table-column show-overflow-tooltip prop="material_spec" label="规格" />
<el-table-column show-overflow-tooltip prop="material_model" label="型号" />
<el-table-column show-overflow-tooltip min-width="130" prop="pcsn" label="批次" />
<el-table-column show-overflow-tooltip prop="quality_scode" label="品质类型" :formatter="format_quality_scode"/>
<el-table-column show-overflow-tooltip prop="ivt_level" label="库存等级" :formatter="format_ivt_level"/>
<el-table-column show-overflow-tooltip prop="is_active" label="是否可用" :formatter="format_is_active"/>
<el-table-column show-overflow-tooltip prop="storage_qty" label="重量" :formatter="crud.formatNum3"/>
<el-table-column show-overflow-tooltip prop="record_order" label="顺序号" />
<el-table-column show-overflow-tooltip prop="bag_qty" label="袋数" />
<el-table-column show-overflow-tooltip prop="unit_name" label="单位" />
</el-table>
<!--分页组件-->
<pagination />
<BagDialog :dialog-show.sync="bagDialog" :open-param-one="openParamOne"/>
</div>
</el-dialog>
</template>
<script>
import CRUD, { presenter, header } from '@crud/crud'
import crudOperation from '@crud/CRUD.operation'
import pagination from '@crud/Pagination'
import crudOrderproc from '@/api/wms/pcs/orderproc'
import BagDialog from '@/views/wms/statistics/ivtQuery/BagDialog'
export default {
name: 'ReceiveDialog',
dicts: ['ST_QUALITY_SCODE', 'ST_IVT_LEVEL', 'is_usable'],
components: { crudOperation, pagination, BagDialog },
mixins: [presenter(), header()],
cruds() {
return CRUD({
url: 'api/ivtQuery/bucketQuery',
idField: 'id',
sort: 'id,desc',
crudMethod: { ... crudOrderproc },
optShow: {
add: false,
edit: false,
del: false,
download: false,
reset: false
}
})
},
props: {
dialogShow: {
type: Boolean,
default: false
},
openParam: {
type: String
}
},
data() {
return {
dialogVisible: false,
openParamOne: null,
bagDialog: false
}
},
watch: {
dialogShow: {
handler(newValue, oldValue) {
this.dialogVisible = newValue
this.crud.query.storagevehicle_code = this.openParam
}
}
},
methods: {
handleClose(done) {
this.$confirm('确认关闭?')
.then(_ => {
done()
})
.catch(_ => {
})
},
close() {
this.$emit('update:dialogShow', false)
},
open() {
this.crud.toQuery()
},
format_quality_scode(row, column) {
return this.dict.label.ST_QUALITY_SCODE[row.quality_scode]
},
format_ivt_level(row, column) {
return this.dict.label.ST_IVT_LEVEL[row.ivt_level]
},
format_is_active(row, column) {
return this.dict.label.is_usable[row.is_active]
},
openBag(row) {
this.openParamOne = row.bucketunique
this.bagDialog = true
}
}
}
</script>
<style scoped>
</style>

View File

@@ -121,6 +121,16 @@
>
确认发货
</el-button>
<el-button
slot="right"
class="filter-item"
type="success"
icon="el-icon-check"
size="mini"
@click="downExcel"
>
导出Excel
</el-button>
</crudOperation>
<!--表格渲染-->
<el-table
@@ -140,7 +150,11 @@
<el-table-column prop="pcsn" label="批次" min-width="100" />
<el-table-column :formatter="crud.formatNum3" prop="workorder_qty" label="重量" width="150px" />
<el-table-column prop="workorder_status" label="工令状态" width="150px" :formatter="stateFormat" />
<el-table-column prop="storagevehicle_code" label="托盘号" />
<el-table-column prop="storagevehicle_code" label="托盘号">
<template slot-scope="scope">
<el-link type="warning" @click="openBucket(scope.row)">{{ scope.row.storagevehicle_code }}</el-link>
</template>
</el-table-column>
<el-table-column prop="num_bucket" label="桶数" />
<el-table-column prop="total_qty" label="托盘重量" min-width="120px" />
<el-table-column prop="create_name" label="组盘人" />
@@ -154,6 +168,7 @@
<!--分页组件-->
<pagination />
</div>
<BucketDialog :dialog-show.sync="bucketDialog" :open-param="openParam" />
</div>
</template>
@@ -165,11 +180,14 @@ import crudOperation from '@crud/CRUD.operation'
import pagination from '@crud/Pagination'
import report from '@/api/wms/statistics/report'
import workorder from '@/api/wms/pdm/workorder'
import BucketDialog from '@/views/wms/statistics/sendOutQuery/BucketDialog'
import { download } from '@/api/data'
import { downloadFile } from '@/utils'
export default {
name: 'SendOutQuery',
dicts: ['workorder_status', 'ST_INV_TYPE_RC'],
components: { pagination, crudOperation, rrOperation },
components: { pagination, crudOperation, rrOperation, BucketDialog },
mixins: [presenter(), header(), crud()],
cruds() {
return CRUD({
@@ -181,7 +199,7 @@ export default {
// 每页数据条数
size: 20
},
query: { is_send: '1' },
query: { },
crudMethod: { ...crudInspectionsheetmst },
optShow: {
add: false,
@@ -193,12 +211,13 @@ export default {
},
data() {
return {
bucketDialog: false,
statusList: [],
resultList: [],
currentRow: {},
Depts: [],
resultPutDialog: false,
openParam: {},
openParam: null,
query_flag: true,
passList: [
{ 'label': '未出库', 'value': '0' },
@@ -221,6 +240,17 @@ export default {
checkboxT(row) {
return row.is_send === '1'
},
downExcel() {
if (this.currentRow !== null) {
crud.downloadLoading = true
download('/api/statistical/download', this.crud.query).then(result => {
downloadFile(result, '外协发货单', 'xlsx')
crud.downloadLoading = false
}).catch(() => {
crud.downloadLoading = false
})
}
},
typeChange() {
this.checkrows = this.$refs.table.selection
this.$confirm('是否确认发货?', '提示', {
@@ -233,6 +263,10 @@ export default {
})
})
},
openBucket(row) {
this.openParam = row.storagevehicle_code
this.bucketDialog = true
},
orgFormat(row) {
for (const item of this.Depts) {
if (item.id === row.org_id) {