/** * 单位变换时获取相应的换算率和条码 * * @param id * @param unitId * @return */ @Override public AjaxJson getChangeInfo(String id, String unitId, Integer rowIndex) { AjaxJson j = new AjaxJson(); TScItemPriceEntity entity = this.getEntity(TScItemPriceEntity.class, unitId); Map<String, Object> attributes = new HashMap<String, Object>(); if (null != entity) { attributes.put("coefficient", entity.getCoefficient()); attributes.put("barCode", entity.getBarCode()); attributes.put("cgLimitPrice", entity.getCgLimitPrice()); if (entity.getXsLimitPrice() == null) { attributes.put("xsLimitPrice", 0); } else { attributes.put("xsLimitPrice", entity.getXsLimitPrice()); } if (entity.getCgLatestPrice() == null) { attributes.put("cgLatestPrice", 0); } else { attributes.put("cgLatestPrice", entity.getCgLatestPrice()); } } attributes.put("rowIndex", rowIndex); j.setAttributes(attributes); return j; }
@Override public AjaxJson getIcItemForQuoteItems(String id) { AjaxJson j = new AjaxJson(); Map<String, Object> attributes = new HashMap<String, Object>(); List<TScItemPriceEntity> priceEntityList = this.findHql("from TScItemPriceEntity where itemID = ?", new Object[] {id}); for (TScItemPriceEntity price : priceEntityList) { if (null != price.getDefaultXS() && 1 == price.getDefaultXS()) { attributes.put("unitId", price.getId()); // 商品从表主键相当于单位id attributes.put("barCode", price.getBarCode()); // 商品从表的条形码 attributes.put("coefficient", price.getCoefficient()); // 单位换算率 attributes.put("cgLatestPrice", price.getCgLatestPrice()); // 最近采购价 } } j.setAttributes(attributes); return j; }