Commit dafb2144 authored by cpatil's avatar cpatil

modify for integral qty


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@96823 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 8ea75414
...@@ -294,7 +294,9 @@ public class WoTransferPrc extends ProcessEJB implements WoTransferPrcLocal,WoTr ...@@ -294,7 +294,9 @@ public class WoTransferPrc extends ProcessEJB implements WoTransferPrcLocal,WoTr
sql = " select tran_id,item_code,lot_no,lot_sl,loc_code,sum(quantity) as quantity " sql = " select tran_id,item_code,lot_no,lot_sl,loc_code,sum(quantity) as quantity "
+" from inv_alloc_det where (case when alloc_qty is null then 0 else alloc_qty end - case when dealloc_qty is null then 0 else dealloc_qty end) > 0 AND tran_id IN (SELECT TRAN_ID FROM INV_ALLOCATE WHERE WORK_ORDER = ?) " +" from inv_alloc_det where (case when alloc_qty is null then 0 else alloc_qty end - case when dealloc_qty is null then 0 else dealloc_qty end) > 0 AND tran_id IN (SELECT TRAN_ID FROM INV_ALLOCATE WHERE WORK_ORDER = ?) "
+" and loc_code in(select loc_code from location where inv_stat = ? ) GROUP BY tran_id, item_code, lot_no, lot_sl, loc_code "; +" and loc_code in(select loc_code from location where inv_stat = ? ) "
+" and 'Y' <> case when deallocated is null then 'N' else deallocated end " // added by cpatil on 04/11/14
+" GROUP BY tran_id, item_code, lot_no, lot_sl, loc_code ";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
// pstmt.setString(1,tranIdInvAlloc); // pstmt.setString(1,tranIdInvAlloc);
pstmt.setString(1,worder); pstmt.setString(1,worder);
...@@ -306,8 +308,11 @@ public class WoTransferPrc extends ProcessEJB implements WoTransferPrcLocal,WoTr ...@@ -306,8 +308,11 @@ public class WoTransferPrc extends ProcessEJB implements WoTransferPrcLocal,WoTr
// +" from inv_alloc_det where tran_id IN (SELECT TRAN_ID FROM INV_ALLOCATE WHERE WORK_ORDER IN (SELECT WORK_ORDER FROM WORKORDER WHERE CAMPGN_NO = ? AND STATUS = 'R')) " // +" from inv_alloc_det where tran_id IN (SELECT TRAN_ID FROM INV_ALLOCATE WHERE WORK_ORDER IN (SELECT WORK_ORDER FROM WORKORDER WHERE CAMPGN_NO = ? AND STATUS = 'R')) "
// +" and loc_code in(select loc_code from location where inv_stat = ? ) GROUP BY item_code, lot_no, lot_sl, loc_code "; // +" and loc_code in(select loc_code from location where inv_stat = ? ) GROUP BY item_code, lot_no, lot_sl, loc_code ";
sql = " select item_code,lot_no,lot_sl,loc_code,sum(quantity) as quantity " sql = " select item_code,lot_no,lot_sl,loc_code,sum(quantity) as quantity "
+" from inv_alloc_det where (case when alloc_qty is null then 0 else alloc_qty end - case when dealloc_qty is null then 0 else dealloc_qty end) > 0 and tran_id IN (SELECT TRAN_ID FROM INV_ALLOCATE WHERE WORK_ORDER IN (SELECT WORK_ORDER FROM WORKORDER WHERE CAMPGN_NO = ? AND STATUS = 'R')) " +" from inv_alloc_det "
+" and loc_code in(select loc_code from location where inv_stat = ? ) GROUP BY item_code, lot_no, lot_sl, loc_code "; +" where (case when alloc_qty is null then 0 else alloc_qty end - case when dealloc_qty is null then 0 else dealloc_qty end) > 0 and tran_id IN (SELECT TRAN_ID FROM INV_ALLOCATE WHERE WORK_ORDER IN (SELECT WORK_ORDER FROM WORKORDER WHERE CAMPGN_NO = ? AND STATUS = 'R')) "
+" and loc_code in(select loc_code from location where inv_stat = ? ) "
+" and 'Y' <> case when deallocated is null then 'N' else deallocated end " // added by cpatil on 04/11/14
+" GROUP BY item_code, lot_no, lot_sl, loc_code ";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1,campNo); pstmt.setString(1,campNo);
pstmt.setString(2,invstat1); pstmt.setString(2,invstat1);
...@@ -380,7 +385,10 @@ public class WoTransferPrc extends ProcessEJB implements WoTransferPrcLocal,WoTr ...@@ -380,7 +385,10 @@ public class WoTransferPrc extends ProcessEJB implements WoTransferPrcLocal,WoTr
if(worder != null && worder.trim().length() > 0) if(worder != null && worder.trim().length() > 0)
{ {
sql = " select site_code,remarks,reas_code,potency_adj,line_no,exp_lev " + sql = " select site_code,remarks,reas_code,potency_adj,line_no,exp_lev " +
" from inv_alloc_det where tran_id = ? and item_code = ? and lot_no = ? and lot_sl = ? and loc_code = ? "; " from inv_alloc_det where tran_id = ? and item_code = ? and lot_no = ? and lot_sl = ? " +
" and loc_code = ? " +
" and 'Y' <> case when deallocated is null then 'N' else deallocated end " + // added by cpatil on 04/11/14
" ";
pstmt1 = conn.prepareStatement(sql); pstmt1 = conn.prepareStatement(sql);
pstmt1.setString(1, rs.getString("tran_id")); pstmt1.setString(1, rs.getString("tran_id"));
pstmt1.setString(2, rs.getString("item_code")); pstmt1.setString(2, rs.getString("item_code"));
...@@ -407,7 +415,11 @@ public class WoTransferPrc extends ProcessEJB implements WoTransferPrcLocal,WoTr ...@@ -407,7 +415,11 @@ public class WoTransferPrc extends ProcessEJB implements WoTransferPrcLocal,WoTr
if(campNo != null && campNo.trim().length() > 0) if(campNo != null && campNo.trim().length() > 0)
{ {
sql = " select site_code,remarks,reas_code,potency_adj,line_no,exp_lev " + sql = " select site_code,remarks,reas_code,potency_adj,line_no,exp_lev " +
" from inv_alloc_det where tran_id in ( SELECT TRAN_ID FROM INV_ALLOCATE WHERE WORK_ORDER IN (SELECT WORK_ORDER FROM WORKORDER WHERE CAMPGN_NO = ? )) and item_code = ? and lot_no = ? and lot_sl = ? and loc_code = ? "; " from inv_alloc_det " +
" where tran_id in ( SELECT TRAN_ID FROM INV_ALLOCATE WHERE WORK_ORDER IN (SELECT WORK_ORDER FROM WORKORDER WHERE CAMPGN_NO = ? )) " +
" and item_code = ? and lot_no = ? and lot_sl = ? and loc_code = ? " +
" and 'Y' <> case when deallocated is null then 'N' else deallocated end " + // added by cpatil on 04/11/14
" ";
pstmt1 = conn.prepareStatement(sql); pstmt1 = conn.prepareStatement(sql);
pstmt1.setString(1, campNo); pstmt1.setString(1, campNo);
pstmt1.setString(2, rs.getString("item_code")); pstmt1.setString(2, rs.getString("item_code"));
...@@ -474,14 +486,17 @@ public class WoTransferPrc extends ProcessEJB implements WoTransferPrcLocal,WoTr ...@@ -474,14 +486,17 @@ public class WoTransferPrc extends ProcessEJB implements WoTransferPrcLocal,WoTr
retTabSepStrBuff.append("<actual_qty>").append("<![CDATA[" + df.format(issQty) +"]]>").append("</actual_qty>"); retTabSepStrBuff.append("<actual_qty>").append("<![CDATA[" + df.format(issQty) +"]]>").append("</actual_qty>");
retTabSepStrBuff.append("<actual_propqty>").append("<![CDATA[" + df.format(allocQty) +"]]>").append("</actual_propqty>"); retTabSepStrBuff.append("<actual_propqty>").append("<![CDATA[" + df.format(allocQty) +"]]>").append("</actual_propqty>");
int SIcnt=0;
sql = "select INTEGRAL_QTY from item where item_code = ?"; //sql = "select INTEGRAL_QTY from item where item_code = ?";
sql = " select INTEGRAL_QTY from siteitem where item_code = ? and site_code = ? ";
pstmt1 = conn.prepareStatement(sql); pstmt1 = conn.prepareStatement(sql);
pstmt1.setString(1, rs.getString("item_code")); pstmt1.setString(1, rs.getString("item_code"));
pstmt1.setString(2, siteCode );
rs1 = pstmt1.executeQuery(); rs1 = pstmt1.executeQuery();
if ( rs1.next() ) if ( rs1.next() )
{ {
integralQty = rs1.getDouble(1); integralQty = rs1.getDouble(1);
SIcnt++;
} }
if(rs1 != null) if(rs1 != null)
rs1.close(); rs1.close();
...@@ -489,6 +504,26 @@ public class WoTransferPrc extends ProcessEJB implements WoTransferPrcLocal,WoTr ...@@ -489,6 +504,26 @@ public class WoTransferPrc extends ProcessEJB implements WoTransferPrcLocal,WoTr
if(pstmt1 != null) if(pstmt1 != null)
pstmt1.close(); pstmt1.close();
pstmt1 = null; pstmt1 = null;
if( SIcnt == 0 )
{
sql = "select INTEGRAL_QTY from item where item_code = ?";
pstmt1 = conn.prepareStatement(sql);
pstmt1.setString(1, rs.getString("item_code"));
//pstmt1.setString(2, siteCode );
rs1 = pstmt1.executeQuery();
if ( rs1.next() )
{
integralQty = rs1.getDouble(1);
}
if(rs1 != null)
rs1.close();
rs1 = null;
if(pstmt1 != null)
pstmt1.close();
pstmt1 = null;
}
if(integralQty > 0) if(integralQty > 0)
{ {
if(allocQty > integralQty ){ if(allocQty > integralQty ){
...@@ -860,6 +895,29 @@ public class WoTransferPrc extends ProcessEJB implements WoTransferPrcLocal,WoTr ...@@ -860,6 +895,29 @@ public class WoTransferPrc extends ProcessEJB implements WoTransferPrcLocal,WoTr
} }
} }
}//inner for loop }//inner for loop
int SIcnt=0;
//sql = "select INTEGRAL_QTY from item where item_code = ?";
sql = " select INTEGRAL_QTY from siteitem where item_code = ? and site_code = ? ";
pstmt = connOne.prepareStatement(sql);
pstmt.setString(1, itemCode );
pstmt.setString(2, siteCode );
rs = pstmt.executeQuery();
if ( rs.next() )
{
integralQty = rs.getDouble(1);
SIcnt++;
}
if(rs != null)
rs.close();
rs = null;
if(pstmt != null)
pstmt.close();
pstmt = null;
if( SIcnt == 0 )
{
sql = "select INTEGRAL_QTY from item where item_code = ?"; sql = "select INTEGRAL_QTY from item where item_code = ?";
pstmt = connOne.prepareStatement(sql); pstmt = connOne.prepareStatement(sql);
pstmt.setString(1, itemCode); pstmt.setString(1, itemCode);
...@@ -874,6 +932,8 @@ public class WoTransferPrc extends ProcessEJB implements WoTransferPrcLocal,WoTr ...@@ -874,6 +932,8 @@ public class WoTransferPrc extends ProcessEJB implements WoTransferPrcLocal,WoTr
if(pstmt != null) if(pstmt != null)
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
}
System.out.println(" amount values "+actualQty+"::"+trfedQty+"::"+allocQty2); System.out.println(" amount values "+actualQty+"::"+trfedQty+"::"+allocQty2);
// sql = "SELECT ISSUE_QTY FROM INV_ALLOC_DET WHERE tran_id = ? and item_code = ? and lot_no = ? and lot_sl = ? and loc_code = ? and site_code = ? "; // sql = "SELECT ISSUE_QTY FROM INV_ALLOC_DET WHERE tran_id = ? and item_code = ? and lot_no = ? and lot_sl = ? and loc_code = ? and site_code = ? ";
// pstmt = connOne.prepareStatement(sql); // pstmt = connOne.prepareStatement(sql);
......
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