Commit fa3c4b0c authored by prahate's avatar prahate

EJB updated for Request Id [D14JSUN004].


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@98121 ce508802-f39f-4f6c-b175-0d175dae99d5
parent b52ef4b2
......@@ -74,18 +74,15 @@ public class DistRcpExShIC extends ValidatorEJB implements DistRcpExShICLocal, D
String userId = "";
String sql = "",sql1="";
String siteCode = "";
String tranDate = "";
String lotNo = "",updateStatus="";
String lotSl="";
String locCode = "",tranCode="";
String quantity = "",lrDateStr="";
String keyFlag="",confirmed="",fldValue="";
String tranIdRcp="",tranId="",qtyactual="",reasCode="",status="";
String updateStatus="";
String tranCode="",remarks="";
String discrIdDate="",discrResDate="";
String keyFlag="",fldValue="";
String tranIdRcp="",tranId="",reasCode="",status="";
String tranIdRcpHdr = "",lineNoRcp="",remarks2="";
int ctr=0;
int cnt = 0;
int cnt1 = 0;
double qtyRcp=0.0,qtyActual=0.0;
int currentFormNo = 0;
int childNodeListLength;
......@@ -95,7 +92,7 @@ public class DistRcpExShIC extends ValidatorEJB implements DistRcpExShICLocal, D
Connection conn = null;
PreparedStatement pstmt = null,pstmt1=null;
ResultSet rs = null,rs1=null;
String siteCodeShip="";
//String siteCodeShip="";
ConnDriver connDriver = new ConnDriver();
StringBuffer errStringXml = new StringBuffer("<?xml version = \"1.0\"?> \r\n <Root> <Errors>");
......@@ -252,9 +249,6 @@ public class DistRcpExShIC extends ValidatorEJB implements DistRcpExShICLocal, D
pstmt = null;
}
}
}
break;
......@@ -321,8 +315,7 @@ public class DistRcpExShIC extends ValidatorEJB implements DistRcpExShICLocal, D
errCode = "VTLINEBLK";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}else
{
}else{
sql = "select count(1) from distord_rcpdet where tran_id = ? and line_no = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,tranIdRcp);
......@@ -339,7 +332,7 @@ public class DistRcpExShIC extends ValidatorEJB implements DistRcpExShICLocal, D
if( cnt == 0 )
{
errCode = "VTRCPTLN2";
errCode = "VTVOULN1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
......@@ -388,7 +381,6 @@ public class DistRcpExShIC extends ValidatorEJB implements DistRcpExShICLocal, D
reasCode = genericUtility.getColumnValue("reas_code", dom);
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("Reason code :"+reasCode);
if(((qtyRcp-qtyActual) > 0 || (qtyRcp-qtyActual) < 0) && (reasCode == null || reasCode.trim().length() == 0))
{
......@@ -400,7 +392,6 @@ public class DistRcpExShIC extends ValidatorEJB implements DistRcpExShICLocal, D
{
sql = " select fld_value from gencodes where fld_name='REAS_CODE' and mod_name='W_DISTRCP_EXSH' ";
pstmt = conn.prepareStatement(sql);
//pstmt.setString(1,siteCode);
rs = pstmt.executeQuery();
if(rs.next())
{
......@@ -408,21 +399,17 @@ public class DistRcpExShIC extends ValidatorEJB implements DistRcpExShICLocal, D
System.out.println("FIELD VALUE"+fldValue);
if(!fldValue.equalsIgnoreCase(reasCode))
{
System.out.println("Inside if of field val>>>>>>>>>>>>>");
errCode = "VTREA01";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
}
}
else if(childNodeName.equalsIgnoreCase("remarks2"))
{
remarks2=genericUtility.getColumnValue("remarks2", dom);
......@@ -432,20 +419,36 @@ public class DistRcpExShIC extends ValidatorEJB implements DistRcpExShICLocal, D
System.out.println("Status@@@@@@@@@@@@@ :"+status);
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
}
else if(childNodeName.equalsIgnoreCase("discr_id_date"))
{
System.out.println("Status is : "+status);
remarks=genericUtility.getColumnValue("remarks", dom);
discrIdDate=genericUtility.getColumnValue("discr_id_date", dom);
if((remarks!=null && remarks.trim().length() > 0) && (discrIdDate==null || discrIdDate.trim().length() < 0))
{
errCode = "VTDISDATE";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
else if(childNodeName.equalsIgnoreCase("discr_res_date"))
{
remarks2=genericUtility.getColumnValue("remarks2", dom);
discrResDate=genericUtility.getColumnValue("discr_res_date", dom);
System.out.println("Remarks@@@@@@@@@@@@@ :"+remarks2);
System.out.println("Discrepancy Res Date@@@@@@@@@@@@@ :"+discrResDate);
if((remarks2!=null && remarks2.trim().length() > 0) && (discrResDate==null || discrResDate.trim().length() < 0))
{
errCode = "VTDISRDATE";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}
}//end switch
int errListSize = errList.size();
cnt = 0;
......@@ -552,34 +555,32 @@ public class DistRcpExShIC extends ValidatorEJB implements DistRcpExShICLocal, D
Node childNode = null;
SimpleDateFormat sdf =null;
Timestamp timestamp = null,expDate=null,mfgDate=null;
Timestamp lrDate=null,tranDate=null,gpDate=null;
Timestamp lrDate=null,tranDate=null,gpDate=null,tranDate2=null;
String currDate="";
String childNodeName = null;
String siteCode = "";
String itemCode = "";
String itemDescr = "";
String lineNoRcp = "";
//String lineNoRcp = "";
String chgUser = "";
String chgTerm = "";
String sql = "";
String siteDescr = "",remarks2="";
String locCode = "",lrDateStr="",tranDatedStr="",gpDateStr="";
String locDescr = "";
String sql = "",sql1="";
String siteDescr = "",remarks2="",status="";
String locCode = "",lrDateStr="",gpDateStr="";
String locDescr = "",locType="",descr1="";
String siteCodeMfg="",suppCodeMfg="";
String tranIdRcp="",distOrder="",tranId="",tranCode="",lrNo="",transMode="",grossWeight="";
String tareWeight="",netWeight="",noArt="",gpNo="",tranName="",tranIdIss="",tranDate1="",rate="";
String tareWeight="",netWeight="",noArt="",gpNo="",tranName="",tranIdIss="";
String lotNo = "",lotSl="";
double quantity=0.0;
double quantity=0.0,qtyActual=0.0,qtyRcp=0.0,rate=0.0,shortVal=0.0;
String lineNo = "";
int ctr = 0;
int currentFormNo = 0;
String siteCodeShip="",siteCodeShipDescr="",unit="",columnValue="";
Connection conn = null;
PreparedStatement pstmt = null;
ResultSet rs = null ;
PreparedStatement pstmt = null,pstmt1=null;
ResultSet rs = null,rs1=null ;
GenericUtility genericUtility = GenericUtility.getInstance();
ConnDriver connDriver = new ConnDriver();
......@@ -631,28 +632,16 @@ public class DistRcpExShIC extends ValidatorEJB implements DistRcpExShICLocal, D
if(currentColumn.trim().equalsIgnoreCase("itm_default"))
{
System.out.println("@@@@@@ itm_default itemchange called");
System.out.println("@@@@@@ 2 siteCode["+siteCode+"]");
System.out.println("@@@@@@ siteCode["+siteCode+"]");
siteCode =(genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginSiteCode")); //25/3/15 start
siteDescr = findValue(conn, "descr" ,"site", "site_code", siteCode);
System.out.println("@@@@@@ 1 siteCode["+siteCode+"]::::::siteDescr["+siteDescr+"]");
valueXmlString.append("<site_code>").append("<![CDATA[" + siteCode + "]]>").append("</site_code>");
valueXmlString.append("<descr>").append("<![CDATA[" + siteDescr + "]]>").append("</descr>"); // 25/3/15end
System.out.println("Receipt Date@@@@@@@@@@@@@@@@@:"+currDate);
//valueXmlString.append("<tran_date>").append("<![CDATA[" + tranDate + "]]>").append("</tran_date>");
valueXmlString.append("<tran_date>").append("<![CDATA[" + currDate + "]]>").append("</tran_date>");
valueXmlString.append("<add_date>").append("<![CDATA[" + currDate + "]]>").append("</add_date>");
valueXmlString.append("<add_user>").append("<![CDATA[" + chgUser + "]]>").append("</add_user>");
valueXmlString.append("<add_term>").append("<![CDATA[" + chgTerm + "]]>").append("</add_term>");
System.out.println("Effective Date@@@@@@@@@@@@@@@@@:"+currDate);
}//end of if
if(currentColumn.trim().equalsIgnoreCase("itm_defaultedit"))
{
......@@ -711,45 +700,36 @@ public class DistRcpExShIC extends ValidatorEJB implements DistRcpExShICLocal, D
if(lrDate != null)
{
System.out.println("In side iff>>>>>>>");
lrDateStr=sdf.format(lrDate).toString();
System.out.println("lrDateStr@@@@@@@"+lrDateStr);
}
else
{
String s1="";
System.out.println("inside else@@@@?????????");
lrDateStr=s1;
// String s1="";
lrDateStr="";
System.out.println("lrDateStr@@@@@@@"+lrDateStr);
}
valueXmlString.append("<lr_date>").append("<![CDATA[" + lrDateStr + "]]>").append("</lr_date>");
if(gpDate != null)
{
System.out.println("In side iff>>>>>>>");
gpDateStr=sdf.format(gpDate).toString();
System.out.println("gpDateStr@@@@@@@"+gpDateStr);
}
else
{
String s1="";
System.out.println("inside else@@@@?????????");
gpDateStr=s1;
System.out.println("gpDateStr@@@@@@@"+gpDateStr);
}
valueXmlString.append("<gp_date>").append("<![CDATA[" + gpDateStr + "]]>").append("</gp_date>");
if(tranDate == null)
{
valueXmlString.append("<tran_date1>").append("<![CDATA[" + currDate + "]]>").append("</tran_date1>");
valueXmlString.append("<tran_date_1>").append("<![CDATA[" + currDate + "]]>").append("</tran_date_1>");
}
else
{
valueXmlString.append("<tran_date1>").append("<![CDATA[" + sdf.format(tranDate) + "]]>").append("</tran_date1>");
valueXmlString.append("<tran_date_1>").append("<![CDATA[" + sdf.format(tranDate) + "]]>").append("</tran_date_1>");
}
valueXmlString.append("<lr_no>").append("<![CDATA[" + lrNo + "]]>").append("</lr_no>");
valueXmlString.append("<gp_no>").append("<![CDATA[" + gpNo + "]]>").append("</gp_no>");
valueXmlString.append("<trans_mode>").append("<![CDATA[" + transMode + "]]>").append("</trans_mode>");
......@@ -762,32 +742,42 @@ public class DistRcpExShIC extends ValidatorEJB implements DistRcpExShICLocal, D
// valueXmlString.append("<tran_id__iss>").append("<![CDATA[" + tranIdIss + "]]>").append("</tran_id__iss>");
valueXmlString.append("<issue_ref>").append("<![CDATA[" + tranIdIss + "]]>").append("</issue_ref>");
sql1="Select tran_date from distord_iss where tran_id= ? ";
pstmt1 = conn.prepareStatement(sql1);
pstmt1.setString(1, tranIdIss);
rs1=pstmt1.executeQuery();
if(rs1.next())
{
tranDate2=rs1.getTimestamp("tran_date");
}
rs1.close();
rs1 = null;
pstmt1.close();
pstmt1 = null;
if(tranDate2 == null)
{
valueXmlString.append("<tran_date_2>").append("<![CDATA[" + currDate + "]]>").append("</tran_date_2>");
}
else
{
valueXmlString.append("<tran_date_2>").append("<![CDATA[" + sdf.format(tranDate2) + "]]>").append("</tran_date_2>");
}
}
else if(currentColumn.trim().equalsIgnoreCase("site_code"))
{
System.out.println("@@@@@@ site_code itemchange called");
siteCode = genericUtility.getColumnValue("site_code", dom);
siteDescr = findValue(conn, "descr" ,"site", "site_code", siteCode);
System.out.println("@@@@@ siteCode["+siteCode+"]siteDescr["+siteDescr+"]");
valueXmlString.append("<descr>").append("<![CDATA[" + siteDescr + "]]>").append("</descr>");
}
else if(currentColumn.trim().equalsIgnoreCase("tran_code"))
{
System.out.println("@@@@@@ tran_code itemchange called");
tranCode = genericUtility.getColumnValue("tran_code", dom);
tranName = findValue(conn, "tran_name", "transporter", "tran_code", tranCode);
System.out.println("@@@@@ Tran Code["+tranCode+"]Tran Name["+tranName+"]");
valueXmlString.append("<tran_name>").append("<![CDATA[" + tranName+ "]]>").append("</tran_name>");
System.out.println("Completed");
}
valueXmlString.append("</Detail1>");
break;
......@@ -818,12 +808,10 @@ 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>");
valueXmlString.append("<tran_id__rcp protect = \"1\">").append("<![CDATA[" + tranIdRcp + "]]>").append("</tran_id__rcp>");
}//end of if
else if(currentColumn.trim().equalsIgnoreCase("itm_defaultedit"))
{
......@@ -831,19 +819,16 @@ public class DistRcpExShIC extends ValidatorEJB implements DistRcpExShICLocal, D
}
else if(currentColumn.trim().equalsIgnoreCase("line_no__rcp"))
{
System.out.println("");
tranIdRcp = checkNull(genericUtility.getColumnValue("tran_id__rcp", dom));
lineNo = checkNull(genericUtility.getColumnValue("line_no__rcp", dom));
System.out.println("Line NO.>>>>>>>>>"+lineNo);
if (lineNo!=null || lineNo.trim().length() > 0 )
if (lineNo!=null && lineNo.trim().length() > 0 )
{
System.out.println("In IF>>>>>>>>>>>>>>");
sql = "select unit,quantity,lot_no,lot_sl,no_art,site_code__mfg,mfg_date,exp_date,gross_weight,tare_weight,net_weight,trans_mode,supp_code__mfg,item_code,loc_code,rate from distord_rcpdet where tran_id= ? and line_no= ? ";//pankaj 6/5/15
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,tranIdRcp);
pstmt.setString(2,lineNo);
rs = pstmt.executeQuery();
if(rs.next())
{
......@@ -862,10 +847,9 @@ 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.getDouble("rate");
itemDescr = findValue(conn, "descr" ,"item", "item_code", itemCode);
locDescr=findValue(conn, "descr", "location", "loc_code", locCode);
}
rs.close();
rs = null;
......@@ -877,7 +861,6 @@ public class DistRcpExShIC extends ValidatorEJB implements DistRcpExShICLocal, D
valueXmlString.append("<loc_code>").append("<![CDATA[" + locCode + "]]>").append("</loc_code>");
valueXmlString.append("<descr>").append("<![CDATA[" + locDescr + "]]>").append("</descr>");
valueXmlString.append("<unit>").append("<![CDATA[" + unit + "]]>").append("</unit>");
//valueXmlString.append("<quantity>").append("<![CDATA[" + quantity + "]]>").append("</quantity>");
valueXmlString.append("<qty_rcp>").append("<![CDATA[" + quantity + "]]>").append("</qty_rcp>");
valueXmlString.append("<qty_actual>").append("<![CDATA[" + quantity + "]]>").append("</qty_actual>");
valueXmlString.append("<lot_no>").append("<![CDATA[" + lotNo + "]]>").append("</lot_no>");
......@@ -906,12 +889,35 @@ public class DistRcpExShIC extends ValidatorEJB implements DistRcpExShICLocal, D
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>");
shortVal=((qtyRcp - qtyActual) * rate);
valueXmlString.append("<short_val>").append("<![CDATA[" + shortVal + "]]>").append("</short_val>");
locType = findValue(conn, "loc_type" ,"item", "item_code", itemCode);
System.out.println(">>>>>>Loc Type"+locType);
sql = "select descr from gencodes where fld_value=? ";// and fld_name= ?
pstmt = conn.prepareStatement(sql);
// pstmt.setString(1,"LOC_TYPE");
pstmt.setString(1,locType);
rs = pstmt.executeQuery();
if(rs.next())
{
descr1=rs.getString("descr");
System.out.println("Description>>>>"+descr1);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
valueXmlString.append("<loc_type>").append("<![CDATA[" + locType + "]]>").append("</loc_type>");
valueXmlString.append("<gencodes_descr>").append("<![CDATA[" + descr1 + "]]>").append("</gencodes_descr>");
}
}
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"))
......@@ -919,14 +925,22 @@ public class DistRcpExShIC extends ValidatorEJB implements DistRcpExShICLocal, D
System.out.println("inside open");
valueXmlString.append("<remarks2 protect = \"1\">").append("<![CDATA[" + remarks2 + "]]>").append("</remarks2>");
}
if(status != null && status.equalsIgnoreCase("C"))
{
System.out.println("inside close");
valueXmlString.append("<remarks2 protect = \"0\">").append("<![CDATA[" + remarks2 + "]]>").append("</remarks2>");
}
}
else if(currentColumn.trim().equalsIgnoreCase("qty_actual"))
{
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));
rate = Double.valueOf(genericUtility.getColumnValue("rate", dom)==null?"0":genericUtility.getColumnValue("rate", dom));;
System.out.println("Quantity RCp["+qtyRcp+"]Quantity Actual["+qtyActual+"]Rate["+rate+"]");
shortVal=((qtyRcp - qtyActual) * rate);
System.out.println("Short Value>>>>>>>>>"+shortVal);
valueXmlString.append("<short_val>").append("<![CDATA[" + shortVal + "]]>").append("</short_val>");
}
valueXmlString.append("</Detail2>");
break;
}//end of switch-case
......@@ -1053,7 +1067,6 @@ public class DistRcpExShIC extends ValidatorEJB implements DistRcpExShICLocal, D
NodeList currDetailList = null;
String updateStatus = "",nodeName = "";
int currDetailListLength = 0;
currDetailList = currDetail.getChildNodes();
currDetailListLength = currDetailList.getLength();
for (int i=0;i< currDetailListLength;i++)
......
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