Commit e09717df authored by msingh's avatar msingh

Change by Manish on 19/01/17 for Supplier Shipment Wizard.


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@104424 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 5843c05b
......@@ -1960,7 +1960,9 @@ public class AsnConf extends ActionHandlerEJB implements AsnConfLocal, AsnConfRe
//Changed by Rohan on 11-07-13 for generate erraor with asn no,line no and item code.start
private String getError(String tranID,String lineNo,String itemCode,String Code,Connection conn) throws ITMException, Exception
{
String mainStr ="";
String mainStr ="", sql = "", descr = "";
PreparedStatement pstmt = null;
ResultSet rs = null ;
try
{
......@@ -1969,7 +1971,20 @@ public class AsnConf extends ActionHandlerEJB implements AsnConfLocal, AsnConfRe
String begPart = errString.substring(0,errString.indexOf("<message>")+9);
String endDesc = errString.substring(errString.indexOf("</description>"));
mainStr= begPart+"Invalid Data "+"</message><description>";
mainStr= mainStr+"Tran ID: ["+tranID+"] Line No: ["+lineNo+"] Item Code: ["+itemCode+"]" +endDesc;
//mainStr= mainStr+"Tran ID: ["+tranID+"] Line No: ["+lineNo+"] Item Code: ["+itemCode+"]" +endDesc;
sql = "select msg_descr from messages where msg_no = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, Code);
rs = pstmt.executeQuery();
if( rs.next())
{
descr = rs.getString("msg_descr");
}
rs.close(); rs = null;
pstmt.close(); pstmt = null;
mainStr= mainStr+descr+" for Tran ID: ["+tranID+"] for Line No: ["+lineNo+"] and Item Code: ["+itemCode+"]" +endDesc;
System.out.println("mainStr:::::::::::::::::: "+mainStr);
begPart = null;
}
......
......@@ -83,7 +83,7 @@ public class PackLabelWizPosEJB extends ValidatorEJB implements PackLabelWizPosE
PreparedStatement pstmt = null, pstmtUpdate = null;
ResultSet rs = null;
String retString = "",userInfo = "";
String retString = "",userInfo = "",sql = "", keyStr = "";
SimpleDateFormat simpleDateFormat = null;
String currDate = "";
......@@ -102,10 +102,28 @@ public class PackLabelWizPosEJB extends ValidatorEJB implements PackLabelWizPosE
dom = genericUtility.parseString(xmlstring);
currDate = getCurrdateAppFormat();
asnNo = "ASN" + GetRandomNumber();
sql = "select key_string FROM transetup where tran_window = 'w_asn'";
pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery();
if (rs.next())
{
keyStr = rs.getString("key_string");
}
if(rs != null)
{
rs.close();rs = null;
}
if(pstmt != null)
{
pstmt.close();pstmt = null;
}
//asnNo = "ASN" + GetRandomNumber();
userId = genericUtility.getValueFromXTRA_PARAMS( xtraParams, "loginCode" );
//loginSiteCode = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginSiteCode");
loginSiteCode = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginSiteCode");
Node detail1Node = dom.getElementsByTagName("Detail1").item(0);
NodeList detail1List = detail1Node.getChildNodes();
int detail1ListLen = detail1List.getLength();
......@@ -148,6 +166,8 @@ public class PackLabelWizPosEJB extends ValidatorEJB implements PackLabelWizPosE
}
}
System.out.println("site_code is ===["+siteCode+"]");
asnNo = generateTranId("w_asn",loginSiteCode,siteCode,conn );
StringBuffer xmlString = new StringBuffer();
StringBuffer xmlStringHdr= new StringBuffer("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
xmlStringHdr.append("<DocumentRoot><description>Datawindow Root</description><group0><description>Group0 escription</description>");
......@@ -313,7 +333,7 @@ public class PackLabelWizPosEJB extends ValidatorEJB implements PackLabelWizPosE
else
{
System.out.println("Error while creating ASN");
throw new Exception(retString);
//throw new Exception(retString);
}
}
catch(Exception e)
......@@ -1430,5 +1450,85 @@ public class PackLabelWizPosEJB extends ValidatorEJB implements PackLabelWizPosE
}
return details.toString();
}
//
private String generateTranId( String windowName,String siteCode,String siteCodeLog, Connection conn )throws ITMException
{
PreparedStatement pstmt = null;
ResultSet rs = null;
String selSql = "";
String tranId = "";
String tranSer = "";
String keyString = "";
String keyCol = "";
String xmlValues = "";
java.sql.Timestamp currDate = null;
ibase.utility.E12GenericUtility genericUtility= new ibase.utility.E12GenericUtility();
try
{
SimpleDateFormat sdfAppl = new SimpleDateFormat(genericUtility.getApplDateFormat());
currDate = new java.sql.Timestamp(System.currentTimeMillis());
String currDateStr = sdfAppl.format(currDate);
selSql = "SELECT KEY_STRING, TRAN_ID_COL, REF_SER FROM TRANSETUP WHERE TRAN_WINDOW = ? ";
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 + "<site_code__log>" + siteCodeLog + "</site_code__log>";
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){}
}
System.out.println("@@@@@@@@@@@@@@@@@@@@@@tranId[[[[[[[[[[["+tranId+"]]]]]]]]]]]]]]]");
return tranId;
}
}
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