Commit ce814f53 authored by manohar's avatar manohar

DI90UNI003 in case of manual edit and lot_no change stock not deallocated


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@91341 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 37834c28
......@@ -121,7 +121,7 @@ public class DespatchPrs extends ValidatorEJB implements DespatchPrsLocal, Despa
System.out.println("*************** Update Status *************** ");
if (currDetail != null ) //&& !updateStatus.equalsIgnoreCase("A")) 22/02/10 manoharan if allocation found then deallocate
if (currDetail != null ) //&& !updateStatus.equalsIgnoreCase("A")) // 22/02/10 manoharan if allocation found in sordalloc the deallocate
{
itemCode = GenericUtility.getInstance().getColumnValueFromNode("item_code",currDetail);
lineNo = GenericUtility.getInstance().getColumnValueFromNode("line_no",currDetail);
......@@ -134,6 +134,8 @@ public class DespatchPrs extends ValidatorEJB implements DespatchPrsLocal, Despa
sordNo = GenericUtility.getInstance().getColumnValueFromNode("sord_no",currDetail);
lineNoSord = GenericUtility.getInstance().getColumnValueFromNode("line_no__sord",currDetail);
// 22/02/10 manoharan if allocation found in sordalloc the deallocate
if (updateStatus.equalsIgnoreCase("A"))
{
sql = "SELECT COUNT(1) AS COUNT FROM SORDALLOC "
+"WHERE SALE_ORDER = ? "
+"AND LINE_NO = ? "
......@@ -161,9 +163,104 @@ public class DespatchPrs extends ValidatorEJB implements DespatchPrsLocal, Despa
rs = null;
pstmt.close();
pstmt = null;
// end 22/02/10 manoharan
if (updateStatus.equalsIgnoreCase("E") || updateStatus.equalsIgnoreCase("D")) //if codn added by jiten 19/05/06
// 22/02/10 manoharan if allocation found in sordalloc then deallocate
if (count > 0 )
{
if (qtyAlloc - qtyStduom <= 0)
{
sqlSord = "DELETE FROM SORDALLOC WHERE SALE_ORDER = ? "
+"AND LINE_NO = ? "
+"AND EXP_LEV = ? "
+"AND ITEM_CODE__ORD = ? "
+"AND ITEM_CODE = ? "
+"AND LOT_NO = ? "
+"AND LOT_SL = ? "
+"AND LOC_CODE = ? ";
System.out.println("Delete sql sqlSord :"+sqlSord);
pstmt = conn.prepareStatement(sqlSord);
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);
updateCnt = pstmt.executeUpdate();
pstmt.close();
pstmt = null;
System.out.println("Deleted the no of records are : updateCnt :"+updateCnt);
}
else
{
sqlSord = "UPDATE SORDALLOC SET QTY_ALLOC = QTY_ALLOC - ? "
+"WHERE SALE_ORDER = ? "
+"AND LINE_NO = ? "
+"AND EXP_LEV = ? "
+"AND ITEM_CODE__ORD = ? "
+"AND ITEM_CODE = ? "
+"AND LOT_NO = ? "
+"AND LOT_SL = ? "
+"AND LOC_CODE = ? ";
System.out.println("Update sql sqlSord :"+sqlSord);
pstmt = conn.prepareStatement(sqlSord);
pstmt.setDouble(1,qtyStduom);
pstmt.setString(2,sordNo);
pstmt.setString(3,lineNoSord);
pstmt.setString(4,expLev);
pstmt.setString(5,itemCodeOrd);
pstmt.setString(6,itemCode);
pstmt.setString(7,lotNo);
pstmt.setString(8,lotSl);
pstmt.setString(9,locCode);
updateCnt = pstmt.executeUpdate();
pstmt.close();
pstmt = null;
System.out.println("Updated the no of records are : updateCnt :"+updateCnt);
}
sqlSordItem = "UPDATE SORDITEM SET QTY_ALLOC = QTY_ALLOC - ? "
+"WHERE SALE_ORDER = ? "
+"AND LINE_NO = ? "
+"AND EXP_LEV = ? ";
System.out.println("Update sql sqlSordItem :"+sqlSordItem);
pstmt = conn.prepareStatement(sqlSordItem);
pstmt.setDouble(1,qtyStduom);
pstmt.setString(2,sordNo);
pstmt.setString(3,lineNoSord);
pstmt.setString(4,expLev);
updateCnt = pstmt.executeUpdate();
pstmt.close();
pstmt = null;
System.out.println("Updated the no of records : updateCnt :"+updateCnt);
line = " " + lineNo;
System.out.println("line :"+line);
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));
strAllocate.put("site_code",siteCode);
strAllocate.put("item_code",itemCode);
strAllocate.put("loc_code",locCode);
strAllocate.put("lot_no",lotNo);
strAllocate.put("lot_sl",lotSl);
strAllocate.put("alloc_qty",new Double(-1*qtyStduom));
strAllocate.put("chg_user",genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginCode"));
strAllocate.put("chg_term",genericUtility.getValueFromXTRA_PARAMS(xtraParams,"termId"));
strAllocate.put("chg_win","W_DESPATCH");
//Calling DistStkUpdEJB
System.out.println("Calling DistStkUpdEJB.....");
if (distStkUpd.updAllocTrace(strAllocate, conn) > 0)
{
System.out.println("distStkUpd.UpdAllocTrace(hashMap) : Sucessuful!");
}
} // end 22/02/10 manoharan
}
// end 22/02/10 manoharan
else if (updateStatus.equalsIgnoreCase("E") || updateStatus.equalsIgnoreCase("D")) //if codn added by jiten 19/05/06
{
//Commented And Changes Below - Gulzar 10/05/07
//sql = "SELECT QUANTITY__STDUOM FROM DESPATCHDET WHERE DESP_ID = '"+tranId+"' AND LINE_NO = '"+lineNo+"'"; //Gulzar - 10/05/07
......@@ -209,8 +306,6 @@ public class DespatchPrs extends ValidatorEJB implements DespatchPrsLocal, Despa
qtyAlloc = 0;
}
// 22/02/10 manoharan if allocation found in sordalloc then deallocate
if (count > 0 )
{
if (qtyAlloc - qtyStduom <= 0)
{
sqlSord = "DELETE FROM SORDALLOC WHERE SALE_ORDER = ? "
......@@ -277,6 +372,8 @@ public class DespatchPrs extends ValidatorEJB implements DespatchPrsLocal, Despa
pstmt.close();
pstmt = null;
System.out.println("Updated the no of records : updateCnt :"+updateCnt);
}
line = " " + lineNo;
System.out.println("line :"+line);
......@@ -300,8 +397,6 @@ public class DespatchPrs extends ValidatorEJB implements DespatchPrsLocal, Despa
{
System.out.println("distStkUpd.UpdAllocTrace(hashMap) : Sucessuful!");
}
} // end 22/02/10 manoharan
}
rs1.close();
rs1 = null;
}
......
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