Commit a238a021 authored by cpatil's avatar cpatil

change logic as per suggestion and removeing ship status condition


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@93936 ce508802-f39f-4f6c-b175-0d175dae99d5
parent e017a85b
...@@ -743,7 +743,7 @@ public class StockAllocationPrc extends ProcessEJB implements StockAllocationPrc ...@@ -743,7 +743,7 @@ public class StockAllocationPrc extends ProcessEJB implements StockAllocationPrc
//CUST_NAME //CUST_NAME
//retTabSepStrBuff.append(rs.getString(2)).append("\t"); //retTabSepStrBuff.append(rs.getString(2)).append("\t");
retTabSepStrBuff.append("<cust_name_2>").append("<![CDATA[" + rs.getString(2) +"]]>").append("</cust_name_2>"); retTabSepStrBuff.append("<cust_name_2>").append("<![CDATA[" + rs.getString(2) +"]]>").append("</cust_name_2>");
//Gtin Case //Gtin Case
//retTabSepStrBuff.append(rs.getString(15)== null?" ":rs.getString(15)).append("\t");// added by Kunal on 22/10/12 //retTabSepStrBuff.append(rs.getString(15)== null?" ":rs.getString(15)).append("\t");// added by Kunal on 22/10/12
retTabSepStrBuff.append("<gtin_case>").append("<![CDATA[" + (rs.getString(15) == null? " ":rs.getString(15)) +"]]>").append("</gtin_case>"); retTabSepStrBuff.append("<gtin_case>").append("<![CDATA[" + (rs.getString(15) == null? " ":rs.getString(15)) +"]]>").append("</gtin_case>");
...@@ -925,13 +925,13 @@ public class StockAllocationPrc extends ProcessEJB implements StockAllocationPrc ...@@ -925,13 +925,13 @@ public class StockAllocationPrc extends ProcessEJB implements StockAllocationPrc
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
Statement st = null; Statement st = null;
int elements = 0,elements1 = 0; int elements = 0,elements1 = 0,cnt=0;
ArrayList list = new ArrayList(); ArrayList list = new ArrayList();
ArrayList list1 = new ArrayList(); ArrayList list1 = new ArrayList();
boolean flag = false,isFlag = true,allocqtyflag = false; boolean flag = false,isFlag = true,allocqtyflag = false,pendingOrderFlag=false;
ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB(); ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB();
String sql = "",shipStatus=""; String sql = "",shipStatus="";
try try
{ {
chgUser = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginCode"); chgUser = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginCode");
...@@ -1049,27 +1049,65 @@ public class StockAllocationPrc extends ProcessEJB implements StockAllocationPrc ...@@ -1049,27 +1049,65 @@ public class StockAllocationPrc extends ProcessEJB implements StockAllocationPrc
elements ++; elements ++;
} }
} //added by ritesh on 07/10/13 for request DI3ESUN009 END } //added by ritesh on 07/10/13 for request DI3ESUN009 END
// added by cpatil on 27/11/13 as per manoj sir instruction start // added by cpatil on 27/11/13 as per manoj sir instruction start
if(saleOrder != null && saleOrder.trim().length() > 0 ) if(saleOrder != null && saleOrder.trim().length() > 0 )
{ {
sql = " select ship_status from sorder where sale_order = ? "; sql = " select count(1) from repl_ord_det d,wave_task w,wave_task_det k" +
" where d.repl_order = k.ref_id and w.wave_id = k.wave_id " +
" and w.cancel <> 'Y' and k.status <>'Y' " +
" and d.cancel_mode IS NULL and d.sale_order = ? " +
" and d.line_no__sord = ? ";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1,saleOrder); pstmt.setString(1,saleOrder);
pstmt.setString(2,lineNo);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if(rs.next()) if(rs.next())
{ {
shipStatus = rs.getString("ship_status"); cnt = rs.getInt(1);
} }
pstmt.close();pstmt = null; pstmt.close();
rs.close();rs = null; pstmt = null;
rs.close();
if( "P".equalsIgnoreCase(shipStatus)) rs = null;
System.out.println("@@@@ first cnt["+cnt+"]");
if( cnt > 0 )
{
pendingOrderFlag = true;
}
else
{
sql = " SELECT count(1) FROM PICK_ORD_DET D,wave_task w,wave_task_det k " +
" WHERE d.PICK_order = k.ref_id and w.wave_id = k.wave_id and w.cancel <> 'Y' " +
" and k.status <>'Y' and D.SALE_ORDER = ? AND D.LINE_NO__ORD = ? " +
" and (D.QUANTITY - (CASE WHEN D.DEALLOC_QTY IS NULL THEN 0 ELSE DEALLOC_QTY END )) > 0 ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,saleOrder);
pstmt.setString(2,lineNo);
rs = pstmt.executeQuery();
if(rs.next())
{
cnt = rs.getInt(1);
}
pstmt.close();
pstmt = null;
rs.close();
rs = null;
System.out.println("@@@@ second cnt["+cnt+"]");
if( cnt > 0)
{
pendingOrderFlag = true;
}
}
System.out.println("@@@@ pendingOrderFlag["+pendingOrderFlag+"] sorder["+saleOrder+"]line no["+lineNo+"]");
if(pendingOrderFlag == true )
{ {
if( allocQty > 0 ) if( allocQty > 0 )
{ {
System.out.println("@@@@@@saleOrder["+saleOrder+"]::shipStatus["+shipStatus+"]::allocQty["+allocQty+"]"); System.out.println("@@@@@@saleOrder["+saleOrder+"]::allocQty["+allocQty+"]");
flag = true; flag = true;
errString = "PROCSUCC"; // "VTALLQTYSO"; errString = "PROCSUCC"; // "VTALLQTYSO";
errString = itmDBAccessEJB.getErrorString("",errString,"","",conn); errString = itmDBAccessEJB.getErrorString("",errString,"","",conn);
...@@ -1079,15 +1117,18 @@ public class StockAllocationPrc extends ProcessEJB implements StockAllocationPrc ...@@ -1079,15 +1117,18 @@ public class StockAllocationPrc extends ProcessEJB implements StockAllocationPrc
if( !(list1.contains(saleOrder))) if( !(list1.contains(saleOrder)))
{ {
isFlag = false; isFlag = false;
list1.add(saleOrder); list.add(saleOrder);
list.add(lineNo);
list.add(itemCode);
list.add(allocQty);
elements1 ++; elements1 ++;
} }
} }
} }
} }
// added by cpatil on 27/11/13 as per manoj sir instruction end // added by cpatil on 27/11/13 as per manoj sir instruction end
if(allocQty > 0 && flag == false) if(allocQty > 0 && flag == false)
{ {
System.out.println("if calling........"); System.out.println("if calling........");
...@@ -1144,14 +1185,18 @@ public class StockAllocationPrc extends ProcessEJB implements StockAllocationPrc ...@@ -1144,14 +1185,18 @@ public class StockAllocationPrc extends ProcessEJB implements StockAllocationPrc
if(elements1 > 0 ) if(elements1 > 0 )
{ {
mainStr = mainStr + "\n pending / incomplete Wave found against sale order.\n"; mainStr = mainStr + "\n pending / incomplete Wave found against sale order.\n";
mainStr = mainStr + "\n Sale Order : ";
} }
for(int i = 0; i < elements1 ;i++) for(int i = 0; i < elements * 4 ;i++)
{ {
mainStr = mainStr + " "+list1.get(i)+ "," ; if( i > 0)
{
i -= 1;
}
mainStr = mainStr +
"sale order :"+list.get(i++)+ ",line no :"+ list.get(i++) + ",item code :"+list.get(i++)+",quantity :"+list.get(i++)+"\n" ;
} }
mainStr = mainStr + endPart; mainStr = mainStr + endPart;
errString = mainStr; errString = mainStr;
begPart =null; begPart =null;
......
...@@ -770,9 +770,9 @@ public class StockDeallocationPrc extends ProcessEJB implements StockDeallocat ...@@ -770,9 +770,9 @@ public class StockDeallocationPrc extends ProcessEJB implements StockDeallocat
String activeAllow = ""; String activeAllow = "";
ArrayList list = new ArrayList(); ArrayList list = new ArrayList();
ArrayList list1 = new ArrayList(); ArrayList list1 = new ArrayList();
boolean flag = false,isFlag = true,allocqtyflag = false; boolean flag = false,isFlag = true,allocqtyflag = false,pendingOrderFlag=false;
double qtyAvailAlloc = 0; double qtyAvailAlloc = 0;
int elements = 0,elements1 = 0; int elements = 0,elements1 = 0,cnt=0;
ConnDriver connDriver = new ConnDriver(); //added by rajendra on 02/11/07 ConnDriver connDriver = new ConnDriver(); //added by rajendra on 02/11/07
ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB(); ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB();
String sql = "",shipStatus=""; String sql = "",shipStatus="";
...@@ -938,24 +938,62 @@ public class StockDeallocationPrc extends ProcessEJB implements StockDeallocat ...@@ -938,24 +938,62 @@ public class StockDeallocationPrc extends ProcessEJB implements StockDeallocat
if( saleOrder != null && saleOrder.trim().length() > 0 ) if( saleOrder != null && saleOrder.trim().length() > 0 )
{ {
sql = " select ship_status from sorder where sale_order = ? "; sql = " select count(1) from repl_ord_det d,wave_task w,wave_task_det k" +
" where d.repl_order = k.ref_id and w.wave_id = k.wave_id " +
" and w.cancel <> 'Y' and k.status <>'Y' " +
" and d.cancel_mode IS NULL and d.sale_order = ? " +
" and d.line_no__sord = ? ";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1,saleOrder); pstmt.setString(1,saleOrder);
pstmt.setString(2,lineNo);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if(rs.next()) if(rs.next())
{ {
shipStatus = rs.getString("ship_status"); cnt = rs.getInt(1);
} }
pstmt.close();pstmt = null; pstmt.close();
rs.close();rs = null; pstmt = null;
rs.close();
if( "P".equalsIgnoreCase(shipStatus)) rs = null;
System.out.println("@@@@ first cnt["+cnt+"]");
if( cnt > 0 )
{
pendingOrderFlag = true;
}
else
{
sql = " SELECT count(1) FROM PICK_ORD_DET D,wave_task w,wave_task_det k " +
" WHERE d.PICK_order = k.ref_id and w.wave_id = k.wave_id and w.cancel <> 'Y' " +
" and k.status <>'Y' and D.SALE_ORDER = ? AND D.LINE_NO__ORD = ? " +
" and (D.QUANTITY - (CASE WHEN D.DEALLOC_QTY IS NULL THEN 0 ELSE DEALLOC_QTY END )) > 0 ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,saleOrder);
pstmt.setString(2,lineNo);
rs = pstmt.executeQuery();
if(rs.next())
{
cnt = rs.getInt(1);
}
pstmt.close();
pstmt = null;
rs.close();
rs = null;
System.out.println("@@@@ second cnt["+cnt+"]");
if( cnt > 0)
{
pendingOrderFlag = true;
}
}
System.out.println("@@@@ pendingOrderFlag["+pendingOrderFlag+"] sorder["+saleOrder+"]line no["+lineNo+"]");
if(pendingOrderFlag == true )
{ {
if( DeallocQty > 0 ) if( DeallocQty > 0 )
{ {
System.out.println("@@@@@@saleOrder["+saleOrder+"]::shipStatus["+shipStatus+"]::DeallocQty["+DeallocQty+"]"); System.out.println("@@@@@@saleOrder["+saleOrder+"]:::DeallocQty["+DeallocQty+"]");
flag = true; flag = true;
errString = "PROCSUCC"; //errString = "VTDALQTYSO"; errString = "PROCSUCC"; // "VTALLQTYSO";
errString = itmDBAccessEJB.getErrorString("",errString,"","",conn); errString = itmDBAccessEJB.getErrorString("",errString,"","",conn);
} }
if( errString != null && errString.trim().length() > 0 && flag == true ) if( errString != null && errString.trim().length() > 0 && flag == true )
...@@ -963,12 +1001,14 @@ public class StockDeallocationPrc extends ProcessEJB implements StockDeallocat ...@@ -963,12 +1001,14 @@ public class StockDeallocationPrc extends ProcessEJB implements StockDeallocat
if( !(list1.contains(saleOrder))) if( !(list1.contains(saleOrder)))
{ {
isFlag = false; isFlag = false;
list1.add(saleOrder); list.add(saleOrder);
list.add(lineNo);
list.add(itemCode);
list.add(DeallocQty);
elements1 ++; elements1 ++;
} }
} }
} }
} }
// added by cpatil on 27/11/13 as per manoj sir instruction end // added by cpatil on 27/11/13 as per manoj sir instruction end
...@@ -1046,12 +1086,16 @@ public class StockDeallocationPrc extends ProcessEJB implements StockDeallocat ...@@ -1046,12 +1086,16 @@ public class StockDeallocationPrc extends ProcessEJB implements StockDeallocat
if(elements1 > 0 ) if(elements1 > 0 )
{ {
mainStr = mainStr + "\n pending / incomplete Wave found against sale order.\n"; mainStr = mainStr + "\n pending / incomplete Wave found against sale order.\n";
mainStr = mainStr + "\n Sale Order : ";
} }
for(int i = 0; i < elements1 ;i++) for(int i = 0; i < elements * 4 ;i++)
{ {
mainStr = mainStr + " "+list1.get(i)+ "," ; if( i > 0)
{
i -= 1;
}
mainStr = mainStr +
"sale order :"+list.get(i++)+ ",line no :"+ list.get(i++) + ",item code :"+list.get(i++)+",quantity :"+list.get(i++)+"\n" ;
} }
mainStr = mainStr + endPart; mainStr = mainStr + endPart;
......
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