@things-factory/worksheet-base 4.3.516 → 4.3.520
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.
- package/dist-server/controllers/outbound/packing-worksheet-controller.js +7 -0
- package/dist-server/controllers/outbound/packing-worksheet-controller.js.map +1 -1
- package/dist-server/graphql/resolvers/worksheet/confirm-cancellation-release-order.js +11 -4
- package/dist-server/graphql/resolvers/worksheet/confirm-cancellation-release-order.js.map +1 -1
- package/dist-server/graphql/resolvers/worksheet/packing-worksheet.js +3 -0
- package/dist-server/graphql/resolvers/worksheet/packing-worksheet.js.map +1 -1
- package/dist-server/graphql/resolvers/worksheet/picking/complete-batch-picking.js +13 -12
- package/dist-server/graphql/resolvers/worksheet/picking/complete-batch-picking.js.map +1 -1
- package/dist-server/graphql/resolvers/worksheet/picking/complete-picking.js +17 -14
- package/dist-server/graphql/resolvers/worksheet/picking/complete-picking.js.map +1 -1
- package/dist-server/graphql/resolvers/worksheet/putaway/complete-putaway.js +56 -69
- package/dist-server/graphql/resolvers/worksheet/putaway/complete-putaway.js.map +1 -1
- package/dist-server/graphql/resolvers/worksheet/putaway-return/complete-putaway-return.js +7 -2
- package/dist-server/graphql/resolvers/worksheet/putaway-return/complete-putaway-return.js.map +1 -1
- package/package.json +18 -18
- package/server/controllers/outbound/packing-worksheet-controller.ts +8 -0
- package/server/graphql/resolvers/worksheet/confirm-cancellation-release-order.ts +15 -6
- package/server/graphql/resolvers/worksheet/packing-worksheet.ts +4 -1
- package/server/graphql/resolvers/worksheet/picking/complete-batch-picking.ts +17 -14
- package/server/graphql/resolvers/worksheet/picking/complete-picking.ts +21 -18
- package/server/graphql/resolvers/worksheet/putaway/complete-putaway.ts +67 -87
- package/server/graphql/resolvers/worksheet/putaway-return/complete-putaway-return.ts +8 -4
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { EntityManager } from 'typeorm'
|
|
1
|
+
import { EntityManager, In } from 'typeorm'
|
|
2
2
|
|
|
3
3
|
import { Application, ApplicationType, User } from '@things-factory/auth-base'
|
|
4
4
|
import { MarketplaceStore } from '@things-factory/integration-marketplace'
|
|
5
5
|
import { Sellercraft, SellercraftStatus } from '@things-factory/integration-sellercraft'
|
|
6
6
|
import { ArrivalNotice, PowrupController } from '@things-factory/sales-base'
|
|
7
|
+
import { WebspertController } from '@things-factory/warehouse-base'
|
|
7
8
|
import { Domain } from '@things-factory/shell'
|
|
8
9
|
import { Bizplace, getCompanyBizplace } from '@things-factory/biz-base'
|
|
9
10
|
|
|
@@ -13,92 +14,71 @@ import { Worksheet } from '../../../../entities'
|
|
|
13
14
|
|
|
14
15
|
export const completePutawayResolver = {
|
|
15
16
|
async completePutaway(_: any, { arrivalNoticeNo }, context: any) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
.findOne({ domain: companyBizplace.domain, status: 'ACTIVE', type: ApplicationType.POWRUP })
|
|
82
|
-
|
|
83
|
-
if (sellercraft) {
|
|
84
|
-
const sellercraftCtrl: SellercraftController = new SellercraftController(tx, domain, user)
|
|
85
|
-
|
|
86
|
-
// allow async run to skip user wait time
|
|
87
|
-
sellercraftCtrl.registerProductInbound(sellercraft, arrivalNotice)
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
if (marketplaceStores?.length && marketplaceStores.some(store => store.isAutoUpdateStockQty)) {
|
|
91
|
-
const ecommerceCtrl: EcommerceController = new EcommerceController(tx, domain, user)
|
|
92
|
-
|
|
93
|
-
// allow async run to skip user wait time
|
|
94
|
-
ecommerceCtrl.updateProductVariationStock(marketplaceStores, arrivalNotice.orderProducts, companyDomain)
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
if (application) {
|
|
98
|
-
const powrupController: PowrupController = new PowrupController()
|
|
99
|
-
|
|
100
|
-
// allow async run to skip user wait time
|
|
101
|
-
powrupController.updateStock(arrivalNotice.orderProducts, customerDomain, user)
|
|
17
|
+
try {
|
|
18
|
+
const { tx, user, domain }: { tx: EntityManager; user: User; domain: Domain } = context.state
|
|
19
|
+
await completePutaway(tx, domain, user, arrivalNoticeNo)
|
|
20
|
+
|
|
21
|
+
const arrivalNotice: ArrivalNotice = await tx.getRepository(ArrivalNotice).findOne({
|
|
22
|
+
where: { domain, name: arrivalNoticeNo },
|
|
23
|
+
relations: [
|
|
24
|
+
'purchaseOrder',
|
|
25
|
+
'bizplace',
|
|
26
|
+
'bizplace.domain',
|
|
27
|
+
'bizplace.company',
|
|
28
|
+
'bizplace.company.domain',
|
|
29
|
+
'orderProducts',
|
|
30
|
+
'orderProducts.product',
|
|
31
|
+
'orderProducts.product.productDetails',
|
|
32
|
+
'orderProducts.product.productDetails.childProductDetail',
|
|
33
|
+
'orderProducts.productDetail'
|
|
34
|
+
]
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
// search for any active marketplace connection
|
|
38
|
+
const companyDomain: Domain = arrivalNotice.bizplace.company.domain
|
|
39
|
+
const customerDomain: Domain = arrivalNotice.bizplace.domain
|
|
40
|
+
const customerBizplaceId: string = arrivalNotice.bizplace.id
|
|
41
|
+
const companyBizplace: Bizplace = await getCompanyBizplace(domain, null, customerBizplaceId, tx)
|
|
42
|
+
|
|
43
|
+
const marketplaceStores: MarketplaceStore[] = await tx.getRepository(MarketplaceStore).find({
|
|
44
|
+
where: { domain: companyDomain, status: 'ACTIVE', isAutoUpdateStockQty: true },
|
|
45
|
+
relations: ['marketplaceDistributors']
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
const sellercraft: Sellercraft = await tx
|
|
49
|
+
.getRepository(Sellercraft)
|
|
50
|
+
.findOne({ domain: customerDomain, status: SellercraftStatus.ACTIVE })
|
|
51
|
+
|
|
52
|
+
if (sellercraft) {
|
|
53
|
+
const sellercraftCtrl: SellercraftController = new SellercraftController(tx, domain, user)
|
|
54
|
+
|
|
55
|
+
// allow async run to skip user wait time
|
|
56
|
+
sellercraftCtrl.registerProductInbound(sellercraft, arrivalNotice)
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
if (marketplaceStores?.length && marketplaceStores.some(store => store.isAutoUpdateStockQty)) {
|
|
60
|
+
const ecommerceCtrl: EcommerceController = new EcommerceController(tx, domain, user)
|
|
61
|
+
|
|
62
|
+
// allow async run to skip user wait time
|
|
63
|
+
ecommerceCtrl.updateProductVariationStock(marketplaceStores, arrivalNotice.orderProducts, companyDomain)
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const application: Application[] = await tx.getRepository(Application).find({
|
|
67
|
+
domain: companyBizplace.domain,
|
|
68
|
+
status: 'ACTIVE',
|
|
69
|
+
type: In([ApplicationType.POWRUP, ApplicationType.WEBSPERT])
|
|
70
|
+
})
|
|
71
|
+
|
|
72
|
+
if (application.find(app => app.type == ApplicationType.POWRUP)) {
|
|
73
|
+
const powrupController: PowrupController = new PowrupController()
|
|
74
|
+
powrupController.updateStock(arrivalNotice.orderProducts, customerDomain, user)
|
|
75
|
+
}
|
|
76
|
+
if (application.find(app => app.type == ApplicationType.WEBSPERT)) {
|
|
77
|
+
WebspertController.updateStock(arrivalNotice.orderProducts.map(op => op.productDetail), arrivalNotice.bizplace, domain, user, tx)
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
} catch (error) {
|
|
81
|
+
throw error
|
|
102
82
|
}
|
|
103
83
|
}
|
|
104
84
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { EntityManager } from 'typeorm'
|
|
1
|
+
import { EntityManager, In } from 'typeorm'
|
|
2
2
|
|
|
3
3
|
import { Application, ApplicationType, User } from '@things-factory/auth-base'
|
|
4
4
|
import { Sellercraft, SellercraftStatus } from '@things-factory/integration-sellercraft'
|
|
5
5
|
import { ReturnOrder, PowrupController } from '@things-factory/sales-base'
|
|
6
|
+
import { WebspertController } from '@things-factory/warehouse-base'
|
|
6
7
|
import { Domain } from '@things-factory/shell'
|
|
7
8
|
import { Bizplace, getCompanyBizplace } from '@things-factory/biz-base'
|
|
8
9
|
|
|
@@ -35,19 +36,22 @@ export const completePutawayReturnResolver = {
|
|
|
35
36
|
|
|
36
37
|
const customerBizplaceId: string = returnOrder.bizplace.id
|
|
37
38
|
const companyBizplace: Bizplace = await getCompanyBizplace(domain, null, customerBizplaceId, tx)
|
|
38
|
-
const application: Application = await tx
|
|
39
|
+
const application: Application[] = await tx
|
|
39
40
|
.getRepository(Application)
|
|
40
|
-
.
|
|
41
|
+
.find({ domain: companyBizplace.domain, status: 'ACTIVE', type: In([ApplicationType.POWRUP, ApplicationType.WEBSPERT]) })
|
|
41
42
|
|
|
42
43
|
if (sellercraft) {
|
|
43
44
|
const sellercraftCtrl: SellercraftController = new SellercraftController(tx, domain, user)
|
|
44
45
|
await sellercraftCtrl.registerProductReturn(sellercraft, returnOrder)
|
|
45
46
|
}
|
|
46
47
|
|
|
47
|
-
if (application) {
|
|
48
|
+
if (application.find(app => app.type == ApplicationType.POWRUP)) {
|
|
48
49
|
const powrupController: PowrupController = new PowrupController()
|
|
49
50
|
powrupController.updateStock(returnOrder.orderInventories, customerDomain, user, tx)
|
|
50
51
|
}
|
|
52
|
+
if (application.find(app => app.type == ApplicationType.WEBSPERT)) {
|
|
53
|
+
WebspertController.updateStock(returnOrder.orderInventories.map(oi => oi.productDetail), returnOrder.bizplace, domain, user, tx)
|
|
54
|
+
}
|
|
51
55
|
}
|
|
52
56
|
}
|
|
53
57
|
|