Commit 718c5d19 authored by cpatil's avatar cpatil

add site code on item default


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@99819 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 31282e59
......@@ -10,7 +10,8 @@ package ibase.webitm.ejb.dis;
import ibase.system.config.ConnDriver;
import ibase.webitm.ejb.ValidatorEJB;
import ibase.webitm.ejb.fin.FinCommon;
import ibase.webitm.utility.GenericUtility;
// import ibase.webitm.utility.GenericUtility;
import ibase.utility.E12GenericUtility;
import ibase.webitm.utility.ITMException;
import java.text.SimpleDateFormat;
......@@ -31,7 +32,9 @@ import java.sql.Timestamp;
public class ShipmentLocIC extends ValidatorEJB implements ShipmentLocICLocal, ShipmentLocICRemote
{
GenericUtility genericUtility = GenericUtility.getInstance();
// GenericUtility genericUtility = GenericUtility.getInstance();
E12GenericUtility genericUtility = new E12GenericUtility();
//method for validation
public String wfValData(String xmlString, String xmlString1, String xmlString2, String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException
......@@ -46,17 +49,17 @@ public class ShipmentLocIC extends ValidatorEJB implements ShipmentLocICLocal, S
if (xmlString != null && xmlString.trim().length() > 0 )
{
dom = parseString(xmlString);
System.out.println("@@@@@@@@@xmlString[["+xmlString+"]]");
System.out.println("@@@@@@@@@xmlString["+xmlString+"]");
}
if (xmlString1 != null && xmlString1.trim().length() > 0 )
{
dom1 = parseString(xmlString1);
System.out.println("@@@@@@@@@xmlString1[["+xmlString1+"]]");
System.out.println("@@@@@@@@@xmlString1["+xmlString1+"]");
}
if (xmlString2 != null && xmlString2.trim().length() > 0 )
{
dom2 = parseString(xmlString2);
System.out.println("@@@@@@@@@xmlString2[["+xmlString2+"]]");
System.out.println("@@@@@@@@@xmlString2["+xmlString2+"]");
}
errString = wfValData(dom, dom1, dom2, objContext, editFlag, xtraParams);
}
......@@ -96,7 +99,7 @@ public class ShipmentLocIC extends ValidatorEJB implements ShipmentLocICLocal, S
String isExistFlag="",exchRateStr="",chargeCode="",stanCodeShip="",stanCodeDlv="",shipmentId="";
double exchRate=0;
String currCodeFrt="",currCodeBc="";
String licenceNo="",distRoute="",saleOrder="";
try
{
......@@ -123,7 +126,7 @@ public class ShipmentLocIC extends ValidatorEJB implements ShipmentLocICLocal, S
if(childNodeName.equalsIgnoreCase("shipment_id"))
{
shipmentId = genericUtility.getColumnValue("shipment_id", dom);
shipmentId = checkNull(genericUtility.getColumnValue("shipment_id", dom));
//Shipment Date should not be blank.
String keyFlag = setDescription("key_flag", "transetup", "tran_window", "w_shipment_loc", conn);
......@@ -383,7 +386,7 @@ public class ShipmentLocIC extends ValidatorEJB implements ShipmentLocICLocal, S
if(childNodeName.equalsIgnoreCase("sale_order"))
{
String saleOrder = checkNull(genericUtility.getColumnValue("sale_order", dom));
saleOrder = checkNull(genericUtility.getColumnValue("sale_order", dom));
if ( saleOrder != null && saleOrder.trim().length() > 0 )
{
......@@ -399,7 +402,7 @@ public class ShipmentLocIC extends ValidatorEJB implements ShipmentLocICLocal, S
if(childNodeName.equalsIgnoreCase("dist_route"))
{
String distRoute = checkNull(genericUtility.getColumnValue("dist_route", dom));
distRoute = checkNull(genericUtility.getColumnValue("dist_route", dom));
if ( distRoute != null && distRoute.trim().length() > 0 )
{
......@@ -413,6 +416,33 @@ public class ShipmentLocIC extends ValidatorEJB implements ShipmentLocICLocal, S
}
}
if(childNodeName.equalsIgnoreCase("licence_no"))
{
licenceNo = checkNull(genericUtility.getColumnValue("licence_no", dom));
if ( licenceNo != null && licenceNo.trim().length() > 0 )
{
cnt=0;
sql = "select count(1) from gencodes where fld_name ='LICENCE_NO' and fld_value = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString( 1, licenceNo );
rs = pstmt.executeQuery();
if (rs.next())
{
cnt = rs.getInt(1);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if (cnt == 0 )
{
errCode = "INVLICENNO";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}
} // end for
......@@ -438,6 +468,29 @@ public class ShipmentLocIC extends ValidatorEJB implements ShipmentLocICLocal, S
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
else
{
cnt=0;
sql = " select count(1) from gencodes where fld_name = 'CHARGE_CODE' and mod_name = 'X' and rtrim(fld_value) = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString( 1, chargeCode );
rs = pstmt.executeQuery();
if (rs.next())
{
cnt = rs.getInt(1);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if (cnt == 0 )
{
errCode = "VMCHGCDINV";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}
......@@ -625,57 +678,6 @@ public class ShipmentLocIC extends ValidatorEJB implements ShipmentLocICLocal, S
}
}
// new
if( childNodeName.equalsIgnoreCase("curr_code__frt") )
{
currCodeFrt = checkNull(genericUtility.getColumnValue("curr_code__frt", dom));
if( currCodeFrt != null && currCodeFrt.trim().length() > 0 )
{
isExistFlag = isExist("currency", "curr_code", currCodeFrt, conn);
if("FALSE".equalsIgnoreCase(isExistFlag))
{
errCode = "VMCURR1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
else
{
errCode = "VMCUR2";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
if( childNodeName.equalsIgnoreCase("curr_code__bc") )
{
currCodeBc = checkNull(genericUtility.getColumnValue("curr_code__bc", dom));
if( currCodeBc != null && currCodeBc.trim().length() > 0 )
{
isExistFlag = isExist("currency", "curr_code", currCodeBc, conn);
if("FALSE".equalsIgnoreCase(isExistFlag))
{
errCode = "VMCURR1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
else
{
errCode = "VMCUR2";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
} // end for
break; // case 4 end
......@@ -771,6 +773,7 @@ public class ShipmentLocIC extends ValidatorEJB implements ShipmentLocICLocal, S
rs = null;
pstmt.close();
pstmt = null;
System.out.println("COUNT["+cnt+"]");
if( cnt > 0)
{
retStr = "TRUE";
......@@ -831,7 +834,8 @@ public class ShipmentLocIC extends ValidatorEJB implements ShipmentLocICLocal, S
Connection conn = null;
PreparedStatement pstmt = null;
ResultSet rs = null ;
GenericUtility genericUtility = GenericUtility.getInstance();
// GenericUtility genericUtility = GenericUtility.getInstance();
E12GenericUtility genericUtility = new E12GenericUtility();
ConnDriver connDriver = new ConnDriver();
int currentFormNo =0;
......@@ -851,16 +855,15 @@ public class ShipmentLocIC extends ValidatorEJB implements ShipmentLocICLocal, S
int i=0,noArt=0;
Timestamp despDate=null;
double netWeightCIss=0;
try
{
Calendar currentDate = Calendar.getInstance();
SimpleDateFormat sdf = new SimpleDateFormat(genericUtility.getApplDateFormat());
String sysDate = sdf.format(currentDate.getTime());
System.out.println("Now the date is :=> " + sysDate);
loginSiteCode = getValueFromXTRA_PARAMS(xtraParams, "loginCode");
//System.out.println("Now the date is :=> " + sysDate);
loginSiteCode = getValueFromXTRA_PARAMS(xtraParams, "loginSiteCode");
System.out.println("Now the date is["+sysDate+"]::loginSiteCode["+loginSiteCode+"]");
conn = connDriver.getConnectDB("DriverITM");
......@@ -905,7 +908,13 @@ public class ShipmentLocIC extends ValidatorEJB implements ShipmentLocICLocal, S
if(currentColumn.trim().equalsIgnoreCase("itm_default"))
{
System.out.println("@@@@@@@@ itemchange itm_default called @@@@@@@@");
valueXmlString.append( "<shipment_date><![CDATA[" ).append(sysDate).append( "]]></shipment_date>\r\n" );
valueXmlString.append( "<shipment_date><![CDATA[" ).append(sysDate).append("]]></shipment_date>\r\n" );
valueXmlString.append("<site_code>").append("<![CDATA["+loginSiteCode+"]]>").append("</site_code>");
siteCodeDescr = setDescription("descr", "site" , "site_code", loginSiteCode, conn);
valueXmlString.append("<descr>").append("<![CDATA["+siteCodeDescr+"]]>").append("</descr>");
valueXmlString.append("<lr_date><![CDATA[" ).append(sysDate).append("]]></lr_date>\r\n" );
}
else if(currentColumn.trim().equalsIgnoreCase("site_code"))
......@@ -1344,13 +1353,13 @@ public class ShipmentLocIC extends ValidatorEJB implements ShipmentLocICLocal, S
{
System.out.println("@@@@@@@@ itemchange charge_code called @@@@@@@@");
chargeCode = genericUtility.getColumnValue("charge_code", dom);
shipmentId = genericUtility.getColumnValue("shipment_id", dom1);
chargeCode = genericUtility.getColumnValue("charge_code", dom)==null?"":genericUtility.getColumnValue("charge_code", dom).trim();
shipmentId = genericUtility.getColumnValue("shipment_id", dom1)==null?"":genericUtility.getColumnValue("shipment_id", dom1).trim();
frtList = genericUtility.getColumnValue("frt_list", dom1);
stanCodeFrom = genericUtility.getColumnValue("stan_code__from", dom1);
stanCodeTo = genericUtility.getColumnValue("stan_code__to", dom1);
loadType = genericUtility.getColumnValue("load_type", dom1);
frtList = genericUtility.getColumnValue("frt_list", dom1)==null?"":genericUtility.getColumnValue("frt_list", dom1).trim();
stanCodeFrom = genericUtility.getColumnValue("stan_code__from", dom1)==null?"":genericUtility.getColumnValue("stan_code__from", dom1).trim();
stanCodeTo = genericUtility.getColumnValue("stan_code__to", dom1)==null?"":genericUtility.getColumnValue("stan_code__to", dom1).trim();
loadType = genericUtility.getColumnValue("load_type", dom1)==null?"":genericUtility.getColumnValue("load_type", dom1).trim();
/*
sql = " select c.descr,b.charges_mode,b.amount,b.charge_code__add,sequence " +
" from shipment a, freight_rate_det b, gencodes c " +
......@@ -1385,9 +1394,9 @@ public class ShipmentLocIC extends ValidatorEJB implements ShipmentLocICLocal, S
pstmt.setString(3,stanCodeTo );
pstmt.setString(4,loadType );
pstmt.setString(5,shipmentId );
pstmt.setString(6,"CHARGE_CODE" );
pstmt.setString(7,chargeCode );
// pstmt.setString(5,shipmentId );
pstmt.setString(5,"CHARGE_CODE" );
pstmt.setString(6,chargeCode );
rs = pstmt.executeQuery();
if(rs.next())
......@@ -1485,7 +1494,24 @@ public class ShipmentLocIC extends ValidatorEJB implements ShipmentLocICLocal, S
pstmt.close();
pstmt = null;
nettWeight = (nettWeight + netWeight) * amount;
sql = " select nvl(sum(gross_weight),0) from CONSUME_ISS " +
" where cons_issue in ( select ref_id from ship_docs where shipment_id = ? ) and confirmed = 'Y' ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, shipmentId);
rs = pstmt.executeQuery();
if( rs.next())
{
grossWeightCIss = rs.getDouble(1);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
System.out.println("@@@@@@@@grossWeightCIss["+grossWeightCIss+"]");
nettWeight = (nettWeight + netWeight + grossWeightCIss ) * amount;
valueXmlString.append("<amount>").append("<![CDATA["+nettWeight+"]]>").append("</amount>");
}
else if ("V".equalsIgnoreCase(mode) ) //volume
......@@ -1545,7 +1571,7 @@ public class ShipmentLocIC extends ValidatorEJB implements ShipmentLocICLocal, S
System.out.println("@@@@@2 stanCodeShip ["+ stanCodeShip + "]");
stationaDescr = setDescription("descr", "station", "stan_code", stanCodeShip, conn);
valueXmlString.append("<stationa_descr protect = \"1\">").append("<![CDATA["+stationaDescr+"]]>").append("</stationa_descr>");
}
} //stationa_descr
else if( currentColumn.trim().equalsIgnoreCase( "stan_code__dlv" ) )
......@@ -1641,7 +1667,7 @@ public class ShipmentLocIC extends ValidatorEJB implements ShipmentLocICLocal, S
valueXmlString.append("<exch_rate protect = \"1\">").append("<![CDATA["+exchRateDescr+"]]>").append("</exch_rate>");
}
else if( currentColumn.trim().equalsIgnoreCase( "tran_code" ) )
else if( currentColumn.trim().equalsIgnoreCase("tran_code") )
{
tranCode = genericUtility.getColumnValue("tran_code", dom);
......@@ -1650,7 +1676,7 @@ public class ShipmentLocIC extends ValidatorEJB implements ShipmentLocICLocal, S
valueXmlString.append("<transporter_tran_name protect = \"1\">").append("<![CDATA["+transporterTranName+"]]>").append("</transporter_tran_name>");
}
else if ( currentColumn.trim().equalsIgnoreCase( "ref_id" ) )
else if ( currentColumn.trim().equalsIgnoreCase("ref_id") )
{
refId = genericUtility.getColumnValue("ref_id", dom);
refSer = genericUtility.getColumnValue("ref_ser", dom);
......@@ -1702,7 +1728,7 @@ public class ShipmentLocIC extends ValidatorEJB implements ShipmentLocICLocal, S
pstmt = null;
}
else if( "P-ORD".equalsIgnoreCase(refSer)) // ls_refser = 'P-ORD' Then
else if("P-ORD".equalsIgnoreCase(refSer)) // ls_refser = 'P-ORD' Then
{
sql = " select tran_code , curr_code , 0 , curr_code__frt , " +
" ord_date , site_code__ord , exch_rate , site_code__dlv " +
......@@ -1763,7 +1789,7 @@ public class ShipmentLocIC extends ValidatorEJB implements ShipmentLocICLocal, S
}
else if( "D-ISS".equalsIgnoreCase(refSer)) // ls_refser = 'D-ISS' Then
else if("D-ISS".equalsIgnoreCase(refSer)) // ls_refser = 'D-ISS' Then
{
sql = " Select tran_code , curr_code , no_art , curr_code__frt ," +
" tran_date , site_code , exch_rate , site_code__dlv , " +
......@@ -1826,10 +1852,12 @@ public class ShipmentLocIC extends ValidatorEJB implements ShipmentLocICLocal, S
pstmt = null;
}
else if ( "C-ISS".equalsIgnoreCase(refSer)) // for c-iss
else if ("C-ISS".equalsIgnoreCase(refSer)) // for c-iss
{
sql = " Select tran_code, curr_code, no_art, curr_code__frt, issue_date, site_code__ord," +
sql = " Select tran_code, curr_code, no_art, " +
// " curr_code__frt, " +
" issue_date, site_code__ord," +
" exch_rate, site_code__req, gross_weight" +
// ", net_weight , tare_weight " +
" From CONSUME_ISS Where cons_issue = ? ";
......@@ -1842,7 +1870,7 @@ public class ShipmentLocIC extends ValidatorEJB implements ShipmentLocICLocal, S
tranCode = rs.getString("tran_code");
currCode = rs.getString("curr_code");
noArt = rs.getInt("no_art");
currCodeFrt = rs.getString("curr_code__frt");
// currCodeFrt = rs.getString("curr_code__frt");
despDate = rs.getTimestamp("issue_date");
siteCode = rs.getString("site_code__ord");
exchRateFrt = rs.getDouble("exch_rate");
......@@ -1892,6 +1920,33 @@ public class ShipmentLocIC extends ValidatorEJB implements ShipmentLocICLocal, S
}
//End if
// below code commented in PB code
// This.Setitem(1,'tran_code',ls_tran_code)
// This.SetColumn('tran_code')
// This.triggerevent(itemchanged!)
// This.Setitem(1,'curr_code',ls_curr_code)
// This.SetColumn('curr_code')
// This.triggerevent(itemchanged!)
// This.Setitem(1,'no_art',ll_noart)
// This.Setitem(1,'curr_code__frt',ls_curr_frt)
// This.SetColumn('curr_code__frt')
// This.triggerevent(itemchanged!)
// This.Setitem(1,'exch_rate',ldexchrate)
// This.Setitem(1,'start_dt',ldt_despdt)
// This.Setitem(1,'start_dt_farsi',ls_date)
// This.SetColumn('start_dt')
// This.triggerevent(itemchanged!)
// This.Setitem(1,'stan_code__dlv',ls_stan_code_dlv)
// This.SetColumn('stan_code__dlv')
// This.triggerevent(itemchanged!)
// This.Setitem(1,'stan_code__ship',ls_stan_code_fr)
// This.SetColumn('stan_code__ship')
// This.triggerevent(itemchanged!)
// This.Setitem(1,'curr_code__bc',ls_curr_bc)
// This.SetColumn('curr_code__bc')
// This.triggerevent(itemchanged!)
// This.SetColumn("ref_id")
}
valueXmlString.append("</Detail4>");
......
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