md
This commit is contained in:
parent
eb07ad83cb
commit
f537251010
@ -159,12 +159,12 @@ class TanexPrinterSdk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 批量获取PDF文件
|
// 批量获取PDF文件
|
||||||
batchGetPDF(tplCode,printerName,orderList,callback){
|
batchGetPDF(tplCode,printerName,orderList,printManCode,callback){
|
||||||
if(tplCode&&printerName&&orderList&&orderList.length>0){
|
if(tplCode&&printerName&&orderList&&orderList.length>0){
|
||||||
this.setOnBatchGetPDF(callback);
|
this.setOnBatchGetPDF(callback);
|
||||||
// 超时计算
|
// 超时计算
|
||||||
let that = this;
|
let that = this;
|
||||||
this.sendBatchGetPDFCMD(tplCode,printerName,orderList);
|
this.sendBatchGetPDFCMD(tplCode,printerName,orderList,printManCode);
|
||||||
// this.recievePdfFileTimer = setTimeout(function(){
|
// this.recievePdfFileTimer = setTimeout(function(){
|
||||||
|
|
||||||
// if(that.onBatchGetPDFCallback!=null){
|
// if(that.onBatchGetPDFCallback!=null){
|
||||||
@ -177,7 +177,7 @@ class TanexPrinterSdk {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
batchGetPDFAdv(printDataList,billCount,callback){
|
batchGetPDFAdv(printDataList,billCount,printManCode,callback){
|
||||||
if(printDataList&&printDataList.length>0){
|
if(printDataList&&printDataList.length>0){
|
||||||
if(callback){
|
if(callback){
|
||||||
this.setOnBatchGetPDF(callback);
|
this.setOnBatchGetPDF(callback);
|
||||||
@ -185,7 +185,7 @@ class TanexPrinterSdk {
|
|||||||
|
|
||||||
let that=this;
|
let that=this;
|
||||||
|
|
||||||
this.sendBatchGetPDFAdvCMD(printDataList,billCount);
|
this.sendBatchGetPDFAdvCMD(printDataList,billCount,printManCode);
|
||||||
// this.recievePdfFileTimer = setTimeout(function(){
|
// this.recievePdfFileTimer = setTimeout(function(){
|
||||||
|
|
||||||
// if(that.onBatchGetPDFCallback!=null){
|
// if(that.onBatchGetPDFCallback!=null){
|
||||||
@ -199,16 +199,16 @@ class TanexPrinterSdk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 批量打印
|
// 批量打印
|
||||||
batchPrint(tplCode,printerName,orderList){
|
batchPrint(tplCode,printerName,orderList,printManCode){
|
||||||
if(tplCode&&printerName&&orderList&&orderList.length>0){
|
if(tplCode&&printerName&&orderList&&orderList.length>0){
|
||||||
this.sendBatchPrintCMD(tplCode,printerName,orderList);
|
this.sendBatchPrintCMD(tplCode,printerName,orderList,printManCode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 高级打印接口,多个模版
|
// 高级打印接口,多个模版
|
||||||
batchPrintAdv(printDataList){
|
batchPrintAdv(printDataList,printManCode){
|
||||||
if(printDataList&&printDataList.length>0){
|
if(printDataList&&printDataList.length>0){
|
||||||
this.sendBatchPrintAdvCMD(printDataList);
|
this.sendBatchPrintAdvCMD(printDataList,printManCode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -238,13 +238,16 @@ class TanexPrinterSdk {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
sendBatchPrintAdvCMD(printDataList){
|
sendBatchPrintAdvCMD(printDataList,printManCode){
|
||||||
// {"CMD":"batchPrint","status":"1","Data":["DT20210901001","DT20210901002"]}
|
// {"CMD":"batchPrint","status":"1","Data":["DT20210901001","DT20210901002"]}
|
||||||
var printCmd={};
|
var printCmd={};
|
||||||
printCmd['RequestId']=this.getRequestId();
|
printCmd['RequestId']=this.getRequestId();
|
||||||
printCmd['CMD']="batchPrint";
|
printCmd['CMD']="batchPrint";
|
||||||
printCmd['Status']="1";
|
printCmd['Status']="1";
|
||||||
if(printDataList && printDataList.length>0){
|
if(printDataList && printDataList.length>0){
|
||||||
|
printDataList.forEach(item=>{
|
||||||
|
item["printManCode"]=printManCode;
|
||||||
|
});
|
||||||
printCmd['Data']=printDataList
|
printCmd['Data']=printDataList
|
||||||
this.send(JSON.stringify(printCmd),null);
|
this.send(JSON.stringify(printCmd),null);
|
||||||
}
|
}
|
||||||
@ -270,13 +273,17 @@ class TanexPrinterSdk {
|
|||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
sendBatchGetPDFAdvCMD(printDataList,billCount){
|
sendBatchGetPDFAdvCMD(printDataList,billCount,printManCode){
|
||||||
// {"CMD":"batchGetPDF","status":"1","Data":["DT20210901001","DT20210901002"]}
|
// {"CMD":"batchGetPDF","status":"1","Data":["DT20210901001","DT20210901002"]}
|
||||||
var printCmd={};
|
var printCmd={};
|
||||||
printCmd['RequestId']=this.getRequestId();
|
printCmd['RequestId']=this.getRequestId();
|
||||||
printCmd['CMD']="batchGetPDF";
|
printCmd['CMD']="batchGetPDF";
|
||||||
printCmd['Status']="1";
|
printCmd['Status']="1";
|
||||||
if(printDataList && printDataList.length>0){
|
if(printDataList && printDataList.length>0){
|
||||||
|
printDataList.forEach(item=>{
|
||||||
|
item["printManCode"]=printManCode;
|
||||||
|
});
|
||||||
|
|
||||||
printCmd['Data']=printDataList
|
printCmd['Data']=printDataList
|
||||||
this.recievePdfFileList = [];
|
this.recievePdfFileList = [];
|
||||||
this.pdfFileReceiveMap=new Map();
|
this.pdfFileReceiveMap=new Map();
|
||||||
@ -286,7 +293,7 @@ class TanexPrinterSdk {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sendBatchPrintCMD(tplCode,printerName,orderList){
|
sendBatchPrintCMD(tplCode,printerName,orderList,printManCode){
|
||||||
// {"CMD":"batchPrint","status":"1","Data":["DT20210901001","DT20210901002"]}
|
// {"CMD":"batchPrint","status":"1","Data":["DT20210901001","DT20210901002"]}
|
||||||
var printCmd={};
|
var printCmd={};
|
||||||
printCmd['RequestId']=this.getRequestId();
|
printCmd['RequestId']=this.getRequestId();
|
||||||
@ -296,16 +303,16 @@ class TanexPrinterSdk {
|
|||||||
let printData=[{
|
let printData=[{
|
||||||
"tplCode":tplCode,
|
"tplCode":tplCode,
|
||||||
"printerName":printerName,
|
"printerName":printerName,
|
||||||
"printManCode":this.$store.getters.empCode,
|
"printManCode":printManCode,
|
||||||
"orderList":orderList.toString()
|
"orderList":orderList.toString()
|
||||||
}]
|
}]
|
||||||
printCmd['Data']=printData
|
printCmd['Data']=printData
|
||||||
// console.log(JSON.stringify(printCmd));
|
console.log(JSON.stringify(printCmd));
|
||||||
this.send(JSON.stringify(printCmd),null);
|
this.send(JSON.stringify(printCmd),null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sendBatchGetPDFCMD(tplCode,printerName,orderList){
|
sendBatchGetPDFCMD(tplCode,printerName,orderList,printManCode){
|
||||||
// {"CMD":"batchGetPDF","status":"1","Data":["DT20210901001","DT20210901002"]}
|
// {"CMD":"batchGetPDF","status":"1","Data":["DT20210901001","DT20210901002"]}
|
||||||
var printCmd={};
|
var printCmd={};
|
||||||
printCmd['RequestId']=this.getRequestId();
|
printCmd['RequestId']=this.getRequestId();
|
||||||
@ -315,7 +322,7 @@ class TanexPrinterSdk {
|
|||||||
let printData=[{
|
let printData=[{
|
||||||
"tplCode":tplCode,
|
"tplCode":tplCode,
|
||||||
"printerName":printerName,
|
"printerName":printerName,
|
||||||
"printManCode":this.$store.getters.empCode,
|
"printManCode":printManCode,
|
||||||
"orderList":orderList.toString()
|
"orderList":orderList.toString()
|
||||||
}]
|
}]
|
||||||
|
|
||||||
|
|||||||
@ -103,11 +103,6 @@
|
|||||||
required: false,
|
required: false,
|
||||||
default: false
|
default: false
|
||||||
},
|
},
|
||||||
isInitA4:{
|
|
||||||
type: [Boolean],
|
|
||||||
required: false,
|
|
||||||
default: false
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@ -116,6 +111,9 @@
|
|||||||
subBillEnd:null,
|
subBillEnd:null,
|
||||||
openPdfView:false,
|
openPdfView:false,
|
||||||
|
|
||||||
|
isInitA4:false,
|
||||||
|
printManCode:this.$store.getters.empCode,
|
||||||
|
|
||||||
// 计数器
|
// 计数器
|
||||||
showCounter:0,
|
showCounter:0,
|
||||||
|
|
||||||
@ -242,16 +240,22 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.tanexPrinter.batchPrintAdv(printDataList);
|
this.isInitA4=false;
|
||||||
|
|
||||||
|
this.tanexPrinter.batchPrintAdv(printDataList,this.printManCode);
|
||||||
},
|
},
|
||||||
|
|
||||||
batchPrint(orderList,tplCode){
|
batchPrint(orderList,tplCode,isA4){
|
||||||
|
|
||||||
if(this.printerStatus !=1){
|
if(this.printerStatus !=1){
|
||||||
this.$modal.msgError("打印机未连接");
|
this.$modal.msgError("打印机未连接");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(isA4){
|
||||||
|
this.isInitA4=isA4;
|
||||||
|
}
|
||||||
|
|
||||||
let that = this;
|
let that = this;
|
||||||
let newOrderList=[];
|
let newOrderList=[];
|
||||||
if(orderList){
|
if(orderList){
|
||||||
@ -262,9 +266,33 @@
|
|||||||
this.selTplCode=tplCode
|
this.selTplCode=tplCode
|
||||||
}
|
}
|
||||||
|
|
||||||
newOrderList=[...orderList];
|
// 打印子单
|
||||||
|
if(this.selTplCode=="TAN-GC-130"){
|
||||||
|
for(let i=0;i<this.orderList.length;i++){
|
||||||
|
let billCode=this.orderList[i];
|
||||||
|
let subBillStart=1;
|
||||||
|
if(this.subBillStart&&this.subBillStart>0){
|
||||||
|
subBillStart=this.subBillStart;
|
||||||
|
}
|
||||||
|
|
||||||
that.tanexPrinter.batchPrint(that.selTplCode,that.selPrinterName,newOrderList)
|
let subBillEnd=50;
|
||||||
|
if(this.subBillEnd){
|
||||||
|
subBillEnd = this.subBillEnd;
|
||||||
|
}
|
||||||
|
// 循环子单范围
|
||||||
|
for(let i=subBillStart;i<=subBillEnd;i++){
|
||||||
|
let subBillCode = billCode+""+this.lpadZero(i,4);
|
||||||
|
newOrderList.push(subBillCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
newOrderList=[...orderList];
|
||||||
|
}
|
||||||
|
|
||||||
|
// newOrderList=[...orderList];
|
||||||
|
|
||||||
|
that.tanexPrinter.batchPrint(that.selTplCode,that.selPrinterName,newOrderList,this.printManCode)
|
||||||
},
|
},
|
||||||
|
|
||||||
printPreviewAdv(printDataList,billCount){
|
printPreviewAdv(printDataList,billCount){
|
||||||
@ -274,6 +302,8 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.isInitA4=false;
|
||||||
|
|
||||||
let that = this;
|
let that = this;
|
||||||
const loadingInstance = this.$loading({
|
const loadingInstance = this.$loading({
|
||||||
text: '正在生成预览...'
|
text: '正在生成预览...'
|
||||||
@ -281,7 +311,7 @@
|
|||||||
|
|
||||||
that.pdfList=[];
|
that.pdfList=[];
|
||||||
that.showCounter=0;
|
that.showCounter=0;
|
||||||
this.tanexPrinter.batchGetPDFAdv(printDataList,billCount,async function(code,msg,data){
|
this.tanexPrinter.batchGetPDFAdv(printDataList,billCount,this.printManCode,async function(code,msg,data){
|
||||||
if(code == 500){
|
if(code == 500){
|
||||||
that.$modal.msgError("打印出错:"+msg);
|
that.$modal.msgError("打印出错:"+msg);
|
||||||
}
|
}
|
||||||
@ -312,13 +342,17 @@
|
|||||||
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
printPreview(orderList){
|
printPreview(orderList,isA4){
|
||||||
|
|
||||||
if(this.printerStatus !=1){
|
if(this.printerStatus !=1){
|
||||||
this.$modal.msgError("打印机未连接");
|
this.$modal.msgError("打印机未连接");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(isA4){
|
||||||
|
this.isInitA4=isA4;
|
||||||
|
}
|
||||||
|
|
||||||
let that = this;
|
let that = this;
|
||||||
let newOrderList=[];
|
let newOrderList=[];
|
||||||
if(orderList){
|
if(orderList){
|
||||||
@ -355,7 +389,7 @@
|
|||||||
|
|
||||||
that.pdfList=[];
|
that.pdfList=[];
|
||||||
that.showCounter=0;
|
that.showCounter=0;
|
||||||
this.tanexPrinter.batchGetPDF(this.selTplCode,this.selPrinterName,newOrderList,async function(code,msg,data){
|
this.tanexPrinter.batchGetPDF(this.selTplCode,this.selPrinterName,newOrderList,this.printManCode,async function(code,msg,data){
|
||||||
if(code == 500){
|
if(code == 500){
|
||||||
that.$modal.msgError("打印出错:"+msg);
|
that.$modal.msgError("打印出错:"+msg);
|
||||||
}
|
}
|
||||||
@ -386,13 +420,16 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
downPDF(orderList){
|
downPDF(orderList,isA4){
|
||||||
|
|
||||||
if(this.printerStatus !=1){
|
if(this.printerStatus !=1){
|
||||||
this.$modal.msgError("打印机未连接");
|
this.$modal.msgError("打印机未连接");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(isA4){
|
||||||
|
this.isInitA4=isA4;
|
||||||
|
}
|
||||||
|
|
||||||
let that = this;
|
let that = this;
|
||||||
let newOrderList=[];
|
let newOrderList=[];
|
||||||
@ -427,7 +464,7 @@
|
|||||||
const loadingInstance = this.$loading({
|
const loadingInstance = this.$loading({
|
||||||
text: '正在下载...'
|
text: '正在下载...'
|
||||||
})
|
})
|
||||||
this.tanexPrinter.batchGetPDF(this.selTplCode,this.selPrinterName,newOrderList,function(code,msg,data){
|
this.tanexPrinter.batchGetPDF(this.selTplCode,this.selPrinterName,newOrderList,this.printManCode,function(code,msg,data){
|
||||||
loadingInstance.close();
|
loadingInstance.close();
|
||||||
|
|
||||||
if(code == 500){
|
if(code == 500){
|
||||||
|
|||||||
@ -138,7 +138,7 @@
|
|||||||
</el-col>
|
</el-col>
|
||||||
|
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<TanexPrinterPanel ref="tanexPrinter" :isShowPinters="false" :isShowTpl="false" :isInitA4="true" :isShowSubBillRange="false" @onPrint="handleBatchPrint"></TanexPrinterPanel>
|
<TanexPrinterPanel ref="tanexPrinter" :isShowPinters="false" :isShowTpl="false" :isShowSubBillRange="false" @onPrint="handleBatchPrint"></TanexPrinterPanel>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
|
||||||
|
|
||||||
@ -626,7 +626,7 @@ export default {
|
|||||||
this.currentSelection.forEach(item=>{
|
this.currentSelection.forEach(item=>{
|
||||||
orderList.push(item.billCode);
|
orderList.push(item.billCode);
|
||||||
});
|
});
|
||||||
this.$refs.tanexPrinter.batchPrint(orderList);
|
this.$refs.tanexPrinter.batchPrint(orderList,null,true);
|
||||||
}).catch(() => {});
|
}).catch(() => {});
|
||||||
|
|
||||||
},
|
},
|
||||||
@ -635,14 +635,14 @@ export default {
|
|||||||
this.currentSelection.forEach(item=>{
|
this.currentSelection.forEach(item=>{
|
||||||
orderList.push(item.billCode);
|
orderList.push(item.billCode);
|
||||||
});
|
});
|
||||||
this.$refs.tanexPrinter.printPreview(orderList);
|
this.$refs.tanexPrinter.printPreview(orderList,true);
|
||||||
},
|
},
|
||||||
handleDownPDF(){
|
handleDownPDF(){
|
||||||
let orderList=[];
|
let orderList=[];
|
||||||
this.currentSelection.forEach(item=>{
|
this.currentSelection.forEach(item=>{
|
||||||
orderList.push(item.billCode);
|
orderList.push(item.billCode);
|
||||||
});
|
});
|
||||||
this.$refs.tanexPrinter.downPDF(orderList);
|
this.$refs.tanexPrinter.downPDF(orderList,true);
|
||||||
},
|
},
|
||||||
/** 查询运单列表列表 */
|
/** 查询运单列表列表 */
|
||||||
getList() {
|
getList() {
|
||||||
|
|||||||
@ -257,7 +257,7 @@
|
|||||||
</el-col>
|
</el-col>
|
||||||
|
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<TanexPrinterPanel ref="tanexPrinter" :isShowPinters="true" :isShowTpl="true" :isInitA4="false" :isShowSubBillRange="true" @onPrint="handleBatchPrint"></TanexPrinterPanel>
|
<TanexPrinterPanel ref="tanexPrinter" :isShowPinters="true" :isShowTpl="true" :isShowSubBillRange="true" @onPrint="handleBatchPrint"></TanexPrinterPanel>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
|
||||||
|
|
||||||
@ -756,7 +756,7 @@ export default {
|
|||||||
this.currentSelection.forEach(item=>{
|
this.currentSelection.forEach(item=>{
|
||||||
orderList.push(item.billCode);
|
orderList.push(item.billCode);
|
||||||
});
|
});
|
||||||
this.$refs.tanexPrinter.batchPrint(orderList);
|
this.$refs.tanexPrinter.batchPrint(orderList,null,false);
|
||||||
}).catch(() => {});
|
}).catch(() => {});
|
||||||
|
|
||||||
},
|
},
|
||||||
@ -765,14 +765,14 @@ export default {
|
|||||||
this.currentSelection.forEach(item=>{
|
this.currentSelection.forEach(item=>{
|
||||||
orderList.push(item.billCode);
|
orderList.push(item.billCode);
|
||||||
});
|
});
|
||||||
this.$refs.tanexPrinter.printPreview(orderList);
|
this.$refs.tanexPrinter.printPreview(orderList,false);
|
||||||
},
|
},
|
||||||
handleDownPDF(){
|
handleDownPDF(){
|
||||||
let orderList=[];
|
let orderList=[];
|
||||||
this.currentSelection.forEach(item=>{
|
this.currentSelection.forEach(item=>{
|
||||||
orderList.push(item.billCode);
|
orderList.push(item.billCode);
|
||||||
});
|
});
|
||||||
this.$refs.tanexPrinter.downPDF(orderList);
|
this.$refs.tanexPrinter.downPDF(orderList,false);
|
||||||
},
|
},
|
||||||
/** 查询运单列表列表 */
|
/** 查询运单列表列表 */
|
||||||
getList() {
|
getList() {
|
||||||
|
|||||||
@ -170,7 +170,7 @@
|
|||||||
</el-checkbox-group>
|
</el-checkbox-group>
|
||||||
</div>
|
</div>
|
||||||
<div style="margin-left:10px">
|
<div style="margin-left:10px">
|
||||||
<TanexPrinterPanel ref="tanexPrinter" v-model="printerStatus" @onPrint="handleBatchPrint" :isInitA4="false" @onPrintComplete="onComplete"></TanexPrinterPanel>
|
<TanexPrinterPanel ref="tanexPrinter" v-model="printerStatus" @onPrint="handleBatchPrint" @onPrintComplete="onComplete"></TanexPrinterPanel>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user