Commit 3d96a395 authored by smane's avatar smane

Generate inv_hold when create QC-ORDER in Work Order Issue/Return Confirmation

(M14GSUN003)


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@96590 ce508802-f39f-4f6c-b175-0d175dae99d5
parent bba3fdd0
...@@ -30,8 +30,6 @@ import java.sql.Timestamp; ...@@ -30,8 +30,6 @@ import java.sql.Timestamp;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.text.NumberFormat; import java.text.NumberFormat;
import java.util.Calendar;
import java.util.HashMap;
import java.util.*; import java.util.*;
import java.sql.*; import java.sql.*;
...@@ -1228,6 +1226,12 @@ public class WorkorderIssConf extends ActionHandlerEJB implements WorkorderIssCo ...@@ -1228,6 +1226,12 @@ public class WorkorderIssConf extends ActionHandlerEJB implements WorkorderIssCo
} }
} }
} }
//Added by sagar for test
System.out.println(">>>>>stkOpt:"+stkOpt);
System.out.println(">>>>>tranType:"+tranType);
System.out.println(">>>>>qcReqd:"+qcReqd);
System.out.println(">>>>>itemCode:"+itemCode);
if (!"0".equals(stkOpt) && "R".equals(tranType) && "Y".equals(qcReqd)) if (!"0".equals(stkOpt) && "R".equals(tranType) && "Y".equals(qcReqd))
{ {
System.out.println("Calling CreateQcorder for tranID ["+tranID + "] siteCode [ "+ siteCode + "] itemCode [" + itemCode + "] lineNo [" + lineNo + "]" ); System.out.println("Calling CreateQcorder for tranID ["+tranID + "] siteCode [ "+ siteCode + "] itemCode [" + itemCode + "] lineNo [" + lineNo + "]" );
...@@ -1367,11 +1371,14 @@ public class WorkorderIssConf extends ActionHandlerEJB implements WorkorderIssCo ...@@ -1367,11 +1371,14 @@ public class WorkorderIssConf extends ActionHandlerEJB implements WorkorderIssCo
String errCode = "", errString = "", qcReqd = "", lotNo = "", lotNoRcp = "", lotSl = "", keyString = "", xmlValues = ""; String errCode = "", errString = "", qcReqd = "", lotNo = "", lotNoRcp = "", lotSl = "", keyString = "", xmlValues = "";
String winName = "", qcorderNo = "", lotRcp = "", locCode = "", tranId = "", unit = "",batchNo = "", userid = "SYSTEM", termid = "SYSTEM"; String winName = "", qcorderNo = "", lotRcp = "", locCode = "", tranId = "", unit = "",batchNo = "", userid = "SYSTEM", termid = "SYSTEM";
String locCodeAprv = "", locCodeRej = "", itemSer = "", routeCode = "", suppCodeMfg = "", suppCode = "", sql = ""; String locCodeAprv = "", locCodeRej = "", itemSer = "", routeCode = "", suppCodeMfg = "", suppCode = "", sql = "";
String lockCode="",invTranId="",remarks="";
double quantity = 0; double quantity = 0;
Timestamp today = null, expiryDate = null, qcDueDate = null, relDate = null, retestDate= null , expDate = null, mfgDate = null, tranDate = null; Timestamp today = null, expiryDate = null, qcDueDate = null, relDate = null, retestDate= null , expDate = null, mfgDate = null, tranDate = null;
int count = 0,qcLeadTime = 0; int count = 0,qcLeadTime = 0;
int insInvCnt=0,lineNoInv=0,insInvDetCnt=0;
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null; ResultSet rs = null;
DistCommon distCommon= new DistCommon();
try try
{ {
GenericUtility genericUtility = GenericUtility.getInstance(); GenericUtility genericUtility = GenericUtility.getInstance();
...@@ -1625,6 +1632,53 @@ public class WorkorderIssConf extends ActionHandlerEJB implements WorkorderIssCo ...@@ -1625,6 +1632,53 @@ public class WorkorderIssConf extends ActionHandlerEJB implements WorkorderIssCo
pstmt.setString(34,suppCodeMfg); pstmt.setString(34,suppCodeMfg);
count = pstmt.executeUpdate(); count = pstmt.executeUpdate();
//Added by Sagar on 10/10/14 Start...
lockCode= distCommon.getDisparams("999999", "QUARNTINE_LOCKCODE", conn);
System.out.println(">>>>> getDisparams lockCode:"+lockCode);
if(count > 0 && lockCode!=null && lockCode.trim().length() > 0 )
{
invTranId = generateTranId( "w_inv_hold", siteCode, conn );
System.out.println(">>>>Generate invTranId in Work Order Issue Return Confirmation:"+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 Work Order Issue/Return Confirmation";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, invTranId);
pstmt.setTimestamp(2,new Timestamp(System.currentTimeMillis()));
pstmt.setString(3, siteCode);
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, itemCode);
pstmt.setString(4, siteCode);
pstmt.setString(5, locCode);
pstmt.setString(6, lotNoRcp);
pstmt.setString(7, lotSl);
pstmt.setString(8, remarks);
pstmt.setString(9, "H");
insInvDetCnt = pstmt.executeUpdate();
pstmt.close();
pstmt = null;
}
}
//Added by Sagar on 10/10/14 End..
} }
catch(SQLException ex) catch(SQLException ex)
{ {
...@@ -1662,4 +1716,88 @@ public class WorkorderIssConf extends ActionHandlerEJB implements WorkorderIssCo ...@@ -1662,4 +1716,88 @@ public class WorkorderIssConf extends ActionHandlerEJB implements WorkorderIssCo
return errCode; return errCode;
} }
//end added by prajakta 27/12/06 //end added by prajakta 27/12/06
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()
} }
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