diff --git a/src/views/wpm_gx/f_mlogs_form.vue b/src/views/wpm_gx/f_mlogs_form.vue index db84b377..a12a11fa 100644 --- a/src/views/wpm_gx/f_mlogs_form.vue +++ b/src/views/wpm_gx/f_mlogs_form.vue @@ -354,6 +354,7 @@ export default { }, qct:'', codeText:'', + codeBatch:'', mgroupName:'', materialCount:1,//领料批次现有库存数 material_in:'', @@ -481,7 +482,7 @@ export default { that.materialOptions = res; if(that.codeText!==''){ res.forEach(item=>{ - if(item.batch == that.codeText){ + if(item.batch == that.codeBatch){ that.form.wm_in = item.id; that.form.batch = item.batch; that.materialCount = that.form.count_use = that.form.count_ok = item.count_cando; @@ -506,12 +507,21 @@ export default { }, //显示 open(mode = "add",codeText) { - this.mode = mode; - this.visible = true; - if(codeText){ - this.codeText = codeText; + let that = this; + that.mode = mode; + that.visible = true; + if(codeText!==''){ + that.codeText = codeText; + let id = codeText.split('#')[1]; + that.$API.cm.labelmat.item.req(id).then((res) => { + that.codeBatch = res.batch; + that.getMaterial(); + }).catch((err) => { + that.getMaterial(); + }) + }else{ + that.getMaterial(); } - this.getMaterial(); return this; }, //表单注入数据 diff --git a/src/views/wpm_gx/fmlog_detail.vue b/src/views/wpm_gx/fmlog_detail.vue index 7b0058bd..0847c493 100644 --- a/src/views/wpm_gx/fmlog_detail.vue +++ b/src/views/wpm_gx/fmlog_detail.vue @@ -173,8 +173,8 @@ { + this.codeTextChange(codeText); + }) + + } this.visible = true; }, @@ -290,8 +304,6 @@ export default { let that = this; that.$API.wpm.fmlog.item.req(that.fmlogId).then((res) => { that.fmlogItem = res; - that.mgroup = res.mgroup; - that.mtask = res.mtask; that.paramsWm.mgroup = res.mgroup; that.$API.wpm.mlog.list.req(that.params).then((res) => { that.tableData = res; @@ -301,9 +313,6 @@ export default { }) that.paramsWm.search = that.batchContains; that.apiObjWm = that.$API.wpm.wmaterial.list; - if(that.codeText!=""){ - this.codeTextChange(that.codeText); - } }else{} }); }); @@ -316,21 +325,19 @@ export default { table_add() { this.dialog.save = true; this.$nextTick(() => { - this.$refs.saveDialog.open('add'); + this.$refs.saveDialogs.open('add'); }); }, codeTextChange(codeText){ - let that = this; - that.codeText = codeText; - that.dialog.save = true; - that.$nextTick(() => { - that.$refs.saveDialog.open('add',codeText); + this.dialog.save = true; + this.$nextTick(() => { + this.$refs.saveDialogs.open('add',codeText); }); }, table_edit(row){ this.dialog.save = true; this.$nextTick(() => { - this.$refs.saveDialog.open('edit').setData(row); + this.$refs.saveDialogs.open('edit').setData(row); }); }, //表单提交方法 diff --git a/src/views/wpm_gx/fmlogs.vue b/src/views/wpm_gx/fmlogs.vue index 379bdc89..d504aac3 100644 --- a/src/views/wpm_gx/fmlogs.vue +++ b/src/views/wpm_gx/fmlogs.vue @@ -148,6 +148,8 @@ { @@ -271,30 +274,23 @@ export default { codeTextChange(codeText){ let that = this; that.codeText = codeText; - //根据扫描内容获取物料 - let obj = {}; - obj.page=0; - obj.tag = 'todo'; - obj.mgroup=that.mgroupId; - obj.batch=that.codeText; - that.$API.wpm.wmaterial.list.req(obj).then(res=>{ - //根据物料获取任务 + let id = codeText.split('#')[1]; + that.$API.cm.labelmat.item.req(id).then((res) => { let params = {} params.page = 0; params.state = 20; params.mgroup = that.mgroupId; - params.route__material_in = res[0].material; + params.route__material_in = res.material; that.$API.pm.mtask.list.req(params).then(res1=>{ if(res1.length==1){//只有一个任务,直接打开日志详情 that.mtaskId =res1[0].id; that.changeMtask(); - // that.table_detail(res2[0]); }else{//多个任务时,弹出任务选择框 that.mtaskoptions = res1; that.dialog.mtask = true; } }) - }) + }).catch((err) => {}) }, changeMtask(){ let that = this;