@rytass/wms-module-graphql 0.8.0 → 0.10.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 +92 -2
- package/adapters/event-emitter.cjs.js +43 -0
- package/adapters/member-base.cjs.js +66 -0
- package/docs/api-reference.md +80 -1
- package/docs/events.md +23 -4
- package/docs/integration-guide.md +31 -17
- package/index.cjs.js +935 -1
- 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 +61 -0
- package/lib/dto/inventory-count-order.dto.js +197 -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/find-stock.args.d.ts +9 -0
- package/lib/inputs/find-stock.args.js +25 -0
- package/lib/inputs/inventory-count-order.args.d.ts +69 -0
- package/lib/inputs/inventory-count-order.args.js +257 -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 +17 -0
- package/lib/queries/inventory-count-order.query.js +63 -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.js +1 -0
- package/lib/resolvers/change-log.resolver.js +1 -0
- 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.js +1 -0
- package/lib/resolvers/material.resolver.js +1 -0
- package/lib/resolvers/receive-inventory-order.resolver.js +1 -0
- package/lib/resolvers/ship-inventory-order.resolver.js +1 -0
- package/lib/resolvers/stock.resolver.js +1 -0
- package/lib/resolvers/transfer-order.resolver.js +1 -0
- package/package.json +12 -6
package/index.cjs.js
CHANGED
|
@@ -465,6 +465,138 @@ exports.WmsMutationInterceptor = tslib.__decorate([
|
|
|
465
465
|
*/
|
|
466
466
|
const WmsMutationEvent = (config) => common.applyDecorators(common.SetMetadata(WMS_MUTATION_EVENT_METADATA, config), common.UseInterceptors(exports.WmsMutationInterceptor));
|
|
467
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
|
+
|
|
468
600
|
const IdGenFunction = (input) => {
|
|
469
601
|
const hash = crypto.createHash('sha256');
|
|
470
602
|
hash.update(input);
|
|
@@ -1602,6 +1734,197 @@ QualityInspectionOrders = tslib.__decorate([
|
|
|
1602
1734
|
graphql.ObjectType()
|
|
1603
1735
|
], QualityInspectionOrders);
|
|
1604
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
|
+
// ── Batch attributes as they were when counting started ────────────────── //
|
|
1764
|
+
//
|
|
1765
|
+
// Snapshotted rather than resolved live: the batch keeps moving after a count
|
|
1766
|
+
// settles, and a sheet that silently rewrites itself months later stops being
|
|
1767
|
+
// a record of what was found. `null` before counting has started.
|
|
1768
|
+
held;
|
|
1769
|
+
inShipment;
|
|
1770
|
+
/** `null` = awaiting inspection, `false` = failed, `true` = passed. */
|
|
1771
|
+
inspectionResult;
|
|
1772
|
+
transferId;
|
|
1773
|
+
vendorId;
|
|
1774
|
+
customerId;
|
|
1775
|
+
saleId;
|
|
1776
|
+
saleSerialId;
|
|
1777
|
+
};
|
|
1778
|
+
tslib.__decorate([
|
|
1779
|
+
graphql.Field(() => graphql.ID),
|
|
1780
|
+
tslib.__metadata("design:type", String)
|
|
1781
|
+
], InventoryCountOrderItemDto.prototype, "id", void 0);
|
|
1782
|
+
tslib.__decorate([
|
|
1783
|
+
graphql.Field(() => graphql.ID),
|
|
1784
|
+
tslib.__metadata("design:type", String)
|
|
1785
|
+
], InventoryCountOrderItemDto.prototype, "orderId", void 0);
|
|
1786
|
+
tslib.__decorate([
|
|
1787
|
+
graphql.Field(() => graphql.ID),
|
|
1788
|
+
tslib.__metadata("design:type", String)
|
|
1789
|
+
], InventoryCountOrderItemDto.prototype, "materialId", void 0);
|
|
1790
|
+
tslib.__decorate([
|
|
1791
|
+
graphql.Field(() => graphql.ID),
|
|
1792
|
+
tslib.__metadata("design:type", String)
|
|
1793
|
+
], InventoryCountOrderItemDto.prototype, "batchId", void 0);
|
|
1794
|
+
tslib.__decorate([
|
|
1795
|
+
graphql.Field(() => graphql.ID, { nullable: true }),
|
|
1796
|
+
tslib.__metadata("design:type", Object)
|
|
1797
|
+
], InventoryCountOrderItemDto.prototype, "locationId", void 0);
|
|
1798
|
+
tslib.__decorate([
|
|
1799
|
+
graphql.Field(() => graphql.ID, { nullable: true }),
|
|
1800
|
+
tslib.__metadata("design:type", Object)
|
|
1801
|
+
], InventoryCountOrderItemDto.prototype, "loaderId", void 0);
|
|
1802
|
+
tslib.__decorate([
|
|
1803
|
+
graphql.Field(() => graphql.ID, { nullable: true }),
|
|
1804
|
+
tslib.__metadata("design:type", Object)
|
|
1805
|
+
], InventoryCountOrderItemDto.prototype, "unitId", void 0);
|
|
1806
|
+
tslib.__decorate([
|
|
1807
|
+
graphql.Field(() => graphql.Float),
|
|
1808
|
+
tslib.__metadata("design:type", Number)
|
|
1809
|
+
], InventoryCountOrderItemDto.prototype, "bookQuantity", void 0);
|
|
1810
|
+
tslib.__decorate([
|
|
1811
|
+
graphql.Field(() => graphql.Float, { nullable: true }),
|
|
1812
|
+
tslib.__metadata("design:type", Object)
|
|
1813
|
+
], InventoryCountOrderItemDto.prototype, "countedQuantity", void 0);
|
|
1814
|
+
tslib.__decorate([
|
|
1815
|
+
graphql.Field(() => Boolean),
|
|
1816
|
+
tslib.__metadata("design:type", Boolean)
|
|
1817
|
+
], InventoryCountOrderItemDto.prototype, "isAddition", void 0);
|
|
1818
|
+
tslib.__decorate([
|
|
1819
|
+
graphql.Field(() => Boolean, { nullable: true }),
|
|
1820
|
+
tslib.__metadata("design:type", Object)
|
|
1821
|
+
], InventoryCountOrderItemDto.prototype, "held", void 0);
|
|
1822
|
+
tslib.__decorate([
|
|
1823
|
+
graphql.Field(() => Boolean, { nullable: true }),
|
|
1824
|
+
tslib.__metadata("design:type", Object)
|
|
1825
|
+
], InventoryCountOrderItemDto.prototype, "inShipment", void 0);
|
|
1826
|
+
tslib.__decorate([
|
|
1827
|
+
graphql.Field(() => Boolean, { nullable: true }),
|
|
1828
|
+
tslib.__metadata("design:type", Object)
|
|
1829
|
+
], InventoryCountOrderItemDto.prototype, "inspectionResult", void 0);
|
|
1830
|
+
tslib.__decorate([
|
|
1831
|
+
graphql.Field(() => graphql.ID, { nullable: true }),
|
|
1832
|
+
tslib.__metadata("design:type", Object)
|
|
1833
|
+
], InventoryCountOrderItemDto.prototype, "transferId", void 0);
|
|
1834
|
+
tslib.__decorate([
|
|
1835
|
+
graphql.Field(() => String, { nullable: true }),
|
|
1836
|
+
tslib.__metadata("design:type", Object)
|
|
1837
|
+
], InventoryCountOrderItemDto.prototype, "vendorId", void 0);
|
|
1838
|
+
tslib.__decorate([
|
|
1839
|
+
graphql.Field(() => String, { nullable: true }),
|
|
1840
|
+
tslib.__metadata("design:type", Object)
|
|
1841
|
+
], InventoryCountOrderItemDto.prototype, "customerId", void 0);
|
|
1842
|
+
tslib.__decorate([
|
|
1843
|
+
graphql.Field(() => String, { nullable: true }),
|
|
1844
|
+
tslib.__metadata("design:type", Object)
|
|
1845
|
+
], InventoryCountOrderItemDto.prototype, "saleId", void 0);
|
|
1846
|
+
tslib.__decorate([
|
|
1847
|
+
graphql.Field(() => String, { nullable: true }),
|
|
1848
|
+
tslib.__metadata("design:type", Object)
|
|
1849
|
+
], InventoryCountOrderItemDto.prototype, "saleSerialId", void 0);
|
|
1850
|
+
InventoryCountOrderItemDto = tslib.__decorate([
|
|
1851
|
+
graphql.ObjectType()
|
|
1852
|
+
], InventoryCountOrderItemDto);
|
|
1853
|
+
/**
|
|
1854
|
+
* A count order. `items` and `locations` come from
|
|
1855
|
+
* `InventoryCountOrderResolver`, for the same reason as above; `locations`
|
|
1856
|
+
* exposes the roots the user picked, not the expanded subtree.
|
|
1857
|
+
*/
|
|
1858
|
+
let InventoryCountOrderDto = class InventoryCountOrderDto {
|
|
1859
|
+
id;
|
|
1860
|
+
key;
|
|
1861
|
+
name;
|
|
1862
|
+
/**
|
|
1863
|
+
* The count's base date. Stock adjustments from settlement are reported under
|
|
1864
|
+
* this date rather than the day settlement happened to run.
|
|
1865
|
+
*/
|
|
1866
|
+
countDate;
|
|
1867
|
+
status;
|
|
1868
|
+
createdBy;
|
|
1869
|
+
startedAt;
|
|
1870
|
+
settledAt;
|
|
1871
|
+
cancelledAt;
|
|
1872
|
+
createdAt;
|
|
1873
|
+
};
|
|
1874
|
+
tslib.__decorate([
|
|
1875
|
+
graphql.Field(() => graphql.ID),
|
|
1876
|
+
tslib.__metadata("design:type", String)
|
|
1877
|
+
], InventoryCountOrderDto.prototype, "id", void 0);
|
|
1878
|
+
tslib.__decorate([
|
|
1879
|
+
graphql.Field(() => String),
|
|
1880
|
+
tslib.__metadata("design:type", String)
|
|
1881
|
+
], InventoryCountOrderDto.prototype, "key", void 0);
|
|
1882
|
+
tslib.__decorate([
|
|
1883
|
+
graphql.Field(() => String),
|
|
1884
|
+
tslib.__metadata("design:type", String)
|
|
1885
|
+
], InventoryCountOrderDto.prototype, "name", void 0);
|
|
1886
|
+
tslib.__decorate([
|
|
1887
|
+
graphql.Field(() => String),
|
|
1888
|
+
tslib.__metadata("design:type", String)
|
|
1889
|
+
], InventoryCountOrderDto.prototype, "countDate", void 0);
|
|
1890
|
+
tslib.__decorate([
|
|
1891
|
+
graphql.Field(() => wmsModuleCore.InventoryCountStatus),
|
|
1892
|
+
tslib.__metadata("design:type", String)
|
|
1893
|
+
], InventoryCountOrderDto.prototype, "status", void 0);
|
|
1894
|
+
tslib.__decorate([
|
|
1895
|
+
graphql.Field(() => String, { nullable: true }),
|
|
1896
|
+
tslib.__metadata("design:type", Object)
|
|
1897
|
+
], InventoryCountOrderDto.prototype, "createdBy", void 0);
|
|
1898
|
+
tslib.__decorate([
|
|
1899
|
+
graphql.Field(() => Date, { nullable: true }),
|
|
1900
|
+
tslib.__metadata("design:type", Object)
|
|
1901
|
+
], InventoryCountOrderDto.prototype, "startedAt", void 0);
|
|
1902
|
+
tslib.__decorate([
|
|
1903
|
+
graphql.Field(() => Date, { nullable: true }),
|
|
1904
|
+
tslib.__metadata("design:type", Object)
|
|
1905
|
+
], InventoryCountOrderDto.prototype, "settledAt", void 0);
|
|
1906
|
+
tslib.__decorate([
|
|
1907
|
+
graphql.Field(() => Date, { nullable: true }),
|
|
1908
|
+
tslib.__metadata("design:type", Object)
|
|
1909
|
+
], InventoryCountOrderDto.prototype, "cancelledAt", void 0);
|
|
1910
|
+
tslib.__decorate([
|
|
1911
|
+
graphql.Field(() => Date),
|
|
1912
|
+
tslib.__metadata("design:type", Date)
|
|
1913
|
+
], InventoryCountOrderDto.prototype, "createdAt", void 0);
|
|
1914
|
+
InventoryCountOrderDto = tslib.__decorate([
|
|
1915
|
+
graphql.ObjectType()
|
|
1916
|
+
], InventoryCountOrderDto);
|
|
1917
|
+
let InventoryCountOrderItems = class InventoryCountOrderItems extends PaginatedResponse(InventoryCountOrderItemDto) {
|
|
1918
|
+
};
|
|
1919
|
+
InventoryCountOrderItems = tslib.__decorate([
|
|
1920
|
+
graphql.ObjectType()
|
|
1921
|
+
], InventoryCountOrderItems);
|
|
1922
|
+
let InventoryCountOrders = class InventoryCountOrders extends PaginatedResponse(InventoryCountOrderDto) {
|
|
1923
|
+
};
|
|
1924
|
+
InventoryCountOrders = tslib.__decorate([
|
|
1925
|
+
graphql.ObjectType()
|
|
1926
|
+
], InventoryCountOrders);
|
|
1927
|
+
|
|
1605
1928
|
let CreateLoaderTypeArgs = class CreateLoaderTypeArgs {
|
|
1606
1929
|
description;
|
|
1607
1930
|
key;
|
|
@@ -2284,6 +2607,15 @@ let FindStockArgs = class FindStockArgs extends PaginationArgs {
|
|
|
2284
2607
|
batchKey;
|
|
2285
2608
|
locationKey;
|
|
2286
2609
|
loaderKey;
|
|
2610
|
+
/**
|
|
2611
|
+
* Commercial attributes carried by the stock's batch. Matched exactly — they
|
|
2612
|
+
* are identifiers from the host system, and a partial match on 「SO-1」 would
|
|
2613
|
+
* quietly sweep in 「SO-10」.
|
|
2614
|
+
*/
|
|
2615
|
+
vendorId;
|
|
2616
|
+
customerId;
|
|
2617
|
+
saleId;
|
|
2618
|
+
saleSerialId;
|
|
2287
2619
|
};
|
|
2288
2620
|
tslib.__decorate([
|
|
2289
2621
|
graphql.Field(() => graphql.ID, { nullable: true }),
|
|
@@ -2329,6 +2661,22 @@ tslib.__decorate([
|
|
|
2329
2661
|
graphql.Field(() => String, { nullable: true }),
|
|
2330
2662
|
tslib.__metadata("design:type", String)
|
|
2331
2663
|
], FindStockArgs.prototype, "loaderKey", void 0);
|
|
2664
|
+
tslib.__decorate([
|
|
2665
|
+
graphql.Field(() => String, { nullable: true }),
|
|
2666
|
+
tslib.__metadata("design:type", String)
|
|
2667
|
+
], FindStockArgs.prototype, "vendorId", void 0);
|
|
2668
|
+
tslib.__decorate([
|
|
2669
|
+
graphql.Field(() => String, { nullable: true }),
|
|
2670
|
+
tslib.__metadata("design:type", String)
|
|
2671
|
+
], FindStockArgs.prototype, "customerId", void 0);
|
|
2672
|
+
tslib.__decorate([
|
|
2673
|
+
graphql.Field(() => String, { nullable: true }),
|
|
2674
|
+
tslib.__metadata("design:type", String)
|
|
2675
|
+
], FindStockArgs.prototype, "saleId", void 0);
|
|
2676
|
+
tslib.__decorate([
|
|
2677
|
+
graphql.Field(() => String, { nullable: true }),
|
|
2678
|
+
tslib.__metadata("design:type", String)
|
|
2679
|
+
], FindStockArgs.prototype, "saleSerialId", void 0);
|
|
2332
2680
|
FindStockArgs = tslib.__decorate([
|
|
2333
2681
|
graphql.ArgsType()
|
|
2334
2682
|
], FindStockArgs);
|
|
@@ -6678,6 +7026,574 @@ MapRangeUnionResolver = tslib.__decorate([
|
|
|
6678
7026
|
tslib.__metadata("design:paramtypes", [wmsModuleCore.WmsEntities])
|
|
6679
7027
|
], MapRangeUnionResolver);
|
|
6680
7028
|
|
|
7029
|
+
let FindInventoryCountOrderArgs = class FindInventoryCountOrderArgs extends PaginationArgs {
|
|
7030
|
+
name;
|
|
7031
|
+
statuses;
|
|
7032
|
+
createdBy;
|
|
7033
|
+
/** Inclusive lower bound on `countDate`, `YYYY-MM-DD`. */
|
|
7034
|
+
countDateFrom;
|
|
7035
|
+
/** Inclusive upper bound on `countDate`, `YYYY-MM-DD`. */
|
|
7036
|
+
countDateTo;
|
|
7037
|
+
/**
|
|
7038
|
+
* Matches against the expanded scope, not the roots the user picked, so
|
|
7039
|
+
* filtering by a shelf finds the count that covers its whole aisle.
|
|
7040
|
+
*/
|
|
7041
|
+
locationIds;
|
|
7042
|
+
};
|
|
7043
|
+
tslib.__decorate([
|
|
7044
|
+
graphql.Field(() => String, { nullable: true }),
|
|
7045
|
+
tslib.__metadata("design:type", String)
|
|
7046
|
+
], FindInventoryCountOrderArgs.prototype, "name", void 0);
|
|
7047
|
+
tslib.__decorate([
|
|
7048
|
+
graphql.Field(() => [wmsModuleCore.InventoryCountStatus], { nullable: true }),
|
|
7049
|
+
tslib.__metadata("design:type", Array)
|
|
7050
|
+
], FindInventoryCountOrderArgs.prototype, "statuses", void 0);
|
|
7051
|
+
tslib.__decorate([
|
|
7052
|
+
graphql.Field(() => String, { nullable: true }),
|
|
7053
|
+
tslib.__metadata("design:type", String)
|
|
7054
|
+
], FindInventoryCountOrderArgs.prototype, "createdBy", void 0);
|
|
7055
|
+
tslib.__decorate([
|
|
7056
|
+
graphql.Field(() => String, { nullable: true }),
|
|
7057
|
+
tslib.__metadata("design:type", String)
|
|
7058
|
+
], FindInventoryCountOrderArgs.prototype, "countDateFrom", void 0);
|
|
7059
|
+
tslib.__decorate([
|
|
7060
|
+
graphql.Field(() => String, { nullable: true }),
|
|
7061
|
+
tslib.__metadata("design:type", String)
|
|
7062
|
+
], FindInventoryCountOrderArgs.prototype, "countDateTo", void 0);
|
|
7063
|
+
tslib.__decorate([
|
|
7064
|
+
graphql.Field(() => [graphql.ID], { nullable: true }),
|
|
7065
|
+
tslib.__metadata("design:type", Array)
|
|
7066
|
+
], FindInventoryCountOrderArgs.prototype, "locationIds", void 0);
|
|
7067
|
+
FindInventoryCountOrderArgs = tslib.__decorate([
|
|
7068
|
+
graphql.ArgsType()
|
|
7069
|
+
], FindInventoryCountOrderArgs);
|
|
7070
|
+
let FindInventoryCountOrderItemArgs = class FindInventoryCountOrderItemArgs extends PaginationArgs {
|
|
7071
|
+
id;
|
|
7072
|
+
materialKey;
|
|
7073
|
+
materialDescription;
|
|
7074
|
+
batchKey;
|
|
7075
|
+
locationKey;
|
|
7076
|
+
loaderSerialId;
|
|
7077
|
+
vendorId;
|
|
7078
|
+
customerId;
|
|
7079
|
+
saleId;
|
|
7080
|
+
saleSerialId;
|
|
7081
|
+
/** Only lines whose counted quantity differs from the books (顯示盤差項目). */
|
|
7082
|
+
onlyVariance;
|
|
7083
|
+
};
|
|
7084
|
+
tslib.__decorate([
|
|
7085
|
+
graphql.Field(() => graphql.ID),
|
|
7086
|
+
tslib.__metadata("design:type", String)
|
|
7087
|
+
], FindInventoryCountOrderItemArgs.prototype, "id", void 0);
|
|
7088
|
+
tslib.__decorate([
|
|
7089
|
+
graphql.Field(() => String, { nullable: true }),
|
|
7090
|
+
tslib.__metadata("design:type", String)
|
|
7091
|
+
], FindInventoryCountOrderItemArgs.prototype, "materialKey", void 0);
|
|
7092
|
+
tslib.__decorate([
|
|
7093
|
+
graphql.Field(() => String, { nullable: true }),
|
|
7094
|
+
tslib.__metadata("design:type", String)
|
|
7095
|
+
], FindInventoryCountOrderItemArgs.prototype, "materialDescription", void 0);
|
|
7096
|
+
tslib.__decorate([
|
|
7097
|
+
graphql.Field(() => String, { nullable: true }),
|
|
7098
|
+
tslib.__metadata("design:type", String)
|
|
7099
|
+
], FindInventoryCountOrderItemArgs.prototype, "batchKey", void 0);
|
|
7100
|
+
tslib.__decorate([
|
|
7101
|
+
graphql.Field(() => String, { nullable: true }),
|
|
7102
|
+
tslib.__metadata("design:type", String)
|
|
7103
|
+
], FindInventoryCountOrderItemArgs.prototype, "locationKey", void 0);
|
|
7104
|
+
tslib.__decorate([
|
|
7105
|
+
graphql.Field(() => String, { nullable: true }),
|
|
7106
|
+
tslib.__metadata("design:type", String)
|
|
7107
|
+
], FindInventoryCountOrderItemArgs.prototype, "loaderSerialId", void 0);
|
|
7108
|
+
tslib.__decorate([
|
|
7109
|
+
graphql.Field(() => String, { nullable: true }),
|
|
7110
|
+
tslib.__metadata("design:type", String)
|
|
7111
|
+
], FindInventoryCountOrderItemArgs.prototype, "vendorId", void 0);
|
|
7112
|
+
tslib.__decorate([
|
|
7113
|
+
graphql.Field(() => String, { nullable: true }),
|
|
7114
|
+
tslib.__metadata("design:type", String)
|
|
7115
|
+
], FindInventoryCountOrderItemArgs.prototype, "customerId", void 0);
|
|
7116
|
+
tslib.__decorate([
|
|
7117
|
+
graphql.Field(() => String, { nullable: true }),
|
|
7118
|
+
tslib.__metadata("design:type", String)
|
|
7119
|
+
], FindInventoryCountOrderItemArgs.prototype, "saleId", void 0);
|
|
7120
|
+
tslib.__decorate([
|
|
7121
|
+
graphql.Field(() => String, { nullable: true }),
|
|
7122
|
+
tslib.__metadata("design:type", String)
|
|
7123
|
+
], FindInventoryCountOrderItemArgs.prototype, "saleSerialId", void 0);
|
|
7124
|
+
tslib.__decorate([
|
|
7125
|
+
graphql.Field(() => Boolean, { nullable: true }),
|
|
7126
|
+
tslib.__metadata("design:type", Boolean)
|
|
7127
|
+
], FindInventoryCountOrderItemArgs.prototype, "onlyVariance", void 0);
|
|
7128
|
+
FindInventoryCountOrderItemArgs = tslib.__decorate([
|
|
7129
|
+
graphql.ArgsType()
|
|
7130
|
+
], FindInventoryCountOrderItemArgs);
|
|
7131
|
+
let CreateInventoryCountOrderArgs = class CreateInventoryCountOrderArgs {
|
|
7132
|
+
name;
|
|
7133
|
+
countDate;
|
|
7134
|
+
/** Root locations; every descendant is pulled into scope automatically. */
|
|
7135
|
+
locationIds;
|
|
7136
|
+
};
|
|
7137
|
+
tslib.__decorate([
|
|
7138
|
+
graphql.Field(() => String),
|
|
7139
|
+
tslib.__metadata("design:type", String)
|
|
7140
|
+
], CreateInventoryCountOrderArgs.prototype, "name", void 0);
|
|
7141
|
+
tslib.__decorate([
|
|
7142
|
+
graphql.Field(() => String),
|
|
7143
|
+
tslib.__metadata("design:type", String)
|
|
7144
|
+
], CreateInventoryCountOrderArgs.prototype, "countDate", void 0);
|
|
7145
|
+
tslib.__decorate([
|
|
7146
|
+
graphql.Field(() => [graphql.ID]),
|
|
7147
|
+
tslib.__metadata("design:type", Array)
|
|
7148
|
+
], CreateInventoryCountOrderArgs.prototype, "locationIds", void 0);
|
|
7149
|
+
CreateInventoryCountOrderArgs = tslib.__decorate([
|
|
7150
|
+
graphql.ArgsType()
|
|
7151
|
+
], CreateInventoryCountOrderArgs);
|
|
7152
|
+
let UpdateInventoryCountOrderArgs = class UpdateInventoryCountOrderArgs {
|
|
7153
|
+
id;
|
|
7154
|
+
name;
|
|
7155
|
+
countDate;
|
|
7156
|
+
locationIds;
|
|
7157
|
+
};
|
|
7158
|
+
tslib.__decorate([
|
|
7159
|
+
graphql.Field(() => graphql.ID),
|
|
7160
|
+
tslib.__metadata("design:type", String)
|
|
7161
|
+
], UpdateInventoryCountOrderArgs.prototype, "id", void 0);
|
|
7162
|
+
tslib.__decorate([
|
|
7163
|
+
graphql.Field(() => String, { nullable: true }),
|
|
7164
|
+
tslib.__metadata("design:type", String)
|
|
7165
|
+
], UpdateInventoryCountOrderArgs.prototype, "name", void 0);
|
|
7166
|
+
tslib.__decorate([
|
|
7167
|
+
graphql.Field(() => String, { nullable: true }),
|
|
7168
|
+
tslib.__metadata("design:type", String)
|
|
7169
|
+
], UpdateInventoryCountOrderArgs.prototype, "countDate", void 0);
|
|
7170
|
+
tslib.__decorate([
|
|
7171
|
+
graphql.Field(() => [graphql.ID], { nullable: true }),
|
|
7172
|
+
tslib.__metadata("design:type", Array)
|
|
7173
|
+
], UpdateInventoryCountOrderArgs.prototype, "locationIds", void 0);
|
|
7174
|
+
UpdateInventoryCountOrderArgs = tslib.__decorate([
|
|
7175
|
+
graphql.ArgsType()
|
|
7176
|
+
], UpdateInventoryCountOrderArgs);
|
|
7177
|
+
let CountInventoryItemInput = class CountInventoryItemInput {
|
|
7178
|
+
itemId;
|
|
7179
|
+
/** `null` clears the entry, putting the line back to "not counted". */
|
|
7180
|
+
countedQuantity;
|
|
7181
|
+
unitId;
|
|
7182
|
+
};
|
|
7183
|
+
tslib.__decorate([
|
|
7184
|
+
graphql.Field(() => graphql.ID),
|
|
7185
|
+
tslib.__metadata("design:type", String)
|
|
7186
|
+
], CountInventoryItemInput.prototype, "itemId", void 0);
|
|
7187
|
+
tslib.__decorate([
|
|
7188
|
+
graphql.Field(() => graphql.Float, { nullable: true }),
|
|
7189
|
+
tslib.__metadata("design:type", Object)
|
|
7190
|
+
], CountInventoryItemInput.prototype, "countedQuantity", void 0);
|
|
7191
|
+
tslib.__decorate([
|
|
7192
|
+
graphql.Field(() => graphql.ID, { nullable: true }),
|
|
7193
|
+
tslib.__metadata("design:type", Object)
|
|
7194
|
+
], CountInventoryItemInput.prototype, "unitId", void 0);
|
|
7195
|
+
CountInventoryItemInput = tslib.__decorate([
|
|
7196
|
+
graphql.InputType()
|
|
7197
|
+
], CountInventoryItemInput);
|
|
7198
|
+
let CountInventoryArgs = class CountInventoryArgs {
|
|
7199
|
+
id;
|
|
7200
|
+
items;
|
|
7201
|
+
};
|
|
7202
|
+
tslib.__decorate([
|
|
7203
|
+
graphql.Field(() => graphql.ID),
|
|
7204
|
+
tslib.__metadata("design:type", String)
|
|
7205
|
+
], CountInventoryArgs.prototype, "id", void 0);
|
|
7206
|
+
tslib.__decorate([
|
|
7207
|
+
graphql.Field(() => [CountInventoryItemInput]),
|
|
7208
|
+
tslib.__metadata("design:type", Array)
|
|
7209
|
+
], CountInventoryArgs.prototype, "items", void 0);
|
|
7210
|
+
CountInventoryArgs = tslib.__decorate([
|
|
7211
|
+
graphql.ArgsType()
|
|
7212
|
+
], CountInventoryArgs);
|
|
7213
|
+
let AddInventoryCountItemArgs = class AddInventoryCountItemArgs {
|
|
7214
|
+
id;
|
|
7215
|
+
materialId;
|
|
7216
|
+
/** An existing batch key, or a new one — the batch is created on demand. */
|
|
7217
|
+
batchKey;
|
|
7218
|
+
locationId;
|
|
7219
|
+
loaderId;
|
|
7220
|
+
countedQuantity;
|
|
7221
|
+
unitId;
|
|
7222
|
+
};
|
|
7223
|
+
tslib.__decorate([
|
|
7224
|
+
graphql.Field(() => graphql.ID),
|
|
7225
|
+
tslib.__metadata("design:type", String)
|
|
7226
|
+
], AddInventoryCountItemArgs.prototype, "id", void 0);
|
|
7227
|
+
tslib.__decorate([
|
|
7228
|
+
graphql.Field(() => graphql.ID),
|
|
7229
|
+
tslib.__metadata("design:type", String)
|
|
7230
|
+
], AddInventoryCountItemArgs.prototype, "materialId", void 0);
|
|
7231
|
+
tslib.__decorate([
|
|
7232
|
+
graphql.Field(() => String),
|
|
7233
|
+
tslib.__metadata("design:type", String)
|
|
7234
|
+
], AddInventoryCountItemArgs.prototype, "batchKey", void 0);
|
|
7235
|
+
tslib.__decorate([
|
|
7236
|
+
graphql.Field(() => graphql.ID),
|
|
7237
|
+
tslib.__metadata("design:type", String)
|
|
7238
|
+
], AddInventoryCountItemArgs.prototype, "locationId", void 0);
|
|
7239
|
+
tslib.__decorate([
|
|
7240
|
+
graphql.Field(() => graphql.ID, { nullable: true }),
|
|
7241
|
+
tslib.__metadata("design:type", Object)
|
|
7242
|
+
], AddInventoryCountItemArgs.prototype, "loaderId", void 0);
|
|
7243
|
+
tslib.__decorate([
|
|
7244
|
+
graphql.Field(() => graphql.Float),
|
|
7245
|
+
tslib.__metadata("design:type", Number)
|
|
7246
|
+
], AddInventoryCountItemArgs.prototype, "countedQuantity", void 0);
|
|
7247
|
+
tslib.__decorate([
|
|
7248
|
+
graphql.Field(() => graphql.ID, { nullable: true }),
|
|
7249
|
+
tslib.__metadata("design:type", Object)
|
|
7250
|
+
], AddInventoryCountItemArgs.prototype, "unitId", void 0);
|
|
7251
|
+
AddInventoryCountItemArgs = tslib.__decorate([
|
|
7252
|
+
graphql.ArgsType()
|
|
7253
|
+
], AddInventoryCountItemArgs);
|
|
7254
|
+
let RemoveInventoryCountItemArgs = class RemoveInventoryCountItemArgs {
|
|
7255
|
+
id;
|
|
7256
|
+
itemId;
|
|
7257
|
+
};
|
|
7258
|
+
tslib.__decorate([
|
|
7259
|
+
graphql.Field(() => graphql.ID),
|
|
7260
|
+
tslib.__metadata("design:type", String)
|
|
7261
|
+
], RemoveInventoryCountItemArgs.prototype, "id", void 0);
|
|
7262
|
+
tslib.__decorate([
|
|
7263
|
+
graphql.Field(() => graphql.ID),
|
|
7264
|
+
tslib.__metadata("design:type", String)
|
|
7265
|
+
], RemoveInventoryCountItemArgs.prototype, "itemId", void 0);
|
|
7266
|
+
RemoveInventoryCountItemArgs = tslib.__decorate([
|
|
7267
|
+
graphql.ArgsType()
|
|
7268
|
+
], RemoveInventoryCountItemArgs);
|
|
7269
|
+
let InventoryCountOrderIdArgs = class InventoryCountOrderIdArgs {
|
|
7270
|
+
id;
|
|
7271
|
+
};
|
|
7272
|
+
tslib.__decorate([
|
|
7273
|
+
graphql.Field(() => graphql.ID),
|
|
7274
|
+
tslib.__metadata("design:type", String)
|
|
7275
|
+
], InventoryCountOrderIdArgs.prototype, "id", void 0);
|
|
7276
|
+
InventoryCountOrderIdArgs = tslib.__decorate([
|
|
7277
|
+
graphql.ArgsType()
|
|
7278
|
+
], InventoryCountOrderIdArgs);
|
|
7279
|
+
|
|
7280
|
+
let InventoryCountOrderQuery = class InventoryCountOrderQuery {
|
|
7281
|
+
inventoryCountOrderService;
|
|
7282
|
+
constructor(inventoryCountOrderService) {
|
|
7283
|
+
this.inventoryCountOrderService = inventoryCountOrderService;
|
|
7284
|
+
}
|
|
7285
|
+
async inventoryCountOrders(args) {
|
|
7286
|
+
const [items, total] = await this.inventoryCountOrderService.findMany(args);
|
|
7287
|
+
return { items, total };
|
|
7288
|
+
}
|
|
7289
|
+
/**
|
|
7290
|
+
* The count sheet, filtered and paginated.
|
|
7291
|
+
*
|
|
7292
|
+
* Separate from `inventoryCountOrder.items` on purpose: the detail page needs
|
|
7293
|
+
* to narrow thousands of lines down to the shelf in front of the operator, and
|
|
7294
|
+
* a field resolver cannot take filters or a page.
|
|
7295
|
+
*/
|
|
7296
|
+
async inventoryCountOrderItems({ id, ...options }) {
|
|
7297
|
+
const [items, total] = await this.inventoryCountOrderService.findItems(id, options);
|
|
7298
|
+
return { items, total };
|
|
7299
|
+
}
|
|
7300
|
+
async inventoryCountOrder({ id }) {
|
|
7301
|
+
return this.inventoryCountOrderService.findOne(id);
|
|
7302
|
+
}
|
|
7303
|
+
};
|
|
7304
|
+
tslib.__decorate([
|
|
7305
|
+
graphql.Query(() => InventoryCountOrders),
|
|
7306
|
+
WmsOperation({ resource: 'inventory-count-order', action: 'read' }),
|
|
7307
|
+
tslib.__param(0, graphql.Args()),
|
|
7308
|
+
tslib.__metadata("design:type", Function),
|
|
7309
|
+
tslib.__metadata("design:paramtypes", [FindInventoryCountOrderArgs]),
|
|
7310
|
+
tslib.__metadata("design:returntype", Promise)
|
|
7311
|
+
], InventoryCountOrderQuery.prototype, "inventoryCountOrders", null);
|
|
7312
|
+
tslib.__decorate([
|
|
7313
|
+
graphql.Query(() => InventoryCountOrderItems),
|
|
7314
|
+
WmsOperation({ resource: 'inventory-count-order', action: 'read-items' }),
|
|
7315
|
+
tslib.__param(0, graphql.Args()),
|
|
7316
|
+
tslib.__metadata("design:type", Function),
|
|
7317
|
+
tslib.__metadata("design:paramtypes", [FindInventoryCountOrderItemArgs]),
|
|
7318
|
+
tslib.__metadata("design:returntype", Promise)
|
|
7319
|
+
], InventoryCountOrderQuery.prototype, "inventoryCountOrderItems", null);
|
|
7320
|
+
tslib.__decorate([
|
|
7321
|
+
graphql.Query(() => InventoryCountOrderDto),
|
|
7322
|
+
WmsOperation({ resource: 'inventory-count-order', action: 'read' }),
|
|
7323
|
+
tslib.__param(0, graphql.Args()),
|
|
7324
|
+
tslib.__metadata("design:type", Function),
|
|
7325
|
+
tslib.__metadata("design:paramtypes", [InventoryCountOrderIdArgs]),
|
|
7326
|
+
tslib.__metadata("design:returntype", Promise)
|
|
7327
|
+
], InventoryCountOrderQuery.prototype, "inventoryCountOrder", null);
|
|
7328
|
+
InventoryCountOrderQuery = tslib.__decorate([
|
|
7329
|
+
common.Injectable(),
|
|
7330
|
+
tslib.__metadata("design:paramtypes", [wmsModuleCore.InventoryCountOrderService])
|
|
7331
|
+
], InventoryCountOrderQuery);
|
|
7332
|
+
|
|
7333
|
+
let InventoryCountOrderMutation = class InventoryCountOrderMutation {
|
|
7334
|
+
inventoryCountOrderService;
|
|
7335
|
+
constructor(inventoryCountOrderService) {
|
|
7336
|
+
this.inventoryCountOrderService = inventoryCountOrderService;
|
|
7337
|
+
}
|
|
7338
|
+
async createInventoryCountOrder(args) {
|
|
7339
|
+
return this.inventoryCountOrderService.create(args);
|
|
7340
|
+
}
|
|
7341
|
+
async updateInventoryCountOrder({ id, ...input }) {
|
|
7342
|
+
return this.inventoryCountOrderService.update(id, input);
|
|
7343
|
+
}
|
|
7344
|
+
async startInventoryCount({ id }) {
|
|
7345
|
+
return this.inventoryCountOrderService.start(id);
|
|
7346
|
+
}
|
|
7347
|
+
/** "暫存結果" — record what was counted without touching stock. */
|
|
7348
|
+
async countInventory({ id, items }) {
|
|
7349
|
+
return this.inventoryCountOrderService.count(id, items.map((item) => ({
|
|
7350
|
+
itemId: item.itemId,
|
|
7351
|
+
countedQuantity: item.countedQuantity ?? null,
|
|
7352
|
+
unitId: item.unitId,
|
|
7353
|
+
})));
|
|
7354
|
+
}
|
|
7355
|
+
async addInventoryCountItem({ id, ...input }) {
|
|
7356
|
+
return this.inventoryCountOrderService.addItem(id, input);
|
|
7357
|
+
}
|
|
7358
|
+
async removeInventoryCountItem({ id, itemId }) {
|
|
7359
|
+
return this.inventoryCountOrderService.removeItem(id, itemId);
|
|
7360
|
+
}
|
|
7361
|
+
/** "清空重填" — discard the counting, keep the lock and the status. */
|
|
7362
|
+
async resetInventoryCount({ id }) {
|
|
7363
|
+
return this.inventoryCountOrderService.reset(id);
|
|
7364
|
+
}
|
|
7365
|
+
async cancelInventoryCount({ id }) {
|
|
7366
|
+
return this.inventoryCountOrderService.cancel(id);
|
|
7367
|
+
}
|
|
7368
|
+
/** "執行盤差" — the only mutation here that changes stock. */
|
|
7369
|
+
async settleInventoryCount({ id }) {
|
|
7370
|
+
return this.inventoryCountOrderService.settle(id);
|
|
7371
|
+
}
|
|
7372
|
+
};
|
|
7373
|
+
tslib.__decorate([
|
|
7374
|
+
graphql.Mutation(() => InventoryCountOrderDto),
|
|
7375
|
+
WmsOperation({ resource: 'inventory-count-order', action: 'create' }),
|
|
7376
|
+
WmsMutationEvent({ event: 'inventory-count-order.created' }),
|
|
7377
|
+
tslib.__param(0, graphql.Args()),
|
|
7378
|
+
tslib.__metadata("design:type", Function),
|
|
7379
|
+
tslib.__metadata("design:paramtypes", [CreateInventoryCountOrderArgs]),
|
|
7380
|
+
tslib.__metadata("design:returntype", Promise)
|
|
7381
|
+
], InventoryCountOrderMutation.prototype, "createInventoryCountOrder", null);
|
|
7382
|
+
tslib.__decorate([
|
|
7383
|
+
graphql.Mutation(() => InventoryCountOrderDto),
|
|
7384
|
+
WmsOperation({ resource: 'inventory-count-order', action: 'update' }),
|
|
7385
|
+
WmsMutationEvent({ event: 'inventory-count-order.updated' }),
|
|
7386
|
+
tslib.__param(0, graphql.Args()),
|
|
7387
|
+
tslib.__metadata("design:type", Function),
|
|
7388
|
+
tslib.__metadata("design:paramtypes", [UpdateInventoryCountOrderArgs]),
|
|
7389
|
+
tslib.__metadata("design:returntype", Promise)
|
|
7390
|
+
], InventoryCountOrderMutation.prototype, "updateInventoryCountOrder", null);
|
|
7391
|
+
tslib.__decorate([
|
|
7392
|
+
graphql.Mutation(() => InventoryCountOrderDto),
|
|
7393
|
+
WmsOperation({ resource: 'inventory-count-order', action: 'start' }),
|
|
7394
|
+
WmsMutationEvent({ event: 'inventory-count-order.started' }),
|
|
7395
|
+
tslib.__param(0, graphql.Args()),
|
|
7396
|
+
tslib.__metadata("design:type", Function),
|
|
7397
|
+
tslib.__metadata("design:paramtypes", [InventoryCountOrderIdArgs]),
|
|
7398
|
+
tslib.__metadata("design:returntype", Promise)
|
|
7399
|
+
], InventoryCountOrderMutation.prototype, "startInventoryCount", null);
|
|
7400
|
+
tslib.__decorate([
|
|
7401
|
+
graphql.Mutation(() => InventoryCountOrderDto),
|
|
7402
|
+
WmsOperation({ resource: 'inventory-count-order', action: 'count' }),
|
|
7403
|
+
WmsMutationEvent({ event: 'inventory-count-order.counted' }),
|
|
7404
|
+
tslib.__param(0, graphql.Args()),
|
|
7405
|
+
tslib.__metadata("design:type", Function),
|
|
7406
|
+
tslib.__metadata("design:paramtypes", [CountInventoryArgs]),
|
|
7407
|
+
tslib.__metadata("design:returntype", Promise)
|
|
7408
|
+
], InventoryCountOrderMutation.prototype, "countInventory", null);
|
|
7409
|
+
tslib.__decorate([
|
|
7410
|
+
graphql.Mutation(() => InventoryCountOrderItemDto),
|
|
7411
|
+
WmsOperation({ resource: 'inventory-count-order', action: 'add-item' }),
|
|
7412
|
+
WmsMutationEvent({ event: 'inventory-count-order.updated' }),
|
|
7413
|
+
tslib.__param(0, graphql.Args()),
|
|
7414
|
+
tslib.__metadata("design:type", Function),
|
|
7415
|
+
tslib.__metadata("design:paramtypes", [AddInventoryCountItemArgs]),
|
|
7416
|
+
tslib.__metadata("design:returntype", Promise)
|
|
7417
|
+
], InventoryCountOrderMutation.prototype, "addInventoryCountItem", null);
|
|
7418
|
+
tslib.__decorate([
|
|
7419
|
+
graphql.Mutation(() => InventoryCountOrderDto),
|
|
7420
|
+
WmsOperation({ resource: 'inventory-count-order', action: 'remove-item' }),
|
|
7421
|
+
WmsMutationEvent({ event: 'inventory-count-order.updated' }),
|
|
7422
|
+
tslib.__param(0, graphql.Args()),
|
|
7423
|
+
tslib.__metadata("design:type", Function),
|
|
7424
|
+
tslib.__metadata("design:paramtypes", [RemoveInventoryCountItemArgs]),
|
|
7425
|
+
tslib.__metadata("design:returntype", Promise)
|
|
7426
|
+
], InventoryCountOrderMutation.prototype, "removeInventoryCountItem", null);
|
|
7427
|
+
tslib.__decorate([
|
|
7428
|
+
graphql.Mutation(() => InventoryCountOrderDto),
|
|
7429
|
+
WmsOperation({ resource: 'inventory-count-order', action: 'reset' }),
|
|
7430
|
+
WmsMutationEvent({ event: 'inventory-count-order.reset' }),
|
|
7431
|
+
tslib.__param(0, graphql.Args()),
|
|
7432
|
+
tslib.__metadata("design:type", Function),
|
|
7433
|
+
tslib.__metadata("design:paramtypes", [InventoryCountOrderIdArgs]),
|
|
7434
|
+
tslib.__metadata("design:returntype", Promise)
|
|
7435
|
+
], InventoryCountOrderMutation.prototype, "resetInventoryCount", null);
|
|
7436
|
+
tslib.__decorate([
|
|
7437
|
+
graphql.Mutation(() => InventoryCountOrderDto),
|
|
7438
|
+
WmsOperation({ resource: 'inventory-count-order', action: 'cancel' }),
|
|
7439
|
+
WmsMutationEvent({ event: 'inventory-count-order.cancelled' }),
|
|
7440
|
+
tslib.__param(0, graphql.Args()),
|
|
7441
|
+
tslib.__metadata("design:type", Function),
|
|
7442
|
+
tslib.__metadata("design:paramtypes", [InventoryCountOrderIdArgs]),
|
|
7443
|
+
tslib.__metadata("design:returntype", Promise)
|
|
7444
|
+
], InventoryCountOrderMutation.prototype, "cancelInventoryCount", null);
|
|
7445
|
+
tslib.__decorate([
|
|
7446
|
+
graphql.Mutation(() => InventoryCountOrderDto),
|
|
7447
|
+
WmsOperation({ resource: 'inventory-count-order', action: 'settle' }),
|
|
7448
|
+
WmsMutationEvent({ event: 'inventory-count-order.settled' }),
|
|
7449
|
+
tslib.__param(0, graphql.Args()),
|
|
7450
|
+
tslib.__metadata("design:type", Function),
|
|
7451
|
+
tslib.__metadata("design:paramtypes", [InventoryCountOrderIdArgs]),
|
|
7452
|
+
tslib.__metadata("design:returntype", Promise)
|
|
7453
|
+
], InventoryCountOrderMutation.prototype, "settleInventoryCount", null);
|
|
7454
|
+
InventoryCountOrderMutation = tslib.__decorate([
|
|
7455
|
+
common.Injectable(),
|
|
7456
|
+
tslib.__metadata("design:paramtypes", [wmsModuleCore.InventoryCountOrderService])
|
|
7457
|
+
], InventoryCountOrderMutation);
|
|
7458
|
+
|
|
7459
|
+
let InventoryCountOrderResolver = class InventoryCountOrderResolver {
|
|
7460
|
+
entities;
|
|
7461
|
+
constructor(entities) {
|
|
7462
|
+
this.entities = entities;
|
|
7463
|
+
}
|
|
7464
|
+
items({ id }, { loaders }) {
|
|
7465
|
+
return loaders.batchMany.load({
|
|
7466
|
+
__entity: wmsModuleCore.InventoryCountOrderItemEntityClass,
|
|
7467
|
+
__from: { orderId: id },
|
|
7468
|
+
});
|
|
7469
|
+
}
|
|
7470
|
+
/**
|
|
7471
|
+
* The locations the user picked.
|
|
7472
|
+
*
|
|
7473
|
+
* Only the roots: the scope table also holds every descendant the backend
|
|
7474
|
+
* expanded into, and listing a whole aisle's shelves as chips would bury the
|
|
7475
|
+
* one thing the operator actually chose. The expansion still exists in the
|
|
7476
|
+
* database — it is what the lock reads — it just is not this field.
|
|
7477
|
+
*/
|
|
7478
|
+
async locations({ id }, { loaders }) {
|
|
7479
|
+
const scope = (await loaders.batchMany.load({
|
|
7480
|
+
__entity: wmsModuleCore.InventoryCountOrderLocationEntityClass,
|
|
7481
|
+
__from: { orderId: id },
|
|
7482
|
+
}));
|
|
7483
|
+
// The join rows carry `locationId`, not a loaded `location` relation, so
|
|
7484
|
+
// each one has to go back through the location DataLoader. Returning
|
|
7485
|
+
// `row.location` directly yields `undefined`, and the non-nullable list then
|
|
7486
|
+
// fails the whole query with "Cannot return null for non-nullable field".
|
|
7487
|
+
return Promise.all(scope
|
|
7488
|
+
.filter(({ isRoot }) => isRoot)
|
|
7489
|
+
.map(({ locationId }) => loaders.batchSingle.load({
|
|
7490
|
+
__entity: this.entities.location,
|
|
7491
|
+
__from: { id: locationId },
|
|
7492
|
+
})));
|
|
7493
|
+
}
|
|
7494
|
+
};
|
|
7495
|
+
tslib.__decorate([
|
|
7496
|
+
graphql.ResolveField(() => [InventoryCountOrderItemDto]),
|
|
7497
|
+
tslib.__param(0, graphql.Parent()),
|
|
7498
|
+
tslib.__param(1, graphql.Context()),
|
|
7499
|
+
tslib.__metadata("design:type", Function),
|
|
7500
|
+
tslib.__metadata("design:paramtypes", [InventoryCountOrderDto, Object]),
|
|
7501
|
+
tslib.__metadata("design:returntype", Promise)
|
|
7502
|
+
], InventoryCountOrderResolver.prototype, "items", null);
|
|
7503
|
+
tslib.__decorate([
|
|
7504
|
+
graphql.ResolveField(() => [LocationDto]),
|
|
7505
|
+
tslib.__param(0, graphql.Parent()),
|
|
7506
|
+
tslib.__param(1, graphql.Context()),
|
|
7507
|
+
tslib.__metadata("design:type", Function),
|
|
7508
|
+
tslib.__metadata("design:paramtypes", [InventoryCountOrderDto, Object]),
|
|
7509
|
+
tslib.__metadata("design:returntype", Promise)
|
|
7510
|
+
], InventoryCountOrderResolver.prototype, "locations", null);
|
|
7511
|
+
InventoryCountOrderResolver = tslib.__decorate([
|
|
7512
|
+
graphql.Resolver(() => InventoryCountOrderDto),
|
|
7513
|
+
tslib.__metadata("design:paramtypes", [wmsModuleCore.WmsEntities])
|
|
7514
|
+
], InventoryCountOrderResolver);
|
|
7515
|
+
let InventoryCountOrderItemResolver = class InventoryCountOrderItemResolver {
|
|
7516
|
+
entities;
|
|
7517
|
+
/**
|
|
7518
|
+
* The configured entities, not the built-in classes: `__entity` decides which
|
|
7519
|
+
* repository the DataLoader opens, so it has to follow whatever the consumer
|
|
7520
|
+
* passed to `WMSBaseModuleOptions`.
|
|
7521
|
+
*/
|
|
7522
|
+
constructor(entities) {
|
|
7523
|
+
this.entities = entities;
|
|
7524
|
+
}
|
|
7525
|
+
material({ materialId }, { loaders }) {
|
|
7526
|
+
return loaders.batchSingle.load({
|
|
7527
|
+
__entity: this.entities.material,
|
|
7528
|
+
__from: { id: materialId },
|
|
7529
|
+
});
|
|
7530
|
+
}
|
|
7531
|
+
async batch({ batchId }, { loaders }) {
|
|
7532
|
+
const { groupId } = await loaders.batchSingle.load({
|
|
7533
|
+
__entity: this.entities.batch,
|
|
7534
|
+
__from: { id: batchId },
|
|
7535
|
+
});
|
|
7536
|
+
return loaders.batchSingle.load({
|
|
7537
|
+
__entity: wmsModuleCore.BatchGroupEntityClass,
|
|
7538
|
+
__from: { id: groupId },
|
|
7539
|
+
});
|
|
7540
|
+
}
|
|
7541
|
+
location({ locationId }, { loaders }) {
|
|
7542
|
+
if (!locationId) {
|
|
7543
|
+
return null;
|
|
7544
|
+
}
|
|
7545
|
+
return loaders.batchSingle.load({
|
|
7546
|
+
__entity: this.entities.location,
|
|
7547
|
+
__from: { id: locationId },
|
|
7548
|
+
});
|
|
7549
|
+
}
|
|
7550
|
+
loader({ loaderId }, { loaders }) {
|
|
7551
|
+
if (!loaderId) {
|
|
7552
|
+
return null;
|
|
7553
|
+
}
|
|
7554
|
+
return loaders.batchSingle.load({
|
|
7555
|
+
__entity: wmsModuleCore.LoadersEntityClass,
|
|
7556
|
+
__from: { id: loaderId },
|
|
7557
|
+
});
|
|
7558
|
+
}
|
|
7559
|
+
};
|
|
7560
|
+
tslib.__decorate([
|
|
7561
|
+
graphql.ResolveField(() => MaterialDto),
|
|
7562
|
+
tslib.__param(0, graphql.Parent()),
|
|
7563
|
+
tslib.__param(1, graphql.Context()),
|
|
7564
|
+
tslib.__metadata("design:type", Function),
|
|
7565
|
+
tslib.__metadata("design:paramtypes", [InventoryCountOrderItemDto, Object]),
|
|
7566
|
+
tslib.__metadata("design:returntype", Promise)
|
|
7567
|
+
], InventoryCountOrderItemResolver.prototype, "material", null);
|
|
7568
|
+
tslib.__decorate([
|
|
7569
|
+
graphql.ResolveField(() => BatchDto),
|
|
7570
|
+
tslib.__param(0, graphql.Parent()),
|
|
7571
|
+
tslib.__param(1, graphql.Context()),
|
|
7572
|
+
tslib.__metadata("design:type", Function),
|
|
7573
|
+
tslib.__metadata("design:paramtypes", [InventoryCountOrderItemDto, Object]),
|
|
7574
|
+
tslib.__metadata("design:returntype", Promise)
|
|
7575
|
+
], InventoryCountOrderItemResolver.prototype, "batch", null);
|
|
7576
|
+
tslib.__decorate([
|
|
7577
|
+
graphql.ResolveField(() => LocationDto, { nullable: true }),
|
|
7578
|
+
tslib.__param(0, graphql.Parent()),
|
|
7579
|
+
tslib.__param(1, graphql.Context()),
|
|
7580
|
+
tslib.__metadata("design:type", Function),
|
|
7581
|
+
tslib.__metadata("design:paramtypes", [InventoryCountOrderItemDto, Object]),
|
|
7582
|
+
tslib.__metadata("design:returntype", Object)
|
|
7583
|
+
], InventoryCountOrderItemResolver.prototype, "location", null);
|
|
7584
|
+
tslib.__decorate([
|
|
7585
|
+
graphql.ResolveField(() => LoaderDto, { nullable: true }),
|
|
7586
|
+
tslib.__param(0, graphql.Parent()),
|
|
7587
|
+
tslib.__param(1, graphql.Context()),
|
|
7588
|
+
tslib.__metadata("design:type", Function),
|
|
7589
|
+
tslib.__metadata("design:paramtypes", [InventoryCountOrderItemDto, Object]),
|
|
7590
|
+
tslib.__metadata("design:returntype", Object)
|
|
7591
|
+
], InventoryCountOrderItemResolver.prototype, "loader", null);
|
|
7592
|
+
InventoryCountOrderItemResolver = tslib.__decorate([
|
|
7593
|
+
graphql.Resolver(() => InventoryCountOrderItemDto),
|
|
7594
|
+
tslib.__metadata("design:paramtypes", [wmsModuleCore.WmsEntities])
|
|
7595
|
+
], InventoryCountOrderItemResolver);
|
|
7596
|
+
|
|
6681
7597
|
var WmsModuleGraphqlModule_1;
|
|
6682
7598
|
const exportDependencies = [
|
|
6683
7599
|
UnitQuery,
|
|
@@ -6732,10 +7648,23 @@ const exportDependencies = [
|
|
|
6732
7648
|
QualityInspectionOrderMutation,
|
|
6733
7649
|
WarehouseMapDataQuery,
|
|
6734
7650
|
MapRangeUnionResolver,
|
|
7651
|
+
InventoryCountOrderQuery,
|
|
7652
|
+
InventoryCountOrderMutation,
|
|
7653
|
+
InventoryCountOrderResolver,
|
|
7654
|
+
InventoryCountOrderItemResolver,
|
|
6735
7655
|
];
|
|
6736
7656
|
exports.WmsModuleGraphqlModule = WmsModuleGraphqlModule_1 = class WmsModuleGraphqlModule {
|
|
6737
7657
|
static forRootAsync(options) {
|
|
6738
|
-
const { authChecker, beforeHooks, afterListeners, actorExtractor, eventEmitterBridge, ...coreOptions } = options;
|
|
7658
|
+
const { authChecker, beforeHooks, afterListeners, actorExtractor, eventEmitterBridge, enabledOperations, disabledOperations, disabledFields, ...coreOptions } = options;
|
|
7659
|
+
// Must run before `GraphQLModule` builds the schema. `forRootAsync` is
|
|
7660
|
+
// called while `AppModule` is still being defined, so this is the earliest
|
|
7661
|
+
// point at which the deployment's switches are known — and it is early
|
|
7662
|
+
// enough: the schema is not built until the app bootstraps.
|
|
7663
|
+
pruneDisabledOperations(exportDependencies, {
|
|
7664
|
+
enabledOperations,
|
|
7665
|
+
disabledOperations,
|
|
7666
|
+
disabledFields,
|
|
7667
|
+
});
|
|
6739
7668
|
// coreOptions still carries `enrichStockEvents`, forwarded to the core module.
|
|
6740
7669
|
const coreModule = wmsModuleCore.WmsModuleCoreModule.forRootAsync(coreOptions);
|
|
6741
7670
|
const authOptions = { authChecker };
|
|
@@ -6770,6 +7699,10 @@ exports.WmsModuleGraphqlModule = WmsModuleGraphqlModule_1 = tslib.__decorate([
|
|
|
6770
7699
|
})
|
|
6771
7700
|
], exports.WmsModuleGraphqlModule);
|
|
6772
7701
|
|
|
7702
|
+
Object.defineProperty(exports, "WMS_OPERATION_NAMES", {
|
|
7703
|
+
enumerable: true,
|
|
7704
|
+
get: function () { return wmsModuleCore.WMS_OPERATION_NAMES; }
|
|
7705
|
+
});
|
|
6773
7706
|
exports.HOST_SKIP_METADATA_KEY = HOST_SKIP_METADATA_KEY;
|
|
6774
7707
|
exports.WMS_AUTH_OPTIONS = WMS_AUTH_OPTIONS;
|
|
6775
7708
|
exports.WMS_MUTATION_EVENT_METADATA = WMS_MUTATION_EVENT_METADATA;
|
|
@@ -6777,3 +7710,4 @@ exports.WMS_OPERATION_METADATA = WMS_OPERATION_METADATA;
|
|
|
6777
7710
|
exports.WmsMutationEvent = WmsMutationEvent;
|
|
6778
7711
|
exports.WmsOperation = WmsOperation;
|
|
6779
7712
|
exports.createWmsLoaders = createWmsLoaders;
|
|
7713
|
+
exports.pruneDisabledOperations = pruneDisabledOperations;
|