/** * Set Multiple system capital asset transaction type code and asset numbers. * * @param poId * @param purApDocs */ protected void setMultipleSystemFromPurAp( Integer poId, List<PurchasingAccountsPayableDocument> purApDocs, String capitalAssetSystemStateCode) { List<CapitalAssetSystem> capitalAssetSystems = this.getPurchaseOrderService().retrieveCapitalAssetSystemsForMultipleSystem(poId); if (ObjectUtils.isNotNull(capitalAssetSystems) && !capitalAssetSystems.isEmpty()) { // PurAp doesn't support multiple system asset information for KFS3.0. It works as one system // for 3.0. CapitalAssetSystem capitalAssetSystem = capitalAssetSystems.get(0); if (ObjectUtils.isNotNull(capitalAssetSystem)) { String capitalAssetTransactionType = getCapitalAssetTransTypeForOneSystem(poId); // if modify existing asset, acquire the assets from Purap List<ItemCapitalAsset> purApCapitalAssets = null; if (PurapConstants.CapitalAssetSystemStates.MODIFY.equalsIgnoreCase( capitalAssetSystemStateCode)) { purApCapitalAssets = getAssetsFromItemCapitalAsset(capitalAssetSystem.getItemCapitalAssets()); } // set TransactionTypeCode, itemCapitalAssets and system identifier for each item for (PurchasingAccountsPayableDocument purApDoc : purApDocs) { setItemAssetsCamsTransaction( capitalAssetSystem.getCapitalAssetSystemIdentifier(), capitalAssetTransactionType, purApCapitalAssets, purApDoc.getPurchasingAccountsPayableItemAssets()); } } } }
/** * Finding out the matching PREQ/CM items originating from the same PurchaseOrderItem. * * @param itemIdentifier * @param purApDocs * @return */ protected List<PurchasingAccountsPayableItemAsset> getMatchingItems( Integer itemIdentifier, List<PurchasingAccountsPayableDocument> purApDocs) { List<PurchasingAccountsPayableItemAsset> matchingItems = new ArrayList<PurchasingAccountsPayableItemAsset>(); if (itemIdentifier != null) { for (PurchasingAccountsPayableDocument purApDoc : purApDocs) { for (PurchasingAccountsPayableItemAsset item : purApDoc.getPurchasingAccountsPayableItemAssets()) { if (itemIdentifier.equals(item.getPurchaseOrderItemIdentifier())) { matchingItems.add(item); } } } } return matchingItems; }
/** * Set CAMS transaction type code the user entered in PurAp * * @param poId */ public void setCamsTransactionFromPurAp(List<PurchasingAccountsPayableDocument> purApDocs) { if (ObjectUtils.isNull(purApDocs) || purApDocs.isEmpty()) { return; } Integer poId = purApDocs.get(0).getPurchaseOrderIdentifier(); PurchaseOrderDocument purApdocument = getCurrentDocumentForPurchaseOrderIdentifier(poId); if (ObjectUtils.isNull(purApdocument)) { return; } String capitalAssetSystemTypeCode = purApdocument.getCapitalAssetSystemTypeCode(); String capitalAssetSystemStateCode = purApdocument.getCapitalAssetSystemStateCode(); boolean individualItemLock = false; if (PurapConstants.CapitalAssetTabStrings.INDIVIDUAL_ASSETS.equalsIgnoreCase( capitalAssetSystemTypeCode)) { // If PurAp sets the CAMS as INDIVIDUAL system setIndividualAssetsFromPurAp(poId, purApDocs, capitalAssetSystemStateCode); individualItemLock = true; } else if (PurapConstants.CapitalAssetTabStrings.ONE_SYSTEM.equalsIgnoreCase( capitalAssetSystemTypeCode)) { // If PurAp sets the CAMS as ONE system setOneSystemFromPurAp(poId, purApDocs, capitalAssetSystemStateCode); } else if (PurapConstants.CapitalAssetTabStrings.MULTIPLE_SYSTEMS.equalsIgnoreCase( capitalAssetSystemTypeCode)) { // If PurAp sets the CAMS as MULTIPLE system setMultipleSystemFromPurAp(poId, purApDocs, capitalAssetSystemStateCode); } // Setting locking information based on capital asset system type code. Currently, only // individual system can set asset // numbers for each item for (PurchasingAccountsPayableDocument purApDoc : purApDocs) { for (PurchasingAccountsPayableItemAsset itemAsset : purApDoc.getPurchasingAccountsPayableItemAssets()) { itemAsset.setLockingInformation( individualItemLock ? itemAsset.getAccountsPayableLineItemIdentifier().toString() : CamsConstants.defaultLockingInformation); } } }
/** * Set One System capital asset transaction type code and asset numbers. * * @param poId * @param purApDocs */ protected void setOneSystemFromPurAp( Integer poId, List<PurchasingAccountsPayableDocument> purApDocs, String capitalAssetSystemStateCode) { CapitalAssetSystem capitalAssetSystem = this.getPurchaseOrderService().retrieveCapitalAssetSystemForOneSystem(poId); String capitalAssetTransactionTypeCode = getCapitalAssetTransTypeForOneSystem(poId); List<ItemCapitalAsset> purApCapitalAssets = null; // if modify existing asset, acquire the assets from Purap if (PurapConstants.CapitalAssetSystemStates.MODIFY.equalsIgnoreCase( capitalAssetSystemStateCode)) { purApCapitalAssets = getAssetsFromItemCapitalAsset(capitalAssetSystem.getItemCapitalAssets()); } for (PurchasingAccountsPayableDocument purApDoc : purApDocs) { // set TransactionTypeCode, itemCapitalAssets and system identifier for each item setItemAssetsCamsTransaction( capitalAssetSystem.getCapitalAssetSystemIdentifier(), capitalAssetTransactionTypeCode, purApCapitalAssets, purApDoc.getPurchasingAccountsPayableItemAssets()); } }