@operato/ops-contract 0.9.36 → 0.9.38
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/epcis.d.ts +51 -2
- package/dist/epcis.js +57 -2
- package/dist/order-fold.d.ts +38 -0
- package/dist/order-fold.js +78 -0
- package/dist/wms-profile.d.ts +20 -1
- package/dist/wms-profile.js +20 -1
- package/dist/yms-profile.d.ts +9 -1
- package/dist/yms-profile.js +10 -1
- package/dist-cjs/index.cjs +1941 -1831
- package/package.json +1 -1
package/dist/epcis.d.ts
CHANGED
|
@@ -38,6 +38,13 @@ export declare const DISP: {
|
|
|
38
38
|
* 준다(지어낸 값의 JSON-LD 가 실재 값과 바이트까지 같았다). 그 경로를 근거로 삼지 말 것.
|
|
39
39
|
*/
|
|
40
40
|
readonly expired: "urn:epcglobal:cbv:disp:expired";
|
|
41
|
+
/**
|
|
42
|
+
* **폐기됐다 — 남은 것이 없다.** CBV `destroyed` (CBV ontology, `Disp-destroyed`), with the step
|
|
43
|
+
* `CBV_BIZSTEP.destroying`. Ruled 2026-09-24, shape from plant: the disposition belongs to the quantity
|
|
44
|
+
* **observed**, which is what is left. A partial scrap leaves the rest `in_progress`; only the last of it —
|
|
45
|
+
* nothing left — is `destroyed`. Putting it on a remainder would say sound goods were thrown away.
|
|
46
|
+
*/
|
|
47
|
+
readonly destroyed: "urn:epcglobal:cbv:disp:destroyed";
|
|
41
48
|
/**
|
|
42
49
|
* **검사에 합격했다 / 불합격했다** — CBV `conformant` / `non_conformant`.
|
|
43
50
|
*
|
|
@@ -61,6 +68,42 @@ export declare const DISP: {
|
|
|
61
68
|
readonly conformant: "urn:epcglobal:cbv:disp:conformant";
|
|
62
69
|
readonly non_conformant: "urn:epcglobal:cbv:disp:non_conformant";
|
|
63
70
|
};
|
|
71
|
+
/**
|
|
72
|
+
* **The one namespace this contract's own vocabulary stands under** — for a term a standard does not have.
|
|
73
|
+
*
|
|
74
|
+
* EPCIS 2.0 lets a business step, a business transaction type or a disposition be any URI **its owner
|
|
75
|
+
* assigns**; only the `urn:epcglobal:cbv:` space is CBV's, and that space is a closed list (the closed-list
|
|
76
|
+
* tests hold it). This prefix is owned by hatiolab.com. It is an identifier, **not an address: it is not
|
|
77
|
+
* dereferenced**, and a 404 at it is not a defect.
|
|
78
|
+
*
|
|
79
|
+
* Every private term goes under this one constant (chief architect, 2026-09-24) — a second private
|
|
80
|
+
* vocabulary under a second prefix is what this is here to prevent.
|
|
81
|
+
*/
|
|
82
|
+
export declare const HATIOLAB_VOCABULARY = "https://hatiolab.com/voc/";
|
|
83
|
+
/**
|
|
84
|
+
* **Business steps CBV does not have** — kept apart from the CBV bundles on purpose. A private value inside
|
|
85
|
+
* `CBV_BIZSTEP` would be read by the next person as CBV's.
|
|
86
|
+
*
|
|
87
|
+
* `consuming` was `urn:epcglobal:cbv:bizstep:consuming` until 2026-09-24; CBV defines no such step (CBV
|
|
88
|
+
* ontology, 41 steps; ref.gs1.org), and none of its steps means "material went into a process". Readers do
|
|
89
|
+
* not branch on the value, and the journal keeps what it already wrote (ADR-0038).
|
|
90
|
+
*/
|
|
91
|
+
export declare const PRIVATE_BIZSTEP: {
|
|
92
|
+
/** 공정에 자재가 들어갔다 — ISA-95 `MaterialUse: Consumed`. */
|
|
93
|
+
readonly consuming: "https://hatiolab.com/voc/bizstep/consuming";
|
|
94
|
+
};
|
|
95
|
+
/**
|
|
96
|
+
* **A business step's short name** — the last segment of its URI, cut at the last `:` or `/`.
|
|
97
|
+
*
|
|
98
|
+
* A CBV step is a URN (`urn:epcglobal:cbv:bizstep:staging_outbound`), a private one is an http URI
|
|
99
|
+
* (`https://hatiolab.com/voc/bizstep/consuming`). Cutting at `:` alone gave `//hatiolab.com/voc/bizstep/consuming`
|
|
100
|
+
* for the second, so a journal index, a filter and a `twin.bizstep.*` label all missed. The short name drops the
|
|
101
|
+
* namespace, so no private short name may equal a CBV one — `cbv-bizstep-values-exist.test.ts` holds that.
|
|
102
|
+
*
|
|
103
|
+
* Only a URI is read here. An empty value, or one that ends in a separator, has no name and answers
|
|
104
|
+
* `undefined`; what to fall back on (an event type, say) is the caller's to decide. A bare word passes as itself.
|
|
105
|
+
*/
|
|
106
|
+
export declare function bizStepName(uri: string | null | undefined): string | undefined;
|
|
64
107
|
/**
|
|
65
108
|
* **자재 소비·산출의 CBV 단계** — 도메인 무관하게 코어가 쓴다.
|
|
66
109
|
*
|
|
@@ -68,8 +111,13 @@ export declare const DISP: {
|
|
|
68
111
|
* 코어에 있어야 한다. 프로파일 하나에 두면 다른 업종이 그것을 가져다 쓰면서 방언이 생긴다.
|
|
69
112
|
*/
|
|
70
113
|
export declare const CBV_BIZSTEP: {
|
|
71
|
-
/**
|
|
72
|
-
|
|
114
|
+
/**
|
|
115
|
+
* **폐기 — 물건이 끝났다.** CBV `destroying`: "Process of terminating an object. For an instance-level
|
|
116
|
+
* identifier, the object should not be the subject of subsequent events" (CBV ontology, `BizStep-destroying`).
|
|
117
|
+
* Ruled 2026-09-24 (chief architect) — plant wrote scrapping as `other`; the warehouse's disposal door uses the
|
|
118
|
+
* same step. Not a count, and not a correction: the goods are gone.
|
|
119
|
+
*/
|
|
120
|
+
readonly destroying: "urn:epcglobal:cbv:bizstep:destroying";
|
|
73
121
|
/** 새 물품이 생겨 계보가 시작된다 — ISA-95 `MaterialUse: Produced`. */
|
|
74
122
|
readonly commissioning: "urn:epcglobal:cbv:bizstep:commissioning";
|
|
75
123
|
/**
|
|
@@ -155,6 +203,7 @@ export interface QuantityElement {
|
|
|
155
203
|
export interface BizTransactionElement {
|
|
156
204
|
/**
|
|
157
205
|
* The kind of document — a CBV business transaction type, or a private URI for a kind CBV does not have.
|
|
206
|
+
* A private one stands under `HATIOLAB_VOCABULARY` (`…/voc/btt/<name>`), never under a prefix of its own.
|
|
158
207
|
*
|
|
159
208
|
* **Optional, as in EPCIS 2.0**: only `bizTransaction` is required. When CBV has no value for the
|
|
160
209
|
* document, leave this out — do not coin one under `urn:epcglobal:cbv:btt:`. That namespace is a
|
package/dist/epcis.js
CHANGED
|
@@ -47,6 +47,13 @@ export const DISP = {
|
|
|
47
47
|
* 준다(지어낸 값의 JSON-LD 가 실재 값과 바이트까지 같았다). 그 경로를 근거로 삼지 말 것.
|
|
48
48
|
*/
|
|
49
49
|
expired: 'urn:epcglobal:cbv:disp:expired',
|
|
50
|
+
/**
|
|
51
|
+
* **폐기됐다 — 남은 것이 없다.** CBV `destroyed` (CBV ontology, `Disp-destroyed`), with the step
|
|
52
|
+
* `CBV_BIZSTEP.destroying`. Ruled 2026-09-24, shape from plant: the disposition belongs to the quantity
|
|
53
|
+
* **observed**, which is what is left. A partial scrap leaves the rest `in_progress`; only the last of it —
|
|
54
|
+
* nothing left — is `destroyed`. Putting it on a remainder would say sound goods were thrown away.
|
|
55
|
+
*/
|
|
56
|
+
destroyed: 'urn:epcglobal:cbv:disp:destroyed',
|
|
50
57
|
/**
|
|
51
58
|
* **검사에 합격했다 / 불합격했다** — CBV `conformant` / `non_conformant`.
|
|
52
59
|
*
|
|
@@ -70,6 +77,48 @@ export const DISP = {
|
|
|
70
77
|
conformant: 'urn:epcglobal:cbv:disp:conformant',
|
|
71
78
|
non_conformant: 'urn:epcglobal:cbv:disp:non_conformant'
|
|
72
79
|
};
|
|
80
|
+
/**
|
|
81
|
+
* **The one namespace this contract's own vocabulary stands under** — for a term a standard does not have.
|
|
82
|
+
*
|
|
83
|
+
* EPCIS 2.0 lets a business step, a business transaction type or a disposition be any URI **its owner
|
|
84
|
+
* assigns**; only the `urn:epcglobal:cbv:` space is CBV's, and that space is a closed list (the closed-list
|
|
85
|
+
* tests hold it). This prefix is owned by hatiolab.com. It is an identifier, **not an address: it is not
|
|
86
|
+
* dereferenced**, and a 404 at it is not a defect.
|
|
87
|
+
*
|
|
88
|
+
* Every private term goes under this one constant (chief architect, 2026-09-24) — a second private
|
|
89
|
+
* vocabulary under a second prefix is what this is here to prevent.
|
|
90
|
+
*/
|
|
91
|
+
export const HATIOLAB_VOCABULARY = 'https://hatiolab.com/voc/';
|
|
92
|
+
/**
|
|
93
|
+
* **Business steps CBV does not have** — kept apart from the CBV bundles on purpose. A private value inside
|
|
94
|
+
* `CBV_BIZSTEP` would be read by the next person as CBV's.
|
|
95
|
+
*
|
|
96
|
+
* `consuming` was `urn:epcglobal:cbv:bizstep:consuming` until 2026-09-24; CBV defines no such step (CBV
|
|
97
|
+
* ontology, 41 steps; ref.gs1.org), and none of its steps means "material went into a process". Readers do
|
|
98
|
+
* not branch on the value, and the journal keeps what it already wrote (ADR-0038).
|
|
99
|
+
*/
|
|
100
|
+
export const PRIVATE_BIZSTEP = {
|
|
101
|
+
/** 공정에 자재가 들어갔다 — ISA-95 `MaterialUse: Consumed`. */
|
|
102
|
+
consuming: `${HATIOLAB_VOCABULARY}bizstep/consuming`
|
|
103
|
+
};
|
|
104
|
+
/**
|
|
105
|
+
* **A business step's short name** — the last segment of its URI, cut at the last `:` or `/`.
|
|
106
|
+
*
|
|
107
|
+
* A CBV step is a URN (`urn:epcglobal:cbv:bizstep:staging_outbound`), a private one is an http URI
|
|
108
|
+
* (`https://hatiolab.com/voc/bizstep/consuming`). Cutting at `:` alone gave `//hatiolab.com/voc/bizstep/consuming`
|
|
109
|
+
* for the second, so a journal index, a filter and a `twin.bizstep.*` label all missed. The short name drops the
|
|
110
|
+
* namespace, so no private short name may equal a CBV one — `cbv-bizstep-values-exist.test.ts` holds that.
|
|
111
|
+
*
|
|
112
|
+
* Only a URI is read here. An empty value, or one that ends in a separator, has no name and answers
|
|
113
|
+
* `undefined`; what to fall back on (an event type, say) is the caller's to decide. A bare word passes as itself.
|
|
114
|
+
*/
|
|
115
|
+
export function bizStepName(uri) {
|
|
116
|
+
const s = String(uri ?? '').trim();
|
|
117
|
+
if (!s)
|
|
118
|
+
return undefined;
|
|
119
|
+
const name = s.slice(Math.max(s.lastIndexOf(':'), s.lastIndexOf('/')) + 1);
|
|
120
|
+
return name || undefined;
|
|
121
|
+
}
|
|
73
122
|
/**
|
|
74
123
|
* **자재 소비·산출의 CBV 단계** — 도메인 무관하게 코어가 쓴다.
|
|
75
124
|
*
|
|
@@ -77,8 +126,14 @@ export const DISP = {
|
|
|
77
126
|
* 코어에 있어야 한다. 프로파일 하나에 두면 다른 업종이 그것을 가져다 쓰면서 방언이 생긴다.
|
|
78
127
|
*/
|
|
79
128
|
export const CBV_BIZSTEP = {
|
|
80
|
-
|
|
81
|
-
|
|
129
|
+
/* 소비(`consuming`)는 CBV 에 없어 `PRIVATE_BIZSTEP` 으로 갔다(2026-09-24). */
|
|
130
|
+
/**
|
|
131
|
+
* **폐기 — 물건이 끝났다.** CBV `destroying`: "Process of terminating an object. For an instance-level
|
|
132
|
+
* identifier, the object should not be the subject of subsequent events" (CBV ontology, `BizStep-destroying`).
|
|
133
|
+
* Ruled 2026-09-24 (chief architect) — plant wrote scrapping as `other`; the warehouse's disposal door uses the
|
|
134
|
+
* same step. Not a count, and not a correction: the goods are gone.
|
|
135
|
+
*/
|
|
136
|
+
destroying: 'urn:epcglobal:cbv:bizstep:destroying',
|
|
82
137
|
/** 새 물품이 생겨 계보가 시작된다 — ISA-95 `MaterialUse: Produced`. */
|
|
83
138
|
commissioning: 'urn:epcglobal:cbv:bizstep:commissioning',
|
|
84
139
|
/**
|
package/dist/order-fold.d.ts
CHANGED
|
@@ -5,6 +5,8 @@ export interface OrderFoldPolicy {
|
|
|
5
5
|
/** 뜨거운 종결 오더가 이보다 많으면 오래된 것부터 접는다. */
|
|
6
6
|
maxTerminal: number;
|
|
7
7
|
}
|
|
8
|
+
/** 시간 칸의 크기 — 정시 단위다(ADR-0092 결정 2 보탬). `afterMs` 는 이것의 배수여야 한다. */
|
|
9
|
+
export declare const ORDER_FOLD_HOUR_MS: number;
|
|
8
10
|
/** 기본 경계 — 24시간 · 1,000건(ADR-0092 결정 1). 시간만 쓰면 바쁜 현장이 묶이지 않고, 건수만 쓰면 한가한 현장의 어제가 사라진다. */
|
|
9
11
|
export declare const ORDER_FOLD_DEFAULT: OrderFoldPolicy;
|
|
10
12
|
/**
|
|
@@ -37,6 +39,14 @@ export interface FoldedOrders {
|
|
|
37
39
|
counts: Record<string, Record<string, number>>;
|
|
38
40
|
/** 접힌 오더 가운데 가장 늦은 종결 시각(ms). 이보다 이른 종결 레코드는 줄을 세우지 않는다. 아직 접은 것이 없으면 null. */
|
|
39
41
|
boundaryMs: number | null;
|
|
42
|
+
/**
|
|
43
|
+
* **시간 칸** — 종결 시각의 정시(절대 시각 ms 를 문자열로) → 종류 × 종결 상태 → 건수(ADR-0092 결정 2 보탬).
|
|
44
|
+
*
|
|
45
|
+
* 접힌 쪽이 시각 없는 누적만 들면 「최근 T 안에 끝난 수」를 낼 수 없다 — 건수 경계(N)가 먼저 걸리는 바쁜 현장에서
|
|
46
|
+
* 뜨거운 줄로 세면 칩이 N 에서 멈춘다. 칸은 창 안의 것만 들고 창 밖 칸은 접을 때 버린다(칸 수 ≤ T/1h + 1).
|
|
47
|
+
* 종결 시각을 모르는 오더는 칸에 들지 않는다(세는 수 `counts` 에만 든다).
|
|
48
|
+
*/
|
|
49
|
+
hours?: Record<string, Record<string, Record<string, number>>>;
|
|
40
50
|
}
|
|
41
51
|
export declare function emptyFoldedOrders(): FoldedOrders;
|
|
42
52
|
/** 접힌 오더의 총수 — 서랍의 「끝난 오더 N건」이 읽는다. */
|
|
@@ -68,3 +78,31 @@ export declare function standsNewOrderRow(record: {
|
|
|
68
78
|
requested?: number;
|
|
69
79
|
fulfilled?: number;
|
|
70
80
|
}, eventTimeMs: number | undefined, folded: FoldedOrders | null | undefined): boolean;
|
|
81
|
+
/** 그 시각이 든 정시(ms) — 칸의 열쇠는 절대 시각의 정시다(판정 2026-09-24). */
|
|
82
|
+
export declare function hourStartOf(ms: number): number;
|
|
83
|
+
/**
|
|
84
|
+
* **「최근 T」 창의 시작** — `지금이 든 정시 − T`. 창은 `[시작, 지금]` 이고 가장 오래된 칸은 늘 든다.
|
|
85
|
+
*
|
|
86
|
+
* 칸으로 세면 창의 끝이 칸 경계에 맞춰진다. 가장 오래된 칸을 넣을지 뺄지가 방송마다 달라지면, 아무 일도 없는데 칩이
|
|
87
|
+
* 한 칸 분량만큼 오르내리고 사람은 그것을 흐름의 변화로 읽는다(UX 조건). 그래서 규칙을 하나로 둔다: 센 폭은 늘
|
|
88
|
+
* T 이상 T + 1시간 미만이다.
|
|
89
|
+
*/
|
|
90
|
+
export declare function finishedWindowStartMs(nowMs: number, policy?: OrderFoldPolicy): number;
|
|
91
|
+
/** 창 밖 칸을 버린다 — 접을 때 부른다. 새 값을 돌려준다. */
|
|
92
|
+
export declare function pruneFoldedHours(folded: FoldedOrders, nowMs: number, policy?: OrderFoldPolicy): FoldedOrders;
|
|
93
|
+
/**
|
|
94
|
+
* **최근 T 안에 끝난 흐름 오더의 수** — 씬 오더 상자의 칩이 읽는다(ADR-0092 결정 2 보탬, 판정 2026-09-24).
|
|
95
|
+
*
|
|
96
|
+
* 판정은 KPI 와 같다: 흐름 오더(`isFlowOrder`)이고 종결(`isOrderTerminal`)이다 — 받는 오더는 들지 않고, 취소도
|
|
97
|
+
* 종결이라 든다(KPI 의 `throughput.orders` 와 같은 수). 뜨거운 줄 가운데 창 안에 끝난 것과, 접힌 칸 가운데 창 안의
|
|
98
|
+
* 것을 더한다. 건수 경계(N)가 먼저 걸려도 이 수는 N 에서 멈추지 않는다.
|
|
99
|
+
*
|
|
100
|
+
* `byStatus` 는 같은 수를 **종결 상태별로** 가른 것이다 — 화면은 완료와 취소를 한 칩에 넣지 않는다(UX 판정 09-24: 반대 방향
|
|
101
|
+
* 둘을 한 수에 넣으면 어느 쪽도 말하지 못한다). 합은 늘 `count` 이고, KPI 의 종결 수와 대어 볼 수 있다.
|
|
102
|
+
*/
|
|
103
|
+
export declare function finishedFlowOrdersWithin(hot: readonly FoldableOrderView[], folded: FoldedOrders | null | undefined, nowMs: number, policy?: OrderFoldPolicy): {
|
|
104
|
+
fromMs: number;
|
|
105
|
+
toMs: number;
|
|
106
|
+
count: number;
|
|
107
|
+
byStatus: Record<string, number>;
|
|
108
|
+
};
|
package/dist/order-fold.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { isOrderTerminal } from "./contract.js";
|
|
2
|
+
import { isFlowOrder } from "./wms-profile.js";
|
|
3
|
+
/** 시간 칸의 크기 — 정시 단위다(ADR-0092 결정 2 보탬). `afterMs` 는 이것의 배수여야 한다. */
|
|
4
|
+
export const ORDER_FOLD_HOUR_MS = 60 * 60 * 1000;
|
|
2
5
|
/** 기본 경계 — 24시간 · 1,000건(ADR-0092 결정 1). 시간만 쓰면 바쁜 현장이 묶이지 않고, 건수만 쓰면 한가한 현장의 어제가 사라진다. */
|
|
3
6
|
export const ORDER_FOLD_DEFAULT = Object.freeze({ afterMs: 24 * 60 * 60 * 1000, maxTerminal: 1000 });
|
|
4
7
|
/**
|
|
@@ -18,6 +21,13 @@ export function orderFoldPolicyOf(declared) {
|
|
|
18
21
|
}
|
|
19
22
|
policy[key] = key === 'maxTerminal' ? Math.floor(v) : v;
|
|
20
23
|
}
|
|
24
|
+
/*
|
|
25
|
+
* **T 는 정시의 배수여야 한다** — 「최근 T 완료」 칩은 시간 칸을 세고, 그 이름은 선언한 T 를 그대로 적는다. 배수가
|
|
26
|
+
* 아니면(예: 90분) 실제로 센 폭과 이름이 달라진다(UX 조건 · 판정 2026-09-24).
|
|
27
|
+
*/
|
|
28
|
+
if (policy.afterMs % ORDER_FOLD_HOUR_MS !== 0) {
|
|
29
|
+
return { error: `order fold afterMs must be a whole number of hours, got ${policy.afterMs} ms — the window is counted in hour slots (ADR-0092)` };
|
|
30
|
+
}
|
|
21
31
|
if (policy.maxTerminal < 1)
|
|
22
32
|
return { error: 'order fold maxTerminal must be at least 1 (ADR-0092)' };
|
|
23
33
|
return { policy };
|
|
@@ -58,6 +68,7 @@ export function foldOrdersInto(folded, orders) {
|
|
|
58
68
|
counts: Object.fromEntries(Object.entries(folded?.counts ?? {}).map(([k, v]) => [k, { ...v }])),
|
|
59
69
|
boundaryMs: folded?.boundaryMs ?? null
|
|
60
70
|
};
|
|
71
|
+
const hours = Object.fromEntries(Object.entries(folded?.hours ?? {}).map(([h, byKind]) => [h, Object.fromEntries(Object.entries(byKind).map(([k, v]) => [k, { ...v }]))]));
|
|
61
72
|
for (const o of orders) {
|
|
62
73
|
const kind = String(o.kind ?? '');
|
|
63
74
|
const status = String(o.status ?? '');
|
|
@@ -65,8 +76,12 @@ export function foldOrdersInto(folded, orders) {
|
|
|
65
76
|
byStatus[status] = (byStatus[status] ?? 0) + 1;
|
|
66
77
|
if (typeof o.terminalAtMs === 'number' && Number.isFinite(o.terminalAtMs)) {
|
|
67
78
|
out.boundaryMs = out.boundaryMs === null ? o.terminalAtMs : Math.max(out.boundaryMs, o.terminalAtMs);
|
|
79
|
+
const slot = ((hours[String(hourStartOf(o.terminalAtMs))] ??= {})[kind] ??= {});
|
|
80
|
+
slot[status] = (slot[status] ?? 0) + 1;
|
|
68
81
|
}
|
|
69
82
|
}
|
|
83
|
+
if (Object.keys(hours).length)
|
|
84
|
+
out.hours = hours;
|
|
70
85
|
return out;
|
|
71
86
|
}
|
|
72
87
|
/**
|
|
@@ -89,3 +104,66 @@ export function standsNewOrderRow(record, eventTimeMs, folded) {
|
|
|
89
104
|
return true;
|
|
90
105
|
return eventTimeMs > boundary;
|
|
91
106
|
}
|
|
107
|
+
/** 그 시각이 든 정시(ms) — 칸의 열쇠는 절대 시각의 정시다(판정 2026-09-24). */
|
|
108
|
+
export function hourStartOf(ms) {
|
|
109
|
+
return Math.floor(ms / ORDER_FOLD_HOUR_MS) * ORDER_FOLD_HOUR_MS;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* **「최근 T」 창의 시작** — `지금이 든 정시 − T`. 창은 `[시작, 지금]` 이고 가장 오래된 칸은 늘 든다.
|
|
113
|
+
*
|
|
114
|
+
* 칸으로 세면 창의 끝이 칸 경계에 맞춰진다. 가장 오래된 칸을 넣을지 뺄지가 방송마다 달라지면, 아무 일도 없는데 칩이
|
|
115
|
+
* 한 칸 분량만큼 오르내리고 사람은 그것을 흐름의 변화로 읽는다(UX 조건). 그래서 규칙을 하나로 둔다: 센 폭은 늘
|
|
116
|
+
* T 이상 T + 1시간 미만이다.
|
|
117
|
+
*/
|
|
118
|
+
export function finishedWindowStartMs(nowMs, policy = ORDER_FOLD_DEFAULT) {
|
|
119
|
+
return hourStartOf(nowMs) - policy.afterMs;
|
|
120
|
+
}
|
|
121
|
+
/** 창 밖 칸을 버린다 — 접을 때 부른다. 새 값을 돌려준다. */
|
|
122
|
+
export function pruneFoldedHours(folded, nowMs, policy = ORDER_FOLD_DEFAULT) {
|
|
123
|
+
if (!folded.hours)
|
|
124
|
+
return folded;
|
|
125
|
+
const start = finishedWindowStartMs(nowMs, policy);
|
|
126
|
+
const kept = Object.fromEntries(Object.entries(folded.hours).filter(([h]) => Number(h) >= start));
|
|
127
|
+
const out = { counts: folded.counts, boundaryMs: folded.boundaryMs };
|
|
128
|
+
if (Object.keys(kept).length)
|
|
129
|
+
out.hours = kept;
|
|
130
|
+
return out;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* **최근 T 안에 끝난 흐름 오더의 수** — 씬 오더 상자의 칩이 읽는다(ADR-0092 결정 2 보탬, 판정 2026-09-24).
|
|
134
|
+
*
|
|
135
|
+
* 판정은 KPI 와 같다: 흐름 오더(`isFlowOrder`)이고 종결(`isOrderTerminal`)이다 — 받는 오더는 들지 않고, 취소도
|
|
136
|
+
* 종결이라 든다(KPI 의 `throughput.orders` 와 같은 수). 뜨거운 줄 가운데 창 안에 끝난 것과, 접힌 칸 가운데 창 안의
|
|
137
|
+
* 것을 더한다. 건수 경계(N)가 먼저 걸려도 이 수는 N 에서 멈추지 않는다.
|
|
138
|
+
*
|
|
139
|
+
* `byStatus` 는 같은 수를 **종결 상태별로** 가른 것이다 — 화면은 완료와 취소를 한 칩에 넣지 않는다(UX 판정 09-24: 반대 방향
|
|
140
|
+
* 둘을 한 수에 넣으면 어느 쪽도 말하지 못한다). 합은 늘 `count` 이고, KPI 의 종결 수와 대어 볼 수 있다.
|
|
141
|
+
*/
|
|
142
|
+
export function finishedFlowOrdersWithin(hot, folded, nowMs, policy = ORDER_FOLD_DEFAULT) {
|
|
143
|
+
const fromMs = finishedWindowStartMs(nowMs, policy);
|
|
144
|
+
let count = 0;
|
|
145
|
+
const byStatus = {};
|
|
146
|
+
const add = (status, n) => {
|
|
147
|
+
const key = String(status ?? '');
|
|
148
|
+
byStatus[key] = (byStatus[key] ?? 0) + n;
|
|
149
|
+
count += n;
|
|
150
|
+
};
|
|
151
|
+
for (const o of hot) {
|
|
152
|
+
if (!isFlowOrder(o) || !isOrderTerminal(o))
|
|
153
|
+
continue;
|
|
154
|
+
const at = o.terminalAtMs;
|
|
155
|
+
if (typeof at === 'number' && at >= fromMs && at <= nowMs)
|
|
156
|
+
add(o.status, 1);
|
|
157
|
+
}
|
|
158
|
+
for (const [h, byKind] of Object.entries(folded?.hours ?? {})) {
|
|
159
|
+
if (Number(h) < fromMs || Number(h) > nowMs)
|
|
160
|
+
continue;
|
|
161
|
+
for (const [kind, statuses] of Object.entries(byKind)) {
|
|
162
|
+
if (!isFlowOrder({ kind }))
|
|
163
|
+
continue;
|
|
164
|
+
for (const [status, c] of Object.entries(statuses))
|
|
165
|
+
add(status, c);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
return { fromMs, toMs: nowMs, count, byStatus };
|
|
169
|
+
}
|
package/dist/wms-profile.d.ts
CHANGED
|
@@ -6,7 +6,26 @@ export declare const BIZSTEP: {
|
|
|
6
6
|
readonly packing: "urn:epcglobal:cbv:bizstep:packing";
|
|
7
7
|
readonly staging_outbound: "urn:epcglobal:cbv:bizstep:staging_outbound";
|
|
8
8
|
readonly shipping: "urn:epcglobal:cbv:bizstep:shipping";
|
|
9
|
-
|
|
9
|
+
/**
|
|
10
|
+
* **Replenishment** — moving goods to where they are picked from. CBV has no `replenishing`; this contract
|
|
11
|
+
* wrote one until 2026-09-24, and the closed-list test found it. CBV `stocking` is the step that means it:
|
|
12
|
+
* "…within a location to make an object available to the customer or for order fulfilment within a DC"
|
|
13
|
+
* (CBV ontology, `BizStep-stocking`). Ruled by the chief architect; no reader branches on the value, and
|
|
14
|
+
* the journal keeps what it already wrote (ADR-0038).
|
|
15
|
+
*/
|
|
16
|
+
readonly stocking: "urn:epcglobal:cbv:bizstep:stocking";
|
|
17
|
+
/**
|
|
18
|
+
* **Counted, and the book set to the count** — CBV `cycle_counting`. Primary source: the CBV ontology
|
|
19
|
+
* (gs1/EPCIS `Ontology/CBV.ttl`, `cbv:BizStep-cycle_counting`, also served at ref.gs1.org/cbv): "Process of
|
|
20
|
+
* counting objects within a location in order to obtain an accurate inventory for business needs other
|
|
21
|
+
* than accounting purposes (e.g., replenishment and allocation)."
|
|
22
|
+
*
|
|
23
|
+
* **Only for an event somebody actually counted** (chief architect, 2026-09-24). A person correcting the
|
|
24
|
+
* book without counting is `CBV_BIZSTEP.other` with the reason carried as a value — `epcis.ts` says why:
|
|
25
|
+
* writing that as `cycle_counting` records a count that never happened. A count for the accounts is a
|
|
26
|
+
* different CBV step (`stock_taking`) and is not this one.
|
|
27
|
+
*/
|
|
28
|
+
readonly cycle_counting: "urn:epcglobal:cbv:bizstep:cycle_counting";
|
|
10
29
|
};
|
|
11
30
|
export declare const BTT: {
|
|
12
31
|
/** Purchase Order — the document an inbound receipt is made against. */
|
package/dist/wms-profile.js
CHANGED
|
@@ -6,7 +6,26 @@ export const BIZSTEP = {
|
|
|
6
6
|
packing: 'urn:epcglobal:cbv:bizstep:packing',
|
|
7
7
|
staging_outbound: 'urn:epcglobal:cbv:bizstep:staging_outbound',
|
|
8
8
|
shipping: 'urn:epcglobal:cbv:bizstep:shipping',
|
|
9
|
-
|
|
9
|
+
/**
|
|
10
|
+
* **Replenishment** — moving goods to where they are picked from. CBV has no `replenishing`; this contract
|
|
11
|
+
* wrote one until 2026-09-24, and the closed-list test found it. CBV `stocking` is the step that means it:
|
|
12
|
+
* "…within a location to make an object available to the customer or for order fulfilment within a DC"
|
|
13
|
+
* (CBV ontology, `BizStep-stocking`). Ruled by the chief architect; no reader branches on the value, and
|
|
14
|
+
* the journal keeps what it already wrote (ADR-0038).
|
|
15
|
+
*/
|
|
16
|
+
stocking: 'urn:epcglobal:cbv:bizstep:stocking',
|
|
17
|
+
/**
|
|
18
|
+
* **Counted, and the book set to the count** — CBV `cycle_counting`. Primary source: the CBV ontology
|
|
19
|
+
* (gs1/EPCIS `Ontology/CBV.ttl`, `cbv:BizStep-cycle_counting`, also served at ref.gs1.org/cbv): "Process of
|
|
20
|
+
* counting objects within a location in order to obtain an accurate inventory for business needs other
|
|
21
|
+
* than accounting purposes (e.g., replenishment and allocation)."
|
|
22
|
+
*
|
|
23
|
+
* **Only for an event somebody actually counted** (chief architect, 2026-09-24). A person correcting the
|
|
24
|
+
* book without counting is `CBV_BIZSTEP.other` with the reason carried as a value — `epcis.ts` says why:
|
|
25
|
+
* writing that as `cycle_counting` records a count that never happened. A count for the accounts is a
|
|
26
|
+
* different CBV step (`stock_taking`) and is not this one.
|
|
27
|
+
*/
|
|
28
|
+
cycle_counting: 'urn:epcglobal:cbv:bizstep:cycle_counting'
|
|
10
29
|
};
|
|
11
30
|
/*
|
|
12
31
|
* Business transaction types — CBV btt. Every value here exists at ref.gs1.org/cbv (checked
|
package/dist/yms-profile.d.ts
CHANGED
|
@@ -1,11 +1,19 @@
|
|
|
1
1
|
import type { TwinTypeInfo } from './domain-catalog.ts';
|
|
2
2
|
export declare const YARD_BIZSTEP: {
|
|
3
3
|
readonly arriving: "urn:epcglobal:cbv:bizstep:arriving";
|
|
4
|
-
readonly staging: "urn:epcglobal:cbv:bizstep:staging";
|
|
5
4
|
readonly loading: "urn:epcglobal:cbv:bizstep:loading";
|
|
6
5
|
readonly unloading: "urn:epcglobal:cbv:bizstep:unloading";
|
|
7
6
|
readonly departing: "urn:epcglobal:cbv:bizstep:departing";
|
|
8
7
|
};
|
|
8
|
+
/**
|
|
9
|
+
* **Yard steps CBV does not have.** `staging` (a trailer parked in a yard slot, waiting) was
|
|
10
|
+
* `urn:epcglobal:cbv:bizstep:staging` until 2026-09-24 — CBV defines no such step; `staging_outbound` is a
|
|
11
|
+
* warehouse's move towards shipping, not a trailer waiting. Kept apart from `YARD_BIZSTEP` so a private value
|
|
12
|
+
* is never read as CBV's.
|
|
13
|
+
*/
|
|
14
|
+
export declare const YARD_PRIVATE_BIZSTEP: {
|
|
15
|
+
readonly staging: "https://hatiolab.com/voc/bizstep/staging";
|
|
16
|
+
};
|
|
9
17
|
/** 트레일러/컨테이너 = GRAI(Global Returnable Asset Identifier, 반납형 자산). */
|
|
10
18
|
export declare function graiUri(companyPrefix: string, assetType: string, serial: number): string;
|
|
11
19
|
/** YMS 자리 타입 카탈로그 — 커널이 키로 쓰는 야드 로케이션 타입(locationByType/slotViews/.type). 도메인 SSOT. */
|
package/dist/yms-profile.js
CHANGED
|
@@ -1,11 +1,20 @@
|
|
|
1
|
+
import { HATIOLAB_VOCABULARY } from "./epcis.js";
|
|
1
2
|
// 야드 bizStep — CBV (yms.md §11).
|
|
2
3
|
export const YARD_BIZSTEP = {
|
|
3
4
|
arriving: 'urn:epcglobal:cbv:bizstep:arriving', // 게이트-인
|
|
4
|
-
staging: 'urn:epcglobal:cbv:bizstep:staging', // 야드 슬롯 주차·대기
|
|
5
5
|
loading: 'urn:epcglobal:cbv:bizstep:loading', // 도크 작업(상차: 트레일러←화물)
|
|
6
6
|
unloading: 'urn:epcglobal:cbv:bizstep:unloading', // 도크 작업(하차: 트레일러→화물)
|
|
7
7
|
departing: 'urn:epcglobal:cbv:bizstep:departing' // 게이트-아웃
|
|
8
8
|
};
|
|
9
|
+
/**
|
|
10
|
+
* **Yard steps CBV does not have.** `staging` (a trailer parked in a yard slot, waiting) was
|
|
11
|
+
* `urn:epcglobal:cbv:bizstep:staging` until 2026-09-24 — CBV defines no such step; `staging_outbound` is a
|
|
12
|
+
* warehouse's move towards shipping, not a trailer waiting. Kept apart from `YARD_BIZSTEP` so a private value
|
|
13
|
+
* is never read as CBV's.
|
|
14
|
+
*/
|
|
15
|
+
export const YARD_PRIVATE_BIZSTEP = {
|
|
16
|
+
staging: `${HATIOLAB_VOCABULARY}bizstep/staging` // 야드 슬롯 주차·대기
|
|
17
|
+
};
|
|
9
18
|
/*
|
|
10
19
|
* A dock appointment has **no CBV business transaction type** — `btt:deliv`, which this file used to
|
|
11
20
|
* export, does not exist at ref.gs1.org/cbv. The kernel now links the appointment by its id alone
|