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 ...@@ -76,6 +76,7 @@ public class WoTransferIC extends ValidatorEJB implements WoTransferICLocal,WoTr
ResultSet rs = null; ResultSet rs = null;
GenericUtility genericUtility = null; GenericUtility genericUtility = null;
ConnDriver connDriver = null; ConnDriver connDriver = null;
String campNoStr = "";
try try
{ {
genericUtility = GenericUtility.getInstance(); genericUtility = GenericUtility.getInstance();
...@@ -97,6 +98,21 @@ public class WoTransferIC extends ValidatorEJB implements WoTransferICLocal,WoTr ...@@ -97,6 +98,21 @@ public class WoTransferIC extends ValidatorEJB implements WoTransferICLocal,WoTr
childNodeList = parentNode.getChildNodes(); childNodeList = parentNode.getChildNodes();
valueXmlString.append("<Detail1>"); valueXmlString.append("<Detail1>");
int childNodeListLength = childNodeList.getLength(); 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")) if (currentColumn.trim().equalsIgnoreCase("loc_code__to"))
{ {
locCode = genericUtility.getColumnValue("loc_code__to", dom); locCode = genericUtility.getColumnValue("loc_code__to", dom);
......
...@@ -101,7 +101,7 @@ public class WoTransferPrc extends ProcessEJB implements WoTransferPrcLocal,WoTr ...@@ -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 public String getData(Document headerDom, Document detailDom, String windowName, String xtraParams) throws RemoteException,ITMException
{ {
String errString = ""; String errString = "";
String sql= "",worder="",locCodeTo="",batchQuantity=""; String sql= "",worder="",locCodeTo="",batchQuantity="",campNo="";
String resultString = "",errCode=""; String resultString = "",errCode="";
String invstat="",invstat1="",tranIdInvAlloc=""; String invstat="",invstat1="",tranIdInvAlloc="";
int cnt=0,lineno=1; int cnt=0,lineno=1;
...@@ -131,12 +131,15 @@ public class WoTransferPrc extends ProcessEJB implements WoTransferPrcLocal,WoTr ...@@ -131,12 +131,15 @@ public class WoTransferPrc extends ProcessEJB implements WoTransferPrcLocal,WoTr
worder = checkNull(genericUtility.getColumnValue("work_order", headerDom)); worder = checkNull(genericUtility.getColumnValue("work_order", headerDom));
locCodeTo = checkNull(genericUtility.getColumnValue("loc_code__to", headerDom)); locCodeTo = checkNull(genericUtility.getColumnValue("loc_code__to", headerDom));
batchQuantity = checkNull(genericUtility.getColumnValue("batch_quantity", headerDom)); batchQuantity = checkNull(genericUtility.getColumnValue("batch_quantity", headerDom));
campNo = checkNull(genericUtility.getColumnValue("campgn_no", headerDom));
if(worder == null || worder.trim().length() <= 0) if(campNo ==null || campNo.trim().length() <=0)
{ {
System.out.println("worder:: is null "+ worder); if(worder == null || worder.trim().length() <= 0)
errString = itmDBAccessEJB.getErrorString("","VTWKORD1 ","","",conn); {
return errString; System.out.println("worder:: is null "+ worder);
errString = itmDBAccessEJB.getErrorString("","VTWKORD1 ","","",conn);
return errString;
}
} }
if(locCodeTo == null || locCodeTo.trim().length() <= 0) if(locCodeTo == null || locCodeTo.trim().length() <= 0)
{ {
...@@ -166,20 +169,41 @@ public class WoTransferPrc extends ProcessEJB implements WoTransferPrcLocal,WoTr ...@@ -166,20 +169,41 @@ public class WoTransferPrc extends ProcessEJB implements WoTransferPrcLocal,WoTr
return errString; return errString;
} }
} }
sql = "select quantity from workorder where work_order = ? "; if(worder != null && worder.trim().length() > 0)
pstmt = conn.prepareStatement(sql); {
pstmt.setString(1,worder); sql = "select quantity from workorder where work_order = ? ";
rs = pstmt.executeQuery(); pstmt = conn.prepareStatement(sql);
if(rs.next()) pstmt.setString(1,worder);
{ rs = pstmt.executeQuery();
quantity = rs.getDouble(1); if(rs.next())
} {
if(rs != null) quantity = rs.getDouble(1);
rs.close(); }
rs = null; if(rs != null)
if(pstmt != null) rs.close();
pstmt.close(); rs = null;
pstmt = null; 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(batchQuantity != null && batchQuantity.trim().length() > 0)
{ {
if(Double.parseDouble(batchQuantity) > quantity) if(Double.parseDouble(batchQuantity) > quantity)
...@@ -219,41 +243,90 @@ public class WoTransferPrc extends ProcessEJB implements WoTransferPrcLocal,WoTr ...@@ -219,41 +243,90 @@ public class WoTransferPrc extends ProcessEJB implements WoTransferPrcLocal,WoTr
return errString; return errString;
} }
} }
sql = "select tran_id from inv_allocate where WORK_ORDER = ? "; if(worder != null && worder.trim().length() > 0)
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,worder);
rs = pstmt.executeQuery();
if(rs.next())
{ {
tranIdInvAlloc = checkNull(rs.getString("tran_id")); sql = "select tran_id from inv_allocate where WORK_ORDER = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,worder);
rs = pstmt.executeQuery();
if(rs.next())
{
tranIdInvAlloc = checkNull(rs.getString("tran_id"));
}
if(rs != null)
rs.close();
rs = null;
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;
} }
if(rs != null)
rs.close();
rs = null;
if(pstmt != null)
pstmt.close();
pstmt = null;
invstat1 = mfgComm.getEnvMfg("999999","MAIN_ST_INVSTAT", conn); 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 = ? " + // 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 = ?) "; // " and loc_code in(select loc_code from location where inv_stat = ?) ";
sql = " select tran_id,item_code,lot_no,lot_sl,loc_code,sum(quantity) as quantity " if(worder != null && worder.trim().length() > 0)
+" 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 = ? ) "; 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 = ? "
pstmt = conn.prepareStatement(sql); +" and loc_code in(select loc_code from location where inv_stat = ? ) ";
pstmt.setString(1,tranIdInvAlloc);
pstmt.setString(2,invstat1); 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(); rs = pstmt.executeQuery();
if(rs.next()) if(rs.next())
{ {
do do
{ {
issQty = rs.getDouble("quantity"); 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 " + 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 = ? "; " where ref_id__for = ?) and item_code = ? and lot_no__fr = ? ";
pstmt1 = conn.prepareStatement(sql); pstmt1 = conn.prepareStatement(sql);
...@@ -299,8 +372,15 @@ public class WoTransferPrc extends ProcessEJB implements WoTransferPrcLocal,WoTr ...@@ -299,8 +372,15 @@ public class WoTransferPrc extends ProcessEJB implements WoTransferPrcLocal,WoTr
if(quantity > 0) if(quantity > 0)
{ {
if(campNo == null || campNo.trim().length() <= 0)
{
//allocQty = ((issQty-allocatedQty)/quantity) * Double.parseDouble(batchQuantity); //allocQty = ((issQty-allocatedQty)/quantity) * Double.parseDouble(batchQuantity);
allocQty = (issQty/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); System.out.println(" ALLOCATED QUANTITY ::"+allocQty);
...@@ -519,8 +599,11 @@ public class WoTransferPrc extends ProcessEJB implements WoTransferPrcLocal,WoTr ...@@ -519,8 +599,11 @@ public class WoTransferPrc extends ProcessEJB implements WoTransferPrcLocal,WoTr
parentNodeListLength = parentNodeList.getLength(); parentNodeListLength = parentNodeList.getLength();
System.out.println("parentNodeListLength------------------->"+parentNodeListLength); System.out.println("parentNodeListLength------------------->"+parentNodeListLength);
String batchQuantityStr = checkNull(genericUtility.getColumnValue("batch_quantity", headerDom)); String batchQuantityStr = checkNull(genericUtility.getColumnValue("batch_quantity", headerDom));
if(batchQuantityStr != null && batchQuantityStr.trim().length() > 0)
batchQuantity = Double.parseDouble(batchQuantityStr); batchQuantity = Double.parseDouble(batchQuantityStr);
System.out.println(" batchQuantity ::"+batchQuantity); 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++) for (int selectedRow = 0; selectedRow < parentNodeListLength; selectedRow++)
{ {
parentNode = parentNodeList.item(selectedRow); parentNode = parentNodeList.item(selectedRow);
...@@ -535,11 +618,23 @@ public class WoTransferPrc extends ProcessEJB implements WoTransferPrcLocal,WoTr ...@@ -535,11 +618,23 @@ public class WoTransferPrc extends ProcessEJB implements WoTransferPrcLocal,WoTr
if (childNodeName.equals("tran_id")) if (childNodeName.equals("tran_id"))
{ {
tranId = childNode.getFirstChild().getNodeValue(); if(childNode !=null)
{
if(childNode.getFirstChild() != null)
{
tranId = childNode.getFirstChild().getNodeValue();
}
}
} }
if (childNodeName.equals("line_no")) if (childNodeName.equals("line_no"))
{ {
lineno = childNode.getFirstChild().getNodeValue(); if(childNode !=null)
{
if(childNode.getFirstChild() != null)
{
lineno = childNode.getFirstChild().getNodeValue();
}
}
} }
if (childNodeName.equals("site_code")) if (childNodeName.equals("site_code"))
...@@ -570,7 +665,7 @@ public class WoTransferPrc extends ProcessEJB implements WoTransferPrcLocal,WoTr ...@@ -570,7 +665,7 @@ public class WoTransferPrc extends ProcessEJB implements WoTransferPrcLocal,WoTr
{ {
if(childNode.getFirstChild() != null) if(childNode.getFirstChild() != null)
{ {
lotno = childNode.getFirstChild().getNodeValue(); lotno = childNode.getFirstChild().getNodeValue();
} }
} }
} }
...@@ -640,7 +735,13 @@ public class WoTransferPrc extends ProcessEJB implements WoTransferPrcLocal,WoTr ...@@ -640,7 +735,13 @@ public class WoTransferPrc extends ProcessEJB implements WoTransferPrcLocal,WoTr
} }
if (childNodeName.equals("work_order")) if (childNodeName.equals("work_order"))
{ {
worder = childNode.getFirstChild().getNodeValue(); if(childNode !=null)
{
if(childNode.getFirstChild() != null)
{
worder = childNode.getFirstChild().getNodeValue();
}
}
} }
if (childNodeName.equals("remarks")) if (childNodeName.equals("remarks"))
{ {
...@@ -719,10 +820,28 @@ public class WoTransferPrc extends ProcessEJB implements WoTransferPrcLocal,WoTr ...@@ -719,10 +820,28 @@ public class WoTransferPrc extends ProcessEJB implements WoTransferPrcLocal,WoTr
// pstmt = null; // 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)-actualQty)) <= integralQty))
// if((Double.parseDouble(df.format(actualQty - trfedQty)) >= Double.parseDouble(df.format(allocQty2))) || (Double.parseDouble(df.format((allocQty2 + trfedQty)-issueQtyDet)) <= 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(actualQty > 0.0)
{ {
if((Double.parseDouble(df.format(actualQty - trfedQty)) >= Double.parseDouble(df.format(allocQty2))) || (Double.parseDouble(df.format(allocQty2 - actualPropQty)) <= integralQty)) 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); 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); System.out.println("err String from STOCKTRANS ="+errString);
} }
...@@ -1248,7 +1367,8 @@ public class WoTransferPrc extends ProcessEJB implements WoTransferPrcLocal,WoTr ...@@ -1248,7 +1367,8 @@ public class WoTransferPrc extends ProcessEJB implements WoTransferPrcLocal,WoTr
pstmt = null; pstmt = null;
if(count == 0) 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 = ? "; 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); 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