@things-factory/worksheet-base 4.3.636 → 4.3.637
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/inbound/unloading-worksheet-controller.js +14 -24
- package/dist-server/controllers/inbound/unloading-worksheet-controller.js.map +1 -1
- package/dist-server/controllers/inspect/cycle-count-worksheet-controller.js +5 -1
- package/dist-server/controllers/inspect/cycle-count-worksheet-controller.js.map +1 -1
- package/dist-server/controllers/outbound/packing-worksheet-controller.js +23 -10
- package/dist-server/controllers/outbound/packing-worksheet-controller.js.map +1 -1
- package/dist-server/controllers/outbound/picking-worksheet-controller.js +7 -6
- package/dist-server/controllers/outbound/picking-worksheet-controller.js.map +1 -1
- package/dist-server/controllers/outbound/returning-worksheet-controller.js +1 -1
- package/dist-server/controllers/outbound/returning-worksheet-controller.js.map +1 -1
- package/dist-server/controllers/outbound/sorting-worksheet-controller.js +7 -1
- package/dist-server/controllers/outbound/sorting-worksheet-controller.js.map +1 -1
- package/dist-server/graphql/resolvers/worksheet/batch-picking-worksheet.js +5 -2
- package/dist-server/graphql/resolvers/worksheet/batch-picking-worksheet.js.map +1 -1
- package/dist-server/graphql/resolvers/worksheet/confirm-cancellation-release-order.js +12 -20
- package/dist-server/graphql/resolvers/worksheet/confirm-cancellation-release-order.js.map +1 -1
- package/dist-server/graphql/resolvers/worksheet/inventories-by-pallet.js +1 -1
- package/dist-server/graphql/resolvers/worksheet/inventories-by-pallet.js.map +1 -1
- package/dist-server/graphql/resolvers/worksheet/proceed-extra-products.js +6 -6
- package/dist-server/graphql/resolvers/worksheet/proceed-extra-products.js.map +1 -1
- package/dist-server/graphql/resolvers/worksheet/worksheet.js +96 -21
- package/dist-server/graphql/resolvers/worksheet/worksheet.js.map +1 -1
- package/dist-server/graphql/types/worksheet/index.js +11 -11
- package/dist-server/graphql/types/worksheet/worksheet-detail-info.js +7 -6
- package/dist-server/graphql/types/worksheet/worksheet-detail-info.js.map +1 -1
- package/package.json +12 -12
- package/server/controllers/inbound/unloading-worksheet-controller.ts +32 -47
- package/server/controllers/inspect/cycle-count-worksheet-controller.ts +6 -1
- package/server/controllers/outbound/packing-worksheet-controller.ts +30 -18
- package/server/controllers/outbound/picking-worksheet-controller.ts +10 -7
- package/server/controllers/outbound/returning-worksheet-controller.ts +1 -1
- package/server/controllers/outbound/sorting-worksheet-controller.ts +7 -1
- package/server/graphql/resolvers/worksheet/batch-picking-worksheet.ts +8 -14
- package/server/graphql/resolvers/worksheet/confirm-cancellation-release-order.ts +29 -44
- package/server/graphql/resolvers/worksheet/inventories-by-pallet.ts +2 -1
- package/server/graphql/resolvers/worksheet/proceed-extra-products.ts +65 -59
- package/server/graphql/resolvers/worksheet/worksheet.ts +117 -76
- package/server/graphql/types/worksheet/index.ts +11 -11
- package/server/graphql/types/worksheet/worksheet-detail-info.ts +7 -6
|
@@ -1,20 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
getRepository,
|
|
3
|
-
SelectQueryBuilder
|
|
4
|
-
} from 'typeorm'
|
|
1
|
+
import { getRepository, SelectQueryBuilder } from 'typeorm'
|
|
5
2
|
|
|
6
3
|
import { ORDER_INVENTORY_STATUS } from '@things-factory/sales-base'
|
|
7
4
|
import { Domain } from '@things-factory/shell'
|
|
8
5
|
import { InventoryChange } from '@things-factory/warehouse-base'
|
|
9
6
|
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
WORKSHEET_TYPE
|
|
13
|
-
} from '../../../constants'
|
|
14
|
-
import {
|
|
15
|
-
Worksheet,
|
|
16
|
-
WorksheetDetail
|
|
17
|
-
} from '../../../entities'
|
|
7
|
+
import { WORKSHEET_STATUS, WORKSHEET_TYPE } from '../../../constants'
|
|
8
|
+
import { Worksheet, WorksheetDetail } from '../../../entities'
|
|
18
9
|
|
|
19
10
|
export const batchPickingWorksheetResolver = {
|
|
20
11
|
async batchPickingWorksheet(_: any, { taskNo, locationSortingRules }, context: any) {
|
|
@@ -43,6 +34,7 @@ export const batchPickingWorksheetResolver = {
|
|
|
43
34
|
.addSelect('"PROD".name', 'productName')
|
|
44
35
|
.addSelect('"PROD".sku', 'productSku')
|
|
45
36
|
.addSelect('"PROD".description', 'productDescription')
|
|
37
|
+
.addSelect('"PROD".is_inventory_decimal', 'isInventoryDecimal')
|
|
46
38
|
.addSelect('"PROD_DET".id', 'productDetailId')
|
|
47
39
|
.addSelect('"INV".qty', 'qty')
|
|
48
40
|
.addSelect('"INV".packing_type', 'packingType')
|
|
@@ -116,7 +108,8 @@ export const batchPickingWorksheetResolver = {
|
|
|
116
108
|
id: item?.productId,
|
|
117
109
|
name: item?.productName,
|
|
118
110
|
description: item?.productDescription,
|
|
119
|
-
sku: item?.productSku
|
|
111
|
+
sku: item?.productSku,
|
|
112
|
+
isInventoryDecimal: item?.isInventoryDecimal
|
|
120
113
|
},
|
|
121
114
|
qty: item?.qty,
|
|
122
115
|
releaseQty: item.releaseQty,
|
|
@@ -135,7 +128,8 @@ export const batchPickingWorksheetResolver = {
|
|
|
135
128
|
id: item?.productId,
|
|
136
129
|
name: item?.productName,
|
|
137
130
|
description: item?.productDescription,
|
|
138
|
-
sku: item?.productSku
|
|
131
|
+
sku: item?.productSku,
|
|
132
|
+
isInventoryDecimal: item?.isInventoryDecimal
|
|
139
133
|
},
|
|
140
134
|
productDetail: {
|
|
141
135
|
id: item?.productDetailId
|
|
@@ -1,22 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
EntityManager,
|
|
3
|
-
In
|
|
4
|
-
} from 'typeorm'
|
|
1
|
+
import { EntityManager, In } from 'typeorm'
|
|
5
2
|
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
ApplicationType,
|
|
9
|
-
User
|
|
10
|
-
} from '@things-factory/auth-base'
|
|
11
|
-
import {
|
|
12
|
-
Bizplace,
|
|
13
|
-
getCompanyBizplace
|
|
14
|
-
} from '@things-factory/biz-base'
|
|
3
|
+
import { Application, ApplicationType, User } from '@things-factory/auth-base'
|
|
4
|
+
import { Bizplace, getCompanyBizplace } from '@things-factory/biz-base'
|
|
15
5
|
import { logger } from '@things-factory/env'
|
|
16
|
-
import {
|
|
17
|
-
Account,
|
|
18
|
-
AccountingAPI
|
|
19
|
-
} from '@things-factory/integration-accounting'
|
|
6
|
+
import { Account, AccountingAPI } from '@things-factory/integration-accounting'
|
|
20
7
|
import { LastMileAPI } from '@things-factory/integration-lmd'
|
|
21
8
|
import {
|
|
22
9
|
DeliveryOrder,
|
|
@@ -38,10 +25,7 @@ import {
|
|
|
38
25
|
WebspertController
|
|
39
26
|
} from '@things-factory/warehouse-base'
|
|
40
27
|
|
|
41
|
-
import {
|
|
42
|
-
Worksheet,
|
|
43
|
-
WorksheetDetail
|
|
44
|
-
} from '../../../entities'
|
|
28
|
+
import { Worksheet, WorksheetDetail } from '../../../entities'
|
|
45
29
|
|
|
46
30
|
export const confirmCancellationReleaseOrder = {
|
|
47
31
|
async confirmCancellationReleaseOrder(_: any, { name }, context: any) {
|
|
@@ -88,8 +72,8 @@ export const confirmCancellationReleaseOrder = {
|
|
|
88
72
|
.createQueryBuilder()
|
|
89
73
|
.update(Inventory)
|
|
90
74
|
.set({
|
|
91
|
-
qty: () => `COALESCE("qty", 0) + ${orderInventory.releaseQty}`,
|
|
92
|
-
uomValue: () => `COALESCE("uom_value", 0) + ${orderInventory.releaseUomValue}`,
|
|
75
|
+
qty: () => `COALESCE("qty", 0) + ${orderInventory.releaseQty}::numeric`,
|
|
76
|
+
uomValue: () => `COALESCE("uom_value", 0) + ${orderInventory.releaseUomValue}::numeric`,
|
|
93
77
|
status: INVENTORY_STATUS.STORED,
|
|
94
78
|
updater: user
|
|
95
79
|
})
|
|
@@ -127,25 +111,12 @@ export const confirmCancellationReleaseOrder = {
|
|
|
127
111
|
.createQueryBuilder()
|
|
128
112
|
.update(Inventory)
|
|
129
113
|
.set({
|
|
130
|
-
lockedQty: () => `COALESCE("locked_qty", 0) - ${orderInventory.releaseQty}`,
|
|
131
|
-
lockedUomValue: () => `COALESCE("locked_uom_value", 0) - ${orderInventory.releaseUomValue}`,
|
|
114
|
+
lockedQty: () => `COALESCE("locked_qty", 0) - ${orderInventory.releaseQty}::numeric`,
|
|
115
|
+
lockedUomValue: () => `COALESCE("locked_uom_value", 0) - ${orderInventory.releaseUomValue}::numeric`,
|
|
132
116
|
updater: user
|
|
133
117
|
})
|
|
134
118
|
.where('id = :id', { id: inventory.id })
|
|
135
119
|
.execute()
|
|
136
|
-
|
|
137
|
-
// @ChrisLim-git commented for further review as it causes qty to add into inventory
|
|
138
|
-
// await tx
|
|
139
|
-
// .createQueryBuilder()
|
|
140
|
-
// .update(Inventory)
|
|
141
|
-
// .set({
|
|
142
|
-
// qty: () => `COALESCE("qty", 0) + ${orderInventory.releaseQty}`,
|
|
143
|
-
// uomValue: () => `COALESCE("uom_value", 0) + ${orderInventory.releaseUomValue}`,
|
|
144
|
-
// status: INVENTORY_STATUS.STORED,
|
|
145
|
-
// updater: user
|
|
146
|
-
// })
|
|
147
|
-
// .where('id = :id', { id: inventory.id })
|
|
148
|
-
// .execute()
|
|
149
120
|
}
|
|
150
121
|
|
|
151
122
|
return orderInventory
|
|
@@ -287,8 +258,8 @@ export const confirmCancellationReleaseOrder = {
|
|
|
287
258
|
.createQueryBuilder()
|
|
288
259
|
.update(ProductDetailStock)
|
|
289
260
|
.set({
|
|
290
|
-
unassignedQty: () => `"unassigned_qty" - ${op.releaseQty}`,
|
|
291
|
-
unassignedUomValue: () => `"unassigned_uom_value" - ${op.releaseUomValue}`
|
|
261
|
+
unassignedQty: () => `"unassigned_qty" - ${op.releaseQty}::numeric`,
|
|
262
|
+
unassignedUomValue: () => `"unassigned_uom_value" - ${op.releaseUomValue}::numeric`
|
|
292
263
|
})
|
|
293
264
|
.where({ productDetail: op.productDetail.id })
|
|
294
265
|
.execute()
|
|
@@ -328,7 +299,7 @@ async function updateStockForOrderInventories(
|
|
|
328
299
|
const customerDomain: Domain = releaseGood.bizplace.domain
|
|
329
300
|
const customerBizplaceId: string = releaseGood.bizplace.id
|
|
330
301
|
const companyBizplace: Bizplace = await getCompanyBizplace(domain, null, customerBizplaceId, tx)
|
|
331
|
-
|
|
302
|
+
|
|
332
303
|
// Find any connected application to POWRUP or WEBSPERT
|
|
333
304
|
const applications: Application[] = await tx.getRepository(Application).find({
|
|
334
305
|
domain: companyBizplace.domain,
|
|
@@ -336,13 +307,27 @@ async function updateStockForOrderInventories(
|
|
|
336
307
|
type: In([ApplicationType.POWRUP, ApplicationType.WEBSPERT])
|
|
337
308
|
})
|
|
338
309
|
|
|
339
|
-
if(
|
|
310
|
+
if (
|
|
311
|
+
applications.find(app => {
|
|
312
|
+
app.type === ApplicationType.POWRUP
|
|
313
|
+
})
|
|
314
|
+
) {
|
|
340
315
|
const powrupController: PowrupController = new PowrupController()
|
|
341
316
|
powrupController.updateStock(orderInventories, customerDomain, user, tx)
|
|
342
317
|
}
|
|
343
318
|
|
|
344
|
-
if(
|
|
345
|
-
|
|
319
|
+
if (
|
|
320
|
+
applications.find(app => {
|
|
321
|
+
app.type === ApplicationType.WEBSPERT
|
|
322
|
+
})
|
|
323
|
+
) {
|
|
324
|
+
WebspertController.updateStock(
|
|
325
|
+
orderInventories.map(oi => oi.productDetail),
|
|
326
|
+
releaseGood.bizplace,
|
|
327
|
+
domain,
|
|
328
|
+
user,
|
|
329
|
+
tx
|
|
330
|
+
)
|
|
346
331
|
}
|
|
347
332
|
}
|
|
348
333
|
}
|
|
@@ -180,7 +180,8 @@ export const inventoriesByPalletResolver = {
|
|
|
180
180
|
productSKU: item.product.sku,
|
|
181
181
|
productBrand: item.product.brand,
|
|
182
182
|
productId: item.product.id,
|
|
183
|
-
productDetailId: item.productDetail.id
|
|
183
|
+
productDetailId: item.productDetail.id,
|
|
184
|
+
isInventoryDecimal: item.product.isInventoryDecimal,
|
|
184
185
|
}
|
|
185
186
|
})
|
|
186
187
|
)
|
|
@@ -71,70 +71,76 @@ export const proceedExtraProductsResolver = {
|
|
|
71
71
|
)
|
|
72
72
|
|
|
73
73
|
if (editedApprovedProducts?.length > 0) {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
: selectedOrderProduct
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
: selectedOrderProduct
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
74
|
+
await Promise.all(
|
|
75
|
+
editedApprovedProducts.map(async (editedApprovedProd: OrderProduct) => {
|
|
76
|
+
const selectedOrderProduct: OrderProduct = storedOrderProducts.find(
|
|
77
|
+
(op: OrderProduct) => op.id === editedApprovedProd.id
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
updatedOrderProducts.push({
|
|
81
|
+
...selectedOrderProduct,
|
|
82
|
+
batchId: selectedOrderProduct?.adjustedBatchId
|
|
83
|
+
? selectedOrderProduct.adjustedBatchId
|
|
84
|
+
: selectedOrderProduct.batchId,
|
|
85
|
+
batchIdRef: selectedOrderProduct?.adjustedBatchIdRef
|
|
86
|
+
? selectedOrderProduct.adjustedBatchIdRef
|
|
87
|
+
: selectedOrderProduct.batchIdRef,
|
|
88
|
+
packingType: selectedOrderProduct?.adjustedPackingType
|
|
89
|
+
? selectedOrderProduct.adjustedPackingType
|
|
90
|
+
: selectedOrderProduct.packingType,
|
|
91
|
+
packQty: selectedOrderProduct?.adjustedPackQty
|
|
92
|
+
? selectedOrderProduct.adjustedPackQty
|
|
93
|
+
: selectedOrderProduct.packQty,
|
|
94
|
+
uom: selectedOrderProduct?.adjustedUom ? selectedOrderProduct.adjustedUom : selectedOrderProduct.uom,
|
|
95
|
+
uomValue: selectedOrderProduct?.adjustedUomValue
|
|
96
|
+
? selectedOrderProduct.adjustedUomValue
|
|
97
|
+
: selectedOrderProduct.uomValue,
|
|
98
|
+
totalUomValue:
|
|
99
|
+
selectedOrderProduct?.adjustedTotalUomValue || selectedOrderProduct?.adjustedTotalUomValue === ''
|
|
100
|
+
? selectedOrderProduct.adjustedTotalUomValue
|
|
101
|
+
: selectedOrderProduct.totalUomValue,
|
|
102
|
+
palletQty: selectedOrderProduct?.adjustedPalletQty
|
|
103
|
+
? selectedOrderProduct.adjustedPalletQty
|
|
104
|
+
: selectedOrderProduct.palletQty,
|
|
105
|
+
unitPrice: selectedOrderProduct?.adjustedUnitPrice
|
|
106
|
+
? selectedOrderProduct.adjustedUnitPrice
|
|
107
|
+
: selectedOrderProduct.unitPrice,
|
|
108
|
+
status:
|
|
109
|
+
worksheet.status === WORKSHEET_STATUS.DEACTIVATED
|
|
110
|
+
? ORDER_PRODUCT_STATUS.READY_TO_UNLOAD
|
|
111
|
+
: ORDER_PRODUCT_STATUS.UNLOADING,
|
|
112
|
+
updater: user
|
|
113
|
+
})
|
|
111
114
|
})
|
|
112
|
-
|
|
115
|
+
)
|
|
113
116
|
}
|
|
114
117
|
|
|
115
118
|
if (addedApprovedProducts?.length > 0) {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
119
|
+
await Promise.all(
|
|
120
|
+
addedApprovedProducts.map(async (addedApprovedProd: OrderProduct) => {
|
|
121
|
+
const selectedOrderProduct: OrderProduct = storedOrderProducts.find(
|
|
122
|
+
(op: OrderProduct) => op.id === addedApprovedProd.id
|
|
123
|
+
)
|
|
124
|
+
|
|
125
|
+
updatedOrderProducts.push({
|
|
126
|
+
...selectedOrderProduct,
|
|
127
|
+
batchId: selectedOrderProduct.adjustedBatchId,
|
|
128
|
+
batchIdRef: selectedOrderProduct.adjustedBatchIdRef,
|
|
129
|
+
packingType: selectedOrderProduct.adjustedPackingType,
|
|
130
|
+
packQty: selectedOrderProduct.adjustedPackQty,
|
|
131
|
+
uom: selectedOrderProduct.adjustedUom,
|
|
132
|
+
uomValue: selectedOrderProduct.adjustedUomValue,
|
|
133
|
+
totalUomValue: selectedOrderProduct.adjustedTotalUomValue,
|
|
134
|
+
palletQty: selectedOrderProduct.adjustedPalletQty,
|
|
135
|
+
unitPrice: selectedOrderProduct.adjustedUnitPrice,
|
|
136
|
+
status:
|
|
137
|
+
worksheet.status === WORKSHEET_STATUS.DEACTIVATED
|
|
138
|
+
? ORDER_PRODUCT_STATUS.READY_TO_UNLOAD
|
|
139
|
+
: ORDER_PRODUCT_STATUS.UNLOADING,
|
|
140
|
+
updater: user
|
|
141
|
+
})
|
|
136
142
|
})
|
|
137
|
-
|
|
143
|
+
)
|
|
138
144
|
}
|
|
139
145
|
|
|
140
146
|
debug('approved and updated order product', updatedOrderProducts)
|
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
import { Equal, getRepository, Not } from 'typeorm'
|
|
2
2
|
|
|
3
3
|
import { MarketplaceOrder, MarketplaceOrderShipping } from '@things-factory/marketplace-base'
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
ArrivalNotice,
|
|
6
|
+
ORDER_INVENTORY_STATUS,
|
|
7
|
+
OrderInventory,
|
|
8
|
+
OrderProduct,
|
|
9
|
+
OrderVas,
|
|
10
|
+
ReleaseGood
|
|
11
|
+
} from '@things-factory/sales-base'
|
|
5
12
|
import { Setting } from '@things-factory/setting-base'
|
|
6
13
|
import { Domain } from '@things-factory/shell'
|
|
7
14
|
import { Inventory, INVENTORY_STATUS, InventoryHistory } from '@things-factory/warehouse-base'
|
|
15
|
+
import { Bizplace } from '@things-factory/biz-base'
|
|
8
16
|
|
|
9
17
|
import { WORKSHEET_TYPE } from '../../../constants'
|
|
10
18
|
import { Worksheet, WorksheetDetail } from '../../../entities'
|
|
@@ -31,80 +39,38 @@ export const worksheetResolver = {
|
|
|
31
39
|
|
|
32
40
|
let worksheetRelations: string[] = []
|
|
33
41
|
|
|
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
|
-
'worksheetDetails.targetProduct',
|
|
67
|
-
'worksheetDetails.targetProduct.product',
|
|
68
|
-
'worksheetDetails.targetProduct.releaseGood',
|
|
69
|
-
'worksheetDetails.targetInventory',
|
|
70
|
-
'worksheetDetails.targetInventory.bizplace',
|
|
71
|
-
'worksheetDetails.targetInventory.releaseGood',
|
|
72
|
-
'worksheetDetails.targetInventory.product',
|
|
73
|
-
'worksheetDetails.targetInventory.inventory',
|
|
74
|
-
'worksheetDetails.targetInventory.inventory.product',
|
|
75
|
-
'worksheetDetails.targetInventory.inventory.warehouse',
|
|
76
|
-
'worksheetDetails.targetInventory.inventory.location',
|
|
77
|
-
'worksheetDetails.targetVas',
|
|
78
|
-
'worksheetDetails.targetVas.product',
|
|
79
|
-
'worksheetDetails.targetVas.newProduct',
|
|
80
|
-
'worksheetDetails.targetVas.newProductDetail',
|
|
81
|
-
'worksheetDetails.targetVas.orderVasItems',
|
|
82
|
-
'worksheetDetails.targetVas.orderVasItems.vas',
|
|
83
|
-
'creator',
|
|
84
|
-
'updater'
|
|
85
|
-
)
|
|
86
|
-
break
|
|
87
|
-
|
|
88
|
-
case 'UNLOADING':
|
|
89
|
-
worksheetRelations.push(
|
|
90
|
-
'worksheetDetails',
|
|
91
|
-
'worksheetDetails.toLocation',
|
|
92
|
-
'worksheetDetails.targetProduct',
|
|
93
|
-
'worksheetDetails.targetProduct.product',
|
|
94
|
-
'worksheetDetails.targetProduct.releaseGood',
|
|
95
|
-
'worksheetDetails.targetVas.product',
|
|
96
|
-
'worksheetDetails.targetVas.newProduct',
|
|
97
|
-
'worksheetDetails.targetVas.newProductDetail',
|
|
98
|
-
'worksheetDetails.targetVas.orderVasItems',
|
|
99
|
-
'worksheetDetails.targetVas.orderVasItems.vas',
|
|
100
|
-
'worksheetDetails.targetInventory.releaseGood',
|
|
101
|
-
'worksheetDetails.targetInventory.inspectedLocation'
|
|
102
|
-
)
|
|
103
|
-
break
|
|
104
|
-
|
|
105
|
-
default:
|
|
106
|
-
// Default case if the name doesn't match any defined case
|
|
107
|
-
break
|
|
42
|
+
const otherWorksheetTypes = [
|
|
43
|
+
'PICKING',
|
|
44
|
+
'BATCH_PICKING',
|
|
45
|
+
'LOADING',
|
|
46
|
+
'PACKING',
|
|
47
|
+
'PICKING_REPLENISHMENT',
|
|
48
|
+
'SORTING',
|
|
49
|
+
'WAREHOUSE_RETURN',
|
|
50
|
+
'PUTAWAY_RETURN',
|
|
51
|
+
'UNLOADING_RETURN',
|
|
52
|
+
'PUTAWAY_REPLENISHMENT',
|
|
53
|
+
'VAS'
|
|
54
|
+
]
|
|
55
|
+
|
|
56
|
+
if (thisWorksheet?.type === 'UNLOADING') {
|
|
57
|
+
worksheetRelations.push('worksheetDetails')
|
|
58
|
+
} else if (otherWorksheetTypes.includes(thisWorksheet?.type)) {
|
|
59
|
+
worksheetRelations.push(
|
|
60
|
+
'domain',
|
|
61
|
+
'bizplace',
|
|
62
|
+
'bufferLocation',
|
|
63
|
+
'arrivalNotice',
|
|
64
|
+
'releaseGood',
|
|
65
|
+
'replenishment',
|
|
66
|
+
'returnOrder',
|
|
67
|
+
'inventoryCheck',
|
|
68
|
+
'vasOrder',
|
|
69
|
+
'assignee',
|
|
70
|
+
'worksheetDetails',
|
|
71
|
+
'creator',
|
|
72
|
+
'updater'
|
|
73
|
+
)
|
|
108
74
|
}
|
|
109
75
|
|
|
110
76
|
worksheet = (await getRepository(Worksheet).findOne({
|
|
@@ -115,7 +81,82 @@ export const worksheetResolver = {
|
|
|
115
81
|
relations: worksheetRelations
|
|
116
82
|
})) as WorksheetInterface
|
|
117
83
|
|
|
118
|
-
if (
|
|
84
|
+
if (worksheet) {
|
|
85
|
+
if (thisWorksheet.type === 'UNLOADING') {
|
|
86
|
+
worksheet.worksheetDetails = await getRepository(WorksheetDetail).find({
|
|
87
|
+
where: {
|
|
88
|
+
domain,
|
|
89
|
+
worksheet: worksheet.id
|
|
90
|
+
},
|
|
91
|
+
relations: [
|
|
92
|
+
'toLocation',
|
|
93
|
+
'targetProduct',
|
|
94
|
+
'targetProduct.product',
|
|
95
|
+
'targetProduct.releaseGood',
|
|
96
|
+
'targetVas.product',
|
|
97
|
+
'targetVas.newProduct',
|
|
98
|
+
'targetVas.newProductDetail',
|
|
99
|
+
'targetVas.orderVasItems',
|
|
100
|
+
'targetVas.orderVasItems.vas',
|
|
101
|
+
'targetInventory.releaseGood',
|
|
102
|
+
'targetInventory.inspectedLocation'
|
|
103
|
+
]
|
|
104
|
+
})
|
|
105
|
+
} else if (otherWorksheetTypes.includes(thisWorksheet.type)) {
|
|
106
|
+
const [bizplace, bufferLocation, arrivalNotice, releaseGood, worksheetDetails] = await Promise.all([
|
|
107
|
+
getRepository(Bizplace).findOne({
|
|
108
|
+
where: { id: worksheet.bizplace.id },
|
|
109
|
+
relations: ['domain']
|
|
110
|
+
}),
|
|
111
|
+
worksheet.bufferLocation
|
|
112
|
+
? getRepository(Inventory).findOne({
|
|
113
|
+
where: { id: worksheet.bufferLocation.id },
|
|
114
|
+
relations: ['warehouse']
|
|
115
|
+
})
|
|
116
|
+
: null,
|
|
117
|
+
worksheet.arrivalNotice
|
|
118
|
+
? getRepository(ArrivalNotice).findOne({
|
|
119
|
+
where: { id: worksheet.arrivalNotice.id },
|
|
120
|
+
relations: ['releaseGood']
|
|
121
|
+
})
|
|
122
|
+
: null,
|
|
123
|
+
worksheet.releaseGood
|
|
124
|
+
? getRepository(ReleaseGood).findOne({
|
|
125
|
+
where: { id: worksheet.releaseGood.id },
|
|
126
|
+
relations: ['arrivalNotice', 'shippingOrder', 'orderPackages', 'orderProducts', 'orderProducts.product']
|
|
127
|
+
})
|
|
128
|
+
: null,
|
|
129
|
+
getRepository(WorksheetDetail).find({
|
|
130
|
+
where: { domain, worksheet: worksheet.id },
|
|
131
|
+
relations: [
|
|
132
|
+
'targetProduct',
|
|
133
|
+
'targetProduct.product',
|
|
134
|
+
'targetProduct.releaseGood',
|
|
135
|
+
'targetInventory',
|
|
136
|
+
'targetInventory.bizplace',
|
|
137
|
+
'targetInventory.releaseGood',
|
|
138
|
+
'targetInventory.product',
|
|
139
|
+
'targetInventory.inventory',
|
|
140
|
+
'targetInventory.inventory.product',
|
|
141
|
+
'targetInventory.inventory.warehouse',
|
|
142
|
+
'targetInventory.inventory.location',
|
|
143
|
+
'targetVas',
|
|
144
|
+
'targetVas.product',
|
|
145
|
+
'targetVas.newProduct',
|
|
146
|
+
'targetVas.newProductDetail',
|
|
147
|
+
'targetVas.orderVasItems',
|
|
148
|
+
'targetVas.orderVasItems.vas'
|
|
149
|
+
]
|
|
150
|
+
})
|
|
151
|
+
])
|
|
152
|
+
|
|
153
|
+
worksheet.bizplace = bizplace
|
|
154
|
+
worksheet.bufferLocation = bufferLocation
|
|
155
|
+
worksheet.arrivalNotice = arrivalNotice
|
|
156
|
+
worksheet.releaseGood = releaseGood
|
|
157
|
+
worksheet.worksheetDetails = worksheetDetails
|
|
158
|
+
}
|
|
159
|
+
} else {
|
|
119
160
|
worksheet = (await getRepository(Worksheet).findOne({
|
|
120
161
|
where: {
|
|
121
162
|
domain,
|
|
@@ -379,7 +379,7 @@ export const Mutation = /* GraphQL */ `
|
|
|
379
379
|
palletId: String
|
|
380
380
|
cartonId: String
|
|
381
381
|
locationName: String!
|
|
382
|
-
releaseQty:
|
|
382
|
+
releaseQty: Float!
|
|
383
383
|
binLocation: String
|
|
384
384
|
serialNumber: String
|
|
385
385
|
toteNo: String
|
|
@@ -393,7 +393,7 @@ export const Mutation = /* GraphQL */ `
|
|
|
393
393
|
binLocation: String
|
|
394
394
|
serialNumber: String
|
|
395
395
|
toteNo: String
|
|
396
|
-
pickingQty:
|
|
396
|
+
pickingQty: Float
|
|
397
397
|
): Boolean @privilege(category: "worksheet_execute", privilege: "mutation") @transaction
|
|
398
398
|
|
|
399
399
|
replenishmentPicking (
|
|
@@ -403,7 +403,7 @@ export const Mutation = /* GraphQL */ `
|
|
|
403
403
|
cartonId: String!
|
|
404
404
|
binLocation: String
|
|
405
405
|
serialNumber: String
|
|
406
|
-
pickingQty:
|
|
406
|
+
pickingQty: Float
|
|
407
407
|
): Boolean @privilege(category: "worksheet_execute", privilege: "mutation") @transaction
|
|
408
408
|
|
|
409
409
|
sortingProduct (
|
|
@@ -444,7 +444,7 @@ export const Mutation = /* GraphQL */ `
|
|
|
444
444
|
palletId: String!
|
|
445
445
|
locationName: String
|
|
446
446
|
binLocationName: String
|
|
447
|
-
releaseQty:
|
|
447
|
+
releaseQty: Float!
|
|
448
448
|
): Boolean @privilege(category: "worksheet_execute", privilege: "mutation") @transaction
|
|
449
449
|
|
|
450
450
|
scanProductBatchPicking (
|
|
@@ -454,21 +454,21 @@ export const Mutation = /* GraphQL */ `
|
|
|
454
454
|
productBarcode: String!
|
|
455
455
|
inventory: InventoryPatch!
|
|
456
456
|
binLocationName: String
|
|
457
|
-
pickingQty:
|
|
457
|
+
pickingQty: Float
|
|
458
458
|
): Boolean @privilege(category: "worksheet_execute", privilege: "mutation") @transaction
|
|
459
459
|
|
|
460
460
|
crossDockPicking (
|
|
461
461
|
worksheetDetailName: String!
|
|
462
462
|
worksheetType: String!
|
|
463
463
|
palletId: String!
|
|
464
|
-
releaseQty:
|
|
464
|
+
releaseQty: Float!
|
|
465
465
|
): Boolean @privilege(category: "worksheet_execute", privilege: "mutation") @transaction
|
|
466
466
|
|
|
467
467
|
|
|
468
468
|
inspectingPallet (
|
|
469
469
|
worksheetDetailName: String!
|
|
470
470
|
inspectedBatchNo: String!
|
|
471
|
-
inspectedQty:
|
|
471
|
+
inspectedQty: Float!
|
|
472
472
|
inspectedUomValue: Float!
|
|
473
473
|
inspectedExpirationDate: Date
|
|
474
474
|
): Boolean @privilege(category: "worksheet_execute", privilege: "mutation") @transaction
|
|
@@ -479,7 +479,7 @@ export const Mutation = /* GraphQL */ `
|
|
|
479
479
|
batchId: String!
|
|
480
480
|
locationId: String!
|
|
481
481
|
inspectedBatchNo: String!
|
|
482
|
-
inspectedQty:
|
|
482
|
+
inspectedQty: Float!
|
|
483
483
|
inspectedUomValue: Float!
|
|
484
484
|
inspectedExpirationDate: Date
|
|
485
485
|
): Boolean @privilege(category: "worksheet_execute", privilege: "mutation") @transaction
|
|
@@ -511,7 +511,7 @@ export const Mutation = /* GraphQL */ `
|
|
|
511
511
|
relocateInventory (
|
|
512
512
|
worksheetDetailName: String!
|
|
513
513
|
inspectedBatchNo: String!
|
|
514
|
-
inspectedQty:
|
|
514
|
+
inspectedQty: Float!
|
|
515
515
|
inspectedUomValue: Float!
|
|
516
516
|
inspectedLocationName: String!
|
|
517
517
|
): Boolean @privilege(category: "worksheet_execute", privilege: "mutation") @transaction
|
|
@@ -522,7 +522,7 @@ export const Mutation = /* GraphQL */ `
|
|
|
522
522
|
batchId: String!
|
|
523
523
|
locationId: String!
|
|
524
524
|
inspectedBatchNo: String!
|
|
525
|
-
inspectedQty:
|
|
525
|
+
inspectedQty: Float!
|
|
526
526
|
inspectedUomValue: Float!
|
|
527
527
|
inspectedLocationName: String!
|
|
528
528
|
): Boolean @privilege(category: "worksheet_execute", privilege: "mutation") @transaction
|
|
@@ -533,7 +533,7 @@ export const Mutation = /* GraphQL */ `
|
|
|
533
533
|
productDetailId: String!
|
|
534
534
|
productId: String!
|
|
535
535
|
inspectedBatchNo: String!
|
|
536
|
-
inspectedQty:
|
|
536
|
+
inspectedQty: Float!
|
|
537
537
|
inspectedUomValue: Float!
|
|
538
538
|
countNo: Int!
|
|
539
539
|
inspectedExpirationDate: Date
|