@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-cjs/index.cjs
CHANGED
|
@@ -21,6 +21,7 @@ var index_exports = {};
|
|
|
21
21
|
__export(index_exports, {
|
|
22
22
|
ABSENCE: () => ABSENCE,
|
|
23
23
|
ALLOCATION_POLICY: () => ALLOCATION_POLICY,
|
|
24
|
+
ASSET_STATUS: () => ASSET_STATUS,
|
|
24
25
|
BASIS_UNKNOWN: () => BASIS_UNKNOWN,
|
|
25
26
|
BIZSTEP: () => BIZSTEP,
|
|
26
27
|
BTT: () => BTT,
|
|
@@ -34,6 +35,7 @@ __export(index_exports, {
|
|
|
34
35
|
COMMAND_STATE: () => COMMAND_STATE,
|
|
35
36
|
DISP: () => DISP,
|
|
36
37
|
DISPOSITION_DECISION: () => DISPOSITION_DECISION,
|
|
38
|
+
DOCK_DOOR_STATUS: () => DOCK_DOOR_STATUS,
|
|
37
39
|
DOMAIN_CATALOG: () => DOMAIN_CATALOG,
|
|
38
40
|
DOMAIN_SYSTEMS: () => DOMAIN_SYSTEMS,
|
|
39
41
|
EMPTY_BECAUSE: () => EMPTY_BECAUSE,
|
|
@@ -71,14 +73,21 @@ __export(index_exports, {
|
|
|
71
73
|
ORDER_FOLD_DEFAULT: () => ORDER_FOLD_DEFAULT,
|
|
72
74
|
ORDER_FOLD_HOUR_MS: () => ORDER_FOLD_HOUR_MS,
|
|
73
75
|
ORDER_TERMINAL_STATUS: () => ORDER_TERMINAL_STATUS,
|
|
76
|
+
PARTY_ROLE: () => PARTY_ROLE,
|
|
77
|
+
PARTY_URI_MAX_LENGTH: () => PARTY_URI_MAX_LENGTH,
|
|
78
|
+
PARTY_URI_RECOMMENDED_LENGTH: () => PARTY_URI_RECOMMENDED_LENGTH,
|
|
79
|
+
PERSON_STATUS: () => PERSON_STATUS,
|
|
74
80
|
PRIORITY_UNSET: () => PRIORITY_UNSET,
|
|
75
81
|
PRIVATE_BIZSTEP: () => PRIVATE_BIZSTEP,
|
|
76
82
|
READ_BASIS: () => READ_BASIS,
|
|
77
83
|
REFUSED_WITHOUT_CODE: () => REFUSED_WITHOUT_CODE,
|
|
78
84
|
RESOURCE_KIND: () => RESOURCE_KIND,
|
|
79
85
|
RETIRED_VOCABULARY: () => RETIRED_VOCABULARY,
|
|
86
|
+
RETURN_TO_SUPPLIER: () => RETURN_TO_SUPPLIER,
|
|
80
87
|
SCHEDULE_STATUS: () => SCHEDULE_STATUS,
|
|
81
88
|
SIGNATURE_REJECTED_REASONS: () => SIGNATURE_REJECTED_REASONS,
|
|
89
|
+
SOURCE_DEST_PARTY_TYPE: () => SOURCE_DEST_PARTY_TYPE,
|
|
90
|
+
TRAILER_LOAD: () => TRAILER_LOAD,
|
|
82
91
|
TWIN_AXES: () => TWIN_AXES,
|
|
83
92
|
TWIN_PROPERTIES: () => TWIN_PROPERTIES,
|
|
84
93
|
TWIN_RELATIONS: () => TWIN_RELATIONS,
|
|
@@ -97,8 +106,13 @@ __export(index_exports, {
|
|
|
97
106
|
WMS_RECEIVING_ORDER_KINDS: () => WMS_RECEIVING_ORDER_KINDS,
|
|
98
107
|
WMS_TYPES: () => WMS_TYPES,
|
|
99
108
|
YARD_BIZSTEP: () => YARD_BIZSTEP,
|
|
109
|
+
YARD_MODE: () => YARD_MODE,
|
|
100
110
|
YARD_PRIVATE_BIZSTEP: () => YARD_PRIVATE_BIZSTEP,
|
|
111
|
+
YMS_APPOINTMENT_CANCEL_REASON: () => YMS_APPOINTMENT_CANCEL_REASON,
|
|
112
|
+
YMS_APPOINTMENT_STATUS: () => YMS_APPOINTMENT_STATUS,
|
|
101
113
|
YMS_LOCATION_TYPES: () => YMS_LOCATION_TYPES,
|
|
114
|
+
YMS_ORDER_KIND: () => YMS_ORDER_KIND,
|
|
115
|
+
YMS_TASK_KIND: () => YMS_TASK_KIND,
|
|
102
116
|
YMS_TYPES: () => YMS_TYPES,
|
|
103
117
|
acceptsPerformance: () => acceptsPerformance,
|
|
104
118
|
activeShiftAt: () => activeShiftAt,
|
|
@@ -132,11 +146,13 @@ __export(index_exports, {
|
|
|
132
146
|
computeOee: () => computeOee,
|
|
133
147
|
conversionFactorOf: () => conversionFactorOf,
|
|
134
148
|
criterionSaysNothing: () => criterionSaysNothing,
|
|
149
|
+
dockDoorStatusOf: () => dockDoorStatusOf,
|
|
135
150
|
documentPath: () => documentPath,
|
|
136
151
|
dueStatusOf: () => dueStatusOf,
|
|
137
152
|
effectivityAt: () => effectivityAt,
|
|
138
153
|
electricalUpstreamOf: () => electricalUpstreamOf,
|
|
139
154
|
emptyFoldedOrders: () => emptyFoldedOrders,
|
|
155
|
+
epcCandidatesOfGs1: () => epcCandidatesOfGs1,
|
|
140
156
|
equipmentClassMembership: () => equipmentClassMembership,
|
|
141
157
|
erpCapabilityGaps: () => erpCapabilityGaps,
|
|
142
158
|
expiryFromAttributes: () => expiryFromAttributes,
|
|
@@ -148,9 +164,13 @@ __export(index_exports, {
|
|
|
148
164
|
generationFractionAt: () => generationFractionAt,
|
|
149
165
|
graiUri: () => graiUri,
|
|
150
166
|
gs1KeyDigitViolation: () => gs1KeyDigitViolation,
|
|
167
|
+
gtin14OfItem: () => gtin14OfItem,
|
|
168
|
+
gtin14OfItemClass: () => gtin14OfItemClass,
|
|
151
169
|
hierarchyOf: () => hierarchyOf,
|
|
152
170
|
homeOf: () => homeOf,
|
|
153
171
|
hourStartOf: () => hourStartOf,
|
|
172
|
+
identifierText: () => identifierText,
|
|
173
|
+
identifierUnderNamespace: () => identifierUnderNamespace,
|
|
154
174
|
identityGroundingOf: () => identityGroundingOf,
|
|
155
175
|
inWorkCalendar: () => inWorkCalendar,
|
|
156
176
|
inWorkCalendarAt: () => inWorkCalendarAt,
|
|
@@ -165,7 +185,10 @@ __export(index_exports, {
|
|
|
165
185
|
ingestEnergyUsagePeriodRecords: () => ingestEnergyUsagePeriodRecords,
|
|
166
186
|
ingestMasterData: () => ingestMasterData,
|
|
167
187
|
ingestOperationalRecords: () => ingestOperationalRecords,
|
|
188
|
+
inheritedExpiry: () => inheritedExpiry,
|
|
189
|
+
inheritedLotUse: () => inheritedLotUse,
|
|
168
190
|
isAggregationRecord: () => isAggregationRecord,
|
|
191
|
+
isAppointmentClosed: () => isAppointmentClosed,
|
|
169
192
|
isCacheableTense: () => isCacheableTense,
|
|
170
193
|
isCommandTerminal: () => isCommandTerminal,
|
|
171
194
|
isElectricalLocationType: () => isElectricalLocationType,
|
|
@@ -187,6 +210,8 @@ __export(index_exports, {
|
|
|
187
210
|
isOperationalAttentionV1: () => isOperationalAttentionV1,
|
|
188
211
|
isOperationalRecord: () => isOperationalRecord,
|
|
189
212
|
isOrderTerminal: () => isOrderTerminal,
|
|
213
|
+
isPartyRef: () => isPartyRef,
|
|
214
|
+
isPartyUri: () => isPartyUri,
|
|
190
215
|
isPlannedStopStatus: () => isPlannedStopStatus,
|
|
191
216
|
isRecipeExecutionBasis: () => isRecipeExecutionBasis,
|
|
192
217
|
isResourceKind: () => isResourceKind,
|
|
@@ -195,9 +220,11 @@ __export(index_exports, {
|
|
|
195
220
|
isWebhookDeliveryCode: () => isWebhookDeliveryCode,
|
|
196
221
|
isWebhookSecretSegment: () => isWebhookSecretSegment,
|
|
197
222
|
isWorkShiftExecutionBasis: () => isWorkShiftExecutionBasis,
|
|
223
|
+
isYmsAppointmentStatus: () => isYmsAppointmentStatus,
|
|
198
224
|
isoDurationHours: () => isoDurationHours,
|
|
199
225
|
itemClassOf: () => itemClassOf,
|
|
200
226
|
itemKeyOf: () => itemKeyOf,
|
|
227
|
+
itemMaterialDefinitionId: () => itemMaterialDefinitionId,
|
|
201
228
|
judgeAgainstSpec: () => judgeAgainstSpec,
|
|
202
229
|
levelOfLocationType: () => levelOfLocationType,
|
|
203
230
|
lgtinClass: () => lgtinClass,
|
|
@@ -207,8 +234,10 @@ __export(index_exports, {
|
|
|
207
234
|
lotClassOfItem: () => lotClassOfItem,
|
|
208
235
|
lotClassUri: () => lotClassUri,
|
|
209
236
|
lotFromAttributes: () => lotFromAttributes,
|
|
237
|
+
lotLineageOf: () => lotLineageOf,
|
|
210
238
|
mapRecord: () => mapRecord,
|
|
211
239
|
mapRecordChecked: () => mapRecordChecked,
|
|
240
|
+
materialDefinitionIdOf: () => materialDefinitionIdOf,
|
|
212
241
|
materialMovementKey: () => materialMovementKey,
|
|
213
242
|
meetsTests: () => meetsTests,
|
|
214
243
|
minuteOfDayAt: () => minuteOfDayAt,
|
|
@@ -227,8 +256,13 @@ __export(index_exports, {
|
|
|
227
256
|
orderFoldPolicyOf: () => orderFoldPolicyOf,
|
|
228
257
|
outsideLimit: () => outsideLimit,
|
|
229
258
|
parseEpc: () => parseEpc,
|
|
259
|
+
parseGs1: () => parseGs1,
|
|
230
260
|
parseIsoDuration: () => parseIsoDuration,
|
|
231
261
|
partitionLensLocations: () => partitionLensLocations,
|
|
262
|
+
partyIdentifierViolation: () => partyIdentifierViolation,
|
|
263
|
+
partyRowIdOf: () => partyRowIdOf,
|
|
264
|
+
partyUri: () => partyUri,
|
|
265
|
+
partyUriLengthNote: () => partyUriLengthNote,
|
|
232
266
|
passThroughReversible: () => passThroughReversible,
|
|
233
267
|
performanceKey: () => performanceKey,
|
|
234
268
|
periodFactId: () => periodFactId,
|
|
@@ -256,6 +290,7 @@ __export(index_exports, {
|
|
|
256
290
|
sgtinUri: () => sgtinUri,
|
|
257
291
|
splitFlowOrders: () => splitFlowOrders,
|
|
258
292
|
splitRelationIds: () => splitRelationIds,
|
|
293
|
+
ssccDigitsOf: () => ssccDigitsOf,
|
|
259
294
|
ssccUri: () => ssccUri,
|
|
260
295
|
standsNewOrderRow: () => standsNewOrderRow,
|
|
261
296
|
stateFieldsOf: () => stateFieldsOf,
|
|
@@ -1157,6 +1192,8 @@ var EQUIPMENT_STATUS = ["busy", "setup", "down", "idle", "planned-stop"];
|
|
|
1157
1192
|
function isEquipmentStatus(value) {
|
|
1158
1193
|
return typeof value === "string" && EQUIPMENT_STATUS.includes(value);
|
|
1159
1194
|
}
|
|
1195
|
+
var PERSON_STATUS = ["idle", "busy"];
|
|
1196
|
+
var ASSET_STATUS = ["idle", "in-use"];
|
|
1160
1197
|
var RESOURCE_KIND = ["equipment", "personnel", "material", "asset"];
|
|
1161
1198
|
function isResourceKind(value) {
|
|
1162
1199
|
return typeof value === "string" && RESOURCE_KIND.includes(value);
|
|
@@ -1343,100 +1380,6 @@ function nonWorkingMsIn(calendar, fromMs, toMs, utcOffsetMinutes) {
|
|
|
1343
1380
|
return closed * 6e4;
|
|
1344
1381
|
}
|
|
1345
1382
|
|
|
1346
|
-
// src/wms-profile.ts
|
|
1347
|
-
var BIZSTEP = {
|
|
1348
|
-
receiving: "urn:epcglobal:cbv:bizstep:receiving",
|
|
1349
|
-
storing: "urn:epcglobal:cbv:bizstep:storing",
|
|
1350
|
-
picking: "urn:epcglobal:cbv:bizstep:picking",
|
|
1351
|
-
packing: "urn:epcglobal:cbv:bizstep:packing",
|
|
1352
|
-
staging_outbound: "urn:epcglobal:cbv:bizstep:staging_outbound",
|
|
1353
|
-
shipping: "urn:epcglobal:cbv:bizstep:shipping",
|
|
1354
|
-
/**
|
|
1355
|
-
* **Replenishment** — moving goods to where they are picked from. CBV has no `replenishing`; this contract
|
|
1356
|
-
* wrote one until 2026-09-24, and the closed-list test found it. CBV `stocking` is the step that means it:
|
|
1357
|
-
* "…within a location to make an object available to the customer or for order fulfilment within a DC"
|
|
1358
|
-
* (CBV ontology, `BizStep-stocking`). Ruled by the chief architect; no reader branches on the value, and
|
|
1359
|
-
* the journal keeps what it already wrote (ADR-0038).
|
|
1360
|
-
*/
|
|
1361
|
-
stocking: "urn:epcglobal:cbv:bizstep:stocking",
|
|
1362
|
-
/**
|
|
1363
|
-
* **Counted, and the book set to the count** — CBV `cycle_counting`. Primary source: the CBV ontology
|
|
1364
|
-
* (gs1/EPCIS `Ontology/CBV.ttl`, `cbv:BizStep-cycle_counting`, also served at ref.gs1.org/cbv): "Process of
|
|
1365
|
-
* counting objects within a location in order to obtain an accurate inventory for business needs other
|
|
1366
|
-
* than accounting purposes (e.g., replenishment and allocation)."
|
|
1367
|
-
*
|
|
1368
|
-
* **Only for an event somebody actually counted** (chief architect, 2026-09-24). A person correcting the
|
|
1369
|
-
* book without counting is `CBV_BIZSTEP.other` with the reason carried as a value — `epcis.ts` says why:
|
|
1370
|
-
* writing that as `cycle_counting` records a count that never happened. A count for the accounts is a
|
|
1371
|
-
* different CBV step (`stock_taking`) and is not this one.
|
|
1372
|
-
*/
|
|
1373
|
-
cycle_counting: "urn:epcglobal:cbv:bizstep:cycle_counting"
|
|
1374
|
-
};
|
|
1375
|
-
var BTT = {
|
|
1376
|
-
/** Purchase Order — the document an inbound receipt is made against. */
|
|
1377
|
-
po: "urn:epcglobal:cbv:btt:po",
|
|
1378
|
-
/** Purchase Order Confirmation — the seller's sales order. */
|
|
1379
|
-
poc: "urn:epcglobal:cbv:btt:poc",
|
|
1380
|
-
/** Despatch Advice (ASN) — announces an inbound delivery; also attached when shipping. */
|
|
1381
|
-
desadv: "urn:epcglobal:cbv:btt:desadv",
|
|
1382
|
-
/** Receiving Advice — the reply once an inbound receipt is complete. */
|
|
1383
|
-
recadv: "urn:epcglobal:cbv:btt:recadv",
|
|
1384
|
-
/** Return Merchandise Authorization — what a return is received against. */
|
|
1385
|
-
rma: "urn:epcglobal:cbv:btt:rma",
|
|
1386
|
-
/** Bill of Lading — the carrier's document, attached when shipping. */
|
|
1387
|
-
bol: "urn:epcglobal:cbv:btt:bol"
|
|
1388
|
-
};
|
|
1389
|
-
var WMS_ORDER_KIND = {
|
|
1390
|
-
/**
|
|
1391
|
-
* Expected receipt (ASN) — what was promised to arrive, and how much of it has.
|
|
1392
|
-
*
|
|
1393
|
-
* Flow metrics leave it out: the arrival both raises and fulfils it, so counting it would add a
|
|
1394
|
-
* completed order per arrival and never clear the backlog (`isFlowOrder`).
|
|
1395
|
-
*/
|
|
1396
|
-
inbound: "inbound",
|
|
1397
|
-
/** Outbound order — what the kernel's sales order is. */
|
|
1398
|
-
outbound: "outbound",
|
|
1399
|
-
/** Receipt of returned goods. */
|
|
1400
|
-
return: "return",
|
|
1401
|
-
/** Stock transfer between sites. CBV has no document type for it: carry the id without a type. */
|
|
1402
|
-
transfer: "transfer"
|
|
1403
|
-
};
|
|
1404
|
-
var WMS_RECEIVING_ORDER_KINDS = [WMS_ORDER_KIND.inbound, WMS_ORDER_KIND.return];
|
|
1405
|
-
function isFlowOrder(o) {
|
|
1406
|
-
const kind = String(o?.kind ?? "").trim();
|
|
1407
|
-
return !WMS_RECEIVING_ORDER_KINDS.includes(kind);
|
|
1408
|
-
}
|
|
1409
|
-
function splitFlowOrders(orders) {
|
|
1410
|
-
const flow = [];
|
|
1411
|
-
let receiving = 0;
|
|
1412
|
-
let kindless = 0;
|
|
1413
|
-
for (const o of orders ?? []) {
|
|
1414
|
-
const kind = String(o?.kind ?? "").trim();
|
|
1415
|
-
if (WMS_RECEIVING_ORDER_KINDS.includes(kind)) {
|
|
1416
|
-
receiving++;
|
|
1417
|
-
continue;
|
|
1418
|
-
}
|
|
1419
|
-
if (!kind) kindless++;
|
|
1420
|
-
flow.push(o);
|
|
1421
|
-
}
|
|
1422
|
-
return { flow, receiving, kindless };
|
|
1423
|
-
}
|
|
1424
|
-
var WMS_LOCATION_TYPES = ["dock", "storage", "staging", "dock-ship", "vas-station"];
|
|
1425
|
-
var WMS_LOCATION_LEVEL = {
|
|
1426
|
-
dock: "StorageZone",
|
|
1427
|
-
storage: "StorageUnit",
|
|
1428
|
-
staging: "StorageZone",
|
|
1429
|
-
"dock-ship": "StorageZone",
|
|
1430
|
-
"vas-station": "WorkCell"
|
|
1431
|
-
};
|
|
1432
|
-
var WMS_TYPES = [
|
|
1433
|
-
...WMS_LOCATION_TYPES.filter((k) => k !== "vas-station").map((k) => ({ key: k, role: "location", label: `twin.type.${k}`, standardClass: { epcis: "bizLocation" }, identity: { scheme: "gs1:SGLN" }, level: WMS_LOCATION_LEVEL[k], capabilities: ["storable"] })),
|
|
1434
|
-
{ key: "vas-station", role: "location", label: "twin.type.vas-station", standardClass: { epcis: "bizLocation", isa95: "WorkCenter" }, identity: { scheme: "gs1:SGLN" }, level: WMS_LOCATION_LEVEL["vas-station"], capabilities: ["storable", "processable"] },
|
|
1435
|
-
{ key: "forklift", role: "equipment", label: "twin.type.forklift", standardClass: { epcis: "object", iso55000: "Asset" }, identity: { scheme: "gs1:GIAI" }, capabilities: ["mobile", "operable"] },
|
|
1436
|
-
/** 유통가공 작업자·작업대 설비 — 가공을 수행하는 능동 자원(ISA-95 `Equipment`). */
|
|
1437
|
-
{ key: "packer", role: "equipment", label: "twin.type.packer", standardClass: { epcis: "object", isa95: "Equipment" }, identity: { scheme: "gs1:GIAI" }, capabilities: ["processable", "operable"] }
|
|
1438
|
-
];
|
|
1439
|
-
|
|
1440
1383
|
// src/epcis.ts
|
|
1441
1384
|
var EPCIS_CONTEXT = "https://ref.gs1.org/standards/epcis/2.0.0/epcis-context.jsonld";
|
|
1442
1385
|
var UTC_OFFSET = "+00:00";
|
|
@@ -1505,7 +1448,15 @@ var DISP = {
|
|
|
1505
1448
|
* 그때 열되, **판정 자체는 여기서 끝난다.**
|
|
1506
1449
|
*/
|
|
1507
1450
|
conformant: "urn:epcglobal:cbv:disp:conformant",
|
|
1508
|
-
non_conformant: "urn:epcglobal:cbv:disp:non_conformant"
|
|
1451
|
+
non_conformant: "urn:epcglobal:cbv:disp:non_conformant",
|
|
1452
|
+
/**
|
|
1453
|
+
* **Sent back** — CBV `returned`. Primary source: the CBV ontology (gs1/EPCIS `Ontology/CBV.ttl`, versionInfo 2.0,
|
|
1454
|
+
* `cbv:Disp-returned`, read 2026-10-23): "Object has been sent or brought back for various reasons. It may or may not
|
|
1455
|
+
* be sellable." It is what goods going back to their supplier carry when they leave (`RETURN_TO_SUPPLIER`), and what
|
|
1456
|
+
* a customer's return may carry when it arrives. Added for the warehouse's return to supplier (operato-application
|
|
1457
|
+
* ADR-0154 decision 2, ruled: the words before the document).
|
|
1458
|
+
*/
|
|
1459
|
+
returned: "urn:epcglobal:cbv:disp:returned"
|
|
1509
1460
|
};
|
|
1510
1461
|
var HATIOLAB_VOCABULARY = "https://hatiolab.com/voc/";
|
|
1511
1462
|
var PRIVATE_BIZSTEP = {
|
|
@@ -1631,6 +1582,33 @@ function itemClassOf(uri) {
|
|
|
1631
1582
|
}
|
|
1632
1583
|
return parsed.uri;
|
|
1633
1584
|
}
|
|
1585
|
+
function materialDefinitionIdOf(epcClass) {
|
|
1586
|
+
const raw = epcClass?.trim();
|
|
1587
|
+
if (!raw) return void 0;
|
|
1588
|
+
const parsed = parseEpc(raw);
|
|
1589
|
+
if (parsed.instance) return void 0;
|
|
1590
|
+
if (parsed.scheme === "lgtin" && parsed.gtinKey) {
|
|
1591
|
+
const [companyPrefix, itemRef] = parsed.gtinKey.split(".");
|
|
1592
|
+
return sgtinClass(companyPrefix, itemRef);
|
|
1593
|
+
}
|
|
1594
|
+
if (parsed.item !== void 0) return parsed.item;
|
|
1595
|
+
const inHouse = /(?:\/class\/|:class:)([^/:\s]+)$/.exec(raw);
|
|
1596
|
+
if (inHouse) {
|
|
1597
|
+
try {
|
|
1598
|
+
return decodeURIComponent(inHouse[1]);
|
|
1599
|
+
} catch {
|
|
1600
|
+
}
|
|
1601
|
+
}
|
|
1602
|
+
return raw;
|
|
1603
|
+
}
|
|
1604
|
+
function itemMaterialDefinitionId(item) {
|
|
1605
|
+
if (!item) return void 0;
|
|
1606
|
+
if (item.definitionId) return item.definitionId;
|
|
1607
|
+
const fromClass = materialDefinitionIdOf(item.gtin);
|
|
1608
|
+
if (fromClass) return fromClass;
|
|
1609
|
+
const [companyPrefix, itemRef] = (item.gtinKey ?? "").split(".");
|
|
1610
|
+
return companyPrefix && itemRef ? sgtinClass(companyPrefix, itemRef) : void 0;
|
|
1611
|
+
}
|
|
1634
1612
|
function lotClassOfItem(itemClass, lot) {
|
|
1635
1613
|
if (!itemClass) return void 0;
|
|
1636
1614
|
const idpat = /^urn:epc:idpat:sgtin:(\d+)\.(\d+)\.\*$/.exec(itemClass);
|
|
@@ -1696,6 +1674,9 @@ var PERCENT_ENCODED = {
|
|
|
1696
1674
|
/* 로트 클래스의 가르는 글자 — `lotClassUri` 만 쓴다(§`LOT_COMPONENT_BREAKING`). 표는 한 벌이다. */
|
|
1697
1675
|
";": "%3B"
|
|
1698
1676
|
};
|
|
1677
|
+
function identifierUnderNamespace(namespace, marker, id) {
|
|
1678
|
+
return underNamespace(namespace, marker, id);
|
|
1679
|
+
}
|
|
1699
1680
|
function underNamespace(namespace, marker, id) {
|
|
1700
1681
|
const raw = String(id);
|
|
1701
1682
|
if (!raw) return void 0;
|
|
@@ -1906,6 +1887,105 @@ function validateEpcisEvent(e) {
|
|
|
1906
1887
|
return v;
|
|
1907
1888
|
}
|
|
1908
1889
|
|
|
1890
|
+
// src/wms-profile.ts
|
|
1891
|
+
var BIZSTEP = {
|
|
1892
|
+
receiving: "urn:epcglobal:cbv:bizstep:receiving",
|
|
1893
|
+
storing: "urn:epcglobal:cbv:bizstep:storing",
|
|
1894
|
+
picking: "urn:epcglobal:cbv:bizstep:picking",
|
|
1895
|
+
packing: "urn:epcglobal:cbv:bizstep:packing",
|
|
1896
|
+
staging_outbound: "urn:epcglobal:cbv:bizstep:staging_outbound",
|
|
1897
|
+
shipping: "urn:epcglobal:cbv:bizstep:shipping",
|
|
1898
|
+
/**
|
|
1899
|
+
* **Replenishment** — moving goods to where they are picked from. CBV has no `replenishing`; this contract
|
|
1900
|
+
* wrote one until 2026-09-24, and the closed-list test found it. CBV `stocking` is the step that means it:
|
|
1901
|
+
* "…within a location to make an object available to the customer or for order fulfilment within a DC"
|
|
1902
|
+
* (CBV ontology, `BizStep-stocking`). Ruled by the chief architect; no reader branches on the value, and
|
|
1903
|
+
* the journal keeps what it already wrote (ADR-0038).
|
|
1904
|
+
*/
|
|
1905
|
+
stocking: "urn:epcglobal:cbv:bizstep:stocking",
|
|
1906
|
+
/**
|
|
1907
|
+
* **Counted, and the book set to the count** — CBV `cycle_counting`. Primary source: the CBV ontology
|
|
1908
|
+
* (gs1/EPCIS `Ontology/CBV.ttl`, `cbv:BizStep-cycle_counting`, also served at ref.gs1.org/cbv): "Process of
|
|
1909
|
+
* counting objects within a location in order to obtain an accurate inventory for business needs other
|
|
1910
|
+
* than accounting purposes (e.g., replenishment and allocation)."
|
|
1911
|
+
*
|
|
1912
|
+
* **Only for an event somebody actually counted** (chief architect, 2026-09-24). A person correcting the
|
|
1913
|
+
* book without counting is `CBV_BIZSTEP.other` with the reason carried as a value — `epcis.ts` says why:
|
|
1914
|
+
* writing that as `cycle_counting` records a count that never happened. A count for the accounts is a
|
|
1915
|
+
* different CBV step (`stock_taking`) and is not this one.
|
|
1916
|
+
*/
|
|
1917
|
+
cycle_counting: "urn:epcglobal:cbv:bizstep:cycle_counting"
|
|
1918
|
+
};
|
|
1919
|
+
var BTT = {
|
|
1920
|
+
/** Purchase Order — the document an inbound receipt is made against. */
|
|
1921
|
+
po: "urn:epcglobal:cbv:btt:po",
|
|
1922
|
+
/** Purchase Order Confirmation — the seller's sales order. */
|
|
1923
|
+
poc: "urn:epcglobal:cbv:btt:poc",
|
|
1924
|
+
/** Despatch Advice (ASN) — announces an inbound delivery; also attached when shipping. */
|
|
1925
|
+
desadv: "urn:epcglobal:cbv:btt:desadv",
|
|
1926
|
+
/** Receiving Advice — the reply once an inbound receipt is complete. */
|
|
1927
|
+
recadv: "urn:epcglobal:cbv:btt:recadv",
|
|
1928
|
+
/** Return Merchandise Authorization — what a return is received against. */
|
|
1929
|
+
rma: "urn:epcglobal:cbv:btt:rma",
|
|
1930
|
+
/** Bill of Lading — the carrier's document, attached when shipping. */
|
|
1931
|
+
bol: "urn:epcglobal:cbv:btt:bol"
|
|
1932
|
+
};
|
|
1933
|
+
var RETURN_TO_SUPPLIER = {
|
|
1934
|
+
bizStep: BIZSTEP.shipping,
|
|
1935
|
+
disposition: DISP.returned,
|
|
1936
|
+
bizTransactionType: BTT.rma
|
|
1937
|
+
};
|
|
1938
|
+
var WMS_ORDER_KIND = {
|
|
1939
|
+
/**
|
|
1940
|
+
* Expected receipt (ASN) — what was promised to arrive, and how much of it has.
|
|
1941
|
+
*
|
|
1942
|
+
* Flow metrics leave it out: the arrival both raises and fulfils it, so counting it would add a
|
|
1943
|
+
* completed order per arrival and never clear the backlog (`isFlowOrder`).
|
|
1944
|
+
*/
|
|
1945
|
+
inbound: "inbound",
|
|
1946
|
+
/** Outbound order — what the kernel's sales order is. */
|
|
1947
|
+
outbound: "outbound",
|
|
1948
|
+
/** Receipt of returned goods. */
|
|
1949
|
+
return: "return",
|
|
1950
|
+
/** Stock transfer between sites. CBV has no document type for it: carry the id without a type. */
|
|
1951
|
+
transfer: "transfer"
|
|
1952
|
+
};
|
|
1953
|
+
var WMS_RECEIVING_ORDER_KINDS = [WMS_ORDER_KIND.inbound, WMS_ORDER_KIND.return];
|
|
1954
|
+
function isFlowOrder(o) {
|
|
1955
|
+
const kind = String(o?.kind ?? "").trim();
|
|
1956
|
+
return !WMS_RECEIVING_ORDER_KINDS.includes(kind);
|
|
1957
|
+
}
|
|
1958
|
+
function splitFlowOrders(orders) {
|
|
1959
|
+
const flow = [];
|
|
1960
|
+
let receiving = 0;
|
|
1961
|
+
let kindless = 0;
|
|
1962
|
+
for (const o of orders ?? []) {
|
|
1963
|
+
const kind = String(o?.kind ?? "").trim();
|
|
1964
|
+
if (WMS_RECEIVING_ORDER_KINDS.includes(kind)) {
|
|
1965
|
+
receiving++;
|
|
1966
|
+
continue;
|
|
1967
|
+
}
|
|
1968
|
+
if (!kind) kindless++;
|
|
1969
|
+
flow.push(o);
|
|
1970
|
+
}
|
|
1971
|
+
return { flow, receiving, kindless };
|
|
1972
|
+
}
|
|
1973
|
+
var WMS_LOCATION_TYPES = ["dock", "storage", "staging", "dock-ship", "vas-station"];
|
|
1974
|
+
var WMS_LOCATION_LEVEL = {
|
|
1975
|
+
dock: "StorageZone",
|
|
1976
|
+
storage: "StorageUnit",
|
|
1977
|
+
staging: "StorageZone",
|
|
1978
|
+
"dock-ship": "StorageZone",
|
|
1979
|
+
"vas-station": "WorkCell"
|
|
1980
|
+
};
|
|
1981
|
+
var WMS_TYPES = [
|
|
1982
|
+
...WMS_LOCATION_TYPES.filter((k) => k !== "vas-station").map((k) => ({ key: k, role: "location", label: `twin.type.${k}`, standardClass: { epcis: "bizLocation" }, identity: { scheme: "gs1:SGLN" }, level: WMS_LOCATION_LEVEL[k], capabilities: ["storable"] })),
|
|
1983
|
+
{ key: "vas-station", role: "location", label: "twin.type.vas-station", standardClass: { epcis: "bizLocation", isa95: "WorkCenter" }, identity: { scheme: "gs1:SGLN" }, level: WMS_LOCATION_LEVEL["vas-station"], capabilities: ["storable", "processable"] },
|
|
1984
|
+
{ key: "forklift", role: "equipment", label: "twin.type.forklift", standardClass: { epcis: "object", iso55000: "Asset" }, identity: { scheme: "gs1:GIAI" }, capabilities: ["mobile", "operable"] },
|
|
1985
|
+
/** 유통가공 작업자·작업대 설비 — 가공을 수행하는 능동 자원(ISA-95 `Equipment`). */
|
|
1986
|
+
{ key: "packer", role: "equipment", label: "twin.type.packer", standardClass: { epcis: "object", isa95: "Equipment" }, identity: { scheme: "gs1:GIAI" }, capabilities: ["processable", "operable"] }
|
|
1987
|
+
];
|
|
1988
|
+
|
|
1909
1989
|
// src/yms-profile.ts
|
|
1910
1990
|
var YARD_BIZSTEP = {
|
|
1911
1991
|
arriving: "urn:epcglobal:cbv:bizstep:arriving",
|
|
@@ -1935,6 +2015,36 @@ var YMS_TYPES = [
|
|
|
1935
2015
|
...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"] })),
|
|
1936
2016
|
{ key: "hostler", role: "equipment", label: "twin.type.hostler", standardClass: { epcis: "object", iso55000: "Asset" }, identity: { scheme: "gs1:GIAI" }, capabilities: ["mobile", "operable"] }
|
|
1937
2017
|
];
|
|
2018
|
+
var YMS_ORDER_KIND = {
|
|
2019
|
+
/** 하차하러 들어오는 트레일러의 예약. */
|
|
2020
|
+
inbound: "appointment",
|
|
2021
|
+
/** 상차하러 들어오는(빈) 트레일러의 예약. */
|
|
2022
|
+
outbound: "appointment-out"
|
|
2023
|
+
};
|
|
2024
|
+
var YMS_TASK_KIND = {
|
|
2025
|
+
spot: "spot",
|
|
2026
|
+
spotLive: "spot-live",
|
|
2027
|
+
pull: "pull",
|
|
2028
|
+
dwell: "dwell",
|
|
2029
|
+
depart: "depart",
|
|
2030
|
+
reposition: "reposition"
|
|
2031
|
+
};
|
|
2032
|
+
var YARD_MODE = ["drop", "live"];
|
|
2033
|
+
var YMS_APPOINTMENT_STATUS = ["scheduled", "checked-in", "at-door", "completed", "cancelled"];
|
|
2034
|
+
var YMS_APPOINTMENT_CANCEL_REASON = ["no-show", "carrier", "site"];
|
|
2035
|
+
function isYmsAppointmentStatus(v) {
|
|
2036
|
+
return typeof v === "string" && YMS_APPOINTMENT_STATUS.includes(v);
|
|
2037
|
+
}
|
|
2038
|
+
function isAppointmentClosed(status) {
|
|
2039
|
+
return typeof status === "string" && ORDER_TERMINAL_STATUS.includes(status);
|
|
2040
|
+
}
|
|
2041
|
+
var DOCK_DOOR_STATUS = ["free", "occupied", "blocked"];
|
|
2042
|
+
function dockDoorStatusOf(d) {
|
|
2043
|
+
if (d.blocked) return "blocked";
|
|
2044
|
+
const cap = typeof d.parallelism === "number" && d.parallelism > 0 ? d.parallelism : 1;
|
|
2045
|
+
return (d.occupancy ?? 0) >= cap ? "occupied" : "free";
|
|
2046
|
+
}
|
|
2047
|
+
var TRAILER_LOAD = ["empty", "loaded"];
|
|
1938
2048
|
|
|
1939
2049
|
// src/mes-profile.ts
|
|
1940
2050
|
var MES_BIZSTEP = {
|
|
@@ -3413,6 +3523,229 @@ function ingestEnergyBillRecords(records, opts) {
|
|
|
3413
3523
|
return { accepted, rejected };
|
|
3414
3524
|
}
|
|
3415
3525
|
|
|
3526
|
+
// src/gs1.ts
|
|
3527
|
+
var FNC1 = "";
|
|
3528
|
+
var FIXED_LENGTH = {
|
|
3529
|
+
"00": 18,
|
|
3530
|
+
// SSCC
|
|
3531
|
+
"01": 14,
|
|
3532
|
+
// GTIN
|
|
3533
|
+
"02": 14,
|
|
3534
|
+
// 포장 안 품목의 GTIN
|
|
3535
|
+
"11": 6,
|
|
3536
|
+
// 생산일
|
|
3537
|
+
"12": 6,
|
|
3538
|
+
// 지급기일
|
|
3539
|
+
"13": 6,
|
|
3540
|
+
// 포장일
|
|
3541
|
+
"15": 6,
|
|
3542
|
+
// 품질유지기한
|
|
3543
|
+
"16": 6,
|
|
3544
|
+
// 판매기한
|
|
3545
|
+
"17": 6,
|
|
3546
|
+
// 사용기한
|
|
3547
|
+
"20": 2,
|
|
3548
|
+
// 제품 변형
|
|
3549
|
+
"414": 13
|
|
3550
|
+
// 물리적 위치의 GLN
|
|
3551
|
+
};
|
|
3552
|
+
var KNOWN_VARIABLE = ["10", "21", "30", "254"];
|
|
3553
|
+
function isBracketed(value) {
|
|
3554
|
+
return /^\(\d{2,4}\)/.test(value);
|
|
3555
|
+
}
|
|
3556
|
+
function parseGs1(value) {
|
|
3557
|
+
const raw = value;
|
|
3558
|
+
if (!raw?.trim()) {
|
|
3559
|
+
return { ok: false, because: "not-gs1", raw };
|
|
3560
|
+
}
|
|
3561
|
+
const parsed = isBracketed(raw) ? fromBracketed(raw) : fromRaw(raw);
|
|
3562
|
+
if (!parsed.ok) {
|
|
3563
|
+
return parsed;
|
|
3564
|
+
}
|
|
3565
|
+
const found = parsed.elements;
|
|
3566
|
+
const count = found["30"] !== void 0 ? Number(found["30"]) : void 0;
|
|
3567
|
+
return {
|
|
3568
|
+
ok: true,
|
|
3569
|
+
scan: {
|
|
3570
|
+
sscc: found["00"],
|
|
3571
|
+
gln: found["414"],
|
|
3572
|
+
glnExtension: found["254"],
|
|
3573
|
+
gtin: found["01"],
|
|
3574
|
+
lot: found["10"],
|
|
3575
|
+
serial: found["21"],
|
|
3576
|
+
useBy: found["17"],
|
|
3577
|
+
/* 숫자가 아니면 담지 않는다 — `NaN` 을 수량으로 두면 더하는 쪽에서 합계가 통째로 사라진다. */
|
|
3578
|
+
count: count !== void 0 && Number.isFinite(count) ? count : void 0,
|
|
3579
|
+
elements: found,
|
|
3580
|
+
raw
|
|
3581
|
+
}
|
|
3582
|
+
};
|
|
3583
|
+
}
|
|
3584
|
+
function fromBracketed(raw) {
|
|
3585
|
+
const elements = {};
|
|
3586
|
+
const pattern = /\((\d{2,4})\)([^(]*)/g;
|
|
3587
|
+
let match;
|
|
3588
|
+
let consumed = 0;
|
|
3589
|
+
while ((match = pattern.exec(raw)) !== null) {
|
|
3590
|
+
const ai = match[1];
|
|
3591
|
+
const value = match[2].trim();
|
|
3592
|
+
const fixed = FIXED_LENGTH[ai];
|
|
3593
|
+
if (fixed !== void 0 && value.length !== fixed) {
|
|
3594
|
+
return { ok: false, because: value.length < fixed ? "truncated" : "unterminated", raw };
|
|
3595
|
+
}
|
|
3596
|
+
elements[ai] = value;
|
|
3597
|
+
consumed = match.index + match[0].length;
|
|
3598
|
+
}
|
|
3599
|
+
if (!Object.keys(elements).length || consumed !== raw.length) {
|
|
3600
|
+
return { ok: false, because: "not-gs1", raw };
|
|
3601
|
+
}
|
|
3602
|
+
return { ok: true, elements };
|
|
3603
|
+
}
|
|
3604
|
+
function fromRaw(raw) {
|
|
3605
|
+
const elements = {};
|
|
3606
|
+
let rest = raw;
|
|
3607
|
+
while (rest.length) {
|
|
3608
|
+
if (rest.startsWith(FNC1)) {
|
|
3609
|
+
rest = rest.slice(1);
|
|
3610
|
+
continue;
|
|
3611
|
+
}
|
|
3612
|
+
const ai = aiAt(rest);
|
|
3613
|
+
if (!ai) {
|
|
3614
|
+
return { ok: false, because: Object.keys(elements).length ? "unterminated" : "not-gs1", raw };
|
|
3615
|
+
}
|
|
3616
|
+
rest = rest.slice(ai.length);
|
|
3617
|
+
const fixed = FIXED_LENGTH[ai];
|
|
3618
|
+
if (fixed !== void 0) {
|
|
3619
|
+
if (rest.length < fixed) {
|
|
3620
|
+
return { ok: false, because: "truncated", raw };
|
|
3621
|
+
}
|
|
3622
|
+
const value = rest.slice(0, fixed);
|
|
3623
|
+
if (value.includes(FNC1)) {
|
|
3624
|
+
return { ok: false, because: "truncated", raw };
|
|
3625
|
+
}
|
|
3626
|
+
elements[ai] = value;
|
|
3627
|
+
rest = rest.slice(fixed);
|
|
3628
|
+
continue;
|
|
3629
|
+
}
|
|
3630
|
+
const end = rest.indexOf(FNC1);
|
|
3631
|
+
elements[ai] = end === -1 ? rest : rest.slice(0, end);
|
|
3632
|
+
rest = end === -1 ? "" : rest.slice(end + 1);
|
|
3633
|
+
}
|
|
3634
|
+
return Object.keys(elements).length ? { ok: true, elements } : { ok: false, because: "not-gs1", raw };
|
|
3635
|
+
}
|
|
3636
|
+
function aiAt(rest) {
|
|
3637
|
+
const two = rest.slice(0, 2);
|
|
3638
|
+
if (!/^\d{2}$/.test(two)) {
|
|
3639
|
+
return void 0;
|
|
3640
|
+
}
|
|
3641
|
+
if (FIXED_LENGTH[two] !== void 0 || KNOWN_VARIABLE.includes(two)) {
|
|
3642
|
+
return two;
|
|
3643
|
+
}
|
|
3644
|
+
const three = rest.slice(0, 3);
|
|
3645
|
+
if (/^\d{3}$/.test(three) && (FIXED_LENGTH[three] !== void 0 || KNOWN_VARIABLE.includes(three))) {
|
|
3646
|
+
return three;
|
|
3647
|
+
}
|
|
3648
|
+
const four = rest.slice(0, 4);
|
|
3649
|
+
return /^\d{4}$/.test(four) ? four : two;
|
|
3650
|
+
}
|
|
3651
|
+
function checkDigitOf(body) {
|
|
3652
|
+
const sum = [...body].reverse().reduce((total, digit, at2) => total + Number(digit) * (at2 % 2 === 0 ? 3 : 1), 0);
|
|
3653
|
+
return String((10 - sum % 10) % 10);
|
|
3654
|
+
}
|
|
3655
|
+
function wellFormed(digits, length) {
|
|
3656
|
+
return !!digits && digits.length === length && /^\d+$/.test(digits) && checkDigitOf(digits.slice(0, -1)) === digits.slice(-1);
|
|
3657
|
+
}
|
|
3658
|
+
var PREFIX_LENGTHS = [6, 7, 8, 9, 10, 11, 12];
|
|
3659
|
+
function epcCandidatesOfGs1(scan) {
|
|
3660
|
+
const out = [];
|
|
3661
|
+
if (wellFormed(scan.sscc, 18)) {
|
|
3662
|
+
const d = scan.sscc;
|
|
3663
|
+
for (const l of PREFIX_LENGTHS) out.push(`urn:epc:id:sscc:${d.slice(1, 1 + l)}.${d[0]}${d.slice(1 + l, 17)}`);
|
|
3664
|
+
}
|
|
3665
|
+
if (wellFormed(scan.gtin, 14)) {
|
|
3666
|
+
const d = scan.gtin;
|
|
3667
|
+
for (const l of PREFIX_LENGTHS) {
|
|
3668
|
+
const prefix = d.slice(1, 1 + l);
|
|
3669
|
+
const itemRefAndIndicator = d[0] + d.slice(1 + l, 13);
|
|
3670
|
+
out.push(scan.lot ? lgtinClass(prefix, itemRefAndIndicator, scan.lot) : sgtinClass(prefix, itemRefAndIndicator));
|
|
3671
|
+
}
|
|
3672
|
+
}
|
|
3673
|
+
if (wellFormed(scan.gln, 13)) {
|
|
3674
|
+
const d = scan.gln;
|
|
3675
|
+
for (const l of PREFIX_LENGTHS) out.push(`urn:epc:id:sgln:${d.slice(0, l)}.${d.slice(l, 12)}.${scan.glnExtension || "0"}`);
|
|
3676
|
+
}
|
|
3677
|
+
return out;
|
|
3678
|
+
}
|
|
3679
|
+
function ssccDigitsOf(uri) {
|
|
3680
|
+
const match = /^urn:epc:id:sscc:(\d+)\.(\d+)$/.exec(uri ?? "");
|
|
3681
|
+
if (!match) return void 0;
|
|
3682
|
+
const [, prefix, reference] = match;
|
|
3683
|
+
const body = reference[0] + prefix + reference.slice(1);
|
|
3684
|
+
if (body.length !== 17) return void 0;
|
|
3685
|
+
return body + checkDigitOf(body);
|
|
3686
|
+
}
|
|
3687
|
+
function gtin14OfItemClass(definitionId) {
|
|
3688
|
+
const match = /^urn:epc:idpat:sgtin:(\d+)\.(\d+)\.\*$/.exec(definitionId ?? "");
|
|
3689
|
+
if (!match) return void 0;
|
|
3690
|
+
const [, prefix, reference] = match;
|
|
3691
|
+
const body = reference[0] + prefix + reference.slice(1);
|
|
3692
|
+
if (body.length !== 13) return void 0;
|
|
3693
|
+
return body + checkDigitOf(body);
|
|
3694
|
+
}
|
|
3695
|
+
function gtin14OfItem(definitionId) {
|
|
3696
|
+
const byClass = gtin14OfItemClass(definitionId);
|
|
3697
|
+
if (byClass) return byClass;
|
|
3698
|
+
return /^(\d{8}|\d{12,14})$/.test(definitionId ?? "") ? definitionId.padStart(14, "0") : void 0;
|
|
3699
|
+
}
|
|
3700
|
+
function identifierText(uri) {
|
|
3701
|
+
const raw = String(uri ?? "").trim();
|
|
3702
|
+
if (!raw) return "";
|
|
3703
|
+
const parsed = parseEpc(raw);
|
|
3704
|
+
if (parsed.scheme === "sgtin" || parsed.scheme === "lgtin" || parsed.scheme === "idpat") {
|
|
3705
|
+
const gtin = gtin14OfKey(parsed.gtinKey);
|
|
3706
|
+
if (!gtin) return raw;
|
|
3707
|
+
if (parsed.scheme === "sgtin") return parsed.serial ? `(01)${gtin}(21)${decoded(parsed.serial)}` : raw;
|
|
3708
|
+
if (parsed.scheme === "lgtin") return parsed.lot ? `(01)${gtin}(10)${parsed.lot}` : raw;
|
|
3709
|
+
return `(01)${gtin}`;
|
|
3710
|
+
}
|
|
3711
|
+
if (parsed.scheme === "sscc") {
|
|
3712
|
+
const sscc = ssccDigitsOf(raw);
|
|
3713
|
+
return sscc ? `(00)${sscc}` : raw;
|
|
3714
|
+
}
|
|
3715
|
+
if (parsed.scheme === "sgln") {
|
|
3716
|
+
const m = /^urn:epc:id:sgln:(\d+)\.(\d*)\.(.+)$/.exec(raw);
|
|
3717
|
+
if (!m || m[1].length + m[2].length !== 12) return raw;
|
|
3718
|
+
const body = m[1] + m[2];
|
|
3719
|
+
return `(414)${body}${checkDigitOf(body)}${m[3] === "0" ? "" : `(254)${decoded(m[3])}`}`;
|
|
3720
|
+
}
|
|
3721
|
+
if (parsed.scheme === "grai" || parsed.scheme === "gdti") {
|
|
3722
|
+
const m = new RegExp(`^urn:epc:id:${parsed.scheme}:(\\d+)\\.(\\d*)\\.(.*)$`).exec(raw);
|
|
3723
|
+
if (!m || m[1].length + m[2].length !== 12) return raw;
|
|
3724
|
+
const key = m[1] + m[2] + checkDigitOf(m[1] + m[2]);
|
|
3725
|
+
return parsed.scheme === "grai" ? `(8003)0${key}${decoded(m[3])}` : `(253)${key}${decoded(m[3])}`;
|
|
3726
|
+
}
|
|
3727
|
+
if (parsed.scheme === "giai") {
|
|
3728
|
+
const m = /^urn:epc:id:giai:(\d+)\.(.+)$/.exec(raw);
|
|
3729
|
+
return m ? `(8004)${m[1]}${decoded(m[2])}` : raw;
|
|
3730
|
+
}
|
|
3731
|
+
if (parsed.item !== void 0 && parsed.lot !== void 0) return `${parsed.item} \xB7 ${parsed.lot}`;
|
|
3732
|
+
const inHouse = /(?:\/(?:obj|class|bt)\/|:(?:obj|class|bt):)([^/:\s]+)$/.exec(raw);
|
|
3733
|
+
return inHouse ? decoded(inHouse[1]) : raw;
|
|
3734
|
+
}
|
|
3735
|
+
function gtin14OfKey(key) {
|
|
3736
|
+
const m = /^(\d+)\.(\d+)$/.exec(key ?? "");
|
|
3737
|
+
if (!m) return void 0;
|
|
3738
|
+
const body = m[2][0] + m[1] + m[2].slice(1);
|
|
3739
|
+
return body.length === 13 ? body + checkDigitOf(body) : void 0;
|
|
3740
|
+
}
|
|
3741
|
+
function decoded(part) {
|
|
3742
|
+
try {
|
|
3743
|
+
return decodeURIComponent(part);
|
|
3744
|
+
} catch {
|
|
3745
|
+
return part;
|
|
3746
|
+
}
|
|
3747
|
+
}
|
|
3748
|
+
|
|
3416
3749
|
// src/order-fold.ts
|
|
3417
3750
|
var ORDER_FOLD_HOUR_MS = 60 * 60 * 1e3;
|
|
3418
3751
|
var ORDER_FOLD_DEFAULT = Object.freeze({ afterMs: 24 * 60 * 60 * 1e3, maxTerminal: 1e3 });
|
|
@@ -3879,9 +4212,6 @@ function shapeErrors(where, row, shape) {
|
|
|
3879
4212
|
return errors;
|
|
3880
4213
|
}
|
|
3881
4214
|
var TASK_STATUS = ["created", "assigned", "in-progress", "completed"];
|
|
3882
|
-
var EQUIPMENT_STATUS2 = ["idle", "busy", "down", "setup", "planned-stop"];
|
|
3883
|
-
var PERSON_STATUS = ["idle", "busy"];
|
|
3884
|
-
var ASSET_STATUS = ["idle", "in-use"];
|
|
3885
4215
|
var SPECS = {
|
|
3886
4216
|
task: {
|
|
3887
4217
|
eventType: OP_EVENT.task,
|
|
@@ -3974,7 +4304,7 @@ var SPECS = {
|
|
|
3974
4304
|
재검사하지는 않는다: 그 모양은 `EquipmentMotion` 계약이고, 여기서 두 번 지키면 두 벌이 된다. */
|
|
3975
4305
|
motion: "object"
|
|
3976
4306
|
},
|
|
3977
|
-
enums: { status:
|
|
4307
|
+
enums: { status: EQUIPMENT_STATUS }
|
|
3978
4308
|
},
|
|
3979
4309
|
person: {
|
|
3980
4310
|
eventType: OP_EVENT.person,
|
|
@@ -4170,7 +4500,7 @@ var SPECS = {
|
|
|
4170
4500
|
fields: { basisId: "string", arrangementId: "string", revisionId: "string", revisionNumber: "number", planId: "string", contentHash: "string", businessTime: "string", timezone: "string", workDate: "string" }
|
|
4171
4501
|
}
|
|
4172
4502
|
},
|
|
4173
|
-
enums: { status:
|
|
4503
|
+
enums: { status: EQUIPMENT_STATUS }
|
|
4174
4504
|
},
|
|
4175
4505
|
/*
|
|
4176
4506
|
* **부적합 처분** — 재고 판정을 받은 것을 어떻게 하기로 정했나.
|
|
@@ -4629,6 +4959,58 @@ function retiredVocabularyIn(line) {
|
|
|
4629
4959
|
return hits;
|
|
4630
4960
|
}
|
|
4631
4961
|
|
|
4962
|
+
// src/party.ts
|
|
4963
|
+
var SOURCE_DEST_PARTY_TYPE = {
|
|
4964
|
+
owning_party: "urn:epcglobal:cbv:sdt:owning_party",
|
|
4965
|
+
possessing_party: "urn:epcglobal:cbv:sdt:possessing_party"
|
|
4966
|
+
};
|
|
4967
|
+
var PARTY_ROLE = {
|
|
4968
|
+
carrier: "CA"
|
|
4969
|
+
};
|
|
4970
|
+
var PARTY_URI_MAX_LENGTH = 128;
|
|
4971
|
+
var PARTY_URI_RECOMMENDED_LENGTH = 60;
|
|
4972
|
+
var UUID = /^[0-9a-f]{8}-?[0-9a-f]{4}-?[0-9a-f]{4}-?[0-9a-f]{4}-?[0-9a-f]{12}$/i;
|
|
4973
|
+
var ISSUED_TOKEN = /^[0-9a-f]{32}$/;
|
|
4974
|
+
var PGLN_EPC = /^urn:epc:id:pgln:\d+\.\d*$/;
|
|
4975
|
+
var PGLN_DIGITAL_LINK = /^https:\/\/id\.gs1\.org\/417\/\d{13}$/;
|
|
4976
|
+
var SD_URL = /^https?:\/\/[^/\s.]+(?:\.[^/\s.]+)+\/(?:[^/\s]+\/)*sd\/[^/\s]+$/;
|
|
4977
|
+
var SD_URN = /^urn:[^:\s]+:(?:[^:\s]+:)*sd:[^:\s]+$/;
|
|
4978
|
+
function partyUri(namespace, rowId) {
|
|
4979
|
+
const raw = String(rowId ?? "").trim();
|
|
4980
|
+
if (!UUID.test(raw)) throw new Error(`partyUri: \uAC70\uB798\uCC98 \uD589 id \uAC00 uuid \uAC00 \uC544\uB2C8\uB2E4: ${rowId}`);
|
|
4981
|
+
const uri = identifierUnderNamespace(namespace, "sd", raw.replace(/-/g, "").toLowerCase());
|
|
4982
|
+
if (uri && uri.length > PARTY_URI_MAX_LENGTH) {
|
|
4983
|
+
throw new Error(`partyUri: ${uri.length}\uC790 \u2014 CBV 2.0 \xA78.1.4 \uB294 ${PARTY_URI_MAX_LENGTH}\uC790 \uC774\uD558\uB97C \uC694\uAD6C\uD55C\uB2E4. \uC774\uB984\uACF5\uAC04 \uC120\uC5B8(${namespace})\uC774 \uB108\uBB34 \uAE38\uB2E4.`);
|
|
4984
|
+
}
|
|
4985
|
+
return uri;
|
|
4986
|
+
}
|
|
4987
|
+
function partyRowIdOf(uri) {
|
|
4988
|
+
if (!uri || partyIdentifierViolation(uri)) return void 0;
|
|
4989
|
+
const token = SD_URL.test(uri) ? uri.slice(uri.lastIndexOf("/") + 1) : SD_URN.test(uri) ? uri.slice(uri.lastIndexOf(":") + 1) : void 0;
|
|
4990
|
+
if (!token || !ISSUED_TOKEN.test(token)) return void 0;
|
|
4991
|
+
return `${token.slice(0, 8)}-${token.slice(8, 12)}-${token.slice(12, 16)}-${token.slice(16, 20)}-${token.slice(20)}`;
|
|
4992
|
+
}
|
|
4993
|
+
function partyIdentifierViolation(uri) {
|
|
4994
|
+
if (typeof uri !== "string" || !uri) return `\uAC70\uB798 \uC0C1\uB300 \uC2DD\uBCC4\uC790\uAC00 \uBE44\uC5C8\uB2E4: ${uri}`;
|
|
4995
|
+
if (uri.length > PARTY_URI_MAX_LENGTH) return `\uAC70\uB798 \uC0C1\uB300 \uC2DD\uBCC4\uC790\uAC00 ${uri.length}\uC790 \u2014 CBV 2.0 \xA78.1.4 \uB294 ${PARTY_URI_MAX_LENGTH}\uC790 \uC774\uD558\uB97C \uC694\uAD6C\uD55C\uB2E4: ${uri}`;
|
|
4996
|
+
if (PGLN_EPC.test(uri) || PGLN_DIGITAL_LINK.test(uri)) return void 0;
|
|
4997
|
+
if (/^urn:epc(global)?:/.test(uri)) return `\uAC70\uB798 \uC0C1\uB300\uC5D0\uB294 GS1 \uACF5\uAC04\uC5D0\uC11C PGLN \uB9CC \uBC1B\uB294\uB2E4(CBV 2.0 \xA78.7.1): ${uri}`;
|
|
4998
|
+
if (SD_URL.test(uri) || SD_URN.test(uri)) return void 0;
|
|
4999
|
+
return `\uAC70\uB798 \uC0C1\uB300 \uC2DD\uBCC4\uC790\uC758 \uAF34\uC774 \uC544\uB2C8\uB2E4: ${uri} \u2014 CBV 2.0 \xA78.7 \uC758 \uAF34\uC774\uC5B4\uC57C \uD55C\uB2E4 (PGLN urn:epc:id:pgln: \xB7 https://id.gs1.org/417/<PGLN> \xB7 http(s)://<\uB3C4\uBA54\uC778>/**/sd/<id> \xB7 urn:<\uC774\uB984\uACF5\uAC04>:**:sd:<id>)`;
|
|
5000
|
+
}
|
|
5001
|
+
function isPartyUri(v) {
|
|
5002
|
+
return typeof v === "string" && partyIdentifierViolation(v) === void 0;
|
|
5003
|
+
}
|
|
5004
|
+
function partyUriLengthNote(uri) {
|
|
5005
|
+
if (typeof uri !== "string" || uri.length <= PARTY_URI_RECOMMENDED_LENGTH) return void 0;
|
|
5006
|
+
return `\uAC70\uB798 \uC0C1\uB300 \uC2DD\uBCC4\uC790\uAC00 ${uri.length}\uC790 \u2014 CBV 2.0 \xA78.1.4 \uB294 ${PARTY_URI_RECOMMENDED_LENGTH}\uC790 \uC774\uD558\uB97C \uAD8C\uD55C\uB2E4: ${uri}`;
|
|
5007
|
+
}
|
|
5008
|
+
function isPartyRef(v) {
|
|
5009
|
+
if (!v || typeof v !== "object" || Array.isArray(v)) return false;
|
|
5010
|
+
const r = v;
|
|
5011
|
+
return isPartyUri(r.id) && (r.name === void 0 || typeof r.name === "string");
|
|
5012
|
+
}
|
|
5013
|
+
|
|
4632
5014
|
// src/command-verdict.ts
|
|
4633
5015
|
var REFUSED_WITHOUT_CODE = "refused";
|
|
4634
5016
|
function verdictOfAck(ack) {
|
|
@@ -5143,10 +5525,46 @@ function isOperationalFactReference(value) {
|
|
|
5143
5525
|
function nonEmpty(value) {
|
|
5144
5526
|
return typeof value === "string" && value.trim().length > 0;
|
|
5145
5527
|
}
|
|
5528
|
+
|
|
5529
|
+
// src/lot-lineage.ts
|
|
5530
|
+
function lotLineageOf(event, classOfUnit) {
|
|
5531
|
+
if (event.type !== "TransformationEvent") return [];
|
|
5532
|
+
const inputs = /* @__PURE__ */ new Set();
|
|
5533
|
+
for (const epc of event.inputEPCList ?? []) {
|
|
5534
|
+
const lot = classOfUnit(epc);
|
|
5535
|
+
if (lot) inputs.add(lot);
|
|
5536
|
+
}
|
|
5537
|
+
for (const one of event.inputQuantityList ?? []) if (one.epcClass) inputs.add(one.epcClass);
|
|
5538
|
+
const edges = [];
|
|
5539
|
+
for (const lot of new Set((event.outputQuantityList ?? []).map((one) => one.epcClass).filter(Boolean))) {
|
|
5540
|
+
for (const input of inputs) if (input !== lot) edges.push({ lot, input });
|
|
5541
|
+
}
|
|
5542
|
+
return edges;
|
|
5543
|
+
}
|
|
5544
|
+
function inheritedLotUse(lot, said, inputsOf, seen = /* @__PURE__ */ new Set()) {
|
|
5545
|
+
const own = said.get(lot);
|
|
5546
|
+
if (own?.use === "blocked") return { use: "blocked", status: own.status };
|
|
5547
|
+
const along = /* @__PURE__ */ new Set([...seen, lot]);
|
|
5548
|
+
const words = (inputsOf.get(lot) ?? []).filter((input) => !along.has(input)).map((input) => ({ input, word: inheritedLotUse(input, said, inputsOf, along) }));
|
|
5549
|
+
const blocked = words.find(({ word }) => word?.use === "blocked");
|
|
5550
|
+
if (blocked) return { use: "blocked", ...blocked.word.status !== void 0 ? { status: blocked.word.status } : {}, from: blocked.word.from ?? blocked.input };
|
|
5551
|
+
if (own?.use === "allowed") return { use: "allowed", status: own.status };
|
|
5552
|
+
if (!own && words.length && words.every(({ word }) => word?.use === "allowed")) return { use: "allowed" };
|
|
5553
|
+
return void 0;
|
|
5554
|
+
}
|
|
5555
|
+
function inheritedExpiry(inputExpiries) {
|
|
5556
|
+
let earliest;
|
|
5557
|
+
for (const at2 of inputExpiries) {
|
|
5558
|
+
if (typeof at2 !== "number" || !Number.isFinite(at2)) continue;
|
|
5559
|
+
if (earliest === void 0 || at2 < earliest) earliest = at2;
|
|
5560
|
+
}
|
|
5561
|
+
return earliest;
|
|
5562
|
+
}
|
|
5146
5563
|
// Annotate the CommonJS export names for ESM import in node:
|
|
5147
5564
|
0 && (module.exports = {
|
|
5148
5565
|
ABSENCE,
|
|
5149
5566
|
ALLOCATION_POLICY,
|
|
5567
|
+
ASSET_STATUS,
|
|
5150
5568
|
BASIS_UNKNOWN,
|
|
5151
5569
|
BIZSTEP,
|
|
5152
5570
|
BTT,
|
|
@@ -5160,6 +5578,7 @@ function nonEmpty(value) {
|
|
|
5160
5578
|
COMMAND_STATE,
|
|
5161
5579
|
DISP,
|
|
5162
5580
|
DISPOSITION_DECISION,
|
|
5581
|
+
DOCK_DOOR_STATUS,
|
|
5163
5582
|
DOMAIN_CATALOG,
|
|
5164
5583
|
DOMAIN_SYSTEMS,
|
|
5165
5584
|
EMPTY_BECAUSE,
|
|
@@ -5197,14 +5616,21 @@ function nonEmpty(value) {
|
|
|
5197
5616
|
ORDER_FOLD_DEFAULT,
|
|
5198
5617
|
ORDER_FOLD_HOUR_MS,
|
|
5199
5618
|
ORDER_TERMINAL_STATUS,
|
|
5619
|
+
PARTY_ROLE,
|
|
5620
|
+
PARTY_URI_MAX_LENGTH,
|
|
5621
|
+
PARTY_URI_RECOMMENDED_LENGTH,
|
|
5622
|
+
PERSON_STATUS,
|
|
5200
5623
|
PRIORITY_UNSET,
|
|
5201
5624
|
PRIVATE_BIZSTEP,
|
|
5202
5625
|
READ_BASIS,
|
|
5203
5626
|
REFUSED_WITHOUT_CODE,
|
|
5204
5627
|
RESOURCE_KIND,
|
|
5205
5628
|
RETIRED_VOCABULARY,
|
|
5629
|
+
RETURN_TO_SUPPLIER,
|
|
5206
5630
|
SCHEDULE_STATUS,
|
|
5207
5631
|
SIGNATURE_REJECTED_REASONS,
|
|
5632
|
+
SOURCE_DEST_PARTY_TYPE,
|
|
5633
|
+
TRAILER_LOAD,
|
|
5208
5634
|
TWIN_AXES,
|
|
5209
5635
|
TWIN_PROPERTIES,
|
|
5210
5636
|
TWIN_RELATIONS,
|
|
@@ -5223,8 +5649,13 @@ function nonEmpty(value) {
|
|
|
5223
5649
|
WMS_RECEIVING_ORDER_KINDS,
|
|
5224
5650
|
WMS_TYPES,
|
|
5225
5651
|
YARD_BIZSTEP,
|
|
5652
|
+
YARD_MODE,
|
|
5226
5653
|
YARD_PRIVATE_BIZSTEP,
|
|
5654
|
+
YMS_APPOINTMENT_CANCEL_REASON,
|
|
5655
|
+
YMS_APPOINTMENT_STATUS,
|
|
5227
5656
|
YMS_LOCATION_TYPES,
|
|
5657
|
+
YMS_ORDER_KIND,
|
|
5658
|
+
YMS_TASK_KIND,
|
|
5228
5659
|
YMS_TYPES,
|
|
5229
5660
|
acceptsPerformance,
|
|
5230
5661
|
activeShiftAt,
|
|
@@ -5258,11 +5689,13 @@ function nonEmpty(value) {
|
|
|
5258
5689
|
computeOee,
|
|
5259
5690
|
conversionFactorOf,
|
|
5260
5691
|
criterionSaysNothing,
|
|
5692
|
+
dockDoorStatusOf,
|
|
5261
5693
|
documentPath,
|
|
5262
5694
|
dueStatusOf,
|
|
5263
5695
|
effectivityAt,
|
|
5264
5696
|
electricalUpstreamOf,
|
|
5265
5697
|
emptyFoldedOrders,
|
|
5698
|
+
epcCandidatesOfGs1,
|
|
5266
5699
|
equipmentClassMembership,
|
|
5267
5700
|
erpCapabilityGaps,
|
|
5268
5701
|
expiryFromAttributes,
|
|
@@ -5274,9 +5707,13 @@ function nonEmpty(value) {
|
|
|
5274
5707
|
generationFractionAt,
|
|
5275
5708
|
graiUri,
|
|
5276
5709
|
gs1KeyDigitViolation,
|
|
5710
|
+
gtin14OfItem,
|
|
5711
|
+
gtin14OfItemClass,
|
|
5277
5712
|
hierarchyOf,
|
|
5278
5713
|
homeOf,
|
|
5279
5714
|
hourStartOf,
|
|
5715
|
+
identifierText,
|
|
5716
|
+
identifierUnderNamespace,
|
|
5280
5717
|
identityGroundingOf,
|
|
5281
5718
|
inWorkCalendar,
|
|
5282
5719
|
inWorkCalendarAt,
|
|
@@ -5291,7 +5728,10 @@ function nonEmpty(value) {
|
|
|
5291
5728
|
ingestEnergyUsagePeriodRecords,
|
|
5292
5729
|
ingestMasterData,
|
|
5293
5730
|
ingestOperationalRecords,
|
|
5731
|
+
inheritedExpiry,
|
|
5732
|
+
inheritedLotUse,
|
|
5294
5733
|
isAggregationRecord,
|
|
5734
|
+
isAppointmentClosed,
|
|
5295
5735
|
isCacheableTense,
|
|
5296
5736
|
isCommandTerminal,
|
|
5297
5737
|
isElectricalLocationType,
|
|
@@ -5313,6 +5753,8 @@ function nonEmpty(value) {
|
|
|
5313
5753
|
isOperationalAttentionV1,
|
|
5314
5754
|
isOperationalRecord,
|
|
5315
5755
|
isOrderTerminal,
|
|
5756
|
+
isPartyRef,
|
|
5757
|
+
isPartyUri,
|
|
5316
5758
|
isPlannedStopStatus,
|
|
5317
5759
|
isRecipeExecutionBasis,
|
|
5318
5760
|
isResourceKind,
|
|
@@ -5321,9 +5763,11 @@ function nonEmpty(value) {
|
|
|
5321
5763
|
isWebhookDeliveryCode,
|
|
5322
5764
|
isWebhookSecretSegment,
|
|
5323
5765
|
isWorkShiftExecutionBasis,
|
|
5766
|
+
isYmsAppointmentStatus,
|
|
5324
5767
|
isoDurationHours,
|
|
5325
5768
|
itemClassOf,
|
|
5326
5769
|
itemKeyOf,
|
|
5770
|
+
itemMaterialDefinitionId,
|
|
5327
5771
|
judgeAgainstSpec,
|
|
5328
5772
|
levelOfLocationType,
|
|
5329
5773
|
lgtinClass,
|
|
@@ -5333,8 +5777,10 @@ function nonEmpty(value) {
|
|
|
5333
5777
|
lotClassOfItem,
|
|
5334
5778
|
lotClassUri,
|
|
5335
5779
|
lotFromAttributes,
|
|
5780
|
+
lotLineageOf,
|
|
5336
5781
|
mapRecord,
|
|
5337
5782
|
mapRecordChecked,
|
|
5783
|
+
materialDefinitionIdOf,
|
|
5338
5784
|
materialMovementKey,
|
|
5339
5785
|
meetsTests,
|
|
5340
5786
|
minuteOfDayAt,
|
|
@@ -5353,8 +5799,13 @@ function nonEmpty(value) {
|
|
|
5353
5799
|
orderFoldPolicyOf,
|
|
5354
5800
|
outsideLimit,
|
|
5355
5801
|
parseEpc,
|
|
5802
|
+
parseGs1,
|
|
5356
5803
|
parseIsoDuration,
|
|
5357
5804
|
partitionLensLocations,
|
|
5805
|
+
partyIdentifierViolation,
|
|
5806
|
+
partyRowIdOf,
|
|
5807
|
+
partyUri,
|
|
5808
|
+
partyUriLengthNote,
|
|
5358
5809
|
passThroughReversible,
|
|
5359
5810
|
performanceKey,
|
|
5360
5811
|
periodFactId,
|
|
@@ -5382,6 +5833,7 @@ function nonEmpty(value) {
|
|
|
5382
5833
|
sgtinUri,
|
|
5383
5834
|
splitFlowOrders,
|
|
5384
5835
|
splitRelationIds,
|
|
5836
|
+
ssccDigitsOf,
|
|
5385
5837
|
ssccUri,
|
|
5386
5838
|
standsNewOrderRow,
|
|
5387
5839
|
stateFieldsOf,
|