/**
 * CSTreeBean.java
 * Version 0.3, September 12, 2000
 *
 * Copyright (C) 2000 CoolServlets.com. All rights reserved.
 *
 * Derived from CoolServlets tree classes. Maintainer: Kevin Sangeelee
 *
 * ===================================================================
 * The Apache Software License, Version 1.1
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in
 *    the documentation and/or other materials provided with the
 *    distribution.
 *
 * 3. The end-user documentation included with the redistribution,
 *    if any, must include the following acknowledgment:
 *       "This product includes software developed by
 *        CoolServlets.com (http://www.coolservlets.com)."
 *    Alternately, this acknowledgment may appear in the software itself,
 *    if and wherever such third-party acknowledgments normally appear.
 *
 * 4. The names "Jive" and "CoolServlets.com" must not be used to
 *    endorse or promote products derived from this software without
 *    prior written permission. For written permission, please
 *    contact webmaster@coolservlets.com.
 *
 * 5. Products derived from this software may not be called "Jive",
 *    nor may "Jive" appear in their name, without prior written
 *    permission of CoolServlets.com.
 *
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED.  IN NO EVENT SHALL COOLSERVLETS.COM OR
 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 * ====================================================================
 *
 * This software consists of voluntary contributions made by many
 * individuals on behalf of CoolServlets.com. For more information
 * on CoolServlets.com, please see <http://www.coolservlets.com>.
 */
package psdi.webclient.beans.woreq;
import java.sql.*;
import java.util.*;

import com.coolservlets.beans.jdbc.*;
import com.coolservlets.beans.method.*;
import com.dbms.dbcon.*;
import com.report.*;
import psdi.security.ConnectionKey;
import psdi.util.*;
/**
 * A CSTreeBean is a server-side JSP JavaBean that generates trees populated from a JDBC
 * data source, and renders the trees as HTML. State information is maintained using URI
 * parameters.
 */

public class woreqBean{

        //com.coolservlets.beans.jdbc.ConnectionPool m_connectionPool;
        //public static com.coolservlets.beans.jdbc.ConnectionPool m_connectionPool;
        //private sql_data SqlData;
        private MXSession mxs = null;
        private String orgId = null;
        private String siteId = null;
        public MXSession	getMxs() { return this.mxs; }
        public void		setMxs(MXSession m_mxs) { this.mxs = m_mxs; }
        public String	getOrgId() { return this.orgId; }
        public void		setOrgId(String m_orgId) {this.orgId = m_orgId;}
        public String	getSiteId() { return this.siteId; }
        public void		setSiteId(String m_siteId) {this.siteId = m_siteId;}

        private Hashtable trees = new Hashtable();
        private int nodeID = 1;
        private Hashtable fatherNode = new Hashtable();
        private Hashtable fatherCode = new Hashtable();
        private Hashtable addChild = new Hashtable();
        private Hashtable codeNode = new Hashtable();
        private Hashtable flushNode = new Hashtable();
        private Hashtable openNodes = new Hashtable();	// holds an easy-lookup of open nodes while rendering HTML

        private String treeName;						// unique name of this tree
        private String tableName="WORKORDER";						// name of the (denormalised) table or view
        private String labelCols;						// comma separated list of columns that hold labels
        private String urlCols;							// comma separated list of corresponding urls
        private String whereClause = "";
        private int lastLevel = 1;
        private String maxCodeStr = "*";
        private String codeType = "KS";

        private String treePage;						// Which page to send tree URL links to
        private String leafPage;						// Which page to send tree leaf links to
        private String leafTarget="_self";

        // Which frame to send non-tree URL links to
        private String openImage="../../images/minus.gif";			// image for open nodes
        private String closedImage="../../images/plus.gif";			// image for closed nodes
        private String leafImage="../../images/child.gif";				// image for leaf nodes

        private String treeStyle="";						// Text style of the table

        private int open = 0;			// Passed by URL to this bean stating which node to open (or close)
        private int absopen;			// what - no abs()??
        private String oldopen = "";	// Automatically maintained URL parameter listing open nodes
        private boolean reload = false;
        //新增变量
        private String opname;
        private String optablename;
        private String nodecode;
        private String nodelevel;
        private String tablename;
        private String fstart;
        private String fstop;
        private String tbdeleterow;
        private String tbundeleterow;
        private String tbdeleterowstr;
        private String deletecodestr;
        private String selectnodecode;
        private String selectnodedesc;
        private int wpMaRowCount;
        private boolean isModifiedRow;
        //private String fristcode;

        // Getter and Setter methods
        public String	getLabelCols() { return this.labelCols; }
        public void		setLabelCols(String str) { this.labelCols = str; }
        public String	getUrlCols() { return this.urlCols; }
        public void		setUrlCols(String str) { this.urlCols = str; }
        public String	getTreeName() { return this.treeName; }
        public void		setTreeName(String str) { this.treeName = str; }
        public String	getTableName() { return this.tableName; }
        public void		setTableName(String str) { this.tableName = str; }
        public String	getWhereClause() { return this.whereClause; }
        public void		setWhereClause(String str) { this.whereClause = str; }

        //public String	get() { return this.; }
        //public void	set(String str) { this. = str; }

        public String getTreePage() { return treePage; }
        public void setTreePage(String treePage) { this.treePage = treePage; }

        public String getLeafPage() { return leafPage; }
        public void setLeafPage(String leafPage) { this.leafPage = leafPage; }
        public String getLeafTarget() { return leafTarget; }
        public void setLeafTarget(String leafTarget) { this.leafTarget = leafTarget; }

        public String getTreeStyle() { return treeStyle; }
        public void setTreeStyle(String treeStyle) { this.treeStyle = treeStyle; }

        public int	getOpen() { return open; }
        public void setOpen(int open) { this.open = open; absopen = open < 0 ? -open : open; }
        public String getOldopen() { return oldopen; }
        public void setOldopen(String oldopen) { this.oldopen = oldopen; }

        public boolean	getReload() { return reload; }
        public void setReload(boolean reload) { this.reload = reload; }

        public void		setOpenImage(String str) { this.openImage = str; }
        public void		setClosedImage(String str) { this.closedImage = str; }
        public void		setLeafImage(String str) { this.leafImage = str; }
        //新增方法
        public String	getOpname() { return this.opname; }
        public void		setOpname(String str) { this.opname = str; }
        public String	getOptablename() { return this.optablename; }
        public void		setOptablename(String str) { this.optablename = str; }
        public String	getNodecode() { return this.nodecode; }
        public void		setNodecode(String str) { this.nodecode = str; }
        public String	getNodelevel() { return this.nodelevel; }
        public void		setNodelevel(String str) { this.nodelevel = str; }
        public String	getTablename() { return this.tablename; }
        public void		setTablename(String str) { this.tablename = str; }
        public String	getFstart() { return this.fstart; }
        public void		setFstart(String str) { this.fstart = str; }
        public String	getFstop() { return this.fstop; }
        public void		setFstop(String str) { this.fstop = str; }
        public String	getTbdeleterow() { return this.tbdeleterow; }
        public void		setTbdeleterow(String str) { this.tbdeleterow = str; }
        public String	getTbundeleterow() { return this.tbundeleterow; }
        public void		setTbundeleterow(String str) { this.tbundeleterow = str; }
        public String	getTbdeleterowstr() { return this.tbdeleterowstr; }
        public void		setTbdeleterowstr(String str) { this.tbdeleterowstr = str; }
        public String	getDeletecodestr() { return this.deletecodestr; }
        public void		setDeletecodestr(String str) { this.deletecodestr = str; }
        public String	getSelectnodecode() { return this.selectnodecode; }
        public void		setSelectnodecode(String str) { this.selectnodecode = str; }
        public String	getSelectnodedesc() { return this.selectnodedesc; }
        public void		setSelectnodedesc(String str) { this.selectnodedesc = str; }
        public int	getWpMaRowCount() { return this.wpMaRowCount; }
        public void		setWpMaRowCount(int RowCount) { this.wpMaRowCount = RowCount; }
        public boolean	getIsModifiedRow() { return this.isModifiedRow; }
        public void		setIsModifiedRow(boolean modIs) { this.isModifiedRow = modIs; }
        // Now on to the real stuff...

        /**
         * Populates the tree specified in the bean parameter 'treeName', or the default tree
         * if none was specified. The trees are held statically in a Hashtable, keyed on the tree
         * name.
         *
         * A tree is populated from a denormalised table or a view using JDBC. Ordinarily, this operation
         * happens only once when the tree is first accessed.
         *
         * This method should probably be reorganised to lend itself more to populating from sources other
         * than JDBC.
         */

        public woreqBean()
        {
           init();
           //SqlData = new sql_data();
        }
        public  static void main(String args[])
        {
          try{

            //实化 DBGuiBean
            woreqBean instanceBean = new woreqBean();
            instanceBean.setOrgId("CGDC");
            instanceBean.setSiteId("HYSPP");
            //instanceBean.getReprtWfcData("2005-9-1 00:00:00","2007-9-30 23:59:59");
            //instanceBean.getReprtWflData("2005-9-1 00:00:00","2007-9-30 23:59:59");
            //instanceBean.getReprtWscData("2005-9-1 00:00:00","2007-9-30 23:59:59");
            //instanceBean.getReprtWslData("2005-9-1 00:00:00","2007-9-30 23:59:59","31");
            //instanceBean.getReprtWdlData("2005-9-1 00:00:00","2007-9-30 23:59:59","31");
            //instanceBean.getReprtWglData("2005-9-1 00:00:00","2007-9-30 23:59:59","0303");
            //instanceBean.getReprtWgcData("2005-9-1 00:00:00","2007-9-30 23:59:59");
            //instanceBean.getReprtWllData("2005-9-1 00:00:00","2007-9-30 23:59:59","HYS000");
            //instanceBean.renderWscHtml("2005-9-1 00:00:00@@2005-9-30 23:59:59@@");
            //instanceBean.renderWslHtml("2005-9-1 00:00:00@@2005-9-30 23:59:59@@=31@@");
            //instanceBean.renderWdlHtml("2005-9-1 00:00:00@@2005-9-30 23:59:59@@=13@@");
            //instanceBean.renderWglHtml("2005-9-1 00:00:00@@2005-9-30 23:59:59@@=1302@@");
            //instanceBean.renderWgcHtml("2005-9-1 00:00:00@@2005-9-30 23:59:59@@");
            //instanceBean.renderWllHtml("2005-9-1 00:00:00@@2005-9-30 23:59:59@@0054@@");
            //renderWdlHtml
            //Connection conn =  DBCon.getConnection();
            //System.out.println("root wonum="+instanceBean.getRootWoNum("11199",conn));
            //System.out.println("Server Cost ="+instanceBean.getActSvrCost("1090",conn));
            //System.out.println("Est Cost ="+instanceBean.getEstMatCost("11199",conn));
            //System.out.println("Act Mat Cost ="+instanceBean.getActMatCost("11199",conn));
            //instanceBean.ombProjectCost("11199",conn);
            //String[][] temp_arrary = instanceBean.fetchEquipType("KKSEQUIP","A");
            //fetchEquipCode
            //String temp_arrary = instanceBean.fetchEquipCode("KKSCODE","40JAA02CE");
            //String temp_arrary = instanceBean.fetchCondCount("MACODING","3","%毛巾%");
            //if(temp_arrary != null){
            //    System.out.println("temp_arrary[0][0]="+temp_arrary);
            //}else{
            //  System.out.println("temp_arrary[0][0]=");
            //}
            //instanceBean.setTableName("WORKORDER");
            //Connection conn = MXConnection.getConnection(mxs);
            //Vector html = instanceBean.getGLAccounts("1006");
            //int loopCount = html.size();
            //System.out.println("html size ="+html.size());
            //for(int i=0;i<loopCount;i++){
            //   System.out.println("html="+html.elementAt(i));
            //}
            //String tmpStr = instanceBean.getSpStr("1 种植业产品　包括农产品、园艺和供应市场的菜果园产　　品等,即包括农业种植业产品和林业种植业　　产品,如花卉、水果和林木种子、苗等");
            //System.out.println("tmpStr="+tmpStr);
            //instanceBean.setOptablename("MACODING");
            //int instanceLength = instanceBean.fetchCodeLength("MA","3","50031401140902488");
            //System.out.println("instanceLength="+instanceLength);
            //instanceArrary[0].equalsIgnoreCase()
            //instanceBean.setDeleteCode("0101@@");
            //instanceBean.deleteRecod();
            //instanceBean.setNodelevel("0");
            //instanceBean.setNodecode("00");
            //instanceBean.setFstart("1");
            //instanceBean.setFstop("3");
            //boolean[] returnIs =  instanceBean.fetchChildDeleteIs();boolean[] deleteArraryIs = new boolean[];
          }
          catch (Exception ex) {
            ex.printStackTrace();
          }
        }
        private String[] csvToArray(String csv) {

                StringTokenizer st = new StringTokenizer(csv,",");
                String[] buf = new String[st.countTokens()];

                int i = 0;
                while(st.hasMoreTokens())
                        buf[i++] = st.nextToken();

                return buf;
        }

        public String adjustScrollPosition() {
//		return "<SCRIPT> window.location.href=\"#A\"; if(window.scrollTo) scrollTo(0,(document.body ? document.body.scrollTop : pageYOffset) - 20); </SCRIPT>";
                return "<SCRIPT> window.location.href=\"#A\"; window.scroll(0, -20); </SCRIPT>";
        }

        public String getSpStr(String str)
        {
          try{
            String altStr = genMethod.readValueStr(str," ",1);
            String lableStr = (str.trim().length() > 25) ? str.substring(0,25)+"..." : str;
            //System.out.println("lableStr="+lableStr);
            return altStr;
          }
          catch(Exception e)
          {
          }
          return "null";
        }
        /**
    * <p>Initialize the servlet. This is called once when the
    * servlet is loaded. It is guaranteed to complete before any
    * requests are made to the servlet
    *
    *
    */

        public void init()
        {

        }

        /**
         * <p>Destroy the servlet. This is called once when the servlet
         * is unloaded.
         */

        public void destroy()
        {

        }

        //全厂按机组汇总
        public final String renderWfcHtml(String pCondStr) throws Exception {
          //开始计算数据Begin
          String startDate = genMethod.readValueStr(pCondStr, "@@", 0);
          String stopDate = genMethod.readValueStr(pCondStr, "@@", 1);
          String title = "您填写的";
          boolean Is = true;
          if(startDate.length() == 0){
            title =title+ "<发现起始日期>为空;";
            Is = false;
          }
          if(stopDate.length() == 0){
            title =title+ "<发现终止日期>为空;";
            Is = false;
          }
          if(!Is) return title;
          String[][] htmlData = getReprtWfcData(startDate,stopDate);
          if(htmlData == null) return "没有符合条件的记录!!!!!";
          //开始计算数据End
          HtmlReport htmlReport = new HtmlReport();
          Vector vM = getReportModule("woreqck","woreqfullcollect.htm");
          htmlReport.setModulefln(vM);
          Vector vecTitle = new Vector();
          vecTitle.addElement(new String("国电深能四川华蓥山发电有限责任公司缺陷统计表"));
          Properties clusters = new Properties();
          clusters.put("$$TITLE", vecTitle);
          Vector vecDate = new Vector();
          vecDate.addElement(new String(startDate + " 至 " + stopDate));
          clusters.put("$$DATE", vecDate);
          htmlReport.setClusters(clusters);
          htmlReport.setCategory("REPORT");
          htmlReport.setCovertag("$$$");
          htmlReport.setReportdata(htmlData);
          return htmlReport.createHtmlReport();
        }
        //缺陷明细表
        public final String renderWflHtml(String pCondStr) throws Exception {
          //开始计算数据Begin
          String startDate = genMethod.readValueStr(pCondStr, "@@", 0);
          String stopDate = genMethod.readValueStr(pCondStr, "@@", 1);
          String title = "您填写的";
          boolean Is = true;
          if(startDate.length() == 0){
            title =title+ "<发现起始日期>为空;";
            Is = false;
          }
          if(stopDate.length() == 0){
            title =title+ "<发现终止日期>为空;";
            Is = false;
          }
          if(!Is) return title;
          String[][] htmlData = getReprtWflData(startDate,stopDate);
          if(htmlData == null) return "没有符合条件的记录!!!!!";
          //开始计算数据End
          HtmlReport htmlReport = new HtmlReport();
          Vector vM = getReportModule("woreqck","woreqfulllist.htm");
          htmlReport.setModulefln(vM);
          Vector vecTitle = new Vector();
          vecTitle.addElement(new String("国电深能四川华蓥山发电有限责任公司缺陷统计表"));
          Properties clusters = new Properties();
          clusters.put("$$TITLE", vecTitle);
          Vector vecDate = new Vector();
          vecDate.addElement(new String(startDate + " 至 " + stopDate));
          clusters.put("$$DATE", vecDate);
          htmlReport.setClusters(clusters);
          htmlReport.setCategory("REPORT");
          htmlReport.setCovertag("$$$");
          htmlReport.setReportdata(htmlData);
          return htmlReport.createHtmlReport();
        }
        //缺陷所属专业汇总表
        public final String renderWscHtml(String pCondStr) throws Exception {
          //开始计算数据Begin
          String startDate = genMethod.readValueStr(pCondStr, "@@", 0);
          String stopDate = genMethod.readValueStr(pCondStr, "@@", 1);
          String title = "您填写的";
          boolean Is = true;
          if(startDate.length() == 0){
            title =title+ "<发现起始日期>为空;";
            Is = false;
          }
          if(stopDate.length() == 0){
            title =title+ "<发现终止日期>为空;";
            Is = false;
          }
          if(!Is) return title;
          String[][] htmlData = getReprtWscData(startDate,stopDate);
          if(htmlData == null) return "没有符合条件的记录!!!!!";
          //开始计算数据End
          HtmlReport htmlReport = new HtmlReport();
          Vector vM = getReportModule("woreqck","woreqspeccollect.htm");
          htmlReport.setModulefln(vM);
          Vector vecTitle = new Vector();
          vecTitle.addElement(new String("国电深能四川华蓥山发电有限责任公司缺陷统计表"));
          Properties clusters = new Properties();
          clusters.put("$$TITLE", vecTitle);
          Vector vecDate = new Vector();
          vecDate.addElement(new String(startDate + " 至 " + stopDate));
          clusters.put("$$DATE", vecDate);
          htmlReport.setClusters(clusters);
          htmlReport.setCategory("REPORT");
          htmlReport.setCovertag("$$$");
          htmlReport.setReportdata(htmlData);
          return htmlReport.createHtmlReport();
        }

        //缺陷所属专业明细表
        public final String renderWslHtml(String pCondStr) throws Exception {
          //开始计算数据Begin
          String startDate = genMethod.readValueStr(pCondStr, "@@", 0);
          String stopDate = genMethod.readValueStr(pCondStr, "@@", 1);
          String spec = genMethod.readValueStr(pCondStr, "@@", 2);
          int nloop = spec.length();
          String tspec = "";
          for(int n=0;n<nloop;n++){
            String s = spec.substring(n,n+1);
            tspec = (CheckMethod.isInteger(s))?tspec + s:tspec;
          }
          spec = tspec;
          String title = "您填写的";
          boolean Is = true;
          if (startDate.length() == 0) {
            title = title + "<发现起始日期>为空;";
            Is = false;
          }
          if (stopDate.length() == 0) {
            title = title + "<发现终止日期>为空;";
            Is = false;
          }
          if (spec.length() == 0) {
            title = title + "<专业>为空;";
            Is = false;
          }
          if (!Is)return title;
          Properties pspecDesc = new java.util.Properties();
          pspecDesc.put("31","汽机");
          pspecDesc.put("32","锅炉");
          pspecDesc.put("33","电气");
          pspecDesc.put("34","热控");
          pspecDesc.put("35","化学");
          pspecDesc.put("36","燃料");
          String[][] htmlData = getReprtWslData(startDate,stopDate,spec);
          if(htmlData == null) return "没有符合条件的记录!!!!!";
          //开始计算数据End
          HtmlReport htmlReport = new HtmlReport();
          Vector vM = getReportModule("woreqck","woreqspeclist.htm");
          htmlReport.setModulefln(vM);
          Vector vecTitle = new Vector();
          vecTitle.addElement(new String("国电深能四川华蓥山发电有限责任公司缺陷统计表"));
          Properties clusters = new Properties();
          clusters.put("$$TITLE", vecTitle);
          Vector vecDate = new Vector();
          vecDate.addElement(new String(startDate + " 至 " + stopDate));
          clusters.put("$$DATE", vecDate);
          Vector vecSpec = new Vector();
          vecSpec.addElement(new String(spec+" "+pspecDesc.getProperty(spec)));
          clusters.put("$$SPEC",vecSpec);
          htmlReport.setClusters(clusters);
          htmlReport.setCategory("REPORT");
          htmlReport.setCovertag("$$$");
          htmlReport.setReportdata(htmlData);
          return htmlReport.createHtmlReport();
        }

        //缺陷所属专业明细表
        public final String renderWdlHtml(String pCondStr) throws Exception {
          //开始计算数据Begin
          String startDate = genMethod.readValueStr(pCondStr, "@@", 0);
          String stopDate = genMethod.readValueStr(pCondStr, "@@", 1);
          //发现部门
          String spec = genMethod.readValueStr(pCondStr, "@@", 2);
          int nloop = spec.length();
          String tspec = "";
          for(int n=0;n<nloop;n++){
            String s = spec.substring(n,n+1);
            tspec = (CheckMethod.isInteger(s))?tspec + s:tspec;
          }
          spec = tspec;
          String title = "您填写的";
          boolean Is = true;
          if (startDate.length() == 0) {
            title = title + "<发现起始日期>为空;";
            Is = false;
          }
          if (stopDate.length() == 0) {
            title = title + "<发现终止日期>为空;";
            Is = false;
          }
          if (spec.length() == 0) {
            title = title + "<发现部门>为空;";
            Is = false;
          }
          if (!Is)return title;
          Properties pspecDesc = new java.util.Properties();
          pspecDesc.put("03","安生部");
          pspecDesc.put("05","发电部");
          pspecDesc.put("06","维护项目部");
          pspecDesc.put("07","常华项目部");
          String[][] htmlData = getReprtWdlData(startDate,stopDate,spec);
          if(htmlData == null) return "没有符合条件的记录!!!!!";
          //开始计算数据End
          HtmlReport htmlReport = new HtmlReport();
          Vector vM = getReportModule("woreqck","woreqdeptlist.htm");
          htmlReport.setModulefln(vM);
          Vector vecTitle = new Vector();
          vecTitle.addElement(new String("国电深能四川华蓥山发电有限责任公司缺陷统计表"));
          Properties clusters = new Properties();
          clusters.put("$$TITLE", vecTitle);
          Vector vecDate = new Vector();
          vecDate.addElement(new String(startDate + " 至 " + stopDate));
          clusters.put("$$DATE", vecDate);
          Vector vecSpec = new Vector();
          vecSpec.addElement(new String(spec+" "+pspecDesc.getProperty(spec)));
          clusters.put("$$SPEC",vecSpec);
          htmlReport.setClusters(clusters);
          htmlReport.setCategory("REPORT");
          htmlReport.setCovertag("$$$");
          htmlReport.setReportdata(htmlData);
          return htmlReport.createHtmlReport();
        }

        //发现班组明细表
        public final String renderWglHtml(String pCondStr) throws Exception {
          //开始计算数据Begin
          String startDate = genMethod.readValueStr(pCondStr, "@@", 0);
          String stopDate = genMethod.readValueStr(pCondStr, "@@", 1);
          //发现班组
          String spec = genMethod.readValueStr(pCondStr, "@@", 2);
          int nloop = spec.length();
          String tspec = "";
          for(int n=0;n<nloop;n++){
            String s = spec.substring(n,n+1);
            tspec = (CheckMethod.isInteger(s))?tspec + s:tspec;
          }
          spec = tspec;
          String title = "您填写的";
          boolean Is = true;
          if (startDate.length() == 0) {
            title = title + "<发现起始日期>为空;";
            Is = false;
          }
          if (stopDate.length() == 0) {
            title = title + "<发现终止日期>为空;";
            Is = false;
          }
          if (spec.length() != 4) {
            title = title + "<发现班组>为空;";
            Is = false;
          }
          if (!Is)return title;
          String[][] htmlData = getReprtWglData(startDate,stopDate,spec);
          if(htmlData == null) return "没有符合条件的记录!!!!!";
          //开始计算数据End
          HtmlReport htmlReport = new HtmlReport();
          Vector vM = getReportModule("woreqck","woreqgrouplist.htm");
          htmlReport.setModulefln(vM);
          Vector vecTitle = new Vector();
          vecTitle.addElement(new String("国电深能四川华蓥山发电有限责任公司缺陷统计表"));
          Properties clusters = new Properties();
          clusters.put("$$TITLE", vecTitle);
          Vector vecDate = new Vector();
          vecDate.addElement(new String(startDate + " 至 " + stopDate));
          clusters.put("$$DATE", vecDate);
          Vector vecSpec = new Vector();
          vecSpec.addElement(new String(spec+" "+getDeptDesc(spec)));
          clusters.put("$$SPEC",vecSpec);
          htmlReport.setClusters(clusters);
          htmlReport.setCategory("REPORT");
          htmlReport.setCovertag("$$$");
          htmlReport.setReportdata(htmlData);
          return htmlReport.createHtmlReport();
        }


        //发现班组汇总表
        public final String renderWgcHtml(String pCondStr) throws Exception {
          //开始计算数据Begin
          String startDate = genMethod.readValueStr(pCondStr,"@@",0);
          String stopDate = genMethod.readValueStr(pCondStr, "@@",1);
          String title = "您填写的";
          boolean Is = true;
          if (startDate.length() == 0) {
            title = title + "<发现起始日期>为空;";
            Is = false;
          }
          if (stopDate.length() == 0) {
            title = title + "<发现终止日期>为空;";
            Is = false;
          }
          if (!Is)return title;
          String[][] htmlData = getReprtWgcData(startDate,stopDate);
          if(htmlData == null) return "没有符合条件的记录!!!!!";
          //开始计算数据End
          HtmlReport htmlReport = new HtmlReport();
          Vector vM = getReportModule("woreqck","woreqgroupcollect.htm");
          htmlReport.setModulefln(vM);
          Vector vecTitle = new Vector();
          vecTitle.addElement(new String("国电深能四川华蓥山发电有限责任公司缺陷统计表"));
          Properties clusters = new Properties();
          clusters.put("$$TITLE", vecTitle);
          Vector vecDate = new Vector();
          vecDate.addElement(new String(startDate + " 至 " + stopDate));
          clusters.put("$$DATE", vecDate);
          htmlReport.setClusters(clusters);
          htmlReport.setCategory("REPORT");
          htmlReport.setCovertag("$$$");
          htmlReport.setReportdata(htmlData);
          return htmlReport.createHtmlReport();
        }

        //发现班组汇总表
        public final String renderWllHtml(String pCondStr) throws Exception {
          //开始计算数据Begin
          String startDate = genMethod.readValueStr(pCondStr,"@@",0);
          String stopDate = genMethod.readValueStr(pCondStr, "@@",1);
          //发现班组
          String slaborCode = genMethod.readValueStr(pCondStr, "@@", 2);
          int nloop = slaborCode.length();
          String t = "";
          for(int n=0;n<nloop;n++){
            String s = slaborCode.substring(n,n+1);
            t = (!s.equalsIgnoreCase("=") && !s.equalsIgnoreCase(">") && !s.equalsIgnoreCase("<"))?t + s:t;
          }
          slaborCode = t;
          String title = "您填写的";
          boolean Is = true;
          if (startDate.length() == 0) {
            title = title + "<发现起始日期>为空;";
            Is = false;
          }
          if (stopDate.length() == 0) {
            title = title + "<发现终止日期>为空;";
            Is = false;
          }
          if (slaborCode.length() == 0) {
            title = title + "<发现人>为空;";
            Is = false;
          }
          if (!Is)return title;
          String[][] htmlData = getReprtWllData(startDate,stopDate,slaborCode);
          if(htmlData == null) return "没有符合条件的记录!!!!!";
          //开始计算数据End
          HtmlReport htmlReport = new HtmlReport();
          Vector vM = getReportModule("woreqck","woreqlaborlist.htm");
          htmlReport.setModulefln(vM);
          Vector vecTitle = new Vector();
          vecTitle.addElement(new String("国电深能四川华蓥山发电有限责任公司缺陷统计表"));
          Properties clusters = new Properties();
          clusters.put("$$TITLE", vecTitle);
          Vector vecDate = new Vector();
          vecDate.addElement(new String(startDate + " 至 " + stopDate));
          clusters.put("$$DATE", vecDate);
          Vector vecSpec = new Vector();
          vecSpec.addElement(new String(slaborCode+" "+getLaborName(slaborCode)));
          clusters.put("$$SPEC",vecSpec);
          htmlReport.setClusters(clusters);
          htmlReport.setCategory("REPORT");
          htmlReport.setCovertag("$$$");
          htmlReport.setReportdata(htmlData);
          return htmlReport.createHtmlReport();
        }

   /**
    * 计算
    *
    */
   public String[][] getReprtWfcData(String pstartDate,String pstopDate) throws Exception {
     String orgIdStr = orgId;
     //String orgIdStr = "HEDGS";
     orgIdStr = (orgIdStr == null) ? "":orgIdStr.trim().toUpperCase();
     String siteIdStr = siteId;
     //String siteIdStr = "HEDSITE";
     siteIdStr =(siteIdStr == null) ? "":siteIdStr.trim();
     Connection conn = MXConnection.getConnection(mxs);
     //Connection conn =  DBCon.getConnection();
     //已发现缺陷
     StringBuffer sqllocal = new StringBuffer(300);
     sqllocal.append("select count(*) C,LOCATION,WO17").append(" from ").append("WORKORDER");
     sqllocal.append(" where (WORKTYPE = \'CM\' AND UPPER(TRIM(SITEID)) ="+"\'"+siteIdStr+"\'"+" AND "+"REPORTDATE >="+"to_date("+"\'"+pstartDate+"\'"+","+"\'"+"YYYY/MM/DD HH24:MI:SS"+"\'"+")"+ " AND REPORTDATE <="+"to_date("+"\'"+pstopDate+"\'"+","+"\'"+"YYYY/MM/DD HH24:MI:SS"+"\'"+")) AND (WO17 =\'COMP\' OR (WO17 =\'WOIS\') OR WO17 =\'WOTEMP\')");
     sqllocal.append(" group by LOCATION,WO17");
     QueryResult rlmvQuery = DBCon.runQuery(sqllocal.toString(), conn);
     rlmvQuery = (rlmvQuery == null) ? new QueryResult() : rlmvQuery;
     int loopCount = rlmvQuery.size();
     if (loopCount == 0)return null;
     Properties pComp = new java.util.Properties();
     Properties pWois = new java.util.Properties();
     Properties pLoca = new java.util.Properties();
     Properties pLocaDesc = new java.util.Properties();
     for (int i = 0; i < loopCount; i++) {
       ResultRow resultRow = rlmvQuery.getRow(i);
       String sCount = resultRow.getValue("C");
       sCount = (sCount == null) ? "" : sCount.trim();
       String sLocation = resultRow.getValue("LOCATION");
       sLocation = (sLocation == null) ? "" : sLocation.trim();
       if(sLocation.equalsIgnoreCase("0")) continue;
       String sWo17 = resultRow.getValue("WO17");
       sWo17 = (sWo17 == null) ? "" :sWo17.trim();
       sLocation = (sLocation.length() > 3)?sLocation.substring(0,3):sLocation.trim();
       if(sLocation.length() == 0) continue;
       String tLoca = pLoca.getProperty(sLocation,"");
       tLoca = (tLoca == null)?"":tLoca.trim();
       if(tLoca.length() == 0) {
         //System.out.println("sLocationa="+sLocation);
         pLoca.put(sLocation, "location");
       }
       //已消除
       if (sWo17.equalsIgnoreCase("COMP")) {
          String tCount = pComp.getProperty(sLocation,"");
          tCount =(tCount == null)?"":tCount.trim();
          if(tCount.length() == 0){
            pComp.put(sLocation,sCount);
          }else{
            tCount =(tCount.length() == 0)?"0":tCount.trim();
            sCount =(sCount.length() == 0)?"0":sCount.trim();
            int iCount = Integer.parseInt(tCount) + Integer.parseInt(sCount);
            pComp.put(sLocation,Integer.toString(iCount));
          }
       }
       else {
         if (sWo17.equalsIgnoreCase("WOIS") || sWo17.equalsIgnoreCase("WOTEMP")) {
           String tCount = pWois.getProperty(sLocation, "");
           tCount = (tCount == null) ? "" : tCount.trim();
           if (tCount.length() == 0) {
             pWois.put(sLocation,sCount);
           }
           else {
             tCount = (tCount.length() == 0) ? "0" : tCount.trim();
             sCount = (sCount.length() == 0) ? "0" : sCount.trim();
             int iCount = Integer.parseInt(tCount) + Integer.parseInt(sCount);
             pWois.put(sLocation, Integer.toString(iCount));
           }
         }
       }
     }
     //计算合计条数begin
     Vector vSortbefor = new Vector();
     Enumeration e = pLoca.propertyNames();
     while (e.hasMoreElements()) {
       String m_KeyList = (String) e.nextElement();
       m_KeyList =(m_KeyList == null)?"":m_KeyList.trim();
       //System.out.println("m_KeyList="+m_KeyList);
       vSortbefor.addElement(new String(m_KeyList+"@@"));
     }
     Vector vSortafter = genMethod.sortValueStr(vSortbefor,"@@",0,"0",null,0);
     String[][] WfcData = new String[pLoca.size()][7];
     int nloop = vSortafter.size();
     int ay = 0;
     for(int n=0;n<nloop;n++){
       String sl = (String)vSortafter.elementAt(n);
       sl =(sl==null)?"":sl.trim();
       String slf = genMethod.readValueStr(sl, "@@",0);
       //System.out.println("slf ="+slf);
       if(slf.length() == 0) continue;
       //开始汇总计算
       //已消除数量
       String sCompCount = pComp.getProperty(slf,"0");
       int iCompCount = Integer.parseInt(sCompCount);
       //未消除数量
       String sWoisCount = pWois.getProperty(slf,"0");
       int iWoisCount = Integer.parseInt(sWoisCount);
       //发现数量
       int iFindCount = iCompCount + iWoisCount;
       //消除率
       float iRateComp = 0.00f;
       if(iFindCount == 0 && iCompCount > 0) iRateComp = 0;
       if(iFindCount == 0 && iCompCount == 0) iRateComp = 0;
       if(iFindCount > 0 && iCompCount > 0) iRateComp = ((float)iCompCount / (float)iFindCount) * 100;
       WfcData[ay][0] = Integer.toString(ay+1);
       WfcData[ay][1] = slf;
       WfcData[ay][2] = "";
       WfcData[ay][3] = Integer.toString(iFindCount);
       WfcData[ay][4] = Integer.toString(iCompCount);
       WfcData[ay][5] = Integer.toString(iWoisCount);
       String sRateComp = Float.toString(iRateComp);
       int sCIndex = 0;
       if(sRateComp.indexOf(".",0) > -1){
          sCIndex = (sRateComp.indexOf(".",0)+4 <=sRateComp.length())?sRateComp.indexOf(".",0)+4:sRateComp.length();
       }else{
          sCIndex = sRateComp.length();
       }
       sRateComp =  sRateComp.substring(0,sCIndex);
       WfcData[ay][6] = sRateComp+"%";
       ay++;
     }
     sqllocal = new StringBuffer(300);
     sqllocal.append("select LOCATION,DESCRIPTION").append(" from ").append("LOCATIONS");
     sqllocal.append(" where UPPER(TRIM(SITEID)) ="+"\'"+siteIdStr+"\'"+" AND "+"LENGTH(TRIM(LOCATION)) < 4");
     sqllocal.append(" order by LOCATION");
     rlmvQuery = DBCon.runQuery(sqllocal.toString(), conn);
     rlmvQuery = (rlmvQuery == null) ? new QueryResult() :rlmvQuery;
     loopCount = rlmvQuery.size();
     for (int i = 0;i<loopCount;i++) {
       ResultRow resultRow = rlmvQuery.getRow(i);
       String sDesc = resultRow.getValue("DESCRIPTION");
       sDesc = (sDesc == null) ? "" :sDesc.trim();
       String sLocation = resultRow.getValue("LOCATION");
       sLocation = (sLocation == null) ? "" : sLocation.trim();
       pLocaDesc.put(sLocation,sDesc);
       //System.out.println("sLocation ="+sLocation);
     }
     String[][] rWfcData = getReprtWfcTotalData(WfcData,1,"0,1","3,4,5",6,"3,4");
     for(int i=0;i<rWfcData.length;i++){
       //rWfcData[i][0] = Integer.toString(i + 1);
       String sunit = rWfcData[i][1];
       String unitDesc = (!sunit.equalsIgnoreCase("9"))?pLocaDesc.getProperty(sunit, ""):"总";
       if(rWfcData[i][0].indexOf("+",0)>-1){
         unitDesc = unitDesc + "合计";
         rWfcData[i][0] = Integer.toString(i + 1);
       }
       rWfcData[i][2] = unitDesc;
       //System.out.println(rWfcData[i][0]+" "+rWfcData[i][1]+" "+rWfcData[i][2]+" "+rWfcData[i][3]+" "+rWfcData[i][4]+" "+rWfcData[i][5]+" "+rWfcData[i][6]);
     }
     return rWfcData;
   }

   /**
    * 计算
    *
    */
   public String[][] getReprtWflData(String pstartDate,String pstopDate) throws Exception {
     String orgIdStr = orgId;
     //String orgIdStr = "HEDGS";
     orgIdStr = (orgIdStr == null) ? "":orgIdStr.trim().toUpperCase();
     String siteIdStr = siteId;
     //String siteIdStr = "HEDSITE";
     siteIdStr =(siteIdStr == null) ? "":siteIdStr.trim();
     Connection conn = MXConnection.getConnection(mxs);
     //Connection conn =  DBCon.getConnection();
     //已发现缺陷
     StringBuffer sqllocal = new StringBuffer(300);
     sqllocal.append("select count(*) C,LOCATION,WO17").append(" from ").append("WORKORDER");
     sqllocal.append(" where (WORKTYPE = \'CM\' AND UPPER(TRIM(SITEID)) ="+"\'"+siteIdStr+"\'"+" AND "+"REPORTDATE >="+"to_date("+"\'"+pstartDate+"\'"+","+"\'"+"YYYY/MM/DD HH24:MI:SS"+"\'"+")"+ " AND REPORTDATE <="+"to_date("+"\'"+pstopDate+"\'"+","+"\'"+"YYYY/MM/DD HH24:MI:SS"+"\'"+")) AND (WO17 =\'COMP\' OR (WO17 =\'WOIS\') OR WO17 =\'WOTEMP\')");
     sqllocal.append(" group by LOCATION,WO17");
     QueryResult rlmvQuery = DBCon.runQuery(sqllocal.toString(), conn);
     rlmvQuery = (rlmvQuery == null) ? new QueryResult() : rlmvQuery;
     int loopCount = rlmvQuery.size();
     if (loopCount == 0)return null;
     Properties pComp = new java.util.Properties();
     Properties pWois = new java.util.Properties();
     Properties pLoca = new java.util.Properties();
     Properties pLocaDesc = new java.util.Properties();
     for (int i = 0; i < loopCount; i++) {
       ResultRow resultRow = rlmvQuery.getRow(i);
       String sCount = resultRow.getValue("C");
       sCount = (sCount == null) ? "" : sCount.trim();
       String sLocation = resultRow.getValue("LOCATION");
       sLocation = (sLocation == null) ? "" : sLocation.trim();
       String sWo17 = resultRow.getValue("WO17");
       sWo17 = (sWo17 == null) ? "" :sWo17.trim();
       if(sLocation.length() > 3){
          String ts = "";
          int yloop = sLocation.length();
          for(int y=3;y<yloop;y++){
            String fs = sLocation.substring(y,y+1);
            if(CheckMethod.isInteger(fs)){
              break;
            }else{
              ts = ts+fs;
            }
          }
          sLocation = sLocation.substring(0,3) + ts;
       }
       //sLocation = (sLocation.length() > 5)?sLocation.substring(0,6):sLocation.trim();
       if(sLocation.length() == 0) continue;
       String tLoca = pLoca.getProperty(sLocation,"");
       tLoca = (tLoca == null)?"":tLoca.trim();
       if(tLoca.length() == 0) pLoca.put(sLocation,"location");
       //已消除
       if (sWo17.equalsIgnoreCase("COMP")) {
          String tCount = pComp.getProperty(sLocation,"");
          tCount =(tCount == null)?"":tCount.trim();
          if(tCount.length() == 0){
            pComp.put(sLocation,sCount);
          }else{
            tCount =(tCount.length() == 0)?"0":tCount.trim();
            sCount =(sCount.length() == 0)?"0":sCount.trim();
            int iCount = Integer.parseInt(tCount) + Integer.parseInt(sCount);
            pComp.put(sLocation,Integer.toString(iCount));
          }
       }
       else {
         if (sWo17.equalsIgnoreCase("WOIS") || sWo17.equalsIgnoreCase("WOTEMP")) {
           String tCount = pWois.getProperty(sLocation, "");
           tCount = (tCount == null) ? "" : tCount.trim();
           if (tCount.length() == 0) {
             pWois.put(sLocation,sCount);
           }
           else {
             tCount = (tCount.length() == 0) ? "0" : tCount.trim();
             sCount = (sCount.length() == 0) ? "0" : sCount.trim();
             int iCount = Integer.parseInt(tCount) + Integer.parseInt(sCount);
             pWois.put(sLocation, Integer.toString(iCount));
           }
         }
       }
     }
     //计算合计条数begin
     Vector vSortbefor = new Vector();
     Enumeration e = pLoca.propertyNames();
     while (e.hasMoreElements()) {
       String m_KeyList = (String) e.nextElement();
       m_KeyList =(m_KeyList == null)?"":m_KeyList.trim();
       vSortbefor.addElement(new String(m_KeyList+"@@"));
       //System.out.println("m_KeyList = "+m_KeyList);
     }
     Vector vSortafter = genMethod.sortValueStr(vSortbefor,"@@",0,"0",null,0);
     String[][] WfcData = new String[pLoca.size()][8];
     int nloop = vSortafter.size();
     int ay = 0;
     for(int n=0;n<nloop;n++){
       String sl = (String)vSortafter.elementAt(n);
       sl =(sl==null)?"":sl.trim();
       String slf = genMethod.readValueStr(sl, "@@", 0);
       if(slf.length() == 0) continue;
       //开始汇总计算
       //已消除数量
       String sCompCount = pComp.getProperty(slf,"0");
       int iCompCount = Integer.parseInt(sCompCount);
       //未消除数量
       String sWoisCount = pWois.getProperty(slf,"0");
       int iWoisCount = Integer.parseInt(sWoisCount);
       //发现数量
       int iFindCount = iCompCount + iWoisCount;
       //消除率
       float iRateComp = 0.00f;
       if(iFindCount == 0 && iCompCount > 0) iRateComp = 0;
       if(iFindCount == 0 && iCompCount == 0) iRateComp = 0;
       if(iFindCount > 0 && iCompCount > 0) iRateComp = ((float)iCompCount / (float)iFindCount) * 100;
       WfcData[ay][0] = Integer.toString(ay+1);
       WfcData[ay][1] = (slf.length() >2)?slf.substring(0,3):slf.trim();
       WfcData[ay][2] = "";
       WfcData[ay][3] = slf;
       WfcData[ay][4] = Integer.toString(iFindCount);
       WfcData[ay][5] = Integer.toString(iCompCount);
       WfcData[ay][6] = Integer.toString(iWoisCount);
       String sRateComp = Float.toString(iRateComp);
       int sCIndex = 0;
       if(sRateComp.indexOf(".",0) > -1){
          sCIndex = (sRateComp.indexOf(".",0)+4 <=sRateComp.length())?sRateComp.indexOf(".",0)+4:sRateComp.length();
       }else{
          sCIndex = sRateComp.length();
       }
       sRateComp =  sRateComp.substring(0,sCIndex);
       WfcData[ay][7] = sRateComp+"%";
       //System.out.println(WfcData[n][0]+" "+WfcData[n][1]+" "+WfcData[n][2]+" "+WfcData[n][3]+" "+WfcData[n][4]+" "+WfcData[n][5]+" "+WfcData[n][6]+" "+WfcData[n][7]);
       ay++;
     }
     sqllocal = new StringBuffer(300);
     sqllocal.append("select LOCATION,DESCRIPTION").append(" from ").append("LOCATIONS");
     sqllocal.append(" where UPPER(TRIM(SITEID)) ="+"\'"+siteIdStr+"\'");
     sqllocal.append(" order by LOCATION");
     rlmvQuery = DBCon.runQuery(sqllocal.toString(), conn);
     rlmvQuery = (rlmvQuery == null) ? new QueryResult() :rlmvQuery;
     loopCount = rlmvQuery.size();
     for (int i = 0;i<loopCount;i++) {
       ResultRow resultRow = rlmvQuery.getRow(i);
       String sDesc = resultRow.getValue("DESCRIPTION");
       sDesc = (sDesc == null) ? "" :sDesc.trim();
       String sLocation = resultRow.getValue("LOCATION");
       sLocation = (sLocation == null) ? "" : sLocation.trim();
       pLocaDesc.put(sLocation,sDesc);
       //System.out.println("sLocation = "+sLocation + " "+sDesc);
     }
     String[][] rWfcData = getReprtWfcTotalData(WfcData,1,"0,3","4,5,6",7,"4,5");
     for(int i=0;i<rWfcData.length;i++){
       //rWfcData[i][0] = Integer.toString(i + 1);
       String ssystem = rWfcData[i][3];
       String systemDesc =pLocaDesc.getProperty(ssystem);
       rWfcData[i][3] = ssystem + " "+systemDesc;
       String sunit = rWfcData[i][1];
       String unitDesc = (!sunit.equalsIgnoreCase("9"))?pLocaDesc.getProperty(sunit, ""):"总";
       if(rWfcData[i][0].indexOf("+",0)>-1){
         unitDesc = unitDesc + "合计";
         rWfcData[i][0] = Integer.toString(i + 1);
         rWfcData[i][2] = "";
         rWfcData[i][3] = "";
       }
       rWfcData[i][1] = unitDesc;
       //System.out.println(rWfcData[i][0]+" "+rWfcData[i][1]+" "+rWfcData[i][2]+" "+rWfcData[i][3]+" "+rWfcData[i][4]+" "+rWfcData[i][5]+" "+rWfcData[i][6]+" "+rWfcData[i][7]);
     }
     return rWfcData;
   }
   /**
    * 计算
    *
    */
   public String[][] getReprtWscData(String pstartDate,String pstopDate) throws Exception {
     String orgIdStr = orgId;
     //String orgIdStr = "HEDGS";
     orgIdStr = (orgIdStr == null) ? "":orgIdStr.trim().toUpperCase();
     String siteIdStr = siteId;
     //String siteIdStr = "HEDSITE";
     siteIdStr =(siteIdStr == null) ? "":siteIdStr.trim();
     Connection conn = MXConnection.getConnection(mxs);

     //Connection conn =  DBCon.getConnection();
     //已发现缺陷
     StringBuffer sqllocal = new StringBuffer(300);
     sqllocal.append("select count(*) C,WOPM1,WO17").append(" from ").append("WORKORDER");
     sqllocal.append(" where (WORKTYPE = \'CM\' AND UPPER(TRIM(SITEID)) ="+"\'"+siteIdStr+"\'"+" AND "+"REPORTDATE >="+"to_date("+"\'"+pstartDate+"\'"+","+"\'"+"YYYY/MM/DD HH24:MI:SS"+"\'"+")"+ " AND REPORTDATE <="+"to_date("+"\'"+pstopDate+"\'"+","+"\'"+"YYYY/MM/DD HH24:MI:SS"+"\'"+")) AND (WO17 =\'COMP\' OR (WO17 =\'WOIS\') OR WO17 =\'WOTEMP\')");
     sqllocal.append(" group by WOPM1,WO17");
     QueryResult rlmvQuery = DBCon.runQuery(sqllocal.toString(), conn);
     rlmvQuery = (rlmvQuery == null) ? new QueryResult() : rlmvQuery;
     int loopCount = rlmvQuery.size();
     if (loopCount == 0)return null;
     Properties pComp = new java.util.Properties();
     Properties pWois = new java.util.Properties();
     Properties pLoca = new java.util.Properties();
     Properties pLocaDesc = new java.util.Properties();
     for (int i = 0; i < loopCount; i++) {
       ResultRow resultRow = rlmvQuery.getRow(i);
       String sCount = resultRow.getValue("C");
       sCount = (sCount == null) ? "" : sCount.trim();
       String sWopm1 = resultRow.getValue("WOPM1");
       sWopm1 = (sWopm1 == null) ? "" :sWopm1.trim();
       String sWo17 = resultRow.getValue("WO17");
       sWo17 = (sWo17 == null) ? "" :sWo17.trim();
       sWopm1 = (sWopm1.length() > 1)?sWopm1.substring(0,2):sWopm1.trim();
       if(sWopm1.length() == 0) continue;
       String tLoca = pLoca.getProperty(sWopm1,"");
       tLoca = (tLoca == null)?"":tLoca.trim();
       if(tLoca.length() == 0) pLoca.put(sWopm1,"location");
       //已消除
       if (sWo17.equalsIgnoreCase("COMP")) {
          String tCount = pComp.getProperty(sWopm1,"");
          tCount =(tCount == null)?"":tCount.trim();
          if(tCount.length() == 0){
            pComp.put(sWopm1,sCount);
          }else{
            tCount =(tCount.length() == 0)?"0":tCount.trim();
            sCount =(sCount.length() == 0)?"0":sCount.trim();
            int iCount = Integer.parseInt(tCount) + Integer.parseInt(sCount);
            pComp.put(sWopm1,Integer.toString(iCount));
          }
       }
       else {
         if (sWo17.equalsIgnoreCase("WOIS") || sWo17.equalsIgnoreCase("WOTEMP")) {
           String tCount = pWois.getProperty(sWopm1, "");
           tCount = (tCount == null) ? "" : tCount.trim();
           if (tCount.length() == 0) {
             pWois.put(sWopm1,sCount);
           }
           else {
             tCount = (tCount.length() == 0) ? "0" : tCount.trim();
             sCount = (sCount.length() == 0) ? "0" : sCount.trim();
             int iCount = Integer.parseInt(tCount) + Integer.parseInt(sCount);
             pWois.put(sWopm1,Integer.toString(iCount));
           }
         }
       }
     }
     //计算合计条数begin
     Vector vSortbefor = new Vector();
     Enumeration e = pLoca.propertyNames();
     while (e.hasMoreElements()) {
       String m_KeyList = (String) e.nextElement();
       m_KeyList =(m_KeyList == null)?"":m_KeyList.trim();
       vSortbefor.addElement(new String(m_KeyList+"@@"));
     }
     Vector vSortafter = genMethod.sortValueStr(vSortbefor,"@@",0,"0",null,0);
     String[][] WfcData = new String[pLoca.size()][6];
     int nloop = vSortafter.size();
     int ay = 0;
     for(int n=0;n<nloop;n++){
       String sl = (String)vSortafter.elementAt(n);
       sl =(sl==null)?"":sl.trim();
       String slf = genMethod.readValueStr(sl, "@@", 0);
       if(slf.length() == 0) continue;
       //开始汇总计算
       //已消除数量
       String sCompCount = pComp.getProperty(slf,"0");
       int iCompCount = Integer.parseInt(sCompCount);
       //未消除数量
       String sWoisCount = pWois.getProperty(slf,"0");
       int iWoisCount = Integer.parseInt(sWoisCount);
       //发现数量
       int iFindCount = iCompCount + iWoisCount;
       //消除率
       float iRateComp = 0.00f;
       if(iFindCount == 0 && iCompCount > 0) iRateComp = 0;
       if(iFindCount == 0 && iCompCount == 0) iRateComp = 0;
       if(iFindCount > 0 && iCompCount > 0) iRateComp = ((float)iCompCount / (float)iFindCount) * 100;
       WfcData[ay][0] = Integer.toString(ay+1);
       WfcData[ay][1] = slf;
       WfcData[ay][2] = Integer.toString(iFindCount);
       WfcData[ay][3] = Integer.toString(iCompCount);
       WfcData[ay][4] = Integer.toString(iWoisCount);
       String sRateComp = Float.toString(iRateComp);
       int sCIndex = 0;
       if(sRateComp.indexOf(".",0) > -1){
          sCIndex = (sRateComp.indexOf(".",0)+4 <=sRateComp.length())?sRateComp.indexOf(".",0)+4:sRateComp.length();
       }else{
          sCIndex = sRateComp.length();
       }
       sRateComp =  sRateComp.substring(0,sCIndex);
       WfcData[ay][5] = sRateComp+"%";
       ay++;
     }
     sqllocal = new StringBuffer(300);
     sqllocal.append("select VALUE,DESCRIPTION").append(" from ").append("ALNDOMAIN");
     sqllocal.append(" where UPPER(TRIM(DOMAINID)) ="+"\'"+"WOPM1"+"\'");
     sqllocal.append(" order by VALUE");
     rlmvQuery = DBCon.runQuery(sqllocal.toString(), conn);
     rlmvQuery = (rlmvQuery == null) ? new QueryResult() :rlmvQuery;
     loopCount = rlmvQuery.size();
     for (int i = 0;i<loopCount;i++) {
       ResultRow resultRow = rlmvQuery.getRow(i);
       String sDesc = resultRow.getValue("DESCRIPTION");
       sDesc = (sDesc == null) ? "" :sDesc.trim();
       String sValue = resultRow.getValue("VALUE");
       sValue = (sValue == null) ? "" :sValue.trim();
       pLocaDesc.put(sValue,sDesc);
     }
     String[][] rWfcData = getReprtTotalData(WfcData,1,"0,2","2,3,4",5,"2,3");
     for(int i=0;i<rWfcData.length;i++){
       rWfcData[i][0] = Integer.toString(i+1);
       String sspec = rWfcData[i][1];
       sspec =(sspec == null)?"":sspec.trim();
       String specDesc = "";
       if(!sspec.equalsIgnoreCase("9")){
         specDesc  = pLocaDesc.getProperty(sspec);
       }else{
         specDesc ="全部专业总合计";
       }
       rWfcData[i][1] = specDesc;
       //System.out.println(rWfcData[i][0]+" "+rWfcData[i][1]+" "+rWfcData[i][2]+" "+rWfcData[i][3]+" "+rWfcData[i][4]+" "+rWfcData[i][5]);
     }
     return rWfcData;
   }

   /**
    * 计算
    *
    */
   public String[][] getReprtWslData(String pstartDate,String pstopDate,String spec) throws Exception {
     String orgIdStr = orgId;
     //String orgIdStr = "HEDGS";
     orgIdStr = (orgIdStr == null) ? "":orgIdStr.trim().toUpperCase();
     String siteIdStr = siteId;
     //String siteIdStr = "HEDSITE";
     siteIdStr =(siteIdStr == null) ? "":siteIdStr.trim();
     Connection conn = MXConnection.getConnection(mxs);
     //Connection conn =  DBCon.getConnection();
     //已发现缺陷
     StringBuffer sqllocal = new StringBuffer(300);
     sqllocal.append("select count(*) C,LOCATION,WO17").append(" from ").append("WORKORDER");
     sqllocal.append(" where (WORKTYPE = \'CM\' AND UPPER(TRIM(SITEID)) ="+"\'"+siteIdStr+"\'"+" AND "+"REPORTDATE >="+"to_date("+"\'"+pstartDate+"\'"+","+"\'"+"YYYY/MM/DD HH24:MI:SS"+"\'"+")"+ " AND REPORTDATE <="+"to_date("+"\'"+pstopDate+"\'"+","+"\'"+"YYYY/MM/DD HH24:MI:SS"+"\'"+") AND WOPM1=\'"+ spec+"\'"+") AND (WO17 =\'COMP\' OR (WO17 =\'WOIS\') OR WO17 =\'WOTEMP\')");
     sqllocal.append(" group by LOCATION,WO17");
     QueryResult rlmvQuery = DBCon.runQuery(sqllocal.toString(), conn);
     rlmvQuery = (rlmvQuery == null) ? new QueryResult() : rlmvQuery;
     int loopCount = rlmvQuery.size();
     if (loopCount == 0)return null;
     Properties pComp = new java.util.Properties();
     Properties pWois = new java.util.Properties();
     Properties pLoca = new java.util.Properties();
     Properties pLocaDesc = new java.util.Properties();
     for (int i = 0; i < loopCount; i++) {
       ResultRow resultRow = rlmvQuery.getRow(i);
       String sCount = resultRow.getValue("C");
       sCount = (sCount == null) ? "" : sCount.trim();
       String sLocation = resultRow.getValue("LOCATION");
       sLocation = (sLocation == null) ? "" : sLocation.trim();
       String sWo17 = resultRow.getValue("WO17");
       sWo17 = (sWo17 == null) ? "" :sWo17.trim();
       //sLocation = (sLocation.length() > 5)?sLocation.substring(0,6):sLocation.trim();
       if(sLocation.length() > 3){
          String ts = "";
          int yloop = sLocation.length();
          for(int y=3;y<yloop;y++){
            String fs = sLocation.substring(y,y+1);
            if(CheckMethod.isInteger(fs)){
              break;
            }else{
              ts = ts+fs;
            }
          }
          sLocation = sLocation.substring(0,3) + ts;
       }
       if(sLocation.length() == 0) continue;
       String tLoca = pLoca.getProperty(sLocation,"");
       tLoca = (tLoca == null)?"":tLoca.trim();
       if(tLoca.length() == 0) pLoca.put(sLocation,"location");
       //已消除
       if (sWo17.equalsIgnoreCase("COMP")) {
          String tCount = pComp.getProperty(sLocation,"");
          tCount =(tCount == null)?"":tCount.trim();
          if(tCount.length() == 0){
            pComp.put(sLocation,sCount);
          }else{
            tCount =(tCount.length() == 0)?"0":tCount.trim();
            sCount =(sCount.length() == 0)?"0":sCount.trim();
            int iCount = Integer.parseInt(tCount) + Integer.parseInt(sCount);
            pComp.put(sLocation,Integer.toString(iCount));
          }
       }
       else {
         if (sWo17.equalsIgnoreCase("WOIS") || sWo17.equalsIgnoreCase("WOTEMP")) {
           String tCount = pWois.getProperty(sLocation, "");
           tCount = (tCount == null) ? "" : tCount.trim();
           if (tCount.length() == 0) {
             pWois.put(sLocation,sCount);
           }
           else {
             tCount = (tCount.length() == 0) ? "0" : tCount.trim();
             sCount = (sCount.length() == 0) ? "0" : sCount.trim();
             int iCount = Integer.parseInt(tCount) + Integer.parseInt(sCount);
             pWois.put(sLocation, Integer.toString(iCount));
           }
         }
       }
     }
     //计算合计条数begin
     Vector vSortbefor = new Vector();
     Enumeration e = pLoca.propertyNames();
     while (e.hasMoreElements()) {
       String m_KeyList = (String) e.nextElement();
       m_KeyList =(m_KeyList == null)?"":m_KeyList.trim();
       vSortbefor.addElement(new String(m_KeyList+"@@"));
     }
     Vector vSortafter = genMethod.sortValueStr(vSortbefor,"@@",0,"0",null,0);
     String[][] WfcData = new String[pLoca.size()][7];
     int nloop = vSortafter.size();
     int ay = 0;
     for(int n=0;n<nloop;n++){
       String sl = (String)vSortafter.elementAt(n);
       sl =(sl==null)?"":sl.trim();
       String slf = genMethod.readValueStr(sl, "@@", 0);
       if(slf.length() == 0) continue;
       //开始汇总计算
       //已消除数量
       String sCompCount = pComp.getProperty(slf,"0");
       int iCompCount = Integer.parseInt(sCompCount);
       //未消除数量
       String sWoisCount = pWois.getProperty(slf,"0");
       int iWoisCount = Integer.parseInt(sWoisCount);
       //发现数量
       int iFindCount = iCompCount + iWoisCount;
       //消除率
       float iRateComp = 0.00f;
       if(iFindCount == 0 && iCompCount > 0) iRateComp = 0;
       if(iFindCount == 0 && iCompCount == 0) iRateComp = 0;
       if(iFindCount > 0 && iCompCount > 0) iRateComp = ((float)iCompCount / (float)iFindCount) * 100;
       WfcData[ay][0] = Integer.toString(ay+1);
       WfcData[ay][1] = (slf.length() >1)?slf.substring(0,2):slf;
       WfcData[ay][2] = slf;
       WfcData[ay][3] = Integer.toString(iFindCount);
       WfcData[ay][4] = Integer.toString(iCompCount);
       WfcData[ay][5] = Integer.toString(iWoisCount);
       String sRateComp = Float.toString(iRateComp);
       int sCIndex = 0;
       if(sRateComp.indexOf(".",0) > -1){
          sCIndex = (sRateComp.indexOf(".",0)+4 <=sRateComp.length())?sRateComp.indexOf(".",0)+4:sRateComp.length();
       }else{
          sCIndex = sRateComp.length();
       }
       sRateComp =  sRateComp.substring(0,sCIndex);
       WfcData[ay][6] = sRateComp+"%";
       ay++;
     }
     sqllocal = new StringBuffer(300);
     sqllocal.append("select LOCATION,DESCRIPTION").append(" from ").append("LOCATIONS");
     sqllocal.append(" where UPPER(TRIM(SITEID)) ="+"\'"+siteIdStr+"\'");
     sqllocal.append(" order by LOCATION");
     rlmvQuery = DBCon.runQuery(sqllocal.toString(), conn);
     rlmvQuery = (rlmvQuery == null) ? new QueryResult() :rlmvQuery;
     loopCount = rlmvQuery.size();
     for (int i = 0;i<loopCount;i++) {
       ResultRow resultRow = rlmvQuery.getRow(i);
       String sDesc = resultRow.getValue("DESCRIPTION");
       sDesc = (sDesc == null) ? "" :sDesc.trim();
       String sLocation = resultRow.getValue("LOCATION");
       sLocation = (sLocation == null) ? "" : sLocation.trim();
       pLocaDesc.put(sLocation,sDesc);
     }
     String[][] rWfcData = getReprtWfcTotalData(WfcData,1,"0,1","3,4,5",6,"3,4");
     //String[][] rWfcData = WfcData;
     for(int i=0;i<rWfcData.length;i++){
       //rWfcData[i][0] = Integer.toString(i + 1);
       String ssystem = rWfcData[i][2];
       String systemDesc =pLocaDesc.getProperty(ssystem);
       rWfcData[i][2] = ssystem + " "+systemDesc;
       String sunit = rWfcData[i][1];
       String unitDesc = (!sunit.equalsIgnoreCase("9"))?pLocaDesc.getProperty(sunit, ""):"总";
       if(rWfcData[i][0].indexOf("+",0)>-1){
         unitDesc = unitDesc + "合计";
         rWfcData[i][0] = Integer.toString(i + 1);
         rWfcData[i][2] = "";
       }
       rWfcData[i][1] = unitDesc;
       //System.out.println(rWfcData[i][0]+" "+rWfcData[i][1]+" "+rWfcData[i][2]+" "+rWfcData[i][3]+" "+rWfcData[i][4]+" "+rWfcData[i][5]+" "+rWfcData[i][6]);
     }
     return rWfcData;
   }

   /**
    * 计算
    *
    */
   public String[][] getReprtWdlData(String pstartDate,String pstopDate,String spec) throws Exception {
     String orgIdStr = orgId;
     //String orgIdStr = "HEDGS";
     orgIdStr = (orgIdStr == null) ? "":orgIdStr.trim().toUpperCase();
     String siteIdStr = siteId;
     //String siteIdStr = "HEDSITE";
     siteIdStr =(siteIdStr == null) ? "":siteIdStr.trim();
     Connection conn = MXConnection.getConnection(mxs);
     //Connection conn =  DBCon.getConnection();
     //已发现缺陷
     StringBuffer sqllocal = new StringBuffer(300);
     sqllocal.append("select count(*) C,HDONGROUP,LOCATION,WO17").append(" from ").append("WORKORDER");
     sqllocal.append(" where (WORKTYPE = \'CM\' AND UPPER(TRIM(SITEID)) ="+"\'"+siteIdStr+"\'"+" AND "+"REPORTDATE >="+"to_date("+"\'"+pstartDate+"\'"+","+"\'"+"YYYY/MM/DD HH24:MI:SS"+"\'"+")"+ " AND REPORTDATE <="+"to_date("+"\'"+pstopDate+"\'"+","+"\'"+"YYYY/MM/DD HH24:MI:SS"+"\'"+") AND HDDEPT=\'"+ spec+"\'"+") AND (WO17 =\'COMP\' OR (WO17 =\'WOIS\') OR WO17 =\'WOTEMP\')");
     sqllocal.append(" group by HDONGROUP,LOCATION,WO17");
     QueryResult rlmvQuery = DBCon.runQuery(sqllocal.toString(), conn);
     rlmvQuery = (rlmvQuery == null) ? new QueryResult() : rlmvQuery;
     int loopCount = rlmvQuery.size();
     if (loopCount == 0)return null;
     Properties pComp = new java.util.Properties();
     Properties pWois = new java.util.Properties();
     Properties pLoca = new java.util.Properties();
     Properties pLocaDesc = new java.util.Properties();
     Properties pDeptDesc = new java.util.Properties();
     for (int i = 0; i < loopCount; i++) {
       ResultRow resultRow = rlmvQuery.getRow(i);
       String sCount = resultRow.getValue("C");
       sCount = (sCount == null) ? "" : sCount.trim();
       String sHdongroup = resultRow.getValue("HDONGROUP");
       sHdongroup = (sHdongroup == null) ? "" :sHdongroup.trim();
       String sLocation = resultRow.getValue("LOCATION");
       sLocation = (sLocation == null) ? "" : sLocation.trim();
       String sWo17 = resultRow.getValue("WO17");
       sWo17 = (sWo17 == null) ? "" :sWo17.trim();
       if (sLocation.length() > 3) {
         String ts = "";
         int yloop = sLocation.length();
         for (int y = 3; y < yloop; y++) {
           String fs = sLocation.substring(y, y + 1);
           if (CheckMethod.isInteger(fs)) {
             break;
           }
           else {
             ts = ts + fs;
           }
         }
         sLocation = sLocation.substring(0, 3) + ts;
       }
       //sLocation = (sLocation.length() > 5)?sLocation.substring(0,6):sLocation.trim();
       if(sLocation.length() == 0) continue;
       String sHdongrp = (sHdongroup.length() > 3)?sHdongroup.substring(0,4):sHdongroup.trim();
       if(sHdongrp.length() != 4) continue;
       String keyStr = sHdongrp + "@@"+ sLocation;
       String tkey = pLoca.getProperty(keyStr,"");
       tkey = (tkey == null)?"":tkey.trim();
       if(tkey.length() == 0) pLoca.put(keyStr,"key");
       //已消除
       if (sWo17.equalsIgnoreCase("COMP")) {
          String tCount = pComp.getProperty(keyStr,"");
          tCount =(tCount == null)?"":tCount.trim();
          if(tCount.length() == 0){
            pComp.put(keyStr,sCount);
          }else{
            tCount =(tCount.length() == 0)?"0":tCount.trim();
            sCount =(sCount.length() == 0)?"0":sCount.trim();
            int iCount = Integer.parseInt(tCount) + Integer.parseInt(sCount);
            pComp.put(keyStr,Integer.toString(iCount));
          }
       }
       else {
         if (sWo17.equalsIgnoreCase("WOIS") || sWo17.equalsIgnoreCase("WOTEMP")) {
           String tCount = pWois.getProperty(keyStr, "");
           tCount = (tCount == null) ? "" : tCount.trim();
           if (tCount.length() == 0) {
             pWois.put(keyStr,sCount);
           }
           else {
             tCount = (tCount.length() == 0) ? "0" : tCount.trim();
             sCount = (sCount.length() == 0) ? "0" : sCount.trim();
             int iCount = Integer.parseInt(tCount) + Integer.parseInt(sCount);
             pWois.put(keyStr,Integer.toString(iCount));
           }
         }
       }
     }
     //计算合计条数begin
     Vector vSortbefor = new Vector();
     Enumeration e = pLoca.propertyNames();
     while (e.hasMoreElements()) {
       String m_KeyList = (String) e.nextElement();
       m_KeyList =(m_KeyList == null)?"":m_KeyList.trim();
       vSortbefor.addElement(new String(m_KeyList+"@@"));
     }
     Vector vSortafter = genMethod.sortValueStr(vSortbefor,"@@",0,"0",null,0);
     String[][] WfcData = new String[pLoca.size()][8];
     int nloop = vSortafter.size();
     int ay = 0;
     for(int n=0;n<nloop;n++){
       String sl = (String)vSortafter.elementAt(n);
       sl =(sl==null)?"":sl.trim();
       String slg = genMethod.readValueStr(sl, "@@", 0);
       String sll = genMethod.readValueStr(sl, "@@", 1);
       //System.out.println("slf="+slf);
       String slf = slg + "@@" + sll;
       if(slg .length() == 0) continue;
       //开始汇总计算
       //已消除数量
       String sCompCount = pComp.getProperty(slf,"0");
       int iCompCount = Integer.parseInt(sCompCount);
       //未消除数量
       String sWoisCount = pWois.getProperty(slf,"0");
       int iWoisCount = Integer.parseInt(sWoisCount);
       //发现数量
       int iFindCount = iCompCount + iWoisCount;
       //消除率
       float iRateComp = 0.00f;
       if(iFindCount == 0 && iCompCount > 0) iRateComp = 0;
       if(iFindCount == 0 && iCompCount == 0) iRateComp = 0;
       if(iFindCount > 0 && iCompCount > 0) iRateComp = ((float)iCompCount / (float)iFindCount) * 100;
       WfcData[ay][0] = Integer.toString(ay+1);
       WfcData[ay][1] = slg;
       WfcData[ay][2] = (sll.length() >2)?sll.substring(0,3):sll.trim();;
       WfcData[ay][3] = sll;
       WfcData[ay][4] = Integer.toString(iFindCount);
       WfcData[ay][5] = Integer.toString(iCompCount);
       WfcData[ay][6] = Integer.toString(iWoisCount);
       String sRateComp = Float.toString(iRateComp);
       int sCIndex = 0;
       if(sRateComp.indexOf(".",0) > -1){
          sCIndex = (sRateComp.indexOf(".",0)+4 <=sRateComp.length())?sRateComp.indexOf(".",0)+4:sRateComp.length();
       }else{
          sCIndex = sRateComp.length();
       }
       sRateComp =  sRateComp.substring(0,sCIndex);
       WfcData[ay][7] = sRateComp+"%";
       ay++;
     }
     sqllocal = new StringBuffer(300);
     sqllocal.append("select LOCATION,DESCRIPTION").append(" from ").append("LOCATIONS");
     sqllocal.append(" where UPPER(TRIM(SITEID)) ="+"\'"+siteIdStr+"\'");
     sqllocal.append(" order by LOCATION");
     rlmvQuery = DBCon.runQuery(sqllocal.toString(), conn);
     rlmvQuery = (rlmvQuery == null) ? new QueryResult() :rlmvQuery;
     loopCount = rlmvQuery.size();
     for (int i = 0;i<loopCount;i++) {
       ResultRow resultRow = rlmvQuery.getRow(i);
       String sDesc = resultRow.getValue("DESCRIPTION");
       sDesc = (sDesc == null) ? "" :sDesc.trim();
       String sLocation = resultRow.getValue("LOCATION");
       sLocation = (sLocation == null) ? "" : sLocation.trim();
       pLocaDesc.put(sLocation,sDesc);
     }
     sqllocal = new StringBuffer(300);
     sqllocal.append("select DEPTNUM,DESCRIPTION").append(" from ").append("DEPT");
     sqllocal.append(" where UPPER(TRIM(SITEID)) ="+"\'"+siteIdStr+"\'"+" AND "+"LENGTH(TRIM(DEPTNUM)) = 4");
     sqllocal.append(" order by DEPTNUM");
     rlmvQuery = DBCon.runQuery(sqllocal.toString(), conn);
     rlmvQuery = (rlmvQuery == null) ? new QueryResult() :rlmvQuery;
     loopCount = rlmvQuery.size();
     for (int i = 0;i<loopCount;i++) {
       ResultRow resultRow = rlmvQuery.getRow(i);
       String sDesc = resultRow.getValue("DESCRIPTION");
       sDesc = (sDesc == null) ? "" :sDesc.trim();
       String sDeptnum = resultRow.getValue("DEPTNUM");
       sDeptnum = (sDeptnum == null) ? "" :sDeptnum.trim();
       pDeptDesc.put(sDeptnum,sDesc);
     }
     String[][] rWfcData = getReprtWfcTotalData(WfcData,1,"0,4","4,5,6",7,"4,5");
     String firstDept ="";
     String firstUnit = "";
     for(int i=0;i<rWfcData.length;i++){
       //rWfcData[i][0] = Integer.toString(i + 1);
       String ssystem = rWfcData[i][3];
       String systemDesc =pLocaDesc.getProperty(ssystem);
       rWfcData[i][3] = ssystem + " "+systemDesc;
       String sunit = rWfcData[i][2];
       String sgroup = rWfcData[i][1];
       //System.out.println("sunit="+sunit);
       String deptDesc = (!sgroup.equalsIgnoreCase("9"))?deptDesc = pDeptDesc.getProperty(sgroup):"总";
       String unitDesc = "";
       if(rWfcData[i][0].indexOf("+",0)>-1){
         deptDesc = deptDesc + "合计";
         rWfcData[i][0] = Integer.toString(i + 1);
         rWfcData[i][2] = "";
         rWfcData[i][3] = "";
         rWfcData[i][1] = deptDesc;
       }else{
         sgroup = rWfcData[i][1];
         deptDesc = pDeptDesc.getProperty(sgroup);
         rWfcData[i][1] = deptDesc;
       }
       if(!firstUnit.equalsIgnoreCase(unitDesc)){
         rWfcData[i][2] = unitDesc;
         firstUnit = unitDesc;
       }else{
         rWfcData[i][2] = "";
       }
       if(!firstDept.equalsIgnoreCase(deptDesc)){
         rWfcData[i][1] =deptDesc;
         firstDept = deptDesc;
       }else{
         rWfcData[i][1] = "";
       }
       //System.out.println(rWfcData[i][0]+" "+rWfcData[i][1]+" "+rWfcData[i][2]+" "+rWfcData[i][3]+" "+rWfcData[i][4]+" "+rWfcData[i][5]+" "+rWfcData[i][6]+" "+rWfcData[i][7]);
     }

     return rWfcData;
   }

   /**
    * 计算
    *
    */
   public String[][] getReprtWglData(String pstartDate,String pstopDate,String spec) throws Exception {
     String orgIdStr = orgId;
     //String orgIdStr = "HEDGS";
     orgIdStr = (orgIdStr == null) ? "":orgIdStr.trim().toUpperCase();
     String siteIdStr = siteId;
     //String siteIdStr = "HEDSITE";
     siteIdStr =(siteIdStr == null) ? "":siteIdStr.trim();
     Connection conn = MXConnection.getConnection(mxs);
     //Connection conn =  DBCon.getConnection();
     //已发现缺陷
     StringBuffer sqllocal = new StringBuffer(300);
     sqllocal.append("select count(*) C,WO18,LOCATION,WO17").append(" from ").append("WORKORDER");
     sqllocal.append(" where (WORKTYPE = \'CM\' AND UPPER(TRIM(SITEID)) ="+"\'"+siteIdStr+"\'"+" AND "+"REPORTDATE >="+"to_date("+"\'"+pstartDate+"\'"+","+"\'"+"YYYY/MM/DD HH24:MI:SS"+"\'"+")"+ " AND REPORTDATE <="+"to_date("+"\'"+pstopDate+"\'"+","+"\'"+"YYYY/MM/DD HH24:MI:SS"+"\'"+") AND HDONGROUP=\'"+ spec+"\'"+") AND (WO17 =\'COMP\' OR (WO17 =\'WOIS\') OR WO17 =\'WOTEMP\')");
     sqllocal.append(" group by WO18,LOCATION,WO17");
     QueryResult rlmvQuery = DBCon.runQuery(sqllocal.toString(), conn);
     rlmvQuery = (rlmvQuery == null) ? new QueryResult() : rlmvQuery;
     int loopCount = rlmvQuery.size();
     if (loopCount == 0)return null;
     Properties pComp = new java.util.Properties();
     Properties pWois = new java.util.Properties();
     Properties pLoca = new java.util.Properties();
     Properties pLocaDesc = new java.util.Properties();
     Properties pLaborDesc = new java.util.Properties();
     for (int i = 0; i < loopCount; i++) {
       ResultRow resultRow = rlmvQuery.getRow(i);
       String sCount = resultRow.getValue("C");
       sCount = (sCount == null) ? "" : sCount.trim();
       String sWo18 = resultRow.getValue("WO18");
       sWo18 = (sWo18 == null) ? "" :sWo18.trim();
       String sLocation = resultRow.getValue("LOCATION");
       sLocation = (sLocation == null) ? "" : sLocation.trim();
       String sWo17 = resultRow.getValue("WO17");
       sWo17 = (sWo17 == null) ? "" :sWo17.trim();
       if(sLocation.length() > 3){
          String ts = "";
          int yloop = sLocation.length();
          for(int y=3;y<yloop;y++){
            String fs = sLocation.substring(y,y+1);
            if(CheckMethod.isInteger(fs)){
              break;
            }else{
              ts = ts+fs;
            }
          }
          sLocation = sLocation.substring(0,3) + ts;
       }
       //sLocation = (sLocation.length() > 5)?sLocation.substring(0,6):sLocation.trim();
       if(sLocation.length() == 0) continue;
       String sFindby = sWo18;
       String keyStr = sFindby+ "," + sLocation+",";
       String tkey = pLoca.getProperty(keyStr,"");
       tkey = (tkey == null)?"":tkey.trim();
       if(tkey.length() == 0) pLoca.put(keyStr,"key");
       //已消除
       if (sWo17.equalsIgnoreCase("COMP")) {
          String tCount = pComp.getProperty(keyStr,"");
          tCount =(tCount == null)?"":tCount.trim();
          if(tCount.length() == 0){
            pComp.put(keyStr,sCount);
          }else{
            tCount =(tCount.length() == 0)?"0":tCount.trim();
            sCount =(sCount.length() == 0)?"0":sCount.trim();
            int iCount = Integer.parseInt(tCount) + Integer.parseInt(sCount);
            pComp.put(keyStr,Integer.toString(iCount));
          }
       }
       else {
         if (sWo17.equalsIgnoreCase("WOIS") || sWo17.equalsIgnoreCase("WOTEMP")) {
           String tCount = pWois.getProperty(keyStr, "");
           tCount = (tCount == null) ? "" : tCount.trim();
           if (tCount.length() == 0) {
             pWois.put(keyStr,sCount);
           }
           else {
             tCount = (tCount.length() == 0) ? "0" : tCount.trim();
             sCount = (sCount.length() == 0) ? "0" : sCount.trim();
             int iCount = Integer.parseInt(tCount) + Integer.parseInt(sCount);
             pWois.put(keyStr,Integer.toString(iCount));
           }
         }
       }
     }
     //计算合计条数begin
     Vector vSortbefor = new Vector();
     Enumeration e = pLoca.propertyNames();
     while (e.hasMoreElements()) {
       String m_KeyList = (String) e.nextElement();
       m_KeyList =(m_KeyList == null)?"":m_KeyList.trim();
       vSortbefor.addElement(new String(m_KeyList+"@@"));
     }
     Vector vSortafter = genMethod.sortValueStr(vSortbefor,"@@",0,"0",null,0);
     String[][] WfcData = new String[pLoca.size()][8];
     int nloop = vSortafter.size();
     int ay = 0;
     for(int n=0;n<nloop;n++){
       String sl = (String)vSortafter.elementAt(n);
       sl =(sl==null)?"":sl.trim();
       String slf = genMethod.readValueStr(sl, "@@", 0);
       if(slf.length() == 0) continue;
       //开始汇总计算
       //已消除数量
       String sCompCount = pComp.getProperty(slf,"0");

       int iCompCount = Integer.parseInt(sCompCount);
       //未消除数量
       String sWoisCount = pWois.getProperty(slf,"0");

       int iWoisCount = Integer.parseInt(sWoisCount);
       //发现数量
       int iFindCount = iCompCount + iWoisCount;
       //消除率
       float iRateComp = 0.00f;
       if(iFindCount == 0 && iCompCount > 0) iRateComp = 0;
       if(iFindCount == 0 && iCompCount == 0) iRateComp = 0;
       if(iFindCount > 0 && iCompCount > 0) iRateComp = ((float)iCompCount / (float)iFindCount) * 100;
       WfcData[ay][0] = Integer.toString(ay+1);
       WfcData[ay][1] = genMethod.readValueStr(slf,",",0);
       String tslf = genMethod.readValueStr(slf,",",1);
       WfcData[ay][2] = (tslf.length() >2)?tslf.substring(0,3):tslf;
       WfcData[ay][3] = tslf;
       WfcData[ay][4] = Integer.toString(iFindCount);
       WfcData[ay][5] = Integer.toString(iCompCount);
       WfcData[ay][6] = Integer.toString(iWoisCount);
       String sRateComp = Float.toString(iRateComp);
       int sCIndex = 0;
       if(sRateComp.indexOf(".",0) > -1){
          sCIndex = (sRateComp.indexOf(".",0)+4 <=sRateComp.length())?sRateComp.indexOf(".",0)+4:sRateComp.length();
       }else{
          sCIndex = sRateComp.length();
       }
       sRateComp =  sRateComp.substring(0,sCIndex);
       WfcData[ay][7] = sRateComp+"%";
       ay++;
     }
     sqllocal = new StringBuffer(300);
     sqllocal.append("select LOCATION,DESCRIPTION").append(" from ").append("LOCATIONS");
     sqllocal.append(" where UPPER(TRIM(SITEID)) ="+"\'"+siteIdStr+"\'");
     sqllocal.append(" order by LOCATION");
     rlmvQuery = DBCon.runQuery(sqllocal.toString(), conn);
     rlmvQuery = (rlmvQuery == null) ? new QueryResult() :rlmvQuery;
     loopCount = rlmvQuery.size();
     for (int i = 0;i<loopCount;i++) {
       ResultRow resultRow = rlmvQuery.getRow(i);
       String sDesc = resultRow.getValue("DESCRIPTION");
       sDesc = (sDesc == null) ? "" :sDesc.trim();
       String sLocation = resultRow.getValue("LOCATION");
       sLocation = (sLocation == null) ? "" : sLocation.trim();
       pLocaDesc.put(sLocation,sDesc);
     }
     sqllocal = new StringBuffer(300);
     sqllocal.append("select PERSONID,DISPLAYNAME").append(" from ").append("PERSON");
     sqllocal.append(" order by PERSONID");
     rlmvQuery = DBCon.runQuery(sqllocal.toString(), conn);
     rlmvQuery = (rlmvQuery == null) ? new QueryResult() :rlmvQuery;
     loopCount = rlmvQuery.size();
     for (int i = 0;i<loopCount;i++) {
       ResultRow resultRow = rlmvQuery.getRow(i);
       String sName = resultRow.getValue("DISPLAYNAME");
       sName = (sName == null) ? "" :sName.trim();
       String sLaborCode = resultRow.getValue("PERSONID");
       sLaborCode = (sLaborCode == null) ? "":sLaborCode.trim();
       pLaborDesc.put(sLaborCode,sName);
     }
     String[][] rWfcData = getReprtWfcTotalDataNoLength(WfcData,1,"4,5,6",7,"4,5");
     String firstlabor ="";
     String firstUnit = "";
     for(int i=0;i<rWfcData.length;i++){
       //rWfcData[i][0] = Integer.toString(i + 1);
       String ssystem = rWfcData[i][3];
       String systemDesc =pLocaDesc.getProperty(ssystem);
       rWfcData[i][3] = ssystem + " "+systemDesc;
       String sunit = rWfcData[i][2];
       String unitDesc = pLocaDesc.getProperty(sunit);
       rWfcData[i][2] = unitDesc;
       String sLaborCode = rWfcData[i][1];
       sLaborCode =(sLaborCode == null)?"":sLaborCode.trim();
       //System.out.println("sLaborCode="+sLaborCode);
       String laborDesc = (!sLaborCode.equalsIgnoreCase("9"))?pLaborDesc.getProperty(sLaborCode,""):"总";
       //String unitDesc = "";
       if (rWfcData[i][0].indexOf("+", 0) > -1) {
         laborDesc = laborDesc + " 合计";
         rWfcData[i][0] = Integer.toString(i + 1);
         rWfcData[i][2] = "";
         rWfcData[i][3] = "";
         rWfcData[i][1] = laborDesc;
       }
       else {
         rWfcData[i][1] = laborDesc;
         if (!firstUnit.equalsIgnoreCase(unitDesc)) {
           rWfcData[i][2] = unitDesc;
           firstUnit = unitDesc;
         }
         else {
           rWfcData[i][2] = "";
         }
         if (!firstlabor.equalsIgnoreCase(laborDesc)) {
           rWfcData[i][1] = laborDesc;
           firstlabor = laborDesc;
         }
         else {
           rWfcData[i][1] = "";
         }
       }
       //System.out.println(rWfcData[i][0]+" "+rWfcData[i][1]+" "+rWfcData[i][2]+" "+rWfcData[i][3]+" "+rWfcData[i][4]+" "+rWfcData[i][5]+" "+rWfcData[i][6]+" "+rWfcData[i][7]);
     }

     return rWfcData;
   }

   /**
    * 计算
    *
    */
   public String[][] getReprtWgcData(String pstartDate,String pstopDate) throws Exception {
     String orgIdStr = orgId;
     //String orgIdStr = "HEDGS";
     orgIdStr = (orgIdStr == null) ? "":orgIdStr.trim().toUpperCase();
     String siteIdStr = siteId;
     //String siteIdStr = "HEDSITE";
     siteIdStr =(siteIdStr == null) ? "":siteIdStr.trim();
     Connection conn = MXConnection.getConnection(mxs);
     //Connection conn =  DBCon.getConnection();
     //已发现缺陷
     StringBuffer sqllocal = new StringBuffer(300);
     sqllocal.append("select count(*) C,HDONGROUP,LOCATION,WO17").append(" from ").append("WORKORDER");
     sqllocal.append(" where (WORKTYPE = \'CM\' AND UPPER(TRIM(SITEID)) ="+"\'"+siteIdStr+"\'"+" AND "+"REPORTDATE >="+"to_date("+"\'"+pstartDate+"\'"+","+"\'"+"YYYY/MM/DD HH24:MI:SS"+"\'"+")"+ " AND REPORTDATE <="+"to_date("+"\'"+pstopDate+"\'"+","+"\'"+"YYYY/MM/DD HH24:MI:SS"+"\'"+")) AND (WO17 =\'COMP\' OR (WO17 =\'WOIS\') OR WO17 =\'WOTEMP\')");
     sqllocal.append(" group by HDONGROUP,LOCATION,WO17");
     QueryResult rlmvQuery = DBCon.runQuery(sqllocal.toString(), conn);
     rlmvQuery = (rlmvQuery == null) ? new QueryResult() : rlmvQuery;
     int loopCount = rlmvQuery.size();
     if (loopCount == 0)return null;
     Properties pComp = new java.util.Properties();
     Properties pWois = new java.util.Properties();
     Properties pLoca = new java.util.Properties();
     //Properties pLocaDesc = new java.util.Properties();
     Properties pDeptDesc = new java.util.Properties();
     for (int i = 0; i < loopCount; i++) {
       ResultRow resultRow = rlmvQuery.getRow(i);
       String sCount = resultRow.getValue("C");
       sCount = (sCount == null) ? "" : sCount.trim();
       String sHdongroup = resultRow.getValue("HDONGROUP");
       sHdongroup = (sHdongroup == null) ? "":sHdongroup.trim();
       String sLocation = resultRow.getValue("LOCATION");
       sLocation = (sLocation == null) ? "" : sLocation.trim();
       String sWo17 = resultRow.getValue("WO17");
       sWo17 = (sWo17 == null) ? "" :sWo17.trim();
       if(sLocation.length() > 3){
          String ts = "";
          int yloop = sLocation.length();
          for(int y=3;y<yloop;y++){
            String fs = sLocation.substring(y,y+1);
            if(CheckMethod.isInteger(fs)){
              break;
            }else{
              ts = ts+fs;
            }
          }
          sLocation = sLocation.substring(0,3) + ts;
       }
       //sLocation = (sLocation.length() > 5)?sLocation.substring(0,6):sLocation.trim();
       if(sLocation.length() == 0) continue;
       String sFindby = sHdongroup;
       String keyStr = sFindby;
       String tkey = pLoca.getProperty(keyStr,"");
       tkey = (tkey == null)?"":tkey.trim();
       if(tkey.length() == 0) pLoca.put(keyStr,"key");
       //已消除
       if (sWo17.equalsIgnoreCase("COMP")) {
          String tCount = pComp.getProperty(keyStr,"");
          tCount =(tCount == null)?"":tCount.trim();
          if(tCount.length() == 0){
            pComp.put(keyStr,sCount);
          }else{
            tCount =(tCount.length() == 0)?"0":tCount.trim();
            sCount =(sCount.length() == 0)?"0":sCount.trim();
            int iCount = Integer.parseInt(tCount) + Integer.parseInt(sCount);
            pComp.put(keyStr,Integer.toString(iCount));
          }
       }
       else {
         if (sWo17.equalsIgnoreCase("WOIS") || sWo17.equalsIgnoreCase("WOTEMP")) {
           String tCount = pWois.getProperty(keyStr, "");
           tCount = (tCount == null) ? "" : tCount.trim();
           if (tCount.length() == 0) {
             pWois.put(keyStr,sCount);
           }
           else {
             tCount = (tCount.length() == 0) ? "0" : tCount.trim();
             sCount = (sCount.length() == 0) ? "0" : sCount.trim();
             int iCount = Integer.parseInt(tCount) + Integer.parseInt(sCount);
             pWois.put(keyStr,Integer.toString(iCount));
           }
         }
       }
     }
     //计算合计条数begin
     Vector vSortbefor = new Vector();
     Enumeration e = pLoca.propertyNames();
     while (e.hasMoreElements()) {
       String m_KeyList = (String) e.nextElement();
       m_KeyList =(m_KeyList == null)?"":m_KeyList.trim();
       vSortbefor.addElement(new String(m_KeyList+"@@"));
     }
     Vector vSortafter = genMethod.sortValueStr(vSortbefor,"@@",0,"0",null,0);
     String[][] WfcData = new String[pLoca.size()][6];
     int nloop = vSortafter.size();
     int ay = 0;
     for(int n=0;n<nloop;n++){
       String sl = (String)vSortafter.elementAt(n);
       sl =(sl==null)?"":sl.trim();
       String slf = genMethod.readValueStr(sl, "@@", 0);
       if(slf.length() == 0) continue;
       //开始汇总计算
       //已消除数量
       String sCompCount = pComp.getProperty(slf,"0");
       int iCompCount = Integer.parseInt(sCompCount);
       //未消除数量
       String sWoisCount = pWois.getProperty(slf,"0");
       int iWoisCount = Integer.parseInt(sWoisCount);
       //发现数量
       int iFindCount = iCompCount + iWoisCount;
       //消除率
       float iRateComp = 0.00f;
       if(iFindCount == 0 && iCompCount > 0) iRateComp = 0;
       if(iFindCount == 0 && iCompCount == 0) iRateComp = 0;
       if(iFindCount > 0 && iCompCount > 0) iRateComp = ((float)iCompCount / (float)iFindCount) * 100;
       WfcData[ay][0] = Integer.toString(ay+1);
       WfcData[ay][1] = slf;
       WfcData[ay][2] = Integer.toString(iFindCount);
       WfcData[ay][3] = Integer.toString(iCompCount);
       WfcData[ay][4] = Integer.toString(iWoisCount);
       String sRateComp = Float.toString(iRateComp);
       int sCIndex = 0;
       if(sRateComp.indexOf(".",0) > -1){
          sCIndex = (sRateComp.indexOf(".",0)+4 <=sRateComp.length())?sRateComp.indexOf(".",0)+4:sRateComp.length();
       }else{
          sCIndex = sRateComp.length();
       }
       sRateComp =  sRateComp.substring(0,sCIndex);
       WfcData[ay][5] = sRateComp+"%";
       ay++;
     }
     sqllocal = new StringBuffer(300);
     sqllocal.append("select DEPTNUM,DESCRIPTION").append(" from ").append("DEPT");
     sqllocal.append(" where UPPER(TRIM(SITEID)) ="+"\'"+siteIdStr+"\'");
     sqllocal.append(" order by DEPTNUM");
     rlmvQuery = DBCon.runQuery(sqllocal.toString(), conn);
     rlmvQuery = (rlmvQuery == null) ? new QueryResult() :rlmvQuery;
     loopCount = rlmvQuery.size();
     for (int i = 0;i<loopCount;i++) {
       ResultRow resultRow = rlmvQuery.getRow(i);
       String sDesc = resultRow.getValue("DESCRIPTION");
       sDesc = (sDesc == null) ? "" :sDesc.trim();
       String sDeptnum = resultRow.getValue("DEPTNUM");
       sDeptnum = (sDeptnum == null) ? "" :sDeptnum.trim();
       pDeptDesc.put(sDeptnum,sDesc);
     }
     String[][] rWfcData = getReprtWfcTotalData(WfcData,1,"0,2","2,3,4",5,"2,3");
     String firstDept ="";
     for(int i=0;i<rWfcData.length;i++){
       //rWfcData[i][0] = Integer.toString(i+1);
       String sDeptnum = rWfcData[i][1];
       String sfind = rWfcData[i][2];
       String deptDesc = (!sDeptnum.equalsIgnoreCase("9"))?pDeptDesc.getProperty(sDeptnum,""):"总";
       //String unitDesc = "";
       if (rWfcData[i][0].indexOf("+", 0) > -1) {
         deptDesc = deptDesc + " 合计";
         rWfcData[i][0] = Integer.toString(i + 1);
         rWfcData[i][1] = deptDesc;
       }
       else {
         if (!firstDept.equalsIgnoreCase(deptDesc)) {
           rWfcData[i][1] = deptDesc;
           firstDept = deptDesc;
         }
         else {
           rWfcData[i][1] = "";
         }
       }
       //System.out.println(rWfcData[i][0]+" "+rWfcData[i][1]+" "+rWfcData[i][2]+" "+rWfcData[i][3]+" "+rWfcData[i][4]+" "+rWfcData[i][5]);
     }
     return rWfcData;
   }

 /**
   * 计算
   *
   */
  public String[][] getReprtWllData(String pstartDate,String pstopDate,String plaborCode) throws Exception {
    String orgIdStr = orgId;
    //String orgIdStr = "HEDGS";
    orgIdStr = (orgIdStr == null) ? "":orgIdStr.trim().toUpperCase();
    String siteIdStr = siteId;
    //String siteIdStr = "HEDSITE";
    siteIdStr =(siteIdStr == null) ? "":siteIdStr.trim();
    Connection conn = MXConnection.getConnection(mxs);
    //Connection conn =  DBCon.getConnection();
    //已发现缺陷
    StringBuffer sqllocal = new StringBuffer(300);
    sqllocal.append("select a.LOCATION al,b.DESCRIPTION bd,a.DESCRIPTION ad,a.ASSETNUM ae,a.REPORTDATE ar,a.STATUSDATE ass,a.WO17 aw").append(" from ").append("WORKORDER a,LOCATIONS b");
    sqllocal.append(" where (a.WORKTYPE = \'CM\' AND a.SITEID ="+"\'"+siteIdStr+"\'"+" AND "+"a.REPORTDATE >="+"to_date("+"\'"+pstartDate+"\'"+","+"\'"+"YYYY/MM/DD HH24:MI:SS"+"\'"+")"+ " AND a.REPORTDATE <="+"to_date("+"\'"+pstopDate+"\'"+","+"\'"+"YYYY/MM/DD HH24:MI:SS"+"\'"+") AND a.WO18=\'"+ plaborCode+"\'"+") AND (a.WO17 =\'COMP\' OR (a.WO17 =\'WOIS\') OR a.WO17 =\'WOTEMP\') AND a.LOCATION = b.LOCATION");
    sqllocal.append(" order by a.LOCATION,a.WO17");
    //System.out.println("sqllocal.toString()="+sqllocal.toString());
    QueryResult rlmvQuery = DBCon.runQuery(sqllocal.toString(), conn);
    rlmvQuery = (rlmvQuery == null) ? new QueryResult() : rlmvQuery;
    //System.out.println("rlmvQuery size="+rlmvQuery.size());
    int loopCount = rlmvQuery.size();
    if (loopCount == 0)return null;
    int aSize = loopCount;
    String[][] WfcData = new String[loopCount+1][8];
    for (int i = 0; i < loopCount; i++) {
      ResultRow resultRow = rlmvQuery.getRow(i);
      String sal = resultRow.getValue("AL");
      sal = (sal == null) ? "" :sal.trim();
      String sbd = resultRow.getValue("BD");
      sbd = (sbd == null) ? "" :sbd.trim();
      String sad = resultRow.getValue("AD");
      sad = (sad == null) ? "" :sad.trim();
      String sae = resultRow.getValue("AE");
      sae = (sae == null) ? "" :sae.trim();
      String scd = "";
      scd = (scd == null) ? "" :scd.trim();
      String sar = resultRow.getValue("AR");
      sar= (sar == null) ? "" :sar.trim();
      String sas = resultRow.getValue("ASS");
      sas= (sas == null) ? "" :sas.trim();
      String saw = resultRow.getValue("AW");
      saw= (saw == null) ? "" :saw.trim();
      WfcData[i][0] = Integer.toString(i+1);
      WfcData[i][1] = (sal.length() >2)?sal.substring(0,3):"";
      WfcData[i][2] = sbd;
      WfcData[i][3] = sad;
      WfcData[i][4] = scd;
      WfcData[i][5] = genMethod.readValueStr(sar,".",0);
      if (saw.equalsIgnoreCase("COMP")){
        WfcData[i][6] = genMethod.readValueStr(sas,".",0);
        WfcData[i][7] = "已消除";
      }else {
        if (saw.equalsIgnoreCase("WOIS") || saw.equalsIgnoreCase("WOTEMP")) {
          WfcData[i][6] = "";
          WfcData[i][7] = "未消除";
        }
      }
      //System.out.println(WfcData[i][0]+" "+WfcData[i][1]+" "+WfcData[i][2]+" "+WfcData[i][3]+" "+WfcData[i][4]+" "+WfcData[i][5]+" "+WfcData[i][6]+" "+WfcData[i][7]);
    }
    Properties pLocaDesc = new java.util.Properties();
    sqllocal = new StringBuffer(300);
    sqllocal.append("select LOCATION,DESCRIPTION").append(" from ").append("LOCATIONS");
    sqllocal.append(" where UPPER(TRIM(SITEID)) =" + "\'" + siteIdStr + "\'"+" AND LENGTH(LOCATION) = 3");
    sqllocal.append(" order by LOCATION");
    rlmvQuery = DBCon.runQuery(sqllocal.toString(), conn);
    rlmvQuery = (rlmvQuery == null) ? new QueryResult() : rlmvQuery;
    loopCount = rlmvQuery.size();
    for (int i = 0; i < loopCount; i++) {
      ResultRow resultRow = rlmvQuery.getRow(i);
      String sDesc = resultRow.getValue("DESCRIPTION");
      sDesc = (sDesc == null) ? "" : sDesc.trim();
      String sLocation = resultRow.getValue("LOCATION");
      sLocation = (sLocation == null) ? "" : sLocation.trim();
      pLocaDesc.put(sLocation, sDesc);
    }
    int cln = 0;
    for (int i = 0; i < aSize; i++) {
      String unit = WfcData[i][1];
      unit = (unit == null)?"":unit.trim();
      WfcData[cln][1] = pLocaDesc.getProperty(unit,"");
      cln++;
      //System.out.println(WfcData[i][0]+" "+WfcData[i][1]+" "+WfcData[i][2]+" "+WfcData[i][3]+" "+WfcData[i][4]+" "+WfcData[i][5]+" "+WfcData[i][6]+" "+WfcData[i][7]);
    }
    WfcData[cln][0] = Integer.toString(cln+1);
    WfcData[cln][1] = "";
    WfcData[cln][2] = "";
    WfcData[cln][3] = " 总合计";
    WfcData[cln][4] = Integer.toString(loopCount);
    WfcData[cln][5] = "";
    WfcData[cln][6] = "";
    WfcData[cln][7] = "";
    //System.out.println(WfcData[cln][0]+" "+WfcData[cln][1]+" "+WfcData[cln][2]+" "+WfcData[cln][3]+" "+WfcData[cln][4]+" "+WfcData[cln][5]+" "+WfcData[cln][6]+" "+WfcData[cln][7]);
    return WfcData;
  }

  /**
   * 计算合计
   *
   */
  public String[][] getReprtWfcTotalData(String[][] m_data,int m_colNoTotal,String m_colmTotalStr,String m_colmSum,int colmPercent,String colmNoPercent) throws Exception {
                                       //getReprtWfcTotalData(WfcData,1,"0,1","3,4,5",6,"3,4")
    Properties ptotal = new java.util.Properties();
    //计算合计条数begin
    int loop = m_data.length;
    int totalRecod = 0;
    //计算合计位数必须大于多少
    String[] aColmTotalStr = genMethod.split(m_colmTotalStr,",");
    String[] sColmSum = genMethod.split(m_colmSum,",");
    int[] iColmSum = new int[sColmSum.length];
    int kloop = sColmSum.length;
    for(int k = 0;k<kloop;k++){
      String s = sColmSum[k];
      s =(s == null)?"0":s.trim();
      iColmSum[k] = Integer.parseInt(s);
    }
    String[] sColmNoPercent = genMethod.split(colmNoPercent,",");
    int[] iColmNoPercent = new int[sColmNoPercent.length];
    kloop = sColmNoPercent.length;
    for(int k = 0;k<kloop;k++){
      String s = sColmNoPercent[k];
      s =(s == null)?"0":s.trim();
      iColmNoPercent[k] = Integer.parseInt(s);
    }
    int iMaxLength = Integer.parseInt(aColmTotalStr[1]) - Integer.parseInt(aColmTotalStr[0])-1;
    for(int i=0;i<loop;i++){
      String s = m_data[i][m_colNoTotal];
      s =(s == null)?"":s.trim();
      if(s.length() > iMaxLength){
        String utotal = s.substring(Integer.parseInt(aColmTotalStr[0]),Integer.parseInt(aColmTotalStr[1]));
        String st = (String)ptotal.getProperty(utotal,"");
         if(st.length() == 0){
           ptotal.put(utotal,"0");
         }
      }
    }
    totalRecod = loop + ptotal.size() + 1;
    int totalColm = m_data[0].length;
    String[][] rWfcData = new String[totalRecod][totalColm];
    //计算合计条数End
    //总合计数
    int[] tWfctotalData = new int[totalColm];
    int nloop = tWfctotalData.length;
    for(int n=0;n<nloop;n++){
      tWfctotalData[n] = 0;
    }
    //分项合计数
    int[] uWfctotalData = new int[totalColm];
    String[] suWfctotalData = new String[totalColm];
    String curTotal = "";
    int clm = 0;
    //String utotalflag = "";
    for(int i=0;i<loop;i++){
      String s = m_data[i][m_colNoTotal];
      s =(s == null)?"":s.trim();
      if(s.length() == 0) continue;
      boolean ftotalIs = false;
      String utotal ="";
      if(s.length() > iMaxLength){
        utotal = s.substring(Integer.parseInt(aColmTotalStr[0]),Integer.parseInt(aColmTotalStr[1]));
        ftotalIs = true;
        //utotalflag = utotal;
      }else{
        utotal = s;
        ftotalIs = false;
        //utotalflag = utotal;
      }
      //System.out.println("utotal 0="+utotal);
      if (!curTotal.equalsIgnoreCase(utotal)) {
        if (curTotal.length() > 0) {
          String bs = m_data[i-1][m_colNoTotal];
          bs = (bs == null) ? "" : bs.trim();
          boolean bftotalIs = false;
          if (bs.length() > iMaxLength) {
            bftotalIs = true;
          }
          else {
            bftotalIs = false;
          }
          if(bftotalIs){
            int mloop = uWfctotalData.length;
            for (int m = 0; m < mloop; m++) {
              //rWfcData[clm][m_colNoTotal] = utotalflag;
              if (m == m_colNoTotal) {
                //System.out.println("suWfctotalData[m]=" + suWfctotalData[m]);
                rWfcData[clm][m] = suWfctotalData[m];
              }
              else {
                rWfcData[clm][m] = Integer.toString(uWfctotalData[m]);
              }
              if(m == 0){
                rWfcData[clm][m] = Integer.toString(uWfctotalData[m])+",+";
              }
            }
            float iRateComp = 0;
            if (uWfctotalData[iColmNoPercent[1]] > 0 &&
                uWfctotalData[iColmNoPercent[0]] == 0) iRateComp = 0;
            if (uWfctotalData[iColmNoPercent[1]] == 0 &&
                uWfctotalData[iColmNoPercent[0]] == 0) iRateComp = 0;
            if (uWfctotalData[iColmNoPercent[1]] > 0 &&
                uWfctotalData[iColmNoPercent[0]] > 0) iRateComp = ( (float)
                uWfctotalData[iColmNoPercent[1]] /
                (float) uWfctotalData[iColmNoPercent[0]]) * 100;
            String sRateComp = Float.toString(iRateComp);
            int sCIndex = 0;
            if (sRateComp.indexOf(".", 0) > -1) {
              sCIndex = (sRateComp.indexOf(".", 0) + 4 <= sRateComp.length()) ?
                  sRateComp.indexOf(".", 0) + 4 : sRateComp.length();
            }
            else {
              sCIndex = sRateComp.length();
            }
            sRateComp = sRateComp.substring(0, sCIndex);
            rWfcData[clm][colmPercent] = sRateComp+"%";
            int uloop = uWfctotalData.length;
            for (int u = 0; u < uloop; u++) {
              uWfctotalData[u] = 0;
            }
            clm++;
          }
        }
        curTotal = utotal;
      }
      //累计分项合计Begin
      int yloop = iColmSum.length;
      if(ftotalIs){
        uWfctotalData[0] = clm + 1;
        suWfctotalData[m_colNoTotal] = utotal;
        for (int y = 0; y < yloop; y++) {
          int isum = iColmSum[y];
          String st = m_data[i][isum];
          st = (st == null)?"0":st.trim();
          uWfctotalData[isum] = uWfctotalData[isum] + Integer.parseInt(st);
        }
      }
      //累计分项合计End

      //累计总合计Begin
      tWfctotalData[0] = clm+1;
      tWfctotalData[m_colNoTotal] = 9;
      //tWfctotalData[2] = 0;
      for(int y=0;y<yloop;y++){
        int isum = iColmSum[y];
        String st = m_data[i][isum];
        st = (st == null)?"0":st.trim();
        tWfctotalData[isum] = tWfctotalData[isum] + Integer.parseInt(st);
      }
      //累计总合计End

      int vloop = m_data[i].length;
      for(int v=0;v<vloop;v++){
        rWfcData[clm][v] = m_data[i][v];
      }
      clm++;
    }
    int mloop = uWfctotalData.length;
    for (int m = 0; m < mloop; m++) {
      //rWfcData[clm][m_colNoTotal] = utotalflag;
      //System.out.println("utotalflag="+utotalflag);
      if(m == m_colNoTotal){
        //System.out.println("suWfctotalData[m]="+suWfctotalData[m]);
        rWfcData[clm][m] = suWfctotalData[m];
      }else{
        rWfcData[clm][m] = Integer.toString(uWfctotalData[m]);
      }
      if(m == 0){
        rWfcData[clm][m] = Integer.toString(uWfctotalData[m])+",+";
      }
    }
    float iRateComp = 0;
    if (uWfctotalData[iColmNoPercent[1]] > 0 &&
        uWfctotalData[iColmNoPercent[0]] == 0) iRateComp = 0;
    if (uWfctotalData[iColmNoPercent[1]] == 0 &&
        uWfctotalData[iColmNoPercent[0]] == 0) iRateComp = 0;
    if (uWfctotalData[iColmNoPercent[1]] > 0 &&
        uWfctotalData[iColmNoPercent[0]] > 0) iRateComp = ( (float)
        uWfctotalData[iColmNoPercent[1]] /
        (float) uWfctotalData[iColmNoPercent[0]]) * 100;
    String sRateComp = Float.toString(iRateComp);
    int sCIndex = 0;
    if (sRateComp.indexOf(".", 0) > -1) {
      sCIndex = (sRateComp.indexOf(".", 0) + 4 <= sRateComp.length()) ?
          sRateComp.indexOf(".", 0) + 4 : sRateComp.length();
    }
    else {
      sCIndex = sRateComp.length();
    }
    sRateComp = sRateComp.substring(0, sCIndex);
    rWfcData[clm][colmPercent] = sRateComp+"%";
    int uloop = uWfctotalData.length;
    for (int u = 0; u < uloop; u++) {
      uWfctotalData[u] = 0;
    }
    clm++;
    mloop = tWfctotalData.length;
    for (int m = 0; m < mloop; m++) {
      rWfcData[clm][m] = Integer.toString(tWfctotalData[m]);
    }
    iRateComp = 0;
    if (tWfctotalData[iColmNoPercent[1]] > 0 && tWfctotalData[iColmNoPercent[0]] == 0) iRateComp = 0;
    if (tWfctotalData[iColmNoPercent[1]] == 0 && tWfctotalData[iColmNoPercent[0]] == 0) iRateComp = 0;
    if (tWfctotalData[iColmNoPercent[1]] > 0 && tWfctotalData[iColmNoPercent[0]] > 0) iRateComp = ( (float)
        tWfctotalData[iColmNoPercent[1]] / (float) tWfctotalData[iColmNoPercent[0]]) * 100;
    sRateComp = Float.toString(iRateComp);
    sCIndex = 0;
    if (sRateComp.indexOf(".", 0) > -1) {
      sCIndex = (sRateComp.indexOf(".", 0) + 4 <= sRateComp.length()) ?
          sRateComp.indexOf(".", 0) + 4 : sRateComp.length();
    }
    else {
      sCIndex = sRateComp.length();
    }
    sRateComp = sRateComp.substring(0, sCIndex);
    rWfcData[clm][colmPercent] = sRateComp+"%";
    rWfcData[clm][m_colNoTotal] = "9";
    rWfcData[clm][0] = rWfcData[clm][0]+",+";
    return rWfcData;
  }

  /**
   * 计算合计
   *
   */
  public String[][] getReprtWfcTotalDataNoLength(String[][] m_data,int m_colNoTotal,String m_colmSum,int colmPercent,String colmNoPercent) throws Exception {
                                       //getReprtWfcTotalData(WfcData,1,"0,1","3,4,5",6,"3,4")
    //计算合计种类
    Vector vu = new Vector();
    int tloop = m_data.length;
    for(int t=0;t<tloop;t++){
      String ts = m_data[t][m_colNoTotal];
      ts =(ts == null)?"":ts.trim();
      boolean isIn = false;
      int yloop = vu.size();
      for(int y=0;y<yloop;y++){
        String ys = (String)vu.elementAt(y);
        ys =(ys == null)?"":ys.trim();
        if(ts.equalsIgnoreCase(ys)){
          isIn = true;
          break;
        }
      }
      if(!isIn){
        vu.addElement(new String(ts));
      }
    }
    Properties ptotal = new java.util.Properties();
    //计算合计条数begin
    int loop = m_data.length;
    int totalRecod = 0;
    //计算合计位数必须大于多少
    //String[] aColmTotalStr = genMethod.split(m_colmTotalStr,",");
    String[] sColmSum = genMethod.split(m_colmSum,",");
    int[] iColmSum = new int[sColmSum.length];
    int kloop = sColmSum.length;
    for(int k = 0;k<kloop;k++){
      String s = sColmSum[k];
      s =(s == null)?"0":s.trim();
      iColmSum[k] = Integer.parseInt(s);
    }
    String[] sColmNoPercent = genMethod.split(colmNoPercent,",");
    int[] iColmNoPercent = new int[sColmNoPercent.length];
    kloop = sColmNoPercent.length;
    for(int k = 0;k<kloop;k++){
      String s = sColmNoPercent[k];
      s =(s == null)?"0":s.trim();
      iColmNoPercent[k] = Integer.parseInt(s);
    }
    //int iMaxLength = Integer.parseInt(aColmTotalStr[1]) - Integer.parseInt(aColmTotalStr[0])-1;
    for(int i=0;i<loop;i++){
      String s = m_data[i][m_colNoTotal];
      s =(s == null)?"":s.trim();
      String st = (String)ptotal.getProperty(s,"");
      if(st.length() == 0){
           ptotal.put(s,"0");
      }
    }
    totalRecod = loop + ptotal.size() + 1;
    int totalColm = m_data[0].length;
    String[][] rWfcData = new String[totalRecod][totalColm];
    //计算合计条数End
    //总合计数
    int[] tWfctotalData = new int[totalColm];
    int nloop = tWfctotalData.length;
    for(int n=0;n<nloop;n++){
      tWfctotalData[n] = 0;
    }
    //分项合计数
    int[] uWfctotalData = new int[totalColm];
    String[] suWfctotalData = new String[totalColm];
    String curTotal = "";
    int clm = 0;
    //String utotalflag = "";
    for (int i = 0; i < loop; i++) {
      String s = m_data[i][m_colNoTotal];
      s = (s == null) ? "" : s.trim();
      System.out.println("s ="+s);
      if (s.length() == 0)continue;
      boolean ftotalIs = false;
      String utotal = "";
      utotal = s;
      ftotalIs = true;
      if(i == 0){
        curTotal = utotal;
      }
      //System.out.println("utotal 0="+utotal);
      if (!curTotal.equalsIgnoreCase(utotal) && curTotal.length() > 0) {
        int mloop = uWfctotalData.length;
        for (int m = 0; m < mloop; m++) {
          //rWfcData[clm][m_colNoTotal] = utotalflag;
          if (m == m_colNoTotal) {
            //System.out.println("suWfctotalData[m]=" + suWfctotalData[m]);
            rWfcData[clm][m] = suWfctotalData[m];
          }
          else {
            rWfcData[clm][m] = Integer.toString(uWfctotalData[m]);
          }
          if (m == 0) {
            rWfcData[clm][m] = Integer.toString(uWfctotalData[m]) + ",+";
          }
        }
        float iRateComp = 0;
        if (uWfctotalData[iColmNoPercent[1]] > 0 &&
            uWfctotalData[iColmNoPercent[0]] == 0) iRateComp = 0;
        if (uWfctotalData[iColmNoPercent[1]] == 0 &&
            uWfctotalData[iColmNoPercent[0]] == 0) iRateComp = 0;
        if (uWfctotalData[iColmNoPercent[1]] > 0 &&
            uWfctotalData[iColmNoPercent[0]] > 0) iRateComp = ( (float)
            uWfctotalData[iColmNoPercent[1]] /
            (float) uWfctotalData[iColmNoPercent[0]]) * 100;
        String sRateComp = Float.toString(iRateComp);
        int sCIndex = 0;
        if (sRateComp.indexOf(".", 0) > -1) {
          sCIndex = (sRateComp.indexOf(".", 0) + 4 <= sRateComp.length()) ?
              sRateComp.indexOf(".", 0) + 4 : sRateComp.length();
        }
        else {
          sCIndex = sRateComp.length();
        }
        sRateComp = sRateComp.substring(0, sCIndex);
        rWfcData[clm][colmPercent] = sRateComp + "%";
        int uloop = uWfctotalData.length;
        for (int u = 0; u < uloop; u++) {
          uWfctotalData[u] = 0;
        }
        clm++;
        curTotal = utotal;
      }
      //累计分项合计Begin
      int yloop = iColmSum.length;
      if(ftotalIs){
        uWfctotalData[0] = clm + 1;
        suWfctotalData[m_colNoTotal] = utotal;
        for (int y = 0; y < yloop; y++) {
          int isum = iColmSum[y];
          String st = m_data[i][isum];
          st = (st == null)?"0":st.trim();
          uWfctotalData[isum] = uWfctotalData[isum] + Integer.parseInt(st);
        }
      }
      //累计分项合计End

      //累计总合计Begin
      tWfctotalData[0] = clm+1;
      tWfctotalData[m_colNoTotal] = 9;
      //tWfctotalData[2] = 0;
      for(int y=0;y<yloop;y++){
        int isum = iColmSum[y];
        String st = m_data[i][isum];
        st = (st == null)?"0":st.trim();
        tWfctotalData[isum] = tWfctotalData[isum] + Integer.parseInt(st);
      }
      //累计总合计End

      int vloop = m_data[i].length;
      for(int v=0;v<vloop;v++){
        rWfcData[clm][v] = m_data[i][v];
      }
      clm++;
    }
    int mloop = uWfctotalData.length;
    for (int m = 0; m < mloop; m++) {
      //rWfcData[clm][m_colNoTotal] = utotalflag;
      //System.out.println("utotalflag="+utotalflag);
      if(m == m_colNoTotal){
        //System.out.println("suWfctotalData[m]="+suWfctotalData[m]);
        rWfcData[clm][m] = suWfctotalData[m];
      }else{
        rWfcData[clm][m] = Integer.toString(uWfctotalData[m]);
      }
      if(m == 0){
        rWfcData[clm][m] = Integer.toString(uWfctotalData[m])+",+";
      }
    }
    float iRateComp = 0;
    if (uWfctotalData[iColmNoPercent[1]] > 0 &&
        uWfctotalData[iColmNoPercent[0]] == 0) iRateComp = 0;
    if (uWfctotalData[iColmNoPercent[1]] == 0 &&
        uWfctotalData[iColmNoPercent[0]] == 0) iRateComp = 0;
    if (uWfctotalData[iColmNoPercent[1]] > 0 &&
        uWfctotalData[iColmNoPercent[0]] > 0) iRateComp = ( (float)
        uWfctotalData[iColmNoPercent[1]] /
        (float) uWfctotalData[iColmNoPercent[0]]) * 100;
    String sRateComp = Float.toString(iRateComp);
    int sCIndex = 0;
    if (sRateComp.indexOf(".", 0) > -1) {
      sCIndex = (sRateComp.indexOf(".", 0) + 4 <= sRateComp.length()) ?
          sRateComp.indexOf(".", 0) + 4 : sRateComp.length();
    }
    else {
      sCIndex = sRateComp.length();
    }
    sRateComp = sRateComp.substring(0, sCIndex);
    rWfcData[clm][colmPercent] = sRateComp+"%";
    int uloop = uWfctotalData.length;
    for (int u = 0; u < uloop; u++) {
      uWfctotalData[u] = 0;
    }
    clm++;
    mloop = tWfctotalData.length;
    for (int m = 0; m < mloop; m++) {
      rWfcData[clm][m] = Integer.toString(tWfctotalData[m]);
    }
    iRateComp = 0;
    if (tWfctotalData[iColmNoPercent[1]] > 0 && tWfctotalData[iColmNoPercent[0]] == 0) iRateComp = 0;
    if (tWfctotalData[iColmNoPercent[1]] == 0 && tWfctotalData[iColmNoPercent[0]] == 0) iRateComp = 0;
    if (tWfctotalData[iColmNoPercent[1]] > 0 && tWfctotalData[iColmNoPercent[0]] > 0) iRateComp = ( (float)
        tWfctotalData[iColmNoPercent[1]] / (float) tWfctotalData[iColmNoPercent[0]]) * 100;
    sRateComp = Float.toString(iRateComp);
    sCIndex = 0;
    if (sRateComp.indexOf(".", 0) > -1) {
      sCIndex = (sRateComp.indexOf(".", 0) + 4 <= sRateComp.length()) ?
          sRateComp.indexOf(".", 0) + 4 : sRateComp.length();
    }
    else {
      sCIndex = sRateComp.length();
    }
    sRateComp = sRateComp.substring(0, sCIndex);
    rWfcData[clm][colmPercent] = sRateComp+"%";
    rWfcData[clm][m_colNoTotal] = "9";
    rWfcData[clm][0] = rWfcData[clm][0]+",+";
    return rWfcData;
  }


  /**
   * 计算总合计
   *
   */
  public String[][] getReprtTotalData(String[][] m_data,int m_colNoTotal,String m_colmTotalStr,String m_colmSum,int colmPercent,String colmNoPercent) throws Exception {
    //Properties ptotal = new java.util.Properties();
    //计算合计条数begin
    int loop = m_data.length;
    int totalRecod = 0;
    //计算合计位数必须大于多少
    //String[] aColmTotalStr = genMethod.split(m_colmTotalStr,",");
    String[] sColmSum = genMethod.split(m_colmSum,",");
    int[] iColmSum = new int[sColmSum.length];
    int kloop = sColmSum.length;
    for(int k = 0;k<kloop;k++){
      String s = sColmSum[k];
      s =(s == null)?"0":s.trim();
      iColmSum[k] = Integer.parseInt(s);
    }
    String[] sColmNoPercent = genMethod.split(colmNoPercent,",");
    int[] iColmNoPercent = new int[sColmNoPercent.length];
    kloop = sColmNoPercent.length;
    for(int k = 0;k<kloop;k++){
      String s = sColmNoPercent[k];
      s =(s == null)?"0":s.trim();
      iColmNoPercent[k] = Integer.parseInt(s);
    }
    totalRecod = loop + 1;
    int totalColm = m_data[0].length;
    String[][] rWfcData = new String[totalRecod][totalColm];
    //计算合计条数End
    //总合计数
    int[] tWfctotalData = new int[totalColm];
    int nloop = tWfctotalData.length;
    for(int n=0;n<nloop;n++){
      tWfctotalData[n] = 0;
    }
    //分项合计数
    int[] uWfctotalData = new int[totalColm];
    String curTotal = "";
    int clm = 0;
    for(int i=0;i<loop;i++){
      String s = m_data[i][m_colNoTotal];
      s =(s == null)?"":s.trim();
      if(s.length() == 0) continue;
      int yloop = iColmSum.length;
      //累计总合计Begin
      tWfctotalData[0] = clm+1;
      tWfctotalData[m_colNoTotal] = 9;
      //tWfctotalData[2] = 0;
      for(int y=0;y<yloop;y++){
        int isum = iColmSum[y];
        String st = m_data[i][isum];
        st = (st == null)?"0":st.trim();
        tWfctotalData[isum] = tWfctotalData[isum] + Integer.parseInt(st);
      }
      //累计总合计End
      int vloop = m_data[i].length;
      for(int v=0;v<vloop;v++){
        rWfcData[clm][v] = m_data[i][v];
      }
      clm++;
    }
    int mloop = tWfctotalData.length;
    for (int m = 0; m < mloop; m++) {
      rWfcData[clm][m] = Integer.toString(tWfctotalData[m]);
    }
    float iRateComp = 0;
    if (tWfctotalData[iColmNoPercent[1]] > 0 && tWfctotalData[iColmNoPercent[0]] == 0) iRateComp = 0;
    if (tWfctotalData[iColmNoPercent[1]] == 0 && tWfctotalData[iColmNoPercent[0]] == 0) iRateComp = 0;
    if (tWfctotalData[iColmNoPercent[1]] > 0 && tWfctotalData[iColmNoPercent[0]] > 0) iRateComp = ( (float)
        tWfctotalData[iColmNoPercent[1]] / (float) tWfctotalData[iColmNoPercent[0]]) * 100;
    String sRateComp = Float.toString(iRateComp);
    int sCIndex = 0;
    if (sRateComp.indexOf(".", 0) > -1) {
      sCIndex = (sRateComp.indexOf(".", 0) + 4 <= sRateComp.length()) ?
          sRateComp.indexOf(".", 0) + 4 : sRateComp.length();
    }
    else {
      sCIndex = sRateComp.length();
    }
    sRateComp = sRateComp.substring(0, sCIndex);
    rWfcData[clm][colmPercent] = sRateComp;
    return rWfcData;
  }

   /**
    * 计算
    *
    */
   public String getDeptDesc(String pDeptnum) throws Exception {
     String orgIdStr = orgId;
     //String orgIdStr = "HEDGS";
     orgIdStr = (orgIdStr == null) ? "":orgIdStr.trim().toUpperCase();
     String siteIdStr = siteId;
     //String siteIdStr = "HEDSITE";
     siteIdStr =(siteIdStr == null) ? "":siteIdStr.trim();
     Connection conn = MXConnection.getConnection(mxs);
     //Connection conn =  DBCon.getConnection();
     //已发现缺陷
     StringBuffer sqllocal = new StringBuffer(300);
     String deptDesc ="";
     sqllocal = new StringBuffer(300);
     sqllocal.append("select DESCRIPTION").append(" from ").append("DEPT");
     sqllocal.append(" where UPPER(TRIM(SITEID)) ="+"\'"+siteIdStr+"\'"+" AND "+"TRIM(DEPTNUM) =\'"+pDeptnum+"\'");
     sqllocal.append(" order by DEPTNUM");
     QueryResult rlmvQuery = DBCon.runQuery(sqllocal.toString(), conn);
     rlmvQuery = (rlmvQuery == null) ? new QueryResult() :rlmvQuery;
     int loopCount = rlmvQuery.size();
     if(loopCount > 0){
       ResultRow resultRow = rlmvQuery.getRow(0);
       deptDesc = resultRow.getValue("DESCRIPTION");
     }
     return deptDesc;
   }

   /**
    * 计算
    *
    */
   public String getLaborName(String plaborCode) throws Exception {
     String orgIdStr = orgId;
     //String orgIdStr = "HEDGS";
     orgIdStr = (orgIdStr == null) ? "":orgIdStr.trim().toUpperCase();
     String siteIdStr = siteId;
     //String siteIdStr = "HEDSITE";
     siteIdStr =(siteIdStr == null) ? "":siteIdStr.trim();
     Connection conn = MXConnection.getConnection(mxs);
     //Connection conn =  DBCon.getConnection();
     plaborCode = (plaborCode == null)?"":plaborCode.trim().toUpperCase();
     //已发现缺陷
     StringBuffer sqllocal = new StringBuffer(300);
     String sName ="";
     sqllocal = new StringBuffer(300);
     sqllocal.append("select DISPLAYNAME").append(" from ").append("PERSON");
     sqllocal.append(" where "+"UPPER(TRIM(PERSONID)) =\'"+plaborCode+"\'");
     sqllocal.append(" order by PERSONID");
     QueryResult rlmvQuery = DBCon.runQuery(sqllocal.toString(), conn);
     rlmvQuery = (rlmvQuery == null) ? new QueryResult() :rlmvQuery;
     int loopCount = rlmvQuery.size();
     if(loopCount > 0){
       ResultRow resultRow = rlmvQuery.getRow(0);
       sName = resultRow.getValue("DISPLAYNAME");
     }
     return sName;
   }

   /**
    * 计算
    *
    */
   public Vector getReportModule(String App,String Module) throws Exception {
     Vector vReportModule = new Vector();
     String orgIdStr = orgId;
     //String orgIdStr = "HEDGS";
     orgIdStr = (orgIdStr == null) ? "":orgIdStr.trim().toUpperCase();
     String siteIdStr = siteId;
     //String siteIdStr = "HEDSITE";
     siteIdStr =(siteIdStr == null) ? "":siteIdStr.trim();
     Connection conn = MXConnection.getConnection(mxs);
     //Connection conn =  DBCon.getConnection();
     //已发现缺陷
     StringBuffer sqllocal = new StringBuffer(300);
     //String sName ="";
     sqllocal = new StringBuffer(300);
     sqllocal.append("select VALUE").append(" from ").append("REPORTMODULE");
     sqllocal.append(" where UPPER(TRIM(SITEID)) ="+"\'"+siteIdStr+"\'"+" AND "+"TRIM(ORGID) =\'"+orgIdStr+"\' AND UPPER(TRIM(APP)) =\'"+App.toUpperCase()+"\' AND UPPER(TRIM(MODULE)) =\'"+Module.toUpperCase()+"\'");
     sqllocal.append(" order by LINENUM");
     QueryResult rlmvQuery = DBCon.runQuery(sqllocal.toString(), conn);
     rlmvQuery = (rlmvQuery == null) ? new QueryResult() :rlmvQuery;
     int loopCount = rlmvQuery.size();
     if(loopCount > 0){
       for (int i = 0; i < loopCount; i++) {
          ResultRow resultRow = rlmvQuery.getRow(i);
          String sValue = resultRow.getValue("VALUE");
          vReportModule.addElement(new String(sValue));
        }
     }
     return vReportModule;
   }
}
