销售退货

This commit is contained in:
DESKTOP-J7ED0MB\yinjinlu 2022-10-06 21:39:18 +08:00
parent 0e6ce424b1
commit e8ce2da049
3 changed files with 552 additions and 1 deletions

44
src/api/mes/wm/rtsalse.js Normal file
View File

@ -0,0 +1,44 @@
import request from '@/utils/request'
// 查询产品销售退货单列表
export function listRtsalse(query) {
return request({
url: '/mes/wm/rtsalse/list',
method: 'get',
params: query
})
}
// 查询产品销售退货单详细
export function getRtsalse(rtId) {
return request({
url: '/mes/wm/rtsalse/' + rtId,
method: 'get'
})
}
// 新增产品销售退货单
export function addRtsalse(data) {
return request({
url: '/mes/wm/rtsalse',
method: 'post',
data: data
})
}
// 修改产品销售退货单
export function updateRtsalse(data) {
return request({
url: '/mes/wm/rtsalse',
method: 'put',
data: data
})
}
// 删除产品销售退货单
export function delRtsalse(rtId) {
return request({
url: '/mes/wm/rtsalse/' + rtId,
method: 'delete'
})
}

View File

@ -253,7 +253,7 @@
</template>
<script>
import { listProductsalse, getProductsalse, delProductsalse, addProductsalse, updateProductsalse } from "@/api/mes/wm/productsalse";
import { listProductsalse, getProductsalse, delProductsalse, addProductsalse, updateProductsalse,execute } from "@/api/mes/wm/productsalse";
import Productsalseline from "./line.vue"
import OqcSelectSingle from "@/components/oqcSelect/single.vue"
import {getTreeList} from "@/api/mes/wm/warehouse"
@ -496,6 +496,16 @@ export default {
...this.queryParams
}, `productsalse_${new Date().getTime()}.xlsx`)
},
//
handleExecute(row){
const salseIds = row.salseId || this.ids;
this.$modal.confirm('确认执行出库?').then(function() {
return execute(salseIds)//
}).then(() => {
this.getList();
this.$modal.msgSuccess("出库成功");
}).catch(() => {});
},
//OQC
handleSelectOqc(){
this.$refs.oqcSelect.showFlag = true;

View File

@ -0,0 +1,497 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px">
<el-form-item label="退货单编号" prop="rtCode">
<el-input
v-model="queryParams.rtCode"
placeholder="请输入退货单编号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="销售订单编号" prop="soCode">
<el-input
v-model="queryParams.soCode"
placeholder="请输入销售订单编号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="客户名称" prop="clientName">
<el-input
v-model="queryParams.clientName"
placeholder="请输入客户名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="仓库名称" prop="warehouseName">
<el-input
v-model="queryParams.warehouseName"
placeholder="请输入仓库名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="单据状态" prop="status">
<el-select v-model="queryParams.status" placeholder="请选择单据状态" clearable>
<el-option
v-for="dict in dict.type.mes_order_status"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['mes:wm:rtsalse:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['mes:wm:rtsalse:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['mes:wm:rtsalse:remove']"
>删除</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="rtsalseList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="退货单编号" align="center" prop="rtCode" />
<el-table-column label="退货单名称" align="center" prop="rtName" />
<el-table-column label="销售订单编号" align="center" prop="soCode" />
<el-table-column label="客户名称" align="center" prop="clientName" />
<el-table-column label="仓库" align="center" prop="warehouseName" />
<el-table-column label="库区" align="center" prop="locationName" />
<el-table-column label="库位" align="center" prop="areaName" />
<el-table-column label="退货日期" align="center" prop="rtDate" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.rtDate, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="单据状态" align="center" prop="status">
<template slot-scope="scope">
<dict-tag :options="dict.type.mes_order_status" :value="scope.row.status"/>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['mes:wm:rtsalse:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['mes:wm:rtsalse:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改产品销售退货单对话框 -->
<el-dialog :title="title" :visible.sync="open" width="960px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
<el-row>
<el-col :span="8">
<el-form-item label="退货单编号" prop="rtCode">
<el-input v-model="form.rtCode" placeholder="请输入退货单编号" />
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label-width="80">
<el-switch v-model="autoGenFlag"
active-color="#13ce66"
active-text="自动生成"
@change="handleAutoGenChange(autoGenFlag)" v-if="optType != 'view' && form.status =='PREPARE'">
</el-switch>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="退货单名称" prop="rtName">
<el-input v-model="form.rtName" placeholder="请输入退货单名称" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="销售订单编号" prop="soCode">
<el-input v-model="form.soCode" placeholder="请输入销售订单编号" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="客户编号" prop="clientCode">
<el-input v-model="form.clientCode" readonly="readonly" placeholder="请输入客户编码" >
<el-button slot="append" @click="handleSelectClient" icon="el-icon-search"></el-button>
</el-input>
</el-form-item>
<ClientSelectSingle ref="clientSelect" @onSelected="handleClientSelect"></ClientSelectSingle>
</el-col>
<el-col :span="8">
<el-form-item label="客户名称" prop="clientName">
<el-input v-model="form.clientName" readonly="readonly" placeholder="请输入客户名称" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="退货日期" prop="rtDate">
<el-date-picker clearable
v-model="form.rtDate"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择退货日期">
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="单据状态" prop="status">
<el-select v-model="form.status" disabled placeholder="请选择单据状态">
<el-option
v-for="dict in dict.type.mes_order_status"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="退货原因" prop="rtReason">
<el-input v-model="form.rtReason" type="textarea" placeholder="请输入退货原因" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="cancel" v-if="optType =='view' || form.status !='PREPARE' ">返回</el-button>
<el-button type="primary" @click="submitForm" v-if="form.status =='PREPARE' && optType !='view' "> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listRtsalse, getRtsalse, delRtsalse, addRtsalse, updateRtsalse } from "@/api/mes/wm/rtsalse";
import ClientSelectSingle from "@/components/clientSelect/single.vue"
import {getTreeList} from "@/api/mes/wm/warehouse"
import {genCode} from "@/api/system/autocode/rule"
export default {
name: "Rtsalse",
dicts: ['mes_order_status'],
components: {
ClientSelectSingle
},
data() {
return {
//
autoGenFlag:false,
optType: undefined,
warehouseInfo:[],
warehouseOptions:[],
warehouseProps:{
multiple: false,
value: 'pId',
label: 'pName',
},
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
// 退
rtsalseList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
rtCode: null,
rtName: null,
soCode: null,
clientId: null,
clientCode: null,
clientName: null,
clientNick: null,
warehouseId: null,
warehouseCode: null,
warehouseName: null,
locationId: null,
locationCode: null,
locationName: null,
areaId: null,
areaCode: null,
areaName: null,
rtDate: null,
rtReason: null,
status: null,
attr1: null,
attr2: null,
attr3: null,
attr4: null,
},
//
form: {},
//
rules: {
rtCode: [
{ required: true, message: "退货单编号不能为空", trigger: "blur" }
],
rtName: [
{ required: true, message: "退货单名称不能为空", trigger: "blur" }
],
rtDate: [
{ required: true, message: "请选择退货日期", trigger: "blur" }
],
clientName: [
{ required: true, message: "请选择客户", trigger: "blur" }
],
rtReason: [
{ required: true, message: "请填写退货原因", trigger: "blur" }
]
}
};
},
created() {
this.getList();
this.getWarehouseList();
},
methods: {
/** 查询产品销售退货单列表 */
getList() {
this.loading = true;
listRtsalse(this.queryParams).then(response => {
this.rtsalseList = response.rows;
this.total = response.total;
this.loading = false;
});
},
getWarehouseList(){
getTreeList().then( response =>{
this.warehouseOptions = response.data;
this.warehouseOptions.map(w =>{
w.children.map(l =>{
let lstr =JSON.stringify(l.children).replace(/locationId/g,'lId').replace(/areaId/g, 'pId').replace(/areaName/g,'pName');
l.children = JSON.parse(lstr);
});
let wstr = JSON.stringify(w.children).replace(/warehouseId/g,'wId').replace(/locationId/g, 'pId').replace(/locationName/g,'pName');
w.children = JSON.parse(wstr);
});
let ostr=JSON.stringify(this.warehouseOptions).replace(/warehouseId/g,'pId').replace(/warehouseName/g, 'pName');
this.warehouseOptions = JSON.parse(ostr);
});
},
//
handleWarehouseChanged(obj){
if(obj !=null){
this.form.warehouseId = obj[0];
this.form.locationId = obj[1];
this.form.areaId = obj[2];
}
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
rtId: null,
rtCode: null,
rtName: null,
soCode: null,
clientId: null,
clientCode: null,
clientName: null,
clientNick: null,
warehouseId: null,
warehouseCode: null,
warehouseName: null,
locationId: null,
locationCode: null,
locationName: null,
areaId: null,
areaCode: null,
areaName: null,
rtDate: null,
rtReason: null,
status: "PREPARE",
remark: null,
attr1: null,
attr2: null,
attr3: null,
attr4: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null
};
this.autoGenFlag = false;
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.rtId)
this.single = selection.length!==1
this.multiple = !selection.length
},
//
handleSelectClient(){
this.$refs.clientSelect.showFlag = true;
},
//
handleClientSelect(obj){
if(obj != undefined && obj != null){
this.form.clientId = obj.clientId;
this.form.clientCode = obj.clientCode;
this.form.clientName = obj.clientName;
}
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加产品销售退货单";
this.optType = "add";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const rtId = row.rtId || this.ids
getRtsalse(rtId).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改产品销售退货单";
this.optType = "add";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.rtId != null) {
updateRtsalse(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addRtsalse(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const rtIds = row.rtId || this.ids;
this.$modal.confirm('是否确认删除产品销售退货单编号为"' + rtIds + '"的数据项?').then(function() {
return delRtsalse(rtIds);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('wm/rtsalse/export', {
...this.queryParams
}, `rtsalse_${new Date().getTime()}.xlsx`)
},
//
handleAutoGenChange(autoGenFlag){
if(autoGenFlag){
genCode('RTSALSE_CODE').then(response =>{
this.form.rtCode = response;
});
}else{
this.form.rtCode = null;
}
}
}
};
</script>