refactor: 入库计划修改

This commit is contained in:
Kelvin 2024-12-19 16:47:00 +08:00
parent b831b2c7fd
commit 256334926a
2 changed files with 40 additions and 73 deletions

View File

@ -14,6 +14,10 @@ export default {
planTypeId: { planTypeId: {
type: String, type: String,
require: true require: true
},
planTypeCode: {
type: String,
require: true
} }
}, },
data() { data() {
@ -61,6 +65,7 @@ export default {
selectBaseKnifeChange(e) { selectBaseKnifeChange(e) {
if (this.selectIndex !== -1) { if (this.selectIndex !== -1) {
this.localEntityList[this.selectIndex].knifeId = e.baseKnifeId this.localEntityList[this.selectIndex].knifeId = e.baseKnifeId
this.localEntityList[this.selectIndex].rfid = e.rfid
this.localEntityList[this.selectIndex].baseKnifeInfo = e this.localEntityList[this.selectIndex].baseKnifeInfo = e
// //
listMdItem({itemCode: e.knifeCode}).then(res => { listMdItem({itemCode: e.knifeCode}).then(res => {
@ -97,8 +102,8 @@ export default {
</el-button> </el-button>
</el-col> </el-col>
</el-row> </el-row>
<!--整刀回库--> <!--工具回库-->
<el-table :data="localEntityList" v-if="planTypeId==19" @selection-change="handleSelectionChange"> <el-table :data="localEntityList" v-if="planTypeCode==='GJHK'" @selection-change="handleSelectionChange">
<el-table-column label="台账ID" align="center" prop="knifeId"> <el-table-column label="台账ID" align="center" prop="knifeId">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input v-model="scope.row.knifeId" @change="updateEntityList"> <el-input v-model="scope.row.knifeId" @change="updateEntityList">
@ -111,26 +116,26 @@ export default {
<el-input v-model="scope.row.source" @change="updateEntityList"></el-input> <el-input v-model="scope.row.source" @change="updateEntityList"></el-input>
</template> </template>
</el-table-column> </el-table-column>
<!-- <el-table-column label="消耗寿命" align="center" prop="consumeLife">--> <el-table-column label="消耗寿命" align="center" prop="consumeLife">
<!-- <template slot-scope="scope">--> <template slot-scope="scope">
<!-- <el-input v-model="scope.row.consumeLife" type="number" min="0" @change="updateEntityList"></el-input>--> <el-input v-model="scope.row.consumeLife" type="number" min="0" @change="updateEntityList"></el-input>
<!-- </template>--> </template>
<!-- </el-table-column>--> </el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
icon="el-icon-delete" icon="el-icon-delete"
@click="handleDelete(scope)" @click="handleDelete(scope)"
v-hasPermi="['wm:wmsInPlanDetailsEntity:remove']" v-hasPermi="['wm:wmsInPlanDetailsEntity:remove']"
>删除 >删除
</el-button> </el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<!--刀柄入库--> <!--采购入库-->
<el-table :data="localEntityList" v-if="planTypeId==7" @selection-change="handleSelectionChange"> <el-table :data="localEntityList" v-if="planTypeCode==='CGRK'" @selection-change="handleSelectionChange">
<el-table-column label="RFID" align="center" prop="rfid"> <el-table-column label="RFID" align="center" prop="rfid">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input v-model="scope.row.rfid" @change="updateEntityList"></el-input> <el-input v-model="scope.row.rfid" @change="updateEntityList"></el-input>
@ -139,45 +144,18 @@ export default {
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
icon="el-icon-delete" icon="el-icon-delete"
@click="handleDelete(scope)" @click="handleDelete(scope)"
v-hasPermi="['wm:wmsInPlanDetailsEntity:remove']" v-hasPermi="['wm:wmsInPlanDetailsEntity:remove']"
>删除
</el-button>
</template>
</el-table-column>
</el-table>
<!--拆刀回库-->
<el-table :data="localEntityList" v-if="planTypeId==15" @selection-change="handleSelectionChange">
<el-table-column label="台账ID" align="center" prop="knifeId">
<template slot-scope="scope">
<el-input v-model="scope.row.knifeId" @change="updateEntityList">
<el-button slot="append" icon="el-icon-search" @click="showBaseKnifeDialog(scope)"></el-button>
</el-input>
</template>
</el-table-column>
<el-table-column label="来源" align="center" prop="source">
<template slot-scope="scope">
<el-input v-model="scope.row.source" @change="updateEntityList"></el-input>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope)"
v-hasPermi="['wm:wmsInPlanDetailsEntity:remove']"
>删除 >删除
</el-button> </el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<base-knife-select-cmps :visible.sync="baseKnifeVisible" <base-knife-select-cmps :visible.sync="baseKnifeVisible" :knife-type="getKnifeType"
@change="selectBaseKnifeChange"></base-knife-select-cmps> @change="selectBaseKnifeChange"></base-knife-select-cmps>
</div> </div>
</template> </template>

View File

@ -29,7 +29,6 @@ export default {
wmsInPlanDetailEntityList: [], wmsInPlanDetailEntityList: [],
// //
rules: { rules: {
planCode: [{required: true}],
relBillCode: [{required: true}], relBillCode: [{required: true}],
}, },
localVisible: this.visible, localVisible: this.visible,
@ -40,7 +39,7 @@ export default {
}, },
computed: { computed: {
title() { title() {
return this.localDataForm.planId ? "修改入库计划" : "新增入库计划" return (this.localDataForm.planId ? "修改" : "新增") + this.dataForm.planTypeName
}, },
}, },
methods: { methods: {
@ -63,18 +62,19 @@ export default {
this.$emit("update:visible", false) this.$emit("update:visible", false)
}, },
async validateRfid() { async validateRfid() {
const rfidList = this.wmsInPlanDetailEntityList.map(entity => entity.rfid); const rfidList = this.wmsInPlanDetailEntityList.filter(entity => entity.rfid && entity.rfid.trim().length > 0).map(entity => entity.rfid);
if (rfidList.length === 0) return console.log(rfidList)
if (!Array.isArray(rfidList) || rfidList.length === 0) return
const res = await isDuplicateRfid(rfidList.join(",")); const res = await isDuplicateRfid(rfidList.join(","));
return res.data return res.data
}, },
/** 提交按钮 */ /** 提交按钮 */
async submitForm() { async submitForm() {
const validateRfidResult = await this.validateRfid(); // const validateRfidResult = await this.validateRfid();
if (validateRfidResult.length > 0) { // if (Array.isArray(validateRfidResult) && validateRfidResult.length > 0) {
this.$modal.msgError(`RFID重复${validateRfidResult}`); // this.$modal.msgError(`RFID${validateRfidResult}`);
return; // return;
} // }
await this.$refs["form"].validate(valid => { await this.$refs["form"].validate(valid => {
if (valid) { if (valid) {
this.localDataForm.wmsInPlanDetailsList = [] this.localDataForm.wmsInPlanDetailsList = []
@ -199,24 +199,12 @@ export default {
<!--状态为1已执行 则禁用--> <!--状态为1已执行 则禁用-->
<el-form ref="form" :model="localDataForm" :rules="rules" label-width="80px" inline <el-form ref="form" :model="localDataForm" :rules="rules" label-width="80px" inline
:disabled="localDataForm.state === '1'"> :disabled="localDataForm.state === '1'">
<el-form-item label="计划编码" prop="planCode"> <!-- <el-form-item label="计划编码" prop="planCode">-->
<el-input v-model="localDataForm.planCode" placeholder="请输入计划编码"></el-input> <!-- <el-input v-model="localDataForm.planCode" placeholder="请输入计划编码"></el-input>-->
</el-form-item> <!-- </el-form-item>-->
<el-form-item label="入库类型" prop="planTypeId">
<el-select v-model="localDataForm.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="localDataForm.relBillCode" placeholder="请输入源头单据"></el-input>
</el-form-item>
<el-form-item label="备注" prop="remark"> <el-form-item label="备注" prop="remark">
<el-input v-model="localDataForm.remark" placeholder="请输入备注"></el-input> <el-input v-model="localDataForm.remark" placeholder="请输入备注"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="批次" prop="batch">
<el-input v-model="wmsInPlanDetailForm.batch" plcaeholder="请输入批次"></el-input>
</el-form-item>
<el-form-item label="库位" prop="cellId"> <el-form-item label="库位" prop="cellId">
<el-select v-model="wmsInPlanDetailForm.cellId" placeholder="请选择库位" filterable remote <el-select v-model="wmsInPlanDetailForm.cellId" placeholder="请选择库位" filterable remote
:remote-method="getAreaList" clearable> :remote-method="getAreaList" clearable>
@ -227,7 +215,7 @@ export default {
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="物品" prop="materialId" v-if="localDataForm.planTypeId==7"> <el-form-item label="物品" prop="materialId" v-if="localDataForm.planTypeCode==='CGRK'">
<el-select v-model="wmsInPlanDetailForm.materialId" placeholder="请选择物料" filterable remote <el-select v-model="wmsInPlanDetailForm.materialId" placeholder="请选择物料" filterable remote
:remote-method="getMdItemList" clearable> :remote-method="getMdItemList" clearable>
<el-option :label="item.itemName" :value="item.itemId.toString()" v-for="item in mdItemList" <el-option :label="item.itemName" :value="item.itemId.toString()" v-for="item in mdItemList"
@ -238,10 +226,11 @@ export default {
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-divider content-position="center">整刀实例</el-divider> <el-divider content-position="center">台账实例</el-divider>
<wms-in-plan-detail-entity-table-cmps <wms-in-plan-detail-entity-table-cmps
:entityList.sync="wmsInPlanDetailEntityList" :entityList.sync="wmsInPlanDetailEntityList"
:planTypeId="localDataForm.planTypeId" :planTypeId="localDataForm.planTypeId"
:planTypeCode="localDataForm.planTypeCode"
></wms-in-plan-detail-entity-table-cmps> ></wms-in-plan-detail-entity-table-cmps>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">