fix:玻纤打印以及日志输入物料修改

This commit is contained in:
shijing 2025-04-27 16:28:58 +08:00
parent d50342425f
commit 5e88ca8045
3 changed files with 111 additions and 46 deletions

View File

@ -63,7 +63,7 @@
</el-table-column> </el-table-column>
<el-table-column width="90"> <el-table-column width="90">
<template #default="scope"> <template #default="scope">
<el-button @click="printMaterial(scope.row)" type="text">物料标签</el-button> <el-button @click="printMaterial(scope.row,'mb')" type="text">物料标签</el-button>
</template> </template>
</el-table-column> </el-table-column>
</scTable> </scTable>
@ -80,7 +80,7 @@
<h4>关联产品</h4> <h4>关联产品</h4>
</template> </template>
<template #default> <template #default>
<scTable ref="wprTable" hidePagination :data="wprList"> <scTable ref="wprTable" hidePagination hideDo :data="wprList">
<el-table-column type="index" width="50"></el-table-column> <el-table-column type="index" width="50"></el-table-column>
<el-table-column label="产品编号" prop="number" min-width="100px"></el-table-column> <el-table-column label="产品编号" prop="number" min-width="100px"></el-table-column>
<el-table-column label="缺陷项" min-width="200px"> <el-table-column label="缺陷项" min-width="200px">
@ -139,10 +139,12 @@ export default {
wprParams:{ wprParams:{
page:0 page:0
}, },
project_code:''
}; };
}, },
mounted() { mounted() {
this.getWarehouse(); this.getWarehouse();
this.project_code = this.$TOOL.data.get("BASE_INFO").base.base_code;
}, },
methods: { methods: {
getType(type){ getType(type){
@ -174,14 +176,60 @@ export default {
}) })
}, },
// //
printMaterial(row){ printMaterial(row,type){
let that = this; let that = this;
let printer_name=localStorage.getItem("printer_name");
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,
"PRINT 1",
];
let obj = {};
obj.printer_commands = str;
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("打印成功");
});
}
}else{
that.wmId = row.id; that.wmId = row.id;
that.wmtype = row.material_.type; that.wmtype = row.material_.type;
that.print_m = true; that.print_m = true;
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.printmaterial.open(); this.$refs.printmaterial.open();
}) })
}
}else{
that.$message.console.error("请先设置打印机");
}
}, },
}, },
}; };

View File

@ -199,7 +199,7 @@
<el-link <el-link
type="primary" type="primary"
v-if="mioObj.type == 'do_out'&&project_code=='bxerp'" v-if="mioObj.type == 'do_out'&&project_code=='bxerp'"
@click="printMaterial(scope.row,'wm')" @click="printMaterial(scope.row,'mioitem')"
> >
物料标签 物料标签
</el-link> </el-link>
@ -479,8 +479,8 @@ export default {
printMaterial(row,type){ printMaterial(row,type){
let that = this; let that = this;
if(that.printer_name!==''&&that.printer_name!==null&&that.printer_name!==undefined){ if(that.printer_name!==''&&that.printer_name!==null&&that.printer_name!==undefined){
if(type=='wm'){ if(type=='mioitem'){
that.$API.cm.labelmat.fromWm.req({tid:row.id}).then((res) => { that.$API.cm.labelmat.fromMioitem.req({tid:row.id}).then((res) => {
let code = res.code_label; let code = res.code_label;
let str = [ let str = [
"SIZE 40 mm,70 mm", "SIZE 40 mm,70 mm",
@ -507,7 +507,6 @@ export default {
"CLS", "CLS",
"REFERENCE 0,0", "REFERENCE 0,0",
'QRCODE 30,400,H,5,A,0,"' +code +'"', 'QRCODE 30,400,H,5,A,0,"' +code +'"',
"WINTEXT 200,550,28,90,0,0,Simhei," + row.material_name,
"WINTEXT 240,550,28,90,0,0,Simhei," + row.number, "WINTEXT 240,550,28,90,0,0,Simhei," + row.number,
"PRINT 1", "PRINT 1",
]; ];

View File

@ -215,6 +215,7 @@ export default {
] ]
}, },
wm_in:'', wm_in:'',
mlogbId:'',
route_code:"", route_code:"",
mlogbIns:[], mlogbIns:[],
options: [], options: [],
@ -392,10 +393,18 @@ export default {
let arr0= that.mlogbIns.filter((item)=>{ let arr0= that.mlogbIns.filter((item)=>{
return item.batch == batch; return item.batch == batch;
}) })
let arr1 = that.bwItemForms.filter((item)=>{
return item.number == bwitem.number;
})
if (arr0.length > 0) { if (arr0.length > 0) {
that.hasMlogbIn = true; that.hasMlogbIn = true;
that.form.count_use = 1; that.form.count_use = 1;
that.mlogbId = arr0[0].id;
bwitem.mlogb = arr0[0].id; bwitem.mlogb = arr0[0].id;
}else{
if(arr1.length>0){
that.wm_in = '';
that.$message.error("已存在");
}else{ }else{
that.form.batch = arr[0].batch; that.form.batch = arr[0].batch;
that.form.wm_in = arr[0].id; that.form.wm_in = arr[0].id;
@ -403,6 +412,7 @@ export default {
that.wm_in = ''; that.wm_in = '';
that.batchs = arr[0].id; that.batchs = arr[0].id;
} }
}
that.bwItemForms.push(bwitem); that.bwItemForms.push(bwitem);
// that.bwItemForm = bwitem; // that.bwItemForm = bwitem;
}else{ }else{
@ -418,9 +428,7 @@ export default {
submit() { submit() {
let that = this; let that = this;
if(that.hasMlogbIn){ if(that.hasMlogbIn){
that.bwItemForms.forEach(item=>{ that.$API.wpm.mlogbw.create.req(that.bwItemForms).then((res1) => {
item.mlogb = res.id;
that.$API.wpm.mlogbw.create.req(item).then((res1) => {
that.wm_in = ''; that.wm_in = '';
that.form.mtask = ''; that.form.mtask = '';
that.form.batch = ''; that.form.batch = '';
@ -429,17 +437,6 @@ export default {
that.$emit("closed"); that.$emit("closed");
that.visible = false; that.visible = false;
}) })
})
// that.$API.wpm.mlogbw.create.req(that.bwItemForm).then((res) => {
// that.$message.success("");
// that.wm_in = '';
// that.form.mtask = '';
// that.form.batch = '';
// that.form.parent = '';
// that.form.count_use = 0;
// that.$emit("closed");
// that.visible = false;
// })
}else{ }else{
that.form.mlog = that.mlog; that.form.mlog = that.mlog;
that.$API.wpm.mlogb.in.req(that.form).then((res) => { that.$API.wpm.mlogb.in.req(that.form).then((res) => {
@ -450,16 +447,37 @@ export default {
that.form.parent = ''; that.form.parent = '';
that.form.count_use = 0; that.form.count_use = 0;
if(that.scanKyes!=='mat'&&that.bwItemForms.length>1){ if(that.scanKyes!=='mat'&&that.bwItemForms.length>1){
//2
// async function callApis() {
// for (const item of that.bwItemForms) {
// item.mlogb = res.id;
// try {
// await that.$API.wpm.mlogbw.create.req(item).then((res) => {});
// } catch (error) {
// console.error('Error calling API:', error);
// }
// }
// }
// callApis();
//1
// const promises = that.bwItemForms.map(item => {
// item.mlogb = res.id;
// return that.$API.wpm.mlogbw.create.req(item).then((res) => {});
// });
// console.log('promises.length',promises.length);
// Promise.all(promises).then(results => {
// console.log('results',results);
// that.$emit("closed");
// }).catch(error => {
// console.error(error);
// });
//0
that.bwItemForms.forEach(item=>{ that.bwItemForms.forEach(item=>{
item.mlogb = res.id; item.mlogb = res.id;
that.$API.wpm.mlogbw.create.req(item).then((res1) => { })
that.$API.wpm.mlogbw.create.req(that.bwItemForms).then((res1) => {
that.$emit("closed"); that.$emit("closed");
}) })
})
// that.bwItemForm.mlogb = res.id;
// that.$API.wpm.mlogbw.create.req(that.bwItemForm).then((res) => {
// that.$emit("closed");
// })
}else{ }else{
that.$emit("closed"); that.$emit("closed");
} }