Commit c957ba51 authored by manohar's avatar manohar

DI89SUN238 in add mode also if allocation found in sordalloc deallocation done


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@91223 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 2ac66ae2
...@@ -74,7 +74,7 @@ public class DespatchPrs extends ValidatorEJB implements DespatchPrsLocal, Despa ...@@ -74,7 +74,7 @@ public class DespatchPrs extends ValidatorEJB implements DespatchPrsLocal, Despa
HashMap strAllocate = new HashMap(); HashMap strAllocate = new HashMap();
String sqlSordAlloc = "", sqlSord = "", sqlSordItem = "", line = ""; String sqlSordAlloc = "", sqlSord = "", sqlSordItem = "", line = "";
double qtyAlloc = 0d, qtyStduom = 0d; double qtyAlloc = 0d, qtyStduom = 0d;
int updateCnt = 0, retVal = 0; int updateCnt = 0, retVal = 0, count =0;
java.sql.Date tranDate = null; java.sql.Date tranDate = null;
GenericUtility genericUtility = GenericUtility.getInstance(); GenericUtility genericUtility = GenericUtility.getInstance();
DistStkUpdLocal distStkUpd = null; DistStkUpdLocal distStkUpd = null;
...@@ -121,7 +121,7 @@ public class DespatchPrs extends ValidatorEJB implements DespatchPrsLocal, Despa ...@@ -121,7 +121,7 @@ public class DespatchPrs extends ValidatorEJB implements DespatchPrsLocal, Despa
System.out.println("*************** Update Status *************** "); System.out.println("*************** Update Status *************** ");
if (currDetail != null && !updateStatus.equalsIgnoreCase("A")) if (currDetail != null ) //&& !updateStatus.equalsIgnoreCase("A")) 22/02/10 manoharan if allocation found then deallocate
{ {
itemCode = GenericUtility.getInstance().getColumnValueFromNode("item_code",currDetail); itemCode = GenericUtility.getInstance().getColumnValueFromNode("item_code",currDetail);
lineNo = GenericUtility.getInstance().getColumnValueFromNode("line_no",currDetail); lineNo = GenericUtility.getInstance().getColumnValueFromNode("line_no",currDetail);
...@@ -133,6 +133,36 @@ public class DespatchPrs extends ValidatorEJB implements DespatchPrsLocal, Despa ...@@ -133,6 +133,36 @@ public class DespatchPrs extends ValidatorEJB implements DespatchPrsLocal, Despa
itemCodeOrd = GenericUtility.getInstance().getColumnValueFromNode("item_code__ord",currDetail); itemCodeOrd = GenericUtility.getInstance().getColumnValueFromNode("item_code__ord",currDetail);
sordNo = GenericUtility.getInstance().getColumnValueFromNode("sord_no",currDetail); sordNo = GenericUtility.getInstance().getColumnValueFromNode("sord_no",currDetail);
lineNoSord = GenericUtility.getInstance().getColumnValueFromNode("line_no__sord",currDetail); lineNoSord = GenericUtility.getInstance().getColumnValueFromNode("line_no__sord",currDetail);
// 22/02/10 manoharan if allocation found in sordalloc the deallocate
sqlSord = "SELECT COUNT(1) AS COUNT 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 = ? ";
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);
rs = pstmt.executeQuery();
if(rs.next())
{
count = rs.getInt(1);
}
rs.close();
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 if (updateStatus.equalsIgnoreCase("E") || updateStatus.equalsIgnoreCase("D")) //if codn added by jiten 19/05/06
{ {
//Commented And Changes Below - Gulzar 10/05/07 //Commented And Changes Below - Gulzar 10/05/07
...@@ -152,6 +182,8 @@ public class DespatchPrs extends ValidatorEJB implements DespatchPrsLocal, Despa ...@@ -152,6 +182,8 @@ public class DespatchPrs extends ValidatorEJB implements DespatchPrsLocal, Despa
lotSl = rs.getString("LOT_SL"); //Gulzar 10/05/07 lotSl = rs.getString("LOT_SL"); //Gulzar 10/05/07
qtyStduomStr = rs.getString("QUANTITY__STDUOM"); qtyStduomStr = rs.getString("QUANTITY__STDUOM");
} }
rs.close();
rs = null;
//End Changes - Gulzar 10/05/07 //End Changes - Gulzar 10/05/07
} }
...@@ -176,90 +208,102 @@ public class DespatchPrs extends ValidatorEJB implements DespatchPrsLocal, Despa ...@@ -176,90 +208,102 @@ public class DespatchPrs extends ValidatorEJB implements DespatchPrsLocal, Despa
{ {
qtyAlloc = 0; qtyAlloc = 0;
} }
if (qtyAlloc - qtyStduom <= 0) // 22/02/10 manoharan if allocation found in sordalloc then deallocate
{ if (count > 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();
System.out.println("Deleted the no of records are : updateCnt :"+updateCnt);
}
else
{ {
sqlSord = "UPDATE SORDALLOC SET QTY_ALLOC = QTY_ALLOC - ? " if (qtyAlloc - qtyStduom <= 0)
+"WHERE SALE_ORDER = ? " {
+"AND LINE_NO = ? " sqlSord = "DELETE FROM SORDALLOC WHERE SALE_ORDER = ? "
+"AND EXP_LEV = ? " +"AND LINE_NO = ? "
+"AND ITEM_CODE__ORD = ? " +"AND EXP_LEV = ? "
+"AND ITEM_CODE = ? " +"AND ITEM_CODE__ORD = ? "
+"AND LOT_NO = ? " +"AND ITEM_CODE = ? "
+"AND LOT_SL = ? " +"AND LOT_NO = ? "
+"AND LOC_CODE = ? "; +"AND LOT_SL = ? "
System.out.println("Update sql sqlSord :"+sqlSord); +"AND LOC_CODE = ? ";
pstmt = conn.prepareStatement(sqlSord); 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.setDouble(1,qtyStduom);
pstmt.setString(2,sordNo); pstmt.setString(2,sordNo);
pstmt.setString(3,lineNoSord); pstmt.setString(3,lineNoSord);
pstmt.setString(4,expLev); 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(); updateCnt = pstmt.executeUpdate();
System.out.println("Updated the no of records are : updateCnt :"+updateCnt); pstmt.close();
} pstmt = null;
sqlSordItem = "UPDATE SORDITEM SET QTY_ALLOC = QTY_ALLOC - ? " System.out.println("Updated the no of records : updateCnt :"+updateCnt);
+"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();
System.out.println("Updated the no of records : updateCnt :"+updateCnt);
line = " " + lineNo; line = " " + lineNo;
System.out.println("line :"+line); System.out.println("line :"+line);
strAllocate.put("tran_date",tranDate); strAllocate.put("tran_date",tranDate);
strAllocate.put("ref_ser","S-DSP"); strAllocate.put("ref_ser","S-DSP");
strAllocate.put("ref_id",tranId); strAllocate.put("ref_id",tranId);
strAllocate.put("ref_line",line.substring(line.length()-3)); strAllocate.put("ref_line",line.substring(line.length()-3));
strAllocate.put("site_code",siteCode); strAllocate.put("site_code",siteCode);
strAllocate.put("item_code",itemCode); strAllocate.put("item_code",itemCode);
strAllocate.put("loc_code",locCode); strAllocate.put("loc_code",locCode);
strAllocate.put("lot_no",lotNo); strAllocate.put("lot_no",lotNo);
strAllocate.put("lot_sl",lotSl); strAllocate.put("lot_sl",lotSl);
strAllocate.put("alloc_qty",new Double(-1*qtyStduom)); strAllocate.put("alloc_qty",new Double(-1*qtyStduom));
strAllocate.put("chg_user",genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginCode")); strAllocate.put("chg_user",genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginCode"));
strAllocate.put("chg_term",genericUtility.getValueFromXTRA_PARAMS(xtraParams,"termId")); strAllocate.put("chg_term",genericUtility.getValueFromXTRA_PARAMS(xtraParams,"termId"));
strAllocate.put("chg_win","W_DESPATCH"); strAllocate.put("chg_win","W_DESPATCH");
//Calling DistStkUpdEJB //Calling DistStkUpdEJB
System.out.println("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!"); System.out.println("distStkUpd.UpdAllocTrace(hashMap) : Sucessuful!");
} }
} // end 22/02/10 manoharan
} }
rs1.close();
rs1 = null;
} }
}//try end }//try end
catch (SQLException sqx) catch (SQLException sqx)
......
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