fix:原料库添加检验
This commit is contained in:
parent
1332fed2c9
commit
ec2310b821
|
@ -61,9 +61,11 @@
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="更新时间" prop="update_time">
|
<el-table-column label="更新时间" prop="update_time">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column width="90">
|
<el-table-column width="140">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-button @click="printMaterial(scope.row,'mb')" type="text">物料标签</el-button>
|
<el-button type="primary" link v-if="project_code == 'gx'" @click="mbCheck(scope.row)">检验</el-button>
|
||||||
|
<el-button type="success" link v-if="project_code == 'gx'" @click="mbCheckList(scope.row)">检验记录</el-button>
|
||||||
|
<el-button type="text" @click="printMaterial(scope.row,'mb')">物料标签</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</scTable>
|
</scTable>
|
||||||
|
@ -75,6 +77,7 @@
|
||||||
:mtype="wmtype"
|
:mtype="wmtype"
|
||||||
:apiObj="apiObjPrint"
|
:apiObj="apiObjPrint"
|
||||||
></print-dialog>
|
></print-dialog>
|
||||||
|
<!-- 关联产品 -->
|
||||||
<el-drawer v-model="wprVisibleDrawer" :size="'70%'">
|
<el-drawer v-model="wprVisibleDrawer" :size="'70%'">
|
||||||
<template #header>
|
<template #header>
|
||||||
<h4>关联产品</h4>
|
<h4>关联产品</h4>
|
||||||
|
@ -108,6 +111,143 @@
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-drawer>
|
</el-drawer>
|
||||||
|
<!-- 检验记录 -->
|
||||||
|
<el-drawer v-model="checkVisibleDrawer" :size="'70%'">
|
||||||
|
<template #header>
|
||||||
|
<h4>检验记录</h4>
|
||||||
|
</template>
|
||||||
|
<template #default>
|
||||||
|
<scTable ref="wprTable" hidePagination hideDo :data="checkList">
|
||||||
|
<el-table-column type="index" width="50"></el-table-column>
|
||||||
|
<el-table-column label="物料名称" prop="material_name" min-width="100px"></el-table-column>
|
||||||
|
<el-table-column label="批次号" prop="batch"></el-table-column>
|
||||||
|
<el-table-column label="总数" prop="count"></el-table-column>
|
||||||
|
<el-table-column label="合格数" prop="count_ok"></el-table-column>
|
||||||
|
<el-table-column label="不合格数" prop="count_notok"></el-table-column>
|
||||||
|
<el-table-column label="检验员" prop="test_user_name"></el-table-column>
|
||||||
|
<el-table-column label="检验日期" prop="test_date"></el-table-column>
|
||||||
|
<el-table-column label="备注" prop="note"></el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
label="操作"
|
||||||
|
fixed="right"
|
||||||
|
align="center"
|
||||||
|
width="80"
|
||||||
|
>
|
||||||
|
<template #default="scope">
|
||||||
|
<el-link :underline="false" @click="checkDelete(scope.row)" type="danger">删除</el-link>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</scTable>
|
||||||
|
</template>
|
||||||
|
<template #footer>
|
||||||
|
<div style="flex: auto">
|
||||||
|
<el-button type="warning" @click="checkVisibleDrawer=false">关闭</el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-drawer>
|
||||||
|
<!-- 入厂检验 -->
|
||||||
|
<el-dialog
|
||||||
|
title="检验"
|
||||||
|
v-model="visible"
|
||||||
|
:size="1200"
|
||||||
|
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="100px"
|
||||||
|
>
|
||||||
|
<el-row>
|
||||||
|
<el-col :md="12" :sm="24">
|
||||||
|
<el-form-item label="物料名称:">
|
||||||
|
{{ objitem.material_name }}
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :md="12" :sm="24">
|
||||||
|
<el-form-item label="批次号:">
|
||||||
|
{{ objitem.batch }}
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :md="12" :sm="24">
|
||||||
|
<el-form-item label='总数'>
|
||||||
|
<el-input-number
|
||||||
|
v-model="form.count"
|
||||||
|
disabled
|
||||||
|
style="width: 100%"
|
||||||
|
controls-position="right"
|
||||||
|
>
|
||||||
|
</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-col :md="12" :sm="24">
|
||||||
|
<el-form-item label="合格数">
|
||||||
|
<el-input-number
|
||||||
|
v-model="form.count_ok"
|
||||||
|
disabled
|
||||||
|
style="width: 100%"
|
||||||
|
controls-position="right"
|
||||||
|
>
|
||||||
|
</el-input-number>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :md="12" :sm="24">
|
||||||
|
<el-form-item label="检验员" prop="test_user">
|
||||||
|
<el-select
|
||||||
|
v-model="form.test_user"
|
||||||
|
placeholder="检验员"
|
||||||
|
clearable
|
||||||
|
filterable
|
||||||
|
style="width: 100%"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in userList"
|
||||||
|
:key="item.id"
|
||||||
|
:label="item.name"
|
||||||
|
:value="item.id"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col v-for="item in qct_defects" :key="item.id" :md="12" :sm="24">
|
||||||
|
<el-form-item :label="item.defect_name">
|
||||||
|
<el-input-number
|
||||||
|
v-model="form[item.defect_name]"
|
||||||
|
:min="0"
|
||||||
|
style="width: 100%"
|
||||||
|
@change="changeDefect(item)"
|
||||||
|
controls-position="right"
|
||||||
|
>
|
||||||
|
</el-input-number>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :md="12" :sm="24">
|
||||||
|
<el-form-item label="备注">
|
||||||
|
<el-input v-model="form.note"> </el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</el-form>
|
||||||
|
</el-main>
|
||||||
|
<el-footer>
|
||||||
|
<el-button type="primary" :loading="isSaveing" @click="mbCheckSubmit">提交</el-button>
|
||||||
|
<el-button @click="visible = false">取消</el-button>
|
||||||
|
</el-footer>
|
||||||
|
</el-container>
|
||||||
|
</el-dialog>
|
||||||
</el-container>
|
</el-container>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
|
@ -123,10 +263,33 @@ export default {
|
||||||
params: { count__gte: 1, material__type__in: "30" },
|
params: { count__gte: 1, material__type__in: "30" },
|
||||||
selection: [],
|
selection: [],
|
||||||
wprList:[],
|
wprList:[],
|
||||||
|
checkList:[],
|
||||||
|
userList:[],
|
||||||
|
rules: {
|
||||||
|
test_date: [
|
||||||
|
{ required: true, message: "请选择检验日期", trigger: "blur" },
|
||||||
|
],
|
||||||
|
test_user: [
|
||||||
|
{ required: true, message: "请选择检验员", trigger: "blur" },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
form: {
|
||||||
|
mb: "",
|
||||||
|
type: "purin",
|
||||||
|
test_date: "",
|
||||||
|
count: 0,
|
||||||
|
count_ok: 0,
|
||||||
|
count_notok: 0,
|
||||||
|
test_user: "",
|
||||||
|
note: "",
|
||||||
|
},
|
||||||
query: {},
|
query: {},
|
||||||
|
objitem: {},
|
||||||
warehouseOptions: [],
|
warehouseOptions: [],
|
||||||
wmtype:0,
|
wmtype:0,
|
||||||
print_m:false,
|
visible: false,
|
||||||
|
print_m: false,
|
||||||
|
checkVisibleDrawer:false,
|
||||||
wprVisibleDrawer:false,
|
wprVisibleDrawer:false,
|
||||||
materialsVisible:false,
|
materialsVisible:false,
|
||||||
apiObjPrint:this.$API.cm.labelmat.fromMb,
|
apiObjPrint:this.$API.cm.labelmat.fromMb,
|
||||||
|
@ -143,7 +306,9 @@ export default {
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
this.getIQCUser();
|
||||||
this.getWarehouse();
|
this.getWarehouse();
|
||||||
|
this.getQctDetail();
|
||||||
this.project_code = this.$TOOL.data.get("BASE_INFO").base.base_code;
|
this.project_code = this.$TOOL.data.get("BASE_INFO").base.base_code;
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
@ -175,6 +340,105 @@ export default {
|
||||||
that.wprList = res;
|
that.wprList = res;
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
getIQCUser(){
|
||||||
|
let that = this;
|
||||||
|
that.$API.system.user.list.req({ page: 0, belong_dept__name: "IQC" }).then((res) => {
|
||||||
|
that.userList = res;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
//根据物料关联的检测表获取检测项和不合格项
|
||||||
|
getQctDetail(){
|
||||||
|
let that = this;
|
||||||
|
that.qct_defects = [];
|
||||||
|
that.$API.qm.qct.list.req({ page:0 }).then((res) => {
|
||||||
|
if(res.length>0){
|
||||||
|
res.forEach((item) => {
|
||||||
|
if(item.name=='入库检验表'){
|
||||||
|
that.qctId = item.id;
|
||||||
|
that.$API.qm.qct.item.req(that.qctId).then((res0) => {
|
||||||
|
if(res0.qct_defects.length>0){
|
||||||
|
that.qct_defects = res0.qct_defects;
|
||||||
|
res0.qct_defects.forEach((item) => {
|
||||||
|
that.form[item.defect_name] = 0;
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
changeDefect(item){
|
||||||
|
let that = this;
|
||||||
|
let count_notok = 0;
|
||||||
|
that.form.count_notok = 0;
|
||||||
|
that.qct_defects.forEach((item) => {
|
||||||
|
if(that.form[item.defect_name]!==null){
|
||||||
|
count_notok += that.form[item.defect_name];
|
||||||
|
}
|
||||||
|
})
|
||||||
|
that.form.count_notok = count_notok;
|
||||||
|
that.form.count_ok = that.form.count - that.form.count_notok;
|
||||||
|
},
|
||||||
|
//原料库存检验
|
||||||
|
mbCheck(row){
|
||||||
|
let that = this;
|
||||||
|
let date = new Date();
|
||||||
|
let currentDate = that.$TOOL.dateFormat2(date);
|
||||||
|
that.form.test_date = that.currentDate = currentDate;
|
||||||
|
that.visible = true;
|
||||||
|
that.objitem = row;
|
||||||
|
that.form.mb = row.id;
|
||||||
|
that.form.count = that.form.count_ok = row.count;
|
||||||
|
},
|
||||||
|
mbCheckSubmit(){
|
||||||
|
let that = this;
|
||||||
|
that.$refs.dialogForm.validate(async (valid) => {
|
||||||
|
if (valid) {
|
||||||
|
that.isSaveing = true;
|
||||||
|
let objitem = {} ;
|
||||||
|
objitem.mb = that.form.mb;
|
||||||
|
objitem.type = that.form.type;
|
||||||
|
objitem.test_date = that.form.test_date;
|
||||||
|
objitem.test_user = that.form.test_user;
|
||||||
|
objitem.count = that.form.count;
|
||||||
|
objitem.count_ok = that.form.count_ok;
|
||||||
|
objitem.count_notok = that.form.count_notok;
|
||||||
|
objitem.note = that.form.note;
|
||||||
|
objitem.ftestworkdefect = [];
|
||||||
|
that.qct_defects.forEach((item) => {
|
||||||
|
if(that.form[item.defect_name]!==null){
|
||||||
|
objitem.ftestworkdefect.push({defect:item.defect,count:that.form[item.defect_name]});
|
||||||
|
}
|
||||||
|
})
|
||||||
|
that.$API.qm.ftestwork.create.req(objitem).then((res) => {
|
||||||
|
that.isSaveing = false;
|
||||||
|
that.visible = false;
|
||||||
|
that.$message.success("检验成功");
|
||||||
|
}).catch(err => {that.isSaveing = false;});
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
getCheckList(){
|
||||||
|
let that = this;
|
||||||
|
that.$API.qm.ftestwork.list.req({ page:0,mb:that.mbId }).then((res) => {
|
||||||
|
that.checkList = res;
|
||||||
|
})
|
||||||
|
},
|
||||||
|
mbCheckList(row){
|
||||||
|
let that = this;
|
||||||
|
that.checkList = [];
|
||||||
|
that.mbId = row.id;
|
||||||
|
that.getCheckList();
|
||||||
|
that.checkVisibleDrawer = true;
|
||||||
|
},
|
||||||
|
checkDelete(row){
|
||||||
|
let that = this;
|
||||||
|
that.$API.qm.ftestwork.delete.req(row.id).then((res) => {
|
||||||
|
that.getCheckList();
|
||||||
|
})
|
||||||
|
},
|
||||||
//打印物料标签
|
//打印物料标签
|
||||||
printMaterial(row,type){
|
printMaterial(row,type){
|
||||||
let that = this;
|
let that = this;
|
||||||
|
|
Loading…
Reference in New Issue