Commit c7c5fb93 authored by manohar's avatar manohar

updated with latest source


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@91391 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 6f5a12cb
......@@ -141,7 +141,7 @@ public class BenefitDisItm extends ValidatorEJB implements BenefitDisItmLocal,Be
benefitType = benefitType == null ?"":benefitType;
if(benefitType.trim().equalsIgnoreCase("AL"))
{
valueXmlString.append("<exchange_rate>").append("<![CDATA[.000000]]>").append("</exchange_rate>");
valueXmlString.append("<exchange_rate protect =\"1\">").append("<![CDATA[.000000]]>").append("</exchange_rate>");
}
else
{
......
......@@ -976,6 +976,8 @@ public class ChargeBackLoc extends ValidatorEJB implements ChargeBackLocLocal, C
}
valueXmlString.append("<site_descr>").append("<![CDATA[" + ( siteDescr )+ "]]>").append("</site_descr>");
valueXmlString.append("<site_code__cr>").append("<![CDATA[" + ( siteCode )+ "]]>").append("</site_code__cr>");
valueXmlString.append("<site_descr2>").append("<![CDATA[" + ( siteDescr )+ "]]>").append("</site_descr2>");
}
if (currentColumn.trim().equals( "site_code__log" ))
{
......@@ -1004,7 +1006,6 @@ public class ChargeBackLoc extends ValidatorEJB implements ChargeBackLocLocal, C
valueXmlString.append("<site_descr1>").append("<![CDATA[" + ( siteDescr )+ "]]>").append("</site_descr1>");
}
if (currentColumn.trim().equals( "site_code__cr" ))
if (currentColumn.trim().equals( "site_code__cr" ))
{
siteCode = genericUtility.getColumnValue( "site_code__cr", dom );
System.out.println("site_code__cr is==>"+siteCode);
......@@ -1341,7 +1342,7 @@ public class ChargeBackLoc extends ValidatorEJB implements ChargeBackLocLocal, C
}
valueXmlString.append("<item_descr>").append("<![CDATA[" + ( itemDescr )+ "]]>").append("</item_descr>");
valueXmlString.append("<item_ser>").append("<![CDATA[" + ( itemSer )+ "]]>").append("</item_ser>");
if( lotNo != null && lotNo.trim().length() > 0 )
if( lotNo != null && lotNo.trim().length() > 0 && itemCode != null && itemCode.trim().length() > 0)
{
sql = "select sum(b.quantity) as saleQty from invoice a, invoice_trace b "
+" where a.invoice_id = b.invoice_id "
......@@ -1591,6 +1592,7 @@ public class ChargeBackLoc extends ValidatorEJB implements ChargeBackLocLocal, C
{
System.out.println("Exception ::"+ e.getMessage());
e.printStackTrace();
throw new ITMException(e);
}
finally
{
......@@ -1616,11 +1618,12 @@ public class ChargeBackLoc extends ValidatorEJB implements ChargeBackLocLocal, C
{
System.out.println("Exception ::" + e);
e.printStackTrace();
throw new ITMException(e);
}
}
return valueXmlString.toString();
}//END OF ITEMCHANGE
private String getCurrdateAppFormat()
private String getCurrdateAppFormat() throws Exception,ITMException
{
String s = "";
GenericUtility genericUtility = GenericUtility.getInstance();
......@@ -1637,10 +1640,11 @@ public class ChargeBackLoc extends ValidatorEJB implements ChargeBackLocLocal, C
catch(Exception exception)
{
System.out.println("Exception in getCurrdateAppFormat " + exception.getMessage());
throw new ITMException(exception);
}
return s;
}
private Timestamp getCurrdateTsFormat()
private Timestamp getCurrdateTsFormat() throws Exception,ITMException
{
String s = "";
Timestamp timestamp = null;
......@@ -1657,6 +1661,7 @@ public class ChargeBackLoc extends ValidatorEJB implements ChargeBackLocLocal, C
catch(Exception exception)
{
System.out.println("Exception in getCurrdateAppFormat " + exception.getMessage());
throw new ITMException(exception);
}
return timestamp;
}
......@@ -2243,7 +2248,7 @@ public class ChargeBackLoc extends ValidatorEJB implements ChargeBackLocLocal, C
for( int detIdx = 0; detIdx < detLen ; detIdx++ )
{
currDet = detailNodes.item( detIdx );
System.out.println("manohar 10/12/10 got currDet [" + currDet + "]");
currNodes = currDet.getChildNodes();
currNodeLen = currNodes.getLength();
domQty = 0;
......@@ -2251,6 +2256,7 @@ public class ChargeBackLoc extends ValidatorEJB implements ChargeBackLocLocal, C
{
currNode = currNodes.item( curNodeIdx );
nodeName = currNode.getNodeName();
System.out.println("manohar 10/12/10 got nodeName [" + nodeName + "]");
if ( nodeName.equalsIgnoreCase( "attribute" ) )
{
updateFlag = currNode.getAttributes().getNamedItem( "updateFlag" ).getNodeValue();
......@@ -2272,6 +2278,7 @@ public class ChargeBackLoc extends ValidatorEJB implements ChargeBackLocLocal, C
domLotNo = currNode.getFirstChild() != null ? currNode.getFirstChild().getNodeValue().trim() : "";
}
}
System.out.println("manohar updateFlag [" + updateFlag + "] lineNoStr [" + lineNoStr + "] curLineNo [" + curLineNo+ "] domItemCode [" + domItemCode + "] itemCode [ " + itemCode + "] domLotNo [" + domLotNo + "] lotNo [ " + lotNo + "] qtyStr[" + qtyStr + "]");
if( !"D".equalsIgnoreCase( updateFlag ) && (!lineNoStr.trim().equals( curLineNo.trim() )) && (domItemCode.trim().equalsIgnoreCase( itemCode.trim() )) && (domLotNo.trim().equalsIgnoreCase( lotNo.trim() )))
{
System.out.println("manohar found lineNoStr [" + lineNoStr + "] curLineNo [" + curLineNo+ "] domItemCode [" + domItemCode + "] domLotNo [" + domLotNo + "] qtyStr[" + qtyStr + "]");
......
......@@ -879,6 +879,23 @@ public class CustStockTransit extends ValidatorEJB //implements SessionBean
stmt.close();
stmt = null;
}
/*// 04/06/09 manoharan set cust_stockmode
selQuery = "SELECT VAR_VALUE FROM DISPARM WHERE PRD_CODE = '999999' AND VAR_NAME = 'CUST_STOCK_MODE'";
//System.out.println("Executing Query .............\n" +selQuery);
stmt = conn.prepareStatement( selQuery );
rs = stmt.executeQuery();
if (rs.next())
{
stockMode = rs.getString(1);
}
else
{
stockMode = "S";
}
rs.close();
rs = null;
valueXmlString.append("<cust_stock_mode>").append( stockMode ).append("</cust_stock_mode>\r\n");
// end 04/06/09 manoharan set cust_stockmode*/
}
else if ( currentColumn.trim().equals("cust_code") )
{
......
......@@ -504,6 +504,10 @@ public class DissOrderDmgItmChg extends ValidatorEJB implements DissOrderDmgItmC
{
valueXmlString.append("<policy_no protect =\"1\">").append("<![CDATA["+policyNo+"]]>").append("</policy_no>");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
}
priceListAcct = distCommon.setPlistTaxClassEnv(siteCodeShip,siteCodeDlv,itemCode,tranType,"","PRICE_LIST",conn);
valueXmlString.append("<price_list protect =\"0\">").append("<![CDATA["+priceListAcct+"]]>").append("</price_list>");
......@@ -524,7 +528,7 @@ public class DissOrderDmgItmChg extends ValidatorEJB implements DissOrderDmgItmC
}
else
{
valueXmlString.append("<sundry_type protect =\"0\">").append("<![CDATA[]]>").append("</sundry_type>");
valueXmlString.append("<sundry_type protect =\"0\">").append("<![CDATA[C]]>").append("</sundry_type>");
valueXmlString.append("<sundry_code protect =\"0\">").append("<![CDATA[]]>").append("</sundry_code>");
}
......@@ -608,6 +612,10 @@ public class DissOrderDmgItmChg extends ValidatorEJB implements DissOrderDmgItmC
priceListClg = rs.getString("price_list__clg")==null ? "":rs.getString("price_list__clg");
priceList = rs.getString("price_list")==null ? "":rs.getString("price_list");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
priceListAcct = distCommon.setPlistTaxClassEnv(siteCodeShip,siteCodeDlv,itemCode,tranType,"","PRICE_LIST",conn);
if(priceListAcct.trim().length()==0||priceListAcct ==null )
{
......@@ -681,6 +689,10 @@ public class DissOrderDmgItmChg extends ValidatorEJB implements DissOrderDmgItmC
priceListClg = rs.getString("price_list__clg")==null ? "":rs.getString("price_list__clg");
priceList = rs.getString("price_list")==null ? "":rs.getString("price_list");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
priceListAcct = distCommon.setPlistTaxClassEnv(siteCodeShip,siteCodeDlv,itemCode,tranType,"","PRICE_LIST",conn);
if(priceListAcct.trim().length()==0||priceListAcct ==null )
{
......
......@@ -575,43 +575,16 @@ public class DissOrderDmgPrc extends ProcessEJB implements DissOrderDmgPrcLocal,
pstmtHeader.setString(27,currCode);
pstmtHeader.setDouble(28,exchRate);
//pstmtHeader.setString(29,totAmt);
if( taxAmt == null || "".equalsIgnoreCase(taxAmt.trim())|| taxAmt.trim().length()==0 )
{
pstmtHeader.setNull(30,java.sql.Types.NUMERIC);
}
else
{
pstmtHeader.setString(30,taxAmt);
}
// pstmtHeader.setString(30,taxAmt); set null if "" value
//pstmtHeader.setString(31,netAmt);
pstmtHeader.setString(32,siteCodeBil);
pstmtHeader.setString(33,projCode);
// pstmtHeader.setString(34,tranSer);
pstmtHeader.setNull(34,java.sql.Types.CHAR); // set null if "" in db on 10/09/09
pstmtHeader.setString(34,tranSer);
pstmtHeader.setString(35,salesPers);
pstmtHeader.setString(36,autoReceipt);
pstmtHeader.setString(37,avaliableYn);
if( targetWgt == null || "".equalsIgnoreCase(targetWgt.trim())|| targetWgt.trim().length()==0 )
{
pstmtHeader.setNull(38,java.sql.Types.NUMERIC);
}
else
{
pstmtHeader.setString(38,targetWgt);
}
if( targetVol == null || "".equalsIgnoreCase(targetVol.trim())|| targetVol.trim().length()==0 )
{
pstmtHeader.setNull(39,java.sql.Types.NUMERIC);
}
else
{
pstmtHeader.setString(39,targetVol);
}
//pstmtHeader.setString(39,targetVol);
pstmtHeader.setString(40,custOrderNo);
pstmtHeader.setString(41,chgUser);
pstmtHeader.setTimestamp(42,java.sql.Timestamp.valueOf(genericUtility.getValidDateTimeString(chgDate,genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat())));
......@@ -995,28 +968,22 @@ public class DissOrderDmgPrc extends ProcessEJB implements DissOrderDmgPrcLocal,
// end of code
double totAmtDet =qtyOrder*rateDec ;
netAmtDec = totAmtDet - (totAmtDet* discount)/100 + taxAmtDec ;
//pstmtDetail.setDouble(1,lineNoSord); //for Db use on 09/09/09
pstmtDetail.setString(1,"1"); //for Db use on 09/09/09
pstmtDetail.setDouble(1,lineNoSord);
pstmtDetail.setDouble(2,discount);
pstmtDetail.setString(3,taxClass);
pstmtDetail.setDouble(4,totAmtDet);
pstmtDetail.setDouble(5,rateClgDec);
pstmtDetail.setDouble(6,shipQty);
pstmtDetail.setString(7,remarks);
// pstmtDetail.setString(8,received); //use for DB on 09/09/09
pstmtDetail.setNull(8,java.sql.Types.NUMERIC);
//pstmtDetail.setString(9,overShipRec); //use for DB on 09/09/09
pstmtDetail.setNull(9,java.sql.Types.NUMERIC);
pstmtDetail.setString(8,received);
pstmtDetail.setString(9,overShipRec);
pstmtDetail.setString(10,taxEnv);
pstmtDetail.setString(11,itemCode);
pstmtDetail.setString(12,saleOrder);
pstmtDetail.setString(13,packInstr);
pstmtDetail.setString(14,tranIdDemand);
pstmtDetail.setString(15,unit);
//pstmtDetail.setString(16,qtyReturn); //use for DB on 09/09/09
pstmtDetail.setNull(16,java.sql.Types.NUMERIC);
pstmtDetail.setString(16,qtyReturn);
pstmtDetail.setDouble(17,qtyOrder);
pstmtDetail.setString(18,tranIdG);
pstmtDetail.setTimestamp(19,java.sql.Timestamp.valueOf(genericUtility.getValidDateTimeString(shipDate,genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat())));
......@@ -1024,15 +991,7 @@ public class DissOrderDmgPrc extends ProcessEJB implements DissOrderDmgPrcLocal,
pstmtDetail.setTimestamp(21,java.sql.Timestamp.valueOf(genericUtility.getValidDateTimeString(dueDate,genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat())));
pstmtDetail.setDouble(22,netAmtDec);
pstmtDetail.setDouble(23,qtyOrder);
//pstmtDetail.setString(24,taxAmt); // for db use on 09/09/09
if( taxAmt == null || "".equalsIgnoreCase(taxAmt.trim())|| taxAmt.trim().length()==0 )
{
pstmtDetail.setNull(24,java.sql.Types.NUMERIC);
}
else
{
pstmtDetail.setString(24,taxAmt);
}
pstmtDetail.setDouble(25,fact);
pstmtDetail.setString(26,unitSal);
pstmtDetail.setDouble(27,lineNo);
......
......@@ -967,7 +967,7 @@ public class DistDemandMatrixPrc extends ProcessEJB implements DistDemandMatrixP
priceList = dstCmn.setPlistTaxClassEnv(hdrItem, destSite, sourceCode, tranType, " ", "PRICE_LIST", conn);
if( flag )
if(flag)
{
distOrder = generateTranId("W_DIST_ORDER", getCurrdateInAppFormat(), loginSite, loginCode, tranType );
//distOrder = "00000000"+z;
......
......@@ -67,7 +67,7 @@ public class FeedBackPos extends ValidatorEJB implements FeedBackPosLocal,FeedBa
{
return "";
}
public String postSaveRec(String xmlString1,String domId,String objContext,String editFlag, String xtraParams, String windowName, Connection conn)throws RemoteException,ITMException
public String postSaveRec(String xmlString1,String domId,String objContext,String editFlag, String xtraParams, Connection conn)throws RemoteException,ITMException
{
String returnVal = "";
Document dom = null;
......
......@@ -14,6 +14,6 @@ import javax.ejb.Remote; // added for ejb3
public interface FeedBackPosLocal extends ValidatorLocal //, EJBObject
{
public String postSave() throws RemoteException,ITMException;
public String postSaveRec(String xmlString1,String domId,String objContext,String editFlag, String xtraParams, String windowName, Connection conn)throws RemoteException,ITMException;
public String postSaveRec(String xmlString1,String domId,String objContext,String editFlag, String xtraParams, Connection conn)throws RemoteException,ITMException;
}
\ No newline at end of file
......@@ -14,6 +14,6 @@ import javax.ejb.Remote; // added for ejb3
public interface FeedBackPosRemote extends ValidatorRemote //, EJBObject
{
public String postSave() throws RemoteException,ITMException;
public String postSaveRec(String xmlString1,String domId,String objContext,String editFlag, String xtraParams, String windowName, Connection conn)throws RemoteException,ITMException;
public String postSaveRec(String xmlString1,String domId,String objContext,String editFlag, String xtraParams, Connection conn)throws RemoteException,ITMException;
}
\ No newline at end of file
......@@ -17,7 +17,7 @@ public class InvAllocTraceBean
{
try
{
f = new FileWriter("C:\\invalloc.log", true);
f = new FileWriter("invalloc.log", true);
}
catch(Exception e)
{
......
......@@ -3364,6 +3364,10 @@ public class SOrderForm extends ValidatorEJB implements SOrderFormLocal, SOrderF
{
priceListParent = rs.getString(1) == null ? "" : rs.getString(1);
}
else // 29/07/10 manoharan this else condition added as was going in loop
{
break;
}
//System.out.println("priceListParent .." + priceListParent);
rs.close();
pstmt.close();
......
......@@ -59,8 +59,8 @@ public class SRetPostSave extends ValidatorEJB implements SRetPostSaveLocal, SRe
{
sql = "update sreturndet set "
+ " net_amt = (quantity__stduom * rate__stduom) - ( (quantity__stduom * rate__stduom * discount) / 100) + tax_amt,"
+ " eff_net_amt = ( case when ret_rep_flag = 'R' then (quantity__stduom * rate__stduom) - ( (quantity__stduom * rate__stduom * discount) / 100) + tax_amt else (-1 * ((quantity__stduom * rate__stduom) - ( (quantity__stduom * rate__stduom * discount) / 100) + tax_amt)) end )"
+ " net_amt = (quantity__stduom * rate__stduom) - ( (quantity__stduom * rate__stduom * case when discount is null then 0 else discount end ) / 100) + case when tax_amt is null then 0 else tax_amt end ,"
+ " eff_net_amt = ( case when ret_rep_flag = 'R' then (quantity__stduom * rate__stduom) - ( (quantity__stduom * rate__stduom * case when discount is null then 0 else discount end ) / 100) + case when tax_amt is null then 0 else tax_amt end else (-1 * ((quantity__stduom * rate__stduom) - ( (quantity__stduom * rate__stduom * case when discount is null then 0 else discount end ) / 100) + case when tax_amt is null then 0 else tax_amt end )) end )"
+ " where tran_id = ? ";
pstmt= conn.prepareStatement(sql);
//System.out.println("First sql ["+ sql + "] tranId [" + tranId + "]");
......
......@@ -44,6 +44,9 @@ public class SReturnPos extends ValidatorEJB implements SReturnPosLocal, SReturn
Document dom = null;
try
{
System.out.println("SReturnPos xmlString1 [" + xmlString1 + "]");
System.out.println("SReturnPos domId [" + domId + "]");
if (xmlString1 != null && xmlString1.trim().length() > 0)
{
dom = GenericUtility.getInstance().parseString(xmlString1);
......@@ -68,8 +71,8 @@ public class SReturnPos extends ValidatorEJB implements SReturnPosLocal, SReturn
DistStkUpdLocal distStkUpd = null;
NodeList hdrDom = null;
Node currDetail = null;
Statement stmt = null;
ResultSet rs = null;
//Statement stmt = null;
//ResultSet rs = null;
HashMap strAllocate = new HashMap();
try
{
......@@ -86,7 +89,11 @@ public class SReturnPos extends ValidatorEJB implements SReturnPosLocal, SReturn
if (currDetail != null && !updateStatus.equalsIgnoreCase("D"))
{
stmt = conn.createStatement();
//stmt = conn.createStatement();
if (conn == null)
{
System.out.println("<-----------Connection is null----------------------->");
}
retFlg = GenericUtility.getInstance().getColumnValueFromNode("ret_rep_flag",currDetail);
if (retFlg.equalsIgnoreCase("P"))
......@@ -133,7 +140,7 @@ public class SReturnPos extends ValidatorEJB implements SReturnPosLocal, SReturn
e.printStackTrace();
throw new ITMException(e);
}
finally
/*finally
{
try
{
......@@ -149,7 +156,7 @@ public class SReturnPos extends ValidatorEJB implements SReturnPosLocal, SReturn
e.printStackTrace();
throw new ITMException(e);
}
}
}*/
return "";
}
private Node getCurrentDetailFromDom(Document dom,String domId)
......
......@@ -45,6 +45,8 @@ public class SReturnPrs extends ValidatorEJB implements SReturnPrsLocal, SReturn
Document dom = null;
try
{
System.out.println("SReturnPrs xmlString1 [" + xmlString1 + "]");
System.out.println("SReturnPrs domId [" + domId + "]");
if (xmlString1 != null && xmlString1.trim().length() > 0)
{
dom = GenericUtility.getInstance().parseString(xmlString1);
......@@ -87,7 +89,11 @@ public class SReturnPrs extends ValidatorEJB implements SReturnPrsLocal, SReturn
if (currDetail != null && !updateStatus.equalsIgnoreCase("A"))
{
stmt = conn.createStatement();
if (conn == null)
{
System.out.println("<-----------Connection is null----------------------->");
}
retFlg = GenericUtility.getInstance().getColumnValueFromNode("ret_rep_flag",currDetail);
if (retFlg.equalsIgnoreCase("P"))
......@@ -98,6 +104,7 @@ public class SReturnPrs extends ValidatorEJB implements SReturnPrsLocal, SReturn
lotNo = GenericUtility.getInstance().getColumnValueFromNode("lot_no",currDetail);
lotSl = GenericUtility.getInstance().getColumnValueFromNode("lot_sl",currDetail);
stmt = conn.createStatement();
sqlStr = "SELECT QUANTITY FROM SRETURNDET WHERE TRAN_ID = '"+tranId+"'" +
" AND LINE_NO = "+lineNo+""; //Omited the single quotes as it is not working in DB2 //Gulzar 09-01-07
System.out.println("sqlStr :: " + sqlStr);
......@@ -106,6 +113,11 @@ public class SReturnPrs extends ValidatorEJB implements SReturnPrsLocal, SReturn
{
qtyStr = rs.getString(1);
}
rs.close();
rs = null;
stmt.close();
stmt = null;
lineNo =" " + lineNo;
System.out.println("Line No : lineNo := "+lineNo);
quantity = Double.parseDouble(qtyStr);
......
......@@ -2036,6 +2036,7 @@ public class SalesReturn extends ValidatorEJB implements SalesReturnLocal, Sales
{
valueXmlString.append("<conv__rtuom_stduom>").append("<![CDATA[1]]>").append("</conv__rtuom_stduom>");
setNodeValue( dom, "conv__rtuom_stduom", "1" );
System.out.println("manohar rate__stduom 1 [" + rate + "]");
valueXmlString.append("<rate__stduom>").append("<![CDATA[" + rate + "]]>").append("</rate__stduom>");
setNodeValue( dom, "rate__stduom", rate );
}
......@@ -2335,6 +2336,7 @@ public class SalesReturn extends ValidatorEJB implements SalesReturnLocal, Sales
rate = Double.parseDouble(sRate);
convRateStdUom = Double.parseDouble(genericUtility.getColumnValue("conv__rtuom_stduom", dom));
System.out.println("manohar rate__stduom 2 [" + rate * convRateStdUom + "]");
valueXmlString.append("<rate__stduom>").append("<![CDATA[" + rate * convRateStdUom + "]]>").append("</rate__stduom>");
setNodeValue( dom, "rate__stduom", rate * convRateStdUom );
tranDate = genericUtility.getColumnValue("tran_date", dom1);
......@@ -2690,6 +2692,7 @@ public class SalesReturn extends ValidatorEJB implements SalesReturnLocal, Sales
unitRate = unitRate == null ?"" : unitRate.trim();
if ( unit.trim().equals(unitRate.trim()))
{
System.out.println("manohar rate__stduom 3 [" + getRequiredDecimal( rate, 4 ) + "]");
valueXmlString.append("<rate__stduom>").append("<![CDATA[" + getRequiredDecimal( rate, 4 ) + "]]>").append("</rate__stduom>");
setNodeValue( dom, "rate__stduom", getRequiredDecimal( rate, 4 ) );
valueXmlString.append("<conv__rtuom_stduom>").append("<![CDATA[1]]>").append("</conv__rtuom_stduom>");
......@@ -2700,7 +2703,7 @@ public class SalesReturn extends ValidatorEJB implements SalesReturnLocal, Sales
convAr = distCommon.getConvQuantityFact(unit, unitRate, itemCode, rate, (double) fact, conn);
convFact = Double.parseDouble( convAr.get(0).toString() );
rateStd = Double.parseDouble( convAr.get(1).toString() );
System.out.println("manohar rate__stduom 4 [" + rateStd + "]");
valueXmlString.append("<rate__stduom>").append("<![CDATA[" + rateStd + "]]>").append("</rate__stduom>");
setNodeValue( dom, "rate__stduom", rateStd );
......@@ -3286,6 +3289,7 @@ public class SalesReturn extends ValidatorEJB implements SalesReturnLocal, Sales
unit = genericUtility.getColumnValue( "unit", dom );
if ( unitRate != null && unit != null && unit.trim().equals( unitRate.trim() ) )
{
System.out.println("manohar rate__stduom 5 [" + rate + "]");
valueXmlString.append("<rate__stduom>").append("<![CDATA[" + rate + "]]>").append("</rate__stduom>");
setNodeValue( dom, "rate__stduom", rate );
valueXmlString.append("<conv__rtuom_stduom>").append("<![CDATA[1]]>").append("</conv__rtuom_stduom>");
......@@ -3301,6 +3305,7 @@ public class SalesReturn extends ValidatorEJB implements SalesReturnLocal, Sales
convAr = distCommon.getConvQuantityFact(unit, unitRate, itemCode, rate, (double) fact, conn);
convFact = Double.parseDouble( convAr.get(0).toString() );
rateStd = Double.parseDouble( convAr.get(1).toString() );
System.out.println("manohar rate__stduom 6 [" + rateStd + "]");
valueXmlString.append("<rate__stduom>").append("<![CDATA[" + rateStd + "]]>").append("</rate__stduom>");
setNodeValue( dom, "rate__stduom", rateStd );
valueXmlString.append("<conv__rtuom_stduom>").append("<![CDATA[" + convFact + "]]>").append("</conv__rtuom_stduom>");
......@@ -4634,6 +4639,7 @@ public class SalesReturn extends ValidatorEJB implements SalesReturnLocal, Sales
valueXmlString.append("<conv__rtuom_stduom>").append("<![CDATA["+ mconvRtuom +"]]>").append("</conv__rtuom_stduom>");
//dw_detedit[ii_currformno].SetItem(1,"conv__rtuom_stduom", mconv_rtuom)
System.out.println("manohar rate__stduom 6 [" + mrateStd + "]");
valueXmlString.append("<rate__stduom>").append("<![CDATA["+ mrateStd +"]]>").append("</rate__stduom>");
//dw_detedit[ii_currformno].SetItem(1,"rate__stduom", mrate_std)
}
......@@ -4663,7 +4669,7 @@ public class SalesReturn extends ValidatorEJB implements SalesReturnLocal, Sales
valStr = distCommon.getConvQuantityFact( mVal1Str, mValStr, mitem, mrate, mconvRtuom, conn ).get(1).toString();
valStr = valStr == null || valStr.trim().length() == 0 || "null".equalsIgnoreCase( valStr ) ? "" : valStr.trim();
String mrateStdStr = valStr;
System.out.println("manohar rate__stduom 7 [" + mrateStdStr + "]");
valueXmlString.append("<rate__stduom>").append("<![CDATA["+ mrateStdStr +"]]>").append("</rate__stduom>");
//dw_detedit[ii_currformno].SetItem(1,"rate__stduom", mrate_std);
}
......@@ -4876,7 +4882,7 @@ public class SalesReturn extends ValidatorEJB implements SalesReturnLocal, Sales
DistCommon distCommon = null;
distCommon = new DistCommon();
String sqlStr = null;
String objName = null;
String objName = null,llLineNoInvtraceStr = "", saleOrder = "",lineNoSord = "",spaces = "";
double lsVarperc = 0.0;
ArrayList errList = new ArrayList();
ArrayList errFields = new ArrayList();
......@@ -5631,7 +5637,7 @@ public class SalesReturn extends ValidatorEJB implements SalesReturnLocal, Sales
String mlineNoStr = genericUtility.getColumnValue( "line_no__inv", dom );//dw_detedit[ii_currformno].GetItemnumber(dw_detedit[ii_currformno].GetRow(),"line_no__inv")
mlineNo = Integer.parseInt( getNumString( mlineNoStr ) );
lsFlag = genericUtility.getColumnValue( "ret_rep_flag", dom );// dw_detedit[ii_currformno].GetItemString(dw_detedit[ii_currformno].GetRow(),"ret_rep_flag")
String llLineNoInvtraceStr = genericUtility.getColumnValue( "line_no__invtrace", dom ); //dw_detedit[ii_currformno].getitemnumber(1,"line_no__invtrace") //Added by jasmina 13.03.2008 - FI78SUN041
llLineNoInvtraceStr = genericUtility.getColumnValue( "line_no__invtrace", dom ); //dw_detedit[ii_currformno].getitemnumber(1,"line_no__invtrace") //Added by jasmina 13.03.2008 - FI78SUN041
llLineNoInvtrace = Integer.parseInt( llLineNoInvtraceStr == null || llLineNoInvtraceStr.trim().length() == 0 ? "0" : llLineNoInvtraceStr.trim() );
if( ( !"P".equalsIgnoreCase( lsFlag ) ) && lsInvoiceId != null && lsInvoiceId.trim().length() > 0 && !"null".equalsIgnoreCase( lsInvoiceId.trim() ) )
......@@ -5708,6 +5714,7 @@ public class SalesReturn extends ValidatorEJB implements SalesReturnLocal, Sales
{
String fldName = childNodeName.toLowerCase();
String lcRateStr = genericUtility.getColumnValue( childNodeName.toLowerCase(), dom );
lcRate = Double.parseDouble( lcRateStr == null || lcRateStr.trim().length() == 0 ? "0" : lcRateStr.trim() );
lsInvoiceId = genericUtility.getColumnValue( "invoice_id", dom ); //dw_detedit[ii_currformno].getitemstring(dw_detedit[ii_currformno].getrow(),"invoice_id")
itemCode = genericUtility.getColumnValue( "item_code", dom ); //dw_detedit[ii_currformno].getitemstring(dw_detedit[ii_currformno].getrow(),"item_code")
......@@ -5748,18 +5755,53 @@ public class SalesReturn extends ValidatorEJB implements SalesReturnLocal, Sales
}
else if( lsInvoiceId.trim().length() > 0 )
{
sqlStr = " select max(case when '" + fldName + "' ='rate' then rate else rate__stduom*conv__rtuom_stduom end ) lc_inv_rate "
// 26/10/10 manoharan to set average rate in case invoiced from multiple lot
llLineNoInvtraceStr = genericUtility.getColumnValue( "line_no__invtrace", dom );
llLineNoInvtrace = Integer.parseInt( llLineNoInvtraceStr == null || llLineNoInvtraceStr.trim().length() == 0 ? "0" : llLineNoInvtraceStr.trim() );
sqlStr = " select i.SORD_NO as SORD_NO, i.SORD_LINE_NO as LINE_NO__SORD"
+" from invoice_trace i "
+" where i.invoice_id = ? "//:ls_invoice_id
+" and i.line_no = ? ";
pstmt = conn.prepareStatement( sqlStr );
pstmt.setString( 1, lsInvoiceId );
pstmt.setInt( 2, llLineNoInvtrace );
rs = pstmt.executeQuery();
if( rs.next() )
{
saleOrder = rs.getString( "SORD_NO" );
lineNoSord = rs.getString( "LINE_NO__SORD" );
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if (lineNoSord.trim().length() == 1)
{
spaces = " ";
}
if (lineNoSord.trim().length() == 2)
{
spaces = " ";
}
lineNoSord = spaces.concat(lineNoSord.trim());
//sqlStr = " select max(case when '" + fldName + "' ='rate' then rate else rate__stduom*conv__rtuom_stduom end ) lc_inv_rate "
// +" from invoice_trace "
// +" where invoice_id = ? "//:ls_invoice_id
// +" and item_code = ? " //:ls_item_code
// +" and lot_no = ? " //:ls_lot_no
// +" and lot_sl = ? "; //:ls_lot_sl;
sqlStr = " select (sum(case when '" + fldName + "' ='rate' then rate else rate__stduom*conv__rtuom_stduom end * quantity) / sum(quantity) ) as lc_inv_rate "
+" from invoice_trace "
+" where invoice_id = ? "//:ls_invoice_id
+" and item_code = ? " //:ls_item_code
+" and lot_no = ? " //:ls_lot_no
+" and lot_sl = ? "; //:ls_lot_sl;
+" where invoice_id = ? "
+" and SORD_NO = ? " //
+" and SORD_LINE_NO = ? " ;
pstmt = conn.prepareStatement( sqlStr );
pstmt.setString( 1, lsInvoiceId );
pstmt.setString( 2, itemCode );
pstmt.setString( 3, lsLotNo );
pstmt.setString( 4, lsLotSl );
pstmt.setString( 2, saleOrder );
pstmt.setString( 3, lineNoSord );
rs = pstmt.executeQuery();
if( rs.next() )
{
......@@ -5769,7 +5811,9 @@ public class SalesReturn extends ValidatorEJB implements SalesReturnLocal, Sales
rs = null;
pstmt.close();
pstmt = null;
lcInvRate = getRequiredDecimal(lcInvRate, 3);
lcRate = getRequiredDecimal(lcRate, 3);
System.out.println("manohar lcRateStr [" + lcRateStr + "] lcRate [" + lcRate + "] > lcInvRate [" + lcInvRate + "]");
if ( lcRate > lcInvRate && lcInvRate > 0 )
{
errCode = "VTINVRATE1";
......@@ -6318,7 +6362,7 @@ public class SalesReturn extends ValidatorEJB implements SalesReturnLocal, Sales
lsRetOpt = genericUtility.getColumnValue( "ret_opt", dom1 );
String llLineNoInvStr = getNumString(genericUtility.getColumnValue( "line_no__inv", dom ));//dw_detedit[ii_currformno].getitemnumber(1,"line_no__inv")
llLineNoInv = Integer.parseInt( llLineNoInvStr == null || llLineNoInvStr.trim().length() == 0 ? "0" : llLineNoInvStr.trim() );
String llLineNoInvtraceStr = getNumString(genericUtility.getColumnValue( "line_no__invtrace", dom ));// dw_detedit[ii_currformno].getitemnumber(1,"line_no__invtrace")
llLineNoInvtraceStr = getNumString(genericUtility.getColumnValue( "line_no__invtrace", dom ));// dw_detedit[ii_currformno].getitemnumber(1,"line_no__invtrace")
llLineNoInvtrace = Integer.parseInt( llLineNoInvtraceStr == null || llLineNoInvtraceStr.trim().length() == 0 ? "0" : llLineNoInvtraceStr.trim() );
System.out.println( " ldCurrQty :: " + ldCurrQty );
if( ldCurrQty == 0 )
......@@ -6687,7 +6731,7 @@ public class SalesReturn extends ValidatorEJB implements SalesReturnLocal, Sales
lcRate = Double.parseDouble( lcRateStr == null || lcRateStr.trim().length() == 0 ? "0" : lcRateStr.trim() );
String llLineNoInvStr = getNumString( genericUtility.getColumnValue( "line_no__inv", dom ) );
llLineNoInv = Integer.parseInt( llLineNoInvStr.trim() );
String llLineNoInvtraceStr = getNumString( genericUtility.getColumnValue( "line_no__invtrace", dom ) );
llLineNoInvtraceStr = getNumString( genericUtility.getColumnValue( "line_no__invtrace", dom ) );
llLineNoInvtrace = Integer.parseInt( llLineNoInvtraceStr.trim() );
lsTranId = genericUtility.getColumnValue( "tran_id", dom );
if( lcQty < 0 )
......@@ -6898,7 +6942,8 @@ public class SalesReturn extends ValidatorEJB implements SalesReturnLocal, Sales
System.out.println( "lcQty :: " + lcQty );
System.out.println( "lcRate :: " + lcRate );
lcAmount = (lcQty * lcRate) + lcAdjAmt; // 22/04/10 manoharan uncommented
lcAmount = getReqDecimal(lcAmount,3); // 23/04/10 manoharan amount is coming in many decimals
lcAmount = getReqDecimal(lcAmount,2); // 23/04/10 manoharan amount is coming in many decimals
lcInvtraceAmt = getReqDecimal(lcInvtraceAmt,2); // 15/11/10 manoharan changes done as per mail by KB (2 decimal is ok)
//lcAmount = getTotAmt( dom2 ) + lcAdjAmt; // 22/04/10 manoharan commented
System.out.println( "lcInvtraceAmt :: " + lcInvtraceAmt );
System.out.println( "lcAmount :: " + lcAmount );
......
......@@ -276,31 +276,31 @@ public class TaxInputCrtXmlPrc extends ProcessEJB implements TaxInputCrtXmlPrcLo
{
String subDirs[] = taxInputCerdStr.split( "\\\\" );
subDirName = subDirs[0];
//System.out.println("windows stype path");
System.out.println("windows stype path");
for( int idx = 1; idx < subDirs.length; idx++ )
{
subDirName = subDirName + File.separator + subDirs[ idx ];
//System.out.println("subDirs[ idx ] [" + subDirs[ idx ] + "]");
System.out.println("subDirs[ idx ] [" + subDirs[ idx ] + "]");
}
}
else
{
String subDirs[] = taxInputCerdStr.split( "/" );
subDirName = subDirs[0];
//System.out.println("Unix style path");
System.out.println("Unix style path");
for( int idx = 1; idx < subDirs.length; idx++ )
{
subDirName = subDirName + File.separator + subDirs[ idx ];
//System.out.println("subDirs[ idx ] [" + subDirs[ idx ] + "]");
System.out.println("subDirs[ idx ] [" + subDirs[ idx ] + "]");
}
}
subDirFile = new File( subDirName );
//System.out.println("File path [" + subDirName + "]");
System.out.println("File path [" + subDirName + "]");
if( !subDirFile.exists() )
{
//System.out.println("creating folders [" + subDirName + "]");
subDirFile.mkdir();
System.out.println("creating folders [" + subDirName + "]");
subDirFile.mkdirs();
}
}
// end 19/01/10 manoharan both on linux and windows should work
......
......@@ -141,6 +141,7 @@ public class TaxSch extends ProcessEJB implements TaxSchLocal, TaxSchRemote
String siteCodeShip = null;
ITMDBAccessLocal itmDBAccess = null;
ConnDriver connDriver = new ConnDriver();
Connection conn = null;
try
{
......@@ -149,9 +150,18 @@ public class TaxSch extends ProcessEJB implements TaxSchLocal, TaxSchRemote
setGlobalVarMap(xtraParams);
String dataStr = null;
System.out.println("global var map :"+this.globalVarMap+":");
itmDBAccess = getITMAccess();
conn = itmDBAccess.getConnection(); //This function is to connect with oracle.ejb..ejb.
// 16/03/10 manoharan
//itmDBAccess = getITMAccess();
//conn = itmDBAccess.getConnection(); //This function is to connect with oracle.ejb..ejb.
//conn.setAutoCommit(false);
conn = connDriver.getConnectDB("DriverITM");
conn.setAutoCommit(false);
connDriver=null;
// end 16/03/10 manoharan
StringBuffer retTabSepStrBuff = new StringBuffer();
StringBuffer inSqlBuff =new StringBuffer();
StringBuffer sqlBuff =new StringBuffer();
......@@ -748,12 +758,68 @@ public class TaxSch extends ProcessEJB implements TaxSchLocal, TaxSchRemote
//sqlExprRSMetaData.close();
sqlExprRSMetaData = null;
resultString = retTabSepStrBuff.toString();
//System.out.println("resultString :"+resultString);
System.out.println("resultString [" + resultString + "]");
// 28-06-2007 manoharan
partyNameRS = null;
// 16/03/10 manoharan
if (partyNamePstmt != null && !partyNamePstmt.isClosed())
{
partyNamePstmt.close();
}
partyNamePstmt = null;
if (taxBalSelPstmt != null && !taxBalSelPstmt.isClosed())
{
taxBalSelPstmt.close();
}
taxBalSelPstmt = null;
if (sundryCodeSelPstmt != null && !sundryCodeSelPstmt.isClosed())
{
sundryCodeSelPstmt.close();
}
sundryCodeSelPstmt = null;
if (exciseRefSelPstmt != null && !exciseRefSelPstmt.isClosed())
{
exciseRefSelPstmt.close();
}
exciseRefSelPstmt = null;
if (taxChapterSelPstmt != null && !taxChapterSelPstmt.isClosed())
{
taxChapterSelPstmt.close();
}
taxChapterSelPstmt = null;
if (chapterHeadingSelPstmt != null && !chapterHeadingSelPstmt.isClosed())
{
chapterHeadingSelPstmt.close();
}
chapterHeadingSelPstmt = null;
if (countTaxChapSelPstmt != null && !countTaxChapSelPstmt.isClosed())
{
countTaxChapSelPstmt.close();
}
countTaxChapSelPstmt = null;
if (matCategorySelPstmt != null && !matCategorySelPstmt.isClosed())
{
matCategorySelPstmt.close();
}
matCategorySelPstmt = null;
if (sqlExprSelPstmt != null && !sqlExprSelPstmt.isClosed())
{
sqlExprSelPstmt.close();
}
sqlExprSelPstmt = null;
if (siteCodeShipPstmt != null && !siteCodeShipPstmt.isClosed())
{
siteCodeShipPstmt.close();
}
siteCodeShipPstmt = null;
if (sundryTypePstmt != null && !sundryTypePstmt.isClosed())
{
sundryTypePstmt.close();
}
sundryTypePstmt = null;
// end 16/03/10 manoharan
// end 28/-06-2007 manoharan
// added by manazir on 26/11/09 since conn was not close
// added by manazir on 26/11/09 since conn is not close
if(conn != null)
{
conn.close();
......
......@@ -3,7 +3,6 @@ import java.rmi.RemoteException;
//import javax.ejb.EJBObject;
import ibase.webitm.utility.ITMException;
import ibase.webitm.ejb.ActionHandler;
import ibase.webitm.ejb.ActionHandlerLocal;
import javax.ejb.Local; // added for ejb3
......
......@@ -1659,7 +1659,8 @@ public class DistIssueAct extends ActionHandlerEJB implements DistIssueActLocal,
valueXmlString.append("<loc_code isSrvCallOnChg='0'>").append("<![CDATA[").append( (tLocCode == null ? "" : tLocCode.trim()) ).append("]]>").append("</loc_code>\r\n");
valueXmlString.append("<rate isSrvCallOnChg='0'>").append("<![CDATA[").append(rate1).append("]]>").append("</rate>\r\n");
//next line commented by mslam on 031108 as it gets set from item change on lot no
//valueXmlString.append("<rate__clg isSrvCallOnChg='0'>").append("<![CDATA[").append(rateClg).append("]]>").append("</rate__clg>\r\n"); //Commented - jiten - 05/04/06 - as set in itemChange of lot_no
// 27/10/10 manoharan commented as itemchanged is disabled
valueXmlString.append("<rate__clg isSrvCallOnChg='0'>").append("<![CDATA[").append(rateClg).append("]]>").append("</rate__clg>\r\n"); //Commented - jiten - 05/04/06 - as set in itemChange of lot_no
//for test this line being taken next to lot no
//valueXmlString.append("<quantity isSrvCallOnChg='0'>").append("<![CDATA[").append(minputQty).append("]]>").append("</quantity>\r\n");
valueXmlString.append("<amount isSrvCallOnChg='0'>").append("<![CDATA[").append(minputQty*Double.parseDouble(rate1)).append("]]>").append("</amount>\r\n");
......
......@@ -357,7 +357,7 @@ public class DistOrderAmdConf extends ActionHandlerEJB implements DistOrderAmdCo
genEDIRemote = ( GenerateEDILocal )ctx.lookup( "ibase/GenerateEDI/local" );// added for ejb3
//GenerateEDI genEDIRemote = (GenerateEDI)genEDIHome.create();//commented for ejb3
errCode = genEDIRemote.genEDI( "w_distordamd", tranId, xtraParams, conn );
errCode = genEDIRemote.genEDI( "w_distordamd", tranId, "E", xtraParams, conn );
if( "SUCCESS".equalsIgnoreCase( errCode ) )
{
errCode = null;
......
......@@ -463,7 +463,7 @@ public class SalesReturnAct extends ActionHandlerEJB implements SalesReturnActLo
System.out.println("parentNodeListLength====>"+parentNodeListLength);
for(int ptr = 0; ptr < parentNodeListLength; ptr++)
{
System.out.println("ptr====>"+ptr);
System.out.println("ptr ====>"+ptr);
parentNode = parentNodeList.item(ptr);
childNodeList = parentNode.getChildNodes();
childNodeListLength = childNodeList.getLength();
......@@ -505,7 +505,7 @@ public class SalesReturnAct extends ActionHandlerEJB implements SalesReturnActLo
} */
if ( childNodeName.equalsIgnoreCase( "item_code" ) )
{
if(childNode.getFirstChild() != null)
if(childNode.getFirstChild() != null )
{
dtlPstFlag = true;
}
......
......@@ -6,15 +6,13 @@ public class BankTranBean
private double adjAmt= 0.0;
private double bal = 0.0;
public void setRefNo(String refNo)
{
this.refNo = refNo;
}
public String getRefNo()
{
return refNo;
return this.refNo;
}
public void setAdjAmt(double adjAmt)
{
......@@ -22,7 +20,7 @@ public class BankTranBean
}
public double getAdjAmt()
{
return adjAmt;
return this.adjAmt;
}
public void setAmt(double amt)
{
......@@ -30,7 +28,7 @@ public class BankTranBean
}
public double getAmt()
{
return amt;
return this.amt;
}
public void setBal(double bal)
{
......@@ -38,7 +36,7 @@ public class BankTranBean
}
public double getBal()
{
return bal;
return this.bal;
}
......
......@@ -176,14 +176,6 @@ public class JvYearEndClosingDtl extends ValidatorEJB implements JvYearEndClosin
break ;
}
}
if ( childNodeName.equalsIgnoreCase( "eff_date" ) )
{
if ( childNode.getFirstChild() == null )
{
errString =itmDBAccessEJB.getErrorString("eff_date","VTEFFDTNL",userId);
break ;
}
}
}
//END OF CASE1
break;
......
......@@ -84,6 +84,7 @@ public class JournalYearEndAct extends ActionHandlerEJB implements JournalYearEn
String detCnt = "0";
double amtDr = 0;
double amtCr = 0;
String accDescr = null;
StringBuffer valueXmlString = new StringBuffer("<?xml version=\"1.0\"?>\r\n<Root>\r\n");
String sql = "";
Connection conn = null;
......@@ -131,7 +132,7 @@ public class JournalYearEndAct extends ActionHandlerEJB implements JournalYearEn
siteCode = "";
siteCode = finalStr.substring(0,finalStr.length()-3);
sql = "SELECT A.ACCT_CODE, SUM(CASE WHEN A.DR_AMT__BASE IS NULL THEN 0 ELSE A.DR_AMT__BASE END) AMT_DR,"
+"SUM(CASE WHEN A.CR_AMT__BASE IS NULL THEN 0 ELSE A.CR_AMT__BASE END) AMT_CR, A.CCTR_CODE FROM ACCTBAL A, "
+"SUM(CASE WHEN A.CR_AMT__BASE IS NULL THEN 0 ELSE A.CR_AMT__BASE END) AMT_CR, A.CCTR_CODE, B.DESCR FROM ACCTBAL A, "
+"ACCOUNTS B, ACCTSGRP C, ACCTGRP D "
+"WHERE A.ACCT_CODE = B.ACCT_CODE "
+"AND B.SGROUP_CODE = C.SGROUP_CODE "
......@@ -142,7 +143,7 @@ public class JournalYearEndAct extends ActionHandlerEJB implements JournalYearEn
+"AND A.PRD_CODE <= '"+ prdCodeTo +"' "
+"AND A.ACCT_CODE >= '"+ acctCodeFrom +"' "
+"AND A.ACCT_CODE <= '"+ acctCodeTo +"' "
+"GROUP BY A.PRD_CODE, A.ACCT_CODE, A.CCTR_CODE "
+"GROUP BY A.PRD_CODE, A.ACCT_CODE, A.CCTR_CODE, B.DESCR "
+"HAVING SUM(CASE WHEN A.DR_AMT__BASE IS NULL THEN 0 ELSE A.DR_AMT__BASE END) <> SUM(CASE WHEN A.CR_AMT__BASE " +"IS NULL THEN 0 ELSE A.CR_AMT__BASE END)";
System.out.println("sql ::"+sql);
......@@ -151,21 +152,23 @@ public class JournalYearEndAct extends ActionHandlerEJB implements JournalYearEn
while (rs.next())
{
valueXmlString.append("<Detail>\r\n");
valueXmlString.append("<acct_code>").append("<![CDATA[").append(rs.getString(1)).append("]]>").append("</acct_code>\r\n");
valueXmlString.append("<cctr_code>").append("<![CDATA[").append(rs.getString(4)).append("]]>").append("</cctr_code>\r\n");
valueXmlString.append("<remarks>").append("<![CDATA[").append(reMarks).append("]]>").append("</remarks>\r\n");
valueXmlString.append("<acct_code isSrvCallOnChg='0'>").append("<![CDATA[").append(rs.getString(1)).append("]]>").append("</acct_code>\r\n");
valueXmlString.append("<cctr_code isSrvCallOnChg='0'>").append("<![CDATA[").append(rs.getString(4)).append("]]>").append("</cctr_code>\r\n");
valueXmlString.append("<remarks isSrvCallOnChg='0'>").append("<![CDATA[").append(reMarks).append("]]>").append("</remarks>\r\n");
amtDr = Double.parseDouble(rs.getString(2));
amtCr = Double.parseDouble(rs.getString(3));
accDescr = rs.getString(5);
if (amtDr >= amtCr)
{
valueXmlString.append("<drcr_flag>").append("<![CDATA[").append("C").append("]]>").append("</drcr_flag>\r\n");
valueXmlString.append("<amount>").append("<![CDATA[").append(amtDr - amtCr).append("]]>").append("</amount>\r\n");
valueXmlString.append("<drcr_flag isSrvCallOnChg='0'>").append("<![CDATA[").append("C").append("]]>").append("</drcr_flag>\r\n");
valueXmlString.append("<amount isSrvCallOnChg='0'>").append("<![CDATA[").append(amtDr - amtCr).append("]]>").append("</amount>\r\n");
}
else
{
valueXmlString.append("<drcr_flag>").append("<![CDATA[").append("D").append("]]>").append("</drcr_flag>\r\n");
valueXmlString.append("<amount>").append("<![CDATA[").append(amtCr - amtDr).append("]]>").append("</amount>\r\n");
valueXmlString.append("<drcr_flag isSrvCallOnChg='0'>").append("<![CDATA[").append("D").append("]]>").append("</drcr_flag>\r\n");
valueXmlString.append("<amount isSrvCallOnChg='0'>").append("<![CDATA[").append(amtCr - amtDr).append("]]>").append("</amount>\r\n");
}
valueXmlString.append("<accounts_descr isSrvCallOnChg='0'>").append("<![CDATA[").append(accDescr).append("]]>").append("</accounts_descr>\r\n");
valueXmlString.append("</Detail>\r\n");
}
stmt.close();
......
......@@ -214,16 +214,17 @@ public class ReceiptAdvAct extends ActionHandlerEJB implements ReceiptAdvActLoca
double balAmt = Double.parseDouble(chqAmt);//Changed from advAmt to chqAmt as changed in PB
double balAmt1 = Double.parseDouble(chqAmt);
System.out.println("BalAmt :=" +balAmt);
System.out.println("actionType [" +actionType + "] siteCode [" + siteCode + "] itemSer [" + itemSer + "] custCode [" + custCode + "]" );
if (objContext.equalsIgnoreCase("2"))
{
if(actionType.equalsIgnoreCase("actionDefaultSer"))
if(actionType.equals("actionDefaultSer"))
{
sql = "SELECT TRAN_SER, REF_NO, TOT_AMT, ADJ_AMT FROM RECEIVABLES "+
" WHERE SITE_CODE = '"+siteCode+"' AND ITEM_SER='"+itemSer+"' AND CUST_CODE = '"+custCode+"' AND CURR_CODE = '"+currCode+"' AND TOT_AMT - ADJ_AMT > 0 ORDER BY DUE_DATE";
}
else if(actionType.equalsIgnoreCase("default"))
else if(actionType.equals("default"))
{
sql = "SELECT TRAN_SER, REF_NO, TOT_AMT, ADJ_AMT FROM RECEIVABLES "+
" WHERE SITE_CODE = '"+siteCode+"' AND CUST_CODE = '"+custCode+"' AND CURR_CODE = '"+currCode+"' AND TOT_AMT - ADJ_AMT > 0 ORDER BY DUE_DATE";
......@@ -475,7 +476,31 @@ public class ReceiptAdvAct extends ActionHandlerEJB implements ReceiptAdvActLoca
// +" ( ( RECEIVABLES.TOT_AMT- RECEIVABLES.ADJ_AMT) <> 0 ) ) and "
// +" receivables.curr_code = currency.curr_code and "
// +" receivables.acct_code = accounts.acct_code ";
/*
SELECT receivables.ref_no , despatch.gp_no , receivables.due_date ,
receivables.tot_amt , receivables.adj_amt ,
((receivables.tot_amt) - (receivables.adj_amt)) Balance,
fn_remark(ref_no,tran_ser) remark, receivables.cust_code
FROM invoice , despatch , receivables , customer
WHERE ( invoice.desp_id = despatch.desp_id (+))
and ( invoice.invoice_id (+) = receivables.ref_no)
and ( receivables.cust_code = customer.cust_code )
and ( ( customer.group_code in ( select group_code from customer where cust_code = 'AD0108') )
and ( receivables.site_code = 'SA117' )
and ( receivables.tran_ser = 'R-IBCA' )
and ( ( RECEIVABLES.TOT_AMT- RECEIVABLES.ADJ_AMT) <> 0 ) )
SELECT r.ref_no, r.tran_ser, d.gp_no, r.due_date,r.tot_amt, r.adj_amt, ((r.tot_amt) - (r.adj_amt)) Balance,
fn_remark(ref_no, tran_ser) remark, r.tran_date, r.ref_no, r.ref_date, r.curr_code, c.descr as curr_descr,
r.exch_rate, r.acct_code, a.descr as acct_descr, r.cctr_code, r.discount, r.tax_amt, r.bad_debt_amt
FROM ((((invoice i left outer join despatch d on i.desp_id = d.desp_id)
left outer join receivables r on r.ref_no = i.invoice_id )
inner join customer cu on r.cust_code = cu.cust_code)
inner join currency c on r.curr_code = c.curr_code)
inner join accounts a on r.acct_code = a.acct_code
WHERE cu.group_code in ( select group_code from customer where cust_code = 'AD0108')
AND r.site_code = 'SA117' AND r.tran_ser = 'R-IBCA' AND ( r.TOT_AMT- r.ADJ_AMT <> 0 )
*/
sql= "SELECT r.ref_no, r.tran_ser, d.gp_no, r.due_date,r.tot_amt,"
+" r.adj_amt, ((r.tot_amt) - (r.adj_amt)) Balance, fn_remark(ref_no, tran_ser) remark, "
+" r.tran_date, r.ref_no, r.ref_date, r.curr_code, "
......@@ -483,7 +508,7 @@ public class ReceiptAdvAct extends ActionHandlerEJB implements ReceiptAdvActLoca
+" r.cctr_code, r.discount, r.tax_amt, r.bad_debt_amt "
+" FROM ((((invoice i "
+" left outer join despatch d on i.desp_id = d.desp_id) "
+" left outer join receivables r on r.ref_no = i.invoice_id ) "
+" right outer join receivables r on r.ref_no = i.invoice_id ) "
+" inner join customer cu on r.cust_code = cu.cust_code) "
+" inner join currency c on r.curr_code = c.curr_code) "
+" inner join accounts a on r.acct_code = a.acct_code "
......@@ -492,6 +517,7 @@ public class ReceiptAdvAct extends ActionHandlerEJB implements ReceiptAdvActLoca
+" AND r.tran_ser = '"+tranSer+"' "
+" AND ( r.TOT_AMT- r.ADJ_AMT <> 0 ) ";
System.out.println("[ReceiptAdvActEJB] sql==>"+sql);
pstmt = conn.prepareStatement(sql);
......
......@@ -40,7 +40,10 @@ class ADPElement
private double supply = 0;
private double planDemand = 0;
private double planSupply = 0;
// 12/04/10 manoharan MF90BHU001
private double stockQty = 0;
private double othSupply = 0;
// end 12/04/10 manoharan MF90BHU001
private double minOrderQty = 0;
private double integralQty = 0;
private double maxQty = 0;
......@@ -61,7 +64,10 @@ class ADPElement
private ArrayList timeMRPArr;
transient GenericUtility genericUtility = null;
// 22/06/10 manoharan mfg lead time based on batch size
private String mfgLeadBasis = "F";
private double batchSizeLead = 0;
// end 22/06/10 manoharan
public ADPElement()
{
//System.out.println("New ADPElement Created");
......@@ -195,7 +201,7 @@ class ADPElement
public void setDemand(java.sql.Timestamp dueDate, double demand)
{
this.demand += demand;
updateTimeMrp(dueDate, demand, 0);
updateTimeMrp(dueDate, demand, 0, 0, 0);
}
public double getDemand()
{
......@@ -204,16 +210,36 @@ class ADPElement
public void setSupply(java.sql.Timestamp dueDate, double supply)
{
this.supply += supply;
updateTimeMrp(dueDate, 0, supply);
updateTimeMrp(dueDate, 0, supply, 0, 0);
}
public double getSupply()
{
return this.supply;
}
// 12/04/10 manoharan MF90BHU001
public void setStockQty(java.sql.Timestamp dueDate, double stockQty)
{
this.stockQty += stockQty;
updateTimeMrp(dueDate, 0,0, stockQty,0);
}
public double getStockQty()
{
return this.stockQty;
}
public void setOthSupply(java.sql.Timestamp dueDate, double othSupply)
{
this.othSupply += othSupply;
updateTimeMrp(dueDate, 0,0, 0, othSupply);
}
public double getOthSupply()
{
return this.othSupply;
}
// end 12/04/10 manoharan MF90BHU001
public void setPlanSupply(java.sql.Timestamp dueDate, double supply)
{
this.planSupply += supply;
updateTimeMrp(dueDate, 0, supply);
updateTimeMrp(dueDate, 0, supply, 0, 0);
}
public double getPlanSupply()
{
......@@ -423,7 +449,27 @@ class ADPElement
{
return this.independentDemand;
}*/
private void updateTimeMrp(java.sql.Timestamp dueDate, double demand, double supply)
// 22/06/10 manoharan mfg lead time based on batch size
public void setMfgLeadBasis(String mfgLeadBasis)
{
this.mfgLeadBasis = mfgLeadBasis;
}
public String getMfgLeadBasis()
{
return this.mfgLeadBasis;
}
public void setBatchSizeLead(double batchSizeLead)
{
this.batchSizeLead = batchSizeLead;
}
public double getBatchSizeLead()
{
return this.batchSizeLead;
}
// end 22/06/10 manoharan
private void updateTimeMrp(java.sql.Timestamp dueDate, double demand, double supply, double stockQty, double othSupply)
{
String errString = "";
TimeMRP timeMRP = null;
......@@ -454,6 +500,10 @@ class ADPElement
timeMRP.setDueDate(dueDate);
timeMRP.setDemand(demand);
timeMRP.setSupply(supply);
// 12/04/10 manoharan MF90BHU001
timeMRP.setStockQty(stockQty);
timeMRP.setOthSupply(othSupply);
// end 12/04/10 manoharan MF90BHU001
this.timeMRPArr.add(timeMRP);
}
else
......@@ -461,6 +511,10 @@ class ADPElement
timeMRP = (TimeMRP)this.timeMRPArr.get(timeEle);
timeMRP.setDemand(demand);
timeMRP.setSupply(supply);
// 12/04/10 manoharan MF90BHU001
timeMRP.setStockQty(stockQty);
timeMRP.setOthSupply(othSupply);
// end 12/04/10 manoharan MF90BHU001
this.timeMRPArr.set(timeEle,timeMRP);
}
updateRunningDemandSupply(dueDate);
......
......@@ -106,6 +106,9 @@ public class ExplodeBom
int iLeadTime = 0;
int iiLeadTime = 0;
String sqlLead = null;
String mfgLeadBasis = "F";
double batchSizeLead = 0;
try
{
conn = connDriver.getConnectDB("DriverITM");//Added by Jiten 13/11/06 -
......@@ -444,7 +447,8 @@ public class ExplodeBom
//}
//else
//{
sqlLead = "SELECT PUR_LEAD_TIME, QC_LEAD_TIME, MFG_LEAD_TIME "
// 22/06/10 manoharan to consider mfg lead time per batch
sqlLead = "SELECT PUR_LEAD_TIME, QC_LEAD_TIME, MFG_LEAD_TIME, mfg_lead_basis, batch_size_lead "
+ "FROM SITEITEM "
+ "WHERE SITE_CODE = ? "
+ "AND ITEM_CODE = ? ";
......@@ -458,6 +462,9 @@ public class ExplodeBom
dpurLeadTime = rsLead.getDouble(1);
dqcLeadTime = rsLead.getDouble(2);
dmfgLeadTime = rsLead.getDouble(3);
mfgLeadBasis = rsLead.getString(4);
batchSizeLead = rsLead.getDouble(5);
pstmtLead.close();
rsLead.close();
}
......@@ -465,6 +472,9 @@ public class ExplodeBom
{
mfgLeadBasis = "F";
batchSizeLead = 0;
sqlLead = "SELECT PUR_LEAD_TIME, QC_LEAD_TIME, MFG_LEAD "
+ "FROM ITEM "
+ "WHERE ITEM_CODE = ? ";
......@@ -519,6 +529,22 @@ public class ExplodeBom
if ( lineTypeInner.equals("B") )
{
// 22/06/10 manoharan mfg_lead_time to be calculated as per batch size
// 22/06/10 manoharan to calculate due_date based on batch size
// if configured as lead time per batch
if (mfgLeadBasis == null)
{
mfgLeadBasis = "F";
}
if ("B".equals(mfgLeadBasis) && quantityUpdate > batchSizeLead )
{
System.out.println("manohar dmfgLeadTime before [" + dmfgLeadTime + "]");
dmfgLeadTime = quantityUpdate * dmfgLeadTime / batchSizeLead;
System.out.println("manohar dmfgLeadTime after [" + dmfgLeadTime + "]");
}
// end 22/06/10 manoharan
simpleDateFormat = new SimpleDateFormat(genericUtility.getDBDateFormat());
sDueDate = simpleDateFormat.format(dueDate);
StringBuffer tempXMLString = new StringBuffer("<Root>");
......
......@@ -83,6 +83,7 @@ public class RcptBackFlushPos extends ValidatorEJB implements RcptBackFlushPosL
NodeList hdrDom = null;
Node currDetail = null;
InvAllocTraceBean invAllocTrace = new InvAllocTraceBean();
String qcReqd = "N", lotNoDet = "";
try
{
stmt = conn.createStatement();
......@@ -94,6 +95,7 @@ public class RcptBackFlushPos extends ValidatorEJB implements RcptBackFlushPosL
tranType = GenericUtility.getInstance().getColumnValueFromNode("tran_type",hdrDom.item(0));
siteCodeReq = GenericUtility.getInstance().getColumnValueFromNode("site_code",hdrDom.item(0));
tranId = GenericUtility.getInstance().getColumnValueFromNode("tran_id",hdrDom.item(0));
qcReqd = GenericUtility.getInstance().getColumnValueFromNode("qc_reqd",hdrDom.item(0));
System.out.println("\n tranId :"+tranId);
// 24/01/11 - Chandni Shah
......@@ -117,7 +119,7 @@ public class RcptBackFlushPos extends ValidatorEJB implements RcptBackFlushPosL
if ("Y".equalsIgnoreCase(sumQtyDet))
{
sql = " select sum ( case when qty_doc is null then quantity else qty_doc end) as qty_doc "
sql = " select sum ( (case when CONV_QTY_DOC is null or CONV_QTY_DOC <= 0 then 1 else CONV_QTY_DOC end) * quantity )as qty_doc "
+" from receipt_backflush_det "
+" where tran_id = ? " ;
pstmt = conn.prepareStatement(sql);
......@@ -148,7 +150,7 @@ public class RcptBackFlushPos extends ValidatorEJB implements RcptBackFlushPosL
// 27/01/11 - Chandni Shah
if ("C".equalsIgnoreCase(backflushType))
{
sql = " select s.mfg_date,s.exp_date,r.loc_code from "
sql = " select s.mfg_date,s.exp_date,r.loc_code, r.lot_no from "
+" receipt_backflush_det r , stock s "
+" where r.item_code = s.item_code "
+" and r.site_code = s.site_code "
......@@ -165,12 +167,15 @@ public class RcptBackFlushPos extends ValidatorEJB implements RcptBackFlushPosL
mfgDate = rs.getTimestamp ("mfg_date") ;
expDate = rs.getTimestamp ("exp_date");
locCodeDet = rs.getString ("loc_code");
lotNoDet = rs.getString ("lot_no");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if ("Y".equals(qcReqd) )
{
sql = " update receipt_backflush "
+" set mfg_date = ? , "
+" exp_date = ? , "
......@@ -181,6 +186,23 @@ public class RcptBackFlushPos extends ValidatorEJB implements RcptBackFlushPosL
pstmt.setTimestamp(2,expDate);
pstmt.setString(3,locCodeDet);
pstmt.setString(4,tranId);
}
else
{
sql = " update receipt_backflush "
+" set mfg_date = ? , "
+" exp_date = ? , "
+" loc_code = ?, "
+ " lot_no = ? "
+" where tran_id = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setTimestamp(1,mfgDate);
pstmt.setTimestamp(2,expDate);
pstmt.setString(3,locCodeDet);
pstmt.setString(4,lotNoDet);
pstmt.setString(5,tranId);
}
int upd = pstmt.executeUpdate();
pstmt.close();
......
......@@ -25,7 +25,6 @@ public class RunMRP extends ValidatorEJB implements RunMRPLocal,RunMRPRemote //
GenericUtility genericUtility = GenericUtility.getInstance();
ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB();
Connection conn = null;
SimpleDateFormat simpleDateFormat = null;
/*public void ejbCreate() throws RemoteException, CreateException
......@@ -113,7 +112,7 @@ public class RunMRP extends ValidatorEJB implements RunMRPLocal,RunMRPRemote //
InitialContext ctx = new InitialContext(p);
itmDBAccess = (ITMDBAccessLocal)ctx.lookup("ibase/ITMDBAccessEJB/local");
//itmDBAccess = itmDBAccessHome.create();
connectionObject = itmDBAccess.getConnection();
//connectionObject = itmDBAccess.getConnection();
userId = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginCode");
columnValue = genericUtility.getColumnValue(currentColumn,dom);
......@@ -229,6 +228,8 @@ public class RunMRP extends ValidatorEJB implements RunMRPLocal,RunMRPRemote //
String itemcodeTo = "";
//String itemSerTo = "";
//String itemSerFrom = "";
Connection conn = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
......@@ -372,8 +373,8 @@ public class RunMRP extends ValidatorEJB implements RunMRPLocal,RunMRPRemote //
try
{
//System.out.println("Closing Connection.....");
//conn.close();
//conn = null;
conn.close();
conn = null;
}catch(Exception se){}
}
return errString;
......
......@@ -22,6 +22,23 @@ import ibase.webitm.utility.TransIDGenerator;
import ibase.system.config.*;
import ibase.utility.CommonConstants;
import javax.ejb.Stateless; // added for ejb3
// 12/04/10 manoharan MF90BHU003
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
import org.apache.poi.hssf.usermodel.HSSFDataFormat;
import org.apache.poi.hssf.usermodel.HSSFCell;
//import org.apache.poi.xssf.usermodel.*;
//import org.apache.poi.ss.util.CellRangeAddress;
//import org.apache.poi.ss.usermodel.*;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.*;
import org.apache.poi.hssf.util.HSSFColor;
import org.w3c.dom.*;
import javax.xml.parsers.*;
// end 12/04/10 manoharan MF90BHU003
@Stateless // added for ejb3
......@@ -91,6 +108,7 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal,RunMRPPrcRem
HashMap itemCodeMap = new HashMap();
HashMap siteCodeMap = new HashMap();
HashMap itemHashMap = new HashMap();
Set itemList = new HashSet();
String logInSite = "";
String chgUser = "";
......@@ -422,6 +440,7 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal,RunMRPPrcRem
}
resultString = setValuesInBrow();
Write2XSL();
}
catch (SQLException se)
{
......@@ -959,7 +978,7 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal,RunMRPPrcRem
sql = sql + "AND CASE WHEN A.MASTER_SCH IS NULL THEN 'Y' ELSE A.MASTER_SCH END <> 'N' ";
sql = sql + "AND B.VALID_UPTO IS NULL ";
sql = sql + "AND C.ITEM_SER >=? ";
sql = sql + "AND C.ITEM_SER <=? ";
sql = sql + "AND C.ITEM_SER <=? ORDER BY ITEM_CODE ASC";
}
else
{
......@@ -975,7 +994,7 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal,RunMRPPrcRem
sql = sql + "AND CASE WHEN A.MASTER_SCH IS NULL THEN 'Y' ELSE A.MASTER_SCH END <> 'N' ";
sql = sql + "AND B.VALID_UPTO IS NULL ";
sql = sql + "AND C.ITEM_SER >= ? ";
sql = sql + "AND C.ITEM_SER <= ? ";
sql = sql + "AND C.ITEM_SER <= ? ORDER BY ITEM_CODE ASC";
}
......@@ -997,6 +1016,7 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal,RunMRPPrcRem
System.out.println("Populating item for site : "+siteCode);
while(rs.next())
{
System.out.println("rs.getString(1)--"+rs.getString(1));
if(itemCodeMap.containsKey(rs.getString(1)))
{
System.out.println("Item Code already exists : "+rs.getString(1));
......@@ -1075,13 +1095,17 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal,RunMRPPrcRem
int ctr;
for (ctr = 0; ctr < itemArr.size() ; ctr++)
{
System.out.println("(String)itemArr.get(ctr)--"+(String)itemArr.get(ctr));
suppSour = getSuppSour((String)siteMapEntry.getKey(),(String)itemArr.get(ctr));
suppSour = suppSour.trim();
bomCode = getBomCode((String)siteMapEntry.getKey(),(String)itemArr.get(ctr));
System.out.println("SuppSour---"+suppSour+"bomCode--"+bomCode);
//System.out.println("populateAllItem(): Supp_Sour:..." + suppSour + " Bom Code:..." + bomCode);
if( ( (suppSour != null) && (!suppSour.equals("P")) ) && (bomCode != null) )
{
itemHashMap.put( (String)itemArr.get(ctr), new Integer(count) );
//itemHashMap.put( (String)itemArr.get(ctr), new Integer(count) );
System.out.println("itemArr.get(ctr)--"+itemArr.get(ctr));
itemList.add((String)itemArr.get(ctr));
//System.out.println("Exploding BOM for site : " + (String)siteMapEntry.getKey() + " Item : " + (String)itemArr.get(ctr) + " BOM : " + bomCode);
//Added by Jiten 07/11/06
cyclicItem.bomCode = bomCode;
......@@ -1100,6 +1124,7 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal,RunMRPPrcRem
}
}
}
itemList.clear();
}
}
catch(Exception e)
......@@ -1131,7 +1156,12 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal,RunMRPPrcRem
String logMsg = null;
String confirmedBom = null;
String activeBom = null;
// 29/09/10 manoharan to close the main resultset before processing
ArrayList mainList = new ArrayList();
String tempItemCode = "";
int setLength=0;
// end 29/09/10 manoharan
try
{
......@@ -1141,7 +1171,7 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal,RunMRPPrcRem
pstmtValidBom.setString(1,bomCode);
rsValidBom = pstmtValidBom.executeQuery();
bomExists = false;
while(rsValidBom.next())
if(rsValidBom.next())
{
bomExists = true;
confirmedBom = rsValidBom.getString(1);
......@@ -1179,63 +1209,104 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal,RunMRPPrcRem
rs = pstmt.executeQuery();
while(rs.next())
{
//System.out.println("Item Code : "+rs.getString(1));
System.out.println("Item Code : "+rs.getString(1));
mainList.add(rs.getString(1));
}
rs.close();
pstmt.close();
/*for (int mainCtr = 0; mainCtr < mainList.size() ; mainCtr++)
{
System.out.println("(String) mainList.get(mainCtr)--"+(String) mainList.get(mainCtr));
}*/
for (int mainCtr = 0; mainCtr < mainList.size() ; mainCtr++)
{
tempItemCode = (String) mainList.get(mainCtr);
//System.out.println("sHAMIM...........................................");
//System.out.println("Manoj tempItemCode--"+tempItemCode);
setLength=itemList.size();
Iterator itr=itemList.iterator();
while(itr.hasNext())
{
System.out.println(itr.next());
}
System.out.println("setLength--"+setLength);
System.out.println("Hello");
System.out.println("tempItemCode--"+tempItemCode+"--"+itemList.size());
itemList.add(tempItemCode);
System.out.println("tempItemCode--"+tempItemCode+"--"+itemList.size());
sqlInner1 = "SELECT COUNT(1) FROM ITEM WHERE ITEM_CODE = ?";
pstmtInner1 = conn.prepareStatement(sqlInner1);
pstmtInner1.setString(1,rs.getString(1));
pstmtInner1.setString(1,tempItemCode);
rsCount = pstmtInner1.executeQuery();
//rsCount = stmt.executeQuery("SELECT COUNT(1) FROM ITEM WHERE ITEM_CODE = '" + rs.getString(1) + "'");
if(rsCount.next() && rsCount.getInt(1) > 0)
{
rsCount.close();
rsCount = null;
pstmtInner1.close();
pstmtInner1 = null;
// Add ItemCode in ItemCodeMap if it not present earlier
innerSuppSour = getSuppSour(siteCode,rs.getString(1));
innerBomCode = getBomCode(siteCode,rs.getString(1));
innerSuppSour = getSuppSour(siteCode,tempItemCode);
innerBomCode = getBomCode(siteCode,tempItemCode);
System.out.println("Inner Bom Code "+innerSuppSour+"--"+innerBomCode+"--"+tempItemCode);
//System.out.println("bomExplode Function :: Site Code :: "+siteCode+"Bom Code ::"+bomCode+"Item Code ::"+rs.getString(1));
if( ( (innerSuppSour != null) && (!innerSuppSour.equals("P")) ) && (innerBomCode != null) )
{
if(itemHashMap.containsKey(rs.getString(1)))
System.out.println("itemList.size()--"+verifier+"--"+setLength+"--"+itemList.size());
if(setLength==itemList.size())
{
if(verifier != null && verifier.equalsIgnoreCase("Y"))
{
//Added by Jiten 07/11/06//
if(verifier != null && verifier.equalsIgnoreCase("Y")){
System.out.println("itemList.size()--"+verifier+"--"+setLength+"--"+itemList.size());
this.fw.write(cyclicItem.siteCode+" "+cyclicItem.bomCode+" "+cyclicItem.itemCode+" "+rs.getString(1)+"\r\n");
System.out.println("Cyclic Item Code is : " + rs.getString(1));
System.out.println("Cyclic Item Code is : " + tempItemCode);
//return "";
System.out.println("itemList.size()--"+verifier+"--"+setLength+"--"+itemList.size());
itemList.clear();
}
else{
System.out.println("Cyclic Item Code is : " + rs.getString(1));
System.out.println("Cyclic Item Code is : " + tempItemCode);
errString = itmDBAccessEJB.getErrorString("","VTMRPITEME","","",conn);
rs.close();
pstmt.close();
itemList.clear();
return errString;
}
//End//
}
}
else
if(itemCodeMap.containsKey(tempItemCode))
{
itemHashMap.put(rs.getString(1),new Integer(itemHashMap.size()+1));
System.out.println("Test1");
}
}
if(itemCodeMap.containsKey(rs.getString(1)))
{}
else
{
itemCodeMap.put(rs.getString(1),new Integer(itemCodeMap.size() + 1));
System.out.println("Test2");
itemCodeMap.put(tempItemCode,new Integer(itemCodeMap.size() + 1));
}
if( ( (innerSuppSour != null) && (!innerSuppSour.equals("P")) ) && (innerBomCode != null) )
{
//System.out.println("Inner Exploding BOM for site : " + siteCode + " Item : " + rs.getString(1) + " BOM : " + innerBomCode);
validBomItemCode = rs.getString(1);
System.out.println("Inner Exploding BOM for site : " + siteCode + " Item : " + tempItemCode + " BOM : " + innerBomCode);
validBomItemCode = tempItemCode;
errString = bomExplode(siteCode, innerBomCode);
System.out.println("Inner 1"+siteCode+"--"+innerBomCode);
System.out.println("Inner 2"+siteCode+"--"+innerBomCode);
if ( errString != null && errString.trim().length() > 0 )
{
System.out.println("Error While Calling method bomExplode(String, String):..."+errString);
rs.close();
pstmt.close();
//rs.close();
//pstmt.close();
//rs = null;
//pstmt = null;
return errString;
}
}
......@@ -1244,31 +1315,51 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal,RunMRPPrcRem
else
{
rsCount.close();
pstmtInner1.close();
sqlInner2 = "SELECT COUNT(1) FROM BOM WHERE BOM_CODE = ?";
pstmtInner2 = conn.prepareStatement(sqlInner2);
pstmtInner2.setString(1,rs.getString(1));
pstmtInner2.setString(1,tempItemCode);
rsCount = pstmtInner2.executeQuery();
//rsCount = stmt.executeQuery("SELECT COUNT(1) FROM BOM WHERE BOM_CODE = '" + rs.getString(1) + "'");
if(rsCount.next() && rsCount.getInt(1) > 0)
{
rsCount.close();
rsCount = null;
pstmtInner2.close();
validBomItemCode = "BOMDET:" +rs.getString(1);
errString = bomExplode(siteCode, rs.getString(1));
pstmtInner2 = null;
validBomItemCode = "BOMDET:" +tempItemCode;
errString = bomExplode(siteCode, tempItemCode);
if ( errString != null && errString.trim().length() > 0 )
{
System.out.println("Error While Calling method bomExplode(String, String):..."+errString);
rs.close();
pstmt.close();
//rs.close();
//pstmt.close();
//rs = null;
//pstmt = null;
return errString;
}
}
else
{
rsCount.close();
rsCount = null;
pstmtInner2.close();
pstmtInner2 = null;
}
}
}
if ( rs != null)
{
rs.close();
rs = null;//Added by Jiten 09/11/06 -Sun
}
if ( pstmt != null)
{
pstmt.close();
pstmt = null;
}
}
catch(SQLException se)
{
System.out.println("SQLException :RunMRPPrcEJB :bomExplode(String siteCode, String MatPlan, String bomCode).." +se.getMessage());
......@@ -1288,6 +1379,11 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal,RunMRPPrcRem
{
try
{
if ( rs != null)
{
rs.close();
rs = null;//Added by Jiten 09/11/06 -Sun
}
if (pstmt != null)
{
pstmt.close();
......@@ -1360,6 +1456,8 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal,RunMRPPrcRem
}
rs.close();
pstmt.close();
rs = null;
pstmt = null;
}
catch(SQLException se)
{
......@@ -1676,6 +1774,10 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal,RunMRPPrcRem
String cctrCodeWp = "";
String acctCode = "";
String cctrCode = "";
// 22/06/10 manoharan mfg lead time basis and batch size
String mfgLeadBasis = "F";
double batchSizeLead = 0;
//
ResultSet rs = null;
ResultSet rsInner = null;
......@@ -1686,6 +1788,7 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal,RunMRPPrcRem
siteCode = adpElement.getSiteCode();
try
{ //1
sql ="SELECT CASE WHEN (CASE WHEN A.SUPP_SOUR IS NULL THEN B.SUPP_SOUR ELSE A.SUPP_SOUR END) IS NULL THEN '' ELSE "
......@@ -1755,20 +1858,21 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal,RunMRPPrcRem
+"C.CCTR_CODE__PH, "
// 30
+" B.ITEM_SER, "
// 31
+" CASE WHEN A.MFG_TYPE IS NULL THEN 'MRP' ELSE A.MFG_TYPE END, A.ROUTE_CODE "
// 31, 32
+" CASE WHEN A.MFG_TYPE IS NULL THEN 'MRP' ELSE A.MFG_TYPE END, A.ROUTE_CODE, "
// 33, 34
+" case when a.mfg_lead_basis is null then 'F' else a.mfg_lead_basis end, case when a.batch_size_lead is null then 0 else a.batch_size_lead end "
+" FROM SITEITEM A, ITEM B, ITEMSER C "
+" WHERE A.ITEM_CODE = B.ITEM_CODE "
+" AND B.ITEM_SER = C.ITEM_SER"
+" AND A.SITE_CODE = '" + siteCode + "' "
+" AND A.ITEM_CODE = '" + itemCode + "' ";
//+" AND A.SITE_CODE = ? "
//+" AND A.ITEM_CODE = ? ";
+" AND B.ITEM_SER = C.ITEM_SER "
+" AND A.SITE_CODE = ? "
+" AND A.ITEM_CODE = ? ";
//+" AND A.SITE_CODE = '" + siteCode + "' "
//+" AND A.ITEM_CODE = '" + itemCode + "' ";
pstmt = conn.prepareStatement(sql);
//pstmt.setString(1,siteCode);
//pstmt.setString(2,itemCode);
pstmt.setString(1,siteCode);
pstmt.setString(2,itemCode);
rs = pstmt.executeQuery();
if (rs.next())
{
......@@ -1869,6 +1973,13 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal,RunMRPPrcRem
{
adpElement.setRouteCode(routeCode);
}
// 22/06/10 manoharan
mfgLeadBasis = rs.getString(33);
mfgLeadBasis = (mfgLeadBasis == null ? "F" : mfgLeadBasis);
adpElement.setMfgLeadBasis(mfgLeadBasis);
batchSizeLead = rs.getDouble(34);
adpElement.setBatchSizeLead(batchSizeLead);
// end 22/06/10 manoharan
rs.close();
}
else
......@@ -2041,6 +2152,10 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal,RunMRPPrcRem
{
adpElement.setMfgType(mfgType.trim());
}
// 22/06/10 manoharan
adpElement.setMfgLeadBasis("F");
adpElement.setBatchSizeLead(0);
// end 22/06/10 manoharan
rs.close();
}
......@@ -2048,9 +2163,6 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal,RunMRPPrcRem
//***************************** end 04-01-2007 manoharan
}
if (adpElement.getSuppSour() == null)
{
adpElement.setSuppSour(this.getSuppSour(siteCode, itemCode));
......@@ -2226,11 +2338,15 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal,RunMRPPrcRem
java.sql.Timestamp dueDate = null;
String itemCode = null;
String siteCode = null;
// 12/04/10 manoharan MF90BHU001
double stockQty = 0;
double othSupply = 0;
// end 12/04/10 manoharan MF90BHU001
Statement stmt = null;
ResultSet rs = null;
errString = "";
String adpQuery = null;
PreparedStatement pstmt = null;
try
{
......@@ -2316,9 +2432,12 @@ bw.write(adpQuery);
bw.close();
fout.close();
stmt = conn.createStatement();
//stmt = conn.createStatement();
//System.out.println("Executing Query After Replacement.....");
rs = stmt.executeQuery(adpQuery);
//rs = stmt.executeQuery(adpQuery);
pstmt = conn.prepareStatement(adpQuery);
rs = pstmt.executeQuery();
//System.out.println("Query Executed for item : " + itemCode);
String rsItemCode = "",adpItemcode = "";
while(rs.next())
......@@ -2327,6 +2446,10 @@ fout.close();
dueDate = rs.getTimestamp(2);
demand = rs.getDouble(3);
supply = rs.getDouble(4);
// 12/04/10 manoharan MF90BHU001 stock and other supply to be separated
stockQty = rs.getDouble(5);
othSupply = rs.getDouble(6);
// end 12/04/10 manoharan
// 18-11-2006 manoharan if dueDate < dateFrom then set the dueDate as dateFrom
if (dueDate.compareTo(dateFrom) < 0 )
{
......@@ -2338,9 +2461,15 @@ fout.close();
{
adpElement.setDemand(dueDate, demand);
adpElement.setSupply(dueDate, supply);
// 12/04/10 manoharan MF90BHU001
adpElement.setStockQty(dueDate, stockQty);
adpElement.setOthSupply(dueDate, othSupply);
// end 12/04/10 manoharan MF90BHU001
}
else
{System.out.println("Site Code :: "+siteCode+" rsItemCode :: "+rsItemCode+" Item Code :: "+itemCode);
{
System.out.println("Site Code :: "+siteCode+" rsItemCode :: "+rsItemCode+" Item Code :: "+itemCode);
int ctr = indexOfADPElement(siteCode, rsItemCode);
//System.out.println("AdpList : "+adpeList.size()+"Index ctr :: "+ctr);//Added by Jiten 09/11/06 Sun
if(ctr > 0){//if condition added by jiten as per Manoharan Sir 10/11/06
......@@ -2361,7 +2490,9 @@ fout.close();
}
}
rs.close();
stmt.close();
rs = null;
pstmt.close();
pstmt = null;
}
catch(SQLException se)
{
......@@ -2381,7 +2512,7 @@ fout.close();
}
finally
{
if (stmt != null) { stmt = null; }
if (pstmt != null) { pstmt = null; }
if (rs != null) { rs = null; }
this.fw1.flush();//Added by jiten 10/11/06
//System.out.println("populateDemandSupply() finally block......");
......@@ -2455,6 +2586,10 @@ fout.close();
String batchQtyType = "";
int mfgLeadTime = 0;
int qcLeadTime = 0;
// 22/06/10 manoharan
String mfgLeadBasis = "F";
double batchSizeLead = 0;
// end 22/06/10 manoharan
ExplodeBom explodeBomObj = new ExplodeBom();
demand = adpElement.getDemand();
......@@ -2469,6 +2604,10 @@ fout.close();
yieldPerc = adpElement.getYieldPerc();
batchQtyType = adpElement.getBatchQtyType();
minPlanPerc = adpElement.getMinPlanPerc();
// 22/06/10 manoharan
mfgLeadBasis = adpElement.getMfgLeadBasis();
batchSizeLead = adpElement.getBatchSizeLead();
// end 22/06/10 manoharan
System.out.println("14012009 Optimize site : " + siteCode + " Item : " + itemCode + " Demand : "+demand+" Supply : "+supply);
try
......@@ -2565,6 +2704,21 @@ fout.close();
// end 10-04-2006 manoharan
if (suppSour != null && suppSour.trim().equals("M") && matPlan.trim().equals("Y"))
{
// 22/06/10 manoharan to calculate due_date based on batch size
// if configured as lead time per batch
if (mfgLeadBasis == null)
{
mfgLeadBasis = "F";
}
if ("B".equals(mfgLeadBasis) && quantity > batchSizeLead )
{
System.out.println("manohar mfgLeadTime before ["+mfgLeadTime + "]");
mfgLeadTime = (int) (quantity * mfgLeadTime / batchSizeLead);
System.out.println("manohar mfgLeadTime after ["+mfgLeadTime + "]");
}
// end 22/06/10 manoharan
StringBuffer xmlString = new StringBuffer("<Root>");
String retXMLStr = null;
xmlString.append("<Detail>");
......@@ -4353,6 +4507,11 @@ fout.close();
mpsOrder = (MPSOrder)list.get(count);
ordType = mpsOrder.ordType;
// 30/06/10 manoharan
if (ordType == null || ordType.trim().length() == 0)
{
ordType = "O";
}
itemCode = mpsOrder.itemCode;
siteCode = mpsOrder.siteCode;
quantity = mpsOrder.quantity;
......@@ -4819,7 +4978,10 @@ fout.close();
double minPlanPerc = 0;
double batchQty = 0;
double purcRate = 0;
// 12/04/10 manoharan MF90BHU001
double stockQty = 0;
double othSupply = 0;
// end 12/04/10 Manoharan MF90BHU001
int purLeadTime = 0;
int qcLeadTime = 0;
int mfgLeadTime = 0;
......@@ -4846,11 +5008,12 @@ fout.close();
+ " ? , ? , ? , ? , ? , ? ,"
+ " ? , ? , ? ) ";
pstmtPlanHdr = conn.prepareStatement(sqlPlanHdr);
// 12/04/10 manoharan MF90BHU001 stock_qty and oth_supply added
String sqlPlanDet = "INSERT INTO PLAN_DET(SITE_CODE, ITEM_CODE, DEMAND, SUPPLY, PLAN_SUPP, "
+ "RUNNING_DEMAND, RUNNING_SUPP, RUNNING_PLAN_SUPP, IND_DEMAND, DUE_DATE) "
+ "RUNNING_DEMAND, RUNNING_SUPP, RUNNING_PLAN_SUPP, IND_DEMAND, DUE_DATE, STOCK_QTY, OTH_SUPPLY) "
+ "VALUES( ? , ? , ? , ? , ? , ? ,"
+ " ? , ? , ? , ? ) ";
+ " ? , ? , ? , ?, ?, ? ) ";
// end 12/04/10 manoharan MF90BHU001 stock_qty and oth_supply added
pstmtPlanDet = conn.prepareStatement(sqlPlanDet);
for(int adpeCount=0; adpeCount<adpeList.size(); adpeCount++)
......@@ -4919,6 +5082,10 @@ fout.close();
runningPlanSupply = timeMrp.getRunningPlanSupply();
independentDemand = timeMrp.getIndependentDemand();
dueDate = timeMrp.getDueDate();
// 12/04/10 Manoharan MF90BHU001
stockQty = timeMrp.getStockQty();
othSupply = timeMrp.getOthSupply();
// end 12/04/10 Manoharan MF90BHU001
pstmtPlanDet.setString(1,siteCode);
pstmtPlanDet.setString(2,itemCode);
......@@ -4930,6 +5097,10 @@ fout.close();
pstmtPlanDet.setDouble(8,runningPlanSupply);
pstmtPlanDet.setDouble(9,independentDemand);
pstmtPlanDet.setTimestamp(10,dueDate);
// 12/04/10 Manoharan MF90BHU001
pstmtPlanDet.setDouble(11,stockQty);
pstmtPlanDet.setDouble(12,othSupply);
// end 12/04/10 Manoharan MF90BHU001
pstmtPlanDet.addBatch();
}
......@@ -5062,7 +5233,10 @@ fout.close();
int qcLeadTime = 0;
int mfgLeadTime = 0;
boolean flag = true;
// 12/04/10 Manoharan MF90BHU001
double stockQty = 0;
double othSupply = 0;
// end 12/04/10 manoharan MF90BHU001
ADPElement adpElement = null;
try
{
......@@ -5106,6 +5280,10 @@ fout.close();
runningPlanSupply = timeMrp.getRunningPlanSupply();
independentDemand = timeMrp.getIndependentDemand();
dueDateStr = simpleDateFormat.format(timeMrp.getDueDate());
// 12/04/10 manoharan MF90BHU001
stockQty = timeMrp.getStockQty();
othSupply = timeMrp.getOthSupply();
// end 12/04/10 manoharan MF90BHU001
if(flag)
{
......@@ -5151,7 +5329,11 @@ fout.close();
retTabSepStrBuff.append(purLeadTime).append("\t");
retTabSepStrBuff.append(qcLeadTime).append("\t");
retTabSepStrBuff.append(mfgLeadTime).append("\t");
retTabSepStrBuff.append(desc).append("\n");
retTabSepStrBuff.append(desc).append("\t");
// 12/04/10 manoharan MF90BHU001
retTabSepStrBuff.append(decFormat(stockQty)).append("\t");
retTabSepStrBuff.append(decFormat(othSupply)).append("\n");
// end end 12/04/10 manoharan MF90BHU001
}
else
{
......@@ -5171,7 +5353,11 @@ fout.close();
retTabSepStrBuff.append("0").append("\t");
retTabSepStrBuff.append("0").append("\t");
retTabSepStrBuff.append("0").append("\t");
retTabSepStrBuff.append(" ").append("\n");
retTabSepStrBuff.append(desc).append("\t");
// 12/04/10 manoharan MF90BHU001
retTabSepStrBuff.append(decFormat(stockQty)).append("\t");
retTabSepStrBuff.append(decFormat(othSupply)).append("\n");
// end end 12/04/10 manoharan MF90BHU001
}
flag = false;
}
......@@ -5215,6 +5401,378 @@ fout.close();
return reqVal;
}
private void Write2XSL() throws ITMException
{
String errCode = "", date;
String errString = "";
String resultString = "";
StringBuffer retTabSepStrBuff = new StringBuffer();
String siteCode = "0";
String itemCode = "0";
String bomCode = "0";
String suppSour = "0";
String orderOpt = "0";
String dueDateStr = "0";
String batchQtyType = "0";
String unit = "0";
String desc = null;
double demand = 0;
double supply = 0;
double planDemand = 0;
double planSupply = 0;
double runningDemand = 0;
double runningSupply = 0;
double runningPlanSupply = 0;
double independentDemand = 0;
double minOrderQty = 0;
double integralQty = 0;
double maxQty = 0;
double minQty = 0;
double reorderQty = 0;
double yieldPerc = 100;
double minPlanPerc = 0;
double batchQty = 0;
double purcRate = 0;
int purLeadTime = 0;
int qcLeadTime = 0;
int mfgLeadTime = 0;
boolean flag = true;
// 12/04/10 Manoharan MF90BHU001
double stockQty = 0;
double othSupply = 0;
// end 12/04/10 manoharan MF90BHU001
ADPElement adpElement = null;
java.sql.Timestamp dueDate;
HSSFCell cell = null;
HSSFRow row = null;
HSSFCellStyle cellStyle = null;
SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy");
final String[] titles = {
"Site Code", "Item Code", "Item Description", "Supply Source", "Demand", "Supply",
"Stock Qty", "Other Supply", "Due Date",
"Plan Supply", "Running Demand", "Running Supply", "Running Plan Supply", "Independent Demand",
"Bom Code","Order Opt","Batch Qty Type","Unit","Min Order Qty","Integral Qty",
"Max Qty","Min Qty","Reorder Qty","Yield Perc", "Min Plan %","Batch Qty",
"Purc Rate", "Pur Lead Time","QC Lead Time", "MFG Lead Time"
};
// 30
try
{
HSSFWorkbook wb;
wb = new HSSFWorkbook();
HSSFSheet sheet = wb.createSheet("MRPRun");
HSSFRow titleRow = sheet.createRow(0);
titleRow.setHeightInPoints(45);
cellStyle = wb.createCellStyle();
HSSFCellStyle style = wb.createCellStyle();
style.setBorderTop((short) 6); // double lines border
style.setBorderBottom((short) 1); // single line border
style.setFillBackgroundColor(HSSFColor.GREY_25_PERCENT.index);
HSSFFont font = wb.createFont();
font.setFontName(HSSFFont.FONT_ARIAL);
font.setFontHeightInPoints((short) 20);
font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
font.setColor(HSSFColor.BLUE.index);
style.setFont(font);
HSSFCell titleCell = titleRow.createCell((short) 0);
titleCell.setCellValue(new HSSFRichTextString("MRP - Material Requirements"));
titleCell.setCellStyle(style);
sheet.autoSizeColumn((short) 1);
//titleCell.setCellStyle(styles.get("title"));
HSSFRow headerRow = sheet.createRow(1);
headerRow.setHeightInPoints(40);
HSSFCell headerCell;
for (int cellCtr = 0; cellCtr < titles.length; cellCtr++)
{
headerCell = headerRow.createCell((short)cellCtr);
headerCell.setCellValue(titles[cellCtr]);
}
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(genericUtility.getApplDateFormat());
int insertRow = 2;
for(int adpeCount=0; adpeCount<adpeList.size(); adpeCount++)
{
flag = true;
adpElement = (ADPElement)adpeList.get(adpeCount);
siteCode = adpElement.getSiteCode();
itemCode = adpElement.getItemCode();
maxQty = adpElement.getMaxQty();
minQty = adpElement.getMinQty();
suppSour = adpElement.getSuppSour();
orderOpt = adpElement.getOrderOpt();
bomCode = adpElement.getBomCode();
unit = adpElement.getUnit();
batchQtyType = adpElement.getBatchQtyType();
minOrderQty = adpElement.getMinOrderQty();
integralQty = adpElement.getIntegralQty();
reorderQty = adpElement.getReoQty();
yieldPerc = adpElement.getYieldPerc();
minPlanPerc = adpElement.getMinPlanPerc();
batchQty = adpElement.getBatchQty();
purcRate = adpElement.getPurcRate();
qcLeadTime = adpElement.getQcLeadTime();
purLeadTime = adpElement.getPurLeadTime();
mfgLeadTime = adpElement.getMfgLeadTime();
desc = adpElement.getItemDescr();
ArrayList timeMRParr = adpElement.getTimeMrpList();
for (int timeCtr = 0; timeCtr < timeMRParr.size() ; timeCtr++)
{
TimeMRP timeMrp = (TimeMRP)timeMRParr.get(timeCtr);
dueDate = timeMrp.getDueDate();
demand = timeMrp.getDemand();
supply = timeMrp.getSupply();
planSupply = timeMrp.getPlanSupply();
runningDemand = timeMrp.getRunningDemand();
runningSupply = timeMrp.getRunningSupply();
runningPlanSupply = timeMrp.getRunningPlanSupply();
independentDemand = timeMrp.getIndependentDemand();
dueDateStr = simpleDateFormat.format(timeMrp.getDueDate());
// 12/04/10 manoharan MF90BHU001
stockQty = timeMrp.getStockQty();
othSupply = timeMrp.getOthSupply();
// end 12/04/10 manoharan MF90BHU001
insertRow++;
row = sheet.createRow(insertRow);
for (int j = 0; j < titles.length; j++)
{
cell = row.createCell((short)j);
}
if(flag)
{
row.getCell(0).setCellValue(siteCode);
row.getCell(1).setCellValue(itemCode);
row.getCell(2).setCellValue(desc);
row.getCell(3).setCellValue(suppSour);
}
row.getCell(4).setCellValue(demand);
row.getCell(5).setCellValue(supply);
row.getCell(6).setCellValue(stockQty);
row.getCell(7).setCellValue(othSupply);
cell = row.getCell(8);
cell.setCellValue(HSSFDateUtil.getExcelDate(dueDate));
cellStyle.setDataFormat(HSSFDataFormat.getBuiltinFormat("m/d/yy"));
cell.setCellStyle(cellStyle);
row.getCell(9).setCellValue(planSupply);
row.getCell(10).setCellValue(runningDemand);
row.getCell(11).setCellValue(runningSupply);
row.getCell(12).setCellValue(runningPlanSupply);
row.getCell(13).setCellValue(independentDemand);
if(flag)
{
row.getCell(14).setCellValue(bomCode);
row.getCell(15).setCellValue(orderOpt);
row.getCell(16).setCellValue(batchQtyType);
row.getCell(17).setCellValue(unit);
row.getCell(18).setCellValue(minOrderQty);
row.getCell(19).setCellValue(integralQty);
row.getCell(20).setCellValue(maxQty);
row.getCell(21).setCellValue(minQty);
row.getCell(22).setCellValue(reorderQty);
row.getCell(23).setCellValue(yieldPerc);
row.getCell(24).setCellValue(minPlanPerc);
row.getCell(25).setCellValue(batchQty);
row.getCell(26).setCellValue(purcRate);
row.getCell(27).setCellValue(purLeadTime);
row.getCell(28).setCellValue(qcLeadTime);
row.getCell(29).setCellValue(mfgLeadTime);
}
flag = false;
}
}
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
Document dom = db.parse( "/IBASEHOME/ibase.xml" );
String mrpOutputLocation = "";
try
{
mrpOutputLocation = dom.getElementsByTagName( "mrp_output_location" ).item(0).getFirstChild().getNodeValue();
}
catch (Exception e)
{
System.out.println("Exception :RunMRPPrcEJB :setValuesInBrow():" + e.getMessage() + ":");
e.printStackTrace();
throw new ITMException(e);
}
Calendar cal = Calendar.getInstance();
String curTime = ( new java.text.DecimalFormat( "0000" ) ).format( cal.get(Calendar.YEAR) )
+ ( new java.text.DecimalFormat( "00" ) ).format( cal.get(Calendar.MONTH) + 1 )
+ ( new java.text.DecimalFormat( "00" ) ).format( cal.get(Calendar.DAY_OF_MONTH) )
+ ( new java.text.DecimalFormat( "00" ) ).format( cal.get(Calendar.HOUR_OF_DAY) )
+ ( new java.text.DecimalFormat( "00" ) ).format( cal.get(Calendar.MINUTE) ) ;
String fileName = mrpOutputLocation + File.separator+"MRPRun_" + curTime + ".xls";
dom = null;
db = null;
dbf = null;
File outputDir = new File( fileName );
File subDirFile = null;
if( !outputDir.exists() )
{
String subDirName = "";
if (mrpOutputLocation.indexOf("\\") > 0)
{
String subDirs[] = mrpOutputLocation.split( "\\\\" );
subDirName = subDirs[0];
System.out.println("windows stype path");
for( int idx = 1; idx < subDirs.length; idx++ )
{
subDirName = subDirName + File.separator + subDirs[ idx ];
System.out.println("subDirs[ idx ] [" + subDirs[ idx ] + "]");
}
}
else
{
String subDirs[] = mrpOutputLocation.split( "/" );
subDirName = subDirs[0];
System.out.println("Unix style path");
for( int idx = 1; idx < subDirs.length; idx++ )
{
subDirName = subDirName + File.separator + subDirs[ idx ];
System.out.println("subDirs[ idx ] [" + subDirs[ idx ] + "]");
}
}
subDirFile = new File( subDirName );
System.out.println("File path [" + subDirName + "]");
if( !subDirFile.exists() )
{
System.out.println("creating folders [" + subDirName + "]");
subDirFile.mkdirs();
}
}
// Write the output to a file
//if(wb instanceof XSSFWorkbook) file += "x";
FileOutputStream out = new FileOutputStream(fileName);
wb.write(out);
out.close();
//System.out.println("End of collected datas......");
resultString = retTabSepStrBuff.toString();
}
catch (SQLException se)
{
System.out.println("SQLException :RunMRPPrcEJB :setValuesInBrow():" + se.getMessage() + ":");
se.printStackTrace();
throw new ITMException(se);
}
catch (Exception e)
{
System.out.println("Exception :RunMRPPrcEJB :setValuesInBrow():" + e.getMessage() + ":");
e.printStackTrace();
throw new ITMException(e);
}
finally
{
try
{
conn.close();
conn = null;
retTabSepStrBuff = null;
}
catch(Exception e)
{}
}
}
/**
* Create a library of cell styles
*/
/* private static Map<String, HSSFCellStyle> createStyles(Workbook wb){
Map<String, HSSFCellStyle> styles = new HashMap<String, HSSFCellStyle>();
HSSFCellStyle style;
Font titleFont = wb.createFont();
titleFont.setFontHeightInPoints((short)18);
titleFont.setBoldweight(Font.BOLDWEIGHT_BOLD);
style = wb.createCellStyle();
style.setAlignment(HSSFCellStyle.ALIGN_CENTER);
style.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);
style.setFont(titleFont);
styles.put("title", style);
Font monthFont = wb.createFont();
monthFont.setFontHeightInPoints((short)11);
monthFont.setColor(IndexedColors.WHITE.getIndex());
style = wb.createCellStyle();
style.setAlignment(HSSFCellStyle.ALIGN_CENTER);
style.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);
style.setFillForegroundColor(IndexedColors.GREY_50_PERCENT.getIndex());
style.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
style.setFont(monthFont);
style.setWrapText(true);
styles.put("header", style);
style = wb.createCellStyle();
style.setAlignment(HSSFCellStyle.ALIGN_CENTER);
style.setWrapText(true);
style.setBorderRight(HSSFCellStyle.BORDER_THIN);
style.setRightBorderColor(IndexedColors.BLACK.getIndex());
style.setBorderLeft(HSSFCellStyle.BORDER_THIN);
style.setLeftBorderColor(IndexedColors.BLACK.getIndex());
style.setBorderTop(HSSFCellStyle.BORDER_THIN);
style.setTopBorderColor(IndexedColors.BLACK.getIndex());
style.setBorderBottom(HSSFCellStyle.BORDER_THIN);
style.setBottomBorderColor(IndexedColors.BLACK.getIndex());
styles.put("cell", style);
style = wb.createCellStyle();
style.setAlignment(HSSFCellStyle.ALIGN_CENTER);
style.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);
style.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());
style.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
style.setDataFormat(wb.createDataFormat().getFormat("0.00"));
styles.put("formula", style);
style = wb.createCellStyle();
style.setAlignment(HSSFCellStyle.ALIGN_CENTER);
style.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);
style.setFillForegroundColor(IndexedColors.GREY_40_PERCENT.getIndex());
style.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
style.setDataFormat(wb.createDataFormat().getFormat("0.00"));
styles.put("formula_2", style);
return styles;
}
public double getRequiredDecimal(double actVal, int prec)
{
NumberFormat numberFormat = NumberFormat.getIntegerInstance ();
Double DoubleValue = new Double (actVal);
numberFormat.setMaximumFractionDigits(3);
String strValue = numberFormat.format(DoubleValue);
strValue = strValue.replaceAll(",","");
double reqVal = Double.parseDouble(strValue);
return reqVal;
}*/
}
//Added by Jiten 07/11/06
......
......@@ -15,6 +15,10 @@ public class TimeMRP
private double runningSupply = 0;
private double runningPlanSupply = 0;
private double independentDemand = 0;
// 12/04/10 manoharan MF90BHU001
private double stockQty = 0;
private double othSupply = 0;
// end 12/04/10 manoharan MF90BHU001
boolean createDemand = false;
public TimeMRP()
......@@ -50,7 +54,24 @@ public class TimeMRP
{
return this.supply;
}
// 12/04/10 manoharan MF90BHU001
public void setStockQty(double stockQty)
{
this.stockQty += stockQty;
}
public double getStockQty()
{
return this.stockQty;
}
public void setOthSupply(double othSupply)
{
this.othSupply += othSupply;
}
public double getOthSupply()
{
return this.othSupply;
}
// 12/04/10 manoharan MF90BHU001
public void setRunningDemand(double runningDemand)
{
this.runningDemand = runningDemand;
......
package ibase.webitm.ejb.mfg;
import java.rmi.RemoteException;
//import javax.ejb.CreateException;
//import javax.ejb.EJBHome;
//import ibase.webitm.ejb.ProcessHome;
//import ibase.webitm.ejb.Process;
//import javax.ejb.EJBObject;
import org.w3c.dom.*;
import ibase.webitm.utility.ITMException;
import ibase.webitm.ejb.*;
import javax.xml.parsers.*;
import ibase.webitm.ejb.ProcessLocal;
import javax.ejb.Local; // added for ejb3
import ibase.webitm.utility.ITMException;
@Local // added for ejb3`
public interface WorkCalendarPrcLocal extends ProcessLocal
import javax.ejb.Local; // added for ejb3
@Local // added for ejb3
public interface WorkCalendarPrcLocal extends ProcessLocal//, EJBObject
{
//public ibase.webitm.ejb.Process create() throws RemoteException, CreateException;
public String process() throws RemoteException,ITMException;
public String process(String string1, String string2, String windowName, String xtraParams) throws RemoteException,ITMException;
}
\ No newline at end of file
......@@ -6,14 +6,14 @@ import org.w3c.dom.*;
import ibase.webitm.utility.ITMException;
import ibase.webitm.ejb.*;
import javax.xml.parsers.*;
//import ibase.webitm.ejb.Process;
import ibase.webitm.utility.ITMException;
import ibase.webitm.ejb.ProcessRemote;
import ibase.webitm.utility.ITMException;
import javax.ejb.Remote; // added for ejb3
import ibase.webitm.ejb.ValidatorRemote;// added for ejb3
@Remote // added for ejb3
public interface WorkCalendarPrcRemote extends ProcessRemote
public interface WorkCalendarPrcRemote extends ProcessRemote//, EJBObject
{
public String process() throws RemoteException,ITMException;
public String process(String string1, String string2, String windowName, String xtraParams) throws RemoteException,ITMException;
......
......@@ -239,7 +239,6 @@ public class QcOrderAct extends ActionHandlerEJB implements QcOrderActLocal , Q
valueXmlString.append("<quantity>").append("<![CDATA[").append(rs.getDouble(11)).append("]]>").append("</quantity>\r\n");
valueXmlString.append("</Detail>");
//valueXmlString.append("</ >\r\n");
counter++;
}
rs.close();
......@@ -493,7 +492,6 @@ public class QcOrderAct extends ActionHandlerEJB implements QcOrderActLocal , Q
//17-01-11 - chandni shah
valueXmlString.append("<cc_stkloc isSrvCallOnChg='0'>").append("<![CDATA[").append(loc).append("]]>").append("</cc_stkloc>\r\n");
valueXmlString.append("<cc_stkqty isSrvCallOnChg='0'>").append("<![CDATA[").append(quantity).append("]]>").append("</cc_stkqty>\r\n");
//
valueXmlString.append("</Detail>");
line++;
}// for end
......
......@@ -457,7 +457,7 @@ public class RcptBackflushAct extends ActionHandlerEJB implements RcptBackflush
PreparedStatement pstmt = null;
ResultSet rs = null;
String tranId = null, siteDescr = null, itemCode = null, itemDescr = null, unit = null;
String stkLocCode = null,stkLotNo = null, stkLotSl = null, locDescr = null,rate=null;;
String stkLocCode = null,stkLotNo = null, stkLotSl = null, locDescr = null,rate=null,unitDoc = "";
String siteCode = null;
double quantity = 0, remainingQty = 0, inputQty = 0, stkQty = 0;
Node currDetail = null, currDetail1 = null;
......@@ -465,6 +465,8 @@ public class RcptBackflushAct extends ActionHandlerEJB implements RcptBackflush
ConnDriver connDriver = new ConnDriver();
ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB();
GenericUtility genericUtility = GenericUtility.getInstance();
ArrayList unitList = null;
Object factOb = null,qtyOb = null;
try {
conn = connDriver.getConnectDB("DriverITM");
connDriver = null;
......@@ -475,7 +477,7 @@ public class RcptBackflushAct extends ActionHandlerEJB implements RcptBackflush
itemCode = genericUtility.getColumnValue("item_code", dom);
itemDescr = genericUtility.getColumnValue("item_descr", dom);
quantity = Double.parseDouble(genericUtility.getColumnValue("quantity", dom));
unitDoc = genericUtility.getColumnValue("unit", dom1);
NodeList detailList = selDataDom.getElementsByTagName("Detail");
int noOfDetails = detailList.getLength();
for (int ctr = 0; ctr < noOfDetails; ctr++) {
......@@ -550,18 +552,52 @@ public class RcptBackflushAct extends ActionHandlerEJB implements RcptBackflush
valueXmlString.append("<tran_id isSrvCallOnChg='0'>").append("<![CDATA[").append(tranId).append("]]>").append("</tran_id>\r\n");
valueXmlString.append("<site_code isSrvCallOnChg='0'>").append("<![CDATA[").append(siteCode).append("]]>").append("</site_code>\r\n");
valueXmlString.append("<site_descr isSrvCallOnChg='0'>").append("<![CDATA[").append(siteDescr).append("]]>").append("</site_descr>\r\n");
valueXmlString.append("<item_code isSrvCallOnChg='0'>").append("<![CDATA[").append(itemCode).append("]]>").append("</item_code>\r\n");
valueXmlString.append("<item_code isSrvCallOnChg='1'>").append("<![CDATA[").append(itemCode).append("]]>").append("</item_code>\r\n");
valueXmlString.append("<item_descr isSrvCallOnChg='0'>").append("<![CDATA[").append(itemDescr).append("]]>").append("</item_descr>\r\n");
valueXmlString.append("<unit isSrvCallOnChg='0'>").append("<![CDATA[").append(unit).append("]]>").append("</unit>\r\n");
valueXmlString.append("<loc_code isSrvCallOnChg='0'>").append("<![CDATA[").append(stkLocCode).append("]]>").append("</loc_code>\r\n");
valueXmlString.append("<location_descr isSrvCallOnChg='0'>").append("<![CDATA[").append(locDescr).append("]]>").append("</location_descr>\r\n");
valueXmlString.append("<unit__doc isSrvCallOnChg='0'>").append("<![CDATA[").append(unit).append("]]>").append("</unit__doc>\r\n");
valueXmlString.append("<unit__doc isSrvCallOnChg='1'>").append("<![CDATA[").append(unitDoc).append("]]>").append("</unit__doc>\r\n");
valueXmlString.append("<lot_no isSrvCallOnChg='0'>").append("<![CDATA[").append(stkLotNo).append("]]>").append("</lot_no>\r\n");
//changed by ALKA on 12/09/07 for no_art column added in the receipt_backflush_set and itemChange enabled for lot_sl for request id "MF78GIN014"
// valueXmlString.append("<lot_sl isSrvCallOnChg='0'>").append("<![CDATA[").append(stkLotSl).append("]]>").append("</lot_sl>\r\n");
valueXmlString.append("<lot_sl isSrvCallOnChg='1'>").append("<![CDATA[").append(stkLotSl).append("]]>").append("</lot_sl>\r\n");
valueXmlString.append("<quantity isSrvCallOnChg='0'>").append("<![CDATA[").append(inputQty).append("]]>").append("</quantity>\r\n");
valueXmlString.append("<rate isSrvCallOnChg='0'>").append("<![CDATA[").append(rate).append("]]>").append("</rate>\r\n");
// 29/01/10 manoharan
if (!unit.trim().equals(unitDoc.trim()))
{
unitList = null;
factOb = null;
qtyOb = null;
double conv = 0;
ibase.webitm.ejb.dis.DistCommon dist = new ibase.webitm.ejb.dis.DistCommon();
unitList = dist.getConvQuantityFact( unit,unitDoc, itemCode, inputQty, conv,conn);
factOb = unitList.get(0);
qtyOb = unitList.get(1);
System.out.println("manoharan 29/01/11 factOb [ " + factOb.toString() + "] qtyOb [" + qtyOb.toString() + "]");
valueXmlString.append("<conv_qty_doc protect =\"0\">").append("<![CDATA["+factOb.toString()+"]]>").append("</conv_qty_doc>");
valueXmlString.append("<qty_doc protect =\"0\">").append("<![CDATA["+qtyOb.toString()+"]]>").append("</qty_doc>");
unitList = null;
factOb = null;
qtyOb = null;
dist = new ibase.webitm.ejb.dis.DistCommon();
unitList = dist.getConvQuantityFact( unitDoc,unit, itemCode, Double.parseDouble(rate), conv,conn);
factOb = unitList.get(0);
qtyOb = unitList.get(1);
valueXmlString.append("<rate_doc protect =\"0\">").append("<![CDATA["+qtyOb.toString()+"]]>").append("</rate_doc>");
}
else
{
valueXmlString.append("<conv_qty_doc protect =\"0\">").append("<![CDATA[1]]>").append("</conv_qty_doc>");
valueXmlString.append("<qty_doc protect =\"0\">").append("<![CDATA["+inputQty+"]]>").append("</qty_doc>");
valueXmlString.append("<rate_doc protect =\"0\">").append("<![CDATA["+rate+"]]>").append("</rate_doc>");
}
// end 29/01/11 manoharan
valueXmlString.append("</Detail>");
System.out.println("remainingQty at the end of the forloop :::: " + remainingQty); //SOP ADDED BY ALKA TO CHECK THE REMAINING STOCK 19/07/07
if (remainingQty == 0)
......
......@@ -104,8 +104,10 @@ public class WorkorderPrc extends ProcessEJB implements WorkorderPrcLocal,Worko
{
System.out.println("Exception :WorkorderPrcEJB :getData(String xmlString, String xmlString2, String windowName, String xtraParams):" + e.getMessage() + ":");
rtrStr = e.getMessage();
throw new ITMException(e);
}
return rtrStr;
}//END OF GETDATA(1)
......@@ -271,8 +273,7 @@ public class WorkorderPrc extends ProcessEJB implements WorkorderPrcLocal,Worko
return resultString;
}//END OF GETDATA(2)
public String process(String xmlString, String xmlString2, String windowName, String xtraParams)
throws RemoteException,ITMException
public String process(String xmlString, String xmlString2, String windowName, String xtraParams) throws RemoteException,ITMException
{
Document detailDom = null;
Document headerDom = null;
......@@ -313,6 +314,7 @@ public class WorkorderPrc extends ProcessEJB implements WorkorderPrcLocal,Worko
System.out.println("Exception :WorkorderPrcEJB :process(String xmlString, String xmlString2, String windowName, String xtraParams):" + e.getMessage() + ":");
e.printStackTrace();
retStr = e.getMessage();
throw new ITMException(e);
}
return retStr;
}//END OF PROCESS (1)
......@@ -444,11 +446,11 @@ public class WorkorderPrc extends ProcessEJB implements WorkorderPrcLocal,Worko
{
System.out.println("Exception : WorkorderPrcEJB =>"+d.toString());
d.printStackTrace();
}
System.out.println("Exception :WorkorderPrcEJB :process(String xmlString2, String xmlString2, String windowName, String xtraParams):" + e.getMessage() + ":");
e.printStackTrace();
errString = e.getMessage();
return errString ;
throw new ITMException(e);
}
}
finally
{
......@@ -474,7 +476,7 @@ public class WorkorderPrc extends ProcessEJB implements WorkorderPrcLocal,Worko
return errString;
}//END OF PROCESS(2)
private String calWorkorderPrc(ArrayList tranList,Connection conn)
private String calWorkorderPrc(ArrayList tranList,Connection conn) throws Exception,ITMException
{
ResultSet rs1 = null,rsSql1=null,rsSql2=null;
PreparedStatement pstmt = null,pstmtInsert=null,pstmtUpdate=null,pstmtSql1=null,pstmtSql2=null;
......@@ -508,7 +510,7 @@ public class WorkorderPrc extends ProcessEJB implements WorkorderPrcLocal,Worko
StringTokenizer st=null;//for itemSeries
ArrayList ar=new ArrayList();
Timestamp chgDate=null;
String deptCodeMfg = "";
GenericUtility genericUtility = GenericUtility.getInstance();
String tranId1 = null; //blanknull(tranId1).trim();
......@@ -521,8 +523,8 @@ public class WorkorderPrc extends ProcessEJB implements WorkorderPrcLocal,Worko
String sqlInsert = "INSERT INTO WORKORDER(WORK_ORDER,ORDER_TYPE,QUANTITY,YIELD_PERC,ROUTE_CODE,BOM_CODE,"
+" UNIT,MRP_RUN_ID,ACCT_CODE__WP,CCTR_CODE__WP,ADDN_ORDER,PLAN_DUE_DATE,TRAN_ID,SITE_CODE,"
+" ITEM_CODE,ORD_DATE,DUE_DATE,STATUS,STATUS_DATE,FEEDBACK_REQD,CHG_DATE,CHG_USER,CHG_TERM,QUANTITY__RCVD,"
+" CURRENT_BATCH_QTY,UNIT__STD,STD_QTY,CONV__QTY_STDUOM,QUANTITY__MPS,TRAN_ID__MPS) "
+" VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
+" CURRENT_BATCH_QTY,UNIT__STD,STD_QTY,CONV__QTY_STDUOM,QUANTITY__MPS,TRAN_ID__MPS, LOT_SL, DEPT_CODE) "
+" VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,'1S',?)";
String sqlUpdate = " UPDATE MPS_ORDER SET STATUS = 'C' WHERE TRAN_ID =?" ;
......@@ -534,6 +536,9 @@ public class WorkorderPrc extends ProcessEJB implements WorkorderPrcLocal,Worko
try
{
// 30/06/10 manoharan
deptCodeMfg = itmDBAccessEJB.getEnvDis("999999", "DEPT_CODE_MFG",conn);
// end 30/06/10 manoharan
//=========Code to seperate tokens and add to array list===============
pstmtSql1=conn.prepareStatement(sql1);
rsSql1=pstmtSql1.executeQuery();
......@@ -712,6 +717,7 @@ public class WorkorderPrc extends ProcessEJB implements WorkorderPrcLocal,Worko
pstmtInsert.setDouble(28,1);//foR con__qty_stduom
pstmtInsert.setDouble(29,quantity);//for quantity__mps
pstmtInsert.setString(30,tranId_db);//for tran_id__mps
pstmtInsert.setString(31,deptCodeMfg); // 30/06/10 manoharan
pstmtInsert.addBatch();
......@@ -734,12 +740,14 @@ public class WorkorderPrc extends ProcessEJB implements WorkorderPrcLocal,Worko
System.out.println("SQLException in WorkorderPrcEJB:"+sqlInsert+"<====>"+sqlUpdate);
se.printStackTrace();
errorString=se.getMessage();
throw new ITMException(se);
}
catch(Exception e)
{
System.out.println("SQLException in WorkorderPrcEJB:"+sqlInsert+"<====>"+sqlUpdate);
e.printStackTrace();
errorString=e.getMessage();
throw new ITMException(e);
}
return errorString;
}//END OF Method
......@@ -753,7 +761,7 @@ public class WorkorderPrc extends ProcessEJB implements WorkorderPrcLocal,Worko
}//end of blanknull()
private String generateTranId(String windowName,String xmlValues)
private String generateTranId(String windowName,String xmlValues) throws Exception,ITMException
{
Statement stmt = null;
ResultSet rs = null;
......@@ -799,12 +807,14 @@ public class WorkorderPrc extends ProcessEJB implements WorkorderPrcLocal,Worko
System.out.println("Exception ::" +sql+ ex.getMessage() + ":");
ex.printStackTrace();
tranId=null;
throw new ITMException(ex);
}
catch(Exception e)
{
System.out.println("Exception ::" + e.getMessage() + ":");
e.printStackTrace();
tranId=null;
throw new ITMException(e);
}
return tranId;
}//generateTranTd()
......
......@@ -11,8 +11,8 @@ import javax.ejb.Local; // added for ejb3
public interface WorkorderPrcLocal extends ibase.webitm.ejb.ProcessLocal//, EJBObject
{
public String process() throws RemoteException,ITMException;
public String process(Document dom, Document dom2, String windowName, String xtraParams) throws RemoteException,ITMException;
//public String process(Document dom, Document dom2, String windowName, String xtraParams) throws RemoteException,ITMException;
public String process(String xmlString, String xmlString2, String windowName, String xtraParams) throws RemoteException,ITMException;
public String getData(String xmlString, String xmlString2, String windowName, String xtraParams) throws RemoteException,ITMException;
public String getData(Document dom, Document dom2, String windowNamem, String xtraParams) throws RemoteException,ITMException;
//public String getData(Document dom, Document dom2, String windowNamem, String xtraParams) throws RemoteException,ITMException;
}//END OF REMOTE INTERFACE
\ No newline at end of file
......@@ -11,8 +11,8 @@ import javax.ejb.Remote; // added for ejb3
public interface WorkorderPrcRemote extends ibase.webitm.ejb.ProcessRemote//, EJBObject
{
public String process() throws RemoteException,ITMException;
public String process(Document dom, Document dom2, String windowName, String xtraParams) throws RemoteException,ITMException;
//public String process(Document dom, Document dom2, String windowName, String xtraParams) throws Exception,ITMException;
public String process(String xmlString, String xmlString2, String windowName, String xtraParams) throws RemoteException,ITMException;
public String getData(String xmlString, String xmlString2, String windowName, String xtraParams) throws RemoteException,ITMException;
public String getData(Document dom, Document dom2, String windowNamem, String xtraParams) throws RemoteException,ITMException;
//public String getData(Document dom, Document dom2, String windowNamem, String xtraParams) throws RemoteException,ITMException;
}//END OF REMOTE INTERFACE
\ 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