Commit 7413aaf6 authored by jshinde's avatar jshinde

req id:[W16GSUN003]


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@103779 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 03590648
......@@ -105,11 +105,14 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
StringBuffer errStringXml = new StringBuffer("<?xml version=\"1.0\"?>\r\n<Root><Errors>");
String loginSite = "", userId = "", childNodeName = "", errorType = "", errCode = "", errString = "",locGroupDisp="",
itemSql="",StatusSql="",status ="",itemRgSql="",locSql="",locGroup="",itemSer="",itemSerRgDisparm="",itemCode="",lotNo="",
locSuffixDisp="",stkSql="",lastCharS="";
int currentFormNo = 0, childNodeListLength = 0, cnt = 0, ctr = 0;
locSuffixDisp="",stkSql="",lastCharS="" ,sqlTranId = "" ,tranId ="";
int currentFormNo = 0, childNodeListLength = 0, cnt = 0, ctr = 0 ,palletHdrCount = 0 ,stockCount = 0,countPalletDetLot =0;//Added by Jagruti Shinde Req id:[W16GSUN003]
char lastChar ;
ArrayList <String> errList = new ArrayList<String>();
ArrayList <String> errFields = new ArrayList <String> ();
//Added by Jagruti Shinde Request id:[W16GSUN003]
double PalletSwmsQty ;
ITMDBAccessEJB itmdbAccess = new ITMDBAccessEJB();
try
{
......@@ -239,13 +242,34 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
}
else
{
System.out.println("pallet not in AWMS" +cntLoc);
System.out.println("pallet not in AWMS::::::::" +cntLoc);
errCode = "VTPALPEEXT";//pallet
errList.add( errCode );
errFields.add( childNodeName.toLowerCase() );
break;
}
//Change by Jagruti Shinde Request Id:[W15JSUN008] for requirement change for Exempted/BSR location inv_stat[End]
//Changed by Jagruti Shinde Request Id:[W15JSUN008] for requirement change for Exempted/BSR location inv_stat[End]
//Changed by Jagruti Shinde Request Id:[W16GSUN003][Start]
palletAWMSCount = getPalletAWMSCount(palletNo, conn);
if(palletAWMSCount > 0)
{
System.out.println("Pallet No still in transist :::::::::: ");
errCode = "VTINOUTTR";
errList.add( errCode );
errFields.add(childNodeName.toLowerCase());
break;
}
PalletSwmsQty = getPalletSwmsQty(palletNo, loginSite, conn);
if(PalletSwmsQty > 0)
{
System.out.println("Pallet is not empty checked from tables::::::::: ");
errCode = "VTINOUTQT";
errList.add( errCode );
errFields.add(childNodeName.toLowerCase());
break;
}
palletQty = getPalletNoQty(palletNo, loginSite, conn);
if(palletQty > 0)
{
......@@ -255,18 +279,62 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
errFields.add(childNodeName.toLowerCase());
break;
}
else
palletHdrCount = getPalletHdrCount(palletNo, conn);
if(palletHdrCount > 0)
{
palletAWMSCount = getPalletAWMSCount(palletNo, conn);
if(palletAWMSCount > 0)
sqlTranId ="SELECT TRAN_ID FROM PALLET_HDR WHERE PALLET_NO = ? AND CONFIRMED = ? ";
pstmt = conn.prepareStatement(sqlTranId);
pstmt.setString(1, palletNo);
pstmt.setString(2, "N");
rs = pstmt.executeQuery();
if(rs.next())
{
System.out.println("Pallet No still transist, interface table :::::::::: ");
errCode = "VTINOUTPL";
errList.add( errCode );
errFields.add(childNodeName.toLowerCase());
break;
tranId = rs.getString("TRAN_ID");
System.out.println("Transaction Id for Pallet_hdr:::::"+tranId);
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(rs != null)
{
rs.close();
rs = null;
}
sql="SELECT COUNT(1) FROM PALLET_DET WHERE TRAN_ID = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranId);
rs = pstmt.executeQuery();
if(rs.next())
{
stockCount = rs.getInt(1);
System.out.println("Stock count for pallet_det::" +stockCount);
}
if(pstmt!=null)
{
pstmt.close();
pstmt = null;
}
if(rs!=null)
{
rs.close();
rs = null;
}
if (stockCount > 0)
{
continue;
}
else
{
System.out.println("stock is NOT present in pallet_det");
errString = itmdbAccess.getErrorString("", "VTALLSCAND", "", "", conn);
return errString;
}
}
//Changed by Jagruti Shinde Request Id:[W16GSUN003][END]
}
}
}
......@@ -342,7 +410,8 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
locGroupDisp = checkNullAndTrim(discommon.getDisparams("999999", "EXTEMP_LOC_PARM", conn));
System.out.println("EXTEMP_LOC_PARM["+locGroupDisp+"]");
int count = 0;
int count = 0 ,PalletLotAWMSCount =0 ;
double PalletLotQty;
parentNodeList = dom.getElementsByTagName("Detail3");
parentNode = parentNodeList.item(0);
......@@ -390,7 +459,8 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
}
else
{
sql = "SELECT COUNT(*) FROM PALLET_DET D, PALLET_HDR H WHERE D.LOT_NO = ? AND D.LOT_SL = ? AND "
//Changed by Jagruti Shinde Request Id:[W16GSUN003][Start]
/*sql = "SELECT COUNT(1) FROM PALLET_DET D, PALLET_HDR H WHERE D.LOT_NO = ? AND D.LOT_SL = ? AND "
+ " D.SITE_CODE = ? AND D.TRAN_ID = H.TRAN_ID AND H.CONFIRMED = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, lotNo);
......@@ -412,18 +482,30 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
{
rs.close();
rs = null;
}*/
PalletLotAWMSCount = getPalletLotAWMSCount(palletNo, lotNo, lotSl, conn);
if(PalletLotAWMSCount > 0)
{
System.out.println("Pallet No still in transist, in both table :::::::::: ");
errCode = "VTINOUTTR";
errList.add( errCode );
errFields.add(childNodeName.toLowerCase());
break;
}
if(count > 0)
PalletLotQty = getPalletLotQty(palletNo, lotNo, lotSl,loginSite, conn);
if(PalletLotQty > 0)
{
System.out.println("Record already scanned in previous transaction:::::::::: ");
errCode = "VTSMRCG";
System.out.println("Pallet is not empty checked from tables::::::::: ");
errCode = "VTINOUTQT";//PALLET_HDR,'Y' swms_to_awms 'Y' quantity check
errList.add( errCode );
errFields.add(childNodeName.toLowerCase());
break;
}
//Changed by wasim on 28-06-2016 to validate the confirmed/unconfirmed pallet_det records for scanned lotNo and lotSl [START]
count = 0;
//countPalletDetLot = 0;
sql = "SELECT COUNT(*) FROM PALLET_DET D, PALLET_HDR H WHERE D.LOT_NO = ? AND D.LOT_SL = ? AND "
+ " D.SITE_CODE = ? AND D.TRAN_ID = H.TRAN_ID AND H.CONFIRMED = ? ";
pstmt = conn.prepareStatement(sql);
......@@ -434,7 +516,7 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
rs = pstmt.executeQuery();
if(rs.next())
{
count = rs.getInt(1);
countPalletDetLot = rs.getInt(1);
}
if(pstmt != null)
{
......@@ -447,48 +529,29 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
rs = null;
}
//Changed by wasim on 28-06-2016 to validate the confirmed/unconfirmed pallet_det records for scanned lotNo and lotSl [END]
if(count > 0)
if(countPalletDetLot > 0)
{
System.out.println("Record already scanned in same transaction:::::::::: ");
System.out.println("lot no-lot sl Record already scanned in previous transaction:::::::::: ");
errCode = "VTSMRCD";
errList.add( errCode );
errFields.add(childNodeName.toLowerCase());
break;
}
else
{
sql = "SELECT COUNT(*) FROM STOCK WHERE LOT_NO = ? AND LOT_SL = ? "
+ "AND SITE_CODE = ? AND INV_STAT NOT IN (?,?) AND QUANTITY > 0 ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, lotNo);
pstmt.setString(2, lotSl);
pstmt.setString(3, loginSite);
pstmt.setString(4, "AWMS");
pstmt.setString(5, "AWMSQ");
rs = pstmt.executeQuery();
if(rs.next())
{
count = rs.getInt(1);
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(rs != null)
{
rs.close();
rs = null;
}
if(count <= 0)
//else
//{
/*PalletLotQty = getPalletLotQty(palletNo, lotNo, lotSl,loginSite, conn);
if(PalletLotQty > 0)
{
System.out.println("No record found :::::::::: ");
errCode = "VTINVREC";
System.out.println("Pallet is not empty checked from tables::::::::: ");
errCode = "VTINOUTQT";//PALLET_HDR,'Y' swms_to_awms 'Y' quantity check
errList.add( errCode );
errFields.add(childNodeName.toLowerCase());
}
break;
}*/
//Changed by Jagruti Shinde Request Id:[W16GSUN003][End]
else
{
System.out.println("in else of (PalletLotQty > 0)::::::::");
hm2 = getScanItem(palletNo, loginSite, conn);
itemCodeDB = (String) hm2.get("ITEM_CODE");
lotNoDB = (String) hm2.get("LOT_NO");
......@@ -627,9 +690,9 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
}
}
}
}
}
}
//}
} //end lot_sl not blank
}//end if lot_sl
}
break;
}//End of switch statement
......@@ -931,11 +994,17 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
int count = 0;
try
{
sql ="SELECT COUNT(*) FROM SWMS_TO_AWMS WHERE PALLET_NO = ? AND SCHEDULE_STATUS = ? AND REF_SER = ? ";
//Changed by Jagruti Shinde Req id:[W16GSUN003][Start]
//sql ="SELECT COUNT(*) FROM SWMS_TO_AWMS WHERE PALLET_NO = ? AND SCHEDULE_STATUS = ? AND REF_SER = ? ";
sql =" SELECT COUNT(1) FROM SWMS_TO_AWMS S,PALLET_HDR H,PALLET_DET D WHERE H.TRAN_ID = S.REF_ID AND" +
" H.TRAN_ID = D.TRAN_ID AND H.PALLET_NO = S.PALLET_NO AND H.PALLET_NO = ? " +
" AND S.SCHEDULE_STATUS = ? AND S.REF_SER = ? AND H.CONFIRMED= ? ";
//Changed by Jagruti Shinde Req id:[W16GSUN003][End]
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, palletNo);
pstmt.setString(2, "N");
pstmt.setString(3, "PZ");
pstmt.setString(4, "Y");
rs = pstmt.executeQuery();
if(rs.next())
{
......@@ -1716,7 +1785,292 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
System.out.println("return lineNo from getMaxLineNo :::::::::::::::::; "+lineNo);
return lineNo;
}
//Changed by Jagruti Shinde Req id:[W16GSUN003][START]
private Double getPalletSwmsQty(String palletNo, String loginSite, Connection conn) throws Exception
{
PreparedStatement pstmt = null ;
ResultSet rs = null ;
String sql = "" ,sqlPallet ="";
double quantity = 0;
int countPallet =0;
try
{
sqlPallet=" SELECT COUNT(1) FROM PALLET_HDR H,PALLET_DET D,SWMS_TO_AWMS S WHERE D.TRAN_ID=H.TRAN_ID AND " +
" H.TRAN_ID=S.REF_ID AND H.CONFIRMED = ? AND S.SCHEDULE_STATUS = ? AND H.PALLET_NO = S.PALLET_NO AND H.PALLET_NO = ?";
pstmt = conn.prepareStatement(sqlPallet);
pstmt.setString(1, "Y");
pstmt.setString(2, "Y");
pstmt.setString(3, palletNo);
rs = pstmt.executeQuery();
if(rs.next())
{
countPallet = rs.getInt(1);
System.out.println("countPallet:::::"+countPallet);
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(rs != null)
{
rs.close();
rs = null;
}
if(countPallet > 0)
{
sql = "SELECT SUM(QUANTITY) FROM STOCK WHERE LOC_CODE IN(?,?,?,?,?,?,?,?) AND SITE_CODE = ? AND INV_STAT IN(?,?) ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, palletNo);
pstmt.setString(2, palletNo+"Q");
pstmt.setString(3, palletNo+"B");
pstmt.setString(4, palletNo+"X");
pstmt.setString(5, palletNo+"M");
pstmt.setString(6, palletNo+"U");
pstmt.setString(7, palletNo+"P");
pstmt.setString(8, palletNo+"S");
pstmt.setString(9, loginSite);
pstmt.setString(10, "AWMS");
pstmt.setString(11, "AWMSQ");
rs = pstmt.executeQuery();
if(rs.next())
{
quantity = rs.getInt(1);
System.out.println("quantity::::::::"+quantity);
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(rs != null)
{
rs.close();
rs = null;
}
}
}
catch(Exception e)
{
System.out.println("Exception in getPalletSwmsQty ::::::::: " + e);
e.printStackTrace();
throw new Exception(e);
}
finally
{
if(rs!=null)
{
rs.close();
rs = null;
}
if(pstmt!=null)
{
pstmt.close();
pstmt = null;
}
}
System.out.println("Return from getPalletSwmsQty ------>>" + quantity);
return quantity;
}
private int getPalletHdrCount(String palletNo, Connection conn) throws Exception
{
PreparedStatement pstmt = null ;
ResultSet rs = null ;
String sql = "" ,sqlTranId ="" ,tranId ="",errString ="";
int countHdr = 0 ,stockCount =0 ;
ITMDBAccessEJB itmdbAccess = new ITMDBAccessEJB();
try
{
sql ="SELECT COUNT(1) FROM PALLET_HDR WHERE PALLET_NO = ? AND CONFIRMED = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, palletNo);
pstmt.setString(2, "N");
rs = pstmt.executeQuery();
if(rs.next())
{
countHdr = rs.getInt(1);
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(rs != null)
{
rs.close();
rs = null;
}
}
}
catch(Exception e)
{
System.out.println("Exception in getPalletHdrCount ::::::: " + e);
e.printStackTrace();
throw new Exception(e);
}
finally
{
if(rs!=null)
{
rs.close();
rs = null;
}
if(pstmt!=null)
{
pstmt.close();
pstmt = null;
}
}
System.out.println("return value from getPalletHdrCount :::::::::: " + countHdr);
return countHdr;
}
private int getPalletLotAWMSCount(String palletNo,String lotNo,String lotSl,Connection conn) throws Exception
{
PreparedStatement pstmt = null ;
ResultSet rs = null ;
String sql = "";
int countLot = 0;
try
{
sql =" SELECT COUNT(1) FROM PALLET_HDR H,PALLET_DET D,SWMS_TO_AWMS S WHERE D.TRAN_ID=H.TRAN_ID AND " +
" H.TRAN_ID=S.REF_ID AND H.CONFIRMED = ? AND S.SCHEDULE_STATUS = ? " +
//"AND H.PALLET_NO = S.PALLET_NO " +
" AND D.LOT_NO = S.LOT_NO AND D.LOT_SL = S.LOT_SL " +
//"AND H.PALLET_NO = ? " +
" AND D.LOT_NO = ? AND D.LOT_SL = ? AND S.REF_SER = ? " ;
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, "Y");
pstmt.setString(2, "N");
//pstmt.setString(3, palletNo);
pstmt.setString(3, lotNo);
pstmt.setString(4, lotSl);
pstmt.setString(5, "PZ");
rs = pstmt.executeQuery();
if(rs.next())
{
countLot = rs.getInt(1);
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(rs != null)
{
rs.close();
rs = null;
}
}
catch(Exception e)
{
System.out.println("Exception in getPalletLotAWMSCount ::::::: " + e);
e.printStackTrace();
throw new Exception(e);
}
finally
{
if(rs!=null)
{
rs.close();
rs = null;
}
if(pstmt!=null)
{
pstmt.close();
pstmt = null;
}
}
System.out.println("return value from getPalletLotAWMSCount :::::::::: " + countLot);
return countLot;
}
private Double getPalletLotQty(String palletNo,String lotNo,String lotSl, String loginSite, Connection conn) throws Exception
{
PreparedStatement pstmt = null ;
ResultSet rs = null ;
String sql = "" ,sqlPallet ="";
double quantity = 0;
int countPallet =0;
try
{
sqlPallet=" SELECT COUNT(1) FROM PALLET_HDR H,PALLET_DET D,SWMS_TO_AWMS S WHERE D.TRAN_ID=H.TRAN_ID AND " +
" H.TRAN_ID=S.REF_ID AND H.CONFIRMED = ? AND S.SCHEDULE_STATUS = ? " +
//" AND H.PALLET_NO = S.PALLET_NO AND H.PALLET_NO = ?" +
" AND D.LOT_NO = S.LOT_NO AND D.LOT_SL = S.LOT_SL AND D.LOT_NO = ? AND D.LOT_SL = ?";
pstmt = conn.prepareStatement(sqlPallet);
pstmt.setString(1, "Y");
pstmt.setString(2, "Y");
//pstmt.setString(3, palletNo);
pstmt.setString(3, lotNo);
pstmt.setString(4, lotSl);
rs = pstmt.executeQuery();
if(rs.next())
{
countPallet = rs.getInt(1);
System.out.println("countPallet:::::"+countPallet);
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(rs != null)
{
rs.close();
rs = null;
}
if(countPallet > 0)
{
sql = "SELECT SUM(QUANTITY) FROM STOCK WHERE " +
" SITE_CODE = ? AND INV_STAT IN(?,?) AND LOT_NO = ? AND LOT_SL = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, loginSite);
pstmt.setString(2, "AWMS");
pstmt.setString(3, "AWMSQ");
pstmt.setString(4, lotNo);
pstmt.setString(5, lotSl);
rs = pstmt.executeQuery();
if(rs.next())
{
quantity = rs.getInt(1);
System.out.println("quantity::::::::"+quantity);
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(rs != null)
{
rs.close();
rs = null;
}
}
}
catch(Exception e)
{
System.out.println("Exception in getPalletLotQty ::::::::: " + e);
e.printStackTrace();
throw new Exception(e);
}
finally
{
if(rs!=null)
{
rs.close();
rs = null;
}
if(pstmt!=null)
{
pstmt.close();
pstmt = null;
}
}
System.out.println("Return from getPalletLotQty ------>>" + quantity);
return quantity;
}
//Changed by Jagruti Shinde Req id:[W16GSUN003][End]
}
\ No newline at end of file
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