Commit cd7dce2c authored by mmhatre's avatar mmhatre

Purchase order protect when item code!=null and exp and mfg date auto set by...

Purchase order protect when item code!=null and  exp and mfg date auto set by item code and lot number

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@205818 ce508802-f39f-4f6c-b175-0d175dae99d5
parent ba39f818
......@@ -2516,9 +2516,10 @@ public class AdjReceiptIC extends ValidatorEJB implements AdjReceiptICRemote,Adj
String convQtyStdm="",cctr="",acct="";
String accCodeInv="",cctrCodeInv="",grossRate="",grade="",dimension="",noArt="",unitAlt="",potencyPerc="";
String tranDate="",unit="",itemSer="",acctCodeCr="",acctCodeAr="",cctrCodeAr="";
String ldtmfgdate1="",ldtexpirydate1="",ldtretestdate1=""; //added by manish on 22-aug-2019
int cnt = 0,stock=0;
double rate=0.0;
Timestamp mfgDate=null,expDate=null;
Timestamp mfgDate=null,expDate=null,retestDate=null; //added by manish on 22-aug-2019
FinCommon finCommon=new FinCommon();
DistCommon distCommon=new DistCommon();
......@@ -2536,6 +2537,45 @@ public class AdjReceiptIC extends ValidatorEJB implements AdjReceiptICRemote,Adj
System.out.println("tranType>>>>"+tranType);
if(lotSl==null || lotSl.trim().length()==0)
{
//added by manish mhatre on 22-aug-2019 [For Expiry and mfg date pick up in item_lot_info table]
//start manish
sql="select mfg_date, exp_date, retest_date from item_lot_info where item_code = ? and lot_no = ? ";
pstmt1 = conn.prepareStatement(sql);
pstmt1.setString(1, itemCode);
pstmt1.setString(2, lotNo);
rs1 = pstmt1.executeQuery();
if (rs1.next())
{
mfgDate = rs1.getTimestamp(1);
expDate =rs1.getTimestamp(2);
retestDate = rs1.getTimestamp(3);
if( mfgDate != null ){
ldtmfgdate1 = sdf.format(mfgDate);
System.out.println("ldtmfgdate1"+ldtmfgdate1);
valueXmlString.append("<mfg_date protect =\"1\">").append("<![CDATA[" + ldtmfgdate1 + "]]>").append("</mfg_date>");
}
if(expDate != null)
{
ldtexpirydate1=sdf.format(expDate);
System.out.println("ldtexpirydate1"+ldtexpirydate1);
valueXmlString.append("<exp_date protect =\"1\">").append("<![CDATA[" + ldtexpirydate1 + "]]>").append("</exp_date>");
}
if(retestDate != null)
{
ldtretestdate1=sdf.format(retestDate);
System.out.println("ldtretestdate1"+ldtretestdate1);
valueXmlString.append("<retest_date protect =\"1\">").append("<![CDATA[" + ldtretestdate1 + "]]>").append("</retest_date>");
}
} //end manish
else
{
rs1.close();
rs1 = null;
pstmt1.close();
pstmt1 = null;
sql="SELECT ACCT_CODE__INV, CCTR_CODE__INV, RATE,GROSS_RATE ,GRADE,DIMENSION,NO_ART," +
"UNIT__ALT,CONV__QTY_STDUOM,POTENCY_PERC,MFG_DATE,EXP_DATE,SITE_CODE__MFG,PACK_CODE " +
"FROM STOCK where item_code = ? and site_code = ? AND LOC_CODE = ? and lot_no = ? ";
......@@ -2648,10 +2688,16 @@ public class AdjReceiptIC extends ValidatorEJB implements AdjReceiptICRemote,Adj
stock=0;*/
//Commented part by sarita as the code will execute if(cnt ==0) on 03 SEPT 2018 [END]
}
if(rs1 != null )
{
rs1.close();
rs1 = null;
}
if(pstmt1!=null)
{
pstmt1.close();
pstmt1=null;
}
System.out.println("cnt@@@@@@@@@1"+cnt);
......@@ -2843,8 +2889,48 @@ public class AdjReceiptIC extends ValidatorEJB implements AdjReceiptICRemote,Adj
//Added by sarita to store acct_code__cr and cctr_code__cr values in dom on 03 SEP 2018 [START]
}
}
}
else
{
//added by manish mhatre on 22-aug-2019 [For Expiry and mfg date pick up in item_lot_info table]
//start manish
sql="select mfg_date, exp_date, retest_date from item_lot_info where item_code = ? and lot_no = ? ";
pstmt1 = conn.prepareStatement(sql);
pstmt1.setString(1, itemCode);
pstmt1.setString(2, lotNo);
rs1 = pstmt1.executeQuery();
if (rs1.next())
{
mfgDate = rs1.getTimestamp(1);
expDate =rs1.getTimestamp(2);
retestDate = rs1.getTimestamp(3);
if( mfgDate != null ){
ldtmfgdate1 = sdf.format(mfgDate);
System.out.println("ldtmfgdate1"+ldtmfgdate1);
valueXmlString.append("<mfg_date protect =\"1\">").append("<![CDATA[" + ldtmfgdate1 + "]]>").append("</mfg_date>");
}
if(expDate != null)
{
ldtexpirydate1=sdf.format(expDate);
System.out.println("ldtexpirydate1"+ldtexpirydate1);
valueXmlString.append("<exp_date protect =\"1\">").append("<![CDATA[" + ldtexpirydate1 + "]]>").append("</exp_date>");
}
if(retestDate != null)
{
ldtretestdate1=sdf.format(retestDate);
System.out.println("ldtretestdate1"+ldtretestdate1);
valueXmlString.append("<retest_date protect =\"1\">").append("<![CDATA[" + ldtretestdate1 + "]]>").append("</retest_date>");
}
} //end manish
else
{
rs1.close();
rs1 = null;
pstmt1.close();
pstmt1 = null;
sql="SELECT ACCT_CODE__INV,CCTR_CODE__INV,RATE,GROSS_RATE,GRADE,DIMENSION,NO_ART,UNIT__ALT,CONV__QTY_STDUOM," +
"POTENCY_PERC,MFG_DATE,EXP_DATE,SITE_CODE__MFG,PACK_CODE FROM STOCK " +
"WHERE ITEM_CODE = ? AND SITE_CODE = ? AND LOC_CODE = ? AND LOT_NO = ? AND LOT_SL = ? ";
......@@ -2945,10 +3031,16 @@ public class AdjReceiptIC extends ValidatorEJB implements AdjReceiptICRemote,Adj
stock=0;*/
//Commented part by sarita as the code will execute if(cnt ==0) on 03 SEPT 2018 [END]
}
if(rs1 != null )
{
rs1.close();
rs1 = null;
}
if(pstmt1!=null)
{
pstmt1.close();
pstmt1=null;
}
System.out.println("cnt@@@@@@@@@2"+cnt);
//Added above commented code for cnt is 0 on 03 SEP 2018 [START]
......@@ -3272,6 +3364,7 @@ public class AdjReceiptIC extends ValidatorEJB implements AdjReceiptICRemote,Adj
//Commented and added by sarita to set acct_code__dr & cctr_code__dr values using dom on 03 SEP 2018 [END]
}
}
}
catch (Exception e)
{
e.printStackTrace();
......
......@@ -4276,7 +4276,9 @@ public class PoReceiptIc extends ValidatorEJB implements PoReceiptIcLocal,PoRec
today = cal.getTime();
sdf=new SimpleDateFormat(genericUtility.getApplDateFormat());
String sysDate=sdf.format(today);
System.out.println("\nInside header..dom.."+genericUtility.serializeDom(dom));
System.out.println("\nInside header..dom1.."+genericUtility.serializeDom(dom1));
System.out.println("\nInside header..dom2.."+genericUtility.serializeDom(dom2));
if(objContext != null && objContext.trim().length()>0)
{
currentFormNo = Integer.parseInt(objContext);
......@@ -4432,13 +4434,37 @@ public class PoReceiptIc extends ValidatorEJB implements PoReceiptIcLocal,PoRec
lspurcorder= genericUtility.getColumnValue("purc_order", dom);
//Commented and Added by sarita to set add proj_code and set to header on 29 MARCH 2019 [START]
projectCode = genericUtility.getColumnValue("proj_code", dom);
//added by manish mhatre on 20-aug-2019 [For purchase order protect when count=0]
//start manish
lstranid = genericUtility.getColumnValue("tran_id", dom);
sql = "select count(*) as CNT from porcpdet where tran_id = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, lstranid);
rs = pstmt.executeQuery();
if (rs.next()) {
cnt = rs.getInt("CNT");
}
pstmt.close();
pstmt = null;
rs.close();
rs = null;
//end manish
//Commented and Added by sarita to set add proj_code and set to header on 29 MARCH 2019 [END]
valueXmlString.append("<supp_code protect =\"1\">").append("<![CDATA["+suppCode+"]]>").append("</supp_code>");
valueXmlString.append("<qc_reqd protect =\"1\">").append("<![CDATA["+lsqcreqd+"]]>").append("</qc_reqd>");
valueXmlString.append("<exch_rate protect =\"1\">").append("<![CDATA["+exchRate+"]]>").append("</exch_rate>");
valueXmlString.append("<exch_rate__frt protect =\"1\">").append("<![CDATA["+exchRateFrt+"]]>").append("</exch_rate__frt>");
//added by manish mhatre on 20-aug-2019 [For purchase order protect when count>0]
//start manish
if( cnt > 0)
{
valueXmlString.append("<purc_order protect =\"1\">").append("<![CDATA["+lspurcorder+"]]>").append("</purc_order>");
}else {
valueXmlString.append("<purc_order protect =\"0\">").append("<![CDATA["+lspurcorder+"]]>").append("</purc_order>");
}
//end manish
//Commented and Added by sarita to set add proj_code and set to header on 29 MARCH 2019 [START]
valueXmlString.append("<proj_code>").append("<![CDATA["+projectCode+"]]>").append("</proj_code>");
//Commented and Added by sarita to set add proj_code and set to header on 29 MARCH 2019 [END]
......@@ -6439,6 +6465,7 @@ public class PoReceiptIc extends ValidatorEJB implements PoReceiptIcLocal,PoRec
String projectCode = ""; // Added by sarita on 29 MARCH 2019
String grossWeight="",netWeight="",netWtItem="", netWt="", integrlQty="",lcMode="";
double mGrossWeight=0d, mNetWeight=0d, mGrosswt=0d,mNetWt=0d, mTareWt=0d,mNoart=0d, mNetWtItem=0d, mIntegrlQty=0d;
boolean PoLineItemFlag=false;//added by manish mhatre on 13-aug-2019
try {
......@@ -6457,13 +6484,45 @@ public class PoReceiptIc extends ValidatorEJB implements PoReceiptIcLocal,PoRec
exchrate=genericUtility.getColumnValue("exch_rate", dom1);
exchRateFrt = genericUtility.getColumnValue("exch_rate__frt", dom1);
lspurcorder= genericUtility.getColumnValue("purc_order", dom1);
//added by manish mhatre on 13-aug-2019[For protect purchase order when flag==true]
//start manish
int parentNodeListLengthTemp = 0;
NodeList parentNodeListTemp = null;
Node parentNodeTemp = null;
parentNodeListTemp = dom2.getElementsByTagName("Detail2");
parentNodeListLengthTemp = parentNodeListTemp.getLength();
for (int selectedRow = 0; selectedRow < parentNodeListLengthTemp; selectedRow++)
{
parentNodeTemp = parentNodeListTemp.item(selectedRow);
String lineItemcode = checkNull(genericUtility.getColumnValueFromNode("item_code", parentNodeTemp));
System.out.println("outside lineItemcode>>>>>>>>>>>>>>>"+lineItemcode);
if(lineItemcode != null && lineItemcode.trim().length() > 0)
{
System.out.println("inside if lineItemcode>>>>>>>>>>>>>>>"+lineItemcode);
PoLineItemFlag = true;
}
}
//end manish
valueXmlString.append("<Detail1>");
valueXmlString.append("<supp_code protect =\"1\">").append("<![CDATA["+suppCode+"]]>").append("</supp_code>");
valueXmlString.append("<qc_reqd protect =\"1\">").append("<![CDATA["+lsqcreqd+"]]>").append("</qc_reqd>");
valueXmlString.append("<exch_rate protect =\"1\">").append("<![CDATA["+exchrate+"]]>").append("</exch_rate>");
valueXmlString.append("<exch_rate__frt protect =\"1\">").append("<![CDATA["+exchRateFrt+"]]>").append("</exch_rate__frt>");
// valueXmlString.append("<purc_order protect =\"1\">").append("<![CDATA["+lspurcorder+"]]>").append("</purc_order>"); //commented by manish mhatre on 13-aug-2019
//added by manish mhatre on 13-aug-2019 [For protect purchase order when flag==true]
//start manish
if(PoLineItemFlag==true)
{
System.out.println("Inside if flag");
valueXmlString.append("<purc_order protect =\"1\">").append("<![CDATA["+lspurcorder+"]]>").append("</purc_order>");
}
else
{
System.out.println("Inside else flag");
valueXmlString.append("<purc_order protect=\"0\">").append("<![CDATA["+lspurcorder+"]]>").append("</purc_order>");
}
//end manish
valueXmlString.append("</Detail1>");
......@@ -9562,6 +9621,45 @@ public class PoReceiptIc extends ValidatorEJB implements PoReceiptIcLocal,PoRec
}
}
String ldtmfgdate1="",ldtexpirydate1="",ldtretestdate1="",lspricelistclg="";
//added by manish mhatre on 21-aug-2019 [For Expiry and mfg date pick up in item_lot_info table]
//start manish
sql="select mfg_date, exp_date, retest_date from item_lot_info where item_code = ? and lot_no = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, mitem);
pstmt.setString(2, mlotno);
rs = pstmt.executeQuery();
if (rs.next())
{
mfgDate = rs.getTimestamp(1);
expDate =rs.getTimestamp(2);
retestDate = rs.getTimestamp(3);
if( mfgDate != null ){
ldtmfgdate1 = sdf.format(mfgDate);
System.out.println("ldtmfgdate1"+ldtmfgdate1);
valueXmlString.append("<mfg_date protect =\"1\">").append("<![CDATA[" + ldtmfgdate1 + "]]>").append("</mfg_date>");
}
if(expDate != null)
{
ldtexpirydate1=sdf.format(expDate);
System.out.println("ldtexpirydate1"+ldtexpirydate1);
valueXmlString.append("<expiry_date protect =\"1\">").append("<![CDATA[" + ldtexpirydate1 + "]]>").append("</expiry_date>");
}
if(retestDate != null)
{
ldtretestdate1=sdf.format(retestDate);
System.out.println("ldtexpirydate1"+ldtretestdate1);
valueXmlString.append("<retest_date protect =\"1\">").append("<![CDATA[" + ldtretestdate1 + "]]>").append("</retest_date>");
}
} //end manish
else
{
rs.close();
rs = null;
pstmt.close();
pstmt = null;
sql="select mfg_date,exp_date ,retest_date from stock where item_code = ? and site_code = ? and loc_code = ? and lot_no = ? and lot_sl= ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, mitem);
......@@ -9588,31 +9686,45 @@ public class PoReceiptIc extends ValidatorEJB implements PoReceiptIcLocal,PoRec
{
ldtmfgdate1 = sdf.format(mfgDate);
System.out.println("ldtmfgdate1"+ldtmfgdate1);
}
if(ldtmfgdate1.trim().length() >0)
{
valueXmlString.append("<mfg_date protect =\"1\">").append("<![CDATA[" + ldtmfgdate1 + "]]>").append("</mfg_date>");
}
//if(ldtmfgdate1.trim().length() >0)
//{
//valueXmlString.append("<mfg_date protect =\"1\">").append("<![CDATA[" + ldtmfgdate1 + "]]>").append("</mfg_date>");
//} //commented by manish mhatre on 21-aug-2019
if(expDate != null)
{
ldtexpirydate1=sdf.format(expDate);
System.out.println("ldtexpirydate1"+ldtexpirydate1);
}
if(ldtexpirydate1.trim().length() >0)
{
valueXmlString.append("<expiry_date protect =\"1\">").append("<![CDATA[" + ldtexpirydate1 + "]]>").append("</expiry_date>");
}
//if(ldtexpirydate1.trim().length() >0)
//{
//valueXmlString.append("<expiry_date protect =\"1\">").append("<![CDATA[" + ldtexpirydate1 + "]]>").append("</expiry_date>");
//} //commented by manish mhatre on 21-aug-2019
if(retestDate != null)
{
ldtretestdate1=sdf.format(retestDate);
System.out.println("ldtexpirydate1"+ldtretestdate1);
}
if(ldtretestdate1.trim().length() >0)
{
valueXmlString.append("<retest_date protect =\"1\">").append("<![CDATA[" + ldtretestdate1 + "]]>").append("</retest_date>");
}
//if(ldtretestdate1.trim().length() >0)
//{
//valueXmlString.append("<retest_date protect =\"1\">").append("<![CDATA[" + ldtretestdate1 + "]]>").append("</retest_date>");
//} //commented by manish mhatre on 21-aug-2019
}
if(rs != null) {
rs.close();
rs = null;}
if(pstmt != null) {
pstmt.close();
pstmt = null;
}
lstrantype = genericUtility.getColumnValue( "tran_type", dom1 );
lcrateclg1 = genericUtility.getColumnValue( "rate__clg", dom );
lcrateclg= (lcrateclg1==null || lcrateclg1.trim().length() == 0) ? 0 : Double.parseDouble(lcrateclg1);
......
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