Commit 4d478096 authored by rtiwari's avatar rtiwari

change for request DI3ESUN009


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@93735 ce508802-f39f-4f6c-b175-0d175dae99d5
parent c681e205
...@@ -738,8 +738,9 @@ public class StockAllocationPrc extends ProcessEJB implements StockAllocationPrc ...@@ -738,8 +738,9 @@ public class StockAllocationPrc extends ProcessEJB implements StockAllocationPrc
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
Statement st = null; Statement st = null;
int elements = 0;
ArrayList list = new ArrayList();
boolean flag = false;
ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB(); ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB();
try try
{ {
...@@ -803,6 +804,10 @@ public class StockAllocationPrc extends ProcessEJB implements StockAllocationPrc ...@@ -803,6 +804,10 @@ public class StockAllocationPrc extends ProcessEJB implements StockAllocationPrc
{ {
activeAllow = childNode.getFirstChild().getNodeValue(); activeAllow = childNode.getFirstChild().getNodeValue();
} }
} //added by ritesh 0n 7/8/13 for request DI3ESUN009 END
}//inner for loop
if(!"Y".equalsIgnoreCase(activeAllow) ) if(!"Y".equalsIgnoreCase(activeAllow) )
{ {
if(!"N".equalsIgnoreCase(activeAllow)) if(!"N".equalsIgnoreCase(activeAllow))
...@@ -811,17 +816,54 @@ public class StockAllocationPrc extends ProcessEJB implements StockAllocationPrc ...@@ -811,17 +816,54 @@ public class StockAllocationPrc extends ProcessEJB implements StockAllocationPrc
errString = itmDBAccessEJB.getErrorString("","VTACTALW","","",conn); errString = itmDBAccessEJB.getErrorString("","VTACTALW","","",conn);
return errString; 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(allocQty % shipperSize != 0)
{
System.out.println("==activeAllow validate 4 N ==");
errString = itmDBAccessEJB.getErrorString("","VTACTALW2","","",conn);
}
} }
} //added by ritesh 0n 7/8/13 for request DI3ESUN009 END catch(ArithmeticException ex)
{
System.out.println("==ArithmeticException==");
errString = itmDBAccessEJB.getErrorString("","VTACTALW3","","",conn);
}//inner for loop }
if(allocQty > 0) if( errString != null && errString.trim().length() > 0 )
{
flag = true;
list.add(saleOrder);
list.add(lineNo);
list.add(itemCode);
list.add(allocQty);
elements ++;
}
} //added by ritesh on 07/10/13 for request DI3ESUN009 END
if(allocQty > 0 && flag == false)
{ {
System.out.println("if calling........"); System.out.println("if calling........");
errString = sorderAllocate(saleOrder, lineNo, itemCode, allocQty, expLev ,holdFlag,activeAllow); 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);
return errString; return errString;
} }
}else if(allocQty == 0) //added by kunal on 27/12/12 as per manoj instruction }else if(allocQty == 0) //added by kunal on 27/12/12 as per manoj instruction
...@@ -838,8 +880,32 @@ public class StockAllocationPrc extends ProcessEJB implements StockAllocationPrc ...@@ -838,8 +880,32 @@ public class StockAllocationPrc extends ProcessEJB implements StockAllocationPrc
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
} }
}// out for loop }// out for loop
//added by ritesh on 07/10/13 for request DI3ESUN009 start
if (errString != null && errString.trim().length() > 0)
{
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;
}
//added by ritesh on 07/10/13 for request DI3ESUN009 end
/*Commented By Manoj Sharma dtd 29/032012 Not required as discussed with Manohar Sir /*Commented By Manoj Sharma dtd 29/032012 Not required as discussed with Manohar Sir
if(postOrderFg.equals("Y")) if(postOrderFg.equals("Y"))
{ {
...@@ -925,6 +991,17 @@ public class StockAllocationPrc extends ProcessEJB implements StockAllocationPrc ...@@ -925,6 +991,17 @@ public class StockAllocationPrc extends ProcessEJB implements StockAllocationPrc
return input; return input;
} }
/**
* @param saleOrder
* @param lineNo
* @param itemCode
* @param allocQty
* @param expLev
* @param holdFlag
* @param activeAllow
* @return
* @throws ITMException
*/
private String sorderAllocate(String saleOrder, String lineNo, String itemCode, double allocQty, String expLev ,String holdFlag,String activeAllow) 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 ..............");
...@@ -1102,6 +1179,14 @@ public class StockAllocationPrc extends ProcessEJB implements StockAllocationPrc ...@@ -1102,6 +1179,14 @@ public class StockAllocationPrc extends ProcessEJB implements StockAllocationPrc
invallocTrace.setLocCode(locCode); invallocTrace.setLocCode(locCode);
invallocTrace.setLotNo(lotNo); invallocTrace.setLotNo(lotNo);
invallocTrace.setLotSl(lotSl); invallocTrace.setLotSl(lotSl);
PreparedStatement pstmt = null;
ResultSet rs1 = null;
String sqls = "";
double shipperSize = 0;
//added by ritesh on 07/10/13 for request DI3ESUN009 start
if(!"N".equalsIgnoreCase(activeAllow))
{
if (allocQty >= qtyAvailAlloc) if (allocQty >= qtyAvailAlloc)
{ {
lotQtyToBeAllocated = qtyAvailAlloc; lotQtyToBeAllocated = qtyAvailAlloc;
...@@ -1110,6 +1195,46 @@ public class StockAllocationPrc extends ProcessEJB implements StockAllocationPrc ...@@ -1110,6 +1195,46 @@ public class StockAllocationPrc extends ProcessEJB implements StockAllocationPrc
{ {
lotQtyToBeAllocated = allocQty; lotQtyToBeAllocated = allocQty;
} }
}
else
{
sqls = "select shipper_size from item_lot_packsize where item_code = ? and '"+lotNo+"' between lot_no__from and lot_no__to";
pstmt = conn.prepareStatement(sqls);
pstmt.setString(1,itemCode);
rs1 = pstmt.executeQuery();
if(rs1.next())
{
shipperSize = rs1.getDouble(1);
}
pstmt.close();pstmt = null;
rs1.close();rs1 = null;
System.out.print(":: qtyAvailAlloc ::"+qtyAvailAlloc);
System.out.print(":: shipperSize ::"+shipperSize);
if(qtyAvailAlloc >= shipperSize )
{
int div = 0;
if(shipperSize > 0)
{
div = (int) (allocQty / shipperSize);
lotQtyToBeAllocated=div*shipperSize;
if(lotQtyToBeAllocated > qtyAvailAlloc)
{
lotQtyToBeAllocated = 0;
System.out.println("::::::uncommon");
}
}
System.out.println("::lotQtyToBeAllocated::"+lotQtyToBeAllocated);
}
else
{
continue;
}
}
//added by ritesh on 07/10/13 for request DI3ESUN009 end
invallocTrace.setAllocQty(lotQtyToBeAllocated); invallocTrace.setAllocQty(lotQtyToBeAllocated);
// //
allocQty -= lotQtyToBeAllocated ; allocQty -= lotQtyToBeAllocated ;
...@@ -1164,7 +1289,6 @@ public class StockAllocationPrc extends ProcessEJB implements StockAllocationPrc ...@@ -1164,7 +1289,6 @@ public class StockAllocationPrc extends ProcessEJB implements StockAllocationPrc
rsSItem=null; rsSItem=null;
st.close(); st.close();
st=null; st=null;
if (count > 0 ) if (count > 0 )
{ {
updateSql = "UPDATE SORDALLOC SET QTY_ALLOC = QTY_ALLOC + " + new Double(lotQtyToBeAllocated).toString() updateSql = "UPDATE SORDALLOC SET QTY_ALLOC = QTY_ALLOC + " + new Double(lotQtyToBeAllocated).toString()
...@@ -1359,6 +1483,7 @@ public class StockAllocationPrc extends ProcessEJB implements StockAllocationPrc ...@@ -1359,6 +1483,7 @@ public class StockAllocationPrc extends ProcessEJB implements StockAllocationPrc
{ {
errString = e.getMessage(); errString = e.getMessage();
e.printStackTrace(); e.printStackTrace();
System.out.println("::@errString@:::"+errString);
return errString ; return errString ;
} }
......
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