@things-factory/worksheet-base 4.3.88 → 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.
- package/dist-server/controllers/ecommerce/ecommerce-controller.js +1 -1
- package/dist-server/controllers/ecommerce/ecommerce-controller.js.map +1 -1
- package/dist-server/controllers/inbound/unloading-worksheet-controller.js +87 -71
- package/dist-server/controllers/inbound/unloading-worksheet-controller.js.map +1 -1
- package/dist-server/controllers/inspect/cycle-count-worksheet-controller.js +2 -4
- package/dist-server/controllers/inspect/cycle-count-worksheet-controller.js.map +1 -1
- package/dist-server/controllers/outbound/loading-worksheet-controller.js +10 -4
- package/dist-server/controllers/outbound/loading-worksheet-controller.js.map +1 -1
- package/dist-server/controllers/outbound/packing-worksheet-controller.js +47 -33
- package/dist-server/controllers/outbound/packing-worksheet-controller.js.map +1 -1
- package/dist-server/controllers/outbound/picking-worksheet-controller.js +78 -48
- package/dist-server/controllers/outbound/picking-worksheet-controller.js.map +1 -1
- package/dist-server/controllers/outbound/sorting-worksheet-controller.js +12 -14
- package/dist-server/controllers/outbound/sorting-worksheet-controller.js.map +1 -1
- package/dist-server/controllers/vas/vas-worksheet-controller.js +1 -2
- package/dist-server/controllers/vas/vas-worksheet-controller.js.map +1 -1
- package/dist-server/controllers/worksheet-controller.js +3 -8
- package/dist-server/controllers/worksheet-controller.js.map +1 -1
- package/dist-server/entities/index.js +3 -2
- package/dist-server/entities/index.js.map +1 -1
- package/dist-server/entities/warehouse-bizplace-onhand-inventory.js +29 -62
- package/dist-server/entities/warehouse-bizplace-onhand-inventory.js.map +1 -1
- package/dist-server/graphql/resolvers/worksheet/batch-picking-worksheet.js +6 -0
- package/dist-server/graphql/resolvers/worksheet/batch-picking-worksheet.js.map +1 -1
- package/dist-server/graphql/resolvers/worksheet/confirm-cancellation-release-order.js +1 -2
- package/dist-server/graphql/resolvers/worksheet/confirm-cancellation-release-order.js.map +1 -1
- package/dist-server/graphql/resolvers/worksheet/cycle-count-adjustment.js +6 -6
- package/dist-server/graphql/resolvers/worksheet/cycle-count-adjustment.js.map +1 -1
- package/dist-server/graphql/resolvers/worksheet/delivery-order-by-worksheet.js +7 -4
- package/dist-server/graphql/resolvers/worksheet/delivery-order-by-worksheet.js.map +1 -1
- package/dist-server/graphql/resolvers/worksheet/inventories-by-pallet.js +2 -1
- package/dist-server/graphql/resolvers/worksheet/inventories-by-pallet.js.map +1 -1
- package/dist-server/graphql/resolvers/worksheet/loading/complete-loading.js +67 -28
- package/dist-server/graphql/resolvers/worksheet/loading/complete-loading.js.map +1 -1
- package/dist-server/graphql/resolvers/worksheet/packing/activate-packing.js +23 -8
- package/dist-server/graphql/resolvers/worksheet/packing/activate-packing.js.map +1 -1
- package/dist-server/graphql/resolvers/worksheet/packing/complete-packing.js +30 -7
- package/dist-server/graphql/resolvers/worksheet/packing/complete-packing.js.map +1 -1
- package/dist-server/graphql/resolvers/worksheet/packing/packing.js +23 -8
- package/dist-server/graphql/resolvers/worksheet/packing/packing.js.map +1 -1
- package/dist-server/graphql/resolvers/worksheet/packing/scan-product-packing.js +25 -8
- package/dist-server/graphql/resolvers/worksheet/packing/scan-product-packing.js.map +1 -1
- package/dist-server/graphql/resolvers/worksheet/packing-worksheet.js +60 -12
- package/dist-server/graphql/resolvers/worksheet/packing-worksheet.js.map +1 -1
- package/dist-server/graphql/resolvers/worksheet/picking/activate-picking.js +51 -25
- package/dist-server/graphql/resolvers/worksheet/picking/activate-picking.js.map +1 -1
- package/dist-server/graphql/resolvers/worksheet/picking/complete-batch-picking.js +37 -29
- package/dist-server/graphql/resolvers/worksheet/picking/complete-batch-picking.js.map +1 -1
- package/dist-server/graphql/resolvers/worksheet/picking/complete-picking.js +132 -118
- package/dist-server/graphql/resolvers/worksheet/picking/complete-picking.js.map +1 -1
- package/dist-server/graphql/resolvers/worksheet/picking-worksheet.js +3 -2
- package/dist-server/graphql/resolvers/worksheet/picking-worksheet.js.map +1 -1
- package/dist-server/graphql/resolvers/worksheet/proceed-extra-products.js +6 -4
- package/dist-server/graphql/resolvers/worksheet/proceed-extra-products.js.map +1 -1
- package/dist-server/graphql/resolvers/worksheet/putaway/complete-putaway.js +39 -14
- package/dist-server/graphql/resolvers/worksheet/putaway/complete-putaway.js.map +1 -1
- package/dist-server/graphql/resolvers/worksheet/transfer.js +9 -9
- package/dist-server/graphql/resolvers/worksheet/transfer.js.map +1 -1
- package/dist-server/graphql/resolvers/worksheet/vas-transactions/common-utils.js +17 -17
- package/dist-server/graphql/resolvers/worksheet/vas-transactions/common-utils.js.map +1 -1
- package/dist-server/graphql/resolvers/worksheet-detail/regenerate-release-good-worksheet-details.js +4 -4
- package/dist-server/graphql/resolvers/worksheet-detail/regenerate-release-good-worksheet-details.js.map +1 -1
- package/dist-server/graphql/types/worksheet/delivery-order-info.js +1 -0
- package/dist-server/graphql/types/worksheet/delivery-order-info.js.map +1 -1
- package/dist-server/graphql/types/worksheet-detail/index.js +1 -0
- package/dist-server/graphql/types/worksheet-detail/index.js.map +1 -1
- package/dist-server/utils/inventory-util.js +1 -98
- package/dist-server/utils/inventory-util.js.map +1 -1
- package/package.json +17 -17
- package/server/controllers/ecommerce/ecommerce-controller.ts +1 -1
- package/server/controllers/inbound/unloading-worksheet-controller.ts +102 -84
- package/server/controllers/inspect/cycle-count-worksheet-controller.ts +2 -4
- package/server/controllers/outbound/loading-worksheet-controller.ts +9 -3
- package/server/controllers/outbound/packing-worksheet-controller.ts +56 -45
- package/server/controllers/outbound/picking-worksheet-controller.ts +98 -66
- package/server/controllers/outbound/sorting-worksheet-controller.ts +12 -12
- package/server/controllers/vas/vas-worksheet-controller.ts +2 -2
- package/server/controllers/worksheet-controller.ts +18 -23
- package/server/entities/index.ts +2 -2
- package/server/entities/warehouse-bizplace-onhand-inventory.ts +29 -63
- package/server/graphql/resolvers/worksheet/batch-picking-worksheet.ts +6 -0
- package/server/graphql/resolvers/worksheet/confirm-cancellation-release-order.ts +1 -2
- package/server/graphql/resolvers/worksheet/cycle-count-adjustment.ts +2 -2
- package/server/graphql/resolvers/worksheet/delivery-order-by-worksheet.ts +7 -6
- package/server/graphql/resolvers/worksheet/inventories-by-pallet.ts +3 -1
- package/server/graphql/resolvers/worksheet/loading/complete-loading.ts +77 -33
- package/server/graphql/resolvers/worksheet/packing/activate-packing.ts +26 -9
- package/server/graphql/resolvers/worksheet/packing/complete-packing.ts +34 -9
- package/server/graphql/resolvers/worksheet/packing/packing.ts +26 -9
- package/server/graphql/resolvers/worksheet/packing/scan-product-packing.ts +28 -9
- package/server/graphql/resolvers/worksheet/packing-worksheet.ts +69 -13
- package/server/graphql/resolvers/worksheet/picking/activate-picking.ts +60 -30
- package/server/graphql/resolvers/worksheet/picking/complete-batch-picking.ts +46 -40
- package/server/graphql/resolvers/worksheet/picking/complete-picking.ts +142 -131
- package/server/graphql/resolvers/worksheet/picking-worksheet.ts +3 -2
- package/server/graphql/resolvers/worksheet/proceed-extra-products.ts +5 -4
- package/server/graphql/resolvers/worksheet/putaway/complete-putaway.ts +45 -15
- package/server/graphql/resolvers/worksheet/transfer.ts +18 -16
- package/server/graphql/resolvers/worksheet/vas-transactions/common-utils.ts +3 -2
- package/server/graphql/resolvers/worksheet-detail/regenerate-release-good-worksheet-details.ts +4 -1
- package/server/graphql/types/worksheet/delivery-order-info.ts +1 -0
- package/server/graphql/types/worksheet-detail/index.ts +1 -0
- package/server/utils/inventory-util.ts +1 -126
|
@@ -32,6 +32,7 @@ export const batchPickingWorksheetResolver = {
|
|
|
32
32
|
.addSelect('"PROD".name', 'productName')
|
|
33
33
|
.addSelect('"PROD".sku', 'productSku')
|
|
34
34
|
.addSelect('"PROD".description', 'productDescription')
|
|
35
|
+
.addSelect('"PROD_DET".id', 'productDetailId')
|
|
35
36
|
.addSelect('"INV".qty', 'qty')
|
|
36
37
|
.addSelect('"INV".packing_type', 'packingType')
|
|
37
38
|
.addSelect('"INV".packing_size', 'packingSize')
|
|
@@ -47,6 +48,7 @@ export const batchPickingWorksheetResolver = {
|
|
|
47
48
|
.leftJoin('WSD.targetInventory', 'T_INV')
|
|
48
49
|
.leftJoin('T_INV.inventory', 'INV')
|
|
49
50
|
.leftJoin('T_INV.product', 'PROD')
|
|
51
|
+
.leftJoin('T_INV.productDetail', 'PROD_DET')
|
|
50
52
|
.leftJoin('T_INV.binLocation', 'BIN_LOC')
|
|
51
53
|
.leftJoin('INV.location', 'LOC')
|
|
52
54
|
.where('"WSD"."worksheet_id" = :worksheetId', { worksheetId: worksheet.id })
|
|
@@ -64,6 +66,7 @@ export const batchPickingWorksheetResolver = {
|
|
|
64
66
|
.addGroupBy('"PROD".name')
|
|
65
67
|
.addGroupBy('"PROD".sku')
|
|
66
68
|
.addGroupBy('"PROD".description')
|
|
69
|
+
.addGroupBy('"PROD_DET".id')
|
|
67
70
|
.addGroupBy('"T_INV".batch_id')
|
|
68
71
|
.addGroupBy('"T_INV".packing_type')
|
|
69
72
|
.addGroupBy('BIN_LOC.name')
|
|
@@ -126,6 +129,9 @@ export const batchPickingWorksheetResolver = {
|
|
|
126
129
|
name: item?.productName,
|
|
127
130
|
description: item?.productDescription,
|
|
128
131
|
sku: item?.productSku
|
|
132
|
+
},
|
|
133
|
+
productDetail: {
|
|
134
|
+
id: item?.productDetailId
|
|
129
135
|
}
|
|
130
136
|
}
|
|
131
137
|
}
|
|
@@ -11,10 +11,9 @@ import {
|
|
|
11
11
|
ReleaseGood
|
|
12
12
|
} from '@things-factory/sales-base'
|
|
13
13
|
import { Domain } from '@things-factory/shell'
|
|
14
|
-
import { Inventory, INVENTORY_STATUS, INVENTORY_TRANSACTION_TYPE, Location } from '@things-factory/warehouse-base'
|
|
14
|
+
import { Inventory, INVENTORY_STATUS, INVENTORY_TRANSACTION_TYPE, Location, generateInventoryHistory } from '@things-factory/warehouse-base'
|
|
15
15
|
|
|
16
16
|
import { Worksheet, WorksheetDetail } from '../../../entities'
|
|
17
|
-
import { generateInventoryHistory } from '../../../utils'
|
|
18
17
|
|
|
19
18
|
export const confirmCancellationReleaseOrder = {
|
|
20
19
|
async confirmCancellationReleaseOrder(_: any, { name }, context: any) {
|
|
@@ -4,12 +4,12 @@ import { User } from '@things-factory/auth-base'
|
|
|
4
4
|
import { Sellercraft, SellercraftStatus } from '@things-factory/integration-sellercraft'
|
|
5
5
|
import { InventoryCheck, ORDER_INVENTORY_STATUS, ORDER_STATUS, OrderInventory } from '@things-factory/sales-base'
|
|
6
6
|
import { Domain } from '@things-factory/shell'
|
|
7
|
-
import { Inventory, INVENTORY_STATUS, INVENTORY_TRANSACTION_TYPE, Location } from '@things-factory/warehouse-base'
|
|
7
|
+
import { Inventory, INVENTORY_STATUS, INVENTORY_TRANSACTION_TYPE, Location, generateInventoryHistory } from '@things-factory/warehouse-base'
|
|
8
8
|
|
|
9
9
|
import { WORKSHEET_STATUS, WORKSHEET_TYPE } from '../../../constants'
|
|
10
10
|
import { SellercraftController } from '../../../controllers'
|
|
11
11
|
import { Worksheet, WorksheetDetail } from '../../../entities'
|
|
12
|
-
import {
|
|
12
|
+
import { switchLocationStatus } from '../../../utils'
|
|
13
13
|
|
|
14
14
|
export const cycleCountAdjustmentResolver = {
|
|
15
15
|
async cycleCountAdjustment(_: any, { cycleCountNo }, context: any) {
|
|
@@ -7,7 +7,7 @@ import { logger } from '@things-factory/env'
|
|
|
7
7
|
|
|
8
8
|
export const deliveryOrderByWorksheetResolver = {
|
|
9
9
|
async deliveryOrderByWorksheet(_: any, { name }, context: any) {
|
|
10
|
-
const { domain, tx }: { domain: Domain
|
|
10
|
+
const { domain, tx }: { domain: Domain; tx: EntityManager } = context.state
|
|
11
11
|
try {
|
|
12
12
|
const foundDO: DeliveryOrder = await tx.getRepository(DeliveryOrder).findOne({
|
|
13
13
|
where: {
|
|
@@ -19,7 +19,9 @@ export const deliveryOrderByWorksheetResolver = {
|
|
|
19
19
|
|
|
20
20
|
if (!foundDO) throw new Error('Delivery order not found!')
|
|
21
21
|
|
|
22
|
-
const foundOI: any = await tx
|
|
22
|
+
const foundOI: any = await tx
|
|
23
|
+
.getRepository(OrderInventory)
|
|
24
|
+
.createQueryBuilder('oi')
|
|
23
25
|
.select('p.name', 'name')
|
|
24
26
|
.addSelect('p.sku', 'sku')
|
|
25
27
|
.addSelect('p.type', 'type')
|
|
@@ -74,10 +76,10 @@ export const deliveryOrderByWorksheetResolver = {
|
|
|
74
76
|
reusablePallet: foundDO.reusablePallet || '',
|
|
75
77
|
createdDate: foundDO.createdAt.toISOString().split('T')[0],
|
|
76
78
|
isManualDo: foundDO.releaseGood ? false : true,
|
|
77
|
-
attentionTo: foundDO.attentionTo,
|
|
79
|
+
attentionTo: foundDO.attentionTo || '',
|
|
78
80
|
releaseGood: {
|
|
79
81
|
...foundDO.releaseGood,
|
|
80
|
-
attentionTo: foundDO.attentionTo || foundDO.releaseGood
|
|
82
|
+
attentionTo: foundDO.attentionTo || foundDO.releaseGood?.attentionTo,
|
|
81
83
|
bizplace: partnerBiz
|
|
82
84
|
},
|
|
83
85
|
productList: foundOI
|
|
@@ -91,12 +93,11 @@ export const deliveryOrderByWorksheetResolver = {
|
|
|
91
93
|
phone: cp.phone || '',
|
|
92
94
|
contactName: cp.name || ''
|
|
93
95
|
}
|
|
94
|
-
})
|
|
96
|
+
})
|
|
95
97
|
}
|
|
96
98
|
} catch (error) {
|
|
97
99
|
logger.error(`delivery-order-by-worksheet:(data:${JSON.stringify({ name, domain })}) ${error} `)
|
|
98
100
|
throw new Error('Something went wrong. Please contact support.')
|
|
99
101
|
}
|
|
100
|
-
|
|
101
102
|
}
|
|
102
103
|
}
|
|
@@ -40,6 +40,7 @@ export const inventoriesByPalletResolver = {
|
|
|
40
40
|
qb.leftJoinAndSelect('iv.domain', 'domain')
|
|
41
41
|
.leftJoinAndSelect('iv.bizplace', 'bizplace')
|
|
42
42
|
.leftJoinAndSelect('iv.product', 'product')
|
|
43
|
+
.leftJoinAndSelect('iv.productDetail', 'productDetail')
|
|
43
44
|
.leftJoinAndSelect('iv.warehouse', 'warehouse')
|
|
44
45
|
.leftJoinAndSelect('iv.location', 'location')
|
|
45
46
|
.leftJoinAndSelect('iv.creator', 'creator')
|
|
@@ -134,7 +135,8 @@ export const inventoriesByPalletResolver = {
|
|
|
134
135
|
productName: item.product.name,
|
|
135
136
|
productSKU: item.product.sku,
|
|
136
137
|
productBrand: item.product.brand,
|
|
137
|
-
productId: item.product.id
|
|
138
|
+
productId: item.product.id,
|
|
139
|
+
productDetailId: item.productDetail.id
|
|
138
140
|
}
|
|
139
141
|
})
|
|
140
142
|
)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EntityManager } from 'typeorm'
|
|
2
2
|
|
|
3
|
-
import { User } from '@things-factory/auth-base'
|
|
3
|
+
import { ApplicationType, User } from '@things-factory/auth-base'
|
|
4
4
|
import { Bizplace, Company } from '@things-factory/biz-base'
|
|
5
5
|
import { FulfillmentCenter } from '@things-factory/integration-fulfillment'
|
|
6
6
|
import { Sftp, SftpAPI } from '@things-factory/integration-sftp'
|
|
@@ -58,42 +58,86 @@ export async function completeLoading(
|
|
|
58
58
|
const warehouseCompanyBizplaces: Bizplace[] = warehouseBizplaces.filter(biz => biz.domain.extType == 'company')
|
|
59
59
|
const warehouseCompanyDomain: Domain = warehouseCompanyBizplaces[0].domain
|
|
60
60
|
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
.
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
let inventoryItems: InventoryItem[] = await tx.getRepository(InventoryItem).find({
|
|
74
|
-
where: { domain, outboundOrderId: releaseGood.id }
|
|
75
|
-
})
|
|
76
|
-
|
|
77
|
-
// if (responseFileTypes.enableShipment) {
|
|
78
|
-
// let shipmentResult: Sftp = await SftpAPI.createShipment(customerAvailableSftp, {
|
|
79
|
-
// releaseGood,
|
|
80
|
-
// orderInventories: targetInventories,
|
|
81
|
-
// sftp: customerAvailableSftp
|
|
82
|
-
// })
|
|
83
|
-
// customerAvailableSftp = await tx.getRepository(Sftp).save(shipmentResult)
|
|
84
|
-
// }
|
|
85
|
-
|
|
86
|
-
if (responseFileTypes.enableSerialNumber) {
|
|
87
|
-
let snResult: Sftp = await SftpAPI.createSerialNumber(customerAvailableSftp, {
|
|
88
|
-
releaseGood,
|
|
89
|
-
inventoryItems,
|
|
90
|
-
sftp: customerAvailableSftp
|
|
61
|
+
const orderSource: string = releaseGood.source
|
|
62
|
+
switch (orderSource) {
|
|
63
|
+
case ApplicationType.SFTP:
|
|
64
|
+
const customerDomain: Domain = releaseGood.bizplace.domain
|
|
65
|
+
const fulfillmentCenter: FulfillmentCenter = await tx
|
|
66
|
+
.getRepository(FulfillmentCenter)
|
|
67
|
+
.findOne({ domain: warehouseCompanyDomain, centerId: domain.subdomain, status: 'active' })
|
|
68
|
+
|
|
69
|
+
if (fulfillmentCenter) {
|
|
70
|
+
let customerAvailableSftp: Sftp = await tx.getRepository(Sftp).findOne({
|
|
71
|
+
where: { domain: customerDomain, status: 'ACTIVE', fulfillmentCenter }
|
|
91
72
|
})
|
|
92
|
-
|
|
73
|
+
if (customerAvailableSftp) {
|
|
74
|
+
const responseFileTypes: any = JSON.parse(customerAvailableSftp.responseFileTypes)
|
|
75
|
+
|
|
76
|
+
let inventoryItems: InventoryItem[] = await tx.getRepository(InventoryItem).find({
|
|
77
|
+
where: { domain, outboundOrderId: releaseGood.id }
|
|
78
|
+
})
|
|
79
|
+
|
|
80
|
+
// if (responseFileTypes.enableShipment) {
|
|
81
|
+
// let shipmentResult: Sftp = await SftpAPI.createShipment(customerAvailableSftp, {
|
|
82
|
+
// releaseGood,
|
|
83
|
+
// orderInventories: targetInventories,
|
|
84
|
+
// sftp: customerAvailableSftp
|
|
85
|
+
// })
|
|
86
|
+
// customerAvailableSftp = await tx.getRepository(Sftp).save(shipmentResult)
|
|
87
|
+
// }
|
|
88
|
+
|
|
89
|
+
if (responseFileTypes.enableSerialNumber) {
|
|
90
|
+
let snResult: Sftp = await SftpAPI.createSerialNumber(customerAvailableSftp, {
|
|
91
|
+
releaseGood,
|
|
92
|
+
inventoryItems,
|
|
93
|
+
sftp: customerAvailableSftp
|
|
94
|
+
})
|
|
95
|
+
customerAvailableSftp = await tx.getRepository(Sftp).save(snResult)
|
|
96
|
+
}
|
|
97
|
+
}
|
|
93
98
|
}
|
|
94
|
-
|
|
99
|
+
break
|
|
100
|
+
|
|
101
|
+
default:
|
|
102
|
+
break
|
|
95
103
|
}
|
|
96
104
|
|
|
105
|
+
// const customerDomain: Domain = releaseGood.bizplace.domain
|
|
106
|
+
// const fulfillmentCenter: FulfillmentCenter = await tx
|
|
107
|
+
// .getRepository(FulfillmentCenter)
|
|
108
|
+
// .findOne({ domain: warehouseCompanyDomain, centerId: domain.subdomain, status: 'active' })
|
|
109
|
+
|
|
110
|
+
// if (fulfillmentCenter) {
|
|
111
|
+
// let customerAvailableSftp: Sftp = await tx.getRepository(Sftp).findOne({
|
|
112
|
+
// where: { domain: customerDomain, status: 'ACTIVE', fulfillmentCenter }
|
|
113
|
+
// })
|
|
114
|
+
// if (customerAvailableSftp) {
|
|
115
|
+
// const responseFileTypes: any = JSON.parse(customerAvailableSftp.responseFileTypes)
|
|
116
|
+
|
|
117
|
+
// let inventoryItems: InventoryItem[] = await tx.getRepository(InventoryItem).find({
|
|
118
|
+
// where: { domain, outboundOrderId: releaseGood.id }
|
|
119
|
+
// })
|
|
120
|
+
|
|
121
|
+
// // if (responseFileTypes.enableShipment) {
|
|
122
|
+
// // let shipmentResult: Sftp = await SftpAPI.createShipment(customerAvailableSftp, {
|
|
123
|
+
// // releaseGood,
|
|
124
|
+
// // orderInventories: targetInventories,
|
|
125
|
+
// // sftp: customerAvailableSftp
|
|
126
|
+
// // })
|
|
127
|
+
// // customerAvailableSftp = await tx.getRepository(Sftp).save(shipmentResult)
|
|
128
|
+
// // }
|
|
129
|
+
|
|
130
|
+
// if (responseFileTypes.enableSerialNumber) {
|
|
131
|
+
// let snResult: Sftp = await SftpAPI.createSerialNumber(customerAvailableSftp, {
|
|
132
|
+
// releaseGood,
|
|
133
|
+
// inventoryItems,
|
|
134
|
+
// sftp: customerAvailableSftp
|
|
135
|
+
// })
|
|
136
|
+
// customerAvailableSftp = await tx.getRepository(Sftp).save(snResult)
|
|
137
|
+
// }
|
|
138
|
+
// }
|
|
139
|
+
// }
|
|
140
|
+
|
|
97
141
|
await worksheetController.completeLoading(releaseGoodNo)
|
|
98
142
|
|
|
99
143
|
if (remainInventories.length) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EntityManager, getManager } from 'typeorm'
|
|
2
2
|
|
|
3
|
-
import { User } from '@things-factory/auth-base'
|
|
3
|
+
import { ApplicationType, User } from '@things-factory/auth-base'
|
|
4
4
|
import { Sellercraft, SellercraftStatus } from '@things-factory/integration-sellercraft'
|
|
5
5
|
import { ReleaseGood } from '@things-factory/sales-base'
|
|
6
6
|
import { Domain } from '@things-factory/shell'
|
|
@@ -38,15 +38,32 @@ export async function activatePacking(
|
|
|
38
38
|
const worksheet = await worksheetController.activatePacking(worksheetNo)
|
|
39
39
|
let releaseGood: ReleaseGood = worksheet.releaseGood
|
|
40
40
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
41
|
+
const orderSource: string = releaseGood.source
|
|
42
|
+
switch (orderSource) {
|
|
43
|
+
case ApplicationType.SELLERCRAFT:
|
|
44
|
+
const sellercraft: Sellercraft = await tx
|
|
45
|
+
.getRepository(Sellercraft)
|
|
46
|
+
.findOne({ domain: releaseGood.bizplace.domain, status: SellercraftStatus.ACTIVE })
|
|
45
47
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
if (sellercraft) {
|
|
49
|
+
const sellercraftCtrl: SellercraftController = new SellercraftController(tx, domain, user)
|
|
50
|
+
sellercraftCtrl.initiateOrderDocument(sellercraft, releaseGood)
|
|
51
|
+
}
|
|
52
|
+
break
|
|
53
|
+
|
|
54
|
+
default:
|
|
55
|
+
break
|
|
50
56
|
}
|
|
57
|
+
|
|
58
|
+
// if (releaseGood.type == 'b2c') {
|
|
59
|
+
// const sellercraft: Sellercraft = await tx
|
|
60
|
+
// .getRepository(Sellercraft)
|
|
61
|
+
// .findOne({ domain: releaseGood.bizplace.domain, status: SellercraftStatus.ACTIVE })
|
|
62
|
+
|
|
63
|
+
// if (sellercraft) {
|
|
64
|
+
// const sellercraftCtrl: SellercraftController = new SellercraftController(tx, domain, user)
|
|
65
|
+
// sellercraftCtrl.initiateOrderDocument(sellercraft, releaseGood)
|
|
66
|
+
// }
|
|
67
|
+
// }
|
|
51
68
|
return worksheet
|
|
52
69
|
}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { EntityManager } from 'typeorm'
|
|
2
2
|
|
|
3
|
-
import { User } from '@things-factory/auth-base'
|
|
3
|
+
import { ApplicationType, User } from '@things-factory/auth-base'
|
|
4
4
|
import { Bizplace, getMyBizplace } from '@things-factory/biz-base'
|
|
5
5
|
import { MarketplaceStore } from '@things-factory/integration-marketplace'
|
|
6
|
-
import { Sellercraft, SellercraftStatus } from '@things-factory/integration-sellercraft'
|
|
7
6
|
import { MarketplaceOrder } from '@things-factory/marketplace-base'
|
|
8
7
|
import { ReleaseGood } from '@things-factory/sales-base'
|
|
9
8
|
import { Domain } from '@things-factory/shell'
|
|
@@ -29,12 +28,9 @@ export const completePackingResolver = {
|
|
|
29
28
|
]
|
|
30
29
|
})
|
|
31
30
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
.findOne({ domain: releaseGood.bizplace.domain, status: SellercraftStatus.ACTIVE })
|
|
36
|
-
|
|
37
|
-
if (!sellercraft) {
|
|
31
|
+
const orderSource: string = releaseGood.source
|
|
32
|
+
switch (orderSource) {
|
|
33
|
+
case ApplicationType.MMS:
|
|
38
34
|
const companyDomain: Domain = releaseGood.bizplace.company.domain
|
|
39
35
|
const marketplaceOrder: MarketplaceOrder = await tx.getRepository(MarketplaceOrder).findOne({
|
|
40
36
|
where: { orderNo: releaseGood.refNo, domain: companyDomain },
|
|
@@ -52,9 +48,38 @@ export const completePackingResolver = {
|
|
|
52
48
|
const ecommerceCtrl: EcommerceController = new EcommerceController(tx, domain, user)
|
|
53
49
|
await ecommerceCtrl.createOrderShip(releaseGood, marketplaceStore, marketplaceOrder, companyDomain)
|
|
54
50
|
}
|
|
55
|
-
|
|
51
|
+
break
|
|
52
|
+
|
|
53
|
+
default:
|
|
54
|
+
break
|
|
56
55
|
}
|
|
57
56
|
|
|
57
|
+
// if (releaseGood.type === 'b2c') {
|
|
58
|
+
// const sellercraft: Sellercraft = await tx
|
|
59
|
+
// .getRepository(Sellercraft)
|
|
60
|
+
// .findOne({ domain: releaseGood.bizplace.domain, status: SellercraftStatus.ACTIVE })
|
|
61
|
+
|
|
62
|
+
// if (!sellercraft) {
|
|
63
|
+
// const companyDomain: Domain = releaseGood.bizplace.company.domain
|
|
64
|
+
// const marketplaceOrder: MarketplaceOrder = await tx.getRepository(MarketplaceOrder).findOne({
|
|
65
|
+
// where: { orderNo: releaseGood.refNo, domain: companyDomain },
|
|
66
|
+
// relations: [
|
|
67
|
+
// 'marketplaceOrderItems',
|
|
68
|
+
// 'marketplaceOrderItems.marketplaceOrderShippingItems',
|
|
69
|
+
// 'marketplaceOrderItems.marketplaceOrderShippingItems.marketplaceOrderShipping',
|
|
70
|
+
// 'marketplaceStore',
|
|
71
|
+
// 'marketplaceStore.marketplaceDistributors'
|
|
72
|
+
// ]
|
|
73
|
+
// })
|
|
74
|
+
// const marketplaceStore: MarketplaceStore = marketplaceOrder.marketplaceStore
|
|
75
|
+
|
|
76
|
+
// if (marketplaceStore.isAutoUpdateShipment) {
|
|
77
|
+
// const ecommerceCtrl: EcommerceController = new EcommerceController(tx, domain, user)
|
|
78
|
+
// await ecommerceCtrl.createOrderShip(releaseGood, marketplaceStore, marketplaceOrder, companyDomain)
|
|
79
|
+
// }
|
|
80
|
+
// }
|
|
81
|
+
// }
|
|
82
|
+
|
|
58
83
|
const bizplace: Bizplace = await getMyBizplace(domain, user)
|
|
59
84
|
const worksheetController: WorksheetController = new WorksheetController(tx, domain, user)
|
|
60
85
|
await worksheetController.notifyToCustomer(bizplace, {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EntityManager } from 'typeorm'
|
|
2
2
|
|
|
3
|
-
import { User } from '@things-factory/auth-base'
|
|
3
|
+
import { ApplicationType, User } from '@things-factory/auth-base'
|
|
4
4
|
import { Sellercraft, SellercraftStatus } from '@things-factory/integration-sellercraft'
|
|
5
5
|
import { ReleaseGood } from '@things-factory/sales-base'
|
|
6
6
|
import { Domain } from '@things-factory/shell'
|
|
@@ -29,14 +29,31 @@ export async function packing(
|
|
|
29
29
|
let releaseGood: ReleaseGood = worksheetDetail.targetInventory.releaseGood
|
|
30
30
|
const worksheet: Worksheet = worksheetDetail.worksheet
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
const orderSource: string = releaseGood.source
|
|
33
|
+
switch (orderSource) {
|
|
34
|
+
case ApplicationType.SELLERCRAFT:
|
|
35
|
+
const sellercraft: Sellercraft = await tx
|
|
36
|
+
.getRepository(Sellercraft)
|
|
37
|
+
.findOne({ domain: worksheet.bizplace.domain, status: SellercraftStatus.ACTIVE })
|
|
36
38
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
if (sellercraft) {
|
|
40
|
+
const sellercraftCtrl: SellercraftController = new SellercraftController(tx, domain, user)
|
|
41
|
+
await sellercraftCtrl.fetchOrderDocument(sellercraft, releaseGood)
|
|
42
|
+
}
|
|
43
|
+
break
|
|
44
|
+
|
|
45
|
+
default:
|
|
46
|
+
break
|
|
41
47
|
}
|
|
48
|
+
|
|
49
|
+
// if (releaseGood.type === 'b2c' && !releaseGood?.airwayBill) {
|
|
50
|
+
// const sellercraft: Sellercraft = await tx
|
|
51
|
+
// .getRepository(Sellercraft)
|
|
52
|
+
// .findOne({ domain: worksheet.bizplace.domain, status: SellercraftStatus.ACTIVE })
|
|
53
|
+
|
|
54
|
+
// if (sellercraft) {
|
|
55
|
+
// const sellercraftCtrl: SellercraftController = new SellercraftController(tx, domain, user)
|
|
56
|
+
// await sellercraftCtrl.fetchOrderDocument(sellercraft, releaseGood)
|
|
57
|
+
// }
|
|
58
|
+
// }
|
|
42
59
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EntityManager } from 'typeorm'
|
|
2
2
|
|
|
3
|
-
import { User } from '@things-factory/auth-base'
|
|
3
|
+
import { ApplicationType, User } from '@things-factory/auth-base'
|
|
4
4
|
import { Sellercraft, SellercraftStatus } from '@things-factory/integration-sellercraft'
|
|
5
5
|
import { ReleaseGood } from '@things-factory/sales-base'
|
|
6
6
|
import { Domain } from '@things-factory/shell'
|
|
@@ -34,17 +34,36 @@ export async function scanProductPacking(
|
|
|
34
34
|
let releaseGood: ReleaseGood = worksheetDetail.targetInventory.releaseGood
|
|
35
35
|
const worksheet: Worksheet = worksheetDetail.worksheet
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
const orderSource: string = releaseGood.source
|
|
38
|
+
switch (orderSource) {
|
|
39
|
+
case ApplicationType.SELLERCRAFT:
|
|
40
|
+
if (!releaseGood?.airwayBill) {
|
|
41
|
+
const sellercraft: Sellercraft = await tx
|
|
42
|
+
.getRepository(Sellercraft)
|
|
43
|
+
.findOne({ domain: worksheet.bizplace.domain, status: SellercraftStatus.ACTIVE })
|
|
41
44
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
45
|
+
if (sellercraft) {
|
|
46
|
+
const sellercraftCtrl: SellercraftController = new SellercraftController(tx, domain, user)
|
|
47
|
+
sellercraftCtrl.fetchOrderDocument(sellercraft, releaseGood)
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
break
|
|
52
|
+
|
|
53
|
+
default:
|
|
54
|
+
break
|
|
46
55
|
}
|
|
47
56
|
|
|
57
|
+
// if (releaseGood.type === 'b2c' && !releaseGood?.airwayBill) {
|
|
58
|
+
// const sellercraft: Sellercraft = await tx
|
|
59
|
+
// .getRepository(Sellercraft)
|
|
60
|
+
// .findOne({ domain: worksheet.bizplace.domain, status: SellercraftStatus.ACTIVE })
|
|
61
|
+
|
|
62
|
+
// if (sellercraft) {
|
|
63
|
+
// const sellercraftCtrl: SellercraftController = new SellercraftController(tx, domain, user)
|
|
64
|
+
// sellercraftCtrl.fetchOrderDocument(sellercraft, releaseGood)
|
|
65
|
+
// }
|
|
66
|
+
// }
|
|
48
67
|
} catch (error) {
|
|
49
68
|
throw error
|
|
50
69
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { EntityManager,
|
|
1
|
+
import { EntityManager, getManager, SelectQueryBuilder } from 'typeorm'
|
|
2
2
|
|
|
3
|
-
import { User } from '@things-factory/auth-base'
|
|
3
|
+
import { ApplicationType, User } from '@things-factory/auth-base'
|
|
4
4
|
import { logger } from '@things-factory/env'
|
|
5
5
|
import { Sellercraft, SellercraftStatus } from '@things-factory/integration-sellercraft'
|
|
6
6
|
import {
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
MarketplaceOrderShippingItem
|
|
11
11
|
} from '@things-factory/marketplace-base'
|
|
12
12
|
import { ORDER_INVENTORY_STATUS, ORDER_STATUS, OrderInventory, ReleaseGood } from '@things-factory/sales-base'
|
|
13
|
+
import { PartnerSetting, Setting } from '@things-factory/setting-base'
|
|
13
14
|
import { Domain } from '@things-factory/shell'
|
|
14
15
|
import { Inventory, Location } from '@things-factory/warehouse-base'
|
|
15
16
|
|
|
@@ -17,7 +18,6 @@ import { WORKSHEET_TYPE } from '../../../constants'
|
|
|
17
18
|
import { PackingWorksheetController, SellercraftController } from '../../../controllers'
|
|
18
19
|
import { Worksheet, WorksheetDetail } from '../../../entities'
|
|
19
20
|
import { fetchExecutingWorksheet } from '../../../utils'
|
|
20
|
-
import { PartnerSetting, Setting } from '@things-factory/setting-base'
|
|
21
21
|
|
|
22
22
|
export const packingWorksheetResolver = {
|
|
23
23
|
async packingWorksheet(_: any, { releaseGoodNo }, context: any) {
|
|
@@ -146,16 +146,21 @@ export const packingWorksheetResolver = {
|
|
|
146
146
|
let shippingProvider: string
|
|
147
147
|
let marketplaceStatus: string
|
|
148
148
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
149
|
+
const orderSource: string = releaseGood.source
|
|
150
|
+
switch (orderSource) {
|
|
151
|
+
case ApplicationType.SELLERCRAFT:
|
|
152
|
+
const sellercraft: Sellercraft = await tx.getRepository(Sellercraft).findOne({
|
|
153
|
+
domain: worksheet.bizplace.domain,
|
|
154
|
+
status: SellercraftStatus.ACTIVE
|
|
155
|
+
})
|
|
154
156
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
157
|
+
if (sellercraft) {
|
|
158
|
+
// asynchronously get document from sellercraft
|
|
159
|
+
getSellercraftDocument(sellercraft, releaseGood, domain, user)
|
|
160
|
+
}
|
|
161
|
+
break
|
|
162
|
+
|
|
163
|
+
case ApplicationType.MMS:
|
|
159
164
|
marketplaceOrder = await tx.getRepository(MarketplaceOrder).findOne({
|
|
160
165
|
where: { orderNo: releaseGood.refNo },
|
|
161
166
|
relations: [
|
|
@@ -191,9 +196,60 @@ export const packingWorksheetResolver = {
|
|
|
191
196
|
|
|
192
197
|
marketplaceStore = marketplaceOrder?.marketplaceStore
|
|
193
198
|
marketplaceStatus = marketplaceOrder?.status
|
|
194
|
-
|
|
199
|
+
break
|
|
200
|
+
|
|
201
|
+
default:
|
|
202
|
+
break
|
|
195
203
|
}
|
|
196
204
|
|
|
205
|
+
// if (releaseGood.type === 'b2c') {
|
|
206
|
+
// const sellercraft: Sellercraft = await tx.getRepository(Sellercraft).findOne({
|
|
207
|
+
// domain: worksheet.bizplace.domain,
|
|
208
|
+
// status: SellercraftStatus.ACTIVE
|
|
209
|
+
// })
|
|
210
|
+
|
|
211
|
+
// if (sellercraft) {
|
|
212
|
+
// // asynchronously get document from sellercraft
|
|
213
|
+
// getSellercraftDocument(sellercraft, releaseGood, domain, user)
|
|
214
|
+
// } else {
|
|
215
|
+
// marketplaceOrder = await tx.getRepository(MarketplaceOrder).findOne({
|
|
216
|
+
// where: { orderNo: releaseGood.refNo },
|
|
217
|
+
// relations: [
|
|
218
|
+
// 'domain',
|
|
219
|
+
// 'marketplaceStore',
|
|
220
|
+
// 'marketplaceOrderItems',
|
|
221
|
+
// 'marketplaceOrderItems.marketplaceOrderShippingItems',
|
|
222
|
+
// 'marketplaceOrderItems.marketplaceOrderShippingItems.marketplaceOrderShipping'
|
|
223
|
+
// ]
|
|
224
|
+
// })
|
|
225
|
+
|
|
226
|
+
// if (!marketplaceOrder) {
|
|
227
|
+
// throw new Error('Failed to retrieve ecommerce information, kindly contact our support team for this issue.')
|
|
228
|
+
// }
|
|
229
|
+
|
|
230
|
+
// let marketplaceOrderShipping: MarketplaceOrderShipping
|
|
231
|
+
// if (marketplaceOrder.isSplitted) {
|
|
232
|
+
// marketplaceOrderShipping = await tx.getRepository(MarketplaceOrderShipping).findOne({
|
|
233
|
+
// where: { subOrderNoRef: worksheet.releaseGood.refNo2 }
|
|
234
|
+
// })
|
|
235
|
+
// } else {
|
|
236
|
+
// marketplaceOrderShipping = await tx.getRepository(MarketplaceOrderShipping).findOne({
|
|
237
|
+
// where: { orderNoRef: worksheet.releaseGood.refNo }
|
|
238
|
+
// })
|
|
239
|
+
// }
|
|
240
|
+
|
|
241
|
+
// trackingNo = marketplaceOrderShipping.ownTrackingNo
|
|
242
|
+
// ? marketplaceOrderShipping.ownTrackingNo
|
|
243
|
+
// : marketplaceOrderShipping.trackingNo
|
|
244
|
+
// shippingProvider = marketplaceOrderShipping.ownTransporter
|
|
245
|
+
// ? marketplaceOrderShipping.ownTransporter
|
|
246
|
+
// : marketplaceOrderShipping.transporter
|
|
247
|
+
|
|
248
|
+
// marketplaceStore = marketplaceOrder?.marketplaceStore
|
|
249
|
+
// marketplaceStatus = marketplaceOrder?.status
|
|
250
|
+
// }
|
|
251
|
+
// }
|
|
252
|
+
|
|
197
253
|
return {
|
|
198
254
|
worksheetInfo: {
|
|
199
255
|
releaseGood,
|