Commit aa31bd9b authored by dpawar's avatar dpawar

handle error and added sql


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@94359 ce508802-f39f-4f6c-b175-0d175dae99d5
parent aa7f2d10
......@@ -114,17 +114,24 @@ public class WorkOrderRouteAlt extends ValidatorEJB implements WorkOrderRouteAlt
workorder = checkNull(genericUtility.getColumnValue("work_order",dom));
operation = checkNull(genericUtility.getColumnValue("operation",dom));
condParam.add("work_ctr");
condParam.add("mc_code");
condParam.add(workctr);
condParam.add(mcCode);
System.out.println("work_ctr---->>["+workctr+"] mc_code---->>["+mcCode+"]");
//check machine is in work center or not
if(workctr.length() > 0 && mcCode.length() > 0){
cnt=getDBRowCount(conn, "workcntr",condParam);
//cnt=getDBRowCount(conn, "workcntr",condParam);
sql="select count(*) from workcntr where work_ctr = ? and mc_code = ?";
pstmt=conn.prepareStatement(sql);
pstmt.setString(1, workctr);
pstmt.setString(2, mcCode);
rs=pstmt.executeQuery();
if(rs.next()){
cnt=rs.getInt(1);
}
rs.close();
rs=null;
pstmt.close();
pstmt=null;
System.out.println("return cnt from getDBRowCount---->>["+cnt+"]");
condParam.clear();
if(cnt==0){
errCode = "VTMCHN";//machine is not in workcenter
errList.add( errCode );
......@@ -133,12 +140,13 @@ public class WorkOrderRouteAlt extends ValidatorEJB implements WorkOrderRouteAlt
}
cnt=0;
condParam.add(0, "work_order");
condParam.add(1, "mc_code");
condParam.add(2, workorder);
condParam.add(3, workctrO);
condParam.add(4, "operation");
condParam.add(5, operation);
condParam.clear();
condParam.add(0, "operation");
condParam.add(1, "work_order");
condParam.add(2, operation);
condParam.add(3, workorder);
condParam.add(4, "mc_code");
condParam.add(5, workctrO);
cnt=getDBRowCount(conn, "worder_route",condParam);
System.out.println("return cnt after getDBRowCount111--->>["+cnt+"]");
condParam.clear();
......@@ -199,6 +207,7 @@ public class WorkOrderRouteAlt extends ValidatorEJB implements WorkOrderRouteAlt
errFields.add( childNodeName.toLowerCase() );
}
count=0;
condParam.clear();
condParam.add("work_ctr");
condParam.add("mc_code");
condParam.add(workctr);
......@@ -210,12 +219,6 @@ public class WorkOrderRouteAlt extends ValidatorEJB implements WorkOrderRouteAlt
errList.add( errCode );
errFields.add( childNodeName.toLowerCase() );
}
/*Select count(1) Into :li_cnt
From workcntr
Where work_ctr = :ls_workctr
And mc_code = :ls_mccode;*/
} //end cnt
......@@ -229,7 +232,6 @@ public class WorkOrderRouteAlt extends ValidatorEJB implements WorkOrderRouteAlt
mcCode = checkNull(genericUtility.getColumnValue("mc_code",dom));
routeCode = checkNull(genericUtility.getColumnValue("route_code",dom));
procCode = checkNull(genericUtility.getColumnValue("proc_code",dom));
condParam.clear();
System.out.println("operation---->>["+operation.length()+"]");
if(operation.length() == 0){
errCode = "VTOPRNN"; // if operation is null then show error.
......@@ -242,7 +244,6 @@ public class WorkOrderRouteAlt extends ValidatorEJB implements WorkOrderRouteAlt
condParam.add("work_order");
condParam.add(operation);
condParam.add(workorder);
System.out.println("getDBrowCount..........1212");
count=getDBRowCount(conn, "worder_route", condParam);
System.out.println("count---->>["+count+"] editflag---->>["+editFlag+"]");
if(count > 0 && editFlag.trim().equalsIgnoreCase("A")){
......@@ -253,6 +254,58 @@ public class WorkOrderRouteAlt extends ValidatorEJB implements WorkOrderRouteAlt
}
}
else if (childNodeName.equalsIgnoreCase("work_order")){
String workorder="",status="";
workorder = checkNull(genericUtility.getColumnValue("work_order",dom));
if(workorder.length() > 0){
sql="select status from workorder where work_order = ?";
pstmt=conn.prepareStatement(sql);
pstmt.setString(1, workorder);
rs=pstmt.executeQuery();
if(rs.next()){
status=checkNull(rs.getString(1));
}
System.out.println("Status------->>["+status+"]");
if(!("R".equalsIgnoreCase(status))){
errCode = "VTWOSRAM";
errList.add( errCode );
errFields.add( childNodeName.toLowerCase() );
}
rs.close();
rs=null;
pstmt.close();
pstmt=null;
}
}
else if (childNodeName.equalsIgnoreCase("operation_parent")){
String parentOpertn="",workorder="",confirmedOpr="";
parentOpertn = checkNull(genericUtility.getColumnValue("operation_parent",dom));
workorder = checkNull(genericUtility.getColumnValue("work_order",dom));
System.out.println("Parent operation---->>["+parentOpertn+"] workorder-->>"+workorder);
if(parentOpertn.length() > 0 && workorder.length() > 0){
sql="select confirmed from workorder_feedback where work_order = ? and operation = ?";
pstmt=conn.prepareStatement(sql);
pstmt.setString(1, workorder);
pstmt.setInt(2, Integer.parseInt(parentOpertn));
rs=pstmt.executeQuery();
if(rs.next()){
confirmedOpr=checkNull(rs.getString(1));
}
rs.close();
rs=null;
pstmt.close();
pstmt=null;
System.out.println("confirmedOpr--->>["+confirmedOpr+"]");
if("N".equalsIgnoreCase(confirmedOpr)){
errCode = "VTOPRFDB";
//errString = getErrorString("site_code",errCode,userId);
errList.add( errCode );
errFields.add( childNodeName.toLowerCase() );
}
}
}
......@@ -264,8 +317,9 @@ public class WorkOrderRouteAlt extends ValidatorEJB implements WorkOrderRouteAlt
String errFldName = null;
if ( errList != null && errListSize > 0 )
{
for (int cnt1 = 0; cnt < errListSize; cnt1++ )
for (int cnt1 = 0; cnt1 < errListSize; cnt1++ )
{
System.out.println("IN ERROR cnt-------["+cnt1+"]");
errCode = (String)errList.get(cnt1);
errFldName = (String)errFields.get(cnt1);
System.out.println("errCode12.........."+errCode);
......@@ -347,9 +401,21 @@ public class WorkOrderRouteAlt extends ValidatorEJB implements WorkOrderRouteAlt
String valueXmlString = "";
try
{
System.out.println("xmlString---->>["+xmlString+"]");
System.out.println("xmlString2---->>["+xmlString2+"]");
System.out.println("xmlString1---->>["+xmlString1+"]");
xmlString=xmlString==null ? "" :xmlString.trim();
xmlString2=xmlString2==null ? "" :xmlString2.trim();
xmlString1=xmlString==null ? "" :xmlString1.trim();
if(xmlString.length() > 0 )
dom = parseString(xmlString);
if(xmlString1.length() > 0 )
dom1 = parseString(xmlString1);
if(xmlString2.length() > 0 )
dom2 = parseString(xmlString2);
valueXmlString = itemChanged(dom,dom1,dom2,objContext,currentColumn,editFlag,xtraParams);
}
catch(Exception e)
......@@ -375,7 +441,7 @@ public class WorkOrderRouteAlt extends ValidatorEJB implements WorkOrderRouteAlt
Node parentNode = null;
Node childNode = null;
int ctr = 0;
String sql="";
String sql="",workorder="",mcCodeDesc="",procCodeDesc="",itemCodeDesc="";
try
{
......@@ -396,38 +462,43 @@ public class WorkOrderRouteAlt extends ValidatorEJB implements WorkOrderRouteAlt
case 1 :
valueXmlString.append("<Detail1>");
System.out.println("[" + currentColumn + "] ==> '" + columnValue + "'");
System.out.println("editFlag =>" +editFlag);
System.out.println("editFlag122 =>" +editFlag);
if( currentColumn.trim().equalsIgnoreCase( "itm_defaultedit" ) )
/*if( currentColumn.trim().equalsIgnoreCase( "itm_defaultedit" ) )
{
valueXmlString.append("<amd_no protect = \"1\">").append("<![CDATA[]]>").append("</amd_no>");
}
*/
if( currentColumn.trim().equalsIgnoreCase( "itm_default" ) )
{
System.out.println("------------in itm_default--------->");
String workorder="",confirm="N";
System.out.println("CURRENT COLUMN---->>["+currentColumn+"]");
System.out.println("Dom in item default---->>[["+genericUtility.serializeDom(dom)+"]]");
System.out.println("Dom in item default---->>[["+genericUtility.serializeDom(dom1)+"]]");
System.out.println("Dom in item default---->>[["+genericUtility.serializeDom(dom2)+"]]");
String confirm="N";
Calendar currentDate = Calendar.getInstance();
SimpleDateFormat simpleDateFormatObj = new SimpleDateFormat(genericUtility.getApplDateFormat());
String tranDate = simpleDateFormatObj.format(currentDate.getTime());
valueXmlString.append("<amd_date>").append("<![CDATA[" + tranDate + "]]>").append("</amd_date>");
workorder = checkNull(genericUtility.getColumnValue("work_order",dom));
workorder=genericUtility.getValueFromXTRA_PARAMS( xtraParams, "work_order");
String routecodeDF=getColumnDescr(conn,"route_code","workorder","work_order",workorder);
System.out.println("work order ------>>"+workorder);
valueXmlString.append("<work_order>").append("<![CDATA[" + workorder + "]]>").append("</work_order>");
valueXmlString.append("<confirmed>").append("<![CDATA[" + confirm + "]]>").append("</confirmed>");
valueXmlString.append("<route_code>").append("<![CDATA[" + routecodeDF + "]]>").append("</route_code>");
}
if (currentColumn.trim().equalsIgnoreCase("operation"))
{
String workOrder="",operation="",oprtn="",procCode="",procCodeDesc="", routecode="";
String itemCode = "",itemCodeDesc="",workctr = "",mcCode= "",mcCodeDesc="";
String workOrder="",operation="",oprtn="",procCode="", routecode="";
String itemCode = "",workctr = "",mcCode= "",oprParent="";
int seqno = 0;
double wtime=0,stime = 0,retime= 0,rutime=0;
operation = checkNull(genericUtility.getColumnValue("operation",dom));
workOrder = checkNull(genericUtility.getColumnValue("work_order",dom));
oprParent = checkNull(genericUtility.getColumnValue("operation_parent",dom));
sql="select operation, proc_code, seq_no,route_code,item_code, work_ctr,"
+ "mc_code,wait_time, set_time, reset_time,run_time from worder_route "
+ "where work_order = ? and operation = ?";
......@@ -455,8 +526,22 @@ public class WorkOrderRouteAlt extends ValidatorEJB implements WorkOrderRouteAlt
pstmt.close();
pstmt=null;
if(oprParent.length() == 0){
valueXmlString.append("<proc_code>").append("<![CDATA[" + procCode + "]]>").append("</proc_code>");
valueXmlString.append("<operation>").append("<![CDATA[" + oprtn + "]]>").append("</operation>");
valueXmlString.append("<work_ctr__o>").append("<![CDATA[" + workctr + "]]>").append("</work_ctr__o>");
valueXmlString.append("<work_ctr>").append("<![CDATA[" + workctr + "]]>").append("</work_ctr>");
valueXmlString.append("<mc_code__o>").append("<![CDATA[" + mcCode + "]]>").append("</mc_code__o>");
valueXmlString.append("<mc_code>").append("<![CDATA[" + mcCode + "]]>").append("</mc_code>");
mcCodeDesc=getColumnDescr(conn,"descr","machines","mc_code",mcCode);
valueXmlString.append("<machines_descr>").append("<![CDATA[" +mcCodeDesc+ "]]>").append("</machines_descr>");
procCodeDesc=getColumnDescr(conn,"descr","process","proc_code",procCode);
valueXmlString.append("<process_descr>").append("<![CDATA[" +procCodeDesc+ "]]>").append("</process_descr>");
}
itemCodeDesc=getColumnDescr(conn,"descr","item","item_code",itemCode);
valueXmlString.append("<item_descr>").append("<![CDATA[" +itemCodeDesc+ "]]>").append("</item_descr>");
// valueXmlString.append("<operation>").append("<![CDATA[" + oprtn + "]]>").append("</operation>");
valueXmlString.append("<seq_no>").append("<![CDATA[" + (seqno == 0 ? "" :seqno) + "]]>").append("</seq_no>");
valueXmlString.append("<route_code>").append("<![CDATA[" + routecode + "]]>").append("</route_code>");
valueXmlString.append("<item_code>").append("<![CDATA[" + itemCode + "]]>").append("</item_code>");
......@@ -472,25 +557,18 @@ public class WorkOrderRouteAlt extends ValidatorEJB implements WorkOrderRouteAlt
valueXmlString.append("<reset_time>").append("<![CDATA[" +retime+ "]]>").append("</reset_time>");
valueXmlString.append("<run_time>").append("<![CDATA[" +rutime+ "]]>").append("</run_time>");
mcCodeDesc=getColumnDescr(conn,"descr","machines","mc_code",mcCode);
valueXmlString.append("<machines_descr>").append("<![CDATA[" +mcCodeDesc+ "]]>").append("</machines_descr>");
itemCodeDesc=getColumnDescr(conn,"descr","item","item_code",itemCode);
valueXmlString.append("<item_descr>").append("<![CDATA[" +itemCodeDesc+ "]]>").append("</item_descr>");
procCodeDesc=getColumnDescr(conn,"descr","process","proc_code",procCode);
valueXmlString.append("<process_descr>").append("<![CDATA[" +procCodeDesc+ "]]>").append("</process_descr>");
}
else if (currentColumn.trim().equalsIgnoreCase("mc_code"))
{
String mcCode="",mcCodeDesc="";
String mcCode="",mcCodeDescL="";
mcCode=checkNull(genericUtility.getColumnValue("mc_code",dom));
mcCodeDesc=getColumnDescr(conn,"descr","machines","mc_code",mcCode);
mcCodeDescL=getColumnDescr(conn,"descr","machines","mc_code",mcCode);
if(mcCodeDesc.length() > 0)
valueXmlString.append("<machines_descr>").append("<![CDATA[" +mcCodeDesc+ "]]>").append("</machines_descr>");
valueXmlString.append("<machines_descr>").append("<![CDATA[" +mcCodeDescL+ "]]>").append("</machines_descr>");
else
valueXmlString.append("<machines_descr>").append("<![CDATA[" +mcCodeDesc+ "]]>").append("</machines_descr>");
valueXmlString.append("<machines_descr>").append("<![CDATA[" +mcCodeDescL+ "]]>").append("</machines_descr>");
}
......@@ -512,6 +590,65 @@ public class WorkOrderRouteAlt extends ValidatorEJB implements WorkOrderRouteAlt
valueXmlString.append("<process_descr>").append("<![CDATA[" +procCodeLDesc+ "]]>").append("</process_descr>");
}
else if(currentColumn.trim().equalsIgnoreCase("operation_parent"))
{
boolean isRecordFound=false;
String operationParent="",procCode="",procCodeLDesc="",workOrd="",workCtrF="",mcCodeF="";
operationParent = checkNull(genericUtility.getColumnValue("operation_parent",dom));
workOrd= checkNull(genericUtility.getColumnValue("work_order",dom));
System.out.println("operationParent dom---->>["+operationParent+"]");
System.out.println("work_order dom---->>["+workOrd+"]");
if(operationParent.length() > 0){
sql="select proc_code from worder_route where work_order= ? and operation = ? ";
pstmt=conn.prepareStatement(sql);
pstmt.setString(1, workOrd);
pstmt.setInt(2, Integer.parseInt(operationParent));
rs=pstmt.executeQuery();
if(rs.next()){
isRecordFound=true;
procCode=checkNull(rs.getString(1));
valueXmlString.append("<proc_code protect = \"1\">").append("<![CDATA[" + procCode + "]]>").append("</proc_code>");
procCodeLDesc=getColumnDescr(conn,"descr","process","proc_code",procCode);
valueXmlString.append("<process_descr>").append("<![CDATA[" +procCodeLDesc+ "]]>").append("</process_descr>");
}
rs.close();
rs=null;
pstmt.close();
pstmt=null;
sql="select work_ctr,mc_code from workorder_feedback where work_order = ? and operation = ?";
pstmt=conn.prepareStatement(sql);
pstmt.setString(1, workOrd);
pstmt.setInt(2, Integer.parseInt(operationParent));
rs=pstmt.executeQuery();
if(rs.next()){
workCtrF=checkNull(rs.getString(1));
mcCodeF=checkNull(rs.getString(2));
valueXmlString.append("<work_ctr__o>").append("<![CDATA[" + workCtrF + "]]>").append("</work_ctr__o>");
valueXmlString.append("<work_ctr>").append("<![CDATA[" + workCtrF + "]]>").append("</work_ctr>");
valueXmlString.append("<mc_code__o>").append("<![CDATA[" + mcCodeF + "]]>").append("</mc_code__o>");
valueXmlString.append("<mc_code>").append("<![CDATA[" + mcCodeF + "]]>").append("</mc_code>");
mcCodeDesc=getColumnDescr(conn,"descr","machines","mc_code",mcCodeF);
valueXmlString.append("<machines_descr>").append("<![CDATA[" +mcCodeDesc+ "]]>").append("</machines_descr>");
procCodeDesc=getColumnDescr(conn,"descr","process","proc_code",procCode);
valueXmlString.append("<process_descr>").append("<![CDATA[" +procCodeDesc+ "]]>").append("</process_descr>");
}
}
if(!isRecordFound){
valueXmlString.append("<proc_code protect = \"0\">").append("<![CDATA[" + procCode + "]]>").append("</proc_code>");
procCodeLDesc=getColumnDescr(conn,"descr","process","proc_code",procCode);
valueXmlString.append("<process_descr>").append("<![CDATA[" +procCodeLDesc+ "]]>").append("</process_descr>");
}
}
valueXmlString.append("</Detail1>");
......@@ -576,6 +713,7 @@ public class WorkOrderRouteAlt extends ValidatorEJB implements WorkOrderRouteAlt
ResultSet rs=null;
int cnt=0;
String sql="";
StringBuffer sql1=new StringBuffer();
try{
if(condParamL.size() > 0){
......
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