Commit 165a8723 authored by msalam's avatar msalam

changes related to special charecter and dupicate item in auto stock repl


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@91096 ce508802-f39f-4f6c-b175-0d175dae99d5
parent be8be183
...@@ -16,8 +16,10 @@ import javax.ejb.*; ...@@ -16,8 +16,10 @@ import javax.ejb.*;
import javax.naming.InitialContext; import javax.naming.InitialContext;
import java.text.*; import java.text.*;
import java.io.File; import java.io.File;
import javax.ejb.Stateless; // added for ejb3 import javax.ejb.Stateless;
@Stateless // added for ejb3 // added for ejb3
@Stateless
// added for ejb3
public class CustStockItem extends ValidatorEJB //implements SessionBean public class CustStockItem extends ValidatorEJB //implements SessionBean
{ {
...@@ -40,7 +42,7 @@ public class CustStockItem extends ValidatorEJB //implements SessionBean ...@@ -40,7 +42,7 @@ public class CustStockItem extends ValidatorEJB //implements SessionBean
{ {
return ""; return "";
} }
public String wfValData(String xmlString, String xmlString1, String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException public String wfValData(String xmlString, String xmlString1, String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException
{ {
String errString = null; String errString = null;
Document dom = null; Document dom = null;
...@@ -723,8 +725,21 @@ public class CustStockItem extends ValidatorEJB //implements SessionBean ...@@ -723,8 +725,21 @@ public class CustStockItem extends ValidatorEJB //implements SessionBean
} }
if (checkNextCol) if (checkNextCol)
{ {
//validation for duplicate item in detail start
if( dom2 != null )
{
lineNo = genericUtility.getColumnValue("line_no",dom);
if( isItemDuplicate( columnValue, lineNo, dom2 ) )
{
errString = getErrorString("item_code","VTDUPITM",userId);
break;
}
}
//validation for duplicate item in detail end
selQueryBuff = new StringBuffer(); selQueryBuff = new StringBuffer();
//for dynamic binding 190309 //for dynamic binding 190309
//selQueryBuff.append("SELECT NVL(COUNT(*),0) FROM CUST_STOCK_DET, CUST_STOCK "); //selQueryBuff.append("SELECT NVL(COUNT(*),0) FROM CUST_STOCK_DET, CUST_STOCK ");
...@@ -733,7 +748,6 @@ public class CustStockItem extends ValidatorEJB //implements SessionBean ...@@ -733,7 +748,6 @@ public class CustStockItem extends ValidatorEJB //implements SessionBean
//selQueryBuff.append("( CUST_STOCK_DET.TRAN_ID = '").append(tranId ).append("') AND "); //selQueryBuff.append("( CUST_STOCK_DET.TRAN_ID = '").append(tranId ).append("') AND ");
//selQueryBuff.append("( CUST_STOCK.CUST_CODE = '").append(custCode).append("' ) ) "); //selQueryBuff.append("( CUST_STOCK.CUST_CODE = '").append(custCode).append("' ) ) ");
selQueryBuff.append("SELECT NVL(COUNT(*),0) FROM CUST_STOCK_DET, CUST_STOCK "); selQueryBuff.append("SELECT NVL(COUNT(*),0) FROM CUST_STOCK_DET, CUST_STOCK ");
selQueryBuff.append("WHERE ( CUST_STOCK.TRAN_ID = CUST_STOCK_DET.TRAN_ID ) AND "); selQueryBuff.append("WHERE ( CUST_STOCK.TRAN_ID = CUST_STOCK_DET.TRAN_ID ) AND ");
selQueryBuff.append("( ( CUST_STOCK_DET.ITEM_CODE = ? ").append(" ) AND "); selQueryBuff.append("( ( CUST_STOCK_DET.ITEM_CODE = ? ").append(" ) AND ");
...@@ -1279,7 +1293,8 @@ public class CustStockItem extends ValidatorEJB //implements SessionBean ...@@ -1279,7 +1293,8 @@ public class CustStockItem extends ValidatorEJB //implements SessionBean
stmt.close(); stmt.close();
stmt = null; stmt = null;
} }
valueXmlString.append("<name>").append(custName).append("</name>\r\n");
valueXmlString.append("<name><![CDATA[").append(custName).append("]]></name>\r\n");
//for dynamic binding 190309 //for dynamic binding 190309
//selQuery = "SELECT SITE_CODE FROM SITE_CUSTOMER WHERE CUST_CODE = '" + columnValue + "'"; //selQuery = "SELECT SITE_CODE FROM SITE_CUSTOMER WHERE CUST_CODE = '" + columnValue + "'";
...@@ -1468,7 +1483,8 @@ public class CustStockItem extends ValidatorEJB //implements SessionBean ...@@ -1468,7 +1483,8 @@ public class CustStockItem extends ValidatorEJB //implements SessionBean
stmt.close(); stmt.close();
stmt = null; stmt = null;
} }
valueXmlString.append("<descr>").append(siteDescr).append("</descr>\r\n");
valueXmlString.append("<descr><![CDATA[").append(siteDescr).append("]]></descr>\r\n");
if (frdate1.trim().equals("")) if (frdate1.trim().equals(""))
{ {
selQueryBuff = new StringBuffer(); selQueryBuff = new StringBuffer();
...@@ -1768,7 +1784,8 @@ public class CustStockItem extends ValidatorEJB //implements SessionBean ...@@ -1768,7 +1784,8 @@ public class CustStockItem extends ValidatorEJB //implements SessionBean
{ {
itemCode = rs.getString("ITEM_CODE"); itemCode = rs.getString("ITEM_CODE");
//System.out.println("rs.getString(ITEM_CODE)["+rs.getString("ITEM_CODE")+"]"); //System.out.println("rs.getString(ITEM_CODE)["+rs.getString("ITEM_CODE")+"]");
valueXmlString.append("<item_code>").append(itemCode).append("</item_code>\r\n");
valueXmlString.append("<item_code><![CDATA[").append(itemCode).append("]]></item_code>\r\n");
} }
else else
{ {
...@@ -1934,7 +1951,8 @@ public class CustStockItem extends ValidatorEJB //implements SessionBean ...@@ -1934,7 +1951,8 @@ public class CustStockItem extends ValidatorEJB //implements SessionBean
valueXmlString.append("<item_ser>").append(itemSer).append("</item_ser>\r\n"); valueXmlString.append("<item_ser>").append(itemSer).append("</item_ser>\r\n");
valueXmlString.append("<unit>").append(unit).append("</unit>\r\n"); valueXmlString.append("<unit>").append(unit).append("</unit>\r\n");
valueXmlString.append("<loc_type>").append(locType).append("</loc_type>\r\n"); valueXmlString.append("<loc_type>").append(locType).append("</loc_type>\r\n");
valueXmlString.append("<item_descr>").append(itemDescr).append("</item_descr>\r\n");
valueXmlString.append("<item_descr><![CDATA[").append(itemDescr).append("]]></item_descr>\r\n");
} }
rs.close(); rs.close();
pstmt.close(); pstmt.close();
...@@ -2200,12 +2218,13 @@ public class CustStockItem extends ValidatorEJB //implements SessionBean ...@@ -2200,12 +2218,13 @@ public class CustStockItem extends ValidatorEJB //implements SessionBean
pstmt.setString(1,custCode); pstmt.setString(1,custCode);
pstmt.setString(2,itemCode); pstmt.setString(2,itemCode);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) if (rs.next())
{ {
String custItemRef = rs.getString("ITEM_CODE__REF"); String custItemRef = rs.getString("ITEM_CODE__REF");
String custItemRefDescr = rs.getString("DESCR"); String custItemRefDescr = rs.getString("DESCR");
valueXmlString.append("<cust_item__ref>").append(custItemRef).append("</cust_item__ref>\r\n"); valueXmlString.append("<cust_item__ref>").append(custItemRef).append("</cust_item__ref>\r\n");
valueXmlString.append("<cust_item_ref_descr>").append(custItemRefDescr).append("</cust_item_ref_descr>\r\n"); valueXmlString.append("<cust_item_ref_descr><![CDATA[").append(custItemRefDescr).append("]]></cust_item_ref_descr>\r\n");
} }
rs.close(); rs.close();
pstmt.close(); pstmt.close();
...@@ -2785,5 +2804,57 @@ public class CustStockItem extends ValidatorEJB //implements SessionBean ...@@ -2785,5 +2804,57 @@ public class CustStockItem extends ValidatorEJB //implements SessionBean
} }
return fldValue; return fldValue;
} }
//added by msalam on 220409 for checking duplicate item
private boolean isItemDuplicate( String columnValue, String itemLineNo, Document dom )
{
String updateFlag = null;
String fldValue = null;
String nodeName = null;
Node currNode = null;
Node currDet = null;
NodeList currNodes = null;
String lineNoStr = "0";
int currNodeLen;
NodeList detailNodes = dom.getElementsByTagName( "Detail2" );
int detLen = detailNodes.getLength();
for( int detIdx = 0; detIdx < detLen ; detIdx++ )
{
currDet = detailNodes.item( detIdx );
currNodes = currDet.getChildNodes();
currNodeLen = currNodes.getLength();
columnValue = columnValue != null ? columnValue.trim() : "";
for(int curNodeIdx = 0; curNodeIdx < currNodeLen; curNodeIdx++ )
{
currNode = currNodes.item( curNodeIdx );
nodeName = currNode.getNodeName();
if ( nodeName.equalsIgnoreCase( "attribute" ) )
{
updateFlag = currNode.getAttributes().getNamedItem( "updateFlag" ).getNodeValue();
}
else if ( currNode.getNodeType() == Node.ELEMENT_NODE && nodeName.equalsIgnoreCase( "item_code" ) )
{
fldValue = currNode.getFirstChild() != null ? currNode.getFirstChild().getNodeValue().trim() : "";
}
else if ( currNode.getNodeType() == Node.ELEMENT_NODE && nodeName.equalsIgnoreCase( "line_no" ) )
{
lineNoStr = currNode.getFirstChild() != null ? currNode.getFirstChild().getNodeValue().trim() : "0";
}
}
if( !"D".equalsIgnoreCase( updateFlag ) )
{
if( !lineNoStr.trim().equals( itemLineNo.trim() ) && fldValue.trim().equalsIgnoreCase( columnValue ) )
{
System.out.println("lineNoStr [" + lineNoStr + "] itemLineNo [" + itemLineNo+ "]fldValue [" + fldValue + "] columnValue [" + columnValue + "]");
return true;
}
}
}
return false;
}
} }
\ No newline at end of file
...@@ -812,8 +812,8 @@ public class CustStockTransit extends ValidatorEJB //implements SessionBean ...@@ -812,8 +812,8 @@ public class CustStockTransit extends ValidatorEJB //implements SessionBean
stmt = conn.createStatement(); stmt = conn.createStatement();
rs = stmt.executeQuery(selQuery); rs = stmt.executeQuery(selQuery);
if (rs.next()) if (rs.next())
{ {
valueXmlString.append("<descr>").append( rs.getString(1) ).append("</descr>\r\n"); valueXmlString.append("<descr><![CDATA[").append( rs.getString(1) ).append("]]></descr>\r\n");
} }
rs.close(); rs.close();
rs = null; rs = null;
...@@ -845,7 +845,8 @@ public class CustStockTransit extends ValidatorEJB //implements SessionBean ...@@ -845,7 +845,8 @@ public class CustStockTransit extends ValidatorEJB //implements SessionBean
stmt.close(); stmt.close();
stmt = null; stmt = null;
} }
valueXmlString.append("<itemser_descr>").append(itemDescr).append("</itemser_descr>\r\n");
valueXmlString.append("<itemser_descr><![CDATA[").append(itemDescr).append("]]></itemser_descr>\r\n");
valueXmlString.append("<tran_type>H</tran_type>\r\n"); valueXmlString.append("<tran_type>H</tran_type>\r\n");
valueXmlString.append("<tot_op_value>0.0</tot_op_value>\r\n"); valueXmlString.append("<tot_op_value>0.0</tot_op_value>\r\n");
valueXmlString.append("<tot_sales_value>0.0</tot_sales_value>\r\n"); valueXmlString.append("<tot_sales_value>0.0</tot_sales_value>\r\n");
...@@ -897,7 +898,8 @@ public class CustStockTransit extends ValidatorEJB //implements SessionBean ...@@ -897,7 +898,8 @@ public class CustStockTransit extends ValidatorEJB //implements SessionBean
stmt.close(); stmt.close();
stmt = null; stmt = null;
} }
valueXmlString.append("<name>").append(custName).append("</name>\r\n");
valueXmlString.append("<name><![CDATA[").append(custName).append("]]></name>\r\n");
selQuery = "SELECT SITE_CODE FROM SITE_CUSTOMER WHERE CUST_CODE = '" + columnValue + "'"; selQuery = "SELECT SITE_CODE FROM SITE_CUSTOMER WHERE CUST_CODE = '" + columnValue + "'";
stmt = conn.createStatement(); stmt = conn.createStatement();
...@@ -976,7 +978,8 @@ public class CustStockTransit extends ValidatorEJB //implements SessionBean ...@@ -976,7 +978,8 @@ public class CustStockTransit extends ValidatorEJB //implements SessionBean
stmt = null; stmt = null;
//} //}
} }
valueXmlString.append("<item_ser>").append(itemSer).append("</item_ser>\r\n");
valueXmlString.append("<item_ser><![CDATA[").append(itemSer).append("]]></item_ser>\r\n");
//SHWETA 2/14/2005 --Start //SHWETA 2/14/2005 --Start
tranIdLast = getColumnValue("tran_id__last",dom1); tranIdLast = getColumnValue("tran_id__last",dom1);
...@@ -1045,7 +1048,8 @@ public class CustStockTransit extends ValidatorEJB //implements SessionBean ...@@ -1045,7 +1048,8 @@ public class CustStockTransit extends ValidatorEJB //implements SessionBean
stmt.close(); stmt.close();
stmt = null; stmt = null;
} }
valueXmlString.append("<descr>").append(siteDescr).append("</descr>\r\n");
valueXmlString.append("<descr><![CDATA[").append(siteDescr).append("]]></descr>\r\n");
if (frdate1.trim().equals("")) if (frdate1.trim().equals(""))
{ {
selQueryBuff = new StringBuffer(); selQueryBuff = new StringBuffer();
......
...@@ -1923,6 +1923,26 @@ public class SOrderForm extends ValidatorEJB implements SOrderFormLocal, SOrderF ...@@ -1923,6 +1923,26 @@ public class SOrderForm extends ValidatorEJB implements SOrderFormLocal, SOrderF
} }
else if (currentColumn.trim().equals("itm_defaultedit") ) else if (currentColumn.trim().equals("itm_defaultedit") )
{ {
//start getting no of detail lines.
//If there is no detail then make the fields enabled
int detCount = 0;
String tranIdSOrd = genericUtility.getColumnValue( "tran_id", dom );
sql = "Select count(1) cnt from sordformdet where TRAN_ID = ? ";
//System.out.println("select descr from site.." + sql);
pstmt= conn.prepareStatement(sql);
pstmt.setString( 1, tranIdSOrd );
rs = pstmt.executeQuery();
if(rs.next())
{
detCount = rs.getInt( "cnt" );
}
//System.out.println("siteDescr .." + siteDescr);
rs.close();
pstmt.close();
pstmt = null;
rs = null;
//end getting no of detail lines
//System.out.println("xtraParams :::::::::::::::::::::::::::::::::: "+xtraParams); //System.out.println("xtraParams :::::::::::::::::::::::::::::::::: "+xtraParams);
//loginSiteCode = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginSiteCode"); //loginSiteCode = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginSiteCode");
//System.out.println("loginSiteCode :::::::::::::::::::::::::::::::::: "+loginSiteCode); //System.out.println("loginSiteCode :::::::::::::::::::::::::::::::::: "+loginSiteCode);
...@@ -1940,8 +1960,8 @@ public class SOrderForm extends ValidatorEJB implements SOrderFormLocal, SOrderF ...@@ -1940,8 +1960,8 @@ public class SOrderForm extends ValidatorEJB implements SOrderFormLocal, SOrderF
siteCode = genericUtility.getColumnValue("site_code",dom); siteCode = genericUtility.getColumnValue("site_code",dom);
custCode = genericUtility.getColumnValue("cust_code",dom); custCode = genericUtility.getColumnValue("cust_code",dom);
valueXmlString.append("<cust_code isSrvCallOnChg='1' protect =\"1\">").append(custCode).append("</cust_code>"); valueXmlString.append("<cust_code isSrvCallOnChg='1' protect =\"" + ( detCount > 0 ? "1" : "0" ) + "\">").append(custCode).append("</cust_code>");
sql = "Select descr from site where site_code =?"; sql = "Select descr from site where site_code =?";
//System.out.println("select descr from site.." + sql); //System.out.println("select descr from site.." + sql);
pstmt= conn.prepareStatement(sql); pstmt= conn.prepareStatement(sql);
pstmt.setString(1,siteCode); pstmt.setString(1,siteCode);
...@@ -1951,32 +1971,41 @@ public class SOrderForm extends ValidatorEJB implements SOrderFormLocal, SOrderF ...@@ -1951,32 +1971,41 @@ public class SOrderForm extends ValidatorEJB implements SOrderFormLocal, SOrderF
siteDescr = rs.getString(1) == null ? "" : rs.getString(1); siteDescr = rs.getString(1) == null ? "" : rs.getString(1);
} }
//System.out.println("siteDescr .." + siteDescr); //System.out.println("siteDescr .." + siteDescr);
rs.close(); rs.close();
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
rs = null; rs = null;
//valueXmlString.append("<quantity isSrvCallOnChg='1'>").append(pickQty).append("</quantity>"); //valueXmlString.append("<quantity isSrvCallOnChg='1'>").append(pickQty).append("</quantity>");
valueXmlString.append("<site_code protect =\"1\">").append(siteCode).append("</site_code>"); //valueXmlString.append("<site_code protect =\"1\">").append(siteCode).append("</site_code>");
valueXmlString.append("<site_code__ship protect =\"1\">").append(siteCode).append("</site_code__ship>"); //valueXmlString.append("<site_code__ship protect =\"1\">").append(siteCode).append("</site_code__ship>");
valueXmlString.append("<site_code protect =\"" + ( detCount > 0 ? "1" : "0" ) + "\">").append(siteCode).append("</site_code>");
valueXmlString.append("<site_code__ship protect =\"" + ( detCount > 0 ? "1" : "0" ) + "\">").append(siteCode).append("</site_code__ship>");
valueXmlString.append("<site_descr>").append(siteDescr).append("</site_descr>"); valueXmlString.append("<site_descr>").append(siteDescr).append("</site_descr>");
valueXmlString.append("<descr>").append(siteDescr).append("</descr>"); valueXmlString.append("<descr>").append(siteDescr).append("</descr>");
//System.out.println("\n today date set ----" + currAppdate); //System.out.println("\n today date set ----" + currAppdate);
//valueXmlString.append("<pord_date>").append(currAppdate).append("</pord_date>"); //valueXmlString.append("<pord_date>").append(currAppdate).append("</pord_date>");
//valueXmlString.append("<sch_1>").append(currAppdate).append("</sch_1>"); //valueXmlString.append("<sch_1>").append(currAppdate).append("</sch_1>");
//valueXmlString.append("<sch_ratio_1>").append("" + 100).append("</sch_ratio_1>"); //valueXmlString.append("<sch_ratio_1>").append("" + 100).append("</sch_ratio_1>");
valueXmlString.append("<item_ser protect =\"1\">").append("</item_ser>");
//valueXmlString.append("<item_ser protect =\"1\">").append("</item_ser>");
valueXmlString.append("<item_ser protect =\"" + ( detCount > 0 ? "1" : "0" ) + "\">").append("</item_ser>");
orderType = genericUtility.getColumnValue("trans_mode",dom); orderType = genericUtility.getColumnValue("trans_mode",dom);
valueXmlString.append("<trans_mode protect =\"1\">").append(orderType).append("</trans_mode>");
valueXmlString.append("<max_ord_value protect =\"1\">").append("</max_ord_value>"); //valueXmlString.append("<trans_mode protect =\"1\">").append(orderType).append("</trans_mode>");
//valueXmlString.append("<max_ord_value protect =\"1\">").append("</max_ord_value>");
valueXmlString.append("<trans_mode protect =\"" + ( detCount > 0 ? "1" : "0" ) + "\">").append(orderType).append("</trans_mode>");
valueXmlString.append("<max_ord_value protect =\"" + ( detCount > 0 ? "1" : "0" ) + "\">").append("</max_ord_value>");
//changed by rajendra for retain old value //changed by rajendra for retain old value
orderType = genericUtility.getColumnValue("order_type",dom); orderType = genericUtility.getColumnValue("order_type",dom);
//System.out.println("orderType.........."+orderType); //System.out.println("orderType.........."+orderType);
if(orderType != null) if(orderType != null)
{ {
valueXmlString.append("<order_type protect =\"1\">").append(orderType).append("</order_type>");
//valueXmlString.append("<order_type protect =\"1\">").append(orderType).append("</order_type>");
valueXmlString.append("<order_type protect =\"" + ( detCount > 0 ? "1" : "0" ) + "\">").append(orderType).append("</order_type>");
} }
/* sql = " select customer.cust_name,customer.trans_mode,customer.credit_lmt," /* sql = " select customer.cust_name,customer.trans_mode,customer.credit_lmt,"
......
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