Commit 84707f5d authored by jshinde's avatar jshinde

Updated ScheduleAWMSInOutTasks


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@103589 ce508802-f39f-4f6c-b175-0d175dae99d5
parent cacd2b07
......@@ -1598,7 +1598,8 @@ public class ScheduleAWMSInOutTasks implements Schedule
String itemSerRg = "",locGroup = "",QcStatus = "",exempted = "",locCodeToReturn = "",itemSerRgDisparm = "";
PreparedStatement pstmt=null;
ResultSet rs = null;
String sql = "";
String sql = "",sqlQcOrder= "",sqlOtherSite ="",available ="";//Changed by Jagruti Shinde Request Id:[W16FSUN009]
int countQcOrder = 0;
try
{
exempted = checkNullAndTrim(distComm.getDisparams("999999", "EXTEMP_LOC_PARM" , conn));
......@@ -1606,145 +1607,206 @@ public class ScheduleAWMSInOutTasks implements Schedule
System.out.println("ITEM_SER_RG1 found from disparm["+itemSerRgDisparm+"]");
System.out.println("Exempted found from disparm["+exempted+"]");
//sql = "SELECT LOC_GROUP FROM LOCATION WHERE LOC_CODE = ? AND SITE_CODE = ?";//Changed by wasim on 19-02-2016 as site code not required
sql = "SELECT LOC_GROUP FROM LOCATION WHERE LOC_CODE = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, locCodeFrom);
//Changed by Jagruti Shinde for palletization stock transfer location should be check whether it is quarantine or approved if qc_order is created at one site and palletization is done on another side Request Id:[W16FSUN009].[Start]
//sqlQcOrder="SELECT COUNT(*) FROM QC_ORDER WHERE SITE_CODE = ? AND ITEM_CODE = ? AND LOT_NO = ? AND STATUS = ? ";
sqlQcOrder="SELECT COUNT(*) FROM QC_ORDER WHERE SITE_CODE = ? AND ITEM_CODE = ? AND LOT_NO = ? ";
pstmt = conn.prepareStatement(sqlQcOrder);
pstmt.setString(1,siteCode);
pstmt.setString(2,itemCode);
pstmt.setString(3,lotNo);
// pstmt.setString(4,"U");
rs = pstmt.executeQuery();
if(rs.next())
{
locGroup = checkNullAndTrim(rs.getString("LOC_GROUP"));
countQcOrder = rs.getInt(1);
}
rs.close();rs = null;
pstmt.close();pstmt = null;
System.out.println("Location group found from location["+locGroup+"]");
String[] exp = exempted.split(",");
String disparmExemp = "";
boolean exempFlag = false;
System.out.println("Exemp Disparm Lenght="+exp.length);
for (int j = 0; j < exp.length; j++)
if(pstmt!=null)
{
disparmExemp = exp[j].trim();
System.out.println("item ser rg1 disparm=["+disparmExemp+"] and site item rg1["+locGroup+"]");
if(disparmExemp.equalsIgnoreCase(locGroup))
{
System.out.println("****Match found in disparm for"+locGroup);
exempted = locGroup;
exempFlag = true;
break;
}
else
{
System.out.println("****Match not found****");
}
pstmt.close();
pstmt = null;
}
System.out.println("####Final flag for Exempted="+exempFlag);
sql = "SELECT ITEM_SER__RG1 FROM SITEITEM WHERE ITEM_CODE = ? AND SITE_CODE = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, itemCode);
pstmt.setString(2, siteCode);
rs = pstmt.executeQuery();
if(rs.next())
if(rs!=null)
{
itemSerRg = checkNullAndTrim(rs.getString("ITEM_SER__RG1"));
rs.close();
rs = null;
}
rs.close();rs = null;
pstmt.close();pstmt = null;
System.out.println("Item series RG found from item["+itemSerRg+"]");
String[] rg1 = itemSerRgDisparm.split(",");
String disparmRg1 = "";
boolean flag = false;
System.out.println("Disparm Lenght="+rg1.length);
for (int x = 0; x < rg1.length; x++)
if(countQcOrder > 0)
{
disparmRg1 = rg1[x].trim();
System.out.println("item ser rg1 disparm=["+disparmRg1+"] and site item rg1["+itemSerRg+"]");
if(disparmRg1.equalsIgnoreCase(itemSerRg))
System.out.println("countQcOrder is greter than 0:::"+countQcOrder);
//Changed by Jagruti Shinde for palletization stock transfer location should be check whether it is quarantine or approved if qc_order is created at one site and palletization is done on another side Request Id:[W16FSUN009].[End]
//sql = "SELECT LOC_GROUP FROM LOCATION WHERE LOC_CODE = ? AND SITE_CODE = ?";//Changed by wasim on 19-02-2016 as site code not required
sql = "SELECT LOC_GROUP FROM LOCATION WHERE LOC_CODE = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, locCodeFrom);
rs = pstmt.executeQuery();
if(rs.next())
{
System.out.println("****Match found in disparm for"+itemSerRg);
itemSerRgDisparm = itemSerRg;
flag = true;
break;
locGroup = checkNullAndTrim(rs.getString("LOC_GROUP"));
}
else
rs.close();rs = null;
pstmt.close();pstmt = null;
System.out.println("Location group found from location["+locGroup+"]");
String[] exp = exempted.split(",");
String disparmExemp = "";
boolean exempFlag = false;
System.out.println("Exemp Disparm Lenght="+exp.length);
for (int j = 0; j < exp.length; j++)
{
System.out.println("****Match not found****");
disparmExemp = exp[j].trim();
System.out.println("item ser rg1 disparm=["+disparmExemp+"] and site item rg1["+locGroup+"]");
if(disparmExemp.equalsIgnoreCase(locGroup))
{
System.out.println("****Match found in disparm for"+locGroup);
exempted = locGroup;
exempFlag = true;
break;
}
else
{
System.out.println("****Match not found****");
}
}
System.out.println("####Final flag for Exempted="+exempFlag);
sql = "SELECT ITEM_SER__RG1 FROM SITEITEM WHERE ITEM_CODE = ? AND SITE_CODE = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, itemCode);
pstmt.setString(2, siteCode);
rs = pstmt.executeQuery();
if(rs.next())
{
itemSerRg = checkNullAndTrim(rs.getString("ITEM_SER__RG1"));
}
rs.close();rs = null;
pstmt.close();pstmt = null;
System.out.println("Item series RG found from item["+itemSerRg+"]");
String[] rg1 = itemSerRgDisparm.split(",");
String disparmRg1 = "";
boolean flag = false;
System.out.println("Disparm Lenght="+rg1.length);
for (int x = 0; x < rg1.length; x++)
{
disparmRg1 = rg1[x].trim();
System.out.println("item ser rg1 disparm=["+disparmRg1+"] and site item rg1["+itemSerRg+"]");
if(disparmRg1.equalsIgnoreCase(itemSerRg))
{
System.out.println("****Match found in disparm for"+itemSerRg);
itemSerRgDisparm = itemSerRg;
flag = true;
break;
}
else
{
System.out.println("****Match not found****");
}
}
System.out.println("####Final flag for item ser rg1="+flag);
sql = "SELECT STATUS FROM QC_ORDER WHERE SITE_CODE = ? AND ITEM_CODE = ? AND LOT_NO = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, siteCode);
pstmt.setString(2, itemCode);
pstmt.setString(3, lotNo);
rs = pstmt.executeQuery();
if(rs.next())
{
QcStatus = checkNullAndTrim(rs.getString("STATUS"));
}
rs.close();rs = null;
pstmt.close();pstmt = null;
System.out.println("QC Status found from QC_ORDER1["+QcStatus+"]");
if(QcStatus == null || QcStatus.length() == 0 || !"U".equalsIgnoreCase(QcStatus))
{
QcStatus = "NA";
}
//if(locGroup == null || locGroup.length() == 0 || !exempted.equalsIgnoreCase(locGroup))
if(locGroup == null || locGroup.length() == 0 || !exempFlag)
{
locGroup = "NA";
}
//if(itemSerRg == null || itemSerRg.length() == 0 || !itemSerRgDisparm.equalsIgnoreCase(itemSerRg))
if(itemSerRg == null || itemSerRg.length() == 0 || !flag)
{
itemSerRg = "NA";
}
System.out.println("********Loc Group["+locGroup+"]Item RG1["+itemSerRg+"]QC Status["+QcStatus+"]**********");
if(exempted.equalsIgnoreCase(locGroup) && itemSerRgDisparm.equalsIgnoreCase(itemSerRg) && "U".equalsIgnoreCase(QcStatus))
{
locCodeToReturn = locCodeTo + "U";
}
else if(exempted.equalsIgnoreCase(locGroup) && itemSerRgDisparm.equalsIgnoreCase(itemSerRg) && "NA".equalsIgnoreCase(QcStatus))
{
locCodeToReturn = locCodeTo + "P";
}
else if(exempted.equalsIgnoreCase(locGroup) && "NA".equalsIgnoreCase(itemSerRg) && "U".equalsIgnoreCase(QcStatus))
{
locCodeToReturn = locCodeTo + "M";
}
else if(exempted.equalsIgnoreCase(locGroup) && "NA".equalsIgnoreCase(itemSerRg) && "NA".equalsIgnoreCase(QcStatus))
{
locCodeToReturn = locCodeTo + "X";
}
else if("NA".equalsIgnoreCase(locGroup) && itemSerRgDisparm.equalsIgnoreCase(itemSerRg) && "NA".equalsIgnoreCase(QcStatus))
{
locCodeToReturn = locCodeTo + "B";
}
else if("NA".equalsIgnoreCase(locGroup) && itemSerRgDisparm.equalsIgnoreCase(itemSerRg) && "U".equalsIgnoreCase(QcStatus))
{
locCodeToReturn = locCodeTo + "S";
}
else if("NA".equalsIgnoreCase(locGroup) && "NA".equalsIgnoreCase(itemSerRg) && "U".equalsIgnoreCase(QcStatus))
{
locCodeToReturn = locCodeTo + "Q";
}
else if("NA".equalsIgnoreCase(locGroup) && "NA".equalsIgnoreCase(itemSerRg) && "NA".equalsIgnoreCase(QcStatus))
{
locCodeToReturn = locCodeTo;
}
//Changed by Jagruti Shinde for palletization stock transfer location should be check whether it is quarantine or approved if qc_order is created at one site and palletization is done on another side Request Id:[W16FSUN009].[Start]
}
System.out.println("####Final flag for item ser rg1="+flag);
sql = "SELECT STATUS FROM QC_ORDER WHERE SITE_CODE = ? AND ITEM_CODE = ? AND LOT_NO = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, siteCode);
pstmt.setString(2, itemCode);
pstmt.setString(3, lotNo);
rs = pstmt.executeQuery();
if(rs.next())
{
QcStatus = checkNullAndTrim(rs.getString("STATUS"));
}
rs.close();rs = null;
pstmt.close();pstmt = null;
System.out.println("QC Status found from QC_ORDER1["+QcStatus+"]");
if(QcStatus == null || QcStatus.length() == 0 || !"U".equalsIgnoreCase(QcStatus))
{
QcStatus = "NA";
}
//if(locGroup == null || locGroup.length() == 0 || !exempted.equalsIgnoreCase(locGroup))
if(locGroup == null || locGroup.length() == 0 || !exempFlag)
{
locGroup = "NA";
}
//if(itemSerRg == null || itemSerRg.length() == 0 || !itemSerRgDisparm.equalsIgnoreCase(itemSerRg))
if(itemSerRg == null || itemSerRg.length() == 0 || !flag)
{
itemSerRg = "NA";
}
System.out.println("********Loc Group["+locGroup+"]Item RG1["+itemSerRg+"]QC Status["+QcStatus+"]**********");
if(exempted.equalsIgnoreCase(locGroup) && itemSerRgDisparm.equalsIgnoreCase(itemSerRg) && "U".equalsIgnoreCase(QcStatus))
{
locCodeToReturn = locCodeTo + "U";
}
else if(exempted.equalsIgnoreCase(locGroup) && itemSerRgDisparm.equalsIgnoreCase(itemSerRg) && "NA".equalsIgnoreCase(QcStatus))
{
locCodeToReturn = locCodeTo + "P";
}
else if(exempted.equalsIgnoreCase(locGroup) && "NA".equalsIgnoreCase(itemSerRg) && "U".equalsIgnoreCase(QcStatus))
{
locCodeToReturn = locCodeTo + "M";
}
else if(exempted.equalsIgnoreCase(locGroup) && "NA".equalsIgnoreCase(itemSerRg) && "NA".equalsIgnoreCase(QcStatus))
{
locCodeToReturn = locCodeTo + "X";
}
else if("NA".equalsIgnoreCase(locGroup) && itemSerRgDisparm.equalsIgnoreCase(itemSerRg) && "NA".equalsIgnoreCase(QcStatus))
{
locCodeToReturn = locCodeTo + "B";
}
else if("NA".equalsIgnoreCase(locGroup) && itemSerRgDisparm.equalsIgnoreCase(itemSerRg) && "U".equalsIgnoreCase(QcStatus))
{
locCodeToReturn = locCodeTo + "S";
}
else if("NA".equalsIgnoreCase(locGroup) && "NA".equalsIgnoreCase(itemSerRg) && "U".equalsIgnoreCase(QcStatus))
{
locCodeToReturn = locCodeTo + "Q";
}
else if("NA".equalsIgnoreCase(locGroup) && "NA".equalsIgnoreCase(itemSerRg) && "NA".equalsIgnoreCase(QcStatus))
else
{
locCodeToReturn = locCodeTo;
sqlOtherSite="SELECT AVAILABLE FROM INVSTAT WHERE INV_STAT IN (SELECT INV_STAT FROM LOCATION WHERE LOC_CODE = ?)";
pstmt = conn.prepareStatement(sqlOtherSite);
pstmt.setString(1, locCodeFrom);
rs = pstmt.executeQuery();
if(rs.next())
{
available = checkNullAndTrim(rs.getString("AVAILABLE"));
}
if(pstmt!=null)
{
pstmt.close();
pstmt = null;
}
if(rs!=null)
{
rs.close();
rs = null;
}
if("N".equalsIgnoreCase(available))
{
locCodeToReturn = locCodeTo + "Q";
System.out.println("locCodeToReturn for available 'N':::::::"+locCodeToReturn);
}
else if("Y".equalsIgnoreCase(available))
{
locCodeToReturn = locCodeTo;
System.out.println("locCodeToReturn for available 'Y':::::::"+locCodeToReturn);
}
}
//Changed by Jagruti Shinde for palletization stock transfer location should be check whether it is quarantine or approved if qc_order is created at one site and palletization is done on another side Request Id:[W16FSUN009].[End]
}
catch(Exception e)
{
......@@ -1766,6 +1828,6 @@ public class ScheduleAWMSInOutTasks implements Schedule
System.out.println("Location code returing["+locCodeToReturn+"]");
return locCodeToReturn;
}
}
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