Commit 214fd20b authored by prahate's avatar prahate

Updated EJB for DistRcpExSh.


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@97663 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 5204aa98
......@@ -35,6 +35,7 @@ import javax.ejb.Stateless; // added for ejb3
public class DistRcpExShIC extends ValidatorEJB implements DistRcpExShICLocal, DistRcpExShICRemote
{
E12GenericUtility genericUtility = new E12GenericUtility();
//method for validation
......@@ -79,8 +80,8 @@ public class DistRcpExShIC extends ValidatorEJB implements DistRcpExShICLocal, D
String lotNo = "";
String lotSl="";
String locCode = "";
String quantity = "";
String keyFlag="";
String quantity = "",lrDateStr="";
String keyFlag="",confirmed="",fldValue="";
String tranIdRcp="",tranId="",qtyactual="",reasCode="";
......@@ -124,16 +125,16 @@ public class DistRcpExShIC extends ValidatorEJB implements DistRcpExShICLocal, D
{
childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName();
if(childNodeName.equalsIgnoreCase("tran_date"))
{
tranDate = genericUtility.getColumnValue("tran_date", dom);
if(tranDate == null || tranDate.trim().length() == 0)
{
errCode = "VTTRAN1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
// if(childNodeName.equalsIgnoreCase("tran_date"))
// {
// tranDate = genericUtility.getColumnValue("tran_date", dom);
// if(tranDate == null || tranDate.trim().length() == 0)
// {
// errCode = "VTTRAN1";
// errList.add(errCode);
// errFields.add(childNodeName.toLowerCase());
// }
// }
else if(childNodeName.equalsIgnoreCase("tran_id"))
{
......@@ -151,6 +152,7 @@ public class DistRcpExShIC extends ValidatorEJB implements DistRcpExShICLocal, D
pstmt1.close();
pstmt1 = null;
if(keyFlag.equalsIgnoreCase("M"))
{
tranId= genericUtility.getColumnValue("tran_id", dom);
......@@ -182,26 +184,27 @@ public class DistRcpExShIC extends ValidatorEJB implements DistRcpExShICLocal, D
}
}
}
else if(childNodeName.equalsIgnoreCase("site_code"))
else if(childNodeName.equalsIgnoreCase("tran_id__rcp"))
{
siteCode = genericUtility.getColumnValue("site_code", dom);
if(siteCode == null || (siteCode.length() == 0))
tranIdRcp = genericUtility.getColumnValue("tran_id__rcp", dom);
if(tranIdRcp == null || tranIdRcp.trim().length() == 0)
{
errList.add("NULLSITECD");
errCode = "VMTRIDRCP";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
if(siteCode != null && (siteCode.trim().length() > 0))
else
{
sql = " select count(*) from site where site_code = ? ";
sql = " select count(*) from distord_rcp where tran_id= ? and confirmed='Y'"; //and confirmed='Y' and status= (case when status is null then 'P' else status end) ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,siteCode);
pstmt.setString(1,tranIdRcp);
rs = pstmt.executeQuery();
if(rs.next())
{
cnt = rs.getInt(1);
if(cnt == 0)
{
errCode = "VMSITE1";
errCode = "VTPRCPID1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
......@@ -211,28 +214,28 @@ public class DistRcpExShIC extends ValidatorEJB implements DistRcpExShICLocal, D
pstmt.close();
pstmt = null;
}
//}
}
else if(childNodeName.equalsIgnoreCase("tran_id__rcp"))
else if(childNodeName.equalsIgnoreCase("site_code"))
{
tranIdRcp = genericUtility.getColumnValue("tran_id__rcp", dom);
if(tranIdRcp == null || tranIdRcp.trim().length() == 0)
siteCode = genericUtility.getColumnValue("site_code", dom);
if(siteCode == null || (siteCode.length() == 0))
{
errCode = "VMTRIDRCP";
errList.add(errCode);
errList.add("NULLSITECD");
errFields.add(childNodeName.toLowerCase());
}
else
if(siteCode != null && (siteCode.trim().length() > 0))
{
sql = " select count(*)from distord_rcp where tran_id= ?"; //and confirmed='Y' and status= (case when status is null then 'P' else status end) ";
sql = " select count(*) from site where site_code = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,tranIdRcp);
pstmt.setString(1,siteCode);
rs = pstmt.executeQuery();
if(rs.next())
{
cnt = rs.getInt(1);
if(cnt == 0)
{
errCode = "VTPRCPD1";
errCode = "VMSITE1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
......@@ -245,6 +248,7 @@ public class DistRcpExShIC extends ValidatorEJB implements DistRcpExShICLocal, D
}
}
break;
......@@ -337,9 +341,35 @@ public class DistRcpExShIC extends ValidatorEJB implements DistRcpExShICLocal, D
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
if(reasCode != null && (reasCode.trim().length() > 0))
{
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())
{
fldValue = rs.getString("fld_value");
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;
}
}
}
}//end switch
......@@ -448,7 +478,8 @@ public class DistRcpExShIC extends ValidatorEJB implements DistRcpExShICLocal, D
Node childNode = null;
SimpleDateFormat sdf =null;
Timestamp timestamp = null,expDate=null,mfgDate=null;
String tranDate="";
Timestamp lrDate=null,tranDate=null;
String currDate="";
String childNodeName = null;
String siteCode = "";
......@@ -459,10 +490,10 @@ public class DistRcpExShIC extends ValidatorEJB implements DistRcpExShICLocal, D
String chgTerm = "";
String sql = "";
String siteDescr = "";
String locCode = "";
String locCode = "",lrDateStr="",tranDatedStr="";
String locDescr = "";
String siteCodeMfg="",suppCodeMfg="";
String tranIdRcp="",distOrder="",tranId="",tranCode="",lrDate="",lrNo="",transMode="",grossWeight="";
String tranIdRcp="",distOrder="",tranId="",tranCode="",lrNo="",transMode="",grossWeight="";
String tareWeight="",netWeight="",noArt="",tranName="",tranIdIss="",tranDate1="";
String lotNo = "",lotSl="";
......@@ -488,6 +519,7 @@ public class DistRcpExShIC extends ValidatorEJB implements DistRcpExShICLocal, D
sdf = new SimpleDateFormat(genericUtility.getApplDateFormat());
timestamp = new Timestamp(System.currentTimeMillis());
if(objContext != null && objContext.trim().length() > 0)
{
currentFormNo = Integer.parseInt(objContext);
......@@ -500,7 +532,7 @@ public class DistRcpExShIC extends ValidatorEJB implements DistRcpExShICLocal, D
chgUser =(genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginEmpCode"));
chgTerm =(genericUtility.getValueFromXTRA_PARAMS(xtraParams, "chgTerm"));
tranDate = (sdf.format(timestamp).toString()).trim();
currDate = (sdf.format(timestamp).toString()).trim();
valueXmlString = new StringBuffer("<?xml version = \"1.0\"?> <Root> <header> <editFlag>");
valueXmlString.append(editFlag).append("</editFlag> </header>");
......@@ -530,22 +562,29 @@ public class DistRcpExShIC extends ValidatorEJB implements DistRcpExShICLocal, D
System.out.println("@@@@@@ itm_default itemchange called");
System.out.println("@@@@@@ 2 siteCode["+siteCode+"]");
System.out.println("Receipt Date@@@@@@@@@@@@@@@@@:"+tranDate);
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
valueXmlString.append("<tran_date>").append("<![CDATA[" + tranDate + "]]>").append("</tran_date>");
valueXmlString.append("<eff_date>").append("<![CDATA[" + tranDate + "]]>").append("</eff_date>");
valueXmlString.append("<add_date>").append("<![CDATA[" + tranDate + "]]>").append("</add_date>");
System.out.println("Receipt Date@@@@@@@@@@@@@@@@@:"+currDate);
//valueXmlString.append("<tran_date>").append("<![CDATA[" + tranDate + "]]>").append("</tran_date>");
valueXmlString.append("<eff_date>").append("<![CDATA[" + currDate + "]]>").append("</eff_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@@@@@@@@@@@@@@@@@:"+tranDate);
System.out.println("Effective Date@@@@@@@@@@@@@@@@@:"+currDate);
}//end of if
if(currentColumn.trim().equalsIgnoreCase("itm_defaultedit"))
{
valueXmlString.append("<chg_date>").append("<![CDATA[" + tranDate + "]]>").append("</chg_date>");
valueXmlString.append("<chg_date>").append("<![CDATA[" + currDate + "]]>").append("</chg_date>");
// valueXmlString.append("<chg_user>").append("<![CDATA[" + chgUser + "]]>").append("</chg_user>");
// valueXmlString.append("<chg_term>").append("<![CDATA[" + chgTerm + "]]>").append("</chg_term>");
......@@ -582,15 +621,15 @@ public class DistRcpExShIC extends ValidatorEJB implements DistRcpExShICLocal, D
valueXmlString.append("<tran_name>").append("<![CDATA[" + tranName+ "]]>").append("</tran_name>");
System.out.println("@@@@@ tran_code["+tranCode+"]tran_name["+tranName+"]");
sql = "select lr_no,lr_date,trans_mode,gross_weight,tare_weight,net_weight,no_art,tran_id__iss from distord_rcp where tran_id=?";
sql = "select tran_date,lr_no,lr_date,trans_mode,gross_weight,tare_weight,net_weight,no_art,tran_id__iss from distord_rcp where tran_id=?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranId);
rs = pstmt.executeQuery();
if (rs.next())
{
tranDate=rs.getTimestamp("tran_date");
lrNo= checkNull(rs.getString("lr_no"));
lrDate= checkNull(rs.getString("lr_date"));
lrDate= rs.getTimestamp("lr_date");
transMode= rs.getString("trans_mode");
grossWeight = rs.getString("gross_weight");
tareWeight = rs.getString("tare_weight");
......@@ -605,8 +644,42 @@ public class DistRcpExShIC extends ValidatorEJB implements DistRcpExShICLocal, D
pstmt.close();
pstmt = null;
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;
System.out.println("lrDateStr@@@@@@@"+lrDateStr);
}
valueXmlString.append("<lr_date>").append("<![CDATA[" + lrDateStr + "]]>").append("</lr_date>");
// if(tranDated != null)
// {
// tranDatedStr=sdf.format(lrDate).toString();
// }
// else
// {
// tranDatedStr="";
// }
if(tranDate == null)
{
valueXmlString.append("<tran_date>").append("<![CDATA[" + currDate + "]]>").append("</tran_date>");
}
else
{
valueXmlString.append("<tran_date>").append("<![CDATA[" + sdf.format(tranDate) + "]]>").append("</tran_date>");
}
valueXmlString.append("<lr_no>").append("<![CDATA[" + lrNo + "]]>").append("</lr_no>");
valueXmlString.append("<lr_date>").append("<![CDATA[" + lrDate + "]]>").append("</lr_date>");
valueXmlString.append("<trans_mode>").append("<![CDATA[" + transMode + "]]>").append("</trans_mode>");
valueXmlString.append("<gross_weight>").append("<![CDATA[" + grossWeight + "]]>").append("</gross_weight>");
valueXmlString.append("<tare_weight>").append("<![CDATA[" + tareWeight + "]]>").append("</tare_weight>");
......@@ -664,33 +737,41 @@ public class DistRcpExShIC extends ValidatorEJB implements DistRcpExShICLocal, D
}//end of if
else if(currentColumn.trim().equalsIgnoreCase("itm_defaultedit"))
{
}
else if(currentColumn.trim().equalsIgnoreCase("tran_id__rcp") || currentColumn.trim().equalsIgnoreCase("line_no__rcp"))
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));
if (lineNo.trim().length() > 0 )
{
valueXmlString.append("<line_no__rcp>").append("<![CDATA[" + lineNo + "]]>").append("</line_no__rcp>");
}
if (tranIdRcp.trim().length() > 0 && lineNo.trim().length() > 0 )
{
if(lineNo.trim().length() > 0)
{
itemCode=findValue(conn, "item_code", "distord_rcpdet", "tran_id", tranIdRcp);
System.out.println("Line NO.>>>>>>>>>"+lineNo);
//lineNo = " " + lineNo.trim();
//lineNo = lineNo.substring( lineNo.length()-3 );
// if (lineNo.trim().length() > 0 )
// {
// valueXmlString.append("<line_no__rcp>").append("<![CDATA[" +lineNo+"]]>").append("</line_no__rcp>");
// }else
// {
// lineNo="0";
// System.out.println("LINE NO>>>>>>>>>>>"+lineNo);
// }
//if (tranIdRcp.trim().length() > 0 && lineNo.trim().length() > 0 )
if (lineNo!=null || lineNo.trim().length() > 0 )
{
System.out.println("In IF>>>>>>>>>>>>>>");
//currentColumn.trim().equalsIgnoreCase("tran_id__rcp") || pankaj
// if(lineNo.trim().length() > 0)
//{
/*itemCode=findValue(conn, "item_code", "distord_rcpdet", "tran_id", tranIdRcp);
itemDescr = findValue(conn, "descr" ,"item", "item_code", itemCode);
valueXmlString.append("<item_code>").append("<![CDATA[" + itemCode + "]]>").append("</item_code>");
valueXmlString.append("<item_descr>").append("<![CDATA[" + itemDescr + "]]>").append("</item_descr>");
locCode=findValue(conn, "loc_code", "distord_rcpdet", "tran_id", tranIdRcp);
locDescr=findValue(conn, "descr", "location", "loc_code", locCode);
locDescr=findValue(conn, "descr", "location", "loc_code", locCode);*/
valueXmlString.append("<loc_code>").append("<![CDATA[" + locCode + "]]>").append("</loc_code>");
valueXmlString.append("<descr>").append("<![CDATA[" + locDescr + "]]>").append("</descr>");
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 from distord_rcpdet where tran_id= ? and line_no= ? ";
pstmt = conn.prepareStatement(sql);
......@@ -714,14 +795,53 @@ public class DistRcpExShIC extends ValidatorEJB implements DistRcpExShICLocal, D
transMode= rs.getString("trans_mode");
suppCodeMfg= rs.getString("supp_code__mfg");
itemCode=findValue(conn, "item_code", "distord_rcpdet", "tran_id", tranIdRcp);
itemDescr = findValue(conn, "descr" ,"item", "item_code", itemCode);
locCode=findValue(conn, "loc_code", "distord_rcpdet", "tran_id", tranIdRcp);
locDescr=findValue(conn, "descr", "location", "loc_code", locCode);
//System.out.println("mfgDate@@@@"+sdf.format(mfgDate));
//System.out.println("expDate@@@@"+sdf.format(expDate));
/*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>");
valueXmlString.append("<lot_sl>").append("<![CDATA[" + lotSl + "]]>").append("</lot_sl>");
valueXmlString.append("<no_art>").append("<![CDATA[" + noArt + "]]>").append("</no_art>");
valueXmlString.append("<site_code__mfg>").append("<![CDATA[" + siteCodeMfg + "]]>").append("</site_code__mfg>");
if(mfgDate == null)
{
valueXmlString.append("<mfg_date>").append("<![CDATA[ ]]>").append("</mfg_date>");
}
else
{
valueXmlString.append("<mfg_date>").append("<![CDATA[" + sdf.format(mfgDate) + "]]>").append("</mfg_date>");
}
if(expDate == null)
{
valueXmlString.append("<exp_date>").append("<![CDATA[ ]]>").append("</exp_date>");
}
else
{
valueXmlString.append("<exp_date>").append("<![CDATA[" + sdf.format(expDate) + "]]>").append("</exp_date>");
}
valueXmlString.append("<gross_weight>").append("<![CDATA[" + grossWeight + "]]>").append("</gross_weight>");
valueXmlString.append("<tare_weight>").append("<![CDATA[" + tareWeight + "]]>").append("</tare_weight>");
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>");
*/
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
System.out.println("mfgDate@@@@"+sdf.format(mfgDate));
System.out.println("expDate@@@@"+sdf.format(expDate));
valueXmlString.append("<item_code>").append("<![CDATA[" + itemCode + "]]>").append("</item_code>");
valueXmlString.append("<item_descr>").append("<![CDATA[" + itemDescr + "]]>").append("</item_descr>");
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>");
......@@ -730,8 +850,22 @@ public class DistRcpExShIC extends ValidatorEJB implements DistRcpExShICLocal, D
valueXmlString.append("<lot_sl>").append("<![CDATA[" + lotSl + "]]>").append("</lot_sl>");
valueXmlString.append("<no_art>").append("<![CDATA[" + noArt + "]]>").append("</no_art>");
valueXmlString.append("<site_code__mfg>").append("<![CDATA[" + siteCodeMfg + "]]>").append("</site_code__mfg>");
if(mfgDate == null)
{
valueXmlString.append("<mfg_date>").append("<![CDATA[ ]]>").append("</mfg_date>");
}
else
{
valueXmlString.append("<mfg_date>").append("<![CDATA[" + sdf.format(mfgDate) + "]]>").append("</mfg_date>");
}
if(expDate == null)
{
valueXmlString.append("<exp_date>").append("<![CDATA[ ]]>").append("</exp_date>");
}
else
{
valueXmlString.append("<exp_date>").append("<![CDATA[" + sdf.format(expDate) + "]]>").append("</exp_date>");
}
valueXmlString.append("<gross_weight>").append("<![CDATA[" + grossWeight + "]]>").append("</gross_weight>");
valueXmlString.append("<tare_weight>").append("<![CDATA[" + tareWeight + "]]>").append("</tare_weight>");
valueXmlString.append("<net_weight>").append("<![CDATA[" + netWeight + "]]>").append("</net_weight>");
......@@ -739,11 +873,17 @@ public class DistRcpExShIC extends ValidatorEJB implements DistRcpExShICLocal, D
valueXmlString.append("<supp_code__mfg>").append("<![CDATA[" + suppCodeMfg + "]]>").append("</supp_code__mfg>");
}
//}
}
}
}/*else if(currentColumn.trim().equalsIgnoreCase("qty_actual"))
{
itemCode="TEST";
valueXmlString.append("<item_code>").append("<![CDATA[" + itemCode + "]]>").append("</item_code>");
}*/
valueXmlString.append("</Detail2>");
break;
}//end of switch-case
......
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