Commit 068335ac authored by rtiwari's avatar rtiwari

updated


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@94298 ce508802-f39f-4f6c-b175-0d175dae99d5
parent d7b66801
......@@ -87,12 +87,12 @@ public class WoVolatileLossAct extends ActionHandlerEJB implements WoVolatileLos
{
String sql="";
String worder = "",itemCode= "",qtyFdStr="",itemCodeBom="";
String VolatileItem= "",siteCode="",locCode="",VolatileItemDescr="";
String scrapItem="",scrapItemDescr="";
String VolatileItem= " ",siteCode="",locCode="",VolatileItemDescr="";
String scrapItem=" ",scrapItemDescr="";
ResultSet rs = null;
Connection conn = null;
StringBuffer valueXmlString = new StringBuffer("<?xml version=\"1.0\"?>\r\n<Root>\r\n");
double qtyFd =0d,billQty = 0d,procLossPerc = 0d,scrapPerc=0d,batchQty=0d;
double qtyFd =0d,billQty = 0d,procLossPerc = 0d,scrapPerc=0d,batchQty=0d,requiredItemQty=0d;
double volatileQty = 0d,scrapQty = 0d ;
PreparedStatement pstmt = null;
ConnDriver connDriver = new ConnDriver();
......@@ -119,18 +119,18 @@ public class WoVolatileLossAct extends ActionHandlerEJB implements WoVolatileLos
String phyattScrabPerc = mfgComm.getEnvMfg("999999","ITEM_PERC_SCRAP", conn);
String phyattScrabItem = mfgComm.getEnvMfg("999999","SCRAP_ITEM_COL", conn);
// sql = " select quantity from workorder_bill where work_order = ? and item_code = ? ";
// pstmt = conn.prepareStatement(sql);
// pstmt.setString(1,worder);
// pstmt.setString(2,itemCode);
// rs = pstmt.executeQuery();
// if(rs.next())
// {
// billQty = rs.getDouble(1);
// }
// pstmt.close();pstmt = null;
// rs.close();rs = null;
sql = " select quantity from workorder_bill where work_order = ? and item_code = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,worder);
pstmt.setString(2,itemCode);
rs = pstmt.executeQuery();
if(rs.next())
{
billQty = rs.getDouble(1);
}
pstmt.close();pstmt = null;
rs.close();rs = null;
//
sql = " select batch_qty from bom where bom_code in (select bom_code from workorder where work_order = ?) ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,worder);
......@@ -142,7 +142,7 @@ public class WoVolatileLossAct extends ActionHandlerEJB implements WoVolatileLos
pstmt.close();pstmt = null;
rs.close();rs = null;
sql = " select qty_per,proc_loss_perc,item_code from bomdet where bom_code in (select bom_code from workorder where work_order = ? ) "+
sql = " select proc_loss_perc,item_code from bomdet where bom_code in (select bom_code from workorder where work_order = ? ) "+
" and (proc_loss_perc is not null or length(trim(proc_loss_perc)) > 0) ";
pstmt = conn.prepareStatement(sql);
......@@ -150,12 +150,25 @@ public class WoVolatileLossAct extends ActionHandlerEJB implements WoVolatileLos
rs = pstmt.executeQuery();
if(rs.next())
{
billQty = rs.getDouble(1);
procLossPerc = rs.getDouble(2);
itemCodeBom = rs.getString(3) == null ?"":rs.getString(3);
procLossPerc = rs.getDouble(1);
itemCodeBom = rs.getString(2) == null ?"":rs.getString(2);
}
pstmt.close();pstmt = null;
rs.close();rs = null;
sql = " select quantity from workorder_bill where work_order = ? and item_code = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,worder);
pstmt.setString(2,itemCodeBom);
rs = pstmt.executeQuery();
if(rs.next())
{
requiredItemQty = rs.getDouble(1);
}
pstmt.close();pstmt = null;
rs.close();rs = null;
if( !("NULLFOUND").equalsIgnoreCase(phyAttVolItem))
{
sql = " select "+phyAttVolItem +" from item where item_code = ? ";
......@@ -164,7 +177,7 @@ public class WoVolatileLossAct extends ActionHandlerEJB implements WoVolatileLos
rs = pstmt.executeQuery();
if(rs.next())
{
VolatileItem = rs.getString(1);
VolatileItem = rs.getString(1)== null ? " ":rs.getString(1);
}
pstmt.close();pstmt = null;
rs.close();rs = null;
......@@ -189,10 +202,11 @@ public class WoVolatileLossAct extends ActionHandlerEJB implements WoVolatileLos
}
pstmt.close();pstmt = null;
rs.close();rs = null;
if(billQty > 0)
// volatileQty = ((billQty * qtyFd)/batchQty)*(procLossPerc/100);
volatileQty = ((requiredItemQty * qtyFd)/batchQty)*(procLossPerc/100);
if(volatileQty > 0 && VolatileItem.trim().length() > 0)
{
volatileQty = ((billQty * qtyFd)/batchQty)*(procLossPerc/100);
volatileQty = ((requiredItemQty * qtyFd)/batchQty)*(procLossPerc/100);
valueXmlString.append("<Detail>\r\n");
valueXmlString.append("<quantity>").append("<![CDATA[").append(df.format(volatileQty)).append("]]>").append("</quantity>\r\n");
......@@ -213,7 +227,7 @@ public class WoVolatileLossAct extends ActionHandlerEJB implements WoVolatileLos
if(rs.next())
{
String scrapPercstr = rs.getString(1) == null ?"0.0":rs.getString(1);
scrapItem = rs.getString(2)== null ?"":rs.getString(2);
scrapItem = rs.getString(2)== null ?" ":rs.getString(2);
scrapPerc = Double.parseDouble(scrapPercstr);
}
pstmt.close();pstmt = null;
......@@ -229,9 +243,11 @@ public class WoVolatileLossAct extends ActionHandlerEJB implements WoVolatileLos
}
pstmt.close();pstmt = null;
rs.close();rs = null;
if(billQty > 0)
//scrapQty = ((billQty * qtyFd)/batchQty)*(scrapPerc/100);
scrapQty = ((batchQty * qtyFd)/billQty)*(scrapPerc/100);
if(scrapQty > 0 && scrapItem.trim().length() > 0)
{
scrapQty = ((billQty * qtyFd)/batchQty)*(scrapPerc/100);
valueXmlString.append("<Detail>\r\n");
valueXmlString.append("<quantity>").append("<![CDATA[").append(df.format(scrapQty)).append("]]>").append("</quantity>\r\n");
......
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