Эх сурвалжийг харах

蓝牙打印机打印运单适配

unknown 3 долоо хоног өмнө
parent
commit
aa0b92dddf

+ 2 - 2
manifest.json

@@ -2,8 +2,8 @@
     "name" : "冷链物流",
     "appid" : "__UNI__92DFF97",
     "description" : "",
-    "versionName" : "1.1.5",
-    "versionCode" : 115,
+    "versionName" : "1.1.8",
+    "versionCode" : 118,
     "transformPx" : false,
     /* 5+App特有相关 */
     "app-plus" : {

+ 2 - 1
pages/order/delivery.vue

@@ -85,7 +85,8 @@
 					<u-search placeholder="请输入保温箱名称" v-model="keyword" :showAction="false"
 						@change="searchChange"></u-search>
 				</view>
-				<view style="display: flex;flex-direction: column;" v-if="incubatorData.length > 0">
+				<view style="display: flex;flex-direction: column;overflow-y: auto;max-height: 600rpx;"
+					v-if="incubatorData.length > 0">
 					<view class="card_title_item" :class="item.name == incubatorName ? 'color_blue' : ''"
 						v-for="(item,index) in incubatorData" :key="index" @click="incubatorClick(item)">
 						{{item.name}}

+ 47 - 44
pages/order/gprint/bluetoolth.js

@@ -271,51 +271,54 @@ export function sendDataToDevice(options) {
 	//这里默认一次20个字节发送
 	const speed = options.onceLength; //20; 
 	if (byteLength > 0) {
-		uniAsyncPromise('writeBLECharacteristicValue', {
-				...options,
-				value: options.value.slice(0, byteLength > speed ? speed : byteLength),
-			})
-			.then((res) => {
-				// console.log('打印继续=============================', speed, byteLength);
-				if (byteLength > speed) {
-					num = 0
-					sendDataToDevice({
-						...options,
-						value: options.value.slice(speed, byteLength),
-					});
-
-				} else {
-					num = 0
-					uni.showToast({
-						title: '打印完成',
-						icon: 'none',
-						duration: 2000
-					})
-					number = 0
-				}
-			})
-			.catch((res) => {
-				if (num != 15) {
-					var data = {
-						...options,
+		setTimeout(() => {
+			uniAsyncPromise('writeBLECharacteristicValue', {
+					...options,
+					value: options.value.slice(0, byteLength > speed ? speed : byteLength),
+				})
+				.then((res) => {
+					// console.log('打印继续=================', res, speed, byteLength);
+					if (byteLength > speed) {
+						num = 0
+						sendDataToDevice({
+							...options,
+							value: options.value.slice(speed, byteLength),
+						});
+
+					} else {
+						num = 0
+						uni.showToast({
+							title: '打印完成',
+							icon: 'none',
+							duration: 2000
+						})
+						number = 0
 					}
-					sendDataToDevice({
-						...data,
-						value: totalValue,
-						// value: options.value.slice(speed,parseInt(byteLength)+parseInt(speed)*5),
-					});
-					console.log(res, '失败重新打印原因', options.value.slice(speed, byteLength), speed, byteLength);
-					num++
-				} else {
-					num = 0
-					uni.showToast({
-						title: '打印失败请检查蓝牙连接状态或打印机状态',
-						icon: 'none',
-						duration: 2000
-					})
-					number = 0
-				}
-			});
+				})
+				.catch((res) => {
+					if (num != 15) {
+						var data = {
+							...options,
+						}
+						sendDataToDevice({
+							...data,
+							value: totalValue,
+							// value: options.value.slice(speed,parseInt(byteLength)+parseInt(speed)*5),
+						});
+						console.log(res, '失败重新打印原因', options.value.slice(speed, byteLength), speed,
+							byteLength);
+						num++
+					} else {
+						num = 0
+						uni.showToast({
+							title: '打印失败请检查蓝牙连接状态或打印机状态',
+							icon: 'none',
+							duration: 2000
+						})
+						number = 0
+					}
+				});
+		}, 100)
 	}
 }
 export function charToArrayBuffer(str) {

+ 1 - 1
pages/order/gprint/printerjobs.js

@@ -170,7 +170,7 @@ printerJobs.prototype.printBarcode = function(content) {
 		let bar = commands.BARCODE_FORMAT;
 		// const cmds = [].concat(bar.BARCODE_TXT_OFF, bar.BARCODE_HEIGHT_DEFAULT, bar.BARCODE_WIDTH(2), bar
 		// 	.BARCODE_CODE128, content);
-		const cmds = [].concat(bar.BARCODE_TXT_BLW, bar.BARCODE_HEIGHT_DEFAULT, bar.BARCODE_WIDTH(2), bar
+		const cmds = [].concat(bar.BARCODE_TXT_OFF, bar.BARCODE_HEIGHT_DEFAULT, bar.BARCODE_WIDTH(2), bar
 			.BARCODE_CODE128, content);
 		this._enqueue(cmds);
 		// this._enqueue(commands.LF);

+ 11 - 1
pages/order/humiture.vue

@@ -69,7 +69,7 @@
 				<u-button type="primary" text="分享微信好友" @click="shareWechatFriends"></u-button>
 			</view>
 		</u-popup>
-		<u-popup :show="emailShow" mode="center" round="5" closeable @close="emailShow = false">
+		<u-popup :show="emailShow" mode="center" round="5" closeable @close="close">
 			<view style="padding: 30rpx;">
 				<view style="margin-top: 20rpx;width: 600rpx;">
 					<view class="email_title" style="margin-bottom: 10rpx;">运单号:{{waybillNo}}</view>
@@ -282,6 +282,9 @@
 							}
 						});
 						dtask.start();
+					} else {
+						this.shareShow = false
+						uni.$u.toast('发送失败')
 					}
 					uni.hideLoading()
 				}).catch(() => {
@@ -308,6 +311,9 @@
 									uni.$u.toast(res.msg)
 									this.email = ''
 									this.emailShow = false
+								} else {
+									this.emailShow = false
+									uni.$u.toast('发送失败')
 								}
 								this.sendLoading = false
 							}).catch(() => {
@@ -498,6 +504,10 @@
 				})
 				this.$forceUpdate()
 			},
+			close(){
+				this.emailShow = false
+				this.email = ''
+			},
 			getDateTime(date, addZero = true) {
 				return `${this.getDate(date, addZero)} ${this.getTime(date, addZero)}`
 			},

+ 8 - 2
pages/order/index.vue

@@ -2,7 +2,7 @@
 	<!-- 订单页面 -->
 	<view>
 		<u-navbar title="我的运单" autoBack placeholder></u-navbar>
-		<view class="tab_order">
+		<view class="tab_order" :style="{top:height + 86 + 'rpx'}">
 			<u-tabs :list="tableList" lineColor="#333333" lineWidth="40" :scrollable="scrollable" :current="current"
 				@change="tabClick"></u-tabs>
 		</view>
@@ -10,7 +10,7 @@
 			<x-orderManagement :orderList="orderList" :userInfo="userInfo" @sendmail="sendmail"
 				:key="keyId"></x-orderManagement>
 			<view style="width: 50%;">
-				<u-loadmore :status="loadStatus" />
+				<u-loadmore :status="loadStatus" :key="Math.random()" />
 				<!-- <u-divider v-if="loadingMore" :text="loading"></u-divider> -->
 			</view>
 		</view>
@@ -116,6 +116,7 @@
 				sendLoading: false,
 				loadStatus: 'loadmore', //loading 、nomore
 				keyId: 0,
+				height: 0,
 			}
 		},
 		onReachBottom() {
@@ -128,6 +129,8 @@
 			}
 		},
 		onLoad(value) {
+			const arr = uni.getSystemInfoSync().statusBarHeight
+			this.height = arr
 			if (value.current) {
 				this.current = Number(value.current)
 			}
@@ -282,6 +285,7 @@
 			},
 			close() {
 				this.emailShow = false
+				this.email = ''
 			}
 		}
 	}
@@ -289,6 +293,8 @@
 
 <style lang="scss">
 	.tab_order {
+		position: sticky;
+		z-index: 2024;
 		background-color: #fff;
 	}
 

+ 53 - 44
pages/order/quantum.vue

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

BIN
unpackage/cache/apk/__UNI__92DFF97_cm.apk


+ 1 - 1
unpackage/cache/apk/apkurl

@@ -1 +1 @@
-https://app.liuyingyong.cn/build/download/3f5b39d0-87b4-11ef-8f00-958b643295cf
+https://app.liuyingyong.cn/build/download/d3e1ea10-982e-11ef-bbb0-5953e2d0c2ce

Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 0 - 0
unpackage/cache/apk/cmManifestCache.json


Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 0 - 0
unpackage/cache/wgt/__UNI__92DFF97/app-service.js


Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 0 - 0
unpackage/cache/wgt/__UNI__92DFF97/app-view.js


Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 0 - 0
unpackage/cache/wgt/__UNI__92DFF97/manifest.json


Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 0 - 0
unpackage/dist/build/app-plus/app-service.js


Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 0 - 0
unpackage/dist/build/app-plus/app-view.js


Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 0 - 0
unpackage/dist/build/app-plus/manifest.json


Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 0 - 0
unpackage/dist/dev/app-plus/app-service.js


Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 91 - 37
unpackage/dist/dev/app-plus/app-view.js


Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 0 - 0
unpackage/dist/dev/app-plus/manifest.json


BIN
unpackage/release/apk/__UNI__92DFF97__20241016171939.apk


BIN
unpackage/release/apk/__UNI__92DFF97__20241101165356.apk


Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно