refactor(入库计划): rfid是否重复

This commit is contained in:
LJW 2024-11-21 09:04:02 +08:00
parent 6053df2144
commit fa84dc4355
3 changed files with 68 additions and 19 deletions

View File

@ -17,6 +17,14 @@ export function getBaseKnife(baseKnifeId) {
})
}
// 查询台账RFID是否重复
export function isDuplicateRfid(rfid) {
return request({
url: '/mes/md/baseKnife/isDuplicateRfid/' + rfid,
method: 'get'
})
}
// 新增刀具台账
export function addBaseKnife(data) {
return request({

View File

@ -23,11 +23,11 @@ export default {
selectIndex: -1
}
},
computed:{
getKnifeType(){
if(this.planTypeId==9){
computed: {
getKnifeType() {
if (this.planTypeId == 9 || this.planTypeId == 15) {
return "整刀"
}else{
} else {
return "刀柄类"
}
}
@ -111,11 +111,6 @@ export default {
<el-input v-model="scope.row.source" @change="updateEntityList"></el-input>
</template>
</el-table-column>
<el-table-column label="RFID" align="center" prop="rfid">
<template slot-scope="scope">
<el-input v-model="scope.row.rfid" @change="updateEntityList"></el-input>
</template>
</el-table-column>
<el-table-column label="消耗寿命" align="center" prop="consumeLife">
<template slot-scope="scope">
<el-input v-model="scope.row.consumeLife" type="number" min="0" @change="updateEntityList"></el-input>
@ -155,7 +150,7 @@ export default {
</el-table-column>
</el-table>
<!--拆刀回库-->
<el-table :data="localEntityList" v-if="planTypeId==15" @selection-change="handleSelectionChange">
<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">
@ -168,11 +163,6 @@ export default {
<el-input v-model="scope.row.source" @change="updateEntityList"></el-input>
</template>
</el-table-column>
<el-table-column label="RFID" align="center" prop="rfid">
<template slot-scope="scope">
<el-input v-model="scope.row.rfid" @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
@ -187,7 +177,8 @@ export default {
</el-table-column>
</el-table>
<base-knife-select-cmps :visible.sync="baseKnifeVisible" :knife-type="getKnifeType" @change="selectBaseKnifeChange"></base-knife-select-cmps>
<base-knife-select-cmps :visible.sync="baseKnifeVisible" :knife-type="getKnifeType"
@change="selectBaseKnifeChange"></base-knife-select-cmps>
</div>
</template>

View File

@ -4,6 +4,7 @@ import WmsInPlanDetailEntityTableCmps from "@/views/mes/wm/inPlan/wmsInPlanDetai
import {addPLAN, updatePLAN} from "@/api/wm/PLAN";
import {listMdItem} from "@/api/mes/md/mdItem";
import {listTYPE} from "@/api/md/TYPE";
import {isDuplicateRfid} from "@/api/mes/md/baseKnife";
export default {
name: "wmsInPlanKnifeBackFormCmps",
@ -58,11 +59,23 @@ export default {
},
/** 对话框关闭 */
handleClose() {
this.reset();
this.$emit("update:visible", false)
},
async validateRfid() {
const rfidList = this.wmsInPlanDetailEntityList.map(entity => entity.rfid);
if (rfidList.length === 0) return
const res = await isDuplicateRfid(rfidList.join(","));
return res.data
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
async submitForm() {
const validateRfidResult = await this.validateRfid();
if (validateRfidResult.length > 0) {
this.$modal.msgError(`RFID重复${validateRfidResult}`);
return;
}
await this.$refs["form"].validate(valid => {
if (valid) {
this.localDataForm.wmsInPlanDetailsList = []
//
@ -130,6 +143,42 @@ export default {
this.mdItemList = response.rows;
});
},
//
reset() {
this.form = {
planId: null,
state: null,
sourceType: null,
wareId: null,
cellCode: null,
workOrderCode: null,
expectDate: null,
publishName: null,
publishTime: null,
closerId: null,
closeTime: null,
relBillCode: null,
createBy: null,
createTime: null,
updateTime: null,
updateBy: null,
remark: null,
customerId: null,
poCode: null,
departmentId: null,
contractNo: null,
supplierId: null,
businessTypeId: null,
srcOutTaskId: null,
isActive: null,
isDelete: null,
planCode: null,
planTypeId: null,
wmsInPlanDetailsList: []
};
this.wmsInPlanDetailsList = [];
this.resetForm("form");
},
},
mounted() {
this.getAreaList();
@ -145,7 +194,8 @@ export default {
</script>
<template>
<el-dialog :title="title" :visible="visible" width="50%" append-to-body @close="handleClose" :close-on-click-modal="false">
<el-dialog :title="title" :visible="visible" width="50%" append-to-body @close="handleClose"
:close-on-click-modal="false">
<!--状态为1已执行 则禁用-->
<el-form ref="form" :model="localDataForm" :rules="rules" label-width="80px" inline
:disabled="localDataForm.state === '1'">