Bladeren bron

Merge branch 'master' of http://git.zthymaoyi.com/gdc/yiliangyiyun-app

gjy 2 jaren geleden
bovenliggende
commit
54d0d4497a
4 gewijzigde bestanden met toevoegingen van 116 en 54 verwijderingen
  1. 6 4
      common/helper.js
  2. 1 2
      config/index.js
  3. 2 2
      manifest.json
  4. 107 46
      pages/erpbusiness/sendCommand.vue

+ 6 - 4
common/helper.js

@@ -14,15 +14,17 @@ const isArray = Array.isArray || function(obj) {
 const getListByUserId = function() {
 const getListByUserId = function() {
 	let baseUrlNew = config.def().baseUrlNew
 	let baseUrlNew = config.def().baseUrlNew
 	var userInfo = uni.getStorageSync("userInfo")
 	var userInfo = uni.getStorageSync("userInfo")
+	var pcUserInfo = uni.getStorageSync("pcUserInfo")
 
 
 	console.log("------", userInfo)
 	console.log("------", userInfo)
-	if (userInfo) {
+	if (pcUserInfo) {
 		uni.request({
 		uni.request({
-			url: baseUrlNew + '/roleMenu/query/getListByUserId',
+			url: baseUrlNew + '/commonUser/getListByUserId',
 			data: {
 			data: {
-				userId: userInfo.id ? userInfo.id : userInfo.data.id
+				staffMobilePhone: pcUserInfo.userMobilePhone,
+				compId: pcUserInfo.compId
 			},
 			},
-			method: 'GET',
+			method: 'POST',
 			success: (res) => {
 			success: (res) => {
 				if (res.statusCode === 200) {
 				if (res.statusCode === 200) {
 					// debugger
 					// debugger

+ 1 - 2
config/index.js

@@ -1,11 +1,10 @@
 const dev = {
 const dev = {
 	baseUrl: 'https://www.zthymaoyi.com',
 	baseUrl: 'https://www.zthymaoyi.com',
 	// baseUrl: 'http://localhost:8080/',
 	// baseUrl: 'http://localhost:8080/',
-	// baseUrlNew: 'http://192.168.110.67:9888/',
+	baseUrlNew: 'http://192.168.110.67:9100/',
 	// baseUrlNew: 'http://192.168.1.118:8090/',
 	// baseUrlNew: 'http://192.168.1.118:8090/',
 	// baseUrlNew: 'http://192.168.110.9:9100/',
 	// baseUrlNew: 'http://192.168.110.9:9100/',
 	// baseUrlNew: 'http://192.168.110.138:8090/',
 	// baseUrlNew: 'http://192.168.110.138:8090/',
-	baseUrlNew: 'http://192.168.110.82:8090/',
 	// baseUrlNew: 'http://192.168.110.202:8090/',
 	// baseUrlNew: 'http://192.168.110.202:8090/',
 	// baseUrlNew: 'http://192.168.110.138:8090/',
 	// baseUrlNew: 'http://192.168.110.138:8090/',
 	// 上传图片的
 	// 上传图片的

+ 2 - 2
manifest.json

@@ -2,8 +2,8 @@
     "name" : "易粮易运",
     "name" : "易粮易运",
     "appid" : "__UNI__7297DA2",
     "appid" : "__UNI__7297DA2",
     "description" : "易粮易运——为天下粮食人服务的App",
     "description" : "易粮易运——为天下粮食人服务的App",
-    "versionName" : "2.1.155",
-    "versionCode" : 21155,
+    "versionName" : "2.1.157",
+    "versionCode" : 21157,
     "transformPx" : false,
     "transformPx" : false,
     /* SDK配置 */
     /* SDK配置 */
     "quickapp" : {},
     "quickapp" : {},

+ 107 - 46
pages/erpbusiness/sendCommand.vue

@@ -10,6 +10,7 @@
 			<view style='margin-top:4%;display: flex;flex-direction: column;'>
 			<view style='margin-top:4%;display: flex;flex-direction: column;'>
 				<button type='primary' class="btn" @tap='receiptTest' :loading='isReceiptSend'
 				<button type='primary' class="btn" @tap='receiptTest' :loading='isReceiptSend'
 					:disabled='isReceiptSend'>打印质检单小票</button>
 					:disabled='isReceiptSend'>打印质检单小票</button>
+				<button type='primary' class="btn" @tap='clearBlue'>重新连接蓝牙</button>
 				<button type='primary' class="btn" @tap='goToList'>返回列表页</button>
 				<button type='primary' class="btn" @tap='goToList'>返回列表页</button>
 				<!-- <button type='primary' @tap='labelTest' :loading='isLabelSend' :disabled='isLabelSend'>标签测试</button> -->
 				<!-- <button type='primary' @tap='labelTest' :loading='isLabelSend' :disabled='isLabelSend'>标签测试</button> -->
 			</view>
 			</view>
@@ -159,10 +160,10 @@
 		methods: {
 		methods: {
 
 
 			clearBlue() {
 			clearBlue() {
-				
+
 				let tmp = this.Bluetooth;
 				let tmp = this.Bluetooth;
 				uni.closeBLEConnection({
 				uni.closeBLEConnection({
-					deviceId:tmp.BLEInformation.deviceId
+					deviceId: tmp.BLEInformation.deviceId
 				})
 				})
 				tmp.BLEInformation.deviceId = ''
 				tmp.BLEInformation.deviceId = ''
 				this.$store.commit('BLEInformationSet', tmp);
 				this.$store.commit('BLEInformationSet', tmp);
@@ -171,7 +172,7 @@
 				// 	icon: 'none'
 				// 	icon: 'none'
 				// })
 				// })
 				uni.navigateBack({
 				uni.navigateBack({
-					delta:1
+					delta: 1
 				})
 				})
 			},
 			},
 			goToList() {
 			goToList() {
@@ -346,6 +347,7 @@
 				if (that.gridList.type == '潮粮') {
 				if (that.gridList.type == '潮粮') {
 					command.setText("单价(元/公斤):" + that.gridList.tidalGrainPrice);
 					command.setText("单价(元/公斤):" + that.gridList.tidalGrainPrice);
 				} else {
 				} else {
+					command.setText("单价(元/公斤):" + that.gridList.dryGrainPrice);
 				}
 				}
 				command.setPrint();
 				command.setPrint();
 				//杂质
 				//杂质
@@ -400,15 +402,24 @@
 			//准备发送,根据每次发送字节数来处理分包数量
 			//准备发送,根据每次发送字节数来处理分包数量
 			prepareSend(buff) {
 			prepareSend(buff) {
 				console.log(buff);
 				console.log(buff);
-				let that = this
-				let time = that.oneTimeData
-				let looptime = parseInt(buff.length / time);
-				let lastData = parseInt(buff.length % time);
-				console.log(looptime + "---" + lastData)
-				this.looptime = looptime + 1;
-				this.lastData = lastData;
-				this.currentTime = 1;
-				that.Send(buff)
+				// let that = this
+				// let time = that.oneTimeData
+				// let looptime = parseInt(buff.length / time);
+				// let lastData = parseInt(buff.length % time);
+				// console.log(looptime + "---" + lastData)
+				// this.looptime = looptime + 1;
+				// this.lastData = lastData;
+				// this.currentTime = 1;
+				// that.Send(buff)
+				var that = this;
+				var time = that.oneTimeData;
+				var looptime = parseInt(buff.length / time);
+				var lastData = parseInt(buff.length % time); //console.log(looptime + "---" + lastData)
+
+				this.looptime = looptime + 1
+				this.lastData = lastData
+				this.currentTime = 1
+				that.Send(buff);
 			},
 			},
 			//查询打印机状态
 			//查询打印机状态
 			queryStatus() {
 			queryStatus() {
@@ -441,47 +452,97 @@
 						dataView.setUint8(i, buff[(currentTime - 1) * onTimeData + i])
 						dataView.setUint8(i, buff[(currentTime - 1) * onTimeData + i])
 					}
 					}
 				}
 				}
-				console.log("第" + currentTime + "次发送数据大小为:" + buf.byteLength)
+				// console.log("第" + currentTime + "次发送数据大小为:" + buf.byteLength)
+
 				let {
 				let {
 					BLEInformation
 					BLEInformation
 				} = that.Bluetooth;
 				} = that.Bluetooth;
-
-				plus.bluetooth.writeBLECharacteristicValue({
-					deviceId: BLEInformation.deviceId,
-					serviceId: BLEInformation.writeServiceId,
-					characteristicId: BLEInformation.writeCharaterId,
-					value: buf,
-					success: function(res) {
-						console.log(res)
-					},
-					fail: function(e) {
-						console.log(e)
-					},
-					complete: function() {
-						currentTime++
-						if (currentTime <= loopTime) {
-							that.currentTime = currentTime;
-							that.Send(buff)
-						} else {
+				setTimeout(()=>{
+					uni.writeBLECharacteristicValue({
+						deviceId: BLEInformation.deviceId,
+						serviceId: BLEInformation.writeServiceId,
+						characteristicId: BLEInformation.writeCharaterId,
+						value: buf,
+						success: function(res) {
+							if (currentTime <= loopTime) {
+								// wx.showLoading({
+								//   title: '传输中...',
+								// })
+							} else {
+								uni.showToast({
+									title: '已打印第' + currentPrint + '张成功'
+								});
+							} //console.log(res)
+						},
+						fail: function(e) {
 							uni.showToast({
 							uni.showToast({
-								title: '已打印第' + currentPrint + '张',
-							})
-							if (currentPrint == printNum) {
-								that.looptime = 0;
-								that.lastData = 0;
-								that.currentTime = 1;
-								that.isReceiptSend = false;
-								that.isLabelSend = false;
-								that.currentPrint = 1;
+								title: '打印第' + currentPrint + '张失败',
+								icon: 'none'
+							});
+							 console.log(e)
+						},
+						complete: function() {
+							currentTime++;
+					
+							if (currentTime <= loopTime) {
+								that.currentTime = currentTime
+					
+								that.Send(buff);
 							} else {
 							} else {
-								currentPrint++;
-								that.currentPrint = currentPrint;
-								that.currentTime = 1;
-								that.Send(buff)
+								if (currentPrint == printNum) {
+									that.looptime = 0
+									that.lastData = 0
+									that.currentTime = 1
+									that.isReceiptSend = false
+									that.currentPrint = 1
+								} else {
+									currentPrint++;
+									that.currentPrint = currentPrint
+									that.currentTime = 1
+					
+									that.Send(buff);
+								}
 							}
 							}
 						}
 						}
-					}
-				})
+					})
+				},100);
+
+				// plus.bluetooth.writeBLECharacteristicValue({
+				// 	deviceId: BLEInformation.deviceId,
+				// 	serviceId: BLEInformation.writeServiceId,
+				// 	characteristicId: BLEInformation.writeCharaterId,
+				// 	value: buf,
+				// 	success: function(res) {
+				// 		console.log(res)
+				// 	},
+				// 	fail: function(e) {
+				// 		console.log(e)
+				// 	},
+				// 	complete: function() {
+				// 		currentTime++
+				// 		if (currentTime <= loopTime) {
+				// 			that.currentTime = currentTime;
+				// 			that.Send(buff)
+				// 		} else {
+				// 			uni.showToast({
+				// 				title: '已打印第' + currentPrint + '张',
+				// 			})
+				// 			if (currentPrint == printNum) {
+				// 				that.looptime = 0;
+				// 				that.lastData = 0;
+				// 				that.currentTime = 1;
+				// 				that.isReceiptSend = false;
+				// 				that.isLabelSend = false;
+				// 				that.currentPrint = 1;
+				// 			} else {
+				// 				currentPrint++;
+				// 				that.currentPrint = currentPrint;
+				// 				that.currentTime = 1;
+				// 				that.Send(buff)
+				// 			}
+				// 		}
+				// 	}
+				// })
 			},
 			},
 			buffBindChange: function(res) { //更改打印字节数
 			buffBindChange: function(res) { //更改打印字节数
 				let index = res.detail.value
 				let index = res.detail.value