package ibase.webitm.utility.wms;
import ibase.webitm.utility.ITMException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
public  class CommonWmsUtil {
	
        public static  int ALL_PTCN_EX_COUNT;
        
        public CommonWmsUtil()
    	{
    	}

    	public static CommonWmsUtil getInstance()
    	{
    		return new ibase.webitm.utility.wms.CommonWmsUtil();
    	}
    	
      //Changed By Pragyan 11-AUG-14 To check and Facility Master implementation.start
    	public boolean isValFacLocation(String locCode,String siteCode,Connection conn) throws ITMException
    	{
    		PreparedStatement pstmt=null;
            ResultSet rs = null;
            double partialQty=0.0;
            double packSize=0.0;
            boolean isValidLocation = false;
            int count = 0;
            
    		try {
    			String sql ="SELECT FN_CHECK_VALID_LOC(?,?) FROM DUAL";
    			pstmt =conn.prepareStatement(sql);
    			pstmt.setString(1, siteCode);
    			pstmt.setString(2, locCode);

    			rs = pstmt.executeQuery();
    			
    			if(rs.next())
    			{
    				count = rs.getInt(1);
    			}
    			
    			if(count > 0)
    			{
    				isValidLocation = true;
    			}
    			
    			
    			if(rs != null)
    			{
    				rs.close();
    				rs=null;
    			}
    			
    			if(pstmt != null)
    			{
    				pstmt.close();
    				pstmt=null;
    			}
    			
    			
    			
    			
    		} catch (Exception e) {
    			// TODO Auto-generated catch block
    			throw new ITMException(e); 
    		}
    		
    		return isValidLocation;
    	}
    	//Changed By Pragyan 11-AUG-14 To check and Facility Master implementation.end
       
}
