Commit 4a2a6f92 authored by ssarkar's avatar ssarkar

Update by Manoj Sharma on 05/02/13


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@92643 ce508802-f39f-4f6c-b175-0d175dae99d5
parent fc5b0b10
......@@ -229,7 +229,8 @@ public class PhysicalCountSchedule implements Schedule
conn = getConnection();
conn.setAutoCommit(false);
tranId=generateTranId("w_phy_item_scan",conn);
//Added by manoj dtd 05/02/2013 to generate tran id as per keystring
tranId=generateTranId("w_phy_item_scan",loginSiteCode,conn);
queryString="select count(*) from work_calendar where work_date=? and working='Y' ";
pstmt=conn.prepareStatement(queryString);
......@@ -754,8 +755,8 @@ public class PhysicalCountSchedule implements Schedule
{
insertItemProcess="insert into PHYSCANDET (TRAN_ID,LINE_NO,SITE_CODE,ITEM_CODE," +
"LOC_CODE,LOT_NO,LOT_SL,QUANTITY," +
"ANALYSIS_CLASS,PRIORITY_SEQ,CYCLE_CRITERIA,EMP_CODE__USER,UNIT,TRAN_TYPE) " +
"values(?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
"ANALYSIS_CLASS,PRIORITY_SEQ,CYCLE_CRITERIA,EMP_CODE__USER,UNIT) " +
"values(?,?,?,?,?,?,?,?,?,?,?,?,?)";
pstmtInsert = conn.prepareStatement(insertItemProcess);
pstmtInsert.setString(1,tranId);
pstmtInsert.setInt(2,rec);
......@@ -770,7 +771,6 @@ public class PhysicalCountSchedule implements Schedule
pstmtInsert.setString(11,rs.getString("CYCLE_CRITERIA"));
pstmtInsert.setString(12,empCode);
pstmtInsert.setString(13,rs.getString("UNIT"));
pstmtInsert.setString(14,"A");
pstmtInsert.executeUpdate();
pstmtInsert.close();
pstmtInsert=null;
......@@ -901,9 +901,93 @@ public class PhysicalCountSchedule implements Schedule
}
return con;
}
//Added by manoj sharma 29/01/2013 to generate tranid as per keystring
private String generateTranId( String windowName, String siteCode, Connection conn )throws ITMException
{
PreparedStatement pstmt = null;
ResultSet rs = null;
String selSql = "";
String tranId = "";
String tranSer = "";
String keyString = "";
String keyCol = "";
String xmlValues = "";
String paySiteCode = "";
String effectiveDate = "";
java.sql.Timestamp currDate = null;
java.sql.Date effDate = null;
GenericUtility genericUtility = GenericUtility.getInstance();
try
{
SimpleDateFormat sdfAppl = new SimpleDateFormat(genericUtility.getApplDateFormat());
currDate = new java.sql.Timestamp(System.currentTimeMillis());
String currDateStr = sdfAppl.format(currDate);
private String generateTranId( String windowName, Connection conn )throws
selSql = "SELECT KEY_STRING, TRAN_ID_COL, REF_SER FROM TRANSETUP WHERE TRAN_WINDOW = ? ";
//System.out.println("selSql :"+selSql);
pstmt = conn.prepareStatement(selSql);
pstmt.setString( 1, windowName );
rs = pstmt.executeQuery();
if (rs.next())
{
keyString = rs.getString("KEY_STRING");
keyCol = rs.getString("TRAN_ID_COL");
tranSer = rs.getString("REF_SER");
}
rs.close();rs = null;
pstmt.close();pstmt = null;
System.out.println("keyString :"+keyString);
System.out.println("keyCol :"+keyCol);
System.out.println("tranSer :"+tranSer);
xmlValues ="<?xml version=\"1.0\" encoding=\"utf-8\"?><Root>";
xmlValues = xmlValues + "<Header></Header>";
xmlValues = xmlValues + "<Detail1>";
xmlValues = xmlValues + "<tran_id></tran_id>";
xmlValues = xmlValues + "<site_code>" + siteCode + "</site_code>";
xmlValues = xmlValues + "<tran_date>" + currDateStr + "</tran_date>";
xmlValues = xmlValues + "</Detail1></Root>";
System.out.println("xmlValues :["+xmlValues+"]");
TransIDGenerator tg = new TransIDGenerator(xmlValues, "BASE", CommonConstants.DB_NAME);
tranId = tg.generateTranSeqID(tranSer, keyCol, keyString, conn);
System.out.println("tranId :"+tranId);
}
catch (SQLException ex)
{
System.out.println("Exception ::" +selSql+ ex.getMessage() + ":");
ex.printStackTrace();
throw new ITMException(ex);
}
catch (Exception e)
{
System.out.println("Exception ::" + e.getMessage() + ":");
e.printStackTrace();
throw new ITMException(e);
}
finally
{
try
{
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
}
catch(Exception e){}
}
return tranId;
}//generateTranTd()
/*private String generateTranId( String windowName, Connection conn )throws
ITMException
{
PreparedStatement pstmt = null;
......@@ -981,7 +1065,7 @@ public class PhysicalCountSchedule implements Schedule
return tranId;
}//generateTranTd()
*/
/*
public String insertSchedule1() throws RemoteException,ITMException
{
......@@ -1383,11 +1467,10 @@ private int generateDetRec(String empCode,int rec,Connection conn,String tranId,
aitem=arr.get(ctr).get(ctr1);
rec++;
System.out.println("lineNo---"+rec);
System.out.println("Setting tranType Auto ---");
insertItemProcess="insert into PHYSCANDET (TRAN_ID,LINE_NO,SITE_CODE,ITEM_CODE," +
"LOC_CODE,LOT_NO,LOT_SL,QUANTITY," +
"ANALYSIS_CLASS,PRIORITY_SEQ,CYCLE_CRITERIA,EMP_CODE__USER,UNIT,TRAN_TYPE) " +
"values(?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
"ANALYSIS_CLASS,PRIORITY_SEQ,CYCLE_CRITERIA,EMP_CODE__USER,UNIT) " +
"values(?,?,?,?,?,?,?,?,?,?,?,?,?)";
pstmtInsert = conn.prepareStatement(insertItemProcess);
pstmtInsert.setString(1,tranId);
pstmtInsert.setInt(2,rec);
......@@ -1402,7 +1485,6 @@ private int generateDetRec(String empCode,int rec,Connection conn,String tranId,
pstmtInsert.setString(11,aitem.getCycleCriteria());
pstmtInsert.setString(12,empCode);
pstmtInsert.setString(13,aitem.getUnit());
pstmtInsert.setString(14,"A");
pstmtInsert.executeUpdate();
pstmtInsert.close();
pstmtInsert=null;
......
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