库存管理前端
This commit is contained in:
44
klp-ui/src/api/wms/stockIo.js
Normal file
44
klp-ui/src/api/wms/stockIo.js
Normal file
@@ -0,0 +1,44 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询出入库单主列表
|
||||
export function listStockIo(query) {
|
||||
return request({
|
||||
url: '/wms/stockIo/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询出入库单主详细
|
||||
export function getStockIo(stockIoId) {
|
||||
return request({
|
||||
url: '/wms/stockIo/' + stockIoId,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增出入库单主
|
||||
export function addStockIo(data) {
|
||||
return request({
|
||||
url: '/wms/stockIo',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改出入库单主
|
||||
export function updateStockIo(data) {
|
||||
return request({
|
||||
url: '/wms/stockIo',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除出入库单主
|
||||
export function delStockIo(stockIoId) {
|
||||
return request({
|
||||
url: '/wms/stockIo/' + stockIoId,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
44
klp-ui/src/api/wms/stockIoDetail.js
Normal file
44
klp-ui/src/api/wms/stockIoDetail.js
Normal file
@@ -0,0 +1,44 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询出入库单明细列表
|
||||
export function listStockIoDetail(query) {
|
||||
return request({
|
||||
url: '/wms/stockIoDetail/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询出入库单明细详细
|
||||
export function getStockIoDetail(detailId) {
|
||||
return request({
|
||||
url: '/wms/stockIoDetail/' + detailId,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增出入库单明细
|
||||
export function addStockIoDetail(data) {
|
||||
return request({
|
||||
url: '/wms/stockIoDetail',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改出入库单明细
|
||||
export function updateStockIoDetail(data) {
|
||||
return request({
|
||||
url: '/wms/stockIoDetail',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除出入库单明细
|
||||
export function delStockIoDetail(detailId) {
|
||||
return request({
|
||||
url: '/wms/stockIoDetail/' + detailId,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
396
klp-ui/src/views/wms/stockIo/index.vue
Normal file
396
klp-ui/src/views/wms/stockIo/index.vue
Normal file
@@ -0,0 +1,396 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="出入库单号" prop="stockIoCode">
|
||||
<el-input
|
||||
v-model="queryParams.stockIoCode"
|
||||
placeholder="请输入出入库单号"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="类型" prop="ioType">
|
||||
<el-select v-model="queryParams.ioType" placeholder="请选择类型" clearable>
|
||||
<el-option
|
||||
v-for="dict in dict.type.stock_io_type"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="业务类型" prop="bizType">
|
||||
<el-select v-model="queryParams.bizType" placeholder="请选择业务类型" clearable>
|
||||
<el-option
|
||||
v-for="dict in dict.type.stock_biz_type"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</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.stock_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="['klp:stockIo: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="['klp:stockIo: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="['klp:stockIo:remove']"
|
||||
>删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
icon="el-icon-download"
|
||||
size="mini"
|
||||
@click="handleExport"
|
||||
v-hasPermi="['klp:stockIo:export']"
|
||||
>导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="stockIoList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="出入库单ID" align="center" prop="stockIoId" v-if="true"/>
|
||||
<el-table-column label="出入库单号" align="center" prop="stockIoCode" />
|
||||
<el-table-column label="类型" align="center" prop="ioType">
|
||||
<template slot-scope="scope">
|
||||
<dict-tag :options="dict.type.stock_io_type" :value="scope.row.ioType"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="业务类型" align="center" prop="bizType">
|
||||
<template slot-scope="scope">
|
||||
<dict-tag :options="dict.type.stock_biz_type" :value="scope.row.bizType"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="单据状态" align="center" prop="status">
|
||||
<template slot-scope="scope">
|
||||
<dict-tag :options="dict.type.stock_status" :value="scope.row.status"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="备注" align="center" prop="remark" />
|
||||
<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="['klp:stockIo:edit']"
|
||||
>修改</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['klp:stockIo:remove']"
|
||||
>删除</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-document"
|
||||
@click="showDetail(scope.row)"
|
||||
>明细</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="500px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="出入库单号" prop="stockIoCode">
|
||||
<el-input v-model="form.stockIoCode" placeholder="请输入出入库单号" />
|
||||
</el-form-item>
|
||||
<el-form-item label="类型" prop="ioType">
|
||||
<el-select v-model="form.ioType" placeholder="请选择类型">
|
||||
<el-option
|
||||
v-for="dict in dict.type.stock_io_type"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="业务类型" prop="bizType">
|
||||
<el-select v-model="form.bizType" placeholder="请选择业务类型">
|
||||
<el-option
|
||||
v-for="dict in dict.type.stock_biz_type"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="单据状态" prop="status">
|
||||
<el-input v-model="form.status" :value="0" readonly disabled />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" placeholder="请输入备注" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
<!-- 明细弹窗 -->
|
||||
<el-dialog
|
||||
title="出入库单详情"
|
||||
:visible.sync="detailDialogVisible"
|
||||
width="1000px"
|
||||
append-to-body
|
||||
@close="onDetailClosed"
|
||||
>
|
||||
<StockIoDetailPanel :stockIo="detailStockIo" />
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listStockIo, getStockIo, delStockIo, addStockIo, updateStockIo } from "@/api/wms/stockIo";
|
||||
import StockIoDetailPanel from './panels/detail.vue';
|
||||
|
||||
export default {
|
||||
name: "StockIo",
|
||||
dicts: ['stock_biz_type', 'stock_io_type', 'stock_status'],
|
||||
components: { StockIoDetailPanel },
|
||||
data() {
|
||||
return {
|
||||
// 按钮loading
|
||||
buttonLoading: false,
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 出入库单主表格数据
|
||||
stockIoList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
stockIoCode: undefined,
|
||||
ioType: undefined,
|
||||
bizType: undefined,
|
||||
status: undefined,
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
stockIoId: [
|
||||
{ required: true, message: "出入库单ID不能为空", trigger: "blur" }
|
||||
],
|
||||
stockIoCode: [
|
||||
{ required: true, message: "出入库单号不能为空", trigger: "blur" }
|
||||
],
|
||||
ioType: [
|
||||
{ required: true, message: "类型不能为空", trigger: "change" }
|
||||
],
|
||||
bizType: [
|
||||
{ required: true, message: "业务类型不能为空", trigger: "change" }
|
||||
],
|
||||
status: [
|
||||
{ required: true, message: "单据状态不能为空", trigger: "change" }
|
||||
],
|
||||
delFlag: [
|
||||
{ required: true, message: "删除标志不能为空", trigger: "blur" }
|
||||
],
|
||||
createTime: [
|
||||
{ required: true, message: "创建时间不能为空", trigger: "blur" }
|
||||
],
|
||||
updateTime: [
|
||||
{ required: true, message: "更新时间不能为空", trigger: "blur" }
|
||||
],
|
||||
},
|
||||
detailDialogVisible: false,
|
||||
detailStockIo: null,
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询出入库单主列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listStockIo(this.queryParams).then(response => {
|
||||
this.stockIoList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
stockIoId: undefined,
|
||||
stockIoCode: undefined,
|
||||
ioType: undefined,
|
||||
bizType: undefined,
|
||||
status: undefined,
|
||||
remark: undefined,
|
||||
delFlag: undefined,
|
||||
createTime: undefined,
|
||||
createBy: undefined,
|
||||
updateTime: undefined,
|
||||
updateBy: undefined
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.stockIoId)
|
||||
this.single = selection.length!==1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.form.status = 0; // 新增时默认草稿状态
|
||||
this.open = true;
|
||||
this.title = "添加出入库单主";
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.loading = true;
|
||||
this.reset();
|
||||
const stockIoId = row.stockIoId || this.ids
|
||||
getStockIo(stockIoId).then(response => {
|
||||
this.loading = false;
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改出入库单主";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
this.buttonLoading = true;
|
||||
if (this.form.stockIoId != null) {
|
||||
updateStockIo(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
}).finally(() => {
|
||||
this.buttonLoading = false;
|
||||
});
|
||||
} else {
|
||||
addStockIo(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
}).finally(() => {
|
||||
this.buttonLoading = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const stockIoIds = row.stockIoId || this.ids;
|
||||
this.$modal.confirm('是否确认删除出入库单主编号为"' + stockIoIds + '"的数据项?').then(() => {
|
||||
this.loading = true;
|
||||
return delStockIo(stockIoIds);
|
||||
}).then(() => {
|
||||
this.loading = false;
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {
|
||||
}).finally(() => {
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
this.download('klp/stockIo/export', {
|
||||
...this.queryParams
|
||||
}, `stockIo_${new Date().getTime()}.xlsx`)
|
||||
},
|
||||
showDetail(row) {
|
||||
this.detailStockIo = { ...row };
|
||||
this.detailDialogVisible = true;
|
||||
},
|
||||
onDetailClosed() {
|
||||
this.getList();
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
323
klp-ui/src/views/wms/stockIo/panels/detail.vue
Normal file
323
klp-ui/src/views/wms/stockIo/panels/detail.vue
Normal file
@@ -0,0 +1,323 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<template v-if="stockIo && stockIo.stockIoId">
|
||||
<!-- 主表信息 -->
|
||||
<el-descriptions :title="'单号:' + (stockIo.stockIoCode || '-')" :column="2" border>
|
||||
<el-descriptions-item label="类型">{{ stockIo.ioType }}</el-descriptions-item>
|
||||
<el-descriptions-item label="业务类型">{{ stockIo.bizType }}</el-descriptions-item>
|
||||
<el-descriptions-item label="状态">
|
||||
<el-tag :type="stockIo.status === 2 ? 'success' : 'info'">
|
||||
{{ stockIo.status === 2 ? '已审核' : (stockIo.status === 0 ? '草稿' : '未审核') }}
|
||||
</el-tag>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="备注">{{ stockIo.remark }}</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
<br />
|
||||
<!-- 明细表格 -->
|
||||
<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="['klp:stockIoDetail: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="['klp:stockIoDetail: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="['klp:stockIoDetail:remove']"
|
||||
>删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
icon="el-icon-download"
|
||||
size="mini"
|
||||
@click="handleExport"
|
||||
v-hasPermi="['klp:stockIoDetail:export']"
|
||||
>导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
<el-table v-loading="loading" :data="stockIoDetailList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="明细ID" align="center" prop="detailId"/>
|
||||
<el-table-column label="库区/库位ID" align="center" prop="warehouseId" />
|
||||
<el-table-column label="源库区/库位ID" align="center" prop="fromWarehouseId" />
|
||||
<el-table-column label="物品类型" align="center" prop="itemType" />
|
||||
<el-table-column label="物品ID" align="center" prop="itemId" />
|
||||
<el-table-column label="数量" align="center" prop="quantity" />
|
||||
<el-table-column label="单位" align="center" prop="unit" />
|
||||
<el-table-column label="批次号" align="center" prop="batchNo" />
|
||||
<el-table-column label="备注" align="center" prop="remark" />
|
||||
<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="['klp:stockIoDetail:edit']"
|
||||
>修改</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['klp:stockIoDetail: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"
|
||||
/>
|
||||
<!-- 审核按钮 -->
|
||||
<div style="margin-top: 20px; text-align: right;">
|
||||
<el-button
|
||||
v-if="stockIo.status !== 2"
|
||||
type="primary"
|
||||
:loading="auditLoading"
|
||||
@click="handleAudit"
|
||||
>确认入库/审核</el-button>
|
||||
</div>
|
||||
<!-- 明细编辑弹窗 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="出入库单ID" prop="stockIoId">
|
||||
<el-input v-model="form.stockIoId" placeholder="请输入出入库单ID" :disabled="true" />
|
||||
</el-form-item>
|
||||
<el-form-item label="库区/库位ID" prop="warehouseId">
|
||||
<el-input v-model="form.warehouseId" placeholder="请输入库区/库位ID" />
|
||||
</el-form-item>
|
||||
<el-form-item label="源库区/库位ID" prop="fromWarehouseId">
|
||||
<el-input v-model="form.fromWarehouseId" placeholder="请输入源库区/库位ID" />
|
||||
</el-form-item>
|
||||
<el-form-item label="物品类型" prop="itemType">
|
||||
<el-input v-model="form.itemType" placeholder="请输入物品类型" />
|
||||
</el-form-item>
|
||||
<el-form-item label="物品ID" prop="itemId">
|
||||
<el-input v-model="form.itemId" placeholder="请输入物品ID" />
|
||||
</el-form-item>
|
||||
<el-form-item label="数量" prop="quantity">
|
||||
<el-input v-model="form.quantity" placeholder="请输入数量" />
|
||||
</el-form-item>
|
||||
<el-form-item label="单位" prop="unit">
|
||||
<el-input v-model="form.unit" placeholder="请输入单位" />
|
||||
</el-form-item>
|
||||
<el-form-item label="批次号" prop="batchNo">
|
||||
<el-input v-model="form.batchNo" placeholder="请输入批次号" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" placeholder="请输入备注" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</template>
|
||||
<template v-else>
|
||||
<div style="height:200px;text-align:center;line-height:200px;">未获取到主表数据</div>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listStockIoDetail, getStockIoDetail, delStockIoDetail, addStockIoDetail, updateStockIoDetail } from "@/api/wms/stockIoDetail";
|
||||
import { auditStockIo } from "@/api/wms/stockIo";
|
||||
export default {
|
||||
name: "StockIoDetailPanel",
|
||||
props: {
|
||||
stockIo: {
|
||||
type: Object,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
loading: true,
|
||||
stockIoDetailList: [],
|
||||
total: 0,
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
stockIoId: undefined
|
||||
},
|
||||
auditLoading: false,
|
||||
open: false,
|
||||
title: '',
|
||||
form: {},
|
||||
buttonLoading: false,
|
||||
rules: {
|
||||
warehouseId: [
|
||||
{ required: true, message: "库区/库位ID不能为空", trigger: "blur" }
|
||||
],
|
||||
itemType: [
|
||||
{ required: true, message: "物品类型不能为空", trigger: "blur" }
|
||||
],
|
||||
itemId: [
|
||||
{ required: true, message: "物品ID不能为空", trigger: "blur" }
|
||||
],
|
||||
quantity: [
|
||||
{ required: true, message: "数量不能为空", trigger: "blur" }
|
||||
],
|
||||
unit: [
|
||||
{ required: true, message: "单位不能为空", trigger: "blur" }
|
||||
]
|
||||
},
|
||||
ids: [],
|
||||
single: true,
|
||||
multiple: true
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
'stockIo.stockIoId': {
|
||||
handler(val) {
|
||||
if (val) {
|
||||
this.queryParams.stockIoId = val;
|
||||
this.getList();
|
||||
}
|
||||
},
|
||||
immediate: true
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
if (this.stockIo && this.stockIo.stockIoId) {
|
||||
this.queryParams.stockIoId = this.stockIo.stockIoId;
|
||||
this.getList();
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
getList() {
|
||||
if (!this.queryParams.stockIoId) return;
|
||||
this.loading = true;
|
||||
listStockIoDetail(this.queryParams).then(response => {
|
||||
this.stockIoDetailList = response.rows;
|
||||
this.total = response.total;
|
||||
}).finally(() => {
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
handleAudit() {
|
||||
this.auditLoading = true;
|
||||
auditStockIo(this.stockIo.stockIoId).then(() => {
|
||||
this.$modal.msgSuccess('审核成功');
|
||||
this.$set(this.stockIo, 'status', 2);
|
||||
}).finally(() => {
|
||||
this.auditLoading = false;
|
||||
});
|
||||
},
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.detailId)
|
||||
this.single = selection.length!==1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.form.stockIoId = this.stockIo.stockIoId;
|
||||
this.open = true;
|
||||
this.title = "添加出入库单明细";
|
||||
},
|
||||
handleUpdate(row) {
|
||||
this.loading = true;
|
||||
this.reset();
|
||||
const detailId = row.detailId || this.ids
|
||||
getStockIoDetail(detailId).then(response => {
|
||||
this.loading = false;
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改出入库单明细";
|
||||
});
|
||||
},
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
this.buttonLoading = true;
|
||||
if (this.form.detailId != null) {
|
||||
updateStockIoDetail(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
}).finally(() => {
|
||||
this.buttonLoading = false;
|
||||
});
|
||||
} else {
|
||||
addStockIoDetail(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
}).finally(() => {
|
||||
this.buttonLoading = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
handleDelete(row) {
|
||||
const detailIds = row.detailId || this.ids;
|
||||
this.$modal.confirm('是否确认删除出入库单明细编号为"' + detailIds + '"的数据项?').then(() => {
|
||||
this.loading = true;
|
||||
return delStockIoDetail(detailIds);
|
||||
}).then(() => {
|
||||
this.loading = false;
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {
|
||||
}).finally(() => {
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
reset() {
|
||||
this.form = {
|
||||
detailId: undefined,
|
||||
stockIoId: undefined,
|
||||
warehouseId: undefined,
|
||||
fromWarehouseId: undefined,
|
||||
itemType: undefined,
|
||||
itemId: undefined,
|
||||
quantity: undefined,
|
||||
unit: undefined,
|
||||
batchNo: undefined,
|
||||
remark: undefined
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
handleExport() {
|
||||
this.download('klp/stockIoDetail/export', {
|
||||
...this.queryParams
|
||||
}, `stockIoDetail_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.klp.controller;
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
|
||||
import com.klp.domain.vo.WmsStockIoDetailVo;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.constraints.*;
|
||||
@@ -24,7 +25,7 @@ import com.klp.service.IWmsStockIoService;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 出入库单主
|
||||
* 出入库单主表
|
||||
*
|
||||
* @author Joshi
|
||||
* @date 2025-07-18
|
||||
@@ -110,7 +111,7 @@ public class WmsStockIoController extends BaseController {
|
||||
/**
|
||||
* 撤销出入库/移库单
|
||||
*/
|
||||
@SaCheckPermission("klp:stockIo:cancel")
|
||||
|
||||
@Log(title = "出入库单主", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PostMapping("/cancel/{stockIoId}")
|
||||
@@ -121,9 +122,8 @@ public class WmsStockIoController extends BaseController {
|
||||
/**
|
||||
* 根据ioType和stockIoId联查明细
|
||||
*/
|
||||
@SaCheckPermission("klp:stockIo:detail")
|
||||
@GetMapping("/detailByTypeAndId")
|
||||
public R<List<com.klp.domain.vo.WmsStockIoDetailVo>> detailByTypeAndId(@RequestParam String ioType, @RequestParam Long stockIoId) {
|
||||
public R<List<WmsStockIoDetailVo>> detailByTypeAndId(@RequestParam String ioType, @RequestParam Long stockIoId) {
|
||||
return R.ok(iWmsStockIoService.detailByTypeAndId(ioType, stockIoId));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.klp.service;
|
||||
|
||||
import com.klp.domain.WmsStockIo;
|
||||
import com.klp.domain.vo.WmsStockIoDetailVo;
|
||||
import com.klp.domain.vo.WmsStockIoVo;
|
||||
import com.klp.domain.bo.WmsStockIoBo;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
@@ -60,5 +61,5 @@ public interface IWmsStockIoService {
|
||||
/**
|
||||
* 根据ioType和stockIoId联查明细
|
||||
*/
|
||||
java.util.List<com.klp.domain.vo.WmsStockIoDetailVo> detailByTypeAndId(String ioType, Long stockIoId);
|
||||
java.util.List<WmsStockIoDetailVo> detailByTypeAndId(String ioType, Long stockIoId);
|
||||
}
|
||||
|
||||
@@ -8,7 +8,9 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.klp.common.utils.StringUtils;
|
||||
import com.klp.domain.vo.WmsStockIoDetailVo;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.klp.domain.bo.WmsStockIoBo;
|
||||
import com.klp.domain.vo.WmsStockIoVo;
|
||||
@@ -22,6 +24,7 @@ import com.klp.mapper.WmsStockMapper;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
@@ -211,7 +214,7 @@ public class WmsStockIoServiceImpl implements IWmsStockIoService {
|
||||
* 根据ioType和stockIoId联查明细
|
||||
*/
|
||||
@Override
|
||||
public java.util.List<com.klp.domain.vo.WmsStockIoDetailVo> detailByTypeAndId(String ioType, Long stockIoId) {
|
||||
public List<WmsStockIoDetailVo> detailByTypeAndId(String ioType, Long stockIoId) {
|
||||
WmsStockIo stockIo = baseMapper.selectById(stockIoId);
|
||||
if (stockIo == null) {
|
||||
throw new ServiceException("单据不存在");
|
||||
@@ -226,10 +229,10 @@ public class WmsStockIoServiceImpl implements IWmsStockIoService {
|
||||
return java.util.Collections.emptyList();
|
||||
}
|
||||
// 转VO
|
||||
java.util.List<com.klp.domain.vo.WmsStockIoDetailVo> voList = new java.util.ArrayList<>();
|
||||
List<WmsStockIoDetailVo> voList = new ArrayList<>();
|
||||
for (WmsStockIoDetail detail : details) {
|
||||
com.klp.domain.vo.WmsStockIoDetailVo vo = new com.klp.domain.vo.WmsStockIoDetailVo();
|
||||
org.springframework.beans.BeanUtils.copyProperties(detail, vo);
|
||||
WmsStockIoDetailVo vo = new WmsStockIoDetailVo();
|
||||
BeanUtils.copyProperties(detail, vo);
|
||||
voList.add(vo);
|
||||
}
|
||||
return voList;
|
||||
|
||||
Reference in New Issue
Block a user