@rytass/wms-module-graphql 0.11.1 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -0
- package/docs/README.md +5 -2
- package/docs/api-reference.md +10 -8
- package/docs/integration-guide.md +34 -17
- package/docs/inventory-count.md +372 -0
- package/index.cjs.js +10 -0
- package/lib/inputs/index.d.ts +0 -0
- package/lib/inputs/inventory-count-order.args.d.ts +6 -0
- package/package.json +8 -29
- package/adapters/event-emitter.d.mts +0 -6
- package/adapters/event-emitter.mjs +0 -41
- package/adapters/member-base.d.mts +0 -6
- package/adapters/member-base.mjs +0 -63
- package/index.d.mts +0 -6
- package/index.mjs +0 -12
- package/lib/auth/host-skip.constant.mjs +0 -29
- package/lib/auth/wms-auth.guard.mjs +0 -41
- package/lib/auth/wms-auth.types.mjs +0 -6
- package/lib/auth/wms-operation.decorator.mjs +0 -29
- package/lib/dto/allocate-inventory-order-item.dto.mjs +0 -36
- package/lib/dto/allocate-inventory-order.dto.mjs +0 -31
- package/lib/dto/batch.dto.mjs +0 -26
- package/lib/dto/consumption-order-item.dto.mjs +0 -43
- package/lib/dto/consumption-order.dto.mjs +0 -52
- package/lib/dto/hold-inventory-order-item.dto.mjs +0 -37
- package/lib/dto/hold-inventory-order.dto.mjs +0 -47
- package/lib/dto/inventory-count-order.dto.mjs +0 -207
- package/lib/dto/loader-type.dto.mjs +0 -46
- package/lib/dto/loader-unit.dto.mjs +0 -21
- package/lib/dto/loader.dto.mjs +0 -71
- package/lib/dto/location.dto.mjs +0 -36
- package/lib/dto/material-unit.dto.mjs +0 -46
- package/lib/dto/material.dto.mjs +0 -36
- package/lib/dto/merge-batch-order.dto.mjs +0 -50
- package/lib/dto/order-reference.dto.mjs +0 -73
- package/lib/dto/pagination.dto.mjs +0 -51
- package/lib/dto/quality-inspection-order-item.dto.mjs +0 -50
- package/lib/dto/quality-inspection-order.dto.mjs +0 -42
- package/lib/dto/receive-inventory-order-item.dto.mjs +0 -60
- package/lib/dto/receive-inventory-order.dto.mjs +0 -58
- package/lib/dto/reclassify-inventory-order.dto.mjs +0 -55
- package/lib/dto/sale-order.dto.mjs +0 -20
- package/lib/dto/scrape-order-item.dto.mjs +0 -56
- package/lib/dto/scrape-order.dto.mjs +0 -37
- package/lib/dto/ship-inventory-order-item.dto.mjs +0 -56
- package/lib/dto/ship-inventory-order-reference.dto.mjs +0 -48
- package/lib/dto/ship-inventory-order.dto.mjs +0 -58
- package/lib/dto/split-batch-order.dto.mjs +0 -50
- package/lib/dto/stock.dto.mjs +0 -166
- package/lib/dto/transfer-customer-order-item.dto.mjs +0 -61
- package/lib/dto/transfer-customer-order.dto.mjs +0 -37
- package/lib/dto/transfer-order-item.dto.mjs +0 -41
- package/lib/dto/transfer-order.dto.mjs +0 -57
- package/lib/dto/transfer-vendor-order-item.dto.mjs +0 -61
- package/lib/dto/transfer-vendor-order.dto.mjs +0 -37
- package/lib/dto/unit.dto.mjs +0 -20
- package/lib/dto/warehouse-map.dto.mjs +0 -165
- package/lib/events/wms-mutation-event.constants.mjs +0 -4
- package/lib/events/wms-mutation-event.decorator.mjs +0 -20
- package/lib/events/wms-mutation.interceptor.mjs +0 -64
- package/lib/graphql.module.mjs +0 -183
- package/lib/helpers/create-wms-loaders.mjs +0 -11
- package/lib/helpers/helper.module.mjs +0 -15
- package/lib/helpers/loader.service.mjs +0 -230
- package/lib/helpers/query-path.mjs +0 -19
- package/lib/inputs/cancel-ship-order.args.mjs +0 -20
- package/lib/inputs/cancel-transfer-order.args.mjs +0 -23
- package/lib/inputs/consumption-order.args.mjs +0 -182
- package/lib/inputs/create-allocate-inventory-order-item.args.mjs +0 -50
- package/lib/inputs/create-allocate-inventory-order.args.mjs +0 -36
- package/lib/inputs/create-hold-inventory-order-item.args.mjs +0 -40
- package/lib/inputs/create-hold-inventory-order.args.mjs +0 -41
- package/lib/inputs/create-loader-type.args.mjs +0 -35
- package/lib/inputs/create-loader.args.mjs +0 -130
- package/lib/inputs/create-location.args.mjs +0 -50
- package/lib/inputs/create-material-unit.args.mjs +0 -25
- package/lib/inputs/create-material.args.mjs +0 -51
- package/lib/inputs/create-quality-inspection-order.args.mjs +0 -50
- package/lib/inputs/create-receive-inventory-order-item.args.mjs +0 -70
- package/lib/inputs/create-receive-inventory-order.args.mjs +0 -51
- package/lib/inputs/create-ship-inventory-order-item.args.mjs +0 -45
- package/lib/inputs/create-ship-inventory-order-reference.args.mjs +0 -65
- package/lib/inputs/create-ship-inventory-order.args.mjs +0 -57
- package/lib/inputs/create-transfer-customer-order-item.args.mjs +0 -40
- package/lib/inputs/create-transfer-customer-order.args.mjs +0 -51
- package/lib/inputs/create-transfer-order-item.args.mjs +0 -40
- package/lib/inputs/create-transfer-order.args.mjs +0 -61
- package/lib/inputs/create-transfer-vendor-order-item.args.mjs +0 -40
- package/lib/inputs/create-transfer-vendor-order.args.mjs +0 -51
- package/lib/inputs/date-range.args.mjs +0 -20
- package/lib/inputs/deallocate-order.args.mjs +0 -25
- package/lib/inputs/find-allocate-inventory-order.args.mjs +0 -42
- package/lib/inputs/find-batch.args.mjs +0 -21
- package/lib/inputs/find-hold-inventory-order.args.mjs +0 -42
- package/lib/inputs/find-loader-type.args.mjs +0 -32
- package/lib/inputs/find-loader.args.mjs +0 -72
- package/lib/inputs/find-location.args.mjs +0 -26
- package/lib/inputs/find-material.args.mjs +0 -21
- package/lib/inputs/find-receive-inventory-order.args.mjs +0 -71
- package/lib/inputs/find-sale-order.args.mjs +0 -16
- package/lib/inputs/find-ship-inventory-order.args.mjs +0 -71
- package/lib/inputs/find-stock.args.mjs +0 -102
- package/lib/inputs/find-transfer-order.args.mjs +0 -82
- package/lib/inputs/inventory-count-order.args.mjs +0 -257
- package/lib/inputs/merge-batch.args.mjs +0 -40
- package/lib/inputs/order-reference.args.mjs +0 -103
- package/lib/inputs/pagination.args.mjs +0 -20
- package/lib/inputs/receive-order.args.mjs +0 -40
- package/lib/inputs/reclassify-inventory-order.args.mjs +0 -40
- package/lib/inputs/release-order.args.mjs +0 -25
- package/lib/inputs/return-transfer-customer-order.args.mjs +0 -35
- package/lib/inputs/return-transfer-vendor-order.args.mjs +0 -35
- package/lib/inputs/scrape-order.args.mjs +0 -35
- package/lib/inputs/ship-order.args.mjs +0 -20
- package/lib/inputs/split-batch.args.mjs +0 -51
- package/lib/inputs/transfer-order.args.mjs +0 -20
- package/lib/inputs/update-warehouse-map.args.mjs +0 -121
- package/lib/mutations/allocate-inventory-order.mutation.mjs +0 -91
- package/lib/mutations/consumption-order.mutation.mjs +0 -90
- package/lib/mutations/hold-inventory-order.mutation.mjs +0 -91
- package/lib/mutations/inventory-count-order.mutation.mjs +0 -138
- package/lib/mutations/loader.mutation.mjs +0 -123
- package/lib/mutations/location.mutation.mjs +0 -47
- package/lib/mutations/material.mutation.mjs +0 -74
- package/lib/mutations/merge-batch.mutation.mjs +0 -50
- package/lib/mutations/order-reference.mutation.mjs +0 -57
- package/lib/mutations/quality-inspection-order.mutation.mjs +0 -50
- package/lib/mutations/receive-inventory-order.mutation.mjs +0 -106
- package/lib/mutations/reclassify-inventory-order.mutation.mjs +0 -51
- package/lib/mutations/scrape-order.mutation.mjs +0 -44
- package/lib/mutations/ship-inventory-order.mutation.mjs +0 -123
- package/lib/mutations/split-batch.mutation.mjs +0 -44
- package/lib/mutations/transfer-customer-order.mutation.mjs +0 -91
- package/lib/mutations/transfer-order.mutation.mjs +0 -96
- package/lib/mutations/transfer-vendor-order.mutation.mjs +0 -91
- package/lib/mutations/warehouse-map.mutation.mjs +0 -60
- package/lib/queries/allocate-inventory-order.query.mjs +0 -33
- package/lib/queries/batch.query.mjs +0 -36
- package/lib/queries/consumption-order.query.mjs +0 -45
- package/lib/queries/hold-inventory-order.query.mjs +0 -33
- package/lib/queries/inventory-count-order.query.mjs +0 -63
- package/lib/queries/loader.query.mjs +0 -167
- package/lib/queries/location.query.mjs +0 -51
- package/lib/queries/material.query.mjs +0 -79
- package/lib/queries/order-reference.query.mjs +0 -34
- package/lib/queries/recieve-inventory-order.query.mjs +0 -77
- package/lib/queries/sale-order.query.mjs +0 -57
- package/lib/queries/ship-inventory-order.query.mjs +0 -77
- package/lib/queries/stock.query.mjs +0 -116
- package/lib/queries/transfer-order.query.mjs +0 -46
- package/lib/queries/unit.query.mjs +0 -30
- package/lib/queries/warehouse-map.query.mjs +0 -32
- package/lib/registry/operation-registry.mjs +0 -136
- package/lib/resolvers/aggregated-stock.resolver.mjs +0 -119
- package/lib/resolvers/allocate-inventory-order.resolver.mjs +0 -27
- package/lib/resolvers/change-log.resolver.mjs +0 -99
- package/lib/resolvers/consumption-order.resolver.mjs +0 -238
- package/lib/resolvers/hold-inventory-order.resolver.mjs +0 -27
- package/lib/resolvers/inventory-count-order.resolver.mjs +0 -148
- package/lib/resolvers/loader-type.resolver.mjs +0 -54
- package/lib/resolvers/loader.resolver.mjs +0 -99
- package/lib/resolvers/location.resolver.mjs +0 -80
- package/lib/resolvers/material.resolver.mjs +0 -87
- package/lib/resolvers/merge-batch.resolver.mjs +0 -26
- package/lib/resolvers/receive-inventory-order.resolver.mjs +0 -156
- package/lib/resolvers/ship-inventory-order.resolver.mjs +0 -301
- package/lib/resolvers/split-batch.resolver.mjs +0 -26
- package/lib/resolvers/stock.resolver.mjs +0 -99
- package/lib/resolvers/transfer-customer-order.resolver.mjs +0 -27
- package/lib/resolvers/transfer-order.resolver.mjs +0 -246
- package/lib/resolvers/transfer-vendor-order.resolver.mjs +0 -27
- package/lib/resolvers/warehouse-map.resolver.mjs +0 -41
- package/lib/scalars/json-object.scalar.mjs +0 -62
|
@@ -1,238 +0,0 @@
|
|
|
1
|
-
import { __decorate, __param, __metadata } from 'tslib';
|
|
2
|
-
import { ResolveField, Parent, Context, Resolver, Float } from '@nestjs/graphql';
|
|
3
|
-
import { ConsumptionOrderItemEntityClass, WmsEntities, ConsumptionOrderChangeEntityClass, BatchGroupEntityClass, LoadersEntityClass, ConsumptionChangeKind } from '@rytass/wms-module-core';
|
|
4
|
-
import { ConsumptionOrderDto } from '../dto/consumption-order.dto.mjs';
|
|
5
|
-
import { ConsumptionOrderItemDto } from '../dto/consumption-order-item.dto.mjs';
|
|
6
|
-
import '../dto/loader-type.dto.mjs';
|
|
7
|
-
import { LoaderDto } from '../dto/loader.dto.mjs';
|
|
8
|
-
import { MaterialDto } from '../dto/material.dto.mjs';
|
|
9
|
-
import '../dto/material-unit.dto.mjs';
|
|
10
|
-
import '../dto/stock.dto.mjs';
|
|
11
|
-
import '../dto/sale-order.dto.mjs';
|
|
12
|
-
import '../dto/receive-inventory-order.dto.mjs';
|
|
13
|
-
import '../dto/receive-inventory-order-item.dto.mjs';
|
|
14
|
-
import '../dto/ship-inventory-order.dto.mjs';
|
|
15
|
-
import '../dto/ship-inventory-order-item.dto.mjs';
|
|
16
|
-
import '../dto/hold-inventory-order.dto.mjs';
|
|
17
|
-
import '../dto/hold-inventory-order-item.dto.mjs';
|
|
18
|
-
import '../dto/allocate-inventory-order.dto.mjs';
|
|
19
|
-
import '../dto/allocate-inventory-order-item.dto.mjs';
|
|
20
|
-
import '../dto/transfer-order.dto.mjs';
|
|
21
|
-
import '../dto/transfer-order-item.dto.mjs';
|
|
22
|
-
import '../dto/transfer-customer-order.dto.mjs';
|
|
23
|
-
import '../dto/transfer-customer-order-item.dto.mjs';
|
|
24
|
-
import '../dto/transfer-vendor-order.dto.mjs';
|
|
25
|
-
import '../dto/transfer-vendor-order-item.dto.mjs';
|
|
26
|
-
import '../dto/scrape-order.dto.mjs';
|
|
27
|
-
import '../dto/scrape-order-item.dto.mjs';
|
|
28
|
-
import '../dto/quality-inspection-order.dto.mjs';
|
|
29
|
-
import '../dto/quality-inspection-order-item.dto.mjs';
|
|
30
|
-
import '../dto/inventory-count-order.dto.mjs';
|
|
31
|
-
import '../dto/order-reference.dto.mjs';
|
|
32
|
-
import { BatchDto } from '../dto/batch.dto.mjs';
|
|
33
|
-
import { LocationDto } from '../dto/location.dto.mjs';
|
|
34
|
-
|
|
35
|
-
let ConsumptionOrderResolver = class ConsumptionOrderResolver {
|
|
36
|
-
items({ id }, { loaders }) {
|
|
37
|
-
return loaders.batchMany.load({
|
|
38
|
-
__entity: ConsumptionOrderItemEntityClass,
|
|
39
|
-
__from: { orderId: id },
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
__decorate([
|
|
44
|
-
ResolveField(() => [ConsumptionOrderItemDto]),
|
|
45
|
-
__param(0, Parent()),
|
|
46
|
-
__param(1, Context()),
|
|
47
|
-
__metadata("design:type", Function),
|
|
48
|
-
__metadata("design:paramtypes", [ConsumptionOrderDto, Object]),
|
|
49
|
-
__metadata("design:returntype", Promise)
|
|
50
|
-
], ConsumptionOrderResolver.prototype, "items", null);
|
|
51
|
-
ConsumptionOrderResolver = __decorate([
|
|
52
|
-
Resolver(() => ConsumptionOrderDto)
|
|
53
|
-
], ConsumptionOrderResolver);
|
|
54
|
-
let ConsumptionOrderItemResolver = class ConsumptionOrderItemResolver {
|
|
55
|
-
entities;
|
|
56
|
-
/**
|
|
57
|
-
* The configured entities, not the built-in classes: `__entity` decides which
|
|
58
|
-
* repository the DataLoader opens, so it has to follow whatever the consumer
|
|
59
|
-
* passed to `WMSBaseModuleOptions`. Loading a built-in class outright filters
|
|
60
|
-
* on its single-table-inheritance discriminator and resolves nothing for an
|
|
61
|
-
* override.
|
|
62
|
-
*/
|
|
63
|
-
constructor(entities) {
|
|
64
|
-
this.entities = entities;
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* How much this line has moved, by kind.
|
|
68
|
-
*
|
|
69
|
-
* Read back from the changes rather than denormalised onto the item: the
|
|
70
|
-
* changes are what the stock ledger and the `stock.*` events agree with, and a
|
|
71
|
-
* counter maintained alongside them is a second answer waiting to disagree.
|
|
72
|
-
*/
|
|
73
|
-
async movedQuantity(itemId, kind, loaders) {
|
|
74
|
-
const changes = await loaders.batchMany.load({
|
|
75
|
-
__entity: ConsumptionOrderChangeEntityClass,
|
|
76
|
-
__from: { itemId },
|
|
77
|
-
});
|
|
78
|
-
return changes
|
|
79
|
-
.filter((change) => change.kind === kind)
|
|
80
|
-
.reduce((total, { quantityChanged }) => total + Math.abs(Number(quantityChanged)), 0);
|
|
81
|
-
}
|
|
82
|
-
material({ materialId }, { loaders }) {
|
|
83
|
-
return loaders.batchSingle.load({
|
|
84
|
-
__entity: this.entities.material,
|
|
85
|
-
__from: { id: materialId },
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
async batch({ batchId }, { loaders }) {
|
|
89
|
-
if (!batchId)
|
|
90
|
-
return null;
|
|
91
|
-
const { groupId } = await loaders.batchSingle.load({
|
|
92
|
-
__entity: this.entities.batch,
|
|
93
|
-
__from: { id: batchId },
|
|
94
|
-
});
|
|
95
|
-
return loaders.batchSingle.load({
|
|
96
|
-
__entity: BatchGroupEntityClass,
|
|
97
|
-
__from: { id: groupId },
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
async location({ locationId }, { loaders }) {
|
|
101
|
-
if (!locationId)
|
|
102
|
-
return null;
|
|
103
|
-
return loaders.batchSingle.load({
|
|
104
|
-
__entity: this.entities.location,
|
|
105
|
-
__from: { id: locationId },
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
async targetLocation({ targetLocationId }, { loaders }) {
|
|
109
|
-
if (!targetLocationId)
|
|
110
|
-
return null;
|
|
111
|
-
return loaders.batchSingle.load({
|
|
112
|
-
__entity: this.entities.location,
|
|
113
|
-
__from: { id: targetLocationId },
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
async loader({ loaderId }, { loaders }) {
|
|
117
|
-
if (!loaderId)
|
|
118
|
-
return null;
|
|
119
|
-
return loaders.batchSingle.load({
|
|
120
|
-
__entity: LoadersEntityClass,
|
|
121
|
-
__from: { id: loaderId },
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
async targetLoader({ targetLoaderId }, { loaders }) {
|
|
125
|
-
if (!targetLoaderId)
|
|
126
|
-
return null;
|
|
127
|
-
return loaders.batchSingle.load({
|
|
128
|
-
__entity: LoadersEntityClass,
|
|
129
|
-
__from: { id: targetLoaderId },
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
|
-
issuedQuantity({ id }, { loaders }) {
|
|
133
|
-
return this.movedQuantity(id, ConsumptionChangeKind.ISSUE, loaders);
|
|
134
|
-
}
|
|
135
|
-
returnedQuantity({ id }, { loaders }) {
|
|
136
|
-
return this.movedQuantity(id, ConsumptionChangeKind.RETURN, loaders);
|
|
137
|
-
}
|
|
138
|
-
settledQuantity({ id }, { loaders }) {
|
|
139
|
-
return this.movedQuantity(id, ConsumptionChangeKind.SETTLE, loaders);
|
|
140
|
-
}
|
|
141
|
-
/** Issued minus returned minus settled: what the process still holds. */
|
|
142
|
-
async outstandingQuantity({ id }, { loaders }) {
|
|
143
|
-
const changes = await loaders.batchMany.load({
|
|
144
|
-
__entity: ConsumptionOrderChangeEntityClass,
|
|
145
|
-
__from: { itemId: id },
|
|
146
|
-
});
|
|
147
|
-
// The sign already carries the direction here — an issue is positive, a
|
|
148
|
-
// return and a settlement negative — so the outstanding amount is just the
|
|
149
|
-
// sum, no filtering by kind needed.
|
|
150
|
-
return changes.reduce((total, { quantityChanged }) => total + Number(quantityChanged), 0);
|
|
151
|
-
}
|
|
152
|
-
};
|
|
153
|
-
__decorate([
|
|
154
|
-
ResolveField(() => MaterialDto),
|
|
155
|
-
__param(0, Parent()),
|
|
156
|
-
__param(1, Context()),
|
|
157
|
-
__metadata("design:type", Function),
|
|
158
|
-
__metadata("design:paramtypes", [ConsumptionOrderItemEntityClass, Object]),
|
|
159
|
-
__metadata("design:returntype", Promise)
|
|
160
|
-
], ConsumptionOrderItemResolver.prototype, "material", null);
|
|
161
|
-
__decorate([
|
|
162
|
-
ResolveField(() => BatchDto, { nullable: true }),
|
|
163
|
-
__param(0, Parent()),
|
|
164
|
-
__param(1, Context()),
|
|
165
|
-
__metadata("design:type", Function),
|
|
166
|
-
__metadata("design:paramtypes", [ConsumptionOrderItemEntityClass, Object]),
|
|
167
|
-
__metadata("design:returntype", Promise)
|
|
168
|
-
], ConsumptionOrderItemResolver.prototype, "batch", null);
|
|
169
|
-
__decorate([
|
|
170
|
-
ResolveField(() => LocationDto, { nullable: true }),
|
|
171
|
-
__param(0, Parent()),
|
|
172
|
-
__param(1, Context()),
|
|
173
|
-
__metadata("design:type", Function),
|
|
174
|
-
__metadata("design:paramtypes", [ConsumptionOrderItemEntityClass, Object]),
|
|
175
|
-
__metadata("design:returntype", Promise)
|
|
176
|
-
], ConsumptionOrderItemResolver.prototype, "location", null);
|
|
177
|
-
__decorate([
|
|
178
|
-
ResolveField(() => LocationDto, { nullable: true }),
|
|
179
|
-
__param(0, Parent()),
|
|
180
|
-
__param(1, Context()),
|
|
181
|
-
__metadata("design:type", Function),
|
|
182
|
-
__metadata("design:paramtypes", [ConsumptionOrderItemEntityClass, Object]),
|
|
183
|
-
__metadata("design:returntype", Promise)
|
|
184
|
-
], ConsumptionOrderItemResolver.prototype, "targetLocation", null);
|
|
185
|
-
__decorate([
|
|
186
|
-
ResolveField(() => LoaderDto, { nullable: true }),
|
|
187
|
-
__param(0, Parent()),
|
|
188
|
-
__param(1, Context()),
|
|
189
|
-
__metadata("design:type", Function),
|
|
190
|
-
__metadata("design:paramtypes", [ConsumptionOrderItemEntityClass, Object]),
|
|
191
|
-
__metadata("design:returntype", Promise)
|
|
192
|
-
], ConsumptionOrderItemResolver.prototype, "loader", null);
|
|
193
|
-
__decorate([
|
|
194
|
-
ResolveField(() => LoaderDto, { nullable: true }),
|
|
195
|
-
__param(0, Parent()),
|
|
196
|
-
__param(1, Context()),
|
|
197
|
-
__metadata("design:type", Function),
|
|
198
|
-
__metadata("design:paramtypes", [ConsumptionOrderItemEntityClass, Object]),
|
|
199
|
-
__metadata("design:returntype", Promise)
|
|
200
|
-
], ConsumptionOrderItemResolver.prototype, "targetLoader", null);
|
|
201
|
-
__decorate([
|
|
202
|
-
ResolveField(() => Float),
|
|
203
|
-
__param(0, Parent()),
|
|
204
|
-
__param(1, Context()),
|
|
205
|
-
__metadata("design:type", Function),
|
|
206
|
-
__metadata("design:paramtypes", [ConsumptionOrderItemEntityClass, Object]),
|
|
207
|
-
__metadata("design:returntype", Promise)
|
|
208
|
-
], ConsumptionOrderItemResolver.prototype, "issuedQuantity", null);
|
|
209
|
-
__decorate([
|
|
210
|
-
ResolveField(() => Float),
|
|
211
|
-
__param(0, Parent()),
|
|
212
|
-
__param(1, Context()),
|
|
213
|
-
__metadata("design:type", Function),
|
|
214
|
-
__metadata("design:paramtypes", [ConsumptionOrderItemEntityClass, Object]),
|
|
215
|
-
__metadata("design:returntype", Promise)
|
|
216
|
-
], ConsumptionOrderItemResolver.prototype, "returnedQuantity", null);
|
|
217
|
-
__decorate([
|
|
218
|
-
ResolveField(() => Float),
|
|
219
|
-
__param(0, Parent()),
|
|
220
|
-
__param(1, Context()),
|
|
221
|
-
__metadata("design:type", Function),
|
|
222
|
-
__metadata("design:paramtypes", [ConsumptionOrderItemEntityClass, Object]),
|
|
223
|
-
__metadata("design:returntype", Promise)
|
|
224
|
-
], ConsumptionOrderItemResolver.prototype, "settledQuantity", null);
|
|
225
|
-
__decorate([
|
|
226
|
-
ResolveField(() => Float),
|
|
227
|
-
__param(0, Parent()),
|
|
228
|
-
__param(1, Context()),
|
|
229
|
-
__metadata("design:type", Function),
|
|
230
|
-
__metadata("design:paramtypes", [ConsumptionOrderItemEntityClass, Object]),
|
|
231
|
-
__metadata("design:returntype", Promise)
|
|
232
|
-
], ConsumptionOrderItemResolver.prototype, "outstandingQuantity", null);
|
|
233
|
-
ConsumptionOrderItemResolver = __decorate([
|
|
234
|
-
Resolver(() => ConsumptionOrderItemDto),
|
|
235
|
-
__metadata("design:paramtypes", [WmsEntities])
|
|
236
|
-
], ConsumptionOrderItemResolver);
|
|
237
|
-
|
|
238
|
-
export { ConsumptionOrderItemResolver, ConsumptionOrderResolver };
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { __decorate, __param, __metadata } from 'tslib';
|
|
2
|
-
import { ResolveField, Parent, Context, Resolver } from '@nestjs/graphql';
|
|
3
|
-
import { HoldInventoryOrderDto } from '../dto/hold-inventory-order.dto.mjs';
|
|
4
|
-
import { HoldInventoryOrderItemDto } from '../dto/hold-inventory-order-item.dto.mjs';
|
|
5
|
-
import { HoldInventoryOrderItemEntityClass } from '@rytass/wms-module-core';
|
|
6
|
-
|
|
7
|
-
let HoldInventoryOrderResolver = class HoldInventoryOrderResolver {
|
|
8
|
-
items({ id }, { loaders }) {
|
|
9
|
-
return loaders.batchMany.load({
|
|
10
|
-
__entity: HoldInventoryOrderItemEntityClass,
|
|
11
|
-
__from: { orderId: id },
|
|
12
|
-
});
|
|
13
|
-
}
|
|
14
|
-
};
|
|
15
|
-
__decorate([
|
|
16
|
-
ResolveField(() => [HoldInventoryOrderItemDto]),
|
|
17
|
-
__param(0, Parent()),
|
|
18
|
-
__param(1, Context()),
|
|
19
|
-
__metadata("design:type", Function),
|
|
20
|
-
__metadata("design:paramtypes", [HoldInventoryOrderDto, Object]),
|
|
21
|
-
__metadata("design:returntype", Promise)
|
|
22
|
-
], HoldInventoryOrderResolver.prototype, "items", null);
|
|
23
|
-
HoldInventoryOrderResolver = __decorate([
|
|
24
|
-
Resolver(() => HoldInventoryOrderDto)
|
|
25
|
-
], HoldInventoryOrderResolver);
|
|
26
|
-
|
|
27
|
-
export { HoldInventoryOrderResolver };
|
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
import { __decorate, __param, __metadata } from 'tslib';
|
|
2
|
-
import { ResolveField, Parent, Context, Resolver } from '@nestjs/graphql';
|
|
3
|
-
import { WmsEntities, InventoryCountOrderItemEntityClass, InventoryCountOrderLocationEntityClass, BatchGroupEntityClass, LoadersEntityClass } from '@rytass/wms-module-core';
|
|
4
|
-
import { InventoryCountOrderItemDto, InventoryCountOrderDto } from '../dto/inventory-count-order.dto.mjs';
|
|
5
|
-
import { BatchDto } from '../dto/batch.dto.mjs';
|
|
6
|
-
import { LoaderDto } from '../dto/loader.dto.mjs';
|
|
7
|
-
import { LocationDto } from '../dto/location.dto.mjs';
|
|
8
|
-
import { MaterialDto } from '../dto/material.dto.mjs';
|
|
9
|
-
|
|
10
|
-
let InventoryCountOrderResolver = class InventoryCountOrderResolver {
|
|
11
|
-
entities;
|
|
12
|
-
constructor(entities) {
|
|
13
|
-
this.entities = entities;
|
|
14
|
-
}
|
|
15
|
-
items({ id }, { loaders }) {
|
|
16
|
-
return loaders.batchMany.load({
|
|
17
|
-
__entity: InventoryCountOrderItemEntityClass,
|
|
18
|
-
__from: { orderId: id },
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* The locations the user picked.
|
|
23
|
-
*
|
|
24
|
-
* Only the roots: the scope table also holds every descendant the backend
|
|
25
|
-
* expanded into, and listing a whole aisle's shelves as chips would bury the
|
|
26
|
-
* one thing the operator actually chose. The expansion still exists in the
|
|
27
|
-
* database — it is what the lock reads — it just is not this field.
|
|
28
|
-
*/
|
|
29
|
-
async locations({ id }, { loaders }) {
|
|
30
|
-
const scope = (await loaders.batchMany.load({
|
|
31
|
-
__entity: InventoryCountOrderLocationEntityClass,
|
|
32
|
-
__from: { orderId: id },
|
|
33
|
-
}));
|
|
34
|
-
// The join rows carry `locationId`, not a loaded `location` relation, so
|
|
35
|
-
// each one has to go back through the location DataLoader. Returning
|
|
36
|
-
// `row.location` directly yields `undefined`, and the non-nullable list then
|
|
37
|
-
// fails the whole query with "Cannot return null for non-nullable field".
|
|
38
|
-
return Promise.all(scope
|
|
39
|
-
.filter(({ isRoot }) => isRoot)
|
|
40
|
-
.map(({ locationId }) => loaders.batchSingle.load({
|
|
41
|
-
__entity: this.entities.location,
|
|
42
|
-
__from: { id: locationId },
|
|
43
|
-
})));
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
__decorate([
|
|
47
|
-
ResolveField(() => [InventoryCountOrderItemDto]),
|
|
48
|
-
__param(0, Parent()),
|
|
49
|
-
__param(1, Context()),
|
|
50
|
-
__metadata("design:type", Function),
|
|
51
|
-
__metadata("design:paramtypes", [InventoryCountOrderDto, Object]),
|
|
52
|
-
__metadata("design:returntype", Promise)
|
|
53
|
-
], InventoryCountOrderResolver.prototype, "items", null);
|
|
54
|
-
__decorate([
|
|
55
|
-
ResolveField(() => [LocationDto]),
|
|
56
|
-
__param(0, Parent()),
|
|
57
|
-
__param(1, Context()),
|
|
58
|
-
__metadata("design:type", Function),
|
|
59
|
-
__metadata("design:paramtypes", [InventoryCountOrderDto, Object]),
|
|
60
|
-
__metadata("design:returntype", Promise)
|
|
61
|
-
], InventoryCountOrderResolver.prototype, "locations", null);
|
|
62
|
-
InventoryCountOrderResolver = __decorate([
|
|
63
|
-
Resolver(() => InventoryCountOrderDto),
|
|
64
|
-
__metadata("design:paramtypes", [WmsEntities])
|
|
65
|
-
], InventoryCountOrderResolver);
|
|
66
|
-
let InventoryCountOrderItemResolver = class InventoryCountOrderItemResolver {
|
|
67
|
-
entities;
|
|
68
|
-
/**
|
|
69
|
-
* The configured entities, not the built-in classes: `__entity` decides which
|
|
70
|
-
* repository the DataLoader opens, so it has to follow whatever the consumer
|
|
71
|
-
* passed to `WMSBaseModuleOptions`.
|
|
72
|
-
*/
|
|
73
|
-
constructor(entities) {
|
|
74
|
-
this.entities = entities;
|
|
75
|
-
}
|
|
76
|
-
material({ materialId }, { loaders }) {
|
|
77
|
-
return loaders.batchSingle.load({
|
|
78
|
-
__entity: this.entities.material,
|
|
79
|
-
__from: { id: materialId },
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
async batch({ batchId }, { loaders }) {
|
|
83
|
-
const { groupId } = await loaders.batchSingle.load({
|
|
84
|
-
__entity: this.entities.batch,
|
|
85
|
-
__from: { id: batchId },
|
|
86
|
-
});
|
|
87
|
-
return loaders.batchSingle.load({
|
|
88
|
-
__entity: BatchGroupEntityClass,
|
|
89
|
-
__from: { id: groupId },
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
location({ locationId }, { loaders }) {
|
|
93
|
-
if (!locationId) {
|
|
94
|
-
return null;
|
|
95
|
-
}
|
|
96
|
-
return loaders.batchSingle.load({
|
|
97
|
-
__entity: this.entities.location,
|
|
98
|
-
__from: { id: locationId },
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
loader({ loaderId }, { loaders }) {
|
|
102
|
-
if (!loaderId) {
|
|
103
|
-
return null;
|
|
104
|
-
}
|
|
105
|
-
return loaders.batchSingle.load({
|
|
106
|
-
__entity: LoadersEntityClass,
|
|
107
|
-
__from: { id: loaderId },
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
};
|
|
111
|
-
__decorate([
|
|
112
|
-
ResolveField(() => MaterialDto),
|
|
113
|
-
__param(0, Parent()),
|
|
114
|
-
__param(1, Context()),
|
|
115
|
-
__metadata("design:type", Function),
|
|
116
|
-
__metadata("design:paramtypes", [InventoryCountOrderItemDto, Object]),
|
|
117
|
-
__metadata("design:returntype", Promise)
|
|
118
|
-
], InventoryCountOrderItemResolver.prototype, "material", null);
|
|
119
|
-
__decorate([
|
|
120
|
-
ResolveField(() => BatchDto),
|
|
121
|
-
__param(0, Parent()),
|
|
122
|
-
__param(1, Context()),
|
|
123
|
-
__metadata("design:type", Function),
|
|
124
|
-
__metadata("design:paramtypes", [InventoryCountOrderItemDto, Object]),
|
|
125
|
-
__metadata("design:returntype", Promise)
|
|
126
|
-
], InventoryCountOrderItemResolver.prototype, "batch", null);
|
|
127
|
-
__decorate([
|
|
128
|
-
ResolveField(() => LocationDto, { nullable: true }),
|
|
129
|
-
__param(0, Parent()),
|
|
130
|
-
__param(1, Context()),
|
|
131
|
-
__metadata("design:type", Function),
|
|
132
|
-
__metadata("design:paramtypes", [InventoryCountOrderItemDto, Object]),
|
|
133
|
-
__metadata("design:returntype", Object)
|
|
134
|
-
], InventoryCountOrderItemResolver.prototype, "location", null);
|
|
135
|
-
__decorate([
|
|
136
|
-
ResolveField(() => LoaderDto, { nullable: true }),
|
|
137
|
-
__param(0, Parent()),
|
|
138
|
-
__param(1, Context()),
|
|
139
|
-
__metadata("design:type", Function),
|
|
140
|
-
__metadata("design:paramtypes", [InventoryCountOrderItemDto, Object]),
|
|
141
|
-
__metadata("design:returntype", Object)
|
|
142
|
-
], InventoryCountOrderItemResolver.prototype, "loader", null);
|
|
143
|
-
InventoryCountOrderItemResolver = __decorate([
|
|
144
|
-
Resolver(() => InventoryCountOrderItemDto),
|
|
145
|
-
__metadata("design:paramtypes", [WmsEntities])
|
|
146
|
-
], InventoryCountOrderItemResolver);
|
|
147
|
-
|
|
148
|
-
export { InventoryCountOrderItemResolver, InventoryCountOrderResolver };
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { __decorate, __param, __metadata } from 'tslib';
|
|
2
|
-
import { ResolveField, Int, Parent, Context, Resolver } from '@nestjs/graphql';
|
|
3
|
-
import { LoaderTypeDto } from '../dto/loader-type.dto.mjs';
|
|
4
|
-
import '../dto/loader.dto.mjs';
|
|
5
|
-
import '../dto/material.dto.mjs';
|
|
6
|
-
import '../dto/material-unit.dto.mjs';
|
|
7
|
-
import '../dto/stock.dto.mjs';
|
|
8
|
-
import '../dto/sale-order.dto.mjs';
|
|
9
|
-
import '../dto/receive-inventory-order.dto.mjs';
|
|
10
|
-
import '../dto/receive-inventory-order-item.dto.mjs';
|
|
11
|
-
import '../dto/ship-inventory-order.dto.mjs';
|
|
12
|
-
import '../dto/ship-inventory-order-item.dto.mjs';
|
|
13
|
-
import '../dto/hold-inventory-order.dto.mjs';
|
|
14
|
-
import '../dto/hold-inventory-order-item.dto.mjs';
|
|
15
|
-
import '../dto/allocate-inventory-order.dto.mjs';
|
|
16
|
-
import '../dto/allocate-inventory-order-item.dto.mjs';
|
|
17
|
-
import '../dto/transfer-order.dto.mjs';
|
|
18
|
-
import '../dto/transfer-order-item.dto.mjs';
|
|
19
|
-
import '../dto/transfer-customer-order.dto.mjs';
|
|
20
|
-
import '../dto/transfer-customer-order-item.dto.mjs';
|
|
21
|
-
import '../dto/transfer-vendor-order.dto.mjs';
|
|
22
|
-
import '../dto/transfer-vendor-order-item.dto.mjs';
|
|
23
|
-
import '../dto/scrape-order.dto.mjs';
|
|
24
|
-
import '../dto/scrape-order-item.dto.mjs';
|
|
25
|
-
import '../dto/quality-inspection-order.dto.mjs';
|
|
26
|
-
import '../dto/quality-inspection-order-item.dto.mjs';
|
|
27
|
-
import '../dto/inventory-count-order.dto.mjs';
|
|
28
|
-
import '../dto/consumption-order.dto.mjs';
|
|
29
|
-
import '../dto/consumption-order-item.dto.mjs';
|
|
30
|
-
import '../dto/order-reference.dto.mjs';
|
|
31
|
-
import { LoaderTypeEntityClass, LoadersEntityClass } from '@rytass/wms-module-core';
|
|
32
|
-
|
|
33
|
-
let LoaderTypeResolver = class LoaderTypeResolver {
|
|
34
|
-
async referencedQuantity({ id }, { loaders }) {
|
|
35
|
-
const referenced = await loaders.batchMany.load({
|
|
36
|
-
__entity: LoadersEntityClass,
|
|
37
|
-
__from: { typeId: id },
|
|
38
|
-
});
|
|
39
|
-
return referenced.length;
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
__decorate([
|
|
43
|
-
ResolveField(() => Int),
|
|
44
|
-
__param(0, Parent()),
|
|
45
|
-
__param(1, Context()),
|
|
46
|
-
__metadata("design:type", Function),
|
|
47
|
-
__metadata("design:paramtypes", [LoaderTypeEntityClass, Object]),
|
|
48
|
-
__metadata("design:returntype", Promise)
|
|
49
|
-
], LoaderTypeResolver.prototype, "referencedQuantity", null);
|
|
50
|
-
LoaderTypeResolver = __decorate([
|
|
51
|
-
Resolver(() => LoaderTypeDto)
|
|
52
|
-
], LoaderTypeResolver);
|
|
53
|
-
|
|
54
|
-
export { LoaderTypeResolver };
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import { __decorate, __param, __metadata } from 'tslib';
|
|
2
|
-
import { ResolveField, Parent, Context, Int, Resolver } from '@nestjs/graphql';
|
|
3
|
-
import { LoaderTypeDto } from '../dto/loader-type.dto.mjs';
|
|
4
|
-
import { LoaderDto } from '../dto/loader.dto.mjs';
|
|
5
|
-
import '../dto/material.dto.mjs';
|
|
6
|
-
import '../dto/material-unit.dto.mjs';
|
|
7
|
-
import '../dto/stock.dto.mjs';
|
|
8
|
-
import '../dto/sale-order.dto.mjs';
|
|
9
|
-
import '../dto/receive-inventory-order.dto.mjs';
|
|
10
|
-
import '../dto/receive-inventory-order-item.dto.mjs';
|
|
11
|
-
import '../dto/ship-inventory-order.dto.mjs';
|
|
12
|
-
import '../dto/ship-inventory-order-item.dto.mjs';
|
|
13
|
-
import '../dto/hold-inventory-order.dto.mjs';
|
|
14
|
-
import '../dto/hold-inventory-order-item.dto.mjs';
|
|
15
|
-
import '../dto/allocate-inventory-order.dto.mjs';
|
|
16
|
-
import '../dto/allocate-inventory-order-item.dto.mjs';
|
|
17
|
-
import '../dto/transfer-order.dto.mjs';
|
|
18
|
-
import '../dto/transfer-order-item.dto.mjs';
|
|
19
|
-
import '../dto/transfer-customer-order.dto.mjs';
|
|
20
|
-
import '../dto/transfer-customer-order-item.dto.mjs';
|
|
21
|
-
import '../dto/transfer-vendor-order.dto.mjs';
|
|
22
|
-
import '../dto/transfer-vendor-order-item.dto.mjs';
|
|
23
|
-
import '../dto/scrape-order.dto.mjs';
|
|
24
|
-
import '../dto/scrape-order-item.dto.mjs';
|
|
25
|
-
import '../dto/quality-inspection-order.dto.mjs';
|
|
26
|
-
import '../dto/quality-inspection-order-item.dto.mjs';
|
|
27
|
-
import '../dto/inventory-count-order.dto.mjs';
|
|
28
|
-
import '../dto/consumption-order.dto.mjs';
|
|
29
|
-
import '../dto/consumption-order-item.dto.mjs';
|
|
30
|
-
import '../dto/order-reference.dto.mjs';
|
|
31
|
-
import { LoadersEntityClass, WmsEntities, StockService, LoaderTypeEntityClass } from '@rytass/wms-module-core';
|
|
32
|
-
import { LocationDto } from '../dto/location.dto.mjs';
|
|
33
|
-
import _ from 'lodash';
|
|
34
|
-
|
|
35
|
-
let LoaderResolver = class LoaderResolver {
|
|
36
|
-
entities;
|
|
37
|
-
stockService;
|
|
38
|
-
/**
|
|
39
|
-
* The configured entities, not the built-in classes: `__entity` decides which
|
|
40
|
-
* repository the DataLoader opens, so it has to follow whatever the consumer
|
|
41
|
-
* passed to `WMSBaseModuleOptions`. Loading a built-in class outright filters
|
|
42
|
-
* on its single-table-inheritance discriminator and resolves nothing for an
|
|
43
|
-
* override.
|
|
44
|
-
*/
|
|
45
|
-
constructor(entities, stockService) {
|
|
46
|
-
this.entities = entities;
|
|
47
|
-
this.stockService = stockService;
|
|
48
|
-
}
|
|
49
|
-
type({ typeId }, { loaders }) {
|
|
50
|
-
return loaders.batchSingle.load({
|
|
51
|
-
__entity: LoaderTypeEntityClass,
|
|
52
|
-
__from: { id: typeId },
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
location({ locationId }, { loaders }) {
|
|
56
|
-
return loaders.batchSingle.load({
|
|
57
|
-
__entity: this.entities.location,
|
|
58
|
-
__from: { id: locationId },
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
async totalQuantity({ id }) {
|
|
62
|
-
const [aggregatedStocks] = await this.stockService.findAggregatedStocks({
|
|
63
|
-
loaderId: id,
|
|
64
|
-
});
|
|
65
|
-
if (!aggregatedStocks.length)
|
|
66
|
-
return 0;
|
|
67
|
-
return aggregatedStocks.reduce((total, { quantity }) => total + _.toInteger(quantity), 0);
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
|
-
__decorate([
|
|
71
|
-
ResolveField(() => LoaderTypeDto),
|
|
72
|
-
__param(0, Parent()),
|
|
73
|
-
__param(1, Context()),
|
|
74
|
-
__metadata("design:type", Function),
|
|
75
|
-
__metadata("design:paramtypes", [LoadersEntityClass, Object]),
|
|
76
|
-
__metadata("design:returntype", void 0)
|
|
77
|
-
], LoaderResolver.prototype, "type", null);
|
|
78
|
-
__decorate([
|
|
79
|
-
ResolveField(() => LocationDto),
|
|
80
|
-
__param(0, Parent()),
|
|
81
|
-
__param(1, Context()),
|
|
82
|
-
__metadata("design:type", Function),
|
|
83
|
-
__metadata("design:paramtypes", [LoadersEntityClass, Object]),
|
|
84
|
-
__metadata("design:returntype", void 0)
|
|
85
|
-
], LoaderResolver.prototype, "location", null);
|
|
86
|
-
__decorate([
|
|
87
|
-
ResolveField(() => Int),
|
|
88
|
-
__param(0, Parent()),
|
|
89
|
-
__metadata("design:type", Function),
|
|
90
|
-
__metadata("design:paramtypes", [LoadersEntityClass]),
|
|
91
|
-
__metadata("design:returntype", Promise)
|
|
92
|
-
], LoaderResolver.prototype, "totalQuantity", null);
|
|
93
|
-
LoaderResolver = __decorate([
|
|
94
|
-
Resolver(() => LoaderDto),
|
|
95
|
-
__metadata("design:paramtypes", [WmsEntities,
|
|
96
|
-
StockService])
|
|
97
|
-
], LoaderResolver);
|
|
98
|
-
|
|
99
|
-
export { LoaderResolver };
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import { __decorate, __param, __metadata } from 'tslib';
|
|
2
|
-
import { ResolveField, Parent, Context, Resolver } from '@nestjs/graphql';
|
|
3
|
-
import { LocationDto } from '../dto/location.dto.mjs';
|
|
4
|
-
import { MapDataDto } from '../dto/warehouse-map.dto.mjs';
|
|
5
|
-
import { LocationEntityClass, WmsEntities } from '@rytass/wms-module-core';
|
|
6
|
-
|
|
7
|
-
let LocationResolver = class LocationResolver {
|
|
8
|
-
entities;
|
|
9
|
-
/**
|
|
10
|
-
* The configured entities, not the built-in classes: `__entity` decides which
|
|
11
|
-
* repository the DataLoader opens, so it has to follow whatever the consumer
|
|
12
|
-
* passed to `WMSBaseModuleOptions`. Loading a built-in class outright filters
|
|
13
|
-
* on its single-table-inheritance discriminator and resolves nothing for an
|
|
14
|
-
* override.
|
|
15
|
-
*/
|
|
16
|
-
constructor(entities) {
|
|
17
|
-
this.entities = entities;
|
|
18
|
-
}
|
|
19
|
-
async mapData({ id }, { loaders }) {
|
|
20
|
-
const map = await loaders.batchSingle.load({
|
|
21
|
-
__entity: this.entities.warehouseMap,
|
|
22
|
-
__from: { id },
|
|
23
|
-
});
|
|
24
|
-
return map?.mapData || null;
|
|
25
|
-
}
|
|
26
|
-
parent({ parentId }, { loaders }) {
|
|
27
|
-
if (!parentId)
|
|
28
|
-
return null;
|
|
29
|
-
return loaders.batchSingle.load({
|
|
30
|
-
__entity: this.entities.location,
|
|
31
|
-
__from: { id: parentId },
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* `children` must never be read off the parent entity: only
|
|
36
|
-
* `LocationQuery.location` and `LocationService.findMany` eager-load the tree
|
|
37
|
-
* relation. Every other producer of a `LocationDto` (stock/loader/change-log/
|
|
38
|
-
* transfer/ship/receive/warehouse-map resolvers, the `parent` field above and
|
|
39
|
-
* the create/update mutations) hands back an entity whose `children` is
|
|
40
|
-
* `undefined`, which breaks the non-nullable list. Always resolve through the
|
|
41
|
-
* request-scoped loader instead.
|
|
42
|
-
*/
|
|
43
|
-
children({ id }, { loaders }) {
|
|
44
|
-
return loaders.batchMany.load({
|
|
45
|
-
__entity: this.entities.location,
|
|
46
|
-
__from: { parentId: id },
|
|
47
|
-
__conditions: (qb) => qb.orderBy('entity."key"', 'ASC'),
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
__decorate([
|
|
52
|
-
ResolveField(() => MapDataDto, { nullable: true }),
|
|
53
|
-
__param(0, Parent()),
|
|
54
|
-
__param(1, Context()),
|
|
55
|
-
__metadata("design:type", Function),
|
|
56
|
-
__metadata("design:paramtypes", [LocationDto, Object]),
|
|
57
|
-
__metadata("design:returntype", Promise)
|
|
58
|
-
], LocationResolver.prototype, "mapData", null);
|
|
59
|
-
__decorate([
|
|
60
|
-
ResolveField(() => LocationDto, { nullable: true }),
|
|
61
|
-
__param(0, Parent()),
|
|
62
|
-
__param(1, Context()),
|
|
63
|
-
__metadata("design:type", Function),
|
|
64
|
-
__metadata("design:paramtypes", [LocationEntityClass, Object]),
|
|
65
|
-
__metadata("design:returntype", void 0)
|
|
66
|
-
], LocationResolver.prototype, "parent", null);
|
|
67
|
-
__decorate([
|
|
68
|
-
ResolveField(() => [LocationDto]),
|
|
69
|
-
__param(0, Parent()),
|
|
70
|
-
__param(1, Context()),
|
|
71
|
-
__metadata("design:type", Function),
|
|
72
|
-
__metadata("design:paramtypes", [LocationEntityClass, Object]),
|
|
73
|
-
__metadata("design:returntype", Promise)
|
|
74
|
-
], LocationResolver.prototype, "children", null);
|
|
75
|
-
LocationResolver = __decorate([
|
|
76
|
-
Resolver(() => LocationDto),
|
|
77
|
-
__metadata("design:paramtypes", [WmsEntities])
|
|
78
|
-
], LocationResolver);
|
|
79
|
-
|
|
80
|
-
export { LocationResolver };
|