diff --git a/src/views/wpm_gx/check_form.vue b/src/views/wpm_gx/check_form.vue
index 652006df..2c2117c1 100644
--- a/src/views/wpm_gx/check_form.vue
+++ b/src/views/wpm_gx/check_form.vue
@@ -135,388 +135,17 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ />
@@ -577,36 +206,22 @@ export default {
count_sampling_ok:0,
count_sampling:0,
count_notok: 0,
- count_notok_json:{}
+ ftestworkdefect:[]
},
count_ok_rate:100,
- 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_xbb:0,
- count_n_ps: 0,
- count_n_qt:0,
- },
rules: {
test_date: [{required: true,message: "请选择检验日期",trigger: "blur"}],
batch: [{required: true,message: "请选择物料批次",trigger: "blur"}],
test_user: [{required: true,message: "请选择物料批次",trigger: "blur"}],
},
+ qct_defects:[],
options: [],
userList : [],
typeOption:[
{name:'全检',value:20},
{name:'抽检',value:10},
],
+ qct:null,
initForm: {},
selectionFilters: [],
batchCount:null,
@@ -618,11 +233,10 @@ export default {
};
},
mounted() {
- console.log('mgroupName',this.mgroupName);
this.batchCount = this.itemObj.count_cando;
this.form.batch = this.itemObj.batch;
this.form.wm = this.itemObj.id;
- this.form.count = this.itemObj.count_cando;
+ this.form.count_sampling = this.form.count_sampling_ok = this.form.count = this.itemObj.count_cando;
this.form.supplier = this.itemObj.supplier;
this.deptID = this.$TOOL.data.get('gx_deptID');
this.getUsers();
@@ -630,10 +244,11 @@ export default {
},
methods: {
//显示
- open(mode = "抽检") {
+ open(mode = "") {
this.mode = mode;
this.modeTitle = mode+'抽检';
this.visible = true;
+ this.getdefects();
return this;
},
getUsers(){
@@ -652,6 +267,20 @@ export default {
});
});
},
+ getdefects(){
+ let that = this;
+ that.$API.qm.qct.list.req({page: 0, qctmat__material: that.itemObj.material,tags:'inm'}).then((res) => {
+ if(res.length>0){
+ that.qct = res[0].id;
+ that.$API.qm.qct.item.req(res[0].id).then((res) => {
+ res.qct_defects.forEach((item) => {
+ that.form[item.defect_name] = 0;
+ })
+ that.qct_defects=res.qct_defects;
+ })
+ }
+ })
+ },
//渲染工单提交按钮
getInit() {
let that = this;
@@ -661,19 +290,10 @@ export default {
});
},
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_xbb+
- this.count_notok_json.count_n_md+
- this.count_notok_json.count_n_ps+
- this.count_notok_json.count_n_qt;
+ this.form.count_notok = 0;
+ this.qct_defects.forEach(item => {
+ this.form.count_notok += this.form[item.defect_name]
+ })
this.handleCountNotokChange();
},
handleCountNotokChange(){
@@ -699,21 +319,6 @@ export default {
submitTicketCreate(id) {
this.transition = id;
this.submit();
- // let that = this;
- // let ticket = {};
- // that.isSaveing = true;
- // ticket.title = '白片抛抽检审批单';
- // ticket.workflow = that.initForm.workflow;
- // ticket.ticket_data = {t_id: that.mlogItem.id};
- // ticket.transition = id;
- // that.$API.wf.ticket.create.req(ticket).then((res) => {
- // that.isSaveing = false;
- // that.ticketDialog = false;
- // that.visible = false;
- // that.$message.success("提交成功");
- // }).catch((e) => {
- // that.isSaveing = false;
- // });
},
//提交
submit() {
@@ -721,67 +326,52 @@ export default {
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_xbb+
- this.count_notok_json.count_n_md+
- this.count_notok_json.count_n_ps+
- this.count_notok_json.count_n_qt;
- if(count_notok>that.form.count_notok){
- that.$notify.error("不合格数量有问题");
- that.isSaveing = false;
- }else{
- if(count_notok {
- if(that.mgroupName=='白片抛'){
- let ticket = {};
- that.isSaveing = true;
- ticket.title = '白片抛抽检审批单';
- ticket.workflow = that.initForm.workflow;
- ticket.ticket_data = {t_id: res.id};
- ticket.transition = that.transition;
- that.$API.wf.ticket.create.req(ticket).then((res) => {
- that.isSaveing = false;
- that.ticketDialog = false;
- that.visible = false;
- that.$message.success("提交成功");
- }).catch((e) => {
- that.isSaveing = false;
- });
- }else{
- 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;
- })
+ let count_notok = 0;
+ that.qct_defects.forEach(item => {
+ let obj = {};
+ obj.defect = item.defect;
+ obj.count = that.form[item.defect_name];
+ that.form.ftestworkdefect.push(obj);
+ count_notok += that.form[item.defect_name];
+ })
+ that.form.count_notok = count_notok;
+ if(that.supplier!== null&&that.form.type2==10){
+ that.form.need_update_wm = false;
}
-
+ if(that.form.type2==10){//抽检
+ that.form.count_sampling_ok = that.form.count_sampling - that.form.count_notok;
+ }else{//全检
+ that.form.count_ok = that.form.count - that.form.count_notok;
+ }
+ that.form.qct = that.qct;
+ that.$API.qm.ftestwork.create.req(that.form).then((res) => {
+ if(that.mgroupName=='白片抛'){
+ let ticket = {};
+ that.isSaveing = true;
+ ticket.title = '白片抛抽检审批单';
+ ticket.workflow = that.initForm.workflow;
+ ticket.ticket_data = {t_id: res.id};
+ ticket.transition = that.transition;
+ that.$API.wf.ticket.create.req(ticket).then((res) => {
+ that.isSaveing = false;
+ that.ticketDialog = false;
+ that.visible = false;
+ that.$message.success("提交成功");
+ }).catch((e) => {
+ that.isSaveing = false;
+ });
+ }else{
+ 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;
+ })
}
});
},
diff --git a/src/views/wpm_gx/mlogb_check.vue b/src/views/wpm_gx/mlogb_check.vue
index 04fdc151..58f48213 100644
--- a/src/views/wpm_gx/mlogb_check.vue
+++ b/src/views/wpm_gx/mlogb_check.vue
@@ -32,7 +32,7 @@
:min="0"
class="width-100"
controls-position="right"
- @change="countChanges"
+ @change="countChange"
/>
@@ -41,6 +41,7 @@
@@ -52,7 +53,29 @@
v-model="form.count_notok"
:min="0"
class="width-100"
- @change="countChanges"
+ :disabled="true"
+ controls-position="right"
+ />
+
+
+
+
+
+
+
+
+
+
@@ -71,7 +94,12 @@
-
+
+ 层数:
+ 抽检数:
+ 不合格数:
+
+
@@ -111,121 +139,12 @@
-
-
-
+
+ 不良统计
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -294,37 +169,16 @@ export default {
data() {
return {
loading: false,
+ mlogbItem:{},
//表单数据
form: {
batch: null,
count_real: 0,
count_ok: 0,
count_notok: 0,
- count_n_hs: 0,
- count_n_qp: 0,
- count_n_swen: 0,
- count_n_bb: 0,
- count_n_xbb:0,
- count_n_md: 0,
- count_n_xh: 0,
- count_n_ps: 0,
- count_n_qt: 0,
- count_n_wm: 0,
- count_n_zq:0
+ mlogbdefect:[],
+ mlogbindefect:[],
},
- notokOptions:[
- {name:"划伤",value:'count_n_hs'},
- {name:"气泡",value:'count_n_qp'},
- {name:"水纹",value:'count_n_swen'},
- {name:"崩边",value:'count_n_bb'},
- {name:"小崩边",value:'count_n_xbb'},
- {name:"麻点",value:'count_n_md'},
- {name:"划伤",value:'count_n_xh'},
- {name:"破损",value:'count_n_ps'},
- {name:"其他",value:'count_n_qt'},
- {name:"雾面",value:'count_n_wm'},
- {name:"棕圈",value:'count_n_zq'},
- ],
//验证规则
rules: {
batch: [
@@ -342,8 +196,14 @@ export default {
},
],
},
+ defectform:{},
+ cells:0,
+ cell_start:1,
+ count_cell:50,
options: [],
- count_notok_json:[],
+ material_out:'',
+ qct_defects:[],
+ mlogbdefect_h:[],
materialOptions: [],
visible: false,
isSaveing: false,
@@ -358,33 +218,58 @@ export default {
methods: {
open(data) {
this.visible = true;
- Object.assign(this.form, data);
+ this.mlogbItem = data;
+ 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;
- console.log(this.form);
+ this.cells = data.count_real/this.count_cell;
+ this.cellStartChanges();
+ this.getdefects();
+ },
+ getdefects(){
+ let that = this;
+ if(that.mlogbItem.qct!==null){
+ that.$API.qm.qct.item.req(that.mlogbItem.qct).then((res) => {
+ res.qct_defects.forEach((item) => {
+ that.defectform[item.defect_name] = 0;
+ })
+ that.qct_defects=res.qct_defects;
+ })
+ }
},
notok_add(){
- this.count_notok_json.push({notok:'qt',count:null,floor:null,count_sampling:null});
+ this.mlogbdefect_h.push({defect:'',count:null,floor:null,count_test:null});
},
notok_del(index){
- this.count_notok_json.splice(index, 1)
+ this.mlogbdefect_h.splice(index, 1)
},
countChange() {
- this.form.count_notok =
- this.form.count_n_hs +
- this.form.count_n_qp +
- this.form.count_n_swen +
- this.form.count_n_bb +
- this.form.count_n_xbb +
- this.form.count_n_md +
- this.form.count_n_xh +
- this.form.count_n_ps +
- this.form.count_n_zq +
- this.form.count_n_qt +
- this.form.count_n_wm;
- this.form.count_ok = this.form.count_real - this.form.count_notok;
+ console.log('change');
+ let that = this;
+ that.form.count_notok = 0;
+ that.qct_defects.forEach(item => {
+ if(item.defect_okcate==30){
+ that.form.count_notok += that.defectform[item.defect_name];
+ }
+ })
+ that.form.count_ok = that.form.count_real - that.form.count_notok;
},
- countChanges(){
- this.form.count_ok = this.form.count_real - this.form.count_notok;
+ cellStartChanges(){
+ this.mlogbdefect_h = [];
+ for(let i=0;i {
- total+=item.count;
+ that.form.count_notok = 0;
+ that.mlogbdefect_h.forEach(item => {
+ item.defect = that.qct_defects[0].defect;
+ that.form.count_notok =item.count;
});
- this.form.count_notok = total;
- this.form.count_notok_json = this.count_notok_json;
+ that.form.count_ok = that.form.count_real -that.form.count_notok;
+ that.form.mlogbdefect = that.mlogbdefect_h;
+
}else{
- this.form.count_notok =
- this.form.count_n_hs +
- this.form.count_n_qp +
- this.form.count_n_swen +
- this.form.count_n_bb +
- this.form.count_n_xbb +
- this.form.count_n_md +
- this.form.count_n_xh +
- this.form.count_n_ps +
- this.form.count_n_zq +
- this.form.count_n_qt +
- this.form.count_n_wm;
+ 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;
}
- sum = this.form.count_ok + this.form.count_notok;
- if (sum - this.form.count_real == 0) {
- that.$API.wpm.mlogb.updateOut
- .req(that.form.id, that.form)
- .then((res) => {
- that.isSaveing = false;
- that.$emit("success");
- that.visible = false;
- that.$message.success("操作成功");
- })
- .catch((err) => {
- that.isSaveing = false;
- });
+ sum = that.form.count_ok + that.form.count_notok;
+ let obj_form = {};
+ obj_form.count_real = that.form.count_real;
+ obj_form.mlogbdefect = that.form.mlogbdefect;
+ if (sum - that.form.count_real == 0) {
+ that.$API.wpm.mlogb.updateOut.req(that.mlogbItem.id, obj_form).then((res) => {
+ that.isSaveing = false;
+ that.$emit("success");
+ that.visible = false;
+ that.$message.success("操作成功");
+ })
+ .catch((err) => {
+ that.isSaveing = false;
+ });
} else {
- this.$message.error("使用数量与合格数不合格数数量不对等");
+ that.isSaveing = false;
+ that.$message.error("使用数量与合格数不合格数数量不对等");
}
}
});