ProjectImplement.aspx.cs
上传用户:tiancihang
上传日期:2014-03-12
资源大小:21387k
文件大小:171k
- com.etong.DAL.FC.EtongFlyChouWFPrj etongFlyChouWFPrj = new com.etong.DAL.FC.EtongFlyChouWFPrj();
- etongFlyChouWFPrj.sID = this.actinstanceid;
- etongFlyChouWFPrj.PrjID = this.ConID;
- etongFlyChouWFPrj.iID = this.WFInstanceID;
- etongFlyChouWFPrj.aID= this.ActivityID;
- etongFlyChouWFPrj.iStatus = 2;
- //etongFlyChouWFPrj.sBlockReason = WorkFolw.GetBlockReason(this.actinstanceid);
- if (etongFlyChouWFPrj.GetPrevioueTasksStatus() == false)
- {
- Common.RunScript(this.Page, "工作流上级活动未完成,不能汇总文档");
- return;
- }
- else
- {
- //汇总代码
-
- //
- string GcglTransactor = cui.EmpName + " " + DateTime.Now.ToShortDateString() + " " + DateTime.Now.Hour + ":" + DateTime.Now.Minute;
- //string GcglFName = "工程进度调整计划、问题和解决方案" + DateTime.Now.Year + DateTime.Now.Month + DateTime.Now.Day + DateTime.Now.Hour + DateTime.Now.Minute + DateTime.Now.Second + ".doc";//工程管理办公室项目实施情况分析,工程项目调整计划(电子文档)-----待续
- string GcglFName = this.ProjectAnalysis.Value;
- string sql = "update [Tb_Construct] set [GcglTransactor]='" + GcglTransactor + "' where [ConID]=" + this.ConID;
- if (SqlServer.RunSql(sql))
- {
- //WorkFlowOperation(ConID, "您已审核通过!", false);
- WFInstADD("您已审核通过!", true);
- WorkFolw workflow = new WorkFolw();
- string ActIDtxt = Request.QueryString["ActID"].ToString().Trim();
- ActID = Convert.ToInt32(ActIDtxt);
- bool flag = workflow.WFActInsUpdata(ActID, 1, this.userid);
- if (flag == true)
- {
- //WorkFlowOperation(ConID, "您已审核通过!");
- int RouID = 2;//结束后关联种类条件ID(-1、无条件,1、变更材料,2、废旧物资处理,3、汇总废旧物资,4、施工工作流)
- //产生项目调整代办任务
- //begin code
- int WFID = -1;
- sql = "select [WFID] from [tb_WorkFlowRouter] where [RouID]=" + RouID;
- DataView dv = SqlServer.GetDataView(sql);
- if (dv.Count > 0)
- {
- WFID = Convert.ToInt32(dv[0]["WFID"].ToString());
- }
- if (WFID != -1)
- {
- dv = GetConstructInfo(this.ConID);
- string bgFName = dv[0]["JcWZFName"].ToString();
- PrjOldMatManager prjOldMatManager = new PrjOldMatManager();
- //PrjOldMatInfo prjOldMatInfo = new PrjOldMatInfo(this.ConID, Convert.ToInt32(consort), -1, "", "", "", "",bgFName, "", "", "", "", "", "", "", "", "", "", 1);
- PrjOldMatInfo prjOldMatInfo = new PrjOldMatInfo(this.ConID, Convert.ToInt32(consort), -1, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", 1);
- int NewMatID = prjOldMatManager.AddPrjOldMat(prjOldMatInfo);
- if (NewMatID > 0)
- {
- EtongZwf etongzwf = new EtongZwf();
- DateTime SuccessDate = Convert.ToDateTime(DateTime.Now.ToShortDateString().Trim());
- //添加工作流实例 (将添加成功的constructid添加到工作流实例表里,注意是加到该表的PrjID字段中)
- WFInstanceInfo wfinstanceinfo = new WFInstanceInfo(-1, Convert.ToDateTime(DateTime.Now.ToShortDateString()),
- userid, -1, -1, DateTime.Now, 5, SuccessDate, WFID, NewMatID);
- int ReInstanceValue = etongzwf.WFInstanceADD(wfinstanceinfo);
- this.WFInstanceID = ReInstanceValue;
- if (this.WFInstanceID > 0)
- {
- sql = "select [ActivityID] from [tb_WF_Activity] where [WorkFlowID]=" + WFID + " and [StartEnd]=0";
- dv = SqlServer.GetDataView(sql);
- if (dv.Count > 0)
- {
- this.ActivityID = Convert.ToInt32(dv[0]["ActivityID"].ToString());
- int OpRoleID = -1;
- sql = "select [RoleID] from [tb_Colony_User] where [ActivityID]=" + this.ActivityID;
- dv = SqlServer.GetDataView(sql);
- if (dv.Count > 0)
- OpRoleID = Convert.ToInt32(dv[0]["RoleID"].ToString());
- if (OpRoleID > 0)
- {
- WFActInsInfo wfactinsinfo = new WFActInsInfo(-1, this.ActivityID, Convert.ToDateTime(DateTime.Now.ToShortDateString()), Convert.ToDateTime(DateTime.Now.ToShortDateString()),
- 0, SuccessDate, this.WFInstanceID, "99", -1, OpRoleID);
- int ReActInsValue = etongzwf.WFActInsADD(wfactinsinfo);
- }
- }
- }
- }
- }
- //end code
- }
- sql = "update [tb_construct] set [Status]=2 where [ConID]=" + this.ConID;
- if (SqlServer.RunSql(sql))
- {
- string script = "<script>alert('系统提示:您已审核通过,转到废旧物资管理流程处理!');top.location.href='../Main.aspx';</script>";
- Common.RunScriptString(this.Page, script);
- }
- }
- else
- {
- Common.RunScript(this.Page, "操作失败,请检查数据!");
- }
- }
- }
- //**************************************************************上缴废旧物资**************************************************************
- /* if (MustChooseItem == 28)
- {
- string JcSJTransactor = cui.EmpName + " " + DateTime.Now.ToShortDateString() + " " + DateTime.Now.Hour + ":" + DateTime.Now.Minute;
- //string JcSJFName = "废旧物资" + DateTime.Now.Year + DateTime.Now.Month + DateTime.Now.Day + DateTime.Now.Hour + DateTime.Now.Minute + DateTime.Now.Second + ".doc";//基层部门上缴废旧物资清单(电子文档)-----待续
- string JcSJFName = this.TurnInOldMaterial.Value;
- string sql = "update [Tb_Construct] set [JcSJTransactor]='" + JcSJTransactor + "',[JcSJFName]='" + JcSJFName + "' where [ConID]=" + this.ConID;
- if (SqlServer.RunSql(sql))
- {
- }
- else
- {
- Common.RunScript(this.Page, "操作失败,请检查数据!");
- }
- }*/
- //************************************************************废旧物资管理流程*************************************************************
- /*if (MustChooseItem == 29)
- {
- string WZFjTransactor = cui.EmpName + " " + DateTime.Now.ToShortDateString() + " " + DateTime.Now.Hour + ":" + DateTime.Now.Minute;
- //string WZFjFName = "剩余材料统计" + DateTime.Now.Year + DateTime.Now.Month + DateTime.Now.Day + DateTime.Now.Hour + DateTime.Now.Minute + DateTime.Now.Second + ".doc";//物资部门废旧物资接受清单(电子文档)-----待续
- //string WZFjFName = this.OldMaterialManagement.Value;
- string WZFjIdea = this.TB_OldMaterialManagement.Text.Trim();
- string sql = "update [Tb_Construct] set [WZFjTransactor]='" + WZFjTransactor + "',[WZFjFName]='" + WZFjIdea + "',[Status]=2 where [ConID]=" + this.ConID;
- string sql1 = "update [tb_WF_ActIns] set [Status]=1,[UserID]=" + this.userid + " where [ActInsID]=" + this.actinstanceid;
- if (SqlServer.RunSql(sql) && SqlServer.RunSql(sql1))
- {
- sql = "select [StartEnd] from [tb_WF_Activity] where [ActivityID]=" + ActivityID;
- DataView dv = SqlServer.GetDataView(sql);
- if (dv.Count > 0)
- {
- startEnd = Convert.ToInt32(dv[0]["StartEnd"].ToString());
- if (startEnd == 2)//最终任务
- {
- string script = "<script language='javascript'>alert('系统提示:您已审核通过,本工程项目实施流程结束!');top.location.href='../Main.aspx';</script>";
- Common.RunScriptString(this.Page, script);
- }
- }
- else
- {
- WorkFlowOperation(ConID, "您已审核通过,本工程项目实施流程结束!");
- }
- }
- else
- {
- Common.RunScript(this.Page, "操作失败,请检查数据!");
- }
- }*/
- //************************************************************工程计划流程*************************************************************
- if (MustChooseItem == 30)
- {
- int RouID = 1;//结束后关联种类条件ID(-1、无条件,1、变更材料,2、废旧物资处理,3、汇总废旧物资,4、施工工作流)
- DataView dv = GetConstructInfo(this.ConID);
- string BgFName = dv[0]["WZFName"].ToString();
- string altername = this.TB_ConName.Text.ToString() + "材料变更";
- string sql = "";
- //string sql = "insert into [tb_PrjAlert]([ConID],[BgFName]) values (" + this.ConID + ",'" + BgFName + "')";
- PrjAlertInfo prjAlertInfo = new PrjAlertInfo(this.ConID, consort, altername, BgFName, "", "", "", "", "", "", "","", 1);
- PrjAlertManager prjAlertManager = new PrjAlertManager();
- int newPrjAlertID = prjAlertManager.AddPrjAlert(prjAlertInfo);
- if (newPrjAlertID>0)
- {
- //产生项目调整代办任务
- //begin code
- int WFID = -1;
- sql = "select [WFID] from [tb_WorkFlowRouter] where [RouID]=" + RouID;
- dv = SqlServer.GetDataView(sql);
- if (dv.Count > 0)
- {
- WFID = Convert.ToInt32(dv[0]["WFID"].ToString());
- }
- if (WFID != -1)
- {
- EtongZwf etongzwf = new EtongZwf();
- DateTime SuccessDate = Convert.ToDateTime(DateTime.Now.ToShortDateString().Trim());
- //添加工作流实例 (将添加成功的constructid添加到工作流实例表里,注意是加到该表的PrjID字段中)
- WFInstanceInfo wfinstanceinfo = new WFInstanceInfo(-1, Convert.ToDateTime(DateTime.Now.ToShortDateString()),
- userid, -1, -1, DateTime.Now, 4, SuccessDate, WFID,newPrjAlertID);
- int ReInstanceValue = etongzwf.WFInstanceADD(wfinstanceinfo);
- this.WFInstanceID = ReInstanceValue;
- if (this.WFInstanceID > 0)
- {
- sql = "select [ActivityID] from [tb_WF_Activity] where [WorkFlowID]=" + WFID + " and [StartEnd]=0";
- dv = SqlServer.GetDataView(sql);
- if (dv.Count > 0)
- {
- this.ActivityID = Convert.ToInt32(dv[0]["ActivityID"].ToString());
- int OpRoleID = -1;
- sql = "select [RoleID] from [tb_Colony_User] where [ActivityID]=" + this.ActivityID;
- dv = SqlServer.GetDataView(sql);
- if (dv.Count > 0)
- OpRoleID = Convert.ToInt32(dv[0]["RoleID"].ToString());
- if (OpRoleID > 0)
- {
- WFActInsInfo wfactinsinfo = new WFActInsInfo(-1, this.ActivityID, Convert.ToDateTime(DateTime.Now.ToShortDateString()), Convert.ToDateTime(DateTime.Now.ToShortDateString()),
- 0, SuccessDate, this.WFInstanceID, "", -1, OpRoleID);
- int ReActInsValue = etongzwf.WFActInsADD(wfactinsinfo);
- }
- }
- }
- }
- //end code
- sql = "update [tb_construct] set [Status]=2 where [ConID]=" + this.ConID;
- if (SqlServer.RunSql(sql))
- {
- string script = "<script>alert('系统提示:您已审核通过,转到废旧物资管理流程!');top.location.href='../Main.aspx';</script>";
- Common.RunScriptString(this.Page, script);
- }
- }
- }
- }
- /*============================================================对并发活动的特殊处理======================================================
- *
- * 工作流操作,分3步
- * 1.产生工作流实例纪录,注意constructid必须真实存在
- * 2.更新当前活动实例状态 由WFInstADD中的WFActInsUpdata执行
- * 3.产生新的工作流实例纪录,即产生下一个活动实例并提交到下一个部门的用户申核,由NextColonyRole操作完成
- *
- *=====================================================================================================================================*/
- protected void WorkFlowOperation(int conid, bool isMaster)
- {
- EtongZwf etongzwf = new EtongZwf();
- ProjectImplment projectImplment = new ProjectImplment();
-
- //int count = dv.Count;
- string sql = " select * from [tb_WF_Instance] where [Status]=2 and [PrjID]=" + this.ConID;
- DataView dv = SqlServer.GetDataView(sql);
- if (dv.Count == 0)//如果实例存在则不添加
- {
- DateTime SuccessDate = Convert.ToDateTime(DateTime.Now.ToShortDateString().Trim());
- //添加工作流实例 (将添加成功的constructid添加到工作流实例表里,注意是加到该表的PrjID字段中)
- WFInstanceInfo wfinstanceinfo = new WFInstanceInfo(-1, Convert.ToDateTime(DateTime.Now.ToShortDateString()),
- userid, -1, -1, DateTime.Now, 2, SuccessDate, wfid, conid);
- int ReInstanceValue = etongzwf.WFInstanceADD(wfinstanceinfo);
- //产生当前工作流实例ID
- WFInstanceID = ReInstanceValue;
- }
- string nextCheckDepartment = "";
- dv = etongzwf.ColonyUserGetByActId(ActivityID);
- if (dv.Count > 0)
- {
- /*int ParentOrgID = Convert.ToInt32(dv[0]["ParentRoleID"].ToString().Trim());
- //DataView dvRoleName = etongzwf.RoleGetName(ParentRoleID);
- DataTable dataTable = projectImplment.GetDepartmentByID(ParentOrgID);
- if (dataTable.Rows.Count == 0)
- {
- ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('系统提示:项目施工停滞,没有上级申核人!(请联系相关部门或系统管理员)');</script>");
- return;
- }*/
- for (int i = 0; i < dv.Count; i++)//找到所有部门
- {
- int ParentRoleID = Convert.ToInt32(dv[i]["ParentRoleID"].ToString().Trim());
- ProjectImplment pi = new ProjectImplment();
- //DataTable dt = pi.GetDepartmentByID(ParentRoleID);
- DataTable dt = pi.GetNextOperatorRole(ParentRoleID);
- nextCheckDepartment += dt.Rows[0]["OpName"].ToString() + "、";
- }
- for (int i = 0; i < dv.Count; i++)
- {
- int CurrentRoleID = Convert.ToInt32(dv[i]["CurrentRoleID"].ToString().Trim());
- int ParentActID = Convert.ToInt32(dv[i]["ParentActID"].ToString().Trim());
- int ParentRoleID = Convert.ToInt32(dv[i]["ParentRoleID"].ToString().Trim());
- if (WFInstanceID > 0)
- {
- /*WorkFolw workflow = new WorkFolw();
- string ActIDtxt = Request.QueryString["ActID"].ToString().Trim();
- ActID = Convert.ToInt32(ActIDtxt);
- bool returnvalue = false;
- //产生当前活动实例 如果是不是第一个活动,只需 修改 UserID 和 Status
- int ReActInsValue = 0;
- //returnvalue = etongzwf.WFActInsUpdata(ActID, userid, 1);
- returnvalue = workflow.WFActInsUpdata(ActID, 1, userid);
- if (returnvalue == true)
- ReActInsValue = ActID;
- if (ReActInsValue > 0)
- {*/
- if (ParentActID != -1)
- {
- NextColonyRole(ParentActID, ParentRoleID, "您已审核通过", nextCheckDepartment, isMaster); //(ReActInsValue); //产生下一个活动实例并提交到下一个角色的用户申核
- }
- else // 不存在上级活动,将 活动状态(Status) 改为 "完成" 注:Status状态(0、正常;1、完成;2、回退;3、回退并完成;4、作废)
- {
- /*bool ReValueAIUpdata = false;
- //ReValueAIUpdata = etongzwf.WFActInsUpdata(ReActInsValue, userid, 1);
- ReValueAIUpdata = workflow.WFActInsUpdata(ReActInsValue, 1, userid);
- if (ReValueAIUpdata == true)
- {
- ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('系统提示:项目施工完成!');top.location.href='../Main.aspx';</script>");
- }
- else
- {*/
- ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('系统提示:操作失败!');top.location.href='../Main.aspx';</script>");
- }
- }
- }
- }
- }
- /*===========================================================================================================================
- *
- * 工作流操作,分3步
- * 1.产生工作流实例纪录,注意constructid必须真实存在
- * 2.更新当前活动实例状态 由WFInstADD中的WFActInsUpdata执行
- * 3.产生新的工作流实例纪录,即产生下一个活动实例并提交到下一个部门的用户申核,由NextColonyRole操作完成
- *
- *==========================================================================================================================*/
- protected void WorkFlowOperation(int conid, string showmessage, bool isMaster)
- {
- EtongZwf etongzwf = new EtongZwf();
- ProjectImplment projectImplment = new ProjectImplment();
- string sql = "select * from [tb_WF_Instance] where [Status]=2 and [PrjID]=" + this.ConID;
- DataView dv = SqlServer.GetDataView(sql);
- if (dv.Count == 0)//如果实例存在则不添加
- {
- DateTime SuccessDate = Convert.ToDateTime(DateTime.Now.ToShortDateString().Trim());
- //添加工作流实例 (将添加成功的constructid添加到工作流实例表里,注意是加到该表的PrjID字段中)
- WFInstanceInfo wfinstanceinfo = new WFInstanceInfo(-1, Convert.ToDateTime(DateTime.Now.ToShortDateString()),
- userid, -1, -1, DateTime.Now, 2, SuccessDate, wfid, conid);
- int ReInstanceValue = etongzwf.WFInstanceADD(wfinstanceinfo);
- //产生当前工作流实例ID
- WFInstanceID = ReInstanceValue;
- }
- dv = etongzwf.ColonyUserGetByActId(ActivityID);
- if (dv.Count > 0)
- {
- //int ParentRoleID = Convert.ToInt32(dv[0]["ParentRoleID"].ToString().Trim());
- ////DataView dvRoleName = etongzwf.RoleGetName(ParentRoleID);
- //DataTable dt = projectImplment.GetDepartmentByID(ParentRoleID);
- //if (dt.Rows.Count == 0)
- //{
- // ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('系统提示:项目施工停滞,没有上级申核人!(请联系相关部门或系统管理员)');</script>");
- // return;
- //}
- //获取当前工作流启始活动 为什么要获取当前工作流启始活动?
- //DataView dvActID = etongzwf.GetActivityByWFID(wfid);
- //ActivityID = Convert.ToInt32(dvActID[0][0].ToString().Trim());
- if (WFInstanceID > 0)
- {
- WFInstADD(showmessage, isMaster);
- }
- }
- }
- /// <summary>
- /// 改变工作流活动实例状态
- /// </summary>
- ///
- protected void WFInstADD(string showMessage, bool isMaster)
- {
- if (WFInstanceID > 0)
- {
- com.etong.DAL.WorkFolw workflow = new com.etong.DAL.WorkFolw();
- DateTime SuccessDate = Convert.ToDateTime(DateTime.Now.ToShortDateString().Trim());
- EtongZwf etongzwf = new EtongZwf();
- DataView dv = etongzwf.ColonyUserGetByActId(ActivityID);
- // int CurrentActID = -1;
- int CurrentRoleID = -1;
- int ParentActID = -1;
- int ParentRoleID = -1;
- string nextCheckDepartment = null;
- if (dv.Count > 0)
- {
- if (dv.Count == 1)//不分流
- {
- CurrentRoleID = Convert.ToInt32(dv[0]["CurrentRoleID"].ToString().Trim());
- ParentActID = Convert.ToInt32(dv[0]["ParentActID"].ToString().Trim());
- ParentRoleID = Convert.ToInt32(dv[0]["ParentRoleID"].ToString().Trim());
- }
- else//分流
- {
- for (int i = 0; i < dv.Count; i++)
- {
- if (Convert.ToInt32(dv[i]["shuntflag"]) == shuntFlag)
- {
- CurrentRoleID = Convert.ToInt32(dv[i]["CurrentRoleID"].ToString().Trim());
- ParentActID = Convert.ToInt32(dv[i]["ParentActID"].ToString().Trim());
- ParentRoleID = Convert.ToInt32(dv[i]["ParentRoleID"].ToString().Trim());
- }
- }
- }
- }
- //产生当前活动实例 如果是不是第一个活动,只需 修改 UserID 和 Status
- int ReActInsValue = 0;
- int tempStatus = WorkFolw.GetCurrentActivityInstanceStatus(this.actinstanceid);//当前活动实例状态
- if (MustChooseItem == 69)//对起始活动的操作
- {
- if (tempStatus == 2)//回退活动
- {
- string ActIDtxt = Request.QueryString["ActID"].ToString().Trim();
- ActID = Convert.ToInt32(ActIDtxt);
- bool returnvalue = false;
- //returnvalue = etongzwf.WFActInsUpdata(ActID, userid, 1);
- returnvalue = workflow.WFActInsUpdata(ActID, 1, userid);
- if (returnvalue == true)
- ReActInsValue = ActID;
- if (ReActInsValue > 0)
- {
- if (ParentActID != -1)
- {
- ProjectImplment pi = new ProjectImplment();
- //DataTable dt = pi.GetDepartmentByID(ParentRoleID);
- DataTable dt = pi.GetNextOperatorRole(ParentRoleID);
- nextCheckDepartment = dt.Rows[0]["OpName"].ToString();
- NextColonyRole(ParentActID, ParentRoleID, showMessage, nextCheckDepartment, isMaster); //(ReActInsValue); //产生下一个活动实例并提交到下一个角色的用户申核
- }
- else//不存在上级活动,将 活动状态(Status) 改为 "完成" 注:Status状态(0、正常;1、完成;2、回退;3、回退并完成;4、作废)
- {
- bool ReValueAIUpdata = false;
- //ReValueAIUpdata = etongzwf.WFActInsUpdata(ReActInsValue, userid, 1);
- ReValueAIUpdata = workflow.WFActInsUpdata(ReActInsValue, 1, userid);
- if (ReValueAIUpdata == true)
- {
- ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('系统提示:项目施工完成!');top.location.href='../Main.aspx';</script>");
- }
- else
- {
- ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('系统提示:操作失败!');top.location.href='../Main.aspx';</script>");
- }
- }
- }
- }
- else
- {
- WFActInsInfo wfactinsinfo = new WFActInsInfo(-1, ActivityID, Convert.ToDateTime(DateTime.Now.ToShortDateString()), Convert.ToDateTime(DateTime.Now.ToShortDateString()),
- 1, SuccessDate, WFInstanceID, "", userid, CurrentRoleID);
- ReActInsValue = etongzwf.WFActInsADD(wfactinsinfo);
- ProjectImplment pi = new ProjectImplment();
- //DataTable dt = pi.GetDepartmentByID(ParentRoleID);
- DataTable dt = pi.GetNextOperatorRole(ParentRoleID);
- if (dt.Rows.Count > 0)
- {
- nextCheckDepartment = dt.Rows[0]["OpName"].ToString();
- //ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('系统提示:计划下达成功,转到『" + nextCheckDepartment + "』申核处理!');top.location.href='../Main.aspx';</script>");
- }
- NextColonyRole(ParentActID, ParentRoleID, showMessage, nextCheckDepartment, isMaster);//提交给下一部门用户审核
- }
- }
- else//对不是起始活动的操作
- {
- string ActIDtxt = Request.QueryString["ActID"].ToString().Trim();
- ActID = Convert.ToInt32(ActIDtxt);
- bool returnvalue = false;
- //returnvalue = etongzwf.WFActInsUpdata(ActID, userid, 1);
- returnvalue = workflow.WFActInsUpdata(ActID, 1, userid);
- if (returnvalue == true)
- ReActInsValue = ActID;
- if (ReActInsValue > 0)
- {
- if (ParentActID != -1)
- {
- ProjectImplment pi = new ProjectImplment();
- //DataTable dt = pi.GetDepartmentByID(ParentRoleID);
- DataTable dt = pi.GetNextOperatorRole(ParentRoleID);
- nextCheckDepartment = dt.Rows[0]["OpName"].ToString();
- NextColonyRole(ParentActID, ParentRoleID, showMessage, nextCheckDepartment, isMaster); //(ReActInsValue); //产生下一个活动实例并提交到下一个角色的用户申核
- }
- else // 不存在上级活动,将 活动状态(Status) 改为 "完成" 注:Status状态(0、正常;1、完成;2、回退;3、回退并完成;4、作废)
- {
- bool ReValueAIUpdata = false;
- //ReValueAIUpdata = etongzwf.WFActInsUpdata(ReActInsValue, userid, 1);
- ReValueAIUpdata = workflow.WFActInsUpdata(ReActInsValue, 1, userid);
- if (ReValueAIUpdata == true)
- {
- ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('系统提示:工程项目实施工作流活动完成!');top.location.href='../Main.aspx';</script>");
- }
- else
- {
- ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('系统提示:操作失败!');top.location.href='../Main.aspx';</script>");
- }
- }
- }
- }
- }
- }
- /// <summary>
- /// 起始活动.
- /// </summary>
- protected int ActivityIDGetByWFID(int WfId)
- {
- EtongZwf etongzwf = new EtongZwf();
- DataView dvActivity = etongzwf.GetActivityByWFID(WfId);
- if (dvActivity.Count != 0)
- {
- int activity = Convert.ToInt32(dvActivity[0][0].ToString().Trim());
- return activity;
- }
- else
- return 0;
- }
- /// <summary>
- /// 提交到上级部门用户申核
- /// </summary>
- protected void NextColonyRole(int ParentActID, int ParentRoleID, string showMessage, string nextCheckDepartment, bool isMaster)
- {
- EtongZwf etongzwf = new EtongZwf();
- WFActInsInfo wfactinsinfo = null;
- if (isMaster == false)
- {
- wfactinsinfo = new WFActInsInfo(-1, ParentActID, Convert.ToDateTime(DateTime.Now.ToShortDateString()), Convert.ToDateTime(DateTime.Now.ToShortDateString()),
- 0, Convert.ToDateTime(DateTime.Now.ToShortDateString()), WFInstanceID, WorkFolw.GetOrgOpRoleType(ParentRoleID), -1, ParentRoleID);
- }
- else
- {
- CheckUserInfo cui = null;
- if (Session["checkuserinfo"] != null)
- {
- cui = (CheckUserInfo)Session["checkuserinfo"];
- }
- string type = ProjectImplment.GetEmpType(cui.EmpID);
- wfactinsinfo = new WFActInsInfo(-1, ParentActID, Convert.ToDateTime(DateTime.Now.ToShortDateString()), Convert.ToDateTime(DateTime.Now.ToShortDateString()),
- 0, Convert.ToDateTime(DateTime.Now.ToShortDateString()), WFInstanceID, type, -1, ParentRoleID);
- }
- int ReActInsValue = etongzwf.WFActInsADD(wfactinsinfo);
- if (ReActInsValue > 0)
- {
- //DataView dvRoleName = etongzwf.RoleGetName(ParentRoleID);
- //if (dvRoleName.Count != 0)
- //{
- //InitializePage(); //初始化当前页面
- ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('系统提示:" + showMessage + ",转到『" + nextCheckDepartment + "』申核处理!');top.location.href='../Main.aspx';</script>");
- //}
- //else
- //ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('系统提示:项目施工停滞,没有上级申核人!');</script>");
- }
- else
- {
- ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('系统提示:操作失败!');top.location.href='../Main.aspx';</script>");
- }
- }
- protected void BT_Revoke_Click(object sender, ImageClickEventArgs e)
- {
- string sql = "update tb_WF_ACtIns set Status=4 where [WfInstanceID]=" + WFInstanceID + " and [ActivityID]=" + ActivityID;
- string sql1 = "update [tb_construct] set [Status]=3 where [ConID]=" + this.ConID;
- if (SqlServer.RunSql(sql) && SqlServer.RunSql(sql1))
- {
- ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('系统提示:作废操作成功!');top.location.href='../Main.aspx';</script>");
- }
- else
- {
- ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('系统提示:作废操作失败!');top.location.href='../Main.aspx';</script>");
- }
- }
- //protected void BT_OpenDocument_Click(object sender, EventArgs e)
- //{
- // this.Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>window.open('DaiBan.aspx?strFName='" + this.lblReportMaterialPlan.Text + ".doc')</script>");
- //}
- protected void BT_NotPass_Click(object sender, ImageClickEventArgs e)
- {
- //******************************************************监督实施*************************************************************
- if (MustChooseItem == 23)
- {
- int RouID = 1;//结束后关联种类条件ID(-1、无条件,1、变更材料,2、废旧物资处理,3、汇总废旧物资,4、施工工作流)
- DataView dv = GetConstructInfo(this.ConID);
- string BgFName = dv[0]["JcWZFName"].ToString();
- string altername = this.TB_ConName.Text.ToString() + "材料变更";
- string sql = "";
- string consort = "";
- CheckUserInfo cui = null;
- if (Session["checkuserinfo"] != null)
- {
- cui = (CheckUserInfo)Session["checkuserinfo"];
- }
- consort = ProjectImplment.GetEmpType(cui.EmpID);
- //string sql = "insert into [tb_PrjAlert]([ConID],[BgFName]) values (" + this.ConID + ",'" + BgFName + "')";
- PrjAlertInfo prjAlertInfo = new PrjAlertInfo(this.ConID, consort, altername, BgFName, "", "", "", "", "", "", "", "", 1);
- PrjAlertManager prjAlertManager = new PrjAlertManager();
- int newPrjAlertID = prjAlertManager.AddPrjAlert(prjAlertInfo);
- if (newPrjAlertID > 0)
- {
- //产生项目调整代办任务
- //begin code
- int WFID = -1;
- sql = "select [WFID] from [tb_WorkFlowRouter] where [RouID]=" + RouID;
- dv = SqlServer.GetDataView(sql);
- if (dv.Count > 0)
- {
- WFID = Convert.ToInt32(dv[0]["WFID"].ToString());
- }
- if (WFID != -1)
- {
- EtongZwf etongzwf = new EtongZwf();
- DateTime SuccessDate = Convert.ToDateTime(DateTime.Now.ToShortDateString().Trim());
- //添加工作流实例 (将添加成功的constructid添加到工作流实例表里,注意是加到该表的PrjID字段中)
- WFInstanceInfo wfinstanceinfo = new WFInstanceInfo(-1, Convert.ToDateTime(DateTime.Now.ToShortDateString()),
- userid, -1, -1, DateTime.Now, 4, SuccessDate, WFID, newPrjAlertID);
- int ReInstanceValue = etongzwf.WFInstanceADD(wfinstanceinfo);
- this.WFInstanceID = ReInstanceValue;
- if (this.WFInstanceID > 0)
- {
- sql = "select [ActivityID] from [tb_WF_Activity] where [WorkFlowID]=" + WFID + " and [StartEnd]=0";
- dv = SqlServer.GetDataView(sql);
- if (dv.Count > 0)
- {
- this.ActivityID = Convert.ToInt32(dv[0]["ActivityID"].ToString());
- int OpRoleID = -1;
- sql = "select [RoleID] from [tb_Colony_User] where [ActivityID]=" + this.ActivityID;
- dv = SqlServer.GetDataView(sql);
- if (dv.Count > 0)
- OpRoleID = Convert.ToInt32(dv[0]["RoleID"].ToString());
- if (OpRoleID > 0)
- {
- WFActInsInfo wfactinsinfo = new WFActInsInfo(-1, this.ActivityID, Convert.ToDateTime(DateTime.Now.ToShortDateString()), Convert.ToDateTime(DateTime.Now.ToShortDateString()),
- 0, SuccessDate, this.WFInstanceID, consort, -1, OpRoleID);
- int ReActInsValue = etongzwf.WFActInsADD(wfactinsinfo);
- }
- }
- }
- }
- //end code
- WorkFolw workflow = new WorkFolw();
- workflow.WFActInsUpdata(actinstanceid, 1, userid);
- string script = "<script>alert('系统提示:您已确认审核不通过,转到物资并更物资管理流程!');top.location.href='../Main.aspx';</script>";
- Common.RunScriptString(this.Page, script);
- //sql = "update [tb_construct] set [Status]=2 where [ConID]=" + this.ConID;
- //if (SqlServer.RunSql(sql))
- //{
- // string script = "<script>alert('系统提示:您已审核通过,转到废旧物资管理流程!');top.location.href='../Main.aspx';</script>";
- // Common.RunScriptString(this.Page, script);
- //}
- }
- //CheckUserInfo cui = (CheckUserInfo)Session["checkuserinfo"];
- ////string ZgJdTransaction = cui.EmpName + " " + DateTime.Now.ToShortDateString() + " " + DateTime.Now.Hour + ":" + DateTime.Now.Minute;
- //string ZgJdTransactor = cui.EmpName;
- //this.TB_ZgJdIdea.Text = "审核不通过";
- //string ZgJdIdea = this.TB_ZgJdIdea.Text.Trim() + " " + DateTime.Now.ToShortDateString() + " " + DateTime.Now.Hour + ":" + DateTime.Now.Minute;//主管部门监督实施审核意见和审核时间
- //string sql = "update [Tb_Construct] set [ZgJdTransactor]='" + ZgJdTransactor + "',[ZgJdIdea]='" + ZgJdIdea + "' where [ConID]=" + this.ConID;
- //if (SqlServer.RunSql(sql))
- //{
- // this.shuntFlag = 2;
- // //WorkFlowOperation(ConID, "您审核未通过!",false);
- //}
- //else
- //{
- // Common.RunScript(this.Page, "操作失败,请检查数据!");
- //}
- }
- }
- //******************************************************得到指定活动的文档名称*************************************************************
- protected string GetDocumentFileName(int activityid)
- {
- string sql = "select [FName] from [tb_Colony_FileName1] a,[tb_Sys_FileName] b where a.[FID]=b.[FID] and [ActivityID]=" + activityid;
- string filename = "";
- //string tempfilename = "";
- DataView dv = SqlServer.GetDataView(sql);
- if (dv != null && dv.Count > 0)
- {
- filename = dv[0]["FName"].ToString();
- //if (filename.Length >= 2)
- //tempfilename = filename.Substring(filename.LastIndexOf("\\") + 2);
- }
- return filename;
- }
- protected string GetDocumentFileName(int activityid, int index)
- {
- string sql = "select [FName] from [tb_Colony_FileName1] a,[tb_Sys_FileName] b where a.[FID]=b.[FID] and [ActivityID]=" + activityid;
- string filename = "";
- //string tempfilename = "";
- DataView dv = SqlServer.GetDataView(sql);
- if (dv != null && dv.Count > 0)
- {
- filename = dv[index]["FName"].ToString();
- //if (filename.Length >= 2)
- //tempfilename = filename.Substring(filename.LastIndexOf("\\") + 2);
- }
- return filename;
- }
- ////******************************************************用最新日期生成最新文档*************************************************************
- protected string MakeNewFileNameWithDate(string filename)
- {
- if (filename.Length > 0 && filename.Contains("."))
- {
- string[] a = filename.Split('.');
- return a[0] + DateTime.Now.Year + DateTime.Now.Month + DateTime.Now.Day + DateTime.Now.Hour + DateTime.Now.Minute + DateTime.Now.Second + "." + a[1];
- }
- else
- return "";
- }
- ////******************************************************找到员工类型的汇总文档*************************************************************
- protected string GetEmpTypeDocument_MaterialPlan()
- {
- string EmpTypeFileName = "";
- string path = Server.MapPath("doc").Replace("\", "\\"); //获取项目所在路径
- CheckUserInfo cui = null;
- if (Session["checkuserinfo"] != null)
- {
- cui = (CheckUserInfo)Session["checkuserinfo"];
- }
- string EmpType = ProjectImplment.GetEmpType(cui.EmpID);
- string filename = GetConstructInfo(this.ConID)[0]["WZFName"].ToString();
- if (filename != "")
- {
- string xmlFileName = path + "\DocTemplateCon\" + filename;
- XML xml = new XML(xmlFileName);
- //ArrayList list = xml.ReadNode("Documents", EmpType, true);
- ArrayList nodename=new ArrayList ();
- nodename.Add("FileName");
- ArrayList list = xml.ReadNode(nodename, "Documents");
- if (list.Count > 0)
- {
- //DocumentNode node = (DocumentNode)list[0];
- //EmpTypeFileName = node.FileName;
- string[] a = (string[])list[0];
- EmpTypeFileName = a[0].ToString();
- }
- }
- return EmpTypeFileName;
- }
- protected string GetEmpTypeDocument_SetupExecution()
- {
- string EmpTypeFileName = "";
- string path = Server.MapPath("doc").Replace("\", "\\"); //获取项目所在路径
- CheckUserInfo cui = null;
- if (Session["checkuserinfo"] != null)
- {
- cui = (CheckUserInfo)Session["checkuserinfo"];
- }
- string EmpType = ProjectImplment.GetEmpType(cui.EmpID);
- string filename = GetConstructInfo(this.ConID)[0]["JcZFName"].ToString();
- if (filename != "")
- {
- string xmlFileName = path + "\DocTemplateCon\" + filename;
- XML xml = new XML(xmlFileName);
- ArrayList list = xml.ReadNode("Documents", EmpType, true);
- if (list.Count > 0)
- {
- DocumentNode node = (DocumentNode)list[0];
- EmpTypeFileName = node.FileName;
- }
- }
- return EmpTypeFileName;
- }
- protected string GetEmpTypeDocument_JDExecution()
- {
- string EmpTypeFileName = "";
- string path = Server.MapPath("doc").Replace("\", "\\"); //获取项目所在路径
- CheckUserInfo cui = null;
- if (Session["checkuserinfo"] != null)
- {
- cui = (CheckUserInfo)Session["checkuserinfo"];
- }
- string EmpType = ProjectImplment.GetEmpType(cui.EmpID);
- string filename = GetConstructInfo(this.ConID)[0]["ZgJdDocumentXml"].ToString();
- if (filename != "")
- {
- string xmlFileName = path + "\DocTemplateCon\" + filename;
- XML xml = new XML(xmlFileName);
- ArrayList list = xml.ReadNode("Documents", EmpType, true);
- if (list.Count > 0)
- {
- DocumentNode node = (DocumentNode)list[0];
- EmpTypeFileName = node.FileName;
- }
- }
- return EmpTypeFileName;
- }
- protected string GetEmpTypeDocument_ProjectPlan()
- {
- string EmpTypeFileName = "";
- string path = Server.MapPath("doc").Replace("\", "\\"); //获取项目所在路径
- CheckUserInfo cui = null;
- if (Session["checkuserinfo"] != null)
- {
- cui = (CheckUserInfo)Session["checkuserinfo"];
- }
- string EmpType = ProjectImplment.GetEmpType(cui.EmpID);
- string filename = GetConstructInfo(this.ConID)[0]["ZgHzFName"].ToString();
- if (filename != "")
- {
- string xmlFileName = path + "\DocTemplateCon\" + filename;
- XML xml = new XML(xmlFileName);
- ArrayList list = xml.ReadNode("Documents", EmpType, true);
- if (list.Count > 0)
- {
- DocumentNode node = (DocumentNode)list[0];
- EmpTypeFileName = node.FileName;
- }
- }
- return EmpTypeFileName;
- }
- protected void ViewLog_Click(object sender, ImageClickEventArgs e)
- {
- string ProjectID = ((HtmlInputHidden)this.FindControl("txt_ProjectID")).Value.Trim();
- string sURL = "WFLog.aspx?ProjectID=" + ProjectID;
- Response.Redirect(sURL);
- }
- protected void IB_Back_Click(object sender, ImageClickEventArgs e)
- {
- ClientScript.RegisterStartupScript(this.GetType(), "", "<script> window.location.href='../SearchP/StructureSearch.aspx';</script>");
- }
- protected void IB_Collect_Click(object sender, ImageClickEventArgs e)
- {
- string path = Server.MapPath("doc").Replace("\", "\\"); //获取项目所在路径
- CheckUserInfo cui = null;
- if (Session["checkuserinfo"] != null)
- {
- cui = (CheckUserInfo)Session["checkuserinfo"];
- }
- /*com.etong.DAL.FC.EtongFlyChouWFPrj etongFlyChouWFPrj = new com.etong.DAL.FC.EtongFlyChouWFPrj();
- etongFlyChouWFPrj.sID = this.actinstanceid;
- etongFlyChouWFPrj.PrjID = this.MatID;
- etongFlyChouWFPrj.wID = this.wfid;
- etongFlyChouWFPrj.iStatus = 5;
- etongFlyChouWFPrj.sBlockReason = WorkFolw.GetBlockReason(this.actinstanceid);
- if (etongFlyChouWFPrj.CheckUpActCompleteSort() == false)
- {
- Common.RunScript(this.Page, "工作流上级所属(同类型的)活动未完成,不能汇总文档");
- return;
- }
- else
- {*/
- string EmpType = ProjectImplment.GetEmpType(cui.EmpID);
- string filename = "型物资计划汇总表";
- string filename1 = "型进度计划汇总表";
- string filename2 = "型工程进度汇总表";
- string filename3 = "型工程进度汇总总表";
- string filename4 = "型进度计划汇总表";
- /*switch (EmpType)
- {
- case "1": filename = "科技" + filename + DateTime.Now.Year + DateTime.Now.Month + DateTime.Now.Day + DateTime.Now.Hour + DateTime.Now.Minute + DateTime.Now.Second + ".doc";
- break;
- case "2": filename = "生产" + filename + DateTime.Now.Year + DateTime.Now.Month + DateTime.Now.Day + DateTime.Now.Hour + DateTime.Now.Minute + DateTime.Now.Second + ".doc";
- break;
- case "3": filename = "营销" + filename + DateTime.Now.Year + DateTime.Now.Month + DateTime.Now.Day + DateTime.Now.Hour + DateTime.Now.Minute + DateTime.Now.Second + ".doc";
- break;
- }*/
- filename = EmpType + "-" + filename + DateTime.Now.Year + DateTime.Now.Month + DateTime.Now.Day + DateTime.Now.Hour + DateTime.Now.Minute + DateTime.Now.Second;
- filename1 = EmpType + "-" + filename1 + DateTime.Now.Year + DateTime.Now.Month + DateTime.Now.Day + DateTime.Now.Hour + DateTime.Now.Minute + DateTime.Now.Second;
- filename2 = EmpType + "-" + filename2 + DateTime.Now.Year + DateTime.Now.Month + DateTime.Now.Day + DateTime.Now.Hour + DateTime.Now.Minute + DateTime.Now.Second;
- filename3 = EmpType + "-" + filename3 + DateTime.Now.Year + DateTime.Now.Month + DateTime.Now.Day + DateTime.Now.Hour + DateTime.Now.Minute + DateTime.Now.Second;
- filename4 = EmpType + "-" + filename4 + DateTime.Now.Year + DateTime.Now.Month + DateTime.Now.Day + DateTime.Now.Hour + DateTime.Now.Minute + DateTime.Now.Second;
-
- string checker = cui.EmpName;
- string time = DateTime.Now.ToString();
- DataView dv = GetConstructInfo(this.ConID);
- if (this.MustChooseItem == 21)//物资采购汇总
- {
- com.etong.DAL.FC.EtongFlyChouWFPrj etongFlyChouWFPrj = new com.etong.DAL.FC.EtongFlyChouWFPrj();
- etongFlyChouWFPrj.sID = this.actinstanceid;
- etongFlyChouWFPrj.PrjID = this.ConID;
- etongFlyChouWFPrj.wID = this.wfid;
- etongFlyChouWFPrj.iStatus = 2;
- //etongFlyChouWFPrj.sBlockReason = WorkFolw.GetBlockReason(this.actinstanceid);
- //if (etongFlyChouWFPrj.CheckUpActComplete() == false)
- if (WorkFolw.ParentActivitysIsCompleted(this.ConID, this.ActivityID) == false)
- {
- Common.RunScript(this.Page, "工作流上级活动未完成,不能汇总文档");
- return;
- }
- else
- {
- string xmlFileName = path + "\DocTemplateCon\" + dv[0]["WZFName"].ToString();
- XML xml = new XML(xmlFileName);
- XML jcXml = new XML(path + "\DocTemplateCon\" + dv[0]["JcWZFName"].ToString());
- //ArrayList list = jcXml.ReadNode("Documents", EmpType, true);
- //ArrayList list = jcXml.ReadNode("Documents");
- ArrayList nodesname = new ArrayList();
- nodesname.Add("FileName");
- ArrayList list = jcXml.ReadNode(nodesname, "Documents");
- string[] filecopy = new string[list.Count];
- ArrayList materiallist = new ArrayList();
- XML jcXml1 = new XML(path + "\DocTemplateCon\" + dv[0]["JcKgName"].ToString());
- ArrayList nodesname1 = new ArrayList();
- nodesname1.Add("FileName");
- ArrayList list1 = jcXml1.ReadNode(nodesname1, "Documents");
- string[] filecopy1 = new string[list.Count];
- ArrayList materiallist1 = new ArrayList();
- if (filecopy.Length > 0&&filecopy1 .Length >0)
- {
- for (int i = 0; i < filecopy.Length; i++)
- {
- //DocumentNode documentNode = (DocumentNode)list[i];
- string[] a = (string[])list[i];
- filecopy[i] = path + "\\DocTemplateCon\\" + a[0].ToString();
- materiallist.Add(Server.MapPath("doc\\DocTemplateCon\\" + a[0].ToString()));
- }
- for (int i = 0; i < filecopy1.Length; i++)
- {
- //DocumentNode documentNode = (DocumentNode)list[i];
- string[] a = (string[])list1[i];
- filecopy1[i] = path + "\\DocTemplateCon\\" + a[0].ToString();
- materiallist1.Add(Server.MapPath("doc\\DocTemplateCon\\" + a[0].ToString()));
- }
- string[] houzhui = filecopy[0].Split('.');
- string[] houzhui1 = filecopy1[0].Split('.');
- MyDocMerger myDocMerger = new MyDocMerger();
- string orgDocName = path + "\\DocTemplateCon\\" + filename4 + "." + houzhui1[1];
- Util.Copyfile(path + "\\空文档.doc", orgDocName);
- //this.txt_ZgHZFName.Value = filename + "." + houzhui[1];
- if (xml.AddXmlNode(new DocumentNode(filename + "." + houzhui[1], checker, time, EmpType))&&xml.AddXmlNode(new DocumentNode(filename4 + "." + houzhui1[1], checker, time, EmpType)))
- {
- // if (Util.Copyfile(path + "\" + orgfilename, orgDocName))
- // {
- /*------------------------文档汇总----------------------*/
- //myDocMerger.MergeDocArray(orgDocName, filecopy, orgDocName);
- /*---------------改变按钮组为可用状态-------------------*/
- //this.TB_OpenDocument_ZGdFName.Enabled = true;
- //this.TB_OpenDocument_ZgHZFName.Enabled = true;
- //this.TB_OpenDocument_ZGxFName.Enabled = true;
- //this.TB_OpenDocument_ZgHZFName.Text = "浏览电子文档";
- //this.TB_OpenDocument_ZgHZFName.Attributes.Add("onclick", "javascript:SetLinkUrl('DocTemplateCon/'+document.all('txt_ZgHZFName').value,'" + cui.EmpName + "');");
- try
- {
- myDocMerger.MergeDocArray(orgDocName, filecopy1, orgDocName);
- EtongExcel EExcel = new EtongExcel(Server.MapPath("doc\\空工作表.xls"), Server.MapPath("doc\\DocTemplateCon\\" + filename + "." + houzhui[1]));
- EExcel.RangeCellSet(materiallist, 3, 10);
- EExcel.SaveAsFile();
- //EExcel.KillExcelProcess();
- //this.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('系统提示:信息合并成功!');", true);
- Common.RunScript(this.Page, "汇总成功!");
- this.BT_OpenDocument_MaterialStock.Enabled = true;
- this.MaterialStock.Value = filename + "." + houzhui[1];
- this.BT_OpenDocument_ProjectPlan.Enabled = true;
- this.ProjectPlan.Value = filename4 + "." + houzhui1[1];
- }
- catch (Exception ex)
- {
- //ClientScript.RegisterStartupScript(this.GetType(), "errorMessage", "<script>alert('" + ex.Message.Replace("'", "").Replace("rn", "") + "');</script>");
- Common.RunScript(this.Page, ex.Message);
- }
- //this.IsCollect = true;
- //this.IB_Collect.Enabled = false;
- // }
- // else
- // {
- // Common.RunScript(this.Page, "打开文档失败!");
- // }
- }
- else
- {
- Common.RunScript(this.Page, "汇总失败,请检查相关数据!");
- }
- }
- else
- {
- Common.RunScript(this.Page, "没有文档,不能汇总!");
- }
- }
- }
- if (this.MustChooseItem == 23)//监督实施汇总
- {
- com.etong.DAL.FC.EtongFlyChouWFPrj etongFlyChouWFPrj = new com.etong.DAL.FC.EtongFlyChouWFPrj();
- etongFlyChouWFPrj.sID = this.actinstanceid;
- etongFlyChouWFPrj.PrjID = this.ConID;
- etongFlyChouWFPrj.wID = this.wfid;
- etongFlyChouWFPrj.iStatus = 2;
- etongFlyChouWFPrj.sBlockReason = WorkFolw.GetBlockReason(this.actinstanceid);
- if (etongFlyChouWFPrj.CheckUpActCompleteSort() == false)
- {
- Common.RunScript(this.Page, "工作流上级所属(同类型的)活动未完成,不能汇总文档");
- return;
- }
- else
- {
- string xmlFileName = path + "\DocTemplateCon\" + dv[0]["ZgJdDocumentXml"].ToString();
- XML xml = new XML(xmlFileName);
- string xmlProjectSchedule = path + "\DocTemplateCon\" + dv[0]["JcZFName"].ToString();
- XML jcXml = new XML(xmlProjectSchedule);
- ArrayList list = jcXml.ReadNode("Documents", EmpType, true);
- string[] filecopy = new string[list.Count];
- ArrayList materiallist = new ArrayList();
- if (filecopy.Length > 0)
- {
- for (int i = 0; i < filecopy.Length; i++)
- {
- DocumentNode documentNode = (DocumentNode)list[i];
- filecopy[i] = path + "\\DocTemplateCon\\" + documentNode.FileName;
- materiallist.Add(Server.MapPath("doc\\DocTemplateCon\\" + documentNode.FileName));
- }
- string[] houzhui = filecopy[0].Split('.');
- MyDocMerger myDocMerger = new MyDocMerger();
- string orgDocName = path + "\\DocTemplateCon\\" + filename1 + "." + houzhui[1];
- //this.txt_ZgHZFName.Value = filename + "." + houzhui[1];
- if (xml.AddXmlNode(new DocumentNode(filename1 + "." + houzhui[1], checker, time, EmpType)))
- {
- // if (Util.Copyfile(path + "\" + orgfilename, orgDocName))
- // {
- /*------------------------文档汇总----------------------*/
- //myDocMerger.MergeDocArray(orgDocName, filecopy, orgDocName);
- /*---------------改变按钮组为可用状态-------------------*/
- //this.TB_OpenDocument_ZGdFName.Enabled = true;
- //this.TB_OpenDocument_ZgHZFName.Enabled = true;
- //this.TB_OpenDocument_ZGxFName.Enabled = true;
- //this.TB_OpenDocument_ZgHZFName.Text = "浏览电子文档";
- //this.TB_OpenDocument_ZgHZFName.Attributes.Add("onclick", "javascript:SetLinkUrl('DocTemplateCon/'+document.all('txt_ZgHZFName').value,'" + cui.EmpName + "');");
- try
- {
- EtongExcel EExcel = new EtongExcel(Server.MapPath("doc\\空工作表.xls"), Server.MapPath("doc\\DocTemplateCon\\" + filename1 + "." + houzhui[1]));
- EExcel.RangeCellSet(materiallist, 3, 10);
- EExcel.SaveAsFile();
- //EExcel.KillExcelProcess();
- //this.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('系统提示:信息合并成功!');", true);
- Common.RunScript(this.Page, "汇总成功!");
- this.BT_OpenDocument_CollectSetupExecution.Enabled = true;
- this.BT_OpenDocument_CollectSetupExecution.Attributes.Add("onclick", "javascript:SetLinkUrl2('DocTemplateCon/'+document.all('CollectSetupExecution').value,'" + cui.EmpName + "');");
- this.CollectSetupExecution.Value = filename1 + "." + houzhui[1];
- }
- catch (Exception ex)
- {
- //ClientScript.RegisterStartupScript(this.GetType(), "errorMessage", "<script>alert('" + ex.Message.Replace("'", "").Replace("rn", "") + "');</script>");
- Common.RunScript(this.Page, ex.Message);
- }
- //this.IsCollect = true;
- //this.IB_Collect.Enabled = false;
- // }
- // else
- // {
- // Common.RunScript(this.Page, "打开文档失败!");
- // }
- }
- else
- {
- Common.RunScript(this.Page, "汇总失败,请检查相关数据!");
- }
- }
- else
- {
- Common.RunScript(this.Page, "没有文档,不能汇总!");
- }
- }
- }
- if (this.MustChooseItem == 26)//工程进度汇总
- {
- com.etong.DAL.FC.EtongFlyChouWFPrj etongFlyChouWFPrj = new com.etong.DAL.FC.EtongFlyChouWFPrj();
- etongFlyChouWFPrj.sID = this.actinstanceid;
- etongFlyChouWFPrj.PrjID = this.ConID;
- etongFlyChouWFPrj.wID = this.wfid;
- etongFlyChouWFPrj.iStatus = 2;
- etongFlyChouWFPrj.sBlockReason = WorkFolw.GetBlockReason(this.actinstanceid);
- if (etongFlyChouWFPrj.CheckUpActCompleteSort() == false)
- //if (WorkFolw.ParentActivitysIsCompleted(this.ConID, this.ActivityID) == false)
- {
- Common.RunScript(this.Page, "工作流上级所属(同类型的)活动未完成,不能汇总文档");
- return;
- }
- else
- {
- string xmlFileName = path + "\DocTemplateCon\" + dv[0]["JcSBFName"].ToString();
- XML xml = new XML(xmlFileName);
- string xmlProjectSchedule = Server.MapPath("doc\DocTemplateCon\" + dv[0]["ZgHzFName"].ToString());
- XML jcXml = new XML(xmlProjectSchedule);
- ArrayList list = xml.ReadNode("Documents", EmpType, true);
- string[] filecopy = new string[list.Count];
- ArrayList materiallist = new ArrayList();
- if (filecopy.Length > 0)
- {
- for (int i = 0; i < filecopy.Length; i++)
- {
- DocumentNode documentNode = (DocumentNode)list[i];
- filecopy[i] = path + "\\DocTemplateCon\\" + documentNode.FileName;
- materiallist.Add(Server.MapPath("doc\\DocTemplateCon\\" + documentNode.FileName));
- }
- string[] houzhui = filecopy[0].Split('.');
- MyDocMerger myDocMerger = new MyDocMerger();
- string orgDocName = path + "\\DocTemplateCon\\" + filename1 + "." + houzhui[1];
- //this.txt_ZgHZFName.Value = filename + "." + houzhui[1];
- if (jcXml.AddXmlNode(new DocumentNode(filename2 + "." + houzhui[1], checker, time, EmpType)))
- {
- // if (Util.Copyfile(path + "\" + orgfilename, orgDocName))
- // {
- /*------------------------文档汇总----------------------*/
- //myDocMerger.MergeDocArray(orgDocName, filecopy, orgDocName);
- /*---------------改变按钮组为可用状态-------------------*/
- //this.TB_OpenDocument_ZGdFName.Enabled = true;
- //this.TB_OpenDocument_ZgHZFName.Enabled = true;
- //this.TB_OpenDocument_ZGxFName.Enabled = true;
- //this.TB_OpenDocument_ZgHZFName.Text = "浏览电子文档";
- //this.TB_OpenDocument_ZgHZFName.Attributes.Add("onclick", "javascript:SetLinkUrl('DocTemplateCon/'+document.all('txt_ZgHZFName').value,'" + cui.EmpName + "');");
- try
- {
- EtongExcel EExcel = new EtongExcel(Server.MapPath("doc\\芜湖供电公司工程进度表.xls"), Server.MapPath("doc\\DocTemplateCon\\" + filename2 + "." + houzhui[1]));
- EExcel.RangeCellSet(materiallist, 3, 10);
- EExcel.SaveAsFile();
- //EExcel.KillExcelProcess();
- //this.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('系统提示:信息合并成功!');", true);
- Common.RunScript(this.Page, "汇总成功!");
- //this.BT_OpenDocument_MaterialStock.Enabled = true;
- this.BT_OpenDocument_GatherProjectSchedule.Enabled = true;
- this.GatherProjectSchedule.Value = filename2 + "." + houzhui[1];
- string xmlfilename = GetConstructInfo(this.ConID)[0]["GcglFName"].ToString();
- if (xmlfilename != "")
- {
- string filename11 = this.GatherProjectSchedule.Value;
- checker = cui.EmpName;
- time = DateTime.Now.ToString();
- string type = ProjectImplment.GetEmpType(cui.EmpID);
- XML xml1 = new XML(path + "\DocTemplateCon\" + xmlfilename);
- xml1.AddXmlNode(new DocumentNode(filename11, checker, time, type));//将基层上报的文档信息写入XML文档
- }
- }
- catch (Exception ex)
- {
- //ClientScript.RegisterStartupScript(this.GetType(), "errorMessage", "<script>alert('" + ex.Message.Replace("'", "").Replace("rn", "") + "');</script>");
- Common.RunScript(this.Page, ex.Message);
- }
- //this.IsCollect = true;
- //this.IB_Collect.Enabled = false;
- // }
- // else
- // {
- // Common.RunScript(this.Page, "打开文档失败!");
- // }
- }
- else
- {
- Common.RunScript(this.Page, "汇总失败,请检查相关数据!");
- }
- }
- else
- {
- Common.RunScript(this.Page, "没有文档,不能汇总!");
- }
- }
- }
- if (this.MustChooseItem == 27)//工程总进度汇总
- {
- com.etong.DAL.FC.EtongFlyChouWFPrj etongFlyChouWFPrj = new com.etong.DAL.FC.EtongFlyChouWFPrj();
- etongFlyChouWFPrj.sID = this.actinstanceid;
- etongFlyChouWFPrj.PrjID = this.ConID;
- etongFlyChouWFPrj.iID = this.WFInstanceID;
- etongFlyChouWFPrj.aID = this.ActivityID;
- etongFlyChouWFPrj.iStatus = 2;
- //etongFlyChouWFPrj.sBlockReason = WorkFolw.GetBlockReason(this.actinstanceid);
- if (etongFlyChouWFPrj.GetPrevioueTasksStatus() == false)
- {
- Common.RunScript(this.Page, "工作流上级活动未完成,不能汇总文档");
- return;
- }
- else
- {
- //string xmlFileName = path + "\DocTemplateCon\" + dv[0]["GcglFName"].ToString();
- //XML xml = new XML(xmlFileName);
- string xmlpth = Server.MapPath("doc\\DocTemplateCon\\" + dv[0]["GcglFName"].ToString());
- XML jcXml = new XML(path + "\\DocTemplateCon\\" + dv[0]["GcglFName"].ToString());
- //ArrayList list = jcXml.ReadNode("Documents", EmpType, true);
- //ArrayList list = jcXml.ReadNode("Documents");
- ArrayList nodesname = new ArrayList();
- nodesname.Add("FileName");
- ArrayList list = jcXml.ReadNode(nodesname, "Documents");
- string[] filecopy = new string[list.Count];
- ArrayList materiallist = new ArrayList();
- if (filecopy.Length > 0)
- {
- for (int i = 0; i < filecopy.Length; i++)
- {
- //DocumentNode documentNode = (DocumentNode)list[i];
- string[] a = (string[])list[i];
- filecopy[i] = path + "\\DocTemplateCon\\" + a[0].ToString();
- materiallist.Add(Server.MapPath("doc\\DocTemplateCon\\" + a[0].ToString()));
- }
- string[] houzhui = filecopy[0].Split('.');
- MyDocMerger myDocMerger = new MyDocMerger();
- string orgDocName = path + "\\DocTemplateCon\\" + filename3 + "." + houzhui[1];
- //this.txt_ZgHZFName.Value = filename + "." + houzhui[1];
- //if (xml.AddXmlNode(new DocumentNode(filename + "." + houzhui[1], checker, time, EmpType)))
- // {
- // if (Util.Copyfile(path + "\" + orgfilename, orgDocName))
- // {
- /*------------------------文档汇总----------------------*/
- //myDocMerger.MergeDocArray(orgDocName, filecopy, orgDocName);
- /*---------------改变按钮组为可用状态-------------------*/
- //this.TB_OpenDocument_ZGdFName.Enabled = true;
- //this.TB_OpenDocument_ZgHZFName.Enabled = true;
- //this.TB_OpenDocument_ZGxFName.Enabled = true;
- //this.TB_OpenDocument_ZgHZFName.Text = "浏览电子文档";
- //this.TB_OpenDocument_ZgHZFName.Attributes.Add("onclick", "javascript:SetLinkUrl('DocTemplateCon/'+document.all('txt_ZgHZFName').value,'" + cui.EmpName + "');");
- try
- {
- EtongExcel EExcel = new EtongExcel(Server.MapPath("doc\\空工作表.xls"), Server.MapPath("doc\\DocTemplateCon\\" + filename3 + "." + houzhui[1]));
- EExcel.RangeCellSet(materiallist, 3, 10);
- EExcel.SaveAsFile();
- //EExcel.KillExcelProcess();
- //this.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('系统提示:信息合并成功!');", true);
- Common.RunScript(this.Page, "汇总成功!");
- this.BT_OpenDocument_ProjectAnalysis.Enabled = true;
- this.ProjectAnalysis.Value = filename3 + "." + houzhui[1];
- }
- catch (Exception ex)
- {
- //ClientScript.RegisterStartupScript(this.GetType(), "errorMessage", "<script>alert('" + ex.Message.Replace("'", "").Replace("rn", "") + "');</script>");
- Common.RunScript(this.Page, ex.Message);
- }
- //}
- //else
- //{
- // Common.RunScript(this.Page, "汇总失败,请检查相关数据!");
- //}
- }
- else
- {
- Common.RunScript(this.Page, "没有文档,不能汇总!");
- }
- }
- }
- //}
- }
- //
- protected bool CheckEmpTypeIsEqualBlockReason()
- {
- bool flag = false;
- int wfid = -1;
- int actid = -1;
- CheckUserInfo cui = null;
- if (Session["checkuserinfo"] != null)
- {
- cui = (CheckUserInfo)Session["checkuserinfo"];
- }
- string type = ProjectImplment.GetEmpType(cui.EmpID);
- string sql = "select * from [tb_WF_Instance] where [Status]=2 and [PrjID]=" + this.ConID;
- DataView dv = SqlServer.GetDataView(sql);
- wfid = Convert.ToInt32(dv[0]["WFInstanceID"].ToString());
- EtongZwf etongzwf = new EtongZwf();
- dv = etongzwf.ColonyUserGetByActId(ActivityID);
- if (dv.Count > 0)
- {
- actid = Convert.ToInt32(dv[0]["ParentActID"].ToString().Trim());
- sql = "select [BlockReason] from [tb_WF_ActIns] where [ActivityID]=" + actid + " and [WfInstanceID]=" + wfid;
- dv = SqlServer.GetDataView(sql);
- if (dv.Count > 0)
- {
- if (type == dv[0]["BlockReason"].ToString())
- flag = true;
- }
- }
- return flag;
- }
- protected bool IsExsitNextWaitActivity()
- {
- bool flag = false;
- int wfid = -1;
- int actid = -1;
- string sql = "select * from [tb_WF_Instance] where [Status]=2 and [PrjID]=" + this.ConID;
- DataView dv = SqlServer.GetDataView(sql);
- wfid = Convert.ToInt32(dv[0]["WFInstanceID"].ToString());
- EtongZwf etongzwf = new EtongZwf();
- dv = etongzwf.ColonyUserGetByActId(ActivityID);
- if (dv.Count > 0)
- {
- actid = Convert.ToInt32(dv[0]["ParentActID"].ToString().Trim());
- sql = "select * from [tb_WF_ActIns] where [ActivityID]=" + actid + " and [WfInstanceID]=" + wfid;
- dv = SqlServer.GetDataView(sql);
- if (dv.Count > 0)
- {
- // if (type == dv[0]["BlockReason"].ToString())
- flag = true;
- }
- }
- return flag;
- }
- }