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
......@@ -47,7 +47,7 @@ public class StockUpdate
double holdQty=0;
String quarLockCode="",genratedTranId="";
String holdLock="";//addad by priyanka
DistCommon distCommon = new DistCommon();// added by priyanka
DistCommon distCommon = new DistCommon();// added by priyanka
/**
* Updates stock return error if fails
......@@ -77,7 +77,7 @@ public class StockUpdate
String acctCodeDr = "",cctrCodeDr = "", sqlState ="", errorCode = "";
Timestamp mtoday = null;
Timestamp tempTestDate = null;
double qtyPerArtStk = 0d,qtyStk=0d;
try
{
DistCommon distCommon = new DistCommon();
......@@ -85,35 +85,6 @@ public class StockUpdate
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");
userId = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginCode");
termId = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "termId");
......@@ -572,10 +543,7 @@ public class StockUpdate
}
}*/
}
}
if((!this.tranType.equalsIgnoreCase("R")) && (!this.tranType.equalsIgnoreCase("D")))
{
if(mbefQty < this.qtyStduom)
......@@ -736,29 +704,11 @@ public class StockUpdate
mamount = this.quantity * this.rate;
count=0;
// *********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()+"'"
+" and site_code ='"+this.siteCode.trim()+"'"
+" and loc_code = '"+this.locationCode.trim()+"'"
+" and lot_no = '"+this.lotNo+"'"
+" and lot_sl = '"+this.lotSl+"'";
//Changed by Pragyan for remove trim [END]
+" and lot_no = '"+this.lotNo.trim()+"'"
+" and lot_sl = '"+this.lotSl.trim()+"'";
System.out.println("Query :::- ["+sql+"]");
pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery();
......@@ -1148,52 +1098,34 @@ public class StockUpdate
pstmt.close();
rs.close();
//Added by Manoj dtd 19/08/2014 to update no_art as 1 if no_art<0
double stkQty=0,noArticle=0;
sql="select quantity,no_art from stock " +
//Added by Manoj dtd 25/06/2014 to update no_art as 1 if no_art<=0
double countnoArt=0;
sql="select count(1) from stock " +
" 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+"' ";
+"and lot_sl = '"+this.lotSl+"' and no_art<=0 and quantity > 0 ";
System.out.println("sql---"+sql);
pstmt=conn.prepareStatement(sql);
rs=pstmt.executeQuery();
if(rs.next())
{
//countnoArt=rs.getDouble(1);
stkQty=rs.getDouble(1);
noArticle=rs.getDouble(2);
countnoArt=rs.getDouble(1);
}
rs.close();
rs=null;
pstmt.close();
pstmt=null;
System.out.println("stkQty::["+stkQty+"]");
System.out.println("noArticle::["+noArticle+"]");
if(stkQty>0 && noArticle<0)
System.out.println("countnoArt["+countnoArt+"]");
if(countnoArt>0)
{
sql="update stock set no_art=1 " +
" 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);
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+"' ";
+"and lot_sl = '"+this.lotSl+"' and no_art=0";
System.out.println("sql---"+sql);
pstmt=conn.prepareStatement(sql);
pstmt.executeUpdate();
......@@ -1266,69 +1198,6 @@ public class StockUpdate
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"))
{
sql ="update stock set quantity = quantity + ? ,"
......@@ -1374,8 +1243,7 @@ public class StockUpdate
pstmt.executeUpdate();
pstmt.close();
//rs.close();
rs.close();
}
else
{
......@@ -1395,8 +1263,8 @@ public class StockUpdate
+"dimension = ?,"
+"last_phyc_date = ?,"
+"supp_code__mfg = ?,"
+"batch_no = ?, "
+"hold_qty=hold_qty + ?"
+"batch_no = ? ,"
+"hold_qty=hold_qty + ?"
+"where item_code = '"+this.itemCode+"'"
+"and site_code = '"+this.siteCode+"'"
+"and loc_code = '"+this.locationCode+"'"
......@@ -1421,10 +1289,10 @@ public class StockUpdate
pstmt.setTimestamp(15,this.lastPhycDate);
pstmt.setString(16,this.suppCodeMfg);
pstmt.setString(17,this.batchNo);
pstmt.setDouble(18,this.holdQty);//added by priyanka
pstmt.setDouble(18,this.holdQty);//added by priyanka
pstmt.executeUpdate();
pstmt.close();
//rs.close();
rs.close();
}
}//end of count
else
......@@ -2002,20 +1870,7 @@ public class StockUpdate
if(updateStockMap.get("no_art")!=null)
{
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)
{
this.lastPhycDate = (Timestamp)updateStockMap.get("last_phyc_date");
......@@ -2064,7 +1919,6 @@ public class StockUpdate
{
this.shelfLifeType = "E";
}
}catch(Exception e){
......@@ -3600,13 +3454,4 @@ public class StockUpdate
// added by cpatil end
private String checkNull(String str) {
if (str == null) {
return "";
} else {
return str;
}
}
}//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