@things-factory/sales-base 4.3.86 → 4.3.94-alpha.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 (72) 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.js +5 -0
  4. package/dist-server/service/arrival-notice/arrival-notice.js.map +1 -1
  5. package/dist-server/service/draft-release-good/draft-release-good-mutation.js +3 -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/draft-release-good/draft-release-good.js +5 -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 +8 -3
  12. package/dist-server/service/invoice-product/invoice-product.js.map +1 -1
  13. package/dist-server/service/order-inventory/order-inventory-query.js +2 -1
  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 +18 -10
  16. package/dist-server/service/order-inventory/order-inventory-types.js.map +1 -1
  17. package/dist-server/service/order-inventory/order-inventory.js +12 -3
  18. package/dist-server/service/order-inventory/order-inventory.js.map +1 -1
  19. package/dist-server/service/order-product/order-product-query.js +1 -0
  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 +18 -10
  22. package/dist-server/service/order-product/order-product-types.js.map +1 -1
  23. package/dist-server/service/order-vas/order-vas.js +8 -3
  24. package/dist-server/service/order-vas/order-vas.js.map +1 -1
  25. package/dist-server/service/others/other-query.js +17 -21
  26. package/dist-server/service/others/other-query.js.map +1 -1
  27. package/dist-server/service/others/other-types.js +4 -0
  28. package/dist-server/service/others/other-types.js.map +1 -1
  29. package/dist-server/service/purchase-order/purchase-order-mutation.js +10 -2
  30. package/dist-server/service/purchase-order/purchase-order-mutation.js.map +1 -1
  31. package/dist-server/service/purchase-order/purchase-order-query.js +1 -0
  32. package/dist-server/service/purchase-order/purchase-order-query.js.map +1 -1
  33. package/dist-server/service/release-good/release-good-mutation.js +68 -46
  34. package/dist-server/service/release-good/release-good-mutation.js.map +1 -1
  35. package/dist-server/service/release-good/release-good-query.js +4 -6
  36. package/dist-server/service/release-good/release-good-query.js.map +1 -1
  37. package/dist-server/service/release-good/release-good-types.js +8 -4
  38. package/dist-server/service/release-good/release-good-types.js.map +1 -1
  39. package/dist-server/service/release-good/release-good.js +5 -0
  40. package/dist-server/service/release-good/release-good.js.map +1 -1
  41. package/dist-server/service/return-order/return-order-mutation.js +2 -0
  42. package/dist-server/service/return-order/return-order-mutation.js.map +1 -1
  43. package/dist-server/service/return-order/return-order-types.js.map +1 -1
  44. package/dist-server/service/reverse-kitting-order-inventory/reverse-kitting-order-inventory.js +8 -3
  45. package/dist-server/service/reverse-kitting-order-inventory/reverse-kitting-order-inventory.js.map +1 -1
  46. package/dist-server/utils/inventory-util.js +33 -102
  47. package/dist-server/utils/inventory-util.js.map +1 -1
  48. package/package.json +13 -13
  49. package/server/service/arrival-notice/arrival-notice-mutation.ts +6 -3
  50. package/server/service/arrival-notice/arrival-notice.ts +4 -0
  51. package/server/service/draft-release-good/draft-release-good-mutation.ts +8 -6
  52. package/server/service/draft-release-good/draft-release-good-query.ts +17 -21
  53. package/server/service/draft-release-good/draft-release-good.ts +4 -0
  54. package/server/service/invoice-product/invoice-product.ts +5 -1
  55. package/server/service/order-inventory/order-inventory-query.ts +2 -0
  56. package/server/service/order-inventory/order-inventory-types.ts +6 -0
  57. package/server/service/order-inventory/order-inventory.ts +8 -1
  58. package/server/service/order-product/order-product-query.ts +1 -0
  59. package/server/service/order-product/order-product-types.ts +6 -0
  60. package/server/service/order-vas/order-vas.ts +6 -1
  61. package/server/service/others/other-query.ts +30 -31
  62. package/server/service/others/other-types.ts +3 -0
  63. package/server/service/purchase-order/purchase-order-mutation.ts +10 -1
  64. package/server/service/purchase-order/purchase-order-query.ts +1 -0
  65. package/server/service/release-good/release-good-mutation.ts +90 -50
  66. package/server/service/release-good/release-good-query.ts +4 -7
  67. package/server/service/release-good/release-good-types.ts +4 -3
  68. package/server/service/release-good/release-good.ts +8 -6
  69. package/server/service/return-order/return-order-mutation.ts +3 -1
  70. package/server/service/return-order/return-order-types.ts +1 -0
  71. package/server/service/reverse-kitting-order-inventory/reverse-kitting-order-inventory.ts +5 -1
  72. package/server/utils/inventory-util.ts +67 -147
@@ -3,7 +3,7 @@ import { Arg, Ctx, Directive, Mutation, Resolver } from 'type-graphql'
3
3
  import { EntityManager, getConnection, getRepository, In, Not, Repository } from 'typeorm'
4
4
 
5
5
  import { Attachment, createAttachments } from '@things-factory/attachment-base'
6
- import { Partner, Role, User } from '@things-factory/auth-base'
6
+ import { ApplicationType, Partner, Role, User } from '@things-factory/auth-base'
7
7
  import {
8
8
  Bizplace,
9
9
  getDomainUsers,
@@ -14,10 +14,9 @@ import {
14
14
  import { generateId } from '@things-factory/id-rule-base'
15
15
  import { MarketplaceStore } from '@things-factory/integration-marketplace'
16
16
  import { Sellercraft, SellercraftStatus } from '@things-factory/integration-sellercraft'
17
- import { Sftp } from '@things-factory/integration-sftp'
18
17
  import { MarketplaceOrder, MarketplaceProductVariation } from '@things-factory/marketplace-base'
19
18
  // import { sendNotification } from '@things-factory/notification'
20
- import { Product, ProductBundleSetting } from '@things-factory/product-base'
19
+ import { Product, ProductBundleSetting, ProductDetail } from '@things-factory/product-base'
21
20
  import { PartnerSetting, Setting } from '@things-factory/setting-base'
22
21
  import { Domain } from '@things-factory/shell'
23
22
  import { Inventory } from '@things-factory/warehouse-base'
@@ -136,7 +135,7 @@ export class ReleaseGoodMutation {
136
135
  context,
137
136
  tx
138
137
  )
139
- } catch (error) {}
138
+ } catch (error) { }
140
139
 
141
140
  if (errorsCaught.length)
142
141
  throw new ValidationError({
@@ -485,20 +484,21 @@ export async function generateReleaseGoodFunction(
485
484
  await InventoryUtil.validateWarehousePartnersProductsQuantity(domain, bizplace, orderInventories, context, tx)
486
485
  /** End Validate Release Order Product Quantity Section */
487
486
 
488
- if (releaseGood.type == 'b2c') {
489
- const sellercraft: Sellercraft = await tx
490
- .getRepository(Sellercraft)
491
- .findOne({ domain: bizplace.domain, status: SellercraftStatus.ACTIVE })
487
+ const orderSource: string = releaseGood.source
488
+ switch (orderSource) {
489
+ case ApplicationType.SELLERCRAFT:
490
+ const sellercraft: Sellercraft = await tx
491
+ .getRepository(Sellercraft)
492
+ .findOne({ domain: bizplace.domain, status: SellercraftStatus.ACTIVE })
492
493
 
493
- let customerAvailableSftp: Sftp = await tx.getRepository(Sftp).findOne({
494
- where: { domain: bizplace.domain }
495
- })
494
+ if (sellercraft) {
495
+ const sellercraftCtrl: SellercraftController = new SellercraftController(tx, domain, user)
496
+ await sellercraftCtrl.checkExistingReleaseGood(sellercraft, releaseGood)
497
+ }
496
498
 
497
- if (sellercraft) {
498
- const sellercraftCtrl: SellercraftController = new SellercraftController(tx, domain, user)
499
- await sellercraftCtrl.checkExistingReleaseGood(sellercraft, releaseGood)
500
- } else if (customerAvailableSftp) {
501
- } else {
499
+ break
500
+
501
+ case ApplicationType.MMS:
502
502
  const refNo: string = releaseGood.refNo
503
503
  const foundReleaseGood: ReleaseGood = await tx.getRepository(ReleaseGood).findOne({
504
504
  where: {
@@ -532,7 +532,10 @@ export async function generateReleaseGoodFunction(
532
532
  throw new Error('Existing release order found')
533
533
  }
534
534
  }
535
- }
535
+ break
536
+
537
+ default:
538
+ break
536
539
  }
537
540
 
538
541
  let newReleaseGood: ReleaseGood = new ReleaseGood()
@@ -624,8 +627,8 @@ export async function generateReleaseGoodFunction(
624
627
  orderMethod: releaseGood?.orderMethod
625
628
  ? releaseGood.orderMethod
626
629
  : releaseGood.orderInventories[0]?.inventory?.id
627
- ? ORDER_METHOD.SELECT_BY_PALLET
628
- : ORDER_METHOD.SELECT_BY_PRODUCT,
630
+ ? ORDER_METHOD.SELECT_BY_PALLET
631
+ : ORDER_METHOD.SELECT_BY_PRODUCT,
629
632
  status: ORDER_STATUS.PENDING,
630
633
  packageId: releaseGood?.packageId,
631
634
  storeName: releaseGood?.storeName,
@@ -672,7 +675,7 @@ export async function generateReleaseGoodFunction(
672
675
 
673
676
  const pbSettings: ProductBundleSetting[] = await tx.getRepository(ProductBundleSetting).find({
674
677
  where: { productBundle: oi.product.id },
675
- relations: ['product', 'productBundle']
678
+ relations: ['product', 'productBundle', 'productDetail']
676
679
  })
677
680
 
678
681
  pbSettings.forEach(pbs => {
@@ -686,6 +689,9 @@ export async function generateReleaseGoodFunction(
686
689
  id: pbs.product.id,
687
690
  name: pbs.product.name,
688
691
  groupType: PRODUCT_GROUP_TYPE.SINGLE
692
+ },
693
+ productDetail: {
694
+ id: pbs.productDetail.id
689
695
  }
690
696
  }
691
697
  splitBundleOIs.push(splitOI)
@@ -700,6 +706,10 @@ export async function generateReleaseGoodFunction(
700
706
  newReleaseGood = await tx.getRepository(ReleaseGood).save(newReleaseGood)
701
707
 
702
708
  for (let oi of orderInventories) {
709
+ let productDetail: any = await tx
710
+ .getRepository(ProductDetail)
711
+ .findOne(oi.productDetail.id, { relations: ['product'] })
712
+
703
713
  let newOrderInv: OrderInventory = Object.assign({}, oi)
704
714
  newOrderInv = {
705
715
  ...newOrderInv,
@@ -708,7 +718,8 @@ export async function generateReleaseGoodFunction(
708
718
  status: ORDER_INVENTORY_STATUS.PENDING,
709
719
  name: OrderNoGenerator.orderInventory(),
710
720
  releaseGood: newReleaseGood,
711
- product: await tx.getRepository(Product).findOne(oi.product.id),
721
+ product: productDetail.product,
722
+ productDetail,
712
723
  creator: user,
713
724
  updater: user
714
725
  }
@@ -746,9 +757,9 @@ export async function generateReleaseGoodFunction(
746
757
  }
747
758
 
748
759
  let assignedOrderInventories: OrderInventory[] = await InventoryUtil.autoAssignInventoryForRelease(
749
- newOrderInv.product,
750
760
  oi,
751
- oi.packingType,
761
+ productDetail.product,
762
+ productDetail,
752
763
  locationSortingRules,
753
764
  bizplace,
754
765
  warehouseDomain,
@@ -887,16 +898,32 @@ export async function confirmReleaseGood(name: string, context: any, tx?: Entity
887
898
  let foundOVs: OrderVas[] = foundReleaseGood.orderVass
888
899
  let customerBizplace: Bizplace = foundReleaseGood.bizplace
889
900
  const companyDomain: Domain = customerBizplace?.company.domain
901
+
890
902
  const sellercraft: Sellercraft = await tx.getRepository(Sellercraft).findOne({
891
903
  where: { domain: foundReleaseGood.bizplace.domain, status: SellercraftStatus.ACTIVE },
892
904
  relations: ['domain']
893
905
  })
894
906
 
895
- if (foundReleaseGood.type == 'b2c') {
907
+ const sellercraftCtrl: SellercraftController = new SellercraftController(tx, domain, user)
908
+
909
+ let updateSCStock = async sellercraft => {
896
910
  if (sellercraft) {
897
- const sellercraftCtrl: SellercraftController = new SellercraftController(tx, domain, user)
898
- foundReleaseGood = await sellercraftCtrl.packOrder(sellercraft, { ...foundReleaseGood, orderProducts: foundOPs })
899
- } else {
911
+ await sellercraftCtrl.updateSellercraftStock(sellercraft, foundOPs, 'CONFIRM_ORDER')
912
+ }
913
+ }
914
+
915
+ const orderSource: string = foundReleaseGood.source
916
+ switch (orderSource) {
917
+ case ApplicationType.SELLERCRAFT:
918
+ if (foundReleaseGood.type == 'b2c' && sellercraft) {
919
+ foundReleaseGood = await sellercraftCtrl.packOrder(sellercraft, {
920
+ ...foundReleaseGood,
921
+ orderProducts: foundOPs
922
+ })
923
+ }
924
+ break
925
+
926
+ case ApplicationType.MMS:
900
927
  // find for any existing marketplace store connections
901
928
  let marketplaceStores: MarketplaceStore[] = await tx.getRepository(MarketplaceStore).find({
902
929
  where: { domain: companyDomain, status: 'ACTIVE' },
@@ -959,14 +986,13 @@ export async function confirmReleaseGood(name: string, context: any, tx?: Entity
959
986
  const ecommerceCtrl: EcommerceController = new EcommerceController(tx, domain, user)
960
987
  await ecommerceCtrl.updateProductVariationStock(marketplaceStores, productIds, companyDomain)
961
988
  }
962
- }
963
- }
964
989
 
965
- if (foundReleaseGood.type == 'b2b') {
966
- if (sellercraft) {
967
- const sellercraftCtrl: SellercraftController = new SellercraftController(tx, domain, user)
968
- await sellercraftCtrl.updateSellercraftStock(sellercraft, foundOPs, 'CONFIRM_ORDER')
969
- }
990
+ updateSCStock(sellercraft)
991
+ break
992
+
993
+ default:
994
+ updateSCStock(sellercraft)
995
+ break
970
996
  }
971
997
 
972
998
  // 1. RO Status change (PENDING => PENDING_RECEIVE)
@@ -1183,13 +1209,21 @@ export async function rejectReleaseGood(
1183
1209
  }
1184
1210
 
1185
1211
  if (foundOPs && foundOPs.length) {
1186
- const sellercraft: Sellercraft = await tx
1187
- .getRepository(Sellercraft)
1188
- .findOne({ domain: releaseGood.bizplace.domain, status: SellercraftStatus.ACTIVE })
1212
+ const orderSource: string = releaseGood.source
1213
+ switch (orderSource) {
1214
+ case ApplicationType.SELLERCRAFT:
1215
+ const sellercraft: Sellercraft = await tx
1216
+ .getRepository(Sellercraft)
1217
+ .findOne({ domain: releaseGood.bizplace.domain, status: SellercraftStatus.ACTIVE })
1218
+
1219
+ if (sellercraft) {
1220
+ const sellercraftCtrl: SellercraftController = new SellercraftController(tx, domain, user)
1221
+ await sellercraftCtrl.updateSellercraftStock(sellercraft, foundOPs, 'REJECT_ORDER')
1222
+ }
1223
+ break
1189
1224
 
1190
- if (sellercraft) {
1191
- const sellercraftCtrl: SellercraftController = new SellercraftController(tx, domain, user)
1192
- await sellercraftCtrl.updateSellercraftStock(sellercraft, foundOPs, 'REJECT_ORDER')
1225
+ default:
1226
+ break
1193
1227
  }
1194
1228
 
1195
1229
  await tx.getRepository(OrderProduct).save(
@@ -1288,6 +1322,7 @@ export async function bulkGenerateReleaseGood(
1288
1322
  phone1: releaseGood?.phone1 || null,
1289
1323
  phone2: releaseGood?.phone2 || null,
1290
1324
  email: releaseGood?.email || null,
1325
+ source: releaseGood?.source || null,
1291
1326
  airwayBill: releaseGood?.airwayBill,
1292
1327
  refNo: releaseGood.refNo,
1293
1328
  refNo2: releaseGood.refNo2,
@@ -1296,8 +1331,8 @@ export async function bulkGenerateReleaseGood(
1296
1331
  ownTransport: releaseGood?.ownTransport || false,
1297
1332
  orderMethod: ORDER_METHOD.SELECT_BY_PRODUCT,
1298
1333
  status: ORDER_STATUS.PENDING,
1299
- creator: user,
1300
- updater: user
1334
+ creator: releaseGood?.creator || user,
1335
+ updater: releaseGood?.updater || user
1301
1336
  }
1302
1337
 
1303
1338
  newReleaseGood = await tx.getRepository(ReleaseGood).save(newReleaseGood)
@@ -1339,12 +1374,17 @@ export async function bulkGenerateReleaseGood(
1339
1374
  }
1340
1375
  }
1341
1376
 
1342
- const product: Product = await tx.getRepository(Product).findOne(oi.productId)
1377
+ let productDetail = oi.orderProduct?.productDetail
1378
+ let product = oi.orderProduct?.product
1379
+ if (!productDetail) {
1380
+ productDetail = await tx.getRepository(ProductDetail).findOne(oi.productDetailId, { relations: ['product'] })
1381
+ product = productDetail.product
1382
+ }
1343
1383
 
1344
1384
  let assignedResult = await InventoryUtil.autoAssignInventoryForRelease(
1345
- product,
1346
1385
  oi,
1347
- oi.packingType,
1386
+ product,
1387
+ productDetail,
1348
1388
  locationSortingRules,
1349
1389
  bizplace,
1350
1390
  warehouseDomain,
@@ -1370,8 +1410,8 @@ export async function bulkGenerateReleaseGood(
1370
1410
  status: ORDER_INVENTORY_STATUS.PENDING,
1371
1411
  name: OrderNoGenerator.orderInventory(),
1372
1412
  releaseGood: newReleaseGood,
1373
- creator: user,
1374
- updater: user
1413
+ creator: newReleaseGood?.creator || user,
1414
+ updater: newReleaseGood?.updater || user
1375
1415
  }
1376
1416
 
1377
1417
  let newOrderProduct: Partial<OrderProduct>
@@ -1393,8 +1433,8 @@ export async function bulkGenerateReleaseGood(
1393
1433
  actualPalletQty: 0,
1394
1434
  status: ORDER_PRODUCT_STATUS.ASSIGNED,
1395
1435
  releaseGood: newReleaseGood,
1396
- creator: user,
1397
- updater: user
1436
+ creator: newReleaseGood?.creator || user,
1437
+ updater: newReleaseGood?.updater || user
1398
1438
  }
1399
1439
 
1400
1440
  newOrderProduct = await tx.getRepository(OrderProduct).save(newOrderProduct)
@@ -1403,7 +1443,7 @@ export async function bulkGenerateReleaseGood(
1403
1443
  ...oi.orderProduct,
1404
1444
  totalUomValue: `${oi.orderProduct.releaseUomValue} ${oi.orderProduct.uom}`,
1405
1445
  status: ORDER_PRODUCT_STATUS.ASSIGNED,
1406
- updater: user
1446
+ updater: newReleaseGood?.updater || user
1407
1447
  })
1408
1448
  }
1409
1449
 
@@ -196,6 +196,7 @@ export class ReleaseGoodQuery {
196
196
  .createQueryBuilder('oi')
197
197
  .leftJoinAndSelect('oi.inventory', 'inventory')
198
198
  .leftJoinAndSelect('oi.product', 'product')
199
+ .leftJoinAndSelect('oi.productDetail', 'productDetail')
199
200
  .leftJoinAndSelect('inventory.location', 'location')
200
201
  .where('oi.domain_id = :domainId', { domainId: domain.id })
201
202
  .andWhere('oi.release_good_id = :releaseGoodId', { releaseGoodId: releaseGood.id })
@@ -226,6 +227,7 @@ export class ReleaseGoodQuery {
226
227
  batchIdRef: inventory.batchIdRef,
227
228
  palletId: inventory.palletId,
228
229
  product: orderInv.product,
230
+ productDetail: orderInv.productDetail,
229
231
  productIdRef: orderInv.product.id,
230
232
  productName: `${orderInv.product.name} (${orderInv.product.description})`,
231
233
  packingType: orderInv.packingType,
@@ -375,10 +377,7 @@ export class ReleaseGoodQuery {
375
377
  params.filters.push({
376
378
  name: typeFilter == 'b2c' ? 'releaseDate' : 'createdAt',
377
379
  operator: 'gte',
378
- value:
379
- typeFilter == 'b2c'
380
- ? releaseDateFrom
381
- : fromDateVal.toISOString(),
380
+ value: typeFilter == 'b2c' ? releaseDateFrom : fromDateVal.toISOString(),
382
381
  relation: false
383
382
  })
384
383
  }
@@ -393,9 +392,7 @@ export class ReleaseGoodQuery {
393
392
  name: typeFilter == 'b2c' ? 'releaseDate' : 'createdAt',
394
393
  operator: typeFilter == 'b2c' ? 'lte' : 'lt',
395
394
  value:
396
- typeFilter == 'b2c'
397
- ? releaseDateTo
398
- : new Date(toDateVal.setDate(toDateVal.getDate() + 1)).toISOString(),
395
+ typeFilter == 'b2c' ? releaseDateTo : new Date(toDateVal.setDate(toDateVal.getDate() + 1)).toISOString(),
399
396
  relation: false
400
397
  })
401
398
  }
@@ -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
 
@@ -95,8 +95,8 @@ export class ReleaseGood {
95
95
  DATABASE_TYPE == 'postgres' || DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb'
96
96
  ? 'enum'
97
97
  : DATABASE_TYPE == 'oracle'
98
- ? 'varchar2'
99
- : 'smallint',
98
+ ? 'varchar2'
99
+ : 'smallint',
100
100
  enum: ReleaseOrderType,
101
101
  default: ReleaseOrderType.B2B
102
102
  })
@@ -167,15 +167,13 @@ export class ReleaseGood {
167
167
  DATABASE_TYPE == 'postgres' || DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb'
168
168
  ? 'enum'
169
169
  : DATABASE_TYPE == 'oracle'
170
- ? 'varchar2'
171
- : 'smallint',
170
+ ? 'varchar2'
171
+ : 'smallint',
172
172
  enum: DispatchmentStatus,
173
173
  default: DispatchmentStatus.READY_TO_DISPATCH
174
174
  })
175
175
  dispatchmentStatus: DispatchmentStatus
176
176
 
177
-
178
-
179
177
  @Column({ nullable: true })
180
178
  @Field({ nullable: true })
181
179
  refNo: String
@@ -443,6 +441,10 @@ export class ReleaseGood {
443
441
  @Field({ nullable: true })
444
442
  stopId: string
445
443
 
444
+ @Column({ nullable: true })
445
+ @Field({ nullable: true })
446
+ source: string
447
+
446
448
  @Column({ nullable: true })
447
449
  @Field({ nullable: true })
448
450
  manifestedAt: Date
@@ -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
  )
@@ -99,6 +100,7 @@ export class ReturnOrderMutation {
99
100
  newOrderInv.name = OrderNoGenerator.orderInventory()
100
101
  newOrderInv.returnOrder = createdReturnOrder
101
102
  newOrderInv.product = await tx.getRepository(Product).findOne(moi.product.id)
103
+ newOrderInv.productDetail = await tx.getRepository(ProductDetail).findOne(moi.productDetail.id)
102
104
  newOrderInv.creator = user
103
105
  newOrderInv.updater = user
104
106
 
@@ -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