@things-factory/worksheet-base 4.3.356 → 4.3.358
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/constants/worksheet.js +2 -1
- package/dist-server/constants/worksheet.js.map +1 -1
- package/dist-server/controllers/inspect/cycle-count-worksheet-controller.js +691 -257
- package/dist-server/controllers/inspect/cycle-count-worksheet-controller.js.map +1 -1
- package/dist-server/controllers/outbound/picking-worksheet-controller.js +76 -0
- package/dist-server/controllers/outbound/picking-worksheet-controller.js.map +1 -1
- package/dist-server/controllers/worksheet-controller.js +9 -2
- package/dist-server/controllers/worksheet-controller.js.map +1 -1
- package/dist-server/entities/worksheet-detail.js +9 -4
- package/dist-server/entities/worksheet-detail.js.map +1 -1
- package/dist-server/entities/worksheet.js +4 -0
- package/dist-server/entities/worksheet.js.map +1 -1
- package/dist-server/graphql/resolvers/worksheet/check-stock-take-current-location.js +18 -11
- package/dist-server/graphql/resolvers/worksheet/check-stock-take-current-location.js.map +1 -1
- package/dist-server/graphql/resolvers/worksheet/cycle-count-adjustment.js +75 -48
- package/dist-server/graphql/resolvers/worksheet/cycle-count-adjustment.js.map +1 -1
- package/dist-server/graphql/resolvers/worksheet/cycle-count-worksheet-for-carton.js +82 -0
- package/dist-server/graphql/resolvers/worksheet/cycle-count-worksheet-for-carton.js.map +1 -0
- package/dist-server/graphql/resolvers/worksheet/cycle-count-worksheet-for-pallet.js +82 -0
- package/dist-server/graphql/resolvers/worksheet/cycle-count-worksheet-for-pallet.js.map +1 -0
- package/dist-server/graphql/resolvers/worksheet/generate-worksheet/generate-cycle-count-worksheet-carton.js +17 -0
- package/dist-server/graphql/resolvers/worksheet/generate-worksheet/generate-cycle-count-worksheet-carton.js.map +1 -0
- package/dist-server/graphql/resolvers/worksheet/generate-worksheet/generate-cycle-count-worksheet.js +4 -4
- package/dist-server/graphql/resolvers/worksheet/generate-worksheet/generate-cycle-count-worksheet.js.map +1 -1
- package/dist-server/graphql/resolvers/worksheet/generate-worksheet/index.js +2 -1
- package/dist-server/graphql/resolvers/worksheet/generate-worksheet/index.js.map +1 -1
- package/dist-server/graphql/resolvers/worksheet/index.js +3 -2
- package/dist-server/graphql/resolvers/worksheet/index.js.map +1 -1
- package/dist-server/graphql/resolvers/worksheet/inspecting/add-extra-inventory.js +16 -0
- package/dist-server/graphql/resolvers/worksheet/inspecting/add-extra-inventory.js.map +1 -0
- package/dist-server/graphql/resolvers/worksheet/inspecting/check-missing-inventory-carton.js +16 -0
- package/dist-server/graphql/resolvers/worksheet/inspecting/check-missing-inventory-carton.js.map +1 -0
- package/dist-server/graphql/resolvers/worksheet/inspecting/check-missing-inventory.js +16 -0
- package/dist-server/graphql/resolvers/worksheet/inspecting/check-missing-inventory.js.map +1 -0
- package/dist-server/graphql/resolvers/worksheet/inspecting/index.js +9 -5
- package/dist-server/graphql/resolvers/worksheet/inspecting/index.js.map +1 -1
- package/dist-server/graphql/resolvers/worksheet/inspecting/inspecting-carton.js +16 -0
- package/dist-server/graphql/resolvers/worksheet/inspecting/inspecting-carton.js.map +1 -0
- package/dist-server/graphql/resolvers/worksheet/inspecting/inspecting-pallet.js +16 -0
- package/dist-server/graphql/resolvers/worksheet/inspecting/inspecting-pallet.js.map +1 -0
- package/dist-server/graphql/resolvers/worksheet/inspecting/relocate-inventory-carton.js +16 -0
- package/dist-server/graphql/resolvers/worksheet/inspecting/relocate-inventory-carton.js.map +1 -0
- package/dist-server/graphql/resolvers/worksheet/inspecting/relocate-inventory.js +16 -0
- package/dist-server/graphql/resolvers/worksheet/inspecting/relocate-inventory.js.map +1 -0
- package/dist-server/graphql/resolvers/worksheet/inspecting/undo-inspection-carton.js +16 -0
- package/dist-server/graphql/resolvers/worksheet/inspecting/undo-inspection-carton.js.map +1 -0
- package/dist-server/graphql/resolvers/worksheet/not-tally-target-inventories.js +9 -5
- package/dist-server/graphql/resolvers/worksheet/not-tally-target-inventories.js.map +1 -1
- package/dist-server/graphql/resolvers/worksheet/worksheet-with-pagination.js +9 -7
- package/dist-server/graphql/resolvers/worksheet/worksheet-with-pagination.js.map +1 -1
- package/dist-server/graphql/resolvers/worksheet/worksheets.js +23 -9
- package/dist-server/graphql/resolvers/worksheet/worksheets.js.map +1 -1
- package/dist-server/graphql/resolvers/worksheet-detail/create-worksheet-detail.js +8 -1
- package/dist-server/graphql/resolvers/worksheet-detail/create-worksheet-detail.js.map +1 -1
- package/dist-server/graphql/resolvers/worksheet-detail/worksheet-detail.js +12 -1
- package/dist-server/graphql/resolvers/worksheet-detail/worksheet-detail.js.map +1 -1
- package/dist-server/graphql/types/worksheet/index.js +65 -9
- package/dist-server/graphql/types/worksheet/index.js.map +1 -1
- package/dist-server/graphql/types/worksheet/inventory-check-worksheet.js +2 -1
- package/dist-server/graphql/types/worksheet/inventory-check-worksheet.js.map +1 -1
- package/dist-server/graphql/types/worksheet/worksheet-detail-info.js +3 -0
- package/dist-server/graphql/types/worksheet/worksheet-detail-info.js.map +1 -1
- package/dist-server/graphql/types/worksheet/worksheet.js +2 -0
- package/dist-server/graphql/types/worksheet/worksheet.js.map +1 -1
- package/dist-server/graphql/types/worksheet-detail/new-worksheet-detail.js +1 -0
- package/dist-server/graphql/types/worksheet-detail/new-worksheet-detail.js.map +1 -1
- package/dist-server/graphql/types/worksheet-detail/worksheet-detail-patch.js +1 -0
- package/dist-server/graphql/types/worksheet-detail/worksheet-detail-patch.js.map +1 -1
- package/dist-server/graphql/types/worksheet-detail/worksheet-detail.js +1 -0
- package/dist-server/graphql/types/worksheet-detail/worksheet-detail.js.map +1 -1
- package/dist-server/utils/lmd-util.js +9 -8
- package/dist-server/utils/lmd-util.js.map +1 -1
- package/package.json +10 -10
- package/server/constants/worksheet.ts +2 -1
- package/server/controllers/inspect/cycle-count-worksheet-controller.ts +904 -296
- package/server/controllers/outbound/picking-worksheet-controller.ts +95 -1
- package/server/controllers/worksheet-controller.ts +10 -4
- package/server/entities/worksheet-detail.ts +7 -10
- package/server/entities/worksheet.ts +3 -0
- package/server/graphql/resolvers/worksheet/check-stock-take-current-location.ts +21 -14
- package/server/graphql/resolvers/worksheet/cycle-count-adjustment.ts +114 -51
- package/server/graphql/resolvers/worksheet/cycle-count-worksheet-for-carton.ts +90 -0
- package/server/graphql/resolvers/worksheet/cycle-count-worksheet-for-pallet.ts +91 -0
- package/server/graphql/resolvers/worksheet/generate-worksheet/generate-cycle-count-worksheet-carton.ts +57 -0
- package/server/graphql/resolvers/worksheet/generate-worksheet/generate-cycle-count-worksheet.ts +17 -11
- package/server/graphql/resolvers/worksheet/generate-worksheet/index.ts +2 -0
- package/server/graphql/resolvers/worksheet/index.ts +4 -2
- package/server/graphql/resolvers/worksheet/inspecting/{add-extra-pallet.ts → add-extra-inventory.ts} +27 -12
- package/server/graphql/resolvers/worksheet/inspecting/check-missing-inventory-carton.ts +24 -0
- package/server/graphql/resolvers/worksheet/inspecting/{check-missing-pallet.ts → check-missing-inventory.ts} +10 -5
- package/server/graphql/resolvers/worksheet/inspecting/index.ts +17 -9
- package/server/graphql/resolvers/worksheet/inspecting/inspecting-carton.ts +51 -0
- package/server/graphql/resolvers/worksheet/inspecting/{inspecting.ts → inspecting-pallet.ts} +5 -5
- package/server/graphql/resolvers/worksheet/inspecting/relocate-inventory-carton.ts +62 -0
- package/server/graphql/resolvers/worksheet/inspecting/{relocate-pallet.ts → relocate-inventory.ts} +15 -5
- package/server/graphql/resolvers/worksheet/inspecting/undo-inspection-carton.ts +24 -0
- package/server/graphql/resolvers/worksheet/not-tally-target-inventories.ts +11 -7
- package/server/graphql/resolvers/worksheet/worksheet-with-pagination.ts +9 -7
- package/server/graphql/resolvers/worksheet/worksheets.ts +57 -38
- package/server/graphql/resolvers/worksheet-detail/create-worksheet-detail.ts +10 -2
- package/server/graphql/resolvers/worksheet-detail/worksheet-detail.ts +12 -1
- package/server/graphql/types/worksheet/index.ts +65 -9
- package/server/graphql/types/worksheet/inventory-check-worksheet.ts +2 -1
- package/server/graphql/types/worksheet/worksheet-detail-info.ts +3 -0
- package/server/graphql/types/worksheet/worksheet.ts +2 -0
- package/server/graphql/types/worksheet-detail/new-worksheet-detail.ts +1 -0
- package/server/graphql/types/worksheet-detail/worksheet-detail-patch.ts +1 -0
- package/server/graphql/types/worksheet-detail/worksheet-detail.ts +1 -0
- package/server/utils/lmd-util.ts +25 -6
- package/tsconfig.json +1 -1
- package/dist-server/graphql/resolvers/worksheet/cycle-count-worksheet.js +0 -74
- package/dist-server/graphql/resolvers/worksheet/cycle-count-worksheet.js.map +0 -1
- package/dist-server/graphql/resolvers/worksheet/inspecting/add-extra-pallet.js +0 -16
- package/dist-server/graphql/resolvers/worksheet/inspecting/add-extra-pallet.js.map +0 -1
- package/dist-server/graphql/resolvers/worksheet/inspecting/check-missing-pallet.js +0 -16
- package/dist-server/graphql/resolvers/worksheet/inspecting/check-missing-pallet.js.map +0 -1
- package/dist-server/graphql/resolvers/worksheet/inspecting/inspecting.js +0 -16
- package/dist-server/graphql/resolvers/worksheet/inspecting/inspecting.js.map +0 -1
- package/dist-server/graphql/resolvers/worksheet/inspecting/relocate-pallet.js +0 -16
- package/dist-server/graphql/resolvers/worksheet/inspecting/relocate-pallet.js.map +0 -1
- package/server/graphql/resolvers/worksheet/cycle-count-worksheet.ts +0 -80
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { createQueryBuilder, getRepository, In, SelectQueryBuilder } from 'typeorm'
|
|
2
|
+
|
|
3
|
+
import { InventoryCheck, ORDER_STATUS, InventoryCheckItem } from '@things-factory/sales-base'
|
|
4
|
+
import { Domain } from '@things-factory/shell'
|
|
5
|
+
import { Inventory } from '@things-factory/warehouse-base'
|
|
6
|
+
import { ProductDetail, Product } from '@things-factory/product-base'
|
|
7
|
+
|
|
8
|
+
import { WORKSHEET_STATUS, WORKSHEET_TYPE } from '../../../constants'
|
|
9
|
+
import { Worksheet, WorksheetDetail } from '../../../entities'
|
|
10
|
+
|
|
11
|
+
export const cycleCountWorksheetForCartonResolver = {
|
|
12
|
+
async cycleCountWorksheetForCarton(_: any, { inventoryCheckNo, locationSortingRules }, context: any) {
|
|
13
|
+
const { domain }: { domain: Domain } = context.state
|
|
14
|
+
const cycleCount: InventoryCheck = await getRepository(InventoryCheck).findOne({
|
|
15
|
+
where: { domain, name: inventoryCheckNo, status: ORDER_STATUS.INSPECTING }
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
if (!cycleCount) throw new Error('Failed to find cycle count worksheet')
|
|
19
|
+
|
|
20
|
+
const worksheet: Worksheet = await getRepository(Worksheet).findOne({
|
|
21
|
+
where: {
|
|
22
|
+
domain,
|
|
23
|
+
inventoryCheck: cycleCount,
|
|
24
|
+
type: In([WORKSHEET_TYPE.CYCLE_COUNT, WORKSHEET_TYPE.CYCLE_COUNT_RECHECK]),
|
|
25
|
+
status: WORKSHEET_STATUS.EXECUTING
|
|
26
|
+
},
|
|
27
|
+
relations: ['bizplace', 'bizplace.domain']
|
|
28
|
+
})
|
|
29
|
+
const qb: SelectQueryBuilder<WorksheetDetail> = createQueryBuilder(WorksheetDetail, 'WSD')
|
|
30
|
+
qb.leftJoinAndSelect('WSD.targetInventoryCheckItem', 'T_INV')
|
|
31
|
+
.leftJoinAndSelect('T_INV.inventory', 'INV')
|
|
32
|
+
.leftJoinAndSelect('T_INV.inspectedLocation', 'INS_LOC')
|
|
33
|
+
.leftJoinAndSelect('INV.location', 'LOC_INV')
|
|
34
|
+
.leftJoinAndSelect('T_INV.product', 'PROD')
|
|
35
|
+
.leftJoinAndSelect('INV.product', 'PROD_INV')
|
|
36
|
+
.leftJoinAndSelect('T_INV.productDetail', 'PD')
|
|
37
|
+
.leftJoinAndSelect('INV.productDetail', 'PD_INV')
|
|
38
|
+
.leftJoinAndSelect('LOC_INV.warehouse', 'WH')
|
|
39
|
+
.leftJoinAndSelect('INS_LOC.warehouse', 'INS_WH')
|
|
40
|
+
|
|
41
|
+
if (locationSortingRules?.length > 0) {
|
|
42
|
+
locationSortingRules.forEach((rule: { name: string; desc: boolean }) => {
|
|
43
|
+
qb.addOrderBy(`LOC_INV.${rule.name}`, rule.desc ? 'DESC' : 'ASC')
|
|
44
|
+
})
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const worksheetDetails: WorksheetDetail[] = await qb
|
|
48
|
+
.where('"WSD"."worksheet_id" = :worksheetId', { worksheetId: worksheet.id })
|
|
49
|
+
.andWhere('"WSD"."status" != :status', { status: WORKSHEET_STATUS.REPLACED })
|
|
50
|
+
.getMany()
|
|
51
|
+
|
|
52
|
+
return {
|
|
53
|
+
worksheetInfo: {
|
|
54
|
+
status: worksheet.status,
|
|
55
|
+
startedAt: worksheet.startedAt,
|
|
56
|
+
bizplace: worksheet.bizplace,
|
|
57
|
+
partnerDomainId: worksheet.bizplace?.domain.id
|
|
58
|
+
},
|
|
59
|
+
worksheetDetailInfos: await Promise.all(
|
|
60
|
+
worksheetDetails.map(async (cycleCountWSD: WorksheetDetail) => {
|
|
61
|
+
const targetInventoryCheckItem: InventoryCheckItem = cycleCountWSD.targetInventoryCheckItem
|
|
62
|
+
const inventory = targetInventoryCheckItem?.inventory
|
|
63
|
+
const products = targetInventoryCheckItem?.product
|
|
64
|
+
const productDetails = targetInventoryCheckItem?.productDetail
|
|
65
|
+
|
|
66
|
+
return {
|
|
67
|
+
name: cycleCountWSD.name,
|
|
68
|
+
cartonId: inventory?.cartonId,
|
|
69
|
+
palletId: inventory?.palletId,
|
|
70
|
+
batchId: inventory?.batchId,
|
|
71
|
+
product: inventory?.product ? inventory.product : products,
|
|
72
|
+
productDetail: inventory?.productDetail ? inventory.productDetail : productDetails,
|
|
73
|
+
qty: inventory?.qty,
|
|
74
|
+
uomValue: inventory?.uomValue,
|
|
75
|
+
uom: inventory?.uom,
|
|
76
|
+
inspectedQty: targetInventoryCheckItem?.inspectedQty,
|
|
77
|
+
inspectedUomValue: targetInventoryCheckItem?.inspectedUomValue,
|
|
78
|
+
inspectedLocation: targetInventoryCheckItem?.inspectedLocation,
|
|
79
|
+
inspectedBatchNo: targetInventoryCheckItem?.inspectedBatchNo,
|
|
80
|
+
status: cycleCountWSD.status,
|
|
81
|
+
targetName: targetInventoryCheckItem?.name,
|
|
82
|
+
packingType: inventory?.packingType ? inventory.packingType : productDetails.packingType,
|
|
83
|
+
location: inventory?.location ? inventory.location : targetInventoryCheckItem.inspectedLocation,
|
|
84
|
+
relatedInvCheckItem: targetInventoryCheckItem
|
|
85
|
+
}
|
|
86
|
+
})
|
|
87
|
+
)
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { createQueryBuilder, getRepository, In, SelectQueryBuilder } from 'typeorm'
|
|
2
|
+
|
|
3
|
+
import { InventoryCheck, ORDER_STATUS, InventoryCheckItem } from '@things-factory/sales-base'
|
|
4
|
+
import { Domain } from '@things-factory/shell'
|
|
5
|
+
import { Inventory } from '@things-factory/warehouse-base'
|
|
6
|
+
import { ProductDetail, Product } from '@things-factory/product-base'
|
|
7
|
+
|
|
8
|
+
import { WORKSHEET_STATUS, WORKSHEET_TYPE } from '../../../constants'
|
|
9
|
+
import { Worksheet, WorksheetDetail } from '../../../entities'
|
|
10
|
+
|
|
11
|
+
export const cycleCountWorksheetForPalletResolver = {
|
|
12
|
+
async cycleCountWorksheetForPallet(_: any, { inventoryCheckNo, locationSortingRules }, context: any) {
|
|
13
|
+
const { domain }: { domain: Domain } = context.state
|
|
14
|
+
const cycleCount: InventoryCheck = await getRepository(InventoryCheck).findOne({
|
|
15
|
+
where: { domain, name: inventoryCheckNo, status: ORDER_STATUS.INSPECTING }
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
if (!cycleCount) throw new Error('Failed to find cycle count worksheet')
|
|
19
|
+
|
|
20
|
+
const worksheet: Worksheet = await getRepository(Worksheet).findOne({
|
|
21
|
+
where: {
|
|
22
|
+
domain,
|
|
23
|
+
inventoryCheck: cycleCount,
|
|
24
|
+
type: In([WORKSHEET_TYPE.CYCLE_COUNT, WORKSHEET_TYPE.CYCLE_COUNT_RECHECK]),
|
|
25
|
+
status: WORKSHEET_STATUS.EXECUTING
|
|
26
|
+
},
|
|
27
|
+
relations: ['bizplace', 'bizplace.domain']
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
const qb: SelectQueryBuilder<WorksheetDetail> = createQueryBuilder(WorksheetDetail, 'WSD')
|
|
31
|
+
qb.leftJoinAndSelect('WSD.targetInventoryCheckItem', 'T_INV')
|
|
32
|
+
.leftJoinAndSelect('T_INV.inventory', 'INV')
|
|
33
|
+
.leftJoinAndSelect('T_INV.inspectedLocation', 'INS_LOC')
|
|
34
|
+
.leftJoinAndSelect('INV.location', 'LOC_INV')
|
|
35
|
+
.leftJoinAndSelect('T_INV.product', 'PROD')
|
|
36
|
+
.leftJoinAndSelect('INV.product', 'PROD_INV')
|
|
37
|
+
.leftJoinAndSelect('T_INV.productDetail', 'PD')
|
|
38
|
+
.leftJoinAndSelect('INV.productDetail', 'PD_INV')
|
|
39
|
+
.leftJoinAndSelect('LOC_INV.warehouse', 'WH')
|
|
40
|
+
.leftJoinAndSelect('INS_LOC.warehouse', 'INS_WH')
|
|
41
|
+
|
|
42
|
+
if (locationSortingRules?.length > 0) {
|
|
43
|
+
locationSortingRules.forEach((rule: { name: string; desc: boolean }) => {
|
|
44
|
+
qb.addOrderBy(`LOC_INV.${rule.name}`, rule.desc ? 'DESC' : 'ASC')
|
|
45
|
+
})
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const worksheetDetails: WorksheetDetail[] = await qb
|
|
49
|
+
.where('"WSD"."worksheet_id" = :worksheetId', { worksheetId: worksheet.id })
|
|
50
|
+
.andWhere('"WSD"."status" != :status', { status: WORKSHEET_STATUS.REPLACED })
|
|
51
|
+
.getMany()
|
|
52
|
+
|
|
53
|
+
return {
|
|
54
|
+
worksheetInfo: {
|
|
55
|
+
status: worksheet.status,
|
|
56
|
+
startedAt: worksheet.startedAt,
|
|
57
|
+
bizplace: worksheet.bizplace,
|
|
58
|
+
partnerDomainId: worksheet.bizplace?.domain.id
|
|
59
|
+
},
|
|
60
|
+
worksheetDetailInfos: await Promise.all(
|
|
61
|
+
worksheetDetails.map(async (cycleCountWSD: WorksheetDetail) => {
|
|
62
|
+
const targetInventoryCheckItem: InventoryCheckItem = cycleCountWSD.targetInventoryCheckItem
|
|
63
|
+
const inventory = targetInventoryCheckItem?.inventory
|
|
64
|
+
const products = targetInventoryCheckItem?.product
|
|
65
|
+
const productDetails = targetInventoryCheckItem?.productDetail
|
|
66
|
+
|
|
67
|
+
return {
|
|
68
|
+
name: cycleCountWSD.name,
|
|
69
|
+
cartonId: inventory?.cartonId,
|
|
70
|
+
palletId: inventory?.palletId,
|
|
71
|
+
batchId: inventory?.batchId,
|
|
72
|
+
product: inventory?.product ? inventory.product : products,
|
|
73
|
+
productDetail: inventory?.productDetail ? inventory.productDetail : productDetails,
|
|
74
|
+
qty: inventory?.qty,
|
|
75
|
+
uomValue: inventory?.uomValue,
|
|
76
|
+
uom: inventory?.uom,
|
|
77
|
+
inspectedQty: targetInventoryCheckItem?.inspectedQty,
|
|
78
|
+
inspectedUomValue: targetInventoryCheckItem?.inspectedUomValue,
|
|
79
|
+
inspectedLocation: targetInventoryCheckItem?.inspectedLocation,
|
|
80
|
+
inspectedBatchNo: targetInventoryCheckItem?.inspectedBatchNo,
|
|
81
|
+
status: cycleCountWSD.status,
|
|
82
|
+
targetName: targetInventoryCheckItem?.name,
|
|
83
|
+
packingType: inventory?.packingType ? inventory.packingType : productDetails.packingType,
|
|
84
|
+
location: inventory?.location ? inventory.location : targetInventoryCheckItem.inspectedLocation,
|
|
85
|
+
relatedInvCheckItem: targetInventoryCheckItem
|
|
86
|
+
}
|
|
87
|
+
})
|
|
88
|
+
)
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { EntityManager } from 'typeorm'
|
|
2
|
+
|
|
3
|
+
import { User } from '@things-factory/auth-base'
|
|
4
|
+
import { OrderInventory, InventoryCheckItem } from '@things-factory/sales-base'
|
|
5
|
+
import { Domain } from '@things-factory/shell'
|
|
6
|
+
|
|
7
|
+
import { CycleCountWorksheetController } from '../../../../controllers'
|
|
8
|
+
import { Worksheet } from '../../../../entities'
|
|
9
|
+
|
|
10
|
+
export const generateCycleCountWorksheetCartonResolver = {
|
|
11
|
+
async generateCycleCountWorksheetCarton(
|
|
12
|
+
_: any,
|
|
13
|
+
{ executionDate, customerId, cycleCountNo, cartonIds, batchIds, productDetailIds, locationNames },
|
|
14
|
+
context: any
|
|
15
|
+
) {
|
|
16
|
+
const { tx, domain, user }: { tx: EntityManager; domain: Domain; user: User } = context.state
|
|
17
|
+
|
|
18
|
+
const cycleCountWorksheet: Worksheet = await generateCycleCountWorksheetCarton(
|
|
19
|
+
tx,
|
|
20
|
+
domain,
|
|
21
|
+
user,
|
|
22
|
+
executionDate,
|
|
23
|
+
customerId,
|
|
24
|
+
cycleCountNo,
|
|
25
|
+
cartonIds,
|
|
26
|
+
batchIds,
|
|
27
|
+
productDetailIds,
|
|
28
|
+
locationNames
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
return cycleCountWorksheet
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export async function generateCycleCountWorksheetCarton(
|
|
36
|
+
tx: EntityManager,
|
|
37
|
+
domain: Domain,
|
|
38
|
+
user: User,
|
|
39
|
+
executionDate: string,
|
|
40
|
+
customerId: string,
|
|
41
|
+
cycleCountNo: string,
|
|
42
|
+
cartonIds: string[] = [],
|
|
43
|
+
batchIds: string[] = [],
|
|
44
|
+
productDetailIds: string[] = [],
|
|
45
|
+
locationNames: string[] = []
|
|
46
|
+
): Promise<Worksheet> {
|
|
47
|
+
const worksheetController: CycleCountWorksheetController = new CycleCountWorksheetController(tx, domain, user)
|
|
48
|
+
return await worksheetController.generateCycleCountWorksheetCarton(
|
|
49
|
+
executionDate,
|
|
50
|
+
customerId,
|
|
51
|
+
cycleCountNo,
|
|
52
|
+
cartonIds,
|
|
53
|
+
batchIds,
|
|
54
|
+
productDetailIds,
|
|
55
|
+
locationNames
|
|
56
|
+
)
|
|
57
|
+
}
|
package/server/graphql/resolvers/worksheet/generate-worksheet/generate-cycle-count-worksheet.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { EntityManager } from 'typeorm'
|
|
2
2
|
|
|
3
3
|
import { User } from '@things-factory/auth-base'
|
|
4
|
-
import { OrderInventory } from '@things-factory/sales-base'
|
|
4
|
+
import { OrderInventory, InventoryCheckItem } from '@things-factory/sales-base'
|
|
5
5
|
import { Domain } from '@things-factory/shell'
|
|
6
6
|
|
|
7
7
|
import { CycleCountWorksheetController } from '../../../../controllers'
|
|
@@ -10,7 +10,7 @@ import { Worksheet } from '../../../../entities'
|
|
|
10
10
|
export const generateCycleCountWorksheetResolver = {
|
|
11
11
|
async generateCycleCountWorksheet(
|
|
12
12
|
_: any,
|
|
13
|
-
{ executionDate, customerId,
|
|
13
|
+
{ executionDate, customerId, inventoryCheckItemIds, inventoryCheckItems, limit, selectedLocation, cycleCountNo },
|
|
14
14
|
context: any
|
|
15
15
|
) {
|
|
16
16
|
const { tx, domain, user }: { tx: EntityManager; domain: Domain; user: User } = context.state
|
|
@@ -21,9 +21,11 @@ export const generateCycleCountWorksheetResolver = {
|
|
|
21
21
|
user,
|
|
22
22
|
executionDate,
|
|
23
23
|
customerId,
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
limit
|
|
24
|
+
inventoryCheckItemIds,
|
|
25
|
+
inventoryCheckItems,
|
|
26
|
+
limit,
|
|
27
|
+
selectedLocation,
|
|
28
|
+
cycleCountNo
|
|
27
29
|
)
|
|
28
30
|
|
|
29
31
|
return cycleCountWorksheet
|
|
@@ -36,16 +38,20 @@ export async function generateCycleCountWorksheet(
|
|
|
36
38
|
user: User,
|
|
37
39
|
executionDate: string,
|
|
38
40
|
customerId: string,
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
limit: number
|
|
41
|
+
inventoryCheckItemIds: string[] = [],
|
|
42
|
+
inventoryCheckItems: InventoryCheckItem[],
|
|
43
|
+
limit: number,
|
|
44
|
+
selectedLocation: string[] = [],
|
|
45
|
+
cycleCountNo: string
|
|
42
46
|
): Promise<Worksheet> {
|
|
43
47
|
const worksheetController: CycleCountWorksheetController = new CycleCountWorksheetController(tx, domain, user)
|
|
44
48
|
return await worksheetController.generateCycleCountWorksheet(
|
|
45
49
|
executionDate,
|
|
46
50
|
customerId,
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
limit
|
|
51
|
+
inventoryCheckItemIds,
|
|
52
|
+
inventoryCheckItems,
|
|
53
|
+
limit,
|
|
54
|
+
selectedLocation,
|
|
55
|
+
cycleCountNo
|
|
50
56
|
)
|
|
51
57
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { generateArrivalNoticeWorksheetResolver } from './generate-arrival-notice-worksheet'
|
|
2
2
|
import { generateBatchPickingWorksheetResolver } from './generate-batch-picking-worksheet'
|
|
3
3
|
import { generateCycleCountWorksheetResolver } from './generate-cycle-count-worksheet'
|
|
4
|
+
import { generateCycleCountWorksheetCartonResolver } from './generate-cycle-count-worksheet-carton'
|
|
4
5
|
import { generatePartialPutawayWorksheetResolver } from './generate-partial-putaway-worksheet'
|
|
5
6
|
import { generatePutawayWorksheetResolver } from './generate-putaway-worksheet'
|
|
6
7
|
import { generateReleaseGoodWorksheetResolver } from './generate-release-good-worksheet'
|
|
@@ -14,6 +15,7 @@ export const Mutations = {
|
|
|
14
15
|
...generateArrivalNoticeWorksheetResolver,
|
|
15
16
|
...generateBatchPickingWorksheetResolver,
|
|
16
17
|
...generateCycleCountWorksheetResolver,
|
|
18
|
+
...generateCycleCountWorksheetCartonResolver,
|
|
17
19
|
...generatePartialPutawayWorksheetResolver,
|
|
18
20
|
...generatePutawayWorksheetResolver,
|
|
19
21
|
...generateReleaseGoodWorksheetResolver,
|
|
@@ -7,7 +7,8 @@ import { confirmCancellationReleaseOrder } from './confirm-cancellation-release-
|
|
|
7
7
|
import { createWorksheet } from './create-worksheet'
|
|
8
8
|
import { crossDockPickingResolver } from './cross-dock-picking'
|
|
9
9
|
import { cycleCountAdjustmentResolver } from './cycle-count-adjustment'
|
|
10
|
-
import {
|
|
10
|
+
import { cycleCountWorksheetForPalletResolver } from './cycle-count-worksheet-for-pallet'
|
|
11
|
+
import { cycleCountWorksheetForCartonResolver } from './cycle-count-worksheet-for-carton'
|
|
11
12
|
import { deleteWorksheet } from './delete-worksheet'
|
|
12
13
|
import { deliveryOrderByWorksheetResolver } from './delivery-order-by-worksheet'
|
|
13
14
|
import { fetchDeliveryOrderROResolver } from './fetch-delivery-order-ro'
|
|
@@ -85,7 +86,8 @@ export const Query = {
|
|
|
85
86
|
...putawayReturningWorksheetResolver,
|
|
86
87
|
...returnWorksheetResolver,
|
|
87
88
|
...pickingWorksheetResolver,
|
|
88
|
-
...
|
|
89
|
+
...cycleCountWorksheetForPalletResolver,
|
|
90
|
+
...cycleCountWorksheetForCartonResolver,
|
|
89
91
|
...vasWorksheetResolver,
|
|
90
92
|
...loadingWorksheetResolver,
|
|
91
93
|
...unloadedInventories,
|
package/server/graphql/resolvers/worksheet/inspecting/{add-extra-pallet.ts → add-extra-inventory.ts}
RENAMED
|
@@ -3,45 +3,60 @@ import { Domain } from '@things-factory/shell'
|
|
|
3
3
|
import { EntityManager } from 'typeorm'
|
|
4
4
|
import { CycleCountWorksheetController } from '../../../../controllers'
|
|
5
5
|
|
|
6
|
-
export const
|
|
7
|
-
async
|
|
6
|
+
export const addExtraInventoryResolver = {
|
|
7
|
+
async addExtraInventory(
|
|
8
8
|
_: any,
|
|
9
|
-
{
|
|
9
|
+
{
|
|
10
|
+
cycleCountNo,
|
|
11
|
+
inspectedLocation,
|
|
12
|
+
productDetailId,
|
|
13
|
+
productId,
|
|
14
|
+
inspectedBatchNo,
|
|
15
|
+
inspectedQty,
|
|
16
|
+
inspectedUomValue,
|
|
17
|
+
countNo
|
|
18
|
+
},
|
|
10
19
|
context: any
|
|
11
20
|
) {
|
|
12
21
|
const { tx, domain, user }: { tx: EntityManager; domain: Domain; user: User } = context.state
|
|
13
|
-
await
|
|
22
|
+
await addExtraInventory(
|
|
14
23
|
tx,
|
|
15
24
|
domain,
|
|
16
25
|
user,
|
|
17
26
|
cycleCountNo,
|
|
18
|
-
|
|
27
|
+
inspectedLocation,
|
|
28
|
+
productDetailId,
|
|
29
|
+
productId,
|
|
19
30
|
inspectedBatchNo,
|
|
20
31
|
inspectedQty,
|
|
21
32
|
inspectedUomValue,
|
|
22
|
-
|
|
33
|
+
countNo
|
|
23
34
|
)
|
|
24
35
|
}
|
|
25
36
|
}
|
|
26
37
|
|
|
27
|
-
export async function
|
|
38
|
+
export async function addExtraInventory(
|
|
28
39
|
tx: EntityManager,
|
|
29
40
|
domain: Domain,
|
|
30
41
|
user: User,
|
|
31
42
|
cycleCountNo: string,
|
|
32
|
-
|
|
43
|
+
inspectedLocation: string,
|
|
44
|
+
productDetailId: string,
|
|
45
|
+
productId: string,
|
|
33
46
|
inspectedBatchNo: string,
|
|
34
47
|
inspectedQty: number,
|
|
35
48
|
inspectedUomValue: number,
|
|
36
|
-
|
|
49
|
+
countNo: number
|
|
37
50
|
) {
|
|
38
51
|
const worksheetController: CycleCountWorksheetController = new CycleCountWorksheetController(tx, domain, user)
|
|
39
|
-
await worksheetController.
|
|
52
|
+
await worksheetController.addExtraInventory(
|
|
40
53
|
cycleCountNo,
|
|
41
|
-
|
|
54
|
+
inspectedLocation,
|
|
55
|
+
productDetailId,
|
|
56
|
+
productId,
|
|
42
57
|
inspectedBatchNo,
|
|
43
58
|
inspectedQty,
|
|
44
59
|
inspectedUomValue,
|
|
45
|
-
|
|
60
|
+
countNo
|
|
46
61
|
)
|
|
47
62
|
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { User } from '@things-factory/auth-base'
|
|
2
|
+
import { Domain } from '@things-factory/shell'
|
|
3
|
+
import { EntityManager } from 'typeorm'
|
|
4
|
+
import { CycleCountWorksheetController } from '../../../../controllers'
|
|
5
|
+
|
|
6
|
+
export const checkMissingInventoryCartonResolver = {
|
|
7
|
+
async checkMissingInventoryCarton(_: any, { productDetailId, cartonId, batchId, locationId }, context: any) {
|
|
8
|
+
const { tx, domain, user }: { tx: EntityManager; domain: Domain; user: User } = context.state
|
|
9
|
+
await checkMissingInventoryCarton(tx, domain, user, productDetailId, cartonId, batchId, locationId)
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export async function checkMissingInventoryCarton(
|
|
14
|
+
tx: EntityManager,
|
|
15
|
+
domain: Domain,
|
|
16
|
+
user: User,
|
|
17
|
+
productDetailId: string,
|
|
18
|
+
cartonId: string,
|
|
19
|
+
batchId: string,
|
|
20
|
+
locationId: string
|
|
21
|
+
) {
|
|
22
|
+
const worksheetController: CycleCountWorksheetController = new CycleCountWorksheetController(tx, domain, user)
|
|
23
|
+
await worksheetController.checkMissingInventoryCarton(productDetailId, cartonId, batchId, locationId)
|
|
24
|
+
}
|
|
@@ -3,14 +3,19 @@ import { Domain } from '@things-factory/shell'
|
|
|
3
3
|
import { EntityManager } from 'typeorm'
|
|
4
4
|
import { CycleCountWorksheetController } from '../../../../controllers'
|
|
5
5
|
|
|
6
|
-
export const
|
|
7
|
-
async
|
|
6
|
+
export const checkMissingInventoryResolver = {
|
|
7
|
+
async checkMissingInventory(_: any, { worksheetDetailName }, context: any) {
|
|
8
8
|
const { tx, domain, user }: { tx: EntityManager; domain: Domain; user: User } = context.state
|
|
9
|
-
await
|
|
9
|
+
await checkMissingInventory(tx, domain, user, worksheetDetailName)
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
export async function
|
|
13
|
+
export async function checkMissingInventory(
|
|
14
|
+
tx: EntityManager,
|
|
15
|
+
domain: Domain,
|
|
16
|
+
user: User,
|
|
17
|
+
worksheetDetailName: string
|
|
18
|
+
) {
|
|
14
19
|
const worksheetController: CycleCountWorksheetController = new CycleCountWorksheetController(tx, domain, user)
|
|
15
|
-
await worksheetController.
|
|
20
|
+
await worksheetController.checkMissingInventory(worksheetDetailName)
|
|
16
21
|
}
|
|
@@ -1,17 +1,25 @@
|
|
|
1
1
|
import { activateCycleCountResolver } from './activate-cycle-count'
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
2
|
+
import { inspectingPalletResolver } from './inspecting-pallet'
|
|
3
|
+
import { inspectingCartonResolver } from './inspecting-carton'
|
|
4
|
+
import { checkMissingInventoryResolver } from './check-missing-inventory'
|
|
5
|
+
import { addExtraInventoryResolver } from './add-extra-inventory'
|
|
6
|
+
import { relocateInventoryResolver } from './relocate-inventory'
|
|
6
7
|
import { undoInspectionResolver } from './undo-inspection'
|
|
7
8
|
import { completeInspectionResolver } from './complete-inspection'
|
|
9
|
+
import { undoInspectionCartonResolver } from './undo-inspection-carton'
|
|
10
|
+
import { relocateInventoryCartonResolver } from './relocate-inventory-carton'
|
|
11
|
+
import { checkMissingInventoryCartonResolver } from './check-missing-inventory-carton'
|
|
8
12
|
|
|
9
13
|
export const Mutations = {
|
|
10
14
|
...activateCycleCountResolver,
|
|
11
|
-
...
|
|
12
|
-
...
|
|
13
|
-
...
|
|
14
|
-
...
|
|
15
|
+
...inspectingPalletResolver,
|
|
16
|
+
...inspectingCartonResolver,
|
|
17
|
+
...addExtraInventoryResolver,
|
|
18
|
+
...relocateInventoryResolver,
|
|
19
|
+
...checkMissingInventoryResolver,
|
|
15
20
|
...undoInspectionResolver,
|
|
16
|
-
...completeInspectionResolver
|
|
21
|
+
...completeInspectionResolver,
|
|
22
|
+
...undoInspectionCartonResolver,
|
|
23
|
+
...relocateInventoryCartonResolver,
|
|
24
|
+
...checkMissingInventoryCartonResolver
|
|
17
25
|
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { User } from '@things-factory/auth-base'
|
|
2
|
+
import { Domain } from '@things-factory/shell'
|
|
3
|
+
import { EntityManager } from 'typeorm'
|
|
4
|
+
import { CycleCountWorksheetController } from '../../../../controllers'
|
|
5
|
+
import { Product } from 'puppeteer'
|
|
6
|
+
|
|
7
|
+
export const inspectingCartonResolver = {
|
|
8
|
+
async inspectingCarton(
|
|
9
|
+
_: any,
|
|
10
|
+
{ productDetailId, cartonId, batchId, locationId, inspectedBatchNo, inspectedQty, inspectedUomValue },
|
|
11
|
+
context: any
|
|
12
|
+
) {
|
|
13
|
+
const { tx, domain, user }: { tx: EntityManager; domain: Domain; user: User } = context.state
|
|
14
|
+
await executeInspectionCarton(
|
|
15
|
+
tx,
|
|
16
|
+
domain,
|
|
17
|
+
user,
|
|
18
|
+
productDetailId,
|
|
19
|
+
cartonId,
|
|
20
|
+
batchId,
|
|
21
|
+
locationId,
|
|
22
|
+
inspectedBatchNo,
|
|
23
|
+
inspectedQty,
|
|
24
|
+
inspectedUomValue
|
|
25
|
+
)
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export async function executeInspectionCarton(
|
|
30
|
+
tx: EntityManager,
|
|
31
|
+
domain: Domain,
|
|
32
|
+
user: User,
|
|
33
|
+
productDetailId: string,
|
|
34
|
+
cartonId: string,
|
|
35
|
+
batchId: string,
|
|
36
|
+
locationId: string,
|
|
37
|
+
inspectedBatchNo: string,
|
|
38
|
+
inspectedQty: number,
|
|
39
|
+
inspectedUomValue: number
|
|
40
|
+
) {
|
|
41
|
+
const worksheetController: CycleCountWorksheetController = new CycleCountWorksheetController(tx, domain, user)
|
|
42
|
+
await worksheetController.inspectingCarton(
|
|
43
|
+
productDetailId,
|
|
44
|
+
cartonId,
|
|
45
|
+
batchId,
|
|
46
|
+
locationId,
|
|
47
|
+
inspectedBatchNo,
|
|
48
|
+
inspectedQty,
|
|
49
|
+
inspectedUomValue
|
|
50
|
+
)
|
|
51
|
+
}
|
package/server/graphql/resolvers/worksheet/inspecting/{inspecting.ts → inspecting-pallet.ts}
RENAMED
|
@@ -3,14 +3,14 @@ import { Domain } from '@things-factory/shell'
|
|
|
3
3
|
import { EntityManager } from 'typeorm'
|
|
4
4
|
import { CycleCountWorksheetController } from '../../../../controllers'
|
|
5
5
|
|
|
6
|
-
export const
|
|
7
|
-
async
|
|
6
|
+
export const inspectingPalletResolver = {
|
|
7
|
+
async inspectingPallet(_: any, { worksheetDetailName, inspectedBatchNo, inspectedQty, inspectedUomValue }, context: any) {
|
|
8
8
|
const { tx, domain, user }: { tx: EntityManager; domain: Domain; user: User } = context.state
|
|
9
|
-
await
|
|
9
|
+
await executeInspectionPallet(tx, domain, user, worksheetDetailName, inspectedBatchNo, inspectedQty, inspectedUomValue)
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
export async function
|
|
13
|
+
export async function executeInspectionPallet(
|
|
14
14
|
tx: EntityManager,
|
|
15
15
|
domain: Domain,
|
|
16
16
|
user: User,
|
|
@@ -20,5 +20,5 @@ export async function executeInspection(
|
|
|
20
20
|
inspectedUomValue: number
|
|
21
21
|
) {
|
|
22
22
|
const worksheetController: CycleCountWorksheetController = new CycleCountWorksheetController(tx, domain, user)
|
|
23
|
-
await worksheetController.
|
|
23
|
+
await worksheetController.inspectingPallet(worksheetDetailName, inspectedBatchNo, inspectedQty, inspectedUomValue)
|
|
24
24
|
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { User } from '@things-factory/auth-base'
|
|
2
|
+
import { Domain } from '@things-factory/shell'
|
|
3
|
+
import { EntityManager } from 'typeorm'
|
|
4
|
+
import { CycleCountWorksheetController } from '../../../../controllers'
|
|
5
|
+
|
|
6
|
+
export const relocateInventoryCartonResolver = {
|
|
7
|
+
async relocateInventoryCarton(
|
|
8
|
+
_: any,
|
|
9
|
+
{
|
|
10
|
+
productDetailId,
|
|
11
|
+
cartonId,
|
|
12
|
+
batchId,
|
|
13
|
+
locationId,
|
|
14
|
+
inspectedBatchNo,
|
|
15
|
+
inspectedQty,
|
|
16
|
+
inspectedUomValue,
|
|
17
|
+
inspectedLocationName
|
|
18
|
+
},
|
|
19
|
+
context: any
|
|
20
|
+
) {
|
|
21
|
+
const { tx, domain, user }: { tx: EntityManager; domain: Domain; user: User } = context.state
|
|
22
|
+
await relocateInventoryCarton(
|
|
23
|
+
tx,
|
|
24
|
+
domain,
|
|
25
|
+
user,
|
|
26
|
+
productDetailId,
|
|
27
|
+
cartonId,
|
|
28
|
+
batchId,
|
|
29
|
+
locationId,
|
|
30
|
+
inspectedBatchNo,
|
|
31
|
+
inspectedQty,
|
|
32
|
+
inspectedUomValue,
|
|
33
|
+
inspectedLocationName
|
|
34
|
+
)
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export async function relocateInventoryCarton(
|
|
39
|
+
tx: EntityManager,
|
|
40
|
+
domain: Domain,
|
|
41
|
+
user: User,
|
|
42
|
+
productDetailId: string,
|
|
43
|
+
cartonId: string,
|
|
44
|
+
batchId: string,
|
|
45
|
+
locationId: string,
|
|
46
|
+
inspectedBatchNo: string,
|
|
47
|
+
inspectedQty: number,
|
|
48
|
+
inspectedUomValue: number,
|
|
49
|
+
inspectedLocationName: string
|
|
50
|
+
) {
|
|
51
|
+
const worksheetController: CycleCountWorksheetController = new CycleCountWorksheetController(tx, domain, user)
|
|
52
|
+
await worksheetController.relocateInventoryCarton(
|
|
53
|
+
productDetailId,
|
|
54
|
+
cartonId,
|
|
55
|
+
batchId,
|
|
56
|
+
locationId,
|
|
57
|
+
inspectedBatchNo,
|
|
58
|
+
inspectedQty,
|
|
59
|
+
inspectedUomValue,
|
|
60
|
+
inspectedLocationName
|
|
61
|
+
)
|
|
62
|
+
}
|