From 267c714e5426754f10bdcbdfb9cfc964e5d5db86 Mon Sep 17 00:00:00 2001 From: Kravtsov Vitaly Date: Wed, 29 Nov 2023 16:25:47 +0300 Subject: [PATCH] [-] Fixed error with text journal --- History.txt | 7 +++++++ .../command/TextDocumentFilter.java | 17 +++++------------ .../src/com/shtrih/util/ServiceVersion.java | 2 +- .../command/TextDocumentFilterTest.java | 6 ------ Source/FiscalPrinterTest/src/PrinterTest.java | 13 ------------- 5 files changed, 13 insertions(+), 32 deletions(-) diff --git a/History.txt b/History.txt index 94bd431e..33c6ac80 100644 --- a/History.txt +++ b/History.txt @@ -5,6 +5,13 @@ Company : SHTRIH-M www.shtrih-m.ru (495) 787-6090 Url : https://github.com/shtrih-m/javapos_shtrih +******************************************************************************** + + 29.11.2023 + deviceServiceVersion = 1013706 + + [-] Fixed error with text journal + ******************************************************************************** 27.10.2023 diff --git a/Source/Core/src/com/shtrih/fiscalprinter/command/TextDocumentFilter.java b/Source/Core/src/com/shtrih/fiscalprinter/command/TextDocumentFilter.java index 4ae6198d..fc1926d9 100644 --- a/Source/Core/src/com/shtrih/fiscalprinter/command/TextDocumentFilter.java +++ b/Source/Core/src/com/shtrih/fiscalprinter/command/TextDocumentFilter.java @@ -68,8 +68,7 @@ public class TextDocumentFilter implements IPrinterEvents { private static String SDayClosed = "СМЕНА ЗАКРЫТА"; public static final String SINN = "ИНН"; private static String[] docNames = {SSaleText, SBuyText, SRetSaleText, SRetBuyText}; - public boolean receiptEnabled = false; - public boolean isDocumentActive = false; + private boolean documentActive = false; private final List lines = new ArrayList(); @@ -141,13 +140,13 @@ public void afterCommand(PrinterCommand command) throws Exception { switch (command.getCode()) { case 0x17: - if (isDocumentActive){ + if (documentActive){ add(((PrintString) command).getLine()); } break; case 0x2F: - if (isDocumentActive){ + if (documentActive){ add(((PrintStringFont) command).getLine()); } break; @@ -393,40 +392,34 @@ private String getPaymentName(int paymentIndex) throws Exception } private void printSale(PrintSale command) throws Exception { - if (!receiptEnabled) return; operatorNumber = command.getOperator(); openReceipt2(PrinterConst.SMFP_RECTYPE_SALE); printReceiptItem(command.getItem()); } private void printSale(FSPrintRecItem command) throws Exception { - if (!receiptEnabled) return; printReceiptItem(command.getItem()); } private void printRefund(PrintRefund command) throws Exception { - if (!receiptEnabled) return; operatorNumber = command.getOperator(); openReceipt2(PrinterConst.SMFP_RECTYPE_BUY); printReceiptItem(command.getItem()); } private void printVoidSale(PrintVoidSale command) throws Exception { - if (!receiptEnabled) return; operatorNumber = command.getOperator(); openReceipt2(PrinterConst.SMFP_RECTYPE_RETSALE); printReceiptItem(command.getItem()); } private void printVoidRefund(PrintVoidRefund command) throws Exception { - if (!receiptEnabled) return; operatorNumber = command.getOperator(); openReceipt2(PrinterConst.SMFP_RECTYPE_RETBUY); printReceiptItem(command.getItem()); } private void printVoidItem(PrintVoidItem command) throws Exception { - if (!receiptEnabled) return; operatorNumber = command.getOperator(); PriceItem item = command.getItem(); // Line 1 @@ -704,12 +697,12 @@ public void add(String text, long value) throws Exception { private void beginDocument() throws Exception { printReceiptHeader(); - isDocumentActive = true; + documentActive = true; lines.clear(); } private void endDocument() throws Exception { - isDocumentActive = false; + documentActive = false; } private void printReceiptHeader() throws Exception { diff --git a/Source/FiscalPrinterService/src/com/shtrih/util/ServiceVersion.java b/Source/FiscalPrinterService/src/com/shtrih/util/ServiceVersion.java index 52028f86..5bfae374 100644 --- a/Source/FiscalPrinterService/src/com/shtrih/util/ServiceVersion.java +++ b/Source/FiscalPrinterService/src/com/shtrih/util/ServiceVersion.java @@ -1,5 +1,5 @@ package com.shtrih.util; public class ServiceVersion { - public static final String VERSION = "704-4-g8c32f1c0"; + public static final String VERSION = "704-5-g552eb5e3"; } \ No newline at end of file diff --git a/Source/FiscalPrinterService/test/com/shtrih/fiscalprinter/command/TextDocumentFilterTest.java b/Source/FiscalPrinterService/test/com/shtrih/fiscalprinter/command/TextDocumentFilterTest.java index 60ba61cd..d76ac33e 100644 --- a/Source/FiscalPrinterService/test/com/shtrih/fiscalprinter/command/TextDocumentFilterTest.java +++ b/Source/FiscalPrinterService/test/com/shtrih/fiscalprinter/command/TextDocumentFilterTest.java @@ -77,7 +77,6 @@ public void test_print_sale_command() throws Exception item.setText("Item 1"); PrintSale command = new PrintSale(30, item); printer.getOperationRegisters().put(new Integer(156), new Integer(1234)); - filter.receiptEnabled = true; assertEquals(0, filter.getLines().size()); filter.init(printer); @@ -105,7 +104,6 @@ public void test_print_refund_command() throws Exception item.setText("Item 1"); PrintRefund command = new PrintRefund(30, item); printer.getOperationRegisters().put(new Integer(156), new Integer(1234)); - filter.receiptEnabled = true; assertEquals(0, filter.getLines().size()); filter.init(printer); @@ -133,7 +131,6 @@ public void test_print_void_sale_command() throws Exception item.setText("Item 1"); PrintVoidSale command = new PrintVoidSale(30, item); printer.getOperationRegisters().put(new Integer(156), new Integer(1234)); - filter.receiptEnabled = true; assertEquals(0, filter.getLines().size()); filter.init(printer); @@ -161,7 +158,6 @@ public void test_print_void_refund_command() throws Exception item.setText("Item 1"); PrintVoidRefund command = new PrintVoidRefund(30, item); printer.getOperationRegisters().put(new Integer(156), new Integer(1234)); - filter.receiptEnabled = true; assertEquals(0, filter.getLines().size()); filter.init(printer); @@ -190,7 +186,6 @@ public void test_print_sale_command2() throws Exception item.setText("Item 1"); PrintSale command = new PrintSale(30, item); printer.getOperationRegisters().put(new Integer(156), new Integer(1234)); - filter.receiptEnabled = true; assertEquals(0, filter.getLines().size()); filter.init(printer); @@ -207,7 +202,6 @@ public void test_print_sale_command2() throws Exception public void test_void_receipt_command() throws Exception { VoidFiscalReceipt command = new VoidFiscalReceipt(); - filter.receiptEnabled = true; assertEquals(0, filter.getLines().size()); filter.init(printer); diff --git a/Source/FiscalPrinterTest/src/PrinterTest.java b/Source/FiscalPrinterTest/src/PrinterTest.java index 40f63045..4a169bac 100644 --- a/Source/FiscalPrinterTest/src/PrinterTest.java +++ b/Source/FiscalPrinterTest/src/PrinterTest.java @@ -3974,24 +3974,11 @@ public void printFiscalReceipt145_5() { public void printFiscalReceipt145_7() { - String QRCodeData = "010464007801637221AgqLybqxM9MbR\u001d91FFD0\u001d92dGVzdL31KAYL0YT6592MjmW7a2HkF3IY+muf2pVSKdQ="; - byte[] data = QRCodeData.getBytes(); - try { printer.resetPrinter(); printer.setFiscalReceiptType(SmFptrConst.SMFPTR_RT_SALE); printer.beginFiscalReceipt(false); - printer.printRecMessage("printRecMessage 1"); - printer.fsWriteTag(1008, "foo@example.com"); - - TLVWriter tlvWriter = new TLVWriter(); - tlvWriter.add(1227, "БЕТА ООО"); - tlvWriter.add(1228, "9705069985"); - printer.fsWriteTag(1256, tlvWriter.getBytes()); - - printer.setItemCode(QRCodeData, true); printer.printRecItem("1. Item1", 124, 123000, 0, 124, ""); - printer.addItemCode(data, true); printer.printRecItem("2. Item2", 124, 123400, 0, 124, ""); printer.printRecTotal(10000, 10000, ""); printer.endFiscalReceipt(false);