fix:玻纤打印以及日志输入物料修改
This commit is contained in:
parent
d50342425f
commit
5e88ca8045
|
@ -63,7 +63,7 @@
|
|||
</el-table-column>
|
||||
<el-table-column width="90">
|
||||
<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>
|
||||
</el-table-column>
|
||||
</scTable>
|
||||
|
@ -80,7 +80,7 @@
|
|||
<h4>关联产品</h4>
|
||||
</template>
|
||||
<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 label="产品编号" prop="number" min-width="100px"></el-table-column>
|
||||
<el-table-column label="缺陷项" min-width="200px">
|
||||
|
@ -139,10 +139,12 @@ export default {
|
|||
wprParams:{
|
||||
page:0
|
||||
},
|
||||
project_code:''
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.getWarehouse();
|
||||
this.project_code = this.$TOOL.data.get("BASE_INFO").base.base_code;
|
||||
},
|
||||
methods: {
|
||||
getType(type){
|
||||
|
@ -174,14 +176,60 @@ 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'){
|
||||
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.wmtype = row.material_.type;
|
||||
that.print_m = true;
|
||||
this.$nextTick(() => {
|
||||
this.$refs.printmaterial.open();
|
||||
})
|
||||
}
|
||||
}else{
|
||||
that.$message.console.error("请先设置打印机");
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
|
|
|
@ -199,7 +199,7 @@
|
|||
<el-link
|
||||
type="primary"
|
||||
v-if="mioObj.type == 'do_out'&&project_code=='bxerp'"
|
||||
@click="printMaterial(scope.row,'wm')"
|
||||
@click="printMaterial(scope.row,'mioitem')"
|
||||
>
|
||||
物料标签
|
||||
</el-link>
|
||||
|
@ -479,8 +479,8 @@ export default {
|
|||
printMaterial(row,type){
|
||||
let that = this;
|
||||
if(that.printer_name!==''&&that.printer_name!==null&&that.printer_name!==undefined){
|
||||
if(type=='wm'){
|
||||
that.$API.cm.labelmat.fromWm.req({tid:row.id}).then((res) => {
|
||||
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",
|
||||
|
@ -507,7 +507,6 @@ export default {
|
|||
"CLS",
|
||||
"REFERENCE 0,0",
|
||||
'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,
|
||||
"PRINT 1",
|
||||
];
|
||||
|
|
|
@ -215,6 +215,7 @@ export default {
|
|||
]
|
||||
},
|
||||
wm_in:'',
|
||||
mlogbId:'',
|
||||
route_code:"",
|
||||
mlogbIns:[],
|
||||
options: [],
|
||||
|
@ -392,16 +393,25 @@ export default {
|
|||
let arr0= that.mlogbIns.filter((item)=>{
|
||||
return item.batch == batch;
|
||||
})
|
||||
let arr1 = that.bwItemForms.filter((item)=>{
|
||||
return item.number == bwitem.number;
|
||||
})
|
||||
if (arr0.length > 0) {
|
||||
that.hasMlogbIn = true;
|
||||
that.form.count_use = 1;
|
||||
that.mlogbId = arr0[0].id;
|
||||
bwitem.mlogb = arr0[0].id;
|
||||
}else{
|
||||
that.form.batch = arr[0].batch;
|
||||
that.form.wm_in = arr[0].id;
|
||||
that.form.count_use += 1;
|
||||
that.wm_in = '';
|
||||
that.batchs = arr[0].id;
|
||||
if(arr1.length>0){
|
||||
that.wm_in = '';
|
||||
that.$message.error("已存在");
|
||||
}else{
|
||||
that.form.batch = arr[0].batch;
|
||||
that.form.wm_in = arr[0].id;
|
||||
that.form.count_use += 1;
|
||||
that.wm_in = '';
|
||||
that.batchs = arr[0].id;
|
||||
}
|
||||
}
|
||||
that.bwItemForms.push(bwitem);
|
||||
// that.bwItemForm = bwitem;
|
||||
|
@ -418,28 +428,15 @@ export default {
|
|||
submit() {
|
||||
let that = this;
|
||||
if(that.hasMlogbIn){
|
||||
that.bwItemForms.forEach(item=>{
|
||||
item.mlogb = res.id;
|
||||
that.$API.wpm.mlogbw.create.req(item).then((res1) => {
|
||||
that.wm_in = '';
|
||||
that.form.mtask = '';
|
||||
that.form.batch = '';
|
||||
that.form.parent = '';
|
||||
that.form.count_use = 0;
|
||||
that.$emit("closed");
|
||||
that.visible = false;
|
||||
})
|
||||
that.$API.wpm.mlogbw.create.req(that.bwItemForms).then((res1) => {
|
||||
that.wm_in = '';
|
||||
that.form.mtask = '';
|
||||
that.form.batch = '';
|
||||
that.form.parent = '';
|
||||
that.form.count_use = 0;
|
||||
that.$emit("closed");
|
||||
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{
|
||||
that.form.mlog = that.mlog;
|
||||
that.$API.wpm.mlogb.in.req(that.form).then((res) => {
|
||||
|
@ -450,16 +447,37 @@ export default {
|
|||
that.form.parent = '';
|
||||
that.form.count_use = 0;
|
||||
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=>{
|
||||
item.mlogb = res.id;
|
||||
that.$API.wpm.mlogbw.create.req(item).then((res1) => {
|
||||
that.$emit("closed");
|
||||
})
|
||||
})
|
||||
// that.bwItemForm.mlogb = res.id;
|
||||
// that.$API.wpm.mlogbw.create.req(that.bwItemForm).then((res) => {
|
||||
// that.$emit("closed");
|
||||
// })
|
||||
that.$API.wpm.mlogbw.create.req(that.bwItemForms).then((res1) => {
|
||||
that.$emit("closed");
|
||||
})
|
||||
}else{
|
||||
that.$emit("closed");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue