diff --git a/src/views/wpm_gx/f_mlogs_form.vue b/src/views/wpm_gx/f_mlogs_form.vue
index 16d2043b..09f0c304 100644
--- a/src/views/wpm_gx/f_mlogs_form.vue
+++ b/src/views/wpm_gx/f_mlogs_form.vue
@@ -17,106 +17,11 @@
style="padding: 0 10px"
>
-
-
-
-
- {{item.name}}
- {{item.number}}
-
-
-
-
-
-
-
-
- {{item.handle_user_name}}
- {{item.count}}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -139,6 +44,86 @@
+
+
+
+
+
+
+
+
+
+
+
+ {{item.name}}
+ {{item.number}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -168,7 +153,7 @@
:min="0"
class="width100"
controls-position="right"
- disabled
+ :disabled="true"
/>
@@ -176,8 +161,8 @@
@@ -186,7 +171,7 @@
@@ -203,126 +188,37 @@
-
-
-
-
+
+ 加工前不良
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+ 本工段不良
+
+
+
+
+
+
+
@@ -341,29 +237,20 @@
const defaultForm = {
batch: null,
equipment: null,
- mtaskb: null,
+ // mtaskb: null,
shift: null,
wm_in: null,
fmlog:null,
- work_start_time:'',
- work_end_time:'',
+ // work_start_time:null,
+ // work_end_time:null,
material_out:'',
count_pn_jgqbl:0,
count_use:0,
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,
+ mlogdefect:[],
+ mlogindefect:[],
note:''
};
@@ -406,15 +293,20 @@ export default {
work_end_time:[{required: true,message: "请选择生产开始时间",trigger: "blur",},],
route: [{required: true,message: "请选择工艺路线",trigger: "blur",},]
},
+ qct:'',
+ codeText:'',
mgroupName:'',
materialCount:1,//领料批次现有库存数
material_in:'',
material_out:'',
+ defectinform:{},
+ defectform:{},
shiftOtions:[],
- mtaskbOtions:[],
+ userList:[],
visible: false,
isSaveing: false,
options: [],
+ qct_defects:[],
routeOptions: [],
supplierOptions: [],
materialOptions:[],
@@ -425,10 +317,8 @@ export default {
this.getShift();
this.getMgroup();
this.getMtask();
- this.getMtaskb();
- console.log('this.fmlog',this.fmlog)
this.form.fmlog = this.fmlog;
- console.log('this.form.fmlog',this.form.fmlog)
+ this.form.handle_date = this.$TOOL.dateFormat2(new Date());;
},
methods: {
disabledDateFn(time) {
@@ -447,8 +337,24 @@ export default {
that.mgroupName = res.name;
that.process = res.process;
that.getEquipment();
+ that.getUserList();
});
},
+ getdefects(){
+ let that = this;
+ that.$API.qm.qct.list.req({qctmat__material: that.material_out,page: 0,tags:'process'}).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.defectform[item.defect_name] = 0;
+ that.defectinform[item.defect_name] = 0;
+ })
+ that.qct_defects=res.qct_defects;
+ })
+ }
+ })
+ },
getEquipment() {
let that = this;
that.options = [];
@@ -466,49 +372,74 @@ export default {
that.$API.pm.mtask.item.req(that.mtask).then(res=>{
that.material_in = res.material_in;
that.material_out = that.form.material_out = res.material_out;
- that.getMaterial();
+ that.getdefects();
+
});
},
- getMtaskb() {
+ //获取工段人员
+ getUserList() {
let that = this;
- that.$API.pm.mtaskb.list.req({ page: 0, mtask:that.mtask }).then((res) => {
- that.mtaskbOtions = res;
+ let userInfo = that.$TOOL.data.get("USER_INFO");
+ this.$API.system.user.list.req({ depts: that.deptId, page: 0 }).then((res) => {
+ that.userList = res;
+ let arr = res.filter(item=>{
+ return item.id==userInfo.id;
+ })
+ if(arr.length>0){
+ that.form.handle_user = userInfo.id;
+ }else{
+ let obj = {};
+ obj.id = userInfo.id;
+ obj.name = userInfo.name;
+ that.userList.push(obj)
+ that.form.handle_user = userInfo.id;
+ }
});
},
+ // getMtaskb() {
+ // let that = this;
+ // that.$API.pm.mtaskb.list.req({ page: 0, mtask:that.mtask }).then((res) => {
+ // that.mtaskbOtions = res;
+ // });
+ // },
//获取车间物料
getMaterial() {
let that = this;
that.$API.wpm.wmaterial.list.req({mtaskx:that.mtask,mgroupx: that.mgroup,material: that.material_in,page: 0,}).then((res) => {
that.materialOptions = res;
+ if(that.codeText!==''){
+ that.materialOptions.forEach(item=>{
+ if(item.batch == that.codeText){
+ that.form.wm_in = item.id;
+ that.form.batch = item.batch;
+ that.materialCount = that.form.count_use = that.form.count_ok = item.count_cando;
+ that.form.count_real = item.count-that.form.count_pn_jgqbl;
+ }
+ })
+ }
});
},
changeMaterial(val){
let that = this;
that.materialOptions.forEach(item=>{
if(item.id == val){
- that.form.count_n_hs =
- that.form.count_n_qp =
- that.form.count_n_swen =
- that.form.count_n_bb =
- that.form.count_n_xbb =
- that.form.count_n_md =
- that.form.count_n_xh =
- that.form.count_n_ps =
- that.form.count_n_zq =
- that.form.count_n_qt =
- that.form.count_n_wm=0;
- that.materialCount =
- that.form.count_use =
- that.form.count_real =
- that.form.count_ok = item.count;
+ that.qct_defects.forEach((item) => {
+ that.form[item.defect_name] = 0;
+ })
+ that.materialCount = that.form.count_use =
+ that.form.count_real = that.form.count_ok = item.count;
that.form.count_real = item.count-that.form.count_pn_jgqbl;
}
})
},
//显示
- open(mode = "add") {
+ open(mode = "add",codeText) {
this.mode = mode;
this.visible = true;
+ if(codeText){
+ this.codeText = codeText;
+ }
+ this.getMaterial();
return this;
},
//表单注入数据
@@ -522,23 +453,23 @@ export default {
that.form.count_ok = that.form.count_real - that.form.count_notok;
},
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;
+ let that = this;
+ that.form.count_notok = 0;
+ that.qct_defects.forEach(item => {
+ that.form.count_notok += that.defectform[item.defect_name];
+ })
+ that.form.count_ok = that.form.count_real - that.form.count_notok;
+ },
+ countinChange(){
+ let that = this;
+ that.form.count_pn_jgqbl = 0;
+ that.qct_defects.forEach(item => {
+ that.form.count_pn_jgqbl += that.defectinform[item.defect_name];
+ })
+ that.form.count_real = that.form.count_use - that.form.count_pn_jgqbl;
+ 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;
- // },
//表单提交方法
submit() {
let that = this;
@@ -546,6 +477,20 @@ export default {
if (valid) {
that.isSaveing = true;
that.form.mgroup = that.mgroup;
+ let mlogdefect = [],mlogindefect =[];
+ that.qct_defects.forEach(item => {
+ let objin = {};
+ objin.defect = item.defect;
+ objin.count = that.defectinform[item.defect_name];
+ mlogindefect.push(objin);
+ let obj = {};
+ obj.defect = item.defect;
+ obj.count = that.defectform[item.defect_name];
+ mlogdefect.push(obj)
+ })
+ that.form.qct = that.qct;
+ that.form.mlogdefect = mlogdefect;
+ that.form.mlogindefect = mlogindefect;
if (that.mode === "add") {
that.$API.wpm.mlog.create.req(that.form).then((res) => {
that.isSaveing = false;
@@ -557,8 +502,6 @@ export default {
});
} else {
let obj = {};
- obj.work_end_time = that.form.work_end_time;
- obj.handle_user = that.form.handle_user;
obj.note = that.form.note;
that.$API.wpm.mlog.update.req(that.form.id, that.form).then((res) => {
that.isSaveing = false;