Commit c147ae71 authored by cpatil's avatar cpatil

exp_date itemchange modified as per requirement


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@91817 ce508802-f39f-4f6c-b175-0d175dae99d5
parent d6a6f50a
......@@ -3154,12 +3154,188 @@ public class SReturnForm extends ValidatorEJB implements SReturnFormLocal, SRetu
//Added By Mahesh Patidar on 07/05/12 add item change on exp_date
else if (currentColumn.trim().equals( "exp_date" ) )
{
System.out.println("@@@@@ expiry date item change code executed before my code.... ");
reStr = itemChanged(dom, dom1, dom2, objContext, "lot_sl", editFlag, xtraParams);
pos = reStr.indexOf("<Detail2>");
reStr = reStr.substring(pos + 9);
pos = reStr.indexOf("</Detail2>");
reStr = reStr.substring(0,pos);
valueXmlString.append(reStr);
// cpatil start
System.out.println("@@@@@ expiry date item change code executed my code.... ");
String ldExpDateStr = genericUtility.getColumnValue( "exp_date", dom );
System.out.println("@@@@@ in item change ldExpDateStr"+ldExpDateStr);
if (ldExpDateStr != null)
{
java.sql.Timestamp ldExpDate = Timestamp.valueOf(genericUtility.getValidDateString(ldExpDateStr, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00.0");
mitemCode = genericUtility.getColumnValue( "item_code", dom );
lotNo = genericUtility.getColumnValue( "lot_no", dom );
sqlStr = "select shelf_life mshlife "
+" from item_lot_packsize "
+" where item_code = ? "
+" and lot_no__from = ? ";
pstmt = conn.prepareStatement( sqlStr );
pstmt.setString( 1, mitemCode );
pstmt.setString( 2, lotNo );
rs = pstmt.executeQuery();
if( rs.next() )
{
mshlife = rs.getDouble( "mshlife" );
}
else
{
if( rs != null )
rs.close();
rs = null;
if( pstmt != null )
pstmt.close();
pstmt = null;
sqlStr = " select shelf_life mshlife from item where item_code = ? "; //:mitem_code;
pstmt = conn.prepareStatement( sqlStr );
pstmt.setString( 1, mitemCode );
rs = pstmt.executeQuery();
if( rs.next() )
{
mshlife = rs.getDouble( "mshlife" );
}
}
if( rs != null )
rs.close();
rs = null;
if( pstmt != null )
pstmt.close();
pstmt = null;
if( mshlife == 0 )
{
mexpDate = null;
}
else
{
mmfgDate = distCommon.CalcExpiry( ldExpDate, mshlife * -1 );
}
valueXmlString.append("<mfg_date>").append("<![CDATA["+ genericUtility.getValidDateString(mmfgDate.toString(), genericUtility.getDBDateFormat(), genericUtility.getApplDateFormat() ) +"]]>").append("</mfg_date>");
mtranDateStr = genericUtility.getColumnValue( "tran_date", dom1 );
mtranDate = Timestamp.valueOf(genericUtility.getValidDateString(mtranDateStr, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00.0");
mtranDateStr = genericUtility.getColumnValue( "exp_date", dom ); // dw_currobj.getitemdatetime(1, "exp_date")
mexpDate = Timestamp.valueOf(genericUtility.getValidDateString(mtranDateStr, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00.0");
mtranDateStr = genericUtility.getColumnValue( "lr_date", dom1 ); // dw_header.getitemdatetime(1,"lr_date")
if (mtranDateStr == null)
{
mtranDateStr = genericUtility.getColumnValue( "tran_date", dom1 );
}
ldtLrdate = Timestamp.valueOf(genericUtility.getValidDateString(mtranDateStr, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00.0");
if( ldtLrdate == null || "19000101".equals( genericUtility.getValidDateString( mtranDateStr, genericUtility.getApplDateFormat(),"yyyymmdd" ) ) )
{
ldtLrdate = mtranDate;
}
if (ldtLrdate != null && mexpDate != null)
{
mdiffDays = (int)utilMethods.DaysAfter( ldtLrdate, mexpDate );
}
else
{
mdiffDays = 0;
}
mdays = mdiffDays;
custCode = genericUtility.getColumnValue("cust_code",dom1);
//genericUtility.getColumnValue( "cust_code", dom1 ); //dw_header.getitemstring(1,"cust_code")
siteCode = genericUtility.getColumnValue("site_code",dom1);
//genericUtility.getColumnValue( "site_code", dom1 ); // dw_header.getitemstring(1,"site_code")
System.out.println("custCode [" + custCode+ "]");
System.out.println("siteCode [" + siteCode+ "]");
if (custCode != null && siteCode != null )
{
sqlStr = " select channel_partner ls_channel_partner "
+" from site_customer "
+" where cust_code = ? " //:ls_cust_code
+" and site_code = ? "; // :ls_sitecode ;
pstmt = conn.prepareStatement( sqlStr );
pstmt.setString( 1, custCode );
pstmt.setString( 2, siteCode );
rs = pstmt.executeQuery();
if( rs.next() )
{
channelPartner = rs.getString( "ls_channel_partner" );
}
if( rs != null )
rs.close();
rs = null;
if( pstmt != null )
pstmt.close();
pstmt = null;
}
if( channelPartner == null && custCode != null)
{
sqlStr = " select channel_partner ls_channel_partner "
+" from customer "
+" where cust_code = ? "; //:ls_cust_code;
pstmt = conn.prepareStatement( sqlStr );
pstmt.setString( 1, custCode );
rs = pstmt.executeQuery();
if( rs.next() )
{
channelPartner = rs.getString( "ls_channel_partner" );
}
if( rs != null )
rs.close();
rs = null;
if( pstmt != null )
pstmt.close();
pstmt = null;
}
if( channelPartner != null && !"Y".equalsIgnoreCase( channelPartner ) )
{
sqlStr = " select deduct_perc mdisc from sreturn_norms "
+" where days_from <= ? " //:mdays
+" and days_to >= ? "; //:mdays;
pstmt = conn.prepareStatement( sqlStr );
pstmt.setInt( 1, mdays );
pstmt.setInt( 2, mdays );
rs = pstmt.executeQuery();
if( rs.next() )
{
mdisc = rs.getDouble( "mdisc" );
}
if( rs != null )
rs.close();
rs = null;
if( pstmt != null )
pstmt.close();
pstmt = null;
}
}
String lcDiscountStr = genericUtility.getColumnValue( "discount", dom ); // dw_detedit[ii_currformno].getitemnumber(dw_detedit[ii_currformno].getrow(),"discount")
lcDiscount = Double.parseDouble( lcDiscountStr == null || lcDiscountStr.trim().length() == 0 ? "0" : lcDiscountStr.trim() );
valueXmlString.append("<discount>").append("<![CDATA["+ mdisc +"]]>").append("</discount>");
//valueXmlString.append("<exp_date>").append("<![CDATA["+ ldExpDateStr +"]]>").append("</exp_date>");
System.out.println("@@@@@ expiry date item change code end .... ");
// cpatil end
}
//ended By Mahesh Patidar
else if (currentColumn.trim().equals( "stk_opt" ) )
......@@ -4356,7 +4532,7 @@ public class SReturnForm extends ValidatorEJB implements SReturnFormLocal, SRetu
if( childNodeName.equalsIgnoreCase( "exp_date" ) )
{
String mdateStr = genericUtility.getColumnValue( "exp_date", dom );
System.out.println("@@@@@@ in validation mdateStr"+mdateStr);
itemCode = genericUtility.getColumnValue( "item_code", dom );
sqlStr = " select ( case when track_shelf_life is null then 'N' else track_shelf_life end ) ls_track_shelf_life "
+" from item where item_code = ? "; //:ls_item_code;
......@@ -4387,11 +4563,12 @@ public class SReturnForm extends ValidatorEJB implements SReturnFormLocal, SRetu
if( pstmt != null )
pstmt.close();
pstmt = null;
System.out.println("@@@@@ mdateStr out :["+mdateStr+"]["+mdateStr.length());
if( lsTrackShelfLife != null && "Y".equalsIgnoreCase( lsTrackShelfLife.trim() ) )
{
if( mdateStr == null || mdateStr.trim().length() == 0 )
{
System.out.println("@@@@@ mdateStr in if :["+mdateStr+"]["+mdateStr.length());
errCode = "VTEXPDATE1";
//errString = getErrorString( childNodeName, errCode, userId );
//break;
......
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