Files
FT541-WMS/ruoyi-ui/src/views/stock/management/index.vue
2026-03-19 08:46:24 +08:00

1064 lines
36 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="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="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="deptName">
<el-input
v-model="queryParams.deptName"
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-table
v-loading="loading"
:data="managementList"
@row-click="handleMasterRowClick"
highlight-current-row
max-height="650"
>
<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="cargoSpaceName" />
<el-table-column label="托盘" align="center" prop="trayCode"/>
<el-table-column label="巷道" align="center" prop="roadwayId"/>
<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="theType"/>
<el-table-column label="容量" align="center" prop="theTypeName"/>
<el-table-column label="部门" align="center" prop="model">
<template slot-scope="scope">
<dict-tag :options="getDeptDictOptions(scope.row)" :value="scope.row.model"/>
</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="handleUpdateDept(scope.row)"
v-hasPermi="['stock:management:edit']"
>转运部门</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-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="['stock:management: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="['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-row>
<el-table v-loading="detailLoading" :data="detailList" @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="cargoSpaceId" width="160"/>
<el-table-column label="托盘" align="center" prop="trayCode" width="160"/>
<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="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 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="detailTotal>0"
:total="detailTotal"
:page.sync="detailQueryParams.pageNum"
:limit.sync="detailQueryParams.pageSize"
@pagination="getDetailList"
/>
<el-dialog :title="title" :visible.sync="open" width="600px" append-to-body>
<div v-if="currentMasterRow" class="master-info">
<div class="master-info-title">主表信息</div>
<el-row :gutter="10">
<el-col :span="12">
<span class="master-info-label">仓库:</span>
<span>{{ currentMasterRow.warehouseName }}</span>
</el-col>
<el-col :span="12">
<span class="master-info-label">库位:</span>
<span>{{ currentMasterRow.cargoSpaceId }}</span>
</el-col>
<el-col :span="12" style="margin-top: 4px">
<span class="master-info-label">托盘:</span>
<span>{{ currentMasterRow.trayCode }}</span>
</el-col>
</el-row>
</div>
<el-form ref="form" :model="form" :rules="rules" label-width="90px">
<el-row style="margin-bottom: 10px; margin-left: 20px;">
<el-button type="primary" icon="el-icon-download" size="mini" @click="openImportDialog">导入入库子单</el-button>
</el-row>
<el-form-item label="子单编码" prop="stockinDetailId">
<el-input v-model="form.stockinDetailId" placeholder="请输入子单编码" />
</el-form-item>
<el-form-item label="合同号" prop="orderId">
<el-input v-model="form.orderId" placeholder="请输入合同号" />
</el-form-item>
<el-form-item label="产品号" prop="power">
<el-input v-model="form.power" placeholder="请输入产品号" />
</el-form-item>
<el-form-item label="代号" prop="distribution">
<el-input v-model="form.distribution" placeholder="请输入代号" />
</el-form-item>
<el-form-item label="台次" prop="spare5">
<el-input v-model="form.spare5" placeholder="请输入台次" />
</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"> &lt;!&ndash; 货位 &ndash;&gt;
<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="titleDept" :visible.sync="openDept" width="500px" append-to-body>
<el-form ref="form" :model="deptForm" label-width="80px">
<el-form-item label="托盘条码" prop="trayCode">
<el-input v-model="deptForm.trayCode" placeholder="请输入托盘条码" />
</el-form-item>
<el-form-item label="部门" prop="model">
<el-select v-model="deptForm.model" placeholder="请选择部门">
<el-option
v-for="dict in getDeptDictOptions(deptForm)"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitFormDept">确定 <!-- 确定 --></el-button>
<el-button @click="cancelDept">取消 <!-- 取消 --></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>
<!-- 导入入库子单弹窗 -->
<el-dialog title="导入入库子单" :visible.sync="importDialogVisible" width="900px" append-to-body>
<el-form :model="importQueryParams" ref="importQueryForm" :inline="true" size="mini">
<el-form-item label="合同号" prop="spare6">
<el-input v-model="importQueryParams.spare6" placeholder="请输入合同号" clearable @keyup.enter.native="handleImportQuery"/>
</el-form-item>
<el-form-item label="产品号" prop="spare7">
<el-input v-model="importQueryParams.spare7" placeholder="请输入产品号" clearable @keyup.enter.native="handleImportQuery"/>
</el-form-item>
<el-form-item label="代号" prop="spare9">
<el-input v-model="importQueryParams.spare9" placeholder="请输入代号" clearable @keyup.enter.native="handleImportQuery"/>
</el-form-item>
<el-form-item label="台次" prop="spare5">
<el-input v-model="importQueryParams.spare5" placeholder="请输入台次" clearable @keyup.enter.native="handleImportQuery"/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="handleImportQuery">搜索</el-button>
<el-button icon="el-icon-refresh" @click="resetImportQuery">重置</el-button>
</el-form-item>
</el-form>
<el-table v-loading="importLoading" :data="importList" @current-change="handleImportCurrentChange" highlight-current-row height="400">
<el-table-column label="入库单号" align="center" prop="stockinId" />
<el-table-column label="合同号" align="center" prop="spare6" />
<el-table-column label="产品号" align="center" prop="spare7" />
<el-table-column label="代号" align="center" prop="spare9" />
<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="quantityX" />
</el-table>
<pagination
v-show="importTotal>0"
:total="importTotal"
:page.sync="importQueryParams.pageNum"
:limit.sync="importQueryParams.pageSize"
@pagination="handleImportQuery"
/>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitImport">确 定</el-button>
<el-button @click="importDialogVisible = false">取 消</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {
addManagement,
delManagement,
getManagement,
stockManagementList,
stockSummaryManagementList,
updateManagement, updateStockDept
} from "@/api/stock/management"
import {listWarehouse} from "@/api/bas/warehouse"
import {listBasProduct} from "@/api/bas/BasProduct"
import {listCargoSpace} from "@/api/bas/cargoSpace"
import { listStockInDetail } from "@/api/in/stockInDetail"
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','sl_dept','el_dept'],
data() {
return {
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 子表总条数
detailTotal: 0,
// 库存信息表格数据
managementList: [],
// 库存信息子表数据
detailList: [],
currentMasterRow: null,
// 仓库选项
warehouseOptions: [],
// 弹出层标题
title: "",
titleDept: "",
// 是否显示弹出层
open: false,
openDept: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
},
// 子表查询参数
detailQueryParams: {
pageNum: 1,
pageSize: 10,
trayCode: null,
warehouseId: null
},
queryWarehouse: {
pageNum:1,
pageSize: 99
},
// 表单参数
form: {},
//部门转运表单
deptForm:{},
// 表单校验
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,
// 子表加载状态
detailLoading: false,
// 选中的库存数据
selectedStockData: [],
// 导入相关
importDialogVisible: false,
importLoading: false,
importList: [],
importTotal: 0,
importQueryParams: {
pageNum: 1,
pageSize: 10,
orderId: null,
power: null,
distribution: null,
spare5: null
},
importCurrentRow: null
}
},
created() {
this.getList()
this.getWarehouseList();
},
methods: {
getDeptDictOptions(row) {
const wid = String(row && row.warehouseId != null ? row.warehouseId : "").padStart(2, "0")
if (wid === "01" ) {
return this.dict.type.sl_dept || []
}
if (wid === "02" || wid === "03") {
return this.dict.type.el_dept || []
}
return this.dict.type.sl_dept || []
},
/** 获取仓库列表 */
getWarehouseList() {
listWarehouse(this.queryWarehouse).then(response => {
this.warehouseOptions = response.rows;
});
},
/** 查询库存信息列表 */
getList() {
this.loading = true
stockSummaryManagementList(this.queryParams).then(response => {
this.managementList = response.rows
this.total = response.total
this.loading = false
if (this.managementList && this.managementList.length > 0) {
this.handleMasterRowClick(this.managementList[0])
} else {
this.detailList = []
this.detailTotal = 0
}
})
},
// 取消按钮
cancel() {
this.open = false
this.reset()
},
cancelDept() {
this.openDept = 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.deptForm = {
trayCode: null,
warehouseId: null,
model: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
},
/** 主表行点击,联动查询子表 */
handleMasterRowClick(row) {
if (!row) {
this.detailList = []
this.detailTotal = 0
return
}
this.currentMasterRow = row
this.detailQueryParams.trayCode = row.trayCode
this.detailQueryParams.warehouseId = row.warehouseId
this.detailQueryParams.pageNum = 1
this.getDetailList()
},
/** 查询子表库存明细列表 */
getDetailList() {
if (!this.detailQueryParams.trayCode || !this.detailQueryParams.warehouseId) {
this.detailList = []
this.detailTotal = 0
return
}
this.detailLoading = true
stockManagementList(this.detailQueryParams).then(response => {
this.detailList = response.rows
this.detailTotal = response.total
this.detailLoading = false
}).catch(() => {
this.detailLoading = false
})
},
/** 新增按钮操作 */
handleAdd() {
if (!this.currentMasterRow) {
this.$modal.msgError("请先在上方选择主表数据")
return
}
this.reset()
this.form.trayCode = this.currentMasterRow.trayCode
this.form.warehouseId = this.currentMasterRow.warehouseId
this.form.cargoSpaceId = this.currentMasterRow.cargoSpaceId
this.form.cargoSpaceName = this.currentMasterRow.cargoSpaceName
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.form.trayCode = this.currentMasterRow.trayCode
this.form.warehouseId = this.currentMasterRow.warehouseId
this.form.cargoSpaceId = this.currentMasterRow.cargoSpaceId
this.form.cargoSpaceName = this.currentMasterRow.cargoSpaceName
this.form.productId = response.data.productId
this.form.productName =response.data.productName
console.log(this.form)
console.log(this.currentMasterRow)
this.title = "修改库存信息" // 修改库存信息
})
},
handleUpdateDept(row) {
this.reset()
const trayCode = row.trayCode
this.deptForm = {
trayCode: row.trayCode,
warehouseId: row.warehouseId,
model:row.model
}
this.openDept = true
this.titleDept = "托盘转运部门"
},
/** 提交按钮 */
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()
})
}
}
})
},
submitFormDept() {
if (!this.deptForm.trayCode){
this.$modal.msgError("请输入托盘")
return
}
if (!this.deptForm.warehouseId){
this.$modal.msgError("请输入仓库")
return
}
if (!this.deptForm.model){
this.$modal.msgError("请输入部门")
}
updateStockDept(this.deptForm).then(response => {
this.$modal.msgSuccess("修改成功") // 修改成功
this.openDept = 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("请选择一个货位")
}
},
/** 打开导入弹窗 */
openImportDialog() {
this.importDialogVisible = true;
this.resetImportQuery();
},
/** 导入查询 */
handleImportQuery() {
this.importLoading = true;
listStockInDetail(this.importQueryParams).then(response => {
this.importList = response.rows;
this.importTotal = response.total;
this.importLoading = false;
});
},
/** 重置导入查询 */
resetImportQuery() {
this.importQueryParams = {
pageNum: 1,
pageSize: 10,
orderId: null,
power: null,
distribution: null,
spare5: null
};
this.importList = [];
this.importTotal = 0;
this.importCurrentRow = null;
},
/** 导入行选中 */
handleImportCurrentChange(val) {
this.importCurrentRow = val;
},
/** 确认导入 */
submitImport() {
if (!this.importCurrentRow) {
this.$modal.msgWarning("请选择一条数据");
return;
}
const row = this.importCurrentRow;
// 回填数据
this.form.orderId = row.spare6;
this.form.power = row.spare7;
this.form.distribution = row.spare9;
this.form.spare5 = row.spare5;
this.form.productId = row.productId;
this.form.productName = row.productName;
this.form.quantity = row.quantityX;
this.form.stockinDetailId = row.stockinDetailId;
this.importDialogVisible = false;
this.$modal.msgSuccess("导入数据成功");
}
}
}
</script>
<style>
.no-wrap {
white-space: nowrap;
}
.master-info {
margin-bottom: 10px;
padding: 10px 12px;
background-color: #f5f7fa;
border-radius: 4px;
font-size: 12px;
}
.master-info-title {
margin-bottom: 6px;
color: #606266;
font-weight: 500;
}
.master-info-label {
color: #909399;
}
</style>