Ejemplo n.º 1
0
  public List<String> getUnusedStocks(int moduleid, String firmID) {
    List<String> result = new ArrayList();
    WareHouseStockDAO wareHouseStockDAO = Server.getInstance().getWareHouseStockDAO();

    List<StockPO> stockList = wareHouseStockDAO.getUnusedStocksVOList(moduleid, firmID);
    if ((stockList == null) || (stockList.size() <= 0)) {
      return result;
    }
    for (StockPO stock : stockList) {
      result.add(stock.getStockID());
    }
    return result;
  }
Ejemplo n.º 2
0
  public List<String> getUnusedStocks(
      long breedID, Map<String, String> propertys, String firmID, double quantity) {
    List<String> result = new ArrayList();
    WareHouseStockDAO wareHouseStockDAO = Server.getInstance().getWareHouseStockDAO();

    List<StockVO> stockList = wareHouseStockDAO.getUnusedStocksVOList(breedID, firmID, quantity);
    if ((stockList == null) || (stockList.size() <= 0)) {
      return result;
    }
    List<Map<String, Object>> propertyList =
        wareHouseStockDAO.getCategoryPropertyByBreedID(breedID);
    if ((propertyList != null) && (propertyList.size() > 0)) {
      for (Map<String, Object> map : propertyList) {
        if ((map.get("stockcheck") != null) && (map.get("stockcheck").equals("Y"))) {
          String propValue = (String) propertys.get(map.get("propertyname").toString());
          List<StockVO> removeStock = new ArrayList();
          for (StockVO stockVO : stockList) {
            List<GoodsPropertyPO> props = stockVO.getStockPropertys();
            if ((props == null) || (props.size() <= 0)) {
              removeStock.add(stockVO);
            } else {
              String stockP = null;
              for (GoodsPropertyPO goodsPropertyPO : props) {
                if (map.get("propertyname").toString().equals(goodsPropertyPO.getPropertyName())) {
                  stockP = goodsPropertyPO.getPropertyValue();
                  break;
                }
              }
              if (((propValue == null) && (stockP != null))
                  || ((propValue != null) && (stockP == null))
                  || ((propValue != null) && (stockP != null) && (!propValue.equals(stockP)))) {
                removeStock.add(stockVO);
              }
            }
          }
          for (StockVO stockVO : removeStock) {
            stockList.remove(stockVO);
          }
        } else if ((map.get("stockcheck") != null) && (map.get("stockcheck").equals("M"))) {
          String propValue = (String) propertys.get(map.get("propertyname").toString());
          List<StockVO> removeStock = new ArrayList();
          for (StockVO stockVO : stockList) {
            List<GoodsPropertyPO> props = stockVO.getStockPropertys();
            if ((props == null) || (props.size() <= 0)) {
              removeStock.add(stockVO);
            } else {
              String stockP = null;
              for (GoodsPropertyPO goodsPropertyPO : props) {
                if (map.get("propertyname").toString().equals(goodsPropertyPO.getPropertyName())) {
                  stockP = goodsPropertyPO.getPropertyValue();
                  break;
                }
              }
              if (((propValue == null) && (stockP != null))
                  || ((propValue != null) && (stockP == null))
                  || ((propValue != null)
                      && (stockP != null)
                      && (!("|" + propValue + "|").contains("|" + stockP + "|")))) {
                removeStock.add(stockVO);
              }
            }
          }
          for (StockVO stockVO : removeStock) {
            stockList.remove(stockVO);
          }
        }
      }
    }
    for (StockVO stockVO : stockList) {
      result.add(stockVO.getStock().getStockID());
    }
    return result;
  }