@operato/ops-contract 0.9.42 → 0.9.44
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/README.md +33 -0
- package/dist/actuation.d.ts +1 -0
- package/dist/capability.d.ts +6 -1
- package/dist/capability.js +0 -13
- package/dist/capacity.d.ts +0 -7
- package/dist/capacity.js +6 -123
- package/dist/contract.d.ts +40 -13
- package/dist/contract.js +37 -0
- package/dist/dock-facts.d.ts +73 -0
- package/dist/dock-facts.js +134 -0
- package/dist/domain-definition.d.ts +1 -1
- package/dist/domain-definition.js +2 -2
- package/dist/ems-profile.d.ts +1 -2
- package/dist/ems-profile.js +19 -8
- package/dist/epcis.d.ts +47 -7
- package/dist/epcis.js +56 -3
- package/dist/erp.d.ts +4 -4
- package/dist/gs1.d.ts +27 -0
- package/dist/gs1.js +86 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.js +4 -0
- package/dist/material-move.d.ts +124 -0
- package/dist/material-move.js +229 -0
- package/dist/mes-profile.js +1 -1
- package/dist/oee.js +8 -4
- package/dist/operational-attention.d.ts +27 -0
- package/dist/operational-attention.js +95 -15
- package/dist/operational-ingest.js +5 -6
- package/dist/operations-capability.d.ts +1 -8
- package/dist/operations-capability.js +0 -99
- package/dist/order-fold.d.ts +0 -30
- package/dist/order-fold.js +0 -75
- package/dist/party.d.ts +70 -0
- package/dist/party.js +131 -0
- package/dist/records-of-event.d.ts +74 -0
- package/dist/records-of-event.js +129 -0
- package/dist/yield.d.ts +1 -1
- package/dist/yms-profile.d.ts +82 -0
- package/dist/yms-profile.js +88 -0
- package/dist-cjs/index.cjs +705 -208
- package/package.json +12 -3
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { validateEpcisEvent } from "./epcis.js";
|
|
2
|
+
/**
|
|
3
|
+
* EPCIS fields the canonical records have no place for yet. They are **named, not dropped silently**: the result says which of them
|
|
4
|
+
* the event carried, so a product can tell what the twin will not see (contract review 2026-11-19). A field that would change what
|
|
5
|
+
* the record means is refused instead (`errorDeclaration` - a correction sent as a plain observation would read as a new fact).
|
|
6
|
+
*/
|
|
7
|
+
export const FIELDS_NOT_CARRIED = ['ilmd', 'sourceList', 'destinationList', 'persistentDisposition', 'sensorElementList', 'certificationInfo'];
|
|
8
|
+
/**
|
|
9
|
+
* **The EPCIS header fields the canonical records carry** - the one list (contract content review 2026-11-19). `headerOf` writes
|
|
10
|
+
* exactly these and the three record types declare them; carrying one more (say `sourceList`) is a move from
|
|
11
|
+
* `FIELDS_NOT_CARRIED` to here, plus the field on the record types and the receiver's mapping.
|
|
12
|
+
*/
|
|
13
|
+
export const CARRIED_HEADER_FIELDS = ['bizStep', 'disposition', 'bizTransactionList', 'readPoint', 'bizLocation'];
|
|
14
|
+
/** What the event is and when - the record's own shape and the envelope carry these, not the header. `@context` is JSON-LD's, not a fact. */
|
|
15
|
+
const IDENTITY_HEADER_FIELDS = ['@context', 'type', 'eventID', 'eventTime', 'eventTimeZoneOffset', 'recordTime'];
|
|
16
|
+
/** Refused rather than sent: it would change what the record means (`correction-not-shaped`). */
|
|
17
|
+
const REFUSED_HEADER_FIELDS = ['errorDeclaration'];
|
|
18
|
+
export const HEADER_FIELDS_PARTITIONED = true;
|
|
19
|
+
function shapeError(code, params, message) {
|
|
20
|
+
return Object.assign(new Error(message), { name: 'RecordShapeError', code, params });
|
|
21
|
+
}
|
|
22
|
+
/** Is this the shaping's refusal? */
|
|
23
|
+
export function isRecordShapeError(error) {
|
|
24
|
+
return error instanceof Error && error.name === 'RecordShapeError';
|
|
25
|
+
}
|
|
26
|
+
function placeOf(ref) {
|
|
27
|
+
return typeof ref?.id === 'string' ? ref.id : undefined;
|
|
28
|
+
}
|
|
29
|
+
function headerOf(event) {
|
|
30
|
+
return {
|
|
31
|
+
bizStep: event.bizStep,
|
|
32
|
+
...(event.disposition ? { disposition: event.disposition } : {}),
|
|
33
|
+
...(event.bizTransactionList?.length ? { bizTransactionList: event.bizTransactionList } : {}),
|
|
34
|
+
/* The twin's record takes a place as its value, an EPCIS document as `{ id }` - the sender moves it (connector ruling 2026-09-24). */
|
|
35
|
+
...(placeOf(event.readPoint) ? { readPoint: placeOf(event.readPoint) } : {}),
|
|
36
|
+
...(placeOf(event.bizLocation) ? { bizLocation: placeOf(event.bizLocation) } : {})
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* One event as canonical records.
|
|
41
|
+
*
|
|
42
|
+
* Quantities go as the absolute remainder, as the contract says ("so much is left", not "so much was taken") - a lost
|
|
43
|
+
* event is corrected by the next. An event that carries one quantity over several units has not said whose it is: put on
|
|
44
|
+
* both it doubles, dropped it vanishes - so it is refused.
|
|
45
|
+
*/
|
|
46
|
+
export function recordsOfEvent(event) {
|
|
47
|
+
if (event.errorDeclaration) {
|
|
48
|
+
throw shapeError('correction-not-shaped', { event: event.eventID }, 'the event declares an error in an earlier one: the canonical records have no correction, and sent as an observation it would read as a new fact');
|
|
49
|
+
}
|
|
50
|
+
/* The header written below is exactly `CARRIED_HEADER_FIELDS`; anything else the event carried is named. */
|
|
51
|
+
const notCarried = FIELDS_NOT_CARRIED.filter(field => {
|
|
52
|
+
const value = event[field];
|
|
53
|
+
return value !== undefined && value !== null && !(Array.isArray(value) && !value.length);
|
|
54
|
+
});
|
|
55
|
+
const shaped = shapedRecordsOf(event);
|
|
56
|
+
return notCarried.length ? { ...shaped, notCarried } : shaped;
|
|
57
|
+
}
|
|
58
|
+
function shapedRecordsOf(event) {
|
|
59
|
+
switch (event.type) {
|
|
60
|
+
case 'ObjectEvent': {
|
|
61
|
+
const units = event.epcList ?? [];
|
|
62
|
+
const quantities = event.quantityList;
|
|
63
|
+
if (!units.length && !quantities?.length) {
|
|
64
|
+
throw shapeError('nothing-observed', { event: event.eventID }, 'the event names neither a logistic unit nor a quantity: there is nothing to observe');
|
|
65
|
+
}
|
|
66
|
+
if (units.length > 1 && quantities?.length) {
|
|
67
|
+
throw shapeError('quantity-across-many-units', { event: event.eventID, units: units.length }, `the event carries a quantity and ${units.length} units: which unit holds it is not said`);
|
|
68
|
+
}
|
|
69
|
+
if (!units.length) {
|
|
70
|
+
return { records: [{ quantityList: quantities, action: event.action, ...headerOf(event) }] };
|
|
71
|
+
}
|
|
72
|
+
return {
|
|
73
|
+
records: units.map(epc => ({
|
|
74
|
+
epc,
|
|
75
|
+
...(quantities?.length ? { quantityList: quantities } : {}),
|
|
76
|
+
action: event.action,
|
|
77
|
+
...headerOf(event)
|
|
78
|
+
}))
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
case 'AggregationEvent':
|
|
82
|
+
return {
|
|
83
|
+
records: [
|
|
84
|
+
{
|
|
85
|
+
parentID: event.parentID,
|
|
86
|
+
...(event.childEPCs?.length ? { childEPCs: event.childEPCs } : {}),
|
|
87
|
+
...(event.childQuantityList?.length ? { childQuantityList: event.childQuantityList } : {}),
|
|
88
|
+
action: event.action,
|
|
89
|
+
...headerOf(event)
|
|
90
|
+
}
|
|
91
|
+
]
|
|
92
|
+
};
|
|
93
|
+
/* What went in and what came out (ADR-0151). A side the event does not name gets no field - an empty list would say "nothing". */
|
|
94
|
+
case 'TransformationEvent':
|
|
95
|
+
return {
|
|
96
|
+
records: [
|
|
97
|
+
{
|
|
98
|
+
...(event.inputEPCList?.length ? { inputEPCList: event.inputEPCList } : {}),
|
|
99
|
+
...(event.inputQuantityList?.length ? { inputQuantityList: event.inputQuantityList } : {}),
|
|
100
|
+
...(event.outputEPCList?.length ? { outputEPCList: event.outputEPCList } : {}),
|
|
101
|
+
...(event.outputQuantityList?.length ? { outputQuantityList: event.outputQuantityList } : {}),
|
|
102
|
+
...(event.transformationID ? { transformationID: event.transformationID } : {}),
|
|
103
|
+
...headerOf(event)
|
|
104
|
+
}
|
|
105
|
+
]
|
|
106
|
+
};
|
|
107
|
+
/* The order's fact - the order record carries it. Sent as an object observation it would make a thing out of nothing. */
|
|
108
|
+
case 'TransactionEvent':
|
|
109
|
+
return { records: [], heldBack: 'the-order-record-carries-it' };
|
|
110
|
+
default:
|
|
111
|
+
throw shapeError('event-type-not-shaped', { type: event.type }, `${event.type} has no canonical shape: no product writes one`);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* A stored event as outbox inputs. When one event becomes several records **each gets its own idempotency key**
|
|
116
|
+
* (`<eventId>#<n>`): the receiver drops a second line with a key it has seen, so one key on two lines would lose the
|
|
117
|
+
* second silently. The record carries no time - the envelope does (a record with a field the contract lacks is refused
|
|
118
|
+
* whole).
|
|
119
|
+
*/
|
|
120
|
+
export function outboxInputsOfEvent(row) {
|
|
121
|
+
const event = row.payload;
|
|
122
|
+
/* A stored payload is checked before it is shaped - a ledger row is only as good as what wrote it. */
|
|
123
|
+
const violations = validateEpcisEvent(event);
|
|
124
|
+
if (violations.length)
|
|
125
|
+
throw shapeError('event-invalid', { event: row.eventId, violations }, `the stored event ${row.eventId} is not a valid EPCIS event: ${violations.join(' · ')}`);
|
|
126
|
+
const { records } = recordsOfEvent(event);
|
|
127
|
+
const eventTime = new Date(typeof event.eventTime === 'string' && event.eventTime ? event.eventTime : row.eventTime);
|
|
128
|
+
return records.map((record, index) => ({ record, eventId: records.length > 1 ? `${row.eventId}#${index}` : row.eventId, eventTime }));
|
|
129
|
+
}
|
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,85 @@ 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
|
+
*
|
|
43
|
+
* 트윈이 읽는 낱말만 이름 붙인다. 야드 앱만 내는 재배치(`reposition`)는 야드의 낱말이다 — 생산자 고유의 종류는 생산자가 갖는다
|
|
44
|
+
* (2026-11-19 계약 내용 점검, 사용자 결정). 트윈은 작업 종류를 닫아 두지 않으므로 그 낱말도 그대로 받는다.
|
|
45
|
+
*/
|
|
46
|
+
export declare const YMS_TASK_KIND: {
|
|
47
|
+
readonly spot: "spot";
|
|
48
|
+
readonly spotLive: "spot-live";
|
|
49
|
+
readonly pull: "pull";
|
|
50
|
+
readonly dwell: "dwell";
|
|
51
|
+
readonly depart: "depart";
|
|
52
|
+
};
|
|
53
|
+
export type YmsTaskKind = (typeof YMS_TASK_KIND)[keyof typeof YMS_TASK_KIND];
|
|
54
|
+
/** 야드 운영 모드 — `drop`: 트레일러를 슬롯에 내려놓고 창이 오면 호슬러가 끈다. `live`: 게이트에서 기다리다 도어로 곧장. */
|
|
55
|
+
export declare const YARD_MODE: readonly ["drop", "live"];
|
|
56
|
+
export type YardMode = (typeof YARD_MODE)[number];
|
|
57
|
+
/**
|
|
58
|
+
* 예약의 **상태** — 닫힌 목록.
|
|
59
|
+
*
|
|
60
|
+
* 끝나는 낱말 둘(`completed` · `cancelled`)은 계약의 `ORDER_TERMINAL_STATUS` 와 **같은 낱말**이다. 다르게 쓰면 `isOrderTerminal` 이
|
|
61
|
+
* 그것을 모르고 트윈에서 그 예약은 영영 열린 오더가 된다.
|
|
62
|
+
*/
|
|
63
|
+
export declare const YMS_APPOINTMENT_STATUS: readonly ["scheduled", "checked-in", "at-door", "completed", "cancelled"];
|
|
64
|
+
export type YmsAppointmentStatus = (typeof YMS_APPOINTMENT_STATUS)[number];
|
|
65
|
+
/**
|
|
66
|
+
* 예약이 **취소된 까닭** — 닫힌 목록. 노쇼는 상태가 아니라 이 사유다.
|
|
67
|
+
*
|
|
68
|
+
* 노쇼를 상태로 두면 위와 같은 까닭으로 끝나지 않는 오더가 된다. 노쇼율은 `cancelled` 중 `no-show` 를 세어 답한다.
|
|
69
|
+
* · `no-show` — 창이 지나도록 오지 않았다. · `carrier` — 운송사가 취소했다. · `site` — 현장이 취소했다.
|
|
70
|
+
*/
|
|
71
|
+
export declare const YMS_APPOINTMENT_CANCEL_REASON: readonly ["no-show", "carrier", "site"];
|
|
72
|
+
export type YmsAppointmentCancelReason = (typeof YMS_APPOINTMENT_CANCEL_REASON)[number];
|
|
73
|
+
/** 그 낱말이 예약의 상태인가 — 모르는 낱말을 「진행 중」으로 받지 않도록 보내기 전에 묻는다. */
|
|
74
|
+
export declare function isYmsAppointmentStatus(v: unknown): v is YmsAppointmentStatus;
|
|
75
|
+
/** 예약이 끝났나 — 판정은 계약의 오더 종결 낱말 한 곳을 따른다. */
|
|
76
|
+
export declare function isAppointmentClosed(status: unknown): boolean;
|
|
77
|
+
/**
|
|
78
|
+
* 도크 도어의 상태 — **파생한다.** 저장하는 값이 아니다(`locationStatusOf` 와 같은 규율).
|
|
79
|
+
*
|
|
80
|
+
* · `blocked` — 차단 기간(고장 · 청소 · 점검) 안이다. 점유보다 먼저 본다: 막힌 도어는 비어 있어도 쓸 수 없다.
|
|
81
|
+
* · `occupied` — 붙어 있는 트레일러 수가 동시 수(`OperationalLocation.parallelism`, 없으면 1)에 닿았다.
|
|
82
|
+
* · `free` — 그 밖.
|
|
83
|
+
*/
|
|
84
|
+
export declare const DOCK_DOOR_STATUS: readonly ["free", "occupied", "blocked"];
|
|
85
|
+
export type DockDoorStatus = (typeof DOCK_DOOR_STATUS)[number];
|
|
86
|
+
export declare function dockDoorStatusOf(d: {
|
|
87
|
+
occupancy?: number;
|
|
88
|
+
parallelism?: number;
|
|
89
|
+
blocked?: boolean;
|
|
90
|
+
}): DockDoorStatus;
|
|
91
|
+
/**
|
|
92
|
+
* **How many trailers a door holds at once** - the definition of `parallelism` on a dock door (see `LocationState.parallelism`):
|
|
93
|
+
* a whole number, at least one - unset, 0 or negative is 1, and 1.5 is 1 (half a trailer does not dock). There is no
|
|
94
|
+
* "unlimited" door. One reading for the door's state, the booking refusal and the measures, on the producer and the twin
|
|
95
|
+
* alike (the yard floored it and this file did not - a 1.5 read two ways, found 2026-11-18).
|
|
96
|
+
*/
|
|
97
|
+
export declare function dockDoorCapacityOf(parallelism: unknown): number;
|
|
98
|
+
/**
|
|
99
|
+
* 트레일러의 적재 — 게이트에서 **신고된** 것. 화물 SSCC 를 아는 경우 내용물은 AggregationEvent 가 말하며, 이 값은 그것을 대신하지 않는다
|
|
100
|
+
* (내용을 모르는 방문 트레일러가 「차 있다 / 비었다」만 말할 때의 칸이다).
|
|
101
|
+
*/
|
|
102
|
+
export declare const TRAILER_LOAD: readonly ["empty", "loaded"];
|
|
103
|
+
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,90 @@ 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
|
+
*
|
|
79
|
+
* 트윈이 읽는 낱말만 이름 붙인다. 야드 앱만 내는 재배치(`reposition`)는 야드의 낱말이다 — 생산자 고유의 종류는 생산자가 갖는다
|
|
80
|
+
* (2026-11-19 계약 내용 점검, 사용자 결정). 트윈은 작업 종류를 닫아 두지 않으므로 그 낱말도 그대로 받는다.
|
|
81
|
+
*/
|
|
82
|
+
export const YMS_TASK_KIND = {
|
|
83
|
+
spot: 'spot',
|
|
84
|
+
spotLive: 'spot-live',
|
|
85
|
+
pull: 'pull',
|
|
86
|
+
dwell: 'dwell',
|
|
87
|
+
depart: 'depart'
|
|
88
|
+
};
|
|
89
|
+
/** 야드 운영 모드 — `drop`: 트레일러를 슬롯에 내려놓고 창이 오면 호슬러가 끈다. `live`: 게이트에서 기다리다 도어로 곧장. */
|
|
90
|
+
export const YARD_MODE = ['drop', 'live'];
|
|
91
|
+
/**
|
|
92
|
+
* 예약의 **상태** — 닫힌 목록.
|
|
93
|
+
*
|
|
94
|
+
* 끝나는 낱말 둘(`completed` · `cancelled`)은 계약의 `ORDER_TERMINAL_STATUS` 와 **같은 낱말**이다. 다르게 쓰면 `isOrderTerminal` 이
|
|
95
|
+
* 그것을 모르고 트윈에서 그 예약은 영영 열린 오더가 된다.
|
|
96
|
+
*/
|
|
97
|
+
export const YMS_APPOINTMENT_STATUS = ['scheduled', 'checked-in', 'at-door', 'completed', 'cancelled'];
|
|
98
|
+
/**
|
|
99
|
+
* 예약이 **취소된 까닭** — 닫힌 목록. 노쇼는 상태가 아니라 이 사유다.
|
|
100
|
+
*
|
|
101
|
+
* 노쇼를 상태로 두면 위와 같은 까닭으로 끝나지 않는 오더가 된다. 노쇼율은 `cancelled` 중 `no-show` 를 세어 답한다.
|
|
102
|
+
* · `no-show` — 창이 지나도록 오지 않았다. · `carrier` — 운송사가 취소했다. · `site` — 현장이 취소했다.
|
|
103
|
+
*/
|
|
104
|
+
export const YMS_APPOINTMENT_CANCEL_REASON = ['no-show', 'carrier', 'site'];
|
|
105
|
+
/** 그 낱말이 예약의 상태인가 — 모르는 낱말을 「진행 중」으로 받지 않도록 보내기 전에 묻는다. */
|
|
106
|
+
export function isYmsAppointmentStatus(v) {
|
|
107
|
+
return typeof v === 'string' && YMS_APPOINTMENT_STATUS.includes(v);
|
|
108
|
+
}
|
|
109
|
+
/** 예약이 끝났나 — 판정은 계약의 오더 종결 낱말 한 곳을 따른다. */
|
|
110
|
+
export function isAppointmentClosed(status) {
|
|
111
|
+
return typeof status === 'string' && ORDER_TERMINAL_STATUS.includes(status);
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* 도크 도어의 상태 — **파생한다.** 저장하는 값이 아니다(`locationStatusOf` 와 같은 규율).
|
|
115
|
+
*
|
|
116
|
+
* · `blocked` — 차단 기간(고장 · 청소 · 점검) 안이다. 점유보다 먼저 본다: 막힌 도어는 비어 있어도 쓸 수 없다.
|
|
117
|
+
* · `occupied` — 붙어 있는 트레일러 수가 동시 수(`OperationalLocation.parallelism`, 없으면 1)에 닿았다.
|
|
118
|
+
* · `free` — 그 밖.
|
|
119
|
+
*/
|
|
120
|
+
export const DOCK_DOOR_STATUS = ['free', 'occupied', 'blocked'];
|
|
121
|
+
export function dockDoorStatusOf(d) {
|
|
122
|
+
if (d.blocked)
|
|
123
|
+
return 'blocked';
|
|
124
|
+
return (d.occupancy ?? 0) >= dockDoorCapacityOf(d.parallelism) ? 'occupied' : 'free';
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* **How many trailers a door holds at once** - the definition of `parallelism` on a dock door (see `LocationState.parallelism`):
|
|
128
|
+
* a whole number, at least one - unset, 0 or negative is 1, and 1.5 is 1 (half a trailer does not dock). There is no
|
|
129
|
+
* "unlimited" door. One reading for the door's state, the booking refusal and the measures, on the producer and the twin
|
|
130
|
+
* alike (the yard floored it and this file did not - a 1.5 read two ways, found 2026-11-18).
|
|
131
|
+
*/
|
|
132
|
+
export function dockDoorCapacityOf(parallelism) {
|
|
133
|
+
return Math.max(1, Math.floor(Number(parallelism) || 0));
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* 트레일러의 적재 — 게이트에서 **신고된** 것. 화물 SSCC 를 아는 경우 내용물은 AggregationEvent 가 말하며, 이 값은 그것을 대신하지 않는다
|
|
137
|
+
* (내용을 모르는 방문 트레일러가 「차 있다 / 비었다」만 말할 때의 칸이다).
|
|
138
|
+
*/
|
|
139
|
+
export const TRAILER_LOAD = ['empty', 'loaded'];
|