예제 #1
0
  /**
   * 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());
        }
      }
    }
  }
예제 #2
0
  public List<Long> retrieveValidAssetNumberForLocking(
      Integer poId, String capitalAssetSystemTypeCode, PurApItem purApItem) {
    List<Long> capitalAssetNumbers = new ArrayList<Long>();
    CapitalAssetSystem capitalAssetSystem = null;

    if (PurapConstants.CapitalAssetTabStrings.INDIVIDUAL_ASSETS.equalsIgnoreCase(
        capitalAssetSystemTypeCode)) {
      // If PurAp sets the CAMS as INDIVIDUAL system
      capitalAssetSystem = getCapitalAssetSystemForIndividual(poId, purApItem);

    } else if (PurapConstants.CapitalAssetTabStrings.ONE_SYSTEM.equalsIgnoreCase(
        capitalAssetSystemTypeCode)) {
      capitalAssetSystem =
          this.getPurchaseOrderService().retrieveCapitalAssetSystemForOneSystem(poId);
    } else if (PurapConstants.CapitalAssetTabStrings.MULTIPLE_SYSTEMS.equalsIgnoreCase(
        capitalAssetSystemTypeCode)) {
      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.
        capitalAssetSystem = capitalAssetSystems.get(0);
      }
    }

    if (ObjectUtils.isNotNull(capitalAssetSystem)
        && capitalAssetSystem.getItemCapitalAssets() != null
        && !capitalAssetSystem.getItemCapitalAssets().isEmpty()) {
      for (ItemCapitalAsset itemCapitalAsset : capitalAssetSystem.getItemCapitalAssets()) {
        if (itemCapitalAsset.getCapitalAssetNumber() != null) {
          Map pKeys = new HashMap<String, Object>();
          // Asset must be valid and capital active 'A','C','S','U'
          pKeys.put(
              CamsPropertyConstants.Asset.CAPITAL_ASSET_NUMBER,
              itemCapitalAsset.getCapitalAssetNumber());

          Asset asset = (Asset) businessObjectService.findByPrimaryKey(Asset.class, pKeys);
          if (ObjectUtils.isNotNull(asset)
              && getAssetService().isCapitalAsset(asset)
              && !getAssetService().isAssetRetired(asset)) {
            capitalAssetNumbers.add(itemCapitalAsset.getCapitalAssetNumber());
          }
        }
      }
    }
    return capitalAssetNumbers;
  }
예제 #3
0
  /**
   * 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());
    }
  }