@operato/twin-kernel 0.11.14 → 0.11.15

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/kernel.js CHANGED
@@ -9,7 +9,7 @@ import { CMD } from '@operato/ops-contract';
9
9
  import { firstFitPolicy } from "./allocation-policy.js";
10
10
  import { FlowEngine } from "./flow-engine.js";
11
11
  import { planMakeToOrder } from "./make-to-order.js";
12
- import { BIZSTEP, BTT } from '@operato/ops-contract';
12
+ import { BIZSTEP, BTT, WMS_ORDER_KIND } from '@operato/ops-contract';
13
13
  import { DISP, ILMD_ATTR, aggregationEvent, objectEvent, transactionEvent } from '@operato/ops-contract';
14
14
  import { subLotIdOf, itemKeyOf } from '@operato/ops-contract';
15
15
  const TRAVEL_MS = 30_000;
@@ -133,7 +133,7 @@ export class WmsKernel extends FlowEngine {
133
133
  const so = this.requireBizTransactionId(`SO-${soSeq}`, 'salesorder');
134
134
  const requested = lines.reduce((s, l) => s + l.qty, 0);
135
135
  const order = {
136
- id, kind: 'outbound', status: 'created', requested, fulfilled: 0, bizTransaction: so,
136
+ id, kind: WMS_ORDER_KIND.outbound, status: 'created', requested, fulfilled: 0, bizTransaction: so,
137
137
  allocated: [], picked: [], shipmentEpc: null, lines: lines.map(l => ({ gtin: l.gtin, requested: l.qty })),
138
138
  ...(spec ? this.promiseOf(spec) : {})
139
139
  };
@@ -175,7 +175,7 @@ export class WmsKernel extends FlowEngine {
175
175
  /* 할당은 아직 집은 것이 아니다 — 물건은 보관 자리에 있고 처분만 '예약' 으로 바뀐다.
176
176
  * 그래서 단계는 storing 이다(피킹 관측은 실제로 집을 때 따로 난다). */
177
177
  this.reserve(chosenAll, BIZSTEP.storing);
178
- this.emit(transactionEvent({ eventTime: this.now(), action: 'ADD', bizStep: BIZSTEP.picking, bizTransactionList: [{ type: BTT.so, bizTransaction: o.bizTransaction }], epcList: chosenAll.slice() }));
178
+ this.emit(transactionEvent({ eventTime: this.now(), action: 'ADD', bizStep: BIZSTEP.picking, bizTransactionList: [{ type: BTT.poc, bizTransaction: o.bizTransaction }], epcList: chosenAll.slice() }));
179
179
  for (const epc of chosenAll) {
180
180
  const it = this.items.get(epc);
181
181
  const id = `task-${++this.taskSeq}`;
@@ -363,7 +363,7 @@ export class WmsKernel extends FlowEngine {
363
363
  const shpSeq = ++this.epcSeq;
364
364
  const shipment = this.requireObjectId(`SHP-${shpSeq}`);
365
365
  order.shipmentEpc = shipment;
366
- const soTxn = [{ type: BTT.so, bizTransaction: order.bizTransaction }];
366
+ const soTxn = [{ type: BTT.poc, bizTransaction: order.bizTransaction }];
367
367
  // 패킹: 화물(shipment) ← 팔레트 조립(merge). 팔레트는 출하 DELETE 까지 독립 유지 → consume 없음.
368
368
  this.aggregate(shipment, order.picked.slice(), { bizStep: BIZSTEP.packing, readPoint: staging.id, bizLocation: staging.id });
369
369
  order.status = 'packed';
@@ -19,7 +19,7 @@ import { itemKeyOf } from '@operato/ops-contract';
19
19
  import { firstFitPolicy } from "./allocation-policy.js";
20
20
  import { FlowEngine } from "./flow-engine.js";
21
21
  import { DISP, objectEvent, transactionEvent } from '@operato/ops-contract';
22
- import { YARD_BIZSTEP, BTT_DELIVERY } from '@operato/ops-contract';
22
+ import { YARD_BIZSTEP } from '@operato/ops-contract';
23
23
  const TRAVEL_MS = 20_000; // 야드 이동
24
24
  const DWELL_MS = 30_000; // 도크 체류(상·하차) — depart 이동에 folded
25
25
  const WINDOW_DELAY_MS = 40_000; // 도착 후 어포인트먼트 창까지(early arrival → 대기)
@@ -149,7 +149,7 @@ export class YmsKernel extends FlowEngine {
149
149
  this.trailerCargo.set(trailer.epc, avail.slice(0, CARGO_PER_TRAILER).map(i => i.epc));
150
150
  }
151
151
  this.reserve([trailer.epc], bizStep); // 처분 변화를 이벤트로 — 미러가 "잡혔다" 를 알 수 있게
152
- this.emit(transactionEvent({ eventTime: this.now(), action: 'ADD', bizStep, bizTransactionList: [{ type: BTT_DELIVERY, bizTransaction: o.bizTransaction }], epcList: [trailer.epc], readPoint: door.id }));
152
+ this.emit(transactionEvent({ eventTime: this.now(), action: 'ADD', bizStep, bizTransactionList: [{ bizTransaction: o.bizTransaction }], epcList: [trailer.epc], readPoint: door.id }));
153
153
  // drop: 야드→도크 pull. live: 게이트→도크 직행(spot-live). 둘 다 toNode=도크도어.
154
154
  const dockKind = mode === 'drop' ? 'pull' : 'spot-live';
155
155
  const task = { id: `task-${++this.taskSeq}`, kind: dockKind, status: 'created', itemEpc: trailer.epc, fromNode: trailer.location, toNode: door.id, resource: null, remainingMs: 0, durationMs: this.durationOf({ kind: dockKind, fromNode: trailer.location, toNode: door.id }, TRAVEL_MS), orderId: o.id };
@@ -993,8 +993,28 @@ var BIZSTEP = {
993
993
  replenishing: "urn:epcglobal:cbv:bizstep:replenishing"
994
994
  };
995
995
  var BTT = {
996
+ /** Purchase Order — the document an inbound receipt is made against. */
996
997
  po: "urn:epcglobal:cbv:btt:po",
997
- so: "urn:epcglobal:cbv:btt:so"
998
+ /** Purchase Order Confirmation — the seller's sales order. */
999
+ poc: "urn:epcglobal:cbv:btt:poc",
1000
+ /** Despatch Advice (ASN) — announces an inbound delivery; also attached when shipping. */
1001
+ desadv: "urn:epcglobal:cbv:btt:desadv",
1002
+ /** Receiving Advice — the reply once an inbound receipt is complete. */
1003
+ recadv: "urn:epcglobal:cbv:btt:recadv",
1004
+ /** Return Merchandise Authorization — what a return is received against. */
1005
+ rma: "urn:epcglobal:cbv:btt:rma",
1006
+ /** Bill of Lading — the carrier's document, attached when shipping. */
1007
+ bol: "urn:epcglobal:cbv:btt:bol"
1008
+ };
1009
+ var WMS_ORDER_KIND = {
1010
+ /** Expected receipt (ASN). The kernel has no inbound order yet — arrival carries a `po` without one. */
1011
+ inbound: "inbound",
1012
+ /** Outbound order — what the kernel's sales order is. */
1013
+ outbound: "outbound",
1014
+ /** Receipt of returned goods. */
1015
+ return: "return",
1016
+ /** Stock transfer between sites. CBV has no document type for it: carry the id without a type. */
1017
+ transfer: "transfer"
998
1018
  };
999
1019
  var WMS_LOCATION_TYPES = ["dock", "storage", "staging", "dock-ship", "vas-station"];
1000
1020
  var WMS_LOCATION_LEVEL = {
@@ -1025,7 +1045,6 @@ var YARD_BIZSTEP = {
1025
1045
  departing: "urn:epcglobal:cbv:bizstep:departing"
1026
1046
  // 게이트-아웃
1027
1047
  };
1028
- var BTT_DELIVERY = "urn:epcglobal:cbv:btt:deliv";
1029
1048
  var YMS_LOCATION_TYPES = ["gate", "yard-slot", "dock-door", "staging"];
1030
1049
  var YMS_LOCATION_LEVEL = {
1031
1050
  gate: "Other",
@@ -7130,7 +7149,7 @@ var WmsKernel = class extends FlowEngine {
7130
7149
  const requested = lines.reduce((s, l) => s + l.qty, 0);
7131
7150
  const order = {
7132
7151
  id,
7133
- kind: "outbound",
7152
+ kind: WMS_ORDER_KIND.outbound,
7134
7153
  status: "created",
7135
7154
  requested,
7136
7155
  fulfilled: 0,
@@ -7166,7 +7185,7 @@ var WmsKernel = class extends FlowEngine {
7166
7185
  }
7167
7186
  if (chosenAll.length === 0) return this.makeShortLines(o);
7168
7187
  this.reserve(chosenAll, BIZSTEP.storing);
7169
- this.emit(transactionEvent({ eventTime: this.now(), action: "ADD", bizStep: BIZSTEP.picking, bizTransactionList: [{ type: BTT.so, bizTransaction: o.bizTransaction }], epcList: chosenAll.slice() }));
7188
+ this.emit(transactionEvent({ eventTime: this.now(), action: "ADD", bizStep: BIZSTEP.picking, bizTransactionList: [{ type: BTT.poc, bizTransaction: o.bizTransaction }], epcList: chosenAll.slice() }));
7170
7189
  for (const epc of chosenAll) {
7171
7190
  const it = this.items.get(epc);
7172
7191
  const id = `task-${++this.taskSeq}`;
@@ -7317,7 +7336,7 @@ var WmsKernel = class extends FlowEngine {
7317
7336
  const shpSeq = ++this.epcSeq;
7318
7337
  const shipment = this.requireObjectId(`SHP-${shpSeq}`);
7319
7338
  order.shipmentEpc = shipment;
7320
- const soTxn = [{ type: BTT.so, bizTransaction: order.bizTransaction }];
7339
+ const soTxn = [{ type: BTT.poc, bizTransaction: order.bizTransaction }];
7321
7340
  this.aggregate(shipment, order.picked.slice(), { bizStep: BIZSTEP.packing, readPoint: staging.id, bizLocation: staging.id });
7322
7341
  order.status = "packed";
7323
7342
  this.emit(objectEvent({ eventTime, action: "OBSERVE", bizStep: BIZSTEP.staging_outbound, disposition: DISP.reserved, epcList: [shipment], readPoint: staging.id, bizLocation: staging.id, bizTransactionList: soTxn }));
@@ -7457,7 +7476,7 @@ var YmsKernel = class extends FlowEngine {
7457
7476
  this.trailerCargo.set(trailer.epc, avail.slice(0, CARGO_PER_TRAILER).map((i) => i.epc));
7458
7477
  }
7459
7478
  this.reserve([trailer.epc], bizStep);
7460
- this.emit(transactionEvent({ eventTime: this.now(), action: "ADD", bizStep, bizTransactionList: [{ type: BTT_DELIVERY, bizTransaction: o.bizTransaction }], epcList: [trailer.epc], readPoint: door.id }));
7479
+ this.emit(transactionEvent({ eventTime: this.now(), action: "ADD", bizStep, bizTransactionList: [{ bizTransaction: o.bizTransaction }], epcList: [trailer.epc], readPoint: door.id }));
7461
7480
  const dockKind = mode === "drop" ? "pull" : "spot-live";
7462
7481
  const task = { id: `task-${++this.taskSeq}`, kind: dockKind, status: "created", itemEpc: trailer.epc, fromNode: trailer.location, toNode: door.id, resource: null, remainingMs: 0, durationMs: this.durationOf({ kind: dockKind, fromNode: trailer.location, toNode: door.id }, TRAVEL_MS2), orderId: o.id };
7463
7482
  this.tasks.set(task.id, task);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@operato/twin-kernel",
3
- "version": "0.11.14",
3
+ "version": "0.11.15",
4
4
  "type": "module",
5
5
  "description": "Twin Domain Kernel — framework-agnostic, zero-dep (domain + sim + 3-channel contract). WMS/YMS/MES, EPCIS 2.0 · ISA-95.",
6
6
  "publishConfig": {
@@ -28,6 +28,6 @@
28
28
  "test": "node --test test/*.test.ts"
29
29
  },
30
30
  "dependencies": {
31
- "@operato/ops-contract": "^0.9.22"
31
+ "@operato/ops-contract": "^0.9.24"
32
32
  }
33
33
  }