@things-factory/sales-base 8.0.0-beta.0 → 8.0.0-beta.2

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,362 +0,0 @@
1
- import { Field, Float, ID, 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, ContactPoint } from '@things-factory/biz-base'
16
- import { Product, ProductBundle, ProductDetail } from '@things-factory/product-base'
17
- import { Domain, ScalarDate, roundTransformer } from '@things-factory/shell'
18
- import { Inventory } from '@things-factory/warehouse-base'
19
-
20
- import { ArrivalNotice } from '../arrival-notice/arrival-notice'
21
- import { CollectionOrder } from '../collection-order/collection-order'
22
- import { DeliveryOrder } from '../delivery-order/delivery-order'
23
- import { DraftReleaseGood } from '../draft-release-good/draft-release-good'
24
- import { OrderInventory } from '../order-inventory/order-inventory'
25
- import { PurchaseOrder } from '../purchase-order/purchase-order'
26
- import { ReleaseGood } from '../release-good/release-good'
27
- import { RetailReplenishmentOrder } from '../retail-replenishment-order/retail-replenishment-order'
28
-
29
- @Entity()
30
- @Index('ix_order-product_0', (orderProduct: OrderProduct) => [orderProduct.domain, orderProduct.name], {
31
- unique: true
32
- })
33
- @Index('ix_order-product_1', (orderProduct: OrderProduct) => [
34
- orderProduct.bizplace,
35
- orderProduct.arrivalNotice,
36
- orderProduct.product,
37
- orderProduct.batchId,
38
- orderProduct.packingType
39
- ])
40
- @Index(
41
- 'ix_order-product_2',
42
- (orderProduct: OrderProduct) => [
43
- orderProduct.bizplace,
44
- orderProduct.retailReplenishmentOrder,
45
- orderProduct.product,
46
- orderProduct.batchId,
47
- orderProduct.packingType
48
- ],
49
- { unique: true }
50
- )
51
- @Index(
52
- 'ix_order-product_3',
53
- (orderProduct: OrderProduct) => [
54
- orderProduct.bizplace,
55
- orderProduct.purchaseOrder,
56
- orderProduct.product,
57
- orderProduct.batchId,
58
- orderProduct.uom
59
- ],
60
- { unique: true }
61
- )
62
- @Index('ix_order-product_4', (orderProduct: OrderProduct) => [orderProduct.draftReleaseGood], { unique: false })
63
- @ObjectType()
64
- export class OrderProduct {
65
- @PrimaryGeneratedColumn('uuid')
66
- @Field(type => ID)
67
- id: string
68
-
69
- @ManyToOne(type => Domain, { nullable: false })
70
- @Field(type => Domain, { nullable: true })
71
- domain: Domain
72
-
73
- @RelationId((orderProduct: OrderProduct) => orderProduct.domain)
74
- domainId: string
75
-
76
- @ManyToOne(type => Bizplace, { nullable: false })
77
- @Field(type => Bizplace, { nullable: true })
78
- bizplace: Bizplace
79
-
80
- @RelationId((orderProduct: OrderProduct) => orderProduct.bizplace)
81
- bizplaceId: string
82
-
83
- @Column()
84
- @Field()
85
- name: string
86
-
87
- @Column({ nullable: true })
88
- @Field({ nullable: true })
89
- description: string
90
-
91
- @Column({ nullable: true })
92
- @Field({ nullable: true })
93
- type: string
94
-
95
- @ManyToOne(type => ArrivalNotice)
96
- @Field(type => ArrivalNotice, { nullable: true })
97
- arrivalNotice: ArrivalNotice
98
-
99
- @RelationId((orderProduct: OrderProduct) => orderProduct.arrivalNotice)
100
- arrivalNoticeId: string
101
-
102
- @ManyToOne(type => ReleaseGood)
103
- @Field(type => ReleaseGood, { nullable: true })
104
- releaseGood: ReleaseGood
105
-
106
- @RelationId((orderProduct: OrderProduct) => orderProduct.releaseGood)
107
- releaseGoodId: string
108
-
109
- @ManyToOne(type => DraftReleaseGood)
110
- @Field(type => DraftReleaseGood, { nullable: true })
111
- draftReleaseGood: DraftReleaseGood
112
-
113
- @RelationId((orderProduct: OrderProduct) => orderProduct.draftReleaseGood)
114
- draftReleaseGoodId: string
115
-
116
- @ManyToOne(type => CollectionOrder)
117
- @Field(type => CollectionOrder, { nullable: true })
118
- collectionOrder: CollectionOrder
119
-
120
- @RelationId((orderProduct: OrderProduct) => orderProduct.collectionOrder)
121
- collectionOrderId: string
122
-
123
- @ManyToOne(type => PurchaseOrder)
124
- @Field(type => PurchaseOrder, { nullable: true })
125
- purchaseOrder: PurchaseOrder
126
-
127
- @RelationId((orderProduct: OrderProduct) => orderProduct.purchaseOrder)
128
- purchaseOrderId: string
129
-
130
- @OneToMany(type => OrderInventory, orderInventory => orderInventory.orderProduct)
131
- @Field(type => [OrderInventory], { nullable: true })
132
- orderInventories: OrderInventory
133
-
134
- @ManyToOne(type => RetailReplenishmentOrder)
135
- @Field(type => RetailReplenishmentOrder, { nullable: true })
136
- retailReplenishmentOrder: RetailReplenishmentOrder
137
-
138
- @RelationId((orderProduct: OrderProduct) => orderProduct.retailReplenishmentOrder)
139
- retailReplenishmentOrderId: string
140
-
141
- @ManyToOne(type => DeliveryOrder)
142
- @Field(type => DeliveryOrder, { nullable: true })
143
- deliveryOrder: DeliveryOrder
144
-
145
- @RelationId((orderProduct: OrderProduct) => orderProduct.deliveryOrder)
146
- deliveryOrderId: string
147
-
148
- @ManyToOne(type => Inventory)
149
- @Field(type => Inventory, { nullable: true })
150
- fromInventory: Inventory
151
-
152
- @RelationId((orderProduct: OrderProduct) => orderProduct.fromInventory)
153
- fromInventoryId: string
154
-
155
- @ManyToOne(type => Inventory)
156
- @Field(type => Inventory, { nullable: true })
157
- currentInventory: Inventory
158
-
159
- @RelationId((orderProduct: OrderProduct) => orderProduct.currentInventory)
160
- currentInventoryId: string
161
-
162
- @ManyToOne(type => Inventory)
163
- @Field(type => Inventory, { nullable: true })
164
- toInventory: Inventory
165
-
166
- @RelationId((orderProduct: OrderProduct) => orderProduct.toInventory)
167
- toInventoryId: string
168
-
169
- @ManyToOne(type => Product, { nullable: true })
170
- @Field(type => Product)
171
- product: Product
172
-
173
- @RelationId((orderProduct: OrderProduct) => orderProduct.product)
174
- productId: string
175
-
176
- @ManyToOne(type => ProductDetail, { nullable: true })
177
- @Field(type => ProductDetail)
178
- productDetail: ProductDetail
179
-
180
- @RelationId((orderProduct: OrderProduct) => orderProduct.productDetail)
181
- productDetailId: string
182
-
183
- @ManyToOne(type => ProductBundle, { nullable: true })
184
- @Field(type => ProductBundle)
185
- productBundle: ProductBundle
186
-
187
- @RelationId((orderProduct: OrderProduct) => orderProduct.productBundle)
188
- productBundleId: string
189
-
190
- @ManyToOne(type => ContactPoint)
191
- @Field(type => ContactPoint, { nullable: true })
192
- contactPoint?: ContactPoint
193
-
194
- @RelationId((orderProduct: OrderProduct) => orderProduct.contactPoint)
195
- contactPointId?: string
196
-
197
- @Column()
198
- @Field()
199
- batchId: string
200
-
201
- @Column({ nullable: true })
202
- @Field({ nullable: true })
203
- adjustedBatchId: string
204
-
205
- @Column({ nullable: true })
206
- @Field({ nullable: true })
207
- batchIdRef: string
208
-
209
- @Column({ nullable: true })
210
- @Field({ nullable: true })
211
- adjustedBatchIdRef: string
212
-
213
- @Column()
214
- @Field()
215
- packingType: string
216
-
217
- @Column({ nullable: true })
218
- @Field({ nullable: true })
219
- adjustedPackingType: string
220
-
221
- @Column('float', { nullable: true, default: 1, transformer: roundTransformer })
222
- @Field({ nullable: true })
223
- packingSize: number
224
-
225
- @Column('int', { nullable: true })
226
- @Field({ nullable: true })
227
- manufactureYear: number
228
-
229
- @Column('date', { nullable: true })
230
- @Field(type => ScalarDate, { nullable: true })
231
- manufactureDate: Date
232
-
233
- @Column({ nullable: true })
234
- @Field({ nullable: true })
235
- uom: string
236
-
237
- @Column({ nullable: true })
238
- @Field({ nullable: true })
239
- adjustedUom: string
240
-
241
- @Column('float', { nullable: true, transformer: roundTransformer })
242
- @Field({ nullable: true })
243
- uomValue: number
244
-
245
- @Column('float', { nullable: true, transformer: roundTransformer })
246
- @Field({ nullable: true })
247
- adjustedUomValue: number
248
-
249
- @Column('float', { nullable: true, transformer: roundTransformer })
250
- @Field({ nullable: true })
251
- unpackUomValue: number
252
-
253
- @Column('float', { transformer: roundTransformer })
254
- @Field()
255
- packQty: number
256
-
257
- @Column({ nullable: true })
258
- @Field({ nullable: true })
259
- adjustedPackQty: number
260
-
261
- @Column('float', { nullable: true, transformer: roundTransformer })
262
- @Field({ nullable: true })
263
- actualPackQty: number
264
-
265
- @Column('float', { nullable: true, transformer: roundTransformer })
266
- @Field({ nullable: true })
267
- unpackQty: number
268
-
269
- @Column('float', { nullable: true, transformer: roundTransformer })
270
- @Field({ nullable: true })
271
- unitPrice: number
272
-
273
- @Column('float', { nullable: true, transformer: roundTransformer })
274
- @Field({ nullable: true })
275
- adjustedUnitPrice: number
276
-
277
- @Column('float', { nullable: true, transformer: roundTransformer })
278
- @Field({ nullable: true })
279
- discountAmt: number
280
-
281
- @Column('float', { nullable: true, transformer: roundTransformer })
282
- @Field({ nullable: true })
283
- taxRate: number
284
-
285
- @Column('float', { nullable: true, transformer: roundTransformer })
286
- @Field({ nullable: true })
287
- miscAmt: number
288
-
289
- @Column('float', { nullable: true, transformer: roundTransformer })
290
- @Field({ nullable: true })
291
- palletQty: number
292
-
293
- @Column('float', { nullable: true, transformer: roundTransformer })
294
- @Field({ nullable: true })
295
- adjustedPalletQty: number
296
-
297
- @Column('float', { nullable: true, transformer: roundTransformer })
298
- @Field({ nullable: true })
299
- actualPalletQty: number
300
-
301
- @Column({ nullable: true })
302
- @Field({ nullable: true })
303
- totalUomValue: string
304
-
305
- @Column({ nullable: true })
306
- @Field({ nullable: true })
307
- adjustedTotalUomValue: string
308
-
309
- @Column({ nullable: true, type: 'float', transformer: roundTransformer })
310
- @Field({ nullable: true })
311
- releaseQty: number
312
-
313
- @Column({ nullable: true, type: 'float', transformer: roundTransformer })
314
- @Field({ nullable: true })
315
- releaseUomValue: number
316
-
317
- @Column({ nullable: true })
318
- @Field({ nullable: true })
319
- remark: string
320
-
321
- @Column({ nullable: true })
322
- @Field({ nullable: true })
323
- issue: string
324
-
325
- @Column()
326
- @Field()
327
- status: string
328
-
329
- @CreateDateColumn()
330
- @Field()
331
- createdAt: Date
332
-
333
- @UpdateDateColumn()
334
- @Field()
335
- updatedAt: Date
336
-
337
- @ManyToOne(type => User)
338
- @Field(type => User, { nullable: true })
339
- creator: User
340
-
341
- @RelationId((orderProduct: OrderProduct) => orderProduct.creator)
342
- creatorId: string
343
-
344
- @ManyToOne(type => User)
345
- @Field(type => User, { nullable: true })
346
- updater: User
347
-
348
- @RelationId((orderProduct: OrderProduct) => orderProduct.updater)
349
- updaterId: string
350
-
351
- @Field(type => Float, { nullable: true })
352
- remainQty: number
353
-
354
- @Field(type => Float, { nullable: true })
355
- remainUomValue: number
356
-
357
- @Field({ nullable: true })
358
- remainUomValueWithUom: string
359
-
360
- @Field({ nullable: true })
361
- groupType: string
362
- }
@@ -1,9 +0,0 @@
1
- import { OrderTote } from './order-tote'
2
- import { OrderToteMutation } from './order-tote-mutation'
3
- import { OrderToteQuery } from './order-tote-query'
4
-
5
- export const entities = [OrderTote]
6
- export const resolvers = [OrderToteQuery, OrderToteMutation]
7
-
8
- export * from './order-tote-mutation'
9
- export * from './order-tote-query'
@@ -1,31 +0,0 @@
1
- import { Arg, Ctx, Directive, Mutation, Resolver } from 'type-graphql'
2
- import { In } from 'typeorm'
3
-
4
- import { OrderTote } from './order-tote'
5
-
6
- @Resolver(OrderTote)
7
- export class OrderToteMutation {
8
- @Directive('@transaction')
9
- @Mutation(returns => Boolean)
10
- async deleteOrderTote(@Arg('name') id: string, @Ctx() context: ResolverContext): Promise<Boolean> {
11
- const { domain, tx } = context.state
12
-
13
- await tx.getRepository(OrderTote).delete({ domain: { id: domain.id }, id })
14
- return true
15
- }
16
-
17
- @Directive('@transaction')
18
- @Mutation(returns => Boolean)
19
- async deleteOrderTotes(
20
- @Arg('ids', type => [String]) ids: string[],
21
- @Ctx() context: ResolverContext
22
- ): Promise<Boolean> {
23
- const { domain, tx } = context.state
24
-
25
- await tx.getRepository(OrderTote).delete({
26
- domain: { id: domain.id },
27
- id: In(ids)
28
- })
29
- return true
30
- }
31
- }
@@ -1,112 +0,0 @@
1
- import { Arg, Ctx, Query, Resolver } from 'type-graphql'
2
- import { In } from 'typeorm'
3
-
4
- import { buildQuery, Filter, getRepository, Pagination, Sorting } from '@things-factory/shell'
5
- import { Tote } from '@things-factory/warehouse-base'
6
-
7
- import { OrderToteSeal } from '../order-tote-seal/order-tote-seal'
8
- import { ReleaseGood } from '../release-good/release-good'
9
- import { OrderTote } from './order-tote'
10
- import { OrderToteList } from './order-tote-types'
11
-
12
- @Resolver(OrderTote)
13
- export class OrderToteQuery {
14
- @Query(returns => OrderToteList)
15
- async orderTotes(
16
- @Ctx() context: ResolverContext,
17
- @Arg('filters', type => [Filter], { nullable: true }) filters?: Filter[],
18
- @Arg('pagination', type => Pagination, { nullable: true }) pagination?: Pagination,
19
- @Arg('sortings', type => [Sorting], { nullable: true }) sortings?: Sorting[]
20
- ): Promise<OrderToteList> {
21
- try {
22
- const { domain } = context.state
23
-
24
- const releaseGoodNoParam = filters.find(item => item.name === 'releaseGoodNo')
25
-
26
- const queryBuilder = await getRepository(OrderTote).createQueryBuilder()
27
- buildQuery(queryBuilder, { filters, pagination, sortings }, context)
28
-
29
- queryBuilder
30
- .leftJoinAndSelect('OrderTote.domain', 'Domain')
31
- .leftJoinAndSelect('OrderTote.releaseGood', 'ReleaseGood')
32
- .leftJoinAndSelect('OrderTote.tote', 'Tote')
33
- .leftJoinAndSelect('OrderTote.updater', 'Updater')
34
- .where('Domain.id = :domainId', { domainId: domain.id })
35
-
36
- if (releaseGoodNoParam) {
37
- filters.splice(
38
- filters.findIndex(item => item.name == 'releaseGoodNo'),
39
- 1
40
- )
41
- queryBuilder.andWhere('ReleaseGood.name = :rgName', { rgName: releaseGoodNoParam.value })
42
- }
43
-
44
- let [items, total] = await queryBuilder.getManyAndCount()
45
-
46
- let orderToteIds: string[] = items.map(itm => itm.id)
47
-
48
- let orderToteSeals: OrderToteSeal[] = await getRepository(OrderToteSeal).find({
49
- where: { orderTote: In(orderToteIds) }
50
- })
51
-
52
- items = items.map((itm: OrderTote) => {
53
- return {
54
- ...itm,
55
- orderToteSeals: orderToteSeals.filter(seal => seal.orderToteId == itm.id)
56
- }
57
- })
58
-
59
- return { items, total }
60
- } catch (e) {
61
- throw new Error(e)
62
- }
63
- }
64
-
65
- @Query(returns => OrderTote)
66
- async orderTote(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<OrderTote> {
67
- const { domain } = context.state
68
-
69
- return await getRepository(OrderTote).findOne({
70
- where: { domain: { id: domain.id }, id },
71
- relations: ['domain', 'releaseGood', 'tote', 'updater']
72
- })
73
- }
74
-
75
- @Query(returns => Boolean)
76
- async checkOrderTote(
77
- @Arg('name') name: string,
78
- @Arg('orderNo') orderNo: string,
79
- @Ctx() context: ResolverContext
80
- ): Promise<Boolean> {
81
- const { domain } = context.state
82
- let foundOrder = await getRepository(ReleaseGood).findOne({
83
- where: { name: orderNo, domain: { id: domain.id } },
84
- relations: ['bizplace']
85
- })
86
- let scannedTote = await getRepository(Tote).findOne({ where: { name, bizplace: { id: foundOrder.bizplace.id } } })
87
-
88
- let foundOrderTote = await getRepository(OrderTote).findOne({
89
- where: { domain: { id: domain.id }, releaseGood: { id: foundOrder.id }, name },
90
- relations: ['domain', 'releaseGood', 'tote', 'updater']
91
- })
92
-
93
- if (!foundOrderTote && scannedTote) {
94
- let executingOrderTote = await getRepository(OrderTote).find({
95
- where: { tote: scannedTote },
96
- relations: ['releaseGood']
97
- })
98
-
99
- executingOrderTote = executingOrderTote.filter(itm => itm.releaseGood.status !== 'DONE')
100
-
101
- if (executingOrderTote && executingOrderTote.length > 0) {
102
- throw new Error(`Current tote is used in another RO (${executingOrderTote[0].releaseGood.name})`)
103
- }
104
- }
105
-
106
- if (foundOrderTote?.closedDate) {
107
- return true
108
- } else {
109
- return false
110
- }
111
- }
112
- }
@@ -1,47 +0,0 @@
1
- import { Field, InputType, Int, ObjectType } from 'type-graphql'
2
-
3
- import { ObjectRef } from '@things-factory/shell'
4
-
5
- import { OrderTote } from './order-tote'
6
-
7
- @ObjectType()
8
- export class OrderToteList {
9
- @Field(type => [OrderTote], { nullable: true })
10
- items: OrderTote[]
11
-
12
- @Field(type => Int, { nullable: true })
13
- total: number
14
- }
15
-
16
- @InputType()
17
- export class NewOrderTote {
18
- @Field({ nullable: true })
19
- name: string
20
-
21
- @Field({ nullable: true })
22
- description: string
23
-
24
- @Field(type => ObjectRef, { nullable: true })
25
- releaseGood: ObjectRef
26
-
27
- @Field(type => ObjectRef, { nullable: true })
28
- tote: ObjectRef
29
- }
30
-
31
- @InputType()
32
- export class OrderTotePatch {
33
- @Field({ nullable: true })
34
- id: string
35
-
36
- @Field({ nullable: true })
37
- name: string
38
-
39
- @Field({ nullable: true })
40
- description: string
41
-
42
- @Field(type => ObjectRef, { nullable: true })
43
- releaseGood: ObjectRef
44
-
45
- @Field(type => ObjectRef, { nullable: true })
46
- tote: ObjectRef
47
- }
@@ -1,73 +0,0 @@
1
- import { Field, ObjectType } from 'type-graphql'
2
- import {
3
- Column,
4
- Entity,
5
- Index,
6
- ManyToOne,
7
- OneToMany,
8
- PrimaryGeneratedColumn,
9
- RelationId,
10
- UpdateDateColumn
11
- } from 'typeorm'
12
-
13
- import { User } from '@things-factory/auth-base'
14
- import { Domain } from '@things-factory/shell'
15
- import { Tote } from '@things-factory/warehouse-base'
16
-
17
- import { OrderToteSeal } from '../order-tote-seal/order-tote-seal'
18
- import { ReleaseGood } from '../release-good/release-good'
19
-
20
- @Entity()
21
- @Index('ix_order_tote_0', (orderTote: OrderTote) => [orderTote.id], { unique: true })
22
- @ObjectType()
23
- export class OrderTote {
24
- @PrimaryGeneratedColumn('uuid')
25
- @Field()
26
- id: string
27
-
28
- @ManyToOne(type => Domain)
29
- @Field(type => Domain)
30
- domain: Domain
31
-
32
- @RelationId((orderTote: OrderTote) => orderTote.domain)
33
- domainId: string
34
-
35
- @Column()
36
- @Field()
37
- name: string
38
-
39
- @ManyToOne(type => ReleaseGood)
40
- @Field(type => ReleaseGood)
41
- releaseGood?: ReleaseGood
42
-
43
- @RelationId((orderTote: OrderTote) => orderTote.releaseGood)
44
- releaseGoodId: string
45
-
46
- @ManyToOne(type => Tote)
47
- @Field(type => Tote, { nullable: true })
48
- tote?: Tote
49
-
50
- @RelationId((orderTote: OrderTote) => orderTote.tote)
51
- toteId: string
52
-
53
- @Column({ nullable: true })
54
- @Field({ nullable: true })
55
- closedDate?: Date
56
-
57
- @UpdateDateColumn()
58
- @Field({ nullable: true })
59
- updatedAt: Date
60
-
61
- @ManyToOne(type => User, {
62
- nullable: true
63
- })
64
- @Field(type => User, { nullable: true })
65
- updater?: User
66
-
67
- @RelationId((orderTote: OrderTote) => orderTote.updater)
68
- updaterId: string
69
-
70
- @OneToMany(type => OrderToteSeal, orderToteSeal => orderToteSeal.orderTote, { nullable: true })
71
- @Field(type => [OrderToteSeal], { nullable: true })
72
- orderToteSeals?: OrderToteSeal[]
73
- }
@@ -1,9 +0,0 @@
1
- import { OrderToteItem } from './order-tote-item'
2
- import { OrderToteItemMutation } from './order-tote-item-mutation'
3
- import { OrderToteItemQuery } from './order-tote-item-query'
4
-
5
- export const entities = [OrderToteItem]
6
- export const resolvers = [OrderToteItemQuery, OrderToteItemMutation]
7
-
8
- export * from './order-tote-item-mutation'
9
- export * from './order-tote-item-query'
@@ -1,31 +0,0 @@
1
- import { Arg, Ctx, Directive, Mutation, Resolver } from 'type-graphql'
2
- import { In } from 'typeorm'
3
-
4
- import { OrderToteItem } from './order-tote-item'
5
-
6
- @Resolver(OrderToteItem)
7
- export class OrderToteItemMutation {
8
- @Directive('@transaction')
9
- @Mutation(returns => Boolean)
10
- async deleteOrderToteItem(@Arg('name') id: string, @Ctx() context: ResolverContext): Promise<Boolean> {
11
- const { domain, tx } = context.state
12
-
13
- await tx.getRepository(OrderToteItem).delete({ domain: { id: domain.id }, id })
14
- return true
15
- }
16
-
17
- @Directive('@transaction')
18
- @Mutation(returns => Boolean)
19
- async deleteOrderToteItems(
20
- @Arg('ids', type => [String]) ids: string[],
21
- @Ctx() context: ResolverContext
22
- ): Promise<Boolean> {
23
- const { domain, tx } = context.state
24
-
25
- await tx.getRepository(OrderToteItem).delete({
26
- domain: { id: domain.id },
27
- id: In(ids)
28
- })
29
- return true
30
- }
31
- }