@rytass/wms-module-graphql 0.10.2 → 0.11.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 (58) hide show
  1. package/index.cjs.js +1009 -98
  2. package/lib/dto/consumption-order-item.dto.d.ts +17 -0
  3. package/lib/dto/consumption-order-item.dto.js +43 -0
  4. package/lib/dto/consumption-order.dto.d.ts +14 -0
  5. package/lib/dto/consumption-order.dto.js +52 -0
  6. package/lib/dto/index.d.ts +3 -0
  7. package/lib/dto/inventory-count-order.dto.d.ts +7 -1
  8. package/lib/dto/inventory-count-order.dto.js +11 -1
  9. package/lib/dto/order-reference.dto.d.ts +22 -0
  10. package/lib/dto/order-reference.dto.js +73 -0
  11. package/lib/dto/stock.dto.d.ts +15 -0
  12. package/lib/dto/stock.dto.js +28 -0
  13. package/lib/events/operation-result-map.d.ts +13 -0
  14. package/lib/events/typed-maps.d.ts +17 -7
  15. package/lib/events/wms-mutation.interceptor.d.ts +11 -9
  16. package/lib/events/wms-mutation.interceptor.js +19 -45
  17. package/lib/graphql.module.d.ts +1 -1
  18. package/lib/graphql.module.js +30 -13
  19. package/lib/inputs/consumption-order.args.d.ts +47 -0
  20. package/lib/inputs/consumption-order.args.js +182 -0
  21. package/lib/inputs/find-stock.args.d.ts +6 -0
  22. package/lib/inputs/find-stock.args.js +10 -0
  23. package/lib/inputs/order-reference.args.d.ts +32 -0
  24. package/lib/inputs/order-reference.args.js +103 -0
  25. package/lib/inputs/split-batch.args.d.ts +6 -0
  26. package/lib/inputs/split-batch.args.js +11 -0
  27. package/lib/mutations/consumption-order.mutation.d.ts +18 -0
  28. package/lib/mutations/consumption-order.mutation.js +90 -0
  29. package/lib/mutations/loader.mutation.js +3 -0
  30. package/lib/mutations/material.mutation.js +3 -0
  31. package/lib/mutations/order-reference.mutation.d.ts +13 -0
  32. package/lib/mutations/order-reference.mutation.js +57 -0
  33. package/lib/mutations/receive-inventory-order.mutation.js +3 -0
  34. package/lib/mutations/ship-inventory-order.mutation.js +3 -0
  35. package/lib/queries/consumption-order.query.d.ts +9 -0
  36. package/lib/queries/consumption-order.query.js +45 -0
  37. package/lib/queries/loader.query.js +3 -0
  38. package/lib/queries/material.query.js +3 -0
  39. package/lib/queries/order-reference.query.d.ts +8 -0
  40. package/lib/queries/order-reference.query.js +34 -0
  41. package/lib/queries/recieve-inventory-order.query.js +3 -0
  42. package/lib/queries/ship-inventory-order.query.js +3 -0
  43. package/lib/queries/stock.query.js +3 -0
  44. package/lib/resolvers/aggregated-stock.resolver.js +3 -0
  45. package/lib/resolvers/change-log.resolver.js +3 -0
  46. package/lib/resolvers/consumption-order.resolver.d.ts +40 -0
  47. package/lib/resolvers/consumption-order.resolver.js +238 -0
  48. package/lib/resolvers/loader-type.resolver.js +3 -0
  49. package/lib/resolvers/loader.resolver.js +3 -0
  50. package/lib/resolvers/material.resolver.js +3 -0
  51. package/lib/resolvers/receive-inventory-order.resolver.js +3 -0
  52. package/lib/resolvers/ship-inventory-order.resolver.js +3 -0
  53. package/lib/resolvers/stock.resolver.js +3 -0
  54. package/lib/resolvers/transfer-order.resolver.js +3 -0
  55. package/lib/scalars/index.d.ts +1 -0
  56. package/lib/scalars/json-object.scalar.d.ts +2 -0
  57. package/lib/scalars/json-object.scalar.js +62 -0
  58. package/package.json +2 -2
@@ -0,0 +1,47 @@
1
+ import { PaginationArgs } from './pagination.args';
2
+ export declare class CreateConsumptionOrderItemInputType {
3
+ materialId: string;
4
+ batchId: string;
5
+ /** Where the material is issued from. Defaults to the module's default location. */
6
+ locationId?: string;
7
+ loaderId?: string;
8
+ unitId?: string;
9
+ quantity: number;
10
+ /** Where it sits while the process holds it. Defaults to the source location. */
11
+ targetLocationId?: string;
12
+ targetLoaderId?: string;
13
+ }
14
+ export declare class CreateConsumptionOrderArgs {
15
+ description?: string;
16
+ createdBy?: string;
17
+ items: CreateConsumptionOrderItemInputType[];
18
+ }
19
+ export declare class UpdateConsumptionOrderArgs {
20
+ id: string;
21
+ description?: string;
22
+ /** Replaces every line. Refused once the order has moved any stock. */
23
+ items?: CreateConsumptionOrderItemInputType[];
24
+ }
25
+ export declare class ConsumptionOrderLineInputType {
26
+ itemId: string;
27
+ /** Omit for whatever is outstanding on that line. */
28
+ quantity?: number;
29
+ }
30
+ export declare class ConsumptionOrderActionArgs {
31
+ orderId: string;
32
+ /** Omit to act on every line of the order. */
33
+ items?: ConsumptionOrderLineInputType[];
34
+ }
35
+ export declare class FindConsumptionOrderArgs extends PaginationArgs {
36
+ ids?: string[];
37
+ key?: string;
38
+ description?: string;
39
+ materialId?: string;
40
+ batchId?: string;
41
+ /** Matches either the source or the consuming location. */
42
+ locationId?: string;
43
+ createdBy?: string;
44
+ createdAtFrom?: Date;
45
+ createdAtTo?: Date;
46
+ includeRemoved?: boolean;
47
+ }
@@ -0,0 +1,182 @@
1
+ import { __decorate, __metadata } from 'tslib';
2
+ import { Field, ID, Float, InputType, ArgsType } from '@nestjs/graphql';
3
+ import { PaginationArgs } from './pagination.args.js';
4
+
5
+ let CreateConsumptionOrderItemInputType = class CreateConsumptionOrderItemInputType {
6
+ materialId;
7
+ batchId;
8
+ /** Where the material is issued from. Defaults to the module's default location. */
9
+ locationId;
10
+ loaderId;
11
+ unitId;
12
+ quantity;
13
+ /** Where it sits while the process holds it. Defaults to the source location. */
14
+ targetLocationId;
15
+ targetLoaderId;
16
+ };
17
+ __decorate([
18
+ Field(() => ID),
19
+ __metadata("design:type", String)
20
+ ], CreateConsumptionOrderItemInputType.prototype, "materialId", void 0);
21
+ __decorate([
22
+ Field(() => ID),
23
+ __metadata("design:type", String)
24
+ ], CreateConsumptionOrderItemInputType.prototype, "batchId", void 0);
25
+ __decorate([
26
+ Field(() => ID, { nullable: true }),
27
+ __metadata("design:type", String)
28
+ ], CreateConsumptionOrderItemInputType.prototype, "locationId", void 0);
29
+ __decorate([
30
+ Field(() => ID, { nullable: true }),
31
+ __metadata("design:type", String)
32
+ ], CreateConsumptionOrderItemInputType.prototype, "loaderId", void 0);
33
+ __decorate([
34
+ Field(() => ID, { nullable: true }),
35
+ __metadata("design:type", String)
36
+ ], CreateConsumptionOrderItemInputType.prototype, "unitId", void 0);
37
+ __decorate([
38
+ Field(() => Float),
39
+ __metadata("design:type", Number)
40
+ ], CreateConsumptionOrderItemInputType.prototype, "quantity", void 0);
41
+ __decorate([
42
+ Field(() => ID, { nullable: true }),
43
+ __metadata("design:type", String)
44
+ ], CreateConsumptionOrderItemInputType.prototype, "targetLocationId", void 0);
45
+ __decorate([
46
+ Field(() => ID, { nullable: true }),
47
+ __metadata("design:type", String)
48
+ ], CreateConsumptionOrderItemInputType.prototype, "targetLoaderId", void 0);
49
+ CreateConsumptionOrderItemInputType = __decorate([
50
+ InputType()
51
+ ], CreateConsumptionOrderItemInputType);
52
+ let CreateConsumptionOrderArgs = class CreateConsumptionOrderArgs {
53
+ description;
54
+ createdBy;
55
+ items;
56
+ };
57
+ __decorate([
58
+ Field(() => String, { nullable: true }),
59
+ __metadata("design:type", String)
60
+ ], CreateConsumptionOrderArgs.prototype, "description", void 0);
61
+ __decorate([
62
+ Field(() => String, { nullable: true }),
63
+ __metadata("design:type", String)
64
+ ], CreateConsumptionOrderArgs.prototype, "createdBy", void 0);
65
+ __decorate([
66
+ Field(() => [CreateConsumptionOrderItemInputType]),
67
+ __metadata("design:type", Array)
68
+ ], CreateConsumptionOrderArgs.prototype, "items", void 0);
69
+ CreateConsumptionOrderArgs = __decorate([
70
+ ArgsType()
71
+ ], CreateConsumptionOrderArgs);
72
+ let UpdateConsumptionOrderArgs = class UpdateConsumptionOrderArgs {
73
+ id;
74
+ description;
75
+ /** Replaces every line. Refused once the order has moved any stock. */
76
+ items;
77
+ };
78
+ __decorate([
79
+ Field(() => ID),
80
+ __metadata("design:type", String)
81
+ ], UpdateConsumptionOrderArgs.prototype, "id", void 0);
82
+ __decorate([
83
+ Field(() => String, { nullable: true }),
84
+ __metadata("design:type", String)
85
+ ], UpdateConsumptionOrderArgs.prototype, "description", void 0);
86
+ __decorate([
87
+ Field(() => [CreateConsumptionOrderItemInputType], { nullable: true }),
88
+ __metadata("design:type", Array)
89
+ ], UpdateConsumptionOrderArgs.prototype, "items", void 0);
90
+ UpdateConsumptionOrderArgs = __decorate([
91
+ ArgsType()
92
+ ], UpdateConsumptionOrderArgs);
93
+ let ConsumptionOrderLineInputType = class ConsumptionOrderLineInputType {
94
+ itemId;
95
+ /** Omit for whatever is outstanding on that line. */
96
+ quantity;
97
+ };
98
+ __decorate([
99
+ Field(() => ID),
100
+ __metadata("design:type", String)
101
+ ], ConsumptionOrderLineInputType.prototype, "itemId", void 0);
102
+ __decorate([
103
+ Field(() => Float, { nullable: true }),
104
+ __metadata("design:type", Number)
105
+ ], ConsumptionOrderLineInputType.prototype, "quantity", void 0);
106
+ ConsumptionOrderLineInputType = __decorate([
107
+ InputType()
108
+ ], ConsumptionOrderLineInputType);
109
+ let ConsumptionOrderActionArgs = class ConsumptionOrderActionArgs {
110
+ orderId;
111
+ /** Omit to act on every line of the order. */
112
+ items;
113
+ };
114
+ __decorate([
115
+ Field(() => ID),
116
+ __metadata("design:type", String)
117
+ ], ConsumptionOrderActionArgs.prototype, "orderId", void 0);
118
+ __decorate([
119
+ Field(() => [ConsumptionOrderLineInputType], { nullable: true }),
120
+ __metadata("design:type", Array)
121
+ ], ConsumptionOrderActionArgs.prototype, "items", void 0);
122
+ ConsumptionOrderActionArgs = __decorate([
123
+ ArgsType()
124
+ ], ConsumptionOrderActionArgs);
125
+ let FindConsumptionOrderArgs = class FindConsumptionOrderArgs extends PaginationArgs {
126
+ ids;
127
+ key;
128
+ description;
129
+ materialId;
130
+ batchId;
131
+ /** Matches either the source or the consuming location. */
132
+ locationId;
133
+ createdBy;
134
+ createdAtFrom;
135
+ createdAtTo;
136
+ includeRemoved;
137
+ };
138
+ __decorate([
139
+ Field(() => [ID], { nullable: true }),
140
+ __metadata("design:type", Array)
141
+ ], FindConsumptionOrderArgs.prototype, "ids", void 0);
142
+ __decorate([
143
+ Field(() => String, { nullable: true }),
144
+ __metadata("design:type", String)
145
+ ], FindConsumptionOrderArgs.prototype, "key", void 0);
146
+ __decorate([
147
+ Field(() => String, { nullable: true }),
148
+ __metadata("design:type", String)
149
+ ], FindConsumptionOrderArgs.prototype, "description", void 0);
150
+ __decorate([
151
+ Field(() => ID, { nullable: true }),
152
+ __metadata("design:type", String)
153
+ ], FindConsumptionOrderArgs.prototype, "materialId", void 0);
154
+ __decorate([
155
+ Field(() => ID, { nullable: true }),
156
+ __metadata("design:type", String)
157
+ ], FindConsumptionOrderArgs.prototype, "batchId", void 0);
158
+ __decorate([
159
+ Field(() => ID, { nullable: true }),
160
+ __metadata("design:type", String)
161
+ ], FindConsumptionOrderArgs.prototype, "locationId", void 0);
162
+ __decorate([
163
+ Field(() => String, { nullable: true }),
164
+ __metadata("design:type", String)
165
+ ], FindConsumptionOrderArgs.prototype, "createdBy", void 0);
166
+ __decorate([
167
+ Field(() => Date, { nullable: true }),
168
+ __metadata("design:type", Date)
169
+ ], FindConsumptionOrderArgs.prototype, "createdAtFrom", void 0);
170
+ __decorate([
171
+ Field(() => Date, { nullable: true }),
172
+ __metadata("design:type", Date)
173
+ ], FindConsumptionOrderArgs.prototype, "createdAtTo", void 0);
174
+ __decorate([
175
+ Field(() => Boolean, { nullable: true }),
176
+ __metadata("design:type", Boolean)
177
+ ], FindConsumptionOrderArgs.prototype, "includeRemoved", void 0);
178
+ FindConsumptionOrderArgs = __decorate([
179
+ ArgsType()
180
+ ], FindConsumptionOrderArgs);
181
+
182
+ export { ConsumptionOrderActionArgs, ConsumptionOrderLineInputType, CreateConsumptionOrderArgs, CreateConsumptionOrderItemInputType, FindConsumptionOrderArgs, UpdateConsumptionOrderArgs };
@@ -4,6 +4,12 @@ export declare class FindStockArgs extends PaginationArgs {
4
4
  materialId?: string;
5
5
  batchId?: string;
6
6
  locationId?: string;
7
+ /**
8
+ * Locations to leave out of the result. Subtractive counterpart to
9
+ * `locationId`: a stock report uses it to drop locations that do not hold
10
+ * available inventory (staging, quarantine, a host's work-in-progress lane).
11
+ */
12
+ excludeLocationIds?: string[];
7
13
  loaderId?: string;
8
14
  ids?: string[];
9
15
  description?: string;
@@ -7,6 +7,12 @@ let FindStockArgs = class FindStockArgs extends PaginationArgs {
7
7
  materialId;
8
8
  batchId;
9
9
  locationId;
10
+ /**
11
+ * Locations to leave out of the result. Subtractive counterpart to
12
+ * `locationId`: a stock report uses it to drop locations that do not hold
13
+ * available inventory (staging, quarantine, a host's work-in-progress lane).
14
+ */
15
+ excludeLocationIds;
10
16
  loaderId;
11
17
  ids;
12
18
  description;
@@ -37,6 +43,10 @@ __decorate([
37
43
  Field(() => ID, { nullable: true }),
38
44
  __metadata("design:type", String)
39
45
  ], FindStockArgs.prototype, "locationId", void 0);
46
+ __decorate([
47
+ Field(() => [ID], { nullable: true }),
48
+ __metadata("design:type", Array)
49
+ ], FindStockArgs.prototype, "excludeLocationIds", void 0);
40
50
  __decorate([
41
51
  Field(() => ID, { nullable: true }),
42
52
  __metadata("design:type", String)
@@ -0,0 +1,32 @@
1
+ import { WmsOrderType } from '@rytass/wms-module-core';
2
+ import { PaginationArgs } from './pagination.args';
3
+ /**
4
+ * Reads the link in either direction: give it an order to list what that order
5
+ * was opened for, or a `referenceType` / `referenceId` to list every order
6
+ * opened for that document.
7
+ *
8
+ * `referenceType` / `referenceId` / `referenceLine` match exactly, never as a
9
+ * substring — they are identifiers the host owns, and a partial match on
10
+ * 「WO-1」 would quietly sweep in 「WO-10」.
11
+ */
12
+ export declare class FindOrderReferenceArgs extends PaginationArgs {
13
+ orderType?: WmsOrderType;
14
+ orderId?: string;
15
+ itemId?: string;
16
+ referenceType?: string;
17
+ referenceId?: string;
18
+ referenceLine?: string;
19
+ }
20
+ export declare class OrderReferenceInputType {
21
+ referenceType: string;
22
+ referenceId: string;
23
+ referenceLine?: string | null;
24
+ /** The order item this link is about; omit for an order-level link. */
25
+ itemId?: string | null;
26
+ metadata?: Record<string, unknown> | null;
27
+ }
28
+ export declare class AttachOrderReferencesArgs {
29
+ orderType: WmsOrderType;
30
+ orderId: string;
31
+ references: OrderReferenceInputType[];
32
+ }
@@ -0,0 +1,103 @@
1
+ import { __decorate, __metadata } from 'tslib';
2
+ import { Field, ID, ArgsType, InputType } from '@nestjs/graphql';
3
+ import { WmsOrderType } from '@rytass/wms-module-core';
4
+ import { GraphQLJSONObject } from '../scalars/json-object.scalar.js';
5
+ import { PaginationArgs } from './pagination.args.js';
6
+
7
+ /**
8
+ * Reads the link in either direction: give it an order to list what that order
9
+ * was opened for, or a `referenceType` / `referenceId` to list every order
10
+ * opened for that document.
11
+ *
12
+ * `referenceType` / `referenceId` / `referenceLine` match exactly, never as a
13
+ * substring — they are identifiers the host owns, and a partial match on
14
+ * 「WO-1」 would quietly sweep in 「WO-10」.
15
+ */
16
+ let FindOrderReferenceArgs = class FindOrderReferenceArgs extends PaginationArgs {
17
+ orderType;
18
+ orderId;
19
+ itemId;
20
+ referenceType;
21
+ referenceId;
22
+ referenceLine;
23
+ };
24
+ __decorate([
25
+ Field(() => WmsOrderType, { nullable: true }),
26
+ __metadata("design:type", String)
27
+ ], FindOrderReferenceArgs.prototype, "orderType", void 0);
28
+ __decorate([
29
+ Field(() => ID, { nullable: true }),
30
+ __metadata("design:type", String)
31
+ ], FindOrderReferenceArgs.prototype, "orderId", void 0);
32
+ __decorate([
33
+ Field(() => ID, { nullable: true }),
34
+ __metadata("design:type", String)
35
+ ], FindOrderReferenceArgs.prototype, "itemId", void 0);
36
+ __decorate([
37
+ Field(() => String, { nullable: true }),
38
+ __metadata("design:type", String)
39
+ ], FindOrderReferenceArgs.prototype, "referenceType", void 0);
40
+ __decorate([
41
+ Field(() => String, { nullable: true }),
42
+ __metadata("design:type", String)
43
+ ], FindOrderReferenceArgs.prototype, "referenceId", void 0);
44
+ __decorate([
45
+ Field(() => String, { nullable: true }),
46
+ __metadata("design:type", String)
47
+ ], FindOrderReferenceArgs.prototype, "referenceLine", void 0);
48
+ FindOrderReferenceArgs = __decorate([
49
+ ArgsType()
50
+ ], FindOrderReferenceArgs);
51
+ let OrderReferenceInputType = class OrderReferenceInputType {
52
+ referenceType;
53
+ referenceId;
54
+ referenceLine;
55
+ /** The order item this link is about; omit for an order-level link. */
56
+ itemId;
57
+ metadata;
58
+ };
59
+ __decorate([
60
+ Field(() => String),
61
+ __metadata("design:type", String)
62
+ ], OrderReferenceInputType.prototype, "referenceType", void 0);
63
+ __decorate([
64
+ Field(() => String),
65
+ __metadata("design:type", String)
66
+ ], OrderReferenceInputType.prototype, "referenceId", void 0);
67
+ __decorate([
68
+ Field(() => String, { nullable: true }),
69
+ __metadata("design:type", Object)
70
+ ], OrderReferenceInputType.prototype, "referenceLine", void 0);
71
+ __decorate([
72
+ Field(() => ID, { nullable: true }),
73
+ __metadata("design:type", Object)
74
+ ], OrderReferenceInputType.prototype, "itemId", void 0);
75
+ __decorate([
76
+ Field(() => GraphQLJSONObject, { nullable: true }),
77
+ __metadata("design:type", Object)
78
+ ], OrderReferenceInputType.prototype, "metadata", void 0);
79
+ OrderReferenceInputType = __decorate([
80
+ InputType()
81
+ ], OrderReferenceInputType);
82
+ let AttachOrderReferencesArgs = class AttachOrderReferencesArgs {
83
+ orderType;
84
+ orderId;
85
+ references;
86
+ };
87
+ __decorate([
88
+ Field(() => WmsOrderType),
89
+ __metadata("design:type", String)
90
+ ], AttachOrderReferencesArgs.prototype, "orderType", void 0);
91
+ __decorate([
92
+ Field(() => ID),
93
+ __metadata("design:type", String)
94
+ ], AttachOrderReferencesArgs.prototype, "orderId", void 0);
95
+ __decorate([
96
+ Field(() => [OrderReferenceInputType]),
97
+ __metadata("design:type", Array)
98
+ ], AttachOrderReferencesArgs.prototype, "references", void 0);
99
+ AttachOrderReferencesArgs = __decorate([
100
+ ArgsType()
101
+ ], AttachOrderReferencesArgs);
102
+
103
+ export { AttachOrderReferencesArgs, FindOrderReferenceArgs, OrderReferenceInputType };
@@ -1,6 +1,12 @@
1
1
  export declare class SplitBatchItemInput {
2
2
  batchKey: string;
3
3
  quantity: number;
4
+ /**
5
+ * Host-defined attributes for this child batch. Applied only when the split
6
+ * creates the batch; reusing an existing `batchKey` keeps what that batch
7
+ * already carries.
8
+ */
9
+ attributes?: Record<string, unknown> | null;
4
10
  }
5
11
  export declare class SplitBatchArgs {
6
12
  aggregatedKey: string;
@@ -1,9 +1,16 @@
1
1
  import { __decorate, __metadata } from 'tslib';
2
2
  import { Field, ID, InputType, ArgsType } from '@nestjs/graphql';
3
+ import { GraphQLJSONObject } from '../scalars/json-object.scalar.js';
3
4
 
4
5
  let SplitBatchItemInput = class SplitBatchItemInput {
5
6
  batchKey;
6
7
  quantity;
8
+ /**
9
+ * Host-defined attributes for this child batch. Applied only when the split
10
+ * creates the batch; reusing an existing `batchKey` keeps what that batch
11
+ * already carries.
12
+ */
13
+ attributes;
7
14
  };
8
15
  __decorate([
9
16
  Field(() => ID),
@@ -13,6 +20,10 @@ __decorate([
13
20
  Field(() => Number),
14
21
  __metadata("design:type", Number)
15
22
  ], SplitBatchItemInput.prototype, "quantity", void 0);
23
+ __decorate([
24
+ Field(() => GraphQLJSONObject, { nullable: true }),
25
+ __metadata("design:type", Object)
26
+ ], SplitBatchItemInput.prototype, "attributes", void 0);
16
27
  SplitBatchItemInput = __decorate([
17
28
  InputType()
18
29
  ], SplitBatchItemInput);
@@ -0,0 +1,18 @@
1
+ import { ConsumptionOrderService } from '@rytass/wms-module-core';
2
+ import { ConsumptionOrderDto } from '../dto/consumption-order.dto';
3
+ import { ConsumptionOrderActionArgs, CreateConsumptionOrderArgs, UpdateConsumptionOrderArgs } from '../inputs/consumption-order.args';
4
+ /**
5
+ * The three actions are separate mutations rather than one with a mode
6
+ * argument: they carry different permissions (a host may well let the floor
7
+ * issue and return but not settle) and different events, and both of those are
8
+ * keyed per field.
9
+ */
10
+ export declare class ConsumptionOrderMutation {
11
+ private readonly consumptionOrderService;
12
+ constructor(consumptionOrderService: ConsumptionOrderService);
13
+ createConsumptionOrder(args: CreateConsumptionOrderArgs): Promise<ConsumptionOrderDto>;
14
+ updateConsumptionOrder(args: UpdateConsumptionOrderArgs): Promise<ConsumptionOrderDto>;
15
+ issueConsumptionOrder(args: ConsumptionOrderActionArgs): Promise<boolean>;
16
+ returnConsumptionOrder(args: ConsumptionOrderActionArgs): Promise<boolean>;
17
+ settleConsumptionOrder(args: ConsumptionOrderActionArgs): Promise<boolean>;
18
+ }
@@ -0,0 +1,90 @@
1
+ import { __decorate, __param, __metadata } from 'tslib';
2
+ import { Injectable } from '@nestjs/common';
3
+ import { Mutation, Args, Resolver } from '@nestjs/graphql';
4
+ import { ConsumptionOrderService } from '@rytass/wms-module-core';
5
+ import { ConsumptionOrderDto } from '../dto/consumption-order.dto.js';
6
+ import { CreateConsumptionOrderArgs, UpdateConsumptionOrderArgs, ConsumptionOrderActionArgs } from '../inputs/consumption-order.args.js';
7
+ import '../auth/wms-auth.guard.js';
8
+ import { WmsOperation } from '../auth/wms-operation.decorator.js';
9
+ import { WmsMutationEvent } from '../events/wms-mutation-event.decorator.js';
10
+ import '../events/wms-mutation.interceptor.js';
11
+
12
+ /**
13
+ * The three actions are separate mutations rather than one with a mode
14
+ * argument: they carry different permissions (a host may well let the floor
15
+ * issue and return but not settle) and different events, and both of those are
16
+ * keyed per field.
17
+ */
18
+ let ConsumptionOrderMutation = class ConsumptionOrderMutation {
19
+ consumptionOrderService;
20
+ constructor(consumptionOrderService) {
21
+ this.consumptionOrderService = consumptionOrderService;
22
+ }
23
+ createConsumptionOrder(args) {
24
+ return this.consumptionOrderService.createConsumptionOrder(args);
25
+ }
26
+ updateConsumptionOrder(args) {
27
+ return this.consumptionOrderService.updateConsumptionOrder(args);
28
+ }
29
+ issueConsumptionOrder(args) {
30
+ return this.consumptionOrderService.issue(args);
31
+ }
32
+ returnConsumptionOrder(args) {
33
+ return this.consumptionOrderService.return(args);
34
+ }
35
+ settleConsumptionOrder(args) {
36
+ return this.consumptionOrderService.settle(args);
37
+ }
38
+ };
39
+ __decorate([
40
+ Mutation(() => ConsumptionOrderDto),
41
+ WmsOperation({ resource: 'consumption-order', action: 'create' }),
42
+ WmsMutationEvent({ event: 'consumption-order.created' }),
43
+ __param(0, Args()),
44
+ __metadata("design:type", Function),
45
+ __metadata("design:paramtypes", [CreateConsumptionOrderArgs]),
46
+ __metadata("design:returntype", Promise)
47
+ ], ConsumptionOrderMutation.prototype, "createConsumptionOrder", null);
48
+ __decorate([
49
+ Mutation(() => ConsumptionOrderDto),
50
+ WmsOperation({ resource: 'consumption-order', action: 'update' }),
51
+ WmsMutationEvent({ event: 'consumption-order.updated' }),
52
+ __param(0, Args()),
53
+ __metadata("design:type", Function),
54
+ __metadata("design:paramtypes", [UpdateConsumptionOrderArgs]),
55
+ __metadata("design:returntype", Promise)
56
+ ], ConsumptionOrderMutation.prototype, "updateConsumptionOrder", null);
57
+ __decorate([
58
+ Mutation(() => Boolean),
59
+ WmsOperation({ resource: 'consumption-order', action: 'issue' }),
60
+ WmsMutationEvent({ event: 'consumption-order.issued' }),
61
+ __param(0, Args()),
62
+ __metadata("design:type", Function),
63
+ __metadata("design:paramtypes", [ConsumptionOrderActionArgs]),
64
+ __metadata("design:returntype", Promise)
65
+ ], ConsumptionOrderMutation.prototype, "issueConsumptionOrder", null);
66
+ __decorate([
67
+ Mutation(() => Boolean),
68
+ WmsOperation({ resource: 'consumption-order', action: 'return' }),
69
+ WmsMutationEvent({ event: 'consumption-order.returned' }),
70
+ __param(0, Args()),
71
+ __metadata("design:type", Function),
72
+ __metadata("design:paramtypes", [ConsumptionOrderActionArgs]),
73
+ __metadata("design:returntype", Promise)
74
+ ], ConsumptionOrderMutation.prototype, "returnConsumptionOrder", null);
75
+ __decorate([
76
+ Mutation(() => Boolean),
77
+ WmsOperation({ resource: 'consumption-order', action: 'settle' }),
78
+ WmsMutationEvent({ event: 'consumption-order.settled' }),
79
+ __param(0, Args()),
80
+ __metadata("design:type", Function),
81
+ __metadata("design:paramtypes", [ConsumptionOrderActionArgs]),
82
+ __metadata("design:returntype", Promise)
83
+ ], ConsumptionOrderMutation.prototype, "settleConsumptionOrder", null);
84
+ ConsumptionOrderMutation = __decorate([
85
+ Injectable(),
86
+ Resolver(),
87
+ __metadata("design:paramtypes", [ConsumptionOrderService])
88
+ ], ConsumptionOrderMutation);
89
+
90
+ export { ConsumptionOrderMutation };
@@ -26,6 +26,9 @@ import '../dto/scrape-order-item.dto.js';
26
26
  import '../dto/quality-inspection-order.dto.js';
27
27
  import '../dto/quality-inspection-order-item.dto.js';
28
28
  import '../dto/inventory-count-order.dto.js';
29
+ import '../dto/consumption-order.dto.js';
30
+ import '../dto/consumption-order-item.dto.js';
31
+ import '../dto/order-reference.dto.js';
29
32
  import { Mutation, Args } from '@nestjs/graphql';
30
33
  import { CreateLoaderTypeArgs, UpdateLoaderTypeArgs } from '../inputs/create-loader-type.args.js';
31
34
  import { CreateLoaderArgs, CreateLoadersArgs, UpdateLoaderArgs } from '../inputs/create-loader.args.js';
@@ -26,6 +26,9 @@ import '../dto/scrape-order-item.dto.js';
26
26
  import '../dto/quality-inspection-order.dto.js';
27
27
  import '../dto/quality-inspection-order-item.dto.js';
28
28
  import '../dto/inventory-count-order.dto.js';
29
+ import '../dto/consumption-order.dto.js';
30
+ import '../dto/consumption-order-item.dto.js';
31
+ import '../dto/order-reference.dto.js';
29
32
  import { CreateMaterialArgs, UpdateMaterialArgs } from '../inputs/create-material.args.js';
30
33
  import { MaterialService } from '@rytass/wms-module-core';
31
34
  import '../auth/wms-auth.guard.js';
@@ -0,0 +1,13 @@
1
+ import { OrderReferenceService } from '@rytass/wms-module-core';
2
+ import { OrderReferenceDto } from '../dto/order-reference.dto';
3
+ import { AttachOrderReferencesArgs } from '../inputs/order-reference.args';
4
+ export declare class OrderReferenceMutation {
5
+ private readonly orderReferenceService;
6
+ constructor(orderReferenceService: OrderReferenceService);
7
+ /**
8
+ * Additive: attaching twice leaves both sets in place. Detach the ones that
9
+ * no longer apply rather than expecting this to replace them.
10
+ */
11
+ attachOrderReferences(args: AttachOrderReferencesArgs): Promise<OrderReferenceDto[]>;
12
+ detachOrderReference(id: string): Promise<boolean>;
13
+ }
@@ -0,0 +1,57 @@
1
+ import { __decorate, __param, __metadata } from 'tslib';
2
+ import { Injectable } from '@nestjs/common';
3
+ import { Mutation, Args, ID, Resolver } from '@nestjs/graphql';
4
+ import { OrderReferenceService } from '@rytass/wms-module-core';
5
+ import { OrderReferenceDto } from '../dto/order-reference.dto.js';
6
+ import { AttachOrderReferencesArgs } from '../inputs/order-reference.args.js';
7
+ import '../auth/wms-auth.guard.js';
8
+ import { WmsOperation } from '../auth/wms-operation.decorator.js';
9
+ import { WmsMutationEvent } from '../events/wms-mutation-event.decorator.js';
10
+ import '../events/wms-mutation.interceptor.js';
11
+
12
+ let OrderReferenceMutation = class OrderReferenceMutation {
13
+ orderReferenceService;
14
+ constructor(orderReferenceService) {
15
+ this.orderReferenceService = orderReferenceService;
16
+ }
17
+ /**
18
+ * Additive: attaching twice leaves both sets in place. Detach the ones that
19
+ * no longer apply rather than expecting this to replace them.
20
+ */
21
+ attachOrderReferences(args) {
22
+ return this.orderReferenceService.attach({
23
+ orderType: args.orderType,
24
+ orderId: args.orderId,
25
+ references: args.references,
26
+ });
27
+ }
28
+ async detachOrderReference(id) {
29
+ await this.orderReferenceService.detach(id);
30
+ return true;
31
+ }
32
+ };
33
+ __decorate([
34
+ Mutation(() => [OrderReferenceDto]),
35
+ WmsOperation({ resource: 'order-reference', action: 'attach' }),
36
+ WmsMutationEvent({ event: 'order-reference.attached' }),
37
+ __param(0, Args()),
38
+ __metadata("design:type", Function),
39
+ __metadata("design:paramtypes", [AttachOrderReferencesArgs]),
40
+ __metadata("design:returntype", Promise)
41
+ ], OrderReferenceMutation.prototype, "attachOrderReferences", null);
42
+ __decorate([
43
+ Mutation(() => Boolean),
44
+ WmsOperation({ resource: 'order-reference', action: 'detach' }),
45
+ WmsMutationEvent({ event: 'order-reference.detached' }),
46
+ __param(0, Args('id', { type: () => ID })),
47
+ __metadata("design:type", Function),
48
+ __metadata("design:paramtypes", [String]),
49
+ __metadata("design:returntype", Promise)
50
+ ], OrderReferenceMutation.prototype, "detachOrderReference", null);
51
+ OrderReferenceMutation = __decorate([
52
+ Injectable(),
53
+ Resolver(),
54
+ __metadata("design:paramtypes", [OrderReferenceService])
55
+ ], OrderReferenceMutation);
56
+
57
+ export { OrderReferenceMutation };
@@ -27,6 +27,9 @@ import '../dto/scrape-order-item.dto.js';
27
27
  import '../dto/quality-inspection-order.dto.js';
28
28
  import '../dto/quality-inspection-order-item.dto.js';
29
29
  import '../dto/inventory-count-order.dto.js';
30
+ import '../dto/consumption-order.dto.js';
31
+ import '../dto/consumption-order-item.dto.js';
32
+ import '../dto/order-reference.dto.js';
30
33
  import { CreateReceiveInventoryOrderArgs, UpdateReceiveInventoryOrderArgs } from '../inputs/create-receive-inventory-order.args.js';
31
34
  import { DataSource } from 'typeorm';
32
35
  import { ReceiveOrderArgs } from '../inputs/receive-order.args.js';
@@ -26,6 +26,9 @@ import '../dto/scrape-order-item.dto.js';
26
26
  import '../dto/quality-inspection-order.dto.js';
27
27
  import '../dto/quality-inspection-order-item.dto.js';
28
28
  import '../dto/inventory-count-order.dto.js';
29
+ import '../dto/consumption-order.dto.js';
30
+ import '../dto/consumption-order-item.dto.js';
31
+ import '../dto/order-reference.dto.js';
29
32
  import { Mutation, Args } from '@nestjs/graphql';
30
33
  import { CreateShipInventoryOrderArgs, UpdateShipInventoryOrderArgs } from '../inputs/create-ship-inventory-order.args.js';
31
34
  import { ShipOrderArgs } from '../inputs/ship-order.args.js';