Commit db40f702 authored by prane's avatar prane

to set eff_from from mfg_date of min lot entered in lot_no_from field. And...

to set eff_from from mfg_date of min lot entered in lot_no_from field.	And valid_upto from exp_date of max lot no entered in Lot_no_to field

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@197998 ce508802-f39f-4f6c-b175-0d175dae99d5
parent ef0bbf27
package ibase.webitm.ejb.dis; package ibase.webitm.ejb.dis;
import ibase.system.config.ConnDriver; import ibase.system.config.ConnDriver;
import ibase.utility.BaseLogger;
import ibase.utility.E12GenericUtility; import ibase.utility.E12GenericUtility;
import ibase.webitm.ejb.ValidatorEJB; import ibase.webitm.ejb.ValidatorEJB;
import ibase.webitm.utility.GenericUtility; import ibase.webitm.utility.GenericUtility;
...@@ -9,6 +10,7 @@ import java.rmi.RemoteException; ...@@ -9,6 +10,7 @@ import java.rmi.RemoteException;
import java.sql.Connection; import java.sql.Connection;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.Timestamp;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Calendar; import java.util.Calendar;
import java.util.Date; import java.util.Date;
...@@ -36,10 +38,12 @@ public class PriceListTranIC extends ValidatorEJB implements ...@@ -36,10 +38,12 @@ public class PriceListTranIC extends ValidatorEJB implements
Document dom1 = null; Document dom1 = null;
Document dom2 = null; Document dom2 = null;
try { try {
System.out.println("::: xmlString" + xmlString); //System.out.println("::: xmlString" + xmlString);
System.out.println("::: xmlString1" + xmlString1); //System.out.println("::: xmlString1" + xmlString1);
System.out.println("::: xmlString2" + xmlString2); //System.out.println("::: xmlString2" + xmlString2);
BaseLogger.log("9", null, null, "::: xmlString" + xmlString);
BaseLogger.log("9", null, null, "::: xmlString1" + xmlString1);
BaseLogger.log("9", null, null, "::: xmlString2" + xmlString2);
if (xmlString != null && xmlString.trim().length() > 0) { if (xmlString != null && xmlString.trim().length() > 0) {
dom = genericUtility.parseString(xmlString); dom = genericUtility.parseString(xmlString);
} }
...@@ -51,8 +55,8 @@ public class PriceListTranIC extends ValidatorEJB implements ...@@ -51,8 +55,8 @@ public class PriceListTranIC extends ValidatorEJB implements
} }
rtStr = wfValData(dom, dom1, dom2, objContext, editFlag, xtraParams); rtStr = wfValData(dom, dom1, dom2, objContext, editFlag, xtraParams);
} catch (Exception e) { } catch (Exception e) {
System.out.println(":::" + this.getClass().getSimpleName() + "::" //System.out.println(":::" + this.getClass().getSimpleName() + "::" + e.getMessage());
+ e.getMessage()); BaseLogger.log("0", null, null,"Exception in PriceListTranIC:: wfValData:: " + e.getMessage());
e.getMessage(); e.getMessage();
} }
return rtStr; return rtStr;
...@@ -105,8 +109,8 @@ public class PriceListTranIC extends ValidatorEJB implements ...@@ -105,8 +109,8 @@ public class PriceListTranIC extends ValidatorEJB implements
System.out.println(":::childNodeName" + childNodeName); System.out.println(":::childNodeName" + childNodeName);
priceList = genericUtility.getColumnValue("price_list",dom); priceList = genericUtility.getColumnValue("price_list",dom);
priceList = priceList == null ? "" : priceList.trim(); priceList = priceList == null ? "" : priceList.trim();
System.out.println(":::price list:: " + priceList); //System.out.println(":::price list:: " + priceList);
BaseLogger.log("3", null, null, ":::price list:: " + priceList);
sql = "select count(*) as count from pricelist_mst where price_list = ? "; sql = "select count(*) as count from pricelist_mst where price_list = ? ";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, priceList); pstmt.setString(1, priceList);
...@@ -115,13 +119,15 @@ public class PriceListTranIC extends ValidatorEJB implements ...@@ -115,13 +119,15 @@ public class PriceListTranIC extends ValidatorEJB implements
{ {
count = rs.getInt("count"); count = rs.getInt("count");
} }
System.out.println("::: count:::" + count); close(pstmt, rs);
//System.out.println("::: count:::" + count);
BaseLogger.log("3", null, null, "::: count:::" + count);
if (count <= 0) if (count <= 0)
{ {
errString = getErrorString("price_list", "VTPLIST", userId); errString = getErrorString("price_list", "VTPLIST", userId);
return errString; return errString;
} }
close(pstmt, rs); //close(pstmt, rs);
sql = "select manage_type from pricelist_mst where price_list = ? "; sql = "select manage_type from pricelist_mst where price_list = ? ";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
...@@ -131,22 +137,23 @@ public class PriceListTranIC extends ValidatorEJB implements ...@@ -131,22 +137,23 @@ public class PriceListTranIC extends ValidatorEJB implements
{ {
manageType = rs.getString("manage_type"); manageType = rs.getString("manage_type");
} }
close(pstmt, rs);
manageType = manageType == null ? "" : manageType.trim(); manageType = manageType == null ? "" : manageType.trim();
System.out.println(":: manage type::" + manageType); //System.out.println(":: manage type::" + manageType);
BaseLogger.log("3", null, null,":: manage type::" + manageType);
if (!manageType.equalsIgnoreCase("M") || manageType.equalsIgnoreCase("")) if (!manageType.equalsIgnoreCase("M") || manageType.equalsIgnoreCase(""))
{ {
errString = getErrorString("price_list", "VTMTYPE", userId); errString = getErrorString("price_list", "VTMTYPE", userId);
return errString; return errString;
} }
close(pstmt, rs); //close(pstmt, rs);
} }
// Changed By Nasruddin [20-SEP-16] START // Changed By Nasruddin [20-SEP-16] START
if (childNodeName.equalsIgnoreCase("tran_id")) if (childNodeName.equalsIgnoreCase("tran_id"))
{ {
System.out.println(":::childNodeName" + childNodeName); //System.out.println(":::childNodeName" + childNodeName);
BaseLogger.log("3", null, null,":::childNodeName" + childNodeName);
tranId = genericUtility.getColumnValue("tran_id", dom); tranId = genericUtility.getColumnValue("tran_id", dom);
sql = "SELECT KEY_FLAG FROM TRANSETUP WHERE TRAN_WINDOW =''"; sql = "SELECT KEY_FLAG FROM TRANSETUP WHERE TRAN_WINDOW =''";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
...@@ -189,7 +196,8 @@ public class PriceListTranIC extends ValidatorEJB implements ...@@ -189,7 +196,8 @@ public class PriceListTranIC extends ValidatorEJB implements
// Changed By Nasruddin [20-SEP-16] END // Changed By Nasruddin [20-SEP-16] END
if (childNodeName.equalsIgnoreCase("ref_no")) if (childNodeName.equalsIgnoreCase("ref_no"))
{ {
System.out.println(":::childNodeName" + childNodeName); //System.out.println(":::childNodeName" + childNodeName);
BaseLogger.log("3", null, null,":::childNodeName" + childNodeName);
refNo = chkNull(genericUtility.getColumnValue("ref_no", dom)); refNo = chkNull(genericUtility.getColumnValue("ref_no", dom));
if(refNo.length() == 0) if(refNo.length() == 0)
{ {
...@@ -206,7 +214,8 @@ public class PriceListTranIC extends ValidatorEJB implements ...@@ -206,7 +214,8 @@ public class PriceListTranIC extends ValidatorEJB implements
} }
if (childNodeName.equalsIgnoreCase("ref_no_old")) { if (childNodeName.equalsIgnoreCase("ref_no_old")) {
System.out.println(":::childNodeName" + childNodeName); //System.out.println(":::childNodeName" + childNodeName);
BaseLogger.log("3", null, null,":::childNodeName" + childNodeName);
refOld = chkNull(genericUtility.getColumnValue("ref_no_old",dom)); refOld = chkNull(genericUtility.getColumnValue("ref_no_old",dom));
if(refOld.length() == 0) if(refOld.length() == 0)
...@@ -238,11 +247,12 @@ public class PriceListTranIC extends ValidatorEJB implements ...@@ -238,11 +247,12 @@ public class PriceListTranIC extends ValidatorEJB implements
childNodeName = childNode.getNodeName(); childNodeName = childNode.getNodeName();
if (childNodeName.equalsIgnoreCase("item_code")) if (childNodeName.equalsIgnoreCase("item_code"))
{ {
System.out.println(":::childNodeName" + childNodeName); //System.out.println(":::childNodeName" + childNodeName);
BaseLogger.log("3", null, null,":::childNodeName" + childNodeName);
itemCode = genericUtility.getColumnValue("item_code", dom); itemCode = genericUtility.getColumnValue("item_code", dom);
itemCode = itemCode == null ? "" : itemCode.trim(); itemCode = itemCode == null ? "" : itemCode.trim();
System.out.println(":::item code:: " + itemCode); //System.out.println(":::item code:: " + itemCode);
BaseLogger.log("3", null, null,":::item code:: " + itemCode);
sql = "select count(*) as count from item where item_code = ? "; sql = "select count(*) as count from item where item_code = ? ";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, itemCode); pstmt.setString(1, itemCode);
...@@ -251,10 +261,9 @@ public class PriceListTranIC extends ValidatorEJB implements ...@@ -251,10 +261,9 @@ public class PriceListTranIC extends ValidatorEJB implements
{ {
count = rs.getInt("count"); count = rs.getInt("count");
} }
System.out.println("::count ::: " + count); //System.out.println("::count ::: " + count);
close(pstmt, rs); close(pstmt, rs);
BaseLogger.log("3", null, null,"::count ::: " + count);
if (count <= 0) { if (count <= 0) {
errString = getErrorString("item_code", "VMITEM_CD", userId); errString = getErrorString("item_code", "VMITEM_CD", userId);
return errString; return errString;
...@@ -389,7 +398,8 @@ public class PriceListTranIC extends ValidatorEJB implements ...@@ -389,7 +398,8 @@ public class PriceListTranIC extends ValidatorEJB implements
} }
} }
catch (Exception e) { catch (Exception e) {
System.out.println(":::: " + this.getClass().getSimpleName() + ":::" + e.getMessage()); //System.out.println(":::: " + this.getClass().getSimpleName() + ":::" + e.getMessage());
BaseLogger.log("0", null, null,"Exception in PriceListTranIC:: wfValData:: " + this.getClass().getSimpleName() + "::" + e.getMessage());
e.printStackTrace(); e.printStackTrace();
} finally { } finally {
try { try {
...@@ -483,6 +493,10 @@ public class PriceListTranIC extends ValidatorEJB implements ...@@ -483,6 +493,10 @@ public class PriceListTranIC extends ValidatorEJB implements
Connection conn = null; Connection conn = null;
String priceList = "", itemCode = "", sql = "", descr = "", unit = "", descrItem = ""; String priceList = "", itemCode = "", sql = "", descr = "", unit = "", descrItem = "";
String rate = "", effDate = "", tranID = ""; String rate = "", effDate = "", tranID = "";
String lotNoFrom = "";
String lotNoTo = "";
Timestamp effData = null;
Timestamp validUpto = null;
java.sql.Date validUptodt = null; java.sql.Date validUptodt = null;
java.sql.Date effFromdt = null; java.sql.Date effFromdt = null;
...@@ -494,9 +508,9 @@ public class PriceListTranIC extends ValidatorEJB implements ...@@ -494,9 +508,9 @@ public class PriceListTranIC extends ValidatorEJB implements
try { try {
ConnDriver connDriver = new ConnDriver(); ConnDriver connDriver = new ConnDriver();
//Changes and Commented By Bhushan on 09-06-2016 :START //Changes and Commented By Bhushan on 09-06-2016 :START
//conn = connDriver.getConnectDB("DriverITM"); //conn = connDriver.getConnectDB("DriverITM");
conn = getConnection(); conn = getConnection();
//Changes and Commented By Bhushan on 09-06-2016 :END //Changes and Commented By Bhushan on 09-06-2016 :END
conn.setAutoCommit(false); conn.setAutoCommit(false);
SimpleDateFormat sdf = new SimpleDateFormat(genericUtility.getDispDateFormat()); SimpleDateFormat sdf = new SimpleDateFormat(genericUtility.getDispDateFormat());
...@@ -545,6 +559,7 @@ public class PriceListTranIC extends ValidatorEJB implements ...@@ -545,6 +559,7 @@ public class PriceListTranIC extends ValidatorEJB implements
if (rs.next()) { if (rs.next()) {
descr = rs.getString("descr"); descr = rs.getString("descr");
} }
close(pstmt, rs);
valueXmlString.append("<descr><![CDATA[" + descr valueXmlString.append("<descr><![CDATA[" + descr
+ "]]></descr>"); + "]]></descr>");
} }
...@@ -604,7 +619,7 @@ public class PriceListTranIC extends ValidatorEJB implements ...@@ -604,7 +619,7 @@ public class PriceListTranIC extends ValidatorEJB implements
validUptodt = rs.getDate("valid_upto"); validUptodt = rs.getDate("valid_upto");
effFromdt = rs.getDate("eff_from"); effFromdt = rs.getDate("eff_from");
} }
close(pstmt, rs);
System.out.println("validUptodt::: " + validUptodt); System.out.println("validUptodt::: " + validUptodt);
System.out.println("effective from dt::: " + effFromdt); System.out.println("effective from dt::: " + effFromdt);
...@@ -638,6 +653,7 @@ public class PriceListTranIC extends ValidatorEJB implements ...@@ -638,6 +653,7 @@ public class PriceListTranIC extends ValidatorEJB implements
descrItem = rs.getString("descr"); descrItem = rs.getString("descr");
unit = rs.getString("unit"); unit = rs.getString("unit");
} }
close(pstmt, rs);
valueXmlString.append("<item_descr><![CDATA[" valueXmlString.append("<item_descr><![CDATA["
+ descrItem + "]]></item_descr>"); + descrItem + "]]></item_descr>");
valueXmlString.append("<unit><![CDATA[" + unit valueXmlString.append("<unit><![CDATA[" + unit
...@@ -654,6 +670,60 @@ public class PriceListTranIC extends ValidatorEJB implements ...@@ -654,6 +670,60 @@ public class PriceListTranIC extends ValidatorEJB implements
valueXmlString.append("<max_rate><![CDATA[" + rate valueXmlString.append("<max_rate><![CDATA[" + rate
+ "]]></max_rate>"); + "]]></max_rate>");
} }
/*Pavan R 4feb19 [to set eff_from from mfg_date of min lot entered in lot_no_from field.
And valid_upto from exp_date of max lot no entered in Lot_no_to field]*/
if (currentColumn.equalsIgnoreCase("lot_no__from"))
{
lotNoFrom = genericUtility.getColumnValue("lot_no__from", dom);
itemCode = genericUtility.getColumnValue("item_code", dom);
BaseLogger.log("3", null, null, "lot_no__from ["+lotNoFrom+"] itemCode ["+itemCode+"]");
if(!("0".equalsIgnoreCase(lotNoFrom) || "00".equalsIgnoreCase(lotNoFrom)))
{
sql = "select mfg_date from item_lot_info where item_code = ? and lot_no = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, itemCode);
pstmt.setString(2, lotNoFrom);
rs = pstmt.executeQuery();
if (rs.next()) {
effData = rs.getTimestamp("mfg_date");
}
close(pstmt, rs);
BaseLogger.log("3", null, null, "lot_no__from >>>> eff_from ["+effData+"]");
if(effData != null)
{
valueXmlString.append("<eff_from><![CDATA[" + sdf.format(effData) + "]]></eff_from>");
}else
{
valueXmlString.append("<eff_from><![CDATA[]]></eff_from>");
}
}
}
if (currentColumn.equalsIgnoreCase("lot_no__to"))
{
lotNoTo = genericUtility.getColumnValue("lot_no__to", dom);
itemCode = genericUtility.getColumnValue("item_code", dom);
BaseLogger.log("3", null, null, "lot_no__to ["+lotNoTo+"] itemCode ["+itemCode+"]");
if(!("z".equalsIgnoreCase(lotNoFrom) || "zz".equalsIgnoreCase(lotNoFrom) || "Z".equalsIgnoreCase(lotNoFrom) || "ZZ".equalsIgnoreCase(lotNoFrom)))
{
sql = "select exp_date from item_lot_info where item_code = ? and lot_no = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, itemCode);
pstmt.setString(2, lotNoTo);
rs = pstmt.executeQuery();
if (rs.next()) {
validUpto = rs.getTimestamp("exp_date");
}
close(pstmt, rs);
BaseLogger.log("3", null, null, "lot_no__from >>>> valid_upto ["+validUpto+"]");
if(validUpto != null)
{
valueXmlString.append("<valid_upto><![CDATA[" + sdf.format(validUpto) + "]]></valid_upto>");
}else
{
valueXmlString.append("<valid_upto><![CDATA[]]></valid_upto>");
}
}
}/*Pavan R 4feb19 end*/
valueXmlString.append("</Detail2>\r\n"); valueXmlString.append("</Detail2>\r\n");
System.out.println(":::::generated xml"+ valueXmlString.toString()); System.out.println(":::::generated xml"+ valueXmlString.toString());
...@@ -687,4 +757,5 @@ public class PriceListTranIC extends ValidatorEJB implements ...@@ -687,4 +757,5 @@ public class PriceListTranIC extends ValidatorEJB implements
System.out.println("ValueXmlString:::::" + valueXmlString.toString()); System.out.println("ValueXmlString:::::" + valueXmlString.toString());
return valueXmlString.toString(); return valueXmlString.toString();
} }
} }
\ 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