From 552eb5e3d1a939d05402287478f0356828723d90 Mon Sep 17 00:00:00 2001 From: Kravtsov Vitaly Date: Tue, 28 Nov 2023 17:01:39 +0300 Subject: [PATCH] [-] Minor changes --- .../command/TextReportStorage.java | 2 +- .../src/com/shtrih/util/ServiceVersion.java | 2 +- .../fiscalprinter/TextReportStorageTests.java | 13 ++++++---- Source/FiscalPrinterTest/Res/PPPConfig.json | 18 -------------- Source/FiscalPrinterTest/Res/jpos.xml | 2 +- Source/FiscalPrinterTest/Res/test.bat | 21 ---------------- Source/FiscalPrinterTest/Res/test.sh | 24 ------------------- Source/FiscalPrinterTest/src/PrinterTest.java | 4 ++++ 8 files changed, 15 insertions(+), 71 deletions(-) delete mode 100644 Source/FiscalPrinterTest/Res/PPPConfig.json delete mode 100644 Source/FiscalPrinterTest/Res/test.bat delete mode 100644 Source/FiscalPrinterTest/Res/test.sh diff --git a/Source/Core/src/com/shtrih/fiscalprinter/command/TextReportStorage.java b/Source/Core/src/com/shtrih/fiscalprinter/command/TextReportStorage.java index 92446625..2ba980c8 100644 --- a/Source/Core/src/com/shtrih/fiscalprinter/command/TextReportStorage.java +++ b/Source/Core/src/com/shtrih/fiscalprinter/command/TextReportStorage.java @@ -107,7 +107,7 @@ private int findNextDocument(List lines, int index) { } private boolean isDocumentHeader(String line) { - return line.contains(TextDocumentFilter.SINN); + return line.contains(TextDocumentFilter.SINN) && line.contains("№"); } private List copyLines(List lines, int index1, int index2) { diff --git a/Source/FiscalPrinterService/src/com/shtrih/util/ServiceVersion.java b/Source/FiscalPrinterService/src/com/shtrih/util/ServiceVersion.java index 01e8fa5e..52028f86 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-1-g76ae479d"; + public static final String VERSION = "704-4-g8c32f1c0"; } \ No newline at end of file diff --git a/Source/FiscalPrinterService/test/com/shtrih/jpos/fiscalprinter/TextReportStorageTests.java b/Source/FiscalPrinterService/test/com/shtrih/jpos/fiscalprinter/TextReportStorageTests.java index d3453fe3..dad72e57 100644 --- a/Source/FiscalPrinterService/test/com/shtrih/jpos/fiscalprinter/TextReportStorageTests.java +++ b/Source/FiscalPrinterService/test/com/shtrih/jpos/fiscalprinter/TextReportStorageTests.java @@ -15,7 +15,7 @@ /** * @author P.Zhirkov */ -@Ignore + public class TextReportStorageTests { private File file; @@ -24,7 +24,6 @@ public class TextReportStorageTests { @Before public void context() throws IOException { file = File.createTempFile("TextReportStorageTests", ".txt"); - storage = new TextReportStorage(file.getAbsolutePath()); } @@ -238,6 +237,7 @@ public void should_search_first_and_single_z_report() throws Exception { assertEqual(expectedReport, storage.searchZReport(1)); } + @Ignore @Test public void should_search_z_report_in_the_middle() throws Exception { writeFile("ККТ 1358 ИНН 770123456789 №0237\n" + @@ -338,6 +338,7 @@ public void should_search_z_report_in_the_middle() throws Exception { assertEqual(expectedReport, storage.searchZReport(19)); } + @Ignore @Test public void should_search_z_report_in_the_middle_when_previous_report_has_different_number_then_minus_one() throws Exception { writeFile("ККТ 1358 ИНН 770123456789 №0237\n" + @@ -434,10 +435,12 @@ public void should_search_z_report_in_the_middle_when_previous_report_has_differ "НЕОБНУЛ.СУММА ПОКУПОК НА НАЧ.СМЕНЫ 0.00\n" + "ЧЕКОВ ПРОДАЖ 0000\n" + "0000 0.00\n"; - - assertEqual(expectedReport, storage.searchZReport(19)); + List report = storage.searchZReport(19); + assertEqual(expectedReport, report); } + + @Ignore @Test public void should_search_z_report_in_the_middle_with_no_documents() throws Exception { writeFile("ККТ 1358 ИНН 770123456789 №0237\n" + @@ -1051,7 +1054,7 @@ public void should_return_null_when_current_report_was_not_found() throws Except } private void writeFile(String text) throws IOException { - OutputStreamWriter writer = new OutputStreamWriter(new FileOutputStream(file), Charset.forName("utf-8")); + OutputStreamWriter writer = new OutputStreamWriter(new FileOutputStream(file)); try { writer.write(text); diff --git a/Source/FiscalPrinterTest/Res/PPPConfig.json b/Source/FiscalPrinterTest/Res/PPPConfig.json deleted file mode 100644 index c1e09a2f..00000000 --- a/Source/FiscalPrinterTest/Res/PPPConfig.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "handle_signals": false, - "resender": { - "host": "localhost", - "port": 7778, - "remote_port": 7778, - "socks_port": 1080 - }, - "transport": { - "type": "serial", - "path": "COM7" - }, - "ppp": { - "our_ip": "192.168.1.169", - "peer_ip": "192.168.1.168", - "peer_dns": "8.8.8.8" - } -} diff --git a/Source/FiscalPrinterTest/Res/jpos.xml b/Source/FiscalPrinterTest/Res/jpos.xml index 257aa73f..6596472e 100644 --- a/Source/FiscalPrinterTest/Res/jpos.xml +++ b/Source/FiscalPrinterTest/Res/jpos.xml @@ -250,7 +250,7 @@ - + diff --git a/Source/FiscalPrinterTest/Res/test.bat b/Source/FiscalPrinterTest/Res/test.bat deleted file mode 100644 index 046fecfa..00000000 --- a/Source/FiscalPrinterTest/Res/test.bat +++ /dev/null @@ -1,21 +0,0 @@ -@echo off - -set oldcp=%classpath% -set classpath=%classpath%;jpos113.jar -set classpath=%classpath%;jpos113-controls.jar -set classpath=%classpath%;shtrihjavapos.jar -set classpath=%classpath%;AbsoluteLayout.jar -set classpath=%classpath%;FiscalPrinterTest.jar -set classpath=%classpath%;log4j-1.2.12.jar -set classpath=%classpath%;xerces.jar -set classpath=%classpath%;nrjavaserial-3.12.0.jar -set classpath=%classpath%;zxing-2.2.jar -set classpath=%classpath%;%cd%\ - -set lp=c:\windows\system32 -set lp=%lp%;%cd%\ - - -java.exe -cp %classpath% -Djava.library.path=%lp% MainDialog - -set classpath=%oldcp% \ No newline at end of file diff --git a/Source/FiscalPrinterTest/Res/test.sh b/Source/FiscalPrinterTest/Res/test.sh deleted file mode 100644 index e84645f5..00000000 --- a/Source/FiscalPrinterTest/Res/test.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -CLASSPATH=$CLASSPATH:jpos113.jar -CLASSPATH=$CLASSPATH:jpos113-controls.jar -CLASSPATH=$CLASSPATH:shtrihjavapos.jar -CLASSPATH=$CLASSPATH:AbsoluteLayout.jar -CLASSPATH=$CLASSPATH:FiscalPrinterTest.jar -CLASSPATH=$CLASSPATH:log4j-1.2.12.jar -CLASSPATH=$CLASSPATH:xerces.jar -CLASSPATH=$CLASSPATH:nrjavaserial-3.12.0.jar -CLASSPATH=$CLASSPATH:zxing-2.2.jar -CLASSPATH=$CLASSPATH:%cd%\ - - -LIB_PATH=$LD_LIBRARY_PATH -######################################## -# # -# Add Device Specific jar's here... # -# # -######################################## - -#CLASSPATH=$CLASSPATH:/path_to_service.jar - - -java -cp $CLASSPATH -Djava.library.path=$LIB_PATH MainDialog diff --git a/Source/FiscalPrinterTest/src/PrinterTest.java b/Source/FiscalPrinterTest/src/PrinterTest.java index 63cc006f..40f63045 100644 --- a/Source/FiscalPrinterTest/src/PrinterTest.java +++ b/Source/FiscalPrinterTest/src/PrinterTest.java @@ -3995,6 +3995,10 @@ public void printFiscalReceipt145_7() printer.printRecItem("2. Item2", 124, 123400, 0, 124, ""); printer.printRecTotal(10000, 10000, ""); printer.endFiscalReceipt(false); + + int docNumber = printer.readLongPrinterStatus().getDocumentNumber(); + printer.printJournalDocNumber(docNumber); + } catch (Exception e) { e.printStackTrace(); }