You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

330 lines
8.6 KiB
Vue

<template>
11 months ago
<div >
<el-form ref="form" :model="form" label-width="100px">
<el-form-item label="派工单号">
<el-input v-model="form.planCode" disabled style="width:360px"></el-input>
</el-form-item>
<el-form-item label="明细编号">
<el-input v-model="form.planDetailCode" disabled></el-input>
</el-form-item>
<el-form-item label="仓库">
<el-select v-model="form.warehouseId" placeholder="请选择仓库" style="width:360px" @change="warehouseChange">
<el-option v-for="item in warehouseList" :key="item.warehouseId" :label="item.warehouseName"
:value="item.warehouseId"></el-option>
</el-select>
</el-form-item>
<el-form-item label="领取原因">
<el-input v-model="form.applyReason" type="textarea"></el-input>
</el-form-item>
</el-form>
<el-table
:cell-style="{textAlign:'center'}"
:data="form.wmsRawOutstockDetailList"
:header-cell-style="{textAlign:'center'}"
max-height="19.13vw"
style="width: 100%;"
>
<el-table-column
label="物料编号"
prop="materialCode"
>
</el-table-column>
<el-table-column
label="物料名称"
prop="materialName"
>
</el-table-column>
<el-table-column
label="物料规格"
prop="materialSpec"
>
</el-table-column>
<el-table-column
label="安全库存"
prop="safeFlag"
>
<template slot-scope="scope">
<dict-tag :options="dict.type.mes_safe_flag" :value="scope.row.safeFlag"/>
</template>
</el-table-column>
<el-table-column
label="可用库存"
prop="availableAmount"
>
</el-table-column>
<el-table-column
label="占用库存"
prop="unavailableAmount"
>
</el-table-column>
<el-table-column
label="已申请"
prop="outstockAmount"
>
</el-table-column>
<el-table-column
label="领取数量"
prop="planAmount"
width="120"
>
<template slot-scope="scope">
<el-input-number
v-model="scope.row.planAmount"
controls-position="right"
:max="maxPlanAmount"
style="width: 100%"
>
</el-input-number>
</template>
</el-table-column>
<el-table-column
label="操作"
width="160"
>
<template slot="header" slot-scope="scope">
<el-input
v-model="queryParams.materialCodeNameSpec"
placeholder="编码、名称或规格搜索"
size="mini"
@change="searchMaterial"/>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="searchMaterial"
/>
<div style="text-align: center;margin-top: 30px">
<el-button type="primary" @click="submitForm"></el-button>
</div>
</div>
</template>
<script>
import {getWarehouses, getStockTotal, applyRawOutstock} from "@/api/board";
export default {
name: "Materialinfo",
props: {
defineData: {
type: Object,
default: {}
}
},
dicts: ['mes_safe_flag'],
data() {
return {
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 物料信息表格数据
warehouseList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
maxPlanAmount: 1,
taskType: '',
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
erpId: null,
materialCode: null,
oldMaterialCode: null,
materialName: null,
materialCategories: null,
materialSubclass: null,
materialTypeId: null,
batchFlag: null,
materialUnitId: null,
materialUnit: null,
materialMatkl: null,
materialSpec: null,
netWeight: null,
grossWeight: null,
factoryId: null,
createOrgId: null,
useOrgId: null,
prodlineId: null,
activeFlag: null,
deletedFlag: null,
approveDate: null,
erpModifyDate: null
},
// 表单参数
form: {},
};
},
created() {
this.getData();
this.getWarehouses();
},
methods: {
getData() {
if (this.defineData.planCode) {
this.form = {
warehouseId: '',
planId: this.defineData?.planId,
planCode: this.defineData?.planCode,
dispatchCode: this.defineData?.dispatchCode,
planDetailCode: this.defineData?.planDetailCode,
saleOrderId: this.defineData?.saleOrderId,
applyReason: '',
taskType: this.defineData?.taskType,
stationId: this.defineData?.stationId,
endStationCode: this.defineData?.stationCode,
returnFlag: this.defineData?.returnFlag,
mesAreaType: this.defineData?.mesAreaType,
warehouseFloor: this.defineData?.warehouseFloor,
wmsRawOutstockDetailList: []
}
}
if (this.defineData.maxPlanAmount) {
this.maxPlanAmount = this.defineData?.maxPlanAmount
}
},
getWarehouses() {
// 获取仓库信息
getWarehouses({
warehouseFloor: this.defineData.warehouseFloor,
returnFlag: this.defineData.returnFlag,
mesAreaType: this.defineData.mesAreaType,
}).then(e => {
this.warehouseList = e.data
this.form.warehouseId = e.data[0]?.warehouseId
this.searchMaterial();
})
},
warehouseChange(warehouseId) {
this.form.wmsRawOutstockDetailList = [];
this.form.warehouseId = warehouseId;
this.searchMaterial();
},
// 物料搜索
searchMaterial() {
if (this.form.warehouseId === null || this.form.warehouseId === undefined
|| this.form.warehouseId === "") {
return;
}
this.queryParams.warehouseId = this.form.warehouseId;
this.queryParams.saleOrderId = this.form.saleOrderId;
this.queryParams.planCode = this.form.planCode;
this.queryParams.planDetailCode = this.form.planDetailCode;
getStockTotal(this.queryParams).then(e => {
this.total = e.total;
this.form.wmsRawOutstockDetailList = e.rows.map(r => {
return {
stockTotalId: r.stockTotalId,
materialId: r.materialId,
materialCode: r.materialCode,
materialName: r.materialName,
safeFlag: r.safeFlag,
availableAmount: r.totalAmount - r.occupyAmount - r.frozenAmount,
unavailableAmount: r.occupyAmount + r.frozenAmount,
outstockAmount: r.outstockAmount,
planAmount: this.planAmount
}
})
})
},
/** 查询物料信息列表 */
getList() {
this.loading = true;
this.queryParams.selectType = this.selectType;
listMaterialinfo(this.queryParams).then(response => {
this.materialinfoList = response.rows;
this.total = response.total;
this.loading = false;
});
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
materialId: null,
erpId: null,
materialCode: null,
oldMaterialCode: null,
materialName: null,
materialCategories: null,
materialSubclass: null,
materialTypeId: null,
batchFlag: null,
materialUnitId: null,
materialUnit: null,
materialMatkl: null,
materialSpec: null,
netWeight: null,
grossWeight: null,
factoryId: null,
createOrgId: null,
useOrgId: null,
prodlineId: null,
activeFlag: null,
deletedFlag: null,
remark: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null,
approveDate: null,
erpModifyDate: null
};
this.resetForm("form");
},
/** 提交按钮 */
submitForm() {
applyRawOutstock(this.form).then(e => {
this.dialogVisible = false
this.$modal.msgSuccess("申请成功");
})
},
}
};
</script>
<style lang="less" scoped>
.el-table {
background-color: #fff0;
overflow-y: auto;
}
.roundBorder {
position: absolute;
transform: translate(-50%, -50%);
}
</style>