Commit 04b90532 authored by msharma's avatar msharma

Stock Deallocation checking


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@92143 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 50502aac
......@@ -418,7 +418,7 @@ public class DespatchPos extends ValidatorEJB implements DespatchPosLocal, Despa
}
String line = " " + lineNo;
System.out.println("line :"+line);
strAllocate.put("tran_date",tranDate);
//strAllocate.put("tran_date",tranDate);
strAllocate.put("ref_ser","S-DSP");
strAllocate.put("ref_id",tranId);
strAllocate.put("ref_line",line.substring(line.length()-3));
......@@ -433,10 +433,15 @@ public class DespatchPos extends ValidatorEJB implements DespatchPosLocal, Despa
strAllocate.put("chg_win","W_DESPATCH");
//Calling DistStkUpdEJB
System.out.println("Calling DistStkUpdEJB.....");
if (distStkUpd.updAllocTrace(strAllocate, conn) > 0)
/*if (distStkUpd.updAllocTrace(strAllocate, conn) > 0)
{
System.out.println("distStkUpd.UpdAllocTrace(hashMap) : Sucessuful!");
}
}*/
InvAllocTraceBean invBean = new InvAllocTraceBean();
String errString = invBean.updateInvallocTrace(strAllocate,conn);
if(errString == null && errString.trim().length() == 0){
System.out.println("distStkUpd.UpdAllocTrace(hashMap) : Sucessuful!");
}
sqlUpdate = "UPDATE SORDITEM SET QTY_ALLOC = QTY_ALLOC + ? "
+"WHERE SALE_ORDER = ? "
+"AND LINE_NO = ? "
......@@ -478,10 +483,7 @@ public class DespatchPos extends ValidatorEJB implements DespatchPosLocal, Despa
pstmt.close();
pstmt = null;
}
if(conn1 != null){
conn1.close();
conn1 = null;
}
}
catch(Exception e)
{
......
......@@ -119,8 +119,95 @@ public class DespatchPrs extends ValidatorEJB implements DespatchPrsLocal, Despa
System.out.println("*************** Update Status *************** ");
System.out.println("DomID :: "+domID+"\n Update Status ::"+updateStatus);
System.out.println("*************** Update Status *************** ");
//01/11/2012 manoj sharma for deallocation
int length=0;
NodeList parentNodeList = null;
Node parentNode = null;
parentNodeList = dom.getElementsByTagName("Detail2");
parentNode = parentNodeList.item(0);
length=dom.getElementsByTagName("Detail2").getLength();
String currlineNo = "";
String keyString="";
String currkey="";
double totAllocQty=0;
if (currDetail != null ) //&& !updateStatus.equalsIgnoreCase("A")) // 22/02/10 manoharan if allocation found in sordalloc the deallocate
{
currlineNo =GenericUtility.getInstance().getColumnValueFromNode("line_no",currDetail);
itemCode = GenericUtility.getInstance().getColumnValueFromNode("item_code",currDetail);
lineNo = GenericUtility.getInstance().getColumnValueFromNode("line_no",currDetail);
locCode = GenericUtility.getInstance().getColumnValueFromNode("loc_code",currDetail);
lotNo = GenericUtility.getInstance().getColumnValueFromNode("lot_no",currDetail);
lotSl = GenericUtility.getInstance().getColumnValueFromNode("lot_sl",currDetail);
qtyStduomStr = GenericUtility.getInstance().getColumnValueFromNode("quantity__stduom",currDetail);
expLev = GenericUtility.getInstance().getColumnValueFromNode("exp_lev",currDetail);
itemCodeOrd = GenericUtility.getInstance().getColumnValueFromNode("item_code__ord",currDetail);
sordNo = GenericUtility.getInstance().getColumnValueFromNode("sord_no",currDetail);
lineNoSord = GenericUtility.getInstance().getColumnValueFromNode("line_no__sord",currDetail);
currkey=itemCode.trim()+"@"+sordNo.trim()+"@"+lineNoSord.trim()+"@"+locCode.trim()+"@"+lotNo.trim()+"@"+lotSl.trim()+"@"+expLev.trim()+"@"+itemCodeOrd.trim();
System.out.println("currkey---"+currkey);
sql="SELECT SUM(QUANTITY) FROM DESPATCHDET "
+"WHERE SORD_NO = ? "
+"AND LINE_NO__SORD = ? "
+"AND EXP_LEV = ? "
+"AND ITEM_CODE__ORD = ? "
+"AND ITEM_CODE = ? "
+"AND LOT_NO = ? "
+"AND LOT_SL = ? "
+"AND LOC_CODE = ? AND DESP_ID<>? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,sordNo);
pstmt.setString(2,lineNoSord);
pstmt.setString(3,expLev);
pstmt.setString(4,itemCodeOrd);
pstmt.setString(5,itemCode);
pstmt.setString(6,lotNo);
pstmt.setString(7,lotSl);
pstmt.setString(8,locCode);
pstmt.setString(9,tranId);
rs = pstmt.executeQuery();
if(rs.next())
{
//count = rs.getInt(1); //
totAllocQty = rs.getDouble(1);
}
System.out.println("totAllocQty--from Other despatch----"+totAllocQty);
rs.close();
rs=null;
pstmt.close();
pstmt=null;
}
for(int i =0; i<length ; i++)
{
itemCode=(genericUtility.getColumnValueFromNode("item_code",dom.getElementsByTagName("Detail2").item(i))).trim();
lineNo=(genericUtility.getColumnValueFromNode("line_no",dom.getElementsByTagName("Detail2").item(i))).trim();
sordNo=(genericUtility.getColumnValueFromNode("sord_no",dom.getElementsByTagName("Detail2").item(i))).trim();
lineNoSord=(genericUtility.getColumnValueFromNode("line_no__sord",dom.getElementsByTagName("Detail2").item(i))).trim();
qtyStduom=Double.parseDouble((genericUtility.getColumnValueFromNode("quantity__stduom",dom.getElementsByTagName("Detail2").item(i))).trim());
System.out.println("qtyStduom----"+qtyStduom);
locCode=(genericUtility.getColumnValueFromNode("loc_code",dom.getElementsByTagName("Detail2").item(i))).trim();
lotNo=(genericUtility.getColumnValueFromNode("lot_no",dom.getElementsByTagName("Detail2").item(i))).trim();
lotSl=(genericUtility.getColumnValueFromNode("lot_sl",dom.getElementsByTagName("Detail2").item(i))).trim();
expLev=(genericUtility.getColumnValueFromNode("exp_lev",dom.getElementsByTagName("Detail2").item(i))).trim();
itemCodeOrd=(genericUtility.getColumnValueFromNode("item_code__ord",dom.getElementsByTagName("Detail2").item(i))).trim();
keyString=itemCode.trim()+"@"+sordNo.trim()+"@"+lineNoSord.trim()+"@"+locCode.trim()+"@"+lotNo.trim()+"@"+lotSl.trim()+"@"+expLev.trim()+"@"+itemCodeOrd.trim();
System.out.println("keyString----"+keyString);
System.out.println("currlineNo----"+currlineNo);
System.out.println("lineNo----"+lineNo);
if(!currlineNo.trim().equalsIgnoreCase(lineNo.trim()))
{
if(currkey.equalsIgnoreCase(keyString))
{
totAllocQty+=qtyStduom;
}
}
}
System.out.println("totAllocQty--from all Entries other than Currect Record----"+totAllocQty);
//01/11/2012 manoj sharma for deallocation end
if (currDetail != null ) //&& !updateStatus.equalsIgnoreCase("A")) // 22/02/10 manoharan if allocation found in sordalloc the deallocate
{
itemCode = GenericUtility.getInstance().getColumnValueFromNode("item_code",currDetail);
......@@ -170,7 +257,8 @@ public class DespatchPrs extends ValidatorEJB implements DespatchPrsLocal, Despa
// 22/02/10 manoharan if allocation found in sordalloc then deallocate
//if (count > 0 ) // 04/04/12 manoharan
if (qtyAlloc > 0) // 04/04/12 manoharan
//if (qtyAlloc > 0) // 04/04/12 manoharan
if(qtyAlloc>totAllocQty)//01/11/2012 manoj sharma for deallocation
{
if (qtyAlloc - qtyStduom <= 0)
{
......@@ -257,10 +345,15 @@ public class DespatchPrs extends ValidatorEJB implements DespatchPrsLocal, Despa
strAllocate.put("chg_win","W_DESPATCH");
//Calling DistStkUpdEJB
System.out.println("Calling DistStkUpdEJB.....");
if (distStkUpd.updAllocTrace(strAllocate, conn) > 0)
/*if (distStkUpd.updAllocTrace(strAllocate, conn) > 0)
{
System.out.println("distStkUpd.UpdAllocTrace(hashMap) : Sucessuful!");
}
}*/
InvAllocTraceBean invBean = new InvAllocTraceBean();
String errString = invBean.updateInvallocTrace(strAllocate,conn);
if(errString == null && errString.trim().length() == 0){
System.out.println("distStkUpd.UpdAllocTrace(hashMap) : Sucessuful!");
}
} // end 22/02/10 manoharan
}
......@@ -404,10 +497,15 @@ public class DespatchPrs extends ValidatorEJB implements DespatchPrsLocal, Despa
strAllocate.put("chg_win","W_DESPATCH");
//Calling DistStkUpdEJB
System.out.println("Calling DistStkUpdEJB.....");
if (distStkUpd.updAllocTrace(strAllocate, conn) > 0)
/*if (distStkUpd.updAllocTrace(strAllocate, conn) > 0)
{
System.out.println("distStkUpd.UpdAllocTrace(hashMap) : Sucessuful!");
}
}*/
InvAllocTraceBean invBean = new InvAllocTraceBean();
String errString = invBean.updateInvallocTrace(strAllocate,conn);
if(errString == null && errString.trim().length() == 0){
System.out.println("distStkUpd.UpdAllocTrace(hashMap) : Sucessuful!");
}
}
}
}//try end
......
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