Commit 1b746d3b authored by manohar's avatar manohar

MF89SUN092 all items button bug fixing


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@91579 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 09faf64a
......@@ -1080,6 +1080,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
lotNo = genericUtility.getColumnValue("lot_no", dom);
lotSl = genericUtility.getColumnValue("lot_sl", dom);
quantity = Double.parseDouble(genericUtility.getColumnValue("quantity", dom));
System.out.println("Manohar quantity [" + quantity + "]");
expLev = genericUtility.getColumnValue("exp_lev", dom);
System.out.println("expLev ::: " + expLev);
reasCode = genericUtility.getColumnValue("reas_code", dom);
......@@ -1244,7 +1245,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
}
}
}
else
else
{
// depending on calc_potency flag potency_adj considered
calcPotency = genericUtility.getColumnValue("calc_potency", dom);
......@@ -1261,7 +1262,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
quantity = quantity + potencyAdjQty;
}
}
System.out.println("lotNo ::: " + lotNo + "lotSl ::: " + lotSl );
System.out.println("Manohar quantity 2 [" + quantity + "]" );
if (lotNo != null && lotNo.trim().length() > 0)
{
if (lotSl == null && lotSl.trim().length() == 0)
......@@ -1362,7 +1363,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
if (rs.next())
{
stockQuantity = rs.getDouble(1);
System.out.println("stockQuantity :"+stockQuantity);
System.out.println("Manohar stockQuantity ["+stockQuantity + "] quantity [" + quantity + "]" );
if (stockQuantity == 0 || quantity > stockQuantity)
{
errCode = "VTSTOCK1";
......@@ -1373,6 +1374,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
}
else
{
System.out.println("Manohar no Stock" );
errCode = "VTSTOCK1";
errString = itmDBAccessEJB.getErrorString("",errCode, loginCode);
return errString;
......@@ -1388,6 +1390,8 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
sqlSb1.append("WHERE A.INV_STAT = B.INV_STAT ");
sqlSb1.append("AND A.ITEM_CODE = ? ");
sqlSb1.append("AND A.SITE_CODE = ? ");
sqlSb1.append(" AND ((CASE WHEN A.QUANTITY IS NULL THEN 0 ELSE A.QUANTITY END) - ");
sqlSb1.append(" (CASE WHEN A.ALLOC_QTY IS NULL THEN 0 ELSE A.ALLOC_QTY END)) > 0 ");
sqlSb1.append("AND B.STAT_TYPE <> 'S'");
if (trackShelfLife.equalsIgnoreCase("Y"))
......@@ -1572,6 +1576,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
if (remainingQty > 0)
{
System.out.println("Manohar remainingQty ["+remainingQty + "]" );
errCode = "VTSTOCK1";
errString = itmDBAccessEJB.getErrorString("",errCode, loginCode);
return errString;
......@@ -1665,7 +1670,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
}
pstmt.close();
rs.close();
if (criteria == "W")
if ("W".equals(criteria))
{
valueXmlString.append("<quantity>").append("<![CDATA[").append(stockQuantity).append("]]>").append("</quantity>\r\n");
}
......@@ -1691,7 +1696,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
{
perArtQty = 1; // TO AVOID DIVIDE BY ZERO ERROR
}
if (criteria == "W")
if ("W".equals(criteria))
{
noArt = stockQuantity/perArtQty;
}
......@@ -1787,7 +1792,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
pstmt.close();
rs.close();
if (orderType.trim() == "T")
if ("T".equals(orderType))
{
mfgLoc = mfgCommon.getEnvMfg("999999", "NON_STOCK", conn);
setValueInDom(dom1, "loc_code", mfgLoc);
......@@ -1846,7 +1851,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
setValueInDom(dom, "item_code", itemCode);
setValueInDom(dom, "item_descr", itemDescr);
if (tranType == "R")
if ("R".equals(tranType))
{
// previous return quantity to consider also.
quantity = getIssueReturnQty(workOrder, expLev, itemCode, itemCodeRef, tranType, operation, bomCode, conn);
......@@ -1927,7 +1932,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
quantity = getPendingQty(workOrder, operation, expLev, conn);
if (tranType == "F")
if ("F".equals(tranType))
{
setValueInDom(dom, "quantity", Double.toString(quantity));
setValueInDom(dom, "unit__alt", unitAlt);
......@@ -1946,7 +1951,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
setValueInDom(dom1, "unit", unit);
if (tranType == "R")
if ("R".equals(tranType))
{
sql = " SELECT COUNT(*) FROM WORKORDER_ISS A,WORKORDER_ISSDET B "
+ " WHERE A.TRAN_ID = B.TRAN_ID AND A.WORK_ORDER = ? "
......@@ -1986,7 +1991,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
// IF W/O RETURN AND ITEM.QC_REQD = 'Y' -- DON'T ALLOW TO CHANGE QC_REQD
// IF WORK ORDER TYPE IS PACKING SET QC_REQD = 'N' EVEN THOUGH RETURN
itemCode = genericUtility.getColumnValue("item_code", dom1);
if (tranType == "R" || orderType == "P")
if ("R".equals(tranType) || "P".equals(orderType))
{
setValueInDom(dom, "qc_reqd", "N");
}
......@@ -2025,7 +2030,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
{
tranIdReq = "";
}
if ((tranType == "D" || tranType == "O") && tranIdReq.trim().length() > 0)
if (("D".equals(tranType) || "O".equals(tranType)) && tranIdReq.trim().length() > 0)
{
sql = " SELECT QUANTITY, ITEM_CODE, UNIT, REAS_CODE FROM WORKORDER_ISSDET_REQ "
+ " WHERE TRAN_ID = ? AND EXP_LEV = ? ";
......@@ -2059,16 +2064,20 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
}
pstmt.close();
rs.close();
System.out.println("Manohar Deviated/Ondemand qtyReq [" + qtyReq + "] totQtyIss [" + totQtyIss + "] reason [" + reason + "]");
setValueInDom(dom, "quantity", Double.toString(qtyReq - totQtyIss));
// SET THE ITEM FROM REQUEST
if (itemCode != null || itemCode.trim().length() > 0)
if (itemCode != null && itemCode.trim().length() > 0)
{
setValueInDom(dom, "item_code", itemCode);
setValueInDom(dom1, "unit", unit);
// REASON CODE SHUD COME FROM ISSUE REQUEST IN CASE OF DEVI AND ONDEMAND ISSUE
setValueInDom(dom1, "reas_code", reason);
setValueInDom(dom, "reas_code", reason);
}
if (reason != null &&reason.trim().length() > 0)
{
setValueInDom(dom, "reas_code", reason);
}
}
//ITEMCHANGE FOR ITEM_CODE BEGINS
......@@ -2147,7 +2156,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
rs.close();
setValueInDom(dom, "qc_reqd", qcReqd);
}
if (tranType == "R")
if ("R".equals(tranType))
{
lineNo = genericUtility.getColumnValue("line_no", dom);
sql = " SELECT SUM(B.QUANTITY) FROM WORKORDER_ISS A, WORKORDER_ISSDET B "
......@@ -2234,7 +2243,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
tranId = "@";
}
if (tranType == "D")
if ("D".equals(tranType))
{
sql = " SELECT A.ITEM_CODE, SUM(CASE WHEN A.QUANTITY IS NULL THEN 0 ELSE A.QUANTITY END + "
+ " CASE WHEN A.POTENCY_ADJ IS NULL THEN 0 ELSE A.POTENCY_ADJ END) "
......@@ -2606,15 +2615,16 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
public ArrayList getDetails(String woCode) throws ITMException
{
PreparedStatement pstmt = null;
PreparedStatement pstmt = null, pstmt1 = null;
ResultSet rs = null;
Connection conn = null;
woStockDtlParams thisBean = null;
ArrayList stkWoList = new ArrayList();
String sql = null;
String trackShelfLife = null;
String itemCode = null;
String itemCode = null,siteCode = null;
Timestamp currDate =null;
double qtyPer = 0;
try
{
......@@ -2636,14 +2646,16 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
if(woCode!=null)
{
sql =" select a.item_code,b.descr from workorder a ,item b "
+" where a.item_code = b.item_code "
+" and a.work_order = ? ";
sql =" select b.item_code,b.descr,a.site_code, sum(c.qty_per) qty_per from workorder a ,item b, bomdet c "
+" where c.item_code = b.item_code "
+ " and c.bom_code = a.bom_code "
+" and a.work_order = ? "
+ " group by b.item_code,b.descr,a.site_code ";
System.out.println("MainQuery:::"+sql);
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,woCode);
rs = pstmt.executeQuery();
pstmt1 = conn.prepareStatement(sql);
pstmt1.setString(1,woCode);
rs = pstmt1.executeQuery();
while(rs.next())
{
......@@ -2652,8 +2664,9 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
thisBean = new woStockDtlParams();
thisBean.itemCode = rs.getString(1);
thisBean.descr = rs.getString(2);
pstmt = null;
siteCode = rs.getString(3);
thisBean.qtyPer = rs.getDouble(4);
pstmt = conn.prepareStatement("select nvl(track_shelf_life,'N') from item where item_code = ?") ;
pstmt.setString(1,itemCode);
ResultSet rs1 = pstmt.executeQuery();
......@@ -2664,16 +2677,17 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
rs1.close();
StringBuffer sb = new StringBuffer();
sb.append("select nvl(sum(a.quantity - a.alloc_qty),0), nvl(sum(a.alloc_qty),0) from stock a, invstat b "
+" where a.inv_stat = b.inv_stat and a.item_code = ? and b.available = 'Y' and b.stat_type <> 'S' and (a.quantity - nvl(a.alloc_qty,0)) > 0 " );
+" where a.inv_stat = b.inv_stat and a.item_code = ? and a.site_code in (select site_code from site where geo_loc in ( select geo_loc from site where site_code = ? )) and b.available = 'Y' and b.stat_type <> 'S' and b.plan_prod = 'Y' and (a.quantity - nvl(a.alloc_qty,0)) > 0 " );
if(trackShelfLife != null && trackShelfLife.equalsIgnoreCase("Y"))
{
sb.append("and ( a.exp_date is null or a.exp_date >?)");
}
pstmt = conn.prepareStatement(sb.toString());
pstmt.setString(1,itemCode);
pstmt.setString(2,siteCode);
if(trackShelfLife != null && trackShelfLife.equalsIgnoreCase("Y"))
{
pstmt.setTimestamp(2,currDate);
pstmt.setTimestamp(3,currDate);
}
rs1 = pstmt.executeQuery();
while(rs1.next())
......@@ -2686,16 +2700,18 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
StringBuffer sbn = new StringBuffer();
sbn.append(" select nvl(sum(a.quantity - a.alloc_qty),0), nvl(sum(a.alloc_qty),0) from stock a, invstat b "
+" where a.inv_stat = b.inv_stat and a.item_code = ? and b.available = 'N' and b.stat_type <> 'S' and (a.quantity - nvl(a.alloc_qty,0)) > 0 " );
+" where a.inv_stat = b.inv_stat and a.item_code = ? and a.site_code in (select site_code from site where geo_loc in ( select geo_loc from site where site_code = ? )) and b.available = 'N' and b.stat_type <> 'S' and (a.quantity - nvl(a.alloc_qty,0)) > 0 " );
if(trackShelfLife.equalsIgnoreCase("Y"))
{
sbn.append("and ( a.exp_date is null or a.exp_date >?)");
}
pstmt = conn.prepareStatement(sbn.toString());
pstmt.setString(1,itemCode);
pstmt.setString(2,siteCode);
if(trackShelfLife.equalsIgnoreCase("Y"))
{
pstmt.setTimestamp(2,currDate);
pstmt.setTimestamp(3,currDate);
}
rs1 = pstmt.executeQuery();
while(rs1.next())
......@@ -2708,6 +2724,10 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
stkWoList.add(thisBean);
}
pstmt1.close();
pstmt1 = null;
rs.close();
rs = null;
}
}
catch (SQLException se)
......@@ -2751,6 +2771,7 @@ public class WOrderIssueAct extends ActionHandlerEJB implements WOrderIssueActL
double stkQty = 0.0;
double nonStkQty = 0.0;
Timestamp currDate =null;
double qtyPer = 0;
}
// Ended by chandni shah - 21-Dec-2011
}
\ No newline at end of file
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