Commit 4bb90fa1 authored by msharma's avatar msharma

Stock on Hold validation taken care


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@96932 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 5d6e1a10
...@@ -77,7 +77,7 @@ public class StockUpdate ...@@ -77,7 +77,7 @@ public class StockUpdate
String acctCodeDr = "",cctrCodeDr = "", sqlState ="", errorCode = ""; String acctCodeDr = "",cctrCodeDr = "", sqlState ="", errorCode = "";
Timestamp mtoday = null; Timestamp mtoday = null;
Timestamp tempTestDate = null; Timestamp tempTestDate = null;
double qtyPerArtStk = 0d,qtyStk=0d;
try try
{ {
DistCommon distCommon = new DistCommon(); DistCommon distCommon = new DistCommon();
...@@ -85,35 +85,6 @@ public class StockUpdate ...@@ -85,35 +85,6 @@ public class StockUpdate
puplateCommonParameters(updateStockMap); puplateCommonParameters(updateStockMap);
//ADDED BY RITESH ON 31/07/14 START
sql = "select quantity , qty_per_art "
+ "from stock "
+ "where item_code = ? "
+ "and site_code = ? "
+ "and loc_code = ? "
+ "and lot_no = ? "
+ "and lot_sl = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,itemCode);
pstmt.setString(2,siteCode);
pstmt.setString(3,locationCode);
pstmt.setString(4,lotNo);
pstmt.setString(5,lotSl);
rs = pstmt.executeQuery();
if ( rs.next() )
{
qtyStk= rs.getDouble("quantity");
qtyPerArtStk= rs.getDouble("qty_per_art");
if((int) (qtyStk/qtyPerArtStk) == 0)
{
this.noArt = 1;
}
}
System.out.println(" no_art accepted 16092014:: "+this.noArt);
//ADDEDBY RITESH ON 31/07/14 END
tempTestDate = Timestamp.valueOf("1900-01-01 00:00:00"); tempTestDate = Timestamp.valueOf("1900-01-01 00:00:00");
userId = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginCode"); userId = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginCode");
termId = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "termId"); termId = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "termId");
...@@ -573,9 +544,6 @@ public class StockUpdate ...@@ -573,9 +544,6 @@ public class StockUpdate
}*/ }*/
} }
if((!this.tranType.equalsIgnoreCase("R")) && (!this.tranType.equalsIgnoreCase("D"))) if((!this.tranType.equalsIgnoreCase("R")) && (!this.tranType.equalsIgnoreCase("D")))
{ {
if(mbefQty < this.qtyStduom) if(mbefQty < this.qtyStduom)
...@@ -736,29 +704,11 @@ public class StockUpdate ...@@ -736,29 +704,11 @@ public class StockUpdate
mamount = this.quantity * this.rate; mamount = this.quantity * this.rate;
count=0; count=0;
// *********xxxxxxxxxxxxxxxx******************** // *********xxxxxxxxxxxxxxxx********************
//Changed by Pragyan for remove trim [START]
/*sql = "select count(*) from stock where item_code ='"+this.itemCode.trim()+"'"
+" and site_code ='"+this.siteCode.trim()+"'"
+" and loc_code = '"+this.locationCode.trim()+"'"
+" and lot_no = '"+this.lotNo.trim()+"'"
+" and lot_sl = '"+this.lotSl.trim()+"'";*/
if(this.lotNo == null || this.lotNo.trim().length() == 0)
{
this.lotNo =" ";
}
if(this.lotSl == null || this.lotSl.trim().length()==0)
{
this.lotSl = " ";
}
sql = "select count(*) from stock where item_code ='"+this.itemCode.trim()+"'" sql = "select count(*) from stock where item_code ='"+this.itemCode.trim()+"'"
+" and site_code ='"+this.siteCode.trim()+"'" +" and site_code ='"+this.siteCode.trim()+"'"
+" and loc_code = '"+this.locationCode.trim()+"'" +" and loc_code = '"+this.locationCode.trim()+"'"
+" and lot_no = '"+this.lotNo+"'" +" and lot_no = '"+this.lotNo.trim()+"'"
+" and lot_sl = '"+this.lotSl+"'"; +" and lot_sl = '"+this.lotSl.trim()+"'";
//Changed by Pragyan for remove trim [END]
System.out.println("Query :::- ["+sql+"]"); System.out.println("Query :::- ["+sql+"]");
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
...@@ -1148,52 +1098,34 @@ public class StockUpdate ...@@ -1148,52 +1098,34 @@ public class StockUpdate
pstmt.close(); pstmt.close();
rs.close(); rs.close();
//Added by Manoj dtd 19/08/2014 to update no_art as 1 if no_art<0 //Added by Manoj dtd 25/06/2014 to update no_art as 1 if no_art<=0
double stkQty=0,noArticle=0; double countnoArt=0;
sql="select quantity,no_art from stock " + sql="select count(1) from stock " +
" where item_code = '"+this.itemCode+"'" " where item_code = '"+this.itemCode+"'"
+"and site_code = '"+this.siteCode +"'" +"and site_code = '"+this.siteCode +"'"
+"and loc_code = '"+this.locationCode +"'" +"and loc_code = '"+this.locationCode +"'"
+"and lot_no = '"+this.lotNo+"'" +"and lot_no = '"+this.lotNo+"'"
+"and lot_sl = '"+this.lotSl+"' "; +"and lot_sl = '"+this.lotSl+"' and no_art<=0 and quantity > 0 ";
System.out.println("sql---"+sql); System.out.println("sql---"+sql);
pstmt=conn.prepareStatement(sql); pstmt=conn.prepareStatement(sql);
rs=pstmt.executeQuery(); rs=pstmt.executeQuery();
if(rs.next()) if(rs.next())
{ {
//countnoArt=rs.getDouble(1); countnoArt=rs.getDouble(1);
stkQty=rs.getDouble(1);
noArticle=rs.getDouble(2);
} }
rs.close(); rs.close();
rs=null; rs=null;
pstmt.close(); pstmt.close();
pstmt=null; pstmt=null;
System.out.println("stkQty::["+stkQty+"]"); System.out.println("countnoArt["+countnoArt+"]");
System.out.println("noArticle::["+noArticle+"]"); if(countnoArt>0)
if(stkQty>0 && noArticle<0)
{ {
sql="update stock set no_art=1 " + sql="update stock set no_art=1 " +
" where item_code = '"+this.itemCode+"'" " where item_code = '"+this.itemCode+"'"
+"and site_code = '"+this.siteCode +"'" +"and site_code = '"+this.siteCode +"'"
+"and loc_code = '"+this.locationCode +"'" +"and loc_code = '"+this.locationCode +"'"
+"and lot_no = '"+this.lotNo+"'" +"and lot_no = '"+this.lotNo+"'"
+"and lot_sl = '"+this.lotSl+"' "; +"and lot_sl = '"+this.lotSl+"' and no_art=0";
System.out.println("sql---"+sql);
pstmt=conn.prepareStatement(sql);
pstmt.executeUpdate();
pstmt.close();
pstmt=null;
}
//Added by Manoj dtd 29/10/2014 to set no_art=0 if stock =0
if(stkQty==0 && noArticle!=0)
{
sql="update stock set no_art=0 " +
" where item_code = '"+this.itemCode+"'"
+"and site_code = '"+this.siteCode +"'"
+"and loc_code = '"+this.locationCode +"'"
+"and lot_no = '"+this.lotNo+"'"
+"and lot_sl = '"+this.lotSl+"' ";
System.out.println("sql---"+sql); System.out.println("sql---"+sql);
pstmt=conn.prepareStatement(sql); pstmt=conn.prepareStatement(sql);
pstmt.executeUpdate(); pstmt.executeUpdate();
...@@ -1266,69 +1198,6 @@ public class StockUpdate ...@@ -1266,69 +1198,6 @@ public class StockUpdate
this.retestDate = null; this.retestDate = null;
} }
//added by priyanka
if(cntHold>0)
{
/*sql=" select a.tran_id From inv_hold a, inv_hold_det b Where a.tran_id = b.tran_id " +
" And b.item_code =? " +
" And (b.site_code = ?) " +
" And (b.loc_code = ?) " +
" And (b.lot_no = ? ) " +
" And (b.lot_sl = ? ) " +
" And (b.line_no_sl = 0 or b.line_no_sl is null) " +
"And a.confirmed='Y' And b.hold_status ='H' ";*/
sql="select a.tran_id From inv_hold a, inv_hold_det b Where a.tran_id = b.tran_id And b.item_code = ? And (b.site_code = ? or b.site_code is null )" +
" And (b.loc_code = ? or b.loc_code is null ) " +
" And (b.lot_no =? or b.lot_no is null ) " +
" And (b.lot_sl = ? or b.lot_sl is null ) " +
"And (b.line_no_sl = 0 or b.line_no_sl is null) " +
" And a.confirmed='Y' And b.hold_status ='H'";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,this.itemCode);
pstmt.setString(2,this.siteCode);
pstmt.setString(3,this.locationCode);
pstmt.setString(4,this.lotNo);
pstmt.setString(5,this.lotSl);
rs = pstmt.executeQuery();
if(rs.next())
{
tranId = rs.getString("tran_id");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
System.out.println("tranId======"+tranId);
holdQty=this.qtyStduom;
sql=" update inv_hold_rel_trace set hold_qty = hold_qty + ? " +
" where ref_no = ?" +
" And item_code= ? " +
" And site_code= ? " +
" And loc_code = ? " +
" And lot_no = ? " +
" And lot_sl = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setDouble(1,this.holdQty);
pstmt.setString(2,this.tranId);
pstmt.setString(3,this.itemCode);
pstmt.setString(4,this.siteCode);
pstmt.setString(5,this.locationCode);
pstmt.setString(6,this.lotNo);
pstmt.setString(7,lotSl);
pstmt.executeUpdate();
pstmt.close();
}
//ended by priyanka
if (this.tranSer.equalsIgnoreCase("QC-ORD")) if (this.tranSer.equalsIgnoreCase("QC-ORD"))
{ {
sql ="update stock set quantity = quantity + ? ," sql ="update stock set quantity = quantity + ? ,"
...@@ -1374,8 +1243,7 @@ public class StockUpdate ...@@ -1374,8 +1243,7 @@ public class StockUpdate
pstmt.executeUpdate(); pstmt.executeUpdate();
pstmt.close(); pstmt.close();
//rs.close(); rs.close();
} }
else else
{ {
...@@ -1395,7 +1263,7 @@ public class StockUpdate ...@@ -1395,7 +1263,7 @@ public class StockUpdate
+"dimension = ?," +"dimension = ?,"
+"last_phyc_date = ?," +"last_phyc_date = ?,"
+"supp_code__mfg = ?," +"supp_code__mfg = ?,"
+"batch_no = ?, " +"batch_no = ? ,"
+"hold_qty=hold_qty + ?" +"hold_qty=hold_qty + ?"
+"where item_code = '"+this.itemCode+"'" +"where item_code = '"+this.itemCode+"'"
+"and site_code = '"+this.siteCode+"'" +"and site_code = '"+this.siteCode+"'"
...@@ -1424,7 +1292,7 @@ public class StockUpdate ...@@ -1424,7 +1292,7 @@ public class StockUpdate
pstmt.setDouble(18,this.holdQty);//added by priyanka pstmt.setDouble(18,this.holdQty);//added by priyanka
pstmt.executeUpdate(); pstmt.executeUpdate();
pstmt.close(); pstmt.close();
//rs.close(); rs.close();
} }
}//end of count }//end of count
else else
...@@ -2002,20 +1870,7 @@ public class StockUpdate ...@@ -2002,20 +1870,7 @@ public class StockUpdate
if(updateStockMap.get("no_art")!=null) if(updateStockMap.get("no_art")!=null)
{ {
this.noArt = Double.parseDouble(updateStockMap.get("no_art").toString()); this.noArt = Double.parseDouble(updateStockMap.get("no_art").toString());
// double partialArt= noArt; // ADDED BY RITESH ON 15/07/14 START }
// if(partialArt == 0)
// {
// partialArt = 1;
// }else
// {
// partialArt = 0;
// }
//// if( "XFRX".equalsIgnoreCase(itemSer))
//// {
// noArt = noArt + partialArt;
// // }
// System.out.println("partialArt ::["+partialArt+"] noArt::["+noArt+"]"+"itemSer::["+itemSer+"]");
} // ADDED BY RITESH ON 15/07/14 END
if(updateStockMap.get("last_phyc_date")!=null) if(updateStockMap.get("last_phyc_date")!=null)
{ {
this.lastPhycDate = (Timestamp)updateStockMap.get("last_phyc_date"); this.lastPhycDate = (Timestamp)updateStockMap.get("last_phyc_date");
...@@ -2066,7 +1921,6 @@ public class StockUpdate ...@@ -2066,7 +1921,6 @@ public class StockUpdate
} }
}catch(Exception e){ }catch(Exception e){
System.out.println("Exception "+e); System.out.println("Exception "+e);
e.printStackTrace(); e.printStackTrace();
...@@ -3600,13 +3454,4 @@ public class StockUpdate ...@@ -3600,13 +3454,4 @@ public class StockUpdate
// added by cpatil end // added by cpatil end
private String checkNull(String str) {
if (str == null) {
return "";
} else {
return str;
}
}
}//END OF CLASS }//END OF CLASS
\ No newline at end of file
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