diff --git a/src/views/wpm_gx/handover.vue b/src/views/wpm_gx/handover.vue index 4376d7ff..15f41672 100644 --- a/src/views/wpm_gx/handover.vue +++ b/src/views/wpm_gx/handover.vue @@ -185,7 +185,7 @@ size="small" @click="table_reBack(scope.row)" type="danger" - v-if="scope.row.recive_mgroup == mgroupId&&scope.row.submit_time!== null&&scope.row.type == 10&&scope.row.mtype == 10" + v-if="scope.row.recive_mgroup == mgroupId&&scope.row.submit_time!== null&&(scope.row.type == 10||scope.row.type == 20)&&scope.row.mtype == 10" >退回 { - this.$refs.saveDialog.open("add",codeText2,20); + this.$refs.saveDialog.open("add",codeText2,10); }); }, //编辑 diff --git a/src/views/wpm_gx/handover_form.vue b/src/views/wpm_gx/handover_form.vue index b8ee7a0d..ea64b8e1 100644 --- a/src/views/wpm_gx/handover_form.vue +++ b/src/views/wpm_gx/handover_form.vue @@ -35,7 +35,26 @@ - + + + + + + - + - + - + {{ listItem.count_cando }} - + { - 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); - } - }) - }); - }, + // 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 = { @@ -393,45 +420,45 @@ 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; - }); - }, + // 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; - }); - }, + // 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; @@ -521,21 +548,47 @@ export default { this.visible = true; return this; }, - materialChange() { + materialChange0(){ 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); + 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('该物料已存在'); + }else{ + that.totalCount += Number(obj.count_cando); + that.form.handoverb.push(obj); + } + }else{ + that.totalCount += Number(obj.count_cando); + that.form.handoverb.push(obj); + } + 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; @@ -628,17 +681,35 @@ export default { if(arr.length>0){ that.$message.error("该批次已存在") }else{ - that.materialOptions.forEach((item) => { - if(item.batch == res.batch){ - let obj = {}; - obj.wm = item.id; - obj.batch = item.batch; - obj.counts = item.count; - obj.count = item.count; - that.form.handoverb.push(obj) - that.getResaveMgroups(item.material); - } - }) + let params = {mgroup: that.mgroupId,page: 0,state__in:res.state,search:res.batch,tag : 'done'}; + if(that.type==10){ + params.state__in = '10'; + }else if(that.type==20){ + params.state__in = '20,34'; + } + that.$API.wpm.wmaterial.list.req(params).then((res1) => { + if(res1.length>0){ + res1.forEach(item=>{ + let cando = Number(item.count_canhandover); + if(cando>0&&item.defect_name==res.defect_name){ + let obj = {}; + 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.defect_name = item.defect_name; + obj.count_cando = item.count_cando; + obj.material = item.material; + that.form.handoverb.push(obj) + that.getResaveMgroups(obj.material); + } + // else{ + // that.$message.error("该批次物料没有可交接的数量") + // } + }) + } + that.codeText = ''; + }); } }) //根据扫描内容,获取物料详情匹配当前库存物料