-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
version_1.1 #1
base: master
Are you sure you want to change the base?
version_1.1 #1
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,13 +8,24 @@ | |
|
||
Перечень поддерживаемых товарных групп: | ||
|
||
### version 1.0 | ||
* Обувь ([ППР №860 от 05.07.2019](https://xn--80ajghhoc2aj1c8b.xn--p1ai/upload/860.pdf)) | ||
* Товары лёгкой промышленности ([ППР №1956 от 31.12.2019](https://xn--80ajghhoc2aj1c8b.xn--p1ai/upload/1956.pdf)) | ||
* Духи и туалетная вода ([ППР №1957 от 31.12.2019](https://xn--80ajghhoc2aj1c8b.xn--p1ai/upload/%D0%9F%D0%BE%D1%81%D1%82%D0%B0%D0%BD%D0%BE%D0%B2%D0%BB%D0%B5%D0%BD%D0%B8%D0%B5_%D0%9F%D1%80%D0%B0%D0%B2%D0%B8%D1%82%D0%B5%D0%BB%D1%8C%D1%81%D1%82%D0%B2%D0%B0_%D0%A0%D0%A4_%D0%BE%D1%82_31_12_2019_N_1957_%D1%80%D0%B5%D0%B4_%D0%BE%D1%82_20_11.pdf)) | ||
* Молочная продукция ([ППР №2099 от 15.12.2020](https://xn--80ajghhoc2aj1c8b.xn--p1ai/upload/%D0%9F%D0%BE%D1%81%D1%82%D0%B0%D0%BD%D0%BE%D0%B2%D0%BB%D0%B5%D0%BD%D0%B8%D0%B5_%D0%9F%D1%80%D0%B0%D0%B2%D0%B8%D1%82%D0%B5%D0%BB%D1%8C%D1%81%D1%82%D0%B2%D0%B0_%D0%A0%D0%A4_%D0%BE%D1%82_15_12_2020_N_2099_%D1%80%D0%B5%D0%B4_%D0%BE%D1%82_22_04.pdf)) | ||
* Пиво и слабоалкогольные напитки ([ППР №2173 от 30.11.2022](https://xn--80ajghhoc2aj1c8b.xn--p1ai/upload/%D0%9F%D0%BE%D1%81%D1%82%D0%B0%D0%BD%D0%BE%D0%B2%D0%BB%D0%B5%D0%BD%D0%B8%D0%B5%20%D0%9F%D1%80%D0%B0%D0%B2%D0%B8%D1%82%D0%B5%D0%BB%D1%8C%D1%81%D1%82%D0%B2%D0%B0%20%E2%84%962173.pdf)) | ||
* Упакованная вода ([ППР №841 от 31.05.2021](https://xn--80ajghhoc2aj1c8b.xn--p1ai/upload/%D0%9F%D0%BE%D1%81%D1%82%D0%B0%D0%BD%D0%BE%D0%B2%D0%BB%D0%B5%D0%BD%D0%B8%D0%B5_%D0%9F%D1%80%D0%B0%D0%B2%D0%B8%D1%82%D0%B5%D0%BB%D1%8C%D1%81%D1%82%D0%B2%D0%B0_%D0%A0%D0%A4_%D0%BE%D1%82_31_05_2021_N_841_%D1%80%D0%B5%D0%B4_%D0%BE%D1%82_26_03.pdf)) | ||
|
||
### version 1.1 | ||
* Одежда ([ППР № 1956 от 31.12.2019г.](https://xn--80ajghhoc2aj1c8b.xn--p1ai/upload/%D0%9F%D0%BE%D1%81%D1%82%D0%B0%D0%BD%D0%BE%D0%B2%D0%BB%D0%B5%D0%BD%D0%B8%D0%B5_%D0%9F%D1%80%D0%B0%D0%B2%D0%B8%D1%82%D0%B5%D0%BB%D1%8C%D1%81%D1%82%D0%B2%D0%B0_%D0%A0%D0%A4_%D0%BE%D1%82_31_05_2021_N_841_%D1%80%D0%B5%D0%B4_%D0%BE%D1%82_26_03.pdf)) | ||
* Шины ([ППР № 1958 от 31.12.2019г.](https://xn--80ajghhoc2aj1c8b.xn--p1ai/upload/%D0%9F%D0%BE%D1%81%D1%82%D0%B0%D0%BD%D0%BE%D0%B2%D0%BB%D0%B5%D0%BD%D0%B8%D0%B5_%D0%9F%D1%80%D0%B0%D0%B2%D0%B8%D1%82%D0%B5%D0%BB%D1%8C%D1%81%D1%82%D0%B2%D0%B0_%D0%A0%D0%A4_%D0%BE%D1%82_31_05_2021_N_841_%D1%80%D0%B5%D0%B4_%D0%BE%D1%82_26_03.pdf)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
* Велосипеды ([Метод рекомен от 05.11.2019г.](https://честныйзнак.рф/upload/iblock/a1e/Metodicheskie_rekomendatsii_dlya_TG_Velosipedy.pdf)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ссылка 404 |
||
* Мед.изделия ([Метод.рекомен от 27.11.2019г.](https://честныйзнак.рф/upload/iblock/4f6/Методические%20рекомендации.pdf)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Описание - это только кресло-коляски? Лучше ссылаться единообразно на честныйзнак.рф |
||
* Фотоаппараты ([ППР № 1953 от 21.12.2019г.](https://xn--80ajghhoc2aj1c8b.xn--p1ai/upload/%D0%9F%D0%BE%D1%81%D1%82%D0%B0%D0%BD%D0%BE%D0%B2%D0%BB%D0%B5%D0%BD%D0%B8%D0%B5_%D0%9F%D1%80%D0%B0%D0%B2%D0%B8%D1%82%D0%B5%D0%BB%D1%8C%D1%81%D1%82%D0%B2%D0%B0_%D0%A0%D0%A4_%D0%BE%D1%82_31_05_2021_N_841_%D1%80%D0%B5%D0%B4_%D0%BE%D1%82_26_03.pdf)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
* БАД ([Проект ППР](https://regulation.gov.ru/projects#npa=130322)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Лучше ссылаться единообразно на честныйзнак.рф |
||
* Антисептики ([Проект ППР](https://regulation.gov.ru/projects#npa=130584)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Лучше ссылаться единообразно на честныйзнак.рф |
||
* Табак,АТП*, НСП* ([ППР № 224 от 28.02.2019г.](https://base.garant.ru/72189916/)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Лучше ссылаться единообразно на честныйзнак.рф |
||
|
||
# Даматарикс код можно валидировать | ||
|
||
* **с указанием конкретной товарной группы** | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,9 @@ public ValidationResult getValidationResult(TradeGroup type, String value) { | |
|
||
@Override | ||
public int getSize(TradeGroup type) { | ||
if (type == NICOTINE) { | ||
return getCode().length() + 12; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. а почему укороченный вариант для табака только для группы AI_01 ? |
||
} | ||
return getCode().length() + 14; | ||
} | ||
}, | ||
|
@@ -40,7 +43,10 @@ public int getSize(TradeGroup type) { | |
case MILK: | ||
return getCode().length() + 6; | ||
case BEER: | ||
case NICOTINE: | ||
return getCode().length() + 7; | ||
case CAMERAS: | ||
return getCode().length() + 20; | ||
default: | ||
return getCode().length() + 13; | ||
} | ||
|
@@ -51,7 +57,7 @@ public int getSize(TradeGroup type) { | |
@Override | ||
public ValidationResult getValidationResult(TradeGroup type, String value) { | ||
return notBlank | ||
.and(checkTradeGroup(type, SHOES, LP, PERFUMERY)) | ||
.and(checkTradeGroup(type, ANTISEPTIC, BICYCLES, CAMERAS, CLOTHES, DS, LP, MP, PERFUMERY, SHOES, TIRES)) | ||
.and(fixedSize(getSize(type))) | ||
.and(checkRegex(GS1_ISO_SUBSET_FOR_CONTROL_NUMBER)) | ||
.test(value); | ||
|
@@ -60,9 +66,16 @@ public ValidationResult getValidationResult(TradeGroup type, String value) { | |
@Override | ||
public int getSize(TradeGroup type) { | ||
switch (type) { | ||
case SHOES: | ||
case ANTISEPTIC: | ||
case BICYCLES: | ||
case CAMERAS: | ||
case CLOTHES: | ||
case DS: | ||
case LP: | ||
case MP: | ||
case PERFUMERY: | ||
case SHOES: | ||
case TIRES: | ||
return getCode().length() + 4; | ||
default: | ||
return 0; | ||
|
@@ -74,7 +87,7 @@ public int getSize(TradeGroup type) { | |
@Override | ||
public ValidationResult getValidationResult(TradeGroup type, String value) { | ||
return notBlank | ||
.and(checkTradeGroup(type, BEER, WATER, MILK)) | ||
.and(checkTradeGroup(type, ANTISEPTIC, BEER, DS, WATER, MILK)) | ||
.and(fixedSize(getSize(type))) | ||
.and(checkRegex(GS1_ISO_SUBSET_FOR_CONTROL_NUMBER)) | ||
.test(value); | ||
|
@@ -83,9 +96,11 @@ public ValidationResult getValidationResult(TradeGroup type, String value) { | |
@Override | ||
public int getSize(TradeGroup type) { | ||
switch (type) { | ||
case ANTISEPTIC: | ||
case BEER: | ||
case DS: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. кажется табак тоже должен здесь быть |
||
case MILK: | ||
case WATER: | ||
case BEER: | ||
return getCode().length() + 4; | ||
default: | ||
return 0; | ||
|
@@ -97,7 +112,7 @@ public int getSize(TradeGroup type) { | |
@Override | ||
public ValidationResult getValidationResult(TradeGroup type, String value) { | ||
return notBlank | ||
.and(checkTradeGroup(type, PERFUMERY, SHOES, LP)) | ||
.and(checkTradeGroup(type, SHOES, ANTISEPTIC, BICYCLES, CAMERAS, CLOTHES, DS, LP, MP, PERFUMERY, TIRES)) | ||
.and(fixedSize(getSize(type))) | ||
.and(checkRegex(GS1_ISO_SUBSET_FOR_CRYPTO_TAIL)) | ||
.test(value); | ||
|
@@ -108,8 +123,15 @@ public int getSize(TradeGroup type) { | |
switch (type) { | ||
case SHOES: | ||
return getCode().length() + 88; | ||
case PERFUMERY: | ||
case ANTISEPTIC: | ||
case BICYCLES: | ||
case CAMERAS: | ||
case CLOTHES: | ||
case DS: | ||
case LP: | ||
case MP: | ||
case PERFUMERY: | ||
case TIRES: | ||
return getCode().length() + 44; | ||
default: | ||
return 0; | ||
|
@@ -155,6 +177,25 @@ public int getSize(TradeGroup type) { | |
} | ||
}, | ||
|
||
AI_8005("8005", false) { | ||
@Override | ||
public ValidationResult getValidationResult(TradeGroup type, String value) { | ||
return notBlank | ||
.and(checkTradeGroup(type, NICOTINE)) | ||
.and(fixedSize(getSize(type))) | ||
.and(onlyNumbers()) | ||
.test(value); | ||
} | ||
|
||
@Override | ||
public int getSize(TradeGroup type) { | ||
if (type == NICOTINE) { | ||
return getCode().length() + 6; | ||
} | ||
return 0; | ||
} | ||
}, | ||
|
||
AI_335Y("335", false) { | ||
@Override | ||
public ValidationResult getValidationResult(TradeGroup type, String value) { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -103,19 +103,23 @@ private static List<AI> splitToAis(String datamatrixCode, TradeGroup type) { | |
List<AI> ais = Arrays.stream(AI.values()) | ||
.filter(ai -> part.startsWith(ai.getCode())) | ||
.collect(Collectors.toList()); | ||
if (ais.size() == 0) { | ||
throw new DatamatrixCodeIncorrectException("unknown AI"); | ||
} | ||
for (AI identifier : ais) { | ||
if (!identifier.isFixedSize()) { | ||
identifier.validateThrow(type, part); | ||
result.add(identifier); | ||
} else { | ||
String begin = part.substring(0, identifier.getSize(type)); | ||
identifier.validateThrow(type, begin); | ||
result.add(identifier); | ||
result.addAll(splitToAis(part.substring(identifier.getSize(type)), type)); | ||
if (!ais.isEmpty()) { | ||
for (AI identifier : ais) { | ||
if (!identifier.isFixedSize()) { | ||
identifier.validateThrow(type, part); | ||
result.add(identifier); | ||
} else { | ||
String begin = part.substring(0, identifier.getSize(type)); | ||
identifier.validateThrow(type, begin); | ||
result.add(identifier); | ||
result.addAll(splitToAis(part.substring(identifier.getSize(type)), type)); | ||
} | ||
} | ||
} else if (datamatrixCode.length() == 29 || datamatrixCode.length() == 15) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. а откуда взялись цифры 29 и 15 ? |
||
//for short NICOTINE | ||
return result; | ||
} else { | ||
throw new DatamatrixCodeIncorrectException("unknown AI"); | ||
} | ||
} | ||
return result; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,7 +31,8 @@ public static Validation<String> notContainsDoubleGS() { | |
} | ||
|
||
public static Validation<String> containsGS() { | ||
return SimpleValidation.from((s) -> contains(s, GS), "must contain <GS>"); | ||
return SimpleValidation.from((s) -> contains(s, GS) || s.length() == 29, | ||
"must contain <GS> or code length must be 29 characters"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. а почему только 29, а 15 не может быть ? |
||
} | ||
|
||
public static Validation<String> onlyNumbers() { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.