diff --git a/src/views/wpm_bx/mlogb_form.vue b/src/views/wpm_bx/mlogb_form.vue index e0bbf03c..aaac6bd5 100644 --- a/src/views/wpm_bx/mlogb_form.vue +++ b/src/views/wpm_bx/mlogb_form.vue @@ -18,6 +18,28 @@ style="padding: 0 10px" > + + + + + [{{ item.routepack_name }}]{{ item.name }} + + + + - { + that.routeOptions = res; + if(res.length==1){ + that.form.route = res[0].id; + } + }); + }, getParentList(){ let that = this; that.$API.wpm.mlogb.list.req(that.params).then((res) => { @@ -313,19 +300,41 @@ export default { getMaterial() { let that = this; let obj = {}; + console.log('that.mgroup',that.mgroup); obj.mtaskx =that.form.mtask; - obj.mgroupx =that.mgroup; - obj.route =that.routeId; + obj.mgroup =that.mgroup; + if(that.routeId!==null&&that.routeId!==''){ + obj.route =that.routeId; + } obj.page =0; - if(that.isfix){ - obj.state =30; + if(that.is_fix){//来料未完成的返修品&&出料已完成的返修品和不合格品 + obj.tag = 'canfix'; }else{ + if(that.materialIn!==null&&that.materialIn!==''){ + obj.material =that.materialIn; + } obj.state =10; + obj.tag = 'todo'; } this.$API.wpm.wmaterial.list.req(obj).then((res) => { - that.materialOptions = res; + let arr = []; + if(res.length>0){ + arr = res.filter((item)=>{ + return Number(item.count_cando)>0; + }) + } + that.materialOptions = arr; }); }, + routeChange(){ + let that = this; + that.routeOptions.forEach(item=>{ + if(item.id == that.form.route){ + that.materialIn = item.material_in; + that.getMaterial(); + } + }) + }, changeMaterial(){ let that = this; that.materialOptions.forEach(item=>{ @@ -338,6 +347,7 @@ export default { }, //扫描后处理方法 formWminChange(code){ + console.log('code',code); let that = this,codeId='',arr=[]; code = code.replace(/(^\s*)|(\s*$)/g, ""); if(code.indexOf("#")>-1){ @@ -367,67 +377,69 @@ export default { }); }else{ that.scanKyes = ""; - if(that.tracking==10){//批次 - arr = that.materialOptions.filter((item) => { - return item.batch == code; - }) - if (arr.length > 0) { - that.form.batch = arr[0].batch; - that.form.wm_in = arr[0].id; - that.form.count_use = arr[0].count; - that.wm_in = arr[0].batch; - }else{ - that.wm_in = ''; - that.$message.error("批次号不存在"); - } - }else{//单件 - that.$API.wpm.wpr.list.req({number:code,page:0}).then((res) => { - if(res.length>0){ - let index = res.length-1;//最后一条记录 - let bwitem = {}; - bwitem.mlogb=""; - bwitem.number=res[index].number; - bwitem.wpr=res[index].id; - let arr = that.materialOptions.filter((item) => { - return item.id == res[index].wm; + that.$API.wpm.wpr.list.req({number:code,page:0}).then((res) => { + if(res.length>0){ + let index = res.length-1;//最后一条记录 + let bwitem = {}; + bwitem.mlogb=""; + bwitem.number=res[index].number; + bwitem.wpr=res[index].id; + let arr = that.materialOptions.filter((item) => { + return item.id == res[index].wm; + }) + if(arr.length>0){ //车间存在该批次 + let batch = arr[0].batch; + that.wm_in = arr[0].batch; + that.mlogbInCount = arr[0].count;//该批次数量 + //判断日志中是否存在该批次 + let arr0= that.mlogbIns.filter((item)=>{ + return item.batch == batch; }) - if(arr.length>0){ //车间存在该批次 - let batch = arr[0].batch; - that.wm_in = arr[0].batch; - that.mlogbInCount = arr[0].count;//该批次数量 - //判断日志中是否存在该批次 - let arr0= that.mlogbIns.filter((item)=>{ - return item.batch == batch; - }) - let arr1 = that.bwItemForms.filter((item)=>{ - return item.number == bwitem.number; - }) - if (arr0.length > 0) { - that.hasMlogbIn = true; - that.form.count_use = 1; - that.mlogbId = arr0[0].id; - bwitem.mlogb = arr0[0].id; - }else{ - if(arr1.length>0){ - that.wm_in = ''; - that.$message.error("已存在"); - }else{ - that.form.batch = arr[0].batch; - that.form.wm_in = arr[0].id; - that.form.count_use += 1; - that.wm_in = ''; - that.batchs = arr[0].id; - } - } - that.bwItemForms.push(bwitem); - // that.bwItemForm = bwitem; + let arr1 = that.bwItemForms.filter((item)=>{ + return item.number == bwitem.number; + }) + if (arr0.length > 0) { + that.hasMlogbIn = true; + that.form.count_use = 1; + that.mlogbId = arr0[0].id; + bwitem.mlogb = arr0[0].id; }else{ - that.wm_in = ''; - that.$message.error("批次号不存在"); + if(arr1.length>0){ + that.wm_in = ''; + that.$message.error("已存在"); + }else{ + that.form.batch = arr[0].batch; + that.form.wm_in = arr[0].id; + that.form.count_use += 1; + that.wm_in = ''; + that.batchs = arr[0].id; + } } + that.bwItemForms.push(bwitem); + // that.bwItemForm = bwitem; + }else{ + that.wm_in = ''; + that.$message.error("批次号不存在"); } - }) - } + } + }) + // if(that.tracking==10||that.tracking==null){//批次 + // arr = that.materialOptions.filter((item) => { + // return item.batch == code; + // }) + // if (arr.length > 0) { + // that.form.batch = arr[0].batch; + // that.form.wm_in = arr[0].id; + // that.form.count_use = arr[0].count; + // that.wm_in = arr[0].batch; + // }else{ + // that.wm_in = ''; + // that.$message.error("批次号不存在"); + // } + // }else{//单件 + // console.log('code',code); + + // } } }, //表单提交方法