Commit 3c91c811 authored by caluka's avatar caluka

Update the rev__tran flag if pricelist is generated for all Item code.[Sended by vallabh]


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@99458 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 6f40dab8
...@@ -74,8 +74,7 @@ public class PlistGenFrmDistIssueSch implements Schedule ...@@ -74,8 +74,7 @@ public class PlistGenFrmDistIssueSch implements Schedule
System.out.println("xtraParams---["+xtraParams+"]"); System.out.println("xtraParams---["+xtraParams+"]");
GenericUtility genericUtility=GenericUtility.getInstance(); GenericUtility genericUtility=GenericUtility.getInstance();
System.out.println("scheduleParamXML-----"+scheduleParamXML); System.out.println("scheduleParamXML-----"+scheduleParamXML);
priceListConfirm(xtraParams); priceListConfirm(xtraParams);
} }
catch (Exception e) catch (Exception e)
...@@ -249,10 +248,12 @@ public class PlistGenFrmDistIssueSch implements Schedule ...@@ -249,10 +248,12 @@ public class PlistGenFrmDistIssueSch implements Schedule
DistCommon distCommon=null; DistCommon distCommon=null;
String revTran="N"; String revTran="N";
int countRec=0; int countRec=0;
String revTranStr="";
try try
{ {
distCommon=new DistCommon(); distCommon=new DistCommon();
conn = connDriver.getConnectDB("DriverITM"); conn = connDriver.getConnectDB("DriverITM");
conn.setAutoCommit(false);
connDriver = null; connDriver = null;
validUpto=checkNull(distCommon.getDisparams("999999","VALIDUPTO_DT", conn)); validUpto=checkNull(distCommon.getDisparams("999999","VALIDUPTO_DT", conn));
exclSeries=checkNull(distCommon.getDisparams("999999","EXCL_SER_PLIST", conn)); exclSeries=checkNull(distCommon.getDisparams("999999","EXCL_SER_PLIST", conn));
...@@ -312,43 +313,67 @@ public class PlistGenFrmDistIssueSch implements Schedule ...@@ -312,43 +313,67 @@ public class PlistGenFrmDistIssueSch implements Schedule
sql="select tran_id,tran_type,site_code__dlv,site_code," + /* sql="select tran_id,tran_type,site_code__dlv,site_code," +
"case when rev__tran is null then 'N' ELSE rev__tran END as rev__tran from distord_iss where confirmed='Y' and tran_type in ('TE','TB') " + "case when rev__tran is null then 'N' ELSE rev__tran END as rev__tran from distord_iss where confirmed='Y' and tran_type in ('TE','TB') " +
"and case when rev__tran is null then 'N' ELSE rev__tran END <>'Y' for update nowait "; "and case when rev__tran is null then 'N' ELSE rev__tran END <>'Y' ";*/
ArrayList<String> tranIdList=new ArrayList<String>();
sql="select tran_id from distord_iss where confirmed='Y' and tran_type in ('TE','TB') " +
"and case when rev__tran is null then 'N' ELSE rev__tran END <>'Y' ";
pstmt=conn.prepareStatement(sql); pstmt=conn.prepareStatement(sql);
rs=pstmt.executeQuery(); rs=pstmt.executeQuery();
while(rs.next()) while(rs.next())
{ {
lineNo=0; tranIdList.add(rs.getString(1));
tranId=rs.getString("tran_id");
tranType=rs.getString("tran_type");
siteCodedlv=rs.getString("site_code__dlv");
siteCode=rs.getString("site_code");
revTran=rs.getString("rev__tran");
fos1.write(("Dist order trn id is:: [" + tranId +"]\r\n").getBytes());
/**
* Insert in to price list header
* */
pstmt1=conn.prepareStatement("select count(1) from distord_iss where tran_id=? and case when rev__tran is null then 'N' ELSE rev__tran END <>'Y' ");
pstmt1.setString(1, tranId);
rs1=pstmt1.executeQuery();
if(rs1.next())
{
countRec=rs1.getInt(1);
}
rs1.close();
rs1=null;
pstmt1.close();
pstmt1=null;
if(countRec>0)
{
priceListId=inserPriceListHdr(tranId,tranType,userId,siteCode,termId,empCode,sysDate,conn,xtraParams,siteCodedlv);
}
} }
rs.close(); rs.close();
rs=null; rs=null;
pstmt.close(); pstmt.close();
pstmt=null; pstmt=null;
System.out.println("tranIdList["+tranIdList+"]");
if(tranIdList.size()>0)
{
for(int k=0;k<tranIdList.size();k++)
{
tranId=tranIdList.get(k);
pstmt1=conn.prepareStatement("select tran_id from distord_iss where tran_id=? for update nowait ");
pstmt1.setString(1, tranId);
rs1=pstmt1.executeQuery();
if(rs1.next())
{
tranId=rs1.getString(1);
}
rs1.close();
rs1=null;
pstmt1.close();
pstmt1=null;
pstmt2=conn.prepareStatement("select tran_id,tran_type,site_code__dlv,site_code,case when rev__tran is null then 'N' ELSE rev__tran END as rev__tran from distord_iss where tran_id=? ");
pstmt2.setString(1, tranId);
rs2=pstmt2.executeQuery();
if(rs2.next())
{
tranType=rs2.getString("tran_type");
siteCodedlv=rs2.getString("site_code__dlv");
siteCode=rs2.getString("site_code");
revTran=rs2.getString("rev__tran");
if("N".equalsIgnoreCase(revTran))
{
priceListId=inserPriceListHdr(tranId,tranType,userId,siteCode,termId,empCode,sysDate,conn,xtraParams,siteCodedlv);
}
}
rs2.close();
rs2=null;
pstmt2.close();
pstmt2=null;
}
}
}catch(Exception e) }catch(Exception e)
{ {
e.printStackTrace(); e.printStackTrace();
...@@ -383,15 +408,15 @@ public class PlistGenFrmDistIssueSch implements Schedule ...@@ -383,15 +408,15 @@ public class PlistGenFrmDistIssueSch implements Schedule
if(conn!=null) if(conn!=null)
{ {
try { try {
conn.commit();
conn.close(); conn.close();
conn=null;
} catch (SQLException e) { } catch (SQLException e) {
// TODO Auto-generated catch block // TODO Auto-generated catch block
e.printStackTrace(); e.printStackTrace();
} }
} }
rs=null;
pstmt=null;
conn=null;
} }
} }
private int insertGenCodes(String itemCode, String lotNo, String loginSite, private int insertGenCodes(String itemCode, String lotNo, String loginSite,
...@@ -527,9 +552,10 @@ public class PlistGenFrmDistIssueSch implements Schedule ...@@ -527,9 +552,10 @@ public class PlistGenFrmDistIssueSch implements Schedule
pstmt5=null; pstmt5=null;
rs3.close(); rs3.close();
rs3=null; rs3=null;
System.out.println("exclitemSerCount :- ["+exclitemSerCount+"] for tran id :- ["+tranId+"]");
if(reccount>exclitemSerCount) if(reccount>exclitemSerCount)
{ {
System.out.println("Tran id for header insertion :- ["+tranId+"]");
/** /**
* Generate tran id (prcLstId) * Generate tran id (prcLstId)
* for pricelist_hdr * for pricelist_hdr
...@@ -723,7 +749,7 @@ public class PlistGenFrmDistIssueSch implements Schedule ...@@ -723,7 +749,7 @@ public class PlistGenFrmDistIssueSch implements Schedule
/** /**
* Confirm the price list * Confirm the price list
* */ * */
if(rowinserted>0) if(rowinserted > 0 || existCount > 0)
{ {
sql3="update distord_iss set rev__tran='Y', parent__tran_id=? where tran_id=?"; sql3="update distord_iss set rev__tran='Y', parent__tran_id=? where tran_id=?";
......
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