feat:抽取物料标签打印并改动库存里的物料标签打印

This commit is contained in:
shijing 2024-10-25 17:16:37 +08:00
parent 13ce3ccc83
commit f3f59c7888
5 changed files with 221 additions and 87 deletions

View File

@ -132,11 +132,22 @@
</el-main>
</el-container>
</el-main>
<print-dialog
v-if="print_m"
ref="printmaterial"
:mId="wmId"
:mtype="wmtype"
:apiObj="apiObjPrint"
></print-dialog>
</el-container>
</template>
<script>
import printDialog from "./../template/printmaterial.vue";
export default {
name: "halfgood",
components: {
printDialog
},
data() {
return {
apiObj: this.$API.inm.warehouse.batch,
@ -148,7 +159,11 @@ export default {
paramsWm: { count__gte: 1, material__type: 10 },
// processOptions: [],
queryWm: {},
printer_name:localStorage.getItem("printer_name")
wmtype:0,
print_m:false,
materialsVisible:false,
apiObjPrint:this.$API.cm.labelmat.fromMb,
wmId:'',
};
},
mounted() {
@ -178,26 +193,11 @@ export default {
//
printMaterial(row){
let that = this;
let code = "";
that.$API.cm.labelmat.fromMb.req({tid:row.id}).then((res) => {
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,
];
if(res.notok_sign!==null){
str.push("WINTEXT 280,550,28,90,0,0,Simhei," +res.notok_sign_name,)
}
str.push("PRINT 1",)
let obj = {};
obj.printer_commands = str;
obj.printer_name = that.printer_name;
this.$API.wpm.prints.req(obj).then((response) => {});
that.wmId = row.id;
that.wmtype = row.material_.type;
that.print_m = true;
this.$nextTick(() => {
this.$refs.printmaterial.open();
})
},
},

View File

@ -141,11 +141,22 @@
</el-main>
</el-container>
</el-main>
<print-dialog
v-if="print_m"
ref="printmaterial"
:mId="wmId"
:mtype="wmtype"
:apiObj="apiObjPrint"
></print-dialog>
</el-container>
</template>
<script>
import printDialog from "./../template/printmaterial.vue";
export default {
name: "halfgood",
components: {
printDialog
},
data() {
return {
apiObj: this.$API.inm.warehouse.batch,
@ -157,7 +168,11 @@ export default {
paramsWm: { count__gte: 1 },
processOptions: [],
queryWm: {},
printer_name:localStorage.getItem("printer_name")
wmtype:0,
print_m:false,
materialsVisible:false,
apiObjPrint:this.$API.cm.labelmat.fromMb,
wmId:'',
};
},
mounted() {
@ -187,28 +202,12 @@ export default {
//
printMaterial(row){
let that = this;
let code = "";
that.$API.cm.labelmat.fromMb.req({tid:row.id}).then((res) => {
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,
];
if(res.notok_sign!==null){
str.push("WINTEXT 280,550,28,90,0,0,Simhei," +res.notok_sign_name,)
}
str.push("PRINT 1",)
let obj = {};
obj.printer_commands = str;
obj.printer_name = that.printer_name;
this.$API.wpm.prints.req(obj).then((response) => {});
that.wmId = row.id;
that.wmtype = row.material_.type;
that.print_m = true;
this.$nextTick(() => {
this.$refs.printmaterial.open();
})
},
},
};

View File

@ -64,11 +64,22 @@
</el-table-column>
</scTable>
</el-main>
<print-dialog
v-if="print_m"
ref="printmaterial"
:mId="wmId"
:mtype="wmtype"
:apiObj="apiObjPrint"
></print-dialog>
</el-container>
</template>
<script>
import printDialog from "./../template/printmaterial.vue";
export default {
name: "materials",
components: {
printDialog
},
data() {
return {
apiObj: this.$API.inm.warehouse.batch,
@ -76,7 +87,11 @@ export default {
selection: [],
query: {},
warehouseOptions: [],
printer_name:localStorage.getItem("printer_name")
wmtype:0,
print_m:false,
materialsVisible:false,
apiObjPrint:this.$API.cm.labelmat.fromMb,
wmId:'',
};
},
mounted() {
@ -97,28 +112,12 @@ export default {
//
printMaterial(row){
let that = this;
let code = "";
that.$API.cm.labelmat.fromMb.req({tid:row.id}).then((res) => {
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,
];
if(res.notok_sign!==null){
str.push("WINTEXT 280,550,28,90,0,0,Simhei," +res.notok_sign_name,)
}
str.push("PRINT 1",)
let obj = {};
obj.printer_commands = str;
obj.printer_name = that.printer_name;
this.$API.wpm.prints.req(obj).then((response) => {});
that.wmId = row.id;
that.wmtype = row.material_.type;
that.print_m = true;
this.$nextTick(() => {
this.$refs.printmaterial.open();
})
},
},
};

View File

@ -64,11 +64,22 @@
</el-table-column>
</scTable>
</el-main>
<print-dialog
v-if="print_m"
ref="printmaterial"
:mId="wmId"
:mtype="wmtype"
:apiObj="apiObjPrint"
></print-dialog>
</el-container>
</template>
<script>
import printDialog from "./../template/printmaterial.vue";
export default {
name: "materials",
components: {
printDialog
},
data() {
return {
apiObj: this.$API.inm.warehouse.batch,
@ -76,7 +87,11 @@ export default {
selection: [],
query: {},
warehouseOptions: [],
printer_name:localStorage.getItem("printer_name")
wmtype:0,
print_m:false,
materialsVisible:false,
apiObjPrint:this.$API.cm.labelmat.fromMb,
wmId:'',
};
},
mounted() {
@ -97,28 +112,12 @@ export default {
//
printMaterial(row){
let that = this;
let code = "";
that.$API.cm.labelmat.fromMb.req({tid:row.id}).then((res) => {
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,
];
if(res.notok_sign!==null){
str.push("WINTEXT 280,550,28,90,0,0,Simhei," +res.notok_sign_name,)
}
str.push("PRINT 1",)
let obj = {};
obj.printer_commands = str;
obj.printer_name = that.printer_name;
this.$API.wpm.prints.req(obj).then((response) => {});
that.wmId = row.id;
that.wmtype = row.material_.type;
that.print_m = true;
this.$nextTick(() => {
this.$refs.printmaterial.open();
})
},
},
};

View File

@ -0,0 +1,137 @@
<template>
<div>
<el-dialog
title="打印物料标签"
v-model="visible"
destroy-on-close
width="800px"
>
<el-form>
<el-form-item label="容器容量">
<el-input-number
v-model="counts"
min="1"
precision="0"
style="width: 100%;"
></el-input-number >
</el-form-item>
<el-form-item label="打印份数">
<el-input-number
v-model="print_count"
min="1"
precision="0"
style="width: 100%;"
></el-input-number >
</el-form-item>
</el-form>
<el-footer>
<el-button type="primary" @click="print">打印</el-button>
</el-footer>
</el-dialog>
</div>
</template>
<script>
export default {
props:{
apiObj:{
type:String,
default:''
},
mId:{
type:String,
default:''
},
mtype:{
type:Number,
default:0
},
supplier_name:{
type:String,
default:''
},
create_time:{
type:String,
default:''
},
effective_time:{
type:String,
default:''
},
},
data(){
return{
counts:100,
print_count:1,
count_printed:0,
visible:false,
printInterval:null,
printer_name:localStorage.getItem("printer_name")
}
},
mounted(){
},
methods:{
open(){
this.visible = true;
},
print(){
let that = this;
that.apiObj.req({tid:that.mId}).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 30,380,28,90,0,0,Simhei,容器容量:" + that.counts,
"WINTEXT 200,550,28,90,0,0,Simhei," + res.material_name,
"WINTEXT 240,550,28,90,0,0,Simhei," + res.batch,
];
//
if(that.mtype==40||that.mtype==30){
str.push("WINTEXT 70,380,28,90,0,0,Simhei,供应商:" + that.supplier_name,);
}
///
if(that.mtype==10){
str.push("WINTEXT 70,380,28,90,0,0,Simhei,生产日期:" + that.create_time,);
str.push("WINTEXT 110,380,28,90,0,0,Simhei,有效日期:" + that.effective_time,);
}
if(res.notok_sign!==null){
str.push("WINTEXT 280,550,28,90,0,0,Simhei," +res.notok_sign_name,)
}
str.push("PRINT 1",)
let obj = {};
obj.printer_commands = str;
obj.printer_name = that.printer_name;
if(that.$INTERVAL == null){
that.$INTERVAL = setInterval(() => {
that.printLabel(obj)
}, 2000);
that.visible = false;
}else{
that.$message.warning("请等待当前打印任务完成")
}
})
},
closed(){
this.visible = false;
},
printLabel(obj){
let that = this;
that.$API.wpm.prints.req(obj).then((response) => {
that.count_printed ++
if (that.count_printed >= that.print_count){
clearInterval(that.$INTERVAL);
that.$INTERVAL = null;
}
});
}
},
beforeUnmount() {
//
clearInterval(this.$INTERVAL);
},
}
</script>