Commit e58124ef authored by cpatil's avatar cpatil

modify stock sql


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@93440 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 3b98ad1f
...@@ -586,9 +586,9 @@ public class WOIssueReplacementPrc extends ProcessEJB implements GenerateReceipt ...@@ -586,9 +586,9 @@ public class WOIssueReplacementPrc extends ProcessEJB implements GenerateReceipt
} }
//// for stock check //// for stock check
sql =" select sum(quantity-alloc_qty) as stockBalQty from stock where item_code = ? " sql =" select sum(quantity-alloc_qty) as stockBalQty from stock a where a.item_code = ? "
+" and site_code = ? " +" and a.site_code = ? "
+" and ( exp_date > ? or retest_date < ? ) "; +" and ( a.exp_date > ? or a.retest_date < ? ) ";
if(issForBatch) if(issForBatch)
{ {
sql = sql + " and a.supp_code__mfg ='"+stockSupplier+"'" ; sql = sql + " and a.supp_code__mfg ='"+stockSupplier+"'" ;
...@@ -602,23 +602,23 @@ public class WOIssueReplacementPrc extends ProcessEJB implements GenerateReceipt ...@@ -602,23 +602,23 @@ public class WOIssueReplacementPrc extends ProcessEJB implements GenerateReceipt
} }
if( "Y".equalsIgnoreCase(ConsiderLotNoIssue) && (lotNoIssue != null && lotNoIssue.trim().length() > 0) ) if( "Y".equalsIgnoreCase(ConsiderLotNoIssue) && (lotNoIssue != null && lotNoIssue.trim().length() > 0) )
{ {
sql = sql + " and lot_no in ("+ lotNoIssue +")"; sql = sql + " and a.lot_no in ("+ lotNoIssue +")";
} }
if( "A".equalsIgnoreCase(locUsageType) && "N".equalsIgnoreCase(ConsiderLotNoIssue) ) if( "A".equalsIgnoreCase(locUsageType) && "N".equalsIgnoreCase(ConsiderLotNoIssue) )
{ {
sql = sql + " and loc_code in ( select loc_code from location where loc_group ='"+locGroup+"' )" ; sql = sql + " and a.loc_code in ( select loc_code from location where loc_group ='"+locGroup+"' )" ;
} }
//on 31/07/13 //on 31/07/13
sql = sql +" and ( select count(1) from qc_order where item_code = ? and site_code=? and lot_no = ? and status='U')=0 " ; 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 " ;
pstmt1 = conn.prepareStatement(sql); pstmt1 = conn.prepareStatement(sql);
pstmt1.setString(1,itemCode); pstmt1.setString(1,itemCode);
pstmt1.setString(2,siteCode); pstmt1.setString(2,siteCode);
pstmt1.setTimestamp(3,newsysDate ); pstmt1.setTimestamp(3,newsysDate );
pstmt1.setTimestamp(4,newsysDate ); pstmt1.setTimestamp(4,newsysDate );
pstmt1.setString(5,itemCode); //pstmt1.setString(5,itemCode);
pstmt1.setString(6,siteCode); //pstmt1.setString(6,siteCode);
pstmt1.setString(7,lotNo); //pstmt1.setString(7,lotNo);
rs1 = pstmt1.executeQuery(); rs1 = pstmt1.executeQuery();
if(rs1.next()) if(rs1.next())
...@@ -795,15 +795,15 @@ public class WOIssueReplacementPrc extends ProcessEJB implements GenerateReceipt ...@@ -795,15 +795,15 @@ public class WOIssueReplacementPrc extends ProcessEJB implements GenerateReceipt
stockSql = stockSql +" and a.exp_date > ? " ; stockSql = stockSql +" and a.exp_date > ? " ;
stockSql = stockSql +" and a.retest_date > ? " ; stockSql = stockSql +" and a.retest_date > ? " ;
//on 31/07/13 //on 31/07/13
stockSql = stockSql +" and ( select count(1) from qc_order where item_code = ? and site_code=? and lot_no = ? and status='U')=0 " ; 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 " ;
System.out.println("\n\n\n Query Executed " + stockSql+ "\n\n******************"); System.out.println("\n\n\n Query Executed " + stockSql+ "\n\n******************");
pstmt = conn.prepareStatement(stockSql); pstmt = conn.prepareStatement(stockSql);
pstmt.setTimestamp(1,currDate1); pstmt.setTimestamp(1,currDate1);
pstmt.setTimestamp(2,currDate1); pstmt.setTimestamp(2,currDate1);
pstmt.setString(3,itemCode); //pstmt.setString(3,itemCode);
pstmt.setString(4,siteCode); //pstmt.setString(4,siteCode);
pstmt.setString(5,lotNo); //pstmt.setString(5,lotNo);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if(rs.next()) if(rs.next())
......
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