Commit 85d3412f authored by pshinde's avatar pshinde

Pass Qc order functionality added before Auto Qc order confirmation


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@98646 ce508802-f39f-4f6c-b175-0d175dae99d5
parent af79c044
......@@ -189,13 +189,13 @@ QCTransferConfLocal, QCTransferConfRemote
PreparedStatement pstmt = null, pstmtSql = null;
ResultSet rs = null;
int cnt = 0,updCnt=0,updCnt1=0;
String retString = "", sql = "", errCode = "";
String retString = "", sql = "", errCode = "", retString1="";
Timestamp sysDate = null, tranDate = null;
GenericUtility genericUtility = GenericUtility.getInstance();
ITMDBAccessEJB itmDBAccessLocal = new ITMDBAccessEJB();
String confirmed="",qorderNo="",siteCode="",toLoc="",lotSl="",lotNo="",porcpNo="",fromLoc="",itemCode="";
String status="",ediOption="",dataStr = "";
double qty=0,qcQty=0,stkGrossWt=0,stkTareWt=0,stkNetWt=0,qtyPerArt=0,grossWtPerArt=0,tareWtPerArt=0,stockQty=0;
double qty=0,qcQty=0,stkGrossWt=0,stkTareWt=0,stkNetWt=0,qtyPerArt=0,grossWtPerArt=0,tareWtPerArt=0,stockQty=0,qcQtyTran=0;
HashMap stockUpd = new HashMap();
String available="";
......@@ -274,7 +274,7 @@ QCTransferConfLocal, QCTransferConfRemote
pstmt = null;
sql = " Select status,Quantity, item_code, net_weight, no_art from qc_order where qorder_no = ? "; // added net_weight by cpatil on 05/04/14
sql = " Select status,Quantity, item_code, net_weight, no_art,qty_transfered from qc_order where qorder_no = ? "; // added net_weight by cpatil on 05/04/14
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, qorderNo);
rs = pstmt.executeQuery();
......@@ -286,6 +286,7 @@ QCTransferConfLocal, QCTransferConfRemote
qcOrderItem= rs.getString("item_code");
netWeight= rs.getDouble("net_weight");
noArt= rs.getDouble("no_art");
qcQtyTran= rs.getDouble("qty_transfered");
}
rs.close();
rs = null;
......@@ -865,31 +866,36 @@ QCTransferConfLocal, QCTransferConfRemote
if(isByProduct)
{
System.out.println("isByProduct***********");
if ( qcQty > convertedQty )
{
System.out.println("qcQty > convertedQty***********");
sql = " Update qc_order set quantity = ( quantity - ? ) " +
" , net_weight = ( net_weight - ? ) , no_art = ( no_art - ? ) " + // modify by cpatil on 09/04/14
" , net_weight = ( net_weight - ? ) , no_art = ( no_art - ? ),qty_transfered= (CASE WHEN qty_transfered IS NULL THEN 0 ELSE qty_transfered END + ? ) " + // modify by cpatil on 09/04/14
" where qorder_no = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setDouble(1, convertedQty );
pstmt.setDouble(2, convertedNetWeight );
pstmt.setDouble(3, convertedNoArt );
pstmt.setString(4, qorderNo);
pstmt.setDouble(4, convertedQty );//added by priyanka
pstmt.setString(5, qorderNo);
updCnt = pstmt.executeUpdate();
pstmt.close();
pstmt = null;
}
else
{
System.out.println("qcQty > convertedQty else***********");
sql = " Update qc_order set quantity = (quantity - ? ) " +
// " , status = 'C' " + // modify by cpatil on 20/12/14 -- comment condition
" , net_weight = ( net_weight - ? ) , no_art = ( no_art - ? ) " + // modify by cpatil on 09/04/14
" , net_weight = ( net_weight - ? ) , no_art = ( no_art - ? ),qty_transfered= (CASE WHEN qty_transfered IS NULL THEN 0 ELSE qty_transfered END + ? ) " + // modify by cpatil on 09/04/14
" where qorder_no = ? " ;
pstmt = conn.prepareStatement(sql);
pstmt.setDouble(1, convertedQty );
pstmt.setDouble(2, convertedNetWeight );
pstmt.setDouble(3, convertedNoArt );
pstmt.setString(4, qorderNo);
pstmt.setDouble(4, convertedQty );//added by priyanka
pstmt.setString(5, qorderNo);
updCnt = pstmt.executeUpdate();
pstmt.close();
pstmt = null;
......@@ -940,6 +946,10 @@ QCTransferConfLocal, QCTransferConfRemote
System.out.println("@@@cpatil23/09/15 remainingQcOrderQty["+remainingQcOrderQty+"]QcTransferQty["+QcTransferQty+"]");
//if ( qcQty != qty )
if ( remainingQcOrderQty != QcTransferQty )
{
......@@ -952,39 +962,39 @@ QCTransferConfLocal, QCTransferConfRemote
System.out.println("QcTransferQty======"+QcTransferQty);
sql = " Update qc_order set quantity = (quantity - ? ) ," +
" net_weight = ( net_weight - ? ) , no_art = ( no_art - ? ) " + // modify by cpatil on 09/04/14
" net_weight = ( net_weight - ? ) , no_art = ( no_art - ? ) ,qty_transfered= (CASE WHEN qty_transfered IS NULL THEN 0 ELSE qty_transfered END + ? )" + // modify by cpatil on 09/04/14
" where qorder_no = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setDouble(1, qty);
pstmt.setDouble(2, convertedNetWeight);
pstmt.setDouble(3, convertedNoArt);
pstmt.setString(4, qorderNo);
pstmt.setDouble(4, qty );//added by priyanka
pstmt.setString(5, qorderNo);
updCnt = pstmt.executeUpdate();
pstmt.close();
pstmt = null;
//testing
// added by priyanka shinde on 01/10/15
// if QC order is fully transferred and autoCloseQCequal to Y then Qc order will auto confirm
/*
}
else
{
sql = " Update qc_order set quantity = (quantity - ? ) "+subSQLCloseQC + // remove update status = 'C' on 05/12/14
" , net_weight = ( net_weight - ? ) , no_art = ( no_art - ? ) " + // modify by cpatil on 09/04/14
" where qorder_no = ? " ;
pstmt = conn.prepareStatement(sql);
pstmt.setDouble(1, qty);
pstmt.setDouble(2, convertedNetWeight);
pstmt.setDouble(3, convertedNoArt);
pstmt.setString(4, qorderNo);
updCnt = pstmt.executeUpdate();
pstmt.close();
sql="select qty_transfered from qc_order where qorder_no=?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,qorderNo);
rs = pstmt.executeQuery();
if(rs.next())
{
qcQtyTran = rs.getDouble("qty_transfered");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
}
*/
System.out.println("Quantioty transferred test====="+qcQtyTran);
//testing end
//end if
}
......@@ -1192,7 +1202,52 @@ QCTransferConfLocal, QCTransferConfRemote
//{
System.out.println("Going to commit transaction============");
conn.commit();
retString=autoConfirmQC("qcorder_new",qorderNo,xtraParams,forcedFlag,conn);
//To pass Qc Order
System.out.println("Quantioty transferred test before QC order passed====="+qcQtyTran);
retString1=autoQC("qcorder_new", qorderNo, xtraParams, forcedFlag,"pre_pass", conn);
System.out.println("Quantioty transferred after QC order passed======="+qcQtyTran);
System.out.println("retString1 from QC Passed===="+retString1);
if((retString1 != null ) && (retString1.indexOf("VTSUCC1") > -1))
{
System.out.println(">>>>>>>>>retString.indexOf(VTSUCC1) :"+retString1.indexOf("VTSUCC1"));
retString=autoQC("qcorder_new",qorderNo,xtraParams,forcedFlag,"pre_confirm",conn);
System.out.println("retString from autoConfirmQC========="+retString);
if((retString != null ) && (retString.indexOf("VTSUCC1") > -1))
{
System.out.println(">>>>>>>>>retString.indexOf(VTSUCC1) :"+retString.indexOf("VTSUCC1"));
//conn.commit();
System.out.println(">>>>After Commit Confirm Completed:"+tranId);
if(retString.indexOf("VTSUCC1") > -1)
{
strToWrite = " ["+ tranId + "] success ";
}
else
{
strToWrite = " ["+tranId+"] return ["+retString+"]";
}
}
else
{
strToWrite = " ["+tranId+"] return ["+retString+"]";
System.out.println(">>>>>>>>>>Confirm Failed:"+tranId);
isQcFlag=true;
}//commet till this
}
else
{
strToWrite = " ["+tranId+"] return ["+retString1+"]";
//conn.rollback();
System.out.println(">>>>>>>>>>Passed Failed:"+tranId);
//return "VTQTSUCC";
}
//Qc Order confirmation
/*retString=autoConfirmQC("qcorder_new",qorderNo,xtraParams,forcedFlag,conn);
System.out.println("retString from autoConfirmQC========="+retString);
if((retString != null ) && (retString.indexOf("VTSUCC1") > -1))
{
......@@ -1217,8 +1272,8 @@ QCTransferConfLocal, QCTransferConfRemote
//return "VTQTSUCC";
isQcFlag=true;
}
}//commet till this
*/
//}
}
......@@ -1308,7 +1363,7 @@ QCTransferConfLocal, QCTransferConfRemote
//Added by priyanka
public String autoConfirmQC(String businessObj,String qcOrder,String xtraParams,String forcedFlag, Connection conn) throws Exception, ITMException
public String autoQC(String businessObj,String qcOrder,String xtraParams,String forcedFlag,String eventCode ,Connection conn) throws Exception, ITMException
{
String methodName = "";
String compName = "";
......@@ -1326,9 +1381,10 @@ QCTransferConfLocal, QCTransferConfRemote
methodName = "gbf_post";
actionURI = "http://NvoServiceurl.org/" + methodName;
sql = "SELECT SERVICE_CODE,COMP_NAME FROM SYSTEM_EVENTS WHERE OBJ_NAME = ? AND EVENT_CODE = 'pre_confirm' ";
sql = "SELECT SERVICE_CODE,COMP_NAME FROM SYSTEM_EVENTS WHERE OBJ_NAME = ? AND EVENT_CODE = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,businessObj);
pstmt.setString(2,eventCode);
rs = pstmt.executeQuery();
if ( rs.next() )
{
......@@ -1410,6 +1466,107 @@ QCTransferConfLocal, QCTransferConfRemote
/* //Added by priyanka shinde to call qc order component for Passed Button
public String passQC(String businessObj,String qcOrder,String xtraParams,String forcedFlag, Connection conn) throws Exception, ITMException
{
String methodName = "";
String compName = "";
String retString = "";
String serviceCode = "";
String serviceURI = "";
String actionURI = "";
String sql = "";
PreparedStatement pstmt = null;
ResultSet rs = null;
try
{
System.out.println("Enter to Pass Qc order********");
methodName = "gbf_post";
actionURI = "http://NvoServiceurl.org/" + methodName;
sql = "SELECT SERVICE_CODE,COMP_NAME FROM SYSTEM_EVENTS WHERE OBJ_NAME = ? AND EVENT_CODE = 'pre_pass' ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,businessObj);
rs = pstmt.executeQuery();
if ( rs.next() )
{
serviceCode = rs.getString("SERVICE_CODE");
compName = rs.getString("COMP_NAME");
}
System.out.println(">>>Pass QC Order serviceCode = "+serviceCode+" compName "+compName);
sql = "SELECT SERVICE_URI FROM SYSTEM_EVENT_SERVICES WHERE SERVICE_CODE = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,serviceCode);
rs = pstmt.executeQuery();
if ( rs.next() )
{
serviceURI = rs.getString("SERVICE_URI");
}
System.out.println(">>>Pass QC Order serviceURI = "+serviceURI+" compName = "+compName);
Service service = new Service();
Call call = (Call)service.createCall();
call.setTargetEndpointAddress(new java.net.URL(serviceURI));
call.setOperationName( new javax.xml.namespace.QName("http://NvoServiceurl.org", methodName ) );
call.setUseSOAPAction(true);
call.setSOAPActionURI(actionURI);
Object[] aobj = new Object[4];
call.addParameter( new javax.xml.namespace.QName("http://NvoServiceurl.org", "component_name"), XMLType.XSD_STRING, ParameterMode.IN);
call.addParameter( new javax.xml.namespace.QName("http://NvoServiceurl.org", "tran_id"), XMLType.XSD_STRING, ParameterMode.IN);
call.addParameter( new javax.xml.namespace.QName("http://NvoServiceurl.org", "xtra_params"), XMLType.XSD_STRING, ParameterMode.IN);
call.addParameter( new javax.xml.namespace.QName("http://NvoServiceurl.org", "forced_flag"), XMLType.XSD_STRING, ParameterMode.IN);
aobj[0] = new String(compName);
aobj[1] = new String(qcOrder);
aobj[2] = new String(xtraParams);
aobj[3] = new String(forcedFlag);
System.out.println("@@@@@@ call.setReturnType(XMLType.XSD_STRING) executed........");
call.setReturnType(XMLType.XSD_STRING);
retString = (String)call.invoke(aobj);
System.out.println(">>>>Pass QC Complete Return string from NVO is:==>["+retString+"]");
}
catch(Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
finally
{
try{
if (pstmt != null )
{
pstmt.close();
pstmt = null;
}
if( conn != null ){
conn.close();
conn = null;
}
}
catch(Exception e)
{
System.out.println("Exception inCalling111 confirmed");
e.printStackTrace();
try{
conn.rollback();
}catch (Exception s)
{
System.out.println("Unable to rollback");
s.printStackTrace();
}
throw new ITMException(e);
}
}
return retString;
}*/
private double roundVal(double round,int scale)
{
return Math.round(round*Math.pow(10, scale))/Math.pow(10, scale);
......
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