WFCheckPrjAccept.aspx.cs
上传用户:tiancihang
上传日期:2014-03-12
资源大小:21387k
文件大小:94k
- using System;
- using System.Data;
- using System.Configuration;
- using System.Collections;
- using System.Web;
- using System.Web.Security;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- using System.Web.UI.WebControls.WebParts;
- using System.Web.UI.HtmlControls;
- using com.etong.Inform;
- using com.etong.BusinessRule.Zwf;
- using com.etong.Model;
- using com.etong.DBUtility;
- using com.etong.user;
- using com.etong.DAL;
- using com.etong.Utility;
- using DocMergerComponent;
- using com.etong.DAL.FC;
- public partial class Workflow_WFCheckPrjAccept : System.Web.UI.Page
- {
- protected int userid = -1;
- protected int wfid = -1;//当前工作流ID
- protected int MustChooseItem = -1;//必选项
- protected int ActivityID = -1;//活动ID
- protected int WFInstanceID = -1;//工作流实例ID
- //protected int actinstanceid = -1;//活动实例ID
- protected int ActID = -1;//活动实例ID
- protected int iDepID = -1;
- protected int iEmpID = -1; //当前员工ID
- protected string sAccount = "";
- protected string sEmpName = "";
- protected int PrjID = -1;
- protected string PrjChSort = "";
- protected void Page_Load(object sender, EventArgs e)
- {
- if (!IsPostBack)
- {
- int year = Convert.ToInt32(DateTime.Now.Year.ToString());
- ddl_nf.Items.Insert(0, new ListItem("--请选择--", "0"));
- //nf.Items.Insert(0, new ListItem("--请选择--", "0"));
- for (int i = 1; i <= 6; i++, year++)
- {
- ddl_nf.Items.Insert(i, new ListItem((year.ToString() + "年"), year.ToString()));
- //nf.Items.Insert(i, new ListItem((year.ToString() + "年"), year.ToString()));
- }
- string path = Server.MapPath("doc").Replace("\", "\\");
- this.BT_OpenDocument_JcCKName.Attributes.Add("onclick", "javascript:SetLinkUrl('DocTemplateChe/'+document.all('JcCKName').value,false);");
- this.BT_OpenDocument_JcRKName.Attributes.Add("onclick", "javascript:SetLinkUrl('DocTemplateChe/'+document.all('JcRKName').value,false);");
- this.BT_OpenDocument_CwTransactor.Attributes.Add("onclick", "javascript:SetLinkUrl('DocTemplateChe/'+document.all('CwTransactor').value,false);");
- this.BT_OpenDocument_WzTransatctor.Attributes.Add("onclick", "javascript:SetLinkUrl('DocTemplateChe/'+document.all('WzTransatctor').value,false);");
- this.BT_OpenDocument_ZgTransactor.Attributes.Add("onclick", "javascript:SetLinkUrl('DocTemplateChe/'+document.all('ZgTransactor').value,false);");
- this.BT_OpenDocument_ZgGdTransactor.Attributes.Add("onclick", "javascript:SetLinkUrl('DocTemplateChe/'+document.all('ZgGdTransactor').value,false);");
- this.BT_OpenDocument_GcglTransactor.Attributes.Add("onclick", "javascript:SetLinkUrl('DocTemplateChe/'+document.all('GcglFname').value,false);");
- ArrayList alfp = EtongZwf.GetSFileNamePerm(iEmpID); //授与编辑权限的文件集合
- for (int i = 0; i < alfp.Count; i++)
- {
- string[] str = alfp[i].ToString().Trim().Split(new Char[] { '.' });
- int JC = JcCKName.Text.IndexOf(str[0].Trim(), 0);
- int JR = JcRKName.Text.IndexOf(str[0].Trim(), 0);
- int CT = CwTransactor.Text.IndexOf(str[0].Trim(), 0);
- int WT = WzTransatctor.Text.IndexOf(str[0].Trim(), 0);
- int ZT = ZgTransactor.Text.IndexOf(str[0].Trim(), 0);
- int ZGT = ZgGdTransactor.Text.IndexOf(str[0].Trim(), 0);
- int GT = GcglFname.Text.IndexOf(str[0].Trim(), 0);
-
- if (JC >= 0)
- {
- this.BT_OpenDocument_JcCKName.Text = "打开电子文档";
- this.BT_OpenDocument_JcCKName.Attributes.Add("onclick", "javascript:SetLinkUrl('DocTemplateChe/'+document.all('JcCKName').value,true);");
- }
- if (JR >= 0)
- {
- this.BT_OpenDocument_JcRKName.Text = "打开电子文档";
- this.BT_OpenDocument_JcRKName.Attributes.Add("onclick", "javascript:SetLinkUrl('DocTemplateChe/'+document.all('JcRKName').value,true);");
- }
- if (CT >= 0)
- {
- this.BT_OpenDocument_CwTransactor.Text = "打开电子文档";
- this.BT_OpenDocument_CwTransactor.Attributes.Add("onclick", "javascript:SetLinkUrl('DocTemplateChe/'+document.all('CwTransactor').value,true);");
- }
- if (WT >= 0)
- {
- this.BT_OpenDocument_WzTransatctor.Text = "打开电子文档";
- this.BT_OpenDocument_WzTransatctor.Attributes.Add("onclick", "javascript:SetLinkUrl('DocTemplateChe/'+document.all('WzTransatctor').value,true);");
- }
- if (ZT >= 0)
- {
- this.BT_OpenDocument_ZgTransactor.Text = "打开电子文档";
- this.BT_OpenDocument_ZgTransactor.Attributes.Add("onclick", "javascript:SetLinkUrl('DocTemplateChe/'+document.all('ZgTransactor').value,true);");
- }
- if (ZGT >= 0)
- {
- this.BT_OpenDocument_ZgGdTransactor.Text = "打开电子文档";
- this.BT_OpenDocument_ZgGdTransactor.Attributes.Add("onclick", "javascript:SetLinkUrl('DocTemplateChe/'+document.all('ZgGdTransactor').value,true);");
- }
- if (GT >= 0)
- {
- this.BT_OpenDocument_GcglTransactor.Text = "打开电子文档";
- this.BT_OpenDocument_GcglTransactor.Attributes.Add("onclick", "javascript:SetLinkUrl('DocTemplateChe/'+document.all('GcglFname').value,true);");
- }
- }
- }
- //this.ddl_nf.SelectedValue = "0";
- //this.ddl_jd.SelectedValue = "0";
- this.JcCKName.Enabled = false;
- //this.JcHZName.Enabled = false;
- //this.JcQDName.Enabled = false;
- this.JcRKName.Enabled = false;
- this.CwTransactor.Enabled = false;
- this.WzTransatctor.Enabled = false;
- this.ZgTransactor.Enabled = false;
- this.ZgGdTransactor.Enabled = false;
- this.zghuizong.Enabled = false;
- this.GcglFname.Enabled = false;
- huizong.Enabled = false;
- //this.GcglTransactor.Enabled = false;
- try
- {
- CheckUserInfo RoInfo = (CheckUserInfo)Session["checkuserinfo"];
- iDepID = RoInfo.OrgID;
- userid = RoInfo.UserID;
- iEmpID = RoInfo.EmpID;
- sAccount = RoInfo.UserAccount;
- sEmpName = RoInfo.EmpName;
- }
- catch
- {
- this.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('系统提示:您尚未登录或您登录已超时,请重新登录!');top.location.href='../login.aspx';", true);
- }
- try //徐秀梅加:Start
- {
- string projectid = Request.QueryString["ProjectID"].ToString().Trim(); //??
- if (projectid != "")
- {
- ddl_nf.Enabled = false;
- ddl_jd.Enabled = false;
- GcglTransactor.Enabled = false;
- PN_Button.Visible = false;
- //GcglGdTransactor.Enabled = false;
- // ZgGdTransactor.Enabled = false;
- ((HtmlInputHidden)this.FindControl("txt_ProjectID")).Value = projectid;
- DataView dv = GetPrjchInfo(Convert.ToInt32(projectid));
- if (dv != null && dv.Count > 0)
- {
- this.TB_ConName.Text = dv[0]["PrjchName"].ToString();
- this.TB_ConName.Enabled = false;
- this.ddl_nf.SelectedValue = dv[0]["nf"].ToString();
- this.ddl_jd.SelectedValue = dv[0]["jd"].ToString();
- //this.BT_OpenDocument_JcCKName.Enabled = false;
- //this.BT_OpenDocument_JcRKName.Enabled = false;
- //this.BT_OpenDocument_CwTransactor.Enabled = false;
- //this.BT_OpenDocument_WzTransatctor.Enabled = false;
- //this.BT_OpenDocument_ZgTransactor.Enabled = false;
- //this.BT_OpenDocument_ZgGdTransactor.Enabled = false;
- this.GcglFname.Text = dv[0]["GcglFname"].ToString();
- //this.JcCKName.Text = dv[0]["JcCKName"].ToString();
- //this.JcRKName.Text = dv[0]["JcRKName"].ToString();
- //this.JcQDName.Text = dv[0]["JcQDName"].ToString();
- //this.JcHZName.Text = dv[0]["JcHZName"].ToString();
- this.CwTransactor.Text = dv[0]["CwFName"].ToString();
- this.WzTransatctor.Text = dv[0]["WzFName"].ToString();
- this.ZgTransactor.Text = dv[0]["ZgZlFName"].ToString();
- this.GcglTransactor.Text = dv[0]["GcglGdContect"].ToString();
- //this.GcglGdTransactor.Text = dv[0]["GcglGdContect"].ToString();
- this.ZgGdTransactor.Text = dv[0]["ZgGdContect"].ToString();
- }
- }
- } //徐秀梅加:End
- catch
- {
- string MustChooseItemtxt = Request.QueryString["MustChooseItem"].ToString().Trim();
- ((HtmlInputHidden)this.FindControl("txt_MustChooseItem")).Value = MustChooseItemtxt;
- MustChooseItem = Convert.ToInt16(MustChooseItemtxt);
- string ActivityIDtxt = Request.QueryString["ActivityID"].ToString().Trim();
- string WFInstanceIDtxt = Request.QueryString["WFInstanceID"].ToString().Trim();
- string WFIDtxt = Request.QueryString["WFID"].ToString().Trim();
- wfid = Convert.ToInt16(WFIDtxt);
- EtongZwf etongzwf = new EtongZwf();
- ActivityID = Convert.ToInt32(ActivityIDtxt);
- if (!IsPostBack)
- {
- ((HtmlInputHidden)this.FindControl("txt_ProjectID")).Value = "-1";
- }
- if (Convert.ToInt32(WFInstanceIDtxt) != -1)
- {
- ((HtmlInputHidden)this.FindControl("txt_WFInstanceID")).Value = WFInstanceIDtxt;
- WFInstanceID = Convert.ToInt32(WFInstanceIDtxt);
- DataView dvInstance = etongzwf.WFInstanceGetAll(WFInstanceID);
- ((HtmlInputHidden)this.FindControl("txt_ProjectID")).Value = dvInstance[0][9].ToString();
- this.wfid = Convert.ToInt32(dvInstance[0][8].ToString().Trim());
- this.PrjID = Convert.ToInt32(((HtmlInputHidden)this.FindControl("txt_ProjectID")).Value.ToString());
- }
- string path = Server.MapPath("doc").Replace("\", "\\");
- BT_Pass.Attributes.Add("OnClientClick", "javascript:if(confirm('确定要退出吗?')) {window.close();return;} else {return;}");
- ArrayList al = new ArrayList();
- //Page.ClientScript.RegisterStartupScript(GetType(),"","<script>alert('"+ddl_nf.SelectedValue.ToString()+"');</script>");
- //return;
- switch (MustChooseItem)
- {
- case 47:
- if (!this.Page.IsPostBack)
- {
- Application.Visible = false;
- Pn_CL_HZ.Visible = false;
- Pn_CW.Visible = false;
- Pn_JG_JC.Visible = false;
- Pn_WZ.Visible = false;
- Pn_ZG_GD.Visible = false;
- }
- break;
- case 40: //剩余材料上报
- // Pn_CL_GD.Visible = false;
- Application.Visible = true;
- Pn_CL_HZ.Visible = false;
- Pn_CW.Visible = false;
- Pn_JG_JC.Visible = false;
- Pn_WZ.Visible = false;
- Pn_ZG_GD.Visible = false;
- ddl_nf.Enabled = false;
- ddl_jd.Enabled = false;
- //this.BT_OpenDocument_JcCKName.Attributes.Add("onclick", "javascript:SetLinkUrl('DocTemplateChe/'+document.all('JcCKName').value);");
- //this.BT_OpenDocument_JcRKName.Attributes.Add("onclick", "javascript:SetLinkUrl('DocTemplateChe/'+document.all('JcRKName').value);");
- //this.BT_OpenDocument_JcQDName.Attributes.Add("onclick", "javascript:SetLinkUrl('DocTemplateChe/'+document.all('JcQDName').value);");
- //this.BT_OpenDocument_JcHZName.Attributes.Add("onclick", "javascript:SetLinkUrl('DocTemplateChe/'+document.all('JcHZName').value);");
- //PN_Button.Visible = false;
- //string YFname=GetFName()+".doc";
- if (!this.Page.IsPostBack)
- {
- al = GetFName();
- if (al.Count > 0)
- {
- this.JcCKName.Text = al[0] + ".doc";
- //string fullpath = path + GetFName() + ".doc";
- string Fname = al[0].ToString() + DateTime.Now.Year + DateTime.Now.Month + DateTime.Now.Day + DateTime.Now.Hour + DateTime.Now.Minute + DateTime.Now.Second + ".doc";
- if (!Util.Copyfile(path + "\" + this.JcCKName.Text, path + "\DocTemplateChe\" + Fname))
- {
- Common.RunScript(this.Page, "打开模版失败,请检查相关设置!");
- return;
- }
- this.JcCKName.Text = Fname;
- //this.JcHZName.Text = al[1] + ".doc";
- ////string fullpath = path + GetFName() + ".doc";
- //Fname = al[1].ToString() + DateTime.Now.Year + DateTime.Now.Month + DateTime.Now.Day + DateTime.Now.Hour + DateTime.Now.Minute + DateTime.Now.Second + ".doc";
- //if (!Util.Filecopy(path + "\" + this.JcHZName.Text, path + "\DocTemplateChe\" + Fname))
- //{
- // Common.RunScript(this.Page, "打开模版失败,请检查相关设置!");
- // return;
- //}
- //this.JcHZName.Text = Fname;
- //this.JcQDName.Text = al[2] + ".doc";
- ////string fullpath = path + GetFName() + ".doc";
- //Fname = al[2].ToString() + DateTime.Now.Year + DateTime.Now.Month + DateTime.Now.Day + DateTime.Now.Hour + DateTime.Now.Minute + DateTime.Now.Second + ".doc";
- //if (!Util.Filecopy(path + "\" + this.JcQDName.Text, path + "\DocTemplateChe\" + Fname))
- //{
- // Common.RunScript(this.Page, "打开模版失败,请检查相关设置!");
- // return;
- //}
- //this.JcQDName.Text = Fname;
- this.JcRKName.Text = al[1] + ".doc";
- //string fullpath = path + GetFName() + ".doc";
- Fname = al[1].ToString() + DateTime.Now.Year + DateTime.Now.Month + DateTime.Now.Day + DateTime.Now.Hour + DateTime.Now.Minute + DateTime.Now.Second + ".doc";
- if (!Util.Copyfile(path + "\" + this.JcRKName.Text, path + "\DocTemplateChe\" + Fname))
- {
- Common.RunScript(this.Page, "打开模版失败,请检查相关设置!");
- return;
- }
- this.JcRKName.Text = Fname;
- }
- }
- DataView dv = GetPrjchInfo(this.PrjID);
- if (dv != null && dv.Count > 0)
- {
- this.TB_ConName.Text = dv[0]["PrjchName"].ToString();
- this.TB_ConName.Enabled = false;
- this.ddl_nf.SelectedValue = dv[0]["nf"].ToString();
- this.ddl_jd.SelectedValue = dv[0]["jd"].ToString();
- }
- break;
- case 41: //财务进账
- //Application.Visible = false;
- //Pn_CL_GD.Visible = false;
- Pn_CL_HZ.Visible = false;
- //Pn_CW.Visible = false;
- Pn_JG_JC.Visible = false;
- Pn_WZ.Visible = false;
- ddl_nf.Enabled = false;
- ddl_jd.Enabled = false;
- Pn_ZG_GD.Visible = false;
- //this.BT_OpenDocument_JcCKName.Text = "浏览电子文档";
- //this.BT_OpenDocument_JcCKName.Attributes.Add("onclick", "javascript:SetLinkUrl2('DocTemplateChe/'+document.all('JcCKName').value);");
- //this.BT_OpenDocument_JcRKName.Text = "浏览电子文档";
- //this.BT_OpenDocument_JcRKName.Attributes.Add("onclick", "javascript:SetLinkUrl2('DocTemplateChe/'+document.all('JcRKName').value);");
- //this.BT_OpenDocument_JcQDName.Text = "浏览电子文档";
- //this.BT_OpenDocument_JcQDName.Attributes.Add("onclick", "javascript:SetLinkUrl2('DocTemplateChe/'+document.all('JcQDName').value);");
- //this.BT_OpenDocument_JcHZName.Text = "浏览电子文档";
- //this.BT_OpenDocument_JcHZName.Attributes.Add("onclick", "javascript:SetLinkUrl2('DocTemplateChe/'+document.all('JcHZName').value);");
- //this.BT_OpenDocument_CwTransactor.Attributes.Add("onclick", "javascript:SetLinkUrl('DocTemplateChe/'+document.all('CwTransactor').value);");
- dv = GetPrjchInfo(this.PrjID);
- if (dv != null && dv.Count > 0)
- {
- this.TB_ConName.Text = dv[0]["PrjchName"].ToString();
- this.TB_ConName.Enabled = false;
- this.JcCKName.Text = dv[0]["JcCKName"].ToString();
- this.JcRKName.Text = dv[0]["JcRKName"].ToString();
- //this.JcQDName.Text = dv[0]["JcQDName"].ToString();
- //this.JcHZName.Text = dv[0]["JcHZName"].ToString();
- this.ddl_nf.SelectedValue = dv[0]["nf"].ToString();
- this.ddl_jd.SelectedValue = dv[0]["jd"].ToString();
- this.ShowOperatorAndTime_CWjinzhang.InnerHtml = "<div align='center'>上报人/上报时间:<font color='red'> " + dv[0]["JcTransactor"].ToString() + "</font></div>";
- }
- if (!this.Page.IsPostBack)
- {
- al = GetFName();
- if (al.Count > 0)
- {
- this.CwTransactor.Text = al[0].ToString() + ".xls";
- string Fname = al[0].ToString() + DateTime.Now.Year + DateTime.Now.Month + DateTime.Now.Day + DateTime.Now.Hour + DateTime.Now.Minute + DateTime.Now.Second + ".xls";
- if (!Util.Copyfile(path + "\" + this.CwTransactor.Text, path + "\DocTemplateChe\" + Fname))
- {
- Common.RunScript(this.Page, "打开模版失败,请检查相关设置!");
- return;
- }
- this.CwTransactor.Text = Fname;
- }
- }
-
- //PN_Button.Visible = false;
- break;
- case 42: //物资管理上报
- //Application.Visible = false;
- //Pn_CL_GD.Visible = false;
- huizong.Enabled = true;
- Pn_CL_HZ.Visible = false;
- //Pn_CW.Visible = false;
- Pn_JG_JC.Visible = false;
- ddl_nf.Enabled = false;
- ddl_jd.Enabled = false;
- //Pn_WZ.Visible = false;
- Pn_ZG_GD.Visible = false;
- //PN_Button.Visible = false;
- //this.BT_OpenDocument_JcCKName.Text = "浏览电子文档";
- //this.BT_OpenDocument_JcCKName.Attributes.Add("onclick", "javascript:SetLinkUrl2('DocTemplateChe/'+document.all('JcCKName').value);");
- //this.BT_OpenDocument_JcRKName.Text = "浏览电子文档";
- //this.BT_OpenDocument_JcRKName.Attributes.Add("onclick", "javascript:SetLinkUrl2('DocTemplateChe/'+document.all('JcRKName').value);");
- //this.BT_OpenDocument_JcQDName.Text = "浏览电子文档";
- //this.BT_OpenDocument_JcQDName.Attributes.Add("onclick", "javascript:SetLinkUrl2('DocTemplateChe/'+document.all('JcQDName').value);");
- //this.BT_OpenDocument_JcHZName.Text = "浏览电子文档";
- //this.BT_OpenDocument_JcHZName.Attributes.Add("onclick", "javascript:SetLinkUrl2('DocTemplateChe/'+document.all('JcHZName').value);");
- //this.BT_OpenDocument_CwTransactor.Text = "浏览电子文档";
- //this.BT_OpenDocument_CwTransactor.Attributes.Add("onclick", "javascript:SetLinkUrl2('DocTemplateChe/'+document.all('CwTransactor').value);");
- // this.BT_OpenDocument_WzTransatctor.Attributes.Add("onclick", "javascript:SetLinkUrl2('DocTemplateChe/'+document.all('WzTransatctor').value);");
- dv = GetPrjchInfo(this.PrjID);
- if (dv != null && dv.Count > 0)
- {
- this.TB_ConName.Text = dv[0]["PrjchName"].ToString();
- this.TB_ConName.Enabled = false;
- this.JcCKName.Text = dv[0]["JcCKName"].ToString();
- this.JcRKName.Text = dv[0]["JcRKName"].ToString();
- //this.JcQDName.Text = dv[0]["JcQDName"].ToString();
- //this.JcHZName.Text = dv[0]["JcHZName"].ToString();
- this.CwTransactor.Text = dv[0]["CwFName"].ToString();
- this.ddl_nf.SelectedValue = dv[0]["nf"].ToString();
- this.ddl_jd.SelectedValue = dv[0]["jd"].ToString();
- this.ShowOperatorAndTime_CWjinzhang.InnerHtml = "<div align='center'>上报人/上报时间:<font color='red'> " + dv[0]["JcTransactor"].ToString() + "</font></div>";
- this.ShowOperatorAndTime_WZmanager.InnerHtml = "<div align='center'>上报人/上报时间:<font color='red'> " + dv[0]["CwTransactor"].ToString() + "</font></div>";
- }
- string year = ddl_nf.SelectedValue.ToString();
- string selectjd = ddl_jd.SelectedValue.ToString();
- /******************************************
- * 取名
- * *****************************************/
- al = GetFName();
- string hzname = "";
- if (al.Count > 0)
- {
- this.WzTransatctor.Text = al[0].ToString() + year + selectjd + ".doc";
- hzname = al[0].ToString() + ".doc";
- }
- //string path = Server.MapPath("doc").Replace("\", "\\") + "\\DocTemplateChe\\";
- //prjcheck = new PrjCheck();
- string filename = Server.MapPath("doc").Replace("\", "\\") + "\\DocTemplateChe\\" + this.WzTransatctor.Text;
- //Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('" + filename + "');</script>");
- //return;
- //判断文件名是否存在
- if (!System.IO.File.Exists(filename))
- {
- if (!Util.Copyfile(path + "\" + hzname, path + "\DocTemplateChe\" + this.WzTransatctor.Text))
- {
- Common.RunScript(this.Page, "打开模版失败,请检查相关设置!");
- return;
- }
- }
- break;
- case 43: //竣工检查上报
- //Application.Visible = false;
- //Pn_CL_GD.Visible = false;
- Pn_CL_HZ.Visible = false;
- ddl_nf.Enabled = false;
- ddl_jd.Enabled = false;
- //Pn_CW.Visible = false;
- //Pn_JG_JC.Visible = false;
- //Pn_WZ.Visible = false;
- Pn_ZG_GD.Visible = false;
- //this.BT_OpenDocument_JcCKName.Text = "浏览电子文档";
- //this.BT_OpenDocument_JcCKName.Attributes.Add("onclick", "javascript:SetLinkUrl2('DocTemplateChe/'+document.all('JcCKName').value);");
- //this.BT_OpenDocument_JcRKName.Text = "浏览电子文档";
- //this.BT_OpenDocument_JcRKName.Attributes.Add("onclick", "javascript:SetLinkUrl2('DocTemplateChe/'+document.all('JcRKName').value);");
- //this.BT_OpenDocument_JcQDName.Text = "浏览电子文档";
- //this.BT_OpenDocument_JcQDName.Attributes.Add("onclick", "javascript:SetLinkUrl2('DocTemplateChe/'+document.all('JcQDName').value);");
- //this.BT_OpenDocument_JcHZName.Text = "浏览电子文档";
- //this.BT_OpenDocument_JcHZName.Attributes.Add("onclick", "javascript:SetLinkUrl2('DocTemplateChe/'+document.all('JcHZName').value);");
- //this.BT_OpenDocument_CwTransactor.Text = "浏览电子文档";
- //this.BT_OpenDocument_CwTransactor.Attributes.Add("onclick", "javascript:SetLinkUrl2('DocTemplateChe/'+document.all('CwTransactor').value);");
- //this.BT_OpenDocument_WzTransatctor.Text = "浏览电子文档";
- //this.BT_OpenDocument_WzTransatctor.Attributes.Add("onclick", "javascript:SetLinkUrl2('DocTemplateChe/'+document.all('WzTransatctor').value);");
- //this.BT_OpenDocument_ZgTransactor.Attributes.Add("onclick", "javascript:SetLinkUrl('DocTemplateChe/'+document.all('ZgTransactor').value);");
- dv = GetPrjchInfo(this.PrjID);
- if (dv != null && dv.Count > 0)
- {
- this.TB_ConName.Text = dv[0]["PrjchName"].ToString();
- this.TB_ConName.Enabled = false;
- this.JcCKName.Text = dv[0]["JcCKName"].ToString();
- this.JcRKName.Text = dv[0]["JcRKName"].ToString();
- //this.JcQDName.Text = dv[0]["JcQDName"].ToString();
- //this.JcHZName.Text = dv[0]["JcHZName"].ToString();
- this.CwTransactor.Text = dv[0]["CwFName"].ToString();
- this.WzTransatctor.Text = dv[0]["WzFName"].ToString();
- this.ddl_nf.SelectedValue = dv[0]["nf"].ToString();
- this.ddl_jd.SelectedValue = dv[0]["jd"].ToString();
- this.ShowOperatorAndTime_CWjinzhang.InnerHtml = "<div align='center'>上报人/上报时间:<font color='red'> " + dv[0]["JcTransactor"].ToString() + "</font></div>";
- this.ShowOperatorAndTime_WZmanager.InnerHtml = "<div align='center'>上报人/上报时间:<font color='red'> " + dv[0]["CwTransactor"].ToString() + "</font></div>";
- this.ShowOperatorAndTime_JGjiancha.InnerHtml = "<div align='center'>上报人/上报时间:<font color='red'> " + dv[0]["WzTransatctor"].ToString() + "</font></div>";
- }
- if (!this.Page.IsPostBack)
- {
- ActID = Convert.ToInt32(Request.QueryString["ActID"].ToString());
- PrjCheck prjcheck=new PrjCheck ();
- dv = prjcheck.GetStatus(ActID);
- int Status =Convert.ToInt32(dv[0]["Status"].ToString());
- if (Status == 2)
- {
- path = Server.MapPath("doc").Replace("\", "\\") + "\\DocTemplateChe\\";
- EtongWord EWord = new EtongWord();
- EWord.sort = 0;
- EWord.opSort = prjcheck.GetEmpType(iEmpID);
- EWord.XmlNodesNames = "XMLrecord";
- dv = GetPrjchInfo(PrjID);
- if (dv.Count > 0)
- {
- EWord.Address =path+ dv[0]["ZgZlFName"].ToString();
- }
- al = EWord.ReadXMLFName();
- EtongXml alfn = (EtongXml)al[0];
- string fname = alfn.DocFileName.ToString();
- this.ZgTransactor.Text = fname;
- }
- else
- {
- al = GetFName();
- if (al.Count > 0)
- {
- this.ZgTransactor.Text = al[0].ToString() + ".doc";
- string Fname = al[0].ToString() + DateTime.Now.Year + DateTime.Now.Month + DateTime.Now.Day + DateTime.Now.Hour + DateTime.Now.Minute + DateTime.Now.Second + ".doc";
- if (!Util.Copyfile(path + "\" + this.ZgTransactor.Text, path + "\DocTemplateChe\" + Fname))
- {
- Common.RunScript(this.Page, "打开模版失败,请检查相关设置!");
- return;
- }
- this.ZgTransactor.Text = Fname;
- }
- }
- }
- break;
- case 44: //工程管理办公室审核
- // Application.Visible = false;
- //Pn_CL_GD.Visible = false;
- zghuizong.Enabled = true;
- ddl_nf.Enabled = false;
- ddl_jd.Enabled = false;
- BT_Untread.Visible = true;
- Pn_CL_HZ.Visible = false;
- //Pn_CW.Visible = false;
- //Pn_JG_JC.Visible = false;
- //Pn_WZ.Visible = false;
- //Pn_ZG_GD.Visible = false;
- //this.BT_OpenDocument_JcCKName.Text = "浏览电子文档";
- //this.BT_OpenDocument_JcCKName.Attributes.Add("onclick", "javascript:SetLinkUrl2('DocTemplateChe/'+document.all('JcCKName').value);");
- //this.BT_OpenDocument_JcRKName.Text = "浏览电子文档";
- //this.BT_OpenDocument_JcRKName.Attributes.Add("onclick", "javascript:SetLinkUrl2('DocTemplateChe/'+document.all('JcRKName').value);");
- //this.BT_OpenDocument_JcQDName.Text = "浏览电子文档";
- //this.BT_OpenDocument_JcQDName.Attributes.Add("onclick", "javascript:SetLinkUrl2('DocTemplateChe/'+document.all('JcQDName').value);");
- //this.BT_OpenDocument_JcHZName.Text = "浏览电子文档";
- //this.BT_OpenDocument_JcHZName.Attributes.Add("onclick", "javascript:SetLinkUrl2('DocTemplateChe/'+document.all('JcHZName').value);");
- //this.BT_OpenDocument_CwTransactor.Text = "浏览电子文档";
- //this.BT_OpenDocument_CwTransactor.Attributes.Add("onclick", "javascript:SetLinkUrl2('DocTemplateChe/'+document.all('CwTransactor').value);");
- //this.BT_OpenDocument_WzTransatctor.Text = "浏览电子文档";
- //this.BT_OpenDocument_WzTransatctor.Attributes.Add("onclick", "javascript:SetLinkUrl2('DocTemplateChe/'+document.all('WzTransatctor').value);");
- //this.BT_OpenDocument_ZgTransactor.Text = "浏览电子文档";
- //this.BT_OpenDocument_ZgTransactor.Attributes.Add("onclick", "javascript:SetLinkUrl2('DocTemplateChe/'+document.all('ZgTransactor').value);");
- //this.BT_OpenDocument_GcglTransactor.Attributes.Add("onclick", "javascript:SetLinkUrl2('DocTemplateChe/'+document.all('GcglTransactor').value);");
- dv = GetPrjchInfo(this.PrjID);
- if (dv != null && dv.Count > 0)
- {
- this.TB_ConName.Text = dv[0]["PrjchName"].ToString();
- this.TB_ConName.Enabled = false;
- this.JcCKName.Text = dv[0]["JcCKName"].ToString();
- this.JcRKName.Text = dv[0]["JcRKName"].ToString();
- //this.JcQDName.Text = dv[0]["JcQDName"].ToString();
- //this.JcHZName.Text = dv[0]["JcHZName"].ToString();
- this.CwTransactor.Text = dv[0]["CwFName"].ToString();
- this.WzTransatctor.Text = dv[0]["WzFName"].ToString();
- this.ZgTransactor.Text = dv[0]["ZgZlFName"].ToString();
- this.ddl_nf.SelectedValue = dv[0]["nf"].ToString();
- this.ddl_jd.SelectedValue = dv[0]["jd"].ToString();
- this.ShowOperatorAndTime_CWjinzhang.InnerHtml = "<div align='center'>上报人/上报时间:<font color='red'> " + dv[0]["JcTransactor"].ToString() + "</font></div>";
- this.ShowOperatorAndTime_WZmanager.InnerHtml = "<div align='center'>上报人/上报时间:<font color='red'> " + dv[0]["CwTransactor"].ToString() + "</font></div>";
- this.ShowOperatorAndTime_JGjiancha.InnerHtml = "<div align='center'>上报人/上报时间:<font color='red'> " + dv[0]["WzTransatctor"].ToString() + "</font></div>";
- this.ShowOperatorAndTime_HZmaterial.InnerHtml = "<div align='center'>上报人/上报时间:<font color='red'> " + dv[0]["ZgTransactor"].ToString() + "</font></div>";
- }
- //以前命名的方式
- //if (!this.Page.IsPostBack)
- //{
- // ArrayList al = GetFName();
- // if (al.Count > 0)
- // {
- // this.GcglTransactor.Text = al[0].ToString() + ".doc";
- // string Fname = al[0].ToString() + DateTime.Now.Year + DateTime.Now.Month + DateTime.Now.Day + DateTime.Now.Hour + DateTime.Now.Minute + DateTime.Now.Second + ".doc";
- // if (!Util.Filecopy(path + "\" + this.GcglTransactor.Text, path + "\DocTemplateChe\" + Fname))
- // {
- // Common.RunScript(this.Page, "打开模版失败,请检查相关设置!");
- // return;
- // }
- // this.GcglTransactor.Text = Fname;
- // }
- //}
-
- //PN_Button.Visible = false;
- break;
- case 45: //主管材料汇总
- //Application.Visible = false;
- //Pn_CL_GD.Visible = false;
- //Pn_CL_HZ.Visible = false;
- //Pn_CW.Visible = false;
- //Pn_JG_JC.Visible = false;
- //Pn_WZ.Visible = false;
- //Pn_ZG_GD.Visible = false;
- ddl_nf.Enabled = false;
- ddl_jd.Enabled = false;
- GcglTransactor.Enabled = false;
- //this.BT_OpenDocument_JcCKName.Text = "浏览电子文档";
- //this.BT_OpenDocument_JcCKName.Attributes.Add("onclick", "javascript:SetLinkUrl2('DocTemplateCheChe/'+document.all('JcCKName').value);");
- //this.BT_OpenDocument_JcRKName.Text = "浏览电子文档";
- //this.BT_OpenDocument_JcRKName.Attributes.Add("onclick", "javascript:SetLinkUrl2('DocTemplateChe/'+document.all('JcRKName').value);");
- ////this.BT_OpenDocument_JcQDName.Text = "浏览电子文档";
- ////this.BT_OpenDocument_JcQDName.Attributes.Add("onclick", "javascript:SetLinkUrl2('DocTemplateChe/'+document.all('JcQDName').value);");
- ////this.BT_OpenDocument_JcHZName.Text = "浏览电子文档";
- ////this.BT_OpenDocument_JcHZName.Attributes.Add("onclick", "javascript:SetLinkUrl2('DocTemplateChe/'+document.all('JcHZName').value);");
- //this.BT_OpenDocument_CwTransactor.Text = "浏览电子文档";
- //this.BT_OpenDocument_CwTransactor.Attributes.Add("onclick", "javascript:SetLinkUrl2('DocTemplateChe/'+document.all('CwTransactor').value);");
- //this.BT_OpenDocument_WzTransatctor.Text = "浏览电子文档";
- //this.BT_OpenDocument_WzTransatctor.Attributes.Add("onclick", "javascript:SetLinkUrl2('DocTemplateChe/'+document.all('WzTransatctor').value);");
- //this.BT_OpenDocument_ZgTransactor.Text = "浏览电子文档";
- //this.BT_OpenDocument_ZgTransactor.Attributes.Add("onclick", "javascript:SetLinkUrl2('DocTemplateChe/'+document.all('ZgTransactor').value);");
- ////this.BT_OpenDocument_GcglTransactor.Text = "浏览电子文档";
- ////this.BT_OpenDocument_GcglTransactor.Attributes.Add("onclick", "javascript:SetLinkUrl('DocTemplateChe/'+document.all('GcglTransactor').value);");
- //this.BT_OpenDocument_ZgGdTransactor.Attributes.Add("onclick", "javascript:SetLinkUrl('DocTemplateChe/'+document.all('ZgGdTransactor').value);");
- dv = GetPrjchInfo(this.PrjID);
- if (dv != null && dv.Count > 0)
- {
- this.TB_ConName.Text = dv[0]["PrjchName"].ToString();
- this.TB_ConName.Enabled = false;
- this.JcCKName.Text = dv[0]["JcCKName"].ToString();
- this.JcRKName.Text = dv[0]["JcRKName"].ToString();
- //this.JcQDName.Text = dv[0]["JcQDName"].ToString();
- //this.JcHZName.Text = dv[0]["JcHZName"].ToString();
- this.CwTransactor.Text = dv[0]["CwFName"].ToString();
- this.WzTransatctor.Text = dv[0]["WzFName"].ToString();
- this.ZgTransactor.Text = dv[0]["ZgZlFName"].ToString();
- this.GcglTransactor.Text = dv[0]["GcglGdContect"].ToString();
- this.GcglFname.Text = dv[0]["GcglFname"].ToString();
- this.ddl_nf.SelectedValue = dv[0]["nf"].ToString();
- this.ddl_jd.SelectedValue = dv[0]["jd"].ToString();
- this.ShowOperatorAndTime_CWjinzhang.InnerHtml = "<div align='center'>上报人/上报时间:<font color='red'> " + dv[0]["JcTransactor"].ToString() + "</font></div>";
- this.ShowOperatorAndTime_WZmanager.InnerHtml = "<div align='center'>上报人/上报时间:<font color='red'> " + dv[0]["CwTransactor"].ToString() + "</font></div>";
- this.ShowOperatorAndTime_JGjiancha.InnerHtml = "<div align='center'>上报人/上报时间:<font color='red'> " + dv[0]["WzTransatctor"].ToString() + "</font></div>";
- this.ShowOperatorAndTime_HZmaterial.InnerHtml = "<div align='center'>上报人/上报时间:<font color='red'> " + dv[0]["ZgTransactor"].ToString() + "</font></div>";
- this.ShowOperatorAndTime_GCmanager.InnerHtml = "<div align='center'>上报人/上报时间:<font color='red'> " + dv[0]["GcglTransactor"].ToString() + "</font></div>";
- }
- if (!this.Page.IsPostBack)
- {
- al = GetFName();
- if (al.Count > 0)
- {
- this.ZgGdTransactor.Text = al[0].ToString() + ".doc";
- string Fname = al[0].ToString() + DateTime.Now.Year + DateTime.Now.Month + DateTime.Now.Day + DateTime.Now.Hour + DateTime.Now.Minute + DateTime.Now.Second + ".doc";
- if (!Util.Copyfile(path + "\" + this.ZgGdTransactor.Text, path + "\DocTemplateChe\" + Fname))
- {
- Common.RunScript(this.Page, "打开模版失败,请检查相关设置!");
- return;
- }
- this.ZgGdTransactor.Text = Fname;
- }
- }
- //PN_Button.Visible = false;
- break;
- //case 46: //主管材料归档
- // //Application.Visible = false;
- // //Pn_CL_GD.Visible = false;
- // //Pn_CL_HZ.Visible = false;
- // //Pn_CW.Visible = false;
- // //Pn_JG_JC.Visible = false;
- // //Pn_WZ.Visible = false;
- // //Pn_ZG_GD.Visible = false;
- // //this.ZgGdTransactor.Text = GetFName() + ".doc";
- // //this.GcglGdTransactor.Enabled = false;
- // ddl_nf.Enabled = false;
- // ddl_jd.Enabled = false;
- // this.BT_OpenDocument_JcCKName.Text = "浏览电子文档";
- // this.BT_OpenDocument_JcCKName.Attributes.Add("onclick", "javascript:SetLinkUrl2('DocTemplateChe/'+document.all('JcCKName').value);");
- // this.BT_OpenDocument_JcRKName.Text = "浏览电子文档";
- // this.BT_OpenDocument_JcRKName.Attributes.Add("onclick", "javascript:SetLinkUrl2('DocTemplateChe/'+document.all('JcRKName').value);");
- // this.BT_OpenDocument_JcQDName.Text = "浏览电子文档";
- // this.BT_OpenDocument_JcQDName.Attributes.Add("onclick", "javascript:SetLinkUrl2('DocTemplateChe/'+document.all('JcQDName').value);");
- // this.BT_OpenDocument_JcHZName.Text = "浏览电子文档";
- // this.BT_OpenDocument_JcHZName.Attributes.Add("onclick", "javascript:SetLinkUrl2('DocTemplateChe/'+document.all('JcHZName').value);");
- // this.BT_OpenDocument_CwTransactor.Text = "浏览电子文档";
- // this.BT_OpenDocument_CwTransactor.Attributes.Add("onclick", "javascript:SetLinkUrl2('DocTemplateChe/'+document.all('CwTransactor').value);");
- // this.BT_OpenDocument_WzTransatctor.Text = "浏览电子文档";
- // this.BT_OpenDocument_WzTransatctor.Attributes.Add("onclick", "javascript:SetLinkUrl2('DocTemplateChe/'+document.all('WzTransatctor').value);");
- // this.BT_OpenDocument_ZgTransactor.Text = "浏览电子文档";
- // this.BT_OpenDocument_ZgTransactor.Attributes.Add("onclick", "javascript:SetLinkUrl2('DocTemplateChe/'+document.all('ZgTransactor').value);");
- // this.BT_OpenDocument_GcglTransactor.Text = "浏览电子文档";
- // this.BT_OpenDocument_GcglTransactor.Attributes.Add("onclick", "javascript:SetLinkUrl('DocTemplateChe/'+document.all('GcglTransactor').value);");
- // //this.BT_OpenDocument_GcglGdTransactor.Text = "浏览电子文档";
- // //this.BT_OpenDocument_GcglGdTransactor.Attributes.Add("onclick", "javascript:SetLinkUrl(document.all('GcglGdTransactor').value);");
- // //this.BT_OpenDocument_ZgGdTransactor.Attributes.Add("onclick", "javascript:SetLinkUrl(document.all('ZgGdTransactor').value);");
- // //if (!this.Page.IsPostBack)
- // //{
- // // string Fname = GetFName() + DateTime.Now.Year + DateTime.Now.Month + DateTime.Now.Day + DateTime.Now.Hour + DateTime.Now.Minute + DateTime.Now.Second + ".doc";
- // // if (!Util.Filecopy(path + "\" + this.ZgGdTransactor.Text, path + "\DocTemplate\" + Fname))
- // // {
- // // Common.RunScript(this.Page, "打开模版失败,请检查相关设置!");
- // // return;
- // // }
- // // this.ZgGdTransactor.Text = Fname;
- // //}
- // dv = GetPrjchInfo(this.PrjID);
- // if (dv != null && dv.Count > 0)
- // {
- // this.TB_ConName.Text = dv[0]["PrjchName"].ToString();
- // this.TB_ConName.Enabled = false;
- // this.JcCKName.Text = dv[0]["JcCKName"].ToString();
- // this.JcRKName.Text = dv[0]["JcRKName"].ToString();
- // this.JcQDName.Text = dv[0]["JcQDName"].ToString();
- // this.JcHZName.Text = dv[0]["JcHZName"].ToString();
- // this.CwTransactor.Text = dv[0]["CwFName"].ToString();
- // this.WzTransatctor.Text = dv[0]["WzFName"].ToString();
- // this.ZgTransactor.Text = dv[0]["ZgZlFName"].ToString();
- // this.GcglTransactor.Text = dv[0]["GcglFName"].ToString();
- // this.ddl_nf.SelectedValue = dv[0]["nf"].ToString();
- // this.ddl_jd.SelectedValue = dv[0]["jd"].ToString();
- // //this.GcglGdTransactor.Text = dv[0]["GcglGdContect"].ToString();
- // this.ShowOperatorAndTime_CWjinzhang.InnerHtml = "<div align='center'>上报人/上报时间:<font color='red'> " + dv[0]["JcTransactor"].ToString() + "</font></div>";
- // this.ShowOperatorAndTime_WZmanager.InnerHtml = "<div align='center'>上报人/上报时间:<font color='red'> " + dv[0]["CwTransactor"].ToString() + "</font></div>";
- // this.ShowOperatorAndTime_JGjiancha.InnerHtml = "<div align='center'>上报人/上报时间:<font color='red'> " + dv[0]["WzTransatctor"].ToString() + "</font></div>";
- // this.ShowOperatorAndTime_HZmaterial.InnerHtml = "<div align='center'>上报人/上报时间:<font color='red'> " + dv[0]["ZgTransactor"].ToString() + "</font></div>";
- // this.ShowOperatorAndTime_GDmaterial.InnerHtml = "<div align='center'>上报人/上报时间:<font color='red'> " + dv[0]["GcglTransactor"].ToString() + "</font></div>";
- // //this.ShowOperatorAndTime_GCmanager.InnerHtml = "<div align='center'>上报人/上报时间:<font color='red'> " + dv[0]["GcglGdTransactor"].ToString() + "</font></div>";
- // }
- // //PN_Button.Visible = false;
- // break;
- }
- }
- }
- protected DataView GetPrjchInfo(int PrjID)
- {
- string sql = "select * from TB_PrjCheck where [PrjChID]=" + PrjID;
- DataView dv = SqlServer.GetDataView(sql);
- return dv;
- }
- protected DataView GetPrj(string PrjChName)
- {
- string sql = "select * from TB_PrjCheck where PrjChName='"+PrjChName+"'";
- DataView dv = SqlServer.GetDataView(sql);
- return dv;
- }
- /*==============================================================================================
- *
- * 审核操作
- *
- *=============================================================================================*/
- protected void BT_Pass_Click(object sender, ImageClickEventArgs e)
- {
- int startEnd = 1;//一般任务
- PrjCheck prjcheck = new PrjCheck();
- PrjChSort = prjcheck.GetEmpType(iEmpID);
- string path = Server.MapPath("doc").Replace("\", "\\"); //获取项目所在路径
- //******************************************************启动活动*************************************************************
- if (MustChooseItem == 47)
- {
- EtongZwf etongzwf = new EtongZwf();
- string Prjchname = this.TB_ConName.Text.Trim();
- DataView dv = GetPrj(Prjchname);
- if (dv.Count > 0)
- {
- Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('该项目名称已经存在!');</script>");
- return;
- }
- string year = "";
- string jd = "";
- if (ddl_nf.SelectedValue == "0")
- {
- Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('请选择年份!');</script>");
- return;
- }
- else
- {
- year = ddl_nf.SelectedValue.ToString();
- }
- if (ddl_jd.SelectedValue == "0")
- {
- Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('请选择季度!');</script>");
- return;
- }
- else
- {
- jd = ddl_jd.SelectedValue.ToString();
- }
- PrjCheckInfo prjcheckinfo = new PrjCheckInfo(PrjID, Prjchname, PrjChSort, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", 1, year, jd, "1");
- int PrjChID = prjcheck.AddPrjCheck(prjcheckinfo);
- int constructid = PrjChID;
- DateTime SuccessDate = Convert.ToDateTime(DateTime.Now.ToShortDateString().Trim());
- WFInstanceInfo wfinstanceinfo = new WFInstanceInfo(-1, Convert.ToDateTime(DateTime.Now.ToShortDateString()),
- userid, -1, -1, DateTime.Now, 3, SuccessDate, wfid, constructid);
- WFInstanceID = etongzwf.WFInstanceADD(wfinstanceinfo);
- dv = etongzwf.ColonyUserGetByActId(ActivityID);
- int CurrentRoleID = -1;
- if (dv.Count > 0)
- {
- CurrentRoleID = Convert.ToInt32(dv[0]["CurrentRoleID"].ToString().Trim());
- }
- WFActInsInfo wfactinsinfo = new WFActInsInfo(-1, ActivityID, Convert.ToDateTime(DateTime.Now.ToShortDateString()), Convert.ToDateTime(DateTime.Now.ToShortDateString()),
- 1, SuccessDate, WFInstanceID, "99", userid, CurrentRoleID);
- int j = etongzwf.WFActInsADD(wfactinsinfo);
- if (PrjChID > 0)
- {
- //WorkFlowOperation(PrjChID);
- WorkFlowOperation(PrjChID);
- }
- else
- {
- Common.RunScript(this.Page, "操作失败,请检查数据!");
- }
- }
- //******************************************************基本单位剩余材料上报*************************************************************
- if (MustChooseItem == 40)
- {
- Application.Visible = true;
- EtongZwf etongzwf = new EtongZwf();
- //string JcTransactor = sEmpName + " " + DateTime.Now.ToShortDateString() + " " + DateTime.Now.Hour + ":" + DateTime.Now.Minute;
- string JcCKName = this.JcCKName.Text; //GetFName() + DateTime.Now.Year + DateTime.Now.Month + DateTime.Now.Day + DateTime.Now.Hour + DateTime.Now.Minute + DateTime.Now.Second + ".doc";//基层单位上报物资部门报表(电子文档名称) -----待续
- string JcRKName = this.JcRKName.Text;
- string xmlname = "PrjChXML";
- string Fname="";
- //al = GetFName();
- //if (al.Count > 0)
- //{
- DataView dv=GetPrjchInfo(PrjID);
- if (dv.Count > 0)
- {
- Fname = dv[0]["JcCKName"].ToString();
- if (Fname == "")
- {
- string xmlname1 = xmlname + ".xml";//al[0].ToString() + ".xml";
- Fname = xmlname + DateTime.Now.Year + DateTime.Now.Month + DateTime.Now.Day + DateTime.Now.Hour + DateTime.Now.Minute + DateTime.Now.Second + ".xml";
- if (!Util.Copyfile(path + "\" + xmlname1, path + "\DocTemplateChe\" + Fname))
- {
- Common.RunScript(this.Page, "打开模版失败,请检查相关设置!");
- return;
- }
- }
- }
-
- string JCXMLFName = path + "\DocTemplateChe\" + Fname;
- //}
- //写入XML文档
- etongzwf.WriteXML(JCXMLFName, JcCKName, sEmpName, PrjChSort, DateTime.Now.ToShortDateString());
- etongzwf.WriteXML(JCXMLFName, JcRKName, sEmpName, PrjChSort, DateTime.Now.ToShortDateString());
- string sql = "update [tb_PrjCheck] set [JcCKName]='" + Fname +"' where [PrjChID]=" + this.PrjID;
- if (SqlServer.RunSql(sql))
- {
- dv = prjcheck.GetActinsid(PrjID, ActivityID);
- if (dv.Count > 0)
- {
- WfUpdate();
- }
- else
- WorkFlowOperation(PrjID);
- }
- else
- {
- Common.RunScript(this.Page, "操作失败,请检查数据!");
- }
- }
- //******************************************************财务报表上报*************************************************************
- if (MustChooseItem == 41)
- {
- //PrjCheck prjcheck = new PrjCheck();
- //int Status = -1;
- ActID = Convert.ToInt32(Request.QueryString["ActID"].ToString());
- EtongZwf etongzwf = new EtongZwf();
- bool flag = true;
- DataView dv = prjcheck.GetParentStatus(this.PrjID, this.ActivityID).DefaultView;
- if (dv.Count > 0)
- {
- for (int i = 0; i < dv.Count; i++)
- {
- string status = dv[i]["Status"].ToString();
- if (status != "1")
- {
- flag = false;
- }
- }
- }
- if (flag)
- {
- //string Prjchname = this.TB_ConName.Text.Trim();
- string CwTransactor = sEmpName + " " + DateTime.Now.ToShortDateString() + " " + DateTime.Now.Hour + ":" + DateTime.Now.Minute;
- string CwFName = this.CwTransactor.Text;// GetFName() + DateTime.Now.Year + DateTime.Now.Month + DateTime.Now.Day + DateTime.Now.Hour + DateTime.Now.Minute + DateTime.Now.Second + ".doc";//财务部门调整资金使用报表(电子文档名称) -----待续
- //PrjCheckInfo prjcheckinfo = new PrjCheckInfo(PrjID, Prjchname, "", JcTransactor, "", JcWFName, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", 1);
- string sql = "update [tb_PrjCheck] set [CwTransactor]='" + CwTransactor + "',[CwFName]='" + CwFName + "' where [PrjChID]=" + this.PrjID;
- if (SqlServer.RunSql(sql))
- {
- dv = prjcheck.GetActinsid(PrjID, ActivityID);
- if (dv.Count > 0)
- {
- WfUpdate();
- }
- else
- WorkFlowOperation(PrjID);
- }
- else
- {
- Common.RunScript(this.Page, "操作失败,请检查数据!");
- }
- }
- else
- Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('上级任务还未完成,不能进行下级任务!')</script>");
- }
- //******************************************************物资管理上报*************************************************************
- if (MustChooseItem == 42)
- {
-
- DataView dv = GetPrjchInfo(PrjID);
- if (dv.Count > 0)
- {
- string hzvalue=dv[0]["hz"].ToString();
- if ( hzvalue== "2")
- {
- string WzTransatctor = sEmpName + " " + DateTime.Now.ToShortDateString() + " " + DateTime.Now.Hour + ":" + DateTime.Now.Minute;
- string WzFName = this.WzTransatctor.Text; //GetFName() + DateTime.Now.Year + DateTime.Now.Month + DateTime.Now.Day + DateTime.Now.Hour + DateTime.Now.Minute + DateTime.Now.Second + ".doc"; //物资部门物资调整报表(电子文档名称) -----待续
- string sql = "update [tb_PrjCheck] set [WzTransatctor]='" + WzTransatctor + "',[WzFName]='" + WzFName + "' where [PrjChID]=" + this.PrjID;
- if (SqlServer.RunSql(sql))
- {
- dv = prjcheck.GetActinsid(PrjID, ActivityID);
- if (dv.Count > 0)
- {
- WfUpdate();
- }
- else
- WorkFlowOperation(PrjID);
- }
- else
- {
- Common.RunScript(this.Page, "操作失败,请检查数据!");
- }
- }
- else
- {
- Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('系统提示:您尚未汇总,不能审核通过!');</script>");
- return;
- }
- }
-
- }
- //******************************************************竣工检查上报*************************************************************
- if (MustChooseItem == 43)
- {
- //DataView dv=new DataView ();
- //int Status = -1;
- //if (Status == 2)
- //{
- // EtongWord EWord = new EtongWord();
- // EWord.sort = 0;
- // EWord.opSort = prjcheck.GetEmpType(iEmpID);
- // EWord.XmlNodesNames = "XMLrecord";
- // dv= GetPrjchInfo(PrjID);
- // if(dv.Count>0)
- // {
- // EWord.Address = dv[0]["ZgZlFName"].ToString();
- // }
- // ArrayList al = new ArrayList();
- // al = EWord.ReadXMLFName();
- // EtongXml alfn = (EtongXml)al[0];
- // string fname = alfn.DocFileName.ToString();
- // this.ZgTransactor.Text = fname;
- //}
- //else
- //{
- ActID = Convert.ToInt32(Request.QueryString["ActID"].ToString());
- DataView dv = prjcheck.GetStatus(ActID);
- int Status = Convert.ToInt32(dv[0]["Status"].ToString());
- if (Status == 2)
- {
- WorkFlowOperation(PrjID, "您已审核通过!");
- }
- else
- {
- ActID = Convert.ToInt32(Request.QueryString["ActID"].ToString());
- EtongZwf etongzwf = new EtongZwf();
- bool flag = true;
- dv = prjcheck.GetParentStatus(this.PrjID, this.ActivityID).DefaultView;
- if (dv.Count > 0)
- {
- for (int i = 0; i < dv.Count; i++)
- {
- string status = dv[i]["Status"].ToString();
- if (status != "1")
- {
- flag = false;
- }
- }
- }
- if (flag)
- {
- string ZgTransactor = sEmpName + " " + DateTime.Now.ToShortDateString() + " " + DateTime.Now.Hour + ":" + DateTime.Now.Minute;
- string ZgZlFName = this.ZgTransactor.Text;
- string xmlname = "PrjChZGXML";
- string Fname = "";
- dv = GetPrjchInfo(PrjID);//判断文件是否存在
- if (dv.Count > 0)
- {
- Fname = dv[0]["ZgZlFName"].ToString();
- if (Fname == "")
- {
- string xmlname1 = xmlname + ".xml";//al[0].ToString() + ".xml";
- Fname = xmlname + DateTime.Now.Year + DateTime.Now.Month + DateTime.Now.Day + DateTime.Now.Hour + DateTime.Now.Minute + DateTime.Now.Second + ".xml";
- if (!Util.Copyfile(path + "\" + xmlname1, path + "\DocTemplateChe\" + Fname))
- {
- Common.RunScript(this.Page, "打开模版失败,请检查相关设置!");
- return;
- }
- }
- }
- string ZGXMLFName = path + "\DocTemplateChe\" + Fname;
- //写入XML文档
- etongzwf.WriteXML(ZGXMLFName, ZgZlFName, sEmpName, PrjChSort, DateTime.Now.ToShortDateString());
- string sql = "update [tb_PrjCheck] set [ZgZlFName]='" + Fname + "' where [PrjChID]=" + this.PrjID;
- if (SqlServer.RunSql(sql))
- {
- dv = prjcheck.GetActinsid(PrjID, ActivityID);
- if (dv.Count > 0)
- {
- WfUpdate();
- }
- else
- WorkFlowOperation(PrjID, "您已审核通过!");
- }
- else
- {
- Common.RunScript(this.Page, "操作失败,请检查数据!");
- }
- }
- else
- Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('上级任务还未完成,不能进行下级任务!')</script>");
- }
- }
- //******************************************************工程管理办公室材料归档*************************************************************
- if (MustChooseItem == 44)
- {
- if (this.GcglFname.Text == "")
- {
- Page.ClientScript.RegisterStartupScript(GetType(),"","<script>alert('请先汇总!');</script>");
- return;
- }
- //string Prjchname = this.TB_ConName.Text.Trim();
- string GcglTransactor = sEmpName + " " + DateTime.Now.ToShortDateString() + " " + DateTime.Now.Hour + ":" + DateTime.Now.Minute;
- string GcglContect = this.GcglTransactor.Text.Trim().ToString();
- string gcglfname = this.GcglFname.Text.Trim().ToString();
- //string GcglGdContect = GetFName() + DateTime.Now.Year + DateTime.Now.Month + DateTime.Now.Day + DateTime.Now.Hour + DateTime.Now.Minute + DateTime.Now.Second + ".doc"; //工程管理办公室材料报表汇总(电子文档名称) -----待续
- string sql = "update [tb_PrjCheck] set [GcglTransactor]='" + GcglTransactor + "',[GcglFName]='" + gcglfname + "',[GcglGdContect]='" + GcglContect + "' where [PrjChID]=" + this.PrjID;
- if (SqlServer.RunSql(sql))
- {
- WorkFlowOperation(PrjID);
- }
- else
- {
- Common.RunScript(this.Page, "操作失败,请检查数据!");
- }
- }
- //******************************************************主管材料报表汇总*************************************************************
- if (MustChooseItem == 45)
- {
- EtongFlyChouWFPrj flywfprj = new EtongFlyChouWFPrj();
- EtongZwf etongzwf = new EtongZwf();
- string ZgGdTransactor = sEmpName + " " + DateTime.Now.ToShortDateString() + " " + DateTime.Now.Hour + ":" + DateTime.Now.Minute;
- string ZgGdContect = this.ZgGdTransactor.Text;
- string xmlname = "PrjChZGHZXML";
- string Fname = "";
- DataView dv = GetPrjchInfo(PrjID);//判断文件是否存在
- if (dv.Count > 0)
- {
- Fname = dv[0]["ZgGdContect"].ToString();
- if (Fname == "")
- {
- string xmlname1 = xmlname + ".xml";//al[0].ToString() + ".xml";
- Fname = xmlname + DateTime.Now.Year + DateTime.Now.Month + DateTime.Now.Day + DateTime.Now.Hour + DateTime.Now.Minute + DateTime.Now.Second + ".xml";
- if (!Util.Copyfile(path + "\" + xmlname1, path + "\DocTemplateChe\" + Fname))
- {
- Common.RunScript(this.Page, "打开模版失败,请检查相关设置!");
- return;
- }
- }
- }
- string ZGHZXMLFName = path + "\DocTemplateChe\" + Fname;
- //写入XML文档
- etongzwf.WriteXML(ZGHZXMLFName, ZgGdContect, sEmpName, PrjChSort, DateTime.Now.ToShortDateString());
- string sql = "update [tb_PrjCheck] set [ZgGdContect]='" + Fname + "' where [PrjChID]=" + this.PrjID;
-
- if (SqlServer.RunSql(sql))
- {
- sql = "select [StartEnd] from [tb_WF_Activity] where [ActivityID]=" + ActivityID;
- dv = SqlServer.GetDataView(sql);
- if (dv.Count > 0)
- {
- startEnd = Convert.ToInt32(dv[0]["StartEnd"].ToString());
- if (startEnd == 2)//最终任务
- {
- WorkFolw workflow = new WorkFolw();
- string ActIDtxt = Request.QueryString["ActID"].ToString().Trim();
- ActID = Convert.ToInt32(ActIDtxt);
- bool returnvalue2 = workflow.WFActInsUpdata(ActID, 1, userid);
- flywfprj.sID = ActID;
- flywfprj.PrjID = PrjID;
- flywfprj.wID = wfid;
- flywfprj.iStatus = 3;
- bool returnvalue = flywfprj.CheckUpActComplete();
- if (returnvalue)
- {
- bool returnvalue3 = prjcheck.UpDatePrjch(PrjID);
- string script = "<script language='javascript'>alert('系统提示:您已审核通过,本工程项目验收流程结束!');top.location.href='../Main.aspx';</script>";
- Common.RunScriptString(this.Page, script);
- }
- else
- {
- string script = "<script language='javascript'>alert('系统提示:您已审核通过!');top.location.href='../Main.aspx';</script>";
- Common.RunScriptString(this.Page, script);
- }
- }
- }
- else
- {
- WorkFlowOperation(PrjID, "您已审核通过!");
- }
- }
- else
- {
- Common.RunScript(this.Page, "操作失败,请检查数据!");
- }
- }
- //if (MustChooseItem == 46)
- //{
- // string ZgGdTransactor = sEmpName + " " + DateTime.Now.ToShortDateString() + " " + DateTime.Now.Hour + ":" + DateTime.Now.Minute;
- // string ZgGdContect = this.ZgGdTransactor.Text.Trim().ToString();
- // //string ZgGdContect = GetFName() + DateTime.Now.Year + DateTime.Now.Month + DateTime.Now.Day + DateTime.Now.Hour + DateTime.Now.Minute + DateTime.Now.Second + ".doc"; //工程管理办公室材料报表汇总(电子文档名称) -----待续
- // string sql = "update [tb_PrjCheck] set [ZgGdTransactor]='" + ZgGdTransactor + "',[ZgGdContect]='" + ZgGdContect + "' where [PrjChID]=" + this.PrjID;
- // if (SqlServer.RunSql(sql))
- // {
- // 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)//最终任务
- // {
- // WorkFolw workflow = new WorkFolw();
- // string ActIDtxt = Request.QueryString["ActID"].ToString().Trim();
- // ActID = Convert.ToInt32(ActIDtxt);
- // bool returnvalue = workflow.WFActInsUpdata(ActID, 1, userid);
- // bool returnvalue2 = prjcheck.UpDatePrjch(PrjID);
- // string script = "<script language='javascript'>alert('系统提示:您已审核通过,本工程项目验收流程结束!');top.location.href='../Main.aspx';</script>";
- // Common.RunScriptString(this.Page, script);
- // }
- // }
- // else
- // {
- // WorkFlowOperation(PrjID, "您已审核通过,本工程项目验收流程结束!");
- // }
- // }
- // else
- // {
- // Common.RunScript(this.Page, "操作失败,请检查数据!");
- // }
- //}
- }
- /*==============================================================================================
- *
- * 回退操作
- *
- *=============================================================================================*/
- protected void BT_Untread_Click(object sender, ImageClickEventArgs e)
- {
- string ActIDtxt = Request.QueryString["ActID"].ToString().Trim();
- ActID = Convert.ToInt32(ActIDtxt);
- Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>UserDialog('" + ActID + "','" + WFInstanceID + "','" + userid + "','" + PrjID+"');</script>");
- return;
-
- //EtongZwf etongzwf = new EtongZwf();
- //PrjCheck prjcheck = new PrjCheck();
- //bool ReActInsValue = false;
- //ReActInsValue = etongzwf.WFActInsUpdata(ActID, userid, 3);
- //if (ReActInsValue == true)
- //{
- // //产生回退活动事例
- // // 注:Status状态(0、正常;1、完成;2、回退;3、回退并完成;4、作废)
- // int ReActInsValue2 = 0;
- // DataView dvAct = prjcheck.GetByActInsId(ActID,PrjID);
- // // DataView dvAct = etongzwf.ColonyUserGetByAct(ActivityID);
- // int PreviousActID = -1;
- // int PreviousUserID = -1;
- // int PreviousRoleID = -1;
- // if (dvAct != null)
- // {
- // PreviousActID = Convert.ToInt16(dvAct[0]["PreviousActID"].ToString().Trim());
- // PreviousUserID = Convert.ToInt16(dvAct[0]["PreviousUserID"].ToString().Trim());
- // PreviousRoleID = Convert.ToInt16(dvAct[0]["PreviousRoleID"].ToString().Trim());
- // }
- // WFActInsInfo wfactinsinfo2 = new WFActInsInfo(-1, PreviousActID, Convert.ToDateTime(DateTime.Now.ToShortDateString()), Convert.ToDateTime(DateTime.Now.ToShortDateString()),
- // 2, Convert.ToDateTime(DateTime.Now.ToShortDateString()), WFInstanceID, "", PreviousUserID, PreviousRoleID);
- // ReActInsValue2 = etongzwf.WFActInsADD(wfactinsinfo2);
- // if (ReActInsValue2 != 0)
- // 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_Revoke_Click(object sender, ImageClickEventArgs e)
- {
- }
- /*=====================================================================================================
- *
- * 工作流操作,分3步
- * 1.产生工作流实例纪录,注意constructid必须真实存在
- * 2.更新当前活动实例状态 由WFInstADD中的WFActInsUpdata执行
- * 3.产生新的工作流实例纪录,即产生下一个活动实例并提交到下一个部门的用户申核,由NextColonyRole操作完成
- *
- *====================================================================================================*/
- protected void WorkFlowOperation(int constructid, string showmessage)
- {
- EtongZwf etongzwf = new EtongZwf();
- ProjectImplment projectImplment = new ProjectImplment();
- PrjCheck prjcheck = new PrjCheck();
- WorkFolw workflow = new WorkFolw();
- int CurrentRoleID = -1;
- int ParentActID = -1;
- int ParentRoleID = -1;
- DataView dv = etongzwf.ColonyUserGetByActId(ActivityID);//根据当前活动id获取当前部门与上级角色
- //if (dv.Count > 0)
- //{
- // ParentRoleID = Convert.ToInt32(dv[0]["ParentRoleID"].ToString().Trim());
- // ////DataView dvRoleName = etongzwf.RoleGetName(ParentRoleID);
- // //DataTable dt = prjcheck.GetOpid(ParentRoleID);
- // //if (dt.Rows.Count == 0)
- // //{
- // // ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('系统提示:项目验收停滞,没有上级申核人!(请联系相关部门或系统管理员)');</script>");
- // // return;
- // //}
- //}
- 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, 3, SuccessDate, wfid, constructid);
- //int ReInstanceValue = etongzwf.WFInstanceADD(wfinstanceinfo);
- ////产生当前工作流实例ID
- //WFInstanceID = ReInstanceValue;
- //if (WFInstanceID > 0)
- //{
- string nextCheckDepartment = null;
- if (dv.Count > 0)
- {
- CurrentRoleID = Convert.ToInt32(dv[0]["CurrentRoleID"].ToString().Trim());
- ParentActID = Convert.ToInt32(dv[0]["ParentActID"].ToString().Trim());
- ParentRoleID = Convert.ToInt32(dv[0]["ParentRoleID"].ToString().Trim());
- }
- //产生当前活动实例 如果是不是第一个活动,只需 修改 UserID 和 Status
- int ReActInsValue = 0;
- if (MustChooseItem == 40)//对起始活动的操作
- {
- 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);
- DataTable dt = prjcheck.GetOpid(ParentRoleID);
- if (dt.Rows.Count > 0)
- {
- nextCheckDepartment = dt.Rows[0]["OpName"].ToString();
- }
- NextColonyRole(ParentActID, ParentRoleID, showmessage, nextCheckDepartment, 0);//提交给下一部门用户审核
- }
- else//对不是起始活动的操作
- {
- string ActIDtxt = Request.QueryString["ActID"].ToString().Trim();
- ActID = Convert.ToInt32(ActIDtxt);
- bool returnvalue = false;
- returnvalue = workflow.WFActInsUpdata(ActID, 1, userid);
- if (returnvalue == true)
- ReActInsValue = ActID;
- if (ReActInsValue > 0)
- {
- if (ParentActID != -1)
- {
- DataTable dt = prjcheck.GetOpid(ParentRoleID);
- nextCheckDepartment = dt.Rows[0]["OpName"].ToString();
- NextColonyRole(ParentActID, ParentRoleID, showmessage, nextCheckDepartment, 0); //(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 void NextColonyRole(int ParentActID, int ParentRoleID, string showMessage, string nextCheckDepartment, int count)
- {
- EtongZwf etongzwf = new EtongZwf();
- string orgsort = EtongZwf.GetOpRole(ParentRoleID);
- //Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('" + orgsort + "');</script>");
- //return;
- //if (MustChooseItem == 41 || MustChooseItem == 42)
- //{
- WFActInsInfo wfactinsinfo = new WFActInsInfo(-1, ParentActID, Convert.ToDateTime(DateTime.Now.ToShortDateString()), Convert.ToDateTime(DateTime.Now.ToShortDateString()),
- 0, Convert.ToDateTime(DateTime.Now.ToShortDateString()), WFInstanceID, orgsort, -1, ParentRoleID);
- int ReActInsValue = etongzwf.WFActInsADD(wfactinsinfo);
- string returnvalue = this.txt_LDid.Value + nextCheckDepartment + ",";
- this.txt_LDid.Value = returnvalue;
- if (count == 0)
- {
- if (ReActInsValue > 0)
- {
- ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('系统提示:" + showMessage + ",转到『" + this.txt_LDid.Value + "』申核处理!');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 constructid)
- {
- EtongZwf etongzwf = new EtongZwf();
- ProjectImplment projectImplment = new ProjectImplment();
- PrjCheck prjcheck = new PrjCheck();
- DateTime SuccessDate = Convert.ToDateTime(DateTime.Now.ToShortDateString().Trim());
- DataView dv = etongzwf.ColonyUserGetByActId(ActivityID);
- if (dv.Count > 0)
- {
- SuccessDate = Convert.ToDateTime(DateTime.Now.ToShortDateString().Trim());
- for (int i = 0,j=dv.Count-1; i < dv.Count; i++,j--)//并行循环
- {
- 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="";
- try
- {
- ActIDtxt = Request.QueryString["ActID"].ToString().Trim();
- }
- catch
- {
- ActIDtxt = Request.QueryString["ActivityID"].ToString().Trim();
- }
- ActID = Convert.ToInt32(ActIDtxt);
- bool returnvalue = false;
- //产生当前活动实例 如果是不是第一个活动,只需 修改 UserID 和 Status
- int ReActInsValue = 0;
- string nextCheckDepartment = null;
- //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();
- // PrjCheck prjcheck = new PrjCheck();
- DataTable dt = prjcheck.GetOpid(ParentRoleID);
- nextCheckDepartment =dt.Rows[0]["OpName"].ToString();
- NextColonyRole(ParentActID, ParentRoleID, "您已审核通过", nextCheckDepartment, j); //(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>");
- return;
- }
- else
- {
- ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('系统提示:操作失败!');top.location.href='../Main.aspx';</script>");
- return;
- }
- }
- }
- }
- }
- //NextColonyRole(ParentActID, ParentRoleID, "您已审核通过", nextCheckDepartment); //(ReActInsValue); //产生下一个活动实例并提交到下一个角色的用户申核
- }
- }
- /*=====================================================================================================
- *
- * 并行下的活动
- * 1.产生工作流实例纪录,注意constructid必须真实存在
- * 2.更新当前活动实例状态 由WFInstADD中的WFActInsUpdata执行(不产生新的活动)
- *
- *====================================================================================================*/
- public void WfUpdate()
- {
- string ActIDtxt = Request.QueryString["ActID"].ToString().Trim();
- ActID = Convert.ToInt32(ActIDtxt);
- WorkFolw workflow = new WorkFolw();
- EtongZwf etongzwf = new EtongZwf();
- PrjCheck prjcheck = new PrjCheck();
- string nextCheckDepartment = "";
- bool returnvalue=workflow.WFActInsUpdata(ActID, 1, userid);//修改actins 表
- if (returnvalue)
- {
- int ActivityID = Convert.ToInt32(Request.QueryString["ActivityID"].ToString().Trim());
- DataView dv = etongzwf.ColonyUserGetByActId(ActivityID);
- if (dv.Count > 0)
- {
- for (int i = 0; i < dv.Count; i++)
- {
- int ParentRoleID = Convert.ToInt32(dv[i]["ParentRoleID"].ToString().Trim());
- DataTable dt = prjcheck.GetOpid(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>");
- }
- }
- /*=====================================================================================================
- *
- *取相关文档名称
- *
- *====================================================================================================*/
- protected ArrayList GetFName()
- {
- PrjCheck prjcheck = new PrjCheck();
- DataView dvFN = prjcheck.GetSFileName(ActivityID);
- ArrayList cklist=new ArrayList ();
- int starti;
- if (dvFN.Count > 0)
- {
- for (int i = 0; i < dvFN.Count; i++)
- {
- string JcFName = dvFN[i]["FName"].ToString().Trim(); //工程项目预算表(电子文档)
- starti = JcFName.Length - (JcFName.Split('\').GetValue(JcFName.Split('\').Length - 1)).ToString().Length;
- JcFName = JcFName.Substring(starti, JcFName.Length - starti - 4);
- cklist.Add(JcFName);
- }
- }
- return cklist;
- }
- protected void huizong_Click(object sender, EventArgs e)
- {
- int Status = -1;
- ActID = Convert.ToInt32(Request.QueryString["ActID"].ToString());
- EtongZwf etongzwf = new EtongZwf();
- bool flag = true;
- PrjCheck prjcheck = new PrjCheck();
- DataView dv = prjcheck.GetParentStatus(this.PrjID, this.ActivityID).DefaultView;
- if (dv.Count > 0)
- {
- for (int i = 0; i < dv.Count; i++)
- {
- string status = dv[i]["Status"].ToString();
- if (status != "1")
- {
- flag = false;
- }
- }
- }
- if (flag)
- {
- string path = Server.MapPath("doc").Replace("\", "\\") + "\\DocTemplateChe\\";
- string filename = path + this.WzTransatctor.Text;
- MyDocMerger objMerger = new MyDocMerger();
- dv = prjcheck.GetWord(PrjID);
- if (dv.Count > 0)
- {
- EtongWord EWord = new EtongWord();
- EWord.sort = -1;
- EWord.opSort = "99";
- EWord.XmlNodesNames = "XMLrecord";
- EWord.Address = path + dv[0]["JcCKName"].ToString();
- ArrayList al = new ArrayList();
- al = EWord.ReadXMLFName();
- if (al.Count > 0)
- {
- string[] afile = new string[al.Count / 2];
- //afile[0] = path + dv[0]["JcCKName"].ToString();
- for (int i = 1, j = 0; i < al.Count; i = i + 2, j++)
- {
- EtongXml alfn = (EtongXml)al[i];
- afile[j] = path + alfn.DocFileName.ToString();
- if (!System.IO.File.Exists(afile[j]))
- {
- Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('相关文件不存在!');</script>");
- return;
- }
- }
- objMerger.MergeDocArray(filename, afile, filename);
- }
- //al.Clear();
- int returnvalue1 = prjcheck.UpdateHZ(Convert.ToInt32(dv[0]["PrjChID"].ToString()));
- if (returnvalue1 == -1)
- {
- Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('系统提示:汇总失败!');</script>");
- return;
- }
- else
- {
- Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('系统提示:汇总成功!');</script>");
- return;
- }
- }
- else
- {
- Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('系统提示:此项已经汇总!');</script>");
- return;
- }
- }
- else
- Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('上级任务还未完成,不能进行下级任务!')</script>");
- }
- protected void zghuizong_Click(object sender, EventArgs e)
- {
- ActID = Convert.ToInt32(Request.QueryString["ActID"].ToString().Trim());
- EtongFlyChouWFPrj flywfprj = new EtongFlyChouWFPrj();
- flywfprj.sID = ActID;
- flywfprj.PrjID = this.PrjID;
- flywfprj.wID = wfid;
- flywfprj.iStatus= 3;
- bool returnvalue = flywfprj.CheckUpActComplete();
- if (!returnvalue)
- {
- Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('上级任务还未完成,不能进行文档汇总!')</script>");
- return;
- }
- string path = Server.MapPath("doc").Replace("\", "\\");
- ArrayList al = GetFName();
- if (al.Count > 0)
- {
- this.GcglFname.Text = al[0].ToString() + ".doc";
- string Fname = al[0].ToString() + DateTime.Now.Year + DateTime.Now.Month + DateTime.Now.Day + DateTime.Now.Hour + DateTime.Now.Minute + DateTime.Now.Second + ".doc";
- if (!Util.Copyfile(path + "\" + this.GcglFname.Text, path + "\DocTemplateChe\" + Fname))
- {
- Common.RunScript(this.Page, "打开模版失败,请检查相关设置!");
- return;
- }
- this.GcglFname.Text = Fname;
- }
- path = Server.MapPath("doc").Replace("\", "\\") + "\\DocTemplateChe\\";
- PrjCheck prjcheck = new PrjCheck();
- string filename = path + this.GcglFname.Text;
- MyDocMerger objMerger = new MyDocMerger();
- DataView dv = GetPrjchInfo(PrjID);
- if (dv.Count > 0)
- {
- EtongWord EWord = new EtongWord();
- EWord.sort = -1;
- EWord.opSort = "99";
- EWord.XmlNodesNames = "XMLrecord";
- EWord.Address = path + dv[0]["ZgZlFName"].ToString();
- al = EWord.ReadXMLFName();
- if (al.Count > 0)
- {
- string[] afile = new string[al.Count];
- //afile[0] = path + dv[0]["JcCKName"].ToString();
- for (int i = 0; i < al.Count; i++)
- {
- EtongXml alfn = (EtongXml)al[i];
- afile[i] = path + alfn.DocFileName.ToString();
- if (!System.IO.File.Exists(afile[i]))
- {
- Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('相关文件不存在!');</script>");
- return;
- }
- }
- objMerger.MergeDocArray(filename, afile, filename);
- Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('系统提示:汇总成功!');</script>");
- return;
- }
- }
- else
- {
- Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('系统提示:汇总失败!');</script>");
- return;
- }
- }
- }