コード例 #1
0
 /**
  * Update item assets by PurAp Cams Transaction setting
  *
  * @param capitalAssetSystemIdentifier
  * @param capitRalAssetTransactionTypeCode
  * @param purApCapitalAssets
  * @param itemAssets
  */
 protected void setItemAssetsCamsTransaction(
     Integer capitalAssetSystemIdentifier,
     String capitalAssetTransactionTypeCode,
     List<ItemCapitalAsset> purApCapitalAssets,
     List<PurchasingAccountsPayableItemAsset> itemAssets) {
   for (PurchasingAccountsPayableItemAsset item : itemAssets) {
     item.setCapitalAssetTransactionTypeCode(capitalAssetTransactionTypeCode);
     // set for item capital assets
     if (purApCapitalAssets != null && !purApCapitalAssets.isEmpty()) {
       item.getPurApItemAssets().addAll(purApCapitalAssets);
     }
     // set for capital asset system ID
     item.setCapitalAssetSystemIdentifier(capitalAssetSystemIdentifier);
   }
 }
コード例 #2
0
  /**
   * 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;
  }
コード例 #3
0
  /**
   * 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);
      }
    }
  }
コード例 #4
0
  /**
   * Set CAB line item information from PurAp PaymentRequestItem or CreditMemoItem.
   *
   * @param purchasingAccountsPayableItemAsset
   * @param docTypeCode
   */
  public void setAccountsPayableItemsFromPurAp(
      PurchasingAccountsPayableItemAsset purchasingAccountsPayableItemAsset, String docTypeCode) {
    Map<String, Object> pKeys = new HashMap<String, Object>();
    pKeys.put(
        PurapPropertyConstants.ITEM_IDENTIFIER,
        purchasingAccountsPayableItemAsset.getAccountsPayableLineItemIdentifier());

    // Access PurAp data based on item type(PREQ or CM).
    if (CabConstants.PREQ.equalsIgnoreCase(docTypeCode)) {
      // for PREQ document
      PaymentRequestItem item =
          (PaymentRequestItem)
              businessObjectService.findByPrimaryKey(PaymentRequestItem.class, pKeys);
      if (ObjectUtils.isNull(item)) {
        throw new PurApDocumentUnavailableException(
            "PaymentRequestItem with id = "
                + purchasingAccountsPayableItemAsset.getAccountsPayableLineItemIdentifier()
                + " doesn't exist in table.");
      }

      purchasingAccountsPayableItemAsset.setItemLineNumber(item.getItemLineNumber());
      if (item.getItemType() != null) {
        purchasingAccountsPayableItemAsset.setAdditionalChargeNonTradeInIndicator(
            item.getItemType().isAdditionalChargeIndicator()
                & !CabConstants.TRADE_IN_TYPE_CODE.equalsIgnoreCase(item.getItemTypeCode()));
        purchasingAccountsPayableItemAsset.setTradeInAllowance(
            item.getItemType().isAdditionalChargeIndicator()
                & CabConstants.TRADE_IN_TYPE_CODE.equalsIgnoreCase(item.getItemTypeCode()));
        purchasingAccountsPayableItemAsset.setItemTypeCode(item.getItemTypeCode());
      }
      purchasingAccountsPayableItemAsset.setItemAssignedToTradeInIndicator(
          item.getItemAssignedToTradeInIndicator());
      // PurchaseOrderItemIdentifier will be used when populate PurAp asset data
      PurchaseOrderItem poi = item.getPurchaseOrderItem();
      if (poi != null) {
        purchasingAccountsPayableItemAsset.setPurchaseOrderItemIdentifier(poi.getItemIdentifier());
      }
    } else {
      // for CM document
      CreditMemoItem item =
          (CreditMemoItem) businessObjectService.findByPrimaryKey(CreditMemoItem.class, pKeys);
      if (ObjectUtils.isNull(item)) {
        throw new PurApDocumentUnavailableException(
            "CreditMemoItem with id = "
                + purchasingAccountsPayableItemAsset.getAccountsPayableLineItemIdentifier()
                + " doesn't exist in table.");
      }

      purchasingAccountsPayableItemAsset.setItemLineNumber(item.getItemLineNumber());
      if (item.getItemType() != null) {
        purchasingAccountsPayableItemAsset.setAdditionalChargeNonTradeInIndicator(
            item.getItemType().isAdditionalChargeIndicator()
                & !CabConstants.TRADE_IN_TYPE_CODE.equalsIgnoreCase(item.getItemTypeCode()));
        purchasingAccountsPayableItemAsset.setTradeInAllowance(
            item.getItemType().isAdditionalChargeIndicator()
                & CabConstants.TRADE_IN_TYPE_CODE.equalsIgnoreCase(item.getItemTypeCode()));
        purchasingAccountsPayableItemAsset.setItemTypeCode(item.getItemTypeCode());
      }
      purchasingAccountsPayableItemAsset.setItemAssignedToTradeInIndicator(
          item.getItemAssignedToTradeInIndicator());
      // PurchaseOrderItemIdentifier will be used when populate PurAp asset data
      PurchaseOrderItem poi = getPurchaseOrderItemfromCreditMemoItem(item);
      if (poi != null) {
        purchasingAccountsPayableItemAsset.setPurchaseOrderItemIdentifier(poi.getItemIdentifier());
      }
      // if PREQ Credit Memo document
      VendorCreditMemoDocument cmDoc = (VendorCreditMemoDocument) item.getPurapDocument();
      if (ObjectUtils.isNotNull(cmDoc) && cmDoc.isSourceDocumentPaymentRequest()) {
        purchasingAccountsPayableItemAsset.setPaymentRequestIdentifier(
            cmDoc.getPaymentRequestIdentifier());
      }
    }
  }