Commit 8c708d36 authored by cpatil's avatar cpatil

modify for order date


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@96980 ce508802-f39f-4f6c-b175-0d175dae99d5
parent f9897e8f
...@@ -287,7 +287,7 @@ public class RunMRPWiz extends ValidatorEJB implements RunMRPWizLocal, RunMRPWiz ...@@ -287,7 +287,7 @@ public class RunMRPWiz extends ValidatorEJB implements RunMRPWizLocal, RunMRPWiz
String custCode="",custName="",quantity="",unit="",loginSiteCode=""; String custCode="",custName="",quantity="",unit="",loginSiteCode="";
String orderType=""; String orderType="";
java.sql.Date orderDueDate=null; java.sql.Date orderDueDate=null, orderDate = null ;
String itemCodeOnlyList=""; // added 20/11/14 by cpatil String itemCodeOnlyList=""; // added 20/11/14 by cpatil
try try
...@@ -392,6 +392,8 @@ public class RunMRPWiz extends ValidatorEJB implements RunMRPWizLocal, RunMRPWiz ...@@ -392,6 +392,8 @@ public class RunMRPWiz extends ValidatorEJB implements RunMRPWizLocal, RunMRPWiz
{ {
siteCodeTo = genericUtility.getColumnValue("site_code__to",dom1); siteCodeTo = genericUtility.getColumnValue("site_code__to",dom1);
siteCodeFr = genericUtility.getColumnValue("site_code__from",dom1); siteCodeFr = genericUtility.getColumnValue("site_code__from",dom1);
String viewByDate = genericUtility.getColumnValue("viewby_date",dom1);
System.out.println("viewByDate>>>>>" +viewByDate);
System.out.println("siteCodeTo="+siteCodeTo+ " siteCodeFr ="+siteCodeFr); System.out.println("siteCodeTo="+siteCodeTo+ " siteCodeFr ="+siteCodeFr);
//sDateTo = genericUtility.getValidDateString(genericUtility.getColumnValue("date_from",dom1), genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()); //sDateTo = genericUtility.getValidDateString(genericUtility.getColumnValue("date_from",dom1), genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat());
...@@ -413,13 +415,13 @@ public class RunMRPWiz extends ValidatorEJB implements RunMRPWizLocal, RunMRPWiz ...@@ -413,13 +415,13 @@ public class RunMRPWiz extends ValidatorEJB implements RunMRPWizLocal, RunMRPWiz
+" and (sorder.cust_code = customer.cust_code ) " +" and (sorder.cust_code = customer.cust_code ) "
+" and case when sorder.alloc_flag is null then 'N' else sorder.alloc_flag end <> 'Y' "; +" and case when sorder.alloc_flag is null then 'N' else sorder.alloc_flag end <> 'Y' ";
*/ */
sql=" select a.sale_order,a.line_no,a.site_code,a.item_code,a.due_date,a.cust_code,a.cust_name,a.quantity,a.unit,a.type,a.order_due_date from ( " + sql=" select a.sale_order,a.line_no,a.site_code,a.item_code,a.due_date,a.cust_code,a.cust_name,a.quantity,a.unit,a.type,a.order_due_date , a.order_date from ( " +
" SELECT sorditem.sale_order as sale_order,sorditem.line_no as line_no," + " SELECT sorditem.sale_order as sale_order,sorditem.line_no as line_no," +
" sorditem.site_code as site_code," + " sorditem.site_code as site_code," +
" item.item_code__plan as item_code,sorditem.due_date as due_date," + " item.item_code__plan as item_code,sorditem.due_date as due_date," +
" sorder.cust_code as cust_code, customer.cust_name as cust_name ," + " sorder.cust_code as cust_code, customer.cust_name as cust_name ," +
" sorditem.quantity quantity,sorditem.unit unit,'SORD' as type " + " sorditem.quantity quantity,sorditem.unit unit,'SORD' as type " +
" ,sorder.due_date as order_due_date " + " ,sorder.due_date as order_due_date , sorder.order_date " +
" FROM sorder,sorditem, item ,customer" + " FROM sorder,sorditem, item ,customer" +
" WHERE ( sorditem.item_code = item.item_code ) and" + " WHERE ( sorditem.item_code = item.item_code ) and" +
" (sorder.sale_order = sorditem.sale_order )" + " (sorder.sale_order = sorditem.sale_order )" +
...@@ -428,27 +430,81 @@ public class RunMRPWiz extends ValidatorEJB implements RunMRPWizLocal, RunMRPWiz ...@@ -428,27 +430,81 @@ public class RunMRPWiz extends ValidatorEJB implements RunMRPWizLocal, RunMRPWiz
" and (case when sorditem.consume_fc is null then 'Y' else" + " and (case when sorditem.consume_fc is null then 'Y' else" +
" sorditem.consume_fc end = 'N' )" + " sorditem.consume_fc end = 'N' )" +
" and sorditem.site_code >= ? AND sorditem.site_code <= ?" + " and sorditem.site_code >= ? AND sorditem.site_code <= ?" +
" and (sorditem.due_date >= ? ) and (sorditem.due_date <= ? )" + //" and (sorditem.due_date >= ? ) and (sorditem.due_date <= ? )" +
" and ( case when sorder.status is null then 'P' else sorder.status end = 'P')" + " and ( case when sorder.status is null then 'P' else sorder.status end = 'P')" +
" and (sorder.cust_code = customer.cust_code )" + " and (sorder.cust_code = customer.cust_code )" +
" and case when sorder.alloc_flag is null then 'N' else sorder.alloc_flag end <> 'Y' " + " and case when sorder.alloc_flag is null then 'N' else sorder.alloc_flag end <> 'Y' " ;
" UNION ALL" + if("order_date".equalsIgnoreCase(viewByDate))
{
sql = sql + " and ( sorder.order_date >= ? ) and ( sorder.order_date <= ? ) ";
}
else if("due_date".equalsIgnoreCase(viewByDate))
{
sql = sql + " and (sorder.due_date >= ? ) and (sorder.due_date <= ? ) ";
}
else if("both".equalsIgnoreCase(viewByDate))
{
sql = sql+" and ((sorder.order_date >= ? and sorder.order_date <= ? ) or (sorder.due_date >= ? and sorder.due_date <= ? )) ";
}
sql = sql + " UNION ALL" +
" select mps_order.tran_id as sale_order,'1' as" + " select mps_order.tran_id as sale_order,'1' as" +
" line_no,mps_order.site_code as site_code," + " line_no,mps_order.site_code as site_code," +
" item.item_code__plan as item_code,mps_order.due_date due_date,'' as " + " item.item_code__plan as item_code,mps_order.due_date due_date,'' as " +
" cust_code,'' as cust_name, " + " cust_code,'' as cust_name, " +
" mps_order.quantity as quantity,item.unit,'MPS' as type " + " mps_order.quantity as quantity,item.unit,'MPS' as type " +
" ,mps_order.due_date as order_due_date " + " ,mps_order.due_date as order_due_date , mps_order.ord_date as order_date " +
" from mps_order,item where mps_order.item_code=item.item_code " + " from mps_order,item where mps_order.item_code=item.item_code " +
" and ( case when mps_order.status is null then 'P' else " + " and ( case when mps_order.status is null then 'P' else " +
" mps_order.status end in ('P','T','M','N')) " + // added N in condition on 26/06/14 " mps_order.status end in ('P','T','M','N')) " + // added N in condition on 26/06/14
" and mps_order.site_code >= ? AND mps_order.site_code <= ? " + " and mps_order.site_code >= ? AND mps_order.site_code <= ? " ;
" and (mps_order.due_date >= ? ) and (mps_order.due_date <= ? ) " + // " and (mps_order.due_date >= ? ) and (mps_order.due_date <= ? )" ;
// " ) a order by sale_order, line_no " ;
// " ) a " ; if("order_date".equalsIgnoreCase(viewByDate))
" ) a order by order_due_date "; {
sql = sql + " and ( mps_order.ord_date >= ? ) and ( mps_order.ord_date <= ? ) ";
}
else if("due_date".equalsIgnoreCase(viewByDate))
{
sql = sql + " and (mps_order.due_date >= ? ) and (mps_order.due_date <= ? ) ";
}
else if("both".equalsIgnoreCase(viewByDate))
{
sql = sql+" and ( (mps_order.ord_date >= ? and mps_order.ord_date <= ? ) or (mps_order.due_date >= ? and mps_order.due_date <= ? ) ) ";
}
sql = sql + " ) a ";
if("order_date".equalsIgnoreCase(viewByDate))
{
sql = sql + " order by order_date ";
}
else if("due_date".equalsIgnoreCase(viewByDate))
{
sql = sql + " order by order_due_date ";
}
else if("both".equalsIgnoreCase(viewByDate))
{
sql = sql + " order by order_due_date , order_date ";
}
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
if("both".equalsIgnoreCase(viewByDate))
{
pstmt.setString(1,siteCodeFr);
pstmt.setString(2,siteCodeTo);
pstmt.setTimestamp(3,dateFr);
pstmt.setTimestamp(4,dateTo);
pstmt.setTimestamp(5,dateFr);
pstmt.setTimestamp(6,dateTo);
pstmt.setString(7,siteCodeFr);
pstmt.setString(8,siteCodeTo);
pstmt.setTimestamp(9,dateFr);
pstmt.setTimestamp(10,dateTo);
pstmt.setTimestamp(11,dateFr);
pstmt.setTimestamp(12,dateTo);
}
else
{
pstmt.setString(1,siteCodeFr); pstmt.setString(1,siteCodeFr);
pstmt.setString(2,siteCodeTo); pstmt.setString(2,siteCodeTo);
pstmt.setTimestamp(3,dateFr); pstmt.setTimestamp(3,dateFr);
...@@ -457,6 +513,7 @@ public class RunMRPWiz extends ValidatorEJB implements RunMRPWizLocal, RunMRPWiz ...@@ -457,6 +513,7 @@ public class RunMRPWiz extends ValidatorEJB implements RunMRPWizLocal, RunMRPWiz
pstmt.setString(6,siteCodeTo); pstmt.setString(6,siteCodeTo);
pstmt.setTimestamp(7,dateFr); pstmt.setTimestamp(7,dateFr);
pstmt.setTimestamp(8,dateTo); pstmt.setTimestamp(8,dateTo);
}
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
while(rs.next()) while(rs.next())
{ {
...@@ -470,10 +527,14 @@ public class RunMRPWiz extends ValidatorEJB implements RunMRPWizLocal, RunMRPWiz ...@@ -470,10 +527,14 @@ public class RunMRPWiz extends ValidatorEJB implements RunMRPWizLocal, RunMRPWiz
unit = checkNull(rs.getString("unit")); unit = checkNull(rs.getString("unit"));
orderType = checkNull(rs.getString("type")); orderType = checkNull(rs.getString("type"));
orderDueDate = rs.getDate("order_due_date"); // added on 02-07-14 orderDueDate = rs.getDate("order_due_date"); // added on 02-07-14
orderDate = rs.getDate("order_date");
SimpleDateFormat sdf = new SimpleDateFormat(genericUtility.getApplDateFormat()); SimpleDateFormat sdf = new SimpleDateFormat(genericUtility.getApplDateFormat());
String sysDate = sdf.format(orderDueDate); String sysDate = sdf.format(orderDueDate);
System.out.println("Now the order due date is ["+sysDate+"]"); System.out.println("Now the due date is ["+sysDate+"]");
String orderDate1 = sdf.format(orderDate);
System.out.println("Now the order due date is ["+orderDate1+"]");
System.out.println(saleOrder+"@"+lineNo+"@"+itemCode); System.out.println(saleOrder+"@"+lineNo+"@"+itemCode);
domID ++; domID ++;
...@@ -489,6 +550,7 @@ public class RunMRPWiz extends ValidatorEJB implements RunMRPWizLocal, RunMRPWiz ...@@ -489,6 +550,7 @@ public class RunMRPWiz extends ValidatorEJB implements RunMRPWizLocal, RunMRPWiz
valueXmlString.append( "<unit><![CDATA[" ).append(unit).append("]]></unit>\r\n" ); valueXmlString.append( "<unit><![CDATA[" ).append(unit).append("]]></unit>\r\n" );
valueXmlString.append( "<order_type><![CDATA[" ).append(orderType).append("]]></order_type>\r\n" ); valueXmlString.append( "<order_type><![CDATA[" ).append(orderType).append("]]></order_type>\r\n" );
valueXmlString.append( "<due_date><![CDATA[" ).append(sysDate).append("]]></due_date>\r\n" ); valueXmlString.append( "<due_date><![CDATA[" ).append(sysDate).append("]]></due_date>\r\n" );
valueXmlString.append( "<order_date><![CDATA[" ).append(orderDate1).append("]]></order_date>\r\n" );
valueXmlString.append( "</Detail2>\r\n" ); valueXmlString.append( "</Detail2>\r\n" );
} }
...@@ -544,7 +606,7 @@ public class RunMRPWiz extends ValidatorEJB implements RunMRPWizLocal, RunMRPWiz ...@@ -544,7 +606,7 @@ public class RunMRPWiz extends ValidatorEJB implements RunMRPWizLocal, RunMRPWiz
System.out.println("inside for orderType["+orderType+"]"); System.out.println("inside for orderType["+orderType+"]");
} }
/* /*
for ( int ctr1 = 0; ctr1 < detail2List.getLength(); ctr1++ ) //Loop for each node of current detail for ( int ctr1 = 0; ctr1 < detail2List.getLength(); ctr1++ ) //Loop for each node of current detail
{ {
saleOrder = checkNull(genericUtility.getColumnValueFromNode( "sale_order", detail2List.item(ctr1) )); saleOrder = checkNull(genericUtility.getColumnValueFromNode( "sale_order", detail2List.item(ctr1) ));
...@@ -556,7 +618,7 @@ public class RunMRPWiz extends ValidatorEJB implements RunMRPWizLocal, RunMRPWiz ...@@ -556,7 +618,7 @@ public class RunMRPWiz extends ValidatorEJB implements RunMRPWizLocal, RunMRPWiz
saleOrderList = "'"+saleOrder+"'" ; saleOrderList = "'"+saleOrder+"'" ;
System.out.println("saleOrderList=="+saleOrderList); System.out.println("saleOrderList=="+saleOrderList);
} }
*/ */
//sDateTo = genericUtility.getValidDateString(genericUtility.getColumnValue("date_from",dom1), genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()); //sDateTo = genericUtility.getValidDateString(genericUtility.getColumnValue("date_from",dom1), genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat());
dateFr = java.sql.Timestamp.valueOf(genericUtility.getValidDateString(genericUtility.getColumnValue("date_from",dom1), genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00"); dateFr = java.sql.Timestamp.valueOf(genericUtility.getValidDateString(genericUtility.getColumnValue("date_from",dom1), genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00");
dateTo = java.sql.Timestamp.valueOf(genericUtility.getValidDateString(genericUtility.getColumnValue("date_to",dom1), genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00"); dateTo = java.sql.Timestamp.valueOf(genericUtility.getValidDateString(genericUtility.getColumnValue("date_to",dom1), genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00");
...@@ -624,7 +686,7 @@ public class RunMRPWiz extends ValidatorEJB implements RunMRPWizLocal, RunMRPWiz ...@@ -624,7 +686,7 @@ public class RunMRPWiz extends ValidatorEJB implements RunMRPWizLocal, RunMRPWiz
//System.out.println("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ cp code----start@@@@@@@@@"); //System.out.println("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ cp code----start@@@@@@@@@");
/* /*
System.out.println("@@@@@@@@@@@@@@@@@@@final mrpGetData =[" + mrpGetData + "]@@@@@@@@@@@@@@@@@@@@@@"); System.out.println("@@@@@@@@@@@@@@@@@@@final mrpGetData =[" + mrpGetData + "]@@@@@@@@@@@@@@@@@@@@@@");
if (mrpGetData != null && mrpGetData.trim().length() != 0) if (mrpGetData != null && mrpGetData.trim().length() != 0)
......
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