Commit 669bfd88 authored by manohar's avatar manohar

MF89SUN092 various bug fixing


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@91616 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 4e3ff97b
...@@ -504,11 +504,11 @@ public class DespatchAct extends ActionHandlerEJB implements DespatchActLocal, D ...@@ -504,11 +504,11 @@ public class DespatchAct extends ActionHandlerEJB implements DespatchActLocal, D
} }
if(stklotNo == null) if(stklotNo == null)
{ {
stklotNo = ""; stklotNo = " ";
} }
if(stklotSl == null) if(stklotSl == null)
{ {
stklotSl = ""; stklotSl = " ";
} }
if(stkquantity == null) if(stkquantity == null)
{ {
...@@ -531,10 +531,10 @@ public class DespatchAct extends ActionHandlerEJB implements DespatchActLocal, D ...@@ -531,10 +531,10 @@ public class DespatchAct extends ActionHandlerEJB implements DespatchActLocal, D
if (Double.parseDouble(balanceQty) > 0) if (Double.parseDouble(balanceQty) > 0)
{ {
valueXmlString.append("<Detail>\r\n"); valueXmlString.append("<Detail>\r\n");
valueXmlString.append("<item_code>").append("<![CDATA[").append(stkItemCode.trim()).append("]]>").append("</item_code>\r\n"); valueXmlString.append("<item_code>").append("<![CDATA[").append(stkItemCode).append("]]>").append("</item_code>\r\n");
valueXmlString.append("<loc_code>").append("<![CDATA[").append(stkLocCode.trim()).append("]]>").append("</loc_code>\r\n"); valueXmlString.append("<loc_code>").append("<![CDATA[").append(stkLocCode).append("]]>").append("</loc_code>\r\n");
valueXmlString.append("<lot_no>").append("<![CDATA[").append(stklotNo.trim()).append("]]>").append("</lot_no>\r\n"); valueXmlString.append("<lot_no>").append("<![CDATA[").append(stklotNo).append("]]>").append("</lot_no>\r\n");
valueXmlString.append("<lot_sl>").append("<![CDATA[").append(stklotSl.trim()).append("]]>").append("</lot_sl>\r\n"); valueXmlString.append("<lot_sl>").append("<![CDATA[").append(stklotSl).append("]]>").append("</lot_sl>\r\n");
valueXmlString.append("<mfg_date>").append("<![CDATA[").append(stkMfgDate1).append("]]>").append("</mfg_date>\r\n"); valueXmlString.append("<mfg_date>").append("<![CDATA[").append(stkMfgDate1).append("]]>").append("</mfg_date>\r\n");
valueXmlString.append("<exp_date>").append("<![CDATA[").append(stkExpDate1).append("]]>").append("</exp_date>\r\n"); valueXmlString.append("<exp_date>").append("<![CDATA[").append(stkExpDate1).append("]]>").append("</exp_date>\r\n");
//valueXmlString.append("<quantity>").append("<![CDATA[").append(balanceQty.trim()).append("]]>").append("</quantity>\r\n"); //Gulzar 13/03/07 //valueXmlString.append("<quantity>").append("<![CDATA[").append(balanceQty.trim()).append("]]>").append("</quantity>\r\n"); //Gulzar 13/03/07
...@@ -937,7 +937,11 @@ public class DespatchAct extends ActionHandlerEJB implements DespatchActLocal, D ...@@ -937,7 +937,11 @@ public class DespatchAct extends ActionHandlerEJB implements DespatchActLocal, D
if((lotSl == null) || (lotSl != null && lotSl.trim().length() == 0)) if((lotSl == null) || (lotSl != null && lotSl.trim().length() == 0))
{ {
lotSl = " "; lotSl = " ";
}
if((lotNo == null) || (lotNo != null && lotNo.trim().length() == 0))
{
lotNo = " ";
} }
if(cQtyStr != null && cQtyStr.trim().length() > 0) if(cQtyStr != null && cQtyStr.trim().length() > 0)
......
...@@ -276,7 +276,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -276,7 +276,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null; ResultSet rs = null;
Connection conn = null; Connection conn = null;
String lotNo = "", lotSl = "", lotNoIssue = "", considerLotNoIssue = "N"; String lotNo = "", lotSl = "", lotNoIssue = "", considerLotNoIssue = "N", locGroup = "", locUsageType = "";
StringBuffer sqlSB = new StringBuffer(); StringBuffer sqlSB = new StringBuffer();
StringBuffer valueXmlString = new StringBuffer("<?xml version=\"1.0\"?>\r\n<Root>\r\n"); StringBuffer valueXmlString = new StringBuffer("<?xml version=\"1.0\"?>\r\n<Root>\r\n");
...@@ -299,8 +299,9 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -299,8 +299,9 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
expLev = genericUtility.getColumnValue("exp_lev", dom); expLev = genericUtility.getColumnValue("exp_lev", dom);
operation = Integer.parseInt(genericUtility.getColumnValue("operation", dom1)); operation = Integer.parseInt(genericUtility.getColumnValue("operation", dom1));
bomCode = genericUtility.getColumnValue("bom_code", dom1); bomCode = genericUtility.getColumnValue("bom_code", dom1);
locGroup = genericUtility.getColumnValue("loc_group", dom1); // 26/03/12 manoharan
// 18/02/12 manoharan // 18/02/12 manoharan
sql = "select w.LOT_NO__ISSUE,b.CONSIDER_LOT_NO__ISSUE from workorder w, workorder_bill b " sql = "select w.LOT_NO__ISSUE,b.CONSIDER_LOT_NO__ISSUE,b.LOC_USAGE_TYPE from workorder w, workorder_bill b "
+ " where w.work_order = b.work_order " + " where w.work_order = b.work_order "
+ " and w.work_order = ? " + " and w.work_order = ? "
+ " and b.exp_lev = ? "; + " and b.exp_lev = ? ";
...@@ -312,6 +313,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -312,6 +313,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
{ {
lotNoIssue = rs.getString("LOT_NO__ISSUE"); lotNoIssue = rs.getString("LOT_NO__ISSUE");
considerLotNoIssue = rs.getString("CONSIDER_LOT_NO__ISSUE"); considerLotNoIssue = rs.getString("CONSIDER_LOT_NO__ISSUE");
locUsageType = rs.getString("LOC_USAGE_TYPE");
} }
pstmt.close(); pstmt.close();
rs.close(); rs.close();
...@@ -339,6 +341,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -339,6 +341,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
} }
// end 18/02/12 manoharan // end 18/02/12 manoharan
// for qc_reqd to be checked from first siteitem & then item // for qc_reqd to be checked from first siteitem & then item
qcReqd = mfgCommon.chkQcReqd(siteCode, itemCode, conn); qcReqd = mfgCommon.chkQcReqd(siteCode, itemCode, conn);
autoQcReqd = mfgCommon.chkAutoQcReqd(siteCode, itemCode, conn); autoQcReqd = mfgCommon.chkAutoQcReqd(siteCode, itemCode, conn);
...@@ -412,6 +415,12 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -412,6 +415,12 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
sql = sql + " AND A.LOT_NO IN (" + lotNoIssue + ") "; sql = sql + " AND A.LOT_NO IN (" + lotNoIssue + ") ";
} }
// end 18/02/12 manoharan // end 18/02/12 manoharan
// 26/03/12 manoharan
if (locGroup != null && locGroup.trim().length() > 0 && "A".equals(locUsageType) )
{
sql = sql + " AND b.loc_group = '" + locGroup + "' ";
}
// end 26/03/12 manoharan
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, itemCode); pstmt.setString(1, itemCode);
pstmt.setString(2, siteCode); pstmt.setString(2, siteCode);
...@@ -432,6 +441,12 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -432,6 +441,12 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
sql = sql + " AND A.LOT_NO IN (" + lotNoIssue + ") "; sql = sql + " AND A.LOT_NO IN (" + lotNoIssue + ") ";
} }
// end 18/02/12 manoharan // end 18/02/12 manoharan
// 26/03/12 manoharan
if (locGroup != null && locGroup.trim().length() > 0 && "A".equals(locUsageType) )
{
sql = sql + " AND b.loc_group = '" + locGroup + "' ";
}
// end 26/03/12 manoharan
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, itemCode); pstmt.setString(1, itemCode);
pstmt.setString(2, siteCode); pstmt.setString(2, siteCode);
...@@ -451,6 +466,12 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -451,6 +466,12 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
sql = sql + " AND A.LOT_NO IN (" + lotNoIssue + ") "; sql = sql + " AND A.LOT_NO IN (" + lotNoIssue + ") ";
} }
// end 18/02/12 manoharan // end 18/02/12 manoharan
// 26/03/12 manoharan
if (locGroup != null && locGroup.trim().length() > 0 && "A".equals(locUsageType) )
{
sql = sql + " AND b.loc_group = '" + locGroup + "' ";
}
// end 26/03/12 manoharan
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, itemCode); pstmt.setString(1, itemCode);
pstmt.setString(2, siteCode); pstmt.setString(2, siteCode);
...@@ -470,6 +491,12 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -470,6 +491,12 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
sql = sql + " AND A.LOT_NO IN (" + lotNoIssue + ") "; sql = sql + " AND A.LOT_NO IN (" + lotNoIssue + ") ";
} }
// end 18/02/12 manoharan // end 18/02/12 manoharan
// 26/03/12 manoharan
if (locGroup != null && locGroup.trim().length() > 0 && "A".equals(locUsageType) )
{
sql = sql + " AND b.loc_group = '" + locGroup + "' ";
}
// end 26/03/12 manoharan
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, itemCode); pstmt.setString(1, itemCode);
pstmt.setString(2, siteCode); pstmt.setString(2, siteCode);
...@@ -488,6 +515,12 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -488,6 +515,12 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
sql = sql + " AND A.LOT_NO IN (" + lotNoIssue + ") "; sql = sql + " AND A.LOT_NO IN (" + lotNoIssue + ") ";
} }
// end 18/02/12 manoharan // end 18/02/12 manoharan
// 26/03/12 manoharan
if (locGroup != null && locGroup.trim().length() > 0 && "A".equals(locUsageType) )
{
sql = sql + " AND b.loc_group = '" + locGroup + "' ";
}
// end 26/03/12 manoharan
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, itemCode); pstmt.setString(1, itemCode);
pstmt.setString(2, siteCode); pstmt.setString(2, siteCode);
...@@ -505,6 +538,12 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -505,6 +538,12 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
sql = sql + " AND A.LOT_NO IN (" + lotNoIssue + ") "; sql = sql + " AND A.LOT_NO IN (" + lotNoIssue + ") ";
} }
// end 18/02/12 manoharan // end 18/02/12 manoharan
// 26/03/12 manoharan
if (locGroup != null && locGroup.trim().length() > 0 && "A".equals(locUsageType) )
{
sql = sql + " AND b.loc_group = '" + locGroup + "' ";
}
// end 26/03/12 manoharan
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, itemCode); pstmt.setString(1, itemCode);
pstmt.setString(2, siteCode); pstmt.setString(2, siteCode);
...@@ -523,6 +562,12 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -523,6 +562,12 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
sql = sql + " AND A.LOT_NO IN (" + lotNoIssue + ") "; sql = sql + " AND A.LOT_NO IN (" + lotNoIssue + ") ";
} }
// end 18/02/12 manoharan // end 18/02/12 manoharan
// 26/03/12 manoharan
if (locGroup != null && locGroup.trim().length() > 0 && "A".equals(locUsageType) )
{
sql = sql + " AND b.loc_group = '" + locGroup + "' ";
}
// end 26/03/12 manoharan
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, itemCode); pstmt.setString(1, itemCode);
pstmt.setString(2, siteCode); pstmt.setString(2, siteCode);
...@@ -542,6 +587,12 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -542,6 +587,12 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
sql = sql + " AND A.LOT_NO IN (" + lotNoIssue + ") "; sql = sql + " AND A.LOT_NO IN (" + lotNoIssue + ") ";
} }
// end 18/02/12 manoharan // end 18/02/12 manoharan
// 26/03/12 manoharan
if (locGroup != null && locGroup.trim().length() > 0 && "A".equals(locUsageType) )
{
sql = sql + " AND b.loc_group = '" + locGroup + "' ";
}
// end 26/03/12 manoharan
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, itemCode); pstmt.setString(1, itemCode);
pstmt.setString(2, siteCode); pstmt.setString(2, siteCode);
...@@ -560,6 +611,12 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -560,6 +611,12 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
sql = sql + " AND A.LOT_NO IN (" + lotNoIssue + ") "; sql = sql + " AND A.LOT_NO IN (" + lotNoIssue + ") ";
} }
// end 18/02/12 manoharan // end 18/02/12 manoharan
// 26/03/12 manoharan
if (locGroup != null && locGroup.trim().length() > 0 && "A".equals(locUsageType) )
{
sql = sql + " AND b.loc_group = '" + locGroup + "' ";
}
// end 26/03/12 manoharan
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, itemCode); pstmt.setString(1, itemCode);
pstmt.setString(2, siteCode); pstmt.setString(2, siteCode);
...@@ -598,6 +655,12 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -598,6 +655,12 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
sql = sql + " AND A.LOT_NO IN (" + lotNoIssue + ") "; sql = sql + " AND A.LOT_NO IN (" + lotNoIssue + ") ";
} }
// end 18/02/12 manoharan // end 18/02/12 manoharan
// 26/03/12 manoharan
if (locGroup != null && locGroup.trim().length() > 0 && "A".equals(locUsageType) )
{
sql = sql + " AND b.loc_group = '" + locGroup + "' ";
}
// end 26/03/12 manoharan
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, itemCode); pstmt.setString(1, itemCode);
pstmt.setString(2, siteCode); pstmt.setString(2, siteCode);
...@@ -622,6 +685,12 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -622,6 +685,12 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
sql = sql + " AND A.LOT_NO IN (" + lotNoIssue + ") "; sql = sql + " AND A.LOT_NO IN (" + lotNoIssue + ") ";
} }
// end 18/02/12 manoharan // end 18/02/12 manoharan
// 26/03/12 manoharan
if (locGroup != null && locGroup.trim().length() > 0 && "A".equals(locUsageType) )
{
sql = sql + " AND b.loc_group = '" + locGroup + "' ";
}
// end 26/03/12 manoharan
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, itemCode); pstmt.setString(1, itemCode);
pstmt.setString(2, siteCode); pstmt.setString(2, siteCode);
...@@ -644,6 +713,12 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -644,6 +713,12 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
sql = sql + " AND A.LOT_NO IN (" + lotNoIssue + ") "; sql = sql + " AND A.LOT_NO IN (" + lotNoIssue + ") ";
} }
// end 18/02/12 manoharan // end 18/02/12 manoharan
// 26/03/12 manoharan
if (locGroup != null && locGroup.trim().length() > 0 && "A".equals(locUsageType) )
{
sql = sql + " AND b.loc_group = '" + locGroup + "' ";
}
// end 26/03/12 manoharan
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, itemCode); pstmt.setString(1, itemCode);
pstmt.setString(2, siteCode); pstmt.setString(2, siteCode);
...@@ -666,6 +741,12 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -666,6 +741,12 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
sql = sql + " AND A.LOT_NO IN (" + lotNoIssue + ") "; sql = sql + " AND A.LOT_NO IN (" + lotNoIssue + ") ";
} }
// end 18/02/12 manoharan // end 18/02/12 manoharan
// 26/03/12 manoharan
if (locGroup != null && locGroup.trim().length() > 0 && "A".equals(locUsageType) )
{
sql = sql + " AND b.loc_group = '" + locGroup + "' ";
}
// end 26/03/12 manoharan
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, itemCode); pstmt.setString(1, itemCode);
pstmt.setString(2, siteCode); pstmt.setString(2, siteCode);
...@@ -687,6 +768,12 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -687,6 +768,12 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
sql = sql + " AND A.LOT_NO IN (" + lotNoIssue + ") "; sql = sql + " AND A.LOT_NO IN (" + lotNoIssue + ") ";
} }
// end 18/02/12 manoharan // end 18/02/12 manoharan
// 26/03/12 manoharan
if (locGroup != null && locGroup.trim().length() > 0 && "A".equals(locUsageType) )
{
sql = sql + " AND b.loc_group = '" + locGroup + "' ";
}
// end 26/03/12 manoharan
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, itemCode); pstmt.setString(1, itemCode);
pstmt.setString(2, siteCode); pstmt.setString(2, siteCode);
...@@ -707,6 +794,12 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -707,6 +794,12 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
sql = sql + " AND A.LOT_NO IN (" + lotNoIssue + ") "; sql = sql + " AND A.LOT_NO IN (" + lotNoIssue + ") ";
} }
// end 18/02/12 manoharan // end 18/02/12 manoharan
// 26/03/12 manoharan
if (locGroup != null && locGroup.trim().length() > 0 && "A".equals(locUsageType) )
{
sql = sql + " AND b.loc_group = '" + locGroup + "' ";
}
// end 26/03/12 manoharan
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, itemCode); pstmt.setString(1, itemCode);
pstmt.setString(2, siteCode); pstmt.setString(2, siteCode);
...@@ -727,6 +820,12 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -727,6 +820,12 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
sql = sql + " AND A.LOT_NO IN (" + lotNoIssue + ") "; sql = sql + " AND A.LOT_NO IN (" + lotNoIssue + ") ";
} }
// end 18/02/12 manoharan // end 18/02/12 manoharan
// 26/03/12 manoharan
if (locGroup != null && locGroup.trim().length() > 0 && "A".equals(locUsageType) )
{
sql = sql + " AND b.loc_group = '" + locGroup + "' ";
}
// end 26/03/12 manoharan
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, itemCode); pstmt.setString(1, itemCode);
pstmt.setString(2, siteCode); pstmt.setString(2, siteCode);
...@@ -747,6 +846,12 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -747,6 +846,12 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
sql = sql + " AND A.LOT_NO IN (" + lotNoIssue + ") "; sql = sql + " AND A.LOT_NO IN (" + lotNoIssue + ") ";
} }
// end 18/02/12 manoharan // end 18/02/12 manoharan
// 26/03/12 manoharan
if (locGroup != null && locGroup.trim().length() > 0 && "A".equals(locUsageType) )
{
sql = sql + " AND b.loc_group = '" + locGroup + "' ";
}
// end 26/03/12 manoharan
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, itemCode); pstmt.setString(1, itemCode);
pstmt.setString(2, siteCode); pstmt.setString(2, siteCode);
...@@ -768,6 +873,12 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -768,6 +873,12 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
sql = sql + " AND A.LOT_NO IN (" + lotNoIssue + ") "; sql = sql + " AND A.LOT_NO IN (" + lotNoIssue + ") ";
} }
// end 18/02/12 manoharan // end 18/02/12 manoharan
// 26/03/12 manoharan
if (locGroup != null && locGroup.trim().length() > 0 && "A".equals(locUsageType) )
{
sql = sql + " AND b.loc_group = '" + locGroup + "' ";
}
// end 26/03/12 manoharan
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, itemCode); pstmt.setString(1, itemCode);
pstmt.setString(2, siteCode); pstmt.setString(2, siteCode);
...@@ -867,7 +978,13 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -867,7 +978,13 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
sql = sql + " AND A.LOT_NO IN (" + lotNoIssue + ") "; sql = sql + " AND A.LOT_NO IN (" + lotNoIssue + ") ";
} }
// end 18/02/12 manoharan // end 18/02/12 manoharan
// 26/03/12 manoharan
if (locGroup != null && locGroup.trim().length() > 0 && "A".equals(locUsageType) )
{
sql = sql + " AND b.loc_group = '" + locGroup + "' ";
}
// end 26/03/12 manoharan
System.out.println("sqlSB converted ::: "+ sql); System.out.println("sqlSB converted ::: "+ sql);
StringTokenizer st = new StringTokenizer(sql, "?"); StringTokenizer st = new StringTokenizer(sql, "?");
cntQ = st.countTokens(); cntQ = st.countTokens();
...@@ -1197,7 +1314,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -1197,7 +1314,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
double stockQuantity = 0d; double stockQuantity = 0d;
String retNoArt = null; String retNoArt = null, locGroup = "", locUsageType = "";
ArrayList noArtDetArrLst = new ArrayList(); ArrayList noArtDetArrLst = new ArrayList();
PreparedStatement pstmt = null, pstmt1 = null, cpstmt1 = null; PreparedStatement pstmt = null, pstmt1 = null, cpstmt1 = null;
Connection conn = null; Connection conn = null;
...@@ -1238,6 +1355,20 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -1238,6 +1355,20 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
reasCode = genericUtility.getColumnValue("reas_code", dom); reasCode = genericUtility.getColumnValue("reas_code", dom);
calcPotency = genericUtility.getColumnValue("calc_potency", dom); calcPotency = genericUtility.getColumnValue("calc_potency", dom);
tranType = genericUtility.getColumnValue("tran_type", dom1); tranType = genericUtility.getColumnValue("tran_type", dom1);
// 26/03/12 manoharan
locGroup = genericUtility.getColumnValue("loc_group", dom1);
sql = "SELECT loc_usage_type FROM WORKORDER_bill WHERE WORK_ORDER = ? and exp_lev = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, workOrder);
pstmt.setString(2, expLev);
rs = pstmt.executeQuery();
if (rs.next())
{
locUsageType = rs.getString(1);
}
pstmt.close();
rs.close();
if (tranType.equalsIgnoreCase("F")) if (tranType.equalsIgnoreCase("F"))
{ {
...@@ -1449,8 +1580,8 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -1449,8 +1580,8 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
if ((locCode == null || locCode.trim().length() == 0) || (lotNo == null || lotNo.trim().length() == 0)) if ((locCode == null || locCode.trim().length() == 0) || (lotNo == null || lotNo.trim().length() == 0))
{ {
sqlSb.append("SELECT (CASE WHEN SUM(A.QUANTITY - A.ALLOC_QTY) IS NULL THEN 0 ELSE SUM(A.QUANTITY - A.ALLOC_QTY) END) "); sqlSb.append("SELECT (CASE WHEN SUM(A.QUANTITY - A.ALLOC_QTY) IS NULL THEN 0 ELSE SUM(A.QUANTITY - A.ALLOC_QTY) END) ");
sqlSb.append("FROM STOCK A, INVSTAT B "); sqlSb.append("FROM STOCK A, INVSTAT B, LOCATION C ");
sqlSb.append("WHERE A.INV_STAT = B.INV_STAT "); sqlSb.append("WHERE A.LOC_CODE = C.LOC_CODE AND C.INV_STAT = B.INV_STAT ");
sqlSb.append("AND A.ITEM_CODE = ? "); sqlSb.append("AND A.ITEM_CODE = ? ");
sqlSb.append("AND A.SITE_CODE = ? "); sqlSb.append("AND A.SITE_CODE = ? ");
sqlSb.append("AND (A.QUANTITY - (CASE WHEN A.ALLOC_QTY IS NULL THEN 0 ELSE A.ALLOC_QTY END)) > 0 "); sqlSb.append("AND (A.QUANTITY - (CASE WHEN A.ALLOC_QTY IS NULL THEN 0 ELSE A.ALLOC_QTY END)) > 0 ");
...@@ -1475,7 +1606,12 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -1475,7 +1606,12 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
sqlSb.append(" AND DDF_COMPARE_DIMENSION(CASE WHEN A.DIMENSION IS NULL THEN ' ' ELSE A.DIMENSION END, ?, ?) = 'Y'"); sqlSb.append(" AND DDF_COMPARE_DIMENSION(CASE WHEN A.DIMENSION IS NULL THEN ' ' ELSE A.DIMENSION END, ?, ?) = 'Y'");
} }
sql = sqlSb.toString(); sql = sqlSb.toString();
// 26/03/12 manoharan
if (locGroup != null && locGroup.trim().length() > 0 && "A".equals(locUsageType) )
{
sql = sql + " AND c.loc_group = '" + locGroup + "' ";
}
// end 26/03/12 manoharan
System.out.println("sqlSB converted ::: "+ sql); System.out.println("sqlSB converted ::: "+ sql);
StringTokenizer st = new StringTokenizer(sql, "?"); StringTokenizer st = new StringTokenizer(sql, "?");
cntQ = st.countTokens(); cntQ = st.countTokens();
...@@ -1566,6 +1702,12 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -1566,6 +1702,12 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
sqlSb1.append(" AND DDF_COMPARE_DIMENSION(CASE WHEN A.DIMENSION IS NULL THEN ' ' ELSE A.DIMENSION END, ?, ?) = 'Y'"); sqlSb1.append(" AND DDF_COMPARE_DIMENSION(CASE WHEN A.DIMENSION IS NULL THEN ' ' ELSE A.DIMENSION END, ?, ?) = 'Y'");
} }
sql = sqlSb1.toString(); sql = sqlSb1.toString();
// 26/03/12 manoharan
if (locGroup != null && locGroup.trim().length() > 0 && "A".equals(locUsageType) )
{
sql = sql + " AND c.loc_group = '" + locGroup + "' ";
}
// end 26/03/12 manoharan
System.out.println("sqlSB1 converted ::: "+ sql); System.out.println("sqlSB1 converted ::: "+ sql);
StringTokenizer st1 = new StringTokenizer(sql, "?"); StringTokenizer st1 = new StringTokenizer(sql, "?");
...@@ -1740,7 +1882,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -1740,7 +1882,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
// IF LOC_CODE AND LOT NO AND LOT_SL ARE ENTERED BY USER // IF LOC_CODE AND LOT NO AND LOT_SL ARE ENTERED BY USER
// TO CHECK ALL CONDITIONS RELATED QC_REQD & TRACKSHELFLIFE // TO CHECK ALL CONDITIONS RELATED QC_REQD & TRACKSHELFLIFE
sqlSb.append(" SELECT (CASE WHEN SUM(A.QUANTITY-A.ALLOC_QTY) IS NULL THEN 0 ELSE SUM(A.QUANTITY-A.ALLOC_QTY) END)"); sqlSb.append(" SELECT (CASE WHEN SUM(A.QUANTITY-A.ALLOC_QTY) IS NULL THEN 0 ELSE SUM(A.QUANTITY-A.ALLOC_QTY) END)");
sqlSb.append(" FROM STOCK A, INVSTAT B "); sqlSb.append(" FROM STOCK A, INVSTAT B, LOCATION C ");
sqlSb.append(" WHERE A.INV_STAT = B.INV_STAT AND A.ITEM_CODE = ? AND A.SITE_CODE = ? "); sqlSb.append(" WHERE A.INV_STAT = B.INV_STAT AND A.ITEM_CODE = ? AND A.SITE_CODE = ? ");
sqlSb.append(" AND A.LOC_CODE = ? AND A.LOT_NO = ? AND A.LOT_SL = ? "); sqlSb.append(" AND A.LOC_CODE = ? AND A.LOT_NO = ? AND A.LOT_SL = ? ");
sqlSb.append(" AND (A.QUANTITY - A.ALLOC_QTY) >= ? AND B.STAT_TYPE <> 'S' "); sqlSb.append(" AND (A.QUANTITY - A.ALLOC_QTY) >= ? AND B.STAT_TYPE <> 'S' ");
...@@ -1765,6 +1907,12 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL ...@@ -1765,6 +1907,12 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
} }
sql = sqlSb.toString(); sql = sqlSb.toString();
// 26/03/12 manoharan
if (locGroup != null && locGroup.trim().length() > 0 && "A".equals(locUsageType) )
{
sql = sql + " AND c.loc_group = '" + locGroup + "' ";
}
// end 26/03/12 manoharan
System.out.println("sqlSB converted ::: "+ sql); System.out.println("sqlSB converted ::: "+ sql);
StringTokenizer st1 = new StringTokenizer(sql, "?"); StringTokenizer st1 = new StringTokenizer(sql, "?");
......
...@@ -106,12 +106,17 @@ public class UserRightsPrc extends ProcessEJB implements UserRightsPrcLocal , U ...@@ -106,12 +106,17 @@ public class UserRightsPrc extends ProcessEJB implements UserRightsPrcLocal , U
String errCode = ""; String errCode = "";
String errString = ""; String errString = "";
String resultString = ""; String resultString = "";
String curUserId = "", curProfileId = "";
//String profileId =null; //String profileId =null;
double quantity = 0.0,pendingQty = 0.0; double quantity = 0.0,pendingQty = 0.0;
int count = 0; int count = 0, usrLev = 0;
String tApplication = null;
String key = null;
String tWinName = null;
String tMenuName = null;
String sqlStr = "";
try try
{ {
if(conn == null) if(conn == null)
...@@ -124,159 +129,192 @@ public class UserRightsPrc extends ProcessEJB implements UserRightsPrcLocal , U ...@@ -124,159 +129,192 @@ public class UserRightsPrc extends ProcessEJB implements UserRightsPrcLocal , U
userId = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"userId"); userId = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"userId");
profileId = genericUtility.getColumnValue("profile_id", headerDom); profileId = genericUtility.getColumnValue("profile_id", headerDom);
System.out.println("profileId ::- "+ profileId); //System.out.println("profileId ::- "+ profileId);
// 24/03/12 manoharan get the current logged in user and show only the menus for which the current user has rights
curUserId = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginCode");
System.out.println("Current userid curUserId ["+ curUserId + "] profileId [" + profileId + "]");
if (curUserId == null && curUserId.trim().length() == 0)
{
retTabSepStrBuff.append(" \t");
//////////////// //LEVEL_1
//If profile Id is blank or doesnt exist in the User_Rights table then prompt error retTabSepStrBuff.append(" \t");
//String profileSql = " select count(*) " +
// " from user_rights " +
// " where profile_id = '" + profileId + "' " ;
String profileSql = " select count(1) " + //LEVEL_2
" from gencodes " + retTabSepStrBuff.append(" \t");
" where fld_name = 'PROFILE_ID' and fld_value = '" + profileId + "' " ;
int profileCount = 0; //LEVEL_3
System.out.println("ProfileSql :: " + profileSql); retTabSepStrBuff.append(" \t");
PreparedStatement pProfileStmt = null; //LEVEL_4
ResultSet profileRs = null; retTabSepStrBuff.append(" \t");
pProfileStmt = conn.prepareStatement(profileSql); //LEVEL_5
retTabSepStrBuff.append(" \t");
profileRs = pProfileStmt.executeQuery(); //DESCR
retTabSepStrBuff.append(" \t");
if(profileRs.next()) //RIGHTS
{ retTabSepStrBuff.append(" \t");
profileCount = profileRs.getInt(1);
System.out.println("Profile Count = " + profileCount); //WIN_NAME
retTabSepStrBuff.append(" \t");
retTabSepStrBuff.append(" ").append("\t");
retTabSepStrBuff.append("\n");
resultString = retTabSepStrBuff.toString();
} }
else
{
sql = " select profile_id,usr_lev from users where code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,curUserId);
rs = pstmt.executeQuery();
if(rs.next())
{
curProfileId = rs.getString("profile_id");
usrLev = rs.getInt("usr_lev");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
profileRs.close(); System.out.println("Current curProfileId ["+ curProfileId + "] usrLev [" + usrLev + "]");
profileRs = null;
pProfileStmt.close(); ////////////////
pProfileStmt = null; //If profile Id is blank or doesnt exist in the User_Rights table then prompt error
/////////////// //String profileSql = " select count(*) " +
// " from user_rights " +
// " where profile_id = '" + profileId + "' " ;
if(profileCount == 0) String profileSql = " select count(1) " +
{ " from gencodes " +
errString = itmDBAccessEJB.getErrorString("","PNOTEXIST","","",conn); " where fld_name = 'PROFILE_ID' and fld_value = '" + profileId + "' " ;
return errString;
}
}
catch(Exception e)
{
}
userRightsMap = new HashMap(); int profileCount = 0;
winNameMap = new HashMap(); System.out.println("ProfileSql :: " + profileSql);
menuNameMap = new HashMap();
String sqlStr = " SELECT ITM2MENU.APPLICATION, " +
" ITM2MENU.LEVEL_1, " +
" ITM2MENU.LEVEL_2, " +
" ITM2MENU.LEVEL_3, " +
" ITM2MENU.LEVEL_4, " +
" ITM2MENU.LEVEL_5, " +
" ITM2MENU.WIN_NAME, " +
" ITM2MENU.DESCR, " +
" (SELECT USER_RIGHTS.RIGHTS FROM USER_RIGHTS " +
" WHERE USER_RIGHTS.PROFILE_ID = '" + profileId + "' " +
" AND USER_RIGHTS.APPLICATION = ITM2MENU.APPLICATION " +
" AND USER_RIGHTS.MENU_ROW = ITM2MENU.LEVEL_1 " +
" AND USER_RIGHTS.MENU_COL = ITM2MENU.LEVEL_2 " +
" AND USER_RIGHTS.MENU_SUBCOL = ITM2MENU.LEVEL_3 " +
" AND USER_RIGHTS.LEVEL_4 = ITM2MENU.LEVEL_4 " +
" AND USER_RIGHTS.LEVEL_5 = ITM2MENU.LEVEL_5 " +
" ) AS RIGHTS " +
" FROM ITM2MENU " +
" ORDER BY ITM2MENU.APPLICATION, ITM2MENU.LEVEL_1, ITM2MENU.LEVEL_2, ITM2MENU.LEVEL_3, ITM2MENU.LEVEL_4, ITM2MENU.LEVEL_5 ";
/*
" SELECT ITM2MENU.APPLICATION, "+
" ITM2MENU.LEVEL_1, "+
" ITM2MENU.LEVEL_2, "+
" ITM2MENU.LEVEL_3, "+
" ITM2MENU.LEVEL_4, "+
" ITM2MENU.LEVEL_5, "+
" ITM2MENU.WIN_NAME, "+
" ITM2MENU.DESCR, "+
" USER_RIGHTS.RIGHTS "+
" FROM ITM2MENU "+
" LEFT OUTER JOIN USER_RIGHTS ON "+
" ITM2MENU.APPLICATION = USER_RIGHTS.APPLICATION "+
" AND ITM2MENU.LEVEL_1 = USER_RIGHTS.MENU_ROW "+
" AND ITM2MENU.LEVEL_2 = USER_RIGHTS.MENU_COL "+
" AND ITM2MENU.LEVEL_3 = USER_RIGHTS.MENU_SUBCOL "+
" AND ITM2MENU.LEVEL_4 = USER_RIGHTS.LEVEL_4 "+
" AND ITM2MENU.LEVEL_5 = USER_RIGHTS.LEVEL_5 "+
" WHERE (USER_RIGHTS.PROFILE_ID = '" + profileId + "'" +
" OR USER_RIGHTS.PROFILE_ID is null )" +
" ORDER BY ITM2MENU.APPLICATION, ITM2MENU.LEVEL_1, ITM2MENU.LEVEL_2, ITM2MENU.LEVEL_3 ";
*/
try PreparedStatement pProfileStmt = null;
{ ResultSet profileRs = null;
pstmt = conn.prepareStatement(sqlStr);
System.out.println("The getData sql is:-"+ sqlStr); pProfileStmt = conn.prepareStatement(profileSql);
rs = pstmt.executeQuery();
while (rs.next())
{
String tApplication = null;
String key = null;
String tWinName = null;
String tMenuName = null;
tApplication = rs.getString(1); profileRs = pProfileStmt.executeQuery();
if(profileRs.next())
{
profileCount = profileRs.getInt(1);
System.out.println("Profile Count = " + profileCount);
}
if(tApplication != null) profileRs.close();
key = tApplication + ":" + rs.getInt(2) + ":" + rs.getInt(3) + ":" + rs.getInt(4) profileRs = null;
+ ":" + rs.getInt(5) + ":" + rs.getInt(6);
//APPLICATION pProfileStmt.close();
retTabSepStrBuff.append(tApplication==null?"":rs.getString(1)).append("\t"); pProfileStmt = null;
///////////////
//LEVEL_1 if(profileCount == 0)
retTabSepStrBuff.append(rs.getInt(2)).append("\t"); {
errString = itmDBAccessEJB.getErrorString("","PNOTEXIST","","",conn);
return errString;
}
//LEVEL_2 userRightsMap = new HashMap();
retTabSepStrBuff.append(rs.getInt(3)).append("\t"); winNameMap = new HashMap();
menuNameMap = new HashMap();
sqlStr = " SELECT ITM2MENU.APPLICATION, " +
" ITM2MENU.LEVEL_1, " +
" ITM2MENU.LEVEL_2, " +
" ITM2MENU.LEVEL_3, " +
" ITM2MENU.LEVEL_4, " +
" ITM2MENU.LEVEL_5, " +
" ITM2MENU.WIN_NAME, " +
" ITM2MENU.DESCR, " +
" (SELECT USER_RIGHTS.RIGHTS FROM USER_RIGHTS " +
" WHERE USER_RIGHTS.PROFILE_ID = ? " +
" AND USER_RIGHTS.APPLICATION = ITM2MENU.APPLICATION " +
" AND USER_RIGHTS.MENU_ROW = ITM2MENU.LEVEL_1 " +
" AND USER_RIGHTS.MENU_COL = ITM2MENU.LEVEL_2 " +
" AND USER_RIGHTS.MENU_SUBCOL = ITM2MENU.LEVEL_3 " +
" AND USER_RIGHTS.LEVEL_4 = ITM2MENU.LEVEL_4 " +
" AND USER_RIGHTS.LEVEL_5 = ITM2MENU.LEVEL_5 " +
" ) AS RIGHTS " +
" FROM ITM2MENU " ;
if (usrLev > 0 )
{
sqlStr = sqlStr + " where exists (select 1 from user_rights u "
+ " where u.profile_id in ('" + curProfileId + "','" + profileId + "') "
+ " and u.application = ITM2MENU.application "
+ " and u.menu_row = ITM2MENU.level_1 "
+ " and u.menu_col = ITM2MENU.level_2 "
+ " and u.menu_subcol = ITM2MENU.level_3 "
+ " and u.level_4 = ITM2MENU.level_4 "
+ " and u.level_5 = ITM2MENU.level_5) " ;
}
sqlStr = sqlStr + " ORDER BY ITM2MENU.APPLICATION, ITM2MENU.LEVEL_1, ITM2MENU.LEVEL_2, ITM2MENU.LEVEL_3, ITM2MENU.LEVEL_4, ITM2MENU.LEVEL_5 ";
pstmt = conn.prepareStatement(sqlStr);
pstmt.setString(1,profileId);
//System.out.println("The getData sql is:-"+ sqlStr);
rs = pstmt.executeQuery();
while (rs.next())
{
//LEVEL_3 tApplication = rs.getString(1);
retTabSepStrBuff.append(rs.getInt(4)).append("\t");
//LEVEL_4 if(tApplication != null)
retTabSepStrBuff.append(rs.getInt(5)).append("\t"); key = tApplication + ":" + rs.getInt(2) + ":" + rs.getInt(3) + ":" + rs.getInt(4)
+ ":" + rs.getInt(5) + ":" + rs.getInt(6);
//LEVEL_5 //APPLICATION
retTabSepStrBuff.append(rs.getInt(6)).append("\t"); retTabSepStrBuff.append(tApplication==null?"":rs.getString(1)).append("\t");
//DESCR //LEVEL_1
tMenuName = rs.getString(8); retTabSepStrBuff.append(rs.getInt(2)).append("\t");
retTabSepStrBuff.append(rs.getString(8)==null?"":rs.getString(8)).append("\t");
//RIGHTS //LEVEL_2
retTabSepStrBuff.append(rs.getString(9)==null?"":rs.getString(9)).append("\t"); retTabSepStrBuff.append(rs.getInt(3)).append("\t");
//WIN_NAME //LEVEL_3
tWinName = rs.getString(7); retTabSepStrBuff.append(rs.getInt(4)).append("\t");
retTabSepStrBuff.append(rs.getString(7)==null?"":rs.getString(7)).append("\t");
retTabSepStrBuff.append(" ").append("\t"); //LEVEL_4
retTabSepStrBuff.append("\n"); retTabSepStrBuff.append(rs.getInt(5)).append("\t");
System.out.println("Key getdata function ["+key+"]"); //LEVEL_5
System.out.println("rights in function ["+ rs.getString(9) +"]"); retTabSepStrBuff.append(rs.getInt(6)).append("\t");
userRightsMap.put(key, rs.getString(9));
if(tWinName != null && tWinName.trim().length() > 2)
winNameMap.put(key, tWinName.trim().substring(2, tWinName.trim().length()));
menuNameMap.put(key, tMenuName); //DESCR
}//while tMenuName = rs.getString(8);
retTabSepStrBuff.append(rs.getString(8)==null?"":rs.getString(8)).append("\t");
//RIGHTS
retTabSepStrBuff.append(rs.getString(9)==null?"":rs.getString(9)).append("\t");
//WIN_NAME
tWinName = rs.getString(7);
retTabSepStrBuff.append(rs.getString(7)==null?"":rs.getString(7)).append("\t");
retTabSepStrBuff.append(" ").append("\t");
retTabSepStrBuff.append("\n");
System.out.println("Key getdata function ["+key+"]");
System.out.println("rights in function ["+ rs.getString(9) +"]");
userRightsMap.put(key, rs.getString(9));
if(tWinName != null && tWinName.trim().length() > 2)
winNameMap.put(key, tWinName.trim().substring(2, tWinName.trim().length()));
menuNameMap.put(key, tMenuName);
}//while
}
// end 24/03/12 manoharan
}//try }//try
catch (SQLException e) catch (SQLException e)
{ {
...@@ -742,7 +780,7 @@ public class UserRightsPrc extends ProcessEJB implements UserRightsPrcLocal , U ...@@ -742,7 +780,7 @@ public class UserRightsPrc extends ProcessEJB implements UserRightsPrcLocal , U
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null; ResultSet rs = null;
String alreadyExists = "N";
String sql = " SELECT RIGHTS FROM USER_RIGHTS " String sql = " SELECT RIGHTS FROM USER_RIGHTS "
+ " WHERE PROFILE_ID = ? " + " WHERE PROFILE_ID = ? "
+ " AND APPLICATION = ? " + " AND APPLICATION = ? "
...@@ -768,6 +806,7 @@ public class UserRightsPrc extends ProcessEJB implements UserRightsPrcLocal , U ...@@ -768,6 +806,7 @@ public class UserRightsPrc extends ProcessEJB implements UserRightsPrcLocal , U
if (rs.next()) if (rs.next())
{ {
foundRights = rs.getString(1); foundRights = rs.getString(1);
alreadyExists = "Y";
} }
rs.close(); rs.close();
rs = null; rs = null;
...@@ -777,11 +816,11 @@ public class UserRightsPrc extends ProcessEJB implements UserRightsPrcLocal , U ...@@ -777,11 +816,11 @@ public class UserRightsPrc extends ProcessEJB implements UserRightsPrcLocal , U
System.out.println("Found rights in function ["+foundRights+"]"); System.out.println("Found rights in function ["+foundRights+"]");
if(foundRights == null && rights != null) if(foundRights == null && rights != null && "N".equals(alreadyExists))
operation = 1; operation = 1;
else if(foundRights != null && rights != null) else if((foundRights != null && rights != null) || ("Y".equals(alreadyExists) && foundRights == null && rights != null) )
operation = 2; operation = 2;
else if(foundRights != null && rights == null) else if(foundRights != null && rights == null && "Y".equals(alreadyExists))
operation = 3; operation = 3;
return operation; return operation;
......
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