Commit 948aea72 authored by smane's avatar smane

Generate hold inventory for 'QUARNTINE_LOCKCODE' when create QC order (M14GSUN001)


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@96563 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 24f33724
......@@ -924,7 +924,7 @@ public class RcpBackflushConfirm extends ActionHandlerEJB implements RcpBackflus
}
private String createQCOrder(String tranID,String lsLotNo,java.sql.Timestamp ldtExpirydate,String xtraParams,Connection conn)
{
{
System.out.println("------in createQCOrder method-----------");
PreparedStatement pstmt=null;
ResultSet rs=null;
......@@ -932,8 +932,11 @@ public class RcpBackflushConfirm extends ActionHandlerEJB implements RcpBackflus
String lsBatchno="",lsLotsl="",lsUnit="",lsLoccode="", lsKeystr="",lsAprv="",lsRej="",lsSuppCodeMfg="";
String lsBackflushType="",lsQorderType="", lsItemser="", lsSiteser="",asLotno="",lsTrackShelfLife="";
String lsSuppCode="",lsItemCodeDet="",lsLotnoDet="",lsLocCodedet="",lsLotslDet="",lsRouteCode="",currDate="";
String remarks="",invTranId="",lockCode="";
double lcQty=0,llSelectedrow=0;
int llQcLeadTime=0,llCount=0;
int insInvCnt=0,lineNoInv=0,insInvDetCnt=0;
DistCommon distCommon= new DistCommon();
java.sql.Timestamp ldtMfgdate=null,ldtMfgdt=null;
java.sql.Timestamp ldtRetestdt=null; java.util.Date ldtQcduedate=null;
GenericUtility genericUtility = null;
......@@ -1375,7 +1378,57 @@ public class RcpBackflushConfirm extends ActionHandlerEJB implements RcpBackflus
pstmt.setString(36,lsSuppCodeMfg);
int insCount=pstmt.executeUpdate();
System.out.println("Insert count for Qc order------>>["+insCount+"]");
System.out.println("Insert count for Qc order------>>["+insCount+"]");
pstmt.close();
pstmt=null;
//Added by Sagar on 06/10/14 Start...
lockCode= distCommon.getDisparams("999999", "QUARNTINE_LOCKCODE", conn);
System.out.println(">>>>> getDisparams lockCode:"+lockCode);
if(insCount > 0 && lockCode!=null && lockCode.trim().length() > 0 )
{
invTranId = generateTranId( "w_inv_hold", lsSitecode, conn );
System.out.println(">>>>Generate invTranId:"+invTranId);
sql = "insert into inv_hold (tran_id, tran_date, site_code, remarks, confirmed, chg_date, chg_user, chg_term, lock_code) "
+ " values (?,?,?,?,?,?,?,?,?) " ;
remarks = "Auto generated from Receipt Backflush Confirmation";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, invTranId);
pstmt.setTimestamp(2,new Timestamp(System.currentTimeMillis()));
pstmt.setString(3, lsSitecode);
pstmt.setString(4, remarks);
pstmt.setString(5, "N");
pstmt.setTimestamp(6, new Timestamp(System.currentTimeMillis()));
pstmt.setString(7, "SYSTEM");
pstmt.setString(8, "SYSTEM");
pstmt.setString(9, lockCode);
insInvCnt = pstmt.executeUpdate();
pstmt.close();
pstmt = null;
System.out.println(">>>>>>>>Record inserted in inv_hold:"+insInvCnt);
if(insInvCnt > 0)
{
lineNoInv++;
System.out.println(">>>>>>>>>Inv hold det lineNoInv:"+lineNoInv);
sql = "insert into inv_hold_det (tran_id, line_no, item_code, site_code,loc_code, lot_no, lot_sl, remarks, hold_status) "
+ " values (?,?,?,?,?,?,?,?,?) ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, invTranId);
pstmt.setInt(2, lineNoInv);
pstmt.setString(3, lsItemcode);
pstmt.setString(4, lsSitecode);
pstmt.setString(5, lsLoccode);
pstmt.setString(6, asLotno);
pstmt.setString(7, lsLotsl);
pstmt.setString(8, remarks);
pstmt.setString(9, "H");
insInvDetCnt = pstmt.executeUpdate();
pstmt.close();
pstmt = null;
}
}
//Added by Sagar on 06/10/14 End...
} //end try
catch(Exception e)
......@@ -2079,6 +2132,90 @@ public class RcpBackflushConfirm extends ActionHandlerEJB implements RcpBackflus
return errorCode;
}
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);
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 int getDBRowCount(Connection conn, String table_name, String whrCondCol, String whrCondVal)
{
......
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