From eb9396f2f8e763b82e1025938840f2eb995b0acf Mon Sep 17 00:00:00 2001 From: shijing Date: Fri, 20 Jun 2025 15:01:12 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E4=BA=A4=E6=8E=A5=E6=92=A4=E6=B6=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/model/wpm.js | 9 ++ src/views/wpm_bx/handover.vue | 16 ++- src/views/wpm_bx/handover_form.vue | 39 ++++--- src/views/wpm_gx/handover.vue | 14 +++ src/views/wpm_gx/handover_form.vue | 157 ++++++----------------------- 5 files changed, 92 insertions(+), 143 deletions(-) diff --git a/src/api/model/wpm.js b/src/api/model/wpm.js index 58ed4600..ad6b4099 100644 --- a/src/api/model/wpm.js +++ b/src/api/model/wpm.js @@ -450,6 +450,15 @@ export default { ); }, }, + revert: { + name: "撤回", + req: async function (id, data) { + return await http.post( + `${config.API_URL}/wpm/handover/${id}/revert/`, + data + ); + }, + }, mgroups:{ name: "获取可交接的工段", req: async function (data) { diff --git a/src/views/wpm_bx/handover.vue b/src/views/wpm_bx/handover.vue index a7e49003..3c95af00 100644 --- a/src/views/wpm_bx/handover.vue +++ b/src/views/wpm_bx/handover.vue @@ -144,12 +144,12 @@ width="300" > - + - @@ -379,33 +358,6 @@ export default { } }); }, - //获取车间物料 - // getMaterial() { - // let that = this; - // var req = { - // page: 0, - // state:10, - // tag:'done' - // }; - // that.materialOptions = []; - // req.mgroup = that.mgroupId; - // that.listParams = req; - // this.$API.wpm.wmaterial.list.req(req).then((res) => { - // that.materialOptions = res; - // res.forEach(item=>{ - // if(that.codeText!==''&&item.batch === that.codeText){ - // let obj = {}; - // obj.wm = item.id; - // obj.batch = item.batch; - // obj.count = item.count_cando; - // obj.count_cando = item.count_cando; - // that.totalCount = item.count_cando; - // that.form.handoverb.push(obj) - // that.getResaveMgroups(item.material); - // } - // }) - // }); - // }, getResaveMgroups(material){ let that = this; let params = { @@ -419,46 +371,6 @@ export default { } }) }, - //获取车间不合格物料 - // getMaterialNotok() { - // let that = this; - // that.materialOptions = []; - // var req = { - // mgroupx: that.mgroupId, - // page: 0, - // state:20 - // }; - // that.listParams = req; - // this.$API.wpm.wmaterial.list.req(req).then((res) => { - // that.materialOptions = res; - // }); - // }, - // getMaterialRework(){ - // let that = this; - // that.materialOptions = []; - // var req = { - // mgroup: that.mgroupId, - // page: 0, - // tag : 'done' - // }; - // that.listParams = req; - // this.$API.wpm.wmaterial.list.req(req).then((res) => { - // that.materialOptions = res; - // }); - // }, - //获取废品库物料 - // getMaterialFP() { - // let that = this; - // that.materialOptions = []; - // var obj = { - // page: 0, - // state : 50, - // state_all: 1 - // }; - // that.$API.wpm.wmaterial.list.req(obj).then((res) => { - // that.materialOptions = res; - // }); - // }, //获取交送工段人员 getUserList() { let that = this; @@ -538,7 +450,7 @@ export default { }else{ this.form.handoverb = data; data.forEach(item=>{ - this.totalCount += Number(item.count_cando); + this.totalCount += Number(item.count); }) } } @@ -550,45 +462,36 @@ export default { }, materialChange0(){ let that = this; - let obj = {}; - obj.wm = that.selectObj.id; - obj.batch = that.selectObj.batch; - obj.label = that.selectObj.defect !== null?that.selectObj.batch+'('+that.selectObj.material_name+')'+that.selectObj.defect_name:that.selectObj.batch+'('+that.selectObj.material_name+')'; - obj.count = that.selectObj.count_cando; - obj.defect_name = that.selectObj.defect_name; - obj.count_cando = that.selectObj.count_cando; - obj.material = that.selectObj.material; - if(that.form.handoverb.length>0){ - let datas = that.form.handoverb.filter((item) => { - return item.wm==that.selectObj.id; - }); - if(datas.length>0){ - that.$message.warning('该物料已存在'); + if(that.selectObj.count_canhandover>0){ + let obj = {}; + obj.wm = that.selectObj.id; + obj.state = that.selectObj.state; + obj.batch = that.selectObj.batch; + obj.label = that.selectObj.defect !== null?that.selectObj.batch+'('+that.selectObj.material_name+')'+that.selectObj.defect_name:that.selectObj.batch+'('+that.selectObj.material_name+')'; + obj.count = that.selectObj.count_canhandover; + obj.defect = that.selectObj.defect; + obj.defect_name = that.selectObj.defect_name; + obj.count_cando = that.selectObj.count_canhandover; + obj.material = that.selectObj.material; + if(that.form.handoverb.length>0){ + let datas = that.form.handoverb.filter((item) => { + return item.wm==that.selectObj.id; + }); + if(datas.length>0){ + that.$message.warning('该物料已存在'); + }else{ + that.totalCount += Number(obj.count_canhandover); + that.form.handoverb.push(obj); + } }else{ - that.totalCount += Number(obj.count_cando); + that.totalCount += Number(obj.count_canhandover); that.form.handoverb.push(obj); } + that.getResaveMgroups(obj.material); }else{ - that.totalCount += Number(obj.count_cando); - that.form.handoverb.push(obj); + that.$message.warning('该物料暂无可交接数量'); } - that.getResaveMgroups(obj.material); }, - // materialChange() { - // let that = this; - // let totalCount = 0; - // let data = that.materialOptions.filter((item) => { - // return that.selectItems.indexOf(item.id)>-1; - // }); - // data.forEach(item=>{ - // item.wm = item.id; - // item.count = item.count_cando; - // totalCount += Number(item.count_cando); - // }) - // that.totalCount = totalCount; - // that.form.handoverb = data; - // that.getResaveMgroups(data[0].material); - // }, countChange(){ let that = this; let totalCount = 0; @@ -676,7 +579,7 @@ export default { let id = data.split('#')[1]; this.$API.cm.labelmat.item.req(id).then((res) => { let arr = that.form.handoverb.filter((item) => { - return item.batch == res.batch; + return item.batch == res.batch&&item.state==res.state&&item.defect==res.defect; }) if(arr.length>0){ that.$message.error("该批次已存在") @@ -696,9 +599,11 @@ export default { obj.wm = item.id; obj.batch = item.batch; obj.label = item.defect !== null?item.batch+'('+item.material_name+')'+item.defect_name:item.batch+'('+item.material_name+')'; - obj.count = item.count_cando; + obj.count = cando; + obj.state = item.state; + obj.defect = item.defect; obj.defect_name = item.defect_name; - obj.count_cando = item.count_cando; + obj.count_cando = cando; obj.material = item.material; that.form.handoverb.push(obj) that.getResaveMgroups(obj.material);