@rytass/wms-module-graphql 0.7.0 → 0.9.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 +94 -6
- package/docs/api-reference.md +81 -6
- package/docs/events.md +23 -4
- package/index.cjs.js +919 -110
- package/index.d.ts +3 -1
- package/index.js +2 -0
- package/lib/dto/index.d.ts +1 -0
- package/lib/dto/inventory-count-order.dto.d.ts +49 -0
- package/lib/dto/inventory-count-order.dto.js +146 -0
- package/lib/events/operation-result-map.d.ts +8 -0
- package/lib/graphql.module.d.ts +6 -2
- package/lib/graphql.module.js +18 -1
- package/lib/inputs/inventory-count-order.args.d.ts +55 -0
- package/lib/inputs/inventory-count-order.args.js +196 -0
- package/lib/mutations/inventory-count-order.mutation.d.ts +19 -0
- package/lib/mutations/inventory-count-order.mutation.js +138 -0
- package/lib/mutations/loader.mutation.js +1 -0
- package/lib/mutations/material.mutation.js +1 -0
- package/lib/mutations/receive-inventory-order.mutation.js +1 -0
- package/lib/mutations/ship-inventory-order.mutation.js +1 -0
- package/lib/queries/inventory-count-order.query.d.ts +9 -0
- package/lib/queries/inventory-count-order.query.js +44 -0
- package/lib/queries/loader.query.js +1 -0
- package/lib/queries/material.query.js +1 -0
- package/lib/queries/recieve-inventory-order.query.js +1 -0
- package/lib/queries/ship-inventory-order.query.js +1 -0
- package/lib/queries/stock.query.js +1 -0
- package/lib/registry/index.d.ts +1 -0
- package/lib/registry/operation-registry.d.ts +59 -0
- package/lib/registry/operation-registry.js +136 -0
- package/lib/resolvers/aggregated-stock.resolver.d.ts +3 -11
- package/lib/resolvers/aggregated-stock.resolver.js +10 -18
- package/lib/resolvers/change-log.resolver.d.ts +8 -8
- package/lib/resolvers/change-log.resolver.js +14 -15
- package/lib/resolvers/inventory-count-order.resolver.d.ts +34 -0
- package/lib/resolvers/inventory-count-order.resolver.js +148 -0
- package/lib/resolvers/loader-type.resolver.js +1 -0
- package/lib/resolvers/loader.resolver.d.ts +10 -2
- package/lib/resolvers/loader.resolver.js +15 -4
- package/lib/resolvers/location.resolver.d.ts +10 -1
- package/lib/resolvers/location.resolver.js +17 -6
- package/lib/resolvers/material.resolver.js +1 -0
- package/lib/resolvers/receive-inventory-order.resolver.d.ts +8 -8
- package/lib/resolvers/receive-inventory-order.resolver.js +14 -15
- package/lib/resolvers/ship-inventory-order.resolver.d.ts +15 -15
- package/lib/resolvers/ship-inventory-order.resolver.js +27 -29
- package/lib/resolvers/stock.resolver.d.ts +8 -8
- package/lib/resolvers/stock.resolver.js +14 -15
- package/lib/resolvers/transfer-order.resolver.d.ts +17 -8
- package/lib/resolvers/transfer-order.resolver.js +30 -19
- package/lib/resolvers/warehouse-map.resolver.d.ts +10 -1
- package/lib/resolvers/warehouse-map.resolver.js +15 -3
- package/package.json +2 -2
package/index.cjs.js
CHANGED
|
@@ -12,7 +12,6 @@ var graphql = require('@nestjs/graphql');
|
|
|
12
12
|
var core = require('@nestjs/core');
|
|
13
13
|
var rxjs = require('rxjs');
|
|
14
14
|
var wmsBaseNestjsModule = require('@rytass/wms-base-nestjs-module');
|
|
15
|
-
var warehouseMap_entity = require('@rytass/wms-base-nestjs-module/models/warehouse-map.entity');
|
|
16
15
|
|
|
17
16
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
18
17
|
|
|
@@ -466,6 +465,138 @@ exports.WmsMutationInterceptor = tslib.__decorate([
|
|
|
466
465
|
*/
|
|
467
466
|
const WmsMutationEvent = (config) => common.applyDecorators(common.SetMetadata(WMS_MUTATION_EVENT_METADATA, config), common.UseInterceptors(exports.WmsMutationInterceptor));
|
|
468
467
|
|
|
468
|
+
function resolveDisabled(options) {
|
|
469
|
+
const { enabledOperations, disabledOperations, disabledFields } = options;
|
|
470
|
+
if (enabledOperations && disabledOperations) {
|
|
471
|
+
throw new Error('[wms-module-graphql] `enabledOperations` and `disabledOperations` are mutually exclusive — pass one or the other, not both.');
|
|
472
|
+
}
|
|
473
|
+
const enabled = enabledOperations ? new Set(enabledOperations) : null;
|
|
474
|
+
const disabled = disabledOperations
|
|
475
|
+
? new Set(disabledOperations)
|
|
476
|
+
: null;
|
|
477
|
+
const fields = new Set(disabledFields ?? []);
|
|
478
|
+
return {
|
|
479
|
+
hasSwitches: enabled !== null || disabled !== null || fields.size > 0,
|
|
480
|
+
isOperationDisabled: (name) => {
|
|
481
|
+
if (enabled) {
|
|
482
|
+
return !enabled.has(name);
|
|
483
|
+
}
|
|
484
|
+
if (disabled) {
|
|
485
|
+
return disabled.has(name);
|
|
486
|
+
}
|
|
487
|
+
return false;
|
|
488
|
+
},
|
|
489
|
+
disabledFields: fields,
|
|
490
|
+
};
|
|
491
|
+
}
|
|
492
|
+
/** Methods already pruned, so the metadata filter can drop their entries. */
|
|
493
|
+
const prunedMethods = new WeakMap();
|
|
494
|
+
let metadataFilterInstalled = false;
|
|
495
|
+
/**
|
|
496
|
+
* Stop the pruned operations from ever entering `TypeMetadataStorage`.
|
|
497
|
+
*
|
|
498
|
+
* The resolver metadata is **lazy**: `@Query()` / `@Mutation()` only register a
|
|
499
|
+
* thunk with `LazyMetadataStorage`, and the thunk calls `add*Metadata` when
|
|
500
|
+
* `GraphQLSchemaBuilder.build()` loads it. At `forRootAsync` time the storage
|
|
501
|
+
* arrays are therefore still empty, and filtering them then would remove
|
|
502
|
+
* nothing — so the filter has to sit on the writes instead.
|
|
503
|
+
*/
|
|
504
|
+
function installMetadataFilter() {
|
|
505
|
+
if (metadataFilterInstalled) {
|
|
506
|
+
return;
|
|
507
|
+
}
|
|
508
|
+
const storage = graphql.TypeMetadataStorage;
|
|
509
|
+
const addQuery = storage.addQueryMetadata.bind(storage);
|
|
510
|
+
const addMutation = storage.addMutationMetadata.bind(storage);
|
|
511
|
+
const isPruned = (metadata) => prunedMethods.get(metadata.target)?.has(metadata.methodName) === true;
|
|
512
|
+
storage.addQueryMetadata = (metadata) => {
|
|
513
|
+
if (isPruned(metadata)) {
|
|
514
|
+
return;
|
|
515
|
+
}
|
|
516
|
+
addQuery(metadata);
|
|
517
|
+
};
|
|
518
|
+
storage.addMutationMetadata = (metadata) => {
|
|
519
|
+
if (isPruned(metadata)) {
|
|
520
|
+
return;
|
|
521
|
+
}
|
|
522
|
+
addMutation(metadata);
|
|
523
|
+
};
|
|
524
|
+
metadataFilterInstalled = true;
|
|
525
|
+
}
|
|
526
|
+
/** The GraphQL field name a root handler ends up under. */
|
|
527
|
+
function schemaNameOf(handler, methodName) {
|
|
528
|
+
const explicit = Reflect.getMetadata(graphql.RESOLVER_NAME_METADATA, handler);
|
|
529
|
+
return explicit || methodName;
|
|
530
|
+
}
|
|
531
|
+
/**
|
|
532
|
+
* Remove the switched-off root operations before the schema is built.
|
|
533
|
+
*
|
|
534
|
+
* Two edits are needed, at two different moments, and they must happen together:
|
|
535
|
+
*
|
|
536
|
+
* 1. **now** — `delete Resolver.prototype[method]`, because
|
|
537
|
+
* `ResolversExplorerService.explore()` walks the prototype with
|
|
538
|
+
* `MetadataScanner` and runs *before* the schema builder loads the lazy
|
|
539
|
+
* metadata. Leaving the method in place would put `Query.foo` in the resolver
|
|
540
|
+
* map with no matching field in the typeDefs, and `makeExecutableSchema`
|
|
541
|
+
* rejects the whole schema (`requireResolversToMatchSchema`).
|
|
542
|
+
* 2. **at load time** — drop the metadata entry ({@link installMetadataFilter}),
|
|
543
|
+
* or the SDL would still declare a field that resolves to `null`: present,
|
|
544
|
+
* but dead.
|
|
545
|
+
*
|
|
546
|
+
* Deleting the prototype method does not disturb step 2's type reflection:
|
|
547
|
+
* `design:returntype` is stored against the prototype and property key, not
|
|
548
|
+
* against the function object, so it survives the delete.
|
|
549
|
+
*
|
|
550
|
+
* This runs synchronously from `forRootAsync`, i.e. while `AppModule` is still
|
|
551
|
+
* being defined. Both the classes and the storage are process-global, so a
|
|
552
|
+
* process may register `WmsModuleGraphqlModule` only once.
|
|
553
|
+
*/
|
|
554
|
+
function pruneDisabledOperations(resolverClasses, options) {
|
|
555
|
+
const { hasSwitches, isOperationDisabled, disabledFields } = resolveDisabled(options);
|
|
556
|
+
if (!hasSwitches) {
|
|
557
|
+
return { queries: [], mutations: [] };
|
|
558
|
+
}
|
|
559
|
+
installMetadataFilter();
|
|
560
|
+
const queries = [];
|
|
561
|
+
const mutations = [];
|
|
562
|
+
for (const resolverClass of resolverClasses) {
|
|
563
|
+
const prototype = resolverClass.prototype;
|
|
564
|
+
if (!prototype) {
|
|
565
|
+
continue;
|
|
566
|
+
}
|
|
567
|
+
for (const methodName of Object.getOwnPropertyNames(prototype)) {
|
|
568
|
+
if (methodName === 'constructor') {
|
|
569
|
+
continue;
|
|
570
|
+
}
|
|
571
|
+
const handler = prototype[methodName];
|
|
572
|
+
if (typeof handler !== 'function') {
|
|
573
|
+
continue;
|
|
574
|
+
}
|
|
575
|
+
const resolverType = Reflect.getMetadata(graphql.RESOLVER_TYPE_METADATA, handler);
|
|
576
|
+
// Only root operations are switchable. `@ResolveField` handlers are
|
|
577
|
+
// reached exclusively through an already-registered root field, so
|
|
578
|
+
// removing one would break the type rather than the deployment surface.
|
|
579
|
+
if (resolverType !== 'Query' && resolverType !== 'Mutation') {
|
|
580
|
+
continue;
|
|
581
|
+
}
|
|
582
|
+
const schemaName = schemaNameOf(handler, methodName);
|
|
583
|
+
const requirement = Reflect.getMetadata(WMS_OPERATION_METADATA, handler);
|
|
584
|
+
const disabled = disabledFields.has(schemaName) ||
|
|
585
|
+
(requirement !== undefined &&
|
|
586
|
+
isOperationDisabled(`${requirement.resource}:${requirement.action}`));
|
|
587
|
+
if (!disabled) {
|
|
588
|
+
continue;
|
|
589
|
+
}
|
|
590
|
+
const alreadyPruned = prunedMethods.get(resolverClass) ?? new Set();
|
|
591
|
+
alreadyPruned.add(methodName);
|
|
592
|
+
prunedMethods.set(resolverClass, alreadyPruned);
|
|
593
|
+
delete prototype[methodName];
|
|
594
|
+
(resolverType === 'Query' ? queries : mutations).push(schemaName);
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
return { queries, mutations };
|
|
598
|
+
}
|
|
599
|
+
|
|
469
600
|
const IdGenFunction = (input) => {
|
|
470
601
|
const hash = crypto.createHash('sha256');
|
|
471
602
|
hash.update(input);
|
|
@@ -1603,6 +1734,146 @@ QualityInspectionOrders = tslib.__decorate([
|
|
|
1603
1734
|
graphql.ObjectType()
|
|
1604
1735
|
], QualityInspectionOrders);
|
|
1605
1736
|
|
|
1737
|
+
graphql.registerEnumType(wmsModuleCore.InventoryCountStatus, {
|
|
1738
|
+
name: 'InventoryCountStatus',
|
|
1739
|
+
description: 'Lifecycle of an inventory count: PENDING (尚未執行) → COUNTING (盤點中) → COMPLETED (已完成), or CANCELLED (已取消).',
|
|
1740
|
+
});
|
|
1741
|
+
/**
|
|
1742
|
+
* A count-sheet line.
|
|
1743
|
+
*
|
|
1744
|
+
* `material` / `batch` / `location` / `loader` are deliberately absent from this
|
|
1745
|
+
* class: they are added to the schema by `InventoryCountOrderItemResolver` as
|
|
1746
|
+
* `@ResolveField`s so they load through DataLoaders, and declaring them here
|
|
1747
|
+
* would make the class stop matching the entity the service returns.
|
|
1748
|
+
*/
|
|
1749
|
+
let InventoryCountOrderItemDto = class InventoryCountOrderItemDto {
|
|
1750
|
+
id;
|
|
1751
|
+
orderId;
|
|
1752
|
+
materialId;
|
|
1753
|
+
batchId;
|
|
1754
|
+
locationId;
|
|
1755
|
+
loaderId;
|
|
1756
|
+
unitId;
|
|
1757
|
+
/** Ledger quantity in base units, frozen when counting started. */
|
|
1758
|
+
bookQuantity;
|
|
1759
|
+
/** What was found, expressed in `unitId`. `null` until someone counts it. */
|
|
1760
|
+
countedQuantity;
|
|
1761
|
+
/** `true` for a line added during counting for stock the books never had. */
|
|
1762
|
+
isAddition;
|
|
1763
|
+
};
|
|
1764
|
+
tslib.__decorate([
|
|
1765
|
+
graphql.Field(() => graphql.ID),
|
|
1766
|
+
tslib.__metadata("design:type", String)
|
|
1767
|
+
], InventoryCountOrderItemDto.prototype, "id", void 0);
|
|
1768
|
+
tslib.__decorate([
|
|
1769
|
+
graphql.Field(() => graphql.ID),
|
|
1770
|
+
tslib.__metadata("design:type", String)
|
|
1771
|
+
], InventoryCountOrderItemDto.prototype, "orderId", void 0);
|
|
1772
|
+
tslib.__decorate([
|
|
1773
|
+
graphql.Field(() => graphql.ID),
|
|
1774
|
+
tslib.__metadata("design:type", String)
|
|
1775
|
+
], InventoryCountOrderItemDto.prototype, "materialId", void 0);
|
|
1776
|
+
tslib.__decorate([
|
|
1777
|
+
graphql.Field(() => graphql.ID),
|
|
1778
|
+
tslib.__metadata("design:type", String)
|
|
1779
|
+
], InventoryCountOrderItemDto.prototype, "batchId", void 0);
|
|
1780
|
+
tslib.__decorate([
|
|
1781
|
+
graphql.Field(() => graphql.ID, { nullable: true }),
|
|
1782
|
+
tslib.__metadata("design:type", Object)
|
|
1783
|
+
], InventoryCountOrderItemDto.prototype, "locationId", void 0);
|
|
1784
|
+
tslib.__decorate([
|
|
1785
|
+
graphql.Field(() => graphql.ID, { nullable: true }),
|
|
1786
|
+
tslib.__metadata("design:type", Object)
|
|
1787
|
+
], InventoryCountOrderItemDto.prototype, "loaderId", void 0);
|
|
1788
|
+
tslib.__decorate([
|
|
1789
|
+
graphql.Field(() => graphql.ID, { nullable: true }),
|
|
1790
|
+
tslib.__metadata("design:type", Object)
|
|
1791
|
+
], InventoryCountOrderItemDto.prototype, "unitId", void 0);
|
|
1792
|
+
tslib.__decorate([
|
|
1793
|
+
graphql.Field(() => graphql.Float),
|
|
1794
|
+
tslib.__metadata("design:type", Number)
|
|
1795
|
+
], InventoryCountOrderItemDto.prototype, "bookQuantity", void 0);
|
|
1796
|
+
tslib.__decorate([
|
|
1797
|
+
graphql.Field(() => graphql.Float, { nullable: true }),
|
|
1798
|
+
tslib.__metadata("design:type", Object)
|
|
1799
|
+
], InventoryCountOrderItemDto.prototype, "countedQuantity", void 0);
|
|
1800
|
+
tslib.__decorate([
|
|
1801
|
+
graphql.Field(() => Boolean),
|
|
1802
|
+
tslib.__metadata("design:type", Boolean)
|
|
1803
|
+
], InventoryCountOrderItemDto.prototype, "isAddition", void 0);
|
|
1804
|
+
InventoryCountOrderItemDto = tslib.__decorate([
|
|
1805
|
+
graphql.ObjectType()
|
|
1806
|
+
], InventoryCountOrderItemDto);
|
|
1807
|
+
/**
|
|
1808
|
+
* A count order. `items` and `locations` come from
|
|
1809
|
+
* `InventoryCountOrderResolver`, for the same reason as above; `locations`
|
|
1810
|
+
* exposes the roots the user picked, not the expanded subtree.
|
|
1811
|
+
*/
|
|
1812
|
+
let InventoryCountOrderDto = class InventoryCountOrderDto {
|
|
1813
|
+
id;
|
|
1814
|
+
key;
|
|
1815
|
+
name;
|
|
1816
|
+
/**
|
|
1817
|
+
* The count's base date. Stock adjustments from settlement are reported under
|
|
1818
|
+
* this date rather than the day settlement happened to run.
|
|
1819
|
+
*/
|
|
1820
|
+
countDate;
|
|
1821
|
+
status;
|
|
1822
|
+
createdBy;
|
|
1823
|
+
startedAt;
|
|
1824
|
+
settledAt;
|
|
1825
|
+
cancelledAt;
|
|
1826
|
+
createdAt;
|
|
1827
|
+
};
|
|
1828
|
+
tslib.__decorate([
|
|
1829
|
+
graphql.Field(() => graphql.ID),
|
|
1830
|
+
tslib.__metadata("design:type", String)
|
|
1831
|
+
], InventoryCountOrderDto.prototype, "id", void 0);
|
|
1832
|
+
tslib.__decorate([
|
|
1833
|
+
graphql.Field(() => String),
|
|
1834
|
+
tslib.__metadata("design:type", String)
|
|
1835
|
+
], InventoryCountOrderDto.prototype, "key", void 0);
|
|
1836
|
+
tslib.__decorate([
|
|
1837
|
+
graphql.Field(() => String),
|
|
1838
|
+
tslib.__metadata("design:type", String)
|
|
1839
|
+
], InventoryCountOrderDto.prototype, "name", void 0);
|
|
1840
|
+
tslib.__decorate([
|
|
1841
|
+
graphql.Field(() => String),
|
|
1842
|
+
tslib.__metadata("design:type", String)
|
|
1843
|
+
], InventoryCountOrderDto.prototype, "countDate", void 0);
|
|
1844
|
+
tslib.__decorate([
|
|
1845
|
+
graphql.Field(() => wmsModuleCore.InventoryCountStatus),
|
|
1846
|
+
tslib.__metadata("design:type", String)
|
|
1847
|
+
], InventoryCountOrderDto.prototype, "status", void 0);
|
|
1848
|
+
tslib.__decorate([
|
|
1849
|
+
graphql.Field(() => String, { nullable: true }),
|
|
1850
|
+
tslib.__metadata("design:type", Object)
|
|
1851
|
+
], InventoryCountOrderDto.prototype, "createdBy", void 0);
|
|
1852
|
+
tslib.__decorate([
|
|
1853
|
+
graphql.Field(() => Date, { nullable: true }),
|
|
1854
|
+
tslib.__metadata("design:type", Object)
|
|
1855
|
+
], InventoryCountOrderDto.prototype, "startedAt", void 0);
|
|
1856
|
+
tslib.__decorate([
|
|
1857
|
+
graphql.Field(() => Date, { nullable: true }),
|
|
1858
|
+
tslib.__metadata("design:type", Object)
|
|
1859
|
+
], InventoryCountOrderDto.prototype, "settledAt", void 0);
|
|
1860
|
+
tslib.__decorate([
|
|
1861
|
+
graphql.Field(() => Date, { nullable: true }),
|
|
1862
|
+
tslib.__metadata("design:type", Object)
|
|
1863
|
+
], InventoryCountOrderDto.prototype, "cancelledAt", void 0);
|
|
1864
|
+
tslib.__decorate([
|
|
1865
|
+
graphql.Field(() => Date),
|
|
1866
|
+
tslib.__metadata("design:type", Date)
|
|
1867
|
+
], InventoryCountOrderDto.prototype, "createdAt", void 0);
|
|
1868
|
+
InventoryCountOrderDto = tslib.__decorate([
|
|
1869
|
+
graphql.ObjectType()
|
|
1870
|
+
], InventoryCountOrderDto);
|
|
1871
|
+
let InventoryCountOrders = class InventoryCountOrders extends PaginatedResponse(InventoryCountOrderDto) {
|
|
1872
|
+
};
|
|
1873
|
+
InventoryCountOrders = tslib.__decorate([
|
|
1874
|
+
graphql.ObjectType()
|
|
1875
|
+
], InventoryCountOrders);
|
|
1876
|
+
|
|
1606
1877
|
let CreateLoaderTypeArgs = class CreateLoaderTypeArgs {
|
|
1607
1878
|
description;
|
|
1608
1879
|
key;
|
|
@@ -3137,8 +3408,17 @@ Locations = tslib.__decorate([
|
|
|
3137
3408
|
], Locations);
|
|
3138
3409
|
|
|
3139
3410
|
let LoaderResolver = class LoaderResolver {
|
|
3411
|
+
entities;
|
|
3140
3412
|
stockService;
|
|
3141
|
-
|
|
3413
|
+
/**
|
|
3414
|
+
* The configured entities, not the built-in classes: `__entity` decides which
|
|
3415
|
+
* repository the DataLoader opens, so it has to follow whatever the consumer
|
|
3416
|
+
* passed to `WMSBaseModuleOptions`. Loading a built-in class outright filters
|
|
3417
|
+
* on its single-table-inheritance discriminator and resolves nothing for an
|
|
3418
|
+
* override.
|
|
3419
|
+
*/
|
|
3420
|
+
constructor(entities, stockService) {
|
|
3421
|
+
this.entities = entities;
|
|
3142
3422
|
this.stockService = stockService;
|
|
3143
3423
|
}
|
|
3144
3424
|
type({ typeId }, { loaders }) {
|
|
@@ -3149,7 +3429,7 @@ let LoaderResolver = class LoaderResolver {
|
|
|
3149
3429
|
}
|
|
3150
3430
|
location({ locationId }, { loaders }) {
|
|
3151
3431
|
return loaders.batchSingle.load({
|
|
3152
|
-
__entity:
|
|
3432
|
+
__entity: this.entities.location,
|
|
3153
3433
|
__from: { id: locationId },
|
|
3154
3434
|
});
|
|
3155
3435
|
}
|
|
@@ -3188,7 +3468,8 @@ tslib.__decorate([
|
|
|
3188
3468
|
], LoaderResolver.prototype, "totalQuantity", null);
|
|
3189
3469
|
LoaderResolver = tslib.__decorate([
|
|
3190
3470
|
graphql.Resolver(() => LoaderDto),
|
|
3191
|
-
tslib.__metadata("design:paramtypes", [wmsModuleCore.
|
|
3471
|
+
tslib.__metadata("design:paramtypes", [wmsModuleCore.WmsEntities,
|
|
3472
|
+
wmsModuleCore.StockService])
|
|
3192
3473
|
], LoaderResolver);
|
|
3193
3474
|
|
|
3194
3475
|
let UnitDto = class UnitDto {
|
|
@@ -3283,32 +3564,32 @@ Batches = tslib.__decorate([
|
|
|
3283
3564
|
], Batches);
|
|
3284
3565
|
|
|
3285
3566
|
let StockResolver = class StockResolver {
|
|
3286
|
-
|
|
3567
|
+
entities;
|
|
3287
3568
|
/**
|
|
3288
|
-
*
|
|
3289
|
-
*
|
|
3290
|
-
*
|
|
3291
|
-
*
|
|
3292
|
-
*
|
|
3569
|
+
* The configured entities, not the built-in classes: `__entity` decides which
|
|
3570
|
+
* repository the DataLoader opens, so it has to follow whatever the consumer
|
|
3571
|
+
* passed to `WMSBaseModuleOptions`. Loading a built-in class outright filters
|
|
3572
|
+
* on its single-table-inheritance discriminator and resolves nothing for an
|
|
3573
|
+
* override.
|
|
3293
3574
|
*/
|
|
3294
|
-
constructor(
|
|
3295
|
-
this.
|
|
3575
|
+
constructor(entities) {
|
|
3576
|
+
this.entities = entities;
|
|
3296
3577
|
}
|
|
3297
3578
|
material({ materialId }, { loaders }) {
|
|
3298
3579
|
return loaders.batchSingle.load({
|
|
3299
|
-
__entity: this.
|
|
3580
|
+
__entity: this.entities.material,
|
|
3300
3581
|
__from: { id: materialId },
|
|
3301
3582
|
});
|
|
3302
3583
|
}
|
|
3303
3584
|
location({ locationId }, { loaders }) {
|
|
3304
3585
|
return loaders.batchSingle.load({
|
|
3305
|
-
__entity:
|
|
3586
|
+
__entity: this.entities.location,
|
|
3306
3587
|
__from: { id: locationId },
|
|
3307
3588
|
});
|
|
3308
3589
|
}
|
|
3309
3590
|
async batch({ batchId }, { loaders }) {
|
|
3310
3591
|
const { groupId } = await loaders.batchSingle.load({
|
|
3311
|
-
__entity:
|
|
3592
|
+
__entity: this.entities.batch,
|
|
3312
3593
|
__from: { id: batchId },
|
|
3313
3594
|
});
|
|
3314
3595
|
return loaders.batchSingle.load({
|
|
@@ -3343,8 +3624,7 @@ tslib.__decorate([
|
|
|
3343
3624
|
], StockResolver.prototype, "batch", null);
|
|
3344
3625
|
StockResolver = tslib.__decorate([
|
|
3345
3626
|
graphql.Resolver(() => StockDto),
|
|
3346
|
-
tslib.
|
|
3347
|
-
tslib.__metadata("design:paramtypes", [Function])
|
|
3627
|
+
tslib.__metadata("design:paramtypes", [wmsModuleCore.WmsEntities])
|
|
3348
3628
|
], StockResolver);
|
|
3349
3629
|
|
|
3350
3630
|
var MapRangeType;
|
|
@@ -3671,9 +3951,20 @@ WarehouseMapMutation = tslib.__decorate([
|
|
|
3671
3951
|
], WarehouseMapMutation);
|
|
3672
3952
|
|
|
3673
3953
|
let LocationResolver = class LocationResolver {
|
|
3954
|
+
entities;
|
|
3955
|
+
/**
|
|
3956
|
+
* The configured entities, not the built-in classes: `__entity` decides which
|
|
3957
|
+
* repository the DataLoader opens, so it has to follow whatever the consumer
|
|
3958
|
+
* passed to `WMSBaseModuleOptions`. Loading a built-in class outright filters
|
|
3959
|
+
* on its single-table-inheritance discriminator and resolves nothing for an
|
|
3960
|
+
* override.
|
|
3961
|
+
*/
|
|
3962
|
+
constructor(entities) {
|
|
3963
|
+
this.entities = entities;
|
|
3964
|
+
}
|
|
3674
3965
|
async mapData({ id }, { loaders }) {
|
|
3675
3966
|
const map = await loaders.batchSingle.load({
|
|
3676
|
-
__entity:
|
|
3967
|
+
__entity: this.entities.warehouseMap,
|
|
3677
3968
|
__from: { id },
|
|
3678
3969
|
});
|
|
3679
3970
|
return map?.mapData || null;
|
|
@@ -3682,7 +3973,7 @@ let LocationResolver = class LocationResolver {
|
|
|
3682
3973
|
if (!parentId)
|
|
3683
3974
|
return null;
|
|
3684
3975
|
return loaders.batchSingle.load({
|
|
3685
|
-
__entity:
|
|
3976
|
+
__entity: this.entities.location,
|
|
3686
3977
|
__from: { id: parentId },
|
|
3687
3978
|
});
|
|
3688
3979
|
}
|
|
@@ -3697,7 +3988,7 @@ let LocationResolver = class LocationResolver {
|
|
|
3697
3988
|
*/
|
|
3698
3989
|
children({ id }, { loaders }) {
|
|
3699
3990
|
return loaders.batchMany.load({
|
|
3700
|
-
__entity:
|
|
3991
|
+
__entity: this.entities.location,
|
|
3701
3992
|
__from: { parentId: id },
|
|
3702
3993
|
__conditions: (qb) => qb.orderBy('entity."key"', 'ASC'),
|
|
3703
3994
|
});
|
|
@@ -3728,7 +4019,8 @@ tslib.__decorate([
|
|
|
3728
4019
|
tslib.__metadata("design:returntype", Promise)
|
|
3729
4020
|
], LocationResolver.prototype, "children", null);
|
|
3730
4021
|
LocationResolver = tslib.__decorate([
|
|
3731
|
-
graphql.Resolver(() => LocationDto)
|
|
4022
|
+
graphql.Resolver(() => LocationDto),
|
|
4023
|
+
tslib.__metadata("design:paramtypes", [wmsModuleCore.WmsEntities])
|
|
3732
4024
|
], LocationResolver);
|
|
3733
4025
|
|
|
3734
4026
|
let FindLocationArgs = class FindLocationArgs extends PaginationArgs {
|
|
@@ -3918,31 +4210,23 @@ UnitQuery = tslib.__decorate([
|
|
|
3918
4210
|
|
|
3919
4211
|
let AggregatedStockResolver = class AggregatedStockResolver {
|
|
3920
4212
|
stockService;
|
|
3921
|
-
|
|
3922
|
-
|
|
3923
|
-
* `materialEntity` is bound to the `MaterialEntity` Symbol, so the DataLoader
|
|
3924
|
-
* queries whichever material entity the consumer configured — the built-in
|
|
3925
|
-
* `MaterialEntityClass` unless `materialEntity` was passed to
|
|
3926
|
-
* `forRoot`/`forRootAsync`. Loading the built-in class outright would filter on
|
|
3927
|
-
* its single-table-inheritance discriminator and resolve nothing for a custom
|
|
3928
|
-
* entity.
|
|
3929
|
-
*/
|
|
3930
|
-
constructor(stockService, materialEntity) {
|
|
4213
|
+
entities;
|
|
4214
|
+
constructor(stockService, entities) {
|
|
3931
4215
|
this.stockService = stockService;
|
|
3932
|
-
this.
|
|
4216
|
+
this.entities = entities;
|
|
3933
4217
|
}
|
|
3934
4218
|
async id(stock) {
|
|
3935
4219
|
return this.stockService.generatedAggregateKey(stock);
|
|
3936
4220
|
}
|
|
3937
4221
|
async material({ materialId }, { loaders }) {
|
|
3938
4222
|
return loaders.batchSingle.load({
|
|
3939
|
-
__entity: this.
|
|
4223
|
+
__entity: this.entities.material,
|
|
3940
4224
|
__from: { id: materialId },
|
|
3941
4225
|
});
|
|
3942
4226
|
}
|
|
3943
4227
|
async batch({ batchId }, { loaders }) {
|
|
3944
4228
|
const { groupId } = await loaders.batchSingle.load({
|
|
3945
|
-
__entity:
|
|
4229
|
+
__entity: this.entities.batch,
|
|
3946
4230
|
__from: { id: batchId },
|
|
3947
4231
|
});
|
|
3948
4232
|
return loaders.batchSingle.load({
|
|
@@ -3952,7 +4236,7 @@ let AggregatedStockResolver = class AggregatedStockResolver {
|
|
|
3952
4236
|
}
|
|
3953
4237
|
async location({ locationId }, { loaders }) {
|
|
3954
4238
|
return loaders.batchSingle.load({
|
|
3955
|
-
__entity:
|
|
4239
|
+
__entity: this.entities.location,
|
|
3956
4240
|
__from: { id: locationId },
|
|
3957
4241
|
});
|
|
3958
4242
|
}
|
|
@@ -4004,8 +4288,8 @@ tslib.__decorate([
|
|
|
4004
4288
|
], AggregatedStockResolver.prototype, "loader", null);
|
|
4005
4289
|
AggregatedStockResolver = tslib.__decorate([
|
|
4006
4290
|
graphql.Resolver(() => AggregatedStockDto),
|
|
4007
|
-
tslib.
|
|
4008
|
-
|
|
4291
|
+
tslib.__metadata("design:paramtypes", [wmsModuleCore.StockService,
|
|
4292
|
+
wmsModuleCore.WmsEntities])
|
|
4009
4293
|
], AggregatedStockResolver);
|
|
4010
4294
|
|
|
4011
4295
|
let CreateTransferOrderItemArgs = class CreateTransferOrderItemArgs {
|
|
@@ -4330,6 +4614,17 @@ TransferOrderQuery = tslib.__decorate([
|
|
|
4330
4614
|
], TransferOrderQuery);
|
|
4331
4615
|
|
|
4332
4616
|
let TransferOrderResolver = class TransferOrderResolver {
|
|
4617
|
+
entities;
|
|
4618
|
+
/**
|
|
4619
|
+
* The configured entities, not the built-in classes: `__entity` decides which
|
|
4620
|
+
* repository the DataLoader opens, so it has to follow whatever the consumer
|
|
4621
|
+
* passed to `WMSBaseModuleOptions`. Loading a built-in class outright filters
|
|
4622
|
+
* on its single-table-inheritance discriminator and resolves nothing for an
|
|
4623
|
+
* override.
|
|
4624
|
+
*/
|
|
4625
|
+
constructor(entities) {
|
|
4626
|
+
this.entities = entities;
|
|
4627
|
+
}
|
|
4333
4628
|
items({ id }, { loaders }) {
|
|
4334
4629
|
return loaders.batchMany.load({
|
|
4335
4630
|
__entity: wmsModuleCore.TransferOrderItemEntityClass,
|
|
@@ -4344,7 +4639,7 @@ let TransferOrderResolver = class TransferOrderResolver {
|
|
|
4344
4639
|
if (!item?.targetLocationId)
|
|
4345
4640
|
return null;
|
|
4346
4641
|
return locationLoader.loaders.batchSingle.load({
|
|
4347
|
-
__entity:
|
|
4642
|
+
__entity: this.entities.location,
|
|
4348
4643
|
__from: { id: item.targetLocationId },
|
|
4349
4644
|
});
|
|
4350
4645
|
}
|
|
@@ -4388,23 +4683,24 @@ tslib.__decorate([
|
|
|
4388
4683
|
tslib.__metadata("design:returntype", Promise)
|
|
4389
4684
|
], TransferOrderResolver.prototype, "targetLoader", null);
|
|
4390
4685
|
TransferOrderResolver = tslib.__decorate([
|
|
4391
|
-
graphql.Resolver(() => TransferOrderDto)
|
|
4686
|
+
graphql.Resolver(() => TransferOrderDto),
|
|
4687
|
+
tslib.__metadata("design:paramtypes", [wmsModuleCore.WmsEntities])
|
|
4392
4688
|
], TransferOrderResolver);
|
|
4393
4689
|
let TransferOrderItemResolver = class TransferOrderItemResolver {
|
|
4394
|
-
|
|
4690
|
+
entities;
|
|
4395
4691
|
/**
|
|
4396
|
-
*
|
|
4397
|
-
*
|
|
4398
|
-
*
|
|
4399
|
-
*
|
|
4400
|
-
*
|
|
4692
|
+
* The configured entities, not the built-in classes: `__entity` decides which
|
|
4693
|
+
* repository the DataLoader opens, so it has to follow whatever the consumer
|
|
4694
|
+
* passed to `WMSBaseModuleOptions`. Loading a built-in class outright filters
|
|
4695
|
+
* on its single-table-inheritance discriminator and resolves nothing for an
|
|
4696
|
+
* override.
|
|
4401
4697
|
*/
|
|
4402
|
-
constructor(
|
|
4403
|
-
this.
|
|
4698
|
+
constructor(entities) {
|
|
4699
|
+
this.entities = entities;
|
|
4404
4700
|
}
|
|
4405
4701
|
material({ materialId }, { loaders }) {
|
|
4406
4702
|
return loaders.batchSingle.load({
|
|
4407
|
-
__entity: this.
|
|
4703
|
+
__entity: this.entities.material,
|
|
4408
4704
|
__from: { id: materialId },
|
|
4409
4705
|
});
|
|
4410
4706
|
}
|
|
@@ -4412,7 +4708,7 @@ let TransferOrderItemResolver = class TransferOrderItemResolver {
|
|
|
4412
4708
|
if (!batchId)
|
|
4413
4709
|
return null;
|
|
4414
4710
|
const { groupId } = await loaders.batchSingle.load({
|
|
4415
|
-
__entity:
|
|
4711
|
+
__entity: this.entities.batch,
|
|
4416
4712
|
__from: { id: batchId },
|
|
4417
4713
|
});
|
|
4418
4714
|
return loaders.batchSingle.load({
|
|
@@ -4424,7 +4720,7 @@ let TransferOrderItemResolver = class TransferOrderItemResolver {
|
|
|
4424
4720
|
if (!locationId)
|
|
4425
4721
|
return null;
|
|
4426
4722
|
return loaders.batchSingle.load({
|
|
4427
|
-
__entity:
|
|
4723
|
+
__entity: this.entities.location,
|
|
4428
4724
|
__from: { id: locationId },
|
|
4429
4725
|
});
|
|
4430
4726
|
}
|
|
@@ -4441,7 +4737,7 @@ let TransferOrderItemResolver = class TransferOrderItemResolver {
|
|
|
4441
4737
|
return null;
|
|
4442
4738
|
return loaders.batchSingle
|
|
4443
4739
|
.load({
|
|
4444
|
-
__entity:
|
|
4740
|
+
__entity: this.entities.batch,
|
|
4445
4741
|
__from: { id: batchId },
|
|
4446
4742
|
})
|
|
4447
4743
|
.then((batch) => batch.saleId);
|
|
@@ -4451,7 +4747,7 @@ let TransferOrderItemResolver = class TransferOrderItemResolver {
|
|
|
4451
4747
|
return null;
|
|
4452
4748
|
return loaders.batchSingle
|
|
4453
4749
|
.load({
|
|
4454
|
-
__entity:
|
|
4750
|
+
__entity: this.entities.batch,
|
|
4455
4751
|
__from: { id: batchId },
|
|
4456
4752
|
})
|
|
4457
4753
|
.then((batch) => batch.saleSerialId);
|
|
@@ -4525,8 +4821,7 @@ tslib.__decorate([
|
|
|
4525
4821
|
], TransferOrderItemResolver.prototype, "transferredQuantity", null);
|
|
4526
4822
|
TransferOrderItemResolver = tslib.__decorate([
|
|
4527
4823
|
graphql.Resolver(() => TransferOrderItemDto),
|
|
4528
|
-
tslib.
|
|
4529
|
-
tslib.__metadata("design:paramtypes", [Function])
|
|
4824
|
+
tslib.__metadata("design:paramtypes", [wmsModuleCore.WmsEntities])
|
|
4530
4825
|
], TransferOrderItemResolver);
|
|
4531
4826
|
|
|
4532
4827
|
let CreateHoldInventoryOrderItemArgs = class CreateHoldInventoryOrderItemArgs {
|
|
@@ -4822,32 +5117,32 @@ BatchQuery = tslib.__decorate([
|
|
|
4822
5117
|
], BatchQuery);
|
|
4823
5118
|
|
|
4824
5119
|
let ChangeLogResolver = class ChangeLogResolver {
|
|
4825
|
-
|
|
5120
|
+
entities;
|
|
4826
5121
|
/**
|
|
4827
|
-
*
|
|
4828
|
-
*
|
|
4829
|
-
*
|
|
4830
|
-
*
|
|
4831
|
-
*
|
|
5122
|
+
* The configured entities, not the built-in classes: `__entity` decides which
|
|
5123
|
+
* repository the DataLoader opens, so it has to follow whatever the consumer
|
|
5124
|
+
* passed to `WMSBaseModuleOptions`. Loading a built-in class outright filters
|
|
5125
|
+
* on its single-table-inheritance discriminator and resolves nothing for an
|
|
5126
|
+
* override.
|
|
4832
5127
|
*/
|
|
4833
|
-
constructor(
|
|
4834
|
-
this.
|
|
5128
|
+
constructor(entities) {
|
|
5129
|
+
this.entities = entities;
|
|
4835
5130
|
}
|
|
4836
5131
|
material({ materialId }, { loaders }) {
|
|
4837
5132
|
return loaders.batchSingle.load({
|
|
4838
|
-
__entity: this.
|
|
5133
|
+
__entity: this.entities.material,
|
|
4839
5134
|
__from: { id: materialId },
|
|
4840
5135
|
});
|
|
4841
5136
|
}
|
|
4842
5137
|
location({ locationId }, { loaders }) {
|
|
4843
5138
|
return loaders.batchSingle.load({
|
|
4844
|
-
__entity:
|
|
5139
|
+
__entity: this.entities.location,
|
|
4845
5140
|
__from: { id: locationId },
|
|
4846
5141
|
});
|
|
4847
5142
|
}
|
|
4848
5143
|
async batch({ batchId }, { loaders }) {
|
|
4849
5144
|
const { groupId } = await loaders.batchSingle.load({
|
|
4850
|
-
__entity:
|
|
5145
|
+
__entity: this.entities.batch,
|
|
4851
5146
|
__from: { id: batchId },
|
|
4852
5147
|
});
|
|
4853
5148
|
return loaders.batchSingle.load({
|
|
@@ -4882,8 +5177,7 @@ tslib.__decorate([
|
|
|
4882
5177
|
], ChangeLogResolver.prototype, "batch", null);
|
|
4883
5178
|
ChangeLogResolver = tslib.__decorate([
|
|
4884
5179
|
graphql.Resolver(() => ChangeLogDto),
|
|
4885
|
-
tslib.
|
|
4886
|
-
tslib.__metadata("design:paramtypes", [Function])
|
|
5180
|
+
tslib.__metadata("design:paramtypes", [wmsModuleCore.WmsEntities])
|
|
4887
5181
|
], ChangeLogResolver);
|
|
4888
5182
|
|
|
4889
5183
|
let ReceiveInventoryOrderResolver = class ReceiveInventoryOrderResolver {
|
|
@@ -4907,20 +5201,20 @@ ReceiveInventoryOrderResolver = tslib.__decorate([
|
|
|
4907
5201
|
graphql.Resolver(() => ReceiveInventoryOrderDto)
|
|
4908
5202
|
], ReceiveInventoryOrderResolver);
|
|
4909
5203
|
let ReceiveInventoryOrderItemResolver = class ReceiveInventoryOrderItemResolver {
|
|
4910
|
-
|
|
5204
|
+
entities;
|
|
4911
5205
|
/**
|
|
4912
|
-
*
|
|
4913
|
-
*
|
|
4914
|
-
*
|
|
4915
|
-
*
|
|
4916
|
-
*
|
|
5206
|
+
* The configured entities, not the built-in classes: `__entity` decides which
|
|
5207
|
+
* repository the DataLoader opens, so it has to follow whatever the consumer
|
|
5208
|
+
* passed to `WMSBaseModuleOptions`. Loading a built-in class outright filters
|
|
5209
|
+
* on its single-table-inheritance discriminator and resolves nothing for an
|
|
5210
|
+
* override.
|
|
4917
5211
|
*/
|
|
4918
|
-
constructor(
|
|
4919
|
-
this.
|
|
5212
|
+
constructor(entities) {
|
|
5213
|
+
this.entities = entities;
|
|
4920
5214
|
}
|
|
4921
5215
|
material({ materialId }, { loaders }) {
|
|
4922
5216
|
return loaders.batchSingle.load({
|
|
4923
|
-
__entity: this.
|
|
5217
|
+
__entity: this.entities.material,
|
|
4924
5218
|
__from: { id: materialId },
|
|
4925
5219
|
});
|
|
4926
5220
|
}
|
|
@@ -4928,7 +5222,7 @@ let ReceiveInventoryOrderItemResolver = class ReceiveInventoryOrderItemResolver
|
|
|
4928
5222
|
if (!batchId)
|
|
4929
5223
|
return null;
|
|
4930
5224
|
const { groupId } = await loaders.batchSingle.load({
|
|
4931
|
-
__entity:
|
|
5225
|
+
__entity: this.entities.batch,
|
|
4932
5226
|
__from: { id: batchId },
|
|
4933
5227
|
});
|
|
4934
5228
|
return loaders.batchSingle.load({
|
|
@@ -4940,7 +5234,7 @@ let ReceiveInventoryOrderItemResolver = class ReceiveInventoryOrderItemResolver
|
|
|
4940
5234
|
if (!locationId)
|
|
4941
5235
|
return null;
|
|
4942
5236
|
return loaders.batchSingle.load({
|
|
4943
|
-
__entity:
|
|
5237
|
+
__entity: this.entities.location,
|
|
4944
5238
|
__from: { id: locationId },
|
|
4945
5239
|
});
|
|
4946
5240
|
}
|
|
@@ -5004,8 +5298,7 @@ tslib.__decorate([
|
|
|
5004
5298
|
], ReceiveInventoryOrderItemResolver.prototype, "receivedQuantity", null);
|
|
5005
5299
|
ReceiveInventoryOrderItemResolver = tslib.__decorate([
|
|
5006
5300
|
graphql.Resolver(() => ReceiveInventoryOrderItemDto),
|
|
5007
|
-
tslib.
|
|
5008
|
-
tslib.__metadata("design:paramtypes", [Function])
|
|
5301
|
+
tslib.__metadata("design:paramtypes", [wmsModuleCore.WmsEntities])
|
|
5009
5302
|
], ReceiveInventoryOrderItemResolver);
|
|
5010
5303
|
|
|
5011
5304
|
let FindAllocateInventoryOrderArgs = class FindAllocateInventoryOrderArgs extends PaginationArgs {
|
|
@@ -5342,20 +5635,20 @@ ShipInventoryOrderResolver = tslib.__decorate([
|
|
|
5342
5635
|
graphql.Resolver(() => ShipInventoryOrderDto)
|
|
5343
5636
|
], ShipInventoryOrderResolver);
|
|
5344
5637
|
let ShipInventoryOrderItemResolver = class ShipInventoryOrderItemResolver {
|
|
5345
|
-
|
|
5638
|
+
entities;
|
|
5346
5639
|
/**
|
|
5347
|
-
*
|
|
5348
|
-
*
|
|
5349
|
-
*
|
|
5350
|
-
*
|
|
5351
|
-
*
|
|
5640
|
+
* The configured entities, not the built-in classes: `__entity` decides which
|
|
5641
|
+
* repository the DataLoader opens, so it has to follow whatever the consumer
|
|
5642
|
+
* passed to `WMSBaseModuleOptions`. Loading a built-in class outright filters
|
|
5643
|
+
* on its single-table-inheritance discriminator and resolves nothing for an
|
|
5644
|
+
* override.
|
|
5352
5645
|
*/
|
|
5353
|
-
constructor(
|
|
5354
|
-
this.
|
|
5646
|
+
constructor(entities) {
|
|
5647
|
+
this.entities = entities;
|
|
5355
5648
|
}
|
|
5356
5649
|
material({ materialId }, { loaders }) {
|
|
5357
5650
|
return loaders.batchSingle.load({
|
|
5358
|
-
__entity: this.
|
|
5651
|
+
__entity: this.entities.material,
|
|
5359
5652
|
__from: { id: materialId },
|
|
5360
5653
|
});
|
|
5361
5654
|
}
|
|
@@ -5363,7 +5656,7 @@ let ShipInventoryOrderItemResolver = class ShipInventoryOrderItemResolver {
|
|
|
5363
5656
|
if (!batchId)
|
|
5364
5657
|
return null;
|
|
5365
5658
|
const { groupId } = await loaders.batchSingle.load({
|
|
5366
|
-
__entity:
|
|
5659
|
+
__entity: this.entities.batch,
|
|
5367
5660
|
__from: { id: batchId },
|
|
5368
5661
|
});
|
|
5369
5662
|
return loaders.batchSingle.load({
|
|
@@ -5375,7 +5668,7 @@ let ShipInventoryOrderItemResolver = class ShipInventoryOrderItemResolver {
|
|
|
5375
5668
|
if (!batchId)
|
|
5376
5669
|
return null;
|
|
5377
5670
|
const { groupId } = await loaders.batchSingle.load({
|
|
5378
|
-
__entity:
|
|
5671
|
+
__entity: this.entities.batch,
|
|
5379
5672
|
__from: { id: batchId },
|
|
5380
5673
|
});
|
|
5381
5674
|
return loaders.batchSingle
|
|
@@ -5389,7 +5682,7 @@ let ShipInventoryOrderItemResolver = class ShipInventoryOrderItemResolver {
|
|
|
5389
5682
|
if (!batchId)
|
|
5390
5683
|
return null;
|
|
5391
5684
|
const { groupId } = await loaders.batchSingle.load({
|
|
5392
|
-
__entity:
|
|
5685
|
+
__entity: this.entities.batch,
|
|
5393
5686
|
__from: { id: batchId },
|
|
5394
5687
|
});
|
|
5395
5688
|
return loaders.batchSingle
|
|
@@ -5403,7 +5696,7 @@ let ShipInventoryOrderItemResolver = class ShipInventoryOrderItemResolver {
|
|
|
5403
5696
|
if (!locationId)
|
|
5404
5697
|
return null;
|
|
5405
5698
|
return loaders.batchSingle.load({
|
|
5406
|
-
__entity:
|
|
5699
|
+
__entity: this.entities.location,
|
|
5407
5700
|
__from: { id: locationId },
|
|
5408
5701
|
});
|
|
5409
5702
|
}
|
|
@@ -5484,20 +5777,19 @@ tslib.__decorate([
|
|
|
5484
5777
|
], ShipInventoryOrderItemResolver.prototype, "shippedQuantity", null);
|
|
5485
5778
|
ShipInventoryOrderItemResolver = tslib.__decorate([
|
|
5486
5779
|
graphql.Resolver(() => ShipInventoryOrderItemDto),
|
|
5487
|
-
tslib.
|
|
5488
|
-
tslib.__metadata("design:paramtypes", [Function])
|
|
5780
|
+
tslib.__metadata("design:paramtypes", [wmsModuleCore.WmsEntities])
|
|
5489
5781
|
], ShipInventoryOrderItemResolver);
|
|
5490
5782
|
let ShipInventoryOrderReferenceResolver = class ShipInventoryOrderReferenceResolver {
|
|
5491
|
-
|
|
5783
|
+
entities;
|
|
5492
5784
|
/**
|
|
5493
|
-
*
|
|
5494
|
-
*
|
|
5495
|
-
*
|
|
5496
|
-
*
|
|
5497
|
-
*
|
|
5785
|
+
* The configured entities, not the built-in classes: `__entity` decides which
|
|
5786
|
+
* repository the DataLoader opens, so it has to follow whatever the consumer
|
|
5787
|
+
* passed to `WMSBaseModuleOptions`. Loading a built-in class outright filters
|
|
5788
|
+
* on its single-table-inheritance discriminator and resolves nothing for an
|
|
5789
|
+
* override.
|
|
5498
5790
|
*/
|
|
5499
|
-
constructor(
|
|
5500
|
-
this.
|
|
5791
|
+
constructor(entities) {
|
|
5792
|
+
this.entities = entities;
|
|
5501
5793
|
}
|
|
5502
5794
|
async shippedQuantity({ orderId, serialId }, { loaders }) {
|
|
5503
5795
|
const items = await loaders.batchMany.load({
|
|
@@ -5513,7 +5805,7 @@ let ShipInventoryOrderReferenceResolver = class ShipInventoryOrderReferenceResol
|
|
|
5513
5805
|
}
|
|
5514
5806
|
material({ materialId }, { loaders }) {
|
|
5515
5807
|
return loaders.batchSingle.load({
|
|
5516
|
-
__entity: this.
|
|
5808
|
+
__entity: this.entities.material,
|
|
5517
5809
|
__from: { id: materialId },
|
|
5518
5810
|
});
|
|
5519
5811
|
}
|
|
@@ -5521,7 +5813,7 @@ let ShipInventoryOrderReferenceResolver = class ShipInventoryOrderReferenceResol
|
|
|
5521
5813
|
if (!batchId)
|
|
5522
5814
|
return null;
|
|
5523
5815
|
const { groupId } = await loaders.batchSingle.load({
|
|
5524
|
-
__entity:
|
|
5816
|
+
__entity: this.entities.batch,
|
|
5525
5817
|
__from: { id: batchId },
|
|
5526
5818
|
});
|
|
5527
5819
|
return loaders.batchSingle.load({
|
|
@@ -5570,8 +5862,7 @@ tslib.__decorate([
|
|
|
5570
5862
|
], ShipInventoryOrderReferenceResolver.prototype, "items", null);
|
|
5571
5863
|
ShipInventoryOrderReferenceResolver = tslib.__decorate([
|
|
5572
5864
|
graphql.Resolver(() => ShipInventoryOrderReferenceDto),
|
|
5573
|
-
tslib.
|
|
5574
|
-
tslib.__metadata("design:paramtypes", [Function])
|
|
5865
|
+
tslib.__metadata("design:paramtypes", [wmsModuleCore.WmsEntities])
|
|
5575
5866
|
], ShipInventoryOrderReferenceResolver);
|
|
5576
5867
|
|
|
5577
5868
|
let FindSaleOrderArgs = class FindSaleOrderArgs extends PaginationArgs {
|
|
@@ -6626,11 +6917,22 @@ WarehouseMapDataQuery = tslib.__decorate([
|
|
|
6626
6917
|
], WarehouseMapDataQuery);
|
|
6627
6918
|
|
|
6628
6919
|
let MapRangeUnionResolver = class MapRangeUnionResolver {
|
|
6920
|
+
entities;
|
|
6921
|
+
/**
|
|
6922
|
+
* The configured entities, not the built-in classes: `__entity` decides which
|
|
6923
|
+
* repository the DataLoader opens, so it has to follow whatever the consumer
|
|
6924
|
+
* passed to `WMSBaseModuleOptions`. Loading a built-in class outright filters
|
|
6925
|
+
* on its single-table-inheritance discriminator and resolves nothing for an
|
|
6926
|
+
* override.
|
|
6927
|
+
*/
|
|
6928
|
+
constructor(entities) {
|
|
6929
|
+
this.entities = entities;
|
|
6930
|
+
}
|
|
6629
6931
|
location({ id }, { loaders }) {
|
|
6630
6932
|
if (!id)
|
|
6631
6933
|
return null;
|
|
6632
6934
|
return loaders.batchSingle.load({
|
|
6633
|
-
__entity:
|
|
6935
|
+
__entity: this.entities.location,
|
|
6634
6936
|
__from: { key: id },
|
|
6635
6937
|
});
|
|
6636
6938
|
}
|
|
@@ -6644,9 +6946,498 @@ tslib.__decorate([
|
|
|
6644
6946
|
tslib.__metadata("design:returntype", void 0)
|
|
6645
6947
|
], MapRangeUnionResolver.prototype, "location", null);
|
|
6646
6948
|
MapRangeUnionResolver = tslib.__decorate([
|
|
6647
|
-
graphql.Resolver(() => MapRangeDto)
|
|
6949
|
+
graphql.Resolver(() => MapRangeDto),
|
|
6950
|
+
tslib.__metadata("design:paramtypes", [wmsModuleCore.WmsEntities])
|
|
6648
6951
|
], MapRangeUnionResolver);
|
|
6649
6952
|
|
|
6953
|
+
let FindInventoryCountOrderArgs = class FindInventoryCountOrderArgs extends PaginationArgs {
|
|
6954
|
+
name;
|
|
6955
|
+
statuses;
|
|
6956
|
+
createdBy;
|
|
6957
|
+
/** Inclusive lower bound on `countDate`, `YYYY-MM-DD`. */
|
|
6958
|
+
countDateFrom;
|
|
6959
|
+
/** Inclusive upper bound on `countDate`, `YYYY-MM-DD`. */
|
|
6960
|
+
countDateTo;
|
|
6961
|
+
/**
|
|
6962
|
+
* Matches against the expanded scope, not the roots the user picked, so
|
|
6963
|
+
* filtering by a shelf finds the count that covers its whole aisle.
|
|
6964
|
+
*/
|
|
6965
|
+
locationIds;
|
|
6966
|
+
};
|
|
6967
|
+
tslib.__decorate([
|
|
6968
|
+
graphql.Field(() => String, { nullable: true }),
|
|
6969
|
+
tslib.__metadata("design:type", String)
|
|
6970
|
+
], FindInventoryCountOrderArgs.prototype, "name", void 0);
|
|
6971
|
+
tslib.__decorate([
|
|
6972
|
+
graphql.Field(() => [wmsModuleCore.InventoryCountStatus], { nullable: true }),
|
|
6973
|
+
tslib.__metadata("design:type", Array)
|
|
6974
|
+
], FindInventoryCountOrderArgs.prototype, "statuses", void 0);
|
|
6975
|
+
tslib.__decorate([
|
|
6976
|
+
graphql.Field(() => String, { nullable: true }),
|
|
6977
|
+
tslib.__metadata("design:type", String)
|
|
6978
|
+
], FindInventoryCountOrderArgs.prototype, "createdBy", void 0);
|
|
6979
|
+
tslib.__decorate([
|
|
6980
|
+
graphql.Field(() => String, { nullable: true }),
|
|
6981
|
+
tslib.__metadata("design:type", String)
|
|
6982
|
+
], FindInventoryCountOrderArgs.prototype, "countDateFrom", void 0);
|
|
6983
|
+
tslib.__decorate([
|
|
6984
|
+
graphql.Field(() => String, { nullable: true }),
|
|
6985
|
+
tslib.__metadata("design:type", String)
|
|
6986
|
+
], FindInventoryCountOrderArgs.prototype, "countDateTo", void 0);
|
|
6987
|
+
tslib.__decorate([
|
|
6988
|
+
graphql.Field(() => [graphql.ID], { nullable: true }),
|
|
6989
|
+
tslib.__metadata("design:type", Array)
|
|
6990
|
+
], FindInventoryCountOrderArgs.prototype, "locationIds", void 0);
|
|
6991
|
+
FindInventoryCountOrderArgs = tslib.__decorate([
|
|
6992
|
+
graphql.ArgsType()
|
|
6993
|
+
], FindInventoryCountOrderArgs);
|
|
6994
|
+
let CreateInventoryCountOrderArgs = class CreateInventoryCountOrderArgs {
|
|
6995
|
+
name;
|
|
6996
|
+
countDate;
|
|
6997
|
+
/** Root locations; every descendant is pulled into scope automatically. */
|
|
6998
|
+
locationIds;
|
|
6999
|
+
};
|
|
7000
|
+
tslib.__decorate([
|
|
7001
|
+
graphql.Field(() => String),
|
|
7002
|
+
tslib.__metadata("design:type", String)
|
|
7003
|
+
], CreateInventoryCountOrderArgs.prototype, "name", void 0);
|
|
7004
|
+
tslib.__decorate([
|
|
7005
|
+
graphql.Field(() => String),
|
|
7006
|
+
tslib.__metadata("design:type", String)
|
|
7007
|
+
], CreateInventoryCountOrderArgs.prototype, "countDate", void 0);
|
|
7008
|
+
tslib.__decorate([
|
|
7009
|
+
graphql.Field(() => [graphql.ID]),
|
|
7010
|
+
tslib.__metadata("design:type", Array)
|
|
7011
|
+
], CreateInventoryCountOrderArgs.prototype, "locationIds", void 0);
|
|
7012
|
+
CreateInventoryCountOrderArgs = tslib.__decorate([
|
|
7013
|
+
graphql.ArgsType()
|
|
7014
|
+
], CreateInventoryCountOrderArgs);
|
|
7015
|
+
let UpdateInventoryCountOrderArgs = class UpdateInventoryCountOrderArgs {
|
|
7016
|
+
id;
|
|
7017
|
+
name;
|
|
7018
|
+
countDate;
|
|
7019
|
+
locationIds;
|
|
7020
|
+
};
|
|
7021
|
+
tslib.__decorate([
|
|
7022
|
+
graphql.Field(() => graphql.ID),
|
|
7023
|
+
tslib.__metadata("design:type", String)
|
|
7024
|
+
], UpdateInventoryCountOrderArgs.prototype, "id", void 0);
|
|
7025
|
+
tslib.__decorate([
|
|
7026
|
+
graphql.Field(() => String, { nullable: true }),
|
|
7027
|
+
tslib.__metadata("design:type", String)
|
|
7028
|
+
], UpdateInventoryCountOrderArgs.prototype, "name", void 0);
|
|
7029
|
+
tslib.__decorate([
|
|
7030
|
+
graphql.Field(() => String, { nullable: true }),
|
|
7031
|
+
tslib.__metadata("design:type", String)
|
|
7032
|
+
], UpdateInventoryCountOrderArgs.prototype, "countDate", void 0);
|
|
7033
|
+
tslib.__decorate([
|
|
7034
|
+
graphql.Field(() => [graphql.ID], { nullable: true }),
|
|
7035
|
+
tslib.__metadata("design:type", Array)
|
|
7036
|
+
], UpdateInventoryCountOrderArgs.prototype, "locationIds", void 0);
|
|
7037
|
+
UpdateInventoryCountOrderArgs = tslib.__decorate([
|
|
7038
|
+
graphql.ArgsType()
|
|
7039
|
+
], UpdateInventoryCountOrderArgs);
|
|
7040
|
+
let CountInventoryItemInput = class CountInventoryItemInput {
|
|
7041
|
+
itemId;
|
|
7042
|
+
/** `null` clears the entry, putting the line back to "not counted". */
|
|
7043
|
+
countedQuantity;
|
|
7044
|
+
unitId;
|
|
7045
|
+
};
|
|
7046
|
+
tslib.__decorate([
|
|
7047
|
+
graphql.Field(() => graphql.ID),
|
|
7048
|
+
tslib.__metadata("design:type", String)
|
|
7049
|
+
], CountInventoryItemInput.prototype, "itemId", void 0);
|
|
7050
|
+
tslib.__decorate([
|
|
7051
|
+
graphql.Field(() => graphql.Float, { nullable: true }),
|
|
7052
|
+
tslib.__metadata("design:type", Object)
|
|
7053
|
+
], CountInventoryItemInput.prototype, "countedQuantity", void 0);
|
|
7054
|
+
tslib.__decorate([
|
|
7055
|
+
graphql.Field(() => graphql.ID, { nullable: true }),
|
|
7056
|
+
tslib.__metadata("design:type", Object)
|
|
7057
|
+
], CountInventoryItemInput.prototype, "unitId", void 0);
|
|
7058
|
+
CountInventoryItemInput = tslib.__decorate([
|
|
7059
|
+
graphql.InputType()
|
|
7060
|
+
], CountInventoryItemInput);
|
|
7061
|
+
let CountInventoryArgs = class CountInventoryArgs {
|
|
7062
|
+
id;
|
|
7063
|
+
items;
|
|
7064
|
+
};
|
|
7065
|
+
tslib.__decorate([
|
|
7066
|
+
graphql.Field(() => graphql.ID),
|
|
7067
|
+
tslib.__metadata("design:type", String)
|
|
7068
|
+
], CountInventoryArgs.prototype, "id", void 0);
|
|
7069
|
+
tslib.__decorate([
|
|
7070
|
+
graphql.Field(() => [CountInventoryItemInput]),
|
|
7071
|
+
tslib.__metadata("design:type", Array)
|
|
7072
|
+
], CountInventoryArgs.prototype, "items", void 0);
|
|
7073
|
+
CountInventoryArgs = tslib.__decorate([
|
|
7074
|
+
graphql.ArgsType()
|
|
7075
|
+
], CountInventoryArgs);
|
|
7076
|
+
let AddInventoryCountItemArgs = class AddInventoryCountItemArgs {
|
|
7077
|
+
id;
|
|
7078
|
+
materialId;
|
|
7079
|
+
/** An existing batch key, or a new one — the batch is created on demand. */
|
|
7080
|
+
batchKey;
|
|
7081
|
+
locationId;
|
|
7082
|
+
loaderId;
|
|
7083
|
+
countedQuantity;
|
|
7084
|
+
unitId;
|
|
7085
|
+
};
|
|
7086
|
+
tslib.__decorate([
|
|
7087
|
+
graphql.Field(() => graphql.ID),
|
|
7088
|
+
tslib.__metadata("design:type", String)
|
|
7089
|
+
], AddInventoryCountItemArgs.prototype, "id", void 0);
|
|
7090
|
+
tslib.__decorate([
|
|
7091
|
+
graphql.Field(() => graphql.ID),
|
|
7092
|
+
tslib.__metadata("design:type", String)
|
|
7093
|
+
], AddInventoryCountItemArgs.prototype, "materialId", void 0);
|
|
7094
|
+
tslib.__decorate([
|
|
7095
|
+
graphql.Field(() => String),
|
|
7096
|
+
tslib.__metadata("design:type", String)
|
|
7097
|
+
], AddInventoryCountItemArgs.prototype, "batchKey", void 0);
|
|
7098
|
+
tslib.__decorate([
|
|
7099
|
+
graphql.Field(() => graphql.ID),
|
|
7100
|
+
tslib.__metadata("design:type", String)
|
|
7101
|
+
], AddInventoryCountItemArgs.prototype, "locationId", void 0);
|
|
7102
|
+
tslib.__decorate([
|
|
7103
|
+
graphql.Field(() => graphql.ID, { nullable: true }),
|
|
7104
|
+
tslib.__metadata("design:type", Object)
|
|
7105
|
+
], AddInventoryCountItemArgs.prototype, "loaderId", void 0);
|
|
7106
|
+
tslib.__decorate([
|
|
7107
|
+
graphql.Field(() => graphql.Float),
|
|
7108
|
+
tslib.__metadata("design:type", Number)
|
|
7109
|
+
], AddInventoryCountItemArgs.prototype, "countedQuantity", void 0);
|
|
7110
|
+
tslib.__decorate([
|
|
7111
|
+
graphql.Field(() => graphql.ID, { nullable: true }),
|
|
7112
|
+
tslib.__metadata("design:type", Object)
|
|
7113
|
+
], AddInventoryCountItemArgs.prototype, "unitId", void 0);
|
|
7114
|
+
AddInventoryCountItemArgs = tslib.__decorate([
|
|
7115
|
+
graphql.ArgsType()
|
|
7116
|
+
], AddInventoryCountItemArgs);
|
|
7117
|
+
let RemoveInventoryCountItemArgs = class RemoveInventoryCountItemArgs {
|
|
7118
|
+
id;
|
|
7119
|
+
itemId;
|
|
7120
|
+
};
|
|
7121
|
+
tslib.__decorate([
|
|
7122
|
+
graphql.Field(() => graphql.ID),
|
|
7123
|
+
tslib.__metadata("design:type", String)
|
|
7124
|
+
], RemoveInventoryCountItemArgs.prototype, "id", void 0);
|
|
7125
|
+
tslib.__decorate([
|
|
7126
|
+
graphql.Field(() => graphql.ID),
|
|
7127
|
+
tslib.__metadata("design:type", String)
|
|
7128
|
+
], RemoveInventoryCountItemArgs.prototype, "itemId", void 0);
|
|
7129
|
+
RemoveInventoryCountItemArgs = tslib.__decorate([
|
|
7130
|
+
graphql.ArgsType()
|
|
7131
|
+
], RemoveInventoryCountItemArgs);
|
|
7132
|
+
let InventoryCountOrderIdArgs = class InventoryCountOrderIdArgs {
|
|
7133
|
+
id;
|
|
7134
|
+
};
|
|
7135
|
+
tslib.__decorate([
|
|
7136
|
+
graphql.Field(() => graphql.ID),
|
|
7137
|
+
tslib.__metadata("design:type", String)
|
|
7138
|
+
], InventoryCountOrderIdArgs.prototype, "id", void 0);
|
|
7139
|
+
InventoryCountOrderIdArgs = tslib.__decorate([
|
|
7140
|
+
graphql.ArgsType()
|
|
7141
|
+
], InventoryCountOrderIdArgs);
|
|
7142
|
+
|
|
7143
|
+
let InventoryCountOrderQuery = class InventoryCountOrderQuery {
|
|
7144
|
+
inventoryCountOrderService;
|
|
7145
|
+
constructor(inventoryCountOrderService) {
|
|
7146
|
+
this.inventoryCountOrderService = inventoryCountOrderService;
|
|
7147
|
+
}
|
|
7148
|
+
async inventoryCountOrders(args) {
|
|
7149
|
+
const [items, total] = await this.inventoryCountOrderService.findMany(args);
|
|
7150
|
+
return { items, total };
|
|
7151
|
+
}
|
|
7152
|
+
async inventoryCountOrder({ id }) {
|
|
7153
|
+
return this.inventoryCountOrderService.findOne(id);
|
|
7154
|
+
}
|
|
7155
|
+
};
|
|
7156
|
+
tslib.__decorate([
|
|
7157
|
+
graphql.Query(() => InventoryCountOrders),
|
|
7158
|
+
WmsOperation({ resource: 'inventory-count-order', action: 'read' }),
|
|
7159
|
+
tslib.__param(0, graphql.Args()),
|
|
7160
|
+
tslib.__metadata("design:type", Function),
|
|
7161
|
+
tslib.__metadata("design:paramtypes", [FindInventoryCountOrderArgs]),
|
|
7162
|
+
tslib.__metadata("design:returntype", Promise)
|
|
7163
|
+
], InventoryCountOrderQuery.prototype, "inventoryCountOrders", null);
|
|
7164
|
+
tslib.__decorate([
|
|
7165
|
+
graphql.Query(() => InventoryCountOrderDto),
|
|
7166
|
+
WmsOperation({ resource: 'inventory-count-order', action: 'read' }),
|
|
7167
|
+
tslib.__param(0, graphql.Args()),
|
|
7168
|
+
tslib.__metadata("design:type", Function),
|
|
7169
|
+
tslib.__metadata("design:paramtypes", [InventoryCountOrderIdArgs]),
|
|
7170
|
+
tslib.__metadata("design:returntype", Promise)
|
|
7171
|
+
], InventoryCountOrderQuery.prototype, "inventoryCountOrder", null);
|
|
7172
|
+
InventoryCountOrderQuery = tslib.__decorate([
|
|
7173
|
+
common.Injectable(),
|
|
7174
|
+
tslib.__metadata("design:paramtypes", [wmsModuleCore.InventoryCountOrderService])
|
|
7175
|
+
], InventoryCountOrderQuery);
|
|
7176
|
+
|
|
7177
|
+
let InventoryCountOrderMutation = class InventoryCountOrderMutation {
|
|
7178
|
+
inventoryCountOrderService;
|
|
7179
|
+
constructor(inventoryCountOrderService) {
|
|
7180
|
+
this.inventoryCountOrderService = inventoryCountOrderService;
|
|
7181
|
+
}
|
|
7182
|
+
async createInventoryCountOrder(args) {
|
|
7183
|
+
return this.inventoryCountOrderService.create(args);
|
|
7184
|
+
}
|
|
7185
|
+
async updateInventoryCountOrder({ id, ...input }) {
|
|
7186
|
+
return this.inventoryCountOrderService.update(id, input);
|
|
7187
|
+
}
|
|
7188
|
+
async startInventoryCount({ id }) {
|
|
7189
|
+
return this.inventoryCountOrderService.start(id);
|
|
7190
|
+
}
|
|
7191
|
+
/** "暫存結果" — record what was counted without touching stock. */
|
|
7192
|
+
async countInventory({ id, items }) {
|
|
7193
|
+
return this.inventoryCountOrderService.count(id, items.map((item) => ({
|
|
7194
|
+
itemId: item.itemId,
|
|
7195
|
+
countedQuantity: item.countedQuantity ?? null,
|
|
7196
|
+
unitId: item.unitId,
|
|
7197
|
+
})));
|
|
7198
|
+
}
|
|
7199
|
+
async addInventoryCountItem({ id, ...input }) {
|
|
7200
|
+
return this.inventoryCountOrderService.addItem(id, input);
|
|
7201
|
+
}
|
|
7202
|
+
async removeInventoryCountItem({ id, itemId }) {
|
|
7203
|
+
return this.inventoryCountOrderService.removeItem(id, itemId);
|
|
7204
|
+
}
|
|
7205
|
+
/** "清空重填" — discard the counting, keep the lock and the status. */
|
|
7206
|
+
async resetInventoryCount({ id }) {
|
|
7207
|
+
return this.inventoryCountOrderService.reset(id);
|
|
7208
|
+
}
|
|
7209
|
+
async cancelInventoryCount({ id }) {
|
|
7210
|
+
return this.inventoryCountOrderService.cancel(id);
|
|
7211
|
+
}
|
|
7212
|
+
/** "執行盤差" — the only mutation here that changes stock. */
|
|
7213
|
+
async settleInventoryCount({ id }) {
|
|
7214
|
+
return this.inventoryCountOrderService.settle(id);
|
|
7215
|
+
}
|
|
7216
|
+
};
|
|
7217
|
+
tslib.__decorate([
|
|
7218
|
+
graphql.Mutation(() => InventoryCountOrderDto),
|
|
7219
|
+
WmsOperation({ resource: 'inventory-count-order', action: 'create' }),
|
|
7220
|
+
WmsMutationEvent({ event: 'inventory-count-order.created' }),
|
|
7221
|
+
tslib.__param(0, graphql.Args()),
|
|
7222
|
+
tslib.__metadata("design:type", Function),
|
|
7223
|
+
tslib.__metadata("design:paramtypes", [CreateInventoryCountOrderArgs]),
|
|
7224
|
+
tslib.__metadata("design:returntype", Promise)
|
|
7225
|
+
], InventoryCountOrderMutation.prototype, "createInventoryCountOrder", null);
|
|
7226
|
+
tslib.__decorate([
|
|
7227
|
+
graphql.Mutation(() => InventoryCountOrderDto),
|
|
7228
|
+
WmsOperation({ resource: 'inventory-count-order', action: 'update' }),
|
|
7229
|
+
WmsMutationEvent({ event: 'inventory-count-order.updated' }),
|
|
7230
|
+
tslib.__param(0, graphql.Args()),
|
|
7231
|
+
tslib.__metadata("design:type", Function),
|
|
7232
|
+
tslib.__metadata("design:paramtypes", [UpdateInventoryCountOrderArgs]),
|
|
7233
|
+
tslib.__metadata("design:returntype", Promise)
|
|
7234
|
+
], InventoryCountOrderMutation.prototype, "updateInventoryCountOrder", null);
|
|
7235
|
+
tslib.__decorate([
|
|
7236
|
+
graphql.Mutation(() => InventoryCountOrderDto),
|
|
7237
|
+
WmsOperation({ resource: 'inventory-count-order', action: 'start' }),
|
|
7238
|
+
WmsMutationEvent({ event: 'inventory-count-order.started' }),
|
|
7239
|
+
tslib.__param(0, graphql.Args()),
|
|
7240
|
+
tslib.__metadata("design:type", Function),
|
|
7241
|
+
tslib.__metadata("design:paramtypes", [InventoryCountOrderIdArgs]),
|
|
7242
|
+
tslib.__metadata("design:returntype", Promise)
|
|
7243
|
+
], InventoryCountOrderMutation.prototype, "startInventoryCount", null);
|
|
7244
|
+
tslib.__decorate([
|
|
7245
|
+
graphql.Mutation(() => InventoryCountOrderDto),
|
|
7246
|
+
WmsOperation({ resource: 'inventory-count-order', action: 'count' }),
|
|
7247
|
+
WmsMutationEvent({ event: 'inventory-count-order.counted' }),
|
|
7248
|
+
tslib.__param(0, graphql.Args()),
|
|
7249
|
+
tslib.__metadata("design:type", Function),
|
|
7250
|
+
tslib.__metadata("design:paramtypes", [CountInventoryArgs]),
|
|
7251
|
+
tslib.__metadata("design:returntype", Promise)
|
|
7252
|
+
], InventoryCountOrderMutation.prototype, "countInventory", null);
|
|
7253
|
+
tslib.__decorate([
|
|
7254
|
+
graphql.Mutation(() => InventoryCountOrderItemDto),
|
|
7255
|
+
WmsOperation({ resource: 'inventory-count-order', action: 'add-item' }),
|
|
7256
|
+
WmsMutationEvent({ event: 'inventory-count-order.updated' }),
|
|
7257
|
+
tslib.__param(0, graphql.Args()),
|
|
7258
|
+
tslib.__metadata("design:type", Function),
|
|
7259
|
+
tslib.__metadata("design:paramtypes", [AddInventoryCountItemArgs]),
|
|
7260
|
+
tslib.__metadata("design:returntype", Promise)
|
|
7261
|
+
], InventoryCountOrderMutation.prototype, "addInventoryCountItem", null);
|
|
7262
|
+
tslib.__decorate([
|
|
7263
|
+
graphql.Mutation(() => InventoryCountOrderDto),
|
|
7264
|
+
WmsOperation({ resource: 'inventory-count-order', action: 'remove-item' }),
|
|
7265
|
+
WmsMutationEvent({ event: 'inventory-count-order.updated' }),
|
|
7266
|
+
tslib.__param(0, graphql.Args()),
|
|
7267
|
+
tslib.__metadata("design:type", Function),
|
|
7268
|
+
tslib.__metadata("design:paramtypes", [RemoveInventoryCountItemArgs]),
|
|
7269
|
+
tslib.__metadata("design:returntype", Promise)
|
|
7270
|
+
], InventoryCountOrderMutation.prototype, "removeInventoryCountItem", null);
|
|
7271
|
+
tslib.__decorate([
|
|
7272
|
+
graphql.Mutation(() => InventoryCountOrderDto),
|
|
7273
|
+
WmsOperation({ resource: 'inventory-count-order', action: 'reset' }),
|
|
7274
|
+
WmsMutationEvent({ event: 'inventory-count-order.reset' }),
|
|
7275
|
+
tslib.__param(0, graphql.Args()),
|
|
7276
|
+
tslib.__metadata("design:type", Function),
|
|
7277
|
+
tslib.__metadata("design:paramtypes", [InventoryCountOrderIdArgs]),
|
|
7278
|
+
tslib.__metadata("design:returntype", Promise)
|
|
7279
|
+
], InventoryCountOrderMutation.prototype, "resetInventoryCount", null);
|
|
7280
|
+
tslib.__decorate([
|
|
7281
|
+
graphql.Mutation(() => InventoryCountOrderDto),
|
|
7282
|
+
WmsOperation({ resource: 'inventory-count-order', action: 'cancel' }),
|
|
7283
|
+
WmsMutationEvent({ event: 'inventory-count-order.cancelled' }),
|
|
7284
|
+
tslib.__param(0, graphql.Args()),
|
|
7285
|
+
tslib.__metadata("design:type", Function),
|
|
7286
|
+
tslib.__metadata("design:paramtypes", [InventoryCountOrderIdArgs]),
|
|
7287
|
+
tslib.__metadata("design:returntype", Promise)
|
|
7288
|
+
], InventoryCountOrderMutation.prototype, "cancelInventoryCount", null);
|
|
7289
|
+
tslib.__decorate([
|
|
7290
|
+
graphql.Mutation(() => InventoryCountOrderDto),
|
|
7291
|
+
WmsOperation({ resource: 'inventory-count-order', action: 'settle' }),
|
|
7292
|
+
WmsMutationEvent({ event: 'inventory-count-order.settled' }),
|
|
7293
|
+
tslib.__param(0, graphql.Args()),
|
|
7294
|
+
tslib.__metadata("design:type", Function),
|
|
7295
|
+
tslib.__metadata("design:paramtypes", [InventoryCountOrderIdArgs]),
|
|
7296
|
+
tslib.__metadata("design:returntype", Promise)
|
|
7297
|
+
], InventoryCountOrderMutation.prototype, "settleInventoryCount", null);
|
|
7298
|
+
InventoryCountOrderMutation = tslib.__decorate([
|
|
7299
|
+
common.Injectable(),
|
|
7300
|
+
tslib.__metadata("design:paramtypes", [wmsModuleCore.InventoryCountOrderService])
|
|
7301
|
+
], InventoryCountOrderMutation);
|
|
7302
|
+
|
|
7303
|
+
let InventoryCountOrderResolver = class InventoryCountOrderResolver {
|
|
7304
|
+
entities;
|
|
7305
|
+
constructor(entities) {
|
|
7306
|
+
this.entities = entities;
|
|
7307
|
+
}
|
|
7308
|
+
items({ id }, { loaders }) {
|
|
7309
|
+
return loaders.batchMany.load({
|
|
7310
|
+
__entity: wmsModuleCore.InventoryCountOrderItemEntityClass,
|
|
7311
|
+
__from: { orderId: id },
|
|
7312
|
+
});
|
|
7313
|
+
}
|
|
7314
|
+
/**
|
|
7315
|
+
* The locations the user picked.
|
|
7316
|
+
*
|
|
7317
|
+
* Only the roots: the scope table also holds every descendant the backend
|
|
7318
|
+
* expanded into, and listing a whole aisle's shelves as chips would bury the
|
|
7319
|
+
* one thing the operator actually chose. The expansion still exists in the
|
|
7320
|
+
* database — it is what the lock reads — it just is not this field.
|
|
7321
|
+
*/
|
|
7322
|
+
async locations({ id }, { loaders }) {
|
|
7323
|
+
const scope = (await loaders.batchMany.load({
|
|
7324
|
+
__entity: wmsModuleCore.InventoryCountOrderLocationEntityClass,
|
|
7325
|
+
__from: { orderId: id },
|
|
7326
|
+
}));
|
|
7327
|
+
// The join rows carry `locationId`, not a loaded `location` relation, so
|
|
7328
|
+
// each one has to go back through the location DataLoader. Returning
|
|
7329
|
+
// `row.location` directly yields `undefined`, and the non-nullable list then
|
|
7330
|
+
// fails the whole query with "Cannot return null for non-nullable field".
|
|
7331
|
+
return Promise.all(scope
|
|
7332
|
+
.filter(({ isRoot }) => isRoot)
|
|
7333
|
+
.map(({ locationId }) => loaders.batchSingle.load({
|
|
7334
|
+
__entity: this.entities.location,
|
|
7335
|
+
__from: { id: locationId },
|
|
7336
|
+
})));
|
|
7337
|
+
}
|
|
7338
|
+
};
|
|
7339
|
+
tslib.__decorate([
|
|
7340
|
+
graphql.ResolveField(() => [InventoryCountOrderItemDto]),
|
|
7341
|
+
tslib.__param(0, graphql.Parent()),
|
|
7342
|
+
tslib.__param(1, graphql.Context()),
|
|
7343
|
+
tslib.__metadata("design:type", Function),
|
|
7344
|
+
tslib.__metadata("design:paramtypes", [InventoryCountOrderDto, Object]),
|
|
7345
|
+
tslib.__metadata("design:returntype", Promise)
|
|
7346
|
+
], InventoryCountOrderResolver.prototype, "items", null);
|
|
7347
|
+
tslib.__decorate([
|
|
7348
|
+
graphql.ResolveField(() => [LocationDto]),
|
|
7349
|
+
tslib.__param(0, graphql.Parent()),
|
|
7350
|
+
tslib.__param(1, graphql.Context()),
|
|
7351
|
+
tslib.__metadata("design:type", Function),
|
|
7352
|
+
tslib.__metadata("design:paramtypes", [InventoryCountOrderDto, Object]),
|
|
7353
|
+
tslib.__metadata("design:returntype", Promise)
|
|
7354
|
+
], InventoryCountOrderResolver.prototype, "locations", null);
|
|
7355
|
+
InventoryCountOrderResolver = tslib.__decorate([
|
|
7356
|
+
graphql.Resolver(() => InventoryCountOrderDto),
|
|
7357
|
+
tslib.__metadata("design:paramtypes", [wmsModuleCore.WmsEntities])
|
|
7358
|
+
], InventoryCountOrderResolver);
|
|
7359
|
+
let InventoryCountOrderItemResolver = class InventoryCountOrderItemResolver {
|
|
7360
|
+
entities;
|
|
7361
|
+
/**
|
|
7362
|
+
* The configured entities, not the built-in classes: `__entity` decides which
|
|
7363
|
+
* repository the DataLoader opens, so it has to follow whatever the consumer
|
|
7364
|
+
* passed to `WMSBaseModuleOptions`.
|
|
7365
|
+
*/
|
|
7366
|
+
constructor(entities) {
|
|
7367
|
+
this.entities = entities;
|
|
7368
|
+
}
|
|
7369
|
+
material({ materialId }, { loaders }) {
|
|
7370
|
+
return loaders.batchSingle.load({
|
|
7371
|
+
__entity: this.entities.material,
|
|
7372
|
+
__from: { id: materialId },
|
|
7373
|
+
});
|
|
7374
|
+
}
|
|
7375
|
+
async batch({ batchId }, { loaders }) {
|
|
7376
|
+
const { groupId } = await loaders.batchSingle.load({
|
|
7377
|
+
__entity: this.entities.batch,
|
|
7378
|
+
__from: { id: batchId },
|
|
7379
|
+
});
|
|
7380
|
+
return loaders.batchSingle.load({
|
|
7381
|
+
__entity: wmsModuleCore.BatchGroupEntityClass,
|
|
7382
|
+
__from: { id: groupId },
|
|
7383
|
+
});
|
|
7384
|
+
}
|
|
7385
|
+
location({ locationId }, { loaders }) {
|
|
7386
|
+
if (!locationId) {
|
|
7387
|
+
return null;
|
|
7388
|
+
}
|
|
7389
|
+
return loaders.batchSingle.load({
|
|
7390
|
+
__entity: this.entities.location,
|
|
7391
|
+
__from: { id: locationId },
|
|
7392
|
+
});
|
|
7393
|
+
}
|
|
7394
|
+
loader({ loaderId }, { loaders }) {
|
|
7395
|
+
if (!loaderId) {
|
|
7396
|
+
return null;
|
|
7397
|
+
}
|
|
7398
|
+
return loaders.batchSingle.load({
|
|
7399
|
+
__entity: wmsModuleCore.LoadersEntityClass,
|
|
7400
|
+
__from: { id: loaderId },
|
|
7401
|
+
});
|
|
7402
|
+
}
|
|
7403
|
+
};
|
|
7404
|
+
tslib.__decorate([
|
|
7405
|
+
graphql.ResolveField(() => MaterialDto),
|
|
7406
|
+
tslib.__param(0, graphql.Parent()),
|
|
7407
|
+
tslib.__param(1, graphql.Context()),
|
|
7408
|
+
tslib.__metadata("design:type", Function),
|
|
7409
|
+
tslib.__metadata("design:paramtypes", [InventoryCountOrderItemDto, Object]),
|
|
7410
|
+
tslib.__metadata("design:returntype", Promise)
|
|
7411
|
+
], InventoryCountOrderItemResolver.prototype, "material", null);
|
|
7412
|
+
tslib.__decorate([
|
|
7413
|
+
graphql.ResolveField(() => BatchDto),
|
|
7414
|
+
tslib.__param(0, graphql.Parent()),
|
|
7415
|
+
tslib.__param(1, graphql.Context()),
|
|
7416
|
+
tslib.__metadata("design:type", Function),
|
|
7417
|
+
tslib.__metadata("design:paramtypes", [InventoryCountOrderItemDto, Object]),
|
|
7418
|
+
tslib.__metadata("design:returntype", Promise)
|
|
7419
|
+
], InventoryCountOrderItemResolver.prototype, "batch", null);
|
|
7420
|
+
tslib.__decorate([
|
|
7421
|
+
graphql.ResolveField(() => LocationDto, { nullable: true }),
|
|
7422
|
+
tslib.__param(0, graphql.Parent()),
|
|
7423
|
+
tslib.__param(1, graphql.Context()),
|
|
7424
|
+
tslib.__metadata("design:type", Function),
|
|
7425
|
+
tslib.__metadata("design:paramtypes", [InventoryCountOrderItemDto, Object]),
|
|
7426
|
+
tslib.__metadata("design:returntype", Object)
|
|
7427
|
+
], InventoryCountOrderItemResolver.prototype, "location", null);
|
|
7428
|
+
tslib.__decorate([
|
|
7429
|
+
graphql.ResolveField(() => LoaderDto, { nullable: true }),
|
|
7430
|
+
tslib.__param(0, graphql.Parent()),
|
|
7431
|
+
tslib.__param(1, graphql.Context()),
|
|
7432
|
+
tslib.__metadata("design:type", Function),
|
|
7433
|
+
tslib.__metadata("design:paramtypes", [InventoryCountOrderItemDto, Object]),
|
|
7434
|
+
tslib.__metadata("design:returntype", Object)
|
|
7435
|
+
], InventoryCountOrderItemResolver.prototype, "loader", null);
|
|
7436
|
+
InventoryCountOrderItemResolver = tslib.__decorate([
|
|
7437
|
+
graphql.Resolver(() => InventoryCountOrderItemDto),
|
|
7438
|
+
tslib.__metadata("design:paramtypes", [wmsModuleCore.WmsEntities])
|
|
7439
|
+
], InventoryCountOrderItemResolver);
|
|
7440
|
+
|
|
6650
7441
|
var WmsModuleGraphqlModule_1;
|
|
6651
7442
|
const exportDependencies = [
|
|
6652
7443
|
UnitQuery,
|
|
@@ -6701,10 +7492,23 @@ const exportDependencies = [
|
|
|
6701
7492
|
QualityInspectionOrderMutation,
|
|
6702
7493
|
WarehouseMapDataQuery,
|
|
6703
7494
|
MapRangeUnionResolver,
|
|
7495
|
+
InventoryCountOrderQuery,
|
|
7496
|
+
InventoryCountOrderMutation,
|
|
7497
|
+
InventoryCountOrderResolver,
|
|
7498
|
+
InventoryCountOrderItemResolver,
|
|
6704
7499
|
];
|
|
6705
7500
|
exports.WmsModuleGraphqlModule = WmsModuleGraphqlModule_1 = class WmsModuleGraphqlModule {
|
|
6706
7501
|
static forRootAsync(options) {
|
|
6707
|
-
const { authChecker, beforeHooks, afterListeners, actorExtractor, eventEmitterBridge, ...coreOptions } = options;
|
|
7502
|
+
const { authChecker, beforeHooks, afterListeners, actorExtractor, eventEmitterBridge, enabledOperations, disabledOperations, disabledFields, ...coreOptions } = options;
|
|
7503
|
+
// Must run before `GraphQLModule` builds the schema. `forRootAsync` is
|
|
7504
|
+
// called while `AppModule` is still being defined, so this is the earliest
|
|
7505
|
+
// point at which the deployment's switches are known — and it is early
|
|
7506
|
+
// enough: the schema is not built until the app bootstraps.
|
|
7507
|
+
pruneDisabledOperations(exportDependencies, {
|
|
7508
|
+
enabledOperations,
|
|
7509
|
+
disabledOperations,
|
|
7510
|
+
disabledFields,
|
|
7511
|
+
});
|
|
6708
7512
|
// coreOptions still carries `enrichStockEvents`, forwarded to the core module.
|
|
6709
7513
|
const coreModule = wmsModuleCore.WmsModuleCoreModule.forRootAsync(coreOptions);
|
|
6710
7514
|
const authOptions = { authChecker };
|
|
@@ -6739,6 +7543,10 @@ exports.WmsModuleGraphqlModule = WmsModuleGraphqlModule_1 = tslib.__decorate([
|
|
|
6739
7543
|
})
|
|
6740
7544
|
], exports.WmsModuleGraphqlModule);
|
|
6741
7545
|
|
|
7546
|
+
Object.defineProperty(exports, "WMS_OPERATION_NAMES", {
|
|
7547
|
+
enumerable: true,
|
|
7548
|
+
get: function () { return wmsModuleCore.WMS_OPERATION_NAMES; }
|
|
7549
|
+
});
|
|
6742
7550
|
exports.HOST_SKIP_METADATA_KEY = HOST_SKIP_METADATA_KEY;
|
|
6743
7551
|
exports.WMS_AUTH_OPTIONS = WMS_AUTH_OPTIONS;
|
|
6744
7552
|
exports.WMS_MUTATION_EVENT_METADATA = WMS_MUTATION_EVENT_METADATA;
|
|
@@ -6746,3 +7554,4 @@ exports.WMS_OPERATION_METADATA = WMS_OPERATION_METADATA;
|
|
|
6746
7554
|
exports.WmsMutationEvent = WmsMutationEvent;
|
|
6747
7555
|
exports.WmsOperation = WmsOperation;
|
|
6748
7556
|
exports.createWmsLoaders = createWmsLoaders;
|
|
7557
|
+
exports.pruneDisabledOperations = pruneDisabledOperations;
|