|
@@ -206,239 +206,179 @@
|
|
|
//编号
|
|
|
// command.rowSpace(10);
|
|
|
if (that.gridList.qualityNo) {
|
|
|
- command.setText(that.gridList.qualityNo.substring(that.gridList.qualityNo.length - 3));
|
|
|
command.bold(3); //加粗
|
|
|
- command.setFontSize(0); //字体大小
|
|
|
+ command.setFontSize(36); //字体大小
|
|
|
command.setSelectJustification(1) //居中
|
|
|
command.rowSpace(200);
|
|
|
- command.setPrint();
|
|
|
- // command.rowSpace(60);
|
|
|
- // command.bold(0); //取消加粗
|
|
|
- // command.setFontSize(0); //正常字体
|
|
|
+ command.setText(that.gridList.qualityNo.substring(that.gridList.qualityNo.length - 3));
|
|
|
+ } else {
|
|
|
+ uni.showToast('编号错误!')
|
|
|
}
|
|
|
|
|
|
|
|
|
- // 标题
|
|
|
+ command.setPrint();
|
|
|
+ command.rowSpace(60);
|
|
|
+ command.bold(0); //取消加粗
|
|
|
+ command.setFontSize(0); //正常字体
|
|
|
|
|
|
- command.setText("粮食质检单");
|
|
|
+ // 标题
|
|
|
command.bold(1); //加粗
|
|
|
- command.setFontSize(0); //字体大小
|
|
|
+ command.setFontSize(16); //字体大小
|
|
|
command.setSelectJustification(1) //居中
|
|
|
- command.rowSpace(60);
|
|
|
// command.rowSpace(10);
|
|
|
+ command.setText("粮食质检单");
|
|
|
command.setPrint();
|
|
|
-
|
|
|
+ command.rowSpace(60);
|
|
|
+ command.bold(0); //取消加粗
|
|
|
+ command.setFontSize(0); //正常字体
|
|
|
// 二维码
|
|
|
+ command.rowSpace(60);
|
|
|
command.setSelectSizeOfModuleForQRCode(5);
|
|
|
command.setSelectErrorCorrectionLevelForQRCode(7)
|
|
|
command.setStoreQRCodeData(that.gridList.compId + '&' + that.gridList.qualityNo + '&' + that.gridList
|
|
|
.warehouseId);
|
|
|
- command.rowSpace(60);
|
|
|
command.setPrintQRCode();
|
|
|
-
|
|
|
//客户姓名
|
|
|
-
|
|
|
- command.setText("客户姓名:" + that.gridList.customerName);
|
|
|
- command.setFontSize(0); //字体大小
|
|
|
command.setSelectJustification(0); //居左
|
|
|
command.setLeftMargin(30)
|
|
|
+ command.setText("客户姓名:" + that.gridList.customerName);
|
|
|
command.setPrint();
|
|
|
//客户身份证
|
|
|
-
|
|
|
- command.setText("客户身份证:" + that.gridList.customerNumberCard);
|
|
|
- command.setFontSize(0); //字体大小
|
|
|
command.setSelectJustification(0); //居左
|
|
|
command.setLeftMargin(30)
|
|
|
+ command.setText("客户身份证:" + that.gridList.customerNumberCard);
|
|
|
command.setPrint();
|
|
|
-
|
|
|
//客户电话
|
|
|
-
|
|
|
- command.setText("客户电话:" + that.gridList.customerPhone);
|
|
|
- command.setFontSize(0); //字体大小
|
|
|
command.setSelectJustification(0); //居左
|
|
|
command.setLeftMargin(30)
|
|
|
+ command.setText("客户电话:" + that.gridList.customerPhone);
|
|
|
command.setPrint();
|
|
|
-
|
|
|
//车牌号
|
|
|
-
|
|
|
- command.setText("车牌号:" + that.gridList.carNumber);
|
|
|
- command.setFontSize(0); //字体大小
|
|
|
command.setSelectJustification(0); //居左
|
|
|
command.setLeftMargin(30)
|
|
|
+ command.setText("车牌号:" + that.gridList.carNumber);
|
|
|
command.setPrint();
|
|
|
-
|
|
|
if (that.gridList.boxNo) {
|
|
|
//箱号
|
|
|
-
|
|
|
- command.setText("箱号-1:" + that.gridList.boxNo);
|
|
|
- command.setFontSize(0); //字体大小
|
|
|
command.setSelectJustification(0); //居左
|
|
|
command.setLeftMargin(30)
|
|
|
+ command.setText("箱号-1:" + that.gridList.boxNo);
|
|
|
command.setPrint();
|
|
|
}
|
|
|
if (that.gridList.boxNoOther) {
|
|
|
//箱号
|
|
|
-
|
|
|
- command.setText("箱号-2:" + that.gridList.boxNoOther);
|
|
|
- command.setFontSize(0); //字体大小
|
|
|
command.setSelectJustification(0); //居左
|
|
|
command.setLeftMargin(30)
|
|
|
+ command.setText("箱号-2:" + that.gridList.boxNoOther);
|
|
|
command.setPrint();
|
|
|
}
|
|
|
if (that.gridList.titleNo) {
|
|
|
//封号
|
|
|
-
|
|
|
- command.setText("封号-1:" + that.gridList.titleNo);
|
|
|
- command.setFontSize(0); //字体大小
|
|
|
command.setSelectJustification(0); //居左
|
|
|
command.setLeftMargin(30)
|
|
|
+ command.setText("封号-1:" + that.gridList.titleNo);
|
|
|
command.setPrint();
|
|
|
}
|
|
|
if (that.gridList.titleNoOther) {
|
|
|
//封号
|
|
|
-
|
|
|
- command.setText("封号-2:" + that.gridList.titleNoOther);
|
|
|
- command.setFontSize(0); //字体大小
|
|
|
command.setSelectJustification(0); //居左
|
|
|
command.setLeftMargin(30)
|
|
|
+ command.setText("封号-2:" + that.gridList.titleNoOther);
|
|
|
command.setPrint();
|
|
|
}
|
|
|
//仓位号
|
|
|
-
|
|
|
- command.setText("仓位号:" + that.gridList.binNumber);
|
|
|
- command.setFontSize(0); //字体大小
|
|
|
command.setSelectJustification(0); //居左
|
|
|
command.setLeftMargin(30)
|
|
|
+ command.setText("仓位号:" + that.gridList.binNumber);
|
|
|
command.setPrint();
|
|
|
//收货单位
|
|
|
-
|
|
|
- command.setText("收货单位:" + that.gridList.compName);
|
|
|
- command.setFontSize(0); //字体大小
|
|
|
command.setSelectJustification(0); //居左
|
|
|
command.setLeftMargin(30)
|
|
|
+ command.setText("收货单位:" + that.gridList.compName);
|
|
|
command.setPrint();
|
|
|
//联系人
|
|
|
-
|
|
|
- command.setText("联系人:" + that.gridList.person);
|
|
|
- command.setFontSize(0); //字体大小
|
|
|
command.setSelectJustification(0); //居左
|
|
|
command.setLeftMargin(30)
|
|
|
+ command.setText("联系人:" + that.gridList.person);
|
|
|
command.setPrint();
|
|
|
-
|
|
|
//联系电话
|
|
|
-
|
|
|
- command.setText("联系电话:" + that.gridList.personPhone);
|
|
|
- command.setFontSize(0); //字体大小
|
|
|
command.setSelectJustification(0); //居左
|
|
|
command.setLeftMargin(30)
|
|
|
+ command.setText("联系电话:" + that.gridList.personPhone);
|
|
|
command.setPrint();
|
|
|
-
|
|
|
//货名
|
|
|
- command.setText("货名:" + that.gridList.goodsName);
|
|
|
- command.setFontSize(0); //字体大小
|
|
|
command.setSelectJustification(0); //居左
|
|
|
command.setLeftMargin(30)
|
|
|
+ command.setText("货名:" + that.gridList.goodsName);
|
|
|
command.setPrint();
|
|
|
-
|
|
|
//类型
|
|
|
-
|
|
|
- command.setText("类型:" + that.gridList.type);
|
|
|
- command.setFontSize(0); //字体大小
|
|
|
command.setSelectJustification(0); //居左
|
|
|
command.setLeftMargin(30)
|
|
|
+ command.setText("类型:" + that.gridList.type);
|
|
|
command.setPrint();
|
|
|
-
|
|
|
//容量
|
|
|
-
|
|
|
- command.setText("容量(克/升):" + that.gridList.bulkDensity);
|
|
|
- command.setFontSize(0); //字体大小
|
|
|
command.setSelectJustification(0); //居左
|
|
|
command.setLeftMargin(30)
|
|
|
+ command.setText("容量(克/升):" + that.gridList.bulkDensity);
|
|
|
command.setPrint();
|
|
|
-
|
|
|
//不完善粒
|
|
|
-
|
|
|
- command.setText("不完善粒(%):" + that.gridList.imperfectGrain);
|
|
|
- command.setFontSize(0); //字体大小
|
|
|
command.setSelectJustification(0); //居左
|
|
|
command.setLeftMargin(30)
|
|
|
+ command.setText("不完善粒(%):" + that.gridList.imperfectGrain);
|
|
|
command.setPrint();
|
|
|
-
|
|
|
//等级
|
|
|
-
|
|
|
- command.setText("等级:" + that.gridList.grade);
|
|
|
- command.setFontSize(0); //字体大小
|
|
|
command.setSelectJustification(0); //居左
|
|
|
command.setLeftMargin(30)
|
|
|
+ command.setText("等级:" + that.gridList.grade);
|
|
|
command.setPrint();
|
|
|
-
|
|
|
//水分
|
|
|
- command.setText("水分(%):" + that.gridList.waterContent);
|
|
|
- command.setFontSize(0); //字体大小
|
|
|
command.setSelectJustification(0); //居左
|
|
|
command.setLeftMargin(30)
|
|
|
+ command.setText("水分(%):" + that.gridList.waterContent);
|
|
|
command.setPrint();
|
|
|
//热损伤
|
|
|
-
|
|
|
- command.setText("热损伤(%):" + that.gridList.jiaorenli);
|
|
|
- command.setFontSize(0); //字体大小
|
|
|
command.setSelectJustification(0); //居左
|
|
|
command.setLeftMargin(30)
|
|
|
+ command.setText("热损伤(%):" + that.gridList.jiaorenli);
|
|
|
command.setPrint();
|
|
|
//单价
|
|
|
+ command.setSelectJustification(0); //居左
|
|
|
+ command.setLeftMargin(30)
|
|
|
if (that.gridList.type == '潮粮') {
|
|
|
command.setText("单价(元/公斤):" + that.gridList.tidalGrainPrice);
|
|
|
- command.setFontSize(0); //字体大小
|
|
|
- command.setSelectJustification(0); //居左
|
|
|
- command.setLeftMargin(30)
|
|
|
- command.setPrint();
|
|
|
+ } else {
|
|
|
+ command.setText("单价(元/公斤):" + that.gridList.dryGrainPrice);
|
|
|
}
|
|
|
-
|
|
|
+ command.setPrint();
|
|
|
//杂质
|
|
|
-
|
|
|
- command.setText("杂质(%):" + that.gridList.impurity);
|
|
|
- command.setFontSize(0); //字体大小
|
|
|
command.setSelectJustification(0); //居左
|
|
|
command.setLeftMargin(30)
|
|
|
+ command.setText("杂质(%):" + that.gridList.impurity);
|
|
|
command.setPrint();
|
|
|
-
|
|
|
//霉变粒
|
|
|
-
|
|
|
- command.setText("霉变粒(%):" + that.gridList.mildewGrain);
|
|
|
- command.setFontSize(0); //字体大小
|
|
|
command.setSelectJustification(0); //居左
|
|
|
command.setLeftMargin(30)
|
|
|
+ command.setText("霉变粒(%):" + that.gridList.mildewGrain);
|
|
|
command.setPrint();
|
|
|
-
|
|
|
//购粮性质
|
|
|
- command.setText("购粮性质:" + that.gridList.natureOfGrainPurchase);
|
|
|
- command.setFontSize(0); //字体大小
|
|
|
command.setSelectJustification(0); //居左
|
|
|
command.setLeftMargin(30)
|
|
|
+ command.setText("购粮性质:" + that.gridList.natureOfGrainPurchase);
|
|
|
command.setPrint();
|
|
|
-
|
|
|
//仓位号
|
|
|
-
|
|
|
- command.setText("仓位号:" + that.gridList.binNumber);
|
|
|
- command.setFontSize(0); //字体大小
|
|
|
command.setSelectJustification(0); //居左
|
|
|
command.setLeftMargin(30)
|
|
|
+ command.setText("仓位号:" + that.gridList.binNumber);
|
|
|
command.setPrint();
|
|
|
-
|
|
|
//囤位号
|
|
|
-
|
|
|
- command.setText("囤位号:" + that.gridList.storageTagNo);
|
|
|
- command.setFontSize(0); //字体大小
|
|
|
command.setSelectJustification(0); //居左
|
|
|
command.setLeftMargin(30)
|
|
|
+ command.setText("囤位号:" + that.gridList.storageTagNo);
|
|
|
command.setPrint();
|
|
|
-
|
|
|
//质检员
|
|
|
-
|
|
|
- command.setText("质检员:" + that.gridList.qualityInspector);
|
|
|
- command.setFontSize(0); //字体大小
|
|
|
command.setSelectJustification(0); //居左
|
|
|
command.setLeftMargin(30)
|
|
|
+ command.setText("质检员:" + that.gridList.qualityInspector);
|
|
|
command.setPrint();
|
|
|
//客户签名
|
|
|
// command.rowSpace(100);
|
|
@@ -448,11 +388,9 @@
|
|
|
// command.setPrint();
|
|
|
// command.rowSpace(100);
|
|
|
//收货单位签名或盖章
|
|
|
-
|
|
|
- command.setText("收货单位签名或盖章:");
|
|
|
- command.setFontSize(0); //字体大小
|
|
|
command.setSelectJustification(0); //居左
|
|
|
command.setLeftMargin(30)
|
|
|
+ command.setText("收货单位签名或盖章:");
|
|
|
command.setPrintAndFeed(150);
|
|
|
command.setPrintAndFeedRow(10);
|
|
|
that.isReceiptSend = true;
|
|
@@ -514,58 +452,60 @@
|
|
|
dataView.setUint8(i, buff[(currentTime - 1) * onTimeData + i])
|
|
|
}
|
|
|
}
|
|
|
- console.log("第" + currentTime + "次发送数据大小为:" + buf.byteLength)
|
|
|
+ // console.log("第" + currentTime + "次发送数据大小为:" + buf.byteLength)
|
|
|
|
|
|
let {
|
|
|
BLEInformation
|
|
|
} = that.Bluetooth;
|
|
|
-
|
|
|
- uni.writeBLECharacteristicValue({
|
|
|
- deviceId: BLEInformation.deviceId,
|
|
|
- serviceId: BLEInformation.writeServiceId,
|
|
|
- characteristicId: BLEInformation.writeCharaterId,
|
|
|
- value: buf,
|
|
|
- success: function(res) {
|
|
|
- if (currentTime <= loopTime) {
|
|
|
- // wx.showLoading({
|
|
|
- // title: '传输中...',
|
|
|
- // })
|
|
|
- } 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({
|
|
|
- title: '已打印第' + currentPrint + '张成功'
|
|
|
+ title: '打印第' + currentPrint + '张失败',
|
|
|
+ icon: 'none'
|
|
|
});
|
|
|
- } //console.log(res)
|
|
|
- },
|
|
|
- fail: function(e) {
|
|
|
- uni.showToast({
|
|
|
- title: '打印第' + currentPrint + '张失败',
|
|
|
- icon: 'none'
|
|
|
- }); //console.log(e)
|
|
|
- },
|
|
|
- complete: function() {
|
|
|
- currentTime++;
|
|
|
-
|
|
|
- if (currentTime <= loopTime) {
|
|
|
- that.currentTime = currentTime
|
|
|
-
|
|
|
- that.Send(buff);
|
|
|
- } else {
|
|
|
- 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
|
|
|
-
|
|
|
+ console.log(e)
|
|
|
+ },
|
|
|
+ complete: function() {
|
|
|
+ currentTime++;
|
|
|
+
|
|
|
+ if (currentTime <= loopTime) {
|
|
|
+ that.currentTime = currentTime
|
|
|
+
|
|
|
that.Send(buff);
|
|
|
+ } else {
|
|
|
+ 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,
|