Skip to content

Commit

Permalink
Fixed error 80 handling after string printing commands
Browse files Browse the repository at this point in the history
  • Loading branch information
nyxiscoo1 committed Feb 27, 2017
1 parent 9034308 commit c3701f7
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions Source/Core/src/com/shtrih/fiscalprinter/SMFiscalPrinterImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ enum Boolean {
public PrinterProtocol device;
// delay on wait
public static final int TimeToSleep = 100;
public static final int SMFP_EFPTR_PREVCOMMAND_TimeToSleep = 333;
public static String charsetName = "Cp1251"; // device charset name
// tax officer password
public int taxPassword = 0;
Expand Down Expand Up @@ -250,6 +251,12 @@ public int executeCommand(PrinterCommand command) throws Exception {
if (!command.getRepeatNeeded()) {
break;
}

if(command.getResultCode() == SMFP_EFPTR_PREVCOMMAND) {
// Do not count as an attempt, added to fix SHTRIH-MOBILE-F bug
SysUtils.sleep(SMFP_EFPTR_PREVCOMMAND_TimeToSleep);
i--;
}
}
if (saveCommands && succeeded(resultCode) && isReceiptCommand(command)) {
BinaryCommand cmd = new BinaryCommand(command.getCode(),
Expand Down Expand Up @@ -1951,7 +1958,7 @@ public void printBarcode(PrinterBarcode barcode) throws Exception {
if (barcode.getType() == SmFptrConst.SMFPTR_BARCODE_EAN13){
barcode.setPrintType(SmFptrConst.SMFPTR_PRINTTYPE_DEVICE);
}

switch (barcode.getPrintType()) {
case SmFptrConst.SMFPTR_PRINTTYPE_AUTO:
if (getModel().getCapBarcodeSupported(barcode.getType())) {
Expand Down Expand Up @@ -2911,7 +2918,7 @@ public void printReceiptHeader(String docName) throws Exception {
line2 = String.format("#%04d", status.getDocumentNumber());
printLines(line1, line2);
// 3
line1 = docName;
line1 = docName;
line2 = String.format("ИНН %010d", status.getFiscalID());
printLines(line1, line2);
// 4
Expand All @@ -2932,11 +2939,11 @@ public void printReceiptHeader(String docName) throws Exception {
private static String[] docNames = {
"ПРОДАЖА", "ПОКУПКА", "ВОЗВРАТ ПРОДАЖИ", "ВОЗВРАТ ПОКУПКИ"
};

private static String[] fsDocNames = {
"ПРИХОД", "РАСХОД", "ВОЗВРАТ ПРИХОДА", "ВОЗВРАТ РАСХОДА"
};

public String getReceiptName(int receiptType)
{
if (getCapFiscalStorage()){
Expand Down

0 comments on commit c3701f7

Please sign in to comment.