-
-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SGTIN-96 and SGTIN-198 implementation
- Loading branch information
Showing
6 changed files
with
659 additions
and
0 deletions.
There are no files selected for viewing
42 changes: 42 additions & 0 deletions
42
epctagcoder/src/main/java/org/epctagcoder/option/SGTIN/SGTINExtensionDigit.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,42 @@ | ||
package org.epctagcoder.option.SGTIN; | ||
|
||
import java.util.LinkedHashMap; | ||
import java.util.Map; | ||
|
||
public enum SGTINExtensionDigit { | ||
EXTENSION_0(0), | ||
EXTENSION_1(1), | ||
EXTENSION_2(2), | ||
EXTENSION_3(3), | ||
EXTENSION_4(4), | ||
EXTENSION_5(5), | ||
EXTENSION_6(6), | ||
EXTENSION_7(7), | ||
EXTENSION_8(8), | ||
EXTENSION_9(9); | ||
|
||
private int value; | ||
|
||
private SGTINExtensionDigit(int value) { | ||
this.value = value; | ||
} | ||
|
||
public int getValue() { | ||
return value; | ||
} | ||
|
||
private static final Map<Integer, SGTINExtensionDigit> BY_CODE_MAP = new LinkedHashMap<>(); | ||
static { | ||
for (SGTINExtensionDigit rae : SGTINExtensionDigit.values()) { | ||
BY_CODE_MAP.put(rae.value, rae); | ||
} | ||
} | ||
|
||
public static SGTINExtensionDigit forCode(int code) { | ||
return BY_CODE_MAP.get(code); | ||
} | ||
|
||
|
||
|
||
|
||
} |
38 changes: 38 additions & 0 deletions
38
epctagcoder/src/main/java/org/epctagcoder/option/SGTIN/SGTINFilterValue.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,38 @@ | ||
package org.epctagcoder.option.SGTIN; | ||
|
||
import java.util.LinkedHashMap; | ||
import java.util.Map; | ||
|
||
public enum SGTINFilterValue { | ||
ALL_OTHERS_0(0), | ||
POS_ITEM_1(1), | ||
CASE_2(2), | ||
RESERVED_3(3), | ||
INNER_PACK_4(4), | ||
RESERVED_5(5), | ||
UNIT_LOAD_6(6), | ||
COMPONENT_7(7); | ||
|
||
private int value; | ||
|
||
private SGTINFilterValue(int value) { | ||
this.value = value; | ||
} | ||
|
||
public int getValue() { | ||
return value; | ||
} | ||
|
||
private static final Map<Integer, SGTINFilterValue> BY_CODE_MAP = new LinkedHashMap<>(); | ||
static { | ||
for (SGTINFilterValue rae : SGTINFilterValue.values()) { | ||
BY_CODE_MAP.put(rae.value, rae); | ||
} | ||
} | ||
|
||
public static SGTINFilterValue forCode(int code) { | ||
return BY_CODE_MAP.get(code); | ||
} | ||
|
||
|
||
} |
42 changes: 42 additions & 0 deletions
42
epctagcoder/src/main/java/org/epctagcoder/option/SGTIN/SGTINHeader.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,42 @@ | ||
package org.epctagcoder.option.SGTIN; | ||
|
||
import java.util.LinkedHashMap; | ||
import java.util.Map; | ||
|
||
public enum SGTINHeader { | ||
HEADER_00110000("00110000") { | ||
public Integer getTagSize() { | ||
return 96; | ||
} | ||
}, | ||
HEADER_00110110("00110110") { | ||
public Integer getTagSize() { | ||
return 198; | ||
} | ||
}; | ||
|
||
private String value; | ||
public abstract Integer getTagSize(); | ||
|
||
|
||
private SGTINHeader(String value) { | ||
this.value = value; | ||
} | ||
|
||
public String getValue() { | ||
return value; | ||
} | ||
|
||
private static final Map<String, SGTINHeader> BY_CODE_MAP = new LinkedHashMap<>(); | ||
static { | ||
for (SGTINHeader rae : SGTINHeader.values()) { | ||
BY_CODE_MAP.put(rae.value, rae); | ||
} | ||
} | ||
|
||
public static SGTINHeader forCode(String code) { | ||
return BY_CODE_MAP.get(code); | ||
} | ||
|
||
|
||
} |
62 changes: 62 additions & 0 deletions
62
epctagcoder/src/main/java/org/epctagcoder/option/SGTIN/SGTINTagSize.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,62 @@ | ||
package org.epctagcoder.option.SGTIN; | ||
|
||
import java.util.LinkedHashMap; | ||
import java.util.Map; | ||
|
||
public enum SGTINTagSize { | ||
BITS_96(96) { | ||
public Integer getHeader() { | ||
return 48; | ||
} | ||
public Integer getSerialBitCount() { | ||
return 38; | ||
} | ||
public Integer getSerialMaxLenght() { | ||
return 11; | ||
} | ||
public Long getSerialMaxValue() { | ||
return 274_877_906_943L; | ||
} | ||
}, | ||
BITS_198(198) { | ||
public Integer getHeader() { | ||
return 54; | ||
} | ||
public Integer getSerialBitCount() { | ||
return 140; | ||
} | ||
public Integer getSerialMaxLenght() { | ||
return 20; | ||
} | ||
public Long getSerialMaxValue() { | ||
return null; // not used | ||
} | ||
}; | ||
|
||
private int value; | ||
public abstract Integer getHeader(); | ||
public abstract Integer getSerialBitCount(); | ||
public abstract Integer getSerialMaxLenght(); | ||
public abstract Long getSerialMaxValue(); | ||
|
||
private SGTINTagSize(int value) { | ||
this.value = value; | ||
} | ||
|
||
public int getValue() { | ||
return value; | ||
} | ||
|
||
private static final Map<Integer, SGTINTagSize> BY_CODE_MAP = new LinkedHashMap<>(); | ||
static { | ||
for (SGTINTagSize rae : SGTINTagSize.values()) { | ||
BY_CODE_MAP.put(rae.value, rae); | ||
} | ||
} | ||
|
||
public static SGTINTagSize forCode(int code) { | ||
return BY_CODE_MAP.get(code); | ||
} | ||
|
||
|
||
} |
50 changes: 50 additions & 0 deletions
50
...er/src/main/java/org/epctagcoder/option/SGTIN/partitionTable/SGTINPartitionTableList.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,50 @@ | ||
package org.epctagcoder.option.SGTIN.partitionTable; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import org.epctagcoder.option.TableItem; | ||
|
||
|
||
public class SGTINPartitionTableList { | ||
static final private List<TableItem> list = new ArrayList<TableItem>(); | ||
|
||
static { | ||
list.add( new TableItem(0, 40, 12, 4, 1) ); | ||
list.add( new TableItem(1, 37, 11, 7, 2) ); | ||
list.add( new TableItem(2, 34, 10, 10, 3) ); | ||
list.add( new TableItem(3, 30, 9, 14, 4) ); | ||
list.add( new TableItem(4, 27, 8, 17, 5) ); | ||
list.add( new TableItem(5, 24, 7, 20, 6) ); | ||
list.add( new TableItem(6, 20, 6, 24, 7) ); | ||
} | ||
|
||
public SGTINPartitionTableList() { | ||
|
||
} | ||
|
||
|
||
public TableItem getPartitionByL(Integer index) { | ||
TableItem tableItem = null; | ||
for (TableItem item : list) { | ||
if (item.getL()==index) { | ||
tableItem = item; | ||
break; | ||
} | ||
} | ||
return tableItem; | ||
} | ||
|
||
public TableItem getPartitionByValue(Integer index) { | ||
TableItem tableItem = null; | ||
for (TableItem item : list) { | ||
if (item.getPartitionValue()==index) { | ||
tableItem = item; | ||
break; | ||
} | ||
} | ||
return tableItem; | ||
} | ||
|
||
|
||
} |
Oops, something went wrong.