ProjectImplement.aspx.cs
上传用户:tiancihang
上传日期:2014-03-12
资源大小:21387k
文件大小:171k
源码类别:

.net编程

开发平台:

C#

  1.             com.etong.DAL.FC.EtongFlyChouWFPrj etongFlyChouWFPrj = new com.etong.DAL.FC.EtongFlyChouWFPrj();
  2.             etongFlyChouWFPrj.sID = this.actinstanceid;
  3.             etongFlyChouWFPrj.PrjID = this.ConID;
  4.             etongFlyChouWFPrj.iID = this.WFInstanceID;
  5.             etongFlyChouWFPrj.aID= this.ActivityID;
  6.             etongFlyChouWFPrj.iStatus = 2;
  7.             //etongFlyChouWFPrj.sBlockReason = WorkFolw.GetBlockReason(this.actinstanceid);
  8.             if (etongFlyChouWFPrj.GetPrevioueTasksStatus() == false)
  9.             {
  10.                 Common.RunScript(this.Page, "工作流上级活动未完成,不能汇总文档");
  11.                 return;
  12.             }
  13.             else
  14.             {
  15.                 //汇总代码
  16.                        
  17.                 //
  18.                 string GcglTransactor = cui.EmpName + "   " + DateTime.Now.ToShortDateString() + " " + DateTime.Now.Hour + ":" + DateTime.Now.Minute;
  19.                 //string GcglFName = "工程进度调整计划、问题和解决方案" + DateTime.Now.Year + DateTime.Now.Month + DateTime.Now.Day + DateTime.Now.Hour + DateTime.Now.Minute + DateTime.Now.Second + ".doc";//工程管理办公室项目实施情况分析,工程项目调整计划(电子文档)-----待续
  20.                 string GcglFName = this.ProjectAnalysis.Value;
  21.                 string sql = "update [Tb_Construct] set [GcglTransactor]='" + GcglTransactor + "' where [ConID]=" + this.ConID;
  22.                 if (SqlServer.RunSql(sql))
  23.                 {
  24.                     //WorkFlowOperation(ConID, "您已审核通过!", false);
  25.                     WFInstADD("您已审核通过!", true);
  26.                     WorkFolw workflow = new WorkFolw();
  27.                     string ActIDtxt = Request.QueryString["ActID"].ToString().Trim();
  28.                     ActID = Convert.ToInt32(ActIDtxt);
  29.                     bool flag = workflow.WFActInsUpdata(ActID, 1, this.userid);
  30.                     if (flag == true)
  31.                     {
  32.                         //WorkFlowOperation(ConID, "您已审核通过!");
  33.                         int RouID = 2;//结束后关联种类条件ID(-1、无条件,1、变更材料,2、废旧物资处理,3、汇总废旧物资,4、施工工作流)
  34.                         //产生项目调整代办任务
  35.                         //begin code
  36.                         int WFID = -1;
  37.                         sql = "select [WFID] from [tb_WorkFlowRouter] where [RouID]=" + RouID;
  38.                         DataView dv = SqlServer.GetDataView(sql);
  39.                         if (dv.Count > 0)
  40.                         {
  41.                             WFID = Convert.ToInt32(dv[0]["WFID"].ToString());
  42.                         }
  43.                         if (WFID != -1)
  44.                         {
  45.                             dv = GetConstructInfo(this.ConID);
  46.                             string bgFName = dv[0]["JcWZFName"].ToString();
  47.                             PrjOldMatManager prjOldMatManager = new PrjOldMatManager();
  48.                             //PrjOldMatInfo prjOldMatInfo = new PrjOldMatInfo(this.ConID, Convert.ToInt32(consort), -1, "", "", "", "",bgFName, "", "", "", "", "", "", "", "", "", "", 1);
  49.                             PrjOldMatInfo prjOldMatInfo = new PrjOldMatInfo(this.ConID, Convert.ToInt32(consort), -1, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", 1);
  50.                             int NewMatID = prjOldMatManager.AddPrjOldMat(prjOldMatInfo);
  51.                             if (NewMatID > 0)
  52.                             {
  53.                                 EtongZwf etongzwf = new EtongZwf();
  54.                                 DateTime SuccessDate = Convert.ToDateTime(DateTime.Now.ToShortDateString().Trim());
  55.                                 //添加工作流实例 (将添加成功的constructid添加到工作流实例表里,注意是加到该表的PrjID字段中)
  56.                                 WFInstanceInfo wfinstanceinfo = new WFInstanceInfo(-1, Convert.ToDateTime(DateTime.Now.ToShortDateString()),
  57.                                         userid, -1, -1, DateTime.Now, 5, SuccessDate, WFID, NewMatID);
  58.                                 int ReInstanceValue = etongzwf.WFInstanceADD(wfinstanceinfo);
  59.                                 this.WFInstanceID = ReInstanceValue;
  60.                                 if (this.WFInstanceID > 0)
  61.                                 {
  62.                                     sql = "select [ActivityID] from [tb_WF_Activity] where [WorkFlowID]=" + WFID + " and [StartEnd]=0";
  63.                                     dv = SqlServer.GetDataView(sql);
  64.                                     if (dv.Count > 0)
  65.                                     {
  66.                                         this.ActivityID = Convert.ToInt32(dv[0]["ActivityID"].ToString());
  67.                                         int OpRoleID = -1;
  68.                                         sql = "select [RoleID] from [tb_Colony_User] where [ActivityID]=" + this.ActivityID;
  69.                                         dv = SqlServer.GetDataView(sql);
  70.                                         if (dv.Count > 0)
  71.                                             OpRoleID = Convert.ToInt32(dv[0]["RoleID"].ToString());
  72.                                         if (OpRoleID > 0)
  73.                                         {
  74.                                             WFActInsInfo wfactinsinfo = new WFActInsInfo(-1, this.ActivityID, Convert.ToDateTime(DateTime.Now.ToShortDateString()), Convert.ToDateTime(DateTime.Now.ToShortDateString()),
  75.                                                                                                                 0, SuccessDate, this.WFInstanceID, "99", -1, OpRoleID);
  76.                                             int ReActInsValue = etongzwf.WFActInsADD(wfactinsinfo);
  77.                                         }
  78.                                     }
  79.                                 }
  80.                             }
  81.                         }
  82.                         //end code
  83.                     }
  84.                     sql = "update [tb_construct] set [Status]=2 where [ConID]=" + this.ConID;
  85.                     if (SqlServer.RunSql(sql))
  86.                     {
  87.                         string script = "<script>alert('系统提示:您已审核通过,转到废旧物资管理流程处理!');top.location.href='../Main.aspx';</script>";
  88.                         Common.RunScriptString(this.Page, script);
  89.                     }
  90.                 }
  91.                 else
  92.                 {
  93.                     Common.RunScript(this.Page, "操作失败,请检查数据!");
  94.                 }
  95.             }
  96.         }
  97.         //**************************************************************上缴废旧物资**************************************************************
  98.        /* if (MustChooseItem == 28)
  99.         {
  100.             string JcSJTransactor = cui.EmpName + "   " + DateTime.Now.ToShortDateString() + " " + DateTime.Now.Hour + ":" + DateTime.Now.Minute;
  101.             //string JcSJFName = "废旧物资" + DateTime.Now.Year + DateTime.Now.Month + DateTime.Now.Day + DateTime.Now.Hour + DateTime.Now.Minute + DateTime.Now.Second + ".doc";//基层部门上缴废旧物资清单(电子文档)-----待续
  102.             string JcSJFName = this.TurnInOldMaterial.Value;
  103.             string sql = "update [Tb_Construct] set [JcSJTransactor]='" + JcSJTransactor + "',[JcSJFName]='" + JcSJFName + "' where [ConID]=" + this.ConID;
  104.             if (SqlServer.RunSql(sql))
  105.             {
  106.             }
  107.             else
  108.             {
  109.                 Common.RunScript(this.Page, "操作失败,请检查数据!");
  110.             }
  111.         }*/
  112.         //************************************************************废旧物资管理流程*************************************************************
  113.         /*if (MustChooseItem == 29)
  114.         {
  115.             string WZFjTransactor = cui.EmpName + "   " + DateTime.Now.ToShortDateString() + " " + DateTime.Now.Hour + ":" + DateTime.Now.Minute;
  116.             //string WZFjFName = "剩余材料统计" + DateTime.Now.Year + DateTime.Now.Month + DateTime.Now.Day + DateTime.Now.Hour + DateTime.Now.Minute + DateTime.Now.Second + ".doc";//物资部门废旧物资接受清单(电子文档)-----待续
  117.             //string WZFjFName = this.OldMaterialManagement.Value;
  118.             string WZFjIdea = this.TB_OldMaterialManagement.Text.Trim();
  119.             string sql = "update [Tb_Construct] set [WZFjTransactor]='" + WZFjTransactor + "',[WZFjFName]='" + WZFjIdea + "',[Status]=2 where [ConID]=" + this.ConID;
  120.             string sql1 = "update [tb_WF_ActIns] set [Status]=1,[UserID]=" + this.userid + " where [ActInsID]=" + this.actinstanceid;
  121.             if (SqlServer.RunSql(sql) && SqlServer.RunSql(sql1))
  122.             {
  123.                 sql = "select [StartEnd] from [tb_WF_Activity] where [ActivityID]=" + ActivityID;
  124.                 DataView dv = SqlServer.GetDataView(sql);
  125.                 if (dv.Count > 0)
  126.                 {
  127.                     startEnd = Convert.ToInt32(dv[0]["StartEnd"].ToString());
  128.                     if (startEnd == 2)//最终任务
  129.                     {
  130.                         string script = "<script language='javascript'>alert('系统提示:您已审核通过,本工程项目实施流程结束!');top.location.href='../Main.aspx';</script>";
  131.                         Common.RunScriptString(this.Page, script);
  132.                     }
  133.                 }
  134.                 else
  135.                 {
  136.                     WorkFlowOperation(ConID, "您已审核通过,本工程项目实施流程结束!");
  137.                 }
  138.             }
  139.             else
  140.             {
  141.                 Common.RunScript(this.Page, "操作失败,请检查数据!");
  142.             }
  143.         }*/
  144.         //************************************************************工程计划流程*************************************************************
  145.         if (MustChooseItem == 30)
  146.         {
  147.             int RouID = 1;//结束后关联种类条件ID(-1、无条件,1、变更材料,2、废旧物资处理,3、汇总废旧物资,4、施工工作流)
  148.             DataView dv = GetConstructInfo(this.ConID);
  149.             string BgFName = dv[0]["WZFName"].ToString();
  150.             string altername = this.TB_ConName.Text.ToString() + "材料变更";
  151.             string sql = "";
  152.             //string sql = "insert into [tb_PrjAlert]([ConID],[BgFName]) values (" + this.ConID + ",'" + BgFName + "')";
  153.             PrjAlertInfo prjAlertInfo = new PrjAlertInfo(this.ConID, consort, altername, BgFName, "", "", "", "", "", "", "","", 1);
  154.             PrjAlertManager prjAlertManager = new PrjAlertManager();
  155.             int newPrjAlertID = prjAlertManager.AddPrjAlert(prjAlertInfo);
  156.             if (newPrjAlertID>0)
  157.             {
  158.                 //产生项目调整代办任务
  159.                 //begin code
  160.                 int WFID = -1;
  161.                 sql = "select [WFID] from [tb_WorkFlowRouter] where [RouID]=" + RouID;
  162.                 dv = SqlServer.GetDataView(sql);
  163.                 if (dv.Count > 0)
  164.                 {
  165.                     WFID = Convert.ToInt32(dv[0]["WFID"].ToString());
  166.                 }
  167.                 if (WFID != -1)
  168.                 {
  169.                     EtongZwf etongzwf = new EtongZwf();
  170.                     DateTime SuccessDate = Convert.ToDateTime(DateTime.Now.ToShortDateString().Trim());
  171.                     //添加工作流实例 (将添加成功的constructid添加到工作流实例表里,注意是加到该表的PrjID字段中)
  172.                     WFInstanceInfo wfinstanceinfo = new WFInstanceInfo(-1, Convert.ToDateTime(DateTime.Now.ToShortDateString()),
  173.                             userid, -1, -1, DateTime.Now, 4, SuccessDate, WFID,newPrjAlertID);
  174.                     int ReInstanceValue = etongzwf.WFInstanceADD(wfinstanceinfo);
  175.                     this.WFInstanceID = ReInstanceValue;
  176.                     if (this.WFInstanceID > 0)
  177.                     {
  178.                         sql = "select [ActivityID] from [tb_WF_Activity] where [WorkFlowID]=" + WFID + " and [StartEnd]=0";
  179.                         dv = SqlServer.GetDataView(sql);
  180.                         if (dv.Count > 0)
  181.                         {
  182.                             this.ActivityID = Convert.ToInt32(dv[0]["ActivityID"].ToString());
  183.                             int OpRoleID = -1;
  184.                             sql = "select [RoleID] from [tb_Colony_User] where [ActivityID]=" + this.ActivityID;
  185.                             dv = SqlServer.GetDataView(sql);
  186.                             if (dv.Count > 0)
  187.                                 OpRoleID = Convert.ToInt32(dv[0]["RoleID"].ToString());
  188.                             if (OpRoleID > 0)
  189.                             {
  190.                                 WFActInsInfo wfactinsinfo = new WFActInsInfo(-1, this.ActivityID, Convert.ToDateTime(DateTime.Now.ToShortDateString()), Convert.ToDateTime(DateTime.Now.ToShortDateString()),
  191.                                                                                                     0, SuccessDate, this.WFInstanceID, "", -1, OpRoleID);
  192.                                 int ReActInsValue = etongzwf.WFActInsADD(wfactinsinfo);
  193.                             }
  194.                         }
  195.                     }
  196.                 }
  197.                 //end code
  198.                 sql = "update [tb_construct] set [Status]=2 where [ConID]=" + this.ConID;
  199.                 if (SqlServer.RunSql(sql))
  200.                 {
  201.                     string script = "<script>alert('系统提示:您已审核通过,转到废旧物资管理流程!');top.location.href='../Main.aspx';</script>";
  202.                     Common.RunScriptString(this.Page, script);
  203.                 }
  204.             }
  205.         }
  206.     }
  207.     /*============================================================对并发活动的特殊处理======================================================
  208.      * 
  209.      *                                                 工作流操作,分3步
  210.      * 1.产生工作流实例纪录,注意constructid必须真实存在 
  211.      * 2.更新当前活动实例状态 由WFInstADD中的WFActInsUpdata执行
  212.      * 3.产生新的工作流实例纪录,即产生下一个活动实例并提交到下一个部门的用户申核,由NextColonyRole操作完成                                
  213.      * 
  214.      *=====================================================================================================================================*/
  215.     protected void WorkFlowOperation(int conid, bool isMaster)
  216.     {
  217.         EtongZwf etongzwf = new EtongZwf();
  218.         ProjectImplment projectImplment = new ProjectImplment();
  219.         
  220.         //int count = dv.Count;
  221.         string sql = " select * from [tb_WF_Instance] where [Status]=2 and [PrjID]=" + this.ConID;
  222.         DataView dv = SqlServer.GetDataView(sql);
  223.         if (dv.Count == 0)//如果实例存在则不添加
  224.         {
  225.             DateTime SuccessDate = Convert.ToDateTime(DateTime.Now.ToShortDateString().Trim());
  226.             //添加工作流实例 (将添加成功的constructid添加到工作流实例表里,注意是加到该表的PrjID字段中)
  227.             WFInstanceInfo wfinstanceinfo = new WFInstanceInfo(-1, Convert.ToDateTime(DateTime.Now.ToShortDateString()),
  228.                     userid, -1, -1, DateTime.Now, 2, SuccessDate, wfid, conid);
  229.             int ReInstanceValue = etongzwf.WFInstanceADD(wfinstanceinfo);
  230.             //产生当前工作流实例ID
  231.             WFInstanceID = ReInstanceValue;
  232.         }
  233.         string nextCheckDepartment = "";
  234.         dv = etongzwf.ColonyUserGetByActId(ActivityID);
  235.         if (dv.Count > 0)
  236.         {
  237.             /*int ParentOrgID = Convert.ToInt32(dv[0]["ParentRoleID"].ToString().Trim());
  238.             //DataView dvRoleName = etongzwf.RoleGetName(ParentRoleID);
  239.             DataTable dataTable = projectImplment.GetDepartmentByID(ParentOrgID);
  240.             if (dataTable.Rows.Count == 0)
  241.             {
  242.                 ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('系统提示:项目施工停滞,没有上级申核人!(请联系相关部门或系统管理员)');</script>");
  243.                 return;
  244.             }*/
  245.             for (int i = 0; i < dv.Count; i++)//找到所有部门
  246.             {
  247.                 int ParentRoleID = Convert.ToInt32(dv[i]["ParentRoleID"].ToString().Trim());
  248.                 ProjectImplment pi = new ProjectImplment();
  249.                 //DataTable dt = pi.GetDepartmentByID(ParentRoleID);
  250.                 DataTable dt = pi.GetNextOperatorRole(ParentRoleID);
  251.                 nextCheckDepartment += dt.Rows[0]["OpName"].ToString() + "、";
  252.             }
  253.             for (int i = 0; i < dv.Count; i++)
  254.             {
  255.                 int CurrentRoleID = Convert.ToInt32(dv[i]["CurrentRoleID"].ToString().Trim());
  256.                 int ParentActID = Convert.ToInt32(dv[i]["ParentActID"].ToString().Trim());
  257.                 int ParentRoleID = Convert.ToInt32(dv[i]["ParentRoleID"].ToString().Trim());
  258.                 if (WFInstanceID > 0)
  259.                 {
  260.                     /*WorkFolw workflow = new WorkFolw();
  261.                     string ActIDtxt = Request.QueryString["ActID"].ToString().Trim();
  262.                     ActID = Convert.ToInt32(ActIDtxt);
  263.                     bool returnvalue = false;
  264.                     //产生当前活动实例  如果是不是第一个活动,只需 修改 UserID 和 Status
  265.                     int ReActInsValue = 0;
  266.                     //returnvalue = etongzwf.WFActInsUpdata(ActID, userid, 1);
  267.                     returnvalue = workflow.WFActInsUpdata(ActID, 1, userid);
  268.                     if (returnvalue == true)
  269.                         ReActInsValue = ActID;
  270.                     if (ReActInsValue > 0)
  271.                     {*/
  272.                     if (ParentActID != -1)
  273.                     {
  274.                         NextColonyRole(ParentActID, ParentRoleID, "您已审核通过", nextCheckDepartment, isMaster);  //(ReActInsValue);     //产生下一个活动实例并提交到下一个角色的用户申核
  275.                     }
  276.                     else   // 不存在上级活动,将 活动状态(Status) 改为 "完成"   注:Status状态(0、正常;1、完成;2、回退;3、回退并完成;4、作废)
  277.                     {
  278.                         /*bool ReValueAIUpdata = false;
  279.                         //ReValueAIUpdata = etongzwf.WFActInsUpdata(ReActInsValue, userid, 1);
  280.                         ReValueAIUpdata = workflow.WFActInsUpdata(ReActInsValue, 1, userid);
  281.                         if (ReValueAIUpdata == true)
  282.                         {
  283.                             ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('系统提示:项目施工完成!');top.location.href='../Main.aspx';</script>");
  284.                         }
  285.                         else
  286.                         {*/
  287.                             ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('系统提示:操作失败!');top.location.href='../Main.aspx';</script>");
  288.                     }
  289.                 }
  290.             }
  291.         }
  292.     }
  293.     /*===========================================================================================================================
  294.      * 
  295.      *                                    工作流操作,分3步 
  296.      * 1.产生工作流实例纪录,注意constructid必须真实存在 
  297.      * 2.更新当前活动实例状态 由WFInstADD中的WFActInsUpdata执行
  298.      * 3.产生新的工作流实例纪录,即产生下一个活动实例并提交到下一个部门的用户申核,由NextColonyRole操作完成                                
  299.      * 
  300.      *==========================================================================================================================*/
  301.     protected void WorkFlowOperation(int conid, string showmessage, bool isMaster)
  302.     {
  303.         EtongZwf etongzwf = new EtongZwf();
  304.         ProjectImplment projectImplment = new ProjectImplment();
  305.          string sql = "select * from [tb_WF_Instance] where [Status]=2 and [PrjID]=" + this.ConID;
  306.         DataView dv = SqlServer.GetDataView(sql);
  307.         if (dv.Count == 0)//如果实例存在则不添加
  308.         {
  309.             DateTime SuccessDate = Convert.ToDateTime(DateTime.Now.ToShortDateString().Trim());
  310.             //添加工作流实例 (将添加成功的constructid添加到工作流实例表里,注意是加到该表的PrjID字段中)
  311.             WFInstanceInfo wfinstanceinfo = new WFInstanceInfo(-1, Convert.ToDateTime(DateTime.Now.ToShortDateString()),
  312.                 userid, -1, -1, DateTime.Now, 2, SuccessDate, wfid, conid);
  313.             int ReInstanceValue = etongzwf.WFInstanceADD(wfinstanceinfo);
  314.             //产生当前工作流实例ID
  315.             WFInstanceID = ReInstanceValue;
  316.         }
  317.         dv = etongzwf.ColonyUserGetByActId(ActivityID);
  318.         if (dv.Count > 0)
  319.         {
  320.             //int ParentRoleID = Convert.ToInt32(dv[0]["ParentRoleID"].ToString().Trim());
  321.             ////DataView dvRoleName = etongzwf.RoleGetName(ParentRoleID);
  322.             //DataTable dt = projectImplment.GetDepartmentByID(ParentRoleID);
  323.             //if (dt.Rows.Count == 0)
  324.             //{
  325.             //    ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('系统提示:项目施工停滞,没有上级申核人!(请联系相关部门或系统管理员)');</script>");
  326.             //    return;
  327.             //}
  328.             //获取当前工作流启始活动    为什么要获取当前工作流启始活动?            
  329.             //DataView dvActID = etongzwf.GetActivityByWFID(wfid);
  330.             //ActivityID = Convert.ToInt32(dvActID[0][0].ToString().Trim());
  331.             if (WFInstanceID > 0)
  332.             {
  333.                 WFInstADD(showmessage, isMaster);
  334.             }
  335.         }
  336.     }
  337.     /// <summary>
  338.     /// 改变工作流活动实例状态   
  339.     /// </summary>
  340.     /// 
  341.     protected void WFInstADD(string showMessage, bool isMaster)
  342.     {
  343.         if (WFInstanceID > 0)
  344.         {
  345.             com.etong.DAL.WorkFolw workflow = new com.etong.DAL.WorkFolw();
  346.             DateTime SuccessDate = Convert.ToDateTime(DateTime.Now.ToShortDateString().Trim());
  347.             EtongZwf etongzwf = new EtongZwf();
  348.             DataView dv = etongzwf.ColonyUserGetByActId(ActivityID);
  349.             // int CurrentActID = -1;
  350.             int CurrentRoleID = -1;
  351.             int ParentActID = -1;
  352.             int ParentRoleID = -1;
  353.             string nextCheckDepartment = null;
  354.             if (dv.Count > 0)
  355.             {
  356.                 if (dv.Count == 1)//不分流
  357.                 {
  358.                     CurrentRoleID = Convert.ToInt32(dv[0]["CurrentRoleID"].ToString().Trim());
  359.                     ParentActID = Convert.ToInt32(dv[0]["ParentActID"].ToString().Trim());
  360.                     ParentRoleID = Convert.ToInt32(dv[0]["ParentRoleID"].ToString().Trim());
  361.                 }
  362.                 else//分流
  363.                 {
  364.                     for (int i = 0; i < dv.Count; i++)
  365.                     {
  366.                         if (Convert.ToInt32(dv[i]["shuntflag"]) == shuntFlag)
  367.                         {
  368.                             CurrentRoleID = Convert.ToInt32(dv[i]["CurrentRoleID"].ToString().Trim());
  369.                             ParentActID = Convert.ToInt32(dv[i]["ParentActID"].ToString().Trim());
  370.                             ParentRoleID = Convert.ToInt32(dv[i]["ParentRoleID"].ToString().Trim());
  371.                         }
  372.                     }
  373.                 }
  374.             }
  375.             //产生当前活动实例  如果是不是第一个活动,只需 修改 UserID 和 Status
  376.             int ReActInsValue = 0;
  377.             int tempStatus = WorkFolw.GetCurrentActivityInstanceStatus(this.actinstanceid);//当前活动实例状态
  378.             if (MustChooseItem == 69)//对起始活动的操作
  379.             {
  380.                 if (tempStatus == 2)//回退活动
  381.                 {
  382.                     string ActIDtxt = Request.QueryString["ActID"].ToString().Trim();
  383.                     ActID = Convert.ToInt32(ActIDtxt);
  384.                     bool returnvalue = false;
  385.                     //returnvalue = etongzwf.WFActInsUpdata(ActID, userid, 1);
  386.                     returnvalue = workflow.WFActInsUpdata(ActID, 1, userid);
  387.                     if (returnvalue == true)
  388.                         ReActInsValue = ActID;
  389.                     if (ReActInsValue > 0)
  390.                     {
  391.                         if (ParentActID != -1)
  392.                         {
  393.                             ProjectImplment pi = new ProjectImplment();
  394.                             //DataTable dt = pi.GetDepartmentByID(ParentRoleID);
  395.                             DataTable dt = pi.GetNextOperatorRole(ParentRoleID);
  396.                             nextCheckDepartment = dt.Rows[0]["OpName"].ToString();
  397.                             NextColonyRole(ParentActID, ParentRoleID, showMessage, nextCheckDepartment, isMaster);  //(ReActInsValue);     //产生下一个活动实例并提交到下一个角色的用户申核
  398.                         }
  399.                         else//不存在上级活动,将 活动状态(Status) 改为 "完成"   注:Status状态(0、正常;1、完成;2、回退;3、回退并完成;4、作废)
  400.                         {
  401.                             bool ReValueAIUpdata = false;
  402.                             //ReValueAIUpdata = etongzwf.WFActInsUpdata(ReActInsValue, userid, 1);
  403.                             ReValueAIUpdata = workflow.WFActInsUpdata(ReActInsValue, 1, userid);
  404.                             if (ReValueAIUpdata == true)
  405.                             {
  406.                                 ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('系统提示:项目施工完成!');top.location.href='../Main.aspx';</script>");
  407.                             }
  408.                             else
  409.                             {
  410.                                 ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('系统提示:操作失败!');top.location.href='../Main.aspx';</script>");
  411.                             }
  412.                         }
  413.                     }
  414.                 }
  415.                 else
  416.                 {
  417.                     WFActInsInfo wfactinsinfo = new WFActInsInfo(-1, ActivityID, Convert.ToDateTime(DateTime.Now.ToShortDateString()), Convert.ToDateTime(DateTime.Now.ToShortDateString()),
  418.                                                                      1, SuccessDate, WFInstanceID, "", userid, CurrentRoleID);
  419.                     ReActInsValue = etongzwf.WFActInsADD(wfactinsinfo);
  420.                     ProjectImplment pi = new ProjectImplment();
  421.                     //DataTable dt = pi.GetDepartmentByID(ParentRoleID);
  422.                     DataTable dt = pi.GetNextOperatorRole(ParentRoleID);
  423.                     if (dt.Rows.Count > 0)
  424.                     {
  425.                         nextCheckDepartment = dt.Rows[0]["OpName"].ToString();
  426.                         //ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('系统提示:计划下达成功,转到『" + nextCheckDepartment + "』申核处理!');top.location.href='../Main.aspx';</script>");
  427.                     }
  428.                     NextColonyRole(ParentActID, ParentRoleID, showMessage, nextCheckDepartment, isMaster);//提交给下一部门用户审核
  429.                 }
  430.             }
  431.             else//对不是起始活动的操作
  432.             {
  433.                 string ActIDtxt = Request.QueryString["ActID"].ToString().Trim();
  434.                 ActID = Convert.ToInt32(ActIDtxt);
  435.                 bool returnvalue = false;
  436.                 //returnvalue = etongzwf.WFActInsUpdata(ActID, userid, 1);
  437.                 returnvalue = workflow.WFActInsUpdata(ActID, 1, userid);
  438.                 if (returnvalue == true)
  439.                     ReActInsValue = ActID;
  440.                 if (ReActInsValue > 0)
  441.                 {
  442.                     if (ParentActID != -1)
  443.                     {
  444.                         ProjectImplment pi = new ProjectImplment();
  445.                         //DataTable dt = pi.GetDepartmentByID(ParentRoleID);
  446.                         DataTable dt = pi.GetNextOperatorRole(ParentRoleID);
  447.                         nextCheckDepartment = dt.Rows[0]["OpName"].ToString();
  448.                         NextColonyRole(ParentActID, ParentRoleID, showMessage, nextCheckDepartment, isMaster);  //(ReActInsValue);     //产生下一个活动实例并提交到下一个角色的用户申核
  449.                     }
  450.                     else   // 不存在上级活动,将 活动状态(Status) 改为 "完成"   注:Status状态(0、正常;1、完成;2、回退;3、回退并完成;4、作废)
  451.                     {
  452.                         bool ReValueAIUpdata = false;
  453.                         //ReValueAIUpdata = etongzwf.WFActInsUpdata(ReActInsValue, userid, 1);
  454.                         ReValueAIUpdata = workflow.WFActInsUpdata(ReActInsValue, 1, userid);
  455.                         if (ReValueAIUpdata == true)
  456.                         {
  457.                             ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('系统提示:工程项目实施工作流活动完成!');top.location.href='../Main.aspx';</script>");
  458.                         }
  459.                         else
  460.                         {
  461.                             ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('系统提示:操作失败!');top.location.href='../Main.aspx';</script>");
  462.                         }
  463.                     }
  464.                 }
  465.             }
  466.         }
  467.     }
  468.     /// <summary>
  469.     /// 起始活动.
  470.     /// </summary>
  471.     protected int ActivityIDGetByWFID(int WfId)
  472.     {
  473.         EtongZwf etongzwf = new EtongZwf();
  474.         DataView dvActivity = etongzwf.GetActivityByWFID(WfId);
  475.         if (dvActivity.Count != 0)
  476.         {
  477.             int activity = Convert.ToInt32(dvActivity[0][0].ToString().Trim());
  478.             return activity;
  479.         }
  480.         else
  481.             return 0;
  482.     }
  483.     /// <summary>
  484.     /// 提交到上级部门用户申核
  485.     /// </summary>
  486.     protected void NextColonyRole(int ParentActID, int ParentRoleID, string showMessage, string nextCheckDepartment, bool isMaster)
  487.     {
  488.         EtongZwf etongzwf = new EtongZwf();
  489.         WFActInsInfo wfactinsinfo = null;
  490.         if (isMaster == false)
  491.         {
  492.             wfactinsinfo = new WFActInsInfo(-1, ParentActID, Convert.ToDateTime(DateTime.Now.ToShortDateString()), Convert.ToDateTime(DateTime.Now.ToShortDateString()),
  493.                                                                      0, Convert.ToDateTime(DateTime.Now.ToShortDateString()), WFInstanceID, WorkFolw.GetOrgOpRoleType(ParentRoleID), -1, ParentRoleID);
  494.         }
  495.         else
  496.         {
  497.             CheckUserInfo cui = null;
  498.             if (Session["checkuserinfo"] != null)
  499.             {
  500.                 cui = (CheckUserInfo)Session["checkuserinfo"];
  501.             }
  502.             string type = ProjectImplment.GetEmpType(cui.EmpID);
  503.             wfactinsinfo = new WFActInsInfo(-1, ParentActID, Convert.ToDateTime(DateTime.Now.ToShortDateString()), Convert.ToDateTime(DateTime.Now.ToShortDateString()),
  504.                                                                 0, Convert.ToDateTime(DateTime.Now.ToShortDateString()), WFInstanceID, type, -1, ParentRoleID);
  505.         }
  506.         int ReActInsValue = etongzwf.WFActInsADD(wfactinsinfo);
  507.         if (ReActInsValue > 0)
  508.         {
  509.             //DataView dvRoleName = etongzwf.RoleGetName(ParentRoleID);
  510.             //if (dvRoleName.Count != 0)
  511.             //{
  512.             //InitializePage();        //初始化当前页面
  513.             ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('系统提示:" + showMessage + ",转到『" + nextCheckDepartment + "』申核处理!');top.location.href='../Main.aspx';</script>");
  514.             //}
  515.             //else
  516.             //ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('系统提示:项目施工停滞,没有上级申核人!');</script>");
  517.         }
  518.         else
  519.         {
  520.             ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('系统提示:操作失败!');top.location.href='../Main.aspx';</script>");
  521.         }
  522.     }
  523.     protected void BT_Revoke_Click(object sender, ImageClickEventArgs e)
  524.     {
  525.         string sql = "update tb_WF_ACtIns set Status=4  where [WfInstanceID]=" + WFInstanceID + " and [ActivityID]=" + ActivityID;
  526.         string sql1 = "update [tb_construct] set [Status]=3 where [ConID]=" + this.ConID;
  527.         if (SqlServer.RunSql(sql) && SqlServer.RunSql(sql1))
  528.         {
  529.             ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('系统提示:作废操作成功!');top.location.href='../Main.aspx';</script>");
  530.         }
  531.         else
  532.         {
  533.             ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('系统提示:作废操作失败!');top.location.href='../Main.aspx';</script>");
  534.         }
  535.     }
  536.     //protected void BT_OpenDocument_Click(object sender, EventArgs e)
  537.     //{
  538.     //    this.Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>window.open('DaiBan.aspx?strFName='" + this.lblReportMaterialPlan.Text + ".doc')</script>");
  539.     //}
  540.     protected void BT_NotPass_Click(object sender, ImageClickEventArgs e)
  541.     {
  542.         //******************************************************监督实施*************************************************************
  543.         if (MustChooseItem == 23)
  544.         {
  545.             int RouID = 1;//结束后关联种类条件ID(-1、无条件,1、变更材料,2、废旧物资处理,3、汇总废旧物资,4、施工工作流)
  546.             DataView dv = GetConstructInfo(this.ConID);
  547.             string BgFName = dv[0]["JcWZFName"].ToString();
  548.             string altername = this.TB_ConName.Text.ToString() + "材料变更";
  549.             string sql = "";
  550.             string consort = "";
  551.             CheckUserInfo cui = null;
  552.             if (Session["checkuserinfo"] != null)
  553.             {
  554.                 cui = (CheckUserInfo)Session["checkuserinfo"];
  555.             }
  556.             consort = ProjectImplment.GetEmpType(cui.EmpID);
  557.             //string sql = "insert into [tb_PrjAlert]([ConID],[BgFName]) values (" + this.ConID + ",'" + BgFName + "')";
  558.             PrjAlertInfo prjAlertInfo = new PrjAlertInfo(this.ConID, consort, altername, BgFName, "", "", "", "", "", "", "", "", 1);
  559.             PrjAlertManager prjAlertManager = new PrjAlertManager();
  560.             int newPrjAlertID = prjAlertManager.AddPrjAlert(prjAlertInfo);
  561.             if (newPrjAlertID > 0)
  562.             {
  563.                 //产生项目调整代办任务
  564.                 //begin code
  565.                 int WFID = -1;
  566.                 sql = "select [WFID] from [tb_WorkFlowRouter] where [RouID]=" + RouID;
  567.                 dv = SqlServer.GetDataView(sql);
  568.                 if (dv.Count > 0)
  569.                 {
  570.                     WFID = Convert.ToInt32(dv[0]["WFID"].ToString());
  571.                 }
  572.                 if (WFID != -1)
  573.                 {
  574.                     EtongZwf etongzwf = new EtongZwf();
  575.                     DateTime SuccessDate = Convert.ToDateTime(DateTime.Now.ToShortDateString().Trim());
  576.                     //添加工作流实例 (将添加成功的constructid添加到工作流实例表里,注意是加到该表的PrjID字段中)
  577.                     WFInstanceInfo wfinstanceinfo = new WFInstanceInfo(-1, Convert.ToDateTime(DateTime.Now.ToShortDateString()),
  578.                             userid, -1, -1, DateTime.Now, 4, SuccessDate, WFID, newPrjAlertID);
  579.                     int ReInstanceValue = etongzwf.WFInstanceADD(wfinstanceinfo);
  580.                     this.WFInstanceID = ReInstanceValue;
  581.                     if (this.WFInstanceID > 0)
  582.                     {
  583.                         sql = "select [ActivityID] from [tb_WF_Activity] where [WorkFlowID]=" + WFID + " and [StartEnd]=0";
  584.                         dv = SqlServer.GetDataView(sql);
  585.                         if (dv.Count > 0)
  586.                         {
  587.                             this.ActivityID = Convert.ToInt32(dv[0]["ActivityID"].ToString());
  588.                             int OpRoleID = -1;
  589.                             sql = "select [RoleID] from [tb_Colony_User] where [ActivityID]=" + this.ActivityID;
  590.                             dv = SqlServer.GetDataView(sql);
  591.                             if (dv.Count > 0)
  592.                                 OpRoleID = Convert.ToInt32(dv[0]["RoleID"].ToString());
  593.                             if (OpRoleID > 0)
  594.                             {
  595.                                 WFActInsInfo wfactinsinfo = new WFActInsInfo(-1, this.ActivityID, Convert.ToDateTime(DateTime.Now.ToShortDateString()), Convert.ToDateTime(DateTime.Now.ToShortDateString()),
  596.                                                                                                     0, SuccessDate, this.WFInstanceID, consort, -1, OpRoleID);
  597.                                 int ReActInsValue = etongzwf.WFActInsADD(wfactinsinfo);
  598.                             }
  599.                         }
  600.                     }
  601.                 }
  602.                 //end code
  603.                 WorkFolw workflow = new WorkFolw();
  604.                 workflow.WFActInsUpdata(actinstanceid, 1, userid);
  605.                 string script = "<script>alert('系统提示:您已确认审核不通过,转到物资并更物资管理流程!');top.location.href='../Main.aspx';</script>";
  606.                 Common.RunScriptString(this.Page, script);
  607.                 //sql = "update [tb_construct] set [Status]=2 where [ConID]=" + this.ConID;
  608.                 //if (SqlServer.RunSql(sql))
  609.                 //{
  610.                 //    string script = "<script>alert('系统提示:您已审核通过,转到废旧物资管理流程!');top.location.href='../Main.aspx';</script>";
  611.                 //    Common.RunScriptString(this.Page, script);
  612.                 //}
  613.             }
  614.             //CheckUserInfo cui = (CheckUserInfo)Session["checkuserinfo"];
  615.             ////string ZgJdTransaction = cui.EmpName + "   " + DateTime.Now.ToShortDateString() + " " + DateTime.Now.Hour + ":" + DateTime.Now.Minute;
  616.             //string ZgJdTransactor = cui.EmpName;
  617.             //this.TB_ZgJdIdea.Text = "审核不通过";
  618.             //string ZgJdIdea = this.TB_ZgJdIdea.Text.Trim() + "  " + DateTime.Now.ToShortDateString() + " " + DateTime.Now.Hour + ":" + DateTime.Now.Minute;//主管部门监督实施审核意见和审核时间
  619.             //string sql = "update [Tb_Construct] set [ZgJdTransactor]='" + ZgJdTransactor + "',[ZgJdIdea]='" + ZgJdIdea + "' where [ConID]=" + this.ConID;
  620.             //if (SqlServer.RunSql(sql))
  621.             //{
  622.             //    this.shuntFlag = 2;
  623.             //    //WorkFlowOperation(ConID, "您审核未通过!",false);
  624.             //}
  625.             //else
  626.             //{
  627.             //    Common.RunScript(this.Page, "操作失败,请检查数据!");
  628.             //}
  629.         }
  630.     }
  631.     //******************************************************得到指定活动的文档名称*************************************************************
  632.     protected string GetDocumentFileName(int activityid)
  633.     {
  634.         string sql = "select [FName] from [tb_Colony_FileName1] a,[tb_Sys_FileName] b where a.[FID]=b.[FID] and [ActivityID]=" + activityid;
  635.         string filename = "";
  636.         //string tempfilename = "";
  637.         DataView dv = SqlServer.GetDataView(sql);
  638.         if (dv != null && dv.Count > 0)
  639.         {
  640.             filename = dv[0]["FName"].ToString();
  641.             //if (filename.Length >= 2)
  642.                 //tempfilename = filename.Substring(filename.LastIndexOf("\\") + 2);
  643.         }
  644.         return filename;
  645.     }
  646.     protected string GetDocumentFileName(int activityid, int index)
  647.     {
  648.         string sql = "select [FName] from [tb_Colony_FileName1] a,[tb_Sys_FileName] b where a.[FID]=b.[FID] and [ActivityID]=" + activityid;
  649.         string filename = "";
  650.         //string tempfilename = "";
  651.         DataView dv = SqlServer.GetDataView(sql);
  652.         if (dv != null && dv.Count > 0)
  653.         {
  654.             filename = dv[index]["FName"].ToString();
  655.             //if (filename.Length >= 2)
  656.                 //tempfilename = filename.Substring(filename.LastIndexOf("\\") + 2);
  657.         }
  658.         return filename;
  659.     }
  660.     ////******************************************************用最新日期生成最新文档*************************************************************
  661.     protected string MakeNewFileNameWithDate(string filename)
  662.     {
  663.         if (filename.Length > 0 && filename.Contains("."))
  664.         {
  665.             string[] a = filename.Split('.');
  666.             return a[0] + DateTime.Now.Year + DateTime.Now.Month + DateTime.Now.Day + DateTime.Now.Hour + DateTime.Now.Minute + DateTime.Now.Second + "." + a[1];
  667.         }
  668.         else
  669.             return "";
  670.     }
  671.     ////******************************************************找到员工类型的汇总文档*************************************************************
  672.     protected string GetEmpTypeDocument_MaterialPlan()
  673.     {
  674.         string EmpTypeFileName = "";
  675.         string path = Server.MapPath("doc").Replace("\", "\\");      //获取项目所在路径
  676.         CheckUserInfo cui = null;
  677.         if (Session["checkuserinfo"] != null)
  678.         {
  679.             cui = (CheckUserInfo)Session["checkuserinfo"];
  680.         }
  681.         string EmpType = ProjectImplment.GetEmpType(cui.EmpID);
  682.         string filename = GetConstructInfo(this.ConID)[0]["WZFName"].ToString();
  683.         if (filename != "")
  684.         {
  685.             string xmlFileName = path + "\DocTemplateCon\" + filename;
  686.             XML xml = new XML(xmlFileName);
  687.             //ArrayList list = xml.ReadNode("Documents", EmpType, true);
  688.             ArrayList nodename=new ArrayList ();
  689.             nodename.Add("FileName");
  690.             ArrayList list = xml.ReadNode(nodename, "Documents");
  691.             if (list.Count > 0)
  692.             {
  693.                 //DocumentNode node = (DocumentNode)list[0];
  694.                 //EmpTypeFileName = node.FileName;
  695.                 string[] a = (string[])list[0];
  696.                 EmpTypeFileName = a[0].ToString();
  697.             }
  698.         }
  699.         return EmpTypeFileName;
  700.     }
  701.     protected string GetEmpTypeDocument_SetupExecution()
  702.     {
  703.         string EmpTypeFileName = "";
  704.         string path = Server.MapPath("doc").Replace("\", "\\");      //获取项目所在路径
  705.         CheckUserInfo cui = null;
  706.         if (Session["checkuserinfo"] != null)
  707.         {
  708.             cui = (CheckUserInfo)Session["checkuserinfo"];
  709.         }
  710.         string EmpType = ProjectImplment.GetEmpType(cui.EmpID);
  711.         string filename = GetConstructInfo(this.ConID)[0]["JcZFName"].ToString();
  712.         if (filename != "")
  713.         {
  714.             string xmlFileName = path + "\DocTemplateCon\" + filename;
  715.             XML xml = new XML(xmlFileName);
  716.             ArrayList list = xml.ReadNode("Documents", EmpType, true);
  717.             if (list.Count > 0)
  718.             {
  719.                 DocumentNode node = (DocumentNode)list[0];
  720.                 EmpTypeFileName = node.FileName;
  721.             }
  722.         }
  723.         return EmpTypeFileName;
  724.     }
  725.     protected string GetEmpTypeDocument_JDExecution()
  726.     {
  727.         string EmpTypeFileName = "";
  728.         string path = Server.MapPath("doc").Replace("\", "\\");      //获取项目所在路径
  729.         CheckUserInfo cui = null;
  730.         if (Session["checkuserinfo"] != null)
  731.         {
  732.             cui = (CheckUserInfo)Session["checkuserinfo"];
  733.         }
  734.         string EmpType = ProjectImplment.GetEmpType(cui.EmpID);
  735.         string filename = GetConstructInfo(this.ConID)[0]["ZgJdDocumentXml"].ToString();
  736.         if (filename != "")
  737.         {
  738.             string xmlFileName = path + "\DocTemplateCon\" + filename;
  739.             XML xml = new XML(xmlFileName);
  740.             ArrayList list = xml.ReadNode("Documents", EmpType, true);
  741.             if (list.Count > 0)
  742.             {
  743.                 DocumentNode node = (DocumentNode)list[0];
  744.                 EmpTypeFileName = node.FileName;
  745.             }
  746.         }
  747.         return EmpTypeFileName;
  748.     }
  749.     protected string GetEmpTypeDocument_ProjectPlan()
  750.     {
  751.         string EmpTypeFileName = "";
  752.         string path = Server.MapPath("doc").Replace("\", "\\");      //获取项目所在路径
  753.         CheckUserInfo cui = null;
  754.         if (Session["checkuserinfo"] != null)
  755.         {
  756.             cui = (CheckUserInfo)Session["checkuserinfo"];
  757.         }
  758.         string EmpType = ProjectImplment.GetEmpType(cui.EmpID);
  759.         string filename = GetConstructInfo(this.ConID)[0]["ZgHzFName"].ToString();
  760.         if (filename != "")
  761.         {
  762.             string xmlFileName = path + "\DocTemplateCon\" + filename;
  763.             XML xml = new XML(xmlFileName);
  764.             ArrayList list = xml.ReadNode("Documents", EmpType, true);
  765.             if (list.Count > 0)
  766.             {
  767.                 DocumentNode node = (DocumentNode)list[0];
  768.                 EmpTypeFileName = node.FileName;
  769.             }
  770.         }
  771.         return EmpTypeFileName;
  772.     }
  773.     protected void ViewLog_Click(object sender, ImageClickEventArgs e)
  774.     {
  775.         string ProjectID = ((HtmlInputHidden)this.FindControl("txt_ProjectID")).Value.Trim();
  776.         string sURL = "WFLog.aspx?ProjectID=" + ProjectID;
  777.         Response.Redirect(sURL);
  778.     }
  779.     protected void IB_Back_Click(object sender, ImageClickEventArgs e)
  780.     {
  781.         ClientScript.RegisterStartupScript(this.GetType(), "", "<script> window.location.href='../SearchP/StructureSearch.aspx';</script>");
  782.     }
  783.     protected void IB_Collect_Click(object sender, ImageClickEventArgs e)
  784.     {
  785.         string path = Server.MapPath("doc").Replace("\", "\\");      //获取项目所在路径
  786.         CheckUserInfo cui = null;
  787.         if (Session["checkuserinfo"] != null)
  788.         {
  789.             cui = (CheckUserInfo)Session["checkuserinfo"];
  790.         }
  791.         /*com.etong.DAL.FC.EtongFlyChouWFPrj etongFlyChouWFPrj = new com.etong.DAL.FC.EtongFlyChouWFPrj();
  792.         etongFlyChouWFPrj.sID = this.actinstanceid;
  793.         etongFlyChouWFPrj.PrjID = this.MatID;
  794.         etongFlyChouWFPrj.wID = this.wfid;
  795.         etongFlyChouWFPrj.iStatus = 5;
  796.         etongFlyChouWFPrj.sBlockReason = WorkFolw.GetBlockReason(this.actinstanceid);
  797.         if (etongFlyChouWFPrj.CheckUpActCompleteSort() == false)
  798.         {
  799.             Common.RunScript(this.Page, "工作流上级所属(同类型的)活动未完成,不能汇总文档");
  800.             return;
  801.         }
  802.         else
  803.         {*/
  804.         string EmpType = ProjectImplment.GetEmpType(cui.EmpID);
  805.         string filename = "型物资计划汇总表";
  806.         string filename1 = "型进度计划汇总表";
  807.         string filename2 = "型工程进度汇总表";
  808.         string filename3 = "型工程进度汇总总表";
  809.         string filename4 = "型进度计划汇总表";
  810.         /*switch (EmpType)
  811.         {
  812.             case "1": filename = "科技" + filename + DateTime.Now.Year + DateTime.Now.Month + DateTime.Now.Day + DateTime.Now.Hour + DateTime.Now.Minute + DateTime.Now.Second + ".doc";
  813.                 break;
  814.             case "2": filename = "生产" + filename + DateTime.Now.Year + DateTime.Now.Month + DateTime.Now.Day + DateTime.Now.Hour + DateTime.Now.Minute + DateTime.Now.Second + ".doc";
  815.                 break;
  816.             case "3": filename = "营销" + filename + DateTime.Now.Year + DateTime.Now.Month + DateTime.Now.Day + DateTime.Now.Hour + DateTime.Now.Minute + DateTime.Now.Second + ".doc";
  817.                 break;
  818.         }*/
  819.         filename = EmpType + "-" + filename + DateTime.Now.Year + DateTime.Now.Month + DateTime.Now.Day + DateTime.Now.Hour + DateTime.Now.Minute + DateTime.Now.Second;
  820.         filename1 = EmpType + "-" + filename1 + DateTime.Now.Year + DateTime.Now.Month + DateTime.Now.Day + DateTime.Now.Hour + DateTime.Now.Minute + DateTime.Now.Second;
  821.         filename2 = EmpType + "-" + filename2 + DateTime.Now.Year + DateTime.Now.Month + DateTime.Now.Day + DateTime.Now.Hour + DateTime.Now.Minute + DateTime.Now.Second;
  822.         filename3 = EmpType + "-" + filename3 + DateTime.Now.Year + DateTime.Now.Month + DateTime.Now.Day + DateTime.Now.Hour + DateTime.Now.Minute + DateTime.Now.Second;
  823.         filename4 = EmpType + "-" + filename4 + DateTime.Now.Year + DateTime.Now.Month + DateTime.Now.Day + DateTime.Now.Hour + DateTime.Now.Minute + DateTime.Now.Second;
  824.   
  825.         string checker = cui.EmpName;
  826.         string time = DateTime.Now.ToString();
  827.         DataView dv = GetConstructInfo(this.ConID);
  828.         if (this.MustChooseItem == 21)//物资采购汇总
  829.         {
  830.             com.etong.DAL.FC.EtongFlyChouWFPrj etongFlyChouWFPrj = new com.etong.DAL.FC.EtongFlyChouWFPrj();
  831.             etongFlyChouWFPrj.sID = this.actinstanceid;
  832.             etongFlyChouWFPrj.PrjID = this.ConID;
  833.             etongFlyChouWFPrj.wID = this.wfid;
  834.             etongFlyChouWFPrj.iStatus = 2;
  835.             //etongFlyChouWFPrj.sBlockReason = WorkFolw.GetBlockReason(this.actinstanceid);
  836.             //if (etongFlyChouWFPrj.CheckUpActComplete() == false)
  837.             if (WorkFolw.ParentActivitysIsCompleted(this.ConID, this.ActivityID) == false)
  838.             {
  839.                 Common.RunScript(this.Page, "工作流上级活动未完成,不能汇总文档");
  840.                 return;
  841.             }
  842.             else
  843.             {
  844.                 string xmlFileName = path + "\DocTemplateCon\" + dv[0]["WZFName"].ToString();
  845.                 XML xml = new XML(xmlFileName);
  846.                 XML jcXml = new XML(path + "\DocTemplateCon\" + dv[0]["JcWZFName"].ToString());
  847.                 //ArrayList list = jcXml.ReadNode("Documents", EmpType, true);
  848.                 //ArrayList list = jcXml.ReadNode("Documents");
  849.                 ArrayList nodesname = new ArrayList();
  850.                 nodesname.Add("FileName");
  851.                 ArrayList list = jcXml.ReadNode(nodesname, "Documents");
  852.                 string[] filecopy = new string[list.Count];
  853.                 ArrayList materiallist = new ArrayList();
  854.                 XML jcXml1 = new XML(path + "\DocTemplateCon\" + dv[0]["JcKgName"].ToString());
  855.                 ArrayList nodesname1 = new ArrayList();
  856.                 nodesname1.Add("FileName");
  857.                 ArrayList list1 = jcXml1.ReadNode(nodesname1, "Documents");
  858.                 string[] filecopy1 = new string[list.Count];
  859.                 ArrayList materiallist1 = new ArrayList();
  860.                 if (filecopy.Length > 0&&filecopy1 .Length >0)
  861.                 {
  862.                     for (int i = 0; i < filecopy.Length; i++)
  863.                     {
  864.                         //DocumentNode documentNode = (DocumentNode)list[i];
  865.                         string[] a = (string[])list[i];
  866.                         filecopy[i] = path + "\\DocTemplateCon\\" + a[0].ToString();
  867.                         materiallist.Add(Server.MapPath("doc\\DocTemplateCon\\" + a[0].ToString()));
  868.                     }
  869.                     for (int i = 0; i < filecopy1.Length; i++)
  870.                     {
  871.                         //DocumentNode documentNode = (DocumentNode)list[i];
  872.                         string[] a = (string[])list1[i];
  873.                         filecopy1[i] = path + "\\DocTemplateCon\\" + a[0].ToString();
  874.                         materiallist1.Add(Server.MapPath("doc\\DocTemplateCon\\" + a[0].ToString()));
  875.                     }
  876.                     string[] houzhui = filecopy[0].Split('.');
  877.                     string[] houzhui1 = filecopy1[0].Split('.');
  878.                     MyDocMerger myDocMerger = new MyDocMerger();
  879.                     string orgDocName = path + "\\DocTemplateCon\\" + filename4 + "." + houzhui1[1];
  880.                     Util.Copyfile(path + "\\空文档.doc", orgDocName);
  881.                     //this.txt_ZgHZFName.Value = filename + "." + houzhui[1];
  882.                     if (xml.AddXmlNode(new DocumentNode(filename + "." + houzhui[1], checker, time, EmpType))&&xml.AddXmlNode(new DocumentNode(filename4 + "." + houzhui1[1], checker, time, EmpType)))
  883.                     {
  884.                         // if (Util.Copyfile(path + "\" + orgfilename, orgDocName))
  885.                         // {
  886.                         /*------------------------文档汇总----------------------*/
  887.                         //myDocMerger.MergeDocArray(orgDocName, filecopy, orgDocName);
  888.                         /*---------------改变按钮组为可用状态-------------------*/
  889.                         //this.TB_OpenDocument_ZGdFName.Enabled = true;
  890.                         //this.TB_OpenDocument_ZgHZFName.Enabled = true;
  891.                         //this.TB_OpenDocument_ZGxFName.Enabled = true;
  892.                         //this.TB_OpenDocument_ZgHZFName.Text = "浏览电子文档";
  893.                         //this.TB_OpenDocument_ZgHZFName.Attributes.Add("onclick", "javascript:SetLinkUrl('DocTemplateCon/'+document.all('txt_ZgHZFName').value,'" + cui.EmpName + "');");
  894.                         try
  895.                         {
  896.                             myDocMerger.MergeDocArray(orgDocName, filecopy1, orgDocName);
  897.                             EtongExcel EExcel = new EtongExcel(Server.MapPath("doc\\空工作表.xls"), Server.MapPath("doc\\DocTemplateCon\\" + filename + "." + houzhui[1]));
  898.                             EExcel.RangeCellSet(materiallist, 3, 10);
  899.                             EExcel.SaveAsFile();
  900.                             //EExcel.KillExcelProcess();
  901.                             //this.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('系统提示:信息合并成功!');", true);
  902.                             Common.RunScript(this.Page, "汇总成功!");
  903.                             this.BT_OpenDocument_MaterialStock.Enabled = true;
  904.                             this.MaterialStock.Value = filename + "." + houzhui[1];
  905.                             this.BT_OpenDocument_ProjectPlan.Enabled = true;
  906.                             this.ProjectPlan.Value = filename4 + "." + houzhui1[1];
  907.                         }
  908.                         catch (Exception ex)
  909.                         {
  910.                             //ClientScript.RegisterStartupScript(this.GetType(), "errorMessage", "<script>alert('" + ex.Message.Replace("'", "").Replace("rn", "") + "');</script>");
  911.                             Common.RunScript(this.Page, ex.Message);
  912.                         }
  913.                         //this.IsCollect = true;
  914.                         //this.IB_Collect.Enabled = false;
  915.                         //  }
  916.                         // else
  917.                         // {
  918.                         //  Common.RunScript(this.Page, "打开文档失败!");
  919.                         // }
  920.                     }
  921.                     else
  922.                     {
  923.                         Common.RunScript(this.Page, "汇总失败,请检查相关数据!");
  924.                     }
  925.                 }
  926.                 else
  927.                 {
  928.                     Common.RunScript(this.Page, "没有文档,不能汇总!");
  929.                 }
  930.             }
  931.         }
  932.         if (this.MustChooseItem == 23)//监督实施汇总
  933.         {
  934.             com.etong.DAL.FC.EtongFlyChouWFPrj etongFlyChouWFPrj = new com.etong.DAL.FC.EtongFlyChouWFPrj();
  935.             etongFlyChouWFPrj.sID = this.actinstanceid;
  936.             etongFlyChouWFPrj.PrjID = this.ConID;
  937.             etongFlyChouWFPrj.wID = this.wfid;
  938.             etongFlyChouWFPrj.iStatus = 2;
  939.             etongFlyChouWFPrj.sBlockReason = WorkFolw.GetBlockReason(this.actinstanceid);
  940.             if (etongFlyChouWFPrj.CheckUpActCompleteSort() == false)
  941.             {
  942.                 Common.RunScript(this.Page, "工作流上级所属(同类型的)活动未完成,不能汇总文档");
  943.                 return;
  944.             }
  945.             else
  946.             {
  947.                 string xmlFileName = path + "\DocTemplateCon\" + dv[0]["ZgJdDocumentXml"].ToString();
  948.                 XML xml = new XML(xmlFileName);
  949.                 string xmlProjectSchedule = path + "\DocTemplateCon\" + dv[0]["JcZFName"].ToString();
  950.                 XML jcXml = new XML(xmlProjectSchedule);
  951.                 ArrayList list = jcXml.ReadNode("Documents", EmpType, true);
  952.                 string[] filecopy = new string[list.Count];
  953.                 ArrayList materiallist = new ArrayList();
  954.                 if (filecopy.Length > 0)
  955.                 {
  956.                     for (int i = 0; i < filecopy.Length; i++)
  957.                     {
  958.                         DocumentNode documentNode = (DocumentNode)list[i];
  959.                         filecopy[i] = path + "\\DocTemplateCon\\" + documentNode.FileName;
  960.                         materiallist.Add(Server.MapPath("doc\\DocTemplateCon\\" + documentNode.FileName));
  961.                     }
  962.                     string[] houzhui = filecopy[0].Split('.');
  963.                     MyDocMerger myDocMerger = new MyDocMerger();
  964.                     string orgDocName = path + "\\DocTemplateCon\\" + filename1 + "." + houzhui[1];
  965.                     //this.txt_ZgHZFName.Value = filename + "." + houzhui[1];
  966.                     if (xml.AddXmlNode(new DocumentNode(filename1 + "." + houzhui[1], checker, time, EmpType)))
  967.                     {
  968.                         // if (Util.Copyfile(path + "\" + orgfilename, orgDocName))
  969.                         // {
  970.                         /*------------------------文档汇总----------------------*/
  971.                         //myDocMerger.MergeDocArray(orgDocName, filecopy, orgDocName);
  972.                         /*---------------改变按钮组为可用状态-------------------*/
  973.                         //this.TB_OpenDocument_ZGdFName.Enabled = true;
  974.                         //this.TB_OpenDocument_ZgHZFName.Enabled = true;
  975.                         //this.TB_OpenDocument_ZGxFName.Enabled = true;
  976.                         //this.TB_OpenDocument_ZgHZFName.Text = "浏览电子文档";
  977.                         //this.TB_OpenDocument_ZgHZFName.Attributes.Add("onclick", "javascript:SetLinkUrl('DocTemplateCon/'+document.all('txt_ZgHZFName').value,'" + cui.EmpName + "');");
  978.                         try
  979.                         {
  980.                             EtongExcel EExcel = new EtongExcel(Server.MapPath("doc\\空工作表.xls"), Server.MapPath("doc\\DocTemplateCon\\" + filename1 + "." + houzhui[1]));
  981.                             EExcel.RangeCellSet(materiallist, 3, 10);
  982.                             EExcel.SaveAsFile();
  983.                             //EExcel.KillExcelProcess();
  984.                             //this.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('系统提示:信息合并成功!');", true);
  985.                             Common.RunScript(this.Page, "汇总成功!");
  986.                             this.BT_OpenDocument_CollectSetupExecution.Enabled = true;
  987.                             this.BT_OpenDocument_CollectSetupExecution.Attributes.Add("onclick", "javascript:SetLinkUrl2('DocTemplateCon/'+document.all('CollectSetupExecution').value,'" + cui.EmpName + "');");
  988.                             this.CollectSetupExecution.Value = filename1 + "." + houzhui[1];
  989.                         }
  990.                         catch (Exception ex)
  991.                         {
  992.                             //ClientScript.RegisterStartupScript(this.GetType(), "errorMessage", "<script>alert('" + ex.Message.Replace("'", "").Replace("rn", "") + "');</script>");
  993.                             Common.RunScript(this.Page, ex.Message);
  994.                         }
  995.                         //this.IsCollect = true;
  996.                         //this.IB_Collect.Enabled = false;
  997.                         //  }
  998.                         // else
  999.                         // {
  1000.                         //  Common.RunScript(this.Page, "打开文档失败!");
  1001.                         // }
  1002.                     }
  1003.                     else
  1004.                     {
  1005.                         Common.RunScript(this.Page, "汇总失败,请检查相关数据!");
  1006.                     }
  1007.                 }
  1008.                 else
  1009.                 {
  1010.                     Common.RunScript(this.Page, "没有文档,不能汇总!");
  1011.                 }
  1012.             }
  1013.         }
  1014.         if (this.MustChooseItem == 26)//工程进度汇总
  1015.         {
  1016.             com.etong.DAL.FC.EtongFlyChouWFPrj etongFlyChouWFPrj = new com.etong.DAL.FC.EtongFlyChouWFPrj();
  1017.             etongFlyChouWFPrj.sID = this.actinstanceid;
  1018.             etongFlyChouWFPrj.PrjID = this.ConID;
  1019.             etongFlyChouWFPrj.wID = this.wfid;
  1020.             etongFlyChouWFPrj.iStatus = 2;
  1021.             etongFlyChouWFPrj.sBlockReason = WorkFolw.GetBlockReason(this.actinstanceid);
  1022.             if (etongFlyChouWFPrj.CheckUpActCompleteSort() == false)
  1023.             //if (WorkFolw.ParentActivitysIsCompleted(this.ConID, this.ActivityID) == false)
  1024.             {
  1025.                 Common.RunScript(this.Page, "工作流上级所属(同类型的)活动未完成,不能汇总文档");
  1026.                 return;
  1027.             }
  1028.             else
  1029.             {
  1030.                 string xmlFileName = path + "\DocTemplateCon\" + dv[0]["JcSBFName"].ToString();
  1031.                 XML xml = new XML(xmlFileName);
  1032.                 string xmlProjectSchedule = Server.MapPath("doc\DocTemplateCon\" + dv[0]["ZgHzFName"].ToString());
  1033.                 XML jcXml = new XML(xmlProjectSchedule);
  1034.                 ArrayList list = xml.ReadNode("Documents", EmpType, true);
  1035.                 string[] filecopy = new string[list.Count];
  1036.                 ArrayList materiallist = new ArrayList();
  1037.                 if (filecopy.Length > 0)
  1038.                 {
  1039.                     for (int i = 0; i < filecopy.Length; i++)
  1040.                     {
  1041.                         DocumentNode documentNode = (DocumentNode)list[i];
  1042.                         filecopy[i] = path + "\\DocTemplateCon\\" + documentNode.FileName;
  1043.                         materiallist.Add(Server.MapPath("doc\\DocTemplateCon\\" + documentNode.FileName));
  1044.                     }
  1045.                     string[] houzhui = filecopy[0].Split('.');
  1046.                     MyDocMerger myDocMerger = new MyDocMerger();
  1047.                     string orgDocName = path + "\\DocTemplateCon\\" + filename1 + "." + houzhui[1];
  1048.                     //this.txt_ZgHZFName.Value = filename + "." + houzhui[1];
  1049.                     if (jcXml.AddXmlNode(new DocumentNode(filename2 + "." + houzhui[1], checker, time, EmpType)))
  1050.                     {
  1051.                         // if (Util.Copyfile(path + "\" + orgfilename, orgDocName))
  1052.                         // {
  1053.                         /*------------------------文档汇总----------------------*/
  1054.                         //myDocMerger.MergeDocArray(orgDocName, filecopy, orgDocName);
  1055.                         /*---------------改变按钮组为可用状态-------------------*/
  1056.                         //this.TB_OpenDocument_ZGdFName.Enabled = true;
  1057.                         //this.TB_OpenDocument_ZgHZFName.Enabled = true;
  1058.                         //this.TB_OpenDocument_ZGxFName.Enabled = true;
  1059.                         //this.TB_OpenDocument_ZgHZFName.Text = "浏览电子文档";
  1060.                         //this.TB_OpenDocument_ZgHZFName.Attributes.Add("onclick", "javascript:SetLinkUrl('DocTemplateCon/'+document.all('txt_ZgHZFName').value,'" + cui.EmpName + "');");
  1061.                         try
  1062.                         {
  1063.                             EtongExcel EExcel = new EtongExcel(Server.MapPath("doc\\芜湖供电公司工程进度表.xls"), Server.MapPath("doc\\DocTemplateCon\\" + filename2 + "." + houzhui[1]));
  1064.                             EExcel.RangeCellSet(materiallist, 3, 10);
  1065.                             EExcel.SaveAsFile();
  1066.                             //EExcel.KillExcelProcess();
  1067.                             //this.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('系统提示:信息合并成功!');", true);
  1068.                             Common.RunScript(this.Page, "汇总成功!");
  1069.                             //this.BT_OpenDocument_MaterialStock.Enabled = true;
  1070.                             this.BT_OpenDocument_GatherProjectSchedule.Enabled = true;
  1071.                             this.GatherProjectSchedule.Value = filename2 + "." + houzhui[1];
  1072.                             string xmlfilename = GetConstructInfo(this.ConID)[0]["GcglFName"].ToString();
  1073.                             if (xmlfilename != "")
  1074.                             {
  1075.                                 string filename11 = this.GatherProjectSchedule.Value;
  1076.                                 checker = cui.EmpName;
  1077.                                 time = DateTime.Now.ToString();
  1078.                                 string type = ProjectImplment.GetEmpType(cui.EmpID);
  1079.                                 XML xml1 = new XML(path + "\DocTemplateCon\" + xmlfilename);
  1080.                                 xml1.AddXmlNode(new DocumentNode(filename11, checker, time, type));//将基层上报的文档信息写入XML文档
  1081.                             }
  1082.                         }
  1083.                         catch (Exception ex)
  1084.                         {
  1085.                             //ClientScript.RegisterStartupScript(this.GetType(), "errorMessage", "<script>alert('" + ex.Message.Replace("'", "").Replace("rn", "") + "');</script>");
  1086.                             Common.RunScript(this.Page, ex.Message);
  1087.                         }
  1088.                         //this.IsCollect = true;
  1089.                         //this.IB_Collect.Enabled = false;
  1090.                         //  }
  1091.                         // else
  1092.                         // {
  1093.                         //  Common.RunScript(this.Page, "打开文档失败!");
  1094.                         // }
  1095.                     }
  1096.                     else
  1097.                     {
  1098.                         Common.RunScript(this.Page, "汇总失败,请检查相关数据!");
  1099.                     }
  1100.                 }
  1101.                 else
  1102.                 {
  1103.                     Common.RunScript(this.Page, "没有文档,不能汇总!");
  1104.                 }
  1105.             }
  1106.         }
  1107.         if (this.MustChooseItem == 27)//工程总进度汇总
  1108.         {
  1109.             com.etong.DAL.FC.EtongFlyChouWFPrj etongFlyChouWFPrj = new com.etong.DAL.FC.EtongFlyChouWFPrj();
  1110.             etongFlyChouWFPrj.sID = this.actinstanceid;
  1111.             etongFlyChouWFPrj.PrjID = this.ConID;
  1112.             etongFlyChouWFPrj.iID = this.WFInstanceID;
  1113.             etongFlyChouWFPrj.aID = this.ActivityID;
  1114.             etongFlyChouWFPrj.iStatus = 2;
  1115.             //etongFlyChouWFPrj.sBlockReason = WorkFolw.GetBlockReason(this.actinstanceid);
  1116.             if (etongFlyChouWFPrj.GetPrevioueTasksStatus() == false)
  1117.             {
  1118.                 Common.RunScript(this.Page, "工作流上级活动未完成,不能汇总文档");
  1119.                 return;
  1120.             }
  1121.             else
  1122.             {
  1123.                 //string xmlFileName = path + "\DocTemplateCon\" + dv[0]["GcglFName"].ToString();
  1124.                 //XML xml = new XML(xmlFileName);
  1125.                 string xmlpth = Server.MapPath("doc\\DocTemplateCon\\" + dv[0]["GcglFName"].ToString());
  1126.                 XML jcXml = new XML(path + "\\DocTemplateCon\\" + dv[0]["GcglFName"].ToString());
  1127.                 //ArrayList list = jcXml.ReadNode("Documents", EmpType, true);
  1128.                 //ArrayList list = jcXml.ReadNode("Documents");
  1129.                 ArrayList nodesname = new ArrayList();
  1130.                 nodesname.Add("FileName");
  1131.                 ArrayList list = jcXml.ReadNode(nodesname, "Documents");
  1132.                 string[] filecopy = new string[list.Count];
  1133.                 ArrayList materiallist = new ArrayList();
  1134.                 if (filecopy.Length > 0)
  1135.                 {
  1136.                     for (int i = 0; i < filecopy.Length; i++)
  1137.                     {
  1138.                         //DocumentNode documentNode = (DocumentNode)list[i];
  1139.                         string[] a = (string[])list[i];
  1140.                         filecopy[i] = path + "\\DocTemplateCon\\" + a[0].ToString();
  1141.                         materiallist.Add(Server.MapPath("doc\\DocTemplateCon\\" + a[0].ToString()));
  1142.                     }
  1143.                     string[] houzhui = filecopy[0].Split('.');
  1144.                     MyDocMerger myDocMerger = new MyDocMerger();
  1145.                     string orgDocName = path + "\\DocTemplateCon\\" + filename3 + "." + houzhui[1];
  1146.                     //this.txt_ZgHZFName.Value = filename + "." + houzhui[1];
  1147.                     //if (xml.AddXmlNode(new DocumentNode(filename + "." + houzhui[1], checker, time, EmpType)))
  1148.                     // {
  1149.                     // if (Util.Copyfile(path + "\" + orgfilename, orgDocName))
  1150.                     // {
  1151.                     /*------------------------文档汇总----------------------*/
  1152.                     //myDocMerger.MergeDocArray(orgDocName, filecopy, orgDocName);
  1153.                     /*---------------改变按钮组为可用状态-------------------*/
  1154.                     //this.TB_OpenDocument_ZGdFName.Enabled = true;
  1155.                     //this.TB_OpenDocument_ZgHZFName.Enabled = true;
  1156.                     //this.TB_OpenDocument_ZGxFName.Enabled = true;
  1157.                     //this.TB_OpenDocument_ZgHZFName.Text = "浏览电子文档";
  1158.                     //this.TB_OpenDocument_ZgHZFName.Attributes.Add("onclick", "javascript:SetLinkUrl('DocTemplateCon/'+document.all('txt_ZgHZFName').value,'" + cui.EmpName + "');");
  1159.                     try
  1160.                     {
  1161.                         EtongExcel EExcel = new EtongExcel(Server.MapPath("doc\\空工作表.xls"), Server.MapPath("doc\\DocTemplateCon\\" + filename3 + "." + houzhui[1]));
  1162.                         EExcel.RangeCellSet(materiallist, 3, 10);
  1163.                         EExcel.SaveAsFile();
  1164.                         //EExcel.KillExcelProcess();
  1165.                         //this.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('系统提示:信息合并成功!');", true);
  1166.                         Common.RunScript(this.Page, "汇总成功!");
  1167.                         this.BT_OpenDocument_ProjectAnalysis.Enabled = true;
  1168.                         this.ProjectAnalysis.Value = filename3 + "." + houzhui[1];
  1169.                     }
  1170.                     catch (Exception ex)
  1171.                     {
  1172.                         //ClientScript.RegisterStartupScript(this.GetType(), "errorMessage", "<script>alert('" + ex.Message.Replace("'", "").Replace("rn", "") + "');</script>");
  1173.                         Common.RunScript(this.Page, ex.Message);
  1174.                     }
  1175.                     //}
  1176.                     //else
  1177.                     //{
  1178.                     //   Common.RunScript(this.Page, "汇总失败,请检查相关数据!");
  1179.                     //}
  1180.                 }
  1181.                 else
  1182.                 {
  1183.                     Common.RunScript(this.Page, "没有文档,不能汇总!");
  1184.                 }
  1185.             }
  1186.         }
  1187.         //}
  1188.     }
  1189.     //
  1190.     protected bool CheckEmpTypeIsEqualBlockReason()
  1191.     {
  1192.         bool flag = false;
  1193.         int wfid = -1;
  1194.         int actid = -1;
  1195.         CheckUserInfo cui = null;
  1196.         if (Session["checkuserinfo"] != null)
  1197.         {
  1198.             cui = (CheckUserInfo)Session["checkuserinfo"];
  1199.         }
  1200.         string type = ProjectImplment.GetEmpType(cui.EmpID);
  1201.         string sql = "select * from [tb_WF_Instance] where [Status]=2 and [PrjID]=" + this.ConID;
  1202.         DataView dv = SqlServer.GetDataView(sql);
  1203.         wfid = Convert.ToInt32(dv[0]["WFInstanceID"].ToString());
  1204.         EtongZwf etongzwf = new EtongZwf();
  1205.         dv = etongzwf.ColonyUserGetByActId(ActivityID);
  1206.         if (dv.Count > 0)
  1207.         {
  1208.             actid = Convert.ToInt32(dv[0]["ParentActID"].ToString().Trim());
  1209.             sql = "select [BlockReason] from [tb_WF_ActIns] where [ActivityID]=" + actid + " and [WfInstanceID]=" + wfid;
  1210.             dv = SqlServer.GetDataView(sql);
  1211.             if (dv.Count > 0)
  1212.             {
  1213.                 if (type == dv[0]["BlockReason"].ToString())
  1214.                     flag = true;
  1215.             } 
  1216.         }
  1217.         return flag;
  1218.     }
  1219.     protected bool IsExsitNextWaitActivity()
  1220.     {
  1221.         bool flag = false;
  1222.         int wfid = -1;
  1223.         int actid = -1;
  1224.         string sql = "select * from [tb_WF_Instance] where [Status]=2 and [PrjID]=" + this.ConID;
  1225.         DataView dv = SqlServer.GetDataView(sql);
  1226.         wfid = Convert.ToInt32(dv[0]["WFInstanceID"].ToString());
  1227.         EtongZwf etongzwf = new EtongZwf();
  1228.         dv = etongzwf.ColonyUserGetByActId(ActivityID);
  1229.         if (dv.Count > 0)
  1230.         {
  1231.             actid = Convert.ToInt32(dv[0]["ParentActID"].ToString().Trim());
  1232.             sql = "select * from [tb_WF_ActIns] where [ActivityID]=" + actid + " and [WfInstanceID]=" + wfid;
  1233.             dv = SqlServer.GetDataView(sql);
  1234.             if (dv.Count > 0)
  1235.             {
  1236.                // if (type == dv[0]["BlockReason"].ToString())
  1237.                 flag = true;
  1238.             }
  1239.         }
  1240.         return flag;
  1241.     }
  1242. }