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 { export default {
install(app) { install(app) {
//挂载全局对象 //挂载全局对象
app.config.globalProperties.$INTERVAL = null;
app.config.globalProperties.$CONFIG = config; app.config.globalProperties.$CONFIG = config;
app.config.globalProperties.$TOOL = tool; app.config.globalProperties.$TOOL = tool;
app.config.globalProperties.$HTTP = http; app.config.globalProperties.$HTTP = http;

View File

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

View File

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

View File

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

View File

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

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

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