fix:抽检

This commit is contained in:
shijing 2024-08-13 15:42:24 +08:00
parent 404b2b71cb
commit 1666728e9e
5 changed files with 462 additions and 16 deletions

View File

@ -1516,7 +1516,7 @@ const routes = [
name: "income", name: "income",
path: "/qm/income", path: "/qm/income",
meta: { meta: {
title: "入检验", title: "入检验",
// icon: "el-icon-cellphone", // icon: "el-icon-cellphone",
perms: ["itest"], perms: ["itest"],
}, },
@ -1536,7 +1536,17 @@ const routes = [
name: "qmProcess", name: "qmProcess",
path: "/qm/qmProcess", path: "/qm/qmProcess",
meta: { meta: {
title: "过程检验", title: "过程自检",
// icon: "el-icon-cellphone",
perms: ["ptest"],
},
component: "qm/process",
},
{
name: "qmProcess",
path: "/qm/qmProcess",
meta: {
title: "过程抽检",
// icon: "el-icon-cellphone", // icon: "el-icon-cellphone",
perms: ["ptest"], perms: ["ptest"],
}, },

View File

@ -32,14 +32,20 @@
:params="params" :params="params"
:query="params" :query="params"
> >
<el-table-column type="index" width="50" /> <!-- <el-table-column type="index" width="50" /> -->
<el-table-column label="检验日期" prop="test_date"></el-table-column> <el-table-column label="检验类型" width="80">
<el-table-column label="批次号" prop="batch"> </el-table-column> <template #default="scope">
<el-table-column label="物料名" prop="material_name" show-overflow-tooltip> </el-table-column> <el-tag v-if="scope.row.type2 == 20" type="success">全检</el-tag>
<el-table-column label="总数" prop="count"> </el-table-column> <el-tag v-else-if="scope.row.type2 == 10" type="primary">抽检</el-tag>
<el-table-column label="抽检数" prop="count_sampling"> </el-table-column> </template>
<el-table-column label="合格数" prop="count_ok"> </el-table-column> </el-table-column>
<el-table-column label="不合格数" prop="count_notok"> </el-table-column> <el-table-column label="检验日期" prop="test_date" width="100"></el-table-column>
<el-table-column label="批次号" prop="batch" min-width="120"> </el-table-column>
<el-table-column label="物料名" prop="material_name" show-overflow-tooltip min-width="120"> </el-table-column>
<el-table-column label="检验数" prop="count" min-width="80"> </el-table-column>
<el-table-column label="合格数" prop="count_ok" min-width="80"> </el-table-column>
<el-table-column label="不合格数" prop="count_notok" width="100"> </el-table-column>
<el-table-column label="提交时间" prop="submit_time" width="150"></el-table-column>
<el-table-column label="操作" fixed="right" width="145"> <el-table-column label="操作" fixed="right" width="145">
<template #default="scope"> <template #default="scope">
<el-link type="primary" v-if="scope.row.submit_user==null" @click="table_submit(scope.row)">提交</el-link> <el-link type="primary" v-if="scope.row.submit_user==null" @click="table_submit(scope.row)">提交</el-link>

View File

@ -0,0 +1,406 @@
<template>
<el-dialog
:title="modeTitle"
v-model="visible"
:size="1000"
destroy-on-close
@closed="$emit('closed')"
>
<el-container v-loading="loading">
<el-main style="padding: 0 20px 20px 20px">
<el-form
ref="dialogForm"
:model="form"
:rules="rules"
label-width="120px"
>
<el-row>
<el-col :md="12" :sm="24">
<el-form-item label="物料批次" prop="batch">
<el-select
v-model="form.batch"
placeholder="物料批次"
clearable
style="width: 100%"
@change="handleChange"
>
<el-option
v-for="item in options"
:key="item.id"
:label="item.batch"
:value="item.id"
>
<span>{{item.batch}}</span>
<span style="float:right">({{item.count}})</span>
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="总数">
<el-input
v-model="batchCount"
disabled
></el-input>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="检验数量">
<el-input-number
controls-position="right"
v-model="form.count"
style="width: 100%"
precision="0"
@change="handleCheckChange"
></el-input-number>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="抽检数量">
<el-input-number
controls-position="right"
v-model="form.count_sampling"
style="width: 100%"
precision="0"
@change="handleCheckChange"
></el-input-number>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="合格数量">
<el-input
v-model="form.count_ok"
disabled
></el-input>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="不合格数量">
<el-input-number
controls-position="right"
v-model="form.count_notok"
style="width: 100%"
precision="0"
@change="handleCountNotokChange"
></el-input-number>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="检验日期" prop="test_date">
<el-date-picker
v-model="form.test_date"
type="date"
value-format="YYYY-MM-DD"
style="width: 100%"
/>
</el-form-item>
</el-col>
</el-row>
<el-divider style="margin-top:0"></el-divider>
<el-row>
<el-col :md="12" :sm="24">
<el-form-item label="厚度">
<el-input-number
controls-position="right"
v-model="count_notok_json.count_n_hd"
style="width: 100%"
precision="0"
@change="handleCountChange"
></el-input-number>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="产品外径">
<el-input-number
controls-position="right"
v-model="count_notok_json.count_n_wj"
style="width: 100%"
precision="0"
@change="handleCountChange"
></el-input-number>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="产品圆度">
<el-input-number
controls-position="right"
v-model="count_notok_json.count_n_yd"
style="width: 100%"
precision="0"
@change="handleCountChange"
></el-input-number>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="产品同心度">
<el-input-number
controls-position="right"
v-model="count_notok_json.count_n_txd"
style="width: 100%"
precision="0"
@change="handleCountChange"
></el-input-number>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="气泡">
<el-input-number
controls-position="right"
v-model="count_notok_json.count_n_qp"
style="width: 100%"
precision="0"
@change="handleCountChange"
></el-input-number>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="水纹">
<el-input-number
controls-position="right"
v-model="count_notok_json.count_n_swen"
style="width: 100%"
precision="0"
@change="handleCountChange"
></el-input-number>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="崩边">
<el-input-number
controls-position="right"
v-model="count_notok_json.count_n_bb"
style="width: 100%"
precision="0"
@change="handleCountChange"
></el-input-number>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="划伤">
<el-input-number
controls-position="right"
v-model="count_notok_json.count_n_hs"
style="width: 100%"
precision="0"
@change="handleCountChange"
></el-input-number>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="麻点">
<el-input-number
controls-position="right"
v-model="count_notok_json.count_n_md"
style="width: 100%"
precision="0"
@change="handleCountChange"
></el-input-number>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="破损">
<el-input-number
controls-position="right"
v-model="count_notok_json.count_n_ps"
style="width: 100%"
precision="0"
@change="handleCountChange"
></el-input-number>
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-main>
<el-footer>
<el-button type="primary" :loading="isSaveing" @click="submit"
>保存</el-button>
<el-button @click="visible = false">取消</el-button>
</el-footer>
</el-container>
</el-dialog>
</template>
<script>
export default {
emits: ["success", "closed"],
props: {
mgroup: {
type: String,
default: "",
},
itemObj:{
type: Object,
default: null,
}
},
data() {
return {
mode:'',
modeTitle: '',
loading: false,
form: {
type2:10,
test_date: "",
batch: "",
count: null,
count_ok: null,
count_notok: 0,
count_notok_json:{}
},
count_notok_json:{
//
count_n_wj: 0,
count_n_yd: 0,
count_n_txd: 0,
count_n_hd: 0,
//
count_n_qp: 0,
count_n_swen: 0,
count_n_hs: 0,
count_n_md: 0,
count_n_bb:0,
count_n_ps: 0,
count_n_qt:0,
},
rules: {
test_date: [
{
required: true,
message: "请选择检验日期",
trigger: "blur",
},
],
batch: [
{
required: true,
message: "请选择物料批次",
trigger: "blur",
},
],
},
batchCount:null,
formCount:null,
visible: false,
isSaveing: false,
options: [],
selectionFilters: [],
setFiltersVisible: false,
};
},
mounted() {
this.batchCount = this.itemObj.count;
this.form.batch = this.itemObj.batch;
this.form.wm = this.itemObj.id;
this.form.count = this.itemObj.count;
},
methods: {
//
open(mode = "抽检") {
this.mode = mode;
this.modeTitle = mode+'抽检';
this.visible = true;
return this;
},
handleCheckChange(){
this.form.count_ok = this.form.count-this.form.count_notok;
},
handleCountChange(type){
this.form.count_notok =
this.count_notok_json.count_n_wj+
this.count_notok_json.count_n_yd+
this.count_notok_json.count_n_txd+
this.count_notok_json.count_n_hd+
this.count_notok_json.count_n_qp+
this.count_notok_json.count_n_swen+
this.count_notok_json.count_n_hs+
this.count_notok_json.count_n_bb+
this.count_notok_json.count_n_md+
this.count_notok_json.count_n_ps;
this.form.count_ok = this.form.count - this.form.count_notok;
},
handleCountNotokChange(){
this.form.count_ok = this.form.count - this.form.count_notok;
},
//
getMaterialBatch() {
let that = this;
let obj = {page: 0, count__gte: 0, count_xtest__gte: 0};
//
obj.mgroupx = that.mgroup;
that.$API.wpm.wmaterial.list
.req(obj)
.then((res) => {
that.options = res;
});
},
//
submit() {
let that = this;
this.$refs.dialogForm.validate(async (valid) => {
if (valid) {
that.isSaveing = true;
let count_notok =
this.count_notok_json.count_n_wj+
this.count_notok_json.count_n_yd+
this.count_notok_json.count_n_txd+
this.count_notok_json.count_n_hd+
this.count_notok_json.count_n_qp+
this.count_notok_json.count_n_swen+
this.count_notok_json.count_n_hs+
this.count_notok_json.count_n_bb+
this.count_notok_json.count_n_md+
this.count_notok_json.count_n_ps;
if(count_notok>this.form.count_notok){
this.$notify.error("不合格数量有问题");
that.isSaveing = false;
}else{
if(count_notok<this.form.count_notok){
that.count_notok_json.count_n_qt = this.form.count_notok-count_notok;
}
that.form.count_ok = this.form.count-this.form.count_notok;
that.form.count_notok_json = that.count_notok_json;
that.$API.qm.ftestwork.create.req(that.form)
.then((res) => {
that.$API.qm.ftestwork.submit.req(res.id)
.then((res) => {
that.isSaveing = false;
that.visible = false;
that.$emit("success");
that.$message.success("操作成功");
})
}).catch( err=>{
//
that.isSaveing = false;
})
}
}
});
},
//
setData(data) {
Object.assign(this.form, data);
this.formCount = this.form.count;
// this.form.test_group = this.form.split(",");
},
//
setFilters(filters) {
this.selectionFilters = filters;
this.setFiltersVisible = true;
},
},
};
</script>
<style></style>

View File

@ -59,9 +59,13 @@
min-width="120" min-width="120"
></el-table-column> ></el-table-column>
<el-table-column <el-table-column
label="所属部门" label="部门/工段"
prop="belong_dept_name" prop="belong_dept_name"
></el-table-column> >
<template #default="scope">
{{scope.row.belong_dept_name}}/{{scope.row.mgroup_name}}
</template>
</el-table-column>
<el-table-column <el-table-column
label="数量" label="数量"
prop="count" prop="count"
@ -99,8 +103,9 @@
@click="table_Check(scope.row)" @click="table_Check(scope.row)"
v-auth="'mgroup.update'" v-auth="'mgroup.update'"
type="primary" type="primary"
>抽检</el-button v-if="scope.row.notok_sign_name == null"
> >抽检
</el-button>
</template> </template>
</el-table-column> </el-table-column>
</scTable> </scTable>
@ -113,10 +118,20 @@
@choseChange="choseChange" @choseChange="choseChange"
></materials> ></materials>
</el-dialog> </el-dialog>
<check-dialog
v-if="dialog.save"
ref="saveDialog"
:mgroup="mgroupId"
:itemObj = "checkItem"
@success="handleSaveSuccess"
@closed="dialog.save = false"
>
</check-dialog>
</el-container> </el-container>
</template> </template>
<script> <script>
import materials from "./../mtm/materials.vue"; import materials from "./../mtm/materials.vue";
import checkDialog from "./check_form.vue";
export default { export default {
props: { props: {
mgroupName: { mgroupName: {
@ -126,6 +141,7 @@ export default {
}, },
components: { components: {
materials, materials,
checkDialog
}, },
name: "wmaterial", name: "wmaterial",
data() { data() {
@ -184,6 +200,14 @@ export default {
tomio() { tomio() {
this.$router.push({ name: "halfgood_mio" }); this.$router.push({ name: "halfgood_mio" });
}, },
table_Check(row){
this.checkItem = row;
let mode = this.mgroupName;
this.dialog.save = true;
this.$nextTick(() => {
this.$refs.saveDialog.open(mode);
});
},
// //
selectionChange(selection) { selectionChange(selection) {
this.selection = selection; this.selection = selection;
@ -194,7 +218,7 @@ export default {
}, },
// //
handleSaveSuccess(data, mode) { handleSaveSuccess(data, mode) {
this.dialog.save = true; this.dialog.save = false;
this.$refs.table.refresh(); this.$refs.table.refresh();
}, },
}, },

View File

@ -209,7 +209,7 @@ const defaultForm = {
note: "", note: "",
route: "", route: "",
equipment: "", equipment: "",
handle_user: "", handle_user: null,
work_start_time: "", work_start_time: "",
reminder_interval_list: [], reminder_interval_list: [],
}; };