fix:6车间车间库存添加中间检验

This commit is contained in:
shijing 2025-02-14 15:52:36 +08:00
parent d41ebfed13
commit 5b169b9545
1 changed files with 337 additions and 0 deletions

View File

@ -0,0 +1,337 @@
<template>
<el-dialog
title="中检"
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="100px"
>
<el-row>
<el-col :md="12" :sm="24">
<el-form-item label="物料批次">
<el-input v-model="wm_batch" disabled></el-input>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="交接数">
<el-input
v-model="form.count"
disabled
></el-input>
</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="合格率(%)">
<el-input-number
controls-position="right"
v-model="count_rate"
style="width: 100%"
:precision="0"
></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="检验人" 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-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_w"
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_d"
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_b"
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_l"
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_h"
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_q"
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_zz"
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_jz"
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"],
data() {
return {
mode:'',
loading: false,
form: {
type:'process',
type2:20,
test_date: "",
count: 0,
count_ok: 0,
count_notok: 0,
count_notok_json:{}
},
count_rate:100,
count_notok_json:{
count_n_w: 0,
count_n_qp: 0,
count_n_d: 0,
count_n_b: 0,
count_n_swen: 0,
count_n_l: 0,
count_n_h: 0,
count_n_q:0,
count_n_zz:0,
count_n_jz: 0
},
rules: {
test_date: [{required: true,message: "请选择检验日期",trigger: "blur"}],
batch: [{required: true,message: "请选择物料批次",trigger: "blur"}],
test_user: [{required: true,message: "请选择物料批次",trigger: "blur"}],
},
userList : [],
selectionFilters: [],
batchCount:null,
formCount:null,
visible: false,
supplier:null,
isSaveing: false,
};
},
mounted() {
this.getUsers();
},
methods: {
//
open() {
this.visible = true;
return this;
},
//
setData(data) {
this.form.wm = data.id;
this.form.count_notok = 0;
this.count_rate = 100;
this.wm_batch = data.batch;
this.form.count = this.form.count_ok = data.count;
},
getUsers(){
let that = this;
that.$API.system.user.list.req({ page: 0, posts__code__contains: "check" }).then((res) => {
that.userList = res ;
});
},
handleCountChange(){
this.form.count_notok =
this.count_notok_json.count_n_w+
this.count_notok_json.count_n_qp+
this.count_notok_json.count_n_d+
this.count_notok_json.count_n_b+
this.count_notok_json.count_n_swen+
this.count_notok_json.count_n_l+
this.count_notok_json.count_n_h+
this.count_notok_json.count_n_q+
this.count_notok_json.count_n_zz+
this.count_notok_json.count_n_jz;
this.handleCountNotokChange();
},
handleCountNotokChange(){
this.form.count_ok = this.form.count - this.form.count_notok;
this.count_rate = ((this.form.count_ok/this.form.count)*100).toFixed(2);
},
//
submit() {
let that = this;
this.$refs.dialogForm.validate(async (valid) => {
if (valid) {
that.isSaveing = true;
let count_notok =
that.count_notok_json.count_n_w+
that.count_notok_json.count_n_qp+
that.count_notok_json.count_n_d+
that.count_notok_json.count_n_b+
that.count_notok_json.count_n_swen+
that.count_notok_json.count_n_l+
that.count_notok_json.count_n_h+
that.count_notok_json.count_n_q+
that.count_notok_json.count_n_zz+
that.count_notok_json.count_n_jz;
if(count_notok>that.form.count_notok){
that.$notify.error("不合格数量有问题");
that.isSaveing = false;
}else{
that.form.count_ok = that.form.count - that.form.count_notok;
that.form.count_notok_json = that.count_notok_json;
console.log('that.form',that.form)
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;
})
}
}
});
},
},
};
</script>
<style></style>