-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added FS fiscalization commands to ShtrihFiscalPrinter
- Loading branch information
Showing
7 changed files
with
130 additions
and
139 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
Source/Core/src/com/shtrih/fiscalprinter/command/FSReFiscalization.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/* | ||
* To change this license header, choose License Headers in Project Properties. | ||
* To change this template file, choose Tools | Templates | ||
* and open the template in the editor. | ||
*/ | ||
package com.shtrih.fiscalprinter.command; | ||
|
||
public class FSReFiscalization extends PrinterCommand { | ||
|
||
// in | ||
private final int sysPassword; // System administrator password (4 bytes) | ||
|
||
private final String taxID; | ||
private final String regID; | ||
private final int taxSystemCode; | ||
private final int operationMode; | ||
private final int reasonCode; | ||
// out | ||
private long docNumber; | ||
private long macNumber; | ||
|
||
public FSReFiscalization(int sysPassword, String taxID, String regID, int taxSystemCode, int operationMode, int reasonCode) { | ||
this.sysPassword = sysPassword; | ||
this.taxID = taxID; | ||
this.regID = regID; | ||
this.taxSystemCode = taxSystemCode; | ||
this.operationMode = operationMode; | ||
this.reasonCode = reasonCode; | ||
} | ||
|
||
public final int getCode() { | ||
return 0xFF34; | ||
} | ||
|
||
public final String getText() { | ||
return "Fiscal storage: refiscalization"; | ||
} | ||
|
||
public void encode(CommandOutputStream out) throws Exception { | ||
out.writeInt(sysPassword); | ||
out.writeString(taxID, 12); | ||
out.writeString(regID, 20); | ||
out.writeByte(taxSystemCode); | ||
out.writeByte(operationMode); | ||
out.writeByte(reasonCode); | ||
} | ||
|
||
public void decode(CommandInputStream in) throws Exception { | ||
docNumber = in.readLong(4); | ||
macNumber = in.readLong(4); | ||
} | ||
|
||
public long getDocNumber() { | ||
return docNumber; | ||
} | ||
|
||
public long getMacNumber() { | ||
return macNumber; | ||
} | ||
} |
97 changes: 0 additions & 97 deletions
97
Source/Core/src/com/shtrih/fiscalprinter/command/FSRegistrationReport.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
...ce/FiscalPrinterService/test/com/shtrih/fiscalprinter/command/FSReFiscalizationTests.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package com.shtrih.fiscalprinter.command; | ||
|
||
import org.junit.Test; | ||
|
||
import static com.shtrih.util.ByteUtils.byteArray; | ||
import static org.junit.Assert.assertArrayEquals; | ||
|
||
/** | ||
* @author P.Zhirkov | ||
*/ | ||
public class FSReFiscalizationTests { | ||
@Test | ||
public void should_serialize() throws Exception { | ||
FSReFiscalization cmd = new FSReFiscalization( | ||
30, "7701234567", "0000000221017090", 17, 24, 4); | ||
|
||
byte[] data = cmd.encodeData(); | ||
|
||
byte[] expectedData = byteArray( | ||
0xFF, 0x34, | ||
0x1E, 0x00, 0x00, 0x00, | ||
0x37, 0x37, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x00, 0x00, | ||
0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x32, 0x32, 0x31, 0x30, 0x31, 0x37, 0x30, 0x39, 0x30, 0x00, 0x00, 0x00, 0x00, | ||
0x11, | ||
0x18, | ||
0x04); | ||
|
||
assertArrayEquals(expectedData, data); | ||
} | ||
} |