Files
FT541-WMS/ruoyi-ui/src/views/stock/pointOut.vue
2026-03-23 11:31:31 +08:00

514 lines
16 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="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="distribution">
<el-input
v-model="queryParams.distribution"
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="trayCode">
<el-input
v-model="queryParams.trayCode"
placeholder="请输入托盘条码"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="托盘列表" prop="trayCodeList">
<el-select
v-model="queryParams.trayCodeList"
multiple
filterable
allow-create
default-first-option
placeholder="输入条码后回车"
style="width: 240px"
@change="handleQuery"
>
<el-option v-for="item in []" :key="item" :label="item" :value="item" />
</el-select>
</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>
<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>-->
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-download"
size="mini"
@click="handleNormalOut"
v-hasPermi="['job:outmydoJob:pointOut']"
>出来看看</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-download"
size="mini"
@click="handleSouthOut"
v-hasPermi="['job:outmydoJob:pointOut1']"
>出库端出库</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-download"
size="mini"
@click="handleNorthOut"
v-hasPermi="['job:outmydoJob:pointOut2']"
>入库端出库</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="warehouseId" >
<template slot-scope="scope">
<dict-tag :options="dict.type.warehouse" :value="scope.row.warehouseId"/>
</template>
</el-table-column>
<el-table-column label="库存编码" align="center" prop="stockId" width="140"/>
<el-table-column label="货位名称" align="center" prop="cargoSpaceName" width="140"/>
<el-table-column label="巷道" align="center" prop="roadwayId" width="80"/>
<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-column label="托盘码" align="center" prop="trayCode" width="120"/>
<el-table-column label="部门" align="center" prop="deptName" width="120"/>
<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" />
<el-table-column label="规格型号" align="center" prop="netWeight" />
<el-table-column label="重量" align="center" prop="theType" />
<el-table-column label="容量" align="center" prop="theTypeName" />
<el-table-column label="库存数量" align="center" prop="quantity" width="80" />
</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', 'product_type', 'quality_type', 'turnover_type', 'sys_yes_no','account_type','origin_type','purpose_type','warehouse'],
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,
trayCodeList: [],
outQuantity: null,
stockinDetailId: null,
stockinId: null,
inType: null,
inClassId: null,
warehouseId: null,
stackingId: null,
spare1: null,
spare2: null,
spare3: null,
spare4: null,
spare5: null,
roadwayId: null,
thePlatoon: null,
theColumn: null,
theFloor: null,
spare6: 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: [],
// 当前操作类型 1:指定货位出库 2:出来看看
currentOperationType: '1'
}
},
created() {
//this.getList()
//this.getWarehouseList();
this.loading = false
},
methods: {
/** 获取仓库列表 */
getWarehouseList() {
listWarehouse().then(response => {
this.warehouseOptions = response.rows;
});
},
/** 查询库存信息列表 */
getList() {
this.loading = true
// 直接传递 queryParams,axios 会将 trayCodeList 数组正确序列化
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
}
this.resetForm("form")
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1
this.getList()
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm")
this.queryParams.inDate = null
this.queryParams.trayCodeList = []
this.managementList = []
this.total = 0
//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(() => {})
},
/** 出库端出库按钮操作 */
handleSouthOut() {
if (this.ids.length === 0) {
this.$modal.msgError("请至少选择一行数据");
return;
}
this.doPointOut('2', '2'); // 出库端出库 exitId: '2', type: '2'
},
/*二联合出库按钮*/
handleNormalOut() {
if (this.ids.length === 0) {
this.$modal.msgError("请至少选择一行数据");
return;
}
this.doPointOut('1', '2');
},
/** 入库端出库按钮操作 */
handleNorthOut() {
if (this.ids.length === 0) {
this.$modal.msgError("请至少选择一行数据");
return;
}
this.doPointOut('1', '2'); // 入库端出库 exitId: '1', type: '2'
},
/** 指定货位出库按钮操作 */
pointOut() {
this.handlePointOutOperation('1');
},
handlePointOutOperation(type) {
this.currentOperationType = type;
if (this.ids.length === 0) {
this.$modal.msgError("请至少选择一行数据");
return;
}
// 获取选中的完整数据
const selectedData = this.managementList.filter(item => this.ids.includes(item.stockId));
this.selectedStockData = selectedData;
const codes = selectedData.map(item => String(item.warehouseId || '').padStart(2, '0'))
const all02 = codes.length > 0 && codes.every(c => c === '02')
if (all02) {
this.exitDialogVisible = false
this.exitForm.exitId = '1'
this.doPointOut('1', type)
return
}
this.exitDialogVisible = true
this.exitForm.exitId = null
},
/** 提交指定货位出库 */
submitPointOut() {
this.$refs["exitForm"].validate(valid => {
if (valid) {
this.doPointOut(this.exitForm.exitId, this.currentOperationType)
}
})
},
doPointOut(exitId, type) {
const stockIds = this.ids
pointOut(stockIds, exitId, type).then(response => {
this.$modal.msgSuccess(response.msg);
this.getList();
this.exitDialogVisible = false;
});
},
/** 取消出口选择 */
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>