* 查询* 但是没有给出任何输出它离开循环if(cur.moveToFirst())请帮忙。我从日期开始传递日期:2013年2月20日到日期:02/28/2013,库存中心ID为1,库存itemid为4
public ArrayList<HashMap<String, String>>getStockLedgerTrans(String stockCenterId, String stockItemId, String from_dt, String to_dt){
ArrayList<HashMap<String, String>> StockLedgerTrans = new ArrayList<HashMap<String, String>>();
db = this.getReadableDatabase();
String fromdt= from_dt.toString();
String todt= to_dt.toString();
String frdt = "'"+fromdt+"'";
String tdt = "'"+todt+"'";
System.out.println("StockCenterId, StockItemId getStockbal "+stockCenterId +" "+ frdt
+" "+ stockItemId+" "+ tdt);
if (stockItemId != null && stockCenterId != null){
Cursor cur= db.rawQuery("SELECT VD.VOUCHER_NO AS VOUCHER_NO, VD.VOUCHER_TYPE AS VOUCHER_TYPE,"+
" VD.VOUCHER_DATE AS VOUCHER_DATE, VD.IN_QTY AS IN_QTY, VD.OUT_QTY AS OUT_QTY" +
" FROM QT_UM_STOCK_VOCH VD WHERE VD.STOCK_CENTER_ID "+ " =? " +
" AND VD.ITEM_ID "+ " =? "+ " AND VD.VOUCHER_DATE "+ " >? " +
" AND VD.VOUCHER_DATE" + " <? ", new String[]{stockCenterId,stockItemId,frdt,tdt});
System.out.println("In Here 1234554");
int count=0;
HashMap<String, String> Map = null;
if (cur != null) {
if (cur.moveToFirst()) {
do {
try{
if(count==0)
{
Map = new HashMap<String, String>();
Map.put(Constants.Bat_Acc_Voch_VOUCHER_ID,spaceManage("V.No",5));
Map.put(Constants.Bat_Acc_Voch_VOUCHER_TYPE,spaceManage("Source",13)) ;
Map.put(Constants.Bat_Acc_Voch_VOUCHER_DATE,spaceManage("Date",20));
Map.put(Constants.qt_um_stock_items_qty_IN_WEIGHT,spaceManage("Qty. Inflow",11)) ;
Map.put(Constants.qt_um_stock_items_qty_OUT_WEIGHT,spaceManage("Qty. Outflow",11
));
StockLedgerTrans.add(Map);
count++;
}
Map= new HashMap <String,String>();
String voucherNo=cur.getString(cur.getColumnIndex("VOUCHER_NO"));
String voucherType=cur.getString(cur.getColumnIndex("VOUCHER_TYPE"));
String voucherDate=cur.getString(cur.getColumnIndex("VOUCHER_DATE"));
String inQty=cur.getString(cur.getColumnIndex("IN_QTY"));
String outQty=cur.getString(cur.getColumnIndex("OUT_QTY"));
System.out.println("Transactions no"+voucherNo +" type "+
voucherType+" date "+voucherDate+" in "+inQty+"out "+outQty);
Map.put(Constants.Bat_Acc_Voch_VOUCHER_ID,spaceManage(voucherNo,5));
Map.put(Constants.Bat_Acc_Voch_VOUCHER_TYPE, spaceManage(voucherType,13));
Map.put(Constants.Bat_Acc_Voch_VOUCHER_DATE, spaceManage(voucherDate,20));
Map.put(Constants.qt_um_stock_items_qty_IN_WEIGHT, spaceManage(inQty,11));
Map.put(Constants.qt_um_stock_items_qty_OUT_WEIGHT, outQty);
StockLedgerTrans.add(Map);
}
catch(Exception e){
e.printStackTrace();
}
}while(cur.moveToNext());
}else{
System.out.println("out of move to next");
}
}else{
System.out.println("OuT of cur=null");
}
}
return StockLedgerTrans;
}