示例#1
0
        /// <summary>
        /// view work.
        /// </summary>
        public void BindTrack_ViewWork()
        {
            string appPath = this.Request.ApplicationPath;
            Track  tk      = new Track(this.FK_Flow, this.MyPK);
            Node   nd      = new Node(tk.NDFrom);
            Work   wk      = nd.HisWork;

            wk.OID = tk.WorkID;
            if (wk.RetrieveFromDBSources() == 0)
            {
                this.UCEn1.AddFieldSet("打开(" + nd.Name + ")错误");
                this.UCEn1.AddH1("当前的节点数据已经被删除!!!<br> 造成此问题出现的原因如下。");
                this.UCEn1.AddBR("1、当前节点数据被非法删除。");
                this.UCEn1.AddBR("2、节点数据是退回人与被退回人中间的节点,这部分节点数据查看不支持。");
                this.UCEn1.AddFieldSetEnd();
                return;
            }

            GenerWorkFlow gwf = new GenerWorkFlow();

            gwf.WorkID = wk.OID;
            if (gwf.RetrieveFromDBSources() == 0)
            {
            }
            else
            {
                if (gwf.FK_Node == wk.NodeID)
                {
                    this.UCEn1.AddFieldSet(wk.EnDesc);
                    this.UCEn1.AddH1("当工作(" + nd.Name + ")未完成,您不能查看它的工作日志。");
                    this.UCEn1.AddFieldSetEnd();
                    return;
                }
            }

            if (nd.HisFlow.IsMD5 && wk.IsPassCheckMD5() == false)
            {
                this.UCEn1.AddFieldSet("打开(" + nd.Name + ")错误");
                this.UCEn1.AddH1("当前的节点数据已经被篡改,请报告管理员。");
                this.UCEn1.AddFieldSetEnd();
                return;
            }

            this.UCEn1.IsReadonly = true;
            Frms frms = nd.HisFrms;

            if (frms.Count == 0)
            {
                if (nd.HisFormType == FormType.FreeForm)
                {
                    /* 自由表单 */
                    this.UCEn1.Add("<div id=divCCForm >");
                    this.UCEn1.BindCCForm(wk, "ND" + nd.NodeID, true); //, false, false, null);
                    if (wk.WorkEndInfo.Length > 2)
                    {
                        this.UCEn1.Add(wk.WorkEndInfo);
                    }
                    this.UCEn1.Add("</div>");
                }

                if (nd.HisFormType == FormType.FixForm)
                {
                    /*傻瓜表单*/
                    this.UCEn1.IsReadonly = true;
                    this.UCEn1.BindColumn4(wk, "ND" + nd.NodeID); //, false, false, null);
                    if (wk.WorkEndInfo.Length > 2)
                    {
                        this.UCEn1.Add(wk.WorkEndInfo);
                    }
                }

                BillTemplates bills = new BillTemplates();
                bills.Retrieve(BillTemplateAttr.NodeID, nd.NodeID);
                if (bills.Count >= 1)
                {
                    string title = "";
                    foreach (BillTemplate item in bills)
                    {
                        title += "<img src='/WF/Img/Btn/Word.gif' border=0/>" + item.Name + "</a>";
                    }

                    string urlr = appPath + "WF/WorkOpt/PrintDoc.aspx?FK_Node=" + nd.NodeID + "&FID=" + tk.FID + "&WorkID=" + tk.WorkID + "&FK_Flow=" + tk.FK_Flow;
                    this.UCEn1.Add("<p><a  href=\"javascript:WinOpen('" + urlr + "','dsdd');\"  />" + title + "</a></p>");
                    //this.UCEn1.Add("<a href='' target=_blank><img src='/WF/Img/Btn/Word.gif' border=0/>" + bt.Name + "</a>");
                }
            }
            else
            {
                /* 涉及到多个表单的情况...*/
                if (nd.HisFormType != FormType.DisableIt)
                {
                    Frm myfrm = new Frm();
                    myfrm.No          = "ND" + nd.NodeID;
                    myfrm.Name        = wk.EnDesc;
                    myfrm.HisFormType = nd.HisFormType;

                    FrmNode fnNode = new FrmNode();
                    fnNode.FK_Frm  = myfrm.No;
                    fnNode.IsEdit  = true;
                    fnNode.IsPrint = false;
                    switch (nd.HisFormType)
                    {
                    case FormType.FixForm:
                        fnNode.HisFrmType = FrmType.Column4Frm;
                        break;

                    case FormType.FreeForm:
                        fnNode.HisFrmType = FrmType.CCForm;
                        break;

                    case FormType.SelfForm:
                        fnNode.HisFrmType = FrmType.Url;
                        break;

                    default:
                        throw new Exception("出现了未判断的异常。");
                    }
                    myfrm.HisFrmNode = fnNode;
                    frms.AddEntity(myfrm, 0);
                }

                Int64 fid = this.FID;
                if (this.FID == 0)
                {
                    fid = tk.WorkID;
                }

                if (frms.Count == 1)
                {
                    /* 如果禁用了节点表单,并且只有一个表单的情况。*/
                    Frm     frm = (Frm)frms[0];
                    FrmNode fn  = frm.HisFrmNode;
                    string  src = "";
                    src = fn.FrmUrl + ".aspx?FK_MapData=" + frm.No + "&FID=" + fid + "&IsEdit=0&IsPrint=0&FK_Node=" + nd.NodeID + "&WorkID=" + tk.WorkID;
                    this.UCEn1.Add("\t\n <DIV id='" + frm.No + "' style='width:" + frm.FrmW + "px; height:" + frm.FrmH + "px;text-align: left;' >");
                    this.UCEn1.Add("\t\n <iframe ID='F" + frm.No + "' src='" + src + "' frameborder=0  style='position:absolute;width:" + frm.FrmW + "px; height:" + frm.FrmH + "px;text-align: left;'  leftMargin='0'  topMargin='0'  /></iframe>");
                    this.UCEn1.Add("\t\n </DIV>");
                }
                else
                {
                    #region 载入相关文件.
                    this.Page.RegisterClientScriptBlock("sg",
                                                        "<link href='./Style/Frm/Tab.css' rel='stylesheet' type='text/css' />");

                    this.Page.RegisterClientScriptBlock("s2g4",
                                                        "<script language='JavaScript' src='./Style/Frm/jquery.min.js' ></script>");

                    this.Page.RegisterClientScriptBlock("sdf24j",
                                                        "<script language='JavaScript' src='./Style/Frm/jquery.idTabs.min.js' ></script>");

                    this.Page.RegisterClientScriptBlock("sdsdf24j",
                                                        "<script language='JavaScript' src='./Style/Frm/TabClick.js' ></script>");
                    #endregion 载入相关文件.

                    this.UCEn1.Clear();
                    this.UCEn1.Add("<div  style='clear:both' ></div>");
                    this.UCEn1.Add("\t\n<div  id='usual2' class='usual' >");  //begain.

                    #region 输出标签.
                    this.UCEn1.Add("\t\n <ul  class='abc' style='background:red;border-color: #800000;border-width: 10px;' >");
                    foreach (Frm frm in frms)
                    {
                        FrmNode fn  = frm.HisFrmNode;
                        string  src = "";
                        src = fn.FrmUrl + ".aspx?FK_MapData=" + frm.No + "&FID=" + fid + "&IsEdit=0&IsPrint=0&FK_Node=" + nd.NodeID + "&WorkID=" + tk.WorkID;
                        this.UCEn1.Add("\t\n<li><a href=\"#" + frm.No + "\" onclick=\"TabClick('" + frm.No + "','" + src + "');\" >" + frm.Name + "</a></li>");
                    }
                    this.UCEn1.Add("\t\n </ul>");
                    #endregion 输出标签.

                    #region 输出表单 iframe 内容.
                    foreach (Frm frm in frms)
                    {
                        FrmNode fn = frm.HisFrmNode;
                        this.UCEn1.Add("\t\n <DIV id='" + frm.No + "' style='width:" + frm.FrmW + "px; height:" + frm.FrmH + "px;text-align: left;' >");
                        string src = "loading.htm";
                        this.UCEn1.Add("\t\n <iframe ID='F" + frm.No + "' src='" + src + "' frameborder=0  style='position:absolute;width:" + frm.FrmW + "px; height:" + frm.FrmH + "px;text-align: left;'  leftMargin='0'  topMargin='0'   /></iframe>");
                        this.UCEn1.Add("\t\n </DIV>");
                    }
                    #endregion 输出表单 iframe 内容.

                    this.UCEn1.Add("\t\n</div>"); // end  usual2

                    // 设置选择的默认值.
                    this.UCEn1.Add("\t\n<script type='text/javascript'>");
                    this.UCEn1.Add("\t\n  $(\"#usual2 ul\").idTabs(\"" + frms[0].No + "\");");
                    this.UCEn1.Add("\t\n</script>");
                }
            }
        }
        /// <summary>
        /// 打开工作处理器,仅仅查看,不能修改。
        /// </summary>
        public void BindTrack_ViewWorkForm()
        {
            string appPath = this.Request.ApplicationPath;
            Node   nd      = null;
            Track  tk      = new Track();

            tk.FK_Flow = this.FK_Flow;
            tk.NDFrom  = this.FK_Node;

            tk.WorkID = this.WorkID;
            if (this.MyPK != null)
            {
                tk = new Track(this.FK_Flow, this.MyPK);
                nd = new Node(tk.NDFrom);
            }
            else
            {
                nd = new Node(this.FK_Node);
            }

            Flow  fl     = new Flow(this.FK_Flow);
            Int64 workid = 0;

            if (nd.HisRunModel == RunModel.SubThread)
            {
                workid = tk.FID;
            }
            else
            {
                workid = tk.WorkID;
            }

            Int64 fid = this.FID;

            if (this.FID == 0)
            {
                fid = tk.FID;
            }

            DataTable ndrpt = DBAccess.RunSQLReturnTable("SELECT PFlowNo,PWorkID FROM " + fl.PTable + " WHERE OID=" + workid);

            string urlExt = "&PFlowNo=" + ndrpt.Rows[0]["PFlowNo"] + "&PWorkID=" + ndrpt.Rows[0]["PWorkID"] + "&IsToobar=0&IsHidden=true";

            urlExt += "&From=CCFlow&TruckKey=" + tk.GetValStrByKey("MyPK");

            if (nd.HisFormType == NodeFormType.SDKForm || nd.HisFormType == NodeFormType.SelfForm)
            {
                if (nd.FormUrl.Contains("?"))
                {
                    this.Response.Redirect(nd.FormUrl + "&WorkID=" + tk.WorkID + "&FK_Node=" + nd.NodeID + "&FK_Flow=" + nd.FK_Flow + "&FID=" + fid + urlExt, true);
                }
                else
                {
                    this.Response.Redirect(nd.FormUrl + "?WorkID=" + tk.WorkID + "&FK_Node=" + nd.NodeID + "&FK_Flow=" + nd.FK_Flow + "&FID=" + fid + urlExt, true);
                }

                if (nd.HisFormType == NodeFormType.SDKForm)
                {
                    if (nd.FormUrl.Contains("?"))
                    {
                        this.Response.Redirect(nd.FormUrl + "&WorkID=" + tk.WorkID + "&FK_Node=" + nd.NodeID + "&FK_Flow=" + nd.FK_Flow + "&FID=" + fid + urlExt, true);
                    }
                    else
                    {
                        this.Response.Redirect(nd.FormUrl + "?WorkID=" + tk.WorkID + "&FK_Node=" + nd.NodeID + "&FK_Flow=" + nd.FK_Flow + "&FID=" + fid + urlExt, true);
                    }
                    return;
                }

                this.Response.Redirect(nd.FormUrl + "&WorkID=" + tk.WorkID + "&FK_Node=" + nd.NodeID + "&FK_Flow=" + nd.FK_Flow + "&FID=" + fid + urlExt, true);
                return;
            }

            Work wk = nd.HisWork;

            wk.OID = tk.WorkID;
            if (wk.RetrieveFromDBSources() == 0)
            {
                GERpt rtp = nd.HisFlow.HisGERpt;
                rtp.OID = this.WorkID;
                if (rtp.RetrieveFromDBSources() == 0)
                {
                    this.UCEn1.AddFieldSet("打开(" + nd.Name + ")错误");
                    this.UCEn1.AddH1("当前的节点数据已经被删除!!!<br> 造成此问题出现的原因如下。");
                    this.UCEn1.AddBR("1、当前节点数据被非法删除。");
                    this.UCEn1.AddBR("2、节点数据是退回人与被退回人中间的节点,这部分节点数据查看不支持。");
                    this.UCEn1.AddH1("技术信息:表" + wk.EnMap.PhysicsTable + " WorkID=" + this.WorkID);
                    this.UCEn1.AddFieldSetEnd();
                    return;
                }
                wk.Row = rtp.Row;
            }

            GenerWorkFlow gwf = new GenerWorkFlow();

            gwf.WorkID = wk.OID;

            if (nd.HisFlow.IsMD5 && wk.IsPassCheckMD5() == false)
            {
                this.UCEn1.AddFieldSet("打开(" + nd.Name + ")错误");
                this.UCEn1.AddH1("当前的节点数据已经被篡改,请报告管理员。");
                this.UCEn1.AddFieldSetEnd();
                return;
            }
            this.InitToolbar(false, appPath);
            this.UCEn1.IsReadonly = true;
            Frms frms = nd.HisFrms;

            if (frms.Count == 0)
            {
                if (nd.HisFormType == NodeFormType.FreeForm)
                {
                    MapData map = new MapData(nd.NodeFrmID);
                    /* 自由表单 */
                    Width = map.MaxRight + map.MaxLeft * 2 + 10 + "";
                    if (float.Parse(Width) < 500)
                    {
                        Width = "900";
                    }
                    Height = map.MaxEnd + "";
                    BtnLab btnLab = new BtnLab(FK_Node);

                    BtnWord = btnLab.WebOfficeEnable + "";

                    this.UCEn1.Add("<div id=divCCForm style='width:" + Width + "px;height:" + Height + "px' >");
                    this.UCEn1.BindCCForm(wk, nd.NodeFrmID, true, 0, false); //, false, false, null);
                    this.UCEn1.Add("</div>");
                }

                if (nd.HisFormType == NodeFormType.FixForm)
                {
                    MapData map = new MapData(nd.NodeFrmID);
                    if (map.TableWidth.Contains("px"))
                    {
                        Width = map.TableWidth.Replace("px", "");
                    }
                    else
                    {
                        Width = map.TableWidth + "";
                    }
                    if (map.TableWidth.Equals("100%"))
                    {
                        Width = "900";
                    }

                    this.UCEn1.Add("<div id=divCCForm style='width:" + Width + "px;height:" + map.FrmH + "px;overflow-x:scroll;' >");
                    /*傻瓜表单*/
                    this.UCEn1.IsReadonly = true;
                    this.UCEn1.BindColumn4(wk, nd.NodeFrmID); //, false, false, null);
                    //if (wk.WorkEndInfo.Length > 2)
                    //    this.UCEn1.Add(wk.WorkEndInfo);
                    this.UCEn1.Add("</div>");
                }



                BillTemplates bills = new BillTemplates();
                bills.Retrieve(BillTemplateAttr.NodeID, nd.NodeID);
                if (bills.Count >= 1)
                {
                    string title = "";
                    foreach (BillTemplate item in bills)
                    {
                        title += "<img src='/WF/Img/Btn/Word.gif' border=0/>" + item.Name + "</a>";
                    }

                    string urlr = appPath + "WF/WorkOpt/PrintDoc.aspx?FK_Node=" + nd.NodeID + "&FID=" + fid + "&WorkID=" + tk.WorkID + "&FK_Flow=" + nd.FK_Flow;
                    this.UCEn1.Add("<p><a  href=\"javascript:WinOpen('" + urlr + "','dsdd');\"  />" + title + "</a></p>");
                    //this.UCEn1.Add("<a href='' target=_blank><img src='/WF/Img/Btn/Word.gif' border=0/>" + bt.Name + "</a>");
                }
            }
            else
            {
                /* 涉及到多个表单的情况...*/
                if (nd.HisFormType == NodeFormType.SheetTree)
                {
                    Response.Redirect(appPath + "WF/FlowFormTree/FlowFormTreeView.aspx?WorkID=" + tk.WorkID + "&FK_Flow=" + nd.FK_Flow + "&FID=" + fid + "&FK_Node=" + nd.NodeID + "&CWorkID=" + this.CWorkID);
                }
                else if (nd.HisFormType != NodeFormType.DisableIt)
                {
                    Frm myfrm = new Frm();
                    myfrm.No             = "ND" + nd.NodeID;
                    myfrm.Name           = wk.EnDesc;
                    myfrm.HisFormRunType = (FormRunType)(int)nd.HisFormType;

                    FrmNode fnNode = new FrmNode();
                    fnNode.FK_Frm  = myfrm.No;
                    fnNode.IsEdit  = true;
                    fnNode.IsPrint = false;
                    switch (nd.HisFormType)
                    {
                    case NodeFormType.FixForm:
                        fnNode.HisFrmType = FrmType.Column4Frm;
                        break;

                    case NodeFormType.FreeForm:
                        fnNode.HisFrmType = FrmType.FreeFrm;
                        break;

                    case NodeFormType.SelfForm:
                        fnNode.HisFrmType = FrmType.Url;
                        break;

                    default:
                        throw new Exception("出现了未判断的异常。");
                    }
                    myfrm.HisFrmNode = fnNode;
                    frms.AddEntity(myfrm, 0);
                }
                if (frms.Count == 1)
                {
                    /* 如果禁用了节点表单,并且只有一个表单的情况。*/
                    Frm     frm = (Frm)frms[0];
                    FrmNode fn  = frm.HisFrmNode;
                    string  src = "";
                    src = fn.FrmUrl + ".aspx?FK_MapData=" + frm.No + "&FID=" + fid + "&IsEdit=0&IsPrint=0&FK_Node=" + nd.NodeID + "&WorkID=" + tk.WorkID + "&CWorkID=" + this.CWorkID;
                    this.UCEn1.Add("\t\n <DIV id='" + frm.No + "' style='width:" + frm.FrmW + "px; height:" + frm.FrmH + "px;text-align: left; background-color:white;margin:0;padding:0;' >");
                    this.UCEn1.Add("\t\n <iframe ID='F" + frm.No + "' src='" + src + "' frameborder=0  style='margin:0;padding:0;width:" + frm.FrmW + "px; height:" + frm.FrmH + "px;text-align: left;'  leftMargin='0'  topMargin='0'  /></iframe>");
                    this.UCEn1.Add("\t\n </DIV>");
                }
                else
                {
                    Frm frmFirst = null;
                    foreach (Frm frm in frms)
                    {
                        if (frmFirst == null)
                        {
                            frmFirst = frm;
                        }

                        if (frmFirst.FrmW < frm.FrmW)
                        {
                            frmFirst = frm;
                        }
                    }

                    #region 载入相关文件.
                    this.Page.RegisterClientScriptBlock("sg",
                                                        "<link href='./Style/Frm/Tab.css' rel='stylesheet' type='text/css' />");

                    this.Page.RegisterClientScriptBlock("s2g4",
                                                        "<script language='JavaScript' src='./Style/Frm/jquery.min.js' ></script>");

                    this.Page.RegisterClientScriptBlock("sdf24j",
                                                        "<script language='JavaScript' src='./Style/Frm/jquery.idTabs.min.js' ></script>");

                    this.Page.RegisterClientScriptBlock("sdsdf24j",
                                                        "<script language='JavaScript' src='./Style/Frm/TabClick.js' ></script>");
                    #endregion 载入相关文件.

                    this.UCEn1.Clear();
                    this.UCEn1.Add("<div  style='clear:both' ></div>");                                                                                             //
                    this.UCEn1.Add("\t\n<div  id='usual2' class='usual' style='width:" + frmFirst.FrmW + "px;height:auto;margin:0 auto;background-color:white;'>"); //begain.

                    #region 输出标签.
                    this.UCEn1.Add("\t\n <ul  class='abc' style='background:red;border-color: #800000;border-width: 10px;' >");
                    foreach (Frm frm in frms)
                    {
                        FrmNode fn  = frm.HisFrmNode;
                        string  src = "";
                        src = fn.FrmUrl + ".aspx?FK_MapData=" + frm.No + "&FID=" + fid + "&IsEdit=0&IsPrint=0&FK_Node=" + nd.NodeID + "&WorkID=" + tk.WorkID + "&CWorkID=" + this.CWorkID + "&FK_Flow=" + this.FK_Flow;//edited by liuxc,2015-6-17
                        this.UCEn1.Add("\t\n<li><a href=\"#" + frm.No + "\" onclick=\"TabClick('" + frm.No + "','" + src + "');\" >" + frm.Name + "</a></li>");
                    }
                    this.UCEn1.Add("\t\n </ul>");
                    #endregion 输出标签.


                    #region 输出表单 iframe 内容.
                    foreach (Frm frm in frms)
                    {
                        FrmNode fn = frm.HisFrmNode;
                        this.UCEn1.Add("\t\n <DIV id='" + frm.No + "' style='width:" + frm.FrmW + "px; height:" + frm.FrmH + "px;text-align: left;margin:0px;padding:0px;' >");
                        string src = "loading.htm";
                        this.UCEn1.Add("\t\n <iframe ID='F" + frm.No + "' src='" + src + "' frameborder=0  style='margin:0px;padding:0px;width:" + frm.FrmW + "px; height:" + frm.FrmH + "px;text-align: left;'  leftMargin='0'  topMargin='0'   /></iframe>");
                        this.UCEn1.Add("\t\n </DIV>");
                    }
                    #endregion 输出表单 iframe 内容.

                    this.UCEn1.Add("\t\n</div>"); // end  usual2

                    // 设置选择的默认值.
                    this.UCEn1.Add("\t\n<script type='text/javascript'>");
                    this.UCEn1.Add("\t\n  $(\"#usual2 ul\").idTabs(\"" + frms[0].No + "\");");
                    this.UCEn1.Add("\t\n</script>");
                }
            }
        }