fix:光芯黑化、退火日志中层数存储;不合格判定

This commit is contained in:
shijing 2025-03-19 09:51:07 +08:00
parent 85eb644e43
commit a25e70c0a0
3 changed files with 369 additions and 212 deletions

View File

@ -158,7 +158,7 @@
ref="saveInForm"
>
<el-row>
<el-col :span="23">
<el-col :md="12" :sm="24">
<el-form-item label="领取数量" prop="count_use">
<el-input-number
v-model="saveInForm.count_use"
@ -168,11 +168,12 @@
/>
</el-form-item>
</el-col>
<el-col :span="23">
<el-col :md="12" :sm="24">
<el-form-item label="加工前不良" prop="count_pn_jgqbl">
<el-input-number
v-model="saveInForm.count_pn_jgqbl"
:min="0"
:disabled="true"
style="width: 100%"
controls-position="right"
/>
@ -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;
},
//

View File

@ -58,89 +58,9 @@
/>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24" v-if="mgroupName=='黑化'||mgroupName=='退火'">
<el-form-item label="每层数量">
<el-input-number
v-model="count_cell"
:min="0"
class="width-100"
@change="countCellChanges"
controls-position="right"
/>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24" v-if="mgroupName=='黑化'||mgroupName=='退火'">
<el-form-item label="开始层数">
<el-input-number
v-model="cell_start"
:min="0"
class="width-100"
@change="cellStartChanges"
controls-position="right"
/>
</el-form-item>
</el-col>
</el-row>
<el-divider></el-divider>
<el-row v-if="mgroupName=='黑化'||mgroupName=='退火'">
<el-col :span="24">
<el-form-item label="不合格统计">
<el-button
type="primary"
icon="el-icon-plus"
@click="notok_add"
></el-button>
</el-form-item>
</el-col>
</el-row>
<template v-if="mgroupName=='黑化'||mgroupName=='退火'">
<el-row>
<el-col :span="7">层数:</el-col>
<el-col :span="7">抽检数:</el-col>
<el-col :span="7">不合格数:</el-col>
</el-row>
<el-row style="margin-bottom:10px" v-for="(item, $index) in mlogbdefect_h" :key="item">
<el-col :span="7">
<el-input-number
style="width:90%"
v-model="item.floor"
:min="0"
class="width-100"
placeholder="层数"
controls-position="right"
/>
</el-col>
<el-col :span="7">
<el-input-number
style="width:90%"
v-model="item.count_test"
:min="0"
class="width-100"
placeholder="抽检数"
controls-position="right"
/>
</el-col>
<el-col :span="7">
<el-input-number
style="width:90%"
v-model="item.count"
:min="0"
class="width-100"
placeholder="不合格数"
controls-position="right"
/>
</el-col>
<el-col :span="2">
<el-button
type="danger"
icon="el-icon-delete"
@click="notok_del( $index)"
></el-button>
</el-col>
</el-row>
</template>
<el-row v-if="mgroupName!=='黑化'&&mgroupName!=='退火'&&qct_defects.length>0">
<el-col>不良统计</el-col>
<el-row v-if="qct_defects.length>0">
<el-col>不良统计最大不合格数<span style="color:red">{{max_defect_rate}}</span>,超过0.5则整层不合格</el-col>
<el-col :md="12" :sm="24" v-for="item in qct_defects" :key="item.id">
<el-form-item :label="item.defect_name">
<el-input-number
@ -152,7 +72,71 @@
/>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24" v-if="mgroupName=='黑化'||mgroupName=='退火'">
<el-form-item label="层抽检数" required>
<el-input-number
v-model="count_cell"
:min="0"
class="width-100"
@change="countCellChanges"
controls-position="right"
/>
</el-form-item>
</el-col>
</el-row>
<el-divider></el-divider>
<template v-if="mgroupName=='黑化'||mgroupName=='退火'">
<el-row>
<el-col :span="6">所在层数</el-col>
<el-col :span="6">本层总数</el-col>
<el-col :span="6">抽检数</el-col>
<el-col :span="6">不合格数</el-col>
</el-row>
<el-row style="margin-bottom:10px" v-for="item in count_json" :key="item">
<el-col :span="6">
<el-input-number
style="width:90%"
v-model="item.floor"
:disabled="true"
class="width-100"
placeholder="层数"
controls-position="right"
/>
</el-col>
<el-col :span="6">
<el-input-number
style="width:90%"
v-model="item.count_use"
:disabled="true"
class="width-100"
placeholder="本层总数"
controls-position="right"
/>
</el-col>
<el-col :span="6">
<el-input-number
style="width:90%"
v-model="item.count_test"
:disabled="true"
class="width-100"
placeholder="抽检数"
controls-position="right"
/>
</el-col>
<el-col :span="6">
<el-input-number
style="width:90%"
v-model="item.count_notok"
:min="0"
class="width-100"
placeholder="不合格数"
controls-position="right"
@change="notokChanges"
/>
</el-col>
</el-row>
</template>
</el-form>
</el-main>
<el-footer>
@ -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<this.cells;i++){
let obj = {};
obj.floor=this.cell_start+i;
obj.count_test = this.count_cell;
obj.count = 0;
obj.defect="";
this.mlogbdefect_h.push(obj)
}
console.log(this.mlogbdefect_h)
notokChanges(){
let that = this;
let count_notok = 0;
that.count_json.forEach(item=>{
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;

View File

@ -7,73 +7,158 @@
@closed="$emit('closed')"
>
<el-container v-loading="loading">
<el-main style="padding: 0 20px 20px 20px">
<el-main style="padding: 0 0 20px 0">
<el-form
ref="dialogForm"
:model="form"
:rules="rules"
label-position="right"
label-width="80px"
style="padding: 0 10px"
label-width="100px"
>
<el-form-item label="关联任务">
<el-select
v-model="form.mtask"
placeholder="关联任务"
clearable
style="width: 100%"
@change="getMaterial"
>
<el-option
v-for="item in options"
:key="item.id"
:label="item.number"
:value="item.id"
<el-row>
<el-col :md="12" :sm="24">
<el-form-item label="关联任务">
<el-select
v-model="form.mtask"
placeholder="关联任务"
clearable
style="width: 100%"
@change="getMaterial"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item label="批次号" prop="wm_in">
<el-select
v-model="form.wm_in"
placeholder="物料"
clearable
style="width: 100%"
>
<el-option
v-for="item in materialOptions"
:key="item.id"
:label="item.batch"
:value="item.id"
>
<div
style="
display: flex;
justify-content: space-between;
"
<el-option
v-for="item in options"
:key="item.id"
:label="item.number"
:value="item.id"
>
<span>{{ item.batch }}</span
><span>{{ item.count }}</span>
</div>
</el-option>
</el-select>
</el-form-item>
<el-form-item label="领用数量">
<el-input-number
v-model="form.count_use"
:min="0"
controls-position="right"
/>
</el-form-item>
<el-form-item label="备注">
<el-input v-model="form.note"/>
</el-form-item>
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="批次号" prop="wm_in">
<el-select
v-model="form.wm_in"
placeholder="物料"
clearable
class="width-100"
@change="materialBatchChange"
>
<el-option
v-for="item in materialOptions"
:key="item.id"
:label="item.batch"
:value="item.id"
>
<div
style="
display: flex;
justify-content: space-between;
"
>
<span>{{ item.batch }}</span
><span>{{ item.count }}</span>
</div>
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="领用数量">
<el-input-number
v-model="form.count_use"
:min="0"
class="width-100"
controls-position="right"
/>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24" v-if="mgroupName=='黑化'||mgroupName=='退火'">
<el-form-item label="每层数量">
<el-input-number
v-model="count_cell"
:min="0"
class="width-100"
@change="countCellChanges"
controls-position="right"
/>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24" v-if="mgroupName=='黑化'||mgroupName=='退火'">
<el-form-item label="开始层数">
<el-input-number
v-model="cell_start"
:min="0"
class="width-100"
@change="cellStartChanges"
controls-position="right"
/>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="加工前不良" prop="count_pn_jgqbl">
<el-input-number
v-model="form.count_pn_jgqbl"
:min="0"
:disabled="true"
style="width: 100%"
controls-position="right"
/>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="备注">
<el-input v-model="form.note"/>
</el-form-item>
</el-col>
<el-divider v-if="(mgroupName=='黑化'||mgroupName=='退火')&&cellsList.length>0"></el-divider>
<template v-if="mgroupName=='黑化'||mgroupName=='退火'">
<el-row v-for="(item) in cellsList" :key="item">
<el-col :md="12" :sm="24">
<el-form-item label="所在层数">
<el-input-number
style="width:90%"
v-model="item.floor"
:min="0"
class="width-100"
placeholder="层数"
controls-position="right"
/>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="本层数量">
<el-input-number
style="width:90%"
v-model="item.count_use"
:min="0"
class="width-100"
placeholder="本层数量"
controls-position="right"
/>
</el-form-item>
</el-col>
</el-row>
<el-divider v-if="qct_defects.length>0"></el-divider>
<el-row>
<el-col :md="12" :sm="24" v-for="item in qct_defects" :key="item.id">
<el-form-item :label="item.defect_name">
<el-input-number
v-model="defectform[item.defect_name]"
:min="0"
style="width: 100%"
controls-position="right"
@change="countChange"
/>
</el-form-item>
</el-col>
</el-row>
</template>
</el-row>
</el-form>
</el-main>
<el-footer>
<el-button type="primary" :loading="isSaveing" @click="submit"
>保存</el-button
>
<el-button type="primary" :loading="isSaveing" @click="submit">保存</el-button>
<el-button @click="visible = false">取消</el-button>
</el-footer>
</el-container>
@ -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;i<that.cells;i++){
console.log('i',i)
console.log((that.cells-i)==1)
let obj = {};
obj.floor=that.cell_start+i;
if((that.cells-i)==1&&remaind>0){
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;
});
}
});
},