Ejemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            #region  属性
            string sealName = null;
            #endregion 属性

#warning 没有缓存经常预览与设计不一致

            MapData md = new MapData();
            md.No = this.FK_MapData;
            if (this.Request.QueryString["IsTest"] == "1")
            {
                md.RepairMap();
                BP.Sys.SystemConfig.DoClearCash_del();
            }

            if (this.Request.QueryString["IsLoadData"] == "1")
            {
                this.UCEn1.IsLoadData = true;
            }

            if (md.RetrieveFromDBSources() == 0 && md.Name.Length > 3)
            {
                /*如果没有找到,就可能是 dtl 。*/
                if (md.HisFrmType == FrmType.Url || md.HisFrmType == FrmType.SLFrm)
                {
                    string no       = Request.QueryString["NO"];
                    string urlParas = "OID=" + this.OID + "&NO=" + no + "&WorkID=" + this.WorkID + "&FK_Node=" + this.FK_Node + "&UserNo=" + WebUser.No + "&SID=" + this.SID;
                    /*如果是URL.*/
                    if (md.Url.Contains("?") == true)
                    {
                        this.Response.Redirect(md.Url + "&" + urlParas, true);
                    }
                    else
                    {
                        this.Response.Redirect(md.Url + "?" + urlParas, true);
                    }
                    return;
                }

                /* 没有找到此map. */
                MapDtl dtl   = new MapDtl(this.FK_MapData);
                GEDtl  dtlEn = dtl.HisGEDtl;
                dtlEn.SetValByKey("OID", this.FID);

                if (dtlEn.EnMap.Attrs.Count <= 0)
                {
                    md.RepairMap();
                    this.Response.Redirect(this.Request.RawUrl, true);
                    return;
                }

                int i = dtlEn.RetrieveFromDBSources();

                string[] paras = this.RequestParas.Split('&');
                foreach (string str in paras)
                {
                    if (string.IsNullOrEmpty(str) || str.Contains("=") == false)
                    {
                        continue;
                    }

                    string[] kvs = str.Split('=');
                    dtlEn.SetValByKey(kvs[0], kvs[1]);
                }
                Width = md.MaxRight + md.MaxLeft * 2 + 10 + "";
                if (float.Parse(Width) < 500)
                {
                    Width = "900";
                }

                Height = md.MaxEnd > md.FrmH ? md.MaxEnd + "" : md.FrmH + "";
                if (float.Parse(Height) <= 800)
                {
                    Height = "800";
                }

                this.UCEn1.Add("<div id=divCCForm style='width:" + Width + "px;height:" + Height + "px' >");

                if (md.HisFrmType == FrmType.FreeFrm)
                {
                    this.UCEn1.BindCCForm(dtlEn, this.FK_MapData, !this.IsEdit, 0, this.IsLoadData);
                }

                if (md.HisFrmType == FrmType.Column4Frm)
                {
                    this.UCEn1.BindCCForm(dtlEn, this.FK_MapData, !this.IsEdit, 0, this.IsLoadData);
                }

                this.AddJSEvent(dtlEn);
                this.UCEn1.Add("</div>");
            }
            else
            {
                /*如果没有找到,就可能是dtl。*/
                if (md.HisFrmType == FrmType.Url || md.HisFrmType == FrmType.SLFrm)
                {
                    string no       = Request.QueryString["NO"];
                    string urlParas = "OID=" + this.OID + "&NO=" + no + "&WorkID=" + this.WorkID + "&FK_Node=" + this.FK_Node + "&IsEdit=" + this.IsEdit.ToString() + "&UserNo=" + WebUser.No + "&SID=" + this.SID;
                    /*如果是URL.*/
                    if (md.Url.Contains("?") == true)
                    {
                        this.Response.Redirect(md.Url + "&" + urlParas, true);
                    }
                    else
                    {
                        this.Response.Redirect(md.Url + "?" + urlParas, true);
                    }
                    return;
                }

                if (md.HisFrmType == FrmType.WordFrm)
                {
                    string no       = Request.QueryString["NO"];
                    string urlParas = "OID=" + this.OID + "&NO=" + no + "&WorkID=" + this.WorkID + "&FK_Node=" + this.FK_Node + "&UserNo=" + WebUser.No + "&SID=" + this.SID + "&FK_MapData=" + this.FK_MapData + "&OIDPKVal=" + this.OIDPKVal + "&FID=" + this.FID + "&FK_Flow=" + this.FK_Flow;
                    /*如果是URL.*/
                    string   requestParas = this.RequestParas;
                    string[] parasArrary  = this.RequestParas.Split('&');
                    foreach (string str in parasArrary)
                    {
                        if (string.IsNullOrEmpty(str) || str.Contains("=") == false)
                        {
                            continue;
                        }
                        string[] kvs = str.Split('=');
                        if (urlParas.Contains(kvs[0]))
                        {
                            continue;
                        }
                        urlParas += "&" + kvs[0] + "=" + kvs[1];
                    }
                    if (md.Url.Contains("?") == true)
                    {
                        this.Response.Redirect("FrmWord.aspx?1=2" + "&" + urlParas, true);
                    }
                    else
                    {
                        this.Response.Redirect("FrmWord.aspx" + "?" + urlParas, true);
                    }
                    return;
                }

                if (md.HisFrmType == FrmType.ExcelFrm)
                {
                    this.Response.Redirect("FrmExcel.aspx?1=2" + this.RequestParas, true);
                    return;
                }

                GEEntity en = md.HisGEEn;

                #region 求出 who is pk 值.
                int    pk     = this.OID;
                string nodeid = this.FK_Node.ToString();
                if (nodeid != "0" && string.IsNullOrEmpty(this.FK_Flow) == false)
                {
                    /*说明是流程调用它, 就要判断谁是表单的PK.*/
                    FrmNode fn = new FrmNode(this.FK_Flow, this.FK_Node, this.FK_MapData);
                    switch (fn.WhoIsPK)
                    {
                    case WhoIsPK.FID:
                        pk = this.FID;
                        if (pk == 0)
                        {
                            throw new Exception("@没有接收到参数FID");
                        }
                        break;

                    case WhoIsPK.CWorkID:     /*延续流程ID*/
                        pk = this.CWorkID;
                        if (pk == 0)
                        {
                            throw new Exception("@没有接收到参数CWorkID");
                        }
                        break;

                    case WhoIsPK.PWorkID:     /*父流程ID*/
                        pk = this.PWorkID;
                        if (pk == 0)
                        {
                            throw new Exception("@没有接收到参数PWorkID");
                        }
                        break;

                    case WhoIsPK.OID:
                    default:
                        break;
                    }
                }

                en.SetValByKey("OID", pk);
                #endregion 求出pk 值.

                if (en.EnMap.Attrs.Count <= 0)
                {
                    md.RepairMap(); //让他刷新一下,重新进入.
                    this.Response.Redirect(this.Request.RawUrl, true);
                    return;
                }

                //检查实体数据是否存在,并重新设置默认值
                if (en.RetrieveFromDBSources() == 0)
                {
                    en.ResetDefaultValAllAttr();
                    try
                    {
                        en.DirectInsert();
                    }
                    catch (Exception ex)
                    {
                        md.RepairMap();
                        en.CheckPhysicsTable();
                        throw new Exception("@装载出现错误:如果是第一次出现该错误,请刷新一次,系统有可能自动修复了。技术信息:" + ex.Message);
                    }
                }

                string[] paras = this.RequestParas.Split('&');
                foreach (string str in paras)
                {
                    if (string.IsNullOrEmpty(str) || str.Contains("=") == false)
                    {
                        continue;
                    }

                    string[] kvs = str.Split('=');
                    en.SetValByKey(kvs[0], kvs[1]);
                }

                if (en.ToString() == "0")
                {
                    en.SetValByKey("OID", pk);
                }
                this.OIDPKVal = pk;


                #region 处理表单权限控制方案
                Width = md.FrmW.ToString();//md.MaxRight + md.MaxLeft * 2 + 10 + "";
                if (float.Parse(Width) < 500)
                {
                    Width = "900";
                }

                Height = md.MaxEnd > md.FrmH ? md.MaxEnd + "" : md.FrmH + "";
                if (float.Parse(Height) <= 800)
                {
                    Height = "800";
                }

                this.UCEn1.Add("<div id=divCCForm style='width:" + Width + "px;height:" + Height + "px' >");
                if (nodeid != null)
                {
                    this.UCEn1.FK_Node = this.FK_Node;
                    /*处理表单权限控制方案*/
                    this.HisFrmNode = new FrmNode();
                    int ii = this.HisFrmNode.Retrieve(FrmNodeAttr.FK_Frm, this.FK_MapData,
                                                      FrmNodeAttr.FK_Node, int.Parse(nodeid));

                    if (ii == 0 || this.HisFrmNode.FrmSln == 0)
                    {
                        /*说明没有配置,或者方案编号为默认就不用处理,*/
                        this.UCEn1.BindCCForm(en, this.FK_MapData, !this.IsEdit, 0, this.IsLoadData);
                    }
                    else
                    {
                        FrmFields fls = new FrmFields(this.FK_MapData, this.HisFrmNode.FrmSln);
                        //求出集合.
                        MapAttrs mattrs = new MapAttrs(this.FK_MapData);
                        foreach (FrmField item in fls)
                        {
                            foreach (MapAttr attr in mattrs)
                            {
                                if (attr.KeyOfEn != item.KeyOfEn)
                                {
                                    continue;
                                }

                                if (item.IsSigan)
                                {
                                    item.UIIsEnable = false;
                                }
                                if (attr.SignType == SignType.CA)
                                {
                                    long        workId  = Convert.ToInt64(this.OID);
                                    FrmField    keyOfEn = new FrmField();
                                    QueryObject info    = new QueryObject(keyOfEn);
                                    info.AddWhere(FrmFieldAttr.FK_Node, this.FK_Node);
                                    info.addAnd();
                                    info.AddWhere(FrmFieldAttr.FK_MapData, attr.FK_MapData);
                                    info.addAnd();
                                    info.AddWhere(FrmFieldAttr.KeyOfEn, attr.KeyOfEn);
                                    info.addAnd();
                                    info.AddWhere(MapAttrAttr.UIIsEnable, "1");
                                    if (info.DoQuery() > 0)
                                    {
                                        sealName = en.GetValStrByKey(attr.KeyOfEn);
                                    }
                                }

                                attr.UIIsEnable = item.UIIsEnable;
                                attr.UIVisible  = item.UIVisible;
                                attr.IsSigan    = item.IsSigan;
                                attr.DefValReal = item.DefVal;
                            }
                        }

                        #region 设置默认值.
                        if (this.IsEdit == true)
                        {
                            bool isHave = false;
                            foreach (MapAttr attr in mattrs)
                            {
                                //if (attr.UIIsEnable)
                                //    continue;

                                if (attr.DefValReal.Contains("@") == false)
                                {
                                    continue;
                                }

                                en.SetValByKey(attr.KeyOfEn, attr.DefVal);
                                isHave = true;
                            }
                            if (isHave)
                            {
                                en.DirectUpdate(); //让其直接更新.
                            }
                        }
                        #endregion 设置默认值.

                        //按照当前方案绑定表单.

                        /*
                         * 修改说明:如果是自定义方案,就不要装载填充了.
                         */

                        ////是否要重新装载数据.
                        bool isLoadData = this.IsLoadData;
                        if (this.HisFrmNode.IsEnableLoadData == true)
                        {
                            /*如果允许启用.*/
                        }
                        else
                        {
                            isLoadData = false;
                        }

                        this.UCEn1.BindCCForm(en, md, mattrs, this.FK_MapData, !this.IsEdit, Int64.Parse(Width), isLoadData);

                        #region 检查必填项
                        string scriptCheckFrm = "";
                        scriptCheckFrm += "\t\n<script type='text/javascript' >";
                        scriptCheckFrm += "\t\n function CheckFrmSlnIsNull(){ ";
                        scriptCheckFrm += "\t\n var isPass = true;";
                        scriptCheckFrm += "\t\n var alloweSave = true;";
                        scriptCheckFrm += "\t\n var erroMsg = '提示信息:';";

                        //表单权限设置为必填项
                        //查询出来,需要不为空的
                        Paras ps = new Paras();
                        ps.SQL = "SELECT KeyOfEn, Name FROM Sys_FrmSln WHERE FK_MapData=" + ps.DBStr + "FK_MapData AND FK_Node=" + ps.DBStr + "FK_Node AND IsNotNull=" + ps.DBStr + "IsNotNull";
                        ps.Add(FrmFieldAttr.FK_MapData, this.FK_MapData);
                        ps.Add(FrmFieldAttr.FK_Node, this.FK_Node);
                        ps.Add(FrmFieldAttr.IsNotNull, 1);

                        //查询
                        System.Data.DataTable dtKeys = DBAccess.RunSQLReturnTable(ps);
                        // 检查数据是否完整.
                        foreach (System.Data.DataRow dr in dtKeys.Rows)
                        {
                            string             key        = dr[0].ToString();
                            string             name       = dr[1].ToString();
                            BP.Web.Controls.TB TB_NotNull = this.UCEn1.GetTBByID("TB_" + key);
                            if (TB_NotNull != null)
                            {
                                scriptCheckFrm += "\t\n try{  ";
                                scriptCheckFrm += "\t\n var element = document.getElementById('" + TB_NotNull.ClientID + "');";
                                //验证输入的正则格式
                                scriptCheckFrm += "\t\n if(element && element.readOnly == true) return;";
                                scriptCheckFrm += "\t\n isPass = EleSubmitCheck(element,'.{1}','" + name + ",不能为空。');";
                                scriptCheckFrm += "\t\n  if(isPass == false){";
                                scriptCheckFrm += "\t\n    alloweSave = false;";
                                scriptCheckFrm += "\t\n    erroMsg += '" + name + ",不能为空。';";
                                scriptCheckFrm += "\t\n  }";
                                scriptCheckFrm += "\t\n } catch(e) { ";
                                scriptCheckFrm += "\t\n  alert(e.name  + e.message);  return false;";
                                scriptCheckFrm += "\t\n } ";
                            }
                        }
                        scriptCheckFrm += "\t\n return alloweSave; } ";
                        scriptCheckFrm += "\t\n</script>";
                        #endregion
                        //检查必填项
                        this.UCEn1.Add(scriptCheckFrm);
                    }
                }
                else
                {
                    this.UCEn1.BindCCForm(en, this.FK_MapData, !this.IsEdit, 0, this.IsLoadData);
                }
                this.UCEn1.Add("</div>");
                #endregion

                if (!IsPostBack)
                {
                    if (md.IsHaveCA)
                    {
                        #region 检查是否有ca签名.
                        //if (md.IsHaveCA == true)
                        //{
                        //    if (string.IsNullOrEmpty(sealName))
                        //        sealName = WebUser.No;

                        //    string basePath = Server.MapPath("~/DataUser/Siganture/" + WorkID);

                        //    if (!System.IO.Directory.Exists(basePath))
                        //    {
                        //        System.IO.Directory.CreateDirectory(basePath);
                        //    }

                        //    // basePath = "C:\\";

                        //    this.TB_SealFile.Text = basePath + "\\" + sealName + ".jpg";

                        //    #region 获取存储的 签名信息

                        //    BP.Tools.WFSealData sealData = new BP.Tools.WFSealData();
                        //    sealData.RetrieveByAttrAnd(BP.Tools.WFSealDataAttr.OID, WorkID, BP.Tools.WFSealDataAttr.FK_Node, FK_Node);
                        //    //sealData.RetrieveFromDBSources();
                        //    if (!string.IsNullOrEmpty(sealData.SealData))
                        //    {
                        //        this.TB_SealData.Text = sealData.SealData;
                        //    }
                        //    #endregion

                        //    //this.TB_SealData.Text = en.GetValStringByKey("SealData");
                        //}
                        #endregion 检查是否有ca签名.
                    }
                }
                this.AddJSEvent(en);
            }

            Session["Count"]        = null;
            this.Btn_Save.Visible   = this.HisFrmNode.IsEdit;
            this.Btn_Save.Enabled   = this.HisFrmNode.IsEdit;
            this.Btn_Save.BackColor = System.Drawing.Color.White;
            Node curNd = new Node();
            curNd.NodeID = this.FK_Node;
            curNd.RetrieveFromDBSources();

            if (curNd.FormType == NodeFormType.SheetTree)
            {
                this.Btn_Save.Visible  = true;
                this.Btn_Save.Enabled  = true;
                this.Btn_Print.Enabled = false;
                this.Btn_Print.Visible = false;
            }
            else
            {
                this.Btn_Print.Visible = this.HisFrmNode.IsPrint;
                this.Btn_Print.Enabled = this.HisFrmNode.IsPrint;
                this.Btn_Print.Attributes["onclick"] = "window.open('Print.aspx?FK_Node=" + this.FK_Node + "&FID=" + this.FID + "&FK_MapData=" + this.FK_MapData + "&WorkID=" + this.OID + "', '', 'dialogHeight: 350px; dialogWidth:450px; center: yes; help: no'); return false;";
            }
        }
Ejemplo n.º 2
0
        public string NewFrmGuide_Create()
        {
            MapData md = new MapData();

            md.Name = this.GetRequestVal("TB_Name");
            md.No   = DataType.ParseStringForNo(this.GetRequestVal("TB_No"), 100);

            md.HisFrmTypeInt = this.GetRequestValInt("DDL_FrmType");

            //表单的物理表.
            if (md.HisFrmType == BP.Sys.FrmType.Url || md.HisFrmType == BP.Sys.FrmType.Entity)
            {
                md.PTable = this.GetRequestVal("TB_PTable");
            }
            else
            {
                md.PTable = DataType.ParseStringForNo(this.GetRequestVal("TB_PTable"), 100);
            }

            //数据表模式。 @周朋 需要翻译.
            md.PTableModel = this.GetRequestValInt("DDL_PTableModel");

            //@李国文 需要对比翻译.
            string sort = this.GetRequestVal("FK_FrmSort");

            if (DataType.IsNullOrEmpty(sort) == true)
            {
                sort = this.GetRequestVal("DDL_FrmTree");
            }

            md.FK_FrmSort  = sort;
            md.FK_FormTree = sort;

            md.AppType = "0";//独立表单
            md.DBSrc   = this.GetRequestVal("DDL_DBSrc");
            if (md.IsExits == true)
            {
                return("err@表单ID:" + md.No + "已经存在.");
            }

            switch (md.HisFrmType)
            {
            //自由,傻瓜,SL表单不做判断
            case BP.Sys.FrmType.FreeFrm:
            case BP.Sys.FrmType.FoolForm:
                break;

            case BP.Sys.FrmType.Url:
            case BP.Sys.FrmType.Entity:
                md.Url = md.PTable;
                break;

            //如果是以下情况,导入模式
            case BP.Sys.FrmType.WordFrm:
            case BP.Sys.FrmType.ExcelFrm:
                break;

            default:
                throw new Exception("未知表单类型.");
            }
            md.Insert();

            //增加上OID字段.
            BP.Sys.CCFormAPI.RepareCCForm(md.No);

            BP.Frm.EntityType entityType = (EntityType)this.GetRequestValInt("EntityType");

            #region 如果是单据.
            if (entityType == EntityType.FrmBill)
            {
                BP.Frm.FrmBill bill = new FrmBill(md.No);
                bill.EntityType   = EntityType.FrmBill;
                bill.BillNoFormat = "ccbpm{yyyy}-{MM}-{dd}-{LSH4}";

                //设置默认的查询条件.
                bill.SetPara("IsSearchKey", 1);
                bill.SetPara("DTSearchWay", 0);

                bill.Update();
                bill.CheckEnityTypeAttrsFor_Bill();
            }
            #endregion 如果是单据.

            #region 如果是实体 EnityNoName .
            if (entityType == EntityType.FrmDict)
            {
                BP.Frm.FrmDict entityDict = new FrmDict(md.No);
                entityDict.BillNoFormat = "3"; //编码格式.001,002,003.

                entityDict.BtnNewModel = 0;

                //设置默认的查询条件.
                entityDict.SetPara("IsSearchKey", 1);
                entityDict.SetPara("DTSearchWay", 0);

                entityDict.EntityType = EntityType.FrmDict;

                entityDict.Update();
                entityDict.CheckEnityTypeAttrsFor_EntityNoName();
            }
            #endregion 如果是实体 EnityNoName .

            //创建表与字段.
            GEEntity en = new GEEntity(md.No);
            en.CheckPhysicsTable();

            if (md.HisFrmType == BP.Sys.FrmType.WordFrm || md.HisFrmType == BP.Sys.FrmType.ExcelFrm)
            {
                /*把表单模版存储到数据库里 */
                return("url@../../Comm/RefFunc/En.htm?EnName=BP.WF.Template.MapFrmExcel&PKVal=" + md.No);
            }

            if (md.HisFrmType == BP.Sys.FrmType.Entity)
            {
                return("url@../../Comm/Ens.htm?EnsName=" + md.PTable);
            }

            if (md.HisFrmType == BP.Sys.FrmType.FreeFrm)
            {
                return("[email protected]?FK_MapData=" + md.No);
            }


            return("url@../FoolFormDesigner/Designer.htm?IsFirst=1&FK_MapData=" + md.No);
        }
Ejemplo n.º 3
0
    void btn_Click(object sender, EventArgs e)
    {
        MapDtls dtl2s = new MapDtls();

        dtl2s.Delete(MapDtlAttr.FK_MapData, this.MyPK);
        Nodes nds = new Nodes(BP.WF.Glo.GenerFlowNo(this.MyPK));

        foreach (BP.WF.Node nd in nds)
        {
            if (nd.IsEndNode == false)
            {
                continue;
            }

            MapDtls dtls = new MapDtls("ND" + nd.NodeID);
            int     i    = 0;

            foreach (MapDtl dtl in dtls)
            {
                if (this.Pub1.GetCBByID("CB_" + dtl.No).Checked == false)
                {
                    continue;
                }

                i++;
                // 生成从表让其可以在单个数据里显示他们。
                MapDtl dtlNew = new MapDtl();
                dtlNew.Copy(dtl);
                dtlNew.No         = this.MyPK + i;
                dtlNew.FK_MapData = this.MyPK;
                dtlNew.GroupID    = this.Pub1.GetDDLByID("DDL_" + dtl.No).SelectedItemIntVal;
                dtlNew.Insert();

                // 删除原来的数据。
                MapAttrs attrsDtl = new MapAttrs();
                attrsDtl.Delete(MapAttrAttr.FK_MapData, dtlNew.No);

                // 复制到新的数据表里。
                MapAttrs attrs = new MapAttrs(dtl.No);
                foreach (MapAttr attr in attrs)
                {
                    MapAttr attrN = new MapAttr();
                    attrN.Copy(attr);
                    attrN.FK_MapData = dtlNew.No;
                    attrN.Insert();
                }
                Cash.Map_Cash.Remove(dtlNew.No);


                #region   制成 主表.让其可以查询。
                // 处理主表。
                MapData md = new MapData();
                md.Copy(dtlNew);
                md.No = "ND" + int.Parse(this.FK_Flow) + "RptDtl" + i.ToString();
                md.Save();

                // 删除原来的属性。
                attrs.Delete(MapAttrAttr.FK_MapData, md.No);

                // 删除分组。
                GroupField gfBase = new GroupField();
                gfBase.Delete(GroupFieldAttr.EnName, md.No);

                // 增加基本信息分组。
                gfBase.EnName = md.No;
                gfBase.Lab    = md.Name;
                gfBase.Idx    = 99;
                gfBase.Insert();


                //生成基本信息属性。
                foreach (MapAttr attr in attrs)
                {
                    MapAttr attrN = new MapAttr();
                    attrN.Copy(attr);
                    attrN.FK_MapData = md.No;
                    attrN.GroupID    = gfBase.OID;
                    attrN.Insert();
                }

                MapAttrs attrNs = new MapAttrs(md.No);

                // 对个别字段进行处理。
                foreach (MapAttr attr in attrNs)
                {
                    switch (attr.KeyOfEn)
                    {
                    case StartWorkAttr.FK_Dept:
                        continue;
                        //if (attr.UIContralType != UIContralType.DDL)
                        //{
                        //attr.UIBindKey = "BP.Port.Depts";
                        //attr.UIContralType = UIContralType.DDL;
                        //attr.LGType = FieldTypeS.FK;
                        //attr.UIVisible = true;
                        //// if (gfs.Contains(attr.GroupID) == false)
                        //attr.GroupID = gfBase.OID;// gfs[0].GetValIntByKey("OID");
                        //attr.Update();
                        //// }
                        break;

                    case "FK_NY":
                        //attr.Delete();
                        ////if (attr.UIContralType != UIContralType.DDL)
                        ////{
                        //attr.UIBindKey = "BP.Pub.NYs";
                        //attr.UIContralType = UIContralType.DDL;
                        //attr.LGType = FieldTypeS.FK;
                        //attr.UIVisible = true;
                        ////   if (gfs.Contains(attr.GroupID) == false)
                        //attr.GroupID = gfBase.OID; // gfs[0].GetValIntByKey("OID");
                        //attr.Update();
                        break;

                    case "Rec":
                        attr.UIBindKey     = "BP.Port.Emps";
                        attr.UIContralType = UIContralType.DDL;
                        attr.LGType        = FieldTypeS.FK;
                        attr.UIVisible     = true;
                        attr.Name          = "最后处理人";
                        attr.GroupID       = gfBase.OID;
                        attr.Update();
                        break;

                    default:
                        break;
                    }
                }

                // 生成流程基本信息属性。
                GroupField gfFlow = new GroupField();
                gfFlow.EnName = md.No;
                gfFlow.Idx    = 0;
                gfFlow.Lab    = "流程信息";
                gfFlow.Insert();


                MapAttr attrFlow = new BP.Sys.MapAttr();

                attrFlow               = new BP.Sys.MapAttr();
                attrFlow.FK_MapData    = md.No;
                attrFlow.HisEditType   = EditType.UnDel;
                attrFlow.KeyOfEn       = "Title";
                attrFlow.Name          = "标题";
                attrFlow.MyDataType    = BP.DA.DataType.AppString;
                attrFlow.UIContralType = UIContralType.TB;
                attrFlow.LGType        = FieldTypeS.Normal;
                attrFlow.UIVisible     = true;
                attrFlow.UIIsEnable    = true;
                attrFlow.UIIsLine      = true;
                attrFlow.MinLen        = 0;
                attrFlow.MaxLen        = 1000;
                attrFlow.IDX           = -100;
                attrFlow.GroupID       = gfFlow.OID;
                attrFlow.Insert();


                attrFlow.FK_MapData    = md.No;
                attrFlow.HisEditType   = EditType.UnDel;
                attrFlow.KeyOfEn       = "FlowStarter";
                attrFlow.Name          = "发起人"; //"发起人";
                attrFlow.MyDataType    = BP.DA.DataType.AppString;
                attrFlow.UIContralType = UIContralType.DDL;
                attrFlow.UIBindKey     = "BP.Port.Emps";
                attrFlow.LGType        = FieldTypeS.FK;
                attrFlow.UIVisible     = true;
                attrFlow.UIIsEnable    = false;
                attrFlow.UIIsLine      = false;
                attrFlow.MaxLen        = 20;
                attrFlow.MinLen        = 0;
                attrFlow.Insert();

                attrFlow               = new BP.Sys.MapAttr();
                attrFlow.FK_MapData    = md.No;
                attrFlow.HisEditType   = EditType.UnDel;
                attrFlow.KeyOfEn       = "FlowStarterDept";
                attrFlow.Name          = "发起人部门";
                attrFlow.MyDataType    = BP.DA.DataType.AppString;
                attrFlow.UIContralType = UIContralType.DDL;
                attrFlow.UIBindKey     = "BP.Port.Depts";
                attrFlow.LGType        = FieldTypeS.FK;
                attrFlow.UIVisible     = true;
                attrFlow.UIIsEnable    = false;
                attrFlow.MaxLen        = 20;
                attrFlow.MinLen        = 0;
                attrFlow.Insert();



                attrFlow               = new BP.Sys.MapAttr();
                attrFlow.FK_MapData    = md.No;
                attrFlow.HisEditType   = EditType.UnDel;
                attrFlow.KeyOfEn       = "FlowEmps";
                attrFlow.Name          = "参与人"; //
                attrFlow.MyDataType    = BP.DA.DataType.AppString;
                attrFlow.UIContralType = UIContralType.TB;
                attrFlow.LGType        = FieldTypeS.Normal;
                attrFlow.UIVisible     = true;
                attrFlow.UIIsEnable    = true;
                attrFlow.UIIsLine      = false;
                attrFlow.MinLen        = 0;
                attrFlow.MaxLen        = 1000;
                attrFlow.IDX           = -100;
                attrFlow.GroupID       = gfFlow.OID;
                attrFlow.Insert();


                attrFlow               = new BP.Sys.MapAttr();
                attrFlow.FK_MapData    = md.No;
                attrFlow.HisEditType   = EditType.UnDel;
                attrFlow.KeyOfEn       = "FlowStartRDT";
                attrFlow.Name          = "发起时间"; //
                attrFlow.MyDataType    = BP.DA.DataType.AppDateTime;
                attrFlow.UIContralType = UIContralType.TB;
                attrFlow.LGType        = FieldTypeS.Normal;
                attrFlow.UIVisible     = true;
                attrFlow.UIIsEnable    = true;
                attrFlow.UIIsLine      = false;
                attrFlow.MinLen        = 0;
                attrFlow.MaxLen        = 1000;
                attrFlow.IDX           = -100;
                attrFlow.GroupID       = gfFlow.OID;
                attrFlow.Insert();

                attrFlow               = new BP.Sys.MapAttr();
                attrFlow.FK_MapData    = md.No;
                attrFlow.HisEditType   = EditType.UnDel;
                attrFlow.KeyOfEn       = "FlowNY";
                attrFlow.Name          = "隶属年月";
                attrFlow.MyDataType    = BP.DA.DataType.AppString;
                attrFlow.UIContralType = UIContralType.DDL;
                attrFlow.UIBindKey     = "BP.Pub.NYs";
                attrFlow.LGType        = FieldTypeS.FK;
                attrFlow.UIVisible     = true;
                attrFlow.UIIsEnable    = false;
                attrFlow.MaxLen        = 20;
                attrFlow.MinLen        = 0;
                attrFlow.Insert();


                attrFlow               = new BP.Sys.MapAttr();
                attrFlow.FK_MapData    = md.No;
                attrFlow.HisEditType   = EditType.UnDel;
                attrFlow.KeyOfEn       = "MyNum";
                attrFlow.Name          = "条"; //
                attrFlow.MyDataType    = BP.DA.DataType.AppInt;
                attrFlow.DefVal        = "1";
                attrFlow.UIContralType = UIContralType.TB;
                attrFlow.LGType        = FieldTypeS.Normal;
                attrFlow.UIVisible     = false;
                attrFlow.UIIsEnable    = false;
                attrFlow.UIIsLine      = false;
                attrFlow.IDX           = -101;
                attrFlow.GroupID       = gfFlow.OID;
                if (attrFlow.IsExits == false)
                {
                    attrFlow.Insert();
                }

                // 清除缓存的map.
                Cash.Map_Cash.Remove(md.No);
                //检查主表的正确性。
                GEEntity ge = new GEEntity(md.No);
                ge.CheckPhysicsTable();
                #endregion   制成 主表.让其可以查询。
            }
        }
        this.WinClose();
    }