diff --git a/src/views/inm/mainso.vue b/src/views/inm/mainso.vue index 4d77e39a..74eba164 100644 --- a/src/views/inm/mainso.vue +++ b/src/views/inm/mainso.vue @@ -182,42 +182,30 @@ export default { if(printer_name!==''&&printer_name!==null&&printer_name!==undefined){ if(that.project_code!=='gz'){ if(type=='mb'){ - that.$API.cm.labelmat.fromMb.req({tid:row.id}).then((res) => { - let code = res.code_label; - let str = [ - "SIZE 40 mm,70 mm", - "GAP 7 mm,7 mm", - "CLS", - "REFERENCE 0,0", - 'QRCODE 30,400,H,5,A,0,"' +code +'"', - "WINTEXT 200,550,28,90,0,0,Simhei," + res.material_name, - "WINTEXT 240,550,28,90,0,0,Simhei,"+"批次号:" + res.batch, - "WINTEXT 280,550,28,90,0,0,Simhei," +"数量:" + row.count, - "PRINT 1", - ]; + 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 = str; + obj.printer_commands = res.commands; obj.printer_name = printer_name; that.$API.wpm.prints.req(obj).then((response) => { that.$message.success("打印成功"); }); }) }else{ - let code = row.number; - let str = [ - "SIZE 70 mm,100 mm", - "GAP 7 mm,7 mm", - "CLS", - "REFERENCE 0,0", - 'QRCODE 30,400,H,5,A,0,"' +code +'"', - "WINTEXT 240,550,28,90,0,0,Simhei," + row.number, - "PRINT 1", - ]; - let obj = {}; - obj.printer_commands = str; - obj.printer_name = printer_name; - that.$API.wpm.prints.req(obj).then((response) => { - that.$message.success("打印成功"); + 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{ diff --git a/src/views/inm/mioitem.vue b/src/views/inm/mioitem.vue index ee619c38..eaf6a07d 100644 --- a/src/views/inm/mioitem.vue +++ b/src/views/inm/mioitem.vue @@ -198,11 +198,12 @@ 物料标签 + @@ -251,7 +252,7 @@ width="120" > @@ -472,6 +473,7 @@ export default { },//打印 showWpr(row){ let that = this; + that.printMaterialName = row.material_name; that.wprList = row.mioitemw; that.wprVisibleDrawer = true; }, @@ -480,42 +482,30 @@ export default { let that = this; if(that.printer_name!==''&&that.printer_name!==null&&that.printer_name!==undefined){ if(type=='mioitem'){ - that.$API.cm.labelmat.fromMioitem.req({tid:row.id}).then((res) => { - let code = res.code_label; - let str = [ - "SIZE 40 mm,70 mm", - "GAP 7 mm,7 mm", - "CLS", - "REFERENCE 0,0", - 'QRCODE 30,400,H,5,A,0,"' +code +'"', - "WINTEXT 200,550,28,90,0,0,Simhei," + res.material_name, - "WINTEXT 240,550,28,90,0,0,Simhei," +"批次号:"+ res.batch, - "WINTEXT 280,550,28,90,0,0,Simhei," +"数量:" + row.count, - "PRINT 1", - ]; + let params = {}; + params.tid = row.id; + params.extra_data={count:row.count}; + params.label_template_name = '库存标签模板'; + that.$API.cm.labelmat.fromMioitem.req(params).then((res) => { let obj = {}; - obj.printer_commands = str; + obj.printer_commands = res.commands; obj.printer_name = that.printer_name; that.$API.wpm.prints.req(obj).then((response) => { that.$message.success("打印成功"); }); }) }else{ - let code = row.number; - let str = [ - "SIZE 70 mm,100 mm", - "GAP 7 mm,7 mm", - "CLS", - "REFERENCE 0,0", - 'QRCODE 30,400,H,5,A,0,"' +code +'"', - "WINTEXT 240,550,28,90,0,0,Simhei," + row.number, - "PRINT 1", - ]; - let obj = {}; - obj.printer_commands = str; - obj.printer_name = that.printer_name; - that.$API.wpm.prints.req(obj).then((response) => { - that.$message.success("打印成功"); + let params = {}; + let name = that.printMaterialName.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 = that.printer_name; + that.$API.wpm.prints.req(obj).then((response) => { + that.$message.success("打印成功"); + }); }); } }else{