@things-factory/worksheet-base 4.3.79-alpha.0 → 4.3.80-alpha.0
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 +49 -49
- package/dist-server/controllers/inbound/unloading-worksheet-controller.js.map +1 -1
- package/dist-server/controllers/inspect/cycle-count-worksheet-controller.js +2 -4
- package/dist-server/controllers/inspect/cycle-count-worksheet-controller.js.map +1 -1
- package/dist-server/controllers/outbound/loading-worksheet-controller.js +10 -4
- package/dist-server/controllers/outbound/loading-worksheet-controller.js.map +1 -1
- package/dist-server/controllers/outbound/packing-worksheet-controller.js +22 -20
- package/dist-server/controllers/outbound/packing-worksheet-controller.js.map +1 -1
- package/dist-server/controllers/outbound/picking-worksheet-controller.js +34 -39
- package/dist-server/controllers/outbound/picking-worksheet-controller.js.map +1 -1
- package/dist-server/controllers/outbound/sorting-worksheet-controller.js +12 -14
- package/dist-server/controllers/outbound/sorting-worksheet-controller.js.map +1 -1
- package/dist-server/controllers/vas/vas-worksheet-controller.js +1 -2
- package/dist-server/controllers/vas/vas-worksheet-controller.js.map +1 -1
- package/dist-server/controllers/worksheet-controller.js +2 -3
- package/dist-server/controllers/worksheet-controller.js.map +1 -1
- package/dist-server/graphql/resolvers/worksheet/batch-picking-worksheet.js +6 -0
- package/dist-server/graphql/resolvers/worksheet/batch-picking-worksheet.js.map +1 -1
- package/dist-server/graphql/resolvers/worksheet/confirm-cancellation-release-order.js +1 -2
- package/dist-server/graphql/resolvers/worksheet/confirm-cancellation-release-order.js.map +1 -1
- package/dist-server/graphql/resolvers/worksheet/cycle-count-adjustment.js +6 -6
- package/dist-server/graphql/resolvers/worksheet/cycle-count-adjustment.js.map +1 -1
- package/dist-server/graphql/resolvers/worksheet/inventories-by-pallet.js +2 -1
- package/dist-server/graphql/resolvers/worksheet/inventories-by-pallet.js.map +1 -1
- package/dist-server/graphql/resolvers/worksheet/picking-worksheet.js +3 -2
- package/dist-server/graphql/resolvers/worksheet/picking-worksheet.js.map +1 -1
- package/dist-server/graphql/resolvers/worksheet/proceed-extra-products.js +6 -4
- package/dist-server/graphql/resolvers/worksheet/proceed-extra-products.js.map +1 -1
- package/dist-server/graphql/resolvers/worksheet/transfer.js +9 -9
- package/dist-server/graphql/resolvers/worksheet/transfer.js.map +1 -1
- package/dist-server/graphql/resolvers/worksheet/vas-transactions/common-utils.js +17 -17
- package/dist-server/graphql/resolvers/worksheet/vas-transactions/common-utils.js.map +1 -1
- package/dist-server/graphql/resolvers/worksheet-detail/regenerate-release-good-worksheet-details.js +4 -4
- package/dist-server/graphql/resolvers/worksheet-detail/regenerate-release-good-worksheet-details.js.map +1 -1
- package/dist-server/graphql/types/worksheet-detail/index.js +1 -0
- package/dist-server/graphql/types/worksheet-detail/index.js.map +1 -1
- package/dist-server/utils/inventory-util.js +1 -98
- package/dist-server/utils/inventory-util.js.map +1 -1
- package/package.json +5 -5
- package/server/controllers/inbound/unloading-worksheet-controller.ts +49 -70
- package/server/controllers/inspect/cycle-count-worksheet-controller.ts +2 -4
- package/server/controllers/outbound/loading-worksheet-controller.ts +9 -3
- package/server/controllers/outbound/packing-worksheet-controller.ts +23 -31
- package/server/controllers/outbound/picking-worksheet-controller.ts +34 -51
- package/server/controllers/outbound/sorting-worksheet-controller.ts +12 -12
- package/server/controllers/vas/vas-worksheet-controller.ts +2 -2
- package/server/controllers/worksheet-controller.ts +4 -6
- package/server/graphql/resolvers/worksheet/batch-picking-worksheet.ts +6 -0
- package/server/graphql/resolvers/worksheet/confirm-cancellation-release-order.ts +1 -2
- package/server/graphql/resolvers/worksheet/cycle-count-adjustment.ts +2 -2
- package/server/graphql/resolvers/worksheet/inventories-by-pallet.ts +3 -1
- package/server/graphql/resolvers/worksheet/picking-worksheet.ts +3 -2
- package/server/graphql/resolvers/worksheet/proceed-extra-products.ts +5 -4
- package/server/graphql/resolvers/worksheet/transfer.ts +18 -16
- package/server/graphql/resolvers/worksheet/vas-transactions/common-utils.ts +3 -2
- package/server/graphql/resolvers/worksheet-detail/regenerate-release-good-worksheet-details.ts +4 -1
- package/server/graphql/types/worksheet-detail/index.ts +1 -0
- package/server/utils/inventory-util.ts +1 -126
|
@@ -261,7 +261,7 @@ export class PickingWorksheetController extends VasWorksheetController {
|
|
|
261
261
|
})
|
|
262
262
|
|
|
263
263
|
let releaseGoods: ReleaseGood[] = pickingOrderInventory.map((oi: OrderInventory) => oi.releaseGood)
|
|
264
|
-
|
|
264
|
+
|
|
265
265
|
if (releaseGoods?.length) {
|
|
266
266
|
releaseGoods = releaseGoods.map((rg: ReleaseGood) => {
|
|
267
267
|
return {
|
|
@@ -435,7 +435,8 @@ export class PickingWorksheetController extends VasWorksheetController {
|
|
|
435
435
|
'targetInventory.orderProduct',
|
|
436
436
|
'targetInventory.product.productDetails',
|
|
437
437
|
'targetInventory.product.productDetails.product',
|
|
438
|
-
'targetInventory.product.productDetails.childProductDetail'
|
|
438
|
+
'targetInventory.product.productDetails.childProductDetail',
|
|
439
|
+
'targetInventory.productDetail'
|
|
439
440
|
]
|
|
440
441
|
)
|
|
441
442
|
|
|
@@ -443,6 +444,7 @@ export class PickingWorksheetController extends VasWorksheetController {
|
|
|
443
444
|
let targetInventory: OrderInventory = worksheetDetail.targetInventory
|
|
444
445
|
let targetProduct: OrderProduct = targetInventory.orderProduct
|
|
445
446
|
const product: Product = targetInventory.product
|
|
447
|
+
const productDetail: ProductDetail = targetInventory.productDetail
|
|
446
448
|
let inventory: Inventory = targetInventory.inventory
|
|
447
449
|
let bizplace: Bizplace = worksheetDetail.worksheet.bizplace
|
|
448
450
|
|
|
@@ -458,9 +460,6 @@ export class PickingWorksheetController extends VasWorksheetController {
|
|
|
458
460
|
if (inventory.cartonId !== cartonId)
|
|
459
461
|
throw new Error(this.ERROR_MSG.VALIDITY.UNEXPECTED_FIELD_VALUE('Carton ID', cartonId, inventory.cartonId))
|
|
460
462
|
|
|
461
|
-
const packingType: string = inventory.packingType
|
|
462
|
-
const packingSize: number = inventory.packingSize
|
|
463
|
-
|
|
464
463
|
let pickedQty: number = pickingQty ? pickingQty : 1
|
|
465
464
|
const releaseQty: number = targetInventory.releaseQty
|
|
466
465
|
|
|
@@ -468,28 +467,15 @@ export class PickingWorksheetController extends VasWorksheetController {
|
|
|
468
467
|
|
|
469
468
|
// search for matching product barcode
|
|
470
469
|
const productDetails: ProductDetail[] = product?.productDetails.filter(detail => !detail.deletedAt)
|
|
471
|
-
|
|
472
|
-
|
|
470
|
+
// scannedProductDetail can be child or gtin
|
|
471
|
+
const scannedProductDetail: ProductDetail = productDetails.find(detail => detail.gtin == productBarcode)
|
|
472
|
+
if (!scannedProductDetail) throw new Error(this.ERROR_MSG.FIND.NO_RESULT(productBarcode))
|
|
473
473
|
|
|
474
474
|
// case for scanning parent packing type, packing size
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
detail.packingType === packingType &&
|
|
479
|
-
detail.packingSize == packingSize &&
|
|
480
|
-
detail.product?.id === product.id
|
|
481
|
-
)
|
|
482
|
-
|
|
483
|
-
if (!foundProductDetail && !product?.isRequireSerialNumberScanningOutbound) {
|
|
484
|
-
const roProductDetail: ProductDetail = productDetails.find(
|
|
485
|
-
(parentDetail: ProductDetail) =>
|
|
486
|
-
parentDetail.packingType === packingType && parentDetail.packingSize == packingSize
|
|
487
|
-
)
|
|
488
|
-
|
|
489
|
-
let childQty = await this.getChildQty(productDetails, productBarcode, roProductDetail)
|
|
475
|
+
// when scannedProductDetail id is not the same as productDetail id, then it's not child gtin, proceed to get child qty
|
|
476
|
+
if (scannedProductDetail.id !== productDetail.id && !product?.isRequireSerialNumberScanningOutbound) {
|
|
477
|
+
let childQty = await this.getChildQty(productDetails, productBarcode, productDetail, scannedProductDetail)
|
|
490
478
|
pickedQty *= childQty
|
|
491
|
-
} else if (!foundProductDetail) {
|
|
492
|
-
throw new Error(this.ERROR_MSG.FIND.NO_RESULT(productBarcode))
|
|
493
479
|
}
|
|
494
480
|
|
|
495
481
|
if (pickedQty + targetInventory.pickedQty > releaseQty) {
|
|
@@ -541,6 +527,7 @@ export class PickingWorksheetController extends VasWorksheetController {
|
|
|
541
527
|
inventoryItem.outboundOrderId = releaseGood.id
|
|
542
528
|
inventoryItem.source = INVENTORY_ITEM_SOURCE.OUTBOUND
|
|
543
529
|
inventoryItem.product = product
|
|
530
|
+
inventoryItem.productDetail = productDetail
|
|
544
531
|
inventoryItem.inventory = inventory
|
|
545
532
|
inventoryItem.domain = this.domain
|
|
546
533
|
|
|
@@ -580,13 +567,15 @@ export class PickingWorksheetController extends VasWorksheetController {
|
|
|
580
567
|
'targetInventory.orderProduct',
|
|
581
568
|
'targetInventory.inventory',
|
|
582
569
|
'targetInventory.inventory.location',
|
|
583
|
-
'targetInventory.product'
|
|
570
|
+
'targetInventory.product',
|
|
571
|
+
'targetInventory.productDetail'
|
|
584
572
|
]
|
|
585
573
|
)
|
|
586
574
|
|
|
587
575
|
const releaseGood: ReleaseGood = worksheetDetail.targetInventory.releaseGood
|
|
588
576
|
let targetInventory: OrderInventory = worksheetDetail.targetInventory
|
|
589
577
|
const product: Product = targetInventory.product
|
|
578
|
+
const productDetail: ProductDetail = targetInventory.productDetail
|
|
590
579
|
let inventory: Inventory = targetInventory.inventory
|
|
591
580
|
let targetProduct: OrderProduct = targetInventory.orderProduct
|
|
592
581
|
let bizplace: Bizplace = worksheetDetail.worksheet.bizplace
|
|
@@ -616,13 +605,13 @@ export class PickingWorksheetController extends VasWorksheetController {
|
|
|
616
605
|
})
|
|
617
606
|
|
|
618
607
|
let foundSerialNumber: InventoryItem = await this.trxMgr.getRepository(InventoryItem).findOne({
|
|
619
|
-
where: { domain: this.domain, serialNumber: serialNumber,
|
|
620
|
-
relations: ['product', 'inventory']
|
|
608
|
+
where: { domain: this.domain, serialNumber: serialNumber, productDetail },
|
|
609
|
+
relations: ['product', 'productDetail', 'inventory']
|
|
621
610
|
})
|
|
622
611
|
|
|
623
612
|
let scannedPalletIdInventory: Inventory = await this.trxMgr
|
|
624
613
|
.getRepository(Inventory)
|
|
625
|
-
.findOne({ where: { domain: this.domain, palletId }, relations: ['
|
|
614
|
+
.findOne({ where: { domain: this.domain, palletId }, relations: ['productDetail'] })
|
|
626
615
|
|
|
627
616
|
if (foundSerialNumber) {
|
|
628
617
|
if (foundSerialNumber.outboundOrderId) {
|
|
@@ -649,6 +638,7 @@ export class PickingWorksheetController extends VasWorksheetController {
|
|
|
649
638
|
inventoryItem.source = INVENTORY_ITEM_SOURCE.OUTBOUND
|
|
650
639
|
inventoryItem.outboundOrderId = releaseGood.id
|
|
651
640
|
inventoryItem.product = product
|
|
641
|
+
inventoryItem.productDetail = productDetail
|
|
652
642
|
inventoryItem.inventory = scannedPalletIdInventory
|
|
653
643
|
inventoryItem.domain = this.domain
|
|
654
644
|
|
|
@@ -674,8 +664,7 @@ export class PickingWorksheetController extends VasWorksheetController {
|
|
|
674
664
|
)
|
|
675
665
|
} else if (
|
|
676
666
|
scannedPalletIdInventory.batchId == inventory.batchId &&
|
|
677
|
-
scannedPalletIdInventory.
|
|
678
|
-
scannedPalletIdInventory.product.packingType == product.packingType
|
|
667
|
+
scannedPalletIdInventory.productDetail.id == productDetail.id
|
|
679
668
|
) {
|
|
680
669
|
//if replacement order inventory does not exist
|
|
681
670
|
await this.serialNumberReplacement(
|
|
@@ -683,6 +672,7 @@ export class PickingWorksheetController extends VasWorksheetController {
|
|
|
683
672
|
scannedPalletIdInventory,
|
|
684
673
|
releaseGood,
|
|
685
674
|
product,
|
|
675
|
+
productDetail,
|
|
686
676
|
worksheetDetail,
|
|
687
677
|
foundSerialNumber
|
|
688
678
|
)
|
|
@@ -858,16 +848,19 @@ export class PickingWorksheetController extends VasWorksheetController {
|
|
|
858
848
|
'worksheetDetails.targetInventory.releaseGood',
|
|
859
849
|
'worksheetDetails.targetInventory.inventory',
|
|
860
850
|
'worksheetDetails.targetInventory.inventory.location',
|
|
861
|
-
'worksheetDetails.targetInventory.
|
|
851
|
+
'worksheetDetails.targetInventory.productDetail',
|
|
852
|
+
'worksheetDetails.targetInventory.productDetail.product',
|
|
862
853
|
'worksheetDetails.targetInventory.product.productDetails',
|
|
863
854
|
'worksheetDetails.targetInventory.product.productDetails.childProductDetail'
|
|
864
855
|
]
|
|
865
856
|
})
|
|
866
857
|
|
|
867
858
|
const worksheetDetails: WorksheetDetail[] = worksheet.worksheetDetails
|
|
868
|
-
const
|
|
859
|
+
const productDetail: ProductDetail = worksheetDetails
|
|
869
860
|
.map((wsd: WorksheetDetail) => wsd.targetInventory.product)
|
|
870
|
-
.find((
|
|
861
|
+
.find((productDetail: ProductDetail) => productDetail.id === inventory.productDetail.id)
|
|
862
|
+
|
|
863
|
+
const product: Product = productDetail.product
|
|
871
864
|
|
|
872
865
|
const batchId: string = inventory.batchId
|
|
873
866
|
const packingType: string = inventory.packingType
|
|
@@ -886,26 +879,14 @@ export class PickingWorksheetController extends VasWorksheetController {
|
|
|
886
879
|
|
|
887
880
|
// search for matching product barcode
|
|
888
881
|
const productDetails: ProductDetail[] = product?.productDetails.filter(detail => !detail.deletedAt)
|
|
889
|
-
|
|
890
|
-
|
|
882
|
+
// scannedProductDetail can be child or gtin
|
|
883
|
+
const scannedProductDetail: ProductDetail = productDetails.find(detail => detail.gtin == productBarcode)
|
|
884
|
+
if (!scannedProductDetail) throw new Error(this.ERROR_MSG.FIND.NO_RESULT(productBarcode))
|
|
891
885
|
|
|
892
886
|
// case for scanning parent packing type, packing size
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
)
|
|
897
|
-
|
|
898
|
-
if (!foundProductDetail) {
|
|
899
|
-
const roProductDetail: ProductDetail = productDetails.find(
|
|
900
|
-
(parentDetail: ProductDetail) =>
|
|
901
|
-
parentDetail.packingType === packingType && parentDetail.packingSize == packingSize
|
|
902
|
-
)
|
|
903
|
-
if (!roProductDetail)
|
|
904
|
-
throw new Error(
|
|
905
|
-
this.ERROR_MSG.FIND.NO_RESULT(`Packing Type ( ${packingType}) or Packing Size (${packingSize})`)
|
|
906
|
-
)
|
|
907
|
-
|
|
908
|
-
let childQty = await this.getChildQty(productDetails, productBarcode, roProductDetail)
|
|
887
|
+
// when scannedProductDetail id is not the same as productDetail id, then it's not child gtin, proceed to get child qty
|
|
888
|
+
if (scannedProductDetail.id !== productDetail.id) {
|
|
889
|
+
let childQty = await this.getChildQty(productDetails, productBarcode, productDetail, scannedProductDetail)
|
|
909
890
|
pickedQty *= childQty
|
|
910
891
|
}
|
|
911
892
|
|
|
@@ -1300,6 +1281,7 @@ export class PickingWorksheetController extends VasWorksheetController {
|
|
|
1300
1281
|
scannedPalletIdInventory,
|
|
1301
1282
|
releaseGood,
|
|
1302
1283
|
product,
|
|
1284
|
+
productDetail,
|
|
1303
1285
|
worksheetDetail,
|
|
1304
1286
|
foundSerialNumber
|
|
1305
1287
|
) {
|
|
@@ -1364,6 +1346,7 @@ export class PickingWorksheetController extends VasWorksheetController {
|
|
|
1364
1346
|
releaseUomValue: newOrderInventoryReleaseUomValue,
|
|
1365
1347
|
pickedQty: 1,
|
|
1366
1348
|
product,
|
|
1349
|
+
productDetail,
|
|
1367
1350
|
inventory: scannedPalletIdInventory,
|
|
1368
1351
|
creator: this.user,
|
|
1369
1352
|
updater: this.user
|
|
@@ -95,7 +95,8 @@ 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'
|
|
98
|
+
'worksheetDetails.targetInventory.releaseGood',
|
|
99
|
+
'worksheetDetails.targetInventory.productDetail'
|
|
99
100
|
]
|
|
100
101
|
})
|
|
101
102
|
|
|
@@ -118,17 +119,12 @@ export class SortingWorksheetController extends VasWorksheetController {
|
|
|
118
119
|
const matchingProductDetail: ProductDetail = productDetails.find(
|
|
119
120
|
(productDetail: ProductDetail) => productDetail.gtin === productBarcode
|
|
120
121
|
)
|
|
121
|
-
if (!matchingProductDetail) throw new Error(
|
|
122
|
+
if (!matchingProductDetail) throw new Error(this.ERROR_MSG.FIND.NO_RESULT(productBarcode))
|
|
122
123
|
const packingType: string = matchingProductDetail.packingType
|
|
123
124
|
const packingSize: number = matchingProductDetail.packingSize
|
|
124
|
-
if (!matchingProductDetail)
|
|
125
|
-
throw new Error(this.ERROR_MSG.PRODUCT.BARCODE_NOT_EXIST(productBarcode, packingType, packingSize))
|
|
126
125
|
|
|
127
126
|
let matchingOIs: OrderInventory[] = orderInventories.filter(
|
|
128
|
-
(oi: OrderInventory) =>
|
|
129
|
-
oi.packingType === packingType &&
|
|
130
|
-
oi.packingSize === packingSize &&
|
|
131
|
-
oi.product?.id === matchingProductDetail.product?.id
|
|
127
|
+
(oi: OrderInventory) => oi.productDetail.id === matchingProductDetail.id
|
|
132
128
|
)
|
|
133
129
|
|
|
134
130
|
let sortedQty: number = 1
|
|
@@ -142,6 +138,7 @@ export class SortingWorksheetController extends VasWorksheetController {
|
|
|
142
138
|
const inventory: Inventory = matchingOI.inventory
|
|
143
139
|
const releaseGood: ReleaseGood = matchingOI.releaseGood
|
|
144
140
|
const product: Product = inventory.product
|
|
141
|
+
const productDetail: ProductDetail = matchingOI.productDetail
|
|
145
142
|
|
|
146
143
|
if (releaseQty != matchingOI?.sortedQty && sortedQty == 1) {
|
|
147
144
|
// Serial Number scanning for batch picking
|
|
@@ -153,7 +150,7 @@ export class SortingWorksheetController extends VasWorksheetController {
|
|
|
153
150
|
|
|
154
151
|
let foundSerialNumber: InventoryItem = await this.trxMgr
|
|
155
152
|
.getRepository(InventoryItem)
|
|
156
|
-
.findOne({ where: { domain: this.domain, serialNumber: serialNumber,
|
|
153
|
+
.findOne({ where: { domain: this.domain, serialNumber: serialNumber, productDetail } })
|
|
157
154
|
|
|
158
155
|
if (foundSerialNumber) {
|
|
159
156
|
if (foundSerialNumber.inventoryId !== inventory.id) {
|
|
@@ -180,6 +177,7 @@ export class SortingWorksheetController extends VasWorksheetController {
|
|
|
180
177
|
inventoryItem.outboundOrderId = releaseGood.id
|
|
181
178
|
inventoryItem.source = INVENTORY_ITEM_SOURCE.OUTBOUND
|
|
182
179
|
inventoryItem.product = product
|
|
180
|
+
inventoryItem.productDetail = productDetail
|
|
183
181
|
inventoryItem.inventory = inventory
|
|
184
182
|
inventoryItem.domain = this.domain
|
|
185
183
|
|
|
@@ -263,7 +261,8 @@ export class SortingWorksheetController extends VasWorksheetController {
|
|
|
263
261
|
'worksheetDetails.targetInventory.inventory.product',
|
|
264
262
|
'worksheetDetails.targetInventory.inventory.product.productDetails',
|
|
265
263
|
'worksheetDetails.targetInventory.inventory.product.productDetails.product',
|
|
266
|
-
'worksheetDetails.targetInventory.releaseGood'
|
|
264
|
+
'worksheetDetails.targetInventory.releaseGood',
|
|
265
|
+
'worksheetDetails.targetInventory.productDetail'
|
|
267
266
|
]
|
|
268
267
|
})
|
|
269
268
|
|
|
@@ -283,6 +282,7 @@ export class SortingWorksheetController extends VasWorksheetController {
|
|
|
283
282
|
const inventory: Inventory = matchingOI.inventory
|
|
284
283
|
const releaseGood: ReleaseGood = matchingOI.releaseGood
|
|
285
284
|
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,8 +292,7 @@ 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,
|
|
296
|
-
relations: ['product', 'inventory']
|
|
295
|
+
where: { domain: this.domain, serialNumber: serialNumber, productDetail }
|
|
297
296
|
})
|
|
298
297
|
|
|
299
298
|
if (foundSerialNumber) {
|
|
@@ -317,6 +316,7 @@ export class SortingWorksheetController extends VasWorksheetController {
|
|
|
317
316
|
inventoryItem.source = INVENTORY_ITEM_SOURCE.OUTBOUND
|
|
318
317
|
inventoryItem.outboundOrderId = releaseGood.id
|
|
319
318
|
inventoryItem.product = product
|
|
319
|
+
inventoryItem.productDetail = productDetail
|
|
320
320
|
inventoryItem.inventory = inventory
|
|
321
321
|
inventoryItem.domain = this.domain
|
|
322
322
|
|
|
@@ -22,7 +22,8 @@ import {
|
|
|
22
22
|
InventoryNoGenerator,
|
|
23
23
|
Location,
|
|
24
24
|
LOCATION_TYPE,
|
|
25
|
-
Warehouse
|
|
25
|
+
Warehouse,
|
|
26
|
+
generateInventoryHistory
|
|
26
27
|
} from '@things-factory/warehouse-base'
|
|
27
28
|
|
|
28
29
|
import { WORKSHEET_STATUS, WORKSHEET_TYPE } from '../../constants'
|
|
@@ -36,7 +37,6 @@ import {
|
|
|
36
37
|
RefOrderType
|
|
37
38
|
} from '../../graphql/resolvers/worksheet/vas-transactions'
|
|
38
39
|
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,11 +19,11 @@ import {
|
|
|
19
19
|
VasOrder
|
|
20
20
|
} from '@things-factory/sales-base'
|
|
21
21
|
import { Domain } from '@things-factory/shell'
|
|
22
|
-
import { Inventory, INVENTORY_STATUS, InventoryItem, Pallet } from '@things-factory/warehouse-base'
|
|
22
|
+
import { Inventory, INVENTORY_STATUS, InventoryItem, Pallet, generateInventoryHistory } from '@things-factory/warehouse-base'
|
|
23
23
|
|
|
24
24
|
import { WORKSHEET_STATUS, WORKSHEET_TYPE } from '../constants'
|
|
25
25
|
import { Worksheet, WorksheetDetail } from '../entities'
|
|
26
|
-
import {
|
|
26
|
+
import { WorksheetNoGenerator } from '../utils'
|
|
27
27
|
|
|
28
28
|
export type ReferenceOrderType = ArrivalNotice | ReleaseGood | VasOrder | InventoryCheck | DeliveryOrder | ReturnOrder
|
|
29
29
|
export type OrderTargetTypes = OrderProduct | OrderInventory | OrderVas
|
|
@@ -1007,11 +1007,9 @@ export class WorksheetController {
|
|
|
1007
1007
|
async getChildQty(
|
|
1008
1008
|
productDetails: ProductDetail[],
|
|
1009
1009
|
productBarcode: string,
|
|
1010
|
-
orderProductDetail: ProductDetail
|
|
1010
|
+
orderProductDetail: ProductDetail,
|
|
1011
|
+
scannedProductDetail: ProductDetail
|
|
1011
1012
|
): Promise<number> {
|
|
1012
|
-
const scannedProductDetail: ProductDetail = productDetails.find(
|
|
1013
|
-
(productDetail: ProductDetail) => productDetail.gtin === productBarcode
|
|
1014
|
-
)
|
|
1015
1013
|
let hasChildRelation: boolean = Boolean(scannedProductDetail?.childProductDetail)
|
|
1016
1014
|
let hasMatchingChild: boolean
|
|
1017
1015
|
let childQty: number
|
|
@@ -32,6 +32,7 @@ export const batchPickingWorksheetResolver = {
|
|
|
32
32
|
.addSelect('"PROD".name', 'productName')
|
|
33
33
|
.addSelect('"PROD".sku', 'productSku')
|
|
34
34
|
.addSelect('"PROD".description', 'productDescription')
|
|
35
|
+
.addSelect('"PROD_DET".id', 'productDetailId')
|
|
35
36
|
.addSelect('"INV".qty', 'qty')
|
|
36
37
|
.addSelect('"INV".packing_type', 'packingType')
|
|
37
38
|
.addSelect('"INV".packing_size', 'packingSize')
|
|
@@ -47,6 +48,7 @@ export const batchPickingWorksheetResolver = {
|
|
|
47
48
|
.leftJoin('WSD.targetInventory', 'T_INV')
|
|
48
49
|
.leftJoin('T_INV.inventory', 'INV')
|
|
49
50
|
.leftJoin('T_INV.product', 'PROD')
|
|
51
|
+
.leftJoin('T_INV.productDetail', 'PROD_DET')
|
|
50
52
|
.leftJoin('T_INV.binLocation', 'BIN_LOC')
|
|
51
53
|
.leftJoin('INV.location', 'LOC')
|
|
52
54
|
.where('"WSD"."worksheet_id" = :worksheetId', { worksheetId: worksheet.id })
|
|
@@ -64,6 +66,7 @@ export const batchPickingWorksheetResolver = {
|
|
|
64
66
|
.addGroupBy('"PROD".name')
|
|
65
67
|
.addGroupBy('"PROD".sku')
|
|
66
68
|
.addGroupBy('"PROD".description')
|
|
69
|
+
.addGroupBy('"PROD_DET".id')
|
|
67
70
|
.addGroupBy('"T_INV".batch_id')
|
|
68
71
|
.addGroupBy('"T_INV".packing_type')
|
|
69
72
|
.addGroupBy('BIN_LOC.name')
|
|
@@ -126,6 +129,9 @@ export const batchPickingWorksheetResolver = {
|
|
|
126
129
|
name: item?.productName,
|
|
127
130
|
description: item?.productDescription,
|
|
128
131
|
sku: item?.productSku
|
|
132
|
+
},
|
|
133
|
+
productDetail: {
|
|
134
|
+
id: item?.productDetailId
|
|
129
135
|
}
|
|
130
136
|
}
|
|
131
137
|
}
|
|
@@ -11,10 +11,9 @@ import {
|
|
|
11
11
|
ReleaseGood
|
|
12
12
|
} from '@things-factory/sales-base'
|
|
13
13
|
import { Domain } from '@things-factory/shell'
|
|
14
|
-
import { Inventory, INVENTORY_STATUS, INVENTORY_TRANSACTION_TYPE, Location } from '@things-factory/warehouse-base'
|
|
14
|
+
import { Inventory, INVENTORY_STATUS, INVENTORY_TRANSACTION_TYPE, Location, generateInventoryHistory } from '@things-factory/warehouse-base'
|
|
15
15
|
|
|
16
16
|
import { Worksheet, WorksheetDetail } from '../../../entities'
|
|
17
|
-
import { generateInventoryHistory } from '../../../utils'
|
|
18
17
|
|
|
19
18
|
export const confirmCancellationReleaseOrder = {
|
|
20
19
|
async confirmCancellationReleaseOrder(_: any, { name }, context: any) {
|
|
@@ -4,12 +4,12 @@ import { User } from '@things-factory/auth-base'
|
|
|
4
4
|
import { Sellercraft, SellercraftStatus } from '@things-factory/integration-sellercraft'
|
|
5
5
|
import { InventoryCheck, ORDER_INVENTORY_STATUS, ORDER_STATUS, OrderInventory } from '@things-factory/sales-base'
|
|
6
6
|
import { Domain } from '@things-factory/shell'
|
|
7
|
-
import { Inventory, INVENTORY_STATUS, INVENTORY_TRANSACTION_TYPE, Location } from '@things-factory/warehouse-base'
|
|
7
|
+
import { Inventory, INVENTORY_STATUS, INVENTORY_TRANSACTION_TYPE, Location, generateInventoryHistory } from '@things-factory/warehouse-base'
|
|
8
8
|
|
|
9
9
|
import { WORKSHEET_STATUS, WORKSHEET_TYPE } from '../../../constants'
|
|
10
10
|
import { SellercraftController } from '../../../controllers'
|
|
11
11
|
import { Worksheet, WorksheetDetail } from '../../../entities'
|
|
12
|
-
import {
|
|
12
|
+
import { switchLocationStatus } from '../../../utils'
|
|
13
13
|
|
|
14
14
|
export const cycleCountAdjustmentResolver = {
|
|
15
15
|
async cycleCountAdjustment(_: any, { cycleCountNo }, context: any) {
|
|
@@ -40,6 +40,7 @@ export const inventoriesByPalletResolver = {
|
|
|
40
40
|
qb.leftJoinAndSelect('iv.domain', 'domain')
|
|
41
41
|
.leftJoinAndSelect('iv.bizplace', 'bizplace')
|
|
42
42
|
.leftJoinAndSelect('iv.product', 'product')
|
|
43
|
+
.leftJoinAndSelect('iv.productDetail', 'productDetail')
|
|
43
44
|
.leftJoinAndSelect('iv.warehouse', 'warehouse')
|
|
44
45
|
.leftJoinAndSelect('iv.location', 'location')
|
|
45
46
|
.leftJoinAndSelect('iv.creator', 'creator')
|
|
@@ -134,7 +135,8 @@ export const inventoriesByPalletResolver = {
|
|
|
134
135
|
productName: item.product.name,
|
|
135
136
|
productSKU: item.product.sku,
|
|
136
137
|
productBrand: item.product.brand,
|
|
137
|
-
productId: item.product.id
|
|
138
|
+
productId: item.product.id,
|
|
139
|
+
productDetailId: item.productDetail.id
|
|
138
140
|
}
|
|
139
141
|
})
|
|
140
142
|
)
|
|
@@ -76,6 +76,7 @@ export async function pickingWorksheet(
|
|
|
76
76
|
.leftJoinAndSelect('T_INV.binLocation', 'BIN_LOC')
|
|
77
77
|
.leftJoinAndSelect('T_INV.inventory', 'INV')
|
|
78
78
|
.leftJoinAndSelect('T_INV.product', 'PROD')
|
|
79
|
+
.leftJoinAndSelect('T_INV.productDetail', 'PROD_DET')
|
|
79
80
|
.leftJoinAndSelect('INV.location', 'LOC')
|
|
80
81
|
|
|
81
82
|
if (locationSortingRules?.length > 0) {
|
|
@@ -114,8 +115,8 @@ export async function pickingWorksheet(
|
|
|
114
115
|
const inventoryChangesCount: number = await tx.getRepository(InventoryChange).count({
|
|
115
116
|
where: {
|
|
116
117
|
inventory: inventory.id,
|
|
117
|
-
status:
|
|
118
|
-
transactionType:
|
|
118
|
+
status: 'PENDING',
|
|
119
|
+
transactionType: 'MISSING'
|
|
119
120
|
},
|
|
120
121
|
relations: ['inventory', 'product']
|
|
121
122
|
})
|
|
@@ -73,7 +73,7 @@ export const proceedExtraProductsResolver = {
|
|
|
73
73
|
if (editedApprovedProducts?.length > 0) {
|
|
74
74
|
editedApprovedProducts.map((editedApprovedProd: OrderProduct) => {
|
|
75
75
|
const selectedOrderProduct: OrderProduct = storedOrderProducts.find(
|
|
76
|
-
(op: OrderProduct) => op.id === editedApprovedProd.
|
|
76
|
+
(op: OrderProduct) => op.productDetail.id === editedApprovedProd.productDetailId
|
|
77
77
|
)
|
|
78
78
|
|
|
79
79
|
updatedOrderProducts.push({
|
|
@@ -115,7 +115,7 @@ export const proceedExtraProductsResolver = {
|
|
|
115
115
|
if (addedApprovedProducts?.length > 0) {
|
|
116
116
|
addedApprovedProducts.map((addedApprovedProd: OrderProduct) => {
|
|
117
117
|
const selectedOrderProduct: OrderProduct = storedOrderProducts.find(
|
|
118
|
-
(op: OrderProduct) => op.
|
|
118
|
+
(op: OrderProduct) => op.productDetailId === addedApprovedProd.productDetailId
|
|
119
119
|
)
|
|
120
120
|
updatedOrderProducts.push({
|
|
121
121
|
...selectedOrderProduct,
|
|
@@ -173,7 +173,7 @@ export const proceedExtraProductsResolver = {
|
|
|
173
173
|
if (editedRejectedProducts?.length > 0) {
|
|
174
174
|
editedRejectedProducts = editedRejectedProducts.map((editedRejectProduct: OrderProduct) => {
|
|
175
175
|
const selectedOrderProduct: OrderProduct = storedOrderProducts.find(
|
|
176
|
-
(op: OrderProduct) => op.id === editedRejectProduct.
|
|
176
|
+
(op: OrderProduct) => op.productDetail.id === editedRejectProduct.productDetailId
|
|
177
177
|
)
|
|
178
178
|
|
|
179
179
|
return {
|
|
@@ -194,7 +194,8 @@ export const proceedExtraProductsResolver = {
|
|
|
194
194
|
let deleteOrderProducts: OrderProduct[] = []
|
|
195
195
|
addedRejectedProducts.map(rejectedOp => {
|
|
196
196
|
const selectedOrderProduct: OrderProduct[] = storedOrderProducts.find(
|
|
197
|
-
(op: OrderProduct) => op.id === rejectedOp.id
|
|
197
|
+
//(op: OrderProduct) => op.id === rejectedOp.id
|
|
198
|
+
(op: OrderProduct) => op.productDetailId === rejectedOp.productDetailId
|
|
198
199
|
)
|
|
199
200
|
deleteOrderProducts.push(selectedOrderProduct)
|
|
200
201
|
})
|
|
@@ -1,38 +1,36 @@
|
|
|
1
|
+
import { EntityManager } from 'typeorm'
|
|
2
|
+
|
|
1
3
|
import { User } from '@things-factory/auth-base'
|
|
2
4
|
import { Bizplace } from '@things-factory/biz-base'
|
|
5
|
+
import { ORDER_PRODUCT_STATUS, OrderInventory } from '@things-factory/sales-base'
|
|
3
6
|
import { Domain } from '@things-factory/shell'
|
|
4
|
-
import { OrderInventory, ORDER_PRODUCT_STATUS } from '@things-factory/sales-base'
|
|
5
7
|
import {
|
|
6
8
|
Inventory,
|
|
7
|
-
InventoryHistory,
|
|
8
|
-
InventoryNoGenerator,
|
|
9
9
|
INVENTORY_STATUS,
|
|
10
|
-
INVENTORY_TRANSACTION_TYPE
|
|
10
|
+
INVENTORY_TRANSACTION_TYPE,
|
|
11
|
+
InventoryHistory,
|
|
12
|
+
InventoryNoGenerator
|
|
11
13
|
} from '@things-factory/warehouse-base'
|
|
12
|
-
|
|
14
|
+
|
|
13
15
|
import { WORKSHEET_STATUS, WORKSHEET_TYPE } from '../../../constants'
|
|
14
16
|
import { Worksheet, WorksheetDetail } from '../../../entities'
|
|
15
17
|
|
|
16
18
|
export const transfer = {
|
|
17
19
|
async transfer(_: any, { palletId, toPalletId, qty }, context: any) {
|
|
18
|
-
const {
|
|
19
|
-
|
|
20
|
-
domain,
|
|
21
|
-
bizplace,
|
|
22
|
-
user
|
|
23
|
-
}: { tx: EntityManager; domain: Domain; bizplace: Bizplace; user: User } = context.state
|
|
20
|
+
const { tx, domain, bizplace, user }: { tx: EntityManager; domain: Domain; bizplace: Bizplace; user: User } =
|
|
21
|
+
context.state
|
|
24
22
|
|
|
25
23
|
// 1. get to inventory
|
|
26
24
|
let toInventory: Inventory = await tx.getRepository(Inventory).findOne({
|
|
27
25
|
where: { domain: domain, palletId: toPalletId },
|
|
28
|
-
relations: ['bizplace', 'product', 'warehouse', 'location']
|
|
26
|
+
relations: ['bizplace', 'product', 'productDetail', 'warehouse', 'location']
|
|
29
27
|
})
|
|
30
28
|
if (!toInventory) throw new Error(`to pallet doesn't exists`)
|
|
31
29
|
|
|
32
30
|
// 2. get from inventory
|
|
33
31
|
let fromInventory: Inventory = await tx.getRepository(Inventory).findOne({
|
|
34
32
|
where: { domain: domain, palletId },
|
|
35
|
-
relations: ['bizplace', 'product', 'warehouse', 'location']
|
|
33
|
+
relations: ['bizplace', 'product', 'productDetail', 'warehouse', 'location']
|
|
36
34
|
})
|
|
37
35
|
if (!fromInventory) throw new Error(`from pallet doesn't exists`)
|
|
38
36
|
if (toInventory.batchId !== fromInventory.batchId) throw new Error(`Can't transfer to different batch`)
|
|
@@ -74,6 +72,7 @@ export const transfer = {
|
|
|
74
72
|
domain: domain,
|
|
75
73
|
name: InventoryNoGenerator.inventoryHistoryName(),
|
|
76
74
|
product: toInventory.product,
|
|
75
|
+
productDetail: toInventory.productDetail,
|
|
77
76
|
warehouse: toInventory.warehouse,
|
|
78
77
|
location: toInventory.location,
|
|
79
78
|
seq: toInventory.lastSeq,
|
|
@@ -97,7 +96,7 @@ export const transfer = {
|
|
|
97
96
|
|
|
98
97
|
fromInventory = await tx.getRepository(Inventory).findOne({
|
|
99
98
|
where: { id: fromInventory.id },
|
|
100
|
-
relations: ['bizplace', 'product', 'warehouse', 'location']
|
|
99
|
+
relations: ['bizplace', 'product', 'productDetail', 'warehouse', 'location']
|
|
101
100
|
})
|
|
102
101
|
|
|
103
102
|
// - add inventory history
|
|
@@ -105,6 +104,7 @@ export const transfer = {
|
|
|
105
104
|
...fromInventory,
|
|
106
105
|
name: InventoryNoGenerator.inventoryHistoryName(),
|
|
107
106
|
product: fromInventory.product,
|
|
107
|
+
productDetail: fromInventory.productDetail,
|
|
108
108
|
warehouse: fromInventory.warehouse,
|
|
109
109
|
location: fromInventory.location,
|
|
110
110
|
seq: fromInventory.lastSeq,
|
|
@@ -131,7 +131,7 @@ export const transfer = {
|
|
|
131
131
|
|
|
132
132
|
toInventory = await tx.getRepository(Inventory).findOne({
|
|
133
133
|
where: { id: toInventory.id },
|
|
134
|
-
relations: ['bizplace', 'product', 'warehouse', 'location']
|
|
134
|
+
relations: ['bizplace', 'product', 'productDetail', 'warehouse', 'location']
|
|
135
135
|
})
|
|
136
136
|
// - add inventory history
|
|
137
137
|
delete toInventory.id
|
|
@@ -140,6 +140,7 @@ export const transfer = {
|
|
|
140
140
|
domain,
|
|
141
141
|
name: InventoryNoGenerator.inventoryHistoryName(),
|
|
142
142
|
product: toInventory.product,
|
|
143
|
+
productDetail: toInventory.productDetail,
|
|
143
144
|
warehouse: toInventory.warehouse,
|
|
144
145
|
location: toInventory.location,
|
|
145
146
|
seq: toInventory.lastSeq,
|
|
@@ -157,7 +158,7 @@ export const transfer = {
|
|
|
157
158
|
|
|
158
159
|
fromInventory = await tx.getRepository(Inventory).findOne({
|
|
159
160
|
where: { id: fromInventory.id },
|
|
160
|
-
relations: ['bizplace', 'product', 'warehouse', 'location']
|
|
161
|
+
relations: ['bizplace', 'product', 'productDetail', 'warehouse', 'location']
|
|
161
162
|
})
|
|
162
163
|
|
|
163
164
|
// - add inventory history
|
|
@@ -165,6 +166,7 @@ export const transfer = {
|
|
|
165
166
|
...fromInventory,
|
|
166
167
|
name: InventoryNoGenerator.inventoryHistoryName(),
|
|
167
168
|
product: fromInventory.product,
|
|
169
|
+
productDetail: fromInventory.productDetail,
|
|
168
170
|
warehouse: fromInventory.warehouse,
|
|
169
171
|
location: fromInventory.location,
|
|
170
172
|
seq: fromInventory.lastSeq,
|
|
@@ -19,12 +19,13 @@ import {
|
|
|
19
19
|
InventoryNoGenerator,
|
|
20
20
|
Location,
|
|
21
21
|
Pallet,
|
|
22
|
-
Warehouse
|
|
22
|
+
Warehouse,
|
|
23
|
+
generateInventoryHistory
|
|
23
24
|
} from '@things-factory/warehouse-base'
|
|
24
25
|
|
|
25
26
|
import { WORKSHEET_STATUS, WORKSHEET_TYPE } from '../../../../constants'
|
|
26
27
|
import { Worksheet, WorksheetDetail } from '../../../../entities'
|
|
27
|
-
import {
|
|
28
|
+
import { WorksheetNoGenerator } from '../../../../utils'
|
|
28
29
|
import {
|
|
29
30
|
OperationGuideInterface,
|
|
30
31
|
PackingUnits,
|
package/server/graphql/resolvers/worksheet-detail/regenerate-release-good-worksheet-details.ts
CHANGED
|
@@ -19,7 +19,7 @@ import { WorksheetNoGenerator } from '../../../utils'
|
|
|
19
19
|
export const regenerateReleaseGoodWorksheetDetailsResolver = {
|
|
20
20
|
async regenerateReleaseGoodWorksheetDetails(
|
|
21
21
|
_: any,
|
|
22
|
-
{ worksheetNo, batchId, productId, packingType, packingSize, orderProductId, worksheetDetails },
|
|
22
|
+
{ worksheetNo, batchId, productId, productDetailId, packingType, packingSize, orderProductId, worksheetDetails },
|
|
23
23
|
context: any
|
|
24
24
|
): Promise<void> {
|
|
25
25
|
const { tx, domain, user }: { tx: EntityManager; domain: Domain; user: User } = context.state
|
|
@@ -30,6 +30,7 @@ export const regenerateReleaseGoodWorksheetDetailsResolver = {
|
|
|
30
30
|
worksheetNo,
|
|
31
31
|
batchId,
|
|
32
32
|
productId,
|
|
33
|
+
productDetailId,
|
|
33
34
|
packingType,
|
|
34
35
|
packingSize,
|
|
35
36
|
orderProductId,
|
|
@@ -45,6 +46,7 @@ export async function regenerateReleaseGoodWorksheetDetails(
|
|
|
45
46
|
worksheetNo: string,
|
|
46
47
|
batchId: string,
|
|
47
48
|
productId: string,
|
|
49
|
+
productDetailId: string,
|
|
48
50
|
packingType: string,
|
|
49
51
|
packingSize: number,
|
|
50
52
|
orderProductId: string,
|
|
@@ -115,6 +117,7 @@ export async function regenerateReleaseGoodWorksheetDetails(
|
|
|
115
117
|
batchIdRef: inventory.batchIdRef,
|
|
116
118
|
status: ORDER_INVENTORY_STATUS.READY_TO_PICK,
|
|
117
119
|
product: await tx.getRepository(Product).findOne(productId),
|
|
120
|
+
productDetail: productDetailId,
|
|
118
121
|
packingType,
|
|
119
122
|
packingSize,
|
|
120
123
|
orderProduct: targetProduct,
|