Commit 1e95a822 authored by cpandey's avatar cpandey

added condition for track self life


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@91811 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 43fb0d56
...@@ -13,7 +13,6 @@ import java.io.ByteArrayOutputStream; ...@@ -13,7 +13,6 @@ import java.io.ByteArrayOutputStream;
import java.io.Serializable; import java.io.Serializable;
import java.rmi.RemoteException; import java.rmi.RemoteException;
import java.sql.Connection; import java.sql.Connection;
import java.sql.Date;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
...@@ -23,8 +22,6 @@ import java.util.ArrayList; ...@@ -23,8 +22,6 @@ import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.StringTokenizer; import java.util.StringTokenizer;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import javax.ejb.CreateException;
import javax.ejb.SessionBean;
import javax.xml.transform.OutputKeys; import javax.xml.transform.OutputKeys;
import javax.xml.transform.Transformer; import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory; import javax.xml.transform.TransformerFactory;
...@@ -43,7 +40,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -43,7 +40,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
} }
public void ejbRemove() { public void ejbRemove() {
} }
public void ejbActivate() { public void ejbActivate() {
} }
...@@ -51,10 +48,12 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -51,10 +48,12 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
public void ejbPassivate() { public void ejbPassivate() {
}*/ }*/
CommonConstants commonConstants = new CommonConstants(); CommonConstants commonConstants = new CommonConstants();
@Override
public String actionHandler() throws RemoteException, ITMException { public String actionHandler() throws RemoteException, ITMException {
return ""; return "";
} }
@Override
public String actionHandler(String actionType, String xmlString, public String actionHandler(String actionType, String xmlString,
String xmlString1, String objContext, String xtraParams) String xmlString1, String objContext, String xtraParams)
throws RemoteException, ITMException { throws RemoteException, ITMException {
...@@ -97,6 +96,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -97,6 +96,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
return retString; return retString;
} }
@Override
public String actionHandlerTransform(String actionType, String xmlString, public String actionHandlerTransform(String actionType, String xmlString,
String xmlString1, String objContext, String xtraParams, String xmlString1, String objContext, String xtraParams,
String selDataStr) throws RemoteException, ITMException { String selDataStr) throws RemoteException, ITMException {
...@@ -183,7 +183,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -183,7 +183,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
{ {
sql = "SELECT EXP_LEV, ITEM_CODE, QUANTITY FROM WORKORDER_ISSDET_REQ WHERE TRAN_ID = ?"; sql = "SELECT EXP_LEV, ITEM_CODE, QUANTITY FROM WORKORDER_ISSDET_REQ WHERE TRAN_ID = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranIdReq); pstmt.setString(1,tranIdReq);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
while (rs.next()) while (rs.next())
{ {
...@@ -430,7 +430,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -430,7 +430,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
} }
else if (qcReqd.equalsIgnoreCase("Y") && autoQcReqd.equalsIgnoreCase("N") && trackShelfLife.equalsIgnoreCase("Y") && useInvStatus.equalsIgnoreCase("U")) else if (qcReqd.equalsIgnoreCase("Y") && autoQcReqd.equalsIgnoreCase("N") && trackShelfLife.equalsIgnoreCase("Y") && useInvStatus.equalsIgnoreCase("U"))
{ {
sql = " SELECT COUNT(A.ITEM_CODE) FROM STOCK A, LOCATION B, INVSTAT C " sql = "SELECT COUNT(A.ITEM_CODE) FROM STOCK A, LOCATION B, INVSTAT C "
+ " WHERE A.LOC_CODE = B.LOC_CODE AND B.INV_STAT = C.INV_STAT " + " WHERE A.LOC_CODE = B.LOC_CODE AND B.INV_STAT = C.INV_STAT "
+ " AND A.ITEM_CODE = ? AND A.SITE_CODE = ? AND C.AVAILABLE = 'Y' " + " AND A.ITEM_CODE = ? AND A.SITE_CODE = ? AND C.AVAILABLE = 'Y' "
+ " AND ((CASE WHEN A.QUANTITY IS NULL THEN 0 ELSE A.QUANTITY END) - " + " AND ((CASE WHEN A.QUANTITY IS NULL THEN 0 ELSE A.QUANTITY END) - "
...@@ -455,12 +455,12 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -455,12 +455,12 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
} }
else if (qcReqd.equalsIgnoreCase("N") && trackShelfLife.equalsIgnoreCase("Y") && useInvStatus.equalsIgnoreCase("U")) else if (qcReqd.equalsIgnoreCase("N") && trackShelfLife.equalsIgnoreCase("Y") && useInvStatus.equalsIgnoreCase("U"))
{ {
sql = " SELECT COUNT(A.ITEM_CODE) FROM STOCK A, LOCATION B, INVSTAT C " sql = "SELECT COUNT(A.ITEM_CODE) FROM STOCK A, LOCATION B, INVSTAT C "
+ " WHERE A.LOC_CODE = B.LOC_CODE AND B.INV_STAT = C.INV_STAT AND A.ITEM_CODE = ? " + "WHERE A.LOC_CODE = B.LOC_CODE AND B.INV_STAT = C.INV_STAT AND A.ITEM_CODE = ? "
+ " AND A.SITE_CODE = ? AND C.AVAILABLE = 'Y' " + "AND A.SITE_CODE = ? AND C.AVAILABLE = 'Y' "
+ " AND ((CASE WHEN A.QUANTITY IS NULL THEN 0 ELSE A.QUANTITY END) - " + "AND ((CASE WHEN A.QUANTITY IS NULL THEN 0 ELSE A.QUANTITY END) - "
+ " (CASE WHEN A.ALLOC_QTY IS NULL THEN 0 ELSE A.ALLOC_QTY END)) > 0 " + "(CASE WHEN A.ALLOC_QTY IS NULL THEN 0 ELSE A.ALLOC_QTY END)) > 0 "
+ " AND (A.EXP_DATE > ? OR A.EXP_DATE IS NULL) "; + "AND (A.EXP_DATE > ? OR A.EXP_DATE IS NULL) ";
// 18/02/12 manoharan // 18/02/12 manoharan
if ("Y".equals(considerLotNoIssue) && lotNoIssue != null && !"null".equals(lotNoIssue) && lotNoIssue.trim().length() > 0) if ("Y".equals(considerLotNoIssue) && lotNoIssue != null && !"null".equals(lotNoIssue) && lotNoIssue.trim().length() > 0)
{ {
...@@ -481,7 +481,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -481,7 +481,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
else if (qcReqd.equalsIgnoreCase("Y") && autoQcReqd.equalsIgnoreCase("Y") && trackShelfLife.equalsIgnoreCase("N") && useInvStatus.equalsIgnoreCase("U")) else if (qcReqd.equalsIgnoreCase("Y") && autoQcReqd.equalsIgnoreCase("Y") && trackShelfLife.equalsIgnoreCase("N") && useInvStatus.equalsIgnoreCase("U"))
{ {
sql = " SELECT COUNT(A.ITEM_CODE) FROM STOCK A, LOCATION B, INVSTAT C " sql = " SELECT COUNT(A.ITEM_CODE) FROM STOCK A, LOCATION B, INVSTAT C "
+ " WHERE A.LOC_CODE = B.LOC_CODE AND B.INV_STAT = C.INV_STAT AND A.ITEM_CODE = ? " + " WHERE A.LOC_CODE = B.LOC_CODE AND B.INV_STAT = C.INV_STAT AND A.ITEM_CODE = ? "
+ " AND A.SITE_CODE = ? AND C.AVAILABLE = 'Y' " + " AND A.SITE_CODE = ? AND C.AVAILABLE = 'Y' "
+ " AND ((CASE WHEN A.QUANTITY IS NULL THEN 0 ELSE A.QUANTITY END) - " + " AND ((CASE WHEN A.QUANTITY IS NULL THEN 0 ELSE A.QUANTITY END) - "
+ " (CASE WHEN A.ALLOC_QTY IS NULL THEN 0 ELSE A.ALLOC_QTY END)) > 0 " + " (CASE WHEN A.ALLOC_QTY IS NULL THEN 0 ELSE A.ALLOC_QTY END)) > 0 "
...@@ -986,20 +986,38 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -986,20 +986,38 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
} }
// end 26/03/12 manoharan // end 26/03/12 manoharan
// 02/04/12 manoharan sorting to be doen as per PB logic // 02/04/12 manoharan sorting to be doen as per PB logic
sql = sql + " order by partial_used, (case when '" + locUsageType + "' = 'P' then (case when rtrim(c.loc_group) = rtrim('" + locGroup + "') Then 'A' else 'B' end) else '0' end), " ; //changes by cpandey additin condition for track shelf life on 20/08/12
if ("db2".equalsIgnoreCase(commonConstants.DB_NAME)) if("N".equalsIgnoreCase(trackShelfLife))
{
sql = sql + " order by partial_used,decode('N','P',decode(rtrim(location.loc_group),rtrim(''),'A','B'),'0'), " ;
System.out.println("sql If track self life is N ["+sql+"]>>");
}
if("Y".equalsIgnoreCase(trackShelfLife))
{
sql = sql + " order by partial_used,decode('N','P',decode(rtrim(location.loc_group),rtrim(''),'A','B'),'0'), " ;
System.out.println("sql sql If track self life is Y--["+sql+"]>>");
}
//end of changes on 20/08/12
//commented by cpandey
//sql = sql + " order by partial_used, (case when '" + locUsageType + "' = 'P' then (case when rtrim(c.loc_group) = rtrim('" + locGroup + "') Then 'A' else 'B' end) else '0' end), " ;
if ("db2".equalsIgnoreCase(CommonConstants.DB_NAME))
{ {
sql = sql + " nvl(a.exp_date,a.crea_date),a.crea_date,a.lot_no "; sql = sql + " nvl(a.exp_date,a.crea_date),a.crea_date,a.lot_no ";
} }
else else
{ {
sql = sql + " nvl(a.exp_date,a.crea_date),a.crea_date,a.lot_no, " sql = sql + " nvl(a.exp_date,a.crea_date),a.crea_date,a.lot_no, "
+ " decode(length(decode( substr(rtrim(a.lot_sl), length(rtrim(a.lot_sl))) , 'S',(substr(rtrim(a.lot_sl),1,length(rtrim(a.lot_sl)) - 1)) ,rtrim(a.lot_sl)) ), " + " decode(length(decode( substr(rtrim(a.lot_sl), length(rtrim(a.lot_sl))) ," +
+ " 1, '00' || decode( substr(rtrim(a.lot_sl), length(rtrim(a.lot_sl))) , 'S',(substr(rtrim(a.lot_sl),1,length(rtrim(a.lot_sl)) )) ,rtrim(a.lot_sl)), " " 'S',(substr(rtrim(a.lot_sl),1,length(rtrim(a.lot_sl)) - 1)) ,rtrim(a.lot_sl)) ), "
+ " 1, '00' || decode( substr(rtrim(a.lot_sl), length(rtrim(a.lot_sl))) , " +
"'S',(substr(rtrim(a.lot_sl),1,length(rtrim(a.lot_sl)) )) ,rtrim(a.lot_sl)), "
+" decode(length(decode( substr(rtrim(a.lot_sl), length(rtrim(a.lot_sl))) , 'S',(substr(rtrim(a.lot_sl),1,length(rtrim(a.lot_sl)) - 1)) ,rtrim(a.lot_sl)) ), " +" decode(length(decode( substr(rtrim(a.lot_sl), length(rtrim(a.lot_sl))) , 'S',(substr(rtrim(a.lot_sl),1,length(rtrim(a.lot_sl)) - 1)) ,rtrim(a.lot_sl)) ), "
+ " 2, '0' || decode( substr(rtrim(a.lot_sl), length(rtrim(a.lot_sl))) , 'S',(substr(rtrim(a.lot_sl),1,length(rtrim(a.lot_sl)) )) ,rtrim(a.lot_sl)), " + " 2, '0' || decode( substr(rtrim(a.lot_sl), length(rtrim(a.lot_sl))) , 'S',(substr(rtrim(a.lot_sl),1,length(rtrim(a.lot_sl)) )) ,rtrim(a.lot_sl)), "
+" decode( substr(rtrim(a.lot_sl), length(rtrim(a.lot_sl))) , 'S',(substr(rtrim(a.lot_sl),1,length(rtrim(a.lot_sl)) - 1)) ,rtrim(a.lot_sl)) )) "; +" decode( substr(rtrim(a.lot_sl), length(rtrim(a.lot_sl))) ," +
} " 'S',(substr(rtrim(a.lot_sl),1,length(rtrim(a.lot_sl)) - 1)) ,rtrim(a.lot_sl)) )) ";
}
// end 02/04/12 manoharan // end 02/04/12 manoharan
...@@ -1209,7 +1227,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -1209,7 +1227,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
} }
remainingQty = 0; remainingQty = 0;
} }
else if (stkQty < remainingQty) else if (stkQty < remainingQty)
{ {
inputQty = stkQty; inputQty = stkQty;
remainingQty = remainingQty - inputQty; remainingQty = remainingQty - inputQty;
...@@ -2950,6 +2968,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -2950,6 +2968,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
} }
return retVal; return retVal;
} }
@Override
public ArrayList getDetails(String woCode) throws ITMException public ArrayList getDetails(String woCode) throws ITMException
{ {
PreparedStatement pstmt = null, pstmt1 = null; PreparedStatement pstmt = null, pstmt1 = 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