Files
FT546MWS/ruoyi-ui/src/views/stock/pointOut.vue
张怡蓉 d427ebf6d0 初始化
2025-12-23 13:36:18 +08:00

444 lines
14 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<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="productId"><!-- 品名 -->
<el-input
v-model="queryParams.productId"
placeholder="请输入品号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="订单号" prop="序列号"><!-- 库存id -->
<el-input
v-model="queryParams.序列号"
placeholder="请输入订单号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="序列号" prop="spare6"><!-- 库存id -->
<el-input
v-model="queryParams.spare6"
placeholder="请输入序列号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="批次" prop="lotNo"><!-- 库存id -->
<el-input
v-model="queryParams.lotNo"
placeholder="请输入批次"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="巷道" prop="roadwayId"><!-- 货位id -->
<el-input
v-model="queryParams.roadwayId"
placeholder="请输入巷道"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="货位-排" prop="thePlatoon"><!-- 货位id -->
<el-input
v-model="queryParams.thePlatoon"
placeholder="请输入货位-排"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="货位-列" prop="theColumn"><!-- 货位id -->
<el-input
v-model="queryParams.theColumn"
placeholder="请输入货位-列"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="货位-层" prop="theFloor"><!-- 货位id -->
<el-input
v-model="queryParams.theFloor"
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="warning"
plain
icon="el-icon-download"
size="mini"
@click="pointOut"
v-hasPermi="['job:outmydoJob:pointOut']"
>指定货位出库 <!-- 指定货位出库 --></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" width="55" align="center"/>
<el-table-column label="库存编码" align="center" prop="stockId" width="120"/>
<el-table-column label="巷道" align="center" prop="roadwayId" sortable/>
<el-table-column label="货位名称" align="center" prop="cargoSpaceName" width="120"/>
<el-table-column label="入库日期" align="center" prop="inDate" width="160" sortable/>
<el-table-column label="批次号" align="center" prop="lotNo"/>
<el-table-column label="订单号" align="center" prop="orderId" width="160" sortable/>
<el-table-column label="序列号" align="center" prop="trayCode" width="130" sortable/>
<el-table-column label="品号" align="center" prop="productId" sortable/>
<el-table-column label="品名" align="center" prop="productName"/>
<el-table-column label="数量" align="center" prop="quantity"/>
<el-table-column label="规格" align="center" prop="spare1"/>
<el-table-column label="单位" align="center" prop="spare3"/>
<el-table-column label="型号" align="center" prop="spare4"/>
<el-table-column label="颜色" align="center" prop="spare5"/>
<el-table-column label="序列号" align="center" prop="spare6"/>
<el-table-column label="电压" align="center" prop="voltage"/>
<el-table-column label="功率" align="center" prop="power"/>
<el-table-column label="相位" align="center" prop="phase"/>
<el-table-column label="净重" align="center" prop="netWeight"/>
<el-table-column label="毛重" align="center" prop="grossWeight"/>
<el-table-column label="分销" align="center" prop="distribution"/>
<el-table-column label="机型" align="center" prop="model"/>
</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"> <!-- 库存id -->
<el-input v-model="form.stockId" placeholder="请输入库存ID"/>
</el-form-item>
<el-form-item label="货位ID" prop="cargoSpaceId"> <!-- 货位id -->
<el-input v-model="form.cargoSpaceId" placeholder="请输入货位ID"/>
</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="exitDialogVisible" width="400px" append-to-body>
<el-form ref="exitForm" :model="exitForm" :rules="exitRules" label-width="80px">
<el-form-item label="选择出口" prop="exitId">
<el-select v-model="exitForm.exitId" placeholder="请选择出口" clearable>
<el-option
v-for="item in exitOptions"
:key="item.exitId"
:label="item.exitName"
:value="item.exitId"
/>
</el-select>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitPointOut">确定</el-button>
<el-button @click="cancelExit">取消</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {listManagement, getManagement, delManagement, addManagement, updateManagement} from "@/api/stock/management"
import {listWarehouse} from "@/api/bas/warehouse"
import {pointOut} from "@/api/job/OutmydoJob"
export default {
name: "Management",
dicts: ['product_status', 'stock_status', 'cargo_space_status', 'cargo_space_lock_status'],
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,
cargoSpaceStockStatus: '2',
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,
roadwayId: null
},
// 表单参数
form: {},
// 表单校验
rules: {
/*stockId: [
{ required: true, message: this.$t('stockManagement.stockIdRequired'), trigger: "blur" } // 库存id不能为空
]*/
},
// 出口选择弹窗显示状态
exitDialogVisible: false,
// 出口表单数据
exitForm: {
exitId: null
},
// 出口表单验证规则
exitRules: {
exitId: [
{required: true, message: "请选择出口", trigger: 'change'}
]
},
// 出口选项
exitOptions: [
{exitId: '1', exitName: '一楼'},
{exitId: '2', exitName: '二楼'},
],
// 选中的库存数据
selectedStockData: []
}
},
created() {
this.getList()
this.getWarehouseList();
},
methods: {
/** 获取仓库列表 */
getWarehouseList() {
listWarehouse().then(response => {
this.warehouseOptions = response.rows;
});
},
/** 查询库存信息列表 */
getList() {
this.loading = true
listManagement(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,
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,
roadwayId: 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(() => {
})
},
/** 指定货位出库按钮操作 */
pointOut() {
if (this.ids.length === 0) {
this.$modal.msgError("请至少选择一行数据");
return;
}
// 获取选中的完整数据
const selectedData = this.managementList.filter(item => this.ids.includes(item.stockId));
this.selectedStockData = selectedData;
// 显示出口选择弹窗
this.exitDialogVisible = true;
this.exitForm.exitId = null;
},
/** 提交指定货位出库 */
submitPointOut() {
this.$refs["exitForm"].validate(valid => {
if (valid) {
const stockIds = this.ids;
// 调用API将stockIds数组和出口信息传给后端
//console.log("指定货位出库:", stockIds, this.exitForm.exitId)
pointOut(stockIds, this.exitForm.exitId).then(response => {
// 根据后端返回的实际code判断业务是否成功
this.$modal.msgSuccess(response.msg);
this.exitDialogVisible = false;
this.getList();
});
}
})
},
/** 取消出口选择 */
cancelExit() {
this.exitDialogVisible = false;
this.exitForm.exitId = null;
},
/** 导出按钮操作 */
handleExport() {
this.download('stock/management/export', {
...this.queryParams
}, `management_${new Date().getTime()}.xlsx`)
}
}
}
</script>
<style>
.no-wrap {
white-space: nowrap;
}
</style>