Commit 2d31ea2a authored by rtiwari's avatar rtiwari

change for request DI3ESUN009


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@93455 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 5f80a18d
...@@ -134,11 +134,13 @@ public class StockAllocationPrc extends ProcessEJB implements StockAllocationPrc ...@@ -134,11 +134,13 @@ public class StockAllocationPrc extends ProcessEJB implements StockAllocationPrc
String getDataSql= "" ; String getDataSql= "" ;
String sql= "" ; String sql= "" ;
String resultString = ""; String resultString = "";
String sql1 ="",custCodeSord = "",waveType = "", activeAllow="";
int waveType1 = 0;
Connection conn = null; Connection conn = null;
ResultSet rs = null; ResultSet rs = null;
ResultSet rs1 = null; ResultSet rs1 = null;
PreparedStatement pstmt = null,pstmt1 = null ; ResultSet rs2 = null;
PreparedStatement pstmt = null,pstmt1 = null,pstmt2 = null ;
Statement st = null; Statement st = null;
StringBuffer retTabSepStrBuff = new StringBuffer(); StringBuffer retTabSepStrBuff = new StringBuffer();
double pendQty = 0; double pendQty = 0;
...@@ -318,6 +320,7 @@ public class StockAllocationPrc extends ProcessEJB implements StockAllocationPrc ...@@ -318,6 +320,7 @@ public class StockAllocationPrc extends ProcessEJB implements StockAllocationPrc
+"AND (SORDITEM.QUANTITY*SORDITEM.CONV__QTY_STDQTY) - SORDITEM.QTY_DESP - SORDITEM.QTY_ALLOC > 0 " +"AND (SORDITEM.QUANTITY*SORDITEM.CONV__QTY_STDQTY) - SORDITEM.QTY_DESP - SORDITEM.QTY_ALLOC > 0 "
+"AND SORDITEM.LINE_TYPE = 'I' " +"AND SORDITEM.LINE_TYPE = 'I' "
+"ORDER BY SORDER.CUST_CODE,SORDER.SALE_ORDER,SORDITEM.ITEM_CODE__ORD"; +"ORDER BY SORDER.CUST_CODE,SORDER.SALE_ORDER,SORDITEM.ITEM_CODE__ORD";
pstmt = conn.prepareStatement(getDataSql); pstmt = conn.prepareStatement(getDataSql);
pstmt.setString(1,siteCode); pstmt.setString(1,siteCode);
...@@ -336,10 +339,10 @@ public class StockAllocationPrc extends ProcessEJB implements StockAllocationPrc ...@@ -336,10 +339,10 @@ public class StockAllocationPrc extends ProcessEJB implements StockAllocationPrc
if(rs.next()) if(rs.next())
{ {
do do
{ {
System.out.println("Processing Item ....." + rs.getString(6) ); System.out.println("Processing Item ....." + rs.getString(6) );
if(itemCodeMap.containsKey(rs.getString(6))) if(itemCodeMap.containsKey(rs.getString(6)))
{ {
...@@ -349,7 +352,7 @@ public class StockAllocationPrc extends ProcessEJB implements StockAllocationPrc ...@@ -349,7 +352,7 @@ public class StockAllocationPrc extends ProcessEJB implements StockAllocationPrc
} }
else else
{ {
sql ="SELECT SUM(STOCK.QUANTITY - case when STOCK.ALLOC_QTY is null then 0 else STOCK.ALLOC_QTY end - case when STOCK.HOLD_QTY is null then 0 else STOCK.HOLD_QTY end ),SUM(case when STOCK.HOLD_QTY is null then 0 else STOCK.HOLD_QTY end ) " sql1 ="SELECT SUM(STOCK.QUANTITY - case when STOCK.ALLOC_QTY is null then 0 else STOCK.ALLOC_QTY end - case when STOCK.HOLD_QTY is null then 0 else STOCK.HOLD_QTY end ),SUM(case when STOCK.HOLD_QTY is null then 0 else STOCK.HOLD_QTY end ) "
+"FROM STOCK,ITEM,LOCATION,INVSTAT " +"FROM STOCK,ITEM,LOCATION,INVSTAT "
+"WHERE (ITEM.ITEM_CODE = STOCK.ITEM_CODE) " +"WHERE (ITEM.ITEM_CODE = STOCK.ITEM_CODE) "
+"AND (LOCATION.LOC_CODE = STOCK.LOC_CODE ) " +"AND (LOCATION.LOC_CODE = STOCK.LOC_CODE ) "
...@@ -360,7 +363,7 @@ public class StockAllocationPrc extends ProcessEJB implements StockAllocationPrc ...@@ -360,7 +363,7 @@ public class StockAllocationPrc extends ProcessEJB implements StockAllocationPrc
+"AND (STOCK.QUANTITY - case when STOCK.ALLOC_QTY is null then 0 else STOCK.ALLOC_QTY end - case when STOCK.HOLD_QTY is null then 0 else STOCK.HOLD_QTY end ) > 0 "; +"AND (STOCK.QUANTITY - case when STOCK.ALLOC_QTY is null then 0 else STOCK.ALLOC_QTY end - case when STOCK.HOLD_QTY is null then 0 else STOCK.HOLD_QTY end ) > 0 ";
// 01/11/12 manoharan preparedstatement used instead of statement // 01/11/12 manoharan preparedstatement used instead of statement
//rs1 = st.executeQuery(sql); //rs1 = st.executeQuery(sql);
pstmt1 = conn.prepareStatement(sql); pstmt1 = conn.prepareStatement(sql1);
pstmt1.setString(1,rs.getString(6) ); pstmt1.setString(1,rs.getString(6) );
pstmt1.setString(2,rs.getString(12)); pstmt1.setString(2,rs.getString(12));
rs1 = pstmt1.executeQuery(); rs1 = pstmt1.executeQuery();
...@@ -492,7 +495,36 @@ public class StockAllocationPrc extends ProcessEJB implements StockAllocationPrc ...@@ -492,7 +495,36 @@ public class StockAllocationPrc extends ProcessEJB implements StockAllocationPrc
//retTabSepStrBuff.append("0").append("\t"); //retTabSepStrBuff.append("0").append("\t");
retTabSepStrBuff.append("<qty_alloc>").append("<![CDATA[" + 0 +"]]>").append("</qty_alloc>"); retTabSepStrBuff.append("<qty_alloc>").append("<![CDATA[" + 0 +"]]>").append("</qty_alloc>");
} }
//added by ritesh 0n 7/8/13 for request DI3ESUN009 START
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[ ]]>").append("</active_pick_allow>");
}
rs2.close();
rs2 = null;
pstmt2.close();
pstmt2 = null;
//added by ritesh 0n 7/8/13 for request DI3ESUN009 END
//qty allocated //qty allocated
//retTabSepStrBuff.append(rs.getDouble(10)).append("\t");// ADDED BY AKHILESH //retTabSepStrBuff.append(rs.getDouble(10)).append("\t");// ADDED BY AKHILESH
retTabSepStrBuff.append("<qty_allocated>").append("<![CDATA[" + (rs.getDouble(10)) +"]]>").append("</qty_allocated>"); retTabSepStrBuff.append("<qty_allocated>").append("<![CDATA[" + (rs.getDouble(10)) +"]]>").append("</qty_allocated>");
...@@ -561,9 +593,6 @@ public class StockAllocationPrc extends ProcessEJB implements StockAllocationPrc ...@@ -561,9 +593,6 @@ public class StockAllocationPrc extends ProcessEJB implements StockAllocationPrc
}*/ }*/
retTabSepStrBuff.append("</Detail2>"); retTabSepStrBuff.append("</Detail2>");
//retTabSepStrBuff.append("\n"); //retTabSepStrBuff.append("\n");
...@@ -687,7 +716,7 @@ public class StockAllocationPrc extends ProcessEJB implements StockAllocationPrc ...@@ -687,7 +716,7 @@ public class StockAllocationPrc extends ProcessEJB implements StockAllocationPrc
String stockQuantity = ""; String stockQuantity = "";
String errString = ""; String errString = "";
String holdFlag = ""; String holdFlag = "";
String activeAllow = "";
String getDataSql= null; String getDataSql= null;
String insertSql = null; String insertSql = null;
String updateSql = null; String updateSql = null;
...@@ -767,13 +796,29 @@ public class StockAllocationPrc extends ProcessEJB implements StockAllocationPrc ...@@ -767,13 +796,29 @@ public class StockAllocationPrc extends ProcessEJB implements StockAllocationPrc
{ {
holdFlag = childNode.getFirstChild().getNodeValue(); holdFlag = childNode.getFirstChild().getNodeValue();
} }
//added by ritesh on 7/8/13 for request DI3ESUN009 START
if (childNodeName.equals("active_pick_allow"))
{
if(childNode.getFirstChild() != null)
{
activeAllow = childNode.getFirstChild().getNodeValue();
}
if(!"Y".equalsIgnoreCase(activeAllow) )
{
if(!"N".equalsIgnoreCase(activeAllow))
{
System.out.println("==activeAllow validate==");
errString = itmDBAccessEJB.getErrorString("","VTACTALW","","",conn);
return errString;
}
}
} //added by ritesh 0n 7/8/13 for request DI3ESUN009 START
}//inner for loop }//inner for loop
if(allocQty > 0) if(allocQty > 0)
{ {
System.out.println("if calling........"); System.out.println("if calling........");
errString = sorderAllocate(saleOrder, lineNo, itemCode, allocQty, expLev ,holdFlag); errString = sorderAllocate(saleOrder, lineNo, itemCode, allocQty, expLev ,holdFlag,activeAllow);
if (errString != null && errString.trim().length() > 0) if (errString != null && errString.trim().length() > 0)
{ {
System.out.println("errString :"+errString); System.out.println("errString :"+errString);
...@@ -880,7 +925,7 @@ public class StockAllocationPrc extends ProcessEJB implements StockAllocationPrc ...@@ -880,7 +925,7 @@ public class StockAllocationPrc extends ProcessEJB implements StockAllocationPrc
return input; return input;
} }
private String sorderAllocate(String saleOrder, String lineNo, String itemCode, double allocQty, String expLev ,String holdFlag) throws ITMException private String sorderAllocate(String saleOrder, String lineNo, String itemCode, double allocQty, String expLev ,String holdFlag,String activeAllow) throws ITMException
{ {
System.out.println("updateSOrder calling .............."); System.out.println("updateSOrder calling ..............");
String getDataSql = null; String getDataSql = null;
...@@ -906,6 +951,7 @@ public class StockAllocationPrc extends ProcessEJB implements StockAllocationPrc ...@@ -906,6 +951,7 @@ public class StockAllocationPrc extends ProcessEJB implements StockAllocationPrc
String updateSordalloc = null; String updateSordalloc = null;
String updateSql= null; String updateSql= null;
String flag = null; String flag = null;
String sql1 = "";
double stockQuantity = 0; double stockQuantity = 0;
double qtyAvailAlloc = 0; double qtyAvailAlloc = 0;
double lotQtyToBeAllocated = 0; double lotQtyToBeAllocated = 0;
...@@ -916,7 +962,7 @@ public class StockAllocationPrc extends ProcessEJB implements StockAllocationPrc ...@@ -916,7 +962,7 @@ public class StockAllocationPrc extends ProcessEJB implements StockAllocationPrc
double pendingQuantity = 0; double pendingQuantity = 0;
int intCnt=0; int intCnt=0;
int updCnt=0; int updCnt=0;
String varValue1 = "",varValue2 = "";
String errString = ""; String errString = "";
String error = ""; String error = "";
String errCode = ""; String errCode = "";
...@@ -926,7 +972,7 @@ public class StockAllocationPrc extends ProcessEJB implements StockAllocationPrc ...@@ -926,7 +972,7 @@ public class StockAllocationPrc extends ProcessEJB implements StockAllocationPrc
Statement st = null; Statement st = null;
ResultSet rs = null ; ResultSet rs = null ;
ResultSet rsSItem = null; ResultSet rsSItem = null;
DistCommon dComm = new DistCommon();
try try
{ {
ConnDriver connDriver = new ConnDriver(); ConnDriver connDriver = new ConnDriver();
...@@ -953,7 +999,6 @@ public class StockAllocationPrc extends ProcessEJB implements StockAllocationPrc ...@@ -953,7 +999,6 @@ public class StockAllocationPrc extends ProcessEJB implements StockAllocationPrc
System.out.println("siteCode------"+ siteCode); System.out.println("siteCode------"+ siteCode);
getDataSql = "SELECT STOCK.LOT_NO,STOCK.LOT_SL," getDataSql = "SELECT STOCK.LOT_NO,STOCK.LOT_SL,"
+"STOCK.LOC_CODE, " +"STOCK.LOC_CODE, "
+"STOCK.UNIT, " +"STOCK.UNIT, "
...@@ -968,10 +1013,21 @@ public class StockAllocationPrc extends ProcessEJB implements StockAllocationPrc ...@@ -968,10 +1013,21 @@ public class StockAllocationPrc extends ProcessEJB implements StockAllocationPrc
+"AND STOCK.ITEM_CODE = ? AND STOCK.SITE_CODE = ? " +"AND STOCK.ITEM_CODE = ? AND STOCK.SITE_CODE = ? "
+"AND (STOCK.QUANTITY - STOCK.ALLOC_QTY - case when STOCK.HOLD_QTY is null then 0 else STOCK.HOLD_QTY end) > 0 " +"AND (STOCK.QUANTITY - STOCK.ALLOC_QTY - case when STOCK.HOLD_QTY is null then 0 else STOCK.HOLD_QTY end) > 0 "
+"AND NOT EXISTS (SELECT 1 FROM INV_RESTR I WHERE I.INV_STAT = INVSTAT.INV_STAT AND I.REF_SER = 'S-DSP' )"; +"AND NOT EXISTS (SELECT 1 FROM INV_RESTR I WHERE I.INV_STAT = INVSTAT.INV_STAT AND I.REF_SER = 'S-DSP' )";
if("N".equalsIgnoreCase(activeAllow))
{
getDataSql = getDataSql.concat(" AND LOCATION.INV_STAT NOT IN(?,?)");
}
pstmtStock = conn.prepareStatement(getDataSql); pstmtStock = conn.prepareStatement(getDataSql);
pstmtStock.setString(1,itemCode); pstmtStock.setString(1,itemCode);
pstmtStock.setString(2,siteCode); pstmtStock.setString(2,siteCode);
//added by ritesh 0n 7/8/13 for request DI3ESUN009 START
if("N".equalsIgnoreCase(activeAllow))
{
varValue1 = dComm.getDisparams("999999","ACTIVE_PICK_INVSTAT", conn);
varValue2 = dComm.getDisparams("999999","PRSRV_INVSTAT", conn);
pstmtStock.setString(3,varValue1);
pstmtStock.setString(4,varValue2);
} //added by ritesh 0n 7/8/13 for request DI3ESUN009 START
rs = pstmtStock.executeQuery(); rs = pstmtStock.executeQuery();
System.out.println("siteCode------"+ siteCode); System.out.println("siteCode------"+ siteCode);
......
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