@things-factory/sales-base 8.0.0-beta.1 → 8.0.0-beta.4

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 (177) hide show
  1. package/package.json +13 -13
  2. package/server/constants/attachment-type.ts +0 -9
  3. package/server/constants/index.ts +0 -7
  4. package/server/constants/load-type.ts +0 -4
  5. package/server/constants/order.ts +0 -203
  6. package/server/constants/product-group-type.ts +0 -4
  7. package/server/constants/release-good.ts +0 -9
  8. package/server/constants/transfer-order-type.ts +0 -6
  9. package/server/constants/validation-error-code.ts +0 -3
  10. package/server/constants/vas-target-type.ts +0 -25
  11. package/server/controllers/ecommerce/ecommerce-controller.ts +0 -122
  12. package/server/controllers/ecommerce/index.ts +0 -2
  13. package/server/controllers/ecommerce/sellercraft-controller.ts +0 -182
  14. package/server/controllers/index.ts +0 -2
  15. package/server/controllers/order-controller.ts +0 -296
  16. package/server/errors/index.ts +0 -1
  17. package/server/errors/validation-error.ts +0 -25
  18. package/server/index.ts +0 -5
  19. package/server/migrations/index.ts +0 -9
  20. package/server/service/arrival-notice/arrival-notice-mutation.ts +0 -1152
  21. package/server/service/arrival-notice/arrival-notice-query.ts +0 -549
  22. package/server/service/arrival-notice/arrival-notice-types.ts +0 -310
  23. package/server/service/arrival-notice/arrival-notice.ts +0 -202
  24. package/server/service/arrival-notice/index.ts +0 -9
  25. package/server/service/claim/claim-mutation.ts +0 -308
  26. package/server/service/claim/claim-query.ts +0 -122
  27. package/server/service/claim/claim-types.ts +0 -130
  28. package/server/service/claim/claim.ts +0 -140
  29. package/server/service/claim/index.ts +0 -9
  30. package/server/service/claim-detail/claim-detail-mutation.ts +0 -102
  31. package/server/service/claim-detail/claim-detail-query.ts +0 -55
  32. package/server/service/claim-detail/claim-detail-types.ts +0 -47
  33. package/server/service/claim-detail/claim-detail.ts +0 -69
  34. package/server/service/claim-detail/index.ts +0 -9
  35. package/server/service/claim-order/claim-order-mutation.ts +0 -101
  36. package/server/service/claim-order/claim-order-query.ts +0 -47
  37. package/server/service/claim-order/claim-order-types.ts +0 -35
  38. package/server/service/claim-order/claim-order.ts +0 -81
  39. package/server/service/claim-order/index.ts +0 -9
  40. package/server/service/collection-order/collection-order-mutation.ts +0 -245
  41. package/server/service/collection-order/collection-order-query.ts +0 -97
  42. package/server/service/collection-order/collection-order-types.ts +0 -165
  43. package/server/service/collection-order/collection-order.ts +0 -135
  44. package/server/service/collection-order/index.ts +0 -9
  45. package/server/service/delivery-order/delivery-order-mutation.ts +0 -967
  46. package/server/service/delivery-order/delivery-order-query.ts +0 -631
  47. package/server/service/delivery-order/delivery-order-types.ts +0 -268
  48. package/server/service/delivery-order/delivery-order.ts +0 -258
  49. package/server/service/delivery-order/index.ts +0 -9
  50. package/server/service/draft-release-good/draft-release-good-mutation.ts +0 -765
  51. package/server/service/draft-release-good/draft-release-good-query.ts +0 -354
  52. package/server/service/draft-release-good/draft-release-good-type.ts +0 -261
  53. package/server/service/draft-release-good/draft-release-good.ts +0 -284
  54. package/server/service/draft-release-good/index.ts +0 -9
  55. package/server/service/goods-receival-note/goods-receival-note-mutation.ts +0 -129
  56. package/server/service/goods-receival-note/goods-receival-note-query.ts +0 -280
  57. package/server/service/goods-receival-note/goods-receival-note-types.ts +0 -105
  58. package/server/service/goods-receival-note/goods-receival-note.ts +0 -127
  59. package/server/service/goods-receival-note/index.ts +0 -9
  60. package/server/service/index.ts +0 -238
  61. package/server/service/inventory-check/index.ts +0 -9
  62. package/server/service/inventory-check/inventory-check-mutation.ts +0 -149
  63. package/server/service/inventory-check/inventory-check-query.ts +0 -48
  64. package/server/service/inventory-check/inventory-check-types.ts +0 -48
  65. package/server/service/inventory-check/inventory-check.ts +0 -90
  66. package/server/service/invoice/index.ts +0 -9
  67. package/server/service/invoice/invoice-mutation.ts +0 -95
  68. package/server/service/invoice/invoice-query.ts +0 -53
  69. package/server/service/invoice/invoice-types.ts +0 -279
  70. package/server/service/invoice/invoice.ts +0 -230
  71. package/server/service/invoice-product/index.ts +0 -9
  72. package/server/service/invoice-product/invoice-product-mutation.ts +0 -54
  73. package/server/service/invoice-product/invoice-product-query.ts +0 -54
  74. package/server/service/invoice-product/invoice-product-types.ts +0 -84
  75. package/server/service/invoice-product/invoice-product.ts +0 -92
  76. package/server/service/job-sheet/index.ts +0 -9
  77. package/server/service/job-sheet/job-sheet-mutation.ts +0 -92
  78. package/server/service/job-sheet/job-sheet-query.ts +0 -112
  79. package/server/service/job-sheet/job-sheet-types.ts +0 -78
  80. package/server/service/job-sheet/job-sheet.ts +0 -102
  81. package/server/service/manifest/index.ts +0 -6
  82. package/server/service/manifest/manifest-mutation.ts +0 -190
  83. package/server/service/manifest/manifest-query.ts +0 -149
  84. package/server/service/manifest/manifest-type.ts +0 -84
  85. package/server/service/manifest/manifest.ts +0 -114
  86. package/server/service/order-inventory/index.ts +0 -9
  87. package/server/service/order-inventory/order-inventory-mutation.ts +0 -54
  88. package/server/service/order-inventory/order-inventory-query.ts +0 -722
  89. package/server/service/order-inventory/order-inventory-types.ts +0 -238
  90. package/server/service/order-inventory/order-inventory.ts +0 -401
  91. package/server/service/order-product/index.ts +0 -9
  92. package/server/service/order-product/order-product-mutation.ts +0 -48
  93. package/server/service/order-product/order-product-query.ts +0 -89
  94. package/server/service/order-product/order-product-types.ts +0 -335
  95. package/server/service/order-product/order-product.ts +0 -362
  96. package/server/service/order-tote/index.ts +0 -9
  97. package/server/service/order-tote/order-tote-mutation.ts +0 -31
  98. package/server/service/order-tote/order-tote-query.ts +0 -112
  99. package/server/service/order-tote/order-tote-types.ts +0 -47
  100. package/server/service/order-tote/order-tote.ts +0 -73
  101. package/server/service/order-tote-item/index.ts +0 -9
  102. package/server/service/order-tote-item/order-tote-item-mutation.ts +0 -31
  103. package/server/service/order-tote-item/order-tote-item-query.ts +0 -82
  104. package/server/service/order-tote-item/order-tote-item-types.ts +0 -56
  105. package/server/service/order-tote-item/order-tote-item.ts +0 -72
  106. package/server/service/order-tote-seal/index.ts +0 -9
  107. package/server/service/order-tote-seal/order-tote-seal-mutation.ts +0 -31
  108. package/server/service/order-tote-seal/order-tote-seal-query.ts +0 -59
  109. package/server/service/order-tote-seal/order-tote-seal-types.ts +0 -41
  110. package/server/service/order-tote-seal/order-tote-seal.ts +0 -46
  111. package/server/service/order-vas/index.ts +0 -9
  112. package/server/service/order-vas/order-vas-mutation.ts +0 -20
  113. package/server/service/order-vas/order-vas-query.ts +0 -72
  114. package/server/service/order-vas/order-vas-types.ts +0 -159
  115. package/server/service/order-vas/order-vas.ts +0 -207
  116. package/server/service/others/index.ts +0 -5
  117. package/server/service/others/other-query.ts +0 -563
  118. package/server/service/others/other-types.ts +0 -115
  119. package/server/service/purchase-order/index.ts +0 -9
  120. package/server/service/purchase-order/purchase-order-mutation.ts +0 -458
  121. package/server/service/purchase-order/purchase-order-query.ts +0 -90
  122. package/server/service/purchase-order/purchase-order-types.ts +0 -154
  123. package/server/service/purchase-order/purchase-order.ts +0 -172
  124. package/server/service/purchase-order-other-charge/index.ts +0 -9
  125. package/server/service/purchase-order-other-charge/purchase-order-other-charge-mutation.ts +0 -31
  126. package/server/service/purchase-order-other-charge/purchase-order-other-charge-query.ts +0 -52
  127. package/server/service/purchase-order-other-charge/purchase-order-other-charge-types.ts +0 -44
  128. package/server/service/purchase-order-other-charge/purchase-order-other-charge.ts +0 -68
  129. package/server/service/release-good/index.ts +0 -9
  130. package/server/service/release-good/release-good-mutation.ts +0 -1686
  131. package/server/service/release-good/release-good-query.ts +0 -980
  132. package/server/service/release-good/release-good-types.ts +0 -662
  133. package/server/service/release-good/release-good.ts +0 -490
  134. package/server/service/retail-replenishment-order/index.ts +0 -9
  135. package/server/service/retail-replenishment-order/retail-replenishment-order-mutation.ts +0 -382
  136. package/server/service/retail-replenishment-order/retail-replenishment-order-query.ts +0 -54
  137. package/server/service/retail-replenishment-order/retail-replenishment-order-types.ts +0 -101
  138. package/server/service/retail-replenishment-order/retail-replenishment-order.ts +0 -115
  139. package/server/service/return-order/index.ts +0 -9
  140. package/server/service/return-order/return-order-mutation.ts +0 -516
  141. package/server/service/return-order/return-order-query.ts +0 -226
  142. package/server/service/return-order/return-order-types.ts +0 -196
  143. package/server/service/return-order/return-order.ts +0 -127
  144. package/server/service/reverse-kitting-order/index.ts +0 -9
  145. package/server/service/reverse-kitting-order/reverse-kitting-order-mutation.ts +0 -500
  146. package/server/service/reverse-kitting-order/reverse-kitting-order-query.ts +0 -197
  147. package/server/service/reverse-kitting-order/reverse-kitting-order-type.ts +0 -173
  148. package/server/service/reverse-kitting-order/reverse-kitting-order.ts +0 -121
  149. package/server/service/reverse-kitting-order-inventory/index.ts +0 -9
  150. package/server/service/reverse-kitting-order-inventory/reverse-kitting-order-inventory-mutation.ts +0 -129
  151. package/server/service/reverse-kitting-order-inventory/reverse-kitting-order-inventory-query.ts +0 -52
  152. package/server/service/reverse-kitting-order-inventory/reverse-kitting-order-inventory-type.ts +0 -95
  153. package/server/service/reverse-kitting-order-inventory/reverse-kitting-order-inventory.ts +0 -143
  154. package/server/service/shipping-order/index.ts +0 -9
  155. package/server/service/shipping-order/shipping-order-mutation.ts +0 -61
  156. package/server/service/shipping-order/shipping-order-query.ts +0 -61
  157. package/server/service/shipping-order/shipping-order-types.ts +0 -89
  158. package/server/service/shipping-order/shipping-order.ts +0 -129
  159. package/server/service/transfer-order/index.ts +0 -9
  160. package/server/service/transfer-order/transfer-order-mutation.ts +0 -309
  161. package/server/service/transfer-order/transfer-order-query.ts +0 -66
  162. package/server/service/transfer-order/transfer-order-types.ts +0 -97
  163. package/server/service/transfer-order/transfer-order.ts +0 -117
  164. package/server/service/vas/index.ts +0 -9
  165. package/server/service/vas/vas-mutation.ts +0 -106
  166. package/server/service/vas/vas-query.ts +0 -60
  167. package/server/service/vas/vas-types.ts +0 -71
  168. package/server/service/vas/vas.ts +0 -77
  169. package/server/service/vas-order/index.ts +0 -9
  170. package/server/service/vas-order/vas-order-mutation.ts +0 -259
  171. package/server/service/vas-order/vas-order-query.ts +0 -119
  172. package/server/service/vas-order/vas-order-types.ts +0 -49
  173. package/server/service/vas-order/vas-order.ts +0 -81
  174. package/server/utils/datetime-util.ts +0 -54
  175. package/server/utils/index.ts +0 -3
  176. package/server/utils/inventory-util.ts +0 -1155
  177. package/server/utils/order-no-generator.ts +0 -146
@@ -1,173 +0,0 @@
1
- import {
2
- Field,
3
- Float,
4
- ID,
5
- InputType,
6
- Int,
7
- ObjectType
8
- } from 'type-graphql'
9
-
10
- import { User } from '@things-factory/auth-base'
11
- import { Bizplace } from '@things-factory/biz-base'
12
- import { Product } from '@things-factory/product-base'
13
- import {
14
- Domain,
15
- ObjectRef
16
- } from '@things-factory/shell'
17
- import {
18
- Inventory,
19
- Location,
20
- Warehouse
21
- } from '@things-factory/warehouse-base'
22
-
23
- import {
24
- NewReverseKittingOrderInventory
25
- } from '../reverse-kitting-order-inventory/reverse-kitting-order-inventory-type'
26
- import { ReverseKittingOrder } from './reverse-kitting-order'
27
-
28
- @InputType()
29
- export class NewReverseKittingOrder {
30
- @Field({ nullable: true })
31
- name?: string
32
-
33
- @Field({ nullable: true })
34
- customerBizplaceId?: string
35
-
36
- @Field({ nullable: true })
37
- status?: string
38
-
39
- @Field(type => [NewReverseKittingOrderInventory], { nullable: true })
40
- reverseKittingOrderInventories?: NewReverseKittingOrderInventory[]
41
-
42
- @Field({ nullable: true })
43
- remark?: string
44
- }
45
-
46
- @InputType()
47
- export class LotInfo {
48
- @Field()
49
- id: string
50
-
51
- @Field()
52
- printQty: number
53
- }
54
-
55
- @InputType()
56
- export class ReverseKittingOrderPatch {
57
- @Field(type => ID, { nullable: true })
58
- id?: string
59
-
60
- @Field({ nullable: true })
61
- name?: string
62
-
63
- @Field(type => [ObjectRef], { nullable: true })
64
- reverseKittingOrderInventories: ObjectRef[]
65
-
66
- @Field({ nullable: true })
67
- status?: string
68
-
69
- @Field({ nullable: true })
70
- remark?: string
71
-
72
- @Field()
73
- cuFlag: string
74
- }
75
-
76
- @ObjectType()
77
- export class ReverseKittingOrderList {
78
- @Field(type => [ReverseKittingOrder])
79
- items: ReverseKittingOrder[]
80
-
81
- @Field(type => Int)
82
- total: number
83
- }
84
-
85
- @ObjectType()
86
- export class ReverseKittingInventoryDetail {
87
- @Field(type => ID)
88
- readonly id: string
89
-
90
- @Field(type => Domain, { nullable: true })
91
- domain: Domain
92
-
93
- @Field(type => Bizplace, { nullable: true })
94
- bizplace: Bizplace
95
-
96
- @Field(type => Inventory, { nullable: true })
97
- refInventory: Inventory
98
-
99
- @Field({ nullable: true })
100
- name: string
101
-
102
- @Field({ nullable: true })
103
- palletId: string
104
-
105
- @Field({ nullable: true })
106
- cartonId: string
107
-
108
- @Field({ nullable: true })
109
- batchId: string
110
-
111
- @Field(type => Product, { nullable: true })
112
- product: Product
113
-
114
- @Field(type => Location, { nullable: true })
115
- location: Location
116
-
117
- @Field(type => Warehouse, { nullable: true })
118
- warehouse: Warehouse
119
-
120
- @Field({ nullable: true })
121
- zone: string
122
-
123
- @Field({ nullable: true })
124
- packingType: string
125
-
126
- @Field(type => Float, { nullable: true })
127
- packingSize: number
128
-
129
- @Field(type => Float, { nullable: true })
130
- qty: number
131
-
132
- @Field(type => Float, { nullable: true })
133
- remainQty: number
134
-
135
- @Field({ nullable: true })
136
- otherRef: string
137
-
138
- @Field(type => Int, { nullable: true })
139
- lastSeq: number
140
-
141
- @Field(type => Float, { nullable: true })
142
- uomValue: number
143
-
144
- @Field(type => Float, { nullable: true })
145
- remainUomValue: number
146
-
147
- @Field({ nullable: true })
148
- uom: string
149
-
150
- @Field({ nullable: true })
151
- status: string
152
-
153
- @Field({ nullable: true })
154
- description: string
155
-
156
- @Field({ nullable: true })
157
- remark: string
158
-
159
- @Field({ nullable: true })
160
- batchIdRef: string
161
-
162
- @Field(type => User, { nullable: true })
163
- creator: User
164
-
165
- @Field(type => User, { nullable: true })
166
- updater: User
167
-
168
- @Field({ nullable: true })
169
- createdAt: string
170
-
171
- @Field({ nullable: true })
172
- updatedAt: string
173
- }
@@ -1,121 +0,0 @@
1
- import { Field, Float, ID, Int, ObjectType } from 'type-graphql'
2
- import {
3
- Column,
4
- CreateDateColumn,
5
- Entity,
6
- Index,
7
- ManyToOne,
8
- OneToMany,
9
- PrimaryGeneratedColumn,
10
- RelationId,
11
- UpdateDateColumn
12
- } from 'typeorm'
13
-
14
- import { User } from '@things-factory/auth-base'
15
- import { Bizplace } from '@things-factory/biz-base'
16
- import { Product } from '@things-factory/product-base'
17
- import { Domain } from '@things-factory/shell'
18
- import { Location } from '@things-factory/warehouse-base'
19
-
20
- import { ReverseKittingOrderInventory } from '../reverse-kitting-order-inventory/reverse-kitting-order-inventory'
21
-
22
- @Entity()
23
- @Index(
24
- 'ix_reverse_kitting_order_0',
25
- (reverseKittingOrder: ReverseKittingOrder) => [reverseKittingOrder.domain, reverseKittingOrder.name],
26
- { unique: true }
27
- )
28
- @ObjectType({ description: 'Entity for ReverseKittingOrder' })
29
- export class ReverseKittingOrder {
30
- @PrimaryGeneratedColumn('uuid')
31
- @Field(type => ID)
32
- readonly id: string
33
-
34
- @ManyToOne(type => Domain)
35
- @Field(type => Domain)
36
- domain?: Domain
37
-
38
- @RelationId((reverseKittingOrder: ReverseKittingOrder) => reverseKittingOrder.domain)
39
- domainId?: string
40
-
41
- @ManyToOne(type => Bizplace)
42
- @Field(type => Bizplace, { nullable: true })
43
- bizplace: Bizplace
44
-
45
- @RelationId((reverseKittingOrder: ReverseKittingOrder) => reverseKittingOrder.bizplace)
46
- bizplaceId?: string
47
-
48
- @OneToMany(
49
- type => ReverseKittingOrderInventory,
50
- reverseKittingOrderInventory => reverseKittingOrderInventory.reverseKittingOrder
51
- )
52
- @Field(type => [ReverseKittingOrderInventory], { nullable: true })
53
- reverseKittingOrderInventories?: ReverseKittingOrderInventory[]
54
-
55
- @Column()
56
- @Field()
57
- name: string
58
-
59
- @Column({ nullable: true })
60
- @Field({ nullable: true })
61
- remark?: string
62
-
63
- @Field({ nullable: true })
64
- batchId?: string
65
-
66
- @Field({ nullable: true })
67
- packingType?: string
68
-
69
- @Field(type => Float, { nullable: true })
70
- packingSize?: number
71
-
72
- @Column()
73
- @Field({ nullable: true })
74
- status?: string
75
-
76
- @Field({ nullable: true })
77
- batchIdRef?: string
78
-
79
- @Field({ nullable: true })
80
- palletId?: string
81
-
82
- @Field({ nullable: true })
83
- cartonId?: string
84
-
85
- @Field(type => Int, { nullable: true })
86
- qty?: number
87
-
88
- @Field({ nullable: true })
89
- expirationDate?: string
90
-
91
- @Field(type => Location, { nullable: true })
92
- location?: Location
93
-
94
- @Field(type => Product, { nullable: true })
95
- product?: Product
96
-
97
- @Field({ nullable: true })
98
- productDetailId?: string
99
-
100
- @CreateDateColumn()
101
- @Field({ nullable: true })
102
- createdAt?: Date
103
-
104
- @UpdateDateColumn()
105
- @Field({ nullable: true })
106
- updatedAt?: Date
107
-
108
- @ManyToOne(type => User, { nullable: true })
109
- @Field(type => User, { nullable: true })
110
- creator?: User
111
-
112
- @RelationId((reverseKittingOrder: ReverseKittingOrder) => reverseKittingOrder.creator)
113
- creatorId?: string
114
-
115
- @ManyToOne(type => User, { nullable: true })
116
- @Field(type => User, { nullable: true })
117
- updater?: User
118
-
119
- @RelationId((reverseKittingOrder: ReverseKittingOrder) => reverseKittingOrder.updater)
120
- updaterId?: string
121
- }
@@ -1,9 +0,0 @@
1
- import { ReverseKittingOrderInventory } from './reverse-kitting-order-inventory'
2
- import { ReverseKittingOrderInventoryQuery } from './reverse-kitting-order-inventory-query'
3
- import { ReverseKittingOrderInventoryMutation } from './reverse-kitting-order-inventory-mutation'
4
-
5
- export const entities = [ReverseKittingOrderInventory]
6
- export const resolvers = [ReverseKittingOrderInventoryQuery, ReverseKittingOrderInventoryMutation]
7
-
8
- export * from './reverse-kitting-order-inventory-mutation'
9
- export * from './reverse-kitting-order-inventory-query'
@@ -1,129 +0,0 @@
1
- import { Arg, Ctx, Directive, Mutation, Resolver } from 'type-graphql'
2
- import { In } from 'typeorm'
3
-
4
- import { getPermittedBizplaceIds } from '@things-factory/biz-base'
5
-
6
- import { ReverseKittingOrderInventory } from './reverse-kitting-order-inventory'
7
- import {
8
- NewReverseKittingOrderInventory,
9
- ReverseKittingOrderInventoryPatch
10
- } from './reverse-kitting-order-inventory-type'
11
-
12
- @Resolver(ReverseKittingOrderInventory)
13
- export class ReverseKittingOrderInventoryMutation {
14
- @Directive('@transaction')
15
- @Mutation(returns => ReverseKittingOrderInventory, { description: 'To create new ReverseKittingOrderInventory' })
16
- async createReverseKittingOrderInventory(
17
- @Arg('reverseKittingOrderInventory') reverseKittingOrderInventory: NewReverseKittingOrderInventory,
18
- @Ctx() context: ResolverContext
19
- ): Promise<ReverseKittingOrderInventory> {
20
- const { domain, user, tx } = context.state
21
-
22
- return await tx.getRepository(ReverseKittingOrderInventory).save({
23
- ...reverseKittingOrderInventory,
24
- domain,
25
- creator: user,
26
- updater: user
27
- })
28
- }
29
-
30
- @Directive('@transaction')
31
- @Mutation(returns => ReverseKittingOrderInventory, {
32
- description: 'To modify ReverseKittingOrderInventory information'
33
- })
34
- async updateReverseKittingOrderInventory(
35
- @Arg('id') id: string,
36
- @Arg('patch') patch: ReverseKittingOrderInventoryPatch,
37
- @Ctx() context: ResolverContext
38
- ): Promise<ReverseKittingOrderInventory> {
39
- const { tx, user, domain } = context.state
40
- const reverseKittingOI: ReverseKittingOrderInventory = await tx
41
- .getRepository(ReverseKittingOrderInventory)
42
- .findOne({
43
- where: {
44
- domain: { id: domain.id },
45
- bizplace: { id: In(await getPermittedBizplaceIds(domain, user)) },
46
- id
47
- }
48
- })
49
-
50
- return await tx.getRepository(ReverseKittingOrderInventory).save({
51
- ...reverseKittingOI,
52
- ...patch,
53
- updater: user
54
- })
55
- }
56
-
57
- @Directive('@transaction')
58
- @Mutation(returns => [ReverseKittingOrderInventory], {
59
- description: "To modify multiple ReverseKittingOrderInventories' information"
60
- })
61
- async updateMultipleReverseKittingOrderInventory(
62
- @Arg('patches', type => [ReverseKittingOrderInventoryPatch]) patches: ReverseKittingOrderInventoryPatch[],
63
- @Ctx() context: ResolverContext
64
- ): Promise<ReverseKittingOrderInventory[]> {
65
- const { domain, user, tx } = context.state
66
-
67
- let results = []
68
- const _createRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === '+')
69
- const _updateRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === 'M')
70
- const reverseKittingOrderInventoryRepo = tx.getRepository(ReverseKittingOrderInventory)
71
-
72
- if (_createRecords.length > 0) {
73
- for (let i = 0; i < _createRecords.length; i++) {
74
- const newRecord = _createRecords[i]
75
-
76
- const result = await reverseKittingOrderInventoryRepo.save({
77
- ...newRecord,
78
- domain,
79
- creator: user,
80
- updater: user
81
- })
82
-
83
- results.push({ ...result, cuFlag: '+' })
84
- }
85
- }
86
-
87
- if (_updateRecords.length > 0) {
88
- for (let i = 0; i < _updateRecords.length; i++) {
89
- const newRecord = _updateRecords[i]
90
- const reverseKittingOrderInventory = await reverseKittingOrderInventoryRepo.findOneBy({ id: newRecord.id })
91
-
92
- const result = await reverseKittingOrderInventoryRepo.save({
93
- ...reverseKittingOrderInventory,
94
- ...newRecord,
95
- updater: user
96
- })
97
-
98
- results.push({ ...result, cuFlag: 'M' })
99
- }
100
- }
101
-
102
- return results
103
- }
104
-
105
- @Directive('@transaction')
106
- @Mutation(returns => Boolean, { description: 'To delete ReverseKittingOrderInventory' })
107
- async deleteReverseKittingOrderInventory(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {
108
- const { domain, tx } = context.state
109
-
110
- await tx.getRepository(ReverseKittingOrderInventory).delete({ domain: { id: domain.id }, id })
111
- return true
112
- }
113
-
114
- @Directive('@transaction')
115
- @Mutation(returns => Boolean, { description: 'To delete multiple reverseKittingOrderInventorys' })
116
- async deleteReverseKittingOrderInventories(
117
- @Arg('ids', type => [String]) ids: string[],
118
- @Ctx() context: ResolverContext
119
- ): Promise<boolean> {
120
- const { domain, tx } = context.state
121
-
122
- await tx.getRepository(ReverseKittingOrderInventory).delete({
123
- domain: { id: domain.id },
124
- id: In(ids)
125
- })
126
-
127
- return true
128
- }
129
- }
@@ -1,52 +0,0 @@
1
- import { Arg, Args, Ctx, FieldResolver, Query, Resolver, Root } from 'type-graphql'
2
-
3
- import { User } from '@things-factory/auth-base'
4
- import { convertListParams, Domain, getRepository, ListParam } from '@things-factory/shell'
5
-
6
- import { ReverseKittingOrderInventory } from './reverse-kitting-order-inventory'
7
- import { ReverseKittingOrderInventoryList } from './reverse-kitting-order-inventory-type'
8
-
9
- @Resolver(ReverseKittingOrderInventory)
10
- export class ReverseKittingOrderInventoryQuery {
11
- @Query(returns => ReverseKittingOrderInventory, { description: 'To fetch a ReverseKittingOrderInventory' })
12
- async reverseKittingOrderInventory(
13
- @Arg('id') id: string,
14
- @Ctx() context: ResolverContext
15
- ): Promise<ReverseKittingOrderInventory> {
16
- const { domain } = context.state
17
-
18
- return await getRepository(ReverseKittingOrderInventory).findOne({
19
- where: { domain: { id: domain.id }, id }
20
- })
21
- }
22
-
23
- @Query(returns => ReverseKittingOrderInventoryList, {
24
- description: 'To fetch multiple ReverseKittingOrderInventories'
25
- })
26
- async reverseKittingOrderInventories(
27
- @Args(type => ListParam) params: ListParam,
28
- @Ctx() context: ResolverContext
29
- ): Promise<ReverseKittingOrderInventoryList> {
30
- const { domain } = context.state
31
-
32
- const convertedParams = convertListParams(params, { domain })
33
- const [items, total] = await getRepository(ReverseKittingOrderInventory).findAndCount(convertedParams)
34
-
35
- return { items, total }
36
- }
37
-
38
- @FieldResolver(type => Domain)
39
- async domain(@Root() reverseKittingOrderInventory: ReverseKittingOrderInventory): Promise<Domain> {
40
- return await getRepository(Domain).findOneBy({ id: reverseKittingOrderInventory.domainId })
41
- }
42
-
43
- @FieldResolver(type => User)
44
- async updater(@Root() reverseKittingOrderInventory: ReverseKittingOrderInventory): Promise<User> {
45
- return await getRepository(User).findOneBy({ id: reverseKittingOrderInventory.updaterId })
46
- }
47
-
48
- @FieldResolver(type => User)
49
- async creator(@Root() reverseKittingOrderInventory: ReverseKittingOrderInventory): Promise<User> {
50
- return await getRepository(User).findOneBy({ id: reverseKittingOrderInventory.creatorId })
51
- }
52
- }
@@ -1,95 +0,0 @@
1
- import { Field, Float, ID, InputType, Int, ObjectType } from 'type-graphql'
2
-
3
- import { ObjectRef } from '@things-factory/shell'
4
-
5
- import { ReverseKittingOrderInventory } from './reverse-kitting-order-inventory'
6
-
7
- @InputType()
8
- export class NewReverseKittingOrderInventory {
9
- @Field()
10
- name: string
11
-
12
- @Field(type => Int)
13
- set: number
14
-
15
- @Field({ nullable: true })
16
- batchId?: string
17
-
18
- @Field({ nullable: true })
19
- remark?: string
20
-
21
- @Field({ nullable: true })
22
- operationGuide?: string
23
-
24
- @Field(type => Int, { nullable: true })
25
- qty?: number
26
-
27
- @Field(type => Float, { nullable: true })
28
- uomValue?: number
29
-
30
- @Field({ nullable: true })
31
- productName?: string
32
-
33
- @Field({ nullable: true })
34
- packingType?: string
35
-
36
- @Field(type => ObjectRef, { nullable: true })
37
- reverseKittingOrder?: ObjectRef
38
-
39
- @Field(type => ObjectRef)
40
- inventory?: ObjectRef
41
-
42
- @Field({ nullable: true })
43
- status: string
44
- }
45
-
46
- @InputType()
47
- export class ReverseKittingOrderInventoryPatch {
48
- @Field(type => ID, { nullable: true })
49
- id?: string
50
-
51
- @Field({ nullable: true })
52
- name: string
53
-
54
- @Field(type => Int, { nullable: true })
55
- set: number
56
-
57
- @Field({ nullable: true })
58
- batchId?: string
59
-
60
- @Field({ nullable: true })
61
- remark?: string
62
-
63
- @Field({ nullable: true })
64
- operationGuide?: string
65
-
66
- @Field(type => Int, { nullable: true })
67
- qty?: number
68
-
69
- @Field(type => Float, { nullable: true })
70
- uomValue?: number
71
-
72
- @Field(type => ObjectRef, { nullable: true })
73
- reverseKittingOrder: ObjectRef
74
-
75
- @Field(type => ObjectRef, { nullable: true })
76
- inventory: ObjectRef
77
-
78
- @Field({ nullable: true })
79
- status: string
80
-
81
- @Field({ nullable: true })
82
- cuFlag: string
83
-
84
- @Field({ nullable: true })
85
- issue: string
86
- }
87
-
88
- @ObjectType()
89
- export class ReverseKittingOrderInventoryList {
90
- @Field(type => [ReverseKittingOrderInventory])
91
- items: ReverseKittingOrderInventory[]
92
-
93
- @Field(type => Int)
94
- total: number
95
- }