Commit dacac720 authored by msharma's avatar msharma

Update no_art=0 if stock qty=0 and no_art<>0


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@96699 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 0cd9d1b8
...@@ -41,6 +41,14 @@ public class StockUpdate ...@@ -41,6 +41,14 @@ public class StockUpdate
String considerAllocate = "Y", partialUsed = ""; String considerAllocate = "Y", partialUsed = "";
// //
String lotSlOrg=""; String lotSlOrg="";
int cnt=0;
int cnt1=0;
int cntHold=0;
double holdQty=0;
String quarLockCode="",genratedTranId="";
String holdLock="";//addad by priyanka
DistCommon distCommon = new DistCommon();// added by priyanka
/** /**
* Updates stock return error if fails * Updates stock return error if fails
* *
...@@ -454,7 +462,120 @@ public class StockUpdate ...@@ -454,7 +462,120 @@ public class StockUpdate
mafterQty = mbefQty - this.qtyStduom; mafterQty = mbefQty - this.qtyStduom;
effQty = this.qtyStduom * -1; effQty = this.qtyStduom * -1;
} }
//**************** //****************added by priyanka
if((this.tranType.equalsIgnoreCase("R")))
{
System.out.println(">>>>>>>>>>>>>tranType.equalsIgnoreCase R");
sql="select count(1) 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())
{
cntHold = rs.getInt(1);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
System.out.println(">>>>>>>>>>>cntHold===="+cntHold);
}
if(updateStockMap.get("hold_lock")!= null)
{
holdLock=(String) updateStockMap.get("hold_lock");
}
System.out.println("holdLock========="+holdLock);
if(holdLock==null||holdLock.trim().length()==0)
{
holdLock="N";
}
if(holdLock.equals("N") && cntHold==0)
//if(holdLock.equals("N") && !(this.tranType.equalsIgnoreCase("R")) )
{
sql="select count(1)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())
{
cnt1 = rs.getInt(1);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if(cnt1>0)
{
errString = "VTSTKHOLD";
errString = itmDBAccessEJB.getErrorString("",errString,"","",conn);
return errString;
}
/*if(cnt1>0)
{
cnt1=0;
sql="select count(1)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 (case when b.line_no_sl is null then 0 else b.line_no_sl end ) > 0 " +
"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())
{
cnt1 = rs.getInt(1);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if(cnt1==0)
{
errString = "VTSTKHOLD";
errString = itmDBAccessEJB.getErrorString("",errString,"","",conn);
return errString;
}
}*/
}
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)
...@@ -1046,6 +1167,21 @@ public class StockUpdate ...@@ -1046,6 +1167,21 @@ public class StockUpdate
pstmt.close(); pstmt.close();
pstmt=null; 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);
pstmt=conn.prepareStatement(sql);
pstmt.executeUpdate();
pstmt.close();
pstmt=null;
}
} }
} }
...@@ -1112,6 +1248,69 @@ public class StockUpdate ...@@ -1112,6 +1248,69 @@ 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 + ? ,"
...@@ -1157,7 +1356,8 @@ public class StockUpdate ...@@ -1157,7 +1356,8 @@ public class StockUpdate
pstmt.executeUpdate(); pstmt.executeUpdate();
pstmt.close(); pstmt.close();
rs.close(); //rs.close();
} }
else else
{ {
...@@ -1177,7 +1377,8 @@ public class StockUpdate ...@@ -1177,7 +1377,8 @@ 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 + ?"
+"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+"'"
...@@ -1202,10 +1403,10 @@ public class StockUpdate ...@@ -1202,10 +1403,10 @@ public class StockUpdate
pstmt.setTimestamp(15,this.lastPhycDate); pstmt.setTimestamp(15,this.lastPhycDate);
pstmt.setString(16,this.suppCodeMfg); pstmt.setString(16,this.suppCodeMfg);
pstmt.setString(17,this.batchNo); pstmt.setString(17,this.batchNo);
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
...@@ -3381,4 +3582,13 @@ public class StockUpdate ...@@ -3381,4 +3582,13 @@ 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