Commit 03c2aab9 authored by prane's avatar prane

to set mfg_date, exp_date from item_lot_info as per same logic from salesReturn in SRF

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@203886 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 470c967a
......@@ -1075,7 +1075,7 @@ public class SReturnForm extends ValidatorEJB implements SReturnFormLocal, SRetu
ctr = 0;
//-------------------------Nandkumar Gadkari on 30/10/18-Start -----------------to protect cust code
reStr = itemChanged(dom1, dom1, dom2, "1","itm_defaultedit", editFlag, xtraParams);
System.out.println("CurrentColumn:["+currentColumn+"]");
reStr=reStr.substring(reStr.indexOf("<Detail1>"), reStr.indexOf("</Detail1>"));
System.out.println("Detail 1String"+reStr);
valueXmlString = new StringBuffer(
......@@ -3894,6 +3894,11 @@ public class SReturnForm extends ValidatorEJB implements SReturnFormLocal, SRetu
//Changed by Nandkumar Gadkari on 23/10/2018 to not to set rate if already set from min_rate_history [End]
//valueXmlString = minRateBuff;
//Pavan Rane 22Jul19[to set mfg_date from item_lot_info as per same logic from salesReturn]
valueXmlString = (gbfIcExpMfgDate(valueXmlString, dom, dom1, dom2, editFlag, xtraParams, objContext,
conn));
//Pavan Rane 22Jul19 end
reStr = itemChanged(dom, dom1, dom2, objContext, "lot_sl", editFlag, xtraParams);
pos = reStr.indexOf("<Detail2>");
reStr = reStr.substring(pos + 9);
......@@ -3904,6 +3909,9 @@ public class SReturnForm extends ValidatorEJB implements SReturnFormLocal, SRetu
}//end of lot_no
else if (currentColumn.trim().equals("lot_sl") )
{
//Pavan Rane 22Jul19[to set mfg_date from item_lot_info as per same logic from salesReturn]
valueXmlString = (gbfIcExpMfgDate(valueXmlString, dom, dom1, dom2, editFlag, xtraParams, objContext,conn));
//Pavan Rane 22Jul19 end
siteCode = genericUtility.getColumnValue("site_code", dom1);
itemCode = genericUtility.getColumnValue("item_code", dom);
locCode = genericUtility.getColumnValue("loc_code", dom);
......@@ -4005,23 +4013,25 @@ public class SReturnForm extends ValidatorEJB implements SReturnFormLocal, SRetu
pstmt.close();
pstmt = null;
rs = null;
System.out.println("4008 cnt...["+cnt+"]");
if (cnt == 0 )
{
valueXmlString.append("<exp_date protect =\"0\">").append("<![CDATA[" + ( expDate != null ? new SimpleDateFormat(genericUtility.getApplDateFormat()).format(expDate).toString() : "" ) + "]]>").append("</exp_date>");
//valueXmlString.append("<exp_date protect =\"0\">").append("<![CDATA[" + ( expDate != null ? new SimpleDateFormat(genericUtility.getApplDateFormat()).format(expDate).toString() : "" ) + "]]>").append("</exp_date>");
valueXmlString.append("<pack_code protect =\"0\">").append("<![CDATA[" + packCode + "]]>").append("</pack_code>");
valueXmlString.append("<site_code__mfg protect =\"0\">").append("<![CDATA[" + siteCodeMfg + "]]>").append("</site_code__mfg>");
}
else
{
valueXmlString.append("<mfg_date protect =\"1\">").append("<![CDATA[" + ( mfgDate != null ? new SimpleDateFormat(genericUtility.getApplDateFormat()).format(mfgDate).toString() : "" ) + "]]>").append("</mfg_date>");
valueXmlString.append("<exp_date protect =\"1\">").append("<![CDATA[" + ( expDate != null ? new SimpleDateFormat(genericUtility.getApplDateFormat()).format(expDate).toString() : "" ) + "]]>").append("</exp_date>");
//Pavan Rane 22Jul19[to set mfg_date from item_lot_info as per same logic from salesReturn]
//valueXmlString.append("<mfg_date protect =\"1\">").append("<![CDATA[" + ( mfgDate != null ? new SimpleDateFormat(genericUtility.getApplDateFormat()).format(mfgDate).toString() : "" ) + "]]>").append("</mfg_date>");
//valueXmlString.append("<exp_date protect =\"1\">").append("<![CDATA[" + ( expDate != null ? new SimpleDateFormat(genericUtility.getApplDateFormat()).format(expDate).toString() : "" ) + "]]>").append("</exp_date>");
valueXmlString.append("<pack_code protect =\"1\">").append("<![CDATA[" + packCode + "]]>").append("</pack_code>");
valueXmlString.append("<site_code__mfg protect =\"1\">").append("<![CDATA[" + siteCodeMfg + "]]>").append("</site_code__mfg>");
}
mtranDateStr = genericUtility.getColumnValue( "tran_date", dom );
mtranDate = Timestamp.valueOf(genericUtility.getValidDateString( ( mtranDateStr == null ? getCurrdateInAppFormat() : mtranDateStr ), genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00.0");
String mexpDateStr = genericUtility.getColumnValue( "exp_date", dom );
System.out.println( "mexpDateStr :: " + mexpDateStr );
System.out.println( "SRFmexpDateStr :: " + mexpDateStr );
// 20/05/10 manoharan commented as expiry date is already fetched from stock
//if( mexpDateStr != null )
//{
......@@ -9711,5 +9721,67 @@ public class SReturnForm extends ValidatorEJB implements SReturnFormLocal, SRetu
}
//added by Nandkumar Gadkari on 23/10/18-------------------end--------------------------
//Pavan Rane 22Jul19[to set mfg_date from item_lot_info as per same logic from salesReturn]
private StringBuffer gbfIcExpMfgDate(StringBuffer valueXmlString, Document dom, Document dom1, Document dom2,
String editFlag, String xtraParams, String objContext, Connection conn) {
// TODO Auto-generated method stub
String siteCode = "", itemCode = "",lotNo= "", lotSl= "", sql= "";
PreparedStatement pstmt = null;
Timestamp mfgDate=null,expDate=null;
ResultSet rs = null;
int cntItemLotInfo = 0;
try {
siteCode = genericUtility.getColumnValue("site_code", dom1);
itemCode = genericUtility.getColumnValue("item_code", dom);
lotNo = genericUtility.getColumnValue("lot_no", dom);
lotSl = genericUtility.getColumnValue("lot_sl", dom);
if (lotSl == null || lotSl.equals("null"))
{
lotSl = " ";
}
sql = "select mfg_date, exp_date "
+ " from item_lot_info "
+ " where item_code = ? "
+ " and lot_no = ? ";
cntItemLotInfo=0;
pstmt= conn.prepareStatement( sql );
pstmt.setString( 1, itemCode);
pstmt.setString( 2, lotNo);
rs = pstmt.executeQuery();
if( rs.next() )
{
cntItemLotInfo++;
mfgDate = rs.getTimestamp(1);
expDate = rs.getTimestamp(2);
}
rs.close();
pstmt.close();
pstmt = null;
rs = null;
if(expDate != null)
{
valueXmlString.append("<exp_date protect =\"1\">").append("<![CDATA[" + new SimpleDateFormat(genericUtility.getApplDateFormat()).format(expDate).toString() + "]]>").append("</exp_date>");
}
else
{
valueXmlString.append("<exp_date protect =\"0\">").append("<![CDATA[]]>").append("</exp_date>");
}
valueXmlString.append("<mfg_date protect =\"1\">").append("<![CDATA[" + ( mfgDate != null ? new SimpleDateFormat(genericUtility.getApplDateFormat()).format(mfgDate).toString() : "" ) + "]]>").append("</mfg_date>"); //protected by nandkumar gadkari on 29/01/19
}catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return valueXmlString;
}
//Pavan Rane 22Jul19 end
}
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