@things-factory/sales-base 4.3.82 → 4.3.89

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 +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.js +0 -5
  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 +8 -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 +7 -4
  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 +0 -5
  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 +10 -18
  22. package/dist-server/service/order-product/order-product-types.js.map +1 -1
  23. package/dist-server/service/order-vas/order-vas.js +3 -8
  24. package/dist-server/service/order-vas/order-vas.js.map +1 -1
  25. package/dist-server/service/others/other-query.js +21 -17
  26. package/dist-server/service/others/other-query.js.map +1 -1
  27. package/dist-server/service/others/other-types.js +0 -4
  28. package/dist-server/service/others/other-types.js.map +1 -1
  29. package/dist-server/service/purchase-order/purchase-order-mutation.js +2 -10
  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 +0 -1
  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 +49 -187
  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 +6 -4
  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 +4 -8
  38. package/dist-server/service/release-good/release-good-types.js.map +1 -1
  39. package/dist-server/service/release-good/release-good.js +0 -5
  40. package/dist-server/service/release-good/release-good.js.map +1 -1
  41. package/dist-server/service/return-order/return-order-mutation.js +0 -2
  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 +3 -8
  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 +102 -33
  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 +3 -6
  50. package/server/service/arrival-notice/arrival-notice.ts +0 -4
  51. package/server/service/draft-release-good/draft-release-good-mutation.ts +12 -10
  52. package/server/service/draft-release-good/draft-release-good-query.ts +5 -5
  53. package/server/service/draft-release-good/draft-release-good.ts +0 -4
  54. package/server/service/invoice-product/invoice-product.ts +1 -5
  55. package/server/service/order-inventory/order-inventory-query.ts +0 -2
  56. package/server/service/order-inventory/order-inventory-types.ts +0 -6
  57. package/server/service/order-inventory/order-inventory.ts +1 -8
  58. package/server/service/order-product/order-product-query.ts +0 -1
  59. package/server/service/order-product/order-product-types.ts +0 -6
  60. package/server/service/order-vas/order-vas.ts +1 -6
  61. package/server/service/others/other-query.ts +31 -30
  62. package/server/service/others/other-types.ts +0 -3
  63. package/server/service/purchase-order/purchase-order-mutation.ts +1 -10
  64. package/server/service/purchase-order/purchase-order-query.ts +0 -1
  65. package/server/service/release-good/release-good-mutation.ts +50 -221
  66. package/server/service/release-good/release-good-query.ts +7 -4
  67. package/server/service/release-good/release-good-types.ts +3 -4
  68. package/server/service/release-good/release-good.ts +6 -8
  69. package/server/service/return-order/return-order-mutation.ts +1 -3
  70. package/server/service/return-order/return-order-types.ts +0 -1
  71. package/server/service/reverse-kitting-order-inventory/reverse-kitting-order-inventory.ts +1 -5
  72. package/server/utils/inventory-util.ts +147 -67
@@ -286,7 +286,6 @@ export class OrderInventoryQuery {
286
286
  .leftJoinAndSelect('oi.bizplace', 'bizplace')
287
287
  .leftJoinAndSelect('oi.inventory', 'inventory')
288
288
  .leftJoinAndSelect('inventory.product', 'product')
289
- .leftJoinAndSelect('inventory.productDetail', 'productDetail')
290
289
  .leftJoinAndSelect('oi.creator', 'creator')
291
290
  .leftJoinAndSelect('oi.updater', 'updater')
292
291
 
@@ -300,7 +299,6 @@ export class OrderInventoryQuery {
300
299
  releaseGoodName: item.releaseGood.name,
301
300
  palletId: item.inventory.palletId,
302
301
  productId: item.inventory.product.id,
303
- productDetailId: item.inventory.productDetail.id,
304
302
  productName: item.inventory.product.name,
305
303
  productSKU: item.inventory.product.sku,
306
304
  productBrand: item.inventory.product.brand,
@@ -41,9 +41,6 @@ export class NewOrderInventory {
41
41
  @Field(type => NewProduct, { nullable: true })
42
42
  product: NewProduct
43
43
 
44
- @Field(type => ObjectRef, { nullable: true })
45
- productDetail: ObjectRef
46
-
47
44
  @Field({ nullable: true })
48
45
  productSKU: string
49
46
 
@@ -203,9 +200,6 @@ export class OrderInventoryPatch {
203
200
  @Field({ nullable: true })
204
201
  productId: string
205
202
 
206
- @Field({ nullable: true })
207
- productDetailId: string
208
-
209
203
  @Field({ nullable: true })
210
204
  orderProductId: string
211
205
 
@@ -13,7 +13,7 @@ import {
13
13
 
14
14
  import { User } from '@things-factory/auth-base'
15
15
  import { Bizplace } from '@things-factory/biz-base'
16
- import { Product, ProductDetail} from '@things-factory/product-base'
16
+ import { Product } from '@things-factory/product-base'
17
17
  import { Domain } from '@things-factory/shell'
18
18
  import { Inventory, Location } from '@things-factory/warehouse-base'
19
19
 
@@ -341,13 +341,6 @@ export class OrderInventory {
341
341
  @Field({ nullable: true })
342
342
  loadedAt: Date
343
343
 
344
- @ManyToOne(type => ProductDetail, { nullable: true })
345
- @Field({ nullable: true })
346
- productDetail: ProductDetail
347
-
348
- @Field({ nullable: true })
349
- productDetailId: String
350
-
351
344
  @Field({ nullable: true })
352
345
  dispatchedAt: Date
353
346
 
@@ -26,7 +26,6 @@ export class OrderProductQuery {
26
26
 
27
27
  let qb: SelectQueryBuilder<OrderProduct> = await getRepository(OrderProduct).createQueryBuilder('op')
28
28
  qb.leftJoinAndSelect('op.product', 'product')
29
- .leftJoinAndSelect('op.productDetail', 'productDetail')
30
29
  .leftJoinAndSelect('op.domain', 'domain')
31
30
  .leftJoinAndSelect('op.bizplace', 'bizplace')
32
31
  .leftJoinAndSelect('bizplace.company', 'company')
@@ -84,9 +84,6 @@ export class OrderProductPatch {
84
84
  @Field(type => ObjectRef, { nullable: true })
85
85
  toInventory: ObjectRef
86
86
 
87
- @Field(type => ObjectRef, { nullable: true })
88
- productDetail: ObjectRef
89
-
90
87
  @Field(type => InboundProduct, { nullable: true })
91
88
  product: InboundProduct
92
89
 
@@ -228,9 +225,6 @@ export class NewOrderProduct {
228
225
  @Field(type => ObjectRef, { nullable: true })
229
226
  toInventory: ObjectRef
230
227
 
231
- @Field(type => ObjectRef, { nullable: true })
232
- productDetail: ObjectRef
233
-
234
228
  @Field(type => InboundProduct, { nullable: true })
235
229
  product: InboundProduct
236
230
 
@@ -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
 
@@ -200,10 +200,6 @@ export class OrderVas {
200
200
  @Field()
201
201
  updatedAt: Date
202
202
 
203
- @ManyToOne(type => ProductDetail, { nullable: true })
204
- @Field({ nullable: true })
205
- productDetail: ProductDetail
206
-
207
203
  @ManyToOne(type => User)
208
204
  @Field(type => User, { nullable: true })
209
205
  creator: User
@@ -217,5 +213,4 @@ export class OrderVas {
217
213
 
218
214
  @RelationId((orderVas: OrderVas) => orderVas.updater)
219
215
  updaterId: string
220
-
221
216
  }
@@ -205,30 +205,32 @@ export class OtherQuery {
205
205
 
206
206
  let packageUomValue = availableItem ? availableItem.remainUomValue / availableItem.remainQty : null
207
207
  const newOrderInventory: any = {
208
- product:
209
- total > 0 ? { id: items[0].productId, sku: items[0].productSKU, name: items[0].productName } : { id: null },
210
- productDetail: total > 0 ? { id: items[0].productDetailId } : { id: null },
211
- inventory:
212
- total > 0
213
- ? {
214
- ...items[0],
215
- remainQty: total > 0 ? items[0].remainQty : null,
216
- remainUomValue: total > 0 ? items[0].remainUomValue : null,
217
- remainUomValueWithUom: total > 0 ? items[0].remainUomValueWithUom : ''
208
+ product: availableItem
209
+ ? {
210
+ id: availableItem.productId,
211
+ sku: availableItem.productSKU,
212
+ name: availableItem.productName
218
213
  }
219
- : null,
220
- productId: total > 0 ? items[0].productId : null,
221
- productDetailID: total > 0 ? items[0].productDetailId : null,
222
- productSKU: total > 0 ? items[0].productSKU : orderInventory.productSKU,
223
- productName: total > 0 ? items[0].productName : null,
224
- uom: total > 0 ? items[0].uom : null,
225
- remainQty: total > 0 ? items[0].remainQty : null,
226
- remainUomValue: total > 0 ? items[0].remainUomValue : null,
227
- remainUomValueWithUom: total > 0 ? items[0].remainUomValueWithUom : '',
228
- batchId: total > 0 ? items[0].batchId : null,
229
- batchIdRef: total > 0 ? items[0].batchIdRef : null,
230
- packingType: total > 0 ? items[0].packingType : orderInventory.packingType,
231
- packingSize: total > 0 ? items[0].packingSize : 1,
214
+ : { id: null },
215
+ inventory: availableItem
216
+ ? {
217
+ ...availableItem,
218
+ remainQty: availableItem ? availableItem.remainQty : null,
219
+ remainUomValue: availableItem ? availableItem.remainUomValue : null,
220
+ remainUomValueWithUom: availableItem ? availableItem.remainUomValueWithUom : ''
221
+ }
222
+ : null,
223
+ productId: availableItem ? availableItem.productId : null,
224
+ productSKU: availableItem ? availableItem.productSKU : orderInventory.productSKU,
225
+ productName: availableItem ? availableItem.productName : null,
226
+ uom: availableItem ? availableItem.uom : null,
227
+ remainQty: availableItem ? availableItem.remainQty : null,
228
+ remainUomValue: availableItem ? availableItem.remainUomValue : null,
229
+ remainUomValueWithUom: availableItem ? availableItem.remainUomValueWithUom : '',
230
+ batchId: availableItem ? availableItem.batchId : null,
231
+ batchIdRef: availableItem ? availableItem.batchIdRef : null,
232
+ packingType: availableItem ? availableItem.packingType : orderInventory.packingType,
233
+ packingSize: availableItem ? availableItem.packingSize : 1,
232
234
  releaseQty: orderInventory.releaseQty
233
235
  ? Number.isInteger(orderInventory.releaseQty)
234
236
  ? orderInventory.releaseQty
@@ -352,7 +354,7 @@ export class OtherQuery {
352
354
  let productDetail: ProductDetail
353
355
  const hasConditions: boolean = Boolean(
354
356
  (orderProduct?.packingType && orderProduct?.packingType.trim() != '') ||
355
- (orderProduct?.uom && orderProduct?.uom.trim() != '')
357
+ (orderProduct?.uom && orderProduct?.uom.trim() != '')
356
358
  )
357
359
  let productDetailCondition: any = { product: foundProduct }
358
360
 
@@ -375,8 +377,8 @@ export class OtherQuery {
375
377
  ? productDetail.uomValue
376
378
  : null
377
379
  : orderProduct?.uomValue
378
- ? orderProduct.uomValue
379
- : productDetail.uomValue
380
+ ? orderProduct.uomValue
381
+ : productDetail.uomValue
380
382
 
381
383
  newOrderProduct = {
382
384
  ...orderProduct,
@@ -482,7 +484,7 @@ export class OtherQuery {
482
484
  let productDetail: ProductDetail
483
485
  const hasConditions: boolean = Boolean(
484
486
  (orderProduct?.packingType && orderProduct?.packingType.trim() != '') ||
485
- (orderProduct?.uom && orderProduct?.uom.trim() != '')
487
+ (orderProduct?.uom && orderProduct?.uom.trim() != '')
486
488
  )
487
489
  let productDetailCondition: any = { product: foundProduct }
488
490
 
@@ -505,8 +507,8 @@ export class OtherQuery {
505
507
  ? productDetail.uomValue
506
508
  : null
507
509
  : orderProduct?.uomValue
508
- ? orderProduct.uomValue
509
- : productDetail.uomValue
510
+ ? orderProduct.uomValue
511
+ : productDetail.uomValue
510
512
 
511
513
  newOrderProduct = {
512
514
  ...orderProduct,
@@ -526,7 +528,6 @@ export class OtherQuery {
526
528
  primaryUnit: productDetail?.uom ? productDetail.uom : null,
527
529
  primaryValue: productDetail?.uomValue ? productDetail.uomValue : null
528
530
  },
529
- productDetail,
530
531
  totalUomValue:
531
532
  orderProduct.packQty > 0
532
533
  ? uomValue
@@ -19,9 +19,6 @@ export class InventoryProductGroup {
19
19
  @Field({ nullable: true })
20
20
  productId: string
21
21
 
22
- @Field({ nullable: true })
23
- productDetailId: string
24
-
25
22
  @Field({ nullable: true })
26
23
  batchId: string
27
24
 
@@ -69,14 +69,7 @@ export class PurchaseOrderMutation {
69
69
 
70
70
  const findPurchaseOrder: PurchaseOrder = await getRepository(PurchaseOrder).findOne({
71
71
  where: { domain, id },
72
- relations: [
73
- 'orderProducts',
74
- 'orderProducts.product',
75
- 'orderProducts.productDetail',
76
- 'bufferLocation',
77
- 'bizplace',
78
- 'domain'
79
- ]
72
+ relations: ['orderProducts', 'orderProducts.product', 'bufferLocation', 'bizplace', 'domain']
80
73
  })
81
74
 
82
75
  // const findPurchaseOrder: PurchaseOrder = await tx.getRepository(PurchaseOrder).findOne({id}, { relations:['bizplace']})
@@ -425,7 +418,6 @@ export async function upsertPurchaseOrderProducts(
425
418
  const bizplaceRepo: Repository<Product> = tx?.getRepository(Bizplace) || getRepository(Bizplace)
426
419
  const orderProductRepo: Repository<OrderProduct> = tx?.getRepository(OrderProduct) || getRepository(OrderProduct)
427
420
  const productRepo: Repository<Product> = tx?.getRepository(Product) || getRepository(Product)
428
- const productDetailRepo: Repository<Product> = tx?.getRepository(ProductDetail) || getRepository(ProductDetail)
429
421
 
430
422
  // // Remove all existing order products that do not exist in current input
431
423
  let removeOP = purchaseOrder.orderProducts.filter(
@@ -451,7 +443,6 @@ export async function upsertPurchaseOrderProducts(
451
443
  bizplace: bizplace,
452
444
  name: op?.id ? op.name : OrderNoGenerator.orderProduct(),
453
445
  product: await productRepo.findOne(op.product.id),
454
- productDetail: await productDetailRepo.findOne(op.productDetail.id),
455
446
  packingSize: foundProductDetail?.packingSize || 1,
456
447
  purchaseOrder: purchaseOrder,
457
448
  status: purchaseOrder.status,
@@ -62,7 +62,6 @@ export async function getPurchaseOrderFunction(_: any, name: any, context: any,
62
62
  'supplier',
63
63
  'orderProducts',
64
64
  'orderProducts.product',
65
- 'orderProducts.productDetail',
66
65
  'otherCharges',
67
66
  'bufferLocation',
68
67
  'bizplace',