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