@things-factory/sales-base 4.3.105-alpha.0 → 4.3.105

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 (79) hide show
  1. package/dist-server/service/arrival-notice/arrival-notice-mutation.js +5 -6
  2. package/dist-server/service/arrival-notice/arrival-notice-mutation.js.map +1 -1
  3. package/dist-server/service/arrival-notice/arrival-notice-query.js +0 -1
  4. package/dist-server/service/arrival-notice/arrival-notice-query.js.map +1 -1
  5. package/dist-server/service/draft-release-good/draft-release-good-mutation.js +4 -3
  6. package/dist-server/service/draft-release-good/draft-release-good-mutation.js.map +1 -1
  7. package/dist-server/service/draft-release-good/draft-release-good-query.js +15 -11
  8. package/dist-server/service/draft-release-good/draft-release-good-query.js.map +1 -1
  9. package/dist-server/service/draft-release-good/draft-release-good.js +40 -0
  10. package/dist-server/service/draft-release-good/draft-release-good.js.map +1 -1
  11. package/dist-server/service/invoice-product/invoice-product.js +3 -8
  12. package/dist-server/service/invoice-product/invoice-product.js.map +1 -1
  13. package/dist-server/service/order-inventory/order-inventory-query.js +1 -2
  14. package/dist-server/service/order-inventory/order-inventory-query.js.map +1 -1
  15. package/dist-server/service/order-inventory/order-inventory-types.js +10 -18
  16. package/dist-server/service/order-inventory/order-inventory-types.js.map +1 -1
  17. package/dist-server/service/order-inventory/order-inventory.js +3 -12
  18. package/dist-server/service/order-inventory/order-inventory.js.map +1 -1
  19. package/dist-server/service/order-product/order-product-query.js +0 -1
  20. package/dist-server/service/order-product/order-product-query.js.map +1 -1
  21. package/dist-server/service/order-product/order-product-types.js +26 -18
  22. package/dist-server/service/order-product/order-product-types.js.map +1 -1
  23. package/dist-server/service/order-product/order-product.js +13 -5
  24. package/dist-server/service/order-product/order-product.js.map +1 -1
  25. package/dist-server/service/order-vas/order-vas.js +3 -8
  26. package/dist-server/service/order-vas/order-vas.js.map +1 -1
  27. package/dist-server/service/others/other-query.js +176 -188
  28. package/dist-server/service/others/other-query.js.map +1 -1
  29. package/dist-server/service/others/other-types.js +1 -9
  30. package/dist-server/service/others/other-types.js.map +1 -1
  31. package/dist-server/service/purchase-order/purchase-order-mutation.js +2 -10
  32. package/dist-server/service/purchase-order/purchase-order-mutation.js.map +1 -1
  33. package/dist-server/service/purchase-order/purchase-order-query.js +0 -1
  34. package/dist-server/service/purchase-order/purchase-order-query.js.map +1 -1
  35. package/dist-server/service/release-good/release-good-mutation.js +8 -18
  36. package/dist-server/service/release-good/release-good-mutation.js.map +1 -1
  37. package/dist-server/service/release-good/release-good-query.js +6 -4
  38. package/dist-server/service/release-good/release-good-query.js.map +1 -1
  39. package/dist-server/service/release-good/release-good-types.js +4 -8
  40. package/dist-server/service/release-good/release-good-types.js.map +1 -1
  41. package/dist-server/service/release-good/release-good.js +41 -3
  42. package/dist-server/service/release-good/release-good.js.map +1 -1
  43. package/dist-server/service/return-order/return-order-mutation.js +0 -2
  44. package/dist-server/service/return-order/return-order-mutation.js.map +1 -1
  45. package/dist-server/service/return-order/return-order-types.js.map +1 -1
  46. package/dist-server/service/reverse-kitting-order-inventory/reverse-kitting-order-inventory.js +3 -8
  47. package/dist-server/service/reverse-kitting-order-inventory/reverse-kitting-order-inventory.js.map +1 -1
  48. package/dist-server/utils/inventory-util.js +102 -33
  49. package/dist-server/utils/inventory-util.js.map +1 -1
  50. package/package.json +13 -13
  51. package/server/service/arrival-notice/arrival-notice-mutation.ts +3 -6
  52. package/server/service/arrival-notice/arrival-notice-query.ts +0 -1
  53. package/server/service/draft-release-good/draft-release-good-mutation.ts +4 -3
  54. package/server/service/draft-release-good/draft-release-good-query.ts +21 -17
  55. package/server/service/draft-release-good/draft-release-good.ts +32 -0
  56. package/server/service/invoice-product/invoice-product.ts +1 -5
  57. package/server/service/order-inventory/order-inventory-query.ts +0 -2
  58. package/server/service/order-inventory/order-inventory-types.ts +0 -6
  59. package/server/service/order-inventory/order-inventory.ts +1 -8
  60. package/server/service/order-product/order-product-query.ts +0 -1
  61. package/server/service/order-product/order-product-types.ts +12 -6
  62. package/server/service/order-product/order-product.ts +15 -13
  63. package/server/service/order-vas/order-vas.ts +1 -6
  64. package/server/service/others/other-query.ts +218 -224
  65. package/server/service/others/other-types.ts +1 -7
  66. package/server/service/purchase-order/purchase-order-mutation.ts +1 -10
  67. package/server/service/purchase-order/purchase-order-query.ts +0 -1
  68. package/server/service/release-good/release-good-mutation.ts +8 -21
  69. package/server/service/release-good/release-good-query.ts +7 -4
  70. package/server/service/release-good/release-good-types.ts +3 -4
  71. package/server/service/release-good/release-good.ts +34 -2
  72. package/server/service/return-order/return-order-mutation.ts +1 -3
  73. package/server/service/return-order/return-order-types.ts +0 -1
  74. package/server/service/reverse-kitting-order-inventory/reverse-kitting-order-inventory.ts +1 -5
  75. package/server/utils/inventory-util.ts +147 -67
  76. package/translations/en.json +0 -1
  77. package/translations/ko.json +1 -2
  78. package/translations/ms.json +1 -2
  79. package/translations/zh.json +0 -25
@@ -17,7 +17,7 @@ import { MarketplaceStore } from '@things-factory/integration-marketplace'
17
17
  import { Sellercraft, SellercraftStatus } from '@things-factory/integration-sellercraft'
18
18
  import { MarketplaceOrder, MarketplaceProductVariation } from '@things-factory/marketplace-base'
19
19
  // import { sendNotification } from '@things-factory/notification'
20
- import { Product, ProductBundleSetting, ProductDetail } from '@things-factory/product-base'
20
+ import { Product, ProductBundleSetting } from '@things-factory/product-base'
21
21
  import { PartnerSetting, Setting } from '@things-factory/setting-base'
22
22
  import { Domain } from '@things-factory/shell'
23
23
  import { Inventory } from '@things-factory/warehouse-base'
@@ -676,7 +676,7 @@ export async function generateReleaseGoodFunction(
676
676
 
677
677
  const pbSettings: ProductBundleSetting[] = await tx.getRepository(ProductBundleSetting).find({
678
678
  where: { productBundle: oi.product.id },
679
- relations: ['product', 'productBundle', 'productDetail']
679
+ relations: ['product', 'productBundle']
680
680
  })
681
681
 
682
682
  pbSettings.forEach(pbs => {
@@ -690,9 +690,6 @@ export async function generateReleaseGoodFunction(
690
690
  id: pbs.product.id,
691
691
  name: pbs.product.name,
692
692
  groupType: PRODUCT_GROUP_TYPE.SINGLE
693
- },
694
- productDetail: {
695
- id: pbs.productDetail.id
696
693
  }
697
694
  }
698
695
  splitBundleOIs.push(splitOI)
@@ -707,10 +704,6 @@ export async function generateReleaseGoodFunction(
707
704
  newReleaseGood = await tx.getRepository(ReleaseGood).save(newReleaseGood)
708
705
 
709
706
  for (let oi of orderInventories) {
710
- let productDetail: any = await tx
711
- .getRepository(ProductDetail)
712
- .findOne(oi.productDetail.id, { relations: ['product'] })
713
-
714
707
  let newOrderInv: OrderInventory = Object.assign({}, oi)
715
708
  newOrderInv = {
716
709
  ...newOrderInv,
@@ -719,8 +712,7 @@ export async function generateReleaseGoodFunction(
719
712
  status: ORDER_INVENTORY_STATUS.PENDING,
720
713
  name: OrderNoGenerator.orderInventory(),
721
714
  releaseGood: newReleaseGood,
722
- product: productDetail.product,
723
- productDetail,
715
+ product: await tx.getRepository(Product).findOne(oi.product.id),
724
716
  creator: user,
725
717
  updater: user
726
718
  }
@@ -758,9 +750,9 @@ export async function generateReleaseGoodFunction(
758
750
  }
759
751
 
760
752
  let assignedOrderInventories: OrderInventory[] = await InventoryUtil.autoAssignInventoryForRelease(
753
+ newOrderInv.product,
761
754
  oi,
762
- productDetail.product,
763
- productDetail,
755
+ oi.packingType,
764
756
  locationSortingRules,
765
757
  bizplace,
766
758
  warehouseDomain,
@@ -1387,17 +1379,12 @@ export async function bulkGenerateReleaseGood(
1387
1379
  }
1388
1380
  }
1389
1381
 
1390
- let productDetail = oi.orderProduct?.productDetail
1391
- let product = oi.orderProduct?.product
1392
- if (!productDetail) {
1393
- productDetail = await tx.getRepository(ProductDetail).findOne(oi.productDetailId, { relations: ['product'] })
1394
- product = productDetail.product
1395
- }
1382
+ const product: Product = await tx.getRepository(Product).findOne(oi.productId)
1396
1383
 
1397
1384
  let assignedResult = await InventoryUtil.autoAssignInventoryForRelease(
1398
- oi,
1399
1385
  product,
1400
- productDetail,
1386
+ oi,
1387
+ oi.packingType,
1401
1388
  locationSortingRules,
1402
1389
  bizplace,
1403
1390
  warehouseDomain,
@@ -196,7 +196,6 @@ export class ReleaseGoodQuery {
196
196
  .createQueryBuilder('oi')
197
197
  .leftJoinAndSelect('oi.inventory', 'inventory')
198
198
  .leftJoinAndSelect('oi.product', 'product')
199
- .leftJoinAndSelect('oi.productDetail', 'productDetail')
200
199
  .leftJoinAndSelect('inventory.location', 'location')
201
200
  .where('oi.domain_id = :domainId', { domainId: domain.id })
202
201
  .andWhere('oi.release_good_id = :releaseGoodId', { releaseGoodId: releaseGood.id })
@@ -227,7 +226,6 @@ export class ReleaseGoodQuery {
227
226
  batchIdRef: inventory.batchIdRef,
228
227
  palletId: inventory.palletId,
229
228
  product: orderInv.product,
230
- productDetail: orderInv.productDetail,
231
229
  productIdRef: orderInv.product.id,
232
230
  productName: `${orderInv.product.name} (${orderInv.product.description})`,
233
231
  packingType: orderInv.packingType,
@@ -377,7 +375,10 @@ export class ReleaseGoodQuery {
377
375
  params.filters.push({
378
376
  name: typeFilter == 'b2c' ? 'releaseDate' : 'createdAt',
379
377
  operator: 'gte',
380
- value: typeFilter == 'b2c' ? releaseDateFrom : fromDateVal.toISOString(),
378
+ value:
379
+ typeFilter == 'b2c'
380
+ ? releaseDateFrom
381
+ : fromDateVal.toISOString(),
381
382
  relation: false
382
383
  })
383
384
  }
@@ -392,7 +393,9 @@ export class ReleaseGoodQuery {
392
393
  name: typeFilter == 'b2c' ? 'releaseDate' : 'createdAt',
393
394
  operator: typeFilter == 'b2c' ? 'lte' : 'lt',
394
395
  value:
395
- typeFilter == 'b2c' ? releaseDateTo : new Date(toDateVal.setDate(toDateVal.getDate() + 1)).toISOString(),
396
+ typeFilter == 'b2c'
397
+ ? releaseDateTo
398
+ : new Date(toDateVal.setDate(toDateVal.getDate() + 1)).toISOString(),
396
399
  relation: false
397
400
  })
398
401
  }
@@ -1,6 +1,6 @@
1
1
  import { Field, Float, InputType, Int, ObjectType } from 'type-graphql'
2
2
 
3
- import { Product, ProductDetail } from '@things-factory/product-base'
3
+ import { Product } from '@things-factory/product-base'
4
4
  import { ObjectRef } from '@things-factory/shell'
5
5
  import { Location } from '@things-factory/warehouse-base'
6
6
 
@@ -77,9 +77,6 @@ export class InventoryInfos {
77
77
  @Field(type => Product, { nullable: true })
78
78
  product?: Product
79
79
 
80
- @Field(type => ProductDetail, { nullable: true })
81
- productDetail?: ProductDetail
82
-
83
80
  @Field({ nullable: true })
84
81
  packingType?: string
85
82
 
@@ -188,6 +185,8 @@ export class NewReleaseGood {
188
185
  @Field({ nullable: true })
189
186
  orderMethod: string
190
187
 
188
+
189
+
191
190
  @Field({ nullable: true })
192
191
  collectionOrderNo: string
193
192
 
@@ -194,6 +194,18 @@ export class ReleaseGood {
194
194
  @Field({ nullable: true })
195
195
  remark: string
196
196
 
197
+ @Column({ nullable: true })
198
+ @Field({ nullable: true })
199
+ platformCode: string
200
+
201
+ @Column({ nullable: true })
202
+ @Field({ nullable: true })
203
+ platformCountry: string
204
+
205
+ @Column({ nullable: true })
206
+ @Field({ nullable: true })
207
+ platformName: string
208
+
197
209
  @Column({ nullable: true })
198
210
  @Field({ nullable: true })
199
211
  marketplaceOrderStatus: string
@@ -382,6 +394,26 @@ export class ReleaseGood {
382
394
  @Field(type => ShippingOrderInfo, { nullable: true })
383
395
  shippingOrderInfo?: ShippingOrderInfo
384
396
 
397
+ @Column('float', { nullable: true })
398
+ @Field({ nullable: true })
399
+ discountAmount?: number
400
+
401
+ @Column('float', { nullable: true })
402
+ @Field({ nullable: true })
403
+ promotionAmount?: number
404
+
405
+ @Column('float', { nullable: true })
406
+ @Field({ nullable: true })
407
+ taxAmount?: number
408
+
409
+ @Column('float', { nullable: true })
410
+ @Field({ nullable: true })
411
+ shippingFee?: number
412
+
413
+ @Column('float', { nullable: true })
414
+ @Field({ nullable: true })
415
+ paidAmount: number
416
+
385
417
  /* Mainly used for rawReleaseGood*/
386
418
  @Field({ nullable: true })
387
419
  productId: string
@@ -459,10 +491,10 @@ export class ReleaseGood {
459
491
  @Field({ nullable: true })
460
492
  orderRemark: Boolean
461
493
 
462
- @Field({ nullable:true })
494
+ @Field({ nullable: true })
463
495
  totalInventoriesByBin: Number
464
496
 
465
- @Field({ nullable:true })
497
+ @Field({ nullable: true })
466
498
  isOrderInventoryBin: Boolean
467
499
 
468
500
  @Field({ nullable: true })
@@ -6,7 +6,7 @@ import { Attachment, createAttachments } from '@things-factory/attachment-base'
6
6
  import { Role, User } from '@things-factory/auth-base'
7
7
  import { Bizplace, getDomainUsers } from '@things-factory/biz-base'
8
8
  import { sendNotification } from '@things-factory/notification'
9
- import { Product, ProductDetail } from '@things-factory/product-base'
9
+ import { Product } from '@things-factory/product-base'
10
10
  import { Domain } from '@things-factory/shell'
11
11
  import { Inventory } from '@things-factory/warehouse-base'
12
12
 
@@ -59,7 +59,6 @@ export class ReturnOrderMutation {
59
59
  itm =>
60
60
  itm.product.id === curr.product.id &&
61
61
  itm.packingType === curr.packingType &&
62
- itm.productDetailId === curr.product.productDetailId &&
63
62
  itm.batchId === curr.batchId &&
64
63
  itm.packingSize === curr.packingSize
65
64
  )
@@ -100,7 +99,6 @@ export class ReturnOrderMutation {
100
99
  newOrderInv.name = OrderNoGenerator.orderInventory()
101
100
  newOrderInv.returnOrder = createdReturnOrder
102
101
  newOrderInv.product = await tx.getRepository(Product).findOne(moi.product.id)
103
- newOrderInv.productDetail = await tx.getRepository(ProductDetail).findOne(moi.productDetail.id)
104
102
  newOrderInv.creator = user
105
103
  newOrderInv.updater = user
106
104
 
@@ -115,7 +115,6 @@ export class NewReturnOrder {
115
115
  @Field({ nullable: true })
116
116
  truckNo: string
117
117
 
118
-
119
118
  @Field({ nullable: true })
120
119
  deliveryOrderNo: string
121
120
 
@@ -12,7 +12,7 @@ import {
12
12
 
13
13
  import { User } from '@things-factory/auth-base'
14
14
  import { Bizplace } from '@things-factory/biz-base'
15
- import { Product, ProductDetail } from '@things-factory/product-base'
15
+ import { Product } from '@things-factory/product-base'
16
16
  import { Domain } from '@things-factory/shell'
17
17
  import { Inventory } from '@things-factory/warehouse-base'
18
18
 
@@ -127,10 +127,6 @@ export class ReverseKittingOrderInventory {
127
127
  @Field({ nullable: true })
128
128
  updatedAt?: Date
129
129
 
130
- @ManyToOne(type => ProductDetail, { nullable: true })
131
- @Field({ nullable: true })
132
- productDetail: ProductDetail
133
-
134
130
  @ManyToOne(type => User, { nullable: true })
135
131
  @Field({ nullable: true })
136
132
  creator?: User