@things-factory/sales-base 4.3.129 → 4.3.132

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 (32) hide show
  1. package/dist-server/constants/order.js +5 -1
  2. package/dist-server/constants/order.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/delivery-order/delivery-order-mutation.js +29 -27
  6. package/dist-server/service/delivery-order/delivery-order-mutation.js.map +1 -1
  7. package/dist-server/service/draft-release-good/draft-release-good-mutation.js +179 -168
  8. package/dist-server/service/draft-release-good/draft-release-good-mutation.js.map +1 -1
  9. package/dist-server/service/goods-receival-note/goods-receival-note-mutation.js +0 -24
  10. package/dist-server/service/goods-receival-note/goods-receival-note-mutation.js.map +1 -1
  11. package/dist-server/service/purchase-order/purchase-order-mutation.js +16 -1
  12. package/dist-server/service/purchase-order/purchase-order-mutation.js.map +1 -1
  13. package/dist-server/service/purchase-order/purchase-order-types.js +18 -2
  14. package/dist-server/service/purchase-order/purchase-order-types.js.map +1 -1
  15. package/dist-server/service/purchase-order/purchase-order.js +23 -3
  16. package/dist-server/service/purchase-order/purchase-order.js.map +1 -1
  17. package/dist-server/service/release-good/release-good-mutation.js +0 -17
  18. package/dist-server/service/release-good/release-good-mutation.js.map +1 -1
  19. package/dist-server/service/release-good/release-good.js +5 -0
  20. package/dist-server/service/release-good/release-good.js.map +1 -1
  21. package/package.json +14 -15
  22. package/server/constants/order.ts +5 -0
  23. package/server/service/arrival-notice/arrival-notice.ts +4 -0
  24. package/server/service/delivery-order/delivery-order-mutation.ts +30 -30
  25. package/server/service/draft-release-good/draft-release-good-mutation.ts +221 -210
  26. package/server/service/goods-receival-note/goods-receival-note-mutation.ts +0 -27
  27. package/server/service/purchase-order/purchase-order-mutation.ts +22 -10
  28. package/server/service/purchase-order/purchase-order-types.ts +16 -2
  29. package/server/service/purchase-order/purchase-order.ts +23 -5
  30. package/server/service/release-good/release-good-mutation.ts +3 -23
  31. package/server/service/release-good/release-good.ts +4 -0
  32. package/LICENSE.md +0 -21
@@ -3,9 +3,10 @@ import { Arg, Ctx, Directive, Mutation, Resolver } from 'type-graphql'
3
3
  import { EntityManager, getRepository, Repository } from 'typeorm'
4
4
 
5
5
  import { Attachment, createAttachments, deleteAttachmentsByRef } from '@things-factory/attachment-base'
6
- import { User } from '@things-factory/auth-base'
6
+ import { ApplicationType, User } from '@things-factory/auth-base'
7
7
  import { Bizplace, ContactPoint, getPermittedBizplaces } from '@things-factory/biz-base'
8
8
  import { generateId } from '@things-factory/id-rule-base'
9
+ import { Account, AccountingAPI } from '@things-factory/integration-accounting'
9
10
  import { Product, ProductDetail } from '@things-factory/product-base'
10
11
  import { Setting } from '@things-factory/setting-base'
11
12
  import { Domain } from '@things-factory/shell'
@@ -23,16 +24,11 @@ import {
23
24
  ATTACHMENT_TYPE,
24
25
  ORDER_NUMBER_RULE_TYPE,
25
26
  ORDER_NUMBER_SETTING_KEY,
26
- PURCHASE_ORDER_STATUS,
27
- ORDER_STATUS
27
+ ORDER_STATUS,
28
+ PURCHASE_ORDER_STATUS
28
29
  } from '../../constants'
29
30
  import { OrderNoGenerator } from '../../utils'
30
- import {
31
- checkArrivedNoticeFunction,
32
- confirmArrivalNoticeFunction,
33
- generateArrivalNoticeFunction,
34
- receiveArrivalNoticeFunction
35
- } from '../arrival-notice/arrival-notice-mutation'
31
+ import { checkArrivedNoticeFunction, generateArrivalNoticeFunction } from '../arrival-notice/arrival-notice-mutation'
36
32
  import { getPurchaseOrderFunction } from './purchase-order-query'
37
33
 
38
34
  @Resolver(PurchaseOrder)
@@ -132,7 +128,7 @@ export class PurchaseOrderMutation {
132
128
 
133
129
  const findPurchaseOrder: PurchaseOrder = await getRepository(PurchaseOrder).findOne({
134
130
  where: { domain, id },
135
- relations: ['orderProducts']
131
+ relations: ['bizplace', 'bizplace.domain', 'orderProducts']
136
132
  })
137
133
  // // 1. Reject purchase order
138
134
  const rejectedPurchaseOrder: PurchaseOrder = await tx.getRepository(PurchaseOrder).save({
@@ -150,6 +146,22 @@ export class PurchaseOrderMutation {
150
146
  })
151
147
  )
152
148
 
149
+ const orderSource: string = rejectedPurchaseOrder.source
150
+ switch (orderSource) {
151
+ case ApplicationType.XILNEX:
152
+ const xilnex: Account = await tx
153
+ .getRepository(Account)
154
+ .findOne({ where: { domain: findPurchaseOrder.bizplace.domain, status: 'active', platform: 'xilnex' } })
155
+
156
+ await AccountingAPI.cancelPurchaseOrder(xilnex, {
157
+ purchaseOrder: rejectedPurchaseOrder
158
+ })
159
+ break
160
+
161
+ default:
162
+ break
163
+ }
164
+
153
165
  return rejectedPurchaseOrder
154
166
  }
155
167
 
@@ -1,7 +1,9 @@
1
- import { ObjectRef } from '@things-factory/shell'
2
1
  import { Field, InputType, Int, ObjectType } from 'type-graphql'
2
+
3
+ import { ObjectRef } from '@things-factory/shell'
4
+
5
+ import { PurchaseOrder, PurchaseOrderOtherCharge, PurchaseOrderOtherChargePatch } from '../'
3
6
  import { OrderProductPatch } from '../order-product/order-product-types'
4
- import { PurchaseOrder, PurchaseOrderOtherChargePatch, PurchaseOrderOtherCharge } from '../'
5
7
 
6
8
  @ObjectType()
7
9
  export class PurchaseOrderList {
@@ -79,6 +81,12 @@ export class NewPurchaseOrder {
79
81
 
80
82
  @Field({ nullable: true })
81
83
  truckNo: string
84
+
85
+ @Field({ nullable: true })
86
+ source: string
87
+
88
+ @Field({ nullable: true })
89
+ orderSourceType: string
82
90
  }
83
91
 
84
92
  @InputType()
@@ -151,4 +159,10 @@ export class PurchaseOrderPatch {
151
159
 
152
160
  @Field({ nullable: true })
153
161
  truckNo: string
162
+
163
+ @Field({ nullable: true })
164
+ source: string
165
+
166
+ @Field({ nullable: true })
167
+ orderSourceType: string
154
168
  }
@@ -1,9 +1,4 @@
1
- import { User } from '@things-factory/auth-base'
2
- import { Bizplace, ContactPoint } from '@things-factory/biz-base'
3
- import { Domain } from '@things-factory/shell'
4
- import { Location } from '@things-factory/warehouse-base'
5
1
  import { Field, ID, ObjectType } from 'type-graphql'
6
- import { Attachment } from '@things-factory/attachment-base'
7
2
  import {
8
3
  Column,
9
4
  CreateDateColumn,
@@ -16,6 +11,13 @@ import {
16
11
  RelationId,
17
12
  UpdateDateColumn
18
13
  } from 'typeorm'
14
+
15
+ import { Attachment } from '@things-factory/attachment-base'
16
+ import { User } from '@things-factory/auth-base'
17
+ import { Bizplace, ContactPoint } from '@things-factory/biz-base'
18
+ import { Domain } from '@things-factory/shell'
19
+ import { Location } from '@things-factory/warehouse-base'
20
+
19
21
  import { ArrivalNotice, OrderProduct, PurchaseOrderOtherCharge, PurchaseOrderOtherChargePatch } from '../'
20
22
  import { PURCHASE_ORDER_STATUS } from '../../constants'
21
23
 
@@ -64,6 +66,14 @@ export class PurchaseOrder {
64
66
  @Field({ nullable: true })
65
67
  refNo: string
66
68
 
69
+ @Column({ nullable: true })
70
+ @Field({ nullable: true })
71
+ refNo2: string
72
+
73
+ @Column({ nullable: true })
74
+ @Field({ nullable: true })
75
+ refNo3: string
76
+
67
77
  @Column({ nullable: true })
68
78
  @Field({ nullable: true })
69
79
  issuedOn: Date
@@ -126,6 +136,14 @@ export class PurchaseOrder {
126
136
  @Field({ nullable: true })
127
137
  looseItem: boolean
128
138
 
139
+ @Column({ nullable: true })
140
+ @Field({ nullable: true })
141
+ source: string
142
+
143
+ @Column({ nullable: true })
144
+ @Field({ nullable: true })
145
+ orderSourceType: string
146
+
129
147
  @Column({ nullable: true })
130
148
  @Field({ nullable: true })
131
149
  approvedOn: Date
@@ -159,7 +159,7 @@ export class ReleaseGoodMutation {
159
159
  childTx
160
160
  )
161
161
  }
162
- } catch (error) {}
162
+ } catch (error) { }
163
163
  })
164
164
 
165
165
  if (errorsCaught.length)
@@ -652,8 +652,8 @@ export async function generateReleaseGoodFunction(
652
652
  orderMethod: releaseGood?.orderMethod
653
653
  ? releaseGood.orderMethod
654
654
  : releaseGood.orderInventories[0]?.inventory?.id
655
- ? ORDER_METHOD.SELECT_BY_PALLET
656
- : ORDER_METHOD.SELECT_BY_PRODUCT,
655
+ ? ORDER_METHOD.SELECT_BY_PALLET
656
+ : ORDER_METHOD.SELECT_BY_PRODUCT,
657
657
  status: ORDER_STATUS.PENDING,
658
658
  packageId: releaseGood?.packageId,
659
659
  storeName: releaseGood?.storeName,
@@ -931,26 +931,6 @@ export async function confirmReleaseGood(name: string, context: any, tx?: Entity
931
931
 
932
932
  const orderSource: string = foundReleaseGood.source
933
933
  switch (orderSource) {
934
- case ApplicationType.SELLERCRAFT:
935
- if (foundReleaseGood.type == 'b2c' && sellercraft) {
936
- try {
937
- let rg = await sellercraftCtrl.packOrder(sellercraft, {
938
- ...foundReleaseGood,
939
- orderProducts: foundOPs
940
- })
941
- foundReleaseGood = rg
942
- } catch (error) {
943
- logger.error(
944
- `release-good-mutation[confirmReleaseGood]:(data:${JSON.stringify({
945
- sellercraft,
946
- foundReleaseGood,
947
- domain,
948
- user
949
- })}) ${error} `
950
- )
951
- }
952
- }
953
- break
954
934
 
955
935
  case ApplicationType.MMS:
956
936
  // find for any existing marketplace store connections
@@ -477,6 +477,10 @@ export class ReleaseGood {
477
477
  @Field({ nullable: true })
478
478
  source: string
479
479
 
480
+ @Column({ nullable: true })
481
+ @Field({ nullable: true })
482
+ orderSourceType: string
483
+
480
484
  @Column({ nullable: true })
481
485
  @Field({ nullable: true })
482
486
  manifestedAt: Date
package/LICENSE.md DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) Hatiolab
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.