diff --git a/src/views/wpm_gx/mlog_detail.vue b/src/views/wpm_gx/mlog_detail.vue index e7187724..e6e8c987 100644 --- a/src/views/wpm_gx/mlog_detail.vue +++ b/src/views/wpm_gx/mlog_detail.vue @@ -158,7 +158,7 @@ ref="saveInForm" > - + - + @@ -328,6 +329,7 @@ ref="saveDialog" :mlog="mlogId" :mgroup="mgroup" + :mgroupName = "mlogItem.mgroup_name" :codeText = "codeText" :materialIn="materialIn" @success="handleSaveSuccess" @@ -496,6 +498,7 @@ export default { mlog: "", material_out__isnull: 0, }, + cells:0, mgroup: "", mlogItem: {}, saveInForm: { @@ -520,6 +523,7 @@ export default { }, defectform:{}, fileList:[], + cellsList:[], qct_defects:[], tableDataWm:[], test_file:'', @@ -560,7 +564,6 @@ export default { that.tableData = res; }) that.getMlogItem(); - }, methods: { open() { @@ -600,6 +603,12 @@ export default { that.defectform[item.defect_name] = 0; }) that.qct_defects=res.qct_defects; + console.log('that.saveInForm.mlogbdefect',that.saveInForm.mlogbdefect); + if(that.saveInForm.mlogbdefect&&that.saveInForm.mlogbdefect.length>0){ + that.saveInForm.mlogbdefect.forEach((item) => { + that.defectform[item.defect_name] = Number(item.count); + }) + } }) } }) @@ -613,6 +622,7 @@ export default { that.saveInForm.count_pn_jgqbl += that.defectform[item.defect_name]; } }) + // that.countCellChanges(); }, //表单注入数据 setData(data) { @@ -660,18 +670,15 @@ export default { obj.count_use = that.saveInForm.count_use; obj.mlogbdefect = mlogbdefect; obj.count_pn_jgqbl = count_pn_jgqbl; - that.$API.wpm.mlogb.updateIn - .req(that.saveInForm.id, obj) - .then((res) => { - that.isSaveing = false; - that.$message.success("操作成功"); - that.saveInDialog = false; - that.$refs.tableIn.refresh(); - that.$refs.tableOut.refresh(); - }) - .catch(() => { - that.isSaveing = false; - }); + that.$API.wpm.mlogb.updateIn.req(that.saveInForm.id, obj).then((res) => { + that.isSaveing = false; + that.$message.success("操作成功"); + that.saveInDialog = false; + that.$refs.tableIn.refresh(); + that.$refs.tableOut.refresh(); + }).catch(() => { + that.isSaveing = false; + }); } }); }, @@ -763,8 +770,6 @@ export default { this.$refs.tableOut.refresh(); }, fileUPSuccess(res) { - let that = this; - console.log('res',res); this.test_file = res.path; }, //编辑成功后的方法调用 diff --git a/src/views/wpm_gx/mlogb_check.vue b/src/views/wpm_gx/mlogb_check.vue index 58f48213..ef420e61 100644 --- a/src/views/wpm_gx/mlogb_check.vue +++ b/src/views/wpm_gx/mlogb_check.vue @@ -58,89 +58,9 @@ /> - - - - - - - - - - - - - - - - - - - - - 层数: - 抽检数: - 不合格数: - - - - - - - - - - - - - - - - - - 不良统计 + + 不良统计(最大不合格数:{{max_defect_rate}},超过0.5则整层不合格) + + + + + + + + + 所在层数 + 本层总数 + 抽检数 + 不合格数 + + + + + + + + + + + + + + + + + @@ -195,15 +179,23 @@ export default { trigger: "blur", }, ], + count_cell:[ + { + required: true, + message: "请填写层抽检数量", + trigger: "blur", + } + ] }, defectform:{}, cells:0, cell_start:1, - count_cell:50, + count_cell:20, options: [], material_out:'', qct_defects:[], - mlogbdefect_h:[], + count_json:[], + max_defect_rate:null, materialOptions: [], visible: false, isSaveing: false, @@ -219,12 +211,16 @@ export default { open(data) { this.visible = true; this.mlogbItem = data; + this.count_json = [] + data.count_json.forEach((item) => { + item.count_notok = 0; + item.count_test = this.count_cell; + this.count_json.push(item); + }) this.form.batch = data.batch; this.form.count_real =this.form.count_ok= data.count_real; this.material_out = data.material_out; this.mgroupName = data.mgroup_name; - this.cells = data.count_real/this.count_cell; - this.cellStartChanges(); this.getdefects(); }, getdefects(){ @@ -234,16 +230,11 @@ export default { res.qct_defects.forEach((item) => { that.defectform[item.defect_name] = 0; }) + that.max_defect_rate =Number(res.max_defect_rate); that.qct_defects=res.qct_defects; }) } }, - notok_add(){ - this.mlogbdefect_h.push({defect:'',count:null,floor:null,count_test:null}); - }, - notok_del(index){ - this.mlogbdefect_h.splice(index, 1) - }, countChange() { console.log('change'); let that = this; @@ -255,21 +246,30 @@ export default { }) that.form.count_ok = that.form.count_real - that.form.count_notok; }, - cellStartChanges(){ - this.mlogbdefect_h = []; - for(let i=0;i{ + console.log('item',item); + if(that.max_defect_rate!==null&&that.count_cell>0){ + let notrate = item.count_notok / that.count_cell; + if(notrate>that.max_defect_rate){ + count_notok += item.count_use; + }else{ + count_notok += item.count_notok; + } + }else{ + count_notok += item.count_notok; + } + }) + that.form.count_notok = count_notok; + that.form.count_ok = that.form.count_real -that.form.count_notok; + that.defectform[that.qct_defects[0].defect_name] = count_notok; }, countCellChanges(){ - this.cells = this.form.count_real/this.count_cell; - this.cellStartChanges(); + this.count_json.forEach(item=>{ + item.count_test = this.count_cell; + }) }, //表单提交方法 submit() { @@ -279,34 +279,28 @@ export default { that.isSaveing = true; that.form.mlog = that.mlog; let sum = 0; - if(that.mgroupName=='黑化'||that.mgroupName=='退火'){ - that.form.count_notok = 0; - that.mlogbdefect_h.forEach(item => { - item.defect = that.qct_defects[0].defect; - that.form.count_notok =item.count; - }); - that.form.count_ok = that.form.count_real -that.form.count_notok; - that.form.mlogbdefect = that.mlogbdefect_h; + that.form.count_notok = 0; + that.qct_defects.forEach(item => { + if(item.defect_okcate==30){ + that.form.count_notok += that.defectform[item.defect_name] ; + } + let obj = {}; + obj.defect = item.defect; + obj.count = that.defectform[item.defect_name]; + obj.mlogb = that.mlogbItem.id; + this.form.mlogbdefect.push(obj); - }else{ - that.form.count_notok = 0; - that.qct_defects.forEach(item => { - if(item.defect_okcate==30){ - that.form.count_notok += that.defectform[item.defect_name] ; - } - let obj = {}; - obj.defect = item.defect; - obj.count = that.defectform[item.defect_name]; - obj.mlogb = that.mlogbItem.id; - this.form.mlogbdefect.push(obj); - - }) - that.form.count_ok = that.form.count_real -that.form.count_notok; - } + }) + that.form.count_ok = that.form.count_real -that.form.count_notok; sum = that.form.count_ok + that.form.count_notok; let obj_form = {}; + obj_form.count_ok = that.form.count_ok; obj_form.count_real = that.form.count_real; + obj_form.count_notok = that.form.count_notok; obj_form.mlogbdefect = that.form.mlogbdefect; + if(that.mgroupName=='黑化'||that.mgroupName=='退火'){ + obj_form.count_json = that.count_json; + } if (sum - that.form.count_real == 0) { that.$API.wpm.mlogb.updateOut.req(that.mlogbItem.id, obj_form).then((res) => { that.isSaveing = false; diff --git a/src/views/wpm_gx/mlogb_form.vue b/src/views/wpm_gx/mlogb_form.vue index b9ee7fe2..1a73589a 100644 --- a/src/views/wpm_gx/mlogb_form.vue +++ b/src/views/wpm_gx/mlogb_form.vue @@ -7,73 +7,158 @@ @closed="$emit('closed')" > - + - - - + + + - - - - - - - - {{ item.batch }}{{ item.count }} - - - - - - - - - - + + + + + + + + + + {{ item.batch }}{{ item.count }} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - 保存 + 保存 取消 @@ -85,6 +170,7 @@ const defaultForm = { mlog: "", mtask: "", batch: "", + count_pn_jgqbl:0, count_use: 0, }; @@ -98,6 +184,10 @@ export default { type: String, default: "", }, + mgroupName:{ + type: String, + default: "", + }, materialIn: { type: String, default: "", @@ -135,9 +225,15 @@ export default { }, ], }, + cells:0,//层数 + count_cell:0,//每层数量 + cell_start:0,//开始层数 codeBatch:"", options: [], + cellsList:[], + qct_defects:[], materialOptions: [], + defectform:{}, visible: false, isSaveing: false, setFiltersVisible: false, @@ -157,6 +253,7 @@ export default { that.getMaterial(); } this.getMtask(); + this.getdefects(); }, methods: { open() { @@ -193,6 +290,58 @@ export default { }); }); }, + getdefects(){ + let that = this; + that.$API.qm.qct.list.req({qctmat__material:that.materialIn,page:0,tags:'process'}).then((res) => { + if(res.length>0){ + that.$API.qm.qct.item.req(res[0].id).then((res) => { + res.qct_defects.forEach((item) => { + that.defectform[item.defect_name] = 0; + }) + that.qct_defects=res.qct_defects; + }) + } + }) + }, + materialBatchChange(){ + let that = this; + that.materialOptions.forEach(item => { + if(item.id==that.form.wm_in){ + that.form.count_use = item.count_cando; + } + }); + }, + cellStartChanges(){ + let that = this; + let remaind = (that.form.count_use-that.form.count_pn_jgqbl)%that.count_cell; + that.cellsList = []; + for(let i=0;i0){ + obj.count_use = remaind; + }else{ + obj.count_use = that.count_cell; + } + that.cellsList.push(obj) + } + }, + countCellChanges(){ + this.cells =Math.ceil((this.form.count_use-this.form.count_pn_jgqbl)/this.count_cell); + this.cellStartChanges(); + }, + countChange() { + let that = this; + that.form.count_pn_jgqbl = 0; + that.qct_defects.forEach(item => { + if(item.defect_okcate==30){ + that.form.count_pn_jgqbl += that.defectform[item.defect_name]; + } + }) + that.countCellChanges(); + }, //表单提交方法 submit() { let that = this; @@ -200,17 +349,26 @@ export default { if (valid) { that.isSaveing = true; that.form.mlog = that.mlog; - that.$API.wpm.mlogb.in - .req(that.form) - .then((res) => { - that.isSaveing = false; - that.$emit("success"); - that.visible = false; - that.$message.success("操作成功"); - }) - .catch((err) => { - that.isSaveing = false; - }); + that.form.count_json = that.cellsList; + let count_pn_jgqbl = 0,mlogbdefect=[]; + that.qct_defects.forEach(item => { + count_pn_jgqbl += that.defectform[item.defect_name] ; + let obj = {}; + obj.defect = item.defect; + obj.count = that.defectform[item.defect_name]; + mlogbdefect.push(obj); + }) + // that.form.count_use = that.count_use; + that.form.mlogbdefect = mlogbdefect; + that.form.count_pn_jgqbl = count_pn_jgqbl; + that.$API.wpm.mlogb.in.req(that.form).then((res) => { + that.isSaveing = false; + that.$emit("success"); + that.visible = false; + that.$message.success("操作成功"); + }).catch((err) => { + that.isSaveing = false; + }); } }); },