Commit 6827fc62 authored by rtiwari's avatar rtiwari

change for campgn no. functionality


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@95162 ce508802-f39f-4f6c-b175-0d175dae99d5
parent d169f438
......@@ -76,6 +76,7 @@ public class WoTransferIC extends ValidatorEJB implements WoTransferICLocal,WoTr
ResultSet rs = null;
GenericUtility genericUtility = null;
ConnDriver connDriver = null;
String campNoStr = "";
try
{
genericUtility = GenericUtility.getInstance();
......@@ -97,6 +98,21 @@ public class WoTransferIC extends ValidatorEJB implements WoTransferICLocal,WoTr
childNodeList = parentNode.getChildNodes();
valueXmlString.append("<Detail1>");
int childNodeListLength = childNodeList.getLength();
if (currentColumn.trim().equalsIgnoreCase("campgn_no"))
{
campNoStr = genericUtility.getColumnValue("campgn_no", dom);
System.out.println("::campgn_no::received -" + campNoStr);
if(campNoStr !=null && campNoStr.trim().length() > 0)
{
valueXmlString.append("<work_order protect='1'>").append("<![CDATA[]]>").append("</work_order>");
valueXmlString.append("<batch_quantity protect='1'></batch_quantity>");
}else
{
valueXmlString.append("<work_order protect='0'>").append("<![CDATA[]]>").append("</work_order>");
valueXmlString.append("<batch_quantity protect='0'></batch_quantity>");
}
}
if (currentColumn.trim().equalsIgnoreCase("loc_code__to"))
{
locCode = genericUtility.getColumnValue("loc_code__to", dom);
......
......@@ -101,7 +101,7 @@ public class WoTransferPrc extends ProcessEJB implements WoTransferPrcLocal,WoTr
public String getData(Document headerDom, Document detailDom, String windowName, String xtraParams) throws RemoteException,ITMException
{
String errString = "";
String sql= "",worder="",locCodeTo="",batchQuantity="";
String sql= "",worder="",locCodeTo="",batchQuantity="",campNo="";
String resultString = "",errCode="";
String invstat="",invstat1="",tranIdInvAlloc="";
int cnt=0,lineno=1;
......@@ -131,13 +131,16 @@ public class WoTransferPrc extends ProcessEJB implements WoTransferPrcLocal,WoTr
worder = checkNull(genericUtility.getColumnValue("work_order", headerDom));
locCodeTo = checkNull(genericUtility.getColumnValue("loc_code__to", headerDom));
batchQuantity = checkNull(genericUtility.getColumnValue("batch_quantity", headerDom));
campNo = checkNull(genericUtility.getColumnValue("campgn_no", headerDom));
if(campNo ==null || campNo.trim().length() <=0)
{
if(worder == null || worder.trim().length() <= 0)
{
System.out.println("worder:: is null "+ worder);
errString = itmDBAccessEJB.getErrorString("","VTWKORD1 ","","",conn);
return errString;
}
}
if(locCodeTo == null || locCodeTo.trim().length() <= 0)
{
System.out.println("loc code to is null:: "+ worder);
......@@ -166,6 +169,8 @@ public class WoTransferPrc extends ProcessEJB implements WoTransferPrcLocal,WoTr
return errString;
}
}
if(worder != null && worder.trim().length() > 0)
{
sql = "select quantity from workorder where work_order = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,worder);
......@@ -180,6 +185,25 @@ public class WoTransferPrc extends ProcessEJB implements WoTransferPrcLocal,WoTr
if(pstmt != null)
pstmt.close();
pstmt = null;
}
if(campNo != null && campNo.trim().length() > 0)
{
sql = "select sum(quantity) from workorder where CAMPGN_NO = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,campNo);
rs = pstmt.executeQuery();
if(rs.next())
{
quantity = rs.getDouble(1);
}
if(rs != null)
rs.close();
rs = null;
if(pstmt != null)
pstmt.close();
pstmt = null;
}
System.out.println("@@@ work order quantity ["+quantity+"]");
if(batchQuantity != null && batchQuantity.trim().length() > 0)
{
if(Double.parseDouble(batchQuantity) > quantity)
......@@ -219,6 +243,8 @@ public class WoTransferPrc extends ProcessEJB implements WoTransferPrcLocal,WoTr
return errString;
}
}
if(worder != null && worder.trim().length() > 0)
{
sql = "select tran_id from inv_allocate where WORK_ORDER = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,worder);
......@@ -234,12 +260,32 @@ public class WoTransferPrc extends ProcessEJB implements WoTransferPrcLocal,WoTr
if(pstmt != null)
pstmt.close();
pstmt = null;
}
if(campNo != null && campNo.trim().length() > 0)
{
// sql = "SELECT TRAN_ID FROM INV_ALLOCATE WHERE WORK_ORDER IN (SELECT WORK_ORDER FROM WORKORDER WHERE CAMPGN_NO = ? ) ";
// pstmt = conn.prepareStatement(sql);
// pstmt.setString(1,campNo);
// rs = pstmt.executeQuery();
// while(rs.next())
// {
// tranIdInvAlloc = checkNull(rs.getString("tran_id"));
//
// }
// if(rs != null)
// rs.close();
// rs = null;
// if(pstmt != null)
// pstmt.close();
// pstmt = null;
}
invstat1 = mfgComm.getEnvMfg("999999","MAIN_ST_INVSTAT", conn);
System.out.println("::: XML Cretation::::");
System.out.println("::: XML Creation::::");
// sql = "select tran_id,line_no,item_code,site_code,lot_no,lot_sl,remarks,loc_code,reas_code,quantity,exp_lev,potency_adj from inv_alloc_det where tran_id = ? " +
// " and loc_code in(select loc_code from location where inv_stat = ?) ";
if(worder != null && worder.trim().length() > 0)
{
sql = " select tran_id,item_code,lot_no,lot_sl,loc_code,sum(quantity) as quantity "
+" from inv_alloc_det GROUP BY tran_id, item_code, lot_no, lot_sl, loc_code having tran_id = ? "
+" and loc_code in(select loc_code from location where inv_stat = ? ) ";
......@@ -247,13 +293,40 @@ public class WoTransferPrc extends ProcessEJB implements WoTransferPrcLocal,WoTr
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,tranIdInvAlloc);
pstmt.setString(2,invstat1);
}
if(campNo != null && campNo.trim().length() > 0)
{
sql = " select tran_id,item_code,lot_no,lot_sl,loc_code,sum(quantity) as quantity "
+" from inv_alloc_det GROUP BY tran_id, item_code, lot_no, lot_sl, loc_code having tran_id IN (SELECT TRAN_ID FROM INV_ALLOCATE WHERE WORK_ORDER IN (SELECT WORK_ORDER FROM WORKORDER WHERE CAMPGN_NO = ? AND STATUS = 'R')) "
+" and loc_code in(select loc_code from location where inv_stat = ? ) ORDER BY TRAN_ID";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,campNo);
pstmt.setString(2,invstat1);
}
rs = pstmt.executeQuery();
if(rs.next())
{
do
{
issQty = rs.getDouble("quantity");
if(campNo != null && campNo.trim().length() > 0)
{
sql = " SELECT WORK_ORDER FROM INV_ALLOCATE WHERE TRAN_ID = ? ";
pstmt1 = conn.prepareStatement(sql);
pstmt1.setString(1, rs.getString("tran_id"));
rs1 = pstmt1.executeQuery();
if ( rs1.next() )
{
worder = rs1.getString(1);
}
if(rs1 != null)
rs1.close();
rs1 = null;
if(pstmt1 != null)
pstmt1.close();
pstmt1 = null;
}
sql = "select SUM(quantity) from stock_transfer_det where tran_id in (select tran_id from stock_transfer " +
" where ref_id__for = ?) and item_code = ? and lot_no__fr = ? ";
pstmt1 = conn.prepareStatement(sql);
......@@ -298,10 +371,17 @@ public class WoTransferPrc extends ProcessEJB implements WoTransferPrcLocal,WoTr
pstmt1 = null;
if(quantity > 0)
{
if(campNo == null || campNo.trim().length() <= 0)
{
//allocQty = ((issQty-allocatedQty)/quantity) * Double.parseDouble(batchQuantity);
allocQty = (issQty/quantity) * Double.parseDouble(batchQuantity);
}
if(campNo != null && campNo.trim().length() > 0)
{
allocQty = issQty;
}
}
System.out.println(" ALLOCATED QUANTITY ::"+allocQty);
//if(allocQty > 0)
......@@ -519,8 +599,11 @@ public class WoTransferPrc extends ProcessEJB implements WoTransferPrcLocal,WoTr
parentNodeListLength = parentNodeList.getLength();
System.out.println("parentNodeListLength------------------->"+parentNodeListLength);
String batchQuantityStr = checkNull(genericUtility.getColumnValue("batch_quantity", headerDom));
if(batchQuantityStr != null && batchQuantityStr.trim().length() > 0)
batchQuantity = Double.parseDouble(batchQuantityStr);
System.out.println(" batchQuantity ::"+batchQuantity);
String campNo = checkNull(genericUtility.getColumnValue("campgn_no", headerDom));
System.out.println( "campgn no @@@["+ campNo+"]");
for (int selectedRow = 0; selectedRow < parentNodeListLength; selectedRow++)
{
parentNode = parentNodeList.item(selectedRow);
......@@ -534,13 +617,25 @@ public class WoTransferPrc extends ProcessEJB implements WoTransferPrcLocal,WoTr
System.out.println("childNodeName---->>> "+ childNodeName);
if (childNodeName.equals("tran_id"))
{
if(childNode !=null)
{
if(childNode.getFirstChild() != null)
{
tranId = childNode.getFirstChild().getNodeValue();
}
}
}
if (childNodeName.equals("line_no"))
{
if(childNode !=null)
{
if(childNode.getFirstChild() != null)
{
lineno = childNode.getFirstChild().getNodeValue();
}
}
}
if (childNodeName.equals("site_code"))
{
......@@ -639,9 +734,15 @@ public class WoTransferPrc extends ProcessEJB implements WoTransferPrcLocal,WoTr
}
}
if (childNodeName.equals("work_order"))
{
if(childNode !=null)
{
if(childNode.getFirstChild() != null)
{
worder = childNode.getFirstChild().getNodeValue();
}
}
}
if (childNodeName.equals("remarks"))
{
if(childNode !=null)
......@@ -719,10 +820,28 @@ public class WoTransferPrc extends ProcessEJB implements WoTransferPrcLocal,WoTr
// pstmt = null;
//if((Double.parseDouble(df.format(actualQty - trfedQty)) >= Double.parseDouble(df.format(allocQty2))) || (Double.parseDouble(df.format((allocQty2 + trfedQty)-actualQty)) <= integralQty))
// if((Double.parseDouble(df.format(actualQty - trfedQty)) >= Double.parseDouble(df.format(allocQty2))) || (Double.parseDouble(df.format((allocQty2 + trfedQty)-issueQtyDet)) <= integralQty))
if(campNo != null && campNo.trim().length() > 0)
{
sql = "select quantity from workorder where work_order = ? ";
pstmt = connOne.prepareStatement(sql);
pstmt.setString(1,worder);
rs = pstmt.executeQuery();
if(rs.next())
{
batchQuantity = rs.getDouble(1);
}
if(rs != null)
rs.close();
rs = null;
if(pstmt != null)
pstmt.close();
pstmt = null;
}
if(actualQty > 0.0)
{
if((Double.parseDouble(df.format(actualQty - trfedQty)) >= Double.parseDouble(df.format(allocQty2))) || (Double.parseDouble(df.format(allocQty2 - actualPropQty)) <= integralQty))
{
errString = allocStockToWo(tranId,lineno,siteCode,itemCode,lotno,lotsl,allocQty,reasCode,locCodeFr,explev,locCodeTo,worder,remarks,tranId,actualPropQty,actualQty,batchQuantity,xtraParams,connOne);
System.out.println("err String from STOCKTRANS ="+errString);
}
......@@ -1248,7 +1367,8 @@ public class WoTransferPrc extends ProcessEJB implements WoTransferPrcLocal,WoTr
pstmt = null;
if(count == 0)
{
if( batchQuantity == totWoQty)
if( batchQuantity == totWoQty )
{
sql = " update inv_alloc_det set loc_code = ? where tran_id = ? and item_code = ? and lot_no = ? and lot_sl = ? and loc_code = ? and site_code = ? ";
pstmt = connOne.prepareStatement(sql);
......
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