This commit is contained in:
linfso 2024-08-16 08:24:55 +08:00
parent fe9b3d68ab
commit f819e7c674
3 changed files with 33 additions and 34 deletions

View File

@ -22,9 +22,10 @@ class TanexPrinterSdk {
VERSION="1.0.0"
MAX_SENT_RETRY_COUNT = 9;
WS_URL = 'ws://'+process.env.VUE_APP_PRINTER_HOST+'/ws';
// WS_URL = "ws://192.168.88.189:17080/ws";
HTTP_GET_PDF = 'http://'+process.env.VUE_APP_PRINTER_HOST+'/api/downPdfFile';
// WS_URL = "ws://192.168.88.100:17080/ws";
// HTTP_GET_PDF = "http://192.168.88.100:17080/api/downPdfFile";

View File

@ -736,6 +736,7 @@
<el-col :span="24" v-if="action=='add' || action=='preAdd'">
<el-form-item :label="$t('打印组件')" prop="printTypeCheckList">
<TanexPrinterPanel ref="tanexPrinter" :isShowPinters="true" v-model="printerStatus" @onPrint="handleBatchPrint" :isInitA4="false" @onPrintComplete="onComplete"></TanexPrinterPanel>
<!-- <el-button type="primary" @click="handleTestPrintPreview">{{$t('测试打印')}}</el-button> -->
</el-form-item>
</el-col>
</el-row>
@ -746,6 +747,7 @@
</el-collapse>
<div style="text-align: center;margin-top: 10px;margin-bottom: 10px;">
<el-button type="primary" @click="submitForm">{{$t('确 定')}}</el-button>
<el-button @click="initData">{{$t('重置')}}</el-button>
</div>
@ -1107,6 +1109,7 @@ methods: {
},
handleBatchPrint(){
if(this.printerStatus == 1){
if(this.form.billCode){
// 重要,设置为true才会把右上角X和取消区分开来
@ -1120,12 +1123,12 @@ methods: {
let printDataList=[]
// 打印主单,子单
// let orderList=[];
// orderList.push(this.form.billCode);
let orderList=[];
orderList.push(this.form.billCode);
// // 客户联
// let customerItem ={
// "tplCode":"TAN-CM-130",
// "printerName":this.$refs.tanexPrinter.getDefaultPrinter(),
// "printerName":this.$refs.tanexPrinter.getSelectPrinter(),
// "orderList":orderList.toString()
// }
// printDataList.push(customerItem);
@ -1133,13 +1136,12 @@ methods: {
// 主单
let mainBillItem ={
"tplCode":"TAN-GM-130",
"printerName":this.$refs.tanexPrinter.getDefaultPrinter(),
"printerName":this.$refs.tanexPrinter.getSelectPrinter(),
"orderList":orderList.toString()
}
printDataList.push(mainBillItem);
// 打印子单
// tplCode="探路速运-子单联(通用)";
// tplCode="TAN-GC-130";
@ -1156,11 +1158,10 @@ methods: {
let subBillItem ={
"tplCode":"TAN-GC-130",
"printerName":this.$refs.tanexPrinter.getDefaultPrinter(),
"printerName":this.$refs.tanexPrinter.getSelectPrinter(),
"orderList":childOrderList.toString()
}
printDataList.push(subBillItem);
// 直接打印主子单
this.$refs.tanexPrinter.batchPrintAdv(printDataList)
@ -1186,6 +1187,11 @@ methods: {
}
},
handleTestPrintPreview(){
this.printerStatus=1;
this.handlePrintPreview();
},
async handlePrintPreview(){
if(this.printerStatus == 1){
@ -1199,7 +1205,7 @@ methods: {
// 客户联
let customerItem ={
"tplCode":"TAN-CM-130",
"printerName":this.$refs.tanexPrinter.getDefaultPrinter(),
"printerName":this.$refs.tanexPrinter.getSelectPrinter(),
"orderList":orderList.toString()
}
printDataList.push(customerItem);
@ -1207,7 +1213,7 @@ methods: {
// 主单
let mainBillItem ={
"tplCode":"TAN-GM-130",
"printerName":this.$refs.tanexPrinter.getDefaultPrinter(),
"printerName":this.$refs.tanexPrinter.getSelectPrinter(),
"orderList":orderList.toString()
}
printDataList.push(mainBillItem);
@ -1234,7 +1240,7 @@ methods: {
if(childOrderList&&childOrderList.length>0){
let subBillItem ={
"tplCode":"TAN-GC-130",
"printerName":this.$refs.tanexPrinter.getDefaultPrinter(),
"printerName":this.$refs.tanexPrinter.getSelectPrinter(),
"orderList":childOrderList.toString()
}
printDataList.push(subBillItem);
@ -1477,7 +1483,7 @@ methods: {
// this.form.billWeight=1.0;
// this.form.totalVolume=0.0;
this.form.parcelQty=1;
this.form.packType=['2'];
// this.form.packType=['2'];
this.form.blOverWeight='0';
this.form.blGenSubbill='1';
this.form.paymentType='1';
@ -1830,7 +1836,7 @@ methods: {
if(row!=null){
let singleVolume=parseFloat(row.length)*parseFloat(row.width)*parseFloat(row.height);
let singleTotalVolume=singleVolume*parseFloat(row.cargoQty);
row.volume=parseFloat( (singleTotalVolume/1000000).toFixed(5) );
row.volume=parseFloat( (singleTotalVolume/1000000).toFixed(4) );
}
let totalVolume=0.0;
@ -1838,7 +1844,7 @@ methods: {
totalVolume=totalVolume+item.volume;
});
this.form.totalVolume = parseFloat(totalVolume.toFixed(5));
this.form.totalVolume = parseFloat(totalVolume.toFixed(4));
this.handleCalcVolumeWeight();
@ -1847,8 +1853,6 @@ methods: {
async handleCalcFeeItem(row){
if(row!=null && this.form.settlementWeight!=null){
// console.log("===>calcExp====>",row.calcExp);
// console.log("===>calcExp111==row==>",row);
if(row.calcExp&&row.calcExp!='undefined'){
let expr=row.calcExp;
// 如果公式包含变量,使用变量进行计算
@ -1876,13 +1880,6 @@ methods: {
}
let feeRemark="";
let totalFee=Number(0);
if(this.form.feeItems&&this.form.feeItems.length>0){
let len=this.form.feeItems.length;
@ -1898,14 +1895,9 @@ methods: {
}
newFee=newFee.toFixed(2);
// feeRemark= feeRemark+item.feeName+'('+item.currency+"):" + item.realFee+",";
// feeRemark = feeRemark.slice(0, -1);
totalFee=Number(totalFee)+Number(newFee);
}
}
// this.form.feeRemark=feeRemark;
this.form.freight = totalFee.toFixed(2);
},
// 计算体积重量

View File

@ -736,6 +736,7 @@
<el-col :span="24" v-if="action=='add' || action=='preAdd'">
<el-form-item :label="$t('打印组件')" prop="printTypeCheckList">
<TanexPrinterPanel ref="tanexPrinter" :isShowPinters="true" v-model="printerStatus" @onPrint="handleBatchPrint" :isInitA4="false" @onPrintComplete="onComplete"></TanexPrinterPanel>
<!-- <el-button type="primary" @click="handleTestPrintPreview">{{$t('测试打印')}}</el-button> -->
</el-form-item>
</el-col>
</el-row>
@ -746,6 +747,7 @@
</el-collapse>
<div style="text-align: center;margin-top: 10px;margin-bottom: 10px;">
<el-button type="primary" @click="submitForm">{{$t('确 定')}}</el-button>
<el-button @click="initData">{{$t('重置')}}</el-button>
</div>
@ -1107,6 +1109,7 @@ methods: {
},
handleBatchPrint(){
if(this.printerStatus == 1){
if(this.form.billCode){
// 重要,设置为true才会把右上角X和取消区分开来
@ -1120,8 +1123,8 @@ methods: {
let printDataList=[]
// 打印主单,子单
// let orderList=[];
// orderList.push(this.form.billCode);
let orderList=[];
orderList.push(this.form.billCode);
// // 客户联
// let customerItem ={
// "tplCode":"TAN-CM-130",
@ -1139,7 +1142,6 @@ methods: {
printDataList.push(mainBillItem);
// 打印子单
// tplCode="探路速运-子单联(通用)";
// tplCode="TAN-GC-130";
@ -1160,7 +1162,6 @@ methods: {
"orderList":childOrderList.toString()
}
printDataList.push(subBillItem);
// 直接打印主子单
this.$refs.tanexPrinter.batchPrintAdv(printDataList)
@ -1186,6 +1187,11 @@ methods: {
}
},
handleTestPrintPreview(){
this.printerStatus=1;
this.handlePrintPreview();
},
async handlePrintPreview(){
if(this.printerStatus == 1){
@ -1830,7 +1836,7 @@ methods: {
if(row!=null){
let singleVolume=parseFloat(row.length)*parseFloat(row.width)*parseFloat(row.height);
let singleTotalVolume=singleVolume*parseFloat(row.cargoQty);
row.volume=parseFloat( (singleTotalVolume/1000000).toFixed(5) );
row.volume=parseFloat( (singleTotalVolume/1000000).toFixed(4) );
}
let totalVolume=0.0;
@ -1838,7 +1844,7 @@ methods: {
totalVolume=totalVolume+item.volume;
});
this.form.totalVolume = parseFloat(totalVolume.toFixed(5));
this.form.totalVolume = parseFloat(totalVolume.toFixed(4));
this.handleCalcVolumeWeight();