|
@@ -153,13 +153,16 @@ export default {
|
|
|
barCode: data.barCode, // 商品条码
|
|
|
customerName: data.customerName, //客户名
|
|
|
number: data.number, // 单据编号
|
|
|
+ batchNumber: data.batchNumber, // 单据编号
|
|
|
+ type: data.type, // 入库:1 出库;2
|
|
|
+ status: data.status, // 订单状态 入库状态为2才有批次号,出库不显示批次号
|
|
|
};
|
|
|
try {
|
|
|
let cellWidth = 6;
|
|
|
if (obj.qrCode.length > 30) cellWidth = 4;
|
|
|
if (obj.qrCode.length > 60) cellWidth = 2;
|
|
|
|
|
|
- const startX = 80;
|
|
|
+ const startX = 50;
|
|
|
const startY = 30;
|
|
|
const qrcodeX = startX;
|
|
|
const qrcodeY = startY;
|
|
@@ -172,48 +175,101 @@ export default {
|
|
|
const barcodeY =
|
|
|
Math.max(qrcodeY + qrcodeSize, textStartY + textLineHeight * 3) + 15;
|
|
|
const barcodeHeight = 50;
|
|
|
-
|
|
|
- const tspl = await vm.$printer
|
|
|
- .tspl()
|
|
|
- .clear()
|
|
|
- .page(new TPage({ width: 76, height: 130 }))
|
|
|
- .qrcode(
|
|
|
- new TQRCode({
|
|
|
- x: qrcodeX,
|
|
|
- y: qrcodeY,
|
|
|
- content: obj.qrCode,
|
|
|
- cellWidth,
|
|
|
- })
|
|
|
- )
|
|
|
- .text(
|
|
|
- new TText({
|
|
|
- x: textStartX,
|
|
|
- y: textStartY,
|
|
|
- content: obj.customerName,
|
|
|
- font: TFont.TSS24,
|
|
|
- })
|
|
|
- )
|
|
|
- .text(
|
|
|
- new TText({
|
|
|
- x: textStartX,
|
|
|
- y: textStartY + textLineHeight * 2,
|
|
|
- content: obj.number,
|
|
|
- font: TFont.TSS24,
|
|
|
- })
|
|
|
- )
|
|
|
- .barcode(
|
|
|
- new TBarCode({
|
|
|
- x: barcodeX,
|
|
|
- y: barcodeY,
|
|
|
- cellWidth: 2,
|
|
|
- height: barcodeHeight,
|
|
|
- content: obj.barCode,
|
|
|
- rotation: TRotation.ROTATION_0,
|
|
|
- codeType: TCodeType.CODE128,
|
|
|
- showType: 2,
|
|
|
- })
|
|
|
- )
|
|
|
- .print(num);
|
|
|
+ console.log("obj==========", obj);
|
|
|
+ let tspl;
|
|
|
+ if (obj.type == 2) {
|
|
|
+ tspl = await vm.$printer
|
|
|
+ .tspl()
|
|
|
+ .clear()
|
|
|
+ .page(new TPage({ width: 76, height: 130 }))
|
|
|
+ .qrcode(
|
|
|
+ new TQRCode({
|
|
|
+ x: qrcodeX,
|
|
|
+ y: qrcodeY,
|
|
|
+ content: obj.qrCode,
|
|
|
+ cellWidth,
|
|
|
+ })
|
|
|
+ )
|
|
|
+ .text(
|
|
|
+ new TText({
|
|
|
+ x: textStartX,
|
|
|
+ y: textStartY,
|
|
|
+ content: obj.customerName,
|
|
|
+ font: TFont.TSS24,
|
|
|
+ })
|
|
|
+ )
|
|
|
+ .text(
|
|
|
+ new TText({
|
|
|
+ x: textStartX,
|
|
|
+ y: textStartY + textLineHeight * 2,
|
|
|
+ content: obj.number,
|
|
|
+ font: TFont.TSS24,
|
|
|
+ })
|
|
|
+ )
|
|
|
+ .barcode(
|
|
|
+ new TBarCode({
|
|
|
+ x: barcodeX,
|
|
|
+ y: barcodeY,
|
|
|
+ cellWidth: 2,
|
|
|
+ height: barcodeHeight,
|
|
|
+ content: `${obj.barCode}`,
|
|
|
+ rotation: TRotation.ROTATION_0,
|
|
|
+ codeType: TCodeType.CODE128,
|
|
|
+ showType: 2,
|
|
|
+ })
|
|
|
+ )
|
|
|
+ .print(num);
|
|
|
+ } else {
|
|
|
+ if (obj.status == 2) {
|
|
|
+ tspl = await vm.$printer
|
|
|
+ .tspl()
|
|
|
+ .clear()
|
|
|
+ .page(new TPage({ width: 76, height: 130 }))
|
|
|
+ .barcode(
|
|
|
+ new TBarCode({
|
|
|
+ x: 50,
|
|
|
+ y: 30,
|
|
|
+ cellWidth: 2,
|
|
|
+ height: 100,
|
|
|
+ content: `${obj.barCode}`,
|
|
|
+ rotation: TRotation.ROTATION_0,
|
|
|
+ codeType: TCodeType.CODE128,
|
|
|
+ showType: 2,
|
|
|
+ })
|
|
|
+ )
|
|
|
+ .barcode(
|
|
|
+ new TBarCode({
|
|
|
+ x: 50,
|
|
|
+ y: 30 + 100 + 50,
|
|
|
+ cellWidth: 2,
|
|
|
+ height: 50,
|
|
|
+ content: `${obj.batchNumber}`,
|
|
|
+ rotation: TRotation.ROTATION_0,
|
|
|
+ codeType: TCodeType.CODE128,
|
|
|
+ showType: 2,
|
|
|
+ })
|
|
|
+ )
|
|
|
+ .print(num);
|
|
|
+ } else {
|
|
|
+ tspl = await vm.$printer
|
|
|
+ .tspl()
|
|
|
+ .clear()
|
|
|
+ .page(new TPage({ width: 76, height: 130 }))
|
|
|
+ .barcode(
|
|
|
+ new TBarCode({
|
|
|
+ x: 50,
|
|
|
+ y: 30,
|
|
|
+ cellWidth: 2,
|
|
|
+ height: 100,
|
|
|
+ content: `${obj.barCode}`,
|
|
|
+ rotation: TRotation.ROTATION_0,
|
|
|
+ codeType: TCodeType.CODE128,
|
|
|
+ showType: 2,
|
|
|
+ })
|
|
|
+ )
|
|
|
+ .print(num);
|
|
|
+ }
|
|
|
+ }
|
|
|
var binary = tspl.command().binary();
|
|
|
await sendMessage(Array.from(uint8ArrayToSignedArray(binary)));
|
|
|
} catch (e) {
|
|
@@ -228,7 +284,7 @@ export default {
|
|
|
await this.writeTsplModel(data, num);
|
|
|
},
|
|
|
//条码逻辑
|
|
|
- async handlePrint(id) {
|
|
|
+ async handlePrint(id, type, status) {
|
|
|
try {
|
|
|
uni.showLoading({
|
|
|
mask: true,
|
|
@@ -236,11 +292,16 @@ export default {
|
|
|
const res = await printMaterial({ id });
|
|
|
console.log("item===id==", id);
|
|
|
console.log("res=====", res);
|
|
|
+ console.log("type=====", type);
|
|
|
+ console.log("status=====", status);
|
|
|
if (res.code == 200) {
|
|
|
const data = {
|
|
|
customerName: res.data.customerName,
|
|
|
number: res.data.number,
|
|
|
barCode: res.data.barCode,
|
|
|
+ batchNumber: res.data.batchNumber,
|
|
|
+ type,
|
|
|
+ status,
|
|
|
};
|
|
|
this.openBlePrintPop(data);
|
|
|
} else {
|