Commit 045ade5b authored by prahate's avatar prahate

EJB updated for Dist.Receipt Req_Id [D14JSUN004].


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@97989 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 9062a860
......@@ -30,9 +30,9 @@ public class DistRcpExShClose extends ActionHandlerEJB implements DistRcpExShClo
String sql = "", sql1 = "";
ConnDriver connDriver = null;
String loginEmpCode = "";
String status = "", empCode = "",siteCode="";
String status = "",confirmed="", empCode = "",siteCode="";
int updateCount=0;
double shortageAmtHdr=0.0;
double shortageAmtHdr=0.0,qtyRcp=0.0,qtyActual=0.0;
ITMDBAccessEJB itmDBAccess = null;
ibase.utility.E12GenericUtility genericUtility = null;
genericUtility = new ibase.utility.E12GenericUtility();
......@@ -54,22 +54,30 @@ public class DistRcpExShClose extends ActionHandlerEJB implements DistRcpExShClo
connDriver = null;
conn.setAutoCommit(false);
sql = "select status,site_code,shortage_amt from distrcp_exsh_hdr where tran_id = ?";
sql = "select status,confirmed,site_code,shortage_amt from distrcp_exsh_hdr where tran_id = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranId);
rs = pstmt.executeQuery();
if (rs.next())
{
confirmed=rs.getString("confirmed");
status = rs.getString("status");
siteCode = rs.getString("site_code");
shortageAmtHdr=rs.getDouble("shortage_amt");
}
System.out.println("Confirm>>>>>>>"+confirmed);
System.out.println("Status@@@@@@@@" + status);
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if(confirmed!=null && confirmed.equalsIgnoreCase("N"))
{
System.out.println("Transaction is not submitted.Please submit it before close");
errString = itmDBAccessEJB.getErrorString("", "VTNSUBCLO", "","", conn);
return errString;
}
if (status != null && status.equalsIgnoreCase("C"))
{
System.out.println("The Selected transaction is already Closed");
......@@ -78,15 +86,17 @@ public class DistRcpExShClose extends ActionHandlerEJB implements DistRcpExShClo
}
else /* (status != null && status.equalsIgnoreCase("O") */
{
sql = "select status from distrcp_exsh_det where tran_id = ? ";
sql = "select status,qty_rcp,qty_actual from distrcp_exsh_det where tran_id = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranId);
rs = pstmt.executeQuery();
while (rs.next())
{
status = rs.getString("status");
qtyRcp=Double.valueOf(rs.getString("qty_rcp"));
qtyActual=Double.valueOf(rs.getString("qty_actual"));
System.out.println("Status : " + status);
if ("O".equalsIgnoreCase(status))
if ("O".equalsIgnoreCase(status) && (qtyRcp > qtyActual) ) //Manoj dtd 21/05/2015
{
errString = itmDBAccessEJB.getErrorString("","VTMCLOSE2", "", "", conn);
return errString;
......@@ -107,7 +117,7 @@ public class DistRcpExShClose extends ActionHandlerEJB implements DistRcpExShClo
pstmt.close();
pstmt = null;
/*if (updateCoount > 0)//code comment by sagar on 19/05/15
/*if (updateCount > 0)//code comment by sagar on 19/05/15
{
errString = itmDBAccessEJB.getErrorString("", "VTEXCL001","", "", conn);//comment added by sagar on 19/05/15
}*/
......
......@@ -396,7 +396,7 @@ public class DistRcpExShIC extends ValidatorEJB implements DistRcpExShICLocal, D
}
}
//Added by Pankaj R. on 13/MAY/2015 [START]
else if(childNodeName.equalsIgnoreCase("remarks2"))
{
remarks2=genericUtility.getColumnValue("remarks2", dom);
......@@ -404,19 +404,18 @@ public class DistRcpExShIC extends ValidatorEJB implements DistRcpExShICLocal, D
qtyRcp=Double.valueOf(genericUtility.getColumnValue("qty_rcp", dom)==null?"0":genericUtility.getColumnValue("qty_rcp", dom));
qtyActual = Double.valueOf(genericUtility.getColumnValue("qty_actual", dom)==null?"0":genericUtility.getColumnValue("qty_actual", dom));
System.out.println("Status@@@@@@@@@@@@@ :"+status);
if(((qtyRcp-qtyActual) > 0 || (qtyRcp-qtyActual) < 0) && (!(status.equalsIgnoreCase("O"))) && ((remarks2==null || remarks2.trim().length()<=0)))
if(( (qtyRcp-qtyActual) < 0) && (!(status.equalsIgnoreCase("O"))) && ((remarks2==null || remarks2.trim().length()<=0)))
{
System.out.println("Inside if of REMARKS2@@@@@@@");
errCode = "VMREMARK";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
System.out.println("Completed of REMARKS2@@@@@@@");
}
else
{
System.out.println("Status is : "+status);
}
}
}//Added by Pankaj R. on 13/MAY/2015 [END]
}
......@@ -538,7 +537,7 @@ public class DistRcpExShIC extends ValidatorEJB implements DistRcpExShICLocal, D
String chgTerm = "";
String sql = "";
String siteDescr = "",remarks2="";
String locCode = "",lrDateStr="",tranDatedStr="",gpDateStr="";
String locCode = "",lrDateStr="",tranDatedStr="",gpDateStr="",status="";
String locDescr = "";
String siteCodeMfg="",suppCodeMfg="";
String tranIdRcp="",distOrder="",tranId="",tranCode="",lrNo="",transMode="",grossWeight="";
......@@ -745,7 +744,7 @@ public class DistRcpExShIC extends ValidatorEJB implements DistRcpExShICLocal, D
System.out.println("@@@@@ siteCode["+siteCode+"]siteDescr["+siteDescr+"]");
valueXmlString.append("<descr>").append("<![CDATA[" + siteDescr + "]]>").append("</descr>");
}
//Added by Pankaj R. on 13/MAY/2015 [START]
else if(currentColumn.trim().equalsIgnoreCase("tran_code"))
{
System.out.println("@@@@@@ tran_code itemchange called");
......@@ -756,7 +755,7 @@ public class DistRcpExShIC extends ValidatorEJB implements DistRcpExShICLocal, D
System.out.println("Completed");
}
//Added by Pankaj R. on 13/MAY/2015 [END]
......@@ -790,7 +789,7 @@ public class DistRcpExShIC extends ValidatorEJB implements DistRcpExShICLocal, D
if(currentColumn.trim().equalsIgnoreCase("itm_default"))
{
String status = genericUtility.getColumnValue("status", dom);
status = genericUtility.getColumnValue("status", dom);
valueXmlString.append("<remarks2 protect = \"1\">").append("<![CDATA[" + remarks2 + "]]>").append("</remarks2>");
tranIdRcp = genericUtility.getColumnValue("tran_id__rcp", dom1, "1");
//valueXmlString.append("<tran_id__rcp>").append("<![CDATA[" + tranIdRcp + "]]>").append("</tran_id__rcp>");
......@@ -799,7 +798,12 @@ public class DistRcpExShIC extends ValidatorEJB implements DistRcpExShICLocal, D
}//end of if
else if(currentColumn.trim().equalsIgnoreCase("itm_defaultedit"))
{
status = genericUtility.getColumnValue("status", dom);
if(status.equalsIgnoreCase("O"))
{
valueXmlString.append("<remarks2 protect = \"1\">").append("<![CDATA[" + remarks2 + "]]>").append("</remarks2>");
}
}
else if(currentColumn.trim().equalsIgnoreCase("line_no__rcp"))
{
......@@ -834,7 +838,7 @@ public class DistRcpExShIC extends ValidatorEJB implements DistRcpExShICLocal, D
suppCodeMfg= rs.getString("supp_code__mfg");
itemCode=rs.getString("item_code");
locCode=rs.getString("loc_code");
rate=rs.getString("rate");
rate=rs.getString("rate"); //Added by Pankaj R on 13/MAY/2015
itemDescr = findValue(conn, "descr" ,"item", "item_code", itemCode);
locDescr=findValue(conn, "descr", "location", "loc_code", locCode);
......@@ -877,13 +881,13 @@ public class DistRcpExShIC extends ValidatorEJB implements DistRcpExShICLocal, D
valueXmlString.append("<net_weight>").append("<![CDATA[" + netWeight + "]]>").append("</net_weight>");
valueXmlString.append("<trans_mode>").append("<![CDATA[" + transMode + "]]>").append("</trans_mode>");
valueXmlString.append("<supp_code__mfg>").append("<![CDATA[" + suppCodeMfg + "]]>").append("</supp_code__mfg>");
valueXmlString.append("<rate>").append("<![CDATA[" + rate + "]]>").append("</rate>");
valueXmlString.append("<rate>").append("<![CDATA[" + rate + "]]>").append("</rate>"); //Added by Pankaj R on 13/MAY/2015
}
}
}//Added by Pankaj R. on 13/MAY/2015 [START]
else if(currentColumn.trim().equalsIgnoreCase("status"))
{
System.out.println("@@@@@@ status itemchange called");
String status = genericUtility.getColumnValue("status", dom);
status = genericUtility.getColumnValue("status", dom);
System.out.println("Status is : "+status);
remarks2="";
if(status != null && status.equalsIgnoreCase("O"))
......@@ -898,6 +902,7 @@ public class DistRcpExShIC extends ValidatorEJB implements DistRcpExShICLocal, D
valueXmlString.append("<remarks2 protect = \"0\">").append("<![CDATA[" + remarks2 + "]]>").append("</remarks2>");
}
}
//Added by Pankaj R. on 13/MAY/2015 [END]
valueXmlString.append("</Detail2>");
break;
......
......@@ -54,7 +54,7 @@ public class DistRcpExShPostSave extends ValidatorEJB implements DistRcpExShPost
}
return errString;
}
public String postSave(Document dom,String tranId,String xtraParams,Connection conn)
public String postSave(Document dom,String tranId,String xtraParams,Connection conn) throws ITMException
{
System.out.println("in DistRcpExShPostSave postSave tran_id---->>["+tranId+"]");
ResultSet rs=null;
......@@ -116,11 +116,15 @@ public class DistRcpExShPostSave extends ValidatorEJB implements DistRcpExShPost
}
System.out.println("rate-->["+rate+"] lineNo-->["+lineNo+"]");
shortageAmt=((quantityRcp)-(quantityActual)) * rate;
System.out.println("ShortageAmt--->>["+shortageAmt+"]");
if(quantityRcp>quantityActual)
{
shortageAmt=((quantityRcp)-(quantityActual)) * rate;
System.out.println("ShortageAmt--->>["+shortageAmt+"]");
shortageAmtH=shortageAmtH + shortageAmt;
System.out.println("ShortageAmtHHH--->>["+shortageAmtH+"]");
shortageAmtH=shortageAmtH + shortageAmt;
System.out.println("ShortageAmtHHH--->>["+shortageAmtH+"]");
}
}//for loop
if (pstmt != null)
{
......@@ -143,10 +147,10 @@ public class DistRcpExShPostSave extends ValidatorEJB implements DistRcpExShPost
pstmt.setString(2, tranId);
System.out.println("Shortage Amount : "+shortageAmtH);
count=pstmt.executeUpdate();
System.out.println("post count---->>["+count+"]");
System.out.println("post count---->String>["+count+"]");
if(count >0 )
{
conn.commit();
errorString="";
}
}
}
......@@ -154,14 +158,33 @@ public class DistRcpExShPostSave extends ValidatorEJB implements DistRcpExShPost
{
System.out.println("Exception : DistRcpExShPostSave -->["+e.getMessage()+"]");
e.printStackTrace();
throw new ITMException(e);
}finally
{
try
{
conn.rollback();
{
if( errorString != null && errorString.trim().length() > 0 )
{
conn.rollback();
System.out.println("Transaction rollback... ");
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(rs != null)
{
rs.close();
rs = null;
}
}
catch(Exception e1)
catch(Exception e)
{
System.out.println("Exception while rollbacking transaction....");
e1.printStackTrace();
e.printStackTrace();
throw new ITMException(e);
}
}
return errorString;
......
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