Commit 1a1b01af authored by ppatro's avatar ppatro

validation price list asn confirmation.


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@92558 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 1363e1c5
...@@ -15,6 +15,7 @@ import java.util.Date; ...@@ -15,6 +15,7 @@ import java.util.Date;
import java.util.*; import java.util.*;
import java.text.*; import java.text.*;
import java.sql.*; import java.sql.*;
import javax.ejb.*; import javax.ejb.*;
import ibase.webitm.ejb.MasterStatefulLocal; import ibase.webitm.ejb.MasterStatefulLocal;
import javax.naming.InitialContext; import javax.naming.InitialContext;
...@@ -40,7 +41,18 @@ public class AsnConf extends ActionHandlerEJB implements AsnConfLocal, AsnConfRe ...@@ -40,7 +41,18 @@ public class AsnConf extends ActionHandlerEJB implements AsnConfLocal, AsnConfRe
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
Connection conn = null; Connection conn = null;
String errString = ""; String errString = "";
//Changed by sumit 24/01/13 start.
String suppCode = "",qtyStr = "", priceList = "";
String itemCode = "";
double quantity = 0.0, rate = 0.0;
java.util.Date currDate = null;
String dbDateFormat = null;
String applDateFormat = null;
DateFormat dateFormat = null;
String currDateStr = null;
PreparedStatement pstmt1 = null;
ResultSet rs1 = null;
//Changed by sumit 24/01/13 end.
ITMDBAccessEJB itmdbAccess = new ITMDBAccessEJB(); ITMDBAccessEJB itmdbAccess = new ITMDBAccessEJB();
try try
...@@ -81,6 +93,66 @@ public class AsnConf extends ActionHandlerEJB implements AsnConfLocal, AsnConfRe ...@@ -81,6 +93,66 @@ public class AsnConf extends ActionHandlerEJB implements AsnConfLocal, AsnConfRe
errString = itmdbAccess.getErrorString("","ASNCONFEMD",loginEmpCode); errString = itmdbAccess.getErrorString("","ASNCONFEMD",loginEmpCode);
return errString; return errString;
} }
//Changed by sumit on 23/01/13 To add price list validation at confirmation.start
currDate = new java.util.Date();
dbDateFormat = genericUtility.getDBDateFormat();
applDateFormat = genericUtility.getApplDateFormat();
dateFormat = new SimpleDateFormat(applDateFormat);
currDateStr = dateFormat.format(currDate);
SimpleDateFormat simpleDateFormatDB = new SimpleDateFormat(genericUtility.getDBDateFormat());
Timestamp timestamp = Timestamp.valueOf(simpleDateFormatDB.format(currDate).toString() + " 00:00:00.0");
sql = "SELECT AH.SUPP_CODE, AD.QUANTITY, AD.ITEM_CODE FROM ASN_HDR AH, ASN_DET AD WHERE AH.TRAN_ID = ? AND AH.TRAN_ID = AD.TRAN_ID";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranId);
rs = pstmt.executeQuery();
while( rs.next())
{
suppCode = rs.getString("SUPP_CODE");
quantity = rs.getDouble("QUANTITY");
itemCode = rs.getString("ITEM_CODE");
System.out.println(" suppCode ["+suppCode+"] quantity ["+quantity+"] itemCode ["+itemCode+"]");
sql = " SELECT PRICE_LIST FROM SUPPLIER WHERE SUPP_CODE = ?";
pstmt1 = conn.prepareStatement(sql);
pstmt1.setString(1, suppCode);
rs1 = pstmt1.executeQuery();
if( rs1.next() )
{
priceList = rs1.getString("PRICE_LIST");
}
rs1.close(); rs1 = null;
pstmt1.close(); pstmt1 = null;
sql="select rate from pricelist where item_code = ? and price_list= ? and ? >= eff_from and ? <= valid_upto ";
pstmt1 = conn.prepareStatement(sql);
pstmt1.setString(1, itemCode);// item_code
pstmt1.setString(2,checkNull(priceList));
pstmt1.setTimestamp(3,timestamp);
pstmt1.setTimestamp(4,timestamp );
rs1 = pstmt1.executeQuery();
if( rs1.next() )
{
rate = rs1.getDouble("rate");
}
rs1.close(); rs1 = null;
pstmt1.close(); pstmt1 = null;
if ( rate == 0 )
{
/*// 26/10/11 manoharan all the errors should be returned so that warnings can be processed
//errString = getErrorString("rate","INVRATE",userId);
errList.add( "INVRATE" );
errFields.add( childNodeName.toLowerCase() );*/
errString = itmdbAccess.getErrorString("","INVRATE",loginEmpCode);
return errString;
}
}
rs.close(); rs = null;
pstmt.close(); pstmt = null;
//Changed by sumit on 23/01/13 To add price list validation at confirmation.end
sql = "UPDATE ASN_HDR SET CONFIRMED = 'Y', CONF_DATE = ?, EMP_CODE__APRV = ? WHERE TRAN_ID = ?"; sql = "UPDATE ASN_HDR SET CONFIRMED = 'Y', CONF_DATE = ?, EMP_CODE__APRV = ? WHERE TRAN_ID = ?";
pstmt = conn.prepareStatement( sql ); pstmt = conn.prepareStatement( sql );
pstmt.setTimestamp(1, Timestamp.valueOf( confDateStr ) ); pstmt.setTimestamp(1, Timestamp.valueOf( confDateStr ) );
...@@ -95,7 +167,7 @@ public class AsnConf extends ActionHandlerEJB implements AsnConfLocal, AsnConfRe ...@@ -95,7 +167,7 @@ public class AsnConf extends ActionHandlerEJB implements AsnConfLocal, AsnConfRe
{ {
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
} }
// 16/10/11 manoharan call po generation here // 16/10/11 manoharan call po generation here
errString = generatePurcOrder(tranId, xtraParams, forcedFlag, conn); errString = generatePurcOrder(tranId, xtraParams, forcedFlag, conn);
...@@ -1283,13 +1355,6 @@ public class AsnConf extends ActionHandlerEJB implements AsnConfLocal, AsnConfRe ...@@ -1283,13 +1355,6 @@ public class AsnConf extends ActionHandlerEJB implements AsnConfLocal, AsnConfRe
} }
*/ */
} }
//Chnaged By Pragyan 18/01/13 To gererate error if PO not generated.start
else
{
errString = itmdbAccess.getErrorString("","ERRGENPOD",userId);
return errString;
}
//Chnaged By Pragyan 18/01/13 To gererate error if PO not generated.start
} }
} }
else else
......
...@@ -435,6 +435,8 @@ public class AsnIC extends ValidatorEJB implements AsnICRemote,AsnICLocal ...@@ -435,6 +435,8 @@ public class AsnIC extends ValidatorEJB implements AsnICRemote,AsnICLocal
rs = null; rs = null;
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
/*
suppCode = genericUtility.getColumnValue( "supp_code", dom1 ); suppCode = genericUtility.getColumnValue( "supp_code", dom1 );
qtyStr = genericUtility.getColumnValue( "quantity", dom ); qtyStr = genericUtility.getColumnValue( "quantity", dom );
...@@ -458,7 +460,7 @@ public class AsnIC extends ValidatorEJB implements AsnICRemote,AsnICLocal ...@@ -458,7 +460,7 @@ public class AsnIC extends ValidatorEJB implements AsnICRemote,AsnICLocal
rs.close(); rs = null; rs.close(); rs = null;
pstmt.close(); pstmt = null; pstmt.close(); pstmt = null;
/*
rate = distComm.pickRate( priceList, currDateStr, columnValue, " ", "L", quantity, conn ); rate = distComm.pickRate( priceList, currDateStr, columnValue, " ", "L", quantity, conn );
if ( rate <= 0 ) if ( rate <= 0 )
{ {
...@@ -473,7 +475,9 @@ public class AsnIC extends ValidatorEJB implements AsnICRemote,AsnICLocal ...@@ -473,7 +475,9 @@ public class AsnIC extends ValidatorEJB implements AsnICRemote,AsnICLocal
// sql = " select rate from pricelist where item_code = ? and price_list=? ; // sql = " select rate from pricelist where item_code = ? and price_list=? ;
//changed by shamim as per mail on 5/sep/12 by manoharan Sir //changed by shamim as per mail on 5/sep/12 by manoharan Sir
sql="select rate from pricelist where item_code = ? and price_list= ? and ? >= eff_from and ? <= valid_upto ";
//Changed by sumit on 24/01/13 this validation will now happen on confirmation start.
/*sql="select rate from pricelist where item_code = ? and price_list= ? and ? >= eff_from and ? <= valid_upto ";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, columnValue); pstmt.setString(1, columnValue);
pstmt.setString(2,checkNull(priceList)); pstmt.setString(2,checkNull(priceList));
...@@ -494,8 +498,8 @@ public class AsnIC extends ValidatorEJB implements AsnICRemote,AsnICLocal ...@@ -494,8 +498,8 @@ public class AsnIC extends ValidatorEJB implements AsnICRemote,AsnICLocal
errList.add( "INVRATE" ); errList.add( "INVRATE" );
errFields.add( childNodeName.toLowerCase() ); errFields.add( childNodeName.toLowerCase() );
// end 26/10/11 manoharan all the errors should be returned so that warnings can be processed // end 26/10/11 manoharan all the errors should be returned so that warnings can be processed
} }*/
//Changed by sumit on 24/01/13 this validation will now happen on confirmation end.
//end by shamim //end by shamim
} }
......
...@@ -227,7 +227,7 @@ public class PalletNoIC extends ValidatorEJB implements PalletNoICLocal, PalletN ...@@ -227,7 +227,7 @@ public class PalletNoIC extends ValidatorEJB implements PalletNoICLocal, PalletN
// 14/09/12 manoharan new trf_status to be maintained // 14/09/12 manoharan new trf_status to be maintained
//sql = "SELECT COUNT(1) FROM PICK_ISS_HDR WHERE PALLET_NO = ? AND PICK_TYPE = 'A'"; //sql = "SELECT COUNT(1) FROM PICK_ISS_HDR WHERE PALLET_NO = ? AND PICK_TYPE = 'A'";
sql="SELECT COUNT(1) FROM PALLET_NO WHERE PALLET_NO = ? "; sql="SELECT PALLET_NO FROM PALLET_NO WHERE PALLET_NO = ? ";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, palletNoDom.trim()); pstmt.setString(1, palletNoDom.trim());
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
......
...@@ -29345,6 +29345,8 @@ INSERT INTO SYSTEM_SERVICE_ARGS ( ...@@ -29345,6 +29345,8 @@ INSERT INTO SYSTEM_SERVICE_ARGS (
COMMIT; COMMIT;
UPDATE MESSAGES SET MSG_STR = 'Invalid ptcn Number', MSG_DESCR ='Ship consignee group are not same for entered ptcn numbers.'
WHERE MSG_NO ='INVSHIPCON';
COMMIT; 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