fix:玻纤车间物料标签打印

This commit is contained in:
shijing 2025-05-08 15:00:32 +08:00
parent 1e0af7d96c
commit 94182221c2
3 changed files with 53 additions and 47 deletions

View File

@ -86,5 +86,13 @@ export default {
`${config.API_URL}/cm/labeltemplate/${id}/`); `${config.API_URL}/cm/labeltemplate/${id}/`);
} }
}, },
commands:{
name: "获取标签指令",
req: async function(data){
return await http.post(
`${config.API_URL}/cm/labeltemplate/commands/`,
data);
}
}
} }
} }

View File

@ -13,7 +13,7 @@
<scTable ref="table" :apiObj="apiObj" row-key="id" @selection-change="selectionChange" hidePagination> <scTable ref="table" :apiObj="apiObj" row-key="id" @selection-change="selectionChange" hidePagination>
<el-table-column label="#" type="index" width="50"></el-table-column> <el-table-column label="#" type="index" width="50"></el-table-column>
<el-table-column label="模板名称" prop="name" min-width="100"></el-table-column> <el-table-column label="模板名称" prop="name" min-width="100"></el-table-column>
<el-table-column label="创建时间" prop="description" min-width="150"></el-table-column> <el-table-column label="创建时间" prop="create_time" min-width="150"></el-table-column>
<el-table-column label="操作" fixed="right" align="center" width="140"> <el-table-column label="操作" fixed="right" align="center" width="140">
<template #default="scope"> <template #default="scope">
<el-button link size="small" @click="labelTemplateEdit(scope.row)" type="primary">编辑</el-button> <el-button link size="small" @click="labelTemplateEdit(scope.row)" type="primary">编辑</el-button>

View File

@ -303,7 +303,6 @@ export default {
wprList:[], wprList:[],
tableData: [], tableData: [],
selection: [], selection: [],
templateList:[],
stateOptions:[ stateOptions:[
{ value: 10, name: "合格"}, { value: 10, name: "合格"},
{ value: 20, name: "不合格"}, { value: 20, name: "不合格"},
@ -344,15 +343,8 @@ export default {
that.params.belong_dept =that.deptId; that.params.belong_dept =that.deptId;
that.$TOOL.data.set('bx_deptID',that.deptId); that.$TOOL.data.set('bx_deptID',that.deptId);
that.apiObj = that.$API.wpm.wmaterial.list; that.apiObj = that.$API.wpm.wmaterial.list;
that.getPrintTemplate();
}, },
methods: { methods: {
getPrintTemplate(){
let that = this;
that.$API.cm.labeltemplate.list.req({process:that.process,page:0}).then((res) => {
that.templateList = res;
})
},
handleWatch(row) { handleWatch(row) {
let that = this; let that = this;
that.$API.wpm.batchlog.dag.req({batch:row.batch}).then((res) => { that.$API.wpm.batchlog.dag.req({batch:row.batch}).then((res) => {
@ -468,55 +460,61 @@ export default {
// //
printMaterial(row,type){ printMaterial(row,type){
let that = this; let that = this;
let str =[]
if(that.templateList.length==1){
str = that.templateList[0].commands;
}else if(that.templateList.length>1){
}else{
}
if(that.printer_name!==''&&that.printer_name!==null&&that.printer_name!==undefined){ if(that.printer_name!==''&&that.printer_name!==null&&that.printer_name!==undefined){
let params = {};
params.tid = row.id;
if(type=='wm'){ if(type=='wm'){
that.apiObjPrint.req({tid:row.id}).then((res) => { if(that.route_code=='paiyicibang'){
let code = res.code_label; params.label_template_name = '排一次棒打印模板';
let str = [ }else{
"SIZE 70 mm,100 mm", params.extra_data={count:row.count};
"GAP 7 mm,7 mm", params.label_template_name = '其他工序打印模板';
"CLS", }
"REFERENCE 0,0", that.apiObjPrint.req(params).then((res) => {
'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 obj = {}; let obj = {};
obj.printer_commands = str; obj.printer_commands = res.commands;
obj.printer_name = that.printer_name; obj.printer_name = that.printer_name;
that.$API.wpm.prints.req(obj).then((response) => { that.$API.wpm.prints.req(obj).then((response) => {
that.$message.success("打印成功"); that.$message.success("打印成功");
}); });
}) })
}else{ }else if(type=='wpr'){
let code = row.number; let params = {};
let str = [ let name = row.material_name.split('|')[0];
"SIZE 70 mm,100 mm", if(that.route_code=='paiban'){
"GAP 7 mm,7 mm", params.label_template_name = '排扳单件打印模板';
"CLS", let oinfo = [];
"REFERENCE 0,0", for(let key in row.oinfo){
'QRCODE 30,400,H,5,A,0,"' +code +'"', oinfo.push(row.oinfo[key])
"WINTEXT 240,550,28,90,0,0,Simhei," + row.number, }
"PRINT 1", let data = {sigao:'',duibian:'',istest:'否',number:row.number,name:name};
]; if(oinfo.length>0){
let obj = {}; oinfo.forEach((item)=>{
obj.printer_commands = str; if(item.name=="丝高"){
obj.printer_name = that.printer_name; data.sigao = item.val;
that.$API.wpm.prints.req(obj).then((response) => { }else if(item.name=="对边"){
that.$message.success("打印成功"); data.duibian = item.val;
}else{
data.istest = item.val?'是':'否';
}
})
}
params.data = data;
}else{
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{ }else{
that.$message.warning("请先设置打印机");
} }
}, },
inmCheck(row){ inmCheck(row){