private PricePartInfo populatePrice(MfgPricesItem mp) { PricePartInfo partInfo = new PricePartInfo(); partInfo.setPriceCode(mp.getPriceCode()); partInfo.setPriceSheet(mp.getPriceSheet()); partInfo.setPriceSheetColor(mp.getPriceSheetColor()); partInfo.setPriceType(mp.getPriceType()); partInfo.setQuantityPrice(mp.getQuantityPrice()); partInfo.setUnitPrice(mp.getUnitPrice()); return partInfo; }
public List<PricePartInfo> getPricesByMfgNameAndPartNumber( final String supplierID, final String mfgName, final String partNumber) throws UnknownHostException, IOException { List<PricePartInfo> pricePartInfos = new ArrayList<PricePartInfo>(0); MfgPricesCatalog pricesCatalog = null; try { pricesCatalog = new MfgPricesCatalog( EpicoreConstants.HOST_IP, EpicoreConstants.DOMAIN_ID, EpicoreConstants.USER_NAME, EpicoreConstants.PASSWORD, supplierID, EpicoreConstants.SERVICE_TYPE); List<?> items = pricesCatalog.MfgPricesInfo(mfgName, partNumber); for (Object object : items) { if (object instanceof MfgPricesItem) { MfgPricesItem mp = (MfgPricesItem) object; PricePartInfo pricePartInfo = populatePrice(mp); pricePartInfos.add(pricePartInfo); } } } catch (CatalogException e) { PricePartInfo pricePartInfo = new PricePartInfo(); pricePartInfo.setErrorMessage(e.getMessage()); pricePartInfos.add(pricePartInfo); } finally { if (pricesCatalog != null) { try { pricesCatalog.DisconnectCatalogServer(); } catch (CatalogException e) { PricePartInfo pricePartInfo = new PricePartInfo(); pricePartInfo.setErrorMessage(e.getMessage()); pricePartInfos.add(pricePartInfo); } } } return pricePartInfos; }