@things-factory/sales-base 4.0.36 → 4.0.40

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 (106) hide show
  1. package/dist-server/controllers/ecommerce/sellercraft-controller.js +4 -3
  2. package/dist-server/controllers/ecommerce/sellercraft-controller.js.map +1 -1
  3. package/dist-server/service/arrival-notice/arrival-notice-mutation.js +42 -35
  4. package/dist-server/service/arrival-notice/arrival-notice-mutation.js.map +1 -1
  5. package/dist-server/service/arrival-notice/arrival-notice-query.js +91 -79
  6. package/dist-server/service/arrival-notice/arrival-notice-query.js.map +1 -1
  7. package/dist-server/service/arrival-notice/arrival-notice-types.js +8 -0
  8. package/dist-server/service/arrival-notice/arrival-notice-types.js.map +1 -1
  9. package/dist-server/service/arrival-notice/arrival-notice.js +20 -15
  10. package/dist-server/service/arrival-notice/arrival-notice.js.map +1 -1
  11. package/dist-server/service/delivery-order/delivery-order-mutation.js +28 -26
  12. package/dist-server/service/delivery-order/delivery-order-mutation.js.map +1 -1
  13. package/dist-server/service/delivery-order/delivery-order-query.js +14 -14
  14. package/dist-server/service/delivery-order/delivery-order-query.js.map +1 -1
  15. package/dist-server/service/delivery-order/delivery-order-summary-report.js +145 -0
  16. package/dist-server/service/delivery-order/delivery-order-summary-report.js.map +1 -0
  17. package/dist-server/service/delivery-order/delivery-order.js +16 -13
  18. package/dist-server/service/delivery-order/delivery-order.js.map +1 -1
  19. package/dist-server/service/delivery-order/index.js +3 -1
  20. package/dist-server/service/delivery-order/index.js.map +1 -1
  21. package/dist-server/service/index.js +12 -4
  22. package/dist-server/service/index.js.map +1 -1
  23. package/dist-server/service/invoice/invoice-mutation.js +21 -3
  24. package/dist-server/service/invoice/invoice-mutation.js.map +1 -1
  25. package/dist-server/service/invoice/invoice-query.js +5 -7
  26. package/dist-server/service/invoice/invoice-query.js.map +1 -1
  27. package/dist-server/service/invoice/invoice-types.js +302 -20
  28. package/dist-server/service/invoice/invoice-types.js.map +1 -1
  29. package/dist-server/service/invoice/invoice.js +190 -26
  30. package/dist-server/service/invoice/invoice.js.map +1 -1
  31. package/dist-server/service/invoice-product/index.js +21 -0
  32. package/dist-server/service/invoice-product/index.js.map +1 -0
  33. package/dist-server/service/invoice-product/invoice-product-mutation.js +70 -0
  34. package/dist-server/service/invoice-product/invoice-product-mutation.js.map +1 -0
  35. package/dist-server/service/invoice-product/invoice-product-query.js +95 -0
  36. package/dist-server/service/invoice-product/invoice-product-query.js.map +1 -0
  37. package/dist-server/service/invoice-product/invoice-product-types.js +125 -0
  38. package/dist-server/service/invoice-product/invoice-product-types.js.map +1 -0
  39. package/dist-server/service/invoice-product/invoice-product.js +117 -0
  40. package/dist-server/service/invoice-product/invoice-product.js.map +1 -0
  41. package/dist-server/service/order-inventory/order-inventory-query.js +9 -7
  42. package/dist-server/service/order-inventory/order-inventory-query.js.map +1 -1
  43. package/dist-server/service/order-inventory/order-inventory-types.js +11 -11
  44. package/dist-server/service/order-inventory/order-inventory-types.js.map +1 -1
  45. package/dist-server/service/order-inventory/order-inventory.js +31 -25
  46. package/dist-server/service/order-inventory/order-inventory.js.map +1 -1
  47. package/dist-server/service/order-product/order-product.js +26 -21
  48. package/dist-server/service/order-product/order-product.js.map +1 -1
  49. package/dist-server/service/order-vas/order-vas.js +34 -27
  50. package/dist-server/service/order-vas/order-vas.js.map +1 -1
  51. package/dist-server/service/others/other-query.js +4 -2
  52. package/dist-server/service/others/other-query.js.map +1 -1
  53. package/dist-server/service/others/other-types.js +42 -0
  54. package/dist-server/service/others/other-types.js.map +1 -1
  55. package/dist-server/service/purchase-order/purchase-order-mutation.js +23 -36
  56. package/dist-server/service/purchase-order/purchase-order-mutation.js.map +1 -1
  57. package/dist-server/service/release-good/release-good-mutation.js +84 -82
  58. package/dist-server/service/release-good/release-good-mutation.js.map +1 -1
  59. package/dist-server/service/release-good/release-good-query.js +8 -9
  60. package/dist-server/service/release-good/release-good-query.js.map +1 -1
  61. package/dist-server/service/release-good/release-good.js +2 -0
  62. package/dist-server/service/release-good/release-good.js.map +1 -1
  63. package/dist-server/service/return-order/return-order-mutation.js +21 -6
  64. package/dist-server/service/return-order/return-order-mutation.js.map +1 -1
  65. package/dist-server/service/reverse-kitting-order-inventory/reverse-kitting-order-inventory-type.js +9 -5
  66. package/dist-server/service/reverse-kitting-order-inventory/reverse-kitting-order-inventory-type.js.map +1 -1
  67. package/dist-server/service/reverse-kitting-order-inventory/reverse-kitting-order-inventory.js +3 -2
  68. package/dist-server/service/reverse-kitting-order-inventory/reverse-kitting-order-inventory.js.map +1 -1
  69. package/dist-server/utils/order-no-generator.js +7 -0
  70. package/dist-server/utils/order-no-generator.js.map +1 -1
  71. package/package.json +12 -12
  72. package/server/controllers/ecommerce/sellercraft-controller.ts +2 -1
  73. package/server/service/arrival-notice/arrival-notice-mutation.ts +11 -15
  74. package/server/service/arrival-notice/arrival-notice-query.ts +94 -78
  75. package/server/service/arrival-notice/arrival-notice-types.ts +6 -0
  76. package/server/service/arrival-notice/arrival-notice.ts +6 -1
  77. package/server/service/delivery-order/delivery-order-mutation.ts +4 -8
  78. package/server/service/delivery-order/delivery-order-query.ts +4 -4
  79. package/server/service/delivery-order/delivery-order-summary-report.ts +152 -0
  80. package/server/service/delivery-order/delivery-order.ts +4 -1
  81. package/server/service/delivery-order/index.ts +3 -1
  82. package/server/service/index.ts +20 -12
  83. package/server/service/invoice/invoice-mutation.ts +45 -7
  84. package/server/service/invoice/invoice-query.ts +6 -6
  85. package/server/service/invoice/invoice-types.ts +231 -18
  86. package/server/service/invoice/invoice.ts +154 -20
  87. package/server/service/invoice-product/index.ts +9 -0
  88. package/server/service/invoice-product/invoice-product-mutation.ts +54 -0
  89. package/server/service/invoice-product/invoice-product-query.ts +55 -0
  90. package/server/service/invoice-product/invoice-product-types.ts +80 -0
  91. package/server/service/invoice-product/invoice-product.ts +93 -0
  92. package/server/service/order-inventory/order-inventory-query.ts +3 -1
  93. package/server/service/order-inventory/order-inventory-types.ts +11 -11
  94. package/server/service/order-inventory/order-inventory.ts +11 -13
  95. package/server/service/order-product/order-product.ts +13 -13
  96. package/server/service/order-vas/order-vas.ts +15 -15
  97. package/server/service/others/other-query.ts +9 -15
  98. package/server/service/others/other-types.ts +31 -0
  99. package/server/service/purchase-order/purchase-order-mutation.ts +19 -21
  100. package/server/service/release-good/release-good-mutation.ts +64 -58
  101. package/server/service/release-good/release-good-query.ts +6 -12
  102. package/server/service/release-good/release-good.ts +2 -0
  103. package/server/service/return-order/return-order-mutation.ts +30 -6
  104. package/server/service/reverse-kitting-order-inventory/reverse-kitting-order-inventory-type.ts +8 -5
  105. package/server/service/reverse-kitting-order-inventory/reverse-kitting-order-inventory.ts +3 -2
  106. package/server/utils/order-no-generator.ts +11 -0
@@ -0,0 +1,9 @@
1
+ import { InvoiceProduct } from './invoice-product'
2
+ import { InvoiceProductMutation } from './invoice-product-mutation'
3
+ import { InvoiceProductQuery } from './invoice-product-query'
4
+
5
+ export const entities = [InvoiceProduct]
6
+ export const resolvers = [InvoiceProductQuery, InvoiceProductMutation]
7
+
8
+ export * from './invoice-product-mutation'
9
+ export * from './invoice-product-query'
@@ -0,0 +1,54 @@
1
+ import { Arg, Ctx, Directive, Mutation, Resolver } from 'type-graphql'
2
+
3
+ import { InvoiceProduct } from '../invoice-product/invoice-product'
4
+ import { InvoiceProductPatch, NewInvoiceProduct } from './invoice-product-types'
5
+
6
+ @Resolver(InvoiceProduct)
7
+ export class InvoiceProductMutation {
8
+ @Mutation(returns => InvoiceProduct)
9
+ @Directive('@transaction')
10
+ async createInvoiceProduct(
11
+ @Arg('invoiceProduct', type => NewInvoiceProduct) invoiceProduct: NewInvoiceProduct,
12
+ @Ctx() context: any
13
+ ): Promise<InvoiceProduct> {
14
+ const { domain, user, tx } = context.state
15
+
16
+ return await tx.getRepository(InvoiceProduct).save({
17
+ ...invoiceProduct,
18
+ domain,
19
+ creator: user,
20
+ updater: user
21
+ })
22
+ }
23
+
24
+ @Mutation(returns => InvoiceProduct)
25
+ @Directive('@transaction')
26
+ async updateInvoiceProduct(
27
+ @Arg('name') name: string,
28
+ @Arg('patch', type => InvoiceProductPatch) patch: InvoiceProductPatch,
29
+ @Ctx() context: any
30
+ ): Promise<InvoiceProduct> {
31
+ const { domain, user, tx } = context.state
32
+
33
+ const repository = tx.getRepository(InvoiceProduct)
34
+ const invoiceProduct = await repository.findOne({
35
+ where: { domain, name }
36
+ })
37
+
38
+ return await repository.save({
39
+ ...invoiceProduct,
40
+ ...patch,
41
+ updater: user
42
+ })
43
+ }
44
+
45
+ @Mutation(returns => Boolean)
46
+ @Directive('@transaction')
47
+ async deleteInvoiceProduct(@Arg('name') name: string, @Ctx() context: any): Promise<boolean> {
48
+ const { domain, tx } = context.state
49
+
50
+ await tx.getRepository(InvoiceProduct).delete({ domain, name })
51
+
52
+ return true
53
+ }
54
+ }
@@ -0,0 +1,55 @@
1
+ import { Arg, Ctx, FieldResolver, Query, Resolver, Root } from 'type-graphql'
2
+ import { getRepository } from 'typeorm'
3
+
4
+ import { User } from '@things-factory/auth-base'
5
+ import { buildQuery, Domain, Filter, Pagination, Sorting } from '@things-factory/shell'
6
+
7
+ import { InvoiceProduct } from './invoice-product'
8
+ import { InvoiceProductList } from './invoice-product-types'
9
+
10
+ @Resolver(InvoiceProduct)
11
+ export class InvoiceProductQuery {
12
+ @Query(returns => InvoiceProductList)
13
+ async invoiceProducts(
14
+ @Ctx() context: any,
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<InvoiceProductList> {
19
+ const queryBuilder = getRepository(InvoiceProduct).createQueryBuilder()
20
+ buildQuery(queryBuilder, { filters, pagination, sortings }, context)
21
+ const [items, total] = await queryBuilder
22
+ .leftJoinAndSelect('InvoiceProduct.domain', 'Domain')
23
+ .leftJoinAndSelect('InvoiceProduct.invoice', 'Invoice')
24
+ .leftJoinAndSelect('InvoiceProduct.creator', 'Creator')
25
+ .leftJoinAndSelect('InvoiceProduct.updater', 'Updater')
26
+ .getManyAndCount()
27
+
28
+ return { items, total }
29
+ }
30
+
31
+ @Query(returns => InvoiceProduct)
32
+ async invoiceProduct(@Arg('name') name: string, @Ctx() context: any): Promise<InvoiceProduct> {
33
+ const { domain }: { domain: Domain } = context.state
34
+
35
+ return await getRepository(InvoiceProduct).findOne({
36
+ where: { domain, name },
37
+ relations: ['domain', 'invoice', 'creator', 'updater']
38
+ })
39
+ }
40
+
41
+ @FieldResolver(type => Domain)
42
+ async domain(@Root() invoiceProduct: InvoiceProduct): Promise<Domain> {
43
+ return await getRepository(Domain).findOne(invoiceProduct.domainId)
44
+ }
45
+
46
+ @FieldResolver(type => User)
47
+ async creator(@Root() invoiceProduct: InvoiceProduct): Promise<User> {
48
+ return await getRepository(User).findOne(invoiceProduct.creatorId)
49
+ }
50
+
51
+ @FieldResolver(type => User)
52
+ async updater(@Root() invoiceProduct: InvoiceProduct): Promise<User> {
53
+ return await getRepository(User).findOne(invoiceProduct.updaterId)
54
+ }
55
+ }
@@ -0,0 +1,80 @@
1
+ import { Field, Float, InputType, Int, ObjectType } from 'type-graphql'
2
+
3
+ import { ObjectRef } from '@things-factory/shell'
4
+
5
+ import { InvoiceProduct } from './invoice-product'
6
+
7
+ @ObjectType()
8
+ export class InvoiceProductList {
9
+ @Field(type => [InvoiceProduct], { nullable: true })
10
+ items: InvoiceProduct[]
11
+
12
+ @Field(type => Int, { nullable: true })
13
+ total: number
14
+ }
15
+
16
+ @InputType()
17
+ export class ProductInput {
18
+ @Field()
19
+ sku: string
20
+ }
21
+
22
+ @InputType()
23
+ export class NewInvoiceProduct {
24
+ @Field({ nullable: true })
25
+ name: string
26
+
27
+ @Field({ nullable: true })
28
+ sku: string
29
+
30
+ @Field({ nullable: true })
31
+ description: string
32
+
33
+ @Field(type => ObjectRef)
34
+ invoice: ObjectRef
35
+
36
+ @Field(type => ProductInput)
37
+ product: ProductInput
38
+
39
+ @Field(type => Int)
40
+ qty: number
41
+
42
+ @Field(type => Float, { nullable: false })
43
+ otherCharges: number
44
+
45
+ @Field(type => Float)
46
+ unitPrice: number
47
+
48
+ @Field(type => Float)
49
+ paidPrice: number
50
+ }
51
+
52
+ @InputType()
53
+ export class InvoiceProductPatch {
54
+ @Field({ nullable: true })
55
+ name: string
56
+
57
+ @Field({ nullable: true })
58
+ sku: string
59
+
60
+ @Field({ nullable: true })
61
+ description: string
62
+
63
+ @Field(type => ObjectRef)
64
+ invoice: ObjectRef
65
+
66
+ @Field(type => ProductInput)
67
+ product: ProductInput
68
+
69
+ @Field(type => Int)
70
+ qty: number
71
+
72
+ @Field(type => Float, { nullable: false })
73
+ otherCharges: number
74
+
75
+ @Field(type => Float)
76
+ unitPrice: number
77
+
78
+ @Field(type => Float)
79
+ paidPrice: number
80
+ }
@@ -0,0 +1,93 @@
1
+ import { Field, ID, ObjectType } from 'type-graphql'
2
+ import {
3
+ Column,
4
+ CreateDateColumn,
5
+ Entity,
6
+ Index,
7
+ ManyToOne,
8
+ PrimaryGeneratedColumn,
9
+ RelationId,
10
+ UpdateDateColumn
11
+ } from 'typeorm'
12
+
13
+ import { User } from '@things-factory/auth-base'
14
+ import { Product } from '@things-factory/product-base'
15
+ import { Domain } from '@things-factory/shell'
16
+
17
+ import { Invoice } from '../invoice/invoice'
18
+
19
+ @Entity()
20
+ @Index('ix_invoice_product_0', (invoiceProduct: InvoiceProduct) => [invoiceProduct.id], {
21
+ unique: true
22
+ })
23
+ @ObjectType()
24
+ export class InvoiceProduct {
25
+ @PrimaryGeneratedColumn('uuid')
26
+ @Field(type => ID)
27
+ readonly id: string
28
+
29
+ @ManyToOne(type => Domain)
30
+ @Field(type => Domain, { nullable: true })
31
+ domain: Domain
32
+
33
+ @RelationId((invoiceProduct: InvoiceProduct) => invoiceProduct.domain)
34
+ domainId: string
35
+
36
+ @Column({ nullable: true })
37
+ @Field({ nullable: true })
38
+ sku: string
39
+
40
+ @Column()
41
+ @Field()
42
+ name: string
43
+
44
+ @Column({ nullable: true })
45
+ @Field()
46
+ description: string
47
+
48
+ @ManyToOne(type => Invoice)
49
+ @Field(type => Invoice)
50
+ invoice: Invoice
51
+
52
+ @ManyToOne(type => Product, { nullable: true })
53
+ @Field(type => Product, { nullable: true })
54
+ product: Product
55
+
56
+ @Column('int', { default: 0 })
57
+ @Field()
58
+ qty: number
59
+
60
+ @Column('float', { default: 0 })
61
+ @Field({ nullable: true })
62
+ otherCharges: number
63
+
64
+ @Column('float', { default: 0 })
65
+ @Field()
66
+ unitPrice: number
67
+
68
+ @Column('float', { default: 0 })
69
+ @Field()
70
+ paidPrice: number
71
+
72
+ @CreateDateColumn()
73
+ @Field()
74
+ createdAt: Date
75
+
76
+ @UpdateDateColumn()
77
+ @Field({ nullable: true })
78
+ updatedAt: Date
79
+
80
+ @ManyToOne(type => User, { nullable: true })
81
+ @Field(type => User, { nullable: true })
82
+ creator: User
83
+
84
+ @RelationId((invoiceProduct: InvoiceProduct) => invoiceProduct.creator)
85
+ creatorId: string
86
+
87
+ @ManyToOne(type => User, { nullable: true })
88
+ @Field(type => User, { nullable: true })
89
+ updater: User
90
+
91
+ @RelationId((invoiceProduct: InvoiceProduct) => invoiceProduct.updater)
92
+ updaterId: string
93
+ }
@@ -6,7 +6,9 @@ import { getPermittedBizplaceIds } from '@things-factory/biz-base'
6
6
  import { Product } from '@things-factory/product-base'
7
7
  import { buildQuery, convertListParams, Domain, Filter, ListParam, Pagination, Sorting } from '@things-factory/shell'
8
8
 
9
- import { ArrivalNotice, OrderInventoryList, ReleaseGood } from '../'
9
+ import { ArrivalNotice } from '../arrival-notice/arrival-notice'
10
+ import { OrderInventoryList } from '../order-inventory/order-inventory-types'
11
+ import { ReleaseGood } from '../release-good/release-good'
10
12
  import { OrderInventory } from './order-inventory'
11
13
 
12
14
  interface filterInterface {
@@ -62,16 +62,16 @@ export class NewOrderInventory {
62
62
  @Field(type => Float, { nullable: true })
63
63
  packingSize: number
64
64
 
65
- @Field(type => Float, { nullable: true })
65
+ @Field(type => Int, { nullable: true })
66
66
  releaseQty: number
67
67
 
68
- @Field(type => Float, { nullable: true })
68
+ @Field(type => Int, { nullable: true })
69
69
  pickedQty: number
70
70
 
71
- @Field(type => Float, { nullable: true })
71
+ @Field(type => Int, { nullable: true })
72
72
  sortedQty: number
73
73
 
74
- @Field(type => Float, { nullable: true })
74
+ @Field(type => Int, { nullable: true })
75
75
  packedQty: number
76
76
 
77
77
  @Field(type => Float, { nullable: true })
@@ -98,7 +98,7 @@ export class NewOrderInventory {
98
98
  @Field({ nullable: true })
99
99
  existingRow: boolean
100
100
 
101
- @Field(type => Float, { nullable: true })
101
+ @Field(type => Int, { nullable: true })
102
102
  returnQty: number
103
103
 
104
104
  @Field(type => Float, { nullable: true })
@@ -173,19 +173,19 @@ export class OrderInventoryPatch {
173
173
  @Field({ nullable: true })
174
174
  extraJsonData: string
175
175
 
176
- @Field(type => Float, { nullable: true })
176
+ @Field(type => Int, { nullable: true })
177
177
  releaseQty: number
178
178
 
179
179
  @Field({ nullable: true })
180
180
  serialNumber: string
181
181
 
182
- @Field(type => Float, { nullable: true })
182
+ @Field(type => Int, { nullable: true })
183
183
  sortedQty: number
184
184
 
185
- @Field(type => Float, { nullable: true })
185
+ @Field(type => Int, { nullable: true })
186
186
  pickedQty: number
187
187
 
188
- @Field(type => Float, { nullable: true })
188
+ @Field(type => Int, { nullable: true })
189
189
  packedQty: number
190
190
 
191
191
  @Field({ nullable: true })
@@ -200,10 +200,10 @@ export class OrderInventoryPatch {
200
200
  @Field(type => Float, { nullable: true })
201
201
  returnUomValue: number
202
202
 
203
- @Field(type => Float, { nullable: true })
203
+ @Field(type => Int, { nullable: true })
204
204
  actualPackQty: number
205
205
 
206
- @Field(type => Float, { nullable: true })
206
+ @Field(type => Int, { nullable: true })
207
207
  actualPalletQty: number
208
208
 
209
209
  @Field({ nullable: true })
@@ -16,15 +16,13 @@ import { Product } from '@things-factory/product-base'
16
16
  import { Domain } from '@things-factory/shell'
17
17
  import { Inventory, Location } from '@things-factory/warehouse-base'
18
18
 
19
- import {
20
- ArrivalNotice,
21
- DeliveryOrder,
22
- InventoryCheck,
23
- OrderProduct,
24
- ReleaseGood,
25
- ReturnOrder,
26
- TransferOrder
27
- } from '../'
19
+ import { ArrivalNotice } from '../arrival-notice/arrival-notice'
20
+ import { DeliveryOrder } from '../delivery-order/delivery-order'
21
+ import { InventoryCheck } from '../inventory-check/inventory-check'
22
+ import { OrderProduct } from '../order-product/order-product'
23
+ import { ReleaseGood } from '../release-good/release-good'
24
+ import { ReturnOrder } from '../return-order/return-order'
25
+ import { TransferOrder } from '../transfer-order/transfer-order'
28
26
 
29
27
  @Entity()
30
28
  @Index('ix_order-inventory_0', (orderInventory: OrderInventory) => [orderInventory.domain, orderInventory.name], {
@@ -57,7 +55,7 @@ import {
57
55
  @ObjectType()
58
56
  export class OrderInventory {
59
57
  @PrimaryGeneratedColumn('uuid')
60
- @Field(type => ID)
58
+ @Field(type => ID, { nullable: true })
61
59
  readonly id: string
62
60
 
63
61
  @ManyToOne(type => Domain)
@@ -75,7 +73,7 @@ export class OrderInventory {
75
73
  bizplaceId: string
76
74
 
77
75
  @Column()
78
- @Field()
76
+ @Field({ nullable: true })
79
77
  name: string
80
78
 
81
79
  @Column({ nullable: true })
@@ -122,8 +120,8 @@ export class OrderInventory {
122
120
  packingType: string
123
121
 
124
122
  @Column('float', { default: 1 })
125
- @Field()
126
- packingSize: number
123
+ @Field({ nullable: true })
124
+ packingSize?: number
127
125
 
128
126
  @ManyToOne(type => ArrivalNotice)
129
127
  @Field(type => ArrivalNotice, { nullable: true })
@@ -1,8 +1,3 @@
1
- import { User } from '@things-factory/auth-base'
2
- import { Bizplace } from '@things-factory/biz-base'
3
- import { Product } from '@things-factory/product-base'
4
- import { Domain } from '@things-factory/shell'
5
- import { Inventory } from '@things-factory/warehouse-base'
6
1
  import { Field, ID, ObjectType } from 'type-graphql'
7
2
  import {
8
3
  Column,
@@ -14,14 +9,19 @@ import {
14
9
  RelationId,
15
10
  UpdateDateColumn
16
11
  } from 'typeorm'
17
- import {
18
- ArrivalNotice,
19
- CollectionOrder,
20
- DeliveryOrder,
21
- PurchaseOrder,
22
- ReleaseGood,
23
- RetailReplenishmentOrder
24
- } from '../'
12
+
13
+ import { User } from '@things-factory/auth-base'
14
+ import { Bizplace } from '@things-factory/biz-base'
15
+ import { Product } from '@things-factory/product-base'
16
+ import { Domain } from '@things-factory/shell'
17
+ import { Inventory } from '@things-factory/warehouse-base'
18
+
19
+ import { ArrivalNotice } from '../arrival-notice/arrival-notice'
20
+ import { CollectionOrder } from '../collection-order/collection-order'
21
+ import { DeliveryOrder } from '../delivery-order/delivery-order'
22
+ import { PurchaseOrder } from '../purchase-order/purchase-order'
23
+ import { ReleaseGood } from '../release-good/release-good'
24
+ import { RetailReplenishmentOrder } from '../retail-replenishment-order/retail-replenishment-order'
25
25
 
26
26
  @Entity()
27
27
  @Index('ix_order-product_0', (orderProduct: OrderProduct) => [orderProduct.domain, orderProduct.name], {
@@ -1,8 +1,3 @@
1
- import { User } from '@things-factory/auth-base'
2
- import { Bizplace } from '@things-factory/biz-base'
3
- import { Product } from '@things-factory/product-base'
4
- import { Domain } from '@things-factory/shell'
5
- import { Inventory } from '@things-factory/warehouse-base'
6
1
  import { Field, ID, ObjectType } from 'type-graphql'
7
2
  import {
8
3
  Column,
@@ -14,16 +9,21 @@ import {
14
9
  RelationId,
15
10
  UpdateDateColumn
16
11
  } from 'typeorm'
17
- import {
18
- ArrivalNotice,
19
- ReleaseGood,
20
- RetailReplenishmentOrder,
21
- ReturnOrder,
22
- ShippingOrder,
23
- TransferOrder,
24
- Vas,
25
- VasOrder
26
- } from '../'
12
+
13
+ import { User } from '@things-factory/auth-base'
14
+ import { Bizplace } from '@things-factory/biz-base'
15
+ import { Product } from '@things-factory/product-base'
16
+ import { Domain } from '@things-factory/shell'
17
+ import { Inventory } from '@things-factory/warehouse-base'
18
+
19
+ import { ArrivalNotice } from '../arrival-notice/arrival-notice'
20
+ import { ReleaseGood } from '../release-good/release-good'
21
+ import { RetailReplenishmentOrder } from '../retail-replenishment-order/retail-replenishment-order'
22
+ import { ReturnOrder } from '../return-order/return-order'
23
+ import { ShippingOrder } from '../shipping-order/shipping-order'
24
+ import { TransferOrder } from '../transfer-order/transfer-order'
25
+ import { VasOrder } from '../vas-order/vas-order'
26
+ import { Vas } from '../vas/vas'
27
27
 
28
28
  @Entity('order_vass')
29
29
  @Index('ix_order-vas_0', (orderVas: OrderVas) => [orderVas.domain, orderVas.name], { unique: true })
@@ -7,7 +7,7 @@ import { Bizplace, getPermittedBizplaces } from '@things-factory/biz-base'
7
7
  import { Product, ProductDetail } from '@things-factory/product-base'
8
8
  import { Domain, ListParam } from '@things-factory/shell'
9
9
 
10
- import { InventoryProductGroupList, NewOrderInventory, NewOrderProduct, OrderInventory, OrderProduct } from '../'
10
+ import { InventoryProductGroup, InventoryProductGroupList, NewOrderInventory, NewOrderProduct, OrderInventory, OrderProduct } from '../'
11
11
  import { InventoryUtil } from '../../utils'
12
12
 
13
13
  @Resolver()
@@ -16,12 +16,8 @@ export class OtherQuery {
16
16
  @Directive('@transaction')
17
17
  @Query(returns => InventoryProductGroupList)
18
18
  async inventoryProductGroup(@Ctx() context: any, @Args() params: ListParam): Promise<InventoryProductGroupList> {
19
- const {
20
- domain,
21
- user,
22
- tx,
23
- bizplace
24
- }: { domain: Domain; user: User; tx: EntityManager; bizplace: Bizplace } = context.state
19
+ const { domain, user, tx, bizplace }: { domain: Domain; user: User; tx: EntityManager; bizplace: Bizplace } =
20
+ context.state
25
21
 
26
22
  let permittedBizplaces: Bizplace[] = await getPermittedBizplaces(domain, user)
27
23
 
@@ -52,7 +48,8 @@ export class OtherQuery {
52
48
  }
53
49
 
54
50
  @Directive('@privilege(category: "order_customer", privilege: "query")')
55
- @Query(returns => OrderInventory)
51
+ @Directive('@transaction')
52
+ @Query(returns => [OrderInventory])
56
53
  async bulkUploadValidateWarehousePartnersProductsQuantity(
57
54
  @Ctx() context: any,
58
55
  @Arg('partnerBizplaceId') partnerBizplaceId: string,
@@ -197,18 +194,15 @@ export class OtherQuery {
197
194
  }
198
195
 
199
196
  @Directive('@privilege(category: "order_customer", privilege: "query")')
200
- @Query(returns => InventoryProductGroupList)
197
+ @Directive('@transaction')
198
+ @Query(returns => [InventoryProductGroup])
201
199
  async bulkUploadValidateOrderProducts(
202
200
  @Ctx() context: any,
203
201
  @Arg('partnerBizplaceId') partnerBizplaceId: string,
204
202
  @Arg('orderProducts', type => [NewOrderProduct], { nullable: true }) orderProducts: NewOrderProduct[]
205
203
  ): Promise<OrderProduct[]> {
206
- const {
207
- domain,
208
- user,
209
- tx,
210
- bizplace
211
- }: { domain: Domain; user: User; tx: EntityManager; bizplace: Bizplace } = context.state
204
+ const { domain, user, tx, bizplace }: { domain: Domain; user: User; tx: EntityManager; bizplace: Bizplace } =
205
+ context.state
212
206
 
213
207
  const productDetailRepo = tx.getRepository(ProductDetail)
214
208
 
@@ -1,4 +1,5 @@
1
1
  import { Field, Float, Int, ObjectType } from 'type-graphql'
2
+ import { Product } from '@things-factory/product-base'
2
3
 
3
4
  @ObjectType()
4
5
  export class InventoryProductGroupList {
@@ -11,6 +12,9 @@ export class InventoryProductGroupList {
11
12
 
12
13
  @ObjectType()
13
14
  export class InventoryProductGroup {
15
+ @Field({ nullable: true })
16
+ id: string
17
+
14
18
  @Field({ nullable: true })
15
19
  productId: string
16
20
 
@@ -35,6 +39,12 @@ export class InventoryProductGroup {
35
39
  @Field(type => Float, { nullable: true })
36
40
  packingSize: number
37
41
 
42
+ @Field(type => Int, { nullable: true })
43
+ packQty: number
44
+
45
+ @Field(type => Int, { nullable: true })
46
+ palletQty: number
47
+
38
48
  @Field(type => Float, { nullable: true })
39
49
  remainQty: number
40
50
 
@@ -50,6 +60,27 @@ export class InventoryProductGroup {
50
60
  @Field({ nullable: true })
51
61
  uom: string
52
62
 
63
+ @Field(type => Float, { nullable: true })
64
+ uomValue: number
65
+
66
+ @Field({ nullable: true })
67
+ totalUomValue: String
68
+
53
69
  @Field({ nullable: true })
54
70
  groupType: string
71
+
72
+ @Field(type => Int, { nullable: true })
73
+ manufactureYear: number
74
+
75
+ @Field(type => Float, { nullable: true })
76
+ unitPrice: number
77
+
78
+ @Field({ nullable: true })
79
+ remark: string
80
+
81
+ @Field(type => Float, { nullable: true })
82
+ isError: Boolean
83
+
84
+ @Field(type => Product, { nullable: true })
85
+ product: Product
55
86
  }