refactor(入库计划): 采购入库、工具回库

This commit is contained in:
Kelvin 2024-12-19 16:45:52 +08:00
parent 4562254d3f
commit f9ae0cb09a

View File

@ -24,53 +24,22 @@
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['wm:PLAN:add']"
>新增
@click="handleAdd('CGRK')"
>采购入库
</el-button>
<!-- <el-button-->
<!-- type="primary"-->
<!-- plain-->
<!-- icon="el-icon-plus"-->
<!-- size="mini"-->
<!-- @click="knifeBackVisible=true"-->
<!-- >整刀回库-->
<!-- </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="['wm:PLAN: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="['wm:PLAN:remove']"-->
<!-- >删除-->
<!-- </el-button>-->
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd('GJHK')"
>工具回库
</el-button>
</el-col>
<el-col :span="1.5">
<!-- <el-button-->
<!-- type="warning"-->
<!-- plain-->
<!-- icon="el-icon-download"-->
<!-- size="mini"-->
<!-- @click="handleExport"-->
<!-- v-hasPermi="['wm:PLAN:export']"-->
<!-- >导出-->
<!-- </el-button>-->
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
@ -81,7 +50,7 @@
<el-table-column label="计划编码" align="center" prop="planCode"/>
<el-table-column label="入库类型" align="center" prop="planTypeId">
<template slot-scope="scope">
{{ filterInPlanType(scope.row.planTypeId) }}
{{ filterInPlanType(scope.row.planTypeCode) }}
</template>
</el-table-column>
<el-table-column label="计划类型" align="center" prop="sourceType">
@ -145,122 +114,115 @@
/>
<!-- 添加或修改入库计划对话框 -->
<div v-if="!isKnifeBack">
<el-dialog :title="title" :visible.sync="open" width="50%" append-to-body :close-on-click-modal="false">
<!--状态为1已执行 则禁用-->
<el-form ref="form" :model="form" :rules="rules" label-width="80px" inline :disabled="form.state === '1'">
<el-form-item label="计划编码" prop="planCode">
<el-input v-model="form.planCode" placeholder="请输入计划编码"></el-input>
</el-form-item>
<el-form-item label="入库类型" prop="planTypeId">
<el-select v-model="form.planTypeId" placeholder="请选择入库类型" @change="handlePlanTypeSelectChange">
<el-option :label="item.name" :value="item.typeId" v-for="item in inPlanTypeList"
:key="item.typeId"/>
</el-select>
</el-form-item>
<el-form-item label="源头单据" prop="relBillCode">
<el-input v-model="form.relBillCode" placeholder="请输入源头单据"></el-input>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" placeholder="请输入备注"></el-input>
</el-form-item>
<el-divider content-position="center">入库计划明细信息</el-divider>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAddWmsInPlanDetails">添加
</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="danger" icon="el-icon-delete" size="mini" @click="handleDeleteWmsInPlanDetails">删除
</el-button>
</el-col>
</el-row>
<div>
<el-table :data="wmsInPlanDetailsList" :row-class-name="rowWmsInPlanDetailsIndex"
@selection-change="handleWmsInPlanDetailsSelectionChange" ref="wmsInPlanDetails"
:highlight-current-row="isKnifeBack" @current-change="handleWmsInPlanDetailsCurrentChange">
<el-table-column type="selection" width="55" align="center"/>
<el-table-column label="序号" align="center" prop="index" width="50"/>
<el-table-column label="物品" prop="materialId" width="170">
<template slot-scope="scope">
<el-select v-model="scope.row.materialId" placeholder="请选择物料" filterable remote
:remote-method="getMdItemList" clearable>
<el-option :label="item.itemName" :value="item.itemId.toString()" v-for="item in mdItemList"
:key="item.itemId">
<span style="float: left">{{ item.itemName }}</span>
<span style="float: right; color: #8492a6; font-size: 13px">{{ item.itemCode }}</span>
</el-option>
</el-select>
</template>
</el-table-column>
<el-table-column label="批次" prop="batch" width="150">
<template slot-scope="scope">
<el-input v-model="scope.row.batch" plcaeholder="请输入批次"></el-input>
</template>
</el-table-column>
<el-table-column label="计划数量" prop="quantity" width="150">
<template slot-scope="scope">
<el-input v-model="scope.row.quantity" plcaeholder="请输入计划数量" type="number" :min="0"></el-input>
</template>
</el-table-column>
<el-table-column label="入库数量" prop="quantityIn" width="150">
<template slot-scope="scope">
<el-input v-model="scope.row.quantityIn" plcaeholder="请输入入库数量" type="number" :min="0"
@change="handleQuantityIn($event,scope.row)" :disabled="isKnifeBack"></el-input>
</template>
</el-table-column>
<el-table-column label="库位" prop="cellId" width="150">
<template slot-scope="scope">
<el-select v-model="scope.row.cellId" placeholder="请选择库位" filterable remote
:remote-method="getMdItemList" clearable>
<el-option :label="item.areaName" :value="item.areaId.toString()" v-for="item in areaList"
:key="item.areaId">
<span style="float: left">{{ item.areaName }}</span>
<span style="float: right; color: #8492a6; font-size: 13px">{{ item.areaCode }}</span>
</el-option>
</el-select>
</template>
</el-table-column>
<el-table-column label="状态" prop="planInStatus" width="150">
<dict-tag :options="dict.type.in_plan_state" :value="form.state"></dict-tag>
</el-table-column>
</el-table>
</div>
<!--入库类型为整刀回库则显示-->
<!-- <div v-if="isKnifeBack && Object.keys(selectPlanDetail).length > 0">-->
<!-- <el-divider content-position="center">整刀实例</el-divider>-->
<!-- <wms-in-plan-detail-entity-table-cmps-->
<!-- :planDetail="wmsInPlanDetailsList[selectPlanDetail.index-1]"-->
<!-- :entityList.sync="wmsInPlanDetailsList[selectPlanDetail.index-1].wmsInPlanDetailEntityList"-->
<!-- @count="wmsInPlanDetailsList[selectPlanDetail.index-1].quantityIn = $event"-->
<!-- ></wms-in-plan-detail-entity-table-cmps>-->
<!-- </div>-->
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
<el-dialog :title="dialogTitle" :visible.sync="open" width="50%" append-to-body :close-on-click-modal="false">
<!--状态为 1 已执行 则禁用表单-->
<el-form ref="form" :model="form" :rules="rules" label-width="80px" inline :disabled="form.state === '1'">
<!-- <el-form-item label="计划编码" prop="planCode">-->
<!-- <el-input v-model="form.planCode" placeholder="请输入计划编码"></el-input>-->
<!-- </el-form-item>-->
<el-form-item label="源头单据" prop="relBillCode">
<el-input v-model="form.relBillCode" placeholder="请输入源头单据"></el-input>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" placeholder="请输入备注"></el-input>
</el-form-item>
<el-divider content-position="center">入库计划明细信息</el-divider>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAddWmsInPlanDetails">添加
</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="danger" icon="el-icon-delete" size="mini" @click="handleDeleteWmsInPlanDetails">删除
</el-button>
</el-col>
</el-row>
<div>
<el-table :data="wmsInPlanDetailsList" :row-class-name="rowWmsInPlanDetailsIndex"
@selection-change="handleWmsInPlanDetailsSelectionChange" ref="wmsInPlanDetails"
@current-change="handleWmsInPlanDetailsCurrentChange">
<el-table-column type="selection" width="55" align="center"/>
<el-table-column label="序号" align="center" prop="index" width="50"/>
<el-table-column label="物品" prop="materialId" width="170">
<template slot-scope="scope">
<el-select v-model="scope.row.materialId" placeholder="请选择物料" filterable remote
:remote-method="getMdItemList" clearable>
<el-option :label="item.itemName" :value="item.itemId.toString()" v-for="item in mdItemList"
:key="item.itemId">
<span style="float: left">{{ item.itemName }}</span>
<span style="float: right; color: #8492a6; font-size: 13px">{{ item.itemCode }}</span>
</el-option>
</el-select>
</template>
</el-table-column>
<el-table-column label="批次" prop="batch" width="150">
<template slot-scope="scope">
<el-input v-model="scope.row.batch" plcaeholder="请输入批次"></el-input>
</template>
</el-table-column>
<!-- <el-table-column label="计划数量" prop="quantity" width="150">-->
<!-- <template slot-scope="scope">-->
<!-- <el-input v-model="scope.row.quantity" plcaeholder="请输入计划数量" type="number" :min="0"></el-input>-->
<!-- </template>-->
<!-- </el-table-column>-->
<el-table-column label="入库数量" prop="quantityIn" width="150">
<template slot-scope="scope">
<el-input v-model="scope.row.quantityIn" plcaeholder="请输入入库数量" type="number" :min="0"
@change="handleQuantityIn($event,scope.row)"></el-input>
</template>
</el-table-column>
<el-table-column label="库位" prop="cellId" width="190">
<template slot-scope="scope">
<el-select v-model="scope.row.cellId" placeholder="请选择库位" filterable remote
:remote-method="getMdItemList" clearable>
<el-option :label="item.areaName" :value="item.areaId.toString()" v-for="item in areaList"
:key="item.areaId">
<span style="float: left">{{ item.areaName }}</span>
<span style="float: right; color: #8492a6; font-size: 13px">{{ item.areaCode }}</span>
</el-option>
</el-select>
</template>
</el-table-column>
<el-table-column label="状态" prop="planInStatus" width="150">
<dict-tag :options="dict.type.in_plan_state" :value="form.state"></dict-tag>
</el-table-column>
</el-table>
</div>
</el-dialog>
</div>
<!--入库类型为整刀回库则显示-->
<!-- <div v-if="isKnifeBack && Object.keys(selectPlanDetail).length > 0">-->
<!-- <el-divider content-position="center">整刀实例</el-divider>-->
<!-- <wms-in-plan-detail-entity-table-cmps-->
<!-- :planDetail="wmsInPlanDetailsList[selectPlanDetail.index-1]"-->
<!-- :entityList.sync="wmsInPlanDetailsList[selectPlanDetail.index-1].wmsInPlanDetailEntityList"-->
<!-- @count="wmsInPlanDetailsList[selectPlanDetail.index-1].quantityIn = $event"-->
<!-- ></wms-in-plan-detail-entity-table-cmps>-->
<!-- </div>-->
</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>
<!-- 添加或修改入库计划对话框 整刀回库 -->
<div v-if="isKnifeBack">
<wms-in-plan-knife-back-form-cmps :data-form.sync="form" :visible.sync="open" @confirm="getList"
@planTypeSelectChange="handlePlanTypeSelectChange"
></wms-in-plan-knife-back-form-cmps>
</div>
<wms-in-plan-knife-back-form-cmps v-if="knifeBackVisible" :data-form.sync="form" :visible.sync="knifeBackVisible"
@confirm="getList"
@planTypeSelectChange="handlePlanTypeSelectChange"
></wms-in-plan-knife-back-form-cmps>
</div>
</template>
<script>
import {listPLAN, getPLAN, delPLAN, addPLAN, updatePLAN, isDuplicatePlanCode,} from "@/api/wm/PLAN";
import {listPLAN, getPLAN, delPLAN, addPLAN, updatePLAN, isDuplicatePlanCode, syncInBound,} from "@/api/wm/PLAN";
import {listTYPE} from "@/api/md/TYPE";
import {listMdItem} from "@/api/mes/md/mdItem"
import {listArea} from "@/api/mes/wm/area"
import {addWmsInTask} from "@/api/mes/wm/wmsInTask"
import WmsInPlanDetailEntityTableCmps from "@/views/mes/wm/inPlan/wmsInPlanDetailEntityTableCmps.vue";
import WmsInPlanKnifeBackFormCmps from "@/views/mes/wm/inPlan/wmsInPlanKnifeBackFormCmps.vue";
import plan from "@/views/mes/cal/plan/index.vue";
//
const planCodeValidator = (rule, value, callback) => {
@ -307,7 +269,7 @@ export default {
//
areaList: [],
//
title: "",
dialogTitle: "",
//
open: false,
//
@ -360,12 +322,7 @@ export default {
}
};
},
computed: {
/** 控制弹窗类型 */
isKnifeBack() {
return this.form.planTypeId == 19;
}
},
computed: {},
created() {
this.getList();
},
@ -402,7 +359,6 @@ export default {
* @param itemName
*/
getMdItemList(itemName = "") {
this.loading = true;
const params = {
pageNum: 1,
pageSize: 100,
@ -418,7 +374,6 @@ export default {
* @param areaName
*/
getAreaList(areaName = "") {
this.loading = true;
const params = {
pageNum: 1,
pageSize: 100,
@ -431,15 +386,15 @@ export default {
},
/**
* 过滤出入库类型
* @param id 出入库类型ID
* @param code 出入库类型 编码
* @returns {*}
*/
filterInPlanType(id) {
const filter = this.inPlanTypeList.filter(item => item.typeId === id);
filterInPlanType(code) {
const filter = this.inPlanTypeList.filter(item => item.code === code);
if (filter.length) {
return filter[0].name
}
return id
return code
},
/** 入库类型选择器回调 */
handlePlanTypeSelectChange(typeId) {
@ -501,6 +456,7 @@ export default {
isDelete: null,
planCode: null,
planTypeId: null,
planTypeCode: null,
wmsInPlanDetailsList: []
};
this.wmsInPlanDetailsList = [];
@ -522,11 +478,32 @@ export default {
this.single = selection.length !== 1
this.multiple = !selection.length
},
handleSync() {
syncInBound().then(res => {
this.getList();
this.$message.success("数据同步成功");
})
},
/** 新增按钮操作 */
handleAdd() {
handleAdd(planTypeCode) {
this.reset();
this.open = true;
this.title = "添加入库计划";
//
const filter = this.inPlanTypeList.filter(item => item.code === planTypeCode);
if (filter.length) {
this.form.planTypeId = filter[0].typeId;
this.form.planTypeCode = filter[0].code;
this.form.planTypeName = filter[0].name;
} else {
this.$message.error("系统错误,请联系管理员");
console.error("计划类型查找失败")
return;
}
if (planTypeCode === "DPRK") {
this.open = true;
} else {
this.knifeBackVisible = true;
}
this.dialogTitle = "新增" + filter[0].name;
},
/** 执行按钮操作 */
async handleIssue(row) {
@ -561,6 +538,7 @@ export default {
materialId: planForm.materialId,
materialCode: material[0].itemCode,
planTypeId: planForm.planTypeId,
planTypeCode: planForm.planTypeCode,
//
planInStatus: 0,
// ID
@ -599,7 +577,7 @@ export default {
this.form = response.data;
this.wmsInPlanDetailsList = response.data.wmsInPlanDetailsList;
this.open = true;
this.title = "修改入库计划";
this.dialogTitle = "修改入库计划";
});
},
/** 提交按钮 */