Commit dd52b2d5 authored by smanohar's avatar smanohar

Before deleting old machine load and tool plan and reallocating check for existing old plan

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@216867 ce508802-f39f-4f6c-b175-0d175dae99d5
parent a5f99958
...@@ -299,7 +299,11 @@ public class WorkOrderRouteAltConf extends ActionHandlerEJB implements WorkOrde ...@@ -299,7 +299,11 @@ public class WorkOrderRouteAltConf extends ActionHandlerEJB implements WorkOrde
HashMap machineLoadMap=new HashMap(); HashMap machineLoadMap=new HashMap();
HashMap mcLoadMap=new HashMap(); HashMap mcLoadMap=new HashMap();
HashMap mcLoadDetMap=new HashMap(); HashMap mcLoadDetMap=new HashMap();
boolean updMachineLoad = false; // 19-Feb-2020 manoharan whether machine load exists
try{ try{
sql="select amd_date,work_order,operation,work_ctr,mc_code,mc_code__o,operation_parent" sql="select amd_date,work_order,operation,work_ctr,mc_code,mc_code__o,operation_parent"
+ " from worder_route_alt where amd_no = ?"; + " from worder_route_alt where amd_no = ?";
pstmt=conn.prepareStatement(sql); pstmt=conn.prepareStatement(sql);
...@@ -338,7 +342,17 @@ public class WorkOrderRouteAltConf extends ActionHandlerEJB implements WorkOrde ...@@ -338,7 +342,17 @@ public class WorkOrderRouteAltConf extends ActionHandlerEJB implements WorkOrde
rs=null; rs=null;
pstmt.close(); pstmt.close();
pstmt=null; pstmt=null;
/////////////////////////////////////////////////////////////////////////////////////////////////////////
sql = "SELECT count(1) FROM work_calendar, workshft "
+ " WHERE ( work_calendar.site_code = workshft.site_code ) "
+ " and ( work_calendar.day_no = workshft.day_no ) "
+ " and ( work_calendar.shift = workshft.shift ) "
+ " and ( ( work_calendar.working = 'Y' ) "
+ " aND ( work_calendar.confirmed = 'Y' ) "
+ " AND ( work_calendar.site_code = ? ) "
+ " AND ( work_calendar.work_date >= ? ) ) ";
/////////////////////////////////////////////////////////////////////////////////////////////////////////
condParam.add("operation"); condParam.add("operation");
condParam.add("work_order"); condParam.add("work_order");
condParam.add(Integer.toString(operation)); condParam.add(Integer.toString(operation));
...@@ -477,6 +491,7 @@ public class WorkOrderRouteAltConf extends ActionHandlerEJB implements WorkOrde ...@@ -477,6 +491,7 @@ public class WorkOrderRouteAltConf extends ActionHandlerEJB implements WorkOrde
pstmt.setInt(4, operation); pstmt.setInt(4, operation);
rs=pstmt.executeQuery(); rs=pstmt.executeQuery();
while(rs.next()){ while(rs.next()){
updMachineLoad = true; // 19-Feb-2020 manoharan whether machine load exists
detSiteCode=checkNull(rs.getString(1)); detSiteCode=checkNull(rs.getString(1));
detLoadDate=rs.getTimestamp(2); detLoadDate=rs.getTimestamp(2);
detWorkCtr=checkNull(rs.getString(3)); detWorkCtr=checkNull(rs.getString(3));
...@@ -503,6 +518,8 @@ public class WorkOrderRouteAltConf extends ActionHandlerEJB implements WorkOrde ...@@ -503,6 +518,8 @@ public class WorkOrderRouteAltConf extends ActionHandlerEJB implements WorkOrde
rs=null; rs=null;
pstmt.close(); pstmt.close();
pstmt=null; pstmt=null;
if (updMachineLoad) // 19-Feb-2020 manoharan whether machine load exists
{
sql="Delete From machine_load_det Where work_ctr = ? and mc_code = ? " sql="Delete From machine_load_det Where work_ctr = ? and mc_code = ? "
+ "and work_order = ? and operation = ?"; + "and work_order = ? and operation = ?";
pstmt=conn.prepareStatement(sql); pstmt=conn.prepareStatement(sql);
...@@ -524,6 +541,7 @@ public class WorkOrderRouteAltConf extends ActionHandlerEJB implements WorkOrde ...@@ -524,6 +541,7 @@ public class WorkOrderRouteAltConf extends ActionHandlerEJB implements WorkOrde
cnt=0; cnt=0;
cnt=pstmt.executeUpdate(); cnt=pstmt.executeUpdate();
System.out.println("No. of rows are deleted machine_load_det---->>["+cnt+"]"); System.out.println("No. of rows are deleted machine_load_det---->>["+cnt+"]");
}
// now allocate the new machine // now allocate the new machine
...@@ -676,6 +694,9 @@ public class WorkOrderRouteAltConf extends ActionHandlerEJB implements WorkOrde ...@@ -676,6 +694,9 @@ public class WorkOrderRouteAltConf extends ActionHandlerEJB implements WorkOrde
} }
} }
} //end startRow } //end startRow
if(rs!=null) if(rs!=null)
rs.beforeFirst(); rs.beforeFirst();
...@@ -696,6 +717,8 @@ public class WorkOrderRouteAltConf extends ActionHandlerEJB implements WorkOrde ...@@ -696,6 +717,8 @@ public class WorkOrderRouteAltConf extends ActionHandlerEJB implements WorkOrde
pstmt.setString(4, shift);*/ pstmt.setString(4, shift);*/
rs=pstmt.executeQuery(); rs=pstmt.executeQuery();
} }
if (updMachineLoad) // 19-Feb-2020 manoharan whether machine load exists
{
// now we have the calEndar in order just allocate For the no. of shifts // now we have the calEndar in order just allocate For the no. of shifts
for(int i=1; i<=noOfShiftsActual;i++){ for(int i=1; i<=noOfShiftsActual;i++){
...@@ -755,6 +778,7 @@ public class WorkOrderRouteAltConf extends ActionHandlerEJB implements WorkOrde ...@@ -755,6 +778,7 @@ public class WorkOrderRouteAltConf extends ActionHandlerEJB implements WorkOrde
} }
}//end for loop }//end for loop
}
rs.close(); rs.close();
rs=null; rs=null;
pstmt.close(); pstmt.close();
......
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