md
This commit is contained in:
parent
eb07ad83cb
commit
f537251010
@ -159,12 +159,12 @@ class TanexPrinterSdk {
|
||||
}
|
||||
|
||||
// 批量获取PDF文件
|
||||
batchGetPDF(tplCode,printerName,orderList,callback){
|
||||
batchGetPDF(tplCode,printerName,orderList,printManCode,callback){
|
||||
if(tplCode&&printerName&&orderList&&orderList.length>0){
|
||||
this.setOnBatchGetPDF(callback);
|
||||
// 超时计算
|
||||
let that = this;
|
||||
this.sendBatchGetPDFCMD(tplCode,printerName,orderList);
|
||||
this.sendBatchGetPDFCMD(tplCode,printerName,orderList,printManCode);
|
||||
// this.recievePdfFileTimer = setTimeout(function(){
|
||||
|
||||
// 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(callback){
|
||||
this.setOnBatchGetPDF(callback);
|
||||
@ -185,7 +185,7 @@ class TanexPrinterSdk {
|
||||
|
||||
let that=this;
|
||||
|
||||
this.sendBatchGetPDFAdvCMD(printDataList,billCount);
|
||||
this.sendBatchGetPDFAdvCMD(printDataList,billCount,printManCode);
|
||||
// this.recievePdfFileTimer = setTimeout(function(){
|
||||
|
||||
// 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){
|
||||
this.sendBatchPrintCMD(tplCode,printerName,orderList);
|
||||
this.sendBatchPrintCMD(tplCode,printerName,orderList,printManCode);
|
||||
}
|
||||
}
|
||||
|
||||
// 高级打印接口,多个模版
|
||||
batchPrintAdv(printDataList){
|
||||
batchPrintAdv(printDataList,printManCode){
|
||||
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"]}
|
||||
var printCmd={};
|
||||
printCmd['RequestId']=this.getRequestId();
|
||||
printCmd['CMD']="batchPrint";
|
||||
printCmd['Status']="1";
|
||||
if(printDataList && printDataList.length>0){
|
||||
printDataList.forEach(item=>{
|
||||
item["printManCode"]=printManCode;
|
||||
});
|
||||
printCmd['Data']=printDataList
|
||||
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"]}
|
||||
var printCmd={};
|
||||
printCmd['RequestId']=this.getRequestId();
|
||||
printCmd['CMD']="batchGetPDF";
|
||||
printCmd['Status']="1";
|
||||
if(printDataList && printDataList.length>0){
|
||||
printDataList.forEach(item=>{
|
||||
item["printManCode"]=printManCode;
|
||||
});
|
||||
|
||||
printCmd['Data']=printDataList
|
||||
this.recievePdfFileList = [];
|
||||
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"]}
|
||||
var printCmd={};
|
||||
printCmd['RequestId']=this.getRequestId();
|
||||
@ -296,16 +303,16 @@ class TanexPrinterSdk {
|
||||
let printData=[{
|
||||
"tplCode":tplCode,
|
||||
"printerName":printerName,
|
||||
"printManCode":this.$store.getters.empCode,
|
||||
"printManCode":printManCode,
|
||||
"orderList":orderList.toString()
|
||||
}]
|
||||
printCmd['Data']=printData
|
||||
// console.log(JSON.stringify(printCmd));
|
||||
console.log(JSON.stringify(printCmd));
|
||||
this.send(JSON.stringify(printCmd),null);
|
||||
}
|
||||
}
|
||||
|
||||
sendBatchGetPDFCMD(tplCode,printerName,orderList){
|
||||
sendBatchGetPDFCMD(tplCode,printerName,orderList,printManCode){
|
||||
// {"CMD":"batchGetPDF","status":"1","Data":["DT20210901001","DT20210901002"]}
|
||||
var printCmd={};
|
||||
printCmd['RequestId']=this.getRequestId();
|
||||
@ -315,7 +322,7 @@ class TanexPrinterSdk {
|
||||
let printData=[{
|
||||
"tplCode":tplCode,
|
||||
"printerName":printerName,
|
||||
"printManCode":this.$store.getters.empCode,
|
||||
"printManCode":printManCode,
|
||||
"orderList":orderList.toString()
|
||||
}]
|
||||
|
||||
|
||||
@ -103,11 +103,6 @@
|
||||
required: false,
|
||||
default: false
|
||||
},
|
||||
isInitA4:{
|
||||
type: [Boolean],
|
||||
required: false,
|
||||
default: false
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@ -116,6 +111,9 @@
|
||||
subBillEnd:null,
|
||||
openPdfView:false,
|
||||
|
||||
isInitA4:false,
|
||||
printManCode:this.$store.getters.empCode,
|
||||
|
||||
// 计数器
|
||||
showCounter:0,
|
||||
|
||||
@ -242,16 +240,22 @@
|
||||
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){
|
||||
this.$modal.msgError("打印机未连接");
|
||||
return;
|
||||
}
|
||||
|
||||
if(isA4){
|
||||
this.isInitA4=isA4;
|
||||
}
|
||||
|
||||
let that = this;
|
||||
let newOrderList=[];
|
||||
if(orderList){
|
||||
@ -262,9 +266,33 @@
|
||||
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){
|
||||
@ -274,6 +302,8 @@
|
||||
return;
|
||||
}
|
||||
|
||||
this.isInitA4=false;
|
||||
|
||||
let that = this;
|
||||
const loadingInstance = this.$loading({
|
||||
text: '正在生成预览...'
|
||||
@ -281,7 +311,7 @@
|
||||
|
||||
that.pdfList=[];
|
||||
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){
|
||||
that.$modal.msgError("打印出错:"+msg);
|
||||
}
|
||||
@ -312,13 +342,17 @@
|
||||
|
||||
});
|
||||
},
|
||||
printPreview(orderList){
|
||||
printPreview(orderList,isA4){
|
||||
|
||||
if(this.printerStatus !=1){
|
||||
this.$modal.msgError("打印机未连接");
|
||||
return;
|
||||
}
|
||||
|
||||
if(isA4){
|
||||
this.isInitA4=isA4;
|
||||
}
|
||||
|
||||
let that = this;
|
||||
let newOrderList=[];
|
||||
if(orderList){
|
||||
@ -355,14 +389,14 @@
|
||||
|
||||
that.pdfList=[];
|
||||
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){
|
||||
that.$modal.msgError("打印出错:"+msg);
|
||||
}
|
||||
else if(code == 200){
|
||||
console.log("===获取到数据====>");
|
||||
loadingInstance.close();
|
||||
|
||||
|
||||
const pdfData=deepClone(data);
|
||||
let pdfInfo={
|
||||
"billCode":pdfData.ydSn,
|
||||
@ -386,13 +420,16 @@
|
||||
}
|
||||
});
|
||||
},
|
||||
downPDF(orderList){
|
||||
downPDF(orderList,isA4){
|
||||
|
||||
if(this.printerStatus !=1){
|
||||
this.$modal.msgError("打印机未连接");
|
||||
return;
|
||||
}
|
||||
|
||||
if(isA4){
|
||||
this.isInitA4=isA4;
|
||||
}
|
||||
|
||||
let that = this;
|
||||
let newOrderList=[];
|
||||
@ -427,7 +464,7 @@
|
||||
const loadingInstance = this.$loading({
|
||||
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();
|
||||
|
||||
if(code == 500){
|
||||
|
||||
@ -138,10 +138,10 @@
|
||||
</el-col>
|
||||
|
||||
<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-row>
|
||||
</div>
|
||||
|
||||
@ -626,7 +626,7 @@ export default {
|
||||
this.currentSelection.forEach(item=>{
|
||||
orderList.push(item.billCode);
|
||||
});
|
||||
this.$refs.tanexPrinter.batchPrint(orderList);
|
||||
this.$refs.tanexPrinter.batchPrint(orderList,null,true);
|
||||
}).catch(() => {});
|
||||
|
||||
},
|
||||
@ -635,14 +635,14 @@ export default {
|
||||
this.currentSelection.forEach(item=>{
|
||||
orderList.push(item.billCode);
|
||||
});
|
||||
this.$refs.tanexPrinter.printPreview(orderList);
|
||||
this.$refs.tanexPrinter.printPreview(orderList,true);
|
||||
},
|
||||
handleDownPDF(){
|
||||
let orderList=[];
|
||||
this.currentSelection.forEach(item=>{
|
||||
orderList.push(item.billCode);
|
||||
});
|
||||
this.$refs.tanexPrinter.downPDF(orderList);
|
||||
this.$refs.tanexPrinter.downPDF(orderList,true);
|
||||
},
|
||||
/** 查询运单列表列表 */
|
||||
getList() {
|
||||
|
||||
@ -45,7 +45,7 @@
|
||||
/>
|
||||
</el-form-item> -->
|
||||
|
||||
<!--
|
||||
<!--
|
||||
<el-form-item label="寄件人" prop="sendName">
|
||||
<el-input
|
||||
v-model="queryParams.sendName"
|
||||
@ -154,7 +154,7 @@
|
||||
<EmisSiteSimplePicker2 v-model="queryParams.dispatchUnderlingSiteCode" ></EmisSiteSimplePicker2>
|
||||
</el-form-item>
|
||||
|
||||
<!--
|
||||
<!--
|
||||
<el-form-item :label="$t('回款联系人')" prop="payee">
|
||||
<PayeePicker :placeholder="$t('回款联系人')" v-model="queryParams.payee" ></PayeePicker>
|
||||
|
||||
@ -257,7 +257,7 @@
|
||||
</el-col>
|
||||
|
||||
<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>
|
||||
|
||||
|
||||
@ -756,7 +756,7 @@ export default {
|
||||
this.currentSelection.forEach(item=>{
|
||||
orderList.push(item.billCode);
|
||||
});
|
||||
this.$refs.tanexPrinter.batchPrint(orderList);
|
||||
this.$refs.tanexPrinter.batchPrint(orderList,null,false);
|
||||
}).catch(() => {});
|
||||
|
||||
},
|
||||
@ -765,14 +765,14 @@ export default {
|
||||
this.currentSelection.forEach(item=>{
|
||||
orderList.push(item.billCode);
|
||||
});
|
||||
this.$refs.tanexPrinter.printPreview(orderList);
|
||||
this.$refs.tanexPrinter.printPreview(orderList,false);
|
||||
},
|
||||
handleDownPDF(){
|
||||
let orderList=[];
|
||||
this.currentSelection.forEach(item=>{
|
||||
orderList.push(item.billCode);
|
||||
});
|
||||
this.$refs.tanexPrinter.downPDF(orderList);
|
||||
this.$refs.tanexPrinter.downPDF(orderList,false);
|
||||
},
|
||||
/** 查询运单列表列表 */
|
||||
getList() {
|
||||
|
||||
@ -170,7 +170,7 @@
|
||||
</el-checkbox-group>
|
||||
</div>
|
||||
<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>
|
||||
</el-form-item>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user