Commit 04422f78 authored by rtiwari's avatar rtiwari

CHANGE FOR REQUEST DI3GSUN017


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@93765 ce508802-f39f-4f6c-b175-0d175dae99d5
parent d52d1bca
......@@ -14,6 +14,7 @@ import java.io.*;
//import SessionManager.*;
import org.omg.CORBA.ORB;
import org.w3c.dom.*;
import java.util.Properties;
import javax.xml.parsers.*;
import javax.ejb.*;
......@@ -27,13 +28,14 @@ import ibase.webitm.utility.TransIDGenerator;
import ibase.utility.CommonConstants;
import ibase.ejb.*;
import ibase.system.config.*;
import java.text.SimpleDateFormat;
import java.util.*;
import javax.ejb.Stateless; // added for ejb3
@Stateless // added for ejb3
//public class StockDeallocationPrcEJB extends ProcessEJB implements SessionBean
public class StockDeallocationPrc extends ProcessEJB implements StockDeallocationPrcLocal,StockDeallocationPrcRemote //SessionBean
public class StockDeallocationPrc extends ProcessEJB implements StockDeallocationPrcLocal,StockDeallocationPrcRemote //SessionBean
{
String siteCode = null;
String custCodeFr = null;
......@@ -143,6 +145,10 @@ public class StockDeallocationPrc extends ProcessEJB implements StockDeallocatio
String wavesql = "";
//Changed by sumit on 27/11/12 end
String sql1="",waveType="";
PreparedStatement pstmt2 = null;
ResultSet rs2 = null;
Connection conn = null;
ResultSet rs=null,rsDealloc= null,rs1=null;
PreparedStatement pstmt = null ,pstmtDeAlloc=null;
......@@ -313,7 +319,8 @@ public class StockDeallocationPrc extends ProcessEJB implements StockDeallocatio
+" ITEM.GTIN_CASE,SORDITEM.ITEM_CODE,SORDER.SITE_CODE__SHIP ,ITEM.GTIN_UNIT " //added by Kunal on 22/10/12
//Changed by sumit on 26/11/12 retrieve wave flag
+", CASE WHEN SORDALLOC.WAVE_FLAG IS NULL THEN 'N' ELSE SORDALLOC.WAVE_FLAG END AS WAVE_FLAG "
+",SORDDET.UNIT,SORDDET.UNIT__STD,SORDDET.CONV__QTY_STDUOM,SORDDET.QUANTITY__STDUOM "
+",SORDDET.UNIT,SORDDET.UNIT__STD,SORDDET.CONV__QTY_STDUOM,SORDDET.QUANTITY__STDUOM "
+ ",SORDER.CUST_CODE__DLV " //ADD BY RITESH ON 08/10/13
+" FROM SORDDET,SORDALLOC,SORDITEM,CUSTOMER,ITEM, SORDER "
+" WHERE SORDER.SALE_ORDER = SORDDET.SALE_ORDER AND "
+"(SORDALLOC.SALE_ORDER = SORDDET.SALE_ORDER ) AND "
......@@ -431,8 +438,39 @@ public class StockDeallocationPrc extends ProcessEJB implements StockDeallocatio
//dealloc_qty
retTabSepStrBuff.append("<dealloc_qty>").append("<![CDATA[" + rs.getDouble(7) +"]]>").append("</dealloc_qty>");
//HOLD_QTY
//ADD BY RITESH ON 08/10/13 FOR REQUEST START
//active_pick_allow
sql1 = " select wave_type from customer where cust_code = ? ";
pstmt2 = conn.prepareStatement(sql1);
pstmt2.setString(1,rs.getString("CUST_CODE__DLV"));
rs2 = pstmt2.executeQuery();
if(rs2.next())
{
waveType = rs2.getString("wave_type");
}
rs2.close();
rs2 = null;
pstmt2.close();
pstmt2 = null;
sql1 = " select case when ACTIVE_PICK_ALLOW is null then 'Y' else ACTIVE_PICK_ALLOW end as ACTIVE_PICK_ALLOW from wave_type where wave_type = ? ";
pstmt2 = conn.prepareStatement(sql1);
pstmt2.setString(1,waveType);
rs2 = pstmt2.executeQuery();
if(rs2.next())
{
retTabSepStrBuff.append("<active_pick_allow>").append("<![CDATA[" + rs2.getString("ACTIVE_PICK_ALLOW") +"]]>").append("</active_pick_allow>");
}
else
{
retTabSepStrBuff.append("<active_pick_allow>").append("<![CDATA[Y]]>").append("</active_pick_allow>");
}
rs2.close();
rs2 = null;
pstmt2.close();
pstmt2 = null;
//ADD BY RITESH ON 08/10/13 FOR REQUEST END
//HOLD_QTY
retTabSepStrBuff.append("<hold_qty>").append("<![CDATA[" + holdQty +"]]>").append("</hold_qty>");
//gtin_case
......@@ -725,7 +763,11 @@ public class StockDeallocationPrc extends ProcessEJB implements StockDeallocatio
Statement st = null;
ResultSet rs=null;
String siteCodeShip="";
String activeAllow = "";
ArrayList list = new ArrayList();
boolean flag = false,isFlag = true,allocqtyflag = false;
double qtyAvailAlloc = 0;
int elements = 0;
ConnDriver connDriver = new ConnDriver(); //added by rajendra on 02/11/07
ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB();
try
......@@ -740,6 +782,7 @@ public class StockDeallocationPrc extends ProcessEJB implements StockDeallocatio
System.out.println("parentNodeListLength------------------->"+parentNodeListLength);
for (int selectedRow = 0; selectedRow < parentNodeListLength; selectedRow++)
{
flag = false;
parentNode = parentNodeList.item(selectedRow);
childNodeList = parentNode.getChildNodes();
......@@ -820,8 +863,69 @@ public class StockDeallocationPrc extends ProcessEJB implements StockDeallocatio
waveFlag = childNode.getFirstChild().getNodeValue();
System.out.print("waveFlag :*::"+ allocLineno );
}
if (childNodeName.equals("active_pick_allow"))
{
if(childNode.getFirstChild() != null)
{
activeAllow = childNode.getFirstChild().getNodeValue();
}
}
}//inner for loop
if(!"Y".equalsIgnoreCase(activeAllow) )
{
if(!"N".equalsIgnoreCase(activeAllow))
{
System.out.println("==activeAllow validate==");
errString = itmDBAccessEJB.getErrorString("","VTACTALW","","",conn);
return errString;
}
} //added by ritesh on 07/10/13 for request DI3ESUN009
if("N".equalsIgnoreCase(activeAllow))
{
String sql1 = "";
double shipperSize = 0;
sql1 = "select shipper_size from item_lot_packsize where item_code = ? ";
pstmt = conn.prepareStatement(sql1);
pstmt.setString(1,itemCode);
rs = pstmt.executeQuery();
if(rs.next())
{
shipperSize = rs.getDouble(1);
}
pstmt.close();pstmt = null;
rs.close();rs = null;
try{
if(DeallocQty % shipperSize != 0)
{
flag = true;
errString = itmDBAccessEJB.getErrorString("","VTACTALW2","","",conn);
System.out.println("==activeAllow validate 4 N =="+errString);
}
}
catch(Exception ex)
{
System.out.println("==ArithmeticException==");
flag = true;
errString = itmDBAccessEJB.getErrorString("","VTACTALW3","","",conn);
}
if( errString != null && errString.trim().length() > 0 && flag == true )
{
isFlag = false;
list.add(saleOrder);
list.add(lineNo);
list.add(itemCode);
list.add(DeallocQty);
elements ++;
}
} //added by ritesh on 07/10/13 for request DI3ESUN009 END
System.out.println(" sumit wave flag - >["+waveFlag+"]");
//Changed by sumit on 27/11/12 error msg if wave done condition start.
//if(DeallocQty > 0 )
......@@ -832,7 +936,7 @@ public class StockDeallocationPrc extends ProcessEJB implements StockDeallocatio
System.out.println(" error ["+errString+"]");
return errString;
}
else if(DeallocQty > 0 && "N".equalsIgnoreCase(waveFlag))
else if(DeallocQty > 0 && "N".equalsIgnoreCase(waveFlag) && flag == false)
{
//Changed by sumit on 27/11/12 error msg if wave done condition end.
System.out.println("if calling...*....");
......@@ -859,11 +963,39 @@ public class StockDeallocationPrc extends ProcessEJB implements StockDeallocatio
{
System.out.println("errString :"+errString);
return errString;
}else
{
allocqtyflag = true;
}
}
}// out for loop
if (isFlag == false)
{
if(allocqtyflag = true)
{
errString = "VTACTALW2";
errString = itmDBAccessEJB.getErrorString("",errString,"","",conn);
}
String begPart = errString.substring( 0, errString.indexOf("<trace>") + 7 );
String endPart = errString.substring( errString.indexOf("</trace>"));
String mainStr = begPart + "Following error has occured\n" ;
for(int i = 0; i < elements * 4;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;
errString = mainStr;
begPart =null;
endPart =null;
mainStr =null;
return errString;
}
}//try end
catch(Exception e)
......@@ -871,7 +1003,7 @@ public class StockDeallocationPrc extends ProcessEJB implements StockDeallocatio
System.out.println("Exception :StockDeallocationPrcEJB :process(String xmlString2, String xmlString2, String windowName, String xtraParams):" + e.getMessage() + ":");
errString = e.getMessage();
e.printStackTrace();
return errString ;
return errString;
}
finally
{
......@@ -909,6 +1041,10 @@ public class StockDeallocationPrc extends ProcessEJB implements StockDeallocatio
return errString;
}
//Changed by sumit on 27/11/12 showing wave messages end.
else if(errString.indexOf("VTACTALW2") > -1 || errString.indexOf("VTACTALW3") > -1 || errString.indexOf("VTACTALW") > -1)
{
return errString;
}
else
{
errString="VTPRCERR";
......@@ -1090,5 +1226,5 @@ public class StockDeallocationPrc extends ProcessEJB implements StockDeallocatio
{
invallocTraceMap.clear();
}
}
\ No newline at end of file
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