Files
FT541-WMS/ruoyi-ui/src/views/stock/management/index.vue
2026-01-04 11:00:18 +08:00

794 lines
27 KiB
Vue

<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="warehouseId"><!--仓库-->
<el-select
v-model="queryParams.warehouseId"
placeholder="请选择仓库"
clearable
@change="handleQuery"
>
<el-option
v-for="item in warehouseOptions"
:key="item.warehouseId"
:label="item.warehouseName"
:value="item.warehouseId"
/>
</el-select>
</el-form-item>
<el-form-item label="巷道" prop="roadwayId">
<el-input
v-model="queryParams.roadwayId"
placeholder="请输入巷道"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="排" prop="thePlatoon">
<el-input
v-model="queryParams.thePlatoon"
placeholder="请输入排"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="列" prop="theColumn">
<el-input
v-model="queryParams.theColumn"
placeholder="请输入列"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="层" prop="theFloor">
<el-input
v-model="queryParams.theFloor"
placeholder="请输入层"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="托盘号" prop="trayCode">
<el-input
v-model="queryParams.trayCode"
placeholder="请输入托盘号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<!-- <el-form-item label="常用编码" prop="parentId">
<el-input
v-model="queryParams.parentId"
placeholder="请输入常用编码"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="供应代号" prop="supplierId">
<el-input
v-model="queryParams.supplierId"
placeholder="请输入供应商代号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="供应名称" prop="supplierName">
<el-input
v-model="queryParams.supplierName"
placeholder="请输入供应商名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>-->
<!-- <el-form-item label="物料编码" prop="productId">
<el-input
v-model="queryParams.productId"
placeholder="请输入物料编码"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>-->
<!-- <el-form-item label="入库单号" prop="stockinId">
<el-input
v-model="queryParams.stockinId"
placeholder="请输入入库单号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="单价" prop="price">
<el-input
v-model="queryParams.price"
placeholder="请输入单价"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>-->
<el-form-item label="合同号" prop="orderId">
<el-input
v-model="queryParams.orderId"
placeholder="请输入合同号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="产品号" prop="power">
<el-input
v-model="queryParams.power"
placeholder="请输入产品号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="台次" prop="spare5">
<el-input
v-model="queryParams.spare5"
placeholder="请输入台次"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="物料名称" prop="productName">
<el-input
v-model="queryParams.productName"
placeholder="请输入物料名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="规格型号" prop="spec">
<el-input
v-model="queryParams.spec"
placeholder="请输入规格型号"
clearable
@keyup.enter.native="handleQuery"
/>
</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="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['stock:management: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="['stock:management: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="['stock:management:export']"
>导出 <!-- 导出 --></el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="managementList" @selection-change="handleSelectionChange" max-height="650">
<el-table-column type="selection" align="center" />
<el-table-column label="仓库名称" align="center" prop="warehouseName"/>
<el-table-column label="库存编码" align="center" prop="stockId" width="160"/>
<!-- <el-table-column label="套账" align="center" prop="spare3">
<template slot-scope="scope">
<dict-tag :options="dict.type.account_type" :value="scope.row.spare3"/>
</template>
</el-table-column>-->
<!-- <el-table-column label="仓库编码" align="center" prop="warehouseId"/>-->
<el-table-column label="库位" align="center" prop="cargoSpaceId" width="160"/>
<el-table-column label="托盘" align="center" prop="trayCode"/>
<el-table-column label="合同号" align="center" prop="orderId"/>
<el-table-column label="产品号" align="center" prop="power"/>
<el-table-column label="代号" align="center" prop="distribution"/>
<el-table-column label="台次" align="center" prop="spare5"/>
<el-table-column label="物料编码" align="center" prop="productId"/>
<el-table-column label="物料名称" align="center" prop="productName" width="160" />
<el-table-column label="规格" align="center" prop="spec" width="160"/>
<el-table-column label="库存状态" align="center" prop="stockStatus" >
<template slot-scope="scope">
<dict-tag :options="dict.type.stock_status" :value="scope.row.stockStatus"/>
</template>
</el-table-column>
<el-table-column label="数量" align="center" prop="quantity"/>
<!-- <el-table-column label="单价" align="center" prop="price"/>-->
<!-- <el-table-column label="金额" align="center" prop="spare6"/>-->
<!-- <el-table-column label="产品状态" align="center" prop="productType">
<template slot-scope="scope">
<dict-tag :options="dict.type.product_type" :value="scope.row.productType"/>
</template>
</el-table-column>-->
<!-- <el-table-column label="单位" align="center" prop="unit"/>-->
<!-- <el-table-column label="图号" align="center" prop="cargoNo"/>-->
<!-- <el-table-column label="质量" align="center" prop="spare8">-->
<!-- <template slot-scope="scope">-->
<!-- <dict-tag :options="dict.type.quality_type" :value="scope.row.spare8"/>-->
<!-- </template>-->
<!-- </el-table-column>-->
<!-- <el-table-column label="常用编码" align="center" prop="parentId"/>-->
<!-- -->
<!-- <el-table-column label="供应商编码" align="center" prop="supplierId" width="160"/>-->
<!-- <el-table-column label="供应商名称" align="center" prop="supplierName" width="160"/>-->
<el-table-column label="重量" align="center" prop="netWeight" width="160"/>
<el-table-column label="入库单号" align="center" prop="stockinId" width="160"/>
<el-table-column label="首次入库时间" align="center" prop="inDate" width="160"/>
<el-table-column label="最后出库时间" align="center" prop="stackingId" width="160"/>
<el-table-column label="盘点标识" align="center" prop="spare7">
<template slot-scope="scope">
<dict-tag :options="dict.type.check_flag" :value="scope.row.spare7"/>
</template>
</el-table-column>
<el-table-column label="盘点时间" align="center" prop="backDate" width="160"/>
<el-table-column label="备注" align="center" prop="remark"/>
<!-- <el-table-column label="来源" align="center" prop="spare4">
<template slot-scope="scope">
<dict-tag :options="dict.type.origin_type" :value="scope.row.spare4"/>
</template>
</el-table-column>
<el-table-column label="用途" align="center" prop="spare1">
<template slot-scope="scope">
<dict-tag :options="dict.type.purpose_type" :value="scope.row.spare1"/>
</template>
</el-table-column>-->
<el-table-column width=120 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="['stock:management:edit']"
>修改 <!-- 修改 --></el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['stock:management: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="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<!-- <el-form-item label="库存ID" prop="stockId"> &lt;!&ndash; 库存id &ndash;&gt;-->
<!-- <el-input v-model="form.stockId" placeholder="请输入库存ID" />-->
<!-- </el-form-item>-->
<!-- <el-form-item label="货位ID" prop="cargoSpaceId"> &lt;!&ndash; 货位id &ndash;&gt;-->
<!-- <el-input v-model="form.cargoSpaceId" placeholder="请输入货位ID" />-->
<!-- </el-form-item>-->
<el-form-item label="物料" prop="productId"> <!-- 物料 -->
<el-input
v-model="form.productName"
placeholder="请选择物料"
readonly
@click="openProductSelect"
style="cursor: pointer;"
>
<template slot="append">
<el-button icon="el-icon-search" @click="openProductSelect"></el-button>
</template>
</el-input>
</el-form-item>
<el-form-item label="货位" prop="cargoSpaceId"> <!-- 货位 -->
<el-input
v-model="form.cargoSpaceName"
placeholder="请选择货位"
readonly
@click="openCargoSpaceSelect"
style="cursor: pointer;"
>
<template slot="append">
<el-button icon="el-icon-search" @click="openCargoSpaceSelect"></el-button>
</template>
</el-input>
</el-form-item>
<el-form-item label="库存状态" prop="stockStatus"> <!-- 库存状态 -->
<el-select v-model="form.stockStatus" placeholder="请选择库存状态">
<el-option
v-for="dict in dict.type.stock_status"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="库存数量" prop="quantity"> <!-- 库存数量 -->
<el-input v-model="form.quantity" placeholder="请输入库存数量" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm">确定 <!-- 确定 --></el-button>
<el-button @click="cancel">取消 <!-- 取消 --></el-button>
</div>
</el-dialog>
<!-- 物料选择对话框 -->
<el-dialog title="选择物料" :visible.sync="productSelectVisible" width="800px" append-to-body>
<el-form :model="productQueryParams" ref="productQueryForm" size="small" :inline="true" label-width="68px">
<el-form-item label="物料编码" prop="productId">
<el-input
v-model="productQueryParams.productId"
placeholder="请输入物料编码"
clearable
@keyup.enter.native="getProductList"
/>
</el-form-item>
<el-form-item label="物料名称" prop="productName">
<el-input
v-model="productQueryParams.productName"
placeholder="请输入物料名称"
clearable
@keyup.enter.native="getProductList"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="getProductList">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetProductQuery">重置</el-button>
</el-form-item>
</el-form>
<el-table
v-loading="productLoading"
:data="productList"
@row-click="handleProductRowClick"
highlight-current-row
max-height="400">
<el-table-column label="物料编码" align="center" prop="productId" />
<el-table-column label="物料名称" align="center" prop="productName" />
<el-table-column label="规格" align="center" prop="spec" />
<el-table-column label="型号" align="center" prop="spare1" />
<el-table-column label="单位" align="center" prop="unit" />
</el-table>
<pagination
v-show="productTotal>0"
:total="productTotal"
:page.sync="productQueryParams.pageNum"
:limit.sync="productQueryParams.pageSize"
@pagination="getProductList"
/>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="confirmProductSelect">确定</el-button>
<el-button @click="productSelectVisible = false">取消</el-button>
</div>
</el-dialog>
<!-- 货位选择对话框 -->
<el-dialog title="选择货位" :visible.sync="cargoSpaceSelectVisible" width="800px" append-to-body>
<el-form :model="cargoSpaceQueryParams" ref="cargoSpaceQueryForm" size="small" :inline="true" label-width="68px">
<el-form-item label="货位编码" prop="cargoSpaceId">
<el-input
v-model="cargoSpaceQueryParams.cargoSpaceId"
placeholder="请输入货位编码"
clearable
@keyup.enter.native="getCargoSpaceList"
/>
</el-form-item>
<el-form-item label="货位名称" prop="cargoSpaceName">
<el-input
v-model="cargoSpaceQueryParams.cargoSpaceName"
placeholder="请输入货位名称"
clearable
@keyup.enter.native="getCargoSpaceList"
/>
</el-form-item>
<el-form-item label="仓库" prop="warehouseId">
<el-select v-model="cargoSpaceQueryParams.warehouseId" placeholder="请选择仓库" clearable>
<el-option
v-for="item in warehouseOptions"
:key="item.warehouseId"
:label="item.warehouseName"
:value="item.warehouseId"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="getCargoSpaceList">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetCargoSpaceQuery">重置</el-button>
</el-form-item>
</el-form>
<el-table
v-loading="cargoSpaceLoading"
:data="cargoSpaceList"
@row-click="handleCargoSpaceRowClick"
highlight-current-row
max-height="400">
<el-table-column label="货位编码" align="center" prop="cargoSpaceId" />
<el-table-column label="货位名称" align="center" prop="cargoSpaceName" />
<el-table-column label="仓库名称" align="center" prop="warehouseName" />
<el-table-column label="状态" align="center" prop="status">
<template slot-scope="scope">
<dict-tag :options="dict.type.cargo_space_status" :value="scope.row.status"/>
</template>
</el-table-column>
<el-table-column label="排" align="center" prop="thePlatoon" />
<el-table-column label="列" align="center" prop="theColumn" />
<el-table-column label="层" align="center" prop="theFloor" />
</el-table>
<pagination
v-show="cargoSpaceTotal>0"
:total="cargoSpaceTotal"
:page.sync="cargoSpaceQueryParams.pageNum"
:limit.sync="cargoSpaceQueryParams.pageSize"
@pagination="getCargoSpaceList"
/>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="confirmCargoSpaceSelect">确定</el-button>
<el-button @click="cargoSpaceSelectVisible = false">取消</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {addManagement, delManagement, getManagement, stockManagementList, updateManagement} from "@/api/stock/management"
import {listWarehouse} from "@/api/bas/warehouse"
import {listBasProduct} from "@/api/bas/BasProduct"
import {listCargoSpace} from "@/api/bas/cargoSpace"
export default {
name: "Management",
dicts: ['product_status','check_flag', 'stock_status','cargo_space_status','cargo_space_lock_status','product_type','origin_type','account_type','turnover_type','purpose_type','quality_type'],
data() {
return {
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 库存信息表格数据
managementList: [],
// 仓库选项
warehouseOptions: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
stockId: null,
cargoSpaceId: null,
cargoSpaceName: null,
stockStatus: null,
productStatus: null,
lotNo: null,
inDate: null,
backDate: null,
productGuid: null,
quantity: null,
jobId: null,
trayCode: null,
outQuantity: null,
stockinDetailId: null,
stockinId: null,
inType: null,
inClassId: null,
warehouseId: null,
stackingId: null,
spare1: null,
spare2: null,
spare3: null,
spare4: null,
spare5: null,
spare6: null,
theFloor: null,
cargoSpaceStockStatus:2
},
queryWarehouse: {
pageNum:1,
pageSize: 99
},
// 表单参数
form: {},
// 表单校验
rules: {
/*stockId: [
{ required: true, message: this.$t('stockManagement.stockIdRequired'), trigger: "blur" } // 库存id不能为空
]*/
},
// 物料选择相关
productSelectVisible: false,
productList: [],
productTotal: 0,
productLoading: false,
productQueryParams: {
pageNum: 1,
pageSize: 10,
productId: null,
productName: null
},
selectedProduct: null,
// 货位选择相关
cargoSpaceSelectVisible: false,
cargoSpaceList: [],
cargoSpaceTotal: 0,
cargoSpaceLoading: false,
cargoSpaceQueryParams: {
pageNum: 1,
pageSize: 10,
cargoSpaceId: null,
cargoSpaceName: null,
warehouseId: null
},
selectedCargoSpace: null
}
},
created() {
this.getList()
this.getWarehouseList();
},
methods: {
/** 获取仓库列表 */
getWarehouseList() {
listWarehouse(this.queryWarehouse).then(response => {
this.warehouseOptions = response.rows;
});
},
/** 查询库存信息列表 */
getList() {
this.loading = true
stockManagementList(this.queryParams).then(response => {
this.managementList = response.rows
this.total = response.total
this.loading = false
})
},
// 取消按钮
cancel() {
this.open = false
this.reset()
},
// 表单重置
reset() {
this.form = {
stockId: null,
cargoSpaceId: null,
cargoSpaceName: null,
stockStatus: null,
productStatus: null,
lotNo: null,
inDate: null,
backDate: null,
productGuid: null,
productId: null,
productName: null,
quantity: null,
jobId: null,
trayCode: null,
outQuantity: null,
stockinDetailId: null,
stockinId: null,
inType: null,
inClassId: null,
warehouseId: null,
stackingId: null,
spare1: null,
spare2: null,
spare3: null,
spare4: null,
spare5: null,
spare6: null
}
this.resetForm("form")
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1
this.getList()
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm")
// 手动清空入库时间字段
this.queryParams.inDate = null
this.handleQuery()
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.stockId)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset()
this.open = true
this.title = "添加库存信息" // 添加库存信息
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset()
const stockId = row.stockId || this.ids
getManagement(stockId).then(response => {
this.form = response.data
this.open = true
this.title = "修改库存信息" // 修改库存信息
})
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.stockId != null) {
updateManagement(this.form).then(response => {
this.$modal.msgSuccess("修改成功") // 修改成功
this.open = false
this.getList()
})
} else {
addManagement(this.form).then(response => {
this.$modal.msgSuccess("新增成功") // 新增成功
this.open = false
this.getList()
})
}
}
})
},
/** 删除按钮操作 */
handleDelete(row) {
const stockIds = row.stockId || this.ids
this.$modal.confirm("是否确认删除库存信息编号为" + stockIds).then(function() { // 是否确认删除库存信息编号为
return delManagement(stockIds)
}).then(() => {
this.getList()
this.$modal.msgSuccess("删除成功") // 删除成功
}).catch(() => {})
},
/** 导出按钮操作 */
handleExport() {
this.download('stock/management/export', {
...this.queryParams
}, `management_${new Date().getTime()}.xlsx`)
},
/** 打开物料选择框 */
openProductSelect() {
this.productSelectVisible = true
this.getProductList()
},
/** 获取物料列表 */
getProductList() {
this.productLoading = true
listBasProduct(this.productQueryParams).then(response => {
this.productList = response.rows
this.productTotal = response.total
this.productLoading = false
}).catch(() => {
this.productLoading = false
})
},
/** 重置物料查询 */
resetProductQuery() {
this.productQueryParams = {
pageNum: 1,
pageSize: 10,
productId: null,
productName: null
}
this.getProductList()
},
/** 物料选择行点击 */
handleProductRowClick(row) {
this.selectedProduct = row
},
/** 确认选择物料 */
confirmProductSelect() {
if (this.selectedProduct) {
this.form.productGuid = this.selectedProduct.productGuid
this.form.productName = this.selectedProduct.productName
this.form.productId = this.selectedProduct.productId
this.productSelectVisible = false
this.selectedProduct = null
} else {
this.$modal.msgWarning("请选择一个物料")
}
},
/** 打开货位选择框 */
openCargoSpaceSelect() {
this.cargoSpaceSelectVisible = true
this.getCargoSpaceList()
},
/** 获取货位列表 */
getCargoSpaceList() {
this.cargoSpaceLoading = true
listCargoSpace(this.cargoSpaceQueryParams).then(response => {
this.cargoSpaceList = response.rows
this.cargoSpaceTotal = response.total
this.cargoSpaceLoading = false
}).catch(() => {
this.cargoSpaceLoading = false
})
},
/** 重置货位查询 */
resetCargoSpaceQuery() {
this.cargoSpaceQueryParams = {
pageNum: 1,
pageSize: 10,
cargoSpaceId: null,
cargoSpaceName: null,
warehouseId: null
}
this.getCargoSpaceList()
},
/** 货位选择行点击 */
handleCargoSpaceRowClick(row) {
this.selectedCargoSpace = row
},
/** 确认选择货位 */
confirmCargoSpaceSelect() {
if (this.selectedCargoSpace) {
this.form.cargoSpaceId = this.selectedCargoSpace.cargoSpaceId
this.form.cargoSpaceName = this.selectedCargoSpace.cargoSpaceName
this.cargoSpaceSelectVisible = false
this.selectedCargoSpace = null
} else {
this.$modal.msgWarning("请选择一个货位")
}
}
}
}
</script>
<style>
.no-wrap {
white-space: nowrap;
}
</style>