@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.
Files changed (53) hide show
  1. package/README.md +94 -6
  2. package/docs/api-reference.md +81 -6
  3. package/docs/events.md +23 -4
  4. package/index.cjs.js +919 -110
  5. package/index.d.ts +3 -1
  6. package/index.js +2 -0
  7. package/lib/dto/index.d.ts +1 -0
  8. package/lib/dto/inventory-count-order.dto.d.ts +49 -0
  9. package/lib/dto/inventory-count-order.dto.js +146 -0
  10. package/lib/events/operation-result-map.d.ts +8 -0
  11. package/lib/graphql.module.d.ts +6 -2
  12. package/lib/graphql.module.js +18 -1
  13. package/lib/inputs/inventory-count-order.args.d.ts +55 -0
  14. package/lib/inputs/inventory-count-order.args.js +196 -0
  15. package/lib/mutations/inventory-count-order.mutation.d.ts +19 -0
  16. package/lib/mutations/inventory-count-order.mutation.js +138 -0
  17. package/lib/mutations/loader.mutation.js +1 -0
  18. package/lib/mutations/material.mutation.js +1 -0
  19. package/lib/mutations/receive-inventory-order.mutation.js +1 -0
  20. package/lib/mutations/ship-inventory-order.mutation.js +1 -0
  21. package/lib/queries/inventory-count-order.query.d.ts +9 -0
  22. package/lib/queries/inventory-count-order.query.js +44 -0
  23. package/lib/queries/loader.query.js +1 -0
  24. package/lib/queries/material.query.js +1 -0
  25. package/lib/queries/recieve-inventory-order.query.js +1 -0
  26. package/lib/queries/ship-inventory-order.query.js +1 -0
  27. package/lib/queries/stock.query.js +1 -0
  28. package/lib/registry/index.d.ts +1 -0
  29. package/lib/registry/operation-registry.d.ts +59 -0
  30. package/lib/registry/operation-registry.js +136 -0
  31. package/lib/resolvers/aggregated-stock.resolver.d.ts +3 -11
  32. package/lib/resolvers/aggregated-stock.resolver.js +10 -18
  33. package/lib/resolvers/change-log.resolver.d.ts +8 -8
  34. package/lib/resolvers/change-log.resolver.js +14 -15
  35. package/lib/resolvers/inventory-count-order.resolver.d.ts +34 -0
  36. package/lib/resolvers/inventory-count-order.resolver.js +148 -0
  37. package/lib/resolvers/loader-type.resolver.js +1 -0
  38. package/lib/resolvers/loader.resolver.d.ts +10 -2
  39. package/lib/resolvers/loader.resolver.js +15 -4
  40. package/lib/resolvers/location.resolver.d.ts +10 -1
  41. package/lib/resolvers/location.resolver.js +17 -6
  42. package/lib/resolvers/material.resolver.js +1 -0
  43. package/lib/resolvers/receive-inventory-order.resolver.d.ts +8 -8
  44. package/lib/resolvers/receive-inventory-order.resolver.js +14 -15
  45. package/lib/resolvers/ship-inventory-order.resolver.d.ts +15 -15
  46. package/lib/resolvers/ship-inventory-order.resolver.js +27 -29
  47. package/lib/resolvers/stock.resolver.d.ts +8 -8
  48. package/lib/resolvers/stock.resolver.js +14 -15
  49. package/lib/resolvers/transfer-order.resolver.d.ts +17 -8
  50. package/lib/resolvers/transfer-order.resolver.js +30 -19
  51. package/lib/resolvers/warehouse-map.resolver.d.ts +10 -1
  52. package/lib/resolvers/warehouse-map.resolver.js +15 -3
  53. package/package.json +2 -2
package/index.d.ts CHANGED
@@ -4,6 +4,8 @@ export type { LoaderOptions, LoaderOptionsWithPagination, } from './lib/helpers/
4
4
  export type { LoaderType } from './lib/helpers/dataloader.type';
5
5
  export { createWmsLoaders, type WmsLoaders, } from './lib/helpers/create-wms-loaders';
6
6
  export { HOST_SKIP_METADATA_KEY, WmsAuthGuard, WmsOperation, WMS_AUTH_OPTIONS, WMS_OPERATION_METADATA, type WmsAuthChecker, type WmsAuthModuleOptions, type WmsOperationRequirement, } from './lib/auth';
7
+ export { pruneDisabledOperations, type PrunedOperations, type WmsOperationRegistrationOptions, } from './lib/registry';
7
8
  export type { WmsModuleGraphqlModuleAsyncOptions } from './lib/graphql.module';
8
9
  export { WmsMutationEvent, WmsMutationInterceptor, WMS_MUTATION_EVENT_METADATA, type WmsMutationEventConfig, type WmsOperationResultMap, type WmsEventPayloadFor, type WmsTypedAfterEventContext, type WmsTypedAfterListenerMap, type WmsTypedBeforeHookContext, type WmsTypedBeforeHookMap, } from './lib/events';
9
- export type { WmsActor, WmsActorExtractor, WmsAfterEventContext, WmsAfterListener, WmsAfterListenerMap, WmsBeforeHook, WmsBeforeHookContext, WmsBeforeHookMap, WmsDomainEvent, WmsEventModuleOptions, WmsEventName, WmsEventPayloadMap, WmsOperationEventName, WmsOperationEventPayload, WmsStockEventName, WmsStockEventPayload, } from '@rytass/wms-module-core';
10
+ export type { WmsActor, WmsActorExtractor, WmsAfterEventContext, WmsAfterListener, WmsAfterListenerMap, WmsBeforeHook, WmsBeforeHookContext, WmsBeforeHookMap, WmsDomainEvent, WmsEventModuleOptions, WmsEventName, WmsEventPayloadMap, WmsOperationEventName, WmsOperationEventPayload, WmsOperationName, WmsStockEventName, WmsStockEventPayload, } from '@rytass/wms-module-core';
11
+ export { WMS_OPERATION_NAMES } from '@rytass/wms-module-core';
package/index.js CHANGED
@@ -5,6 +5,8 @@ export { HOST_SKIP_METADATA_KEY } from './lib/auth/host-skip.constant.js';
5
5
  export { WmsAuthGuard } from './lib/auth/wms-auth.guard.js';
6
6
  export { WmsOperation } from './lib/auth/wms-operation.decorator.js';
7
7
  export { WMS_AUTH_OPTIONS, WMS_OPERATION_METADATA } from './lib/auth/wms-auth.types.js';
8
+ export { pruneDisabledOperations } from './lib/registry/operation-registry.js';
8
9
  export { WmsMutationEvent } from './lib/events/wms-mutation-event.decorator.js';
9
10
  export { WMS_MUTATION_EVENT_METADATA } from './lib/events/wms-mutation-event.constants.js';
10
11
  export { WmsMutationInterceptor } from './lib/events/wms-mutation.interceptor.js';
12
+ export { WMS_OPERATION_NAMES } from '@rytass/wms-module-core';
@@ -22,3 +22,4 @@ export * from './scrape-order.dto';
22
22
  export * from './scrape-order-item.dto';
23
23
  export * from './quality-inspection-order.dto';
24
24
  export * from './quality-inspection-order-item.dto';
25
+ export * from './inventory-count-order.dto';
@@ -0,0 +1,49 @@
1
+ import { InventoryCountStatus } from '@rytass/wms-module-core';
2
+ /**
3
+ * A count-sheet line.
4
+ *
5
+ * `material` / `batch` / `location` / `loader` are deliberately absent from this
6
+ * class: they are added to the schema by `InventoryCountOrderItemResolver` as
7
+ * `@ResolveField`s so they load through DataLoaders, and declaring them here
8
+ * would make the class stop matching the entity the service returns.
9
+ */
10
+ export declare class InventoryCountOrderItemDto {
11
+ id: string;
12
+ orderId: string;
13
+ materialId: string;
14
+ batchId: string;
15
+ locationId: string | null;
16
+ loaderId: string | null;
17
+ unitId: string | null;
18
+ /** Ledger quantity in base units, frozen when counting started. */
19
+ bookQuantity: number;
20
+ /** What was found, expressed in `unitId`. `null` until someone counts it. */
21
+ countedQuantity: number | null;
22
+ /** `true` for a line added during counting for stock the books never had. */
23
+ isAddition: boolean;
24
+ }
25
+ /**
26
+ * A count order. `items` and `locations` come from
27
+ * `InventoryCountOrderResolver`, for the same reason as above; `locations`
28
+ * exposes the roots the user picked, not the expanded subtree.
29
+ */
30
+ export declare class InventoryCountOrderDto {
31
+ id: string;
32
+ key: string;
33
+ name: string;
34
+ /**
35
+ * The count's base date. Stock adjustments from settlement are reported under
36
+ * this date rather than the day settlement happened to run.
37
+ */
38
+ countDate: string;
39
+ status: InventoryCountStatus;
40
+ createdBy: string | null;
41
+ startedAt: Date | null;
42
+ settledAt: Date | null;
43
+ cancelledAt: Date | null;
44
+ createdAt: Date;
45
+ }
46
+ declare const InventoryCountOrders_base: new () => import("./pagination.dto").PaginatedType<InventoryCountOrderDto>;
47
+ export declare class InventoryCountOrders extends InventoryCountOrders_base {
48
+ }
49
+ export {};
@@ -0,0 +1,146 @@
1
+ import { __decorate, __metadata } from 'tslib';
2
+ import { registerEnumType, Field, ID, Float, ObjectType } from '@nestjs/graphql';
3
+ import { InventoryCountStatus } from '@rytass/wms-module-core';
4
+ import { PaginatedResponse } from './pagination.dto.js';
5
+
6
+ registerEnumType(InventoryCountStatus, {
7
+ name: 'InventoryCountStatus',
8
+ description: 'Lifecycle of an inventory count: PENDING (尚未執行) → COUNTING (盤點中) → COMPLETED (已完成), or CANCELLED (已取消).',
9
+ });
10
+ /**
11
+ * A count-sheet line.
12
+ *
13
+ * `material` / `batch` / `location` / `loader` are deliberately absent from this
14
+ * class: they are added to the schema by `InventoryCountOrderItemResolver` as
15
+ * `@ResolveField`s so they load through DataLoaders, and declaring them here
16
+ * would make the class stop matching the entity the service returns.
17
+ */
18
+ let InventoryCountOrderItemDto = class InventoryCountOrderItemDto {
19
+ id;
20
+ orderId;
21
+ materialId;
22
+ batchId;
23
+ locationId;
24
+ loaderId;
25
+ unitId;
26
+ /** Ledger quantity in base units, frozen when counting started. */
27
+ bookQuantity;
28
+ /** What was found, expressed in `unitId`. `null` until someone counts it. */
29
+ countedQuantity;
30
+ /** `true` for a line added during counting for stock the books never had. */
31
+ isAddition;
32
+ };
33
+ __decorate([
34
+ Field(() => ID),
35
+ __metadata("design:type", String)
36
+ ], InventoryCountOrderItemDto.prototype, "id", void 0);
37
+ __decorate([
38
+ Field(() => ID),
39
+ __metadata("design:type", String)
40
+ ], InventoryCountOrderItemDto.prototype, "orderId", void 0);
41
+ __decorate([
42
+ Field(() => ID),
43
+ __metadata("design:type", String)
44
+ ], InventoryCountOrderItemDto.prototype, "materialId", void 0);
45
+ __decorate([
46
+ Field(() => ID),
47
+ __metadata("design:type", String)
48
+ ], InventoryCountOrderItemDto.prototype, "batchId", void 0);
49
+ __decorate([
50
+ Field(() => ID, { nullable: true }),
51
+ __metadata("design:type", Object)
52
+ ], InventoryCountOrderItemDto.prototype, "locationId", void 0);
53
+ __decorate([
54
+ Field(() => ID, { nullable: true }),
55
+ __metadata("design:type", Object)
56
+ ], InventoryCountOrderItemDto.prototype, "loaderId", void 0);
57
+ __decorate([
58
+ Field(() => ID, { nullable: true }),
59
+ __metadata("design:type", Object)
60
+ ], InventoryCountOrderItemDto.prototype, "unitId", void 0);
61
+ __decorate([
62
+ Field(() => Float),
63
+ __metadata("design:type", Number)
64
+ ], InventoryCountOrderItemDto.prototype, "bookQuantity", void 0);
65
+ __decorate([
66
+ Field(() => Float, { nullable: true }),
67
+ __metadata("design:type", Object)
68
+ ], InventoryCountOrderItemDto.prototype, "countedQuantity", void 0);
69
+ __decorate([
70
+ Field(() => Boolean),
71
+ __metadata("design:type", Boolean)
72
+ ], InventoryCountOrderItemDto.prototype, "isAddition", void 0);
73
+ InventoryCountOrderItemDto = __decorate([
74
+ ObjectType()
75
+ ], InventoryCountOrderItemDto);
76
+ /**
77
+ * A count order. `items` and `locations` come from
78
+ * `InventoryCountOrderResolver`, for the same reason as above; `locations`
79
+ * exposes the roots the user picked, not the expanded subtree.
80
+ */
81
+ let InventoryCountOrderDto = class InventoryCountOrderDto {
82
+ id;
83
+ key;
84
+ name;
85
+ /**
86
+ * The count's base date. Stock adjustments from settlement are reported under
87
+ * this date rather than the day settlement happened to run.
88
+ */
89
+ countDate;
90
+ status;
91
+ createdBy;
92
+ startedAt;
93
+ settledAt;
94
+ cancelledAt;
95
+ createdAt;
96
+ };
97
+ __decorate([
98
+ Field(() => ID),
99
+ __metadata("design:type", String)
100
+ ], InventoryCountOrderDto.prototype, "id", void 0);
101
+ __decorate([
102
+ Field(() => String),
103
+ __metadata("design:type", String)
104
+ ], InventoryCountOrderDto.prototype, "key", void 0);
105
+ __decorate([
106
+ Field(() => String),
107
+ __metadata("design:type", String)
108
+ ], InventoryCountOrderDto.prototype, "name", void 0);
109
+ __decorate([
110
+ Field(() => String),
111
+ __metadata("design:type", String)
112
+ ], InventoryCountOrderDto.prototype, "countDate", void 0);
113
+ __decorate([
114
+ Field(() => InventoryCountStatus),
115
+ __metadata("design:type", String)
116
+ ], InventoryCountOrderDto.prototype, "status", void 0);
117
+ __decorate([
118
+ Field(() => String, { nullable: true }),
119
+ __metadata("design:type", Object)
120
+ ], InventoryCountOrderDto.prototype, "createdBy", void 0);
121
+ __decorate([
122
+ Field(() => Date, { nullable: true }),
123
+ __metadata("design:type", Object)
124
+ ], InventoryCountOrderDto.prototype, "startedAt", void 0);
125
+ __decorate([
126
+ Field(() => Date, { nullable: true }),
127
+ __metadata("design:type", Object)
128
+ ], InventoryCountOrderDto.prototype, "settledAt", void 0);
129
+ __decorate([
130
+ Field(() => Date, { nullable: true }),
131
+ __metadata("design:type", Object)
132
+ ], InventoryCountOrderDto.prototype, "cancelledAt", void 0);
133
+ __decorate([
134
+ Field(() => Date),
135
+ __metadata("design:type", Date)
136
+ ], InventoryCountOrderDto.prototype, "createdAt", void 0);
137
+ InventoryCountOrderDto = __decorate([
138
+ ObjectType()
139
+ ], InventoryCountOrderDto);
140
+ let InventoryCountOrders = class InventoryCountOrders extends PaginatedResponse(InventoryCountOrderDto) {
141
+ };
142
+ InventoryCountOrders = __decorate([
143
+ ObjectType()
144
+ ], InventoryCountOrders);
145
+
146
+ export { InventoryCountOrderDto, InventoryCountOrderItemDto, InventoryCountOrders };
@@ -12,6 +12,7 @@
12
12
  import type { WmsOperationEventName } from '@rytass/wms-module-core';
13
13
  import type { AllocateInventoryOrderDto, HoldInventoryOrderDto, LoaderDto, LoaderTypeDto, MaterialDto, QualityInspectionOrderDto, ReceiveInventoryOrderDto, ScrapeOrderDto, ShipInventoryOrderDto, TransferCustomerOrderDto, TransferOrderDto, TransferVendorOrderDto } from '../dto';
14
14
  import type { LocationDto } from '../dto/location.dto';
15
+ import type { InventoryCountOrderDto, InventoryCountOrderItemDto } from '../dto/inventory-count-order.dto';
15
16
  import type { MapDataDto } from '../dto/warehouse-map.dto';
16
17
  import type { MergeBatchOrderDto } from '../dto/merge-batch-order.dto';
17
18
  import type { ReclassifyInventoryOrderDto } from '../dto/reclassify-inventory-order.dto';
@@ -27,6 +28,13 @@ import type { SplitBatchOrderDto } from '../dto/split-batch-order.dto';
27
28
  * Maintenance: for every new `@Mutation`, add the matching entry here.
28
29
  */
29
30
  export interface WmsOperationResultMap extends Record<WmsOperationEventName, unknown> {
31
+ 'inventory-count-order.created': InventoryCountOrderDto;
32
+ 'inventory-count-order.updated': InventoryCountOrderDto | InventoryCountOrderItemDto;
33
+ 'inventory-count-order.started': InventoryCountOrderDto;
34
+ 'inventory-count-order.counted': InventoryCountOrderDto;
35
+ 'inventory-count-order.reset': InventoryCountOrderDto;
36
+ 'inventory-count-order.cancelled': InventoryCountOrderDto;
37
+ 'inventory-count-order.settled': InventoryCountOrderDto;
30
38
  'material.created': MaterialDto;
31
39
  'material.updated': MaterialDto;
32
40
  'location.created': LocationDto;
@@ -2,6 +2,7 @@ import { DynamicModule, type Provider } from '@nestjs/common';
2
2
  import { type WmsActorExtractor, type WmsModuleCoreModuleAsyncOptions } from '@rytass/wms-module-core';
3
3
  import { type WmsAuthModuleOptions } from './auth';
4
4
  import { type WmsTypedAfterListenerMap, type WmsTypedBeforeHookMap } from './events';
5
+ import { type WmsOperationRegistrationOptions } from './registry';
5
6
  /**
6
7
  * Options for `WmsModuleGraphqlModule.forRootAsync`. Extends the core module
7
8
  * options with:
@@ -16,11 +17,14 @@ import { type WmsTypedAfterListenerMap, type WmsTypedBeforeHookMap } from './eve
16
17
  * - `eventEmitterBridge` — pass `wmsEventEmitterBridgeProvider` from
17
18
  * `@rytass/wms-module-graphql/adapters/event-emitter` to also fan events out
18
19
  * to `@nestjs/event-emitter` (`@OnEvent('wms.<event>')`).
20
+ * - `enabledOperations` / `disabledOperations` / `disabledFields` — deployment
21
+ * switches that keep an operation **out of the schema entirely** rather than
22
+ * merely refusing it (see {@link WmsOperationRegistrationOptions}).
19
23
  *
20
24
  * Everything is optional; with nothing configured the module behaves exactly as
21
- * before (no events emitted, fully permissive).
25
+ * before (no events emitted, fully permissive, every operation registered).
22
26
  */
23
- export type WmsModuleGraphqlModuleAsyncOptions = WmsModuleCoreModuleAsyncOptions & WmsAuthModuleOptions & {
27
+ export type WmsModuleGraphqlModuleAsyncOptions = WmsModuleCoreModuleAsyncOptions & WmsAuthModuleOptions & WmsOperationRegistrationOptions & {
24
28
  readonly beforeHooks?: WmsTypedBeforeHookMap;
25
29
  readonly afterListeners?: WmsTypedAfterListenerMap;
26
30
  readonly actorExtractor?: WmsActorExtractor;
@@ -7,6 +7,7 @@ import './helpers/query-path.js';
7
7
  import { WmsAuthGuard } from './auth/wms-auth.guard.js';
8
8
  import { WMS_AUTH_OPTIONS } from './auth/wms-auth.types.js';
9
9
  import { WmsMutationInterceptor } from './events/wms-mutation.interceptor.js';
10
+ import { pruneDisabledOperations } from './registry/operation-registry.js';
10
11
  import { LoaderMutation } from './mutations/loader.mutation.js';
11
12
  import { LoaderQuery } from './queries/loader.query.js';
12
13
  import { MaterialMutation } from './mutations/material.mutation.js';
@@ -53,6 +54,9 @@ import { ScrapeMutation } from './mutations/scrape-order.mutation.js';
53
54
  import { QualityInspectionOrderMutation } from './mutations/quality-inspection-order.mutation.js';
54
55
  import { WarehouseMapDataQuery } from './queries/warehouse-map.query.js';
55
56
  import { MapRangeUnionResolver } from './resolvers/warehouse-map.resolver.js';
57
+ import { InventoryCountOrderQuery } from './queries/inventory-count-order.query.js';
58
+ import { InventoryCountOrderMutation } from './mutations/inventory-count-order.mutation.js';
59
+ import { InventoryCountOrderResolver, InventoryCountOrderItemResolver } from './resolvers/inventory-count-order.resolver.js';
56
60
 
57
61
  var WmsModuleGraphqlModule_1;
58
62
  const exportDependencies = [
@@ -108,10 +112,23 @@ const exportDependencies = [
108
112
  QualityInspectionOrderMutation,
109
113
  WarehouseMapDataQuery,
110
114
  MapRangeUnionResolver,
115
+ InventoryCountOrderQuery,
116
+ InventoryCountOrderMutation,
117
+ InventoryCountOrderResolver,
118
+ InventoryCountOrderItemResolver,
111
119
  ];
112
120
  let WmsModuleGraphqlModule = WmsModuleGraphqlModule_1 = class WmsModuleGraphqlModule {
113
121
  static forRootAsync(options) {
114
- const { authChecker, beforeHooks, afterListeners, actorExtractor, eventEmitterBridge, ...coreOptions } = options;
122
+ const { authChecker, beforeHooks, afterListeners, actorExtractor, eventEmitterBridge, enabledOperations, disabledOperations, disabledFields, ...coreOptions } = options;
123
+ // Must run before `GraphQLModule` builds the schema. `forRootAsync` is
124
+ // called while `AppModule` is still being defined, so this is the earliest
125
+ // point at which the deployment's switches are known — and it is early
126
+ // enough: the schema is not built until the app bootstraps.
127
+ pruneDisabledOperations(exportDependencies, {
128
+ enabledOperations,
129
+ disabledOperations,
130
+ disabledFields,
131
+ });
115
132
  // coreOptions still carries `enrichStockEvents`, forwarded to the core module.
116
133
  const coreModule = WmsModuleCoreModule.forRootAsync(coreOptions);
117
134
  const authOptions = { authChecker };
@@ -0,0 +1,55 @@
1
+ import { InventoryCountStatus } from '@rytass/wms-module-core';
2
+ import { PaginationArgs } from './pagination.args';
3
+ export declare class FindInventoryCountOrderArgs extends PaginationArgs {
4
+ name?: string;
5
+ statuses?: InventoryCountStatus[];
6
+ createdBy?: string;
7
+ /** Inclusive lower bound on `countDate`, `YYYY-MM-DD`. */
8
+ countDateFrom?: string;
9
+ /** Inclusive upper bound on `countDate`, `YYYY-MM-DD`. */
10
+ countDateTo?: string;
11
+ /**
12
+ * Matches against the expanded scope, not the roots the user picked, so
13
+ * filtering by a shelf finds the count that covers its whole aisle.
14
+ */
15
+ locationIds?: string[];
16
+ }
17
+ export declare class CreateInventoryCountOrderArgs {
18
+ name: string;
19
+ countDate: string;
20
+ /** Root locations; every descendant is pulled into scope automatically. */
21
+ locationIds: string[];
22
+ }
23
+ export declare class UpdateInventoryCountOrderArgs {
24
+ id: string;
25
+ name?: string;
26
+ countDate?: string;
27
+ locationIds?: string[];
28
+ }
29
+ export declare class CountInventoryItemInput {
30
+ itemId: string;
31
+ /** `null` clears the entry, putting the line back to "not counted". */
32
+ countedQuantity?: number | null;
33
+ unitId?: string | null;
34
+ }
35
+ export declare class CountInventoryArgs {
36
+ id: string;
37
+ items: CountInventoryItemInput[];
38
+ }
39
+ export declare class AddInventoryCountItemArgs {
40
+ id: string;
41
+ materialId: string;
42
+ /** An existing batch key, or a new one — the batch is created on demand. */
43
+ batchKey: string;
44
+ locationId: string;
45
+ loaderId?: string | null;
46
+ countedQuantity: number;
47
+ unitId?: string | null;
48
+ }
49
+ export declare class RemoveInventoryCountItemArgs {
50
+ id: string;
51
+ itemId: string;
52
+ }
53
+ export declare class InventoryCountOrderIdArgs {
54
+ id: string;
55
+ }
@@ -0,0 +1,196 @@
1
+ import { __decorate, __metadata } from 'tslib';
2
+ import { Field, ID, ArgsType, Float, InputType } from '@nestjs/graphql';
3
+ import { InventoryCountStatus } from '@rytass/wms-module-core';
4
+ import { PaginationArgs } from './pagination.args.js';
5
+
6
+ let FindInventoryCountOrderArgs = class FindInventoryCountOrderArgs extends PaginationArgs {
7
+ name;
8
+ statuses;
9
+ createdBy;
10
+ /** Inclusive lower bound on `countDate`, `YYYY-MM-DD`. */
11
+ countDateFrom;
12
+ /** Inclusive upper bound on `countDate`, `YYYY-MM-DD`. */
13
+ countDateTo;
14
+ /**
15
+ * Matches against the expanded scope, not the roots the user picked, so
16
+ * filtering by a shelf finds the count that covers its whole aisle.
17
+ */
18
+ locationIds;
19
+ };
20
+ __decorate([
21
+ Field(() => String, { nullable: true }),
22
+ __metadata("design:type", String)
23
+ ], FindInventoryCountOrderArgs.prototype, "name", void 0);
24
+ __decorate([
25
+ Field(() => [InventoryCountStatus], { nullable: true }),
26
+ __metadata("design:type", Array)
27
+ ], FindInventoryCountOrderArgs.prototype, "statuses", void 0);
28
+ __decorate([
29
+ Field(() => String, { nullable: true }),
30
+ __metadata("design:type", String)
31
+ ], FindInventoryCountOrderArgs.prototype, "createdBy", void 0);
32
+ __decorate([
33
+ Field(() => String, { nullable: true }),
34
+ __metadata("design:type", String)
35
+ ], FindInventoryCountOrderArgs.prototype, "countDateFrom", void 0);
36
+ __decorate([
37
+ Field(() => String, { nullable: true }),
38
+ __metadata("design:type", String)
39
+ ], FindInventoryCountOrderArgs.prototype, "countDateTo", void 0);
40
+ __decorate([
41
+ Field(() => [ID], { nullable: true }),
42
+ __metadata("design:type", Array)
43
+ ], FindInventoryCountOrderArgs.prototype, "locationIds", void 0);
44
+ FindInventoryCountOrderArgs = __decorate([
45
+ ArgsType()
46
+ ], FindInventoryCountOrderArgs);
47
+ let CreateInventoryCountOrderArgs = class CreateInventoryCountOrderArgs {
48
+ name;
49
+ countDate;
50
+ /** Root locations; every descendant is pulled into scope automatically. */
51
+ locationIds;
52
+ };
53
+ __decorate([
54
+ Field(() => String),
55
+ __metadata("design:type", String)
56
+ ], CreateInventoryCountOrderArgs.prototype, "name", void 0);
57
+ __decorate([
58
+ Field(() => String),
59
+ __metadata("design:type", String)
60
+ ], CreateInventoryCountOrderArgs.prototype, "countDate", void 0);
61
+ __decorate([
62
+ Field(() => [ID]),
63
+ __metadata("design:type", Array)
64
+ ], CreateInventoryCountOrderArgs.prototype, "locationIds", void 0);
65
+ CreateInventoryCountOrderArgs = __decorate([
66
+ ArgsType()
67
+ ], CreateInventoryCountOrderArgs);
68
+ let UpdateInventoryCountOrderArgs = class UpdateInventoryCountOrderArgs {
69
+ id;
70
+ name;
71
+ countDate;
72
+ locationIds;
73
+ };
74
+ __decorate([
75
+ Field(() => ID),
76
+ __metadata("design:type", String)
77
+ ], UpdateInventoryCountOrderArgs.prototype, "id", void 0);
78
+ __decorate([
79
+ Field(() => String, { nullable: true }),
80
+ __metadata("design:type", String)
81
+ ], UpdateInventoryCountOrderArgs.prototype, "name", void 0);
82
+ __decorate([
83
+ Field(() => String, { nullable: true }),
84
+ __metadata("design:type", String)
85
+ ], UpdateInventoryCountOrderArgs.prototype, "countDate", void 0);
86
+ __decorate([
87
+ Field(() => [ID], { nullable: true }),
88
+ __metadata("design:type", Array)
89
+ ], UpdateInventoryCountOrderArgs.prototype, "locationIds", void 0);
90
+ UpdateInventoryCountOrderArgs = __decorate([
91
+ ArgsType()
92
+ ], UpdateInventoryCountOrderArgs);
93
+ let CountInventoryItemInput = class CountInventoryItemInput {
94
+ itemId;
95
+ /** `null` clears the entry, putting the line back to "not counted". */
96
+ countedQuantity;
97
+ unitId;
98
+ };
99
+ __decorate([
100
+ Field(() => ID),
101
+ __metadata("design:type", String)
102
+ ], CountInventoryItemInput.prototype, "itemId", void 0);
103
+ __decorate([
104
+ Field(() => Float, { nullable: true }),
105
+ __metadata("design:type", Object)
106
+ ], CountInventoryItemInput.prototype, "countedQuantity", void 0);
107
+ __decorate([
108
+ Field(() => ID, { nullable: true }),
109
+ __metadata("design:type", Object)
110
+ ], CountInventoryItemInput.prototype, "unitId", void 0);
111
+ CountInventoryItemInput = __decorate([
112
+ InputType()
113
+ ], CountInventoryItemInput);
114
+ let CountInventoryArgs = class CountInventoryArgs {
115
+ id;
116
+ items;
117
+ };
118
+ __decorate([
119
+ Field(() => ID),
120
+ __metadata("design:type", String)
121
+ ], CountInventoryArgs.prototype, "id", void 0);
122
+ __decorate([
123
+ Field(() => [CountInventoryItemInput]),
124
+ __metadata("design:type", Array)
125
+ ], CountInventoryArgs.prototype, "items", void 0);
126
+ CountInventoryArgs = __decorate([
127
+ ArgsType()
128
+ ], CountInventoryArgs);
129
+ let AddInventoryCountItemArgs = class AddInventoryCountItemArgs {
130
+ id;
131
+ materialId;
132
+ /** An existing batch key, or a new one — the batch is created on demand. */
133
+ batchKey;
134
+ locationId;
135
+ loaderId;
136
+ countedQuantity;
137
+ unitId;
138
+ };
139
+ __decorate([
140
+ Field(() => ID),
141
+ __metadata("design:type", String)
142
+ ], AddInventoryCountItemArgs.prototype, "id", void 0);
143
+ __decorate([
144
+ Field(() => ID),
145
+ __metadata("design:type", String)
146
+ ], AddInventoryCountItemArgs.prototype, "materialId", void 0);
147
+ __decorate([
148
+ Field(() => String),
149
+ __metadata("design:type", String)
150
+ ], AddInventoryCountItemArgs.prototype, "batchKey", void 0);
151
+ __decorate([
152
+ Field(() => ID),
153
+ __metadata("design:type", String)
154
+ ], AddInventoryCountItemArgs.prototype, "locationId", void 0);
155
+ __decorate([
156
+ Field(() => ID, { nullable: true }),
157
+ __metadata("design:type", Object)
158
+ ], AddInventoryCountItemArgs.prototype, "loaderId", void 0);
159
+ __decorate([
160
+ Field(() => Float),
161
+ __metadata("design:type", Number)
162
+ ], AddInventoryCountItemArgs.prototype, "countedQuantity", void 0);
163
+ __decorate([
164
+ Field(() => ID, { nullable: true }),
165
+ __metadata("design:type", Object)
166
+ ], AddInventoryCountItemArgs.prototype, "unitId", void 0);
167
+ AddInventoryCountItemArgs = __decorate([
168
+ ArgsType()
169
+ ], AddInventoryCountItemArgs);
170
+ let RemoveInventoryCountItemArgs = class RemoveInventoryCountItemArgs {
171
+ id;
172
+ itemId;
173
+ };
174
+ __decorate([
175
+ Field(() => ID),
176
+ __metadata("design:type", String)
177
+ ], RemoveInventoryCountItemArgs.prototype, "id", void 0);
178
+ __decorate([
179
+ Field(() => ID),
180
+ __metadata("design:type", String)
181
+ ], RemoveInventoryCountItemArgs.prototype, "itemId", void 0);
182
+ RemoveInventoryCountItemArgs = __decorate([
183
+ ArgsType()
184
+ ], RemoveInventoryCountItemArgs);
185
+ let InventoryCountOrderIdArgs = class InventoryCountOrderIdArgs {
186
+ id;
187
+ };
188
+ __decorate([
189
+ Field(() => ID),
190
+ __metadata("design:type", String)
191
+ ], InventoryCountOrderIdArgs.prototype, "id", void 0);
192
+ InventoryCountOrderIdArgs = __decorate([
193
+ ArgsType()
194
+ ], InventoryCountOrderIdArgs);
195
+
196
+ export { AddInventoryCountItemArgs, CountInventoryArgs, CountInventoryItemInput, CreateInventoryCountOrderArgs, FindInventoryCountOrderArgs, InventoryCountOrderIdArgs, RemoveInventoryCountItemArgs, UpdateInventoryCountOrderArgs };
@@ -0,0 +1,19 @@
1
+ import { InventoryCountOrderService } from '@rytass/wms-module-core';
2
+ import { InventoryCountOrderDto, InventoryCountOrderItemDto } from '../dto/inventory-count-order.dto';
3
+ import { AddInventoryCountItemArgs, CountInventoryArgs, CreateInventoryCountOrderArgs, InventoryCountOrderIdArgs, RemoveInventoryCountItemArgs, UpdateInventoryCountOrderArgs } from '../inputs/inventory-count-order.args';
4
+ export declare class InventoryCountOrderMutation {
5
+ private readonly inventoryCountOrderService;
6
+ constructor(inventoryCountOrderService: InventoryCountOrderService);
7
+ createInventoryCountOrder(args: CreateInventoryCountOrderArgs): Promise<InventoryCountOrderDto>;
8
+ updateInventoryCountOrder({ id, ...input }: UpdateInventoryCountOrderArgs): Promise<InventoryCountOrderDto>;
9
+ startInventoryCount({ id }: InventoryCountOrderIdArgs): Promise<InventoryCountOrderDto>;
10
+ /** "暫存結果" — record what was counted without touching stock. */
11
+ countInventory({ id, items }: CountInventoryArgs): Promise<InventoryCountOrderDto>;
12
+ addInventoryCountItem({ id, ...input }: AddInventoryCountItemArgs): Promise<InventoryCountOrderItemDto>;
13
+ removeInventoryCountItem({ id, itemId }: RemoveInventoryCountItemArgs): Promise<InventoryCountOrderDto>;
14
+ /** "清空重填" — discard the counting, keep the lock and the status. */
15
+ resetInventoryCount({ id }: InventoryCountOrderIdArgs): Promise<InventoryCountOrderDto>;
16
+ cancelInventoryCount({ id }: InventoryCountOrderIdArgs): Promise<InventoryCountOrderDto>;
17
+ /** "執行盤差" — the only mutation here that changes stock. */
18
+ settleInventoryCount({ id }: InventoryCountOrderIdArgs): Promise<InventoryCountOrderDto>;
19
+ }