Commit d149de77 authored by smestry's avatar smestry

W15FSUN008, Updated class file for Palletization.


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@99169 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 0b00fd80
......@@ -140,11 +140,11 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
System.out.println("DOM2----->>["+genericUtility.serializeDom(dom2).toString()+"]");
String locationCode ="", palletNo = "", sql = "";
ArrayList<String> locStockList = new ArrayList<String>();
ArrayList<String> palletList = new ArrayList<String>();
//ArrayList<String> locStockList = new ArrayList<String>();
//ArrayList<String> palletList = new ArrayList<String>();
PreparedStatement pstmt = null ;
ResultSet rs = null ;
int countPalletNo = 0;
int palletNoCount = 0, palletAWMSCount = 0;
double palletQty = 0;
parentNodeList = dom.getElementsByTagName("Detail1");
......@@ -154,29 +154,16 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
//locationCode = checkNullAndTrim(genericUtility.getColumnValue("loc_code", dom));
palletNo = checkNullAndTrim(genericUtility.getColumnValue("pallet_no", dom));
System.out.println("palletNo ------->>["+palletNo+"]");
//System.out.println("palletNo ------->>["+palletNo+"]");
//locStockList = getLocationCode(conn, loginSite);
palletList = getPalletNoList(loginSite, conn);
palletQty = getPalletNoQty(palletNo, loginSite, conn);
sql ="select count(*) from swms_to_awms where pallet_no = ? and schedule_status is null and ref_ser = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, palletNo);
pstmt.setString(2, "PZ");
rs = pstmt.executeQuery();
if(rs.next())
{
countPalletNo = rs.getInt(1);
}
if(pstmt != null){pstmt.close();pstmt = null;}
if(rs != null){rs.close();rs = null;}
for (ctr = 0; ctr < childNodeListLength; ctr++)
{
childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName();
System.out.println("childNodeName ------->>["+childNodeName+"]");
//System.out.println("childNodeName ------->>["+childNodeName+"]");
/*
if("loc_code".equalsIgnoreCase(childNodeName))
{
......@@ -225,28 +212,48 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
}*/
if("pallet_no".equalsIgnoreCase(childNodeName))
{
if(palletNo.length() <= 0)
if(palletNo.length() <= 0) // blank
{
System.out.println("Pallet No length less than 0 :::::::::: ");
errCode = "VMNLPALLET";
errList.add( errCode );
errFields.add(childNodeName.toLowerCase());
}
else if(!palletList.contains(palletNo) && palletNo.length() > 0)
else
{
palletNoCount = getPalletNoCount(palletNo, loginSite, conn);
if(palletNoCount <= 0 && palletNo.length() > 0) // exist in location
{
System.out.println("Invalid Pallet No :::::::::: ");
errCode = "INVPALTNO";
errList.add( errCode );
errFields.add(childNodeName.toLowerCase());
}
else if(palletQty > 0)
else
{
palletQty = getPalletNoQty(palletNo, loginSite, conn);
if(palletQty > 0)
{
System.out.println("Pallet is not empty :::::::::: ");
errCode = "VMPALLETNO";
errList.add( errCode );
errFields.add(childNodeName.toLowerCase());
}
else
{
palletAWMSCount = getPalletAWMSCount(palletNo, conn);
if(palletAWMSCount > 0)
{
System.out.println("Pallet No still transist, interface table :::::::::: ");
errCode = "VTINOUTPL";
errList.add( errCode );
errFields.add(childNodeName.toLowerCase());
}
}
}
}
/*if(locationCode.equals(palletNo))
{
......@@ -262,13 +269,6 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
errList.add( errCode );
errFields.add(childNodeName.toLowerCase());
}*/
if(countPalletNo > 0)
{
System.out.println("Pallet No still transist, interface table :::::::::: ");
errCode = "VTINOUTPL";
errList.add( errCode );
errFields.add(childNodeName.toLowerCase());
}
}
}
break;
......@@ -294,7 +294,7 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
{
childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName();
System.out.println("value of child node name ["+childNodeName + "]");
//System.out.println("value of child node name ["+childNodeName + "]");
if("".equalsIgnoreCase(tranType))
{
......@@ -403,7 +403,7 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
{
childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName();
System.out.println("childNodeName ------->>["+childNodeName+"]");
//System.out.println("childNodeName ------->>["+childNodeName+"]");
if("lot_sl".equalsIgnoreCase(childNodeName))
{
......@@ -515,7 +515,7 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
}
catch(Exception e)
{
System.out.println( "Exception : MultiplePtcnWiz:wfValData : " + e.getMessage() );
System.out.println( "Exception : PalletizationIC:wfValData : " + e.getMessage() );
throw new ITMException(e);
}
}
......@@ -626,11 +626,10 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
{
quantity = rs.getInt(1);
}
System.out.println("quantity in getPalletNo :::::::::: " + quantity);
}
catch(Exception e)
{
System.out.println("Exception in locCode " + e);
System.out.println("Exception in getPalletNoQty ::::::::: " + e);
e.printStackTrace();
throw new Exception(e);
}
......@@ -647,32 +646,35 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
pstmt = null;
}
}
System.out.println("Return from getPalletNo------>>" + quantity);
System.out.println("Return from getPalletNoQty ------>>" + quantity);
return quantity;
}
private ArrayList<String> getPalletNoList(String loginSite, Connection conn) throws Exception
//private ArrayList<String> getPalletNoList(String loginSite, Connection conn) throws Exception
private int getPalletNoCount(String palletNo, String loginSite, Connection conn) throws Exception
{
ArrayList<String> colVal = new ArrayList<String>();
//ArrayList<String> colVal = new ArrayList<String>();
PreparedStatement pstmt = null ;
ResultSet rs = null ;
String sql = "";
String location = "";
int count = 0;
try
{
sql = "select distinct(loc_code) as loc_code from location where site_code = ? and inv_stat = ? ";
sql = "select count(loc_code) from location where site_code = ? and inv_stat = ? and loc_code = ? ";
//sql = "select distinct(loc_code) as loc_code from location where site_code = ? and inv_stat = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, loginSite);
pstmt.setString(2, "AWMS");
pstmt.setString(3, palletNo);
rs = pstmt.executeQuery();
while(rs.next())
if(rs.next())
{
colVal.add(checkNull(rs.getString("loc_code")));
//colVal.add(checkNull(rs.getString("loc_code")));
count = rs.getInt(1);
}
System.out.println("Location in getLocation :::::::::: " + location);
}
catch(Exception e)
{
System.out.println("Exception in locCode " + e);
System.out.println("Exception in getPalletNoCount ::::::: " + e);
e.printStackTrace();
throw new Exception(e);
}
......@@ -689,8 +691,49 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
pstmt = null;
}
}
System.out.println("Return List from getLocation------>>" + colVal);
return colVal;
System.out.println("return value from getPalletNoCount :::::::::: " + count);
return count;
}
private int getPalletAWMSCount(String palletNo, Connection conn) throws Exception
{
PreparedStatement pstmt = null ;
ResultSet rs = null ;
String sql = "";
int count = 0;
try
{
sql ="select count(*) from swms_to_awms where pallet_no = ? and schedule_status is null and ref_ser = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, palletNo);
pstmt.setString(2, "PZ");
rs = pstmt.executeQuery();
if(rs.next())
{
count = rs.getInt(1);
}
}
catch(Exception e)
{
System.out.println("Exception in getPalletAWMSCount ::::::: " + 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 getPalletAWMSCount :::::::::: " + count);
return count;
}
/**
......
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