Commit 50c7104f authored by cpatil's avatar cpatil

add order by in stock sql


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@94354 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 6a0ba238
......@@ -697,6 +697,26 @@ public class WOIssueReplacementPrc extends ProcessEJB implements GenerateReceipt
//on 31/07/13
sql = sql +" and ( select count(1) from qc_order where item_code =a.item_code and site_code= a.site_code and lot_no = a.lot_no and status = 'U')=0 " ;
sql = sql + " order by a.partial_used,decode('N','P',decode(rtrim('"+locGroup+"'),rtrim(''),'A','B'),'0'), " ;
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME))
{
sql = sql + " nvl(a.exp_date,a.crea_date),a.crea_date,a.lot_no ";
System.out.println("after sql db converted 2--["+sql+"]->.");
}
else
{
sql = sql + " nvl(a.exp_date,a.crea_date),a.crea_date,a.lot_no, "
+ " decode(length(decode( substr(rtrim(a.lot_sl), length(rtrim(a.lot_sl))) ," +
" 'S',(substr(rtrim(a.lot_sl),1,length(rtrim(a.lot_sl)) - 1)) ,rtrim(a.lot_sl)) ), "
+ " 1, '00' || decode( substr(rtrim(a.lot_sl), length(rtrim(a.lot_sl))) , " +
"'S',(substr(rtrim(a.lot_sl),1,length(rtrim(a.lot_sl)) )) ,rtrim(a.lot_sl)), "
+" decode(length(decode( substr(rtrim(a.lot_sl), length(rtrim(a.lot_sl))) , 'S',(substr(rtrim(a.lot_sl),1,length(rtrim(a.lot_sl)) - 1)) ,rtrim(a.lot_sl)) ), "
+ " 2, '0' || decode( substr(rtrim(a.lot_sl), length(rtrim(a.lot_sl))) , 'S',(substr(rtrim(a.lot_sl),1,length(rtrim(a.lot_sl)) )) ,rtrim(a.lot_sl)), "
+" decode( substr(rtrim(a.lot_sl), length(rtrim(a.lot_sl))) ," +
" 'S',(substr(rtrim(a.lot_sl),1,length(rtrim(a.lot_sl)) - 1)) ,rtrim(a.lot_sl)) )) ";
}
pstmt1 = conn.prepareStatement(sql);
pstmt1.setString(1,itemCode);
pstmt1.setString(2,siteCode);
......@@ -883,6 +903,28 @@ public class WOIssueReplacementPrc extends ProcessEJB implements GenerateReceipt
//on 31/07/13
stockSql = stockSql +" and ( select count(1) from qc_order where item_code =a.item_code and site_code= a.site_code and lot_no = a.lot_no and status = 'U')=0 " ;
stockSql = stockSql +" and ( a.quantity - a.alloc_qty ) > 0 ";
stockSql = stockSql + " order by a.partial_used,decode('N','P',decode(rtrim('"+locGroup+"'),rtrim(''),'A','B'),'0'), " ;
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME))
{
stockSql = stockSql + " nvl(a.exp_date,a.crea_date),a.crea_date,a.lot_no ";
System.out.println("after sql db converted --["+stockSql+"]->.");
}
else
{
stockSql = stockSql + " nvl(a.exp_date,a.crea_date),a.crea_date,a.lot_no, "
+ " decode(length(decode( substr(rtrim(a.lot_sl), length(rtrim(a.lot_sl))) ," +
" 'S',(substr(rtrim(a.lot_sl),1,length(rtrim(a.lot_sl)) - 1)) ,rtrim(a.lot_sl)) ), "
+ " 1, '00' || decode( substr(rtrim(a.lot_sl), length(rtrim(a.lot_sl))) , " +
"'S',(substr(rtrim(a.lot_sl),1,length(rtrim(a.lot_sl)) )) ,rtrim(a.lot_sl)), "
+" decode(length(decode( substr(rtrim(a.lot_sl), length(rtrim(a.lot_sl))) , 'S',(substr(rtrim(a.lot_sl),1,length(rtrim(a.lot_sl)) - 1)) ,rtrim(a.lot_sl)) ), "
+ " 2, '0' || decode( substr(rtrim(a.lot_sl), length(rtrim(a.lot_sl))) , 'S',(substr(rtrim(a.lot_sl),1,length(rtrim(a.lot_sl)) )) ,rtrim(a.lot_sl)), "
+" decode( substr(rtrim(a.lot_sl), length(rtrim(a.lot_sl))) ," +
" 'S',(substr(rtrim(a.lot_sl),1,length(rtrim(a.lot_sl)) - 1)) ,rtrim(a.lot_sl)) )) ";
}
System.out.println("\n\n\n Query Executed " + stockSql+ "\n\n******************");
pstmt = conn.prepareStatement(stockSql);
pstmt.setTimestamp(1,currDate1);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment