diff --git a/src/views/wpm_gx/handover_form.vue b/src/views/wpm_gx/handover_form.vue index a2cb92c3..ea4b1eb6 100644 --- a/src/views/wpm_gx/handover_form.vue +++ b/src/views/wpm_gx/handover_form.vue @@ -13,117 +13,14 @@ :rules="rules" label-width="80px" > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 手动添加 + + {{ totalCount }} + @@ -188,7 +85,88 @@ -
总计:{{ totalCount }}
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
@@ -214,12 +192,27 @@ export default { type: String, default: "", }, + processtype:{ + type:String, + default:"" + + }, + process:{ + type:String, + default:"" + + }, + changebatch:{ + type:Boolean, + default:false + } }, components: { scanDialog }, data() { return { + change_batch:false, selectItems:[], yseorno: ["是", "否"], loading: false, @@ -288,14 +281,11 @@ export default { }, ], }, - listParams:{ - - }, + listParams:{}, totalCount: 0, deptID:'', userList: [], userList2: [], - deptOptions:[], mgroupOptions: [], materialOptions: [], addShow: false, @@ -307,6 +297,7 @@ export default { }, mounted() { let that = this; + that.change_batch = that.changebatch; that.form.type = that.type; let materialObj = that.$TOOL.data.get("MATERIAL_OBJECT"); that.materialObj = materialObj; @@ -314,39 +305,35 @@ export default { let year = date.getFullYear(); let month = date.getMonth() + 1; let day = date.getDate(); - that.form.handle_date = year + "-" + month + "-" + day; + month = month>9?month:'0'+month; + day = day>9?day:'0'+day; + that.form.handle_date = that.form.send_date = year + "-" + month + "-" + day; that.form.send_mgroup = that.mgroupId; - if(that.mgroupName=="size"||that.mgroupName=="facade"){//检验部交接 - that.$API.system.user.list - .req({ page: 0, posts__code__contains: "check" }) - .then((res) => { - that.userList = res; - }); - }else if(that.type==20&&that.mgroupName=='废品库'){//废品交接 + //type 10:正常交接 ;20:返工交接 ;40:报废交接 + //mtype 10:正常交接 ;20:分批操作 ;30:合批操作 + //获取交接人员 + if(that.type==20&&that.mgroupName=='废品库'){//废品出库交接 that.getCkUserList(); }else{ that.deptID = that.$TOOL.data.get('gx_deptID'); that.getUserList(); } + //获取交接物料 if((that.type==20&&that.mgroupName!=='废品库')||that.type==40){ + //返工交接和报废交接 that.getMaterialNotok(); }else if(that.type==20&&that.mgroupName=='废品库'){ + //废品出库 that.getMaterialFP(); }else{ + //其他 that.getMaterial(); } - that.getDeptOptions(); - that.getMgroupOptions(); + if(that.type==40||that.type==20){ + that.getMgroupOptions(); + }else{} }, methods: { - //获取部门列表 - getDeptOptions() { - this.$API.system.dept.list - .req({ page: 0, type: "dept" }) - .then((res) => { - this.deptOptions = res; - }); - }, //获取工段列表 getMgroupOptions() { let that = this; @@ -367,37 +354,40 @@ export default { let that = this; var req = { page: 0, - notok_sign__isnull : 1, - count_xtest__isnull:1 + state:10, + tag:'done' }; that.materialOptions = []; - if(that.mgroupName=="size"){ - that.$API.system.dept.list.req({name__contains:'尺寸',page:0}).then((res) => { - if(res.length>0){ - req.belong_dept=res[0].id; - that.listParams = req; - this.$API.wpm.wmaterial.list.req(req).then((res) => { - that.materialOptions = res; - }); + req.mgroup = that.mgroupId; + that.listParams = req; + this.$API.wpm.wmaterial.list.req(req).then((res) => { + that.materialOptions = res; + res.forEach(item=>{ + if(that.codeText!==''&&item.batch === that.codeText){ + let obj = {}; + obj.wm = item.id; + obj.batch = item.batch; + obj.count = item.count_cando; + obj.count_cando = item.count_cando; + that.totalCount = item.count_cando; + that.form.handoverb.push(obj) + that.getResaveMgroups(item.material); } }) - }else if(that.mgroupName=="facade"){ - that.$API.system.dept.list.req({name__contains:'外观',page:0}).then((res) => { - if(res.length>0){ - req.belong_dept=res[0].id; - that.listParams = req; - this.$API.wpm.wmaterial.list.req(req).then((res) => { - that.materialOptions = res; - }); - } - }) - }else{ - req.mgroupx = that.mgroupId; - that.listParams = req; - this.$API.wpm.wmaterial.list.req(req).then((res) => { - that.materialOptions = res; - }); - } + }); + }, + getResaveMgroups(material){ + let that = this; + let params = { + material: material, + type: that.type, + }; + that.$API.wpm.handover.mgroups.req(params).then((res) => { + that.mgroupOptions = res; + if(res.length==1){ + that.form.recive_mgroup = res[0].id; + } + }) }, //获取车间不合格物料 getMaterialNotok() { @@ -406,8 +396,7 @@ export default { var req = { mgroupx: that.mgroupId, page: 0, - notok_sign__isnull : 0, - count_xtest__isnull:1 + state:20 }; that.listParams = req; this.$API.wpm.wmaterial.list.req(req).then((res) => { @@ -430,8 +419,22 @@ export default { //获取交送工段人员 getUserList() { let that = this; + 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.send_user = userInfo.id; + }else{ + let obj = {}; + obj.id = userInfo.id; + obj.name = userInfo.name; + that.userList.push(obj) + that.form.send_user = userInfo.id; + } + }); }, //获取仓库人员 @@ -478,8 +481,24 @@ export default { this.countChange(); }, //显示 - open(mode = "add") { + open(mode = "add",data,mtype) { this.mode = mode; + this.mtype = mtype; + if(typeof(data)=='string'){ + if(data!==''){ + this.codeText = data.replace(" ",""); + } + }else{ + this.form.handoverb = data; + } + // if(mtype==10){//正常交接 + // console.log('data',data) + + // }else if(mtype==20){//分批 + // this.codeText = data.replace(" ",""); + // }else if(mtype==30||this.type==20||this.type==40){//合批 + // this.form.handoverb = data; + // } this.visible = true; return this; }, @@ -496,6 +515,7 @@ export default { }) that.totalCount = totalCount; that.form.handoverb = data; + that.getResaveMgroups(data[0].material); }, countChange(){ let that = this; @@ -513,8 +533,13 @@ export default { that.$refs.dialogForm.validate(async (valid) => { if (valid) { if (that.mode == "add") { + if(that.mtype==30){ + that.form.mtype =30; + that.form.recive_user = that.form.send_user; + that.form.recive_mgroup = that.form.send_mgroup; + } that.$API.wpm.handover.create.req(that.form).then((res) => { - if(that.type==40){ + if(that.type==40||that.mtype==20||that.mtype==30){ //提交 that.$API.wpm.handover.submit.req(res.id).then((res1) => { that.isSaveing = false; @@ -592,6 +617,7 @@ export default { obj.count = item.count; that.form.handoverb.push(obj) that.$refs.scanDialog.closed(); + that.getResaveMgroups(item.material); } }) } diff --git a/src/views/wpm_gx/handover_form2.vue b/src/views/wpm_gx/handover_form2.vue new file mode 100644 index 00000000..31f4e4e9 --- /dev/null +++ b/src/views/wpm_gx/handover_form2.vue @@ -0,0 +1,299 @@ + + +