@things-factory/sales-base 8.0.0-beta.9 → 8.0.1

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 (178) hide show
  1. package/dist-server/tsconfig.tsbuildinfo +1 -1
  2. package/package.json +13 -13
  3. package/server/constants/attachment-type.ts +9 -0
  4. package/server/constants/index.ts +7 -0
  5. package/server/constants/load-type.ts +4 -0
  6. package/server/constants/order.ts +203 -0
  7. package/server/constants/product-group-type.ts +4 -0
  8. package/server/constants/release-good.ts +9 -0
  9. package/server/constants/transfer-order-type.ts +6 -0
  10. package/server/constants/validation-error-code.ts +3 -0
  11. package/server/constants/vas-target-type.ts +25 -0
  12. package/server/controllers/ecommerce/ecommerce-controller.ts +122 -0
  13. package/server/controllers/ecommerce/index.ts +2 -0
  14. package/server/controllers/ecommerce/sellercraft-controller.ts +182 -0
  15. package/server/controllers/index.ts +2 -0
  16. package/server/controllers/order-controller.ts +296 -0
  17. package/server/errors/index.ts +1 -0
  18. package/server/errors/validation-error.ts +25 -0
  19. package/server/index.ts +5 -0
  20. package/server/migrations/index.ts +9 -0
  21. package/server/service/arrival-notice/arrival-notice-mutation.ts +1152 -0
  22. package/server/service/arrival-notice/arrival-notice-query.ts +549 -0
  23. package/server/service/arrival-notice/arrival-notice-types.ts +310 -0
  24. package/server/service/arrival-notice/arrival-notice.ts +202 -0
  25. package/server/service/arrival-notice/index.ts +9 -0
  26. package/server/service/claim/claim-mutation.ts +308 -0
  27. package/server/service/claim/claim-query.ts +122 -0
  28. package/server/service/claim/claim-types.ts +130 -0
  29. package/server/service/claim/claim.ts +140 -0
  30. package/server/service/claim/index.ts +9 -0
  31. package/server/service/claim-detail/claim-detail-mutation.ts +102 -0
  32. package/server/service/claim-detail/claim-detail-query.ts +55 -0
  33. package/server/service/claim-detail/claim-detail-types.ts +47 -0
  34. package/server/service/claim-detail/claim-detail.ts +69 -0
  35. package/server/service/claim-detail/index.ts +9 -0
  36. package/server/service/claim-order/claim-order-mutation.ts +101 -0
  37. package/server/service/claim-order/claim-order-query.ts +47 -0
  38. package/server/service/claim-order/claim-order-types.ts +35 -0
  39. package/server/service/claim-order/claim-order.ts +81 -0
  40. package/server/service/claim-order/index.ts +9 -0
  41. package/server/service/collection-order/collection-order-mutation.ts +245 -0
  42. package/server/service/collection-order/collection-order-query.ts +97 -0
  43. package/server/service/collection-order/collection-order-types.ts +165 -0
  44. package/server/service/collection-order/collection-order.ts +135 -0
  45. package/server/service/collection-order/index.ts +9 -0
  46. package/server/service/delivery-order/delivery-order-mutation.ts +967 -0
  47. package/server/service/delivery-order/delivery-order-query.ts +631 -0
  48. package/server/service/delivery-order/delivery-order-types.ts +268 -0
  49. package/server/service/delivery-order/delivery-order.ts +258 -0
  50. package/server/service/delivery-order/index.ts +9 -0
  51. package/server/service/draft-release-good/draft-release-good-mutation.ts +765 -0
  52. package/server/service/draft-release-good/draft-release-good-query.ts +354 -0
  53. package/server/service/draft-release-good/draft-release-good-type.ts +261 -0
  54. package/server/service/draft-release-good/draft-release-good.ts +284 -0
  55. package/server/service/draft-release-good/index.ts +9 -0
  56. package/server/service/goods-receival-note/goods-receival-note-mutation.ts +129 -0
  57. package/server/service/goods-receival-note/goods-receival-note-query.ts +280 -0
  58. package/server/service/goods-receival-note/goods-receival-note-types.ts +105 -0
  59. package/server/service/goods-receival-note/goods-receival-note.ts +127 -0
  60. package/server/service/goods-receival-note/index.ts +9 -0
  61. package/server/service/index.ts +238 -0
  62. package/server/service/inventory-check/index.ts +9 -0
  63. package/server/service/inventory-check/inventory-check-mutation.ts +149 -0
  64. package/server/service/inventory-check/inventory-check-query.ts +48 -0
  65. package/server/service/inventory-check/inventory-check-types.ts +48 -0
  66. package/server/service/inventory-check/inventory-check.ts +90 -0
  67. package/server/service/invoice/index.ts +9 -0
  68. package/server/service/invoice/invoice-mutation.ts +95 -0
  69. package/server/service/invoice/invoice-query.ts +53 -0
  70. package/server/service/invoice/invoice-types.ts +279 -0
  71. package/server/service/invoice/invoice.ts +230 -0
  72. package/server/service/invoice-product/index.ts +9 -0
  73. package/server/service/invoice-product/invoice-product-mutation.ts +54 -0
  74. package/server/service/invoice-product/invoice-product-query.ts +54 -0
  75. package/server/service/invoice-product/invoice-product-types.ts +84 -0
  76. package/server/service/invoice-product/invoice-product.ts +92 -0
  77. package/server/service/job-sheet/index.ts +9 -0
  78. package/server/service/job-sheet/job-sheet-mutation.ts +92 -0
  79. package/server/service/job-sheet/job-sheet-query.ts +112 -0
  80. package/server/service/job-sheet/job-sheet-types.ts +78 -0
  81. package/server/service/job-sheet/job-sheet.ts +102 -0
  82. package/server/service/manifest/index.ts +6 -0
  83. package/server/service/manifest/manifest-mutation.ts +190 -0
  84. package/server/service/manifest/manifest-query.ts +149 -0
  85. package/server/service/manifest/manifest-type.ts +84 -0
  86. package/server/service/manifest/manifest.ts +114 -0
  87. package/server/service/order-inventory/index.ts +9 -0
  88. package/server/service/order-inventory/order-inventory-mutation.ts +54 -0
  89. package/server/service/order-inventory/order-inventory-query.ts +722 -0
  90. package/server/service/order-inventory/order-inventory-types.ts +238 -0
  91. package/server/service/order-inventory/order-inventory.ts +401 -0
  92. package/server/service/order-product/index.ts +9 -0
  93. package/server/service/order-product/order-product-mutation.ts +48 -0
  94. package/server/service/order-product/order-product-query.ts +89 -0
  95. package/server/service/order-product/order-product-types.ts +335 -0
  96. package/server/service/order-product/order-product.ts +362 -0
  97. package/server/service/order-tote/index.ts +9 -0
  98. package/server/service/order-tote/order-tote-mutation.ts +31 -0
  99. package/server/service/order-tote/order-tote-query.ts +112 -0
  100. package/server/service/order-tote/order-tote-types.ts +47 -0
  101. package/server/service/order-tote/order-tote.ts +73 -0
  102. package/server/service/order-tote-item/index.ts +9 -0
  103. package/server/service/order-tote-item/order-tote-item-mutation.ts +31 -0
  104. package/server/service/order-tote-item/order-tote-item-query.ts +82 -0
  105. package/server/service/order-tote-item/order-tote-item-types.ts +56 -0
  106. package/server/service/order-tote-item/order-tote-item.ts +72 -0
  107. package/server/service/order-tote-seal/index.ts +9 -0
  108. package/server/service/order-tote-seal/order-tote-seal-mutation.ts +31 -0
  109. package/server/service/order-tote-seal/order-tote-seal-query.ts +59 -0
  110. package/server/service/order-tote-seal/order-tote-seal-types.ts +41 -0
  111. package/server/service/order-tote-seal/order-tote-seal.ts +46 -0
  112. package/server/service/order-vas/index.ts +9 -0
  113. package/server/service/order-vas/order-vas-mutation.ts +20 -0
  114. package/server/service/order-vas/order-vas-query.ts +72 -0
  115. package/server/service/order-vas/order-vas-types.ts +159 -0
  116. package/server/service/order-vas/order-vas.ts +207 -0
  117. package/server/service/others/index.ts +5 -0
  118. package/server/service/others/other-query.ts +563 -0
  119. package/server/service/others/other-types.ts +115 -0
  120. package/server/service/purchase-order/index.ts +9 -0
  121. package/server/service/purchase-order/purchase-order-mutation.ts +458 -0
  122. package/server/service/purchase-order/purchase-order-query.ts +90 -0
  123. package/server/service/purchase-order/purchase-order-types.ts +154 -0
  124. package/server/service/purchase-order/purchase-order.ts +172 -0
  125. package/server/service/purchase-order-other-charge/index.ts +9 -0
  126. package/server/service/purchase-order-other-charge/purchase-order-other-charge-mutation.ts +31 -0
  127. package/server/service/purchase-order-other-charge/purchase-order-other-charge-query.ts +52 -0
  128. package/server/service/purchase-order-other-charge/purchase-order-other-charge-types.ts +44 -0
  129. package/server/service/purchase-order-other-charge/purchase-order-other-charge.ts +68 -0
  130. package/server/service/release-good/index.ts +9 -0
  131. package/server/service/release-good/release-good-mutation.ts +1686 -0
  132. package/server/service/release-good/release-good-query.ts +980 -0
  133. package/server/service/release-good/release-good-types.ts +662 -0
  134. package/server/service/release-good/release-good.ts +490 -0
  135. package/server/service/retail-replenishment-order/index.ts +9 -0
  136. package/server/service/retail-replenishment-order/retail-replenishment-order-mutation.ts +382 -0
  137. package/server/service/retail-replenishment-order/retail-replenishment-order-query.ts +54 -0
  138. package/server/service/retail-replenishment-order/retail-replenishment-order-types.ts +101 -0
  139. package/server/service/retail-replenishment-order/retail-replenishment-order.ts +115 -0
  140. package/server/service/return-order/index.ts +9 -0
  141. package/server/service/return-order/return-order-mutation.ts +516 -0
  142. package/server/service/return-order/return-order-query.ts +226 -0
  143. package/server/service/return-order/return-order-types.ts +196 -0
  144. package/server/service/return-order/return-order.ts +127 -0
  145. package/server/service/reverse-kitting-order/index.ts +9 -0
  146. package/server/service/reverse-kitting-order/reverse-kitting-order-mutation.ts +500 -0
  147. package/server/service/reverse-kitting-order/reverse-kitting-order-query.ts +197 -0
  148. package/server/service/reverse-kitting-order/reverse-kitting-order-type.ts +173 -0
  149. package/server/service/reverse-kitting-order/reverse-kitting-order.ts +121 -0
  150. package/server/service/reverse-kitting-order-inventory/index.ts +9 -0
  151. package/server/service/reverse-kitting-order-inventory/reverse-kitting-order-inventory-mutation.ts +129 -0
  152. package/server/service/reverse-kitting-order-inventory/reverse-kitting-order-inventory-query.ts +52 -0
  153. package/server/service/reverse-kitting-order-inventory/reverse-kitting-order-inventory-type.ts +95 -0
  154. package/server/service/reverse-kitting-order-inventory/reverse-kitting-order-inventory.ts +143 -0
  155. package/server/service/shipping-order/index.ts +9 -0
  156. package/server/service/shipping-order/shipping-order-mutation.ts +61 -0
  157. package/server/service/shipping-order/shipping-order-query.ts +61 -0
  158. package/server/service/shipping-order/shipping-order-types.ts +89 -0
  159. package/server/service/shipping-order/shipping-order.ts +129 -0
  160. package/server/service/transfer-order/index.ts +9 -0
  161. package/server/service/transfer-order/transfer-order-mutation.ts +309 -0
  162. package/server/service/transfer-order/transfer-order-query.ts +66 -0
  163. package/server/service/transfer-order/transfer-order-types.ts +97 -0
  164. package/server/service/transfer-order/transfer-order.ts +117 -0
  165. package/server/service/vas/index.ts +9 -0
  166. package/server/service/vas/vas-mutation.ts +106 -0
  167. package/server/service/vas/vas-query.ts +60 -0
  168. package/server/service/vas/vas-types.ts +71 -0
  169. package/server/service/vas/vas.ts +77 -0
  170. package/server/service/vas-order/index.ts +9 -0
  171. package/server/service/vas-order/vas-order-mutation.ts +259 -0
  172. package/server/service/vas-order/vas-order-query.ts +119 -0
  173. package/server/service/vas-order/vas-order-types.ts +49 -0
  174. package/server/service/vas-order/vas-order.ts +81 -0
  175. package/server/utils/datetime-util.ts +54 -0
  176. package/server/utils/index.ts +3 -0
  177. package/server/utils/inventory-util.ts +1155 -0
  178. package/server/utils/order-no-generator.ts +146 -0
@@ -0,0 +1,82 @@
1
+ import { Arg, Ctx, Query, Resolver } from 'type-graphql'
2
+
3
+ import { buildQuery, getRepository, Sorting } from '@things-factory/shell'
4
+
5
+ import { ReleaseGood } from '../release-good/release-good'
6
+ import { OrderToteItem } from './order-tote-item'
7
+ import { OrderToteItemList } from './order-tote-item-types'
8
+
9
+ @Resolver(OrderToteItem)
10
+ export class OrderToteItemQuery {
11
+ @Query(returns => OrderToteItemList)
12
+ async orderToteItems(
13
+ @Ctx() context: ResolverContext,
14
+ @Arg('toteNo', type => String) toteNo: string,
15
+ @Arg('orderNo', type => String) orderNo: string,
16
+ @Arg('sortings', type => [Sorting], { nullable: true }) sortings?: Sorting[]
17
+ ): Promise<OrderToteItemList> {
18
+ try {
19
+ const { domain } = context.state
20
+
21
+ const foundOrder: ReleaseGood = await getRepository(ReleaseGood).findOne({
22
+ where: { domain: { id: domain.id }, name: orderNo }
23
+ })
24
+
25
+ const queryBuilder = getRepository(OrderToteItem).createQueryBuilder()
26
+ buildQuery(queryBuilder, { sortings }, context)
27
+
28
+ queryBuilder
29
+ .select('OrderToteItem.id', 'id')
30
+ .addSelect('OrderToteItem.name', 'name')
31
+ .addSelect('OrderProduct.id', 'orderProductId')
32
+ .addSelect('OrderProduct.name', 'orderProductName')
33
+ .addSelect('Domain.id', 'domainId')
34
+ .addSelect('Domain.name', 'domainName')
35
+ .addSelect('SUM(OrderToteItem.qty)', 'pickedQty')
36
+ .addSelect('Product.id', 'productId')
37
+ .addSelect('Product.sku', 'productSku')
38
+ .addSelect('Product.packingType', 'packingType')
39
+ .leftJoin('OrderToteItem.domain', 'Domain')
40
+ .leftJoin('OrderToteItem.orderProduct', 'OrderProduct')
41
+ .leftJoin('OrderProduct.product', 'Product')
42
+ .leftJoin('OrderToteItem.orderTote', 'OrderTote')
43
+ .where('"OrderTote"."release_good_id" = :foundOrderId', { foundOrderId: foundOrder.id })
44
+ .andWhere('Domain.id = :domainId', { domainId: domain.id })
45
+ .andWhere('"OrderTote"."name" = :toteName', { toteName: toteNo })
46
+ .groupBy('Product.id')
47
+ .addGroupBy('OrderToteItem.id')
48
+ .addGroupBy('Domain.id')
49
+ .addGroupBy('OrderProduct.id')
50
+
51
+ const items = await queryBuilder.getRawMany()
52
+
53
+ return {
54
+ items: items.map(itm => {
55
+ return {
56
+ ...itm,
57
+ orderProduct: {
58
+ id: itm.orderProductId,
59
+ name: itm.orderProductName,
60
+ product: { id: itm.productId, sku: itm.productSku, packingType: itm.packingType }
61
+ },
62
+ domain: { id: itm.domainId, name: itm.domainName },
63
+ qty: itm.pickedQty
64
+ }
65
+ }),
66
+ total: items.length
67
+ }
68
+ } catch (e) {
69
+ throw new Error(e)
70
+ }
71
+ }
72
+
73
+ @Query(returns => OrderToteItem)
74
+ async orderToteItem(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<OrderToteItem> {
75
+ const { domain } = context.state
76
+
77
+ return await getRepository(OrderToteItem).findOne({
78
+ where: { domain: { id: domain.id }, id },
79
+ relations: ['domain', 'orderProduct', 'orderInventory', 'orderTote', 'updater']
80
+ })
81
+ }
82
+ }
@@ -0,0 +1,56 @@
1
+ import { Field, InputType, Int, ObjectType } from 'type-graphql'
2
+
3
+ import { ObjectRef } from '@things-factory/shell'
4
+
5
+ import { OrderToteItem } from './order-tote-item'
6
+
7
+ @ObjectType()
8
+ export class OrderToteItemList {
9
+ @Field(type => [OrderToteItem], { nullable: true })
10
+ items: OrderToteItem[]
11
+
12
+ @Field(type => Int, { nullable: true })
13
+ total: number
14
+ }
15
+
16
+ @InputType()
17
+ export class NewOrderToteItem {
18
+ @Field({ nullable: true })
19
+ name: string
20
+
21
+ @Field({ nullable: true })
22
+ description: string
23
+
24
+ @Field(type => ObjectRef, { nullable: true })
25
+ orderProduct: ObjectRef
26
+
27
+ @Field(type => ObjectRef, { nullable: true })
28
+ orderInventory: ObjectRef
29
+
30
+ @Field(type => ObjectRef, { nullable: true })
31
+ orderTote: ObjectRef
32
+
33
+ @Field(type => Int)
34
+ qty: number
35
+ }
36
+
37
+ @InputType()
38
+ export class OrderToteItemPatch {
39
+ @Field({ nullable: true })
40
+ id: string
41
+
42
+ @Field({ nullable: true })
43
+ name: string
44
+
45
+ @Field({ nullable: true })
46
+ description: string
47
+
48
+ @Field(type => ObjectRef, { nullable: true })
49
+ orderProduct: ObjectRef
50
+
51
+ @Field(type => ObjectRef, { nullable: true })
52
+ orderTote: ObjectRef
53
+
54
+ @Field(type => Int)
55
+ qty: number
56
+ }
@@ -0,0 +1,72 @@
1
+ import { Field, Int, ObjectType } from 'type-graphql'
2
+ import { Column, Entity, Index, ManyToOne, PrimaryGeneratedColumn, RelationId, UpdateDateColumn } from 'typeorm'
3
+
4
+ import { User } from '@things-factory/auth-base'
5
+ import { Domain } from '@things-factory/shell'
6
+ import { OrderTote } from '../order-tote/order-tote'
7
+ import { OrderProduct } from '../order-product/order-product'
8
+ import { OrderInventory } from '../order-inventory/order-inventory'
9
+
10
+ @Entity()
11
+ @Index('ix_order_tote_item_0', (orderToteItem: OrderToteItem) => [orderToteItem.name], { unique: true })
12
+ @ObjectType()
13
+ export class OrderToteItem {
14
+ @PrimaryGeneratedColumn('uuid')
15
+ @Field()
16
+ id: string
17
+
18
+ @ManyToOne(type => Domain)
19
+ @Field(type => Domain)
20
+ domain: Domain
21
+
22
+ @RelationId((orderToteItem: OrderToteItem) => orderToteItem.domain)
23
+ domainId: string
24
+
25
+ @Column()
26
+ @Field()
27
+ name: string
28
+
29
+ @ManyToOne(type => OrderInventory)
30
+ @Field(type => OrderInventory)
31
+ orderInventory?: OrderInventory
32
+
33
+ @RelationId((orderToteItem: OrderToteItem) => orderToteItem.orderInventory)
34
+ orderInventoryId: string
35
+
36
+ @ManyToOne(type => OrderProduct)
37
+ @Field(type => OrderProduct)
38
+ orderProduct?: OrderProduct
39
+
40
+ @RelationId((orderToteItem: OrderToteItem) => orderToteItem.orderProduct)
41
+ orderProductId: string
42
+
43
+ @ManyToOne(type => OrderTote)
44
+ @Field(type => OrderTote, { nullable: true })
45
+ orderTote?: OrderTote
46
+
47
+ @RelationId((orderToteItem: OrderToteItem) => orderToteItem.orderTote)
48
+ orderToteId: string
49
+
50
+ @Column('int')
51
+ @Field({ nullable: true })
52
+ qty?: number
53
+
54
+ @Field({ nullable: true })
55
+ sku?: string
56
+
57
+ @Field({ nullable: true })
58
+ packingType?: string
59
+
60
+ @UpdateDateColumn()
61
+ @Field({ nullable: true })
62
+ updatedAt: Date
63
+
64
+ @ManyToOne(type => User, {
65
+ nullable: true
66
+ })
67
+ @Field({ nullable: true })
68
+ updater: User
69
+
70
+ @RelationId((orderToteItem: OrderTote) => orderToteItem.updater)
71
+ updaterId: string
72
+ }
@@ -0,0 +1,9 @@
1
+ import { OrderToteSeal } from './order-tote-seal'
2
+ import { OrderToteSealMutation } from './order-tote-seal-mutation'
3
+ import { OrderToteSealQuery } from './order-tote-seal-query'
4
+
5
+ export const entities = [OrderToteSeal]
6
+ export const resolvers = [OrderToteSealQuery, OrderToteSealMutation]
7
+
8
+ export * from './order-tote-seal-mutation'
9
+ export * from './order-tote-seal-query'
@@ -0,0 +1,31 @@
1
+ import { Arg, Ctx, Directive, Mutation, Resolver } from 'type-graphql'
2
+ import { In } from 'typeorm'
3
+
4
+ import { OrderToteSeal } from './order-tote-seal'
5
+
6
+ @Resolver(OrderToteSeal)
7
+ export class OrderToteSealMutation {
8
+ @Directive('@transaction')
9
+ @Mutation(returns => Boolean)
10
+ async deleteOrderToteSeal(@Arg('name') id: string, @Ctx() context: ResolverContext): Promise<Boolean> {
11
+ const { domain, tx } = context.state
12
+
13
+ await tx.getRepository(OrderToteSeal).delete({ domain: { id: domain.id }, id })
14
+ return true
15
+ }
16
+
17
+ @Directive('@transaction')
18
+ @Mutation(returns => Boolean)
19
+ async deleteOrderToteSeals(
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(OrderToteSeal).delete({
26
+ domain: { id: domain.id },
27
+ id: In(ids)
28
+ })
29
+ return true
30
+ }
31
+ }
@@ -0,0 +1,59 @@
1
+ import { Arg, Ctx, FieldResolver, Query, Resolver, Root } from 'type-graphql'
2
+
3
+ import { User } from '@things-factory/auth-base'
4
+ import { buildQuery, Domain, Filter, getRepository, Pagination, Sorting } from '@things-factory/shell'
5
+
6
+ import { OrderTote } from '../order-tote/order-tote'
7
+ import { OrderToteSeal } from './order-tote-seal'
8
+ import { OrderToteSealList } from './order-tote-seal-types'
9
+
10
+ @Resolver(OrderToteSeal)
11
+ export class OrderToteSealQuery {
12
+ @Query(returns => OrderToteSealList)
13
+ async orderToteSeals(
14
+ @Ctx() context: ResolverContext,
15
+ @Arg('filters', type => [Filter], { nullable: true }) filters?: Filter[],
16
+ @Arg('pagination', type => Pagination, { nullable: true }) pagination?: Pagination,
17
+ @Arg('sortings', type => [Sorting], { nullable: true }) sortings?: Sorting[]
18
+ ): Promise<OrderToteSealList> {
19
+ const { domain } = context.state
20
+
21
+ const queryBuilder = getRepository(OrderToteSeal).createQueryBuilder()
22
+ buildQuery(queryBuilder, { filters, pagination, sortings }, context)
23
+
24
+ queryBuilder
25
+ .leftJoinAndSelect('OrderToteSeal.domain', 'Domain')
26
+ .leftJoinAndSelect('OrderToteSeal.orderTote', 'OrderTote')
27
+ .leftJoinAndSelect('OrderToteSeal.updater', 'Updater')
28
+ .where('Domain.id = :domainId', { domainId: domain.id })
29
+
30
+ const [items, total] = await queryBuilder.getManyAndCount()
31
+
32
+ return { items, total }
33
+ }
34
+
35
+ @Query(returns => OrderToteSeal)
36
+ async orderToteSeal(@Arg('name') name: string, @Ctx() context: ResolverContext): Promise<OrderToteSeal> {
37
+ const { domain } = context.state
38
+
39
+ return await getRepository(OrderToteSeal).findOne({
40
+ where: { domain: { id: domain.id }, name },
41
+ relations: ['domain', 'orderTote', 'updater']
42
+ })
43
+ }
44
+
45
+ @FieldResolver()
46
+ async domain(@Root() orderToteSeal: OrderToteSeal) {
47
+ return await getRepository(Domain).findOneBy({ id: orderToteSeal.domainId })
48
+ }
49
+
50
+ @FieldResolver()
51
+ async updater(@Root() orderToteSeal: OrderToteSeal) {
52
+ return await getRepository(User).findOneBy({ id: orderToteSeal.updaterId })
53
+ }
54
+
55
+ @FieldResolver()
56
+ async orderTote(@Root() orderToteSeal: OrderToteSeal) {
57
+ return await getRepository(OrderTote).findOneBy({ id: orderToteSeal.orderToteId })
58
+ }
59
+ }
@@ -0,0 +1,41 @@
1
+ import { Field, InputType, Int, ObjectType } from 'type-graphql'
2
+
3
+ import { ObjectRef } from '@things-factory/shell'
4
+
5
+ import { OrderToteSeal } from './order-tote-seal'
6
+
7
+ @ObjectType()
8
+ export class OrderToteSealList {
9
+ @Field(type => [OrderToteSeal], { nullable: true })
10
+ items: OrderToteSeal[]
11
+
12
+ @Field(type => Int, { nullable: true })
13
+ total: number
14
+ }
15
+
16
+ @InputType()
17
+ export class NewOrderToteSeal {
18
+ @Field({ nullable: true })
19
+ name: string
20
+
21
+ @Field({ nullable: true })
22
+ description: string
23
+
24
+ @Field(type => ObjectRef, { nullable: true })
25
+ orderTote: ObjectRef
26
+ }
27
+
28
+ @InputType()
29
+ export class OrderToteSealPatch {
30
+ @Field({ nullable: true })
31
+ id: string
32
+
33
+ @Field({ nullable: true })
34
+ name: string
35
+
36
+ @Field({ nullable: true })
37
+ description: string
38
+
39
+ @Field(type => ObjectRef, { nullable: true })
40
+ orderTote: ObjectRef
41
+ }
@@ -0,0 +1,46 @@
1
+ import { Field, ObjectType } from 'type-graphql'
2
+ import { Column, Entity, Index, ManyToOne, PrimaryGeneratedColumn, RelationId, UpdateDateColumn } from 'typeorm'
3
+
4
+ import { User } from '@things-factory/auth-base'
5
+ import { Domain } from '@things-factory/shell'
6
+ import { OrderTote } from '../order-tote/order-tote'
7
+
8
+ @Entity()
9
+ @Index('ix_order_tote_seal_0', (orderToteSeal: OrderToteSeal) => [orderToteSeal.name], { unique: true })
10
+ @ObjectType()
11
+ export class OrderToteSeal {
12
+ @PrimaryGeneratedColumn('uuid')
13
+ @Field()
14
+ id: string
15
+
16
+ @ManyToOne(type => Domain)
17
+ @Field(type => Domain)
18
+ domain: Domain
19
+
20
+ @RelationId((orderToteSeal: OrderToteSeal) => orderToteSeal.domain)
21
+ domainId: string
22
+
23
+ @Column()
24
+ @Field()
25
+ name: string
26
+
27
+ @ManyToOne(type => OrderTote)
28
+ @Field(type => OrderTote, { nullable: true })
29
+ orderTote?: OrderTote
30
+
31
+ @RelationId((orderToteSeal: OrderToteSeal) => orderToteSeal.orderTote)
32
+ orderToteId: string
33
+
34
+ @UpdateDateColumn()
35
+ @Field({ nullable: true })
36
+ updatedAt: Date
37
+
38
+ @ManyToOne(type => User, {
39
+ nullable: true
40
+ })
41
+ @Field({ nullable: true })
42
+ updater: User
43
+
44
+ @RelationId((orderToteSeal: OrderToteSeal) => orderToteSeal.updater)
45
+ updaterId: string
46
+ }
@@ -0,0 +1,9 @@
1
+ import { OrderVas } from './order-vas'
2
+ import { OrderVasQuery } from './order-vas-query'
3
+ import { OrderVasMutation } from './order-vas-mutation'
4
+
5
+ export const entities = [OrderVas]
6
+ export const resolvers = [OrderVasQuery, OrderVasMutation]
7
+
8
+ export * from './order-vas-mutation'
9
+ export * from './order-vas-query'
@@ -0,0 +1,20 @@
1
+ import { Arg, Ctx, Directive, Mutation, Resolver } from 'type-graphql'
2
+
3
+ import { OrderVasPatch } from '../'
4
+ import { OrderVas } from './order-vas'
5
+
6
+ @Resolver(OrderVas)
7
+ export class OrderVasMutation {
8
+ @Directive('@transaction')
9
+ @Mutation(returns => OrderVas)
10
+ async updateOrderVas(
11
+ @Arg('id') id: string,
12
+ @Arg('patch', type => OrderVasPatch) patch: OrderVasPatch,
13
+ @Ctx() context: ResolverContext
14
+ ): Promise<OrderVas> {
15
+ const { tx, domain } = context.state
16
+
17
+ let orderVas = await tx.getRepository(OrderVas).findOneBy({ id })
18
+ return await tx.getRepository(OrderVas).save({ orderVas, ...patch })
19
+ }
20
+ }
@@ -0,0 +1,72 @@
1
+ import { Arg, Ctx, FieldResolver, Query, Resolver, Root } from 'type-graphql'
2
+
3
+ import { User } from '@things-factory/auth-base'
4
+ import { convertListParams, Domain, Filter, getRepository, Pagination, Sorting } from '@things-factory/shell'
5
+
6
+ import { OrderVasList } from '../'
7
+ import { OrderVas } from './order-vas'
8
+
9
+ @Resolver(OrderVas)
10
+ export class OrderVasQuery {
11
+ @Query(returns => OrderVasList)
12
+ async orderVass(
13
+ @Arg('filters', type => [Filter], { nullable: true }) filters?: [Filter],
14
+ @Arg('pagination', type => Pagination, { nullable: true }) pagination?: Pagination,
15
+ @Arg('sortings', type => [Sorting], { nullable: true }) sortings?: [Sorting]
16
+ ): Promise<OrderVasList> {
17
+ const convertedParams = convertListParams({ filters, pagination, sortings })
18
+ const [items, total] = await getRepository(OrderVas).findAndCount({
19
+ ...convertedParams,
20
+ relations: [
21
+ 'domain',
22
+ 'arrivalNotice',
23
+ 'releaseGood',
24
+ 'vasOrder',
25
+ 'shippingOrder',
26
+ 'vas',
27
+ 'inventory',
28
+ 'creator',
29
+ 'updater'
30
+ ]
31
+ })
32
+ return { items, total }
33
+ }
34
+
35
+ @Query(returns => OrderVas)
36
+ async orderVas(@Arg('name') name: string, @Ctx() context: ResolverContext): Promise<OrderVas> {
37
+ const { domain } = context.state
38
+
39
+ return await getRepository(OrderVas).findOne({
40
+ where: {
41
+ domain: { id: domain.id },
42
+ name
43
+ },
44
+ relations: [
45
+ 'domain',
46
+ 'arrivalNotice',
47
+ 'releaseGood',
48
+ 'vasOrder',
49
+ 'shippingOrder',
50
+ 'vas',
51
+ 'inventory',
52
+ 'creator',
53
+ 'updater'
54
+ ]
55
+ })
56
+ }
57
+
58
+ @FieldResolver(type => Domain)
59
+ async domain(@Root() orderVas: OrderVas): Promise<Domain> {
60
+ return await getRepository(Domain).findOneBy({ id: orderVas.domainId })
61
+ }
62
+
63
+ @FieldResolver(type => User)
64
+ async creator(@Root() orderVas: OrderVas): Promise<User> {
65
+ return await getRepository(User).findOneBy({ id: orderVas.creatorId })
66
+ }
67
+
68
+ @FieldResolver(type => User)
69
+ async updater(@Root() orderVas: OrderVas): Promise<User> {
70
+ return await getRepository(User).findOneBy({ id: orderVas.updaterId })
71
+ }
72
+ }
@@ -0,0 +1,159 @@
1
+ import { ObjectRef } from '@things-factory/shell'
2
+ import { Field, Float, InputType, Int, ObjectType } from 'type-graphql'
3
+ import { OrderVas } from './order-vas'
4
+
5
+ @ObjectType()
6
+ export class OrderVasList {
7
+ @Field(type => [OrderVas], { nullable: true })
8
+ items: OrderVas[]
9
+
10
+ @Field(type => Int, { nullable: true })
11
+ total: number
12
+ }
13
+
14
+ @InputType()
15
+ export class NewOrderVas {
16
+ @Field({ nullable: true })
17
+ name: string
18
+
19
+ @Field(type => Int, { nullable: true })
20
+ set: number
21
+
22
+ @Field({ nullable: true })
23
+ targetType: string
24
+
25
+ @Field({ nullable: true })
26
+ targetBatchId: string
27
+
28
+ @Field(type => ObjectRef, { nullable: true })
29
+ targetProduct: ObjectRef
30
+
31
+ @Field({ nullable: true })
32
+ otherTarget: string
33
+
34
+ @Field(type => Int, { nullable: true })
35
+ qty: number
36
+
37
+ @Field(type => Float, { nullable: true })
38
+ uomValue: number
39
+
40
+ @Field({ nullable: true })
41
+ batchId: string
42
+
43
+ @Field({ nullable: true })
44
+ productName: string
45
+
46
+ @Field({ nullable: true })
47
+ packingType: string
48
+
49
+ @Field(type => ObjectRef, { nullable: true })
50
+ arrivalNotice: ObjectRef
51
+
52
+ @Field(type => ObjectRef, { nullable: true })
53
+ releaseGood: ObjectRef
54
+
55
+ @Field(type => ObjectRef, { nullable: true })
56
+ shippingOrder: ObjectRef
57
+
58
+ @Field(type => ObjectRef, { nullable: true })
59
+ transferOrder: ObjectRef
60
+
61
+ @Field(type => ObjectRef, { nullable: true })
62
+ retailReplenishmentOrder: ObjectRef
63
+
64
+ @Field(type => ObjectRef, { nullable: true })
65
+ inventory: ObjectRef
66
+
67
+ @Field(type => ObjectRef, { nullable: true })
68
+ vas: ObjectRef
69
+
70
+ @Field({ nullable: true })
71
+ type: string
72
+
73
+ @Field({ nullable: true })
74
+ operationGuide: string
75
+
76
+ @Field({ nullable: true })
77
+ remark: string
78
+
79
+ @Field({ nullable: true })
80
+ description: string
81
+
82
+ @Field({ nullable: true })
83
+ status: string
84
+ }
85
+
86
+ @InputType()
87
+ export class OrderVasPatch {
88
+ @Field({ nullable: true })
89
+ id: string
90
+
91
+ @Field({ nullable: true })
92
+ name: string
93
+
94
+ @Field(type => Int, { nullable: true })
95
+ set: number
96
+
97
+ @Field({ nullable: true })
98
+ targetType: string
99
+
100
+ @Field({ nullable: true })
101
+ targetBatchId: string
102
+
103
+ @Field(type => ObjectRef, { nullable: true })
104
+ targetProduct: ObjectRef
105
+
106
+ @Field({ nullable: true })
107
+ otherTarget: string
108
+
109
+ @Field(type => Int, { nullable: true })
110
+ qty: number
111
+
112
+ @Field(type => Float, { nullable: true })
113
+ uomValue: number
114
+
115
+ @Field({ nullable: true })
116
+ batchId: string
117
+
118
+ @Field({ nullable: true })
119
+ productName: string
120
+
121
+ @Field({ nullable: true })
122
+ packingType: string
123
+
124
+ @Field(type => ObjectRef, { nullable: true })
125
+ arrivalNotice: ObjectRef
126
+
127
+ @Field(type => ObjectRef, { nullable: true })
128
+ releaseGood: ObjectRef
129
+
130
+ @Field(type => ObjectRef, { nullable: true })
131
+ shippingOrder: ObjectRef
132
+
133
+ @Field(type => ObjectRef, { nullable: true })
134
+ retailReplenishmentOrder: ObjectRef
135
+
136
+ @Field(type => ObjectRef, { nullable: true })
137
+ transferOrder: ObjectRef
138
+
139
+ @Field(type => ObjectRef, { nullable: true })
140
+ inventory: ObjectRef
141
+
142
+ @Field(type => ObjectRef, { nullable: true })
143
+ vas: ObjectRef
144
+
145
+ @Field({ nullable: true })
146
+ operationGuide: string
147
+
148
+ @Field({ nullable: true })
149
+ remark: string
150
+
151
+ @Field({ nullable: true })
152
+ description: string
153
+
154
+ @Field({ nullable: true })
155
+ status: string
156
+
157
+ @Field({ nullable: true })
158
+ cuFlag: string
159
+ }