Commit 8f3c1ccb authored by cpatil's avatar cpatil

code rearrange and modify for pricelist issue at client side on 10 jun 15


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@98101 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 22afe201
......@@ -34,6 +34,7 @@ public class PriceListPos extends ValidatorEJB implements PriceListPosLocal, Pri
{
if (xmlString1 != null && xmlString1.trim().length() > 0)
{
System.out.println("@@@@@@@@ xmlString1["+xmlString1+"]xtraParams["+xtraParams+"]");
returnVal = generatePriceList( xmlString1, xtraParams, conn );
}
}
......@@ -148,6 +149,91 @@ public class PriceListPos extends ValidatorEJB implements PriceListPosLocal, Pri
java.sql.Timestamp effFrom = Timestamp.valueOf(genericUtility.getValidDateString(pricelistEffRom, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00.0");
java.sql.Timestamp validUpto = Timestamp.valueOf(genericUtility.getValidDateString(pricelistValidUpto, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00.0");
// logic merge by cpatil on 12/06/12 start
sql = "SELECT count( 1 ) from pricelist where "
+" PRICE_LIST = ? "
+" AND ITEM_CODE = ? "
// +" AND LIST_TYPE = ? "
+" AND ( ? between EFF_FROM AND VALID_UPTO) "
// +" and slab_no not in ( ? ) and unit not in ( ? ) and list_type not in ( ? ) ";
+" and EFF_FROM not in ( ? ) and VALID_UPTO not in ( ? ) "; // added by cpatil 15/06/15
chkPlpstmt = conn.prepareStatement( sql );
chkPlpstmt.setString( 1, pricelistMrp.trim() ); // cpatil pricelstGen
chkPlpstmt.setString( 2, pricelistItemCode.trim() );
//chkPlpstmt.setString( 3, pricelistListype.trim() );
chkPlpstmt.setTimestamp (3, effFrom );
chkPlpstmt.setTimestamp (4, effFrom );
chkPlpstmt.setTimestamp (5, validUpto );
chkPlrs = chkPlpstmt.executeQuery();
if(chkPlrs.next())
{
plCount = chkPlrs.getInt( 1 );
}
chkPlrs.close();
chkPlrs = null;
System.out.println("@@@@@@ plCount["+plCount+"]");
if(plCount > 0)
{
sql = "update pricelist set "
+" valid_upto = ? "
+" where price_list = ? "
+" AND item_code = ? "
//+" AND LIST_TYPE = ?"
+" AND ( ? between EFF_FROM AND VALID_UPTO) "
+" and EFF_FROM not in ( ? ) and VALID_UPTO not in ( ? ) "; // added by cpatil 15/06/15
dateOverpstmt = conn.prepareStatement( sql );
String effFromAppl = genericUtility.getValidDateString(effFrom.toString(), genericUtility.getDBDateFormat(), genericUtility.getApplDateFormat());
Calendar calender = Calendar.getInstance();
java.text.SimpleDateFormat sdtf = new java.text.SimpleDateFormat( genericUtility.getApplDateFormat() );
java.util.Date effFromCal = sdtf.parse( effFromAppl );
calender.setTime( effFromCal );
calender.add( calender.DATE, -1 );
java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat( genericUtility.getDBDateFormat() );
java.sql.Date effectFrom = java.sql.Date.valueOf( sdf.format( calender.getTime() ) );
Timestamp effectFromTS = Timestamp.valueOf(genericUtility.getValidDateString(effectFrom.toString(), genericUtility.getDBDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00.0");
dateOverpstmt.setTimestamp (1, effectFromTS );
dateOverpstmt.setString( 2, pricelistMrp ); // cpatil pricelstGen
dateOverpstmt.setString( 3, pricelistItemCode );
//dateOverpstmt.setString( 4, pricelistListype );
dateOverpstmt.setTimestamp (4, effFrom );
dateOverpstmt.setTimestamp (5, effFrom );
dateOverpstmt.setTimestamp (6, validUpto );
updtCnt = dateOverpstmt.executeUpdate();
dateOverpstmt.close();
dateOverpstmt = null;
/*
sql = "update pricelist set "
+" valid_upto = ? "
+" where price_list = ? "
+" AND item_code = ? "
+" AND ( ? between EFF_FROM AND VALID_UPTO) "
+" AND slab_no <> ? ";
dateOverpstmt = conn.prepareStatement( sql );
dateOverpstmt.setTimestamp (1, effectFromTS );
dateOverpstmt.setString( 2, pricelistMrp );
dateOverpstmt.setString( 3, pricelistItemCode );
//dateOverpstmt.setString( 4, pricelistListype );
dateOverpstmt.setTimestamp (4, effFrom );
dateOverpstmt.setInt (5, slabNo );
updtCnt = dateOverpstmt.executeUpdate();
*/
}
// end by cpatil // added by cpatil 15/06/15
// if( plCount < 0 ) // added for testing
// {
sql = "SELECT tran_id, price_list "
+" FROM pricelist_gen_hdr "
+" WHERE price_list__mrp = ? ";
......@@ -205,6 +291,20 @@ public class PriceListPos extends ValidatorEJB implements PriceListPosLocal, Pri
if(plCount > 0)
{
String effFromAppl = genericUtility.getValidDateString(effFrom.toString(), genericUtility.getDBDateFormat(), genericUtility.getApplDateFormat());
Calendar calender = Calendar.getInstance();
java.text.SimpleDateFormat sdtf = new java.text.SimpleDateFormat( genericUtility.getApplDateFormat() );
java.util.Date effFromCal = sdtf.parse( effFromAppl );
calender.setTime( effFromCal );
calender.add( calender.DATE, -1 );
java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat( genericUtility.getDBDateFormat() );
java.sql.Date effectFrom = java.sql.Date.valueOf( sdf.format( calender.getTime() ) );
Timestamp effectFromTS = Timestamp.valueOf(genericUtility.getValidDateString(effectFrom.toString(), genericUtility.getDBDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00.0");
/* // commented by cpatil beacause code shifted above i.e. before pricelist_gen_hdr sql
sql = "update pricelist set "
+" valid_upto = ? "
+" where price_list = ? "
......@@ -235,6 +335,7 @@ public class PriceListPos extends ValidatorEJB implements PriceListPosLocal, Pri
dateOverpstmt.close();
dateOverpstmt = null;
*/
sql = "update pricelist set "
+" valid_upto = ? "
+" where price_list = ? "
......@@ -323,12 +424,16 @@ public class PriceListPos extends ValidatorEJB implements PriceListPosLocal, Pri
}
pstmt.close();
pstmt = null;
// } // added for testing
}
}
catch (Exception e)
{
try
{
System.out.println("@@@@@@@@ conn.rollback().........");
conn.rollback();
e.printStackTrace();
}
......@@ -354,6 +459,7 @@ public class PriceListPos extends ValidatorEJB implements PriceListPosLocal, Pri
}
if(retString.equals("VTSUCCSS"))
{
System.out.println("@@@@@@@@ conn.commit().........");
retString = itmDBAccessEJB.getErrorString("",retString,userId);
conn.commit();
}
......
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