@things-factory/worksheet-base 4.3.108 → 4.3.110
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 +73 -58
- package/dist-server/controllers/inbound/unloading-worksheet-controller.js.map +1 -1
- package/dist-server/controllers/inspect/cycle-count-worksheet-controller.js +6 -7
- package/dist-server/controllers/inspect/cycle-count-worksheet-controller.js.map +1 -1
- package/dist-server/controllers/outbound/loading-worksheet-controller.js +4 -10
- package/dist-server/controllers/outbound/loading-worksheet-controller.js.map +1 -1
- package/dist-server/controllers/outbound/packing-worksheet-controller.js +24 -33
- package/dist-server/controllers/outbound/packing-worksheet-controller.js.map +1 -1
- package/dist-server/controllers/outbound/picking-worksheet-controller.js +48 -78
- package/dist-server/controllers/outbound/picking-worksheet-controller.js.map +1 -1
- package/dist-server/controllers/outbound/sorting-worksheet-controller.js +14 -12
- package/dist-server/controllers/outbound/sorting-worksheet-controller.js.map +1 -1
- package/dist-server/controllers/render-orientage-do.js +1 -1
- package/dist-server/controllers/render-orientage-do.js.map +1 -1
- package/dist-server/controllers/render-orientage-grn.js +1 -1
- package/dist-server/controllers/render-orientage-grn.js.map +1 -1
- package/dist-server/controllers/vas/vas-worksheet-controller.js +2 -1
- package/dist-server/controllers/vas/vas-worksheet-controller.js.map +1 -1
- package/dist-server/controllers/worksheet-controller.js +9 -7
- package/dist-server/controllers/worksheet-controller.js.map +1 -1
- package/dist-server/entities/index.js +2 -3
- package/dist-server/entities/index.js.map +1 -1
- package/dist-server/entities/warehouse-bizplace-onhand-inventory.js +62 -29
- package/dist-server/entities/warehouse-bizplace-onhand-inventory.js.map +1 -1
- package/dist-server/graphql/resolvers/worksheet/batch-picking-worksheet.js +0 -6
- package/dist-server/graphql/resolvers/worksheet/batch-picking-worksheet.js.map +1 -1
- package/dist-server/graphql/resolvers/worksheet/check-stock-take-current-location.js +39 -43
- package/dist-server/graphql/resolvers/worksheet/check-stock-take-current-location.js.map +1 -1
- package/dist-server/graphql/resolvers/worksheet/confirm-cancellation-release-order.js +39 -1
- 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/inventories-by-pallet.js +1 -2
- package/dist-server/graphql/resolvers/worksheet/inventories-by-pallet.js.map +1 -1
- package/dist-server/graphql/resolvers/worksheet/packing-worksheet.js +1 -4
- package/dist-server/graphql/resolvers/worksheet/packing-worksheet.js.map +1 -1
- package/dist-server/graphql/resolvers/worksheet/picking/complete-batch-picking.js +3 -3
- package/dist-server/graphql/resolvers/worksheet/picking/complete-batch-picking.js.map +1 -1
- package/dist-server/graphql/resolvers/worksheet/picking/complete-picking.js +51 -1
- package/dist-server/graphql/resolvers/worksheet/picking/complete-picking.js.map +1 -1
- package/dist-server/graphql/resolvers/worksheet/picking-worksheet.js +2 -3
- package/dist-server/graphql/resolvers/worksheet/picking-worksheet.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/unloaded-inventories.js +1 -1
- package/dist-server/graphql/resolvers/worksheet/unloaded-inventories.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/worksheets.js +1 -1
- package/dist-server/graphql/resolvers/worksheet/worksheets.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-detail/index.js +0 -1
- package/dist-server/graphql/types/worksheet-detail/index.js.map +1 -1
- package/dist-server/utils/inventory-util.js +98 -1
- package/dist-server/utils/inventory-util.js.map +1 -1
- package/package.json +18 -17
- package/server/controllers/inbound/unloading-worksheet-controller.ts +86 -72
- package/server/controllers/inspect/cycle-count-worksheet-controller.ts +6 -7
- package/server/controllers/outbound/loading-worksheet-controller.ts +3 -9
- package/server/controllers/outbound/packing-worksheet-controller.ts +36 -41
- package/server/controllers/outbound/picking-worksheet-controller.ts +66 -98
- package/server/controllers/outbound/sorting-worksheet-controller.ts +12 -12
- package/server/controllers/render-orientage-do.ts +1 -1
- package/server/controllers/render-orientage-grn.ts +12 -12
- package/server/controllers/vas/vas-worksheet-controller.ts +2 -2
- package/server/controllers/worksheet-controller.ts +12 -15
- package/server/entities/index.ts +2 -2
- package/server/entities/warehouse-bizplace-onhand-inventory.ts +63 -29
- package/server/graphql/resolvers/worksheet/batch-picking-worksheet.ts +0 -6
- package/server/graphql/resolvers/worksheet/check-stock-take-current-location.ts +50 -52
- package/server/graphql/resolvers/worksheet/confirm-cancellation-release-order.ts +43 -1
- package/server/graphql/resolvers/worksheet/cycle-count-adjustment.ts +2 -2
- package/server/graphql/resolvers/worksheet/inventories-by-pallet.ts +1 -3
- package/server/graphql/resolvers/worksheet/packing-worksheet.ts +2 -4
- package/server/graphql/resolvers/worksheet/picking/complete-batch-picking.ts +3 -3
- package/server/graphql/resolvers/worksheet/picking/complete-picking.ts +57 -1
- package/server/graphql/resolvers/worksheet/picking-worksheet.ts +2 -3
- package/server/graphql/resolvers/worksheet/transfer.ts +16 -18
- package/server/graphql/resolvers/worksheet/unloaded-inventories.ts +1 -1
- package/server/graphql/resolvers/worksheet/vas-transactions/common-utils.ts +2 -3
- package/server/graphql/resolvers/worksheet/worksheets.ts +1 -1
- package/server/graphql/resolvers/worksheet-detail/regenerate-release-good-worksheet-details.ts +1 -4
- package/server/graphql/types/worksheet-detail/index.ts +0 -1
- package/server/utils/inventory-util.ts +126 -1
|
@@ -28,13 +28,12 @@ import {
|
|
|
28
28
|
Location,
|
|
29
29
|
LOCATION_TYPE,
|
|
30
30
|
Tote,
|
|
31
|
-
TOTE_STATUS
|
|
32
|
-
generateInventoryHistory
|
|
31
|
+
TOTE_STATUS
|
|
33
32
|
} from '@things-factory/warehouse-base'
|
|
34
33
|
|
|
35
34
|
import { TASK_NUMBER_RULE_TYPE, TASK_NUMBER_SETTING_KEY, WORKSHEET_STATUS, WORKSHEET_TYPE } from '../../constants'
|
|
36
35
|
import { Worksheet, WorksheetDetail } from '../../entities'
|
|
37
|
-
import { WorksheetNoGenerator } from '../../utils'
|
|
36
|
+
import { generateInventoryHistory, WorksheetNoGenerator } from '../../utils'
|
|
38
37
|
import { VasWorksheetController } from '../vas/vas-worksheet-controller'
|
|
39
38
|
|
|
40
39
|
export class PickingWorksheetController extends VasWorksheetController {
|
|
@@ -214,7 +213,7 @@ export class PickingWorksheetController extends VasWorksheetController {
|
|
|
214
213
|
if (vasWorksheet) {
|
|
215
214
|
await this.activateVAS(vasWorksheet.name, vasWorksheet.worksheetDetails)
|
|
216
215
|
}
|
|
217
|
-
} catch (e) {}
|
|
216
|
+
} catch (e) { }
|
|
218
217
|
|
|
219
218
|
const pendingSplitOIs: OrderInventory[] = await this.trxMgr.getRepository(OrderInventory).find({
|
|
220
219
|
where: { domain: this.domain, releaseGood, status: ORDER_INVENTORY_STATUS.PENDING_SPLIT }
|
|
@@ -431,7 +430,11 @@ export class PickingWorksheetController extends VasWorksheetController {
|
|
|
431
430
|
.innerJoinAndSelect('oi.inventory', 'inv')
|
|
432
431
|
.leftJoinAndSelect('oi.orderProduct', 'op')
|
|
433
432
|
.innerJoinAndSelect('oi.product', 'prd')
|
|
434
|
-
.
|
|
433
|
+
.leftJoinAndSelect(
|
|
434
|
+
'prd.productDetails',
|
|
435
|
+
'pd',
|
|
436
|
+
'pd.product_id = oi.product_id AND pd.deleted_at is null AND pd.packing_type = oi.packing_type AND pd.packing_size = oi.packing_size AND pd.uom = oi.uom'
|
|
437
|
+
)
|
|
435
438
|
.where('wd.name = :name', { name: worksheetDetailName })
|
|
436
439
|
.andWhere('wd.domain_id = :domainId', { domainId: this.domain.id })
|
|
437
440
|
.andWhere('wd.type = :type', { type: worksheetType })
|
|
@@ -440,41 +443,27 @@ export class PickingWorksheetController extends VasWorksheetController {
|
|
|
440
443
|
.getOne()
|
|
441
444
|
|
|
442
445
|
//validation to check matching worksheet detail based on name
|
|
443
|
-
if (!worksheetDetail
|
|
444
|
-
|
|
445
|
-
const releaseGood: ReleaseGood = worksheetDetail.targetInventory.releaseGood
|
|
446
|
-
let targetInventory: OrderInventory = worksheetDetail.targetInventory
|
|
447
|
-
let targetProduct: OrderProduct = targetInventory.orderProduct
|
|
448
|
-
const product: Product = targetInventory.product
|
|
449
|
-
const productDetail: ProductDetail = targetInventory.productDetail
|
|
450
|
-
let inventory: Inventory = targetInventory.inventory
|
|
451
|
-
let bizplace: Bizplace = worksheetDetail.worksheet.bizplace
|
|
452
|
-
let pickedUomValue = pickedQty * productDetail.uomValue
|
|
453
|
-
let matchingProduct
|
|
446
|
+
if (!worksheetDetail || !worksheetDetail.targetInventory)
|
|
447
|
+
throw new Error(this.ERROR_MSG.FIND.NO_RESULT(worksheetDetailName))
|
|
454
448
|
|
|
455
449
|
//validation to prevent duplicated picking
|
|
456
|
-
if (targetInventory?.status != ORDER_INVENTORY_STATUS.PICKING)
|
|
450
|
+
if (worksheetDetail?.targetInventory?.status != ORDER_INVENTORY_STATUS.PICKING)
|
|
457
451
|
throw new Error(this.ERROR_MSG.VALIDITY.CANT_PROCEED_STEP_BY('picking', `is done`))
|
|
458
452
|
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
},
|
|
468
|
-
productBarcode,
|
|
469
|
-
pickedQty
|
|
470
|
-
)
|
|
453
|
+
let matchingProduct = await this.getDirectQty(
|
|
454
|
+
{
|
|
455
|
+
...worksheetDetail?.targetInventory?.product?.productDetails[0],
|
|
456
|
+
product: worksheetDetail?.targetInventory?.product
|
|
457
|
+
},
|
|
458
|
+
productBarcode,
|
|
459
|
+
pickedQty
|
|
460
|
+
)
|
|
471
461
|
|
|
472
|
-
|
|
473
|
-
|
|
462
|
+
//validate matching product details based on scanned barcode
|
|
463
|
+
if (!matchingProduct) throw new Error(this.ERROR_MSG.FIND.NO_RESULT(productBarcode))
|
|
474
464
|
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
}
|
|
465
|
+
pickedQty = matchingProduct.qty
|
|
466
|
+
let pickedUomValue = matchingProduct.uomValue
|
|
478
467
|
|
|
479
468
|
//validation to prevent over release
|
|
480
469
|
if (
|
|
@@ -484,24 +473,15 @@ export class PickingWorksheetController extends VasWorksheetController {
|
|
|
484
473
|
)
|
|
485
474
|
throw new Error(this.ERROR_MSG.VALIDITY.CANT_PROCEED_STEP_BY('picking', `over release`))
|
|
486
475
|
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
// // search for matching product barcode
|
|
490
|
-
// const productDetails: ProductDetail[] = product?.productDetails.filter(detail => !detail.deletedAt)
|
|
491
|
-
// // scannedProductDetail can be child or gtin
|
|
492
|
-
// const scannedProductDetail: ProductDetail = productDetails.find(detail => detail.gtin == productBarcode)
|
|
493
|
-
// if (!scannedProductDetail) throw new Error(this.ERROR_MSG.FIND.NO_RESULT(productBarcode))
|
|
476
|
+
const releaseGood: ReleaseGood = worksheetDetail.targetInventory.releaseGood
|
|
494
477
|
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
// }
|
|
478
|
+
let targetInventory: OrderInventory = worksheetDetail.targetInventory
|
|
479
|
+
let targetProduct: OrderProduct = targetInventory.orderProduct
|
|
480
|
+
let inventory: Inventory = targetInventory.inventory
|
|
481
|
+
let bizplace: Bizplace = worksheetDetail.worksheet.bizplace
|
|
482
|
+
const product: Product = targetInventory.product
|
|
501
483
|
|
|
502
|
-
|
|
503
|
-
// throw new Error(this.ERROR_MSG.VALIDITY.CANT_PROCEED_STEP_BY('picking', `over release`))
|
|
504
|
-
// }
|
|
484
|
+
targetInventory = await this.checkAndSetBinPicking(targetInventory, binLocation)
|
|
505
485
|
|
|
506
486
|
// for required outbound serial number scanning
|
|
507
487
|
if (product?.isRequireSerialNumberScanningOutbound) {
|
|
@@ -549,7 +529,6 @@ export class PickingWorksheetController extends VasWorksheetController {
|
|
|
549
529
|
inventoryItem.outboundOrderId = releaseGood.id
|
|
550
530
|
inventoryItem.source = INVENTORY_ITEM_SOURCE.OUTBOUND
|
|
551
531
|
inventoryItem.product = product
|
|
552
|
-
inventoryItem.productDetail = productDetail
|
|
553
532
|
inventoryItem.inventory = inventory
|
|
554
533
|
inventoryItem.domain = this.domain
|
|
555
534
|
|
|
@@ -715,15 +694,13 @@ export class PickingWorksheetController extends VasWorksheetController {
|
|
|
715
694
|
'targetInventory.orderProduct',
|
|
716
695
|
'targetInventory.inventory',
|
|
717
696
|
'targetInventory.inventory.location',
|
|
718
|
-
'targetInventory.product'
|
|
719
|
-
'targetInventory.productDetail'
|
|
697
|
+
'targetInventory.product'
|
|
720
698
|
]
|
|
721
699
|
)
|
|
722
700
|
|
|
723
701
|
const releaseGood: ReleaseGood = worksheetDetail.targetInventory.releaseGood
|
|
724
702
|
let targetInventory: OrderInventory = worksheetDetail.targetInventory
|
|
725
703
|
const product: Product = targetInventory.product
|
|
726
|
-
const productDetail: ProductDetail = targetInventory.productDetail
|
|
727
704
|
let inventory: Inventory = targetInventory.inventory
|
|
728
705
|
let targetProduct: OrderProduct = targetInventory.orderProduct
|
|
729
706
|
let bizplace: Bizplace = worksheetDetail.worksheet.bizplace
|
|
@@ -753,13 +730,13 @@ export class PickingWorksheetController extends VasWorksheetController {
|
|
|
753
730
|
})
|
|
754
731
|
|
|
755
732
|
let foundSerialNumber: InventoryItem = await this.trxMgr.getRepository(InventoryItem).findOne({
|
|
756
|
-
where: { domain: this.domain, serialNumber: serialNumber,
|
|
757
|
-
relations: ['product', '
|
|
733
|
+
where: { domain: this.domain, serialNumber: serialNumber, product },
|
|
734
|
+
relations: ['product', 'inventory']
|
|
758
735
|
})
|
|
759
736
|
|
|
760
737
|
let scannedPalletIdInventory: Inventory = await this.trxMgr
|
|
761
738
|
.getRepository(Inventory)
|
|
762
|
-
.findOne({ where: { domain: this.domain, palletId }, relations: ['
|
|
739
|
+
.findOne({ where: { domain: this.domain, palletId }, relations: ['product'] })
|
|
763
740
|
|
|
764
741
|
if (foundSerialNumber) {
|
|
765
742
|
if (foundSerialNumber.outboundOrderId) {
|
|
@@ -786,7 +763,6 @@ export class PickingWorksheetController extends VasWorksheetController {
|
|
|
786
763
|
inventoryItem.source = INVENTORY_ITEM_SOURCE.OUTBOUND
|
|
787
764
|
inventoryItem.outboundOrderId = releaseGood.id
|
|
788
765
|
inventoryItem.product = product
|
|
789
|
-
inventoryItem.productDetail = productDetail
|
|
790
766
|
inventoryItem.inventory = scannedPalletIdInventory
|
|
791
767
|
inventoryItem.domain = this.domain
|
|
792
768
|
|
|
@@ -812,7 +788,8 @@ export class PickingWorksheetController extends VasWorksheetController {
|
|
|
812
788
|
)
|
|
813
789
|
} else if (
|
|
814
790
|
scannedPalletIdInventory.batchId == inventory.batchId &&
|
|
815
|
-
scannedPalletIdInventory.
|
|
791
|
+
scannedPalletIdInventory.product.id == product.id &&
|
|
792
|
+
scannedPalletIdInventory.product.packingType == product.packingType
|
|
816
793
|
) {
|
|
817
794
|
//if replacement order inventory does not exist
|
|
818
795
|
await this.serialNumberReplacement(
|
|
@@ -820,7 +797,6 @@ export class PickingWorksheetController extends VasWorksheetController {
|
|
|
820
797
|
scannedPalletIdInventory,
|
|
821
798
|
releaseGood,
|
|
822
799
|
product,
|
|
823
|
-
productDetail,
|
|
824
800
|
worksheetDetail,
|
|
825
801
|
foundSerialNumber
|
|
826
802
|
)
|
|
@@ -996,8 +972,6 @@ export class PickingWorksheetController extends VasWorksheetController {
|
|
|
996
972
|
'worksheetDetails.targetInventory.releaseGood',
|
|
997
973
|
'worksheetDetails.targetInventory.inventory',
|
|
998
974
|
'worksheetDetails.targetInventory.inventory.location',
|
|
999
|
-
'worksheetDetails.targetInventory.productDetail',
|
|
1000
|
-
'worksheetDetails.targetInventory.productDetail.product',
|
|
1001
975
|
'worksheetDetails.targetInventory.product',
|
|
1002
976
|
'worksheetDetails.targetInventory.product.productDetails',
|
|
1003
977
|
'worksheetDetails.targetInventory.product.productDetails.childProductDetail'
|
|
@@ -1005,53 +979,49 @@ export class PickingWorksheetController extends VasWorksheetController {
|
|
|
1005
979
|
})
|
|
1006
980
|
|
|
1007
981
|
const worksheetDetails: WorksheetDetail[] = worksheet.worksheetDetails
|
|
1008
|
-
const
|
|
1009
|
-
.map(wsd => wsd.targetInventory.
|
|
1010
|
-
.find(
|
|
1011
|
-
|
|
1012
|
-
const product: Product = productDetail.product
|
|
982
|
+
const product: Product = worksheetDetails
|
|
983
|
+
.map((wsd: WorksheetDetail) => wsd.targetInventory.product)
|
|
984
|
+
.find((product: Product) => product.id === inventory.product.id)
|
|
1013
985
|
|
|
1014
986
|
const batchId: string = inventory.batchId
|
|
987
|
+
const packingType: string = inventory.packingType
|
|
988
|
+
const packingSize: number = inventory.packingSize
|
|
1015
989
|
let pickedQty: number = pickingQty ? pickingQty : 1
|
|
1016
|
-
let matchingProduct
|
|
1017
990
|
|
|
1018
991
|
const targetInventories: OrderInventory[] = worksheetDetails
|
|
1019
992
|
.map((wsd: WorksheetDetail) => wsd.targetInventory)
|
|
1020
993
|
.filter(
|
|
1021
994
|
(targetInventory: OrderInventory) =>
|
|
1022
995
|
targetInventory.batchId === batchId &&
|
|
996
|
+
targetInventory.packingType === packingType &&
|
|
1023
997
|
targetInventory.inventory.cartonId === cartonId &&
|
|
1024
|
-
targetInventory.
|
|
1025
|
-
)
|
|
1026
|
-
|
|
1027
|
-
if (productBarcode !== productDetail.gtin) {
|
|
1028
|
-
matchingProduct = await this.getDirectQty(
|
|
1029
|
-
{
|
|
1030
|
-
...productDetail,
|
|
1031
|
-
product
|
|
1032
|
-
},
|
|
1033
|
-
productBarcode,
|
|
1034
|
-
pickedQty
|
|
998
|
+
targetInventory.product.id === product.id
|
|
1035
999
|
)
|
|
1036
1000
|
|
|
1037
|
-
|
|
1038
|
-
|
|
1001
|
+
// search for matching product barcode
|
|
1002
|
+
const productDetails: ProductDetail[] = product?.productDetails.filter(detail => !detail.deletedAt)
|
|
1003
|
+
const isMatchingBarcode: boolean = productDetails.map(detail => detail.gtin).includes(productBarcode)
|
|
1004
|
+
if (!isMatchingBarcode) throw new Error(this.ERROR_MSG.FIND.NO_RESULT(`GTIN (${productBarcode})`))
|
|
1039
1005
|
|
|
1040
|
-
|
|
1041
|
-
|
|
1006
|
+
// case for scanning parent packing type, packing size
|
|
1007
|
+
const foundProductDetail: ProductDetail = productDetails.find(
|
|
1008
|
+
(detail: ProductDetail) =>
|
|
1009
|
+
detail.gtin === productBarcode && detail.packingType === packingType && detail.packingSize == packingSize
|
|
1010
|
+
)
|
|
1042
1011
|
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1012
|
+
if (!foundProductDetail) {
|
|
1013
|
+
const roProductDetail: ProductDetail = productDetails.find(
|
|
1014
|
+
(parentDetail: ProductDetail) =>
|
|
1015
|
+
parentDetail.packingType === packingType && parentDetail.packingSize == packingSize
|
|
1016
|
+
)
|
|
1017
|
+
if (!roProductDetail)
|
|
1018
|
+
throw new Error(
|
|
1019
|
+
this.ERROR_MSG.FIND.NO_RESULT(`Packing Type ( ${packingType}) or Packing Size (${packingSize})`)
|
|
1020
|
+
)
|
|
1048
1021
|
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
// let childQty = await this.getChildQty(productDetails, productBarcode, productDetail, scannedProductDetail)
|
|
1053
|
-
// pickedQty *= childQty
|
|
1054
|
-
// }
|
|
1022
|
+
let childQty = await this.getChildQty(productDetails, productBarcode, roProductDetail)
|
|
1023
|
+
pickedQty *= childQty
|
|
1024
|
+
}
|
|
1055
1025
|
|
|
1056
1026
|
const sumOfReleaseQty: number = targetInventories
|
|
1057
1027
|
.map((oi: OrderInventory) => oi.releaseQty)
|
|
@@ -1436,7 +1406,7 @@ export class PickingWorksheetController extends VasWorksheetController {
|
|
|
1436
1406
|
await this.trxMgr.getRepository(WorksheetDetail).delete(worksheetDetail.ild)
|
|
1437
1407
|
await this.trxMgr.getRepository(OrderInventory).delete(targetInventory.id)
|
|
1438
1408
|
}
|
|
1439
|
-
} catch (e) {}
|
|
1409
|
+
} catch (e) { }
|
|
1440
1410
|
}
|
|
1441
1411
|
|
|
1442
1412
|
private async serialNumberReplacement(
|
|
@@ -1444,7 +1414,6 @@ export class PickingWorksheetController extends VasWorksheetController {
|
|
|
1444
1414
|
scannedPalletIdInventory,
|
|
1445
1415
|
releaseGood,
|
|
1446
1416
|
product,
|
|
1447
|
-
productDetail,
|
|
1448
1417
|
worksheetDetail,
|
|
1449
1418
|
foundSerialNumber
|
|
1450
1419
|
) {
|
|
@@ -1509,7 +1478,6 @@ export class PickingWorksheetController extends VasWorksheetController {
|
|
|
1509
1478
|
releaseUomValue: newOrderInventoryReleaseUomValue,
|
|
1510
1479
|
pickedQty: 1,
|
|
1511
1480
|
product,
|
|
1512
|
-
productDetail,
|
|
1513
1481
|
inventory: scannedPalletIdInventory,
|
|
1514
1482
|
creator: this.user,
|
|
1515
1483
|
updater: this.user
|
|
@@ -1553,7 +1521,7 @@ export class PickingWorksheetController extends VasWorksheetController {
|
|
|
1553
1521
|
await this.trxMgr.getRepository(WorksheetDetail).delete(worksheetDetail.id)
|
|
1554
1522
|
await this.trxMgr.getRepository(OrderInventory).delete(targetInventory.id)
|
|
1555
1523
|
}
|
|
1556
|
-
} catch (e) {}
|
|
1524
|
+
} catch (e) { }
|
|
1557
1525
|
}
|
|
1558
1526
|
|
|
1559
1527
|
private async toteScanning(toteNo, targetProduct, targetInventory, pickedQty, releaseGood, bizplace) {
|
|
@@ -95,8 +95,7 @@ export class SortingWorksheetController extends VasWorksheetController {
|
|
|
95
95
|
'worksheetDetails.targetInventory.inventory.product',
|
|
96
96
|
'worksheetDetails.targetInventory.inventory.product.productDetails',
|
|
97
97
|
'worksheetDetails.targetInventory.inventory.product.productDetails.product',
|
|
98
|
-
'worksheetDetails.targetInventory.releaseGood'
|
|
99
|
-
'worksheetDetails.targetInventory.productDetail'
|
|
98
|
+
'worksheetDetails.targetInventory.releaseGood'
|
|
100
99
|
]
|
|
101
100
|
})
|
|
102
101
|
|
|
@@ -119,12 +118,17 @@ export class SortingWorksheetController extends VasWorksheetController {
|
|
|
119
118
|
const matchingProductDetail: ProductDetail = productDetails.find(
|
|
120
119
|
(productDetail: ProductDetail) => productDetail.gtin === productBarcode
|
|
121
120
|
)
|
|
122
|
-
if (!matchingProductDetail) throw new Error(
|
|
121
|
+
if (!matchingProductDetail) throw new Error('Unable to find product barcode.')
|
|
123
122
|
const packingType: string = matchingProductDetail.packingType
|
|
124
123
|
const packingSize: number = matchingProductDetail.packingSize
|
|
124
|
+
if (!matchingProductDetail)
|
|
125
|
+
throw new Error(this.ERROR_MSG.PRODUCT.BARCODE_NOT_EXIST(productBarcode, packingType, packingSize))
|
|
125
126
|
|
|
126
127
|
let matchingOIs: OrderInventory[] = orderInventories.filter(
|
|
127
|
-
(oi: OrderInventory) =>
|
|
128
|
+
(oi: OrderInventory) =>
|
|
129
|
+
oi.packingType === packingType &&
|
|
130
|
+
oi.packingSize === packingSize &&
|
|
131
|
+
oi.product?.id === matchingProductDetail.product?.id
|
|
128
132
|
)
|
|
129
133
|
|
|
130
134
|
let sortedQty: number = 1
|
|
@@ -138,7 +142,6 @@ export class SortingWorksheetController extends VasWorksheetController {
|
|
|
138
142
|
const inventory: Inventory = matchingOI.inventory
|
|
139
143
|
const releaseGood: ReleaseGood = matchingOI.releaseGood
|
|
140
144
|
const product: Product = inventory.product
|
|
141
|
-
const productDetail: ProductDetail = matchingOI.productDetail
|
|
142
145
|
|
|
143
146
|
if (releaseQty != matchingOI?.sortedQty && sortedQty == 1) {
|
|
144
147
|
// Serial Number scanning for batch picking
|
|
@@ -150,7 +153,7 @@ export class SortingWorksheetController extends VasWorksheetController {
|
|
|
150
153
|
|
|
151
154
|
let foundSerialNumber: InventoryItem = await this.trxMgr
|
|
152
155
|
.getRepository(InventoryItem)
|
|
153
|
-
.findOne({ where: { domain: this.domain, serialNumber: serialNumber,
|
|
156
|
+
.findOne({ where: { domain: this.domain, serialNumber: serialNumber, product } })
|
|
154
157
|
|
|
155
158
|
if (foundSerialNumber) {
|
|
156
159
|
if (foundSerialNumber.inventoryId !== inventory.id) {
|
|
@@ -177,7 +180,6 @@ export class SortingWorksheetController extends VasWorksheetController {
|
|
|
177
180
|
inventoryItem.outboundOrderId = releaseGood.id
|
|
178
181
|
inventoryItem.source = INVENTORY_ITEM_SOURCE.OUTBOUND
|
|
179
182
|
inventoryItem.product = product
|
|
180
|
-
inventoryItem.productDetail = productDetail
|
|
181
183
|
inventoryItem.inventory = inventory
|
|
182
184
|
inventoryItem.domain = this.domain
|
|
183
185
|
|
|
@@ -261,8 +263,7 @@ export class SortingWorksheetController extends VasWorksheetController {
|
|
|
261
263
|
'worksheetDetails.targetInventory.inventory.product',
|
|
262
264
|
'worksheetDetails.targetInventory.inventory.product.productDetails',
|
|
263
265
|
'worksheetDetails.targetInventory.inventory.product.productDetails.product',
|
|
264
|
-
'worksheetDetails.targetInventory.releaseGood'
|
|
265
|
-
'worksheetDetails.targetInventory.productDetail'
|
|
266
|
+
'worksheetDetails.targetInventory.releaseGood'
|
|
266
267
|
]
|
|
267
268
|
})
|
|
268
269
|
|
|
@@ -282,7 +283,6 @@ export class SortingWorksheetController extends VasWorksheetController {
|
|
|
282
283
|
const inventory: Inventory = matchingOI.inventory
|
|
283
284
|
const releaseGood: ReleaseGood = matchingOI.releaseGood
|
|
284
285
|
const product: Product = matchingOI.inventory.product
|
|
285
|
-
const productDetail: ProductDetail = matchingOI.productDetail
|
|
286
286
|
const packingType: string = matchingOI.packingType
|
|
287
287
|
const packingSize: number = matchingOI.packingSize
|
|
288
288
|
|
|
@@ -292,7 +292,8 @@ export class SortingWorksheetController extends VasWorksheetController {
|
|
|
292
292
|
}
|
|
293
293
|
|
|
294
294
|
let foundSerialNumber: InventoryItem = await this.trxMgr.getRepository(InventoryItem).findOne({
|
|
295
|
-
where: { domain: this.domain, serialNumber: serialNumber,
|
|
295
|
+
where: { domain: this.domain, serialNumber: serialNumber, product },
|
|
296
|
+
relations: ['product', 'inventory']
|
|
296
297
|
})
|
|
297
298
|
|
|
298
299
|
if (foundSerialNumber) {
|
|
@@ -316,7 +317,6 @@ export class SortingWorksheetController extends VasWorksheetController {
|
|
|
316
317
|
inventoryItem.source = INVENTORY_ITEM_SOURCE.OUTBOUND
|
|
317
318
|
inventoryItem.outboundOrderId = releaseGood.id
|
|
318
319
|
inventoryItem.product = product
|
|
319
|
-
inventoryItem.productDetail = productDetail
|
|
320
320
|
inventoryItem.inventory = inventory
|
|
321
321
|
inventoryItem.domain = this.domain
|
|
322
322
|
|
|
@@ -51,7 +51,7 @@ export async function renderOrientageDO({ doNo }, context: any) {
|
|
|
51
51
|
const ownRefNo3 = foundRO.refNo3
|
|
52
52
|
|
|
53
53
|
const partnerDomain: Partner = await getRepository(Partner).findOne({
|
|
54
|
-
where: { partnerDomain: partnerBiz.domain },
|
|
54
|
+
where: { domain, partnerDomain: partnerBiz.domain },
|
|
55
55
|
relations: ['domain']
|
|
56
56
|
})
|
|
57
57
|
|
|
@@ -44,7 +44,7 @@ export async function renderOrientageGRN({ grnNo }, context: any) {
|
|
|
44
44
|
const partnerBiz: Bizplace = foundGRN.bizplace
|
|
45
45
|
|
|
46
46
|
const partnerDomain: Partner = await getRepository(Partner).findOne({
|
|
47
|
-
where: { partnerDomain: partnerBiz.domain },
|
|
47
|
+
where: { partnerDomain: partnerBiz.domain, domain },
|
|
48
48
|
relations: ['domain']
|
|
49
49
|
})
|
|
50
50
|
|
|
@@ -123,16 +123,16 @@ export async function renderOrientageGRN({ grnNo }, context: any) {
|
|
|
123
123
|
pack_size: matchedProductDetail
|
|
124
124
|
? matchedProductDetail.uomValue
|
|
125
125
|
? matchedProductDetail.uomValue +
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
126
|
+
' ' +
|
|
127
|
+
matchedProductDetail.uom +
|
|
128
|
+
(item.product.volumeSize ? ' x ' + (parseFloat(item.product.volumeSize) / 100).toFixed(2) + ' L' : '')
|
|
129
129
|
: null
|
|
130
130
|
: item.product.primaryValue
|
|
131
|
-
|
|
131
|
+
? item.product.primaryValue +
|
|
132
132
|
' ' +
|
|
133
133
|
item.product.primaryUnit +
|
|
134
134
|
(item.product.volumeSize ? ' x ' + (parseFloat(item.product.volumeSize) / 100).toFixed(2) + ' L' : '')
|
|
135
|
-
|
|
135
|
+
: null,
|
|
136
136
|
pack_qty: item.packQty ? item.packQty : 0,
|
|
137
137
|
actual_pack_qty: item.actualPackQty ? item.actualPackQty : 0,
|
|
138
138
|
container_no: foundGAN.containerNo ? foundGAN.containerNo : '',
|
|
@@ -142,15 +142,15 @@ export async function renderOrientageGRN({ grnNo }, context: any) {
|
|
|
142
142
|
? matchedProductDetail.volume
|
|
143
143
|
: 0
|
|
144
144
|
: item?.product?.volume
|
|
145
|
-
|
|
146
|
-
|
|
145
|
+
? item.product.volume
|
|
146
|
+
: 0,
|
|
147
147
|
total_volume: matchedProductDetail
|
|
148
148
|
? matchedProductDetail.volume
|
|
149
149
|
? Number((matchedProductDetail.volume * item.actualPackQty).toFixed(4))
|
|
150
150
|
: 0
|
|
151
151
|
: item?.product?.volume
|
|
152
|
-
|
|
153
|
-
|
|
152
|
+
? Number((item.product.volume * item.actualPackQty).toFixed(4))
|
|
153
|
+
: 0,
|
|
154
154
|
manufacture_year: item.manufactureDate ? new Date(item.manufactureDate).getFullYear() : null,
|
|
155
155
|
manufacture_date: item.manufactureDate ? item.manufactureDate : null,
|
|
156
156
|
literage: matchedProductDetail
|
|
@@ -158,8 +158,8 @@ export async function renderOrientageGRN({ grnNo }, context: any) {
|
|
|
158
158
|
? parseFloat(matchedProductDetail.packingSize) * parseFloat(item.product.volumeSize)
|
|
159
159
|
: 0
|
|
160
160
|
: item.packingSize
|
|
161
|
-
|
|
162
|
-
|
|
161
|
+
? parseFloat(item.packingSize) * parseFloat(item.product.volumeSize)
|
|
162
|
+
: 0,
|
|
163
163
|
remark: item.remark || ''
|
|
164
164
|
}
|
|
165
165
|
})
|
|
@@ -22,8 +22,7 @@ import {
|
|
|
22
22
|
InventoryNoGenerator,
|
|
23
23
|
Location,
|
|
24
24
|
LOCATION_TYPE,
|
|
25
|
-
Warehouse
|
|
26
|
-
generateInventoryHistory
|
|
25
|
+
Warehouse
|
|
27
26
|
} from '@things-factory/warehouse-base'
|
|
28
27
|
|
|
29
28
|
import { WORKSHEET_STATUS, WORKSHEET_TYPE } from '../../constants'
|
|
@@ -37,6 +36,7 @@ import {
|
|
|
37
36
|
RefOrderType
|
|
38
37
|
} from '../../graphql/resolvers/worksheet/vas-transactions'
|
|
39
38
|
import { PackingUnits } from '../../graphql/resolvers/worksheet/vas-transactions/interfaces/repackaging'
|
|
39
|
+
import { generateInventoryHistory } from '../../utils'
|
|
40
40
|
import { ReferenceOrderType, WorksheetController } from '../worksheet-controller'
|
|
41
41
|
|
|
42
42
|
type CompleteTransactionType = (trxMgr: EntityManager, orderVas: OrderVas, user: User) => Promise<void>
|
|
@@ -19,17 +19,11 @@ import {
|
|
|
19
19
|
VasOrder
|
|
20
20
|
} from '@things-factory/sales-base'
|
|
21
21
|
import { Domain } from '@things-factory/shell'
|
|
22
|
-
import {
|
|
23
|
-
Inventory,
|
|
24
|
-
INVENTORY_STATUS,
|
|
25
|
-
InventoryItem,
|
|
26
|
-
Pallet,
|
|
27
|
-
generateInventoryHistory
|
|
28
|
-
} from '@things-factory/warehouse-base'
|
|
22
|
+
import { Inventory, INVENTORY_STATUS, InventoryItem, Pallet } from '@things-factory/warehouse-base'
|
|
29
23
|
|
|
30
24
|
import { WORKSHEET_STATUS, WORKSHEET_TYPE } from '../constants'
|
|
31
25
|
import { Worksheet, WorksheetDetail } from '../entities'
|
|
32
|
-
import { WorksheetNoGenerator } from '../utils'
|
|
26
|
+
import { generateInventoryHistory, WorksheetNoGenerator } from '../utils'
|
|
33
27
|
|
|
34
28
|
export type ReferenceOrderType = ArrivalNotice | ReleaseGood | VasOrder | InventoryCheck | DeliveryOrder | ReturnOrder
|
|
35
29
|
export type OrderTargetTypes = OrderProduct | OrderInventory | OrderVas
|
|
@@ -1012,9 +1006,11 @@ export class WorksheetController {
|
|
|
1012
1006
|
async getChildQty(
|
|
1013
1007
|
productDetails: ProductDetail[],
|
|
1014
1008
|
productBarcode: string,
|
|
1015
|
-
orderProductDetail: ProductDetail
|
|
1016
|
-
scannedProductDetail: ProductDetail
|
|
1009
|
+
orderProductDetail: ProductDetail
|
|
1017
1010
|
): Promise<number> {
|
|
1011
|
+
const scannedProductDetail: ProductDetail = productDetails.find(
|
|
1012
|
+
(productDetail: ProductDetail) => productDetail.gtin === productBarcode
|
|
1013
|
+
)
|
|
1018
1014
|
let hasChildRelation: boolean = Boolean(scannedProductDetail?.childProductDetail)
|
|
1019
1015
|
let hasMatchingChild: boolean
|
|
1020
1016
|
let childQty: number
|
|
@@ -1063,11 +1059,12 @@ export class WorksheetController {
|
|
|
1063
1059
|
let results = await this.trxMgr.query(
|
|
1064
1060
|
`
|
|
1065
1061
|
WITH RECURSIVE cte as (
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1062
|
+
select * from (
|
|
1063
|
+
select pd2.product_id as "productId", pd2.id, pd2.packing_size as "packingSize",
|
|
1064
|
+
pd2.packing_type as "packingType", pd2.uom as "uom", (pd2.uom_value * $2::float) as "uomValue", $2::float as "qty", pd2.gtin
|
|
1065
|
+
from product_details pd
|
|
1066
|
+
inner join product_details pd2 on pd.product_id = pd2.product_id and pd.packing_type = pd2.packing_type and pd.packing_size = pd2.packing_size and pd.uom = pd2.uom
|
|
1067
|
+
where pd.id = $1
|
|
1071
1068
|
) as dt
|
|
1072
1069
|
union all
|
|
1073
1070
|
select pd.product_id as "productId", pd.id, pd.packing_size as "packingSize",
|
package/server/entities/index.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { WarehouseBizplaceOnhandInventory } from './warehouse-bizplace-onhand-inventory'
|
|
2
1
|
import { Worksheet } from './worksheet'
|
|
3
2
|
import { WorksheetDetail } from './worksheet-detail'
|
|
4
3
|
import { WorksheetMovement } from './worksheet-movement'
|
|
4
|
+
import { WarehouseBizplaceOnhandInventory } from './warehouse-bizplace-onhand-inventory'
|
|
5
5
|
|
|
6
6
|
export const entities = [Worksheet, WorksheetDetail, WorksheetMovement, WarehouseBizplaceOnhandInventory]
|
|
7
7
|
|
|
8
|
-
export {
|
|
8
|
+
export { Worksheet, WorksheetDetail, WorksheetMovement }
|