Ejemplo n.º 1
0
  @Override
  public List<TransferView> getAccount(TransferView transferV) {
    // TODO Auto-generated method stub
    Connection conn = DBUtil.getConnection();
    PreparedStatement pstm = null;
    ResultSet rs = null;
    List<TransferView> list = new ArrayList<TransferView>();
    String sql =
        "select goods_id,goods_name,goods_unit,goods_spft,goods_num,goods_manufacture from transfer_account"
            + " where warehouse_id=?";
    try {
      pstm = conn.prepareStatement(sql);
      WarehouseBeans housb = transferV.getWarehouseb();
      pstm.setString(1, housb.getWarehouse_id());
      System.out.println(housb.getWarehouse_id());
      rs = pstm.executeQuery();
      TransferView transV = null;
      while (rs.next()) {
        transV = new TransferView();
        GoodsBeans goodsb = new GoodsBeans();
        HouseCapacityBeans houseb = new HouseCapacityBeans();
        goodsb.setGoods_id(rs.getString("goods_id"));
        goodsb.setGoods_name(rs.getString("goods_name"));
        goodsb.setGoods_unit(rs.getString("goods_unit"));
        goodsb.setGoods_spft(rs.getString("goods_spft"));
        houseb.setGoods_num(rs.getInt("goods_num"));
        goodsb.setGoods_manufacture(rs.getString("goods_manufacture"));

        transV.setGoodsb(goodsb);
        transV.setHousecapb(houseb);

        list.add(transV);
      }
    } catch (SQLException e) {
      // TODO: handle exception
      e.printStackTrace();
    } finally {
      DBUtil.free(rs, pstm, conn);
    }

    return list;
  }
Ejemplo n.º 2
0
  @Override
  public TransferView getChoose(TransferView transferV) {
    // TODO Auto-generated method stub
    Connection conn = DBUtil.getConnection();
    PreparedStatement pstm = null;
    ResultSet rs = null;
    TransferView transV = null;
    String sql =
        "select goods_id,goods_name,goods_unit,goods_spft,goods_apvlunm,goods_num,goods_manufacture from transfer_account "
            + "where goods_id=? and warehouse_id=?";
    try {
      WarehouseBeans warehouseb = transferV.getWarehouseb();
      GoodsBeans godsb = transferV.getGoodsb();
      pstm = conn.prepareStatement(sql);
      pstm.setString(1, godsb.getGoods_id());
      pstm.setString(2, warehouseb.getWarehouse_id());
      rs = pstm.executeQuery();
      transV = new TransferView();
      GoodsBeans goodsb = new GoodsBeans();
      HouseCapacityBeans houseb = new HouseCapacityBeans();
      while (rs.next()) {
        goodsb.setGoods_id(rs.getString("goods_id"));
        goodsb.setGoods_name(rs.getString("goods_name"));
        goodsb.setGoods_unit(rs.getString("goods_unit"));
        goodsb.setGoods_spft(rs.getString("goods_spft"));
        goodsb.setGoods_apvlnum(rs.getString("goods_apvlunm"));
        houseb.setGoods_num(rs.getInt("goods_num"));
        goodsb.setGoods_manufacture(rs.getString("goods_manufacture"));

        transV.setGoodsb(goodsb);
        transV.setHousecapb(houseb);
      }

    } catch (SQLException e) {
      // TODO: handle exception
      e.printStackTrace();
    } finally {
      DBUtil.free(rs, pstm, conn);
    }
    return transV;
  }
Ejemplo n.º 3
0
 @Override
 public List<TransferView> getGoodsByMid(MoveBeans movesb) {
   List<TransferView> glist = new ArrayList<TransferView>();
   Connection conn = DBUtil.getConnection();
   PreparedStatement pstm = null;
   ResultSet rs = null;
   String sql =
       "select goods.*,move_number from goods inner join moves "
           + "on  moves.goods_id = goods.goods_id where moves.move_id=?";
   try {
     pstm = conn.prepareStatement(sql);
     pstm.setString(1, movesb.getMove_id());
     rs = pstm.executeQuery();
     GoodsBeans gb = null;
     MoveBeans mb = null;
     TransferView tV = null;
     while (rs.next()) {
       gb = new GoodsBeans();
       mb = new MoveBeans();
       tV = new TransferView();
       gb.setGoods_id(rs.getString("goods_id"));
       gb.setGoods_name(rs.getString("goods_name"));
       mb.setMove_number(rs.getInt("move_number"));
       gb.setGoods_unit(rs.getString("goods_unit"));
       gb.setGoods_spft(rs.getString("goods_spft"));
       gb.setGoods_apvlnum(rs.getString("goods_apvlunm"));
       tV.setGoodsb(gb);
       tV.setMovesb(mb);
       glist.add(tV);
     }
   } catch (SQLException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   } finally {
     DBUtil.free(rs, pstm, conn);
   }
   return glist;
 }