Functional Weave
Code in TypeScript

logistics.sscc@1.1.0

README.md

1,817 bytes · view raw

# logistics.sscc

Builds a Serial Shipping Container Code, the 18-digit number on a GS1
logistics label that identifies one pallet, cage or parcel through the supply
chain. It is:

| digits | part |
|---|---|
| 1 | extension digit, 0-9, the company's own choice |
| 4-12 | GS1 company prefix, as allocated by GS1 |
| the rest, to make 17 | serial reference, zero-padded |
| 1 | GS1 mod-10 check digit |

So a 7-digit prefix leaves 9 digits of serial reference and a 10-digit prefix
leaves 6. A serial reference too large for the room left is an error rather
than being truncated, because a truncated serial silently re-uses another
pallet's number.

## Check digit

The standard GS1 mod-10 over the 17 data digits, from
`validation.gs1-check-digit` since 1.1.0 (1.0.0 repeated the arithmetic here,
because `validation.gtin` only accepted GTIN lengths). The answers are the
same. GS1's own example, `(00) 1 0614141 123456789 7`, is a vector, and so is
the SSCC from GS1's check digit worked example, `376104250021234569`.

## What it does not do

- It returns the bare 18 digits. The label's human-readable line shows them
  after the application identifier as `(00) 106141411234567897`; the barcode
  (GS1-128) encodes `00` followed by the 18 digits.
- It does not allocate serial references. GS1 asks that an SSCC is not
  re-used for at least a year after the unit was shipped; keeping the counter
  is the caller's job.
- It cannot tell whether a prefix was really allocated to you.

## Source

GS1 General Specifications, the SSCC (logistic units) and check digit
calculation sections, https://www.gs1.org/standards/barcodes-epcrfid-id-keys/gs1-general-specifications ;
GS1 UK, "How do I create SSCCs and logistics labels?",
https://www.gs1uk.org/knowledge-hub/barcodes/how-do-i-create-ssccs-and-logistics-labels