@operato/ops-contract 0.9.41 → 0.9.43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/capability.d.ts +6 -1
- package/dist/capability.js +0 -13
- package/dist/contract.d.ts +15 -9
- package/dist/contract.js +4 -0
- package/dist/domain-definition.d.ts +1 -1
- package/dist/domain-definition.js +2 -2
- package/dist/epcis.d.ts +45 -0
- package/dist/epcis.js +72 -1
- package/dist/erp.d.ts +4 -4
- package/dist/gs1.d.ts +96 -0
- package/dist/gs1.js +346 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/dist/lot-lineage.d.ts +50 -0
- package/dist/lot-lineage.js +76 -0
- package/dist/operational-ingest.js +4 -4
- package/dist/party.d.ts +70 -0
- package/dist/party.js +131 -0
- package/dist/wms-profile.d.ts +20 -0
- package/dist/wms-profile.js +21 -0
- package/dist/yield.d.ts +1 -1
- package/dist/yms-profile.d.ts +74 -0
- package/dist/yms-profile.js +79 -0
- package/dist-cjs/index.cjs +552 -100
- package/package.json +11 -2
package/dist/party.js
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* **거래 상대** — 누구인가(정체성)와 어떤 관계로 나타났나(역할)를 가르는 계약 (operato-application ADR-0211).
|
|
3
|
+
*
|
|
4
|
+
* 정체성은 biz-base `Counterparty` 한 행이고, 그 행을 **경계 밖에서** 가리키는 값이 여기의 URI 다(ADR-0211 결정 13 —
|
|
5
|
+
* 같은 DB 안은 행 id 외래키, 사람에게는 이름). 역할은 상대의 칸이 아니라 관계(문서 · 사건 · 예약) 쪽에 붙는다(결정 1).
|
|
6
|
+
*
|
|
7
|
+
* ── 표준 (CBV 2.0, Release 2.0, Ratified, Jun 2022 — 원문 확인 2026-11-17) ─────────────────────────────
|
|
8
|
+
* 표준에 「거래 상대 식별자」라는 절은 따로 없다. 거래 상대는 EPCIS `sourceList` · `destinationList` 의 값이고 그 식별자는
|
|
9
|
+
* §8.7 Source/Destination identifiers 다. 네 꼴이 있다:
|
|
10
|
+
* · §8.7.1 EPC URI — 거래 상대에는 PGLN(`urn:epc:id:pgln:…`)이 「preferred」
|
|
11
|
+
* · §8.7.2 GS1 Digital Link — PGLN 은 AI (417): `https://id.gs1.org/417/{pgln}`
|
|
12
|
+
* · §8.7.3 `urn:URNNamespace:**:sd:Locid` — URN 이름공간 소유자가 배정, `Locid` 에 콜론 불가
|
|
13
|
+
* · §8.7.4 `http(s)://[Subdomain.]Domain/**\/sd/SourceOrDestId` — 그 도메인 소유자가 배정, `/sd/` 뒤 경로 성분 **하나**
|
|
14
|
+
* 길이는 128자 이하(SHALL), 60자 이하 권장(SHOULD)이다(§8.1.4).
|
|
15
|
+
*
|
|
16
|
+
* 표준은 PGLN 을 권한다(SHOULD). 우리는 발급한 `/sd/` 값을 원장에 쓴다 — 거래 상대 대부분이 GLN 이 없고 식별자는 바뀌지
|
|
17
|
+
* 않아야 하기 때문이다(ADR-0211 결정 11-2 · 11-3). PGLN 을 아는 상대는 내보내는 쪽이 바깥으로 PGLN 을 싣는다.
|
|
18
|
+
*
|
|
19
|
+
* §8.4 의 위치 꼴도 sourceList 에 들 수 있지만 그것은 **자리**(sdt `location`)다. 배송지 · 출하지는 거래 상대가 아니다
|
|
20
|
+
* (결정 4) — 그래서 이 파일의 판별은 위치 꼴을 거래 상대로 받지 않는다.
|
|
21
|
+
*/
|
|
22
|
+
import { identifierUnderNamespace } from "./epcis.js";
|
|
23
|
+
/**
|
|
24
|
+
* EPCIS Source/Destination 의 **종류** 중 거래 상대인 것 — CBV 2.0 §7.4.3.
|
|
25
|
+
*
|
|
26
|
+
* · `owning_party` — 그 이전의 끝점에서 물건을 **소유한**(또는 소유할) 당사자.
|
|
27
|
+
* · `possessing_party` — 그 이전의 끝점에서 물건을 **물리적으로 가진**(또는 가질) 당사자. 실려 가는 동안의 운송사가 이것이다.
|
|
28
|
+
*
|
|
29
|
+
* 표준의 셋째 값 `location` 은 자리다 — 거래 상대가 아니므로 여기 두지 않는다.
|
|
30
|
+
*/
|
|
31
|
+
export const SOURCE_DEST_PARTY_TYPE = {
|
|
32
|
+
owning_party: 'urn:epcglobal:cbv:sdt:owning_party',
|
|
33
|
+
possessing_party: 'urn:epcglobal:cbv:sdt:possessing_party'
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* **관계 안의 역할** — UN/CEFACT 당사자 역할 코드(UNTDID 3035). 닫힌 목록이고, **쓰는 날 하나씩** 올린다(ADR-0211 결정 4).
|
|
37
|
+
* 표준에 없는 역할은 지어내기 전에 판정을 받는다.
|
|
38
|
+
*
|
|
39
|
+
* · `CA` Carrier — 「Party undertaking or arranging transport of goods between named points.」
|
|
40
|
+
* (UNTDID 3035, D.96A 사본으로 확인 2026-11-17. 야드의 예약 · 게이트 방문, 창고 출하의 `bol` 을 낸 쪽.)
|
|
41
|
+
*/
|
|
42
|
+
export const PARTY_ROLE = {
|
|
43
|
+
carrier: 'CA'
|
|
44
|
+
};
|
|
45
|
+
/** CBV 2.0 §8.1.4 — HTTP(S) 식별자는 이 길이를 넘지 않는다(SHALL). */
|
|
46
|
+
export const PARTY_URI_MAX_LENGTH = 128;
|
|
47
|
+
/** CBV 2.0 §8.1.4 — 이 길이를 넘지 않기를 권한다(SHOULD). 넘으면 거절하지 않고 알린다. */
|
|
48
|
+
export const PARTY_URI_RECOMMENDED_LENGTH = 60;
|
|
49
|
+
const UUID = /^[0-9a-f]{8}-?[0-9a-f]{4}-?[0-9a-f]{4}-?[0-9a-f]{4}-?[0-9a-f]{12}$/i;
|
|
50
|
+
/** 발급한 토큰의 꼴 — 하이픈 뺀 소문자 uuid 32자(ADR-0211 결정 11-8). 이 꼴만 행 id 로 되돌린다. */
|
|
51
|
+
const ISSUED_TOKEN = /^[0-9a-f]{32}$/;
|
|
52
|
+
const PGLN_EPC = /^urn:epc:id:pgln:\d+\.\d*$/;
|
|
53
|
+
const PGLN_DIGITAL_LINK = /^https:\/\/id\.gs1\.org\/417\/\d{13}$/;
|
|
54
|
+
/** §8.7.4 — 등록된 도메인(점이 있다) · 임의의 경로 · `/sd/` · 슬래시 없는 성분 하나. */
|
|
55
|
+
const SD_URL = /^https?:\/\/[^/\s.]+(?:\.[^/\s.]+)+\/(?:[^/\s]+\/)*sd\/[^/\s]+$/;
|
|
56
|
+
/** §8.7.3 — `urn:<이름공간>:**:sd:<콜론 없는 성분>`. GS1 의 `urn:epc:` · `urn:epcglobal:` 공간에는 우리가 표지를 만들 수 없다. */
|
|
57
|
+
const SD_URN = /^urn:[^:\s]+:(?:[^:\s]+:)*sd:[^:\s]+$/;
|
|
58
|
+
/**
|
|
59
|
+
* **거래 상대 식별자를 발급한다** — 소유 도메인의 이름공간과 거래처 행 id 로(ADR-0211 결정 11).
|
|
60
|
+
*
|
|
61
|
+
* 부르는 곳은 biz-base 한 곳이다(결정 13-4 — 다른 코드는 URI 를 조립하지 않는다). 꼴의 규칙을 그곳에 다시 적지 않도록 여기 둔다.
|
|
62
|
+
*
|
|
63
|
+
* · 행 id 는 uuid 여야 한다 — 하이픈 · 대소문자는 받아서 **하이픈 뺀 소문자 32자**로 쓴다(결정 11-8). 아니면 던진다.
|
|
64
|
+
* · 이름공간이 없거나 GS1 공간이면 `undefined` 다(지어내지 않는다 — `objectUri` 와 같다).
|
|
65
|
+
* · 만든 값이 128자를 넘으면 던진다 — 그 이름공간 선언이 틀린 것이다(결정 11-8).
|
|
66
|
+
*/
|
|
67
|
+
export function partyUri(namespace, rowId) {
|
|
68
|
+
const raw = String(rowId ?? '').trim();
|
|
69
|
+
if (!UUID.test(raw))
|
|
70
|
+
throw new Error(`partyUri: 거래처 행 id 가 uuid 가 아니다: ${rowId}`);
|
|
71
|
+
const uri = identifierUnderNamespace(namespace, 'sd', raw.replace(/-/g, '').toLowerCase());
|
|
72
|
+
if (uri && uri.length > PARTY_URI_MAX_LENGTH) {
|
|
73
|
+
throw new Error(`partyUri: ${uri.length}자 — CBV 2.0 §8.1.4 는 ${PARTY_URI_MAX_LENGTH}자 이하를 요구한다. 이름공간 선언(${namespace})이 너무 길다.`);
|
|
74
|
+
}
|
|
75
|
+
return uri;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* **우리가 발급한 식별자에서 거래처 행 id 를 되찾는다** — 하이픈 있는 uuid 로.
|
|
79
|
+
*
|
|
80
|
+
* 토큰이 발급한 꼴(소문자 32자)일 때만 답한다. 대문자 · 하이픈이 섞인 꼴은 같은 값이 아니다(결정 11-8). 바깥에서 온 식별자
|
|
81
|
+
* (PGLN · 남의 `/sd/`)는 `undefined` 다 — 그때는 알려진 다른 식별자로 찾는다(결정 13-2). 이 함수는 **이름공간을 묻지 않는다**:
|
|
82
|
+
* 그 이름공간이 우리 것인지는 부르는 쪽(biz-base)이 안다.
|
|
83
|
+
*/
|
|
84
|
+
export function partyRowIdOf(uri) {
|
|
85
|
+
if (!uri || partyIdentifierViolation(uri))
|
|
86
|
+
return undefined;
|
|
87
|
+
const token = SD_URL.test(uri) ? uri.slice(uri.lastIndexOf('/') + 1) : SD_URN.test(uri) ? uri.slice(uri.lastIndexOf(':') + 1) : undefined;
|
|
88
|
+
if (!token || !ISSUED_TOKEN.test(token))
|
|
89
|
+
return undefined;
|
|
90
|
+
return `${token.slice(0, 8)}-${token.slice(8, 12)}-${token.slice(12, 16)}-${token.slice(16, 20)}-${token.slice(20)}`;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* **거래 상대 식별자로 받을 수 있는가** — 받을 수 없으면 까닭, 받을 수 있으면 `undefined`.
|
|
94
|
+
*
|
|
95
|
+
* 받는 꼴은 CBV 2.0 §8.7 의 네 꼴 중 거래 상대의 것이다: PGLN EPC · PGLN Digital Link(정규 `id.gs1.org`) · `/sd/` URL · `:sd:` URN.
|
|
96
|
+
* 128자를 넘으면 거절한다(SHALL). 60자 초과는 거절하지 않는다 — `partyUriLengthNote` 가 말한다.
|
|
97
|
+
*
|
|
98
|
+
* 비정규 Digital Link(`https://example.com/…/417/…`)는 아직 판정하지 않는다 — 클래스 식별자와 같은 좁힘이다(`epcis.ts`
|
|
99
|
+
* `classIdentifierViolation`). 그것을 쓰는 원천이 붙는 날 연다.
|
|
100
|
+
*/
|
|
101
|
+
export function partyIdentifierViolation(uri) {
|
|
102
|
+
if (typeof uri !== 'string' || !uri)
|
|
103
|
+
return `거래 상대 식별자가 비었다: ${uri}`;
|
|
104
|
+
if (uri.length > PARTY_URI_MAX_LENGTH)
|
|
105
|
+
return `거래 상대 식별자가 ${uri.length}자 — CBV 2.0 §8.1.4 는 ${PARTY_URI_MAX_LENGTH}자 이하를 요구한다: ${uri}`;
|
|
106
|
+
if (PGLN_EPC.test(uri) || PGLN_DIGITAL_LINK.test(uri))
|
|
107
|
+
return undefined;
|
|
108
|
+
if (/^urn:epc(global)?:/.test(uri))
|
|
109
|
+
return `거래 상대에는 GS1 공간에서 PGLN 만 받는다(CBV 2.0 §8.7.1): ${uri}`;
|
|
110
|
+
if (SD_URL.test(uri) || SD_URN.test(uri))
|
|
111
|
+
return undefined;
|
|
112
|
+
return (`거래 상대 식별자의 꼴이 아니다: ${uri} — CBV 2.0 §8.7 의 꼴이어야 한다 ` +
|
|
113
|
+
`(PGLN urn:epc:id:pgln: · https://id.gs1.org/417/<PGLN> · http(s)://<도메인>/**/sd/<id> · urn:<이름공간>:**:sd:<id>)`);
|
|
114
|
+
}
|
|
115
|
+
/** 판별의 참 · 거짓 — 까닭이 필요하면 `partyIdentifierViolation` 을 부른다. */
|
|
116
|
+
export function isPartyUri(v) {
|
|
117
|
+
return typeof v === 'string' && partyIdentifierViolation(v) === undefined;
|
|
118
|
+
}
|
|
119
|
+
/** 60자 권장(SHOULD)을 넘었으면 알릴 말, 아니면 `undefined`. 거절하지 않는다. */
|
|
120
|
+
export function partyUriLengthNote(uri) {
|
|
121
|
+
if (typeof uri !== 'string' || uri.length <= PARTY_URI_RECOMMENDED_LENGTH)
|
|
122
|
+
return undefined;
|
|
123
|
+
return `거래 상대 식별자가 ${uri.length}자 — CBV 2.0 §8.1.4 는 ${PARTY_URI_RECOMMENDED_LENGTH}자 이하를 권한다: ${uri}`;
|
|
124
|
+
}
|
|
125
|
+
/** 경계를 넘어 받은 값이 거래 상대 참조인가 — `id` 가 판별을 지나야 한다. `name` 은 있으면 글이어야 한다. */
|
|
126
|
+
export function isPartyRef(v) {
|
|
127
|
+
if (!v || typeof v !== 'object' || Array.isArray(v))
|
|
128
|
+
return false;
|
|
129
|
+
const r = v;
|
|
130
|
+
return isPartyUri(r.id) && (r.name === undefined || typeof r.name === 'string');
|
|
131
|
+
}
|
package/dist/wms-profile.d.ts
CHANGED
|
@@ -41,6 +41,26 @@ export declare const BTT: {
|
|
|
41
41
|
/** Bill of Lading — the carrier's document, attached when shipping. */
|
|
42
42
|
readonly bol: "urn:epcglobal:cbv:btt:bol";
|
|
43
43
|
};
|
|
44
|
+
/**
|
|
45
|
+
* **Goods going back to their supplier** (return to vendor) — the CBV words, read in the CBV ontology itself (gs1/EPCIS
|
|
46
|
+
* `Ontology/CBV.ttl`, versionInfo 2.0, 2026-10-23), before any document of that kind was built (operato-application
|
|
47
|
+
* ADR-0154 decision 2, chief architect: the vocabulary first).
|
|
48
|
+
*
|
|
49
|
+
* - **Step: `shipping`.** CBV has no returning step. Of its 41 steps, the one for goods leaving to another party is
|
|
50
|
+
* `shipping` ("the overall process of staging_outbound, loading and departing … a final event from a shipping
|
|
51
|
+
* point"); where they go is the destination, not the step.
|
|
52
|
+
* - **Disposition: `returned`** — "Object has been sent or brought back for various reasons. It may or may not be
|
|
53
|
+
* sellable." Not `in_transit` (between two trading partners, said of goods on their way to be received) and not
|
|
54
|
+
* `disposed` (returned for disposal - a supplier that destroys them says so itself).
|
|
55
|
+
* - **Document: `rma`** — "A document issued by the seller that authorises a buyer to return merchandise". In a return
|
|
56
|
+
* to supplier the warehouse is the buyer and the supplier issues it - the same document a customer's return comes in
|
|
57
|
+
* under, seen from the other side.
|
|
58
|
+
*/
|
|
59
|
+
export declare const RETURN_TO_SUPPLIER: {
|
|
60
|
+
readonly bizStep: "urn:epcglobal:cbv:bizstep:shipping";
|
|
61
|
+
readonly disposition: "urn:epcglobal:cbv:disp:returned";
|
|
62
|
+
readonly bizTransactionType: "urn:epcglobal:cbv:btt:rma";
|
|
63
|
+
};
|
|
44
64
|
export declare const WMS_ORDER_KIND: {
|
|
45
65
|
/**
|
|
46
66
|
* Expected receipt (ASN) — what was promised to arrive, and how much of it has.
|
package/dist/wms-profile.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { DISP } from "./epcis.js";
|
|
1
2
|
// bizStep — CBV URN (wms.md §11 확정 어휘)
|
|
2
3
|
export const BIZSTEP = {
|
|
3
4
|
receiving: 'urn:epcglobal:cbv:bizstep:receiving',
|
|
@@ -53,6 +54,26 @@ export const BTT = {
|
|
|
53
54
|
/** Bill of Lading — the carrier's document, attached when shipping. */
|
|
54
55
|
bol: 'urn:epcglobal:cbv:btt:bol'
|
|
55
56
|
};
|
|
57
|
+
/**
|
|
58
|
+
* **Goods going back to their supplier** (return to vendor) — the CBV words, read in the CBV ontology itself (gs1/EPCIS
|
|
59
|
+
* `Ontology/CBV.ttl`, versionInfo 2.0, 2026-10-23), before any document of that kind was built (operato-application
|
|
60
|
+
* ADR-0154 decision 2, chief architect: the vocabulary first).
|
|
61
|
+
*
|
|
62
|
+
* - **Step: `shipping`.** CBV has no returning step. Of its 41 steps, the one for goods leaving to another party is
|
|
63
|
+
* `shipping` ("the overall process of staging_outbound, loading and departing … a final event from a shipping
|
|
64
|
+
* point"); where they go is the destination, not the step.
|
|
65
|
+
* - **Disposition: `returned`** — "Object has been sent or brought back for various reasons. It may or may not be
|
|
66
|
+
* sellable." Not `in_transit` (between two trading partners, said of goods on their way to be received) and not
|
|
67
|
+
* `disposed` (returned for disposal - a supplier that destroys them says so itself).
|
|
68
|
+
* - **Document: `rma`** — "A document issued by the seller that authorises a buyer to return merchandise". In a return
|
|
69
|
+
* to supplier the warehouse is the buyer and the supplier issues it - the same document a customer's return comes in
|
|
70
|
+
* under, seen from the other side.
|
|
71
|
+
*/
|
|
72
|
+
export const RETURN_TO_SUPPLIER = {
|
|
73
|
+
bizStep: BIZSTEP.shipping,
|
|
74
|
+
disposition: DISP.returned,
|
|
75
|
+
bizTransactionType: BTT.rma
|
|
76
|
+
};
|
|
56
77
|
/*
|
|
57
78
|
* What an order in a warehouse is for — `OrderState.kind`.
|
|
58
79
|
*
|
package/dist/yield.d.ts
CHANGED
|
@@ -26,7 +26,7 @@ export interface FirstPassInput {
|
|
|
26
26
|
/**
|
|
27
27
|
* 분모는 **그 공정을 마친 수**다 — 양품과 부적합의 합.
|
|
28
28
|
*
|
|
29
|
-
* ── 왜 「들어간 수」가 분모가 아닌가 (첫
|
|
29
|
+
* ── 왜 「들어간 수」가 분모가 아닌가 (첫 버전을 고침) ─────────────────────────
|
|
30
30
|
* 처음에는 `들어간 수 − 부적합` 을 분자로 뒀다. **틀렸다.** 들어갔는데 아직 안 나온 것이 그 계산에서
|
|
31
31
|
* 「처음에 통과」로 세어진다 — 158이 들어가고 154가 나왔는데 160으로 잰다면 2개를 통과로 센다.
|
|
32
32
|
*
|
package/dist/yms-profile.d.ts
CHANGED
|
@@ -19,3 +19,77 @@ export declare function graiUri(companyPrefix: string, assetType: string, serial
|
|
|
19
19
|
/** YMS 자리 타입 카탈로그 — 커널이 키로 쓰는 야드 로케이션 타입(locationByType/slotViews/.type). 도메인 SSOT. */
|
|
20
20
|
export declare const YMS_LOCATION_TYPES: readonly ["gate", "yard-slot", "dock-door", "staging"];
|
|
21
21
|
export declare const YMS_TYPES: TwinTypeInfo[];
|
|
22
|
+
/**
|
|
23
|
+
* 야드에서 **오더**인 것 — 도크 예약(어포인트먼트). `OrderState.kind`.
|
|
24
|
+
*
|
|
25
|
+
* 들어오는 예약(하차)과 나가는 예약(상차)이 둘이다. 야드 안의 이동은 오더가 아니라 작업이다(§`YMS_TASK_KIND`).
|
|
26
|
+
*/
|
|
27
|
+
export declare const YMS_ORDER_KIND: {
|
|
28
|
+
/** 하차하러 들어오는 트레일러의 예약. */
|
|
29
|
+
readonly inbound: "appointment";
|
|
30
|
+
/** 상차하러 들어오는(빈) 트레일러의 예약. */
|
|
31
|
+
readonly outbound: "appointment-out";
|
|
32
|
+
};
|
|
33
|
+
export type YmsOrderKind = (typeof YMS_ORDER_KIND)[keyof typeof YMS_ORDER_KIND];
|
|
34
|
+
/**
|
|
35
|
+
* 야드의 **작업** — `TaskState.kind`.
|
|
36
|
+
*
|
|
37
|
+
* · `spot` — 게이트에서 야드 슬롯으로(drop 모드의 주차).
|
|
38
|
+
* · `spot-live` — 게이트에서 도어로 곧장(live 모드, 야드 미경유).
|
|
39
|
+
* · `pull` — 야드 슬롯에서 도어로(창이 열리고 도어가 비었을 때).
|
|
40
|
+
* · `dwell` — 도어에 붙어 상·하차하는 동안. 자리를 옮기지 않는 작업이다(from = to = 도어).
|
|
41
|
+
* · `depart` — 도어 또는 슬롯에서 게이트로.
|
|
42
|
+
* · `reposition` — 야드 안의 재배치(슬롯 → 슬롯). 커널은 아직 내지 않고 야드 앱이 낸다.
|
|
43
|
+
*/
|
|
44
|
+
export declare const YMS_TASK_KIND: {
|
|
45
|
+
readonly spot: "spot";
|
|
46
|
+
readonly spotLive: "spot-live";
|
|
47
|
+
readonly pull: "pull";
|
|
48
|
+
readonly dwell: "dwell";
|
|
49
|
+
readonly depart: "depart";
|
|
50
|
+
readonly reposition: "reposition";
|
|
51
|
+
};
|
|
52
|
+
export type YmsTaskKind = (typeof YMS_TASK_KIND)[keyof typeof YMS_TASK_KIND];
|
|
53
|
+
/** 야드 운영 모드 — `drop`: 트레일러를 슬롯에 내려놓고 창이 오면 호슬러가 끈다. `live`: 게이트에서 기다리다 도어로 곧장. */
|
|
54
|
+
export declare const YARD_MODE: readonly ["drop", "live"];
|
|
55
|
+
export type YardMode = (typeof YARD_MODE)[number];
|
|
56
|
+
/**
|
|
57
|
+
* 예약의 **상태** — 닫힌 목록.
|
|
58
|
+
*
|
|
59
|
+
* 끝나는 낱말 둘(`completed` · `cancelled`)은 계약의 `ORDER_TERMINAL_STATUS` 와 **같은 낱말**이다. 다르게 쓰면 `isOrderTerminal` 이
|
|
60
|
+
* 그것을 모르고 트윈에서 그 예약은 영영 열린 오더가 된다.
|
|
61
|
+
*/
|
|
62
|
+
export declare const YMS_APPOINTMENT_STATUS: readonly ["scheduled", "checked-in", "at-door", "completed", "cancelled"];
|
|
63
|
+
export type YmsAppointmentStatus = (typeof YMS_APPOINTMENT_STATUS)[number];
|
|
64
|
+
/**
|
|
65
|
+
* 예약이 **취소된 까닭** — 닫힌 목록. 노쇼는 상태가 아니라 이 사유다.
|
|
66
|
+
*
|
|
67
|
+
* 노쇼를 상태로 두면 위와 같은 까닭으로 끝나지 않는 오더가 된다. 노쇼율은 `cancelled` 중 `no-show` 를 세어 답한다.
|
|
68
|
+
* · `no-show` — 창이 지나도록 오지 않았다. · `carrier` — 운송사가 취소했다. · `site` — 현장이 취소했다.
|
|
69
|
+
*/
|
|
70
|
+
export declare const YMS_APPOINTMENT_CANCEL_REASON: readonly ["no-show", "carrier", "site"];
|
|
71
|
+
export type YmsAppointmentCancelReason = (typeof YMS_APPOINTMENT_CANCEL_REASON)[number];
|
|
72
|
+
/** 그 낱말이 예약의 상태인가 — 모르는 낱말을 「진행 중」으로 받지 않도록 보내기 전에 묻는다. */
|
|
73
|
+
export declare function isYmsAppointmentStatus(v: unknown): v is YmsAppointmentStatus;
|
|
74
|
+
/** 예약이 끝났나 — 판정은 계약의 오더 종결 낱말 한 곳을 따른다. */
|
|
75
|
+
export declare function isAppointmentClosed(status: unknown): boolean;
|
|
76
|
+
/**
|
|
77
|
+
* 도크 도어의 상태 — **파생한다.** 저장하는 값이 아니다(`locationStatusOf` 와 같은 규율).
|
|
78
|
+
*
|
|
79
|
+
* · `blocked` — 차단 기간(고장 · 청소 · 점검) 안이다. 점유보다 먼저 본다: 막힌 도어는 비어 있어도 쓸 수 없다.
|
|
80
|
+
* · `occupied` — 붙어 있는 트레일러 수가 동시 수(`OperationalLocation.parallelism`, 없으면 1)에 닿았다.
|
|
81
|
+
* · `free` — 그 밖.
|
|
82
|
+
*/
|
|
83
|
+
export declare const DOCK_DOOR_STATUS: readonly ["free", "occupied", "blocked"];
|
|
84
|
+
export type DockDoorStatus = (typeof DOCK_DOOR_STATUS)[number];
|
|
85
|
+
export declare function dockDoorStatusOf(d: {
|
|
86
|
+
occupancy?: number;
|
|
87
|
+
parallelism?: number;
|
|
88
|
+
blocked?: boolean;
|
|
89
|
+
}): DockDoorStatus;
|
|
90
|
+
/**
|
|
91
|
+
* 트레일러의 적재 — 게이트에서 **신고된** 것. 화물 SSCC 를 아는 경우 내용물은 AggregationEvent 가 말하며, 이 값은 그것을 대신하지 않는다
|
|
92
|
+
* (내용을 모르는 방문 트레일러가 「차 있다 / 비었다」만 말할 때의 칸이다).
|
|
93
|
+
*/
|
|
94
|
+
export declare const TRAILER_LOAD: readonly ["empty", "loaded"];
|
|
95
|
+
export type TrailerLoad = (typeof TRAILER_LOAD)[number];
|
package/dist/yms-profile.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ORDER_TERMINAL_STATUS } from "./contract.js";
|
|
1
2
|
import { HATIOLAB_VOCABULARY } from "./epcis.js";
|
|
2
3
|
// 야드 bizStep — CBV (yms.md §11).
|
|
3
4
|
export const YARD_BIZSTEP = {
|
|
@@ -49,3 +50,81 @@ export const YMS_TYPES = [
|
|
|
49
50
|
...YMS_LOCATION_TYPES.map((k) => ({ key: k, role: 'location', label: `twin.type.${k}`, standardClass: { epcis: 'bizLocation' }, identity: { scheme: 'gs1:SGLN' }, level: YMS_LOCATION_LEVEL[k], capabilities: ['storable'] })),
|
|
50
51
|
{ key: 'hostler', role: 'equipment', label: 'twin.type.hostler', standardClass: { epcis: 'object', iso55000: 'Asset' }, identity: { scheme: 'gs1:GIAI' }, capabilities: ['mobile', 'operable'] }
|
|
51
52
|
];
|
|
53
|
+
/*
|
|
54
|
+
* ── 야드 앱의 어휘 (operato-application ADR-0210 결정 7) ─────────────────────────────────────────
|
|
55
|
+
*
|
|
56
|
+
* 도크 관리와 야드 관리는 한 제품(영역 `yms`)이다. 커널이 글자로 쓰던 낱말에 먼저 이름을 붙인다 — 두 번째 생산자(야드 앱)가
|
|
57
|
+
* 서는 날 철자가 둘이 되지 않게(ADR-0059 결정 3, `WMS_ORDER_KIND` 와 같은 까닭). 값은 커널의 철자 그대로다: 저널은 쓴 것을 지킨다.
|
|
58
|
+
*/
|
|
59
|
+
/**
|
|
60
|
+
* 야드에서 **오더**인 것 — 도크 예약(어포인트먼트). `OrderState.kind`.
|
|
61
|
+
*
|
|
62
|
+
* 들어오는 예약(하차)과 나가는 예약(상차)이 둘이다. 야드 안의 이동은 오더가 아니라 작업이다(§`YMS_TASK_KIND`).
|
|
63
|
+
*/
|
|
64
|
+
export const YMS_ORDER_KIND = {
|
|
65
|
+
/** 하차하러 들어오는 트레일러의 예약. */
|
|
66
|
+
inbound: 'appointment',
|
|
67
|
+
/** 상차하러 들어오는(빈) 트레일러의 예약. */
|
|
68
|
+
outbound: 'appointment-out'
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* 야드의 **작업** — `TaskState.kind`.
|
|
72
|
+
*
|
|
73
|
+
* · `spot` — 게이트에서 야드 슬롯으로(drop 모드의 주차).
|
|
74
|
+
* · `spot-live` — 게이트에서 도어로 곧장(live 모드, 야드 미경유).
|
|
75
|
+
* · `pull` — 야드 슬롯에서 도어로(창이 열리고 도어가 비었을 때).
|
|
76
|
+
* · `dwell` — 도어에 붙어 상·하차하는 동안. 자리를 옮기지 않는 작업이다(from = to = 도어).
|
|
77
|
+
* · `depart` — 도어 또는 슬롯에서 게이트로.
|
|
78
|
+
* · `reposition` — 야드 안의 재배치(슬롯 → 슬롯). 커널은 아직 내지 않고 야드 앱이 낸다.
|
|
79
|
+
*/
|
|
80
|
+
export const YMS_TASK_KIND = {
|
|
81
|
+
spot: 'spot',
|
|
82
|
+
spotLive: 'spot-live',
|
|
83
|
+
pull: 'pull',
|
|
84
|
+
dwell: 'dwell',
|
|
85
|
+
depart: 'depart',
|
|
86
|
+
reposition: 'reposition'
|
|
87
|
+
};
|
|
88
|
+
/** 야드 운영 모드 — `drop`: 트레일러를 슬롯에 내려놓고 창이 오면 호슬러가 끈다. `live`: 게이트에서 기다리다 도어로 곧장. */
|
|
89
|
+
export const YARD_MODE = ['drop', 'live'];
|
|
90
|
+
/**
|
|
91
|
+
* 예약의 **상태** — 닫힌 목록.
|
|
92
|
+
*
|
|
93
|
+
* 끝나는 낱말 둘(`completed` · `cancelled`)은 계약의 `ORDER_TERMINAL_STATUS` 와 **같은 낱말**이다. 다르게 쓰면 `isOrderTerminal` 이
|
|
94
|
+
* 그것을 모르고 트윈에서 그 예약은 영영 열린 오더가 된다.
|
|
95
|
+
*/
|
|
96
|
+
export const YMS_APPOINTMENT_STATUS = ['scheduled', 'checked-in', 'at-door', 'completed', 'cancelled'];
|
|
97
|
+
/**
|
|
98
|
+
* 예약이 **취소된 까닭** — 닫힌 목록. 노쇼는 상태가 아니라 이 사유다.
|
|
99
|
+
*
|
|
100
|
+
* 노쇼를 상태로 두면 위와 같은 까닭으로 끝나지 않는 오더가 된다. 노쇼율은 `cancelled` 중 `no-show` 를 세어 답한다.
|
|
101
|
+
* · `no-show` — 창이 지나도록 오지 않았다. · `carrier` — 운송사가 취소했다. · `site` — 현장이 취소했다.
|
|
102
|
+
*/
|
|
103
|
+
export const YMS_APPOINTMENT_CANCEL_REASON = ['no-show', 'carrier', 'site'];
|
|
104
|
+
/** 그 낱말이 예약의 상태인가 — 모르는 낱말을 「진행 중」으로 받지 않도록 보내기 전에 묻는다. */
|
|
105
|
+
export function isYmsAppointmentStatus(v) {
|
|
106
|
+
return typeof v === 'string' && YMS_APPOINTMENT_STATUS.includes(v);
|
|
107
|
+
}
|
|
108
|
+
/** 예약이 끝났나 — 판정은 계약의 오더 종결 낱말 한 곳을 따른다. */
|
|
109
|
+
export function isAppointmentClosed(status) {
|
|
110
|
+
return typeof status === 'string' && ORDER_TERMINAL_STATUS.includes(status);
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* 도크 도어의 상태 — **파생한다.** 저장하는 값이 아니다(`locationStatusOf` 와 같은 규율).
|
|
114
|
+
*
|
|
115
|
+
* · `blocked` — 차단 기간(고장 · 청소 · 점검) 안이다. 점유보다 먼저 본다: 막힌 도어는 비어 있어도 쓸 수 없다.
|
|
116
|
+
* · `occupied` — 붙어 있는 트레일러 수가 동시 수(`OperationalLocation.parallelism`, 없으면 1)에 닿았다.
|
|
117
|
+
* · `free` — 그 밖.
|
|
118
|
+
*/
|
|
119
|
+
export const DOCK_DOOR_STATUS = ['free', 'occupied', 'blocked'];
|
|
120
|
+
export function dockDoorStatusOf(d) {
|
|
121
|
+
if (d.blocked)
|
|
122
|
+
return 'blocked';
|
|
123
|
+
const cap = typeof d.parallelism === 'number' && d.parallelism > 0 ? d.parallelism : 1;
|
|
124
|
+
return (d.occupancy ?? 0) >= cap ? 'occupied' : 'free';
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* 트레일러의 적재 — 게이트에서 **신고된** 것. 화물 SSCC 를 아는 경우 내용물은 AggregationEvent 가 말하며, 이 값은 그것을 대신하지 않는다
|
|
128
|
+
* (내용을 모르는 방문 트레일러가 「차 있다 / 비었다」만 말할 때의 칸이다).
|
|
129
|
+
*/
|
|
130
|
+
export const TRAILER_LOAD = ['empty', 'loaded'];
|