Пример #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            this.Title = this.Lab;

            switch (this.DoType)
            {
            case "Del":
                MapExt mm = new MapExt();
                mm.MyPK = this.MyPK;
                mm.Retrieve();
                mm.Delete();
                this.Response.Redirect("InputCheck.aspx?FK_MapData=" + this.FK_MapData + "&ExtType=" + this.ExtType + "&RefNo=" + this.RefNo, true);
                return;

            default:
                break;
            }

            if (this.MyPK != null || this.DoType == "New")
            {
                Edit_InputCheck();
                return;
            }

            MapExts mes = new MapExts();

            mes.Retrieve(MapExtAttr.ExtType, this.ExtType,
                         MapExtAttr.FK_MapData, this.FK_MapData);
            this.MapJS(mes);
        }
        public string AutoFullDtlField_Init()
        {
            DataSet ds = new DataSet();

            // 加载mapext 数据.
            MapExt me = new MapExt();
            int    i  = me.Retrieve(MapExtAttr.ExtType, MapExtXmlList.AutoFullDtlField,
                                    MapExtAttr.FK_MapData, this.FK_MapData,
                                    MapExtAttr.AttrOfOper, this.KeyOfEn);

            if (i == 0)
            {
                me.FK_MapData = this.FK_MapData;
                me.AttrOfOper = this.KeyOfEn;
                me.FK_DBSrc   = "local";
            }

            if (me.FK_DBSrc == "")
            {
                me.FK_DBSrc = "local";
            }

            //去掉 ' 号.
            me.SetValByKey("Doc", me.Doc);

            DataTable dt = me.ToDataTableField();

            dt.TableName = "Sys_MapExt";
            ds.Tables.Add(dt);

            //把从表放入里面.
            MapDtls dtls = new MapDtls(this.FK_MapData);

            ds.Tables.Add(dtls.ToDataTableField("Dtls"));

            //把从表的字段放入.
            foreach (MapDtl dtl in dtls)
            {
                string sql = "SELECT KeyOfEn as \"No\",Name as \"Name\" FROM Sys_MapAttr WHERE FK_MapData='" + dtl.No + "' AND (MyDataType=2 OR MyDataType=3 OR MyDataType=5 OR MyDataType=8)  ";
                sql += " AND KeyOfEn !='OID' AND KeyOfEn!='FID' AND KeyOfEn!='RefPK' ";

                //把从表增加里面去.
                DataTable mydt = DBAccess.RunSQLReturnTable(sql);
                mydt.TableName = dtl.No;
                ds.Tables.Add(mydt);
            }

            //把主表的字段放入
            string mainsql = "SELECT KeyOfEn as \"No\",Name as \"Name\" FROM Sys_MapAttr WHERE FK_MapData='" + this.FK_MapData + "' AND MyDataType=1 AND UIIsEnable = 0 ";

            mainsql += " AND KeyOfEn !='OID' AND KeyOfEn!='FID' AND KeyOfEn!='WorkID' AND KeyOfEn!='NodeID' AND KeyOfEn!='RefPK'  AND KeyOfEn!='RDT' AND KeyOfEn!='Rec' ";

            //把从表增加里面去.
            DataTable maindt = DBAccess.RunSQLReturnTable(mainsql);

            maindt.TableName = "main_Attr";
            ds.Tables.Add(maindt);

            return(BP.Tools.Json.ToJson(ds));
        }
Пример #3
0
        public string ActiveDDL_Init()
        {
            DataSet ds = new DataSet();

            //加载外键字段.
            Paras ps = new Paras();

            ps.SQL = "SELECT KeyOfEn AS No, Name FROM Sys_MapAttr WHERE UIContralType=1 AND FK_MapData=" + SystemConfig.AppCenterDBVarStr + "FK_MapData AND KeyOfEn!=" + SystemConfig.AppCenterDBVarStr + "KeyOfEn";
            ps.Add("FK_MapData", this.FK_MapData);
            ps.Add("KeyOfEn", this.KeyOfEn);
            //var sql = "SELECT KeyOfEn AS No, Name FROM Sys_MapAttr WHERE UIContralType=1 AND FK_MapData='" + this.FK_MapData + "' AND KeyOfEn!='" + this.KeyOfEn + "'";
            DataTable dt = BP.DA.DBAccess.RunSQLReturnTable(ps);

            dt.TableName = "Sys_MapAttr";

            dt.Columns[0].ColumnName = "No";
            dt.Columns[1].ColumnName = "Name";
            ds.Tables.Add(dt);

            if (dt.Rows.Count == 0)
            {
                return("err@表单中没有要级联的下拉框.");
            }

            //加载数据源.
            SFDBSrcs srcs = new SFDBSrcs();

            srcs.RetrieveAll();
            DataTable dtSrc = srcs.ToDataTableField();

            dtSrc.TableName = "Sys_SFDBSrc";
            ds.Tables.Add(dtSrc);

            // 加载mapext 数据.
            MapExt me = new MapExt();
            int    i  = me.Retrieve(MapExtAttr.ExtType, MapExtXmlList.ActiveDDL,
                                    MapExtAttr.FK_MapData, this.FK_MapData,
                                    MapExtAttr.AttrOfOper, this.KeyOfEn);

            if (i == 0)
            {
                me.FK_MapData = this.FK_MapData;
                me.AttrOfOper = this.KeyOfEn;
                me.FK_DBSrc   = "local";
            }

            if (me.FK_DBSrc == "")
            {
                me.FK_DBSrc = "local";
            }

            //去掉 ' 号.
            me.SetValByKey("Doc", me.Doc);

            dt           = me.ToDataTableField();
            dt.TableName = "Sys_MapExt";
            ds.Tables.Add(dt);

            return(BP.Tools.Json.ToJson(ds));
        }
Пример #4
0
        public string AutoFull_Init()
        {
            DataSet ds = new DataSet();

            // 加载mapext 数据.
            MapExt me = new MapExt();
            int    i  = me.Retrieve(MapExtAttr.ExtType, MapExtXmlList.AutoFull,
                                    MapExtAttr.FK_MapData, this.FK_MapData,
                                    MapExtAttr.AttrOfOper, this.KeyOfEn);

            if (i == 0)
            {
                me.FK_MapData = this.FK_MapData;
                me.AttrOfOper = this.KeyOfEn;
                me.FK_DBSrc   = "local";
            }

            if (me.FK_DBSrc == "")
            {
                me.FK_DBSrc = "local";
            }

            //去掉 ' 号.
            me.SetValByKey("Doc", me.Doc);

            DataTable dt = me.ToDataTableField();

            dt.TableName = "Sys_MapExt";
            ds.Tables.Add(dt);

            return(BP.Tools.Json.ToJson(ds));
        }
Пример #5
0
        /// <summary>
        /// 保存
        /// </summary>
        /// <returns></returns>
        public string TBFullCtrl_Save()
        {
            try
            {
                MapExt me = new MapExt();
                int    i  = me.Retrieve(MapExtAttr.ExtType, MapExtXmlList.TBFullCtrl,
                                        MapExtAttr.FK_MapData, this.FK_MapData,
                                        MapExtAttr.AttrOfOper, this.KeyOfEn);

                me.FK_MapData = this.FK_MapData;
                me.AttrOfOper = this.KeyOfEn;
                me.FK_DBSrc   = this.GetValFromFrmByKey("FK_DBSrc");
                me.Doc        = this.GetValFromFrmByKey("TB_Doc"); //要执行的SQL.

                me.ExtType = MapExtXmlList.TBFullCtrl;

                //执行保存.
                me.InitPK();

                if (me.Update() == 0)
                {
                    me.Insert();
                }

                return("保存成功.");
            }
            catch (Exception ex)
            {
                return("err@" + ex.Message);
            }
        }
Пример #6
0
        protected void Btn_Delete_Click(object sender, EventArgs e)
        {
            MapExt me = new MapExt();

            me.Retrieve(MapExtAttr.FK_MapData, this.FK_MapData, this.ExtType, this.ExtType, MapExtAttr.AttrOfOper, this.RefNo);
            me.Doc = "";
            me.Update();

            BP.Sys.PubClass.WinClose();
        }
Пример #7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack == false)
            {
                MapExt me = new MapExt();

                me.Retrieve(MapExtAttr.FK_MapData, this.FK_MapData, MapExtAttr.ExtType, this.ExtType, MapExtAttr.AttrOfOper, this.RefNo);
                this.TB_SQL.Text = me.Doc;

                BP.Sys.SFDBSrcs srcs = new SFDBSrcs();
                srcs.RetrieveAll();
                BP.Web.Controls.Glo.DDL_BindEns(this.DDL_DBSrc, srcs, me.FK_DBSrc);
            }
        }
Пример #8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack == false)
            {
                MapExt me = new MapExt();

                me.Retrieve(MapExtAttr.FK_MapData, this.FK_MapData, MapExtAttr.ExtType, this.ExtType, MapExtAttr.AttrOfOper, this.RefNo);
                this.TB_SQL.Text = me.Doc;
                ArrayList arr = new ArrayList();
                SysEnums  ens = new SysEnums("DBSrcType");

                foreach (SysEnum en in ens)
                {
                    arr.Add(en.Lab);
                }

                switch (me.FK_DBSrc)
                {
                case "1":
                    this.DDL_DBSrc.SelectedValue = "SQLServer数据库";
                    break;

                case "100":
                    this.DDL_DBSrc.SelectedValue = "WebService数据源";
                    break;

                case "2":
                    this.DDL_DBSrc.SelectedValue = "Oracle数据库";
                    break;

                case "3":
                    this.DDL_DBSrc.SelectedValue = "MySQL数据库";
                    break;

                case "4":
                    this.DDL_DBSrc.SelectedValue = "Informix数据库";
                    break;

                default:
                    this.DDL_DBSrc.SelectedValue = "应用系统主数据库(默认)";
                    break;
                }
                this.DDL_DBSrc.DataSource = arr;
                this.DDL_DBSrc.DataBind();
            }
        }
Пример #9
0
        public string TBFullCtrl_Init()
        {
            DataSet ds = new DataSet();

            //加载数据源.
            SFDBSrcs srcs = new SFDBSrcs();

            srcs.RetrieveAll();
            DataTable dtSrc = srcs.ToDataTableField();

            dtSrc.TableName = "Sys_SFDBSrc";
            ds.Tables.Add(dtSrc);

            // 加载 mapext 数据.
            MapExt me = new MapExt();
            int    i  = me.Retrieve(MapExtAttr.ExtType, MapExtXmlList.TBFullCtrl,
                                    MapExtAttr.FK_MapData, this.FK_MapData,
                                    MapExtAttr.AttrOfOper, this.KeyOfEn);

            if (i == 0)
            {
                me.FK_MapData = this.FK_MapData;
                me.AttrOfOper = this.KeyOfEn;
                me.FK_DBSrc   = "local";
            }

            //这个属性没有用.
            me.W = i;  //用于标记该数据是否保存?  从而不现实填充从表,填充下拉框.按钮是否可以用.
            if (me.FK_DBSrc == "")
            {
                me.FK_DBSrc = "local";
            }

            //去掉 ' 号.
            me.SetValByKey("Doc", me.Doc);

            DataTable dt = me.ToDataTableField();

            dt.TableName = "Sys_MapExt";
            ds.Tables.Add(dt);

            return(BP.Tools.Json.ToJson(ds));
        }
Пример #10
0
        protected void Btn_Save_Click(object sender, EventArgs e)
        {
            MapExt me = new MapExt();

            me.Retrieve(MapExtAttr.FK_MapData, this.FK_MapData, MapExtAttr.ExtType, this.ExtType, MapExtAttr.AttrOfOper, this.RefNo);
            me.ExtType    = this.ExtType;
            me.Doc        = this.TB_SQL.Text;
            me.AttrOfOper = this.RefNo;
            me.FK_MapData = this.FK_MapData;
            me.MyPK       = this.FK_MapData + "_" + me.ExtType + "_" + me.AttrOfOper;

            switch (this.DDL_DBSrc.Text)
            {
            case "应用系统主数据库(默认)":
                me.FK_DBSrc = "0";
                break;

            case "SQLServer数据库":
                me.FK_DBSrc = "1";
                break;

            case "WebService数据源":
                me.FK_DBSrc = "100";
                break;

            case "Oracle数据库":
                me.FK_DBSrc = "2";
                break;

            case "MySQL数据库":
                me.FK_DBSrc = "3";
                break;

            case "Informix数据库":
                me.FK_DBSrc = "4";
                break;

            default:
                break;
            }

            me.Save();
        }
Пример #11
0
        /// <summary>
        /// 保存(自动计算: @单价*@数量 模式.)
        /// </summary>
        /// <returns></returns>
        public string AutoFullDtlField_Save()
        {
            MapExt me = new MapExt();
            int    i  = me.Retrieve(MapExtAttr.ExtType, MapExtXmlList.AutoFullDtlField,
                                    MapExtAttr.FK_MapData, this.FK_MapData,
                                    MapExtAttr.AttrOfOper, this.KeyOfEn);

            me.FK_MapData = this.FK_MapData;
            me.AttrOfOper = this.KeyOfEn;
            me.Doc        = this.GetValFromFrmByKey("DDL_Dtl") + "." + this.GetValFromFrmByKey("DDL_Field") + "." + this.GetValFromFrmByKey("DDL_JSFS"); //要执行的表达式.

            me.ExtType = MapExtXmlList.AutoFullDtlField;

            //执行保存.
            me.MyPK = MapExtXmlList.AutoFullDtlField + "_" + me.FK_MapData + "_" + me.AttrOfOper;
            if (me.Update() == 0)
            {
                me.Insert();
            }

            return("保存成功.");
        }
Пример #12
0
        /// <summary>
        /// 保存
        /// </summary>
        /// <returns></returns>
        public string AutoFullDLL_Save()
        {
            MapExt me = new MapExt();
            int    i  = me.Retrieve(MapExtAttr.ExtType, MapExtXmlList.AutoFullDLL,
                                    MapExtAttr.FK_MapData, this.FK_MapData,
                                    MapExtAttr.AttrOfOper, this.KeyOfEn);

            me.FK_MapData = this.FK_MapData;
            me.AttrOfOper = this.KeyOfEn;
            me.FK_DBSrc   = this.GetValFromFrmByKey("FK_DBSrc");
            me.Doc        = this.GetValFromFrmByKey("TB_Doc"); //要执行的SQL.
            me.ExtType    = MapExtXmlList.AutoFullDLL;

            //执行保存.
            me.InitPK();

            if (me.Update() == 0)
            {
                me.Insert();
            }

            return("保存成功.");
        }
Пример #13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            MapExt me = new MapExt();
            // me.MyPK = this.FK_MapData + "_" + this.ExtType + "_" + me.AttrOfOper + "_" + me.AttrsOfActive;

            int i = me.Retrieve(MapExtAttr.FK_MapData, this.FK_MapData, MapExtAttr.ExtType, MapExtXmlList.ActiveDDL,
                                MapExtAttr.AttrOfOper, this.RefNo);

            this.Pub1.AddEasyUiPanelInfoBegin("为下拉框[" + this.RefNo + "]设置联动.", "icon-edit");
            me.FK_MapData = this.FK_MapData;

            this.Pub1.AddTableNormal();

            MapAttrs attrs = new MapAttrs(this.FK_MapData);

            this.Pub1.AddTR();
            this.Pub1.AddTDGroupTitle("联动下拉框:");
            BP.Web.Controls.DDL ddl = new BP.Web.Controls.DDL();
            ddl.ID = "DDL_Attr";
            foreach (MapAttr attr in attrs)
            {
                if (attr.UIVisible == false)
                {
                    continue;
                }

                if (attr.UIIsEnable == false)
                {
                    continue;
                }

                if (attr.UIContralType != UIContralType.DDL)
                {
                    continue;
                }

                if (attr.KeyOfEn == this.RefNo)
                {
                    continue;
                }

                ddl.Items.Add(new ListItem(attr.KeyOfEn + " - " + attr.Name, attr.KeyOfEn));
            }
            ddl.SetSelectItem(me.AttrsOfActive);
            this.Pub1.AddTD(ddl);
            this.Pub1.AddTD("要实现联动的菜单");
            this.Pub1.AddTREnd();

            // 数据源列表.
            this.Pub1.AddTR();
            this.Pub1.AddTDGroupTitle("colspan=1", "数据源");

            ddl = new DDL();
            SFDBSrcs srcs = new SFDBSrcs();

            srcs.RetrieveAll();
            ddl.BindEntitiesNoName(srcs);

            this.Pub1.AddTD(ddl);
            // this.Pub1.AddTD("ccform允许从其他数据源中取数据,<a href=\"javascript:WinOpen('/WF/Comm/Search.aspx?EnsName=BP.Sys.SFDBSrcs')\" ><img src='/WF/Img/Setting.png' border=0/>设置/新建数据源</a>, <a href=\"javascript:window.localhost.href=window.localhost.href;\" >刷新数据源</a>");
            this.Pub1.AddTD("ccform允许从其他数据源中取数据,<a href=\"javascript:WinOpen('/WF/Comm/Search.aspx?EnsName=BP.Sys.SFDBSrcs','d2')\" ><img src='/WF/Img/Setting.png' border=0/>设置/新建数据源</a>, <a href=\"javascript:window.localhost.href=window.localhost.href;\" >刷新数据源</a>");

            this.Pub1.AddTREnd();

            this.Pub1.AddTR();
            this.Pub1.AddTDBegin("colspan='3'");
            RadioButton rb = new RadioButton();

            rb.Text      = "通过sql获取联动";
            rb.GroupName = "sdr";
            rb.ID        = "RB_0";
            if (me.DoWay == 0)
            {
                rb.Checked = true;
            }

            this.Pub1.Add("在下面文本框中输入一个SQL,具有编号,标签列,用来绑定下从动下拉框。<br />");
            this.Pub1.Add("比如:SELECT No, Name FROM CN_City WHERE FK_SF = '@Key' ");
            this.Pub1.AddBR();
            TextBox tb = new TextBox();

            tb.ID       = "TB_Doc";
            tb.Text     = me.Doc;
            tb.Columns  = 80;
            tb.CssClass = "TH";
            tb.TextMode = TextBoxMode.MultiLine;
            tb.Rows     = 7;
            tb.Style.Add("width", "99%");
            this.Pub1.Add(tb);
            this.Pub1.AddBR();
            this.Pub1.Add("说明:@Key是ccflow约定的关键字,是主下拉框传递过来的值");
            //this.Pub1.AddFieldSetEnd();

            rb           = new RadioButton();
            rb.Text      = "通过编码标识获取";
            rb.GroupName = "sdr";
            rb.Enabled   = false;
            rb.ID        = "RB_1";
            if (me.DoWay == 1)
            {
                rb.Checked = true;
            }

            //this.Pub1.AddFieldSet(rb);
            this.Pub1.Add("主菜单是编号的是从动菜单编号的前几位,不必联动内容。<br />");
            this.Pub1.Add("比如: 主下拉框是省份,联动菜单是城市。");
            //this.Pub1.AddFieldSetEnd();

            //this.Pub1.Add("</TD>");
            this.Pub1.AddTDEnd();
            this.Pub1.AddTREnd();

            this.Pub1.AddTR();
            var btn = new LinkBtn(false, NamesOfBtn.Save, "保存");

            btn.Click += new EventHandler(btn_SaveJiLian_Click);
            this.Pub1.AddTD("colspan=2", btn);

            if (i != 0)
            {
                btn        = new LinkBtn(false, NamesOfBtn.Delete, "删除");
                btn.Click += new EventHandler(btn_Del_Click);
                this.Pub1.AddTD("colspan=1", btn);
            }

            this.Pub1.AddTREnd();
            this.Pub1.AddTableEnd();
            this.Pub1.AddEasyUiPanelInfoEnd();
        }
Пример #14
0
        public void EditAutoFull_TB()
        {
            MapExt me = new MapExt();

            me.FK_MapData = this.FK_MapData;
            me.AttrOfOper = this.RefNo;
            me.ExtType    = this.ExtType;

            me.Retrieve(MapExtAttr.FK_MapData, this.FK_MapData, MapExtAttr.ExtType, this.ExtType, MapExtAttr.AttrOfOper, this.RefNo);

            me.FK_MapData = this.FK_MapData;
            me.AttrOfOper = this.RefNo;
            me.ExtType    = this.ExtType;

            //this.Pub1.AddTable("border=0");
            this.Pub1.AddTable("class='Table' cellpadding='0' cellspacing='0' border='0' style='width:100%'");
            this.Pub1.AddCaptionLeft("为字段[" + this.RefNo + "]设置自动填充." + BP.WF.Glo.GenerHelpCCForm("主表中的自动完成", "http://ccform.mydoc.io/?v=5769&t=20175", null));

            this.Pub1.AddTR();
            this.Pub1.AddTDGroupTitle("自动填充SQL:");
            this.Pub1.AddTREnd();

            this.Pub1.AddTR();
            TextBox tb = new TextBox();

            tb.ID       = "TB_Doc";
            tb.Text     = me.Doc;
            tb.TextMode = TextBoxMode.MultiLine;
            tb.Rows     = 5;
            tb.Columns  = 80;
            tb.Style.Add("width", "99%");
            this.Pub1.AddTD(tb);
            this.Pub1.AddTREnd();

            this.Pub1.AddTR();
            this.Pub1.AddTDGroupTitle("关键字查询的SQL:");
            this.Pub1.AddTREnd();

            this.Pub1.AddTR();
            tb          = new TextBox();
            tb.ID       = "TB_Tag";
            tb.Text     = me.Tag;
            tb.TextMode = TextBoxMode.MultiLine;
            tb.Rows     = 5;
            tb.Columns  = 80;
            tb.Style.Add("width", "99%");
            this.Pub1.AddTD(tb);
            this.Pub1.AddTREnd();

            this.Pub1.AddTRSum();
            this.Pub1.AddTDBegin("colspan=1");

            var btn = new LinkBtn(false, NamesOfBtn.Save, "保存");

            btn.Click += new EventHandler(btn_SaveAutoFull_Click);
            this.Pub1.Add(btn);

            if (me.IsExits == true)
            {
                string mypk = this.ExtType + "_" + this.FK_MapData + "_" + this.RefNo;
                this.Pub1.AddSpace(1);
                this.Pub1.Add("<a class='easyui-linkbutton' href=\"TBFullCtrl.aspx?MyPK=" + mypk + "&FK_MapData=" + this.FK_MapData + "&RefNo=" + this.RefNo + "&ExtType=" + this.ExtType + "&DoType=EditAutoJL\" >级联下拉框</a>");
                this.Pub1.AddSpace(1);
                this.Pub1.Add("<a class='easyui-linkbutton' href=\"TBFullCtrl.aspx?MyPK=" + mypk + "&FK_MapData=" + this.FK_MapData + "&ExtType=" + this.ExtType + "&RefNo=" + this.RefNo + "&DoType=EditAutoFullDtl\" >填充从表</a>");
                this.Pub1.AddSpace(1);
                this.Pub1.Add("<a class='easyui-linkbutton' href=\"TBFullCtrl.aspx?MyPK=" + mypk + "&FK_MapData=" + this.FK_MapData + "&ExtType=" + this.ExtType + "&RefNo=" + this.RefNo + "&DoType=EditAutoFullM2M\" >填充一对多</a>");
            }

            this.Pub1.AddTDEnd();
            this.Pub1.AddTREnd();
            this.Pub1.AddTableEnd();

            #region 输出事例
            ////this.Pub1.AddFieldSet("帮助");
            //this.Pub1.AddEasyUiPanelInfoBegin("帮助", "icon-help");
            //this.Pub1.AddB("For oracle:");
            //string sql = "自动填充SQL:<br />SELECT No as ~No~ , Name as ~Name~, Name as ~mingcheng~ FROM WF_Emp WHERE No LIKE '@Key%' AND ROWNUM<=15";
            //sql += "<br />关键字查询SQL:<br>SELECT No as ~No~ , Name as ~Name~, Name as ~mingcheng~ FROM WF_Emp WHERE No LIKE '@Key%'  ";
            //this.Pub1.AddBR(sql.Replace("~", "\""));

            //this.Pub1.AddB("<br />For sqlserver:");
            //sql = "自动填充SQL:<br />SELECT TOP 15 No, Name , Name as mingcheng FROM WF_Emp WHERE No LIKE '@Key%'";
            //sql += "<br />关键字查询SQL:<br>SELECT  No, Name , Name as mingcheng FROM WF_Emp WHERE No LIKE '@Key%'";
            //this.Pub1.AddBR(sql.Replace("~", "\""));
            //this.Pub1.AddB("<br />注意:");
            //this.Pub1.AddBR("1,文本框自动完成填充事例: 必须有No,Name两列,它用于显示下列出的提示列表。");
            //this.Pub1.AddBR("2,设置合适的记录数量,能够改善系统执行效率。");
            //this.Pub1.AddBR("3,@Key 是系统约定的关键字,就是当用户输入一个字符后ccform就会传递此关键字到数据库查询把结果返回给用户。");
            //this.Pub1.AddBR("4,其它的列与本表单的字段名相同则可自动填充,要注意大小写匹配。");
            //this.Pub1.AddBR("5,关键字查询sql是用来,双点文本框时弹出的查询语句,如果为空就按自动填充的sql计算。");
            ////this.Pub1.AddFieldSetEnd();
            //this.Pub1.AddEasyUiPanelInfoEnd();
            #endregion 输出事例
        }
        /// <summary>
        /// 保存(自动计算: @单价*@数量 模式.)
        /// </summary>
        /// <returns></returns>
        public string AutoFullDtlField_Save()
        {
            MapExt me = new MapExt();
            int    i  = me.Retrieve(MapExtAttr.ExtType, MapExtXmlList.AutoFullDtlField,
                                    MapExtAttr.FK_MapData, this.FK_MapData,
                                    MapExtAttr.AttrOfOper, this.KeyOfEn);

            me.FK_MapData = this.FK_MapData;
            me.AttrOfOper = this.KeyOfEn;
            me.Doc        = this.GetValFromFrmByKey("DDL_Dtl") + "." + this.GetValFromFrmByKey("DDL_Field") + "." + this.GetValFromFrmByKey("DDL_JSFS"); //要执行的表达式.

            me.ExtType = MapExtXmlList.AutoFullDtlField;

            me.Tag1 = this.GetValFromFrmByKey("TB_Tag1");
            me.Tag2 = this.GetValFromFrmByKey("TB_Tag2");

            string Tag = "0";

            try
            {
                Tag = this.GetValFromFrmByKey("CB_Tag");
                if (Tag == "on")
                {
                    Tag = "1";
                }
            }
            catch (Exception e)
            {
                Tag = "0";
            }


            me.Tag = Tag;

            string Tag3 = "0";

            try
            {
                Tag3 = this.GetValFromFrmByKey("CB_Tag3");
                if (Tag3 == "on")
                {
                    Tag3 = "1";
                }
            }
            catch (Exception e)
            {
                Tag3 = "0";
            }
            me.Tag3 = Tag3;

            me.Tag4 = this.GetValFromFrmByKey("DDL_Fileds");

            //执行保存.
            me.MyPK = MapExtXmlList.AutoFullDtlField + "_" + me.FK_MapData + "_" + me.AttrOfOper;
            if (me.Update() == 0)
            {
                me.Insert();
            }

            return("保存成功.");
        }
Пример #16
0
        void btn_SaveInputCheck_Click(object sender, EventArgs e)
        {
            ListBox lb = this.Pub1.FindControl("LB1") as ListBox;

            // 检查路径. 没有就创建它。
            string pathDir = BP.Sys.SystemConfig.PathOfDataUser + "\\JSLibData\\";

            if (Directory.Exists(pathDir) == false)
            {
                Directory.CreateDirectory(pathDir);
            }

            // 删除已经存在的数据.
            MapExt me = new MapExt();

            me.Retrieve(MapExtAttr.FK_MapData, this.FK_MapData,
                        MapExtAttr.ExtType, this.ExtType,
                        MapExtAttr.AttrOfOper, this.OperAttrKey);

            foreach (ListItem li in lb.Items)
            {
                if (li.Selected == false)
                {
                    continue;
                }

                me         = (MapExt)this.Pub1.Copy(me);
                me.ExtType = this.ExtType;

                // 操作的属性.
                me.AttrOfOper = this.OperAttrKey;

                int doWay = 0;
                if (this.Pub1.GetRadioButtonByID("RB_0").Checked == false)
                {
                    doWay = 1;
                }

                me.DoWay = doWay;
                me.Doc   = BP.DA.DataType.ReadTextFile(li.Value);
                FileInfo info = new FileInfo(li.Value);
                me.Tag2 = info.Directory.Name;

                //获取函数的名称.
                string func = me.Doc;
                func    = me.Doc.Substring(func.IndexOf("function") + 8);
                func    = func.Substring(0, func.IndexOf("("));
                me.Tag1 = func.Trim();

                // 检查路径,没有就创建它.
                FileInfo fi = new FileInfo(li.Value);
                me.Tag        = li.Value;
                me.FK_MapData = this.FK_MapData;
                me.ExtType    = this.ExtType;
                me.MyPK       = this.FK_MapData + "_" + me.ExtType + "_" + me.AttrOfOper + "_" + me.Tag1;
                try
                {
                    me.Insert();
                }
                catch
                {
                    me.Update();
                }
            }

            #region 把所有的js 文件放在一个文件里面。
            MapExts mes = new MapExts();
            mes.Retrieve(MapExtAttr.FK_MapData, this.FK_MapData,
                         MapExtAttr.ExtType, this.ExtType);

            string js = "";
            foreach (MapExt me1 in mes)
            {
                js += "\r\n" + BP.DA.DataType.ReadTextFile(me1.Tag);
            }

            if (File.Exists(pathDir + "\\" + this.FK_MapData + ".js"))
            {
                File.Delete(pathDir + "\\" + this.FK_MapData + ".js");
            }

            BP.DA.DataType.WriteFile(pathDir + "\\" + this.FK_MapData + ".js", js);
            #endregion 把所有的js 文件放在一个文件里面。

            this.Response.Redirect("InputCheck.aspx?FK_MapData=" + this.FK_MapData + "&ExtType=" + this.ExtType + "&RefNo=" + this.RefNo, true);
        }
Пример #17
0
        /// <summary>
        /// 产生一个WorkNode
        /// </summary>
        /// <param name="fk_flow">流程编号</param>
        /// <param name="fk_node">节点ID</param>
        /// <param name="workID">工作ID</param>
        /// <param name="fid">FID</param>
        /// <param name="userNo">用户编号</param>
        /// <returns>返回dataset</returns>
        public static DataSet GenerWorkNode(string fk_flow, int fk_node, Int64 workID, Int64 fid, string userNo, string fromWorkOpt = "0")
        {
            //节点.
            if (fk_node == 0)
            {
                fk_node = int.Parse(fk_flow + "01");
            }

            if (workID == 0)
            {
                workID = BP.WF.Dev2Interface.Node_CreateBlankWork(fk_flow, null, null, userNo, null);
            }

            Node nd = new Node(fk_node);

            try
            {
                nd.WorkID = workID; //为获取表单ID提供参数.
                MapData md = new MapData();
                md.No = nd.NodeFrmID;
                if (md.RetrieveFromDBSources() == 0)
                {
                    throw new Exception("装载错误,该表单ID=" + md.No + "丢失,请修复一次流程重新加载一次.");
                }

                Work wk = nd.HisWork;
                wk.OID = workID;

                wk.RetrieveFromDBSources();
                wk.ResetDefaultVal();

                // 第1.2: 调用,处理用户定义的业务逻辑.
                string sendWhen = nd.HisFlow.DoFlowEventEntity(EventListOfNode.FrmLoadBefore, nd,
                                                               wk, null);

                //获得表单模版.
                DataSet myds = BP.Sys.CCFormAPI.GenerHisDataSet(md.No, nd.Name);

                //移除MapAttr
                myds.Tables.Remove("Sys_MapAttr"); //移除.

                //获取表单的mapAttr
                //求出集合.
                MapAttrs mattrs = new MapAttrs(md.No);
                if (fk_node != null)
                {
                    /*处理表单权限控制方案*/
                    FrmNode frmNode = new FrmNode();
                    int     count   = frmNode.Retrieve(FrmNodeAttr.FK_Frm, md.No, FrmNodeAttr.FK_Node, fk_node);
                    if (count != 0 && frmNode.FrmSln != 0)
                    {
                        FrmFields fls = new FrmFields(md.No, frmNode.FK_Node);
                        foreach (FrmField item in fls)
                        {
                            foreach (MapAttr attr in mattrs)
                            {
                                if (attr.KeyOfEn != item.KeyOfEn)
                                {
                                    continue;
                                }

                                if (item.IsSigan)
                                {
                                    item.UIIsEnable = false;
                                }

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

                DataTable Sys_MapAttr = mattrs.ToDataTableField("Sys_MapAttr");
                myds.Tables.Add(Sys_MapAttr);

                //把流程信息表发送过去.
                GenerWorkFlow gwf = new GenerWorkFlow();
                gwf.WorkID = workID;
                gwf.RetrieveFromDBSources();

                //加入WF_Node.
                DataTable WF_Node = nd.ToDataTableField("WF_Node");
                myds.Tables.Add(WF_Node);

                #region 加入组件的状态信息, 在解析表单的时候使用.
                BP.WF.Template.FrmNodeComponent fnc = new FrmNodeComponent(nd.NodeID);

                nd.WorkID = workID; //为获取表单ID提供参数.
                if (nd.NodeFrmID != "ND" + nd.NodeID && nd.HisFormType != NodeFormType.RefOneFrmTree)
                {
                    /*说明这是引用到了其他节点的表单,就需要把一些位置元素修改掉.*/
                    int refNodeID = int.Parse(nd.NodeFrmID.Replace("ND", ""));

                    BP.WF.Template.FrmNodeComponent refFnc = new FrmNodeComponent(refNodeID);

                    fnc.SetValByKey(FrmWorkCheckAttr.FWC_H, refFnc.GetValFloatByKey(FrmWorkCheckAttr.FWC_H));
                    fnc.SetValByKey(FrmWorkCheckAttr.FWC_W, refFnc.GetValFloatByKey(FrmWorkCheckAttr.FWC_W));
                    fnc.SetValByKey(FrmWorkCheckAttr.FWC_X, refFnc.GetValFloatByKey(FrmWorkCheckAttr.FWC_X));
                    fnc.SetValByKey(FrmWorkCheckAttr.FWC_Y, refFnc.GetValFloatByKey(FrmWorkCheckAttr.FWC_Y));

                    if (fnc.GetValFloatByKey(FrmWorkCheckAttr.FWC_H) <= 10)
                    {
                        fnc.SetValByKey(FrmWorkCheckAttr.FWC_H, 500);
                    }

                    if (fnc.GetValFloatByKey(FrmWorkCheckAttr.FWC_W) <= 10)
                    {
                        fnc.SetValByKey(FrmWorkCheckAttr.FWC_W, 600);
                    }

                    if (fnc.GetValFloatByKey(FrmWorkCheckAttr.FWC_X) <= 10)
                    {
                        fnc.SetValByKey(FrmWorkCheckAttr.FWC_X, 200);
                    }

                    if (fnc.GetValFloatByKey(FrmWorkCheckAttr.FWC_Y) <= 10)
                    {
                        fnc.SetValByKey(FrmWorkCheckAttr.FWC_Y, 200);
                    }


                    fnc.SetValByKey(FrmSubFlowAttr.SF_H, refFnc.GetValFloatByKey(FrmSubFlowAttr.SF_H));
                    fnc.SetValByKey(FrmSubFlowAttr.SF_W, refFnc.GetValFloatByKey(FrmSubFlowAttr.SF_W));
                    fnc.SetValByKey(FrmSubFlowAttr.SF_X, refFnc.GetValFloatByKey(FrmSubFlowAttr.SF_X));
                    fnc.SetValByKey(FrmSubFlowAttr.SF_Y, refFnc.GetValFloatByKey(FrmSubFlowAttr.SF_Y));

                    fnc.SetValByKey(FrmThreadAttr.FrmThread_H, refFnc.GetValFloatByKey(FrmThreadAttr.FrmThread_H));
                    fnc.SetValByKey(FrmThreadAttr.FrmThread_W, refFnc.GetValFloatByKey(FrmThreadAttr.FrmThread_W));
                    fnc.SetValByKey(FrmThreadAttr.FrmThread_X, refFnc.GetValFloatByKey(FrmThreadAttr.FrmThread_X));
                    fnc.SetValByKey(FrmThreadAttr.FrmThread_Y, refFnc.GetValFloatByKey(FrmThreadAttr.FrmThread_Y));

                    fnc.SetValByKey(FrmTrackAttr.FrmTrack_H, refFnc.GetValFloatByKey(FrmTrackAttr.FrmTrack_H));
                    fnc.SetValByKey(FrmTrackAttr.FrmTrack_W, refFnc.GetValFloatByKey(FrmTrackAttr.FrmTrack_W));
                    fnc.SetValByKey(FrmTrackAttr.FrmTrack_X, refFnc.GetValFloatByKey(FrmTrackAttr.FrmTrack_X));
                    fnc.SetValByKey(FrmTrackAttr.FrmTrack_Y, refFnc.GetValFloatByKey(FrmTrackAttr.FrmTrack_Y));

                    fnc.SetValByKey(FTCAttr.FTC_H, refFnc.GetValFloatByKey(FTCAttr.FTC_H));
                    fnc.SetValByKey(FTCAttr.FTC_W, refFnc.GetValFloatByKey(FTCAttr.FTC_W));
                    fnc.SetValByKey(FTCAttr.FTC_X, refFnc.GetValFloatByKey(FTCAttr.FTC_X));
                    fnc.SetValByKey(FTCAttr.FTC_Y, refFnc.GetValFloatByKey(FTCAttr.FTC_Y));

                    #region 没有审核组件分组就增加上审核组件分组. @杜需要翻译&测试.
                    if (md.HisFrmType == FrmType.FoolForm)
                    {
                        //判断是否是傻瓜表单,如果是,就要判断该傻瓜表单是否有审核组件groupfield ,没有的话就增加上.
                        DataTable gf     = myds.Tables["Sys_GroupField"];
                        bool      isHave = false;
                        foreach (DataRow dr in gf.Rows)
                        {
                            string cType = dr["CtrlType"] as string;
                            if (cType == null)
                            {
                                continue;
                            }

                            if (cType.Equals("FWC") == true)
                            {
                                isHave = true;
                            }
                        }

                        if (isHave == false)
                        {
                            DataRow dr = gf.NewRow();

                            nd.WorkID = workID; //为获取表单ID提供参数.
                            dr[GroupFieldAttr.OID]      = 100;
                            dr[GroupFieldAttr.FrmID]    = nd.NodeFrmID;
                            dr[GroupFieldAttr.CtrlType] = "FWC";
                            dr[GroupFieldAttr.CtrlID]   = "FWCND" + nd.NodeID;
                            dr[GroupFieldAttr.Idx]      = 100;
                            dr[GroupFieldAttr.Lab]      = "审核信息";
                            gf.Rows.Add(dr);

                            myds.Tables.Remove("Sys_GroupField");
                            myds.Tables.Add(gf);

                            //执行更新,就自动生成那个丢失的字段分组.
                            refFnc.Update();

                            /*
                             * //丢失了就插入新的.
                             * BP.Sys.GroupField gfEn = new GroupField();
                             * gfEn.FrmID = nd.NodeFrmID;
                             * gfEn.CtrlType = "FWC";
                             * gfEn.CtrlID = "FWCND" + nd.NodeID;
                             * gfEn.Idx = 100;
                             * gfEn.Lab = "审核信息";
                             * gfEn.Insert(); */
                        }
                    }
                    #endregion 没有审核组件分组就增加上审核组件分组.
                }

                #region 没有审核组件分组就增加上审核组件分组. @杜需要翻译&测试.
                if (nd.NodeFrmID == "ND" + nd.NodeID && nd.HisFormType != NodeFormType.RefOneFrmTree)
                {
                    //   Work wk1 = nd.HisWork;

                    if (nd.FormType == NodeFormType.FoolForm)
                    {
                        //判断是否是傻瓜表单,如果是,就要判断该傻瓜表单是否有审核组件groupfield ,没有的话就增加上.
                        DataTable gf     = myds.Tables["Sys_GroupField"];
                        bool      isHave = false;
                        foreach (DataRow dr in gf.Rows)
                        {
                            string cType = dr["CtrlType"] as string;
                            if (cType == null)
                            {
                                continue;
                            }

                            if (cType.Equals("FWC") == true)
                            {
                                isHave = true;
                            }
                        }

                        if (isHave == false)
                        {
                            DataRow dr = gf.NewRow();

                            nd.WorkID = workID; //为获取表单ID提供参数.
                            dr[GroupFieldAttr.OID]      = 100;
                            dr[GroupFieldAttr.FrmID]    = nd.NodeFrmID;
                            dr[GroupFieldAttr.CtrlType] = "FWC";
                            dr[GroupFieldAttr.CtrlID]   = "FWCND" + nd.NodeID;
                            dr[GroupFieldAttr.Idx]      = 100;
                            dr[GroupFieldAttr.Lab]      = "审核信息";
                            gf.Rows.Add(dr);

                            myds.Tables.Remove("Sys_GroupField");
                            myds.Tables.Add(gf);

                            //更新,为了让其自动增加审核分组.
                            BP.WF.Template.FrmNodeComponent refFnc = new FrmNodeComponent(nd.NodeID);
                            refFnc.Update();
                        }
                    }
                }
                #endregion 没有审核组件分组就增加上审核组件分组.

                myds.Tables.Add(fnc.ToDataTableField("WF_FrmNodeComponent"));

                #endregion 加入组件的状态信息, 在解析表单的时候使用.

                #region 增加 groupfields
                if (nd.FormType == NodeFormType.FoolTruck && nd.IsStartNode == false &&
                    DataType.IsNullOrEmpty(wk.HisPassedFrmIDs) == false)
                {
                    #region 处理字段分组排序.
                    //查询所有的分组, 如果是查看表单的方式,就不应该把当前的表单显示出来.
                    string myFrmIDs = "";
                    if (fromWorkOpt.Equals("1") == true)
                    {
                        if (gwf.WFState == WFState.Complete)
                        {
                            myFrmIDs = wk.HisPassedFrmIDs + ",'ND" + fk_node + "'";
                        }
                        else
                        {
                            myFrmIDs = wk.HisPassedFrmIDs; //流程未完成并且是查看表单的情况.
                        }
                    }
                    else
                    {
                        myFrmIDs = wk.HisPassedFrmIDs + ",'ND" + fk_node + "'";
                    }

                    GroupFields gfs = new GroupFields();
                    gfs.RetrieveIn(GroupFieldAttr.FrmID, "(" + myFrmIDs + ")");

                    //按照时间的顺序查找出来 ids .
                    string sqlOrder = "SELECT OID FROM  Sys_GroupField WHERE   FrmID IN (" + myFrmIDs + ")";
                    if (BP.Sys.SystemConfig.AppCenterDBType == DBType.Oracle)
                    {
                        myFrmIDs  = myFrmIDs.Replace("'", "");
                        sqlOrder += " ORDER BY INSTR('" + myFrmIDs + "',FrmID) , Idx";
                    }

                    if (BP.Sys.SystemConfig.AppCenterDBType == DBType.MSSQL)
                    {
                        myFrmIDs  = myFrmIDs.Replace("'", "");
                        sqlOrder += " ORDER BY CHARINDEX(FrmID, '" + myFrmIDs + "'), Idx";
                    }

                    if (BP.Sys.SystemConfig.AppCenterDBType == DBType.MySQL)
                    {
                        myFrmIDs  = myFrmIDs.Replace("'", "");
                        sqlOrder += " ORDER BY INSTR('" + myFrmIDs + "', FrmID ), Idx";
                    }
                    DataTable dtOrder = DBAccess.RunSQLReturnTable(sqlOrder);

                    //创建容器,把排序的分组放入这个容器.
                    GroupFields gfsNew = new GroupFields();

                    //遍历查询出来的分组.
                    foreach (DataRow dr in dtOrder.Rows)
                    {
                        string pkOID = dr[0].ToString();
                        var    mygf  = gfs.GetEntityByKey(pkOID);
                        gfsNew.AddEntity(mygf); //把分组字段加入里面去.
                    }

                    DataTable dtGF = gfsNew.ToDataTableField("Sys_GroupField");
                    myds.Tables.Remove("Sys_GroupField");
                    myds.Tables.Add(dtGF);
                    #endregion 处理字段分组排序.

                    #region 处理 mapattrs
                    //求当前表单的字段集合.
                    MapAttrs    attrs = new MapAttrs();
                    QueryObject qo    = new QueryObject(attrs);
                    qo.AddWhere(MapAttrAttr.FK_MapData, "ND" + nd.NodeID);
                    qo.addOrderBy(MapAttrAttr.Idx);
                    qo.DoQuery();

                    //计算累加的字段集合.
                    MapAttrs attrsLeiJia = new MapAttrs();
                    qo = new QueryObject(attrsLeiJia);
                    qo.AddWhere(MapAttrAttr.FK_MapData, " IN ", "(" + wk.HisPassedFrmIDs + ")");
                    qo.addOrderBy(MapAttrAttr.Idx);
                    qo.DoQuery();

                    //把两个集合接起来.
                    foreach (MapAttr item in attrsLeiJia)
                    {
                        item.UIIsEnable = false; //设置为只读的.
                        attrs.AddEntity(item);
                    }

                    //替换掉现有的.
                    myds.Tables.Remove("Sys_MapAttr");                      //移除.
                    myds.Tables.Add(attrs.ToDataTableField("Sys_MapAttr")); //增加.
                    #endregion 处理mapattrs

                    #region 把枚举放入里面去.
                    myds.Tables.Remove("Sys_Enum");

                    myFrmIDs = wk.HisPassedFrmIDs + ",'ND" + fk_node + "'";
                    SysEnums enums = new SysEnums();
                    enums.RetrieveInSQL(SysEnumAttr.EnumKey,
                                        "SELECT UIBindKey FROM Sys_MapAttr WHERE FK_MapData in(" + myFrmIDs + ")");

                    // 加入最新的枚举.
                    myds.Tables.Add(enums.ToDataTableField("Sys_Enum"));
                    #endregion 把枚举放入里面去.

                    #region  MapExt .
                    myds.Tables.Remove("Sys_MapExt");

                    // 把扩展放入里面去.
                    myFrmIDs = wk.HisPassedFrmIDs + ",'ND" + fk_node + "'";
                    BP.Sys.MapExts exts = new MapExts();
                    qo = new QueryObject(exts);
                    qo.AddWhere(MapExtAttr.FK_MapData, " IN ", "(" + myFrmIDs + ")");
                    qo.DoQuery();

                    // 加入最新的MapExt.
                    myds.Tables.Add(exts.ToDataTableField("Sys_MapExt"));
                    #endregion  MapExt .
                }
                #endregion 增加 groupfields

                #region 流程设置信息.
                if (nd.IsStartNode == false)
                {
                    BP.WF.Dev2Interface.Node_SetWorkRead(fk_node, workID);

                    // @杜.
                    if (gwf.TodoEmps.Contains(BP.Web.WebUser.Name + ";") == false)
                    {
                        gwf.TodoEmps += BP.Web.WebUser.No + "," + BP.Web.WebUser.Name;
                        gwf.Update();
                    }
                }

                //增加转向下拉框数据.
                if (nd.CondModel == CondModel.SendButtonSileSelect)
                {
                    if (nd.IsStartNode == true || gwf.TodoEmps.Contains(WebUser.No + ",") == true)
                    {
                        /*如果当前不是主持人,如果不是主持人,就不让他显示下拉框了.*/

                        /*如果当前节点,是可以显示下拉框的.*/
                        Nodes nds = nd.HisToNodes;

                        DataTable dtToNDs = new DataTable();
                        dtToNDs.TableName = "ToNodes";
                        dtToNDs.Columns.Add("No", typeof(string));           //节点ID.
                        dtToNDs.Columns.Add("Name", typeof(string));         //到达的节点名称.
                        dtToNDs.Columns.Add("IsSelectEmps", typeof(string)); //是否弹出选择人的对话框?
                        dtToNDs.Columns.Add("IsSelected", typeof(string));   //是否选择?

                        #region 增加到达延续子流程节点。
                        NodeYGFlows ygflows = new NodeYGFlows(fk_node.ToString());
                        if (ygflows.Count > 1 && SystemConfig.CustomerNo.Equals("CZBank") == true)
                        {
                            dtToNDs.Rows.Clear();  //为浙商银行做的特殊判断,如果配置了延续流程,就不让其走分支节点.
                        }
                        foreach (NodeYGFlow item in ygflows)
                        {
                            DataRow dr = dtToNDs.NewRow();
                            dr["No"]   = item.FK_Flow + "01";
                            dr["Name"] = "启动:" + item.FlowName;
                            //if (item.HisDeliveryWay == DeliveryWay.BySelected)
                            dr["IsSelectEmps"] = "1";
                            //else
                            //  dr["IsSelectEmps"] = "0";  //是不是,可以选择接受人.

                            //设置默认选择的节点.
                            //if (defalutSelectedNodeID == item.NodeID)
                            //    dr["IsSelected"] = "1";
                            //else
                            //    dr["IsSelected"] = "0";

                            dr["IsSelected"] = "0";
                            dtToNDs.Rows.Add(dr);
                        }
                        #endregion 增加到达延续子流程节点。

                        #region 到达其他节点.
                        //上一次选择的节点.
                        int defalutSelectedNodeID = 0;
                        if (nds.Count > 1)
                        {
                            string mysql = "";
                            // 找出来上次发送选择的节点.
                            if (SystemConfig.AppCenterDBType == DBType.MSSQL)
                            {
                                mysql = "SELECT  top 1 NDTo FROM ND" + int.Parse(nd.FK_Flow) + "Track A WHERE A.NDFrom=" + fk_node + " AND ActionType=1 ORDER BY WorkID DESC";
                            }
                            else if (SystemConfig.AppCenterDBType == DBType.Oracle)
                            {
                                mysql = "SELECT * FROM ( SELECT  NDTo FROM ND" + int.Parse(nd.FK_Flow) + "Track A WHERE A.NDFrom=" + fk_node + " AND ActionType=1 ORDER BY WorkID DESC ) WHERE ROWNUM =1";
                            }
                            else if (SystemConfig.AppCenterDBType == DBType.MySQL)
                            {
                                mysql = "SELECT  NDTo FROM ND" + int.Parse(nd.FK_Flow) + "Track A WHERE A.NDFrom=" + fk_node + " AND ActionType=1 ORDER BY WorkID  DESC limit 1,1";
                            }

                            //获得上一次发送到的节点.
                            defalutSelectedNodeID = DBAccess.RunSQLReturnValInt(mysql, 0);
                        }

                        #region 为天业集团做一个特殊的判断.
                        if (SystemConfig.CustomerNo == "TianYe" && nd.Name.Contains("董事长") == true)
                        {
                            /*如果是董事长节点, 如果是下一个节点默认的是备案. */
                            foreach (Node item in nds)
                            {
                                if (item.Name.Contains("备案") == true && item.Name.Contains("待") == false)
                                {
                                    defalutSelectedNodeID = item.NodeID;
                                    break;
                                }
                            }
                        }
                        #endregion 为天业集团做一个特殊的判断.


                        foreach (Node item in nds)
                        {
                            DataRow dr = dtToNDs.NewRow();
                            dr["No"]   = item.NodeID;
                            dr["Name"] = item.Name;
                            //if (item.hissel

                            if (item.HisDeliveryWay == DeliveryWay.BySelected)
                            {
                                dr["IsSelectEmps"] = "1";
                            }
                            else
                            {
                                dr["IsSelectEmps"] = "0";  //是不是,可以选择接受人.
                            }
                            //设置默认选择的节点.
                            if (defalutSelectedNodeID == item.NodeID)
                            {
                                dr["IsSelected"] = "1";
                            }
                            else
                            {
                                dr["IsSelected"] = "0";
                            }

                            dtToNDs.Rows.Add(dr);
                        }
                        #endregion 到达其他节点。


                        //增加一个下拉框, 对方判断是否有这个数据.
                        myds.Tables.Add(dtToNDs);
                    }
                }

                // 节点数据.
                //string sql = "SELECT * FROM WF_Node WHERE NodeID=" + fk_node;
                //DataTable dt = BP.DA.DBAccess.RunSQLReturnTable(sql);
                //dt.TableName = "WF_NodeBar";
                //myds.Tables.Add(dt);

                //// 流程数据.
                //Flow fl = new Flow(fk_flow);
                //myds.Tables.Add(fl.ToDataTableField("WF_Flow"));
                #endregion 流程设置信息.

                #region 把主从表数据放入里面.
                //.工作数据放里面去, 放进去前执行一次装载前填充事件.

                //重设默认值.
                wk.ResetDefaultVal();

                //@樊雷伟 把这部分代码搬到jflow上去. CCFlowAPI. 114行出.
                if (BP.Sys.SystemConfig.IsBSsystem == true)
                {
                    // 处理传递过来的参数。
                    foreach (string k in System.Web.HttpContext.Current.Request.QueryString.AllKeys)
                    {
                        if (DataType.IsNullOrEmpty(k) == true)
                        {
                            continue;
                        }

                        wk.SetValByKey(k, System.Web.HttpContext.Current.Request.QueryString[k]);
                    }

                    // 处理传递过来的frm参数。
                    foreach (string k in System.Web.HttpContext.Current.Request.Form.AllKeys)
                    {
                        if (DataType.IsNullOrEmpty(k) == true)
                        {
                            continue;
                        }
                        wk.SetValByKey(k, System.Web.HttpContext.Current.Request.Form[k]);
                    }

                    //更新到数据库里.
                    wk.DirectUpdate();
                }

                // 执行表单事件..
                string msg = md.DoEvent(FrmEventList.FrmLoadBefore, wk);
                if (DataType.IsNullOrEmpty(msg) == false)
                {
                    throw new Exception("err@错误:" + msg);
                }

                // 执行FEE事件.
                string msgOfLoad = nd.HisFlow.DoFlowEventEntity(EventListOfNode.FrmLoadBefore, nd,
                                                                wk, null);
                if (msgOfLoad != null)
                {
                    wk.RetrieveFromDBSources();
                }

                //执行装载填充.
                MapExt me = new MapExt();
                if (me.Retrieve(MapExtAttr.ExtType, MapExtXmlList.PageLoadFull, MapExtAttr.FK_MapData, wk.NodeFrmID) == 1)
                {
                    //执行通用的装载方法.
                    MapAttrs attrs = new MapAttrs(wk.NodeFrmID);
                    MapDtls  dtls  = new MapDtls(wk.NodeFrmID);
                    wk = BP.WF.Glo.DealPageLoadFull(wk, me, attrs, dtls) as Work;
                }

                //如果是累加表单,就把整个rpt数据都放入里面去.
                if (nd.FormType == NodeFormType.FoolTruck && nd.IsStartNode == false &&
                    DataType.IsNullOrEmpty(wk.HisPassedFrmIDs) == false)
                {
                    GERpt rpt = new GERpt("ND" + int.Parse(nd.FK_Flow) + "Rpt", workID); // nd.HisFlow.HisGERpt;
                    rpt.ResetDefaultVal();

                    //rpt.Copy(wk); //加入后就出现了错误.

                    myds.Tables.Add(rpt.ToDataTableField("MainTable"));
                    // myds.WriteXml("C:\\XX.xml");
                }
                else
                {
                    DataTable mainTable = wk.ToDataTableField(md.No);
                    mainTable.TableName = "MainTable";
                    myds.Tables.Add(mainTable);
                }
                string    sql = "";
                DataTable dt  = null;
                #endregion

                #region 把外键表加入DataSet
                DataTable dtMapAttr = myds.Tables["Sys_MapAttr"];
                MapExts   mes       = md.MapExts;
                foreach (DataRow dr in dtMapAttr.Rows)
                {
                    string lgType    = dr["LGType"].ToString();
                    string uiBindKey = dr["UIBindKey"].ToString();

                    if (DataType.IsNullOrEmpty(uiBindKey) == true)
                    {
                        continue; //为空就continue.
                    }
                    if (lgType.Equals("1") == true)
                    {
                        continue; //枚举值就continue;
                    }
                    string uiIsEnable = dr["UIIsEnable"].ToString();
                    if (uiIsEnable.Equals("0") == true && lgType.Equals("1") == true)
                    {
                        continue; //如果是外键,并且是不可以编辑的状态.
                    }
                    if (uiIsEnable.Equals("1") == true && lgType.Equals("0") == true)
                    {
                        continue; //如果是外部数据源,并且是不可以编辑的状态.
                    }
                    // 检查是否有下拉框自动填充。
                    string keyOfEn    = dr["KeyOfEn"].ToString();
                    string fk_mapData = dr["FK_MapData"].ToString();


                    #region 处理下拉框数据范围. for 小杨.
                    me = mes.GetEntityByKey(MapExtAttr.ExtType, MapExtXmlList.AutoFullDLL, MapExtAttr.AttrOfOper, keyOfEn) as MapExt;
                    if (me != null)
                    {
                        string fullSQL = me.Doc.Clone() as string;
                        fullSQL = fullSQL.Replace("~", ",");
                        fullSQL = BP.WF.Glo.DealExp(fullSQL, wk, null);
                        dt      = DBAccess.RunSQLReturnTable(fullSQL);
                        //重构新表
                        DataTable dt_FK_Dll = new DataTable();
                        dt_FK_Dll.TableName = keyOfEn;//可能存在隐患,如果多个字段,绑定同一个表,就存在这样的问题.
                        dt_FK_Dll.Columns.Add("No", typeof(string));
                        dt_FK_Dll.Columns.Add("Name", typeof(string));
                        foreach (DataRow dllRow in dt.Rows)
                        {
                            DataRow drDll = dt_FK_Dll.NewRow();
                            drDll["No"]   = dllRow["No"];
                            drDll["Name"] = dllRow["Name"];
                            dt_FK_Dll.Rows.Add(drDll);
                        }
                        myds.Tables.Add(dt_FK_Dll);
                        continue;
                    }
                    #endregion 处理下拉框数据范围.

                    // 判断是否存在.
                    if (myds.Tables.Contains(uiBindKey) == true)
                    {
                        continue;
                    }

                    if (BP.Sys.PubClass.GetDataTableByUIBineKey(uiBindKey) != null)
                    {
                        myds.Tables.Add(BP.Sys.PubClass.GetDataTableByUIBineKey(uiBindKey));
                    }
                }
                #endregion End把外键表加入DataSet

                #region 处理流程-消息提示.
                DataTable dtAlert = new DataTable();
                dtAlert.TableName = "AlertMsg";

                dtAlert.Columns.Add("Title", typeof(string));
                dtAlert.Columns.Add("Msg", typeof(string));
                dtAlert.Columns.Add("URL", typeof(string));

                //  string msg = "";
                switch (gwf.WFState)
                {
                case WFState.AskForReplay:     // 返回加签的信息.
                    string mysql = "SELECT * FROM ND" + int.Parse(fk_flow) + "Track WHERE WorkID=" + workID + " AND " + TrackAttr.ActionType + "=" + (int)ActionType.ForwardAskfor;

                    DataTable mydt = BP.DA.DBAccess.RunSQLReturnTable(mysql);
                    foreach (DataRow dr in mydt.Rows)
                    {
                        string msgAskFor  = dr[TrackAttr.Msg].ToString();
                        string worker     = dr[TrackAttr.EmpFrom].ToString();
                        string workerName = dr[TrackAttr.EmpFromT].ToString();
                        string rdt        = dr[TrackAttr.RDT].ToString();

                        DataRow drMsg = dtAlert.NewRow();
                        drMsg["Title"] = worker + "," + workerName + "回复信息:";
                        drMsg["Msg"]   = DataType.ParseText2Html(msgAskFor) + "<br>" + rdt;
                        dtAlert.Rows.Add(drMsg);
                    }
                    break;

                case WFState.Askfor:     //加签.

                    sql = "SELECT * FROM ND" + int.Parse(fk_flow) + "Track WHERE WorkID=" + workID + " AND " + TrackAttr.ActionType + "=" + (int)ActionType.AskforHelp;
                    dt  = BP.DA.DBAccess.RunSQLReturnTable(sql);
                    foreach (DataRow dr in dt.Rows)
                    {
                        string msgAskFor  = dr[TrackAttr.Msg].ToString();
                        string worker     = dr[TrackAttr.EmpFrom].ToString();
                        string workerName = dr[TrackAttr.EmpFromT].ToString();
                        string rdt        = dr[TrackAttr.RDT].ToString();

                        DataRow drMsg = dtAlert.NewRow();
                        drMsg["Title"] = worker + "," + workerName + "请求加签:";
                        drMsg["Msg"]   = DataType.ParseText2Html(msgAskFor) + "<br>" + rdt + "<a href='./WorkOpt/AskForRe.htm?FK_Flow=" + fk_flow + "&FK_Node=" + fk_node + "&WorkID=" + workID + "&FID=" + fid + "' >回复加签意见</a> --";
                        dtAlert.Rows.Add(drMsg);

                        //提示信息.
                        // this.FlowMsg.AlertMsg_Info(worker + "," + workerName + "请求加签:",
                        //   DataType.ParseText2Html(msgAskFor) + "<br>" + rdt + " --<a href='./WorkOpt/AskForRe.aspx?FK_Flow=" + this.FK_Flow + "&FK_Node=" + this.FK_Node + "&WorkID=" + this.WorkID + "&FID=" + this.FID + "' >回复加签意见</a> --");
                    }
                    // isAskFor = true;
                    break;

                case WFState.ReturnSta:
                    /* 如果工作节点退回了*/
                    ReturnWorks rws = new ReturnWorks();
                    rws.Retrieve(ReturnWorkAttr.ReturnToNode, fk_node,
                                 ReturnWorkAttr.WorkID, workID,
                                 ReturnWorkAttr.RDT);

                    if (rws.Count != 0)
                    {
                        //string msgInfo = "";
                        //foreach (BP.WF.ReturnWork rw in rws)
                        //{
                        //    DataRow drMsg = dtAlert.NewRow();
                        //    //drMsg["Title"] = "来自节点:" + rw.ReturnNodeName + " 退回人:" + rw.ReturnerName + "  " + rw.RDT + "&nbsp;<a href='/DataUser/ReturnLog/" + fk_flow + "/" + rw.MyPK + ".htm' target=_blank>工作日志</a>";
                        //    drMsg["Title"] = "来自节点:" + rw.ReturnNodeName + " 退回人:" + rw.ReturnerName + "  " + rw.RDT;
                        //    drMsg["Msg"] = rw.BeiZhuHtml;
                        //    dtAlert.Rows.Add(drMsg);
                        //}

                        string msgInfo = "";
                        foreach (BP.WF.ReturnWork rw in rws)
                        {
                            //drMsg["Title"] = "来自节点:" + rw.ReturnNodeName + " 退回人:" + rw.ReturnerName + "  " + rw.RDT + "&nbsp;<a href='/DataUser/ReturnLog/" + fk_flow + "/" + rw.MyPK + ".htm' target=_blank>工作日志</a>";
                            msgInfo += "\t\n来自节点:" + rw.ReturnNodeName + " 退回人:" + rw.ReturnerName + "  " + rw.RDT;
                            msgInfo += rw.BeiZhuHtml;
                        }

                        string str = nd.ReturnAlert;
                        if (str != "")
                        {
                            str = str.Replace("~", "'");
                            str = str.Replace("@PWorkID", workID.ToString());
                            str = str.Replace("@PNodeID", nd.NodeID.ToString());
                            str = str.Replace("@FK_Node", nd.NodeID.ToString());

                            str = str.Replace("@PFlowNo", fk_flow);
                            str = str.Replace("@FK_Flow", fk_flow);
                            str = str.Replace("@PWorkID", workID.ToString());

                            str = str.Replace("@WorkID", workID.ToString());
                            str = str.Replace("@OID", workID.ToString());

                            DataRow drMsg = dtAlert.NewRow();
                            drMsg["Title"] = "退回信息";
                            drMsg["Msg"]   = msgInfo + "\t\n" + str;
                            dtAlert.Rows.Add(drMsg);
                        }
                        else
                        {
                            DataRow drMsg = dtAlert.NewRow();
                            drMsg["Title"] = "退回信息";
                            drMsg["Msg"]   = msgInfo + "\t\n" + str;
                            dtAlert.Rows.Add(drMsg);
                        }
                    }
                    break;

                case WFState.Shift:
                    /* 判断移交过来的。 */
                    ShiftWorks        fws = new ShiftWorks();
                    BP.En.QueryObject qo  = new QueryObject(fws);
                    qo.AddWhere(ShiftWorkAttr.WorkID, workID);
                    qo.addAnd();
                    qo.AddWhere(ShiftWorkAttr.FK_Node, fk_node);
                    qo.addOrderBy(ShiftWorkAttr.RDT);
                    qo.DoQuery();
                    if (fws.Count >= 1)
                    {
                        DataRow drMsg = dtAlert.NewRow();
                        drMsg["Title"] = "移交历史信息";
                        msg            = "";
                        foreach (ShiftWork fw in fws)
                        {
                            string temp = "@移交人[" + fw.FK_Emp + "," + fw.FK_EmpName + "]。@接受人:" + fw.ToEmp + "," + fw.ToEmpName + "。<br>移交原因:-------------" + fw.NoteHtml;
                            if (fw.FK_Emp == WebUser.No)
                            {
                                temp = "<b>" + temp + "</b>";
                            }

                            temp = temp.Replace("@", "<br>@");
                            msg += temp + "<hr/>";
                        }
                        drMsg["Msg"] = msg;
                        dtAlert.Rows.Add(drMsg);
                    }
                    break;

                default:
                    break;
                }
                #endregion

                #region 增加流程节点表单绑定信息.
                if (nd.HisFormType == NodeFormType.RefOneFrmTree)
                {
                    /* 独立流程节点表单. */

                    nd.WorkID = workID; //为获取表单ID ( NodeFrmID )提供参数.

                    FrmNode fn = new FrmNode();
                    fn.MyPK = nd.NodeFrmID + "_" + nd.NodeID + "_" + nd.FK_Flow;
                    fn.Retrieve();
                    myds.Tables.Add(fn.ToDataTableField("FrmNode"));
                }
                #endregion 增加流程节点表单绑定信息.


                myds.Tables.Add(dtAlert);
                return(myds);
            }
            catch (Exception ex)
            {
                Log.DebugWriteError(ex.StackTrace);
                throw new Exception(ex.Message);
            }
        }
Пример #18
0
        /// <summary>
        /// 仅获取表单数据
        /// </summary>
        /// <param name="frmID">表单ID</param>
        /// <param name="pkval">主键</param>
        /// <param name="atParas">参数</param>
        /// <param name="specDtlFrmID">指定明细表的参数,如果为空就标识主表数据,否则就是从表数据.</param>
        /// <returns>数据</returns>
        public static DataSet GenerDBForVSTOExcelFrmModel(string frmID, object pkval, string atParas, string specDtlFrmID = null)
        {
            //如果是一个实体类.
            if (frmID.Contains("BP."))
            {
                // 执行map同步.
                Entities ens = BP.En.ClassFactory.GetEns(frmID + "s");
                Entity   en  = ens.GetNewEntity;
                en.DTSMapToSys_MapData();

                return(GenerDBForVSTOExcelFrmModelOfEntity(frmID, pkval, atParas, specDtlFrmID = null));

                //上面这行代码的解释(2017-04-25):
                //若不加上这行,代码执行到“ MapData md = new MapData(frmID); ”会报错:
                //@没有找到记录[表单注册表  Sys_MapData, [ 主键=No 值=BP.LI.BZQX ]记录不存在,请与管理员联系, 或者确认输入错误.@在Entity(BP.Sys.MapData)查询期间出现错误@   在 BP.En.Entity.Retrieve() 位置 D:\ccflow\Components\BP.En30\En\Entity.cs:行号 1051
                //即使加上:
                //frmID = frmID.Substring(0, frmID.Length - 1);
                //也会出现该问题
                //2017-04-25 15:26:34:new MapData(frmID)应传入“BZQX”,但考虑到 GenerDBForVSTOExcelFrmModelOfEntity()运行稳定,暂不采用『统一执行下方代码』的方案。
            }

            //数据容器,就是要返回的对象.
            DataSet myds = new DataSet();

            //映射实体.
            MapData md = new MapData(frmID);

            //实体.
            GEEntity wk = new GEEntity(frmID);

            wk.OID = int.Parse(pkval.ToString());
            if (wk.RetrieveFromDBSources() == 0)
            {
                wk.Insert();
            }

            //加载事件.
            md.DoEvent(FrmEventList.FrmLoadBefore, wk, null);

            //把参数放入到 En 的 Row 里面。
            if (DataType.IsNullOrEmpty(atParas) == false)
            {
                AtPara ap = new AtPara(atParas);
                foreach (string key in ap.HisHT.Keys)
                {
                    if (wk.Row.ContainsKey(key) == true)                     //有就该变.
                    {
                        wk.Row[key] = ap.GetValStrByKey(key);
                    }
                    else
                    {
                        wk.Row.Add(key, ap.GetValStrByKey(key));                         //增加他.
                    }
                }
            }

            //属性.
            MapExt    me        = null;
            DataTable dtMapAttr = null;
            MapExts   mes       = null;



            #region 表单模版信息.(含主、从表的,以及从表的枚举/外键相关数据).
            //增加表单字段描述.
            string    sql = "SELECT * FROM Sys_MapData WHERE No='" + frmID + "' ";
            DataTable dt  = BP.DA.DBAccess.RunSQLReturnTable(sql);
            dt.TableName = "Sys_MapData";
            myds.Tables.Add(dt);

            //增加表单字段描述.
            sql          = "SELECT * FROM Sys_MapAttr WHERE FK_MapData='" + frmID + "' ";
            dt           = BP.DA.DBAccess.RunSQLReturnTable(sql);
            dt.TableName = "Sys_MapAttr";
            myds.Tables.Add(dt);

            //增加从表信息.
            sql          = "SELECT * FROM Sys_MapDtl WHERE FK_MapData='" + frmID + "' ";
            dt           = BP.DA.DBAccess.RunSQLReturnTable(sql);
            dt.TableName = "Sys_MapDtl";
            myds.Tables.Add(dt);


            //主表的配置信息.
            sql          = "SELECT * FROM Sys_MapExt WHERE FK_MapData='" + frmID + "'";
            dt           = BP.DA.DBAccess.RunSQLReturnTable(sql);
            dt.TableName = "Sys_MapExt";
            myds.Tables.Add(dt);

            #region 加载 从表表单模版信息.(含 从表的枚举/外键相关数据)
            foreach (MapDtl item in md.MapDtls)
            {
                #region 返回指定的明细表的数据.
                if (DataType.IsNullOrEmpty(specDtlFrmID) == true)
                {
                }
                else
                {
                    if (item.No != specDtlFrmID)
                    {
                        continue;
                    }
                }
                #endregion 返回指定的明细表的数据.

                //明细表的主表描述
                sql          = "SELECT * FROM Sys_MapDtl WHERE No='" + item.No + "'";
                dt           = BP.DA.DBAccess.RunSQLReturnTable(sql);
                dt.TableName = "Sys_MapDtl_For_" + (string.IsNullOrWhiteSpace(item.Alias) ? item.No : item.Alias);
                myds.Tables.Add(dt);

                //明细表的表单描述
                sql                 = "SELECT * FROM Sys_MapAttr WHERE FK_MapData='" + item.No + "'";
                dtMapAttr           = BP.DA.DBAccess.RunSQLReturnTable(sql);
                dtMapAttr.TableName = "Sys_MapAttr_For_" + (string.IsNullOrWhiteSpace(item.Alias) ? item.No : item.Alias);
                myds.Tables.Add(dtMapAttr);

                //明细表的配置信息.
                sql          = "SELECT * FROM Sys_MapExt WHERE FK_MapData='" + item.No + "'";
                dt           = BP.DA.DBAccess.RunSQLReturnTable(sql);
                dt.TableName = "Sys_MapExt_For_" + (string.IsNullOrWhiteSpace(item.Alias) ? item.No : item.Alias);
                myds.Tables.Add(dt);

                #region 从表的 外键表/枚举
                mes = new MapExts(item.No);
                foreach (DataRow dr in dtMapAttr.Rows)
                {
                    string lgType = dr["LGType"].ToString();
                    //不是枚举/外键字段
                    if (lgType.Equals("0"))
                    {
                        continue;
                    }

                    string uiBindKey = dr["UIBindKey"].ToString();
                    var    mypk      = dr["MyPK"].ToString();

                    #region 枚举字段
                    if (lgType.Equals("1"))
                    {
                        // 如果是枚举值, 判断是否存在.
                        if (myds.Tables.Contains(uiBindKey) == true)
                        {
                            continue;
                        }

                        string    mysql  = "SELECT IntKey AS No, Lab as Name FROM Sys_Enum WHERE EnumKey='" + uiBindKey + "' ORDER BY IntKey ";
                        DataTable dtEnum = DBAccess.RunSQLReturnTable(mysql);
                        dtEnum.TableName = uiBindKey;
                        myds.Tables.Add(dtEnum);
                        continue;
                    }
                    #endregion

                    string UIIsEnable = dr["UIIsEnable"].ToString();
                    if (UIIsEnable.Equals("0"))                     //字段未启用
                    {
                        continue;
                    }

                    #region 外键字段
                    // 检查是否有下拉框自动填充。
                    string keyOfEn = dr["KeyOfEn"].ToString();

                    #region 处理下拉框数据范围. for 小杨.
                    me = mes.GetEntityByKey(MapExtAttr.ExtType, MapExtXmlList.AutoFullDLL, MapExtAttr.AttrOfOper, keyOfEn) as MapExt;
                    if (me != null)                     //有范围限制时
                    {
                        string fullSQL = me.Doc.Clone() as string;
                        fullSQL = fullSQL.Replace("~", ",");
                        fullSQL = BP.WF.Glo.DealExp(fullSQL, wk, null);

                        dt = DBAccess.RunSQLReturnTable(fullSQL);

                        dt.TableName = mypk;
                        myds.Tables.Add(dt);
                        continue;
                    }
                    #endregion 处理下拉框数据范围.
                    else                     //无范围限制时
                    {
                        // 判断是否存在.
                        if (myds.Tables.Contains(uiBindKey) == true)
                        {
                            continue;
                        }

                        myds.Tables.Add(BP.Sys.PubClass.GetDataTableByUIBineKey(uiBindKey));
                    }
                    #endregion 外键字段
                }
                #endregion 从表的 外键表/枚举
            }
            #endregion 加载 从表表单模版信息.(含 从表的枚举/外键相关数据)

            #endregion 表单模版信息.(含主、从表的,以及从表的枚举/外键相关数据).

            #region 主表数据
            if (BP.Sys.SystemConfig.IsBSsystem == true)
            {
                // 处理传递过来的参数。
                foreach (string k in System.Web.HttpContext.Current.Request.QueryString.AllKeys)
                {
                    wk.SetValByKey(k, System.Web.HttpContext.Current.Request.QueryString[k]);
                }
            }

            // 执行表单事件..
            string msg = md.DoEvent(FrmEventList.FrmLoadBefore, wk);
            if (DataType.IsNullOrEmpty(msg) == false)
            {
                throw new Exception("err@错误:" + msg);
            }

            //重设默认值.
            wk.ResetDefaultVal();

            //执行装载填充.
            me = new MapExt();

            if (me.Retrieve(MapExtAttr.ExtType, MapExtXmlList.PageLoadFull, MapExtAttr.FK_MapData, frmID) == 1)
            {
                //执行通用的装载方法.
                MapAttrs attrs = new MapAttrs(frmID);
                MapDtls  dtls  = new MapDtls(frmID);
                wk = BP.WF.Glo.DealPageLoadFull(wk, me, attrs, dtls) as GEEntity;
            }

            //增加主表数据.
            DataTable mainTable = wk.ToDataTableField(md.No);
            mainTable.TableName = "MainTable";
            myds.Tables.Add(mainTable);

            #endregion 主表数据

            #region  从表数据
            foreach (MapDtl dtl in md.MapDtls)
            {
                #region 返回指定的明细表的数据.
                if (DataType.IsNullOrEmpty(specDtlFrmID) == true)
                {
                }
                else
                {
                    if (dtl.No != specDtlFrmID)
                    {
                        continue;
                    }
                }
                #endregion 返回指定的明细表的数据.

                GEDtls      dtls = new GEDtls(dtl.No);
                QueryObject qo   = null;
                try
                {
                    qo = new QueryObject(dtls);
                    switch (dtl.DtlOpenType)
                    {
                    case DtlOpenType.ForEmp:                              // 按人员来控制.
                        qo.AddWhere(GEDtlAttr.RefPK, pkval);
                        qo.addAnd();
                        qo.AddWhere(GEDtlAttr.Rec, WebUser.No);
                        break;

                    case DtlOpenType.ForWorkID:                             // 按工作ID来控制
                        qo.AddWhere(GEDtlAttr.RefPK, pkval);
                        break;

                    case DtlOpenType.ForFID:                             // 按流程ID来控制.
                        qo.AddWhere(GEDtlAttr.FID, pkval);
                        break;
                    }
                }
                catch
                {
                    dtls.GetNewEntity.CheckPhysicsTable();
                }

                //条件过滤.
                if (dtl.FilterSQLExp != "")
                {
                    string[] strs = dtl.FilterSQLExp.Split('=');
                    qo.addAnd();
                    qo.AddWhere(strs[0], strs[1]);
                }

                //从表
                DataTable dtDtl = qo.DoQueryToTable();

                // 为明细表设置默认值.
                MapAttrs dtlAttrs = new MapAttrs(dtl.No);
                foreach (MapAttr attr in dtlAttrs)
                {
                    //处理它的默认值.
                    if (attr.DefValReal.Contains("@") == false)
                    {
                        continue;
                    }

                    foreach (DataRow dr in dtDtl.Rows)
                    {
                        dr[attr.KeyOfEn] = attr.DefVal;
                    }
                }

                dtDtl.TableName = string.IsNullOrWhiteSpace(dtl.Alias) ? dtl.No : dtl.Alias; //edited by liuxc,2017-10-10.如果有别名,则使用别名,没有则使用No
                myds.Tables.Add(dtDtl);                                                      //加入这个明细表, 如果没有数据,xml体现为空.
            }
            #endregion 从表数据

            #region 主表的 外键表/枚举
            dtMapAttr = myds.Tables["Sys_MapAttr"];
            mes       = md.MapExts;
            foreach (DataRow dr in dtMapAttr.Rows)
            {
                string uiBindKey = dr["UIBindKey"].ToString();
                string myPK      = dr["MyPK"].ToString();
                string lgType    = dr["LGType"].ToString();
                if (lgType.Equals("1"))
                {
                    // 如果是枚举值, 判断是否存在.,
                    if (myds.Tables.Contains(uiBindKey) == true)
                    {
                        continue;
                    }

                    string    mysql  = "SELECT IntKey AS No, Lab as Name FROM Sys_Enum WHERE EnumKey='" + uiBindKey + "' ORDER BY IntKey ";
                    DataTable dtEnum = DBAccess.RunSQLReturnTable(mysql);
                    dtEnum.TableName = uiBindKey;
                    myds.Tables.Add(dtEnum);
                    continue;
                }

                if (lgType.Equals("2") == false)
                {
                    continue;
                }

                string UIIsEnable = dr["UIIsEnable"].ToString();
                if (UIIsEnable.Equals("0"))
                {
                    continue;
                }

                // 检查是否有下拉框自动填充。
                string keyOfEn    = dr["KeyOfEn"].ToString();
                string fk_mapData = dr["FK_MapData"].ToString();

                #region 处理下拉框数据范围. for 小杨.
                me = mes.GetEntityByKey(MapExtAttr.ExtType, MapExtXmlList.AutoFullDLL, MapExtAttr.AttrOfOper, keyOfEn) as MapExt;
                if (me != null)
                {
                    string fullSQL = me.Doc.Clone() as string;
                    fullSQL      = fullSQL.Replace("~", ",");
                    fullSQL      = BP.WF.Glo.DealExp(fullSQL, wk, null);
                    dt           = DBAccess.RunSQLReturnTable(fullSQL);
                    dt.TableName = myPK;                     //可能存在隐患,如果多个字段,绑定同一个表,就存在这样的问题.
                    myds.Tables.Add(dt);
                    continue;
                }
                #endregion 处理下拉框数据范围.

                dt           = BP.Sys.PubClass.GetDataTableByUIBineKey(uiBindKey);
                dt.TableName = uiBindKey;
                myds.Tables.Add(dt);
            }
            #endregion 主表的 外键表/枚举

            //返回生成的dataset.
            return(myds);
        }