Commit ab88b72d authored by cpatil's avatar cpatil

modify for date issue exception


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@101776 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 0ad4c6c3
...@@ -138,6 +138,8 @@ POrderICRemote, POrderICLocal { ...@@ -138,6 +138,8 @@ POrderICRemote, POrderICLocal {
Node parentNode4 = null; Node parentNode4 = null;
Node childNode4 = null; Node childNode4 = null;
Timestamp ordDate2=null,ordDated2=null;
StringBuffer errStringXml = new StringBuffer( StringBuffer errStringXml = new StringBuffer(
"<?xml version=\"1.0\"?>\r\n<Root><Errors>"); "<?xml version=\"1.0\"?>\r\n<Root><Errors>");
try { try {
...@@ -1417,6 +1419,11 @@ POrderICRemote, POrderICLocal { ...@@ -1417,6 +1419,11 @@ POrderICRemote, POrderICLocal {
discount = checkNull(genericUtility.getColumnValue("discount", dom)); discount = checkNull(genericUtility.getColumnValue("discount", dom));
taxAmt = genericUtility.getColumnValue("tax_amt", dom); taxAmt = genericUtility.getColumnValue("tax_amt", dom);
if( ordDate != null && ordDate.trim().length() > 0)
{
ordDate2 = Timestamp.valueOf(genericUtility.getValidDateString(ordDate, genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat()) + " 00:00:00.0");
}
if (purcOrder == null || purcOrder.trim().length() == 0) { if (purcOrder == null || purcOrder.trim().length() == 0) {
purcOrder = "@@@"; purcOrder = "@@@";
} }
...@@ -1707,9 +1714,13 @@ POrderICRemote, POrderICLocal { ...@@ -1707,9 +1714,13 @@ POrderICRemote, POrderICLocal {
} }
if (errcode == null if (errcode == null
|| errcode.trim().length() == 0) { || errcode.trim().length() == 0) {
sql = "select count(*) from project where proj_code = ? and (ordDate between start_date and end_date or ordDate between start_date and ext_end_date)"; sql = "select count(*) from project where proj_code = ? " +
" and ( ? between start_date and end_date " +
" or ? between start_date and ext_end_date )";
pStmt = conn.prepareStatement(sql); pStmt = conn.prepareStatement(sql);
pStmt.setString(1, projCode); pStmt.setString(1, projCode);
pStmt.setTimestamp(2, ordDate2);
pStmt.setTimestamp(3, ordDate2);
rs = pStmt.executeQuery(); rs = pStmt.executeQuery();
if (rs.next()) { if (rs.next()) {
cnt = rs.getInt(1); cnt = rs.getInt(1);
...@@ -3590,15 +3601,22 @@ POrderICRemote, POrderICLocal { ...@@ -3590,15 +3601,22 @@ POrderICRemote, POrderICLocal {
pStmt.close(); pStmt.close();
pStmt = null; pStmt = null;
java.sql.Date ordDated = (java.sql.Date) sdf //java.sql.Date ordDated = (java.sql.Date) sdf.parse(ordDate);
.parse(ordDate); if( ordDate != null && ordDate.trim().length() > 0)
{
ordDated2 = Timestamp.valueOf(genericUtility.getValidDateString(ordDate, genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat()) + " 00:00:00.0");
}
if (lopReqd == "Y") { if (lopReqd == "Y") {
sql = "Select count(1) From lop_hdr a, lop_det b Where a.lop_ref_no = b.lop_ref_no And" sql = "Select count(1) From lop_hdr a, lop_det b Where a.lop_ref_no = b.lop_ref_no And"
+ "a.site_code = :ls_site_code And a.confirmed = 'Y' And b.item_code = :ls_itemCode And b.item_status ='A' And" + "a.site_code = :ls_site_code And a.confirmed = 'Y' And b.item_code = :ls_itemCode And b.item_status ='A' And"
+ "? >= a.valid_from And ? <= a.valid_to And b.buy_sell_flag In ('P','B');"; + "? >= a.valid_from And ? <= a.valid_to And b.buy_sell_flag In ('P','B');";
pStmt = conn.prepareStatement(sql); pStmt = conn.prepareStatement(sql);
pStmt.setDate(1, ordDated); pStmt.setTimestamp(1, ordDated2);
pStmt.setDate(2, ordDated); pStmt.setTimestamp(2, ordDated2);
//pStmt.setDate(1, ordDated);
//pStmt.setDate(2, ordDated);
rs = pStmt.executeQuery(); rs = pStmt.executeQuery();
if (rs.next()) { if (rs.next()) {
...@@ -3702,10 +3720,18 @@ POrderICRemote, POrderICLocal { ...@@ -3702,10 +3720,18 @@ POrderICRemote, POrderICLocal {
} }
} }
java.sql.Date ordDated = (java.sql.Date) sdf //java.sql.Date ordDated = (java.sql.Date) sdf.parse(ordDate);
.parse(ordDate); //java.sql.Date purcOrderd = (java.sql.Date) sdf.parse(purcOrder);
java.sql.Date purcOrderd = (java.sql.Date) sdf
.parse(purcOrder); if( ordDate != null && ordDate.trim().length() > 0)
{
ordDated2 = Timestamp.valueOf(genericUtility.getValidDateString(ordDate, genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat()) + " 00:00:00.0");
}
if( ordDate != null && ordDate.trim().length() > 0)
{
ordDated2 = Timestamp.valueOf(genericUtility.getValidDateString(ordDate, genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat()) + " 00:00:00.0");
}
sql = "select a.status, case when b.quantity is null then 0 else b.quantity end,case when b.qty_used is null then 0 else b.qty_used end" sql = "select a.status, case when b.quantity is null then 0 else b.quantity end,case when b.qty_used is null then 0 else b.qty_used end"
+ "From ct3form_hdr a , ct3form_det b Where a.form_no = b.form_no And a.site_code = ? And b.supp_code = ? And b.item_code = ?" + "From ct3form_hdr a , ct3form_det b Where a.form_no = b.form_no And a.site_code = ? And b.supp_code = ? And b.item_code = ?"
+ "And ? >= a.eff_from And ? <= a.valid_upto And b.purc_order = ? And b.line_no = ? And a.status = 'O'" + "And ? >= a.eff_from And ? <= a.valid_upto And b.purc_order = ? And b.line_no = ? And a.status = 'O'"
...@@ -3714,9 +3740,12 @@ POrderICRemote, POrderICLocal { ...@@ -3714,9 +3740,12 @@ POrderICRemote, POrderICLocal {
pStmt.setString(1, siteCode); pStmt.setString(1, siteCode);
pStmt.setString(2, suppCode); pStmt.setString(2, suppCode);
pStmt.setString(3, itemCode); pStmt.setString(3, itemCode);
pStmt.setDate(3, ordDated); pStmt.setTimestamp(3, ordDated2);
pStmt.setDate(4, ordDated); pStmt.setTimestamp(4, ordDated2);
pStmt.setDate(5, purcOrderd); //pStmt.setDate(3, ordDated);
//pStmt.setDate(4, ordDated);
//pStmt.setDate(5, purcOrderd);
pStmt.setString(5, purcOrder);
pStmt.setString(6, lineNo); pStmt.setString(6, lineNo);
rs = pStmt.executeQuery(); rs = pStmt.executeQuery();
if (rs.next()) { if (rs.next()) {
...@@ -4553,7 +4582,7 @@ POrderICRemote, POrderICLocal { ...@@ -4553,7 +4582,7 @@ POrderICRemote, POrderICLocal {
return errStringXml.toString(); return errStringXml.toString();
} }
private String checkrate(Document dom, Connection conn) throws SQLException { private String checkrate(Document dom, Connection conn) throws Exception {
// TODO Auto-generated method stub // TODO Auto-generated method stub
System.out.println("Inside checkrate ........"); System.out.println("Inside checkrate ........");
String errcode = ""; String errcode = "";
...@@ -4575,6 +4604,8 @@ POrderICRemote, POrderICLocal { ...@@ -4575,6 +4604,8 @@ POrderICRemote, POrderICLocal {
DistCommon DistCommon = new DistCommon(); DistCommon DistCommon = new DistCommon();
ArrayList ratestduomArr = new ArrayList(); ArrayList ratestduomArr = new ArrayList();
Timestamp orddate2= null;
try { try {
lsValue = DistCommon.getDisparams("999999", "UOM_ROUND", conn); lsValue = DistCommon.getDisparams("999999", "UOM_ROUND", conn);
...@@ -4631,18 +4662,24 @@ POrderICRemote, POrderICLocal { ...@@ -4631,18 +4662,24 @@ POrderICRemote, POrderICLocal {
Double.parseDouble(convrtuomstduom), conn); Double.parseDouble(convrtuomstduom), conn);
} }
if( orddate!=null && orddate.trim().length() > 0)
{
orddate2 = Timestamp.valueOf(genericUtility.getValidDateString(orddate, genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat()) + " 00:00:00.0");
}
sql = "select porddet.purc_order, porder.ord_date, porddet.rate__stduom from porddet, porder " sql = "select porddet.purc_order, porder.ord_date, porddet.rate__stduom from porddet, porder "
+ " where ( porddet.purc_order = porder.purc_order ) and ( ( porddet.site_code = ? ) and " + " where ( porddet.purc_order = porder.purc_order ) and ( ( porddet.site_code = ? ) and "
+ " ( porddet.item_code = ? ) and ( porder.ord_date < ? ) ) order by porder.ord_date desc "; + " ( porddet.item_code = ? ) and ( porder.ord_date < ? ) ) order by porder.ord_date desc ";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, sitecode); pstmt.setString(1, sitecode);
pstmt.setString(2, itemCode); pstmt.setString(2, itemCode);
pstmt.setString(3, orddate); pstmt.setTimestamp(3, orddate2);
//pstmt.setString(3, orddate);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
while (rs.next()) { while (rs.next()) {
lspurcorder = rs.getString(1); lspurcorder = rs.getString(1);
ldtorddate = rs.getDate(1); ldtorddate = rs.getDate(2);
lctemprate = rs.getDouble(1); lctemprate = rs.getDouble(3);
} }
rs.close(); rs.close();
rs = null; rs = null;
...@@ -4812,6 +4849,8 @@ POrderICRemote, POrderICLocal { ...@@ -4812,6 +4849,8 @@ POrderICRemote, POrderICLocal {
// cpatil end // cpatil end
Timestamp ordDate2=null;
try try
{ {
sdf = new SimpleDateFormat(genericUtility.getApplDateFormat()); sdf = new SimpleDateFormat(genericUtility.getApplDateFormat());
...@@ -5811,7 +5850,7 @@ POrderICRemote, POrderICLocal { ...@@ -5811,7 +5850,7 @@ POrderICRemote, POrderICLocal {
} }
if(currentColumn.trim().equals( "cr_term" )) if(currentColumn.trim().equals( "cr_term" ))
{ {
mcode = checkNull(genericUtility.getColumnValue("dept_code", dom)); mcode = checkNull(genericUtility.getColumnValue("cr_term", dom));
sql = "select descr from crterm where cr_term = ? "; sql = "select descr from crterm where cr_term = ? ";
pStmt= conn.prepareStatement(sql); pStmt= conn.prepareStatement(sql);
...@@ -5825,6 +5864,7 @@ POrderICRemote, POrderICLocal { ...@@ -5825,6 +5864,7 @@ POrderICRemote, POrderICLocal {
rs = null; rs = null;
pStmt.close(); pStmt.close();
pStmt = null; pStmt = null;
valueXmlString.append("<crterm_descr>").append("<![CDATA[" + descr + "]]>").append("</crterm_descr>"); valueXmlString.append("<crterm_descr>").append("<![CDATA[" + descr + "]]>").append("</crterm_descr>");
} }
if(currentColumn.trim().equals( "curr_code__frt" )) if(currentColumn.trim().equals( "curr_code__frt" ))
...@@ -8377,10 +8417,17 @@ POrderICRemote, POrderICLocal { ...@@ -8377,10 +8417,17 @@ POrderICRemote, POrderICLocal {
siteCode = checkNull(genericUtility.getColumnValue("site_code", dom)); siteCode = checkNull(genericUtility.getColumnValue("site_code", dom));
//siteCode = checkNull(genericUtility.getColumnValue("site_code", dom)); //siteCode = checkNull(genericUtility.getColumnValue("site_code", dom));
if( ordDate != null && ordDate.trim().length() > 0)
{
ordDate2 = Timestamp.valueOf(genericUtility.getValidDateString(ordDate, genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat()) + " 00:00:00.0");
}
sql = "select DDF_GET_LASTPURRATE(?,?,?) from dual"; sql = "select DDF_GET_LASTPURRATE(?,?,?) from dual";
pStmt= conn.prepareStatement(sql); pStmt= conn.prepareStatement(sql);
pStmt.setString(1, itemCode); pStmt.setString(1, itemCode);
pStmt.setString(2, ordDate); //pStmt.setString(2, ordDate);
pStmt.setTimestamp(2, ordDate2);
pStmt.setString(3, siteCode); pStmt.setString(3, siteCode);
rs = pStmt.executeQuery(); rs = pStmt.executeQuery();
if(rs.next()) if(rs.next())
...@@ -8397,7 +8444,8 @@ POrderICRemote, POrderICLocal { ...@@ -8397,7 +8444,8 @@ POrderICRemote, POrderICLocal {
sql = "select DDF_GET_PO(?,?,?) from dual"; sql = "select DDF_GET_PO(?,?,?) from dual";
pStmt= conn.prepareStatement(sql); pStmt= conn.prepareStatement(sql);
pStmt.setString(1, itemCode); pStmt.setString(1, itemCode);
pStmt.setString(2, ordDate); //pStmt.setString(2, ordDate);
pStmt.setTimestamp(2, ordDate2);
pStmt.setString(3, siteCode); pStmt.setString(3, siteCode);
rs = pStmt.executeQuery(); rs = pStmt.executeQuery();
if(rs.next()) if(rs.next())
......
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