Browse Source

蓝牙打印机打印运单适配

unknown 2 weeks ago
parent
commit
aa0b92dddf

+ 2 - 2
manifest.json

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

+ 2 - 1
pages/order/delivery.vue

@@ -85,7 +85,8 @@
 					<u-search placeholder="请输入保温箱名称" v-model="keyword" :showAction="false"
 					<u-search placeholder="请输入保温箱名称" v-model="keyword" :showAction="false"
 						@change="searchChange"></u-search>
 						@change="searchChange"></u-search>
 				</view>
 				</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' : ''"
 					<view class="card_title_item" :class="item.name == incubatorName ? 'color_blue' : ''"
 						v-for="(item,index) in incubatorData" :key="index" @click="incubatorClick(item)">
 						v-for="(item,index) in incubatorData" :key="index" @click="incubatorClick(item)">
 						{{item.name}}
 						{{item.name}}

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

@@ -271,51 +271,54 @@ export function sendDataToDevice(options) {
 	//这里默认一次20个字节发送
 	//这里默认一次20个字节发送
 	const speed = options.onceLength; //20; 
 	const speed = options.onceLength; //20; 
 	if (byteLength > 0) {
 	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) {
 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;
 		let bar = commands.BARCODE_FORMAT;
 		// const cmds = [].concat(bar.BARCODE_TXT_OFF, 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);
 		// 	.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);
 			.BARCODE_CODE128, content);
 		this._enqueue(cmds);
 		this._enqueue(cmds);
 		// this._enqueue(commands.LF);
 		// this._enqueue(commands.LF);

+ 11 - 1
pages/order/humiture.vue

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

+ 8 - 2
pages/order/index.vue

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

+ 53 - 44
pages/order/quantum.vue

@@ -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) {

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

File diff suppressed because it is too large
+ 0 - 0
unpackage/cache/apk/cmManifestCache.json


File diff suppressed because it is too large
+ 0 - 0
unpackage/cache/wgt/__UNI__92DFF97/app-service.js


File diff suppressed because it is too large
+ 0 - 0
unpackage/cache/wgt/__UNI__92DFF97/app-view.js


File diff suppressed because it is too large
+ 0 - 0
unpackage/cache/wgt/__UNI__92DFF97/manifest.json


File diff suppressed because it is too large
+ 0 - 0
unpackage/dist/build/app-plus/app-service.js


File diff suppressed because it is too large
+ 0 - 0
unpackage/dist/build/app-plus/app-view.js


File diff suppressed because it is too large
+ 0 - 0
unpackage/dist/build/app-plus/manifest.json


File diff suppressed because it is too large
+ 0 - 0
unpackage/dist/dev/app-plus/app-service.js


File diff suppressed because it is too large
+ 91 - 37
unpackage/dist/dev/app-plus/app-view.js


File diff suppressed because it is too large
+ 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


Some files were not shown because too many files changed in this diff