@rytass/wms-module-core 0.8.1 → 0.9.1
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/index.cjs.js +1689 -199
- package/index.d.mts +6 -0
- package/{index.js → index.mjs} +97 -87
- package/lib/constants/consumption-change-kind.d.ts +17 -0
- package/lib/constants/consumption-change-kind.mjs +20 -0
- package/lib/constants/index.d.ts +2 -0
- package/lib/constants/operations.d.ts +1 -1
- package/lib/constants/{operations.js → operations.mjs} +9 -0
- package/lib/constants/order-type.d.ts +30 -0
- package/lib/constants/order-type.mjs +33 -0
- package/lib/constants/stock-status.d.ts +4 -1
- package/lib/constants/{stock-status.js → stock-status.mjs} +6 -0
- package/lib/{core.module.js → core.module.mjs} +118 -34
- package/lib/events/index.d.ts +2 -1
- package/lib/events/stock-change.subscriber.d.ts +26 -1
- package/lib/events/{stock-change.subscriber.js → stock-change.subscriber.mjs} +100 -17
- package/lib/events/{wms-event.collector.js → wms-event.collector.mjs} +1 -1
- package/lib/events/{wms-event.dispatcher.js → wms-event.dispatcher.mjs} +1 -1
- package/lib/events/wms-event.tokens.d.ts +2 -0
- package/lib/events/{wms-event.tokens.js → wms-event.tokens.mjs} +3 -1
- package/lib/events/wms-event.types.d.ts +38 -6
- package/lib/events/wms-operation-runner.d.ts +57 -0
- package/lib/events/wms-operation-runner.mjs +101 -0
- package/lib/models/extensions/allocate-inventory-order/{allocate-inventory-order-change.entity.js → allocate-inventory-order-change.entity.mjs} +1 -1
- package/lib/models/extensions/allocate-inventory-order/{allocate-inventory-order-item.entity.js → allocate-inventory-order-item.entity.mjs} +12 -12
- package/lib/models/extensions/consumption-order/consumption-order-change.entity.d.ts +19 -0
- package/lib/models/extensions/consumption-order/consumption-order-change.entity.mjs +59 -0
- package/lib/models/extensions/consumption-order/consumption-order-item.entity.d.ts +26 -0
- package/lib/models/extensions/consumption-order/consumption-order-item.entity.mjs +114 -0
- package/lib/models/extensions/consumption-order/consumption-order.entity.d.ts +32 -0
- package/lib/models/extensions/consumption-order/consumption-order.entity.mjs +69 -0
- package/lib/models/extensions/consumption-order/index.d.ts +3 -0
- package/lib/models/extensions/hold-inventory-order/{hold-inventory-order-change.entity.js → hold-inventory-order-change.entity.mjs} +1 -1
- package/lib/models/extensions/hold-inventory-order/{hold-inventory-order-item.entity.js → hold-inventory-order-item.entity.mjs} +12 -12
- package/lib/models/extensions/index.d.ts +4 -0
- package/lib/models/extensions/inventory-count-order/{inventory-count-order-change.entity.js → inventory-count-order-change.entity.mjs} +1 -1
- package/lib/models/extensions/inventory-count-order/inventory-count-order-item.entity.d.ts +13 -1
- package/lib/models/extensions/inventory-count-order/{inventory-count-order-item.entity.js → inventory-count-order-item.entity.mjs} +29 -13
- package/lib/models/extensions/inventory-count-order/{inventory-count-order.entity.js → inventory-count-order.entity.mjs} +12 -12
- package/lib/models/extensions/merge-batch-order/{merge-batch-order-change.entity.js → merge-batch-order-change.entity.mjs} +1 -1
- package/lib/models/extensions/merge-batch-order/{merge-batch-order-item.entity.js → merge-batch-order-item.entity.mjs} +12 -12
- package/lib/models/extensions/order-reference/index.d.ts +1 -0
- package/lib/models/extensions/order-reference/order-reference.entity.d.ts +49 -0
- package/lib/models/extensions/order-reference/order-reference.entity.mjs +95 -0
- package/lib/models/extensions/quality-inspection-order/{quality-inspection-order-change.entity.js → quality-inspection-order-change.entity.mjs} +1 -1
- package/lib/models/extensions/quality-inspection-order/{quality-inspection-order-item.entity.js → quality-inspection-order-item.entity.mjs} +12 -12
- package/lib/models/extensions/receive-inventory-order/{receive-inventory-order-change.entity.js → receive-inventory-order-change.entity.mjs} +2 -2
- package/lib/models/extensions/receive-inventory-order/{receive-inventory-order-item.entity.js → receive-inventory-order-item.entity.mjs} +2 -2
- package/lib/models/extensions/receive-inventory-order/{receive-inventory-order.entity.js → receive-inventory-order.entity.mjs} +2 -2
- package/lib/models/extensions/reclassify-inventory-order/{reclassify-inventory-order-change.entity.js → reclassify-inventory-order-change.entity.mjs} +1 -1
- package/lib/models/extensions/reclassify-inventory-order/{reclassify-inventory-order-item.entity.js → reclassify-inventory-order-item.entity.mjs} +12 -12
- package/lib/models/extensions/scrape-order/{scrape-order-change.entity.js → scrape-order-change.entity.mjs} +1 -1
- package/lib/models/extensions/scrape-order/{scrape-order-item.entity.js → scrape-order-item.entity.mjs} +12 -12
- package/lib/models/extensions/ship-inventory-order/{ship-inventory-order-change.entity.js → ship-inventory-order-change.entity.mjs} +2 -2
- package/lib/models/extensions/ship-inventory-order/{ship-inventory-order-item.entity.js → ship-inventory-order-item.entity.mjs} +2 -2
- package/lib/models/extensions/ship-inventory-order/{ship-inventory-order.entity.js → ship-inventory-order.entity.mjs} +2 -2
- package/lib/models/extensions/split-batch-order/{split-batch-order-change.entity.js → split-batch-order-change.entity.mjs} +1 -1
- package/lib/models/extensions/split-batch-order/{split-batch-order-item.entity.js → split-batch-order-item.entity.mjs} +12 -12
- package/lib/models/extensions/transfer-customer-order/{transfer-customer-order-change.entity.js → transfer-customer-order-change.entity.mjs} +1 -1
- package/lib/models/extensions/transfer-customer-order/{transfer-customer-order-item.entity.js → transfer-customer-order-item.entity.mjs} +12 -12
- package/lib/models/extensions/transfer-order/{transfer-order-change.entity.js → transfer-order-change.entity.mjs} +1 -1
- package/lib/models/extensions/transfer-order/{transfer-order-item.entity.js → transfer-order-item.entity.mjs} +12 -12
- package/lib/models/extensions/transfer-vendor-order/{transfer-vendor-order-change.entity.js → transfer-vendor-order-change.entity.mjs} +1 -1
- package/lib/models/extensions/transfer-vendor-order/{transfer-vendor-order-item.entity.js → transfer-vendor-order-item.entity.mjs} +12 -12
- package/lib/models/metadata/batch.entity.d.ts +46 -0
- package/lib/models/metadata/batch.entity.mjs +131 -0
- package/lib/models/metadata/{loader.entity.js → loader.entity.mjs} +1 -1
- package/lib/models/metadata/{material-unit.entity.js → material-unit.entity.mjs} +1 -1
- package/lib/models/metadata/{stock.entity.js → stock.entity.mjs} +1 -1
- package/lib/models/{models.module.js → models.module.mjs} +60 -52
- package/lib/models/{wms-entities.js → wms-entities.mjs} +5 -5
- package/lib/services/{allocate-inventory-order.service.js → allocate-inventory-order.service.mjs} +60 -56
- package/lib/services/base-order.service.d.ts +18 -3
- package/lib/services/base-order.service.mjs +76 -0
- package/lib/services/batch.service.d.ts +17 -0
- package/lib/services/{batch.service.js → batch.service.mjs} +93 -53
- package/lib/services/consumption-order.service.d.ts +75 -0
- package/lib/services/consumption-order.service.mjs +504 -0
- package/lib/services/{hold-inventory-order.service.js → hold-inventory-order.service.mjs} +60 -56
- package/lib/services/index.d.ts +3 -0
- package/lib/services/{inventory-count-order.service.js → inventory-count-order.service.mjs} +64 -57
- package/lib/services/{loader.service.js → loader.service.mjs} +56 -52
- package/lib/services/{location.service.js → location.service.mjs} +56 -52
- package/lib/services/{material.service.js → material.service.mjs} +56 -52
- package/lib/services/{merge-batch-order.service.js → merge-batch-order.service.mjs} +60 -56
- package/lib/services/order-reference.service.d.ts +50 -0
- package/lib/services/order-reference.service.mjs +136 -0
- package/lib/services/{quality-inspection-order.service.js → quality-inspection-order.service.mjs} +59 -55
- package/lib/services/{receive-inventory-order.service.js → receive-inventory-order.service.mjs} +189 -135
- package/lib/services/{reclassify-inventory-order.service.js → reclassify-inventory-order.service.mjs} +60 -56
- package/lib/services/{sale-order.service.js → sale-order.service.mjs} +1 -1
- package/lib/services/{scrape.service.js → scrape.service.mjs} +59 -55
- package/lib/services/{ship-inventory-order.service.js → ship-inventory-order.service.mjs} +60 -56
- package/lib/services/split-batch-order.service.mjs +191 -0
- package/lib/services/{stock.service.js → stock.service.mjs} +86 -56
- package/lib/services/{transfer-customer-order.service.js → transfer-customer-order.service.mjs} +60 -56
- package/lib/services/{transfer-order.service.js → transfer-order.service.mjs} +61 -57
- package/lib/services/{transfer-vendor-order.service.js → transfer-vendor-order.service.mjs} +60 -56
- package/lib/services/{unit.service.js → unit.service.mjs} +56 -52
- package/lib/services/{warehouse-map.service.js → warehouse-map.service.mjs} +1 -1
- package/lib/typings/aggregated-stock.d.ts +6 -0
- package/lib/typings/consumption-order.input.d.ts +72 -0
- package/lib/typings/core-module-options.d.ts +34 -1
- package/lib/typings/custom-change-table.d.ts +70 -0
- package/lib/typings/find-stock.input.d.ts +14 -0
- package/lib/typings/get-batch.input.d.ts +16 -0
- package/lib/typings/index.d.ts +3 -0
- package/lib/typings/order-reference.input.d.ts +28 -0
- package/lib/typings/split-batch.input.d.ts +11 -0
- package/package.json +19 -7
- package/lib/models/metadata/batch.entity.js +0 -73
- package/lib/services/split-batch-order.service.js +0 -168
- package/lib/typings/entity-overrides.d.ts +0 -34
- package/lib/typings/entity-overrides.js +0 -7
- package/src/lib/models/extensions/README.md +0 -219
- /package/lib/constants/{inventory-count-status.js → inventory-count-status.mjs} +0 -0
- /package/lib/events/{dispatch-scope.js → dispatch-scope.mjs} +0 -0
- /package/lib/events/{inventory-count-lock.subscriber.js → inventory-count-lock.subscriber.mjs} +0 -0
- /package/lib/models/extensions/allocate-inventory-order/{allocate-inventory-order.entity.js → allocate-inventory-order.entity.mjs} +0 -0
- /package/lib/models/extensions/hold-inventory-order/{hold-inventory-order.entity.js → hold-inventory-order.entity.mjs} +0 -0
- /package/lib/models/extensions/merge-batch-order/{merge-batch-order.entity.js → merge-batch-order.entity.mjs} +0 -0
- /package/lib/models/extensions/quality-inspection-order/{quality-inspection-order.entity.js → quality-inspection-order.entity.mjs} +0 -0
- /package/lib/models/extensions/reclassify-inventory-order/{reclassify-inventory-order.entity.js → reclassify-inventory-order.entity.mjs} +0 -0
- /package/lib/models/extensions/scrape-order/{scrape-order.entity.js → scrape-order.entity.mjs} +0 -0
- /package/lib/models/extensions/ship-inventory-order/{ship-inventory-order-reference.entity.js → ship-inventory-order-reference.entity.mjs} +0 -0
- /package/lib/models/extensions/split-batch-order/{split-batch-order.entity.js → split-batch-order.entity.mjs} +0 -0
- /package/lib/models/extensions/transfer-customer-order/{transfer-customer-order.entity.js → transfer-customer-order.entity.mjs} +0 -0
- /package/lib/models/extensions/transfer-order/{transfer-order.entity.js → transfer-order.entity.mjs} +0 -0
- /package/lib/models/extensions/transfer-vendor-order/{transfer-vendor-order.entity.js → transfer-vendor-order.entity.mjs} +0 -0
- /package/lib/models/metadata/{batch-group.entity.js → batch-group.entity.mjs} +0 -0
- /package/lib/models/metadata/{loader-type.entity.js → loader-type.entity.mjs} +0 -0
- /package/lib/models/metadata/{loader-unit.entity.js → loader-unit.entity.mjs} +0 -0
- /package/lib/models/metadata/{location.entity.js → location.entity.mjs} +0 -0
- /package/lib/models/metadata/{material.entity.js → material.entity.mjs} +0 -0
- /package/lib/models/metadata/{order.entity.js → order.entity.mjs} +0 -0
- /package/lib/models/metadata/{sale-order.entity.js → sale-order.entity.mjs} +0 -0
- /package/lib/models/metadata/{unit.entity.js → unit.entity.mjs} +0 -0
- /package/lib/services/{helper.service.js → helper.service.mjs} +0 -0
- /package/lib/typings/{core-module-options.js → core-module-options.mjs} +0 -0
- /package/lib/typings/{find-receive-inventory-order.input.js → find-receive-inventory-order.input.mjs} +0 -0
- /package/lib/typings/{find-ship-inventory-order.input.js → find-ship-inventory-order.input.mjs} +0 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { LoadersEntityClass, LocationEntityClass } from '../../metadata';
|
|
2
|
+
import { ConsumptionOrderEntityClass } from './consumption-order.entity';
|
|
3
|
+
import { ConsumptionOrderChangeEntityClass } from './consumption-order-change.entity';
|
|
4
|
+
export declare const ConsumptionOrderItemEntity: unique symbol;
|
|
5
|
+
export declare class ConsumptionOrderItemEntityClass {
|
|
6
|
+
id: string;
|
|
7
|
+
materialId: string;
|
|
8
|
+
batchId: string;
|
|
9
|
+
/** Where the material is issued from. */
|
|
10
|
+
locationId: string;
|
|
11
|
+
loaderId: string | null;
|
|
12
|
+
unitId: string | null;
|
|
13
|
+
targetConsumedQuantity: number;
|
|
14
|
+
/**
|
|
15
|
+
* Where the material sits while the process holds it. An ordinary location;
|
|
16
|
+
* the host decides which of its own means "in the hands of a process".
|
|
17
|
+
*/
|
|
18
|
+
targetLocationId: string | null;
|
|
19
|
+
targetLoaderId: string | null;
|
|
20
|
+
orderId: string;
|
|
21
|
+
removedAt: Date | null;
|
|
22
|
+
location: LocationEntityClass;
|
|
23
|
+
loader: LoadersEntityClass;
|
|
24
|
+
order: ConsumptionOrderEntityClass;
|
|
25
|
+
changes: ConsumptionOrderChangeEntityClass[];
|
|
26
|
+
}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { __decorate, __metadata } from 'tslib';
|
|
2
|
+
import { PrimaryGeneratedColumn, Column, Index, ManyToOne, JoinColumn, OneToMany, Entity, TableInheritance } from 'typeorm';
|
|
3
|
+
import '../../metadata/batch.entity.mjs';
|
|
4
|
+
import '../../metadata/batch-group.entity.mjs';
|
|
5
|
+
import { LoadersEntityClass } from '../../metadata/loader.entity.mjs';
|
|
6
|
+
import '../../metadata/loader-type.entity.mjs';
|
|
7
|
+
import '../../metadata/loader-unit.entity.mjs';
|
|
8
|
+
import { LocationEntityClass } from '../../metadata/location.entity.mjs';
|
|
9
|
+
import '../../metadata/material.entity.mjs';
|
|
10
|
+
import '../../metadata/material-unit.entity.mjs';
|
|
11
|
+
import '@rytass/wms-base-nestjs-module';
|
|
12
|
+
import '../../metadata/sale-order.entity.mjs';
|
|
13
|
+
import '../../metadata/stock.entity.mjs';
|
|
14
|
+
import '../../metadata/unit.entity.mjs';
|
|
15
|
+
import { ConsumptionOrderEntityClass } from './consumption-order.entity.mjs';
|
|
16
|
+
|
|
17
|
+
const ConsumptionOrderItemEntity = Symbol('ConsumptionOrderItemEntity');
|
|
18
|
+
let ConsumptionOrderItemEntityClass = class ConsumptionOrderItemEntityClass {
|
|
19
|
+
id;
|
|
20
|
+
materialId;
|
|
21
|
+
batchId;
|
|
22
|
+
/** Where the material is issued from. */
|
|
23
|
+
locationId;
|
|
24
|
+
loaderId;
|
|
25
|
+
unitId;
|
|
26
|
+
targetConsumedQuantity;
|
|
27
|
+
/**
|
|
28
|
+
* Where the material sits while the process holds it. An ordinary location;
|
|
29
|
+
* the host decides which of its own means "in the hands of a process".
|
|
30
|
+
*/
|
|
31
|
+
targetLocationId;
|
|
32
|
+
targetLoaderId;
|
|
33
|
+
orderId;
|
|
34
|
+
removedAt;
|
|
35
|
+
location;
|
|
36
|
+
loader;
|
|
37
|
+
order;
|
|
38
|
+
changes;
|
|
39
|
+
};
|
|
40
|
+
__decorate([
|
|
41
|
+
PrimaryGeneratedColumn('uuid'),
|
|
42
|
+
__metadata("design:type", String)
|
|
43
|
+
], ConsumptionOrderItemEntityClass.prototype, "id", void 0);
|
|
44
|
+
__decorate([
|
|
45
|
+
Column({ type: 'uuid' }),
|
|
46
|
+
Index(),
|
|
47
|
+
__metadata("design:type", String)
|
|
48
|
+
], ConsumptionOrderItemEntityClass.prototype, "materialId", void 0);
|
|
49
|
+
__decorate([
|
|
50
|
+
Column({ type: 'uuid' }),
|
|
51
|
+
Index(),
|
|
52
|
+
__metadata("design:type", String)
|
|
53
|
+
], ConsumptionOrderItemEntityClass.prototype, "batchId", void 0);
|
|
54
|
+
__decorate([
|
|
55
|
+
Column({ type: 'uuid' }),
|
|
56
|
+
Index(),
|
|
57
|
+
__metadata("design:type", String)
|
|
58
|
+
], ConsumptionOrderItemEntityClass.prototype, "locationId", void 0);
|
|
59
|
+
__decorate([
|
|
60
|
+
Column({ type: 'uuid', nullable: true }),
|
|
61
|
+
__metadata("design:type", Object)
|
|
62
|
+
], ConsumptionOrderItemEntityClass.prototype, "loaderId", void 0);
|
|
63
|
+
__decorate([
|
|
64
|
+
Column({ type: 'uuid', nullable: true }),
|
|
65
|
+
__metadata("design:type", Object)
|
|
66
|
+
], ConsumptionOrderItemEntityClass.prototype, "unitId", void 0);
|
|
67
|
+
__decorate([
|
|
68
|
+
Column({ type: 'numeric' }),
|
|
69
|
+
__metadata("design:type", Number)
|
|
70
|
+
], ConsumptionOrderItemEntityClass.prototype, "targetConsumedQuantity", void 0);
|
|
71
|
+
__decorate([
|
|
72
|
+
Column({ type: 'uuid', nullable: true }),
|
|
73
|
+
Index(),
|
|
74
|
+
__metadata("design:type", Object)
|
|
75
|
+
], ConsumptionOrderItemEntityClass.prototype, "targetLocationId", void 0);
|
|
76
|
+
__decorate([
|
|
77
|
+
Column({ type: 'uuid', nullable: true }),
|
|
78
|
+
Index(),
|
|
79
|
+
__metadata("design:type", Object)
|
|
80
|
+
], ConsumptionOrderItemEntityClass.prototype, "targetLoaderId", void 0);
|
|
81
|
+
__decorate([
|
|
82
|
+
Column({ type: 'uuid' }),
|
|
83
|
+
Index(),
|
|
84
|
+
__metadata("design:type", String)
|
|
85
|
+
], ConsumptionOrderItemEntityClass.prototype, "orderId", void 0);
|
|
86
|
+
__decorate([
|
|
87
|
+
Column({ type: 'timestamptz', nullable: true }),
|
|
88
|
+
__metadata("design:type", Object)
|
|
89
|
+
], ConsumptionOrderItemEntityClass.prototype, "removedAt", void 0);
|
|
90
|
+
__decorate([
|
|
91
|
+
ManyToOne('locations'),
|
|
92
|
+
JoinColumn({ name: 'locationId', referencedColumnName: 'id' }),
|
|
93
|
+
__metadata("design:type", LocationEntityClass)
|
|
94
|
+
], ConsumptionOrderItemEntityClass.prototype, "location", void 0);
|
|
95
|
+
__decorate([
|
|
96
|
+
ManyToOne('loaders'),
|
|
97
|
+
JoinColumn({ name: 'loaderId', referencedColumnName: 'id' }),
|
|
98
|
+
__metadata("design:type", LoadersEntityClass)
|
|
99
|
+
], ConsumptionOrderItemEntityClass.prototype, "loader", void 0);
|
|
100
|
+
__decorate([
|
|
101
|
+
ManyToOne('consumption_orders', (entity) => entity.items),
|
|
102
|
+
JoinColumn({ name: 'orderId', referencedColumnName: 'id' }),
|
|
103
|
+
__metadata("design:type", ConsumptionOrderEntityClass)
|
|
104
|
+
], ConsumptionOrderItemEntityClass.prototype, "order", void 0);
|
|
105
|
+
__decorate([
|
|
106
|
+
OneToMany('consumption_order_changes', (change) => change.item),
|
|
107
|
+
__metadata("design:type", Array)
|
|
108
|
+
], ConsumptionOrderItemEntityClass.prototype, "changes", void 0);
|
|
109
|
+
ConsumptionOrderItemEntityClass = __decorate([
|
|
110
|
+
Entity('consumption_order_items'),
|
|
111
|
+
TableInheritance({ column: { type: 'varchar', name: 'entityName' } })
|
|
112
|
+
], ConsumptionOrderItemEntityClass);
|
|
113
|
+
|
|
114
|
+
export { ConsumptionOrderItemEntity, ConsumptionOrderItemEntityClass };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { ConsumptionOrderItemEntityClass } from './consumption-order-item.entity';
|
|
2
|
+
export declare const ConsumptionOrderEntity: unique symbol;
|
|
3
|
+
/**
|
|
4
|
+
* Material handed to a process that consumes it.
|
|
5
|
+
*
|
|
6
|
+
* One order covers the whole life of that handover: issue material out to a
|
|
7
|
+
* consuming location, take back what was not used, and settle what was. Three
|
|
8
|
+
* actions on one document rather than three documents, which is the grammar
|
|
9
|
+
* every other stateful order here already uses -- hold/release, allocate/
|
|
10
|
+
* deallocate and transfer/cancel are each a single order too.
|
|
11
|
+
*
|
|
12
|
+
* Nothing about it is specific to manufacturing. "Give stock to a process that
|
|
13
|
+
* eats some of it, possibly returns the rest, and may produce something else"
|
|
14
|
+
* is equally a subcontract, a repair job, a teardown, or a kitchen prep list.
|
|
15
|
+
* What the process *is* belongs in `order_references`.
|
|
16
|
+
*
|
|
17
|
+
* The consuming location is an ordinary location, and material sitting there is
|
|
18
|
+
* ordinary `FREE` stock. There is no work-in-progress status: status in this
|
|
19
|
+
* model is a flag on the batch, so a status would force every partial issue to
|
|
20
|
+
* split a child batch off, and a batch key per issue is a worse answer than a
|
|
21
|
+
* location. `excludeLocationIds` is how a stock report leaves that location
|
|
22
|
+
* out.
|
|
23
|
+
*/
|
|
24
|
+
export declare class ConsumptionOrderEntityClass {
|
|
25
|
+
id: string;
|
|
26
|
+
key: string;
|
|
27
|
+
description: string | null;
|
|
28
|
+
createdBy: string | null;
|
|
29
|
+
removedAt: Date | null;
|
|
30
|
+
createdAt: Date;
|
|
31
|
+
items: ConsumptionOrderItemEntityClass[];
|
|
32
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { __decorate, __metadata } from 'tslib';
|
|
2
|
+
import { PrimaryGeneratedColumn, Column, Index, CreateDateColumn, OneToMany, Entity, TableInheritance } from 'typeorm';
|
|
3
|
+
|
|
4
|
+
const ConsumptionOrderEntity = Symbol('ConsumptionOrderEntity');
|
|
5
|
+
/**
|
|
6
|
+
* Material handed to a process that consumes it.
|
|
7
|
+
*
|
|
8
|
+
* One order covers the whole life of that handover: issue material out to a
|
|
9
|
+
* consuming location, take back what was not used, and settle what was. Three
|
|
10
|
+
* actions on one document rather than three documents, which is the grammar
|
|
11
|
+
* every other stateful order here already uses -- hold/release, allocate/
|
|
12
|
+
* deallocate and transfer/cancel are each a single order too.
|
|
13
|
+
*
|
|
14
|
+
* Nothing about it is specific to manufacturing. "Give stock to a process that
|
|
15
|
+
* eats some of it, possibly returns the rest, and may produce something else"
|
|
16
|
+
* is equally a subcontract, a repair job, a teardown, or a kitchen prep list.
|
|
17
|
+
* What the process *is* belongs in `order_references`.
|
|
18
|
+
*
|
|
19
|
+
* The consuming location is an ordinary location, and material sitting there is
|
|
20
|
+
* ordinary `FREE` stock. There is no work-in-progress status: status in this
|
|
21
|
+
* model is a flag on the batch, so a status would force every partial issue to
|
|
22
|
+
* split a child batch off, and a batch key per issue is a worse answer than a
|
|
23
|
+
* location. `excludeLocationIds` is how a stock report leaves that location
|
|
24
|
+
* out.
|
|
25
|
+
*/
|
|
26
|
+
let ConsumptionOrderEntityClass = class ConsumptionOrderEntityClass {
|
|
27
|
+
id;
|
|
28
|
+
key;
|
|
29
|
+
description;
|
|
30
|
+
createdBy;
|
|
31
|
+
removedAt;
|
|
32
|
+
createdAt;
|
|
33
|
+
items;
|
|
34
|
+
};
|
|
35
|
+
__decorate([
|
|
36
|
+
PrimaryGeneratedColumn('uuid'),
|
|
37
|
+
__metadata("design:type", String)
|
|
38
|
+
], ConsumptionOrderEntityClass.prototype, "id", void 0);
|
|
39
|
+
__decorate([
|
|
40
|
+
Column({ type: 'varchar', unique: true }),
|
|
41
|
+
Index(),
|
|
42
|
+
__metadata("design:type", String)
|
|
43
|
+
], ConsumptionOrderEntityClass.prototype, "key", void 0);
|
|
44
|
+
__decorate([
|
|
45
|
+
Column({ type: 'text', nullable: true }),
|
|
46
|
+
__metadata("design:type", Object)
|
|
47
|
+
], ConsumptionOrderEntityClass.prototype, "description", void 0);
|
|
48
|
+
__decorate([
|
|
49
|
+
Column({ type: 'varchar', nullable: true }),
|
|
50
|
+
__metadata("design:type", Object)
|
|
51
|
+
], ConsumptionOrderEntityClass.prototype, "createdBy", void 0);
|
|
52
|
+
__decorate([
|
|
53
|
+
Column({ type: 'timestamptz', nullable: true }),
|
|
54
|
+
__metadata("design:type", Object)
|
|
55
|
+
], ConsumptionOrderEntityClass.prototype, "removedAt", void 0);
|
|
56
|
+
__decorate([
|
|
57
|
+
CreateDateColumn({ type: 'timestamptz' }),
|
|
58
|
+
__metadata("design:type", Date)
|
|
59
|
+
], ConsumptionOrderEntityClass.prototype, "createdAt", void 0);
|
|
60
|
+
__decorate([
|
|
61
|
+
OneToMany('consumption_order_items', (entity) => entity.order),
|
|
62
|
+
__metadata("design:type", Array)
|
|
63
|
+
], ConsumptionOrderEntityClass.prototype, "items", void 0);
|
|
64
|
+
ConsumptionOrderEntityClass = __decorate([
|
|
65
|
+
Entity('consumption_orders'),
|
|
66
|
+
TableInheritance({ column: { type: 'varchar', name: 'entityName' } })
|
|
67
|
+
], ConsumptionOrderEntityClass);
|
|
68
|
+
|
|
69
|
+
export { ConsumptionOrderEntity, ConsumptionOrderEntityClass };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __decorate, __metadata } from 'tslib';
|
|
2
2
|
import { OrderEntity } from '@rytass/wms-base-nestjs-module';
|
|
3
3
|
import { PrimaryGeneratedColumn, Column, OneToOne, JoinColumn, ManyToOne, Entity } from 'typeorm';
|
|
4
|
-
import { HoldInventoryOrderItemEntityClass } from './hold-inventory-order-item.entity.
|
|
4
|
+
import { HoldInventoryOrderItemEntityClass } from './hold-inventory-order-item.entity.mjs';
|
|
5
5
|
|
|
6
6
|
const HoldInventoryOrderChangeEntity = Symbol('HoldInventoryOrderChangeEntity');
|
|
7
7
|
let HoldInventoryOrderChangeEntityClass = class HoldInventoryOrderChangeEntityClass {
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { __decorate, __metadata } from 'tslib';
|
|
2
2
|
import { PrimaryGeneratedColumn, Column, Index, ManyToOne, JoinColumn, OneToMany, Entity, TableInheritance } from 'typeorm';
|
|
3
|
-
import '../../metadata/batch.entity.
|
|
4
|
-
import '../../metadata/batch-group.entity.
|
|
5
|
-
import { LoadersEntityClass } from '../../metadata/loader.entity.
|
|
6
|
-
import '../../metadata/loader-type.entity.
|
|
7
|
-
import '../../metadata/loader-unit.entity.
|
|
8
|
-
import { LocationEntityClass } from '../../metadata/location.entity.
|
|
9
|
-
import '../../metadata/material.entity.
|
|
10
|
-
import '../../metadata/material-unit.entity.
|
|
3
|
+
import '../../metadata/batch.entity.mjs';
|
|
4
|
+
import '../../metadata/batch-group.entity.mjs';
|
|
5
|
+
import { LoadersEntityClass } from '../../metadata/loader.entity.mjs';
|
|
6
|
+
import '../../metadata/loader-type.entity.mjs';
|
|
7
|
+
import '../../metadata/loader-unit.entity.mjs';
|
|
8
|
+
import { LocationEntityClass } from '../../metadata/location.entity.mjs';
|
|
9
|
+
import '../../metadata/material.entity.mjs';
|
|
10
|
+
import '../../metadata/material-unit.entity.mjs';
|
|
11
11
|
import '@rytass/wms-base-nestjs-module';
|
|
12
|
-
import '../../metadata/sale-order.entity.
|
|
13
|
-
import '../../metadata/stock.entity.
|
|
14
|
-
import '../../metadata/unit.entity.
|
|
15
|
-
import { HoldInventoryOrderEntityClass } from './hold-inventory-order.entity.
|
|
12
|
+
import '../../metadata/sale-order.entity.mjs';
|
|
13
|
+
import '../../metadata/stock.entity.mjs';
|
|
14
|
+
import '../../metadata/unit.entity.mjs';
|
|
15
|
+
import { HoldInventoryOrderEntityClass } from './hold-inventory-order.entity.mjs';
|
|
16
16
|
|
|
17
17
|
const HoldInventoryOrderItemEntity = Symbol('HoldInventoryOrderItemEntity');
|
|
18
18
|
let HoldInventoryOrderItemEntityClass = class HoldInventoryOrderItemEntityClass {
|
|
@@ -38,3 +38,7 @@ export * from './scrape-order/scrape-order-change.entity';
|
|
|
38
38
|
export * from './inventory-count-order/inventory-count-order.entity';
|
|
39
39
|
export * from './inventory-count-order/inventory-count-order-item.entity';
|
|
40
40
|
export * from './inventory-count-order/inventory-count-order-change.entity';
|
|
41
|
+
export * from './consumption-order/consumption-order.entity';
|
|
42
|
+
export * from './consumption-order/consumption-order-item.entity';
|
|
43
|
+
export * from './consumption-order/consumption-order-change.entity';
|
|
44
|
+
export * from './order-reference/order-reference.entity';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __decorate, __metadata } from 'tslib';
|
|
2
2
|
import { OrderEntity } from '@rytass/wms-base-nestjs-module';
|
|
3
3
|
import { PrimaryGeneratedColumn, Column, OneToOne, JoinColumn, ManyToOne, Entity } from 'typeorm';
|
|
4
|
-
import { InventoryCountOrderItemEntityClass } from './inventory-count-order-item.entity.
|
|
4
|
+
import { InventoryCountOrderItemEntityClass } from './inventory-count-order-item.entity.mjs';
|
|
5
5
|
|
|
6
6
|
const InventoryCountOrderChangeEntity = Symbol('InventoryCountOrderChangeEntity');
|
|
7
7
|
/**
|
|
@@ -34,8 +34,20 @@ export declare class InventoryCountOrderItemEntityClass {
|
|
|
34
34
|
isAddition: boolean;
|
|
35
35
|
held: boolean | null;
|
|
36
36
|
inShipment: boolean | null;
|
|
37
|
-
/**
|
|
37
|
+
/**
|
|
38
|
+
* `false` = 檢驗失敗, `true` = passed, `null` = not inspected.
|
|
39
|
+
*
|
|
40
|
+
* `null` on its own does **not** mean 待檢驗: it is the resting state of
|
|
41
|
+
* almost every batch in the warehouse. Pair it with
|
|
42
|
+
* {@link InventoryCountOrderItemEntityClass.requiresInspection}.
|
|
43
|
+
*/
|
|
38
44
|
inspectionResult: boolean | null;
|
|
45
|
+
/**
|
|
46
|
+
* Whether anybody had asked for this position to be inspected when the count
|
|
47
|
+
* started. Snapshotted for the same reason as the flags around it, and needed
|
|
48
|
+
* because `inspectionResult IS NULL` alone would mark the whole sheet 待檢驗.
|
|
49
|
+
*/
|
|
50
|
+
requiresInspection: boolean | null;
|
|
39
51
|
transferId: string | null;
|
|
40
52
|
vendorId: string | null;
|
|
41
53
|
customerId: string | null;
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { __decorate, __metadata } from 'tslib';
|
|
2
2
|
import { PrimaryGeneratedColumn, Column, Index, ManyToOne, JoinColumn, OneToMany, Entity, TableInheritance } from 'typeorm';
|
|
3
|
-
import '../../metadata/batch.entity.
|
|
4
|
-
import '../../metadata/batch-group.entity.
|
|
5
|
-
import { LoadersEntityClass } from '../../metadata/loader.entity.
|
|
6
|
-
import '../../metadata/loader-type.entity.
|
|
7
|
-
import '../../metadata/loader-unit.entity.
|
|
8
|
-
import { LocationEntityClass } from '../../metadata/location.entity.
|
|
9
|
-
import '../../metadata/material.entity.
|
|
10
|
-
import '../../metadata/material-unit.entity.
|
|
3
|
+
import '../../metadata/batch.entity.mjs';
|
|
4
|
+
import '../../metadata/batch-group.entity.mjs';
|
|
5
|
+
import { LoadersEntityClass } from '../../metadata/loader.entity.mjs';
|
|
6
|
+
import '../../metadata/loader-type.entity.mjs';
|
|
7
|
+
import '../../metadata/loader-unit.entity.mjs';
|
|
8
|
+
import { LocationEntityClass } from '../../metadata/location.entity.mjs';
|
|
9
|
+
import '../../metadata/material.entity.mjs';
|
|
10
|
+
import '../../metadata/material-unit.entity.mjs';
|
|
11
11
|
import '@rytass/wms-base-nestjs-module';
|
|
12
|
-
import '../../metadata/sale-order.entity.
|
|
13
|
-
import '../../metadata/stock.entity.
|
|
14
|
-
import '../../metadata/unit.entity.
|
|
15
|
-
import { InventoryCountOrderEntityClass } from './inventory-count-order.entity.
|
|
12
|
+
import '../../metadata/sale-order.entity.mjs';
|
|
13
|
+
import '../../metadata/stock.entity.mjs';
|
|
14
|
+
import '../../metadata/unit.entity.mjs';
|
|
15
|
+
import { InventoryCountOrderEntityClass } from './inventory-count-order.entity.mjs';
|
|
16
16
|
|
|
17
17
|
const InventoryCountOrderItemEntity = Symbol('InventoryCountOrderItemEntity');
|
|
18
18
|
/**
|
|
@@ -58,8 +58,20 @@ let InventoryCountOrderItemEntityClass = class InventoryCountOrderItemEntityClas
|
|
|
58
58
|
// `null` before counting has started.
|
|
59
59
|
held;
|
|
60
60
|
inShipment;
|
|
61
|
-
/**
|
|
61
|
+
/**
|
|
62
|
+
* `false` = 檢驗失敗, `true` = passed, `null` = not inspected.
|
|
63
|
+
*
|
|
64
|
+
* `null` on its own does **not** mean 待檢驗: it is the resting state of
|
|
65
|
+
* almost every batch in the warehouse. Pair it with
|
|
66
|
+
* {@link InventoryCountOrderItemEntityClass.requiresInspection}.
|
|
67
|
+
*/
|
|
62
68
|
inspectionResult;
|
|
69
|
+
/**
|
|
70
|
+
* Whether anybody had asked for this position to be inspected when the count
|
|
71
|
+
* started. Snapshotted for the same reason as the flags around it, and needed
|
|
72
|
+
* because `inspectionResult IS NULL` alone would mark the whole sheet 待檢驗.
|
|
73
|
+
*/
|
|
74
|
+
requiresInspection;
|
|
63
75
|
transferId;
|
|
64
76
|
vendorId;
|
|
65
77
|
customerId;
|
|
@@ -128,6 +140,10 @@ __decorate([
|
|
|
128
140
|
Column({ type: 'boolean', nullable: true }),
|
|
129
141
|
__metadata("design:type", Object)
|
|
130
142
|
], InventoryCountOrderItemEntityClass.prototype, "inspectionResult", void 0);
|
|
143
|
+
__decorate([
|
|
144
|
+
Column({ type: 'boolean', nullable: true }),
|
|
145
|
+
__metadata("design:type", Object)
|
|
146
|
+
], InventoryCountOrderItemEntityClass.prototype, "requiresInspection", void 0);
|
|
131
147
|
__decorate([
|
|
132
148
|
Column({ type: 'uuid', nullable: true }),
|
|
133
149
|
__metadata("design:type", Object)
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { __decorate, __metadata } from 'tslib';
|
|
2
2
|
import { PrimaryGeneratedColumn, Column, Index, CreateDateColumn, OneToMany, Entity, TableInheritance, ManyToOne, JoinColumn } from 'typeorm';
|
|
3
|
-
import '../../metadata/batch.entity.
|
|
4
|
-
import '../../metadata/batch-group.entity.
|
|
5
|
-
import '../../metadata/loader.entity.
|
|
6
|
-
import '../../metadata/loader-type.entity.
|
|
7
|
-
import '../../metadata/loader-unit.entity.
|
|
8
|
-
import { LocationEntityClass } from '../../metadata/location.entity.
|
|
9
|
-
import '../../metadata/material.entity.
|
|
10
|
-
import '../../metadata/material-unit.entity.
|
|
3
|
+
import '../../metadata/batch.entity.mjs';
|
|
4
|
+
import '../../metadata/batch-group.entity.mjs';
|
|
5
|
+
import '../../metadata/loader.entity.mjs';
|
|
6
|
+
import '../../metadata/loader-type.entity.mjs';
|
|
7
|
+
import '../../metadata/loader-unit.entity.mjs';
|
|
8
|
+
import { LocationEntityClass } from '../../metadata/location.entity.mjs';
|
|
9
|
+
import '../../metadata/material.entity.mjs';
|
|
10
|
+
import '../../metadata/material-unit.entity.mjs';
|
|
11
11
|
import '@rytass/wms-base-nestjs-module';
|
|
12
|
-
import '../../metadata/sale-order.entity.
|
|
13
|
-
import '../../metadata/stock.entity.
|
|
14
|
-
import '../../metadata/unit.entity.
|
|
15
|
-
import { InventoryCountStatus } from '../../../constants/inventory-count-status.
|
|
12
|
+
import '../../metadata/sale-order.entity.mjs';
|
|
13
|
+
import '../../metadata/stock.entity.mjs';
|
|
14
|
+
import '../../metadata/unit.entity.mjs';
|
|
15
|
+
import { InventoryCountStatus } from '../../../constants/inventory-count-status.mjs';
|
|
16
16
|
|
|
17
17
|
const InventoryCountOrderEntity = Symbol('InventoryCountOrderEntity');
|
|
18
18
|
let InventoryCountOrderEntityClass = class InventoryCountOrderEntityClass {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __decorate, __metadata } from 'tslib';
|
|
2
2
|
import { OrderEntity } from '@rytass/wms-base-nestjs-module';
|
|
3
3
|
import { PrimaryGeneratedColumn, Column, OneToOne, JoinColumn, ManyToOne, Entity } from 'typeorm';
|
|
4
|
-
import { MergeBatchOrderItemEntityClass } from './merge-batch-order-item.entity.
|
|
4
|
+
import { MergeBatchOrderItemEntityClass } from './merge-batch-order-item.entity.mjs';
|
|
5
5
|
|
|
6
6
|
const MergeBatchOrderChangeEntity = Symbol('MergeBatchOrderChangeEntity');
|
|
7
7
|
let MergeBatchOrderChangeEntityClass = class MergeBatchOrderChangeEntityClass {
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { __decorate, __metadata } from 'tslib';
|
|
2
2
|
import { PrimaryGeneratedColumn, Column, Index, ManyToOne, JoinColumn, Entity, TableInheritance } from 'typeorm';
|
|
3
|
-
import '../../metadata/batch.entity.
|
|
4
|
-
import '../../metadata/batch-group.entity.
|
|
5
|
-
import { LoadersEntityClass } from '../../metadata/loader.entity.
|
|
6
|
-
import '../../metadata/loader-type.entity.
|
|
7
|
-
import '../../metadata/loader-unit.entity.
|
|
8
|
-
import { LocationEntityClass } from '../../metadata/location.entity.
|
|
9
|
-
import '../../metadata/material.entity.
|
|
10
|
-
import '../../metadata/material-unit.entity.
|
|
3
|
+
import '../../metadata/batch.entity.mjs';
|
|
4
|
+
import '../../metadata/batch-group.entity.mjs';
|
|
5
|
+
import { LoadersEntityClass } from '../../metadata/loader.entity.mjs';
|
|
6
|
+
import '../../metadata/loader-type.entity.mjs';
|
|
7
|
+
import '../../metadata/loader-unit.entity.mjs';
|
|
8
|
+
import { LocationEntityClass } from '../../metadata/location.entity.mjs';
|
|
9
|
+
import '../../metadata/material.entity.mjs';
|
|
10
|
+
import '../../metadata/material-unit.entity.mjs';
|
|
11
11
|
import '@rytass/wms-base-nestjs-module';
|
|
12
|
-
import '../../metadata/sale-order.entity.
|
|
13
|
-
import '../../metadata/stock.entity.
|
|
14
|
-
import '../../metadata/unit.entity.
|
|
15
|
-
import { MergeBatchOrderEntityClass } from './merge-batch-order.entity.
|
|
12
|
+
import '../../metadata/sale-order.entity.mjs';
|
|
13
|
+
import '../../metadata/stock.entity.mjs';
|
|
14
|
+
import '../../metadata/unit.entity.mjs';
|
|
15
|
+
import { MergeBatchOrderEntityClass } from './merge-batch-order.entity.mjs';
|
|
16
16
|
|
|
17
17
|
const MergeBatchOrderItemEntity = Symbol('MergeBatchOrderItemEntity');
|
|
18
18
|
let MergeBatchOrderItemEntityClass = class MergeBatchOrderItemEntityClass {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './order-reference.entity';
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { WmsOrderType } from '../../../constants/order-type';
|
|
2
|
+
export declare const OrderReferenceEntity: unique symbol;
|
|
3
|
+
/**
|
|
4
|
+
* Why an order was opened, in the host's own vocabulary.
|
|
5
|
+
*
|
|
6
|
+
* Every order family in this package records *what* moved and *when*, and none
|
|
7
|
+
* of them records *what for*. A host that drives the warehouse from somewhere
|
|
8
|
+
* else — a work order, a purchase order, a repair job, a subcontract — has no
|
|
9
|
+
* way to ask "which stock movements happened because of this", and no way to
|
|
10
|
+
* show an operator which upstream document a transfer belongs to.
|
|
11
|
+
*
|
|
12
|
+
* One polymorphic table rather than three columns on each of the thirteen order
|
|
13
|
+
* entities: the reference is the same idea everywhere, a new order family picks
|
|
14
|
+
* it up for free, and a per-item reference (`itemId`) has somewhere to live
|
|
15
|
+
* without widening every item table too.
|
|
16
|
+
*
|
|
17
|
+
* `referenceType` / `referenceId` are opaque strings. This module never parses
|
|
18
|
+
* them and never resolves them to anything — what a `work-order` is belongs to
|
|
19
|
+
* the host, and `@rytass/wms-module-react`'s `referenceLinkResolver` is how a
|
|
20
|
+
* host turns one into a link.
|
|
21
|
+
*
|
|
22
|
+
* Not to be confused with `ShipInventoryOrderReferenceEntityClass`, which
|
|
23
|
+
* despite the name is a line-level shipment plan (it carries quantities and a
|
|
24
|
+
* removal timestamp), not a pointer at an upstream document. The two coexist.
|
|
25
|
+
*/
|
|
26
|
+
export declare class OrderReferenceEntityClass {
|
|
27
|
+
id: string;
|
|
28
|
+
/** Which order family `orderId` belongs to. */
|
|
29
|
+
orderType: WmsOrderType;
|
|
30
|
+
orderId: string;
|
|
31
|
+
/**
|
|
32
|
+
* The order item this reference is about, when the reference is line-level —
|
|
33
|
+
* one order covering several upstream lines. `null` means it applies to the
|
|
34
|
+
* order as a whole.
|
|
35
|
+
*/
|
|
36
|
+
itemId: string | null;
|
|
37
|
+
/** Host-defined kind of document, e.g. `work-order`, `purchase-order`. */
|
|
38
|
+
referenceType: string;
|
|
39
|
+
/** The upstream document's identifier, as the host knows it. */
|
|
40
|
+
referenceId: string;
|
|
41
|
+
/** The line within that document, when it has lines. */
|
|
42
|
+
referenceLine: string | null;
|
|
43
|
+
/**
|
|
44
|
+
* Anything else the host wants to carry along — an operation sequence, a
|
|
45
|
+
* component line, a reason code. Stored verbatim and never interpreted.
|
|
46
|
+
*/
|
|
47
|
+
metadata: Record<string, unknown> | null;
|
|
48
|
+
createdAt: Date;
|
|
49
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { __decorate, __metadata } from 'tslib';
|
|
2
|
+
import { PrimaryGeneratedColumn, Column, CreateDateColumn, Entity, Index } from 'typeorm';
|
|
3
|
+
import '../../../constants/order-type.mjs';
|
|
4
|
+
|
|
5
|
+
const OrderReferenceEntity = Symbol('OrderReferenceEntity');
|
|
6
|
+
/**
|
|
7
|
+
* Why an order was opened, in the host's own vocabulary.
|
|
8
|
+
*
|
|
9
|
+
* Every order family in this package records *what* moved and *when*, and none
|
|
10
|
+
* of them records *what for*. A host that drives the warehouse from somewhere
|
|
11
|
+
* else — a work order, a purchase order, a repair job, a subcontract — has no
|
|
12
|
+
* way to ask "which stock movements happened because of this", and no way to
|
|
13
|
+
* show an operator which upstream document a transfer belongs to.
|
|
14
|
+
*
|
|
15
|
+
* One polymorphic table rather than three columns on each of the thirteen order
|
|
16
|
+
* entities: the reference is the same idea everywhere, a new order family picks
|
|
17
|
+
* it up for free, and a per-item reference (`itemId`) has somewhere to live
|
|
18
|
+
* without widening every item table too.
|
|
19
|
+
*
|
|
20
|
+
* `referenceType` / `referenceId` are opaque strings. This module never parses
|
|
21
|
+
* them and never resolves them to anything — what a `work-order` is belongs to
|
|
22
|
+
* the host, and `@rytass/wms-module-react`'s `referenceLinkResolver` is how a
|
|
23
|
+
* host turns one into a link.
|
|
24
|
+
*
|
|
25
|
+
* Not to be confused with `ShipInventoryOrderReferenceEntityClass`, which
|
|
26
|
+
* despite the name is a line-level shipment plan (it carries quantities and a
|
|
27
|
+
* removal timestamp), not a pointer at an upstream document. The two coexist.
|
|
28
|
+
*/
|
|
29
|
+
let OrderReferenceEntityClass = class OrderReferenceEntityClass {
|
|
30
|
+
id;
|
|
31
|
+
/** Which order family `orderId` belongs to. */
|
|
32
|
+
orderType;
|
|
33
|
+
orderId;
|
|
34
|
+
/**
|
|
35
|
+
* The order item this reference is about, when the reference is line-level —
|
|
36
|
+
* one order covering several upstream lines. `null` means it applies to the
|
|
37
|
+
* order as a whole.
|
|
38
|
+
*/
|
|
39
|
+
itemId;
|
|
40
|
+
/** Host-defined kind of document, e.g. `work-order`, `purchase-order`. */
|
|
41
|
+
referenceType;
|
|
42
|
+
/** The upstream document's identifier, as the host knows it. */
|
|
43
|
+
referenceId;
|
|
44
|
+
/** The line within that document, when it has lines. */
|
|
45
|
+
referenceLine;
|
|
46
|
+
/**
|
|
47
|
+
* Anything else the host wants to carry along — an operation sequence, a
|
|
48
|
+
* component line, a reason code. Stored verbatim and never interpreted.
|
|
49
|
+
*/
|
|
50
|
+
metadata;
|
|
51
|
+
createdAt;
|
|
52
|
+
};
|
|
53
|
+
__decorate([
|
|
54
|
+
PrimaryGeneratedColumn('uuid'),
|
|
55
|
+
__metadata("design:type", String)
|
|
56
|
+
], OrderReferenceEntityClass.prototype, "id", void 0);
|
|
57
|
+
__decorate([
|
|
58
|
+
Column({ type: 'varchar' }),
|
|
59
|
+
__metadata("design:type", String)
|
|
60
|
+
], OrderReferenceEntityClass.prototype, "orderType", void 0);
|
|
61
|
+
__decorate([
|
|
62
|
+
Column({ type: 'uuid' }),
|
|
63
|
+
__metadata("design:type", String)
|
|
64
|
+
], OrderReferenceEntityClass.prototype, "orderId", void 0);
|
|
65
|
+
__decorate([
|
|
66
|
+
Column({ type: 'uuid', nullable: true }),
|
|
67
|
+
__metadata("design:type", Object)
|
|
68
|
+
], OrderReferenceEntityClass.prototype, "itemId", void 0);
|
|
69
|
+
__decorate([
|
|
70
|
+
Column({ type: 'varchar' }),
|
|
71
|
+
__metadata("design:type", String)
|
|
72
|
+
], OrderReferenceEntityClass.prototype, "referenceType", void 0);
|
|
73
|
+
__decorate([
|
|
74
|
+
Column({ type: 'varchar' }),
|
|
75
|
+
__metadata("design:type", String)
|
|
76
|
+
], OrderReferenceEntityClass.prototype, "referenceId", void 0);
|
|
77
|
+
__decorate([
|
|
78
|
+
Column({ type: 'varchar', nullable: true }),
|
|
79
|
+
__metadata("design:type", Object)
|
|
80
|
+
], OrderReferenceEntityClass.prototype, "referenceLine", void 0);
|
|
81
|
+
__decorate([
|
|
82
|
+
Column({ type: 'jsonb', nullable: true }),
|
|
83
|
+
__metadata("design:type", Object)
|
|
84
|
+
], OrderReferenceEntityClass.prototype, "metadata", void 0);
|
|
85
|
+
__decorate([
|
|
86
|
+
CreateDateColumn({ type: 'timestamptz' }),
|
|
87
|
+
__metadata("design:type", Date)
|
|
88
|
+
], OrderReferenceEntityClass.prototype, "createdAt", void 0);
|
|
89
|
+
OrderReferenceEntityClass = __decorate([
|
|
90
|
+
Entity('order_references'),
|
|
91
|
+
Index(['orderType', 'orderId']),
|
|
92
|
+
Index(['referenceType', 'referenceId'])
|
|
93
|
+
], OrderReferenceEntityClass);
|
|
94
|
+
|
|
95
|
+
export { OrderReferenceEntity, OrderReferenceEntityClass };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __decorate, __metadata } from 'tslib';
|
|
2
2
|
import { OrderEntity } from '@rytass/wms-base-nestjs-module';
|
|
3
3
|
import { PrimaryGeneratedColumn, Column, OneToOne, JoinColumn, ManyToOne, Entity } from 'typeorm';
|
|
4
|
-
import { QualityInspectionOrderItemEntityClass } from './quality-inspection-order-item.entity.
|
|
4
|
+
import { QualityInspectionOrderItemEntityClass } from './quality-inspection-order-item.entity.mjs';
|
|
5
5
|
|
|
6
6
|
const QualityInspectionOrderChangeEntity = Symbol('QualityInspectionOrderChangeEntity');
|
|
7
7
|
let QualityInspectionOrderChangeEntityClass = class QualityInspectionOrderChangeEntityClass {
|