Commit f83d9810 authored by msharma's avatar msharma

FEFO concept implemented during stock allocation earlier it was unavailable


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@93473 ce508802-f39f-4f6c-b175-0d175dae99d5
parent a0ccb2fb
......@@ -1788,12 +1788,12 @@ public class StockAllocIc extends ValidatorEJB implements StockAllocIcLocal, Sto
if((pendingQty % packSize) > 0)
{
isActives = true;
orderByStkStr = "AND LOCATION.INV_STAT IN(?,?,?,?,?) ORDER BY STOCK.EXP_DATE,LOCATION.INV_STAT, STOCK.LOC_CODE ";
orderByStkStr = "AND LOCATION.INV_STAT IN(?,?,?,?,?) ORDER BY CASE WHEN STOCK.EXP_DATE IS NULL THEN STOCK.CREA_DATE ELSE STOCK.EXP_DATE END,LOCATION.INV_STAT, STOCK.LOC_CODE ";
}
else
{
isActives = false;
orderByStkStr = "AND LOCATION.INV_STAT IN(?,?,?,?) ORDER BY STOCK.EXP_DATE, STOCK.LOC_CODE ";
orderByStkStr = "AND LOCATION.INV_STAT IN(?,?,?,?) ORDER BY CASE WHEN STOCK.EXP_DATE IS NULL THEN STOCK.CREA_DATE ELSE STOCK.EXP_DATE END, STOCK.LOC_CODE ";
}
......
......@@ -973,6 +973,7 @@ public class StockAllocationPrc extends ProcessEJB implements StockAllocationPrc
ResultSet rs = null ;
ResultSet rsSItem = null;
DistCommon dComm = new DistCommon();
double minSelfLife=0;
try
{
ConnDriver connDriver = new ConnDriver();
......@@ -998,7 +999,34 @@ public class StockAllocationPrc extends ProcessEJB implements StockAllocationPrc
// end 21/08/12 manoharan get the shipping site
System.out.println("siteCode------"+ siteCode);
sorditemSql = "SELECT ITEM_CODE,ITEM_CODE__ORD,UNIT, QTY_DESP, ITEM_REF,"
+" QUANTITY - QTY_DESP PENDING_QUANTITY,MIN_SHELF_LIFE "
+" FROM SORDITEM WHERE SALE_ORDER = '" + saleOrder + "' "
+" AND LINE_NO = '" + lineNo + "' "
+" AND EXP_LEV = '" + expLev + "' ";
System.out.println("sorditemSql:::"+sorditemSql);
st = conn.createStatement();
rsSItem = st.executeQuery(sorditemSql);
if (rsSItem.next())
{
//ITEM_CODE
itemCode = rsSItem.getString(1);
System.out.println("itemCode::::"+ itemCode);
//ITEM_CODE__ORD
itemCodeOrd = rsSItem.getString(2);
//UNIT
unitStd = rsSItem.getString(3);
//QTY_DESP
qtyDesp = 0;
//ITEM_REF
itemRef = rsSItem.getString(5);
//PENDING_QUANTITY
pendingQuantity = rsSItem.getDouble(6);
minSelfLife= rsSItem.getDouble("MIN_SHELF_LIFE");
}
rsSItem.close();
st.close();
getDataSql = "SELECT STOCK.LOT_NO,STOCK.LOT_SL,"
+"STOCK.LOC_CODE, "
+"STOCK.UNIT, "
......@@ -1013,13 +1041,19 @@ public class StockAllocationPrc extends ProcessEJB implements StockAllocationPrc
+"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 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(?,?)");
}
//Added by manoj dtd 09/08/2013 to implement FEFO concept
getDataSql=getDataSql+"AND (MONTHS_BETWEEN(TO_DATE(STOCK.EXP_DATE),SYSDATE) > ? ) ";
getDataSql=getDataSql+" ORDER BY CASE WHEN STOCK.EXP_DATE IS NULL THEN STOCK.CREA_DATE ELSE STOCK.EXP_DATE END ASC";
pstmtStock = conn.prepareStatement(getDataSql);
pstmtStock.setString(1,itemCode);
pstmtStock.setString(2,siteCode);
pstmtStock.setDouble(3,minSelfLife);
//added by ritesh 0n 7/8/13 for request DI3ESUN009 START
if("N".equalsIgnoreCase(activeAllow))
{
......@@ -1027,8 +1061,9 @@ public class StockAllocationPrc extends ProcessEJB implements StockAllocationPrc
varValue2 = dComm.getDisparams("999999","PRSRV_INVSTAT", conn);
pstmtStock.setString(3,varValue1);
pstmtStock.setString(4,varValue2);
pstmtStock.setDouble(5,minSelfLife);
} //added by ritesh 0n 7/8/13 for request DI3ESUN009 START
rs = pstmtStock.executeQuery();
System.out.println("siteCode------"+ siteCode);
System.out.println("itemCode------"+ itemCode);
......@@ -1099,32 +1134,7 @@ public class StockAllocationPrc extends ProcessEJB implements StockAllocationPrc
{
saleOrderArr.add(saleOrderArr.size() , saleOrder);
}
sorditemSql = "SELECT ITEM_CODE,ITEM_CODE__ORD,UNIT, QTY_DESP, ITEM_REF,"
+" QUANTITY - QTY_DESP PENDING_QUANTITY "
+" FROM SORDITEM WHERE SALE_ORDER = '" + saleOrder + "' "
+" AND LINE_NO = '" + lineNo + "' "
+" AND EXP_LEV = '" + expLev + "' ";
System.out.println("sorditemSql:::"+sorditemSql);
st = conn.createStatement();
rsSItem = st.executeQuery(sorditemSql);
if (rsSItem.next())
{
//ITEM_CODE
itemCode = rsSItem.getString(1);
System.out.println("itemCode::::"+ itemCode);
//ITEM_CODE__ORD
itemCodeOrd = rsSItem.getString(2);
//UNIT
unitStd = rsSItem.getString(3);
//QTY_DESP
qtyDesp = 0;
//ITEM_REF
itemRef = rsSItem.getString(5);
//PENDING_QUANTITY
pendingQuantity = rsSItem.getDouble(6);
}
rsSItem.close();
st.close();
updateSorditem ="UPDATE SORDITEM SET QTY_ALLOC = CASE WHEN QTY_ALLOC IS NULL THEN 0 ELSE QTY_ALLOC END + " + new Double(lotQtyToBeAllocated).toString()
+" WHERE SALE_ORDER = '" + saleOrder + "' "
+" AND LINE_NO = '" + lineNo + "' "
......
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