From a12c3954052b52ce68c02e8810cb07a6f27acff0 Mon Sep 17 00:00:00 2001 From: shijing Date: Sat, 8 Feb 2025 16:47:29 +0800 Subject: [PATCH] =?UTF-8?q?fix:wpr=E6=89=93=E5=8D=B0=E6=A0=87=E7=AD=BE?= =?UTF-8?q?=E6=9B=B4=E6=8D=A2=E6=88=90number=EF=BC=8C=E4=BB=A5=E5=8F=8A?= =?UTF-8?q?=E4=BA=A4=E6=8E=A5=E6=89=AB=E7=A0=81=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/wpm_bx/handover_form.vue | 136 +++++++++++++++-------------- src/views/wpm_bx/inm.vue | 4 +- 2 files changed, 71 insertions(+), 69 deletions(-) diff --git a/src/views/wpm_bx/handover_form.vue b/src/views/wpm_bx/handover_form.vue index 4edeba10..5959c3b6 100644 --- a/src/views/wpm_bx/handover_form.vue +++ b/src/views/wpm_bx/handover_form.vue @@ -706,82 +706,24 @@ export default { return; } let that = this; - let keys = data.split('#')[0]; - let id = data.split('#')[1]; - if(keys=='wpr'){ - that.$API.wpm.wpr.item.req(id).then((res) => { - if(res){ - let indexs = 0; - let arr = that.form.handoverb.filter((item,index) => { - indexs = index; - return item.wm == res.wm; - }) - //handoverb里有这个物料批次 - if(arr.length>0){ - //判断是否有wpr,若无将wpr放进去 - if(that.form.handoverb[0].handoverbw&&that.form.handoverb[0].handoverbw.length>0){ - let arr1 = []; - arr1 = that.form.handoverb[0].handoverbw.filter((item1) => { - return item1.wpr == res.id; - }) - if(arr1.length>0){ - that.$message.error("该物料已存在"); - // console.log('0',that.form); - }else{ - let obj1 = {}; - obj1.wpr = res.id; - obj1.number = res.number; - that.form.handoverb[indexs].count+=1; - that.form.handoverb[indexs].handoverbw.push(obj1); - // console.log('1',that.form); - } - }else{ - that.form.handoverb[indexs].handoverbw = []; - let obj1 = {}; - obj1.wpr = res.id; - obj1.number = res.number; - that.form.handoverb[indexs].count=1; - that.form.handoverb[indexs].handoverbw.push(obj1); - // console.log('2',that.form); - } - }else{//handoverb里没有有这个物料批次 - let params = {material: res.material,type: that.type,}; - that.$API.wpm.handover.mgroups.req(params).then((res) => { - that.mgroupOptions = res; - }) - that.materialOptions.forEach((item) => { - if(item.id == res.wm){ - let obj2 = {}; - obj2.wm = item.id; - obj2.batch = item.batch; - obj2.count_cando = item.count; - obj2.handoverbw = []; - obj2.count = 1; - let obj3 = {}; - obj3.wpr = res.id; - obj3.number = res.number; - obj2.handoverbw.push(obj3); - that.form.handoverb.push(obj2); - // console.log('3',that.form); - } - }) - } - } - }) - }else{ + if(data.indexOf('#')>-1){ + // let keys = data.split('#')[0]; + 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&&item.state==res.state; }) + // console.log('arr',arr) if(arr.length>0){ that.$message.error("该批次已存在") }else{ - let params = {material: res.material,type: that.type,}; - that.$API.wpm.handover.mgroups.req(params).then((res) => { - that.mgroupOptions = res; - }) + // console.log('materialOptions',that.materialOptions) that.materialOptions.forEach((item) => { if(item.batch == res.batch){ + let params = {material: item.material,type: that.type}; + that.$API.wpm.handover.mgroups.req(params).then((res0) => { + that.mgroupOptions = res0; + }) let obj = {}; obj.wm = item.id; obj.batch = item.batch; @@ -804,6 +746,66 @@ export default { }) } }) + }else{//wpr的number + that.$API.wpm.wpr.list.req({number:data,page:0}).then((res) => { + if(res.length>0){ + let indexs = 0; + let arr = that.form.handoverb.filter((item,index) => { + indexs = index; + return item.wm == res[0].wm; + }) + //handoverb里有这个物料批次 + if(arr.length>0){ + //判断是否有wpr,若无将wpr放进去 + if(that.form.handoverb[0].handoverbw&&that.form.handoverb[0].handoverbw.length>0){ + let arr1 = []; + arr1 = that.form.handoverb[0].handoverbw.filter((item1) => { + return item1.wpr == res[0].id; + }) + if(arr1.length>0){ + that.$message.error("该物料已存在"); + // console.log('0',that.form); + }else{ + let obj1 = {}; + obj1.wpr = res[0].id; + obj1.number = res[0].number; + that.form.handoverb[indexs].count+=1; + that.form.handoverb[indexs].handoverbw.push(obj1); + // console.log('1',that.form); + } + }else{ + that.form.handoverb[indexs].handoverbw = []; + let obj1 = {}; + obj1.wpr = res[0].id; + obj1.number = res[0].number; + that.form.handoverb[indexs].count=1; + that.form.handoverb[indexs].handoverbw.push(obj1); + // console.log('2',that.form); + } + }else{//handoverb里没有有这个物料批次 + that.materialOptions.forEach((item) => { + if(item.id == res[0].wm){ + let params = {material: item.material,type: that.type}; + that.$API.wpm.handover.mgroups.req(params).then((res1) => { + that.mgroupOptions = res1; + }) + let obj2 = {}; + obj2.wm = item.id; + obj2.batch = item.batch; + obj2.count_cando = item.count; + obj2.handoverbw = []; + obj2.count = 1; + let obj3 = {}; + obj3.wpr = res[0].id; + obj3.number = res[0].number; + obj2.handoverbw.push(obj3); + that.form.handoverb.push(obj2); + // console.log('3',that.form); + } + }) + } + } + }) } }, }, diff --git a/src/views/wpm_bx/inm.vue b/src/views/wpm_bx/inm.vue index c0e08c8d..f169e17a 100644 --- a/src/views/wpm_bx/inm.vue +++ b/src/views/wpm_bx/inm.vue @@ -200,7 +200,6 @@ > @@ -423,7 +422,8 @@ export default { }); }) }else{ - let code = 'wpr#'+row.id; + // let code = 'wpr#'+row.id; + let code = row.number; let str = [ "SIZE 70 mm,100 mm", "GAP 7 mm,7 mm",