Commit 8304b90b authored by dpawar's avatar dpawar

change update query of worder_route


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@94408 ce508802-f39f-4f6c-b175-0d175dae99d5
parent f98fdde5
......@@ -173,10 +173,12 @@ public class WorkOrderRouteAltConf extends ActionHandlerEJB implements WorkOrde
private String gbfRetrieveWoRouteAlt(String amdNo,String xtraParams,Connection conn)
{
String sql="",errcode = "", conf="", mcCode="" , worder="",dbName="";
String loginEmpCode="",loginSite="";
String sql="",errcode = "", conf="", mcCode="" , worder="",dbName="",itemCode="",procCode="";
String loginEmpCode="",loginSite="",workCtr="",workCtrOld="",mcCodeOld="";
int operation=0,cnt=0;
double waitT=0,setT=0,resetT=0,runT=0;
ArrayList <String> updateParamList =new ArrayList();
Map <String,String> updateParamMap=new HashMap<String,String>();
ResultSet rs=null;
PreparedStatement pstmt=null;
GenericUtility genericUtility=GenericUtility.getInstance();
......@@ -192,27 +194,63 @@ public class WorkOrderRouteAltConf extends ActionHandlerEJB implements WorkOrde
if(errcode.length() == 0){
sql="select work_order,operation,mc_code from worder_route_alt where amd_no= ?";
sql="select work_order,operation,item_code,proc_code,wait_time,set_time,run_time,reset_time,work_ctr,"
+ "mc_code,work_ctr__o,mc_code__o from worder_route_alt where amd_no= ?";
pstmt=conn.prepareStatement(sql);
pstmt.setString(1, amdNo);
rs=pstmt.executeQuery();
if(rs.next()){
worder=rs.getString(1);
worder=checkNull(rs.getString(1));
operation=rs.getInt(2);
mcCode=rs.getString(3);
itemCode=checkNull(rs.getString(3));
procCode=checkNull(rs.getString(4));
waitT=rs.getDouble(5);
setT=rs.getDouble(6);
runT=rs.getDouble(7);
resetT=rs.getDouble(8);
workCtr=checkNull(rs.getString(9));
mcCode=checkNull(rs.getString(10));
workCtrOld=checkNull(rs.getString(11));
mcCodeOld=checkNull(rs.getString(12));
}
if(rs!=null){
rs.close();
rs=null;
}
if(pstmt!=null){
pstmt.close();
pstmt=null;
}
System.out.println("worder---->"+worder);
System.out.println("operation---->"+operation);
System.out.println("mccode---->"+mcCode);
updateParamList.add(mcCode);
updateParamList.add(worder);
updateParamList.add(Integer.toString(operation));
updateParamList.add("Y");
updateParamList.add(loginEmpCode);
updateParamList.add(amdNo);
System.out.println("workCtr---->"+workCtr);
if(workCtr.length() == 0){
workCtr=workCtrOld;
}
if(mcCode.length() == 0){
mcCode=mcCodeOld;
}
updateParamMap.put("mcCode", mcCode);
updateParamMap.put("worder", worder);
updateParamMap.put("operation", Integer.toString(operation));
updateParamMap.put("confirmed", "Y");
updateParamMap.put("loginEmpCode", loginEmpCode);
updateParamMap.put("amdNo", amdNo);
updateParamMap.put("workCtr", workCtr);
updateParamMap.put("itemCode", itemCode);
updateParamMap.put("procCode", procCode);
updateParamMap.put("waitT", Double.toString(waitT));
updateParamMap.put("setT", Double.toString(setT));
updateParamMap.put("runT", Double.toString(runT));
updateParamMap.put("resetT", Double.toString(resetT));
// update worder_route and worder_route_alt table
cnt =updateOnConfirmation(conn,updateParamList);
cnt =updateOnConfirmation(conn,updateParamMap);
System.out.println("Return int from updateOnConfirmation--->>["+cnt+"]");
/*if (cnt > 0){
conn.commit();
......@@ -246,7 +284,7 @@ public class WorkOrderRouteAltConf extends ActionHandlerEJB implements WorkOrde
String chgStat="1",operStat="1",qcType="N",shift="",startTime="",procCode="",current="",inTime="";
String detSiteCode="",detWorkCtr="",detMcCode="",detDayNo="",detShift="" ,routeCode="",dayNo="";
java.sql.Timestamp admDate=null;
int operation=0,seqNo=0,cnt=0,seqNo1=0,rows=0,startRow=0,error=0;
int operation=0,seqNo=0,cnt=0,seqNo1=0,rows=0,startRow=0,error=0,ParentOpert=0;
double workOrderQty=0,waitTime=0,setTime=0,runTime=0,resetTime=0,bomBatchQty=0,mcCapacityOri=0,wcBatchQty=0;
double processSizeOriginal=0,operLevel=0,decPrSize=0,noOfShiftsOriginal=0,noOfShiftsActual=0,machineCapacity=0;
ArrayList<String> condParam=new ArrayList();
......@@ -256,7 +294,8 @@ public class WorkOrderRouteAltConf extends ActionHandlerEJB implements WorkOrde
HashMap mcLoadMap=new HashMap();
HashMap mcLoadDetMap=new HashMap();
try{
sql="select amd_date,work_order,operation,work_ctr,mc_code,mc_code__o from worder_route_alt where amd_no = ?";
sql="select amd_date,work_order,operation,work_ctr,mc_code,mc_code__o,operation_parent"
+ " from worder_route_alt where amd_no = ?";
pstmt=conn.prepareStatement(sql);
pstmt.setString(1, amdNo);
rs=pstmt.executeQuery();
......@@ -266,10 +305,12 @@ public class WorkOrderRouteAltConf extends ActionHandlerEJB implements WorkOrde
operation=rs.getInt(3);
workctr=checkNull(rs.getString(4));
mcCode=checkNull(rs.getString(5));
mcCodeOld=checkNull(rs.getString(6));
mcCodeOld=checkNull(rs.getString(6));
ParentOpert=rs.getInt(7);
}
System.out.println("mcCode------->>["+mcCode+"]");
System.out.println("mcCodeOld------->>["+mcCodeOld+"]");
System.out.println("Parent operation------->>["+ParentOpert+"]");
rs.close();
rs=null;
pstmt.close();
......@@ -300,16 +341,18 @@ public class WorkOrderRouteAltConf extends ActionHandlerEJB implements WorkOrde
System.out.println("count return from getDBRowCount--->["+cnt+"]");
if(cnt == 0){
sql="select worder_route_alt.chg_date,worder_route_alt.chg_user,worder_route_alt.chg_term," //3
+ "worder_route.seq_no,worder_route.route_code,worder_route.item_code,worder_route.wait_time," //7
+ "worder_route.set_time,worder_route.run_time,worder_route.reset_time,worder_route.proc_code " //11
+ "from worder_route_alt,worder_route,item,machines,process "
+ "where worder_route_alt.work_order = worder_route.work_order and "
+ "worder_route_alt.operation = worder_route.operation and "
+ "worder_route.proc_code = process.proc_code and "
+ "worder_route.item_code = item.item_code and "
+ "worder_route_alt.mc_code = machines.mc_code and "
+ "worder_route_alt.amd_no= ? ";
sql="select worder_route_alt.chg_date,worder_route_alt.chg_user,worder_route_alt.chg_term,"+
"worder_route.seq_no,worder_route.route_code,worder_route_alt.item_code,"+
"worder_route_alt.wait_time,worder_route_alt.set_time,worder_route_alt.run_time,"+
"worder_route_alt.reset_time,worder_route_alt.proc_code "+
"from worder_route_alt,worder_route,item,machines,process,employee,workorder "+
"where ( worder_route_alt.emp_code__aprv = employee.emp_code (+)) and "+
"( worder_route_alt.work_order = worder_route.work_order (+)) and "+
"( worder_route_alt.mc_code = machines.mc_code (+)) and "+
"( worder_route_alt.work_order = workorder.work_order (+)) and "+
"( worder_route_alt.item_code = item.item_code ) and "+
"( worder_route_alt.proc_code = process.proc_code (+)) and "+
"( ( worder_route_alt.amd_no = ? ) )";
pstmt=conn.prepareStatement(sql);
pstmt.setString(1, amdNo);
......@@ -332,6 +375,9 @@ public class WorkOrderRouteAltConf extends ActionHandlerEJB implements WorkOrde
pstmt.close();
pstmt=null;
System.out.println("itemCode----->>["+itemCode+"]");
System.out.println("proc_code----->>["+proc_code+"]");
sql="insert into worder_route (work_order,operation,proc_code,seq_no,route_code,item_code,"
+ "work_ctr,mc_code ,chg_stat ,oper_stat ,quantity ,wait_time,set_time,run_time,"
+ "reset_time ,chg_date ,chg_user ,chg_term ,qc_type,operation_level ) "
......@@ -1095,19 +1141,29 @@ public class WorkOrderRouteAltConf extends ActionHandlerEJB implements WorkOrde
}
return 1;
}
private int updateOnConfirmation(Connection conn,ArrayList<String>updateParamListL)
private int updateOnConfirmation(Connection conn,Map<String,String>updateParamMapL)
{
System.out.println("updateOnConfirmation--->>["+updateParamListL+"]");
//[T-PRK , BPRFE0001 , 15, Y, E01712 , WOE0007]
System.out.println("updateOnConfirmation--->>["+updateParamMapL+"]");
PreparedStatement pstmt=null;
int count=0;
String sql = "",sql1="";
try{
sql="update worder_route set mc_code = ? where work_order = ? and operation = ?";
//sql="update worder_route set mc_code = ? where work_order = ? and operation = ?";
sql="update worder_route set mc_code = ?,item_code = ?,proc_code = ?,wait_time = ?,set_time = ?,"
+ "run_time = ?,reset_time = ?,work_ctr =? where work_order = ? and operation = ?";
pstmt=conn.prepareStatement(sql);
pstmt.setString(1, updateParamListL.get(0));
pstmt.setString(2, updateParamListL.get(1));
pstmt.setInt(3, Integer.parseInt(updateParamListL.get(2)));
pstmt.setString(1, updateParamMapL.get("mcCode"));
pstmt.setString(2, updateParamMapL.get("itemCode"));
pstmt.setString(3, updateParamMapL.get("procCode"));
pstmt.setDouble(4, Double.parseDouble(updateParamMapL.get("waitT")));
pstmt.setDouble(5, Double.parseDouble(updateParamMapL.get("setT")));
pstmt.setDouble(6, Double.parseDouble(updateParamMapL.get("runT")));
pstmt.setDouble(7, Double.parseDouble(updateParamMapL.get("resetT")));
pstmt.setString(8, updateParamMapL.get("workCtr"));
pstmt.setString(9, updateParamMapL.get("worder"));
pstmt.setInt(10, Integer.parseInt(updateParamMapL.get("operation")));
count=pstmt.executeUpdate();
if(pstmt!=null){
......@@ -1119,9 +1175,10 @@ public class WorkOrderRouteAltConf extends ActionHandlerEJB implements WorkOrde
sql1="update worder_route_alt set confirmed = ?,conf_date = sysdate,emp_code__aprv = ?"
+ " where amd_no = ?";
pstmt=conn.prepareStatement(sql1);
pstmt.setString(1, updateParamListL.get(3));
pstmt.setString(2,updateParamListL.get(4).trim());
pstmt.setString(3,updateParamListL.get(5).trim());
pstmt.setString(1, updateParamMapL.get("confirmed"));
pstmt.setString(2, updateParamMapL.get("loginEmpCode"));
pstmt.setString(3, updateParamMapL.get("amdNo"));
count=pstmt.executeUpdate();
System.out.println("Second count in updateOnConfirmation-->>["+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