Commit 6416559e authored by wansari's avatar wansari

W16IBAS005 updated source to check retRep flag if type is changed to P in edit...

W16IBAS005 updated source to check retRep flag if type is changed to P in edit mode then only allow to deallocate.


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@43862 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 42a38358
......@@ -79,6 +79,7 @@ public class SReturnPrs extends ValidatorEJB implements SReturnPrsLocal, SReturn
InvAllocTraceBean invAllocTrace = new InvAllocTraceBean();
NodeList parentNodeList = null;
Node parentNode = null;
String retRepFlag = "";//Added by wasim on 19-MAY-17
try
{
distStkUpd = getComponent("DistStkUpd");
......@@ -106,7 +107,8 @@ public class SReturnPrs extends ValidatorEJB implements SReturnPrsLocal, SReturn
retFlg = genericUtility.getColumnValueFromNode("ret_rep_flag",currDetail);
if (retFlg.equalsIgnoreCase("P"))
//Changed by wasim on 19-MAY-2017 to comment this condition as retFlag will be checked below from database, if P-->Deallocate else if R-->bypass
//if (retFlg.equalsIgnoreCase("P"))
{
lineNo = genericUtility.getColumnValueFromNode("line_no",currDetail);
itemCode = genericUtility.getColumnValueFromNode("item_code",currDetail);
......@@ -115,8 +117,14 @@ public class SReturnPrs extends ValidatorEJB implements SReturnPrsLocal, SReturn
lotSl = genericUtility.getColumnValueFromNode("lot_sl",currDetail);
stmt = conn.createStatement();
//Changed by wasim on 19-May-2017 for checking ret_rep_flag if it is R(Return) present in database then not allow to deallocate [START]
/*
sqlStr = "SELECT QUANTITY,item_code,loc_code,lot_no,lot_sl FROM SRETURNDET WHERE TRAN_ID = '"+tranId+"'" +
" AND LINE_NO = "+lineNo+""; //Omited the single quotes as it is not working in DB2 //Gulzar 09-01-07
*/
sqlStr = "SELECT QUANTITY,ITEM_CODE,LOC_CODE,LOT_NO,LOT_SL,RET_REP_FLAG FROM SRETURNDET WHERE TRAN_ID = '"+tranId+"'" +
" AND LINE_NO = "+lineNo+"";
//Changed by wasim on 19-May-2017 for checking ret_rep_flag if it is R(Return) present in database then not allow to deallocate [END]
System.out.println("sqlStr :: " + sqlStr);
rs = stmt.executeQuery(sqlStr);
if(rs.next())
......@@ -126,66 +134,76 @@ public class SReturnPrs extends ValidatorEJB implements SReturnPrsLocal, SReturn
locCode = rs.getString("loc_code");
lotNo = rs.getString("lot_no");
lotSl = rs.getString("lot_sl");
//Added by wasim on 19-May-2017
retRepFlag = rs.getString("RET_REP_FLAG");
}
rs.close();
rs = null;
stmt.close();
stmt = null;
lineNo =" " + lineNo;
System.out.println("Line No : lineNo := "+lineNo);
quantity = Double.parseDouble(qtyStr);
/*
strAllocate.put("tran_date",tranDate);
strAllocate.put("ref_ser","S-RET");
strAllocate.put("ref_id",tranId);
strAllocate.put("ref_line",lineNo.substring(lineNo.length()-3));
strAllocate.put("site_code",siteCode);
strAllocate.put("item_code",itemCode);
strAllocate.put("loc_code",locCode);
strAllocate.put("lot_no",lotNo);
strAllocate.put("lot_sl",lotSl);
strAllocate.put("alloc_qty",new Double(-1*quantity));
strAllocate.put("chg_user",GenericUtility.getInstance().getValueFromXTRA_PARAMS(xtraParams,"loginCode"));
strAllocate.put("chg_term",GenericUtility.getInstance().getValueFromXTRA_PARAMS(xtraParams,"termId"));
strAllocate.put("chg_win","W_SALESRETURN");
if (distStkUpd.updAllocTrace(strAllocate, conn) > 0)
{
System.out.println("distStkUpd.UpdAllocTrace(HashMap, Connection) : Sucessuful!");
}
else
{
throw new Exception ("Exception while deallocating old allocation");
}
*/
strAllocate = null;
strAllocate = new HashMap();
strAllocate.put("tran_date",tranDate);
strAllocate.put("ref_ser","S-RET");
strAllocate.put("ref_id",tranId);
strAllocate.put("ref_line",lineNo.substring(lineNo.length()-3));
strAllocate.put("site_code",siteCode);
strAllocate.put("item_code",itemCode);
strAllocate.put("loc_code",locCode);
strAllocate.put("lot_no",lotNo);
strAllocate.put("lot_sl",lotSl);
strAllocate.put("alloc_qty",new Double(-1*quantity));
strAllocate.put("chg_user",genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginCode"));
strAllocate.put("chg_term",genericUtility.getValueFromXTRA_PARAMS(xtraParams,"termId"));
strAllocate.put("chg_win",winName);
errString = invAllocTrace.updateInvallocTrace(strAllocate, conn);
if (errString == null || errString.trim().length() == 0 )
//Changed by wasim on 19-May-2017 for checking ret_rep_flag if it is R(Return) present in database then not allow to deallocate [START]
System.out.println("Database Old ReturnFlag ["+retRepFlag+"]");
if("R".equalsIgnoreCase(retRepFlag))
{
System.out.println("invAllocTrace.updateInvallocTrace : Sucessuful!");
System.out.println("Previous return type was R (Return) so stock will not be De-allocated");
}
else
else //Old logic inside else
{
throw new Exception ("Exception while deallocating old allocation");
//Changed by wasim on 19-May-2017 for checking ret_rep_flag if it is R(Return) present in database then not allow to deallocate [END]
lineNo =" " + lineNo;
System.out.println("Line No : lineNo := "+lineNo);
quantity = Double.parseDouble(qtyStr);
/*
strAllocate.put("tran_date",tranDate);
strAllocate.put("ref_ser","S-RET");
strAllocate.put("ref_id",tranId);
strAllocate.put("ref_line",lineNo.substring(lineNo.length()-3));
strAllocate.put("site_code",siteCode);
strAllocate.put("item_code",itemCode);
strAllocate.put("loc_code",locCode);
strAllocate.put("lot_no",lotNo);
strAllocate.put("lot_sl",lotSl);
strAllocate.put("alloc_qty",new Double(-1*quantity));
strAllocate.put("chg_user",GenericUtility.getInstance().getValueFromXTRA_PARAMS(xtraParams,"loginCode"));
strAllocate.put("chg_term",GenericUtility.getInstance().getValueFromXTRA_PARAMS(xtraParams,"termId"));
strAllocate.put("chg_win","W_SALESRETURN");
if (distStkUpd.updAllocTrace(strAllocate, conn) > 0)
{
System.out.println("distStkUpd.UpdAllocTrace(HashMap, Connection) : Sucessuful!");
}
else
{
throw new Exception ("Exception while deallocating old allocation");
}
*/
strAllocate = null;
strAllocate = new HashMap();
strAllocate.put("tran_date",tranDate);
strAllocate.put("ref_ser","S-RET");
strAllocate.put("ref_id",tranId);
strAllocate.put("ref_line",lineNo.substring(lineNo.length()-3));
strAllocate.put("site_code",siteCode);
strAllocate.put("item_code",itemCode);
strAllocate.put("loc_code",locCode);
strAllocate.put("lot_no",lotNo);
strAllocate.put("lot_sl",lotSl);
strAllocate.put("alloc_qty",new Double(-1*quantity));
strAllocate.put("chg_user",genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginCode"));
strAllocate.put("chg_term",genericUtility.getValueFromXTRA_PARAMS(xtraParams,"termId"));
strAllocate.put("chg_win",winName);
errString = invAllocTrace.updateInvallocTrace(strAllocate, conn);
if (errString == null || errString.trim().length() == 0 )
{
System.out.println("invAllocTrace.updateInvallocTrace : Sucessuful!");
}
else
{
throw new Exception ("Exception while deallocating old allocation");
}
}
}
}
}
......
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