Commit 53320d08 authored by kmandhre's avatar kmandhre

change for quantity allocate in invalloc_trace


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@93848 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 2632c2ba
......@@ -3,6 +3,7 @@ package ibase.webitm.ejb.dis;
import java.rmi.RemoteException;
import java.lang.String;
import java.sql.*;
import javax.ejb.*;
import javax.naming.InitialContext;
import java.util.HashMap;
......@@ -67,6 +68,10 @@ public class StockTransferPos extends ValidatorEJB implements StockTransferPosLo
HashMap hashMap = new HashMap();
String lineNo = "", tranId = "", tranSer = "XFRX", line = "", updateStatus = ""; //change tran Series(XFRX) on 18/OCT/13 Kunal M
String siteCode = "", itemCode = "", quantity = "", locCode = "", lotNo = "", lotSl = "";
String sql = "";
Double allocQty = 0.0 ,totAllocQty = 0.0, qty = 0.0 ,pendingQty = 0.0;
PreparedStatement pstmt = null;
ResultSet rs = null;
DistStkUpdLocal distStkUpd = null;
NodeList hdrDom = null;
Node currDetail = null;
......@@ -103,6 +108,39 @@ public class StockTransferPos extends ValidatorEJB implements StockTransferPosLo
{
quantity = "0.000";
}
//added by kunal on 06/NOV/13
sql = "select ref_ser,ref_id ,trim(ref_line) as ref_line, sum(alloc_qty) from invalloc_trace where "
+" site_code = ? and loc_code = ? and item_code = ? and lot_no = ? and lot_sl = ? "
+" group by ref_ser, ref_id ,trim( ref_line) having sum(alloc_qty) > 0 order by sum(alloc_qty) desc ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, siteCode);
pstmt.setString(2, locCode);
pstmt.setString(3, itemCode);
pstmt.setString(4, lotNo);
pstmt.setString(5, lotSl);
rs = pstmt.executeQuery();
while(rs.next())
{
//refSer = checkNull(rs.getString( "ref_ser" )) ;
//refId = checkNull(rs.getString( "ref_id" ));
System.out.println("ref ser="+rs.getString( "ref_ser" )+" ref id="+rs.getString( "ref_id" ));
//refLine = Integer.parseInt( checkNull(rs.getString("ref_line")).trim().length() == 0 ?"0":rs.getString("ref_line").trim()) ;
allocQty = rs.getDouble(4);
System.out.println("allocQty="+allocQty);
totAllocQty = totAllocQty + allocQty;
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
System.out.println("totAllocQty="+totAllocQty);
qty = new Double(quantity.trim().length() == 0?"0":quantity);
pendingQty = qty - totAllocQty;
System.out.println("pendingQty="+pendingQty);
if(pendingQty > 0)
{
//added by kunal on 06/NOV/13 END
hashMap.put("tran_date", new java.sql.Date(System.currentTimeMillis()));
hashMap.put("ref_ser",tranSer);
hashMap.put("ref_id", tranId);
......@@ -112,7 +150,8 @@ public class StockTransferPos extends ValidatorEJB implements StockTransferPosLo
hashMap.put("loc_code",locCode);
hashMap.put("lot_no",lotNo);
hashMap.put("lot_sl",lotSl);
hashMap.put("alloc_qty", new Double(quantity.trim().length() == 0?"0":quantity));
//hashMap.put("alloc_qty", new Double(quantity.trim().length() == 0?"0":quantity));
hashMap.put("alloc_qty", new Double(pendingQty));//changed by kunal on 06/NOV/13
hashMap.put("chg_win","W_STOCK_TRANSFER_MULTI");
hashMap.put("chg_user", GenericUtility.getInstance().getValueFromXTRA_PARAMS(xtraParams, "loginCode"));
hashMap.put("chg_term", GenericUtility.getInstance().getValueFromXTRA_PARAMS(xtraParams, "termId"));
......@@ -122,6 +161,7 @@ public class StockTransferPos extends ValidatorEJB implements StockTransferPosLo
{
System.out.println("distStkUpd.UpdAllocTrace(HashMap, Connection) : Sucessuful!");
}
}
}//end if
}//end if
}//end try
......@@ -182,11 +222,21 @@ public class StockTransferPos extends ValidatorEJB implements StockTransferPosLo
{
try
{
if(rs != null)
{
rs.close();
rs = null;
}
if (stmt != null)
{
stmt.close();
stmt = null;
}
if(conn != null)
{
conn.close();
conn = null;
}
}
catch(Exception e)
{
......
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