|
@@ -297,17 +297,17 @@
|
|
// 这里的 serviceId 需要在 getBLEDeviceServices 接口中获取
|
|
// 这里的 serviceId 需要在 getBLEDeviceServices 接口中获取
|
|
serviceId: serviceId,
|
|
serviceId: serviceId,
|
|
success(res) {
|
|
success(res) {
|
|
- let write = false;
|
|
|
|
- let notify = false;
|
|
|
|
- let indicate = false;
|
|
|
|
var readId;
|
|
var readId;
|
|
var writeId;
|
|
var writeId;
|
|
- console.log(res, serviceId, '获取特征值成功')
|
|
|
|
|
|
+ // console.log(res, serviceId, '获取特征值成功')
|
|
// that.pairedDeviceList = []
|
|
// that.pairedDeviceList = []
|
|
// that.pairedDeviceList.push(item)
|
|
// that.pairedDeviceList.push(item)
|
|
var arrList = JSON.parse(JSON.stringify(res))
|
|
var arrList = JSON.parse(JSON.stringify(res))
|
|
for (var i = 0; i < arrList.characteristics
|
|
for (var i = 0; i < arrList.characteristics
|
|
.length; i++) {
|
|
.length; i++) {
|
|
|
|
+ let write = false;
|
|
|
|
+ let notify = false;
|
|
|
|
+ let indicate = false;
|
|
if (!notify) {
|
|
if (!notify) {
|
|
notify = arrList.characteristics[i]
|
|
notify = arrList.characteristics[i]
|
|
.properties
|
|
.properties
|
|
@@ -331,11 +331,11 @@
|
|
writeId = arrList.characteristics[i].uuid;
|
|
writeId = arrList.characteristics[i].uuid;
|
|
}
|
|
}
|
|
if ((notify || indicate) && write) {
|
|
if ((notify || indicate) && write) {
|
|
- // console.log(2)
|
|
|
|
/* 获取蓝牙特征值uuid */
|
|
/* 获取蓝牙特征值uuid */
|
|
let uuid = arrList.characteristics[i].uuid
|
|
let uuid = arrList.characteristics[i].uuid
|
|
that.matchingUnit.characteristicId = uuid
|
|
that.matchingUnit.characteristicId = uuid
|
|
that.matchingUnit.serviceId = serviceId
|
|
that.matchingUnit.serviceId = serviceId
|
|
|
|
+ // console.log(that.matchingUnit, 'matchingUnit')
|
|
resolve(true);
|
|
resolve(true);
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
@@ -479,10 +479,8 @@
|
|
.setAlign('CT')
|
|
.setAlign('CT')
|
|
.printBarcode(code128)
|
|
.printBarcode(code128)
|
|
.setSize(1, 1)
|
|
.setSize(1, 1)
|
|
- .setAlign('LT')
|
|
|
|
- // .text(' ')
|
|
|
|
- // .text(codeValue + ' \n')
|
|
|
|
- // .print(printerUtil.fillLine())
|
|
|
|
|
|
+ .setAlign('CT')
|
|
|
|
+ .text(codeValue + ' \n')
|
|
.setAlign('LT')
|
|
.setAlign('LT')
|
|
.setSize(1, 2)
|
|
.setSize(1, 2)
|
|
.setSize(2, 1)
|
|
.setSize(2, 1)
|
|
@@ -508,7 +506,6 @@
|
|
.print(shippingAddress(this.waybillList.consigneeAddressDetails))
|
|
.print(shippingAddress(this.waybillList.consigneeAddressDetails))
|
|
.print(printerUtil.fillLine())
|
|
.print(printerUtil.fillLine())
|
|
.print('下单时间:' + this.waybillList.orderTime)
|
|
.print('下单时间:' + this.waybillList.orderTime)
|
|
- // .print(printerUtil.fillLine())
|
|
|
|
.text('备注:')
|
|
.text('备注:')
|
|
.text('货物类型:' + this.waybillList.cargoType + ' \n')
|
|
.text('货物类型:' + this.waybillList.cargoType + ' \n')
|
|
.print(' 温度需求:' + this.waybillList.temperatureInterval)
|
|
.print(' 温度需求:' + this.waybillList.temperatureInterval)
|
|
@@ -653,9 +650,9 @@
|
|
`${item2[1] == '---' ? '----' : character(item2[1].T_t) }`
|
|
`${item2[1] == '---' ? '----' : character(item2[1].T_t) }`
|
|
)
|
|
)
|
|
.text(' ')
|
|
.text(' ')
|
|
- if (isEven(index2 + 1)) {
|
|
|
|
- printerJobs.text(' \n')
|
|
|
|
- }
|
|
|
|
|
|
+ // if (isEven(index2 + 1)) {
|
|
|
|
+ // printerJobs.text(' \n')
|
|
|
|
+ // }
|
|
|
|
|
|
function isEven(num) {
|
|
function isEven(num) {
|
|
return num % 2 === 0;
|
|
return num % 2 === 0;
|
|
@@ -699,6 +696,10 @@
|
|
},
|
|
},
|
|
async printbuffs(buffer) {
|
|
async printbuffs(buffer) {
|
|
uni.hideLoading()
|
|
uni.hideLoading()
|
|
|
|
+ uni.showLoading({
|
|
|
|
+ title: '打印中,请稍等',
|
|
|
|
+ mask: true,
|
|
|
|
+ });
|
|
// 1.并行调用多次会存在写失败的可能性
|
|
// 1.并行调用多次会存在写失败的可能性
|
|
// 2.建议每次写入不超过20字节
|
|
// 2.建议每次写入不超过20字节
|
|
// 分包处理,延时调用
|
|
// 分包处理,延时调用
|
|
@@ -708,6 +709,11 @@
|
|
let subPackage = buffer.slice(i, i + maxChunk <= length ? (i + maxChunk) : length);
|
|
let subPackage = buffer.slice(i, i + maxChunk <= length ? (i + maxChunk) : length);
|
|
setTimeout(await this.printbuff, j * delay, subPackage);
|
|
setTimeout(await this.printbuff, j * delay, subPackage);
|
|
}
|
|
}
|
|
|
|
+ uni.showToast({
|
|
|
|
+ title: '打印完成',
|
|
|
|
+ icon: 'none',
|
|
|
|
+ duration: 2000
|
|
|
|
+ })
|
|
},
|
|
},
|
|
printbuff(buffer) {
|
|
printbuff(buffer) {
|
|
let deviceId = this.deviceId;
|
|
let deviceId = this.deviceId;
|
|
@@ -918,38 +924,41 @@
|
|
},
|
|
},
|
|
getWaybillTask(params) {
|
|
getWaybillTask(params) {
|
|
return new Promise((resolve, reject) => {
|
|
return new Promise((resolve, reject) => {
|
|
- this.$api.post('/api/waybill-task/print-data', params).then(res => {
|
|
|
|
- if (res.code == 200) {
|
|
|
|
- let arr1 = res.data.list
|
|
|
|
- if (arr1) {
|
|
|
|
- let arr2 = []
|
|
|
|
- arr1.forEach(item1 => {
|
|
|
|
- const dateString = item1.T_time;
|
|
|
|
- const parts = dateString.split(" ")[0].split("-");
|
|
|
|
- const extractedDate = parts[0] + "-" + parts[1] + "-" + parts[
|
|
|
|
- 2];
|
|
|
|
- const parts1 = dateString.split(" ")[1].split(":");
|
|
|
|
- const extractedTime = parts1[0] + ":" + parts1[1];
|
|
|
|
- let arr3 = {
|
|
|
|
- T_sn: item1.T_sn,
|
|
|
|
- T_id: item1.T_id,
|
|
|
|
- T_time: extractedDate,
|
|
|
|
- T_t: item1.T_t,
|
|
|
|
- T_rh: item1.T_rh,
|
|
|
|
- time: extractedTime
|
|
|
|
- }
|
|
|
|
- arr2.push(arr3)
|
|
|
|
- })
|
|
|
|
- resolve(arr2)
|
|
|
|
|
|
+ setTimeout(() => {
|
|
|
|
+ this.$api.post('/api/waybill-task/print-data', params).then(res => {
|
|
|
|
+ if (res.code == 200) {
|
|
|
|
+ let arr1 = res.data.list
|
|
|
|
+ if (arr1) {
|
|
|
|
+ let arr2 = []
|
|
|
|
+ arr1.forEach(item1 => {
|
|
|
|
+ const dateString = item1.T_time;
|
|
|
|
+ const parts = dateString.split(" ")[0].split("-");
|
|
|
|
+ const extractedDate = parts[0] + "-" + parts[1] +
|
|
|
|
+ "-" + parts[
|
|
|
|
+ 2];
|
|
|
|
+ const parts1 = dateString.split(" ")[1].split(":");
|
|
|
|
+ const extractedTime = parts1[0] + ":" + parts1[1];
|
|
|
|
+ let arr3 = {
|
|
|
|
+ T_sn: item1.T_sn,
|
|
|
|
+ T_id: item1.T_id,
|
|
|
|
+ T_time: extractedDate,
|
|
|
|
+ T_t: item1.T_t,
|
|
|
|
+ T_rh: item1.T_rh,
|
|
|
|
+ time: extractedTime
|
|
|
|
+ }
|
|
|
|
+ arr2.push(arr3)
|
|
|
|
+ })
|
|
|
|
+ resolve(arr2)
|
|
|
|
+ }
|
|
|
|
+ this.disqualification = true
|
|
|
|
+ } else if (res.code == 5000) {
|
|
|
|
+ // this.disqualification = false
|
|
|
|
+ // let arr2 = []
|
|
|
|
+ // resolve(arr2)
|
|
|
|
+ resolve(false)
|
|
}
|
|
}
|
|
- this.disqualification = true
|
|
|
|
- } else if (res.code == 5000) {
|
|
|
|
- // this.disqualification = false
|
|
|
|
- // let arr2 = []
|
|
|
|
- // resolve(arr2)
|
|
|
|
- resolve(false)
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
|
|
+ })
|
|
|
|
+ }, 300)
|
|
});
|
|
});
|
|
},
|
|
},
|
|
changeDatetime(value, data) {
|
|
changeDatetime(value, data) {
|