This commit is contained in:
caoqianming 2024-10-26 13:09:04 +08:00
commit 177446d8c2
7 changed files with 248 additions and 115 deletions

View File

@ -42,6 +42,7 @@ import * as scIcons from './assets/icons'
export default {
install(app) {
//挂载全局对象
app.config.globalProperties.$INTERVAL = null;
app.config.globalProperties.$CONFIG = config;
app.config.globalProperties.$TOOL = tool;
app.config.globalProperties.$HTTP = http;

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>

View File

@ -160,11 +160,19 @@
@success="handleinmSuccess"
>
</save-dialog>
<print-dialog
v-if="dialog.print_m"
ref="printmaterial"
:mId="wmId"
:mtype="wmtype"
:apiObj="apiObjPrint"
></print-dialog>
</el-container>
</template>
<script>
import { wmState } from "@/utils/enum.js";
import materials from "./../mtm/materials.vue";
import printDialog from "./../template/printmaterial.vue";
import checkDialog from "./check_form.vue";
import showDrawer from "./check_drawer.vue";
import scrapDialog from "./handover_form.vue";
@ -181,7 +189,8 @@ export default {
materials,
checkDialog,
showDrawer,
scrapDialog
scrapDialog,
printDialog
},
name: "wmaterial",
data() {
@ -192,12 +201,14 @@ export default {
mgroupx: "",
belong_dept:''
},
wmtype:0,
query: {},
dialog: {
save: false,
scrap: false,
permission: false,
inmRecord:false
inmRecord:false,
print_m:false
},
tableData: [],
selection: [],
@ -208,7 +219,10 @@ export default {
cate_type:'',
process:'',
materialType: "wm",
materialsVisible:false,
visibleDrawer: false,
apiObjPrint:this.$API.cm.labelmat.fromWm,
wmId:'',
printer_name:localStorage.getItem("printer_name")
};
},
@ -317,28 +331,12 @@ export default {
//
printMaterial(row){
let that = this;
that.$API.cm.labelmat.fromWm.req({tid:row.id}).then((res) => {
console.log(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,
];
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.dialog.print_m = true;
this.$nextTick(() => {
this.$refs.printmaterial.open();
})
},
},
};