diff --git a/src/views/inm/good.vue b/src/views/inm/good.vue index a006a9a5..e482fcaa 100644 --- a/src/views/inm/good.vue +++ b/src/views/inm/good.vue @@ -72,12 +72,12 @@ - + @@ -273,15 +273,50 @@ export default { }); }) }, - //打印物料标签 - printMaterial(row){ + //打签 + printMaterial(row,type){ let that = this; - that.wmId = row.id; - that.wmtype = row.material_.type; - that.print_m = true; - this.$nextTick(() => { - this.$refs.printmaterial.open(); - }) + let printer_name=localStorage.getItem("printer_name"); + if(printer_name!==''&&printer_name!==null&&printer_name!==undefined){ + if(that.project_code!=='gz'){ + if(type=='mb'){ + let params = {}; + params.tid = row.id; + params.label_template_name = '库存标签模板'; + params.extra_data={count:row.count}; + that.$API.cm.labelmat.fromMb.req(params).then((res) => { + let obj = {}; + obj.printer_commands = res.commands; + obj.printer_name = printer_name; + that.$API.wpm.prints.req(obj).then((response) => { + that.$message.success("打印成功"); + }); + }) + }else{ + let params = {}; + let name = row.material_name.split('|')[0]; + params.label_template_name = '单件打印模板'; + params.data = {number:row.number,name:name}; + that.$API.cm.labeltemplate.commands.req(params).then((res) => { + let obj = {}; + obj.printer_commands = res.commands; + obj.printer_name = printer_name; + that.$API.wpm.prints.req(obj).then((response) => { + that.$message.success("打印成功"); + }); + }); + } + }else{ + that.wmId = row.id; + that.wmtype = row.material_.type; + that.print_m = true; + this.$nextTick(() => { + this.$refs.printmaterial.open(); + }) + } + }else{ + that.$message.error("请先设置打印机"); + } }, }, }; diff --git a/src/views/inm/halfgood.vue b/src/views/inm/halfgood.vue index b37664c2..c11faa94 100644 --- a/src/views/inm/halfgood.vue +++ b/src/views/inm/halfgood.vue @@ -66,15 +66,13 @@ - - + @@ -199,15 +197,50 @@ export default { resetQuery() { this.query = {}; }, - //打印物料标签 - printMaterial(row){ + //打签 + printMaterial(row,type){ let that = this; - that.wmId = row.id; - that.wmtype = row.material_.type; - that.print_m = true; - this.$nextTick(() => { - this.$refs.printmaterial.open(); - }) + let printer_name=localStorage.getItem("printer_name"); + if(printer_name!==''&&printer_name!==null&&printer_name!==undefined){ + if(that.project_code!=='gz'){ + if(type=='mb'){ + let params = {}; + params.tid = row.id; + params.label_template_name = '库存标签模板'; + params.extra_data={count:row.count}; + that.$API.cm.labelmat.fromMb.req(params).then((res) => { + let obj = {}; + obj.printer_commands = res.commands; + obj.printer_name = printer_name; + that.$API.wpm.prints.req(obj).then((response) => { + that.$message.success("打印成功"); + }); + }) + }else{ + let params = {}; + let name = row.material_name.split('|')[0]; + params.label_template_name = '单件打印模板'; + params.data = {number:row.number,name:name}; + that.$API.cm.labeltemplate.commands.req(params).then((res) => { + let obj = {}; + obj.printer_commands = res.commands; + obj.printer_name = printer_name; + that.$API.wpm.prints.req(obj).then((response) => { + that.$message.success("打印成功"); + }); + }); + } + }else{ + that.wmId = row.id; + that.wmtype = row.material_.type; + that.print_m = true; + this.$nextTick(() => { + this.$refs.printmaterial.open(); + }) + } + }else{ + that.$message.error("请先设置打印机"); + } }, }, };