From 3b20f98e2c384a8d07b407a7899fb113b0935855 Mon Sep 17 00:00:00 2001 From: shijing Date: Tue, 18 Mar 2025 10:39:38 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E7=8E=BB=E7=BA=A4=E4=BA=A4=E6=8E=A5?= =?UTF-8?q?=E8=AE=B0=E5=BD=95=E6=89=AB=E6=8F=8F=E6=89=B9=E6=AC=A1=EF=BC=8C?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E7=89=A9=E6=96=99=E5=B7=A5=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/wpm_bx/handover_form.vue | 155 ++++++++++++++++++----------- 1 file changed, 98 insertions(+), 57 deletions(-) diff --git a/src/views/wpm_bx/handover_form.vue b/src/views/wpm_bx/handover_form.vue index 5c91b06a..dfc15325 100644 --- a/src/views/wpm_bx/handover_form.vue +++ b/src/views/wpm_bx/handover_form.vue @@ -64,7 +64,8 @@ - + + @@ -532,6 +533,7 @@ export default { this.addShow = true; }, delMaterial(index){ + this.selectItems.splice(index,1); this.form.handoverb.splice(index,1); this.countChange(); }, @@ -569,8 +571,9 @@ export default { data.forEach((item,index)=>{ item.wm = item.id; item.count = item.count_cando; - totalCount += item.count_cando; + totalCount += Number(item.count_cando); item.tracking = item.material_.tracking; + item.process = item.material_.process_name; item.handoverbw = []; that.getWprList(item.id,index); }) @@ -598,9 +601,11 @@ export default { let totalCount = 0; if(this.form.handoverb.length>0){ this.form.handoverb.forEach(item=>{ - totalCount += item.count; + totalCount += Number(item.count); }) that.totalCount = totalCount; + }else{ + that.totalCount = 0; } }, countChanges(index){ @@ -723,6 +728,7 @@ export default { let obj = {}; obj.wm = item.id; obj.batch = item.batch; + obj.batch = item.batch.material_.process_name; obj.count_cando = item.count; obj.count = item.count; obj.handoverbw = []; @@ -752,74 +758,109 @@ export default { } }) }else{//wpr的number - that.$API.wpm.wpr.list.req({number:data,page:0}).then((res) => { - if(res.length>0){ - let indexs = 0,arr =[]; - if( that.form.handoverb&&that.form.handoverb.length>0){ - arr = that.form.handoverb.filter((item,index) => { - indexs = index; - return item.wm == res[0].wm; - }) + let arr = []; + arr = that.materialOptions.filter((item) => { + return item.batch == data; + }) + if(arr.length>0){//有批次 + let arr2 = []; + if(that.form.handoverb&&that.form.handoverb.length>0){ + arr2 = that.form.handoverb.filter((item) => { + return item.batch == data; + }) + } + if(arr2.length>0){ + that.wm_in = ""; + that.$message.error("该批次已存在") + }else{ + let params = {material: arr[0].material,type: that.type}; + that.$API.wpm.handover.mgroups.req(params).then((res0) => { + that.mgroupOptions = res0; + }) + let obj2 = {}; + obj2.wm = arr[0].id; + obj2.batch = arr[0].batch; + obj2.process = arr[0].material_.process_name; + obj2.count_cando = arr[0].count; + obj2.count = arr[0].count; + if(that.form.handoverb&&that.form.handoverb.length>0){ + that.form.handoverb.push(obj2); + }else{ + that.form.handoverb = []; + that.form.handoverb.push(obj2); } - //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; + that.wm_in = ""; + } + }else{//单件 + that.$API.wpm.wpr.list.req({number:data,page:0}).then((res) => { + if(res.length>0){ + let indexs = 0,arr =[]; + if( that.form.handoverb&&that.form.handoverb.length>0){ + arr = that.form.handoverb.filter((item,index) => { + indexs = index; + return item.wm == res[0].wm; }) - if(arr1.length>0){ - that.wm_in = ""; - that.$message.error("该物料已存在"); + } + //handoverb里有这个物料批次 + if(arr.length>0){ + //判断是否有wpr,若无将wpr放进去 + if(that.form.handoverb[indexs].handoverbw&&that.form.handoverb[indexs].handoverbw.length>0){ + let arr1 = []; + arr1 = that.form.handoverb[indexs].handoverbw.filter((item1) => { + return item1.wpr == res[0].id; + }) + if(arr1.length>0){ + that.wm_in = ""; + that.$message.error("该物料已存在"); + }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); + that.wm_in = ""; + } }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].count=1; that.form.handoverb[indexs].handoverbw.push(obj1); that.wm_in = ""; } - }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); + }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.process = item.material_.process_name; + 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 = []; + that.form.handoverb.push(obj2); + } + }) that.wm_in = ""; } - }else{//handoverb里没有有这个物料批次 - console.log('handoverb里没有有这个物料批次'); - that.materialOptions.forEach((item) => { - if(item.id == res[0].wm){ - console.log('item',item); - 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 = []; - that.form.handoverb.push(obj2); - } - }) + }else{ that.wm_in = ""; + that.$message.error("该批次不存在") } - }else{ - that.wm_in = ""; - that.$message.error("该批次不存在") - } - }) + }) + } } + this.countChange(); }, }, };