Commit 84e76617 authored by pshinde's avatar pshinde

Auto Qc order confirmation


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@98629 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 535e512c
......@@ -21,6 +21,10 @@ import javax.ejb.Stateless;
import java.util.Calendar;
import java.util.HashMap;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.axis.encoding.XMLType;
import javax.xml.rpc.ParameterMode;
@Stateless
public class QCTransferConf extends ActionHandlerEJB implements
......@@ -143,8 +147,9 @@ QCTransferConfLocal, QCTransferConfRemote
{
try
{
if (errString != null && errString.trim().length() > 0 && !("VTCONFIRM".equalsIgnoreCase(errCode)) )
if (errString != null && errString.trim().length() > 0 && !("VTCONFIRM".equalsIgnoreCase(errCode)) && !("VTQTSUCC".equalsIgnoreCase(errString)))
{
System.out.println("Test123=====");
// if(isLocal){
conn.rollback();
System.out.println("@@@@ Transaction rollback...["+errString+"]::errCode["+errCode+"]");
......@@ -160,7 +165,8 @@ QCTransferConfLocal, QCTransferConfRemote
System.out.println("c"+errString+"]::errCode["+errCode+"]");
conn.close();
conn = null;
}else{
}
else{
System.out.println("DIDNT COMMIT ********8");
}
}
......@@ -209,6 +215,9 @@ QCTransferConfLocal, QCTransferConfRemote
String autoCloseQC="";
String subSQLCloseQC="";
String ledgPostConf ="";
String strToWrite="";
boolean isQcFlag=false;
double remainingQcOrderQty=0.0, QcTransferQty=0.0;
try
{
StockUpdate stockUpdate = new StockUpdate();
......@@ -225,6 +234,7 @@ QCTransferConfLocal, QCTransferConfRemote
{
subSQLCloseQC=",STATUS='C' ";
}
System.out.println("subSQLCloseQC====="+subSQLCloseQC);
}
System.out.println("@@@@@@@@@@@@@@@ confirmQcTransfer method called next..............");
Calendar currentDate = Calendar.getInstance();
......@@ -895,7 +905,7 @@ QCTransferConfLocal, QCTransferConfRemote
System.out.println("@@@ convertedNoArt["+convertedNoArt+"]convertedNetWeight["+convertedNetWeight+"]");
double remainingQcOrderQty=0.0, QcTransferQty=0.0;
// added by cpatil on 22/09/15 for update qc order status as 'C' when full transfer done
......@@ -935,8 +945,14 @@ QCTransferConfLocal, QCTransferConfRemote
{
subSQLCloseQC = "";
}
sql = " Update qc_order set quantity = (quantity - ? ) " + subSQLCloseQC+
/*sql = " Update qc_order set quantity = (quantity - ? ) " + subSQLCloseQC+
" , net_weight = ( net_weight - ? ) , no_art = ( no_art - ? ) " + // modify by cpatil on 09/04/14
" where qorder_no = ? ";*/
System.out.println("remainingQcOrderQty======"+remainingQcOrderQty);
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
" where qorder_no = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setDouble(1, qty);
......@@ -946,6 +962,12 @@ QCTransferConfLocal, QCTransferConfRemote
updCnt = pstmt.executeUpdate();
pstmt.close();
pstmt = null;
// 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
......@@ -1139,6 +1161,67 @@ QCTransferConfLocal, QCTransferConfRemote
pstmt = null;
System.out.println("hiold_qty updated in to location "+updCnt);
}*/
sql = " Select quantity__o,quantity from qc_transfer Where tran_id = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,tranId);
rs = pstmt.executeQuery();
if(rs.next())
{
remainingQcOrderQty = rs.getDouble(1);
QcTransferQty = rs.getDouble(2);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
System.out.println("@@@cpatil23/09/15 remainingQcOrderQty["+remainingQcOrderQty+"]QcTransferQty["+QcTransferQty+"]");
if("Y".equalsIgnoreCase(autoCloseQC) && (remainingQcOrderQty==QcTransferQty))
{
System.out.println("remainingQcOrderQty==QcTransferQty***********");
System.out.println(">>>>>>>>>>>Found Tran id for Confirm:"+tranId);
System.out.println("Qc order no===="+qorderNo);
String forcedFlag="N";
//if(errCode==null || errCode.trim().length()==0)
//{
System.out.println("Going to commit transaction============");
conn.commit();
retString=autoConfirmQC("qcorder_new",qorderNo,xtraParams,forcedFlag,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+"]";
//conn.rollback();
System.out.println(">>>>>>>>>>Confirm Failed:"+tranId);
//return "VTQTSUCC";
isQcFlag=true;
}
//}
}
}
// ADDED BY RITESH ON 23/SEP/2014 END
} //end if
......@@ -1190,6 +1273,13 @@ QCTransferConfLocal, QCTransferConfRemote
{
System.out.println("retString from batchload = ["+ retString + "]");
}
if(isQcFlag)
{
System.out.println("Qc flag is true===");
// errCode="VTQTSUCC";
errCode = itmDBAccessLocal.getErrorString("","VTQTSUCC","");
}
}
System.out.println("@@@@@@@@@@@@@@@ ediOption called end..............");
......@@ -1215,6 +1305,111 @@ QCTransferConfLocal, QCTransferConfRemote
return string;
}
*/
//Added by priyanka
public String autoConfirmQC(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
{
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' ";
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(">>>QC transfer confirmation 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(">>>QC transfer confirmation 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(">>>>Confirm 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 inCalling 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