@things-factory/sales-base 4.3.137 → 4.3.138

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 (73) hide show
  1. package/dist-server/service/arrival-notice/arrival-notice-mutation.js +6 -5
  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 +1 -0
  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 +2 -4
  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 +11 -15
  8. package/dist-server/service/draft-release-good/draft-release-good-query.js.map +1 -1
  9. package/dist-server/service/invoice-product/invoice-product.js +8 -3
  10. package/dist-server/service/invoice-product/invoice-product.js.map +1 -1
  11. package/dist-server/service/order-inventory/order-inventory-query.js +2 -1
  12. package/dist-server/service/order-inventory/order-inventory-query.js.map +1 -1
  13. package/dist-server/service/order-inventory/order-inventory-types.js +18 -10
  14. package/dist-server/service/order-inventory/order-inventory-types.js.map +1 -1
  15. package/dist-server/service/order-inventory/order-inventory.js +12 -3
  16. package/dist-server/service/order-inventory/order-inventory.js.map +1 -1
  17. package/dist-server/service/order-product/order-product-query.js +1 -0
  18. package/dist-server/service/order-product/order-product-query.js.map +1 -1
  19. package/dist-server/service/order-product/order-product-types.js +18 -10
  20. package/dist-server/service/order-product/order-product-types.js.map +1 -1
  21. package/dist-server/service/order-vas/order-vas.js +8 -3
  22. package/dist-server/service/order-vas/order-vas.js.map +1 -1
  23. package/dist-server/service/others/other-query.js +193 -177
  24. package/dist-server/service/others/other-query.js.map +1 -1
  25. package/dist-server/service/others/other-types.js +9 -1
  26. package/dist-server/service/others/other-types.js.map +1 -1
  27. package/dist-server/service/purchase-order/purchase-order-mutation.js +10 -2
  28. package/dist-server/service/purchase-order/purchase-order-mutation.js.map +1 -1
  29. package/dist-server/service/purchase-order/purchase-order-query.js +1 -0
  30. package/dist-server/service/purchase-order/purchase-order-query.js.map +1 -1
  31. package/dist-server/service/release-good/release-good-mutation.js +22 -10
  32. package/dist-server/service/release-good/release-good-mutation.js.map +1 -1
  33. package/dist-server/service/release-good/release-good-query.js +2 -0
  34. package/dist-server/service/release-good/release-good-query.js.map +1 -1
  35. package/dist-server/service/release-good/release-good-types.js +8 -4
  36. package/dist-server/service/release-good/release-good-types.js.map +1 -1
  37. package/dist-server/service/release-good/release-good.js +1 -0
  38. package/dist-server/service/release-good/release-good.js.map +1 -1
  39. package/dist-server/service/return-order/return-order-mutation.js +3 -0
  40. package/dist-server/service/return-order/return-order-mutation.js.map +1 -1
  41. package/dist-server/service/return-order/return-order-types.js.map +1 -1
  42. package/dist-server/service/reverse-kitting-order-inventory/reverse-kitting-order-inventory.js +8 -3
  43. package/dist-server/service/reverse-kitting-order-inventory/reverse-kitting-order-inventory.js.map +1 -1
  44. package/dist-server/utils/inventory-util.js +39 -104
  45. package/dist-server/utils/inventory-util.js.map +1 -1
  46. package/package.json +13 -13
  47. package/server/service/arrival-notice/arrival-notice-mutation.ts +6 -3
  48. package/server/service/arrival-notice/arrival-notice-query.ts +1 -0
  49. package/server/service/draft-release-good/draft-release-good-mutation.ts +4 -7
  50. package/server/service/draft-release-good/draft-release-good-query.ts +17 -21
  51. package/server/service/invoice-product/invoice-product.ts +5 -1
  52. package/server/service/order-inventory/order-inventory-query.ts +2 -0
  53. package/server/service/order-inventory/order-inventory-types.ts +6 -0
  54. package/server/service/order-inventory/order-inventory.ts +8 -1
  55. package/server/service/order-product/order-product-query.ts +1 -0
  56. package/server/service/order-product/order-product-types.ts +6 -0
  57. package/server/service/order-vas/order-vas.ts +6 -1
  58. package/server/service/others/other-query.ts +237 -220
  59. package/server/service/others/other-types.ts +7 -1
  60. package/server/service/purchase-order/purchase-order-mutation.ts +10 -1
  61. package/server/service/purchase-order/purchase-order-query.ts +1 -0
  62. package/server/service/release-good/release-good-mutation.ts +31 -18
  63. package/server/service/release-good/release-good-query.ts +2 -0
  64. package/server/service/release-good/release-good-types.ts +4 -3
  65. package/server/service/release-good/release-good.ts +1 -0
  66. package/server/service/return-order/return-order-mutation.ts +4 -1
  67. package/server/service/return-order/return-order-types.ts +1 -0
  68. package/server/service/reverse-kitting-order-inventory/reverse-kitting-order-inventory.ts +5 -1
  69. package/server/utils/inventory-util.ts +75 -149
  70. package/translations/en.json +1 -0
  71. package/translations/ko.json +2 -1
  72. package/translations/ms.json +2 -1
  73. package/translations/zh.json +25 -0
@@ -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 } from '@things-factory/product-base'
20
+ import { Product, ProductBundleSetting, ProductDetail } 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'
@@ -87,7 +87,8 @@ export class ReleaseGoodMutation {
87
87
  ...Object.fromEntries(
88
88
  Object.entries(releaseGoods[i]).filter(([_, val]) => !/^\s*$/.test(val) && _ != 'orderInventories')
89
89
  ),
90
- domain
90
+ domain,
91
+ status: Not('REJECTED')
91
92
  }
92
93
  })
93
94
  if (existingReleaseGood) throw new Error('this order is already exist in the system')
@@ -159,7 +160,7 @@ export class ReleaseGoodMutation {
159
160
  childTx
160
161
  )
161
162
  }
162
- } catch (error) { }
163
+ } catch (error) {}
163
164
  })
164
165
 
165
166
  if (errorsCaught.length)
@@ -652,8 +653,8 @@ export async function generateReleaseGoodFunction(
652
653
  orderMethod: releaseGood?.orderMethod
653
654
  ? releaseGood.orderMethod
654
655
  : releaseGood.orderInventories[0]?.inventory?.id
655
- ? ORDER_METHOD.SELECT_BY_PALLET
656
- : ORDER_METHOD.SELECT_BY_PRODUCT,
656
+ ? ORDER_METHOD.SELECT_BY_PALLET
657
+ : ORDER_METHOD.SELECT_BY_PRODUCT,
657
658
  status: ORDER_STATUS.PENDING,
658
659
  packageId: releaseGood?.packageId,
659
660
  storeName: releaseGood?.storeName,
@@ -700,7 +701,7 @@ export async function generateReleaseGoodFunction(
700
701
 
701
702
  const pbSettings: ProductBundleSetting[] = await tx.getRepository(ProductBundleSetting).find({
702
703
  where: { productBundle: oi.product.id },
703
- relations: ['product', 'productBundle']
704
+ relations: ['product', 'productBundle', 'productDetail']
704
705
  })
705
706
 
706
707
  pbSettings.forEach(pbs => {
@@ -714,6 +715,9 @@ export async function generateReleaseGoodFunction(
714
715
  id: pbs.product.id,
715
716
  name: pbs.product.name,
716
717
  groupType: PRODUCT_GROUP_TYPE.SINGLE
718
+ },
719
+ productDetail: {
720
+ id: pbs.productDetail.id
717
721
  }
718
722
  }
719
723
  splitBundleOIs.push(splitOI)
@@ -728,6 +732,10 @@ export async function generateReleaseGoodFunction(
728
732
  newReleaseGood = await tx.getRepository(ReleaseGood).save(newReleaseGood)
729
733
 
730
734
  for (let oi of orderInventories) {
735
+ let productDetail: any = await tx
736
+ .getRepository(ProductDetail)
737
+ .findOne(oi.productDetail.id, { relations: ['product'] })
738
+
731
739
  let newOrderInv: OrderInventory = Object.assign({}, oi)
732
740
  newOrderInv = {
733
741
  ...newOrderInv,
@@ -736,7 +744,8 @@ export async function generateReleaseGoodFunction(
736
744
  status: ORDER_INVENTORY_STATUS.PENDING,
737
745
  name: OrderNoGenerator.orderInventory(),
738
746
  releaseGood: newReleaseGood,
739
- product: await tx.getRepository(Product).findOne(oi.product.id),
747
+ product: productDetail.product,
748
+ productDetail,
740
749
  creator: user,
741
750
  updater: user
742
751
  }
@@ -774,9 +783,9 @@ export async function generateReleaseGoodFunction(
774
783
  }
775
784
 
776
785
  let assignedOrderInventories: OrderInventory[] = await InventoryUtil.autoAssignInventoryForRelease(
777
- newOrderInv.product,
778
786
  oi,
779
- oi.packingType,
787
+ productDetail.product,
788
+ productDetail,
780
789
  locationSortingRules,
781
790
  bizplace,
782
791
  warehouseDomain,
@@ -931,7 +940,6 @@ export async function confirmReleaseGood(name: string, context: any, tx?: Entity
931
940
 
932
941
  const orderSource: string = foundReleaseGood.source
933
942
  switch (orderSource) {
934
-
935
943
  case ApplicationType.MMS:
936
944
  // find for any existing marketplace store connections
937
945
  let marketplaceStores: MarketplaceStore[] = await tx.getRepository(MarketplaceStore).find({
@@ -1385,12 +1393,17 @@ export async function bulkGenerateReleaseGood(
1385
1393
  }
1386
1394
  }
1387
1395
 
1388
- const product: Product = await tx.getRepository(Product).findOne(oi.productId)
1396
+ let productDetail = oi.orderProduct?.productDetail
1397
+ let product = oi.orderProduct?.product
1398
+ if (!productDetail) {
1399
+ productDetail = await tx.getRepository(ProductDetail).findOne(oi.productDetailId, { relations: ['product'] })
1400
+ product = productDetail.product
1401
+ }
1389
1402
 
1390
1403
  let assignedResult = await InventoryUtil.autoAssignInventoryForRelease(
1391
- product,
1392
1404
  oi,
1393
- oi.packingType,
1405
+ product,
1406
+ productDetail,
1394
1407
  locationSortingRules,
1395
1408
  bizplace,
1396
1409
  warehouseDomain,
@@ -1492,7 +1505,10 @@ export async function bulkConfirmOrReceiveReleaseGoods(
1492
1505
  let orderStatus =
1493
1506
  partnerDirectReceiveSettingValue == 1 ? ORDER_STATUS.PENDING_RECEIVE : ORDER_STATUS.PENDING_WORKSHEET
1494
1507
 
1495
- let orderInventoryStatus = partnerDirectReceiveSettingValue == 1 ? ORDER_INVENTORY_STATUS.PENDING_RECEIVE : ORDER_INVENTORY_STATUS.PENDING_WORKSHEET
1508
+ let orderInventoryStatus =
1509
+ partnerDirectReceiveSettingValue == 1
1510
+ ? ORDER_INVENTORY_STATUS.PENDING_RECEIVE
1511
+ : ORDER_INVENTORY_STATUS.PENDING_WORKSHEET
1496
1512
 
1497
1513
  await tx
1498
1514
  .getRepository(ReleaseGood)
@@ -1500,10 +1516,7 @@ export async function bulkConfirmOrReceiveReleaseGoods(
1500
1516
 
1501
1517
  await tx
1502
1518
  .getRepository(OrderInventory)
1503
- .update(
1504
- { id: In(foundOrderInventories.map(oi => oi.id)) },
1505
- { status: orderInventoryStatus, updater: user }
1506
- )
1519
+ .update({ id: In(foundOrderInventories.map(oi => oi.id)) }, { status: orderInventoryStatus, updater: user })
1507
1520
 
1508
1521
  if (context?.state?.type != 'api') {
1509
1522
  const users: any[] = await tx
@@ -197,6 +197,7 @@ export class ReleaseGoodQuery {
197
197
  .createQueryBuilder('oi')
198
198
  .leftJoinAndSelect('oi.inventory', 'inventory')
199
199
  .leftJoinAndSelect('oi.product', 'product')
200
+ .leftJoinAndSelect('oi.productDetail', 'productDetail')
200
201
  .leftJoinAndSelect('inventory.location', 'location')
201
202
  .where('oi.domain_id = :domainId', { domainId: domain.id })
202
203
  .andWhere('oi.release_good_id = :releaseGoodId', { releaseGoodId: releaseGood.id })
@@ -227,6 +228,7 @@ export class ReleaseGoodQuery {
227
228
  batchIdRef: inventory.batchIdRef,
228
229
  palletId: inventory.palletId,
229
230
  product: orderInv.product,
231
+ productDetail: orderInv.productDetail,
230
232
  productIdRef: orderInv.product.id,
231
233
  productName: `${orderInv.product.name} (${orderInv.product.description})`,
232
234
  packingType: orderInv.packingType,
@@ -1,6 +1,6 @@
1
1
  import { Field, Float, InputType, Int, ObjectType } from 'type-graphql'
2
2
 
3
- import { Product } from '@things-factory/product-base'
3
+ import { Product, ProductDetail } 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,6 +77,9 @@ 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
+
80
83
  @Field({ nullable: true })
81
84
  packingType?: string
82
85
 
@@ -185,8 +188,6 @@ export class NewReleaseGood {
185
188
  @Field({ nullable: true })
186
189
  orderMethod: string
187
190
 
188
-
189
-
190
191
  @Field({ nullable: true })
191
192
  collectionOrderNo: string
192
193
 
@@ -50,6 +50,7 @@ export enum DispatchmentStatus {
50
50
  @Index('ix_release-good_1', (releaseGood: ReleaseGood) => [releaseGood.domain, releaseGood.refNo])
51
51
  @Index('ix_release-good_2', (releaseGood: ReleaseGood) => [releaseGood.domain, releaseGood.refNo2])
52
52
  @Index('ix_release-good_3', (releaseGood: ReleaseGood) => [releaseGood.domain, releaseGood.remark])
53
+ @Index('ix_release-good_4', (releaseGood: ReleaseGood) => [releaseGood.domain, releaseGood.bizplace])
53
54
  @ObjectType()
54
55
  export class ReleaseGood {
55
56
  @PrimaryGeneratedColumn('uuid')
@@ -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 } from '@things-factory/product-base'
9
+ import { Product, ProductDetail } 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,6 +59,7 @@ 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 &&
62
63
  itm.batchId === curr.batchId &&
63
64
  itm.packingSize === curr.packingSize
64
65
  )
@@ -68,6 +69,7 @@ export class ReturnOrderMutation {
68
69
  } else {
69
70
  existingItem.returnQty = existingItem.returnQty + curr.returnQty
70
71
  existingItem.returnUomValue = existingItem.returnUomValue + curr.returnUomValue
72
+ existingItem.remark = `${existingItem.remark} | ${curr.remark}`
71
73
  }
72
74
 
73
75
  return acc
@@ -99,6 +101,7 @@ export class ReturnOrderMutation {
99
101
  newOrderInv.name = OrderNoGenerator.orderInventory()
100
102
  newOrderInv.returnOrder = createdReturnOrder
101
103
  newOrderInv.product = await tx.getRepository(Product).findOne(moi.product.id)
104
+ newOrderInv.productDetail = await tx.getRepository(ProductDetail).findOne(moi.productDetail.id)
102
105
  newOrderInv.creator = user
103
106
  newOrderInv.updater = user
104
107
 
@@ -115,6 +115,7 @@ export class NewReturnOrder {
115
115
  @Field({ nullable: true })
116
116
  truckNo: string
117
117
 
118
+
118
119
  @Field({ nullable: true })
119
120
  deliveryOrderNo: string
120
121
 
@@ -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 } from '@things-factory/product-base'
15
+ import { Product, ProductDetail } 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,6 +127,10 @@ 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
+
130
134
  @ManyToOne(type => User, { nullable: true })
131
135
  @Field({ nullable: true })
132
136
  creator?: User