Exemplo n.º 1
0
 @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;
 }
Exemplo n.º 2
0
 @Override
 public AjaxJson getIcItemPriceInfoByIcitemId(String id) {
   AjaxJson j = new AjaxJson();
   Map<String, Object> attributes = new HashMap<String, Object>();
   TScIcitemEntity icitemEntity = this.getEntity(TScIcitemEntity.class, id);
   if (null != icitemEntity.getStockForIcitemEntity()) {
     attributes.put("stockId", icitemEntity.getStockForIcitemEntity().getId());
     attributes.put("stockName", icitemEntity.getStockForIcitemEntity().getName());
   } else {
     attributes.put("stockId", "");
     attributes.put("stockName", "");
   }
   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()); // 商品从表主键
       attributes.put("barCode", price.getBarCode()); // 商品从表的条形码
       //				attributes.put("unieName",price.getMeasureunitToIcItemEntity().getName());
       attributes.put("cofficient", price.getCoefficient()); // 单位换算率
       if (price.getXsLimitPrice() == null) {
         attributes.put("xsLimitPrice", 0);
       } else {
         attributes.put("xsLimitPrice", price.getXsLimitPrice());
       }
     }
     if ("0003".equals(price.getUnitType())) {
       attributes.put("secUnitId", price.getId());
       attributes.put("secCoefficient", price.getCoefficient());
     } else if ("0001".equals(price.getUnitType())) {
       attributes.put("basicUnitId", price.getId());
     }
   }
   //		attributes.put("id",id);
   j.setAttributes(attributes);
   return j;
 }
Exemplo n.º 3
0
 /**
  * 单位变换时获取相应的换算率和条码
  *
  * @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;
 }
Exemplo n.º 4
0
 /**
  * @param id
  * @return
  */
 @Override
 public AjaxJson getItemInfoById(String id, String tranType, String stockId, String batchNo) {
   AjaxJson j = new AjaxJson();
   Map<String, Object> attributes = new HashMap<String, Object>();
   TScIcitemEntity icitemEntity = this.getEntity(TScIcitemEntity.class, id);
   // 配置默认仓库
   if (null != icitemEntity.getStockForIcitemEntity()) {
     attributes.put("stockId", icitemEntity.getStockForIcitemEntity().getId());
     attributes.put("stockName", icitemEntity.getStockForIcitemEntity().getName());
   } else {
     attributes.put("stockId", "");
     attributes.put("stockName", "");
   }
   List<TScItemPriceEntity> priceEntityList =
       this.findHql("from TScItemPriceEntity where itemID = ?", new Object[] {id});
   for (TScItemPriceEntity price : priceEntityList) {
     if ("51".equals(tranType)) {
       if (null != price.getDefaultCG() && 1 == price.getDefaultCG()) {
         attributes.put("unitId", price.getId());
         attributes.put(
             "unitName",
             price.getMeasureunitToIcItemEntity() == null
                 ? ""
                 : price.getMeasureunitToIcItemEntity().getName());
         attributes.put("cofficient", price.getCoefficient());
         attributes.put("barCode", price.getBarCode());
         // 采购限价
         attributes.put("cgLimitPrice", price.getCgLimitPrice());
         // 销货限价
         attributes.put("xsLimitPrice", price.getXsLimitPrice());
       }
     } else if ("52".equals(tranType) || "53".equals(tranType)) {
       if (null != price.getDefaultCK() && 1 == price.getDefaultCK()) {
         attributes.put("unitId", price.getId());
         attributes.put(
             "unitName",
             price.getMeasureunitToIcItemEntity() == null
                 ? ""
                 : price.getMeasureunitToIcItemEntity().getName());
         attributes.put("cofficient", price.getCoefficient());
         attributes.put("barCode", price.getBarCode());
         // 限购单价
         attributes.put("cgLimitPrice", price.getCgLimitPrice());
         // 销货限价
         attributes.put("xsLimitPrice", price.getXsLimitPrice());
       }
     } else if ("1504".equals(tranType) || "353".equals(tranType)) {
       if (null != price.getDefaultCK() && 1 == price.getDefaultCK()) {
         attributes.put(
             "unitName",
             price.getMeasureunitToIcItemEntity() == null
                 ? ""
                 : price.getMeasureunitToIcItemEntity().getName()); // 单位名称
         attributes.put("barCode", price.getBarCode()); // 条形码
         attributes.put("unitID", price.getId()); // 单位
         attributes.put("basicUnitID", price.getId()); // 基本单位
         attributes.put("coefficient", price.getCoefficient()); // 换算率
       }
     } else if ("103".equals(tranType) || "1506".equals(tranType)) {
       if (null != price.getDefaultXS() && 1 == price.getDefaultXS()) {
         attributes.put("unitId", price.getId());
         if (null != price.getMeasureunitToIcItemEntity()) {
           attributes.put(
               "unitName",
               price.getMeasureunitToIcItemEntity() == null
                   ? ""
                   : price.getMeasureunitToIcItemEntity().getName());
         }
         attributes.put("cofficient", price.getCoefficient());
         attributes.put("barCode", price.getBarCode());
         // 限购单价
         attributes.put("cgLimitPrice", price.getCgLimitPrice());
         // 销货限价
         attributes.put("xsLimitPrice", price.getXsLimitPrice());
       }
     }
     // 辅助单位
     if ("0003".equals(price.getUnitType())) {
       attributes.put("secUnitId", price.getId());
       attributes.put("secCoefficient", price.getCoefficient());
     }
     // 基本单位
     else if ("0001".equals(price.getUnitType())) {
       attributes.put("basicUnitId", price.getId());
       attributes.put("basicCoefficient", price.getCoefficient());
     }
   }
   attributes.put("id", id);
   if (StringUtils.isNotEmpty(stockId)) {
     // 获取库存基本信息;
     List<TScIcInventoryEntity> inventoryEntity =
         this.findHql(
             "from TScIcInventoryEntity where itemId = ? and stockId = ?",
             new Object[] {id, stockId});
     // 若存在库存数据,则判断是否存在批号数据,若不存在,则取库存数量为商品限量,若存在,则取该批号的库存数量作为商品限量
     if (inventoryEntity.size() > 0) {
       if (StringUtils.isEmpty(batchNo)) {
         attributes.put("invQty", inventoryEntity.get(0).getBasicQty());
       } else {
         List<TScIcInventoryBatchnoEntity> batchnoEntityList =
             this.findHql(
                 "from TScIcInventoryBatchnoEntity where itemId = ? and stockId=? and batchNo = ?",
                 new Object[] {id, stockId, batchNo});
         if (batchnoEntityList.size() > 0) {
           attributes.put("invQty", batchnoEntityList.get(0).getBasicQty());
         } else {
           attributes.put("invQty", inventoryEntity.get(0).getBasicQty());
         }
       }
     } else {
       attributes.put("invQty", 0);
     }
   } else {
     attributes.put("invQty", 0);
   }
   j.setAttributes(attributes);
   return j;
 }