Exemple #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            switch (this.DoType)
            {
            case "DelSln":     //删除sln.
                FrmField sln = new FrmField();
                sln.Delete(FrmFieldAttr.FK_MapData, this.FK_MapData,
                           FrmFieldAttr.KeyOfEn, this.KeyOfEn,
                           FrmFieldAttr.FK_Flow, this.FK_Flow,
                           FrmFieldAttr.FK_Node, this.FK_Node);
                this.WinClose();
                return;

            case "EditSln":     //编辑sln.
                this.EditSln();
                return;

            case "Copy":     //编辑sln.
                this.Copy();
                return;

            case "CopyIt":     //编辑sln.
                FrmFields fss = new FrmFields();
                fss.Delete(FrmFieldAttr.FK_MapData, this.FK_MapData,
                           FrmFieldAttr.FK_Flow, this.FK_Flow,
                           FrmFieldAttr.FK_Node, this.FK_Node);

                fss = new FrmFields(this.FK_MapData, int.Parse(this.Request.QueryString["FromSln"]));
                //fss.Retrieve(FrmFieldAttr.FK_MapData, this.FK_MapData,
                //    FrmFieldAttr.FK_Node, this.Request.QueryString["FromSln"]);

                foreach (FrmField sl in fss)
                {
                    sl.FK_Node = int.Parse(this.FK_Node);
                    sl.FK_Flow = this.FK_Flow;
                    sl.MyPK    = this.FK_MapData + "_" + this.FK_Flow + "_" + this.FK_Node + "_" + sl.KeyOfEn;
                    sl.Insert();
                }
                this.WinClose();
                return;

            default:
                break;
            }
        }
Exemple #2
0
        void btn_Field_Click(object sender, EventArgs e)
        {
            Button btn = sender as Button;

            if (btn.ID == "Btn_Del")
            {
                BP.Sys.FrmFields fss1 = new BP.Sys.FrmFields();
                fss1.Delete(BP.Sys.FrmFieldAttr.FK_MapData, this.FK_MapData,
                            BP.Sys.FrmFieldAttr.FK_Node, int.Parse(this.FK_Node));
                this.Response.Redirect("Sln.aspx?FK_Flow=" + this.FK_Flow + "&FK_Node=" + this.FK_Node + "&FK_MapData=" + this.FK_MapData + "&IsOk=1", true);
                return;
            }

            MapAttrs attrs = new MapAttrs(this.FK_MapData);
            // 查询出来解决方案.
            FrmFields fss = new  FrmFields();

            fss.Delete(FrmFieldAttr.FK_MapData, this.FK_MapData, FrmFieldAttr.FK_Node, int.Parse(this.FK_Node));

            foreach (MapAttr attr in attrs)
            {
                switch (attr.KeyOfEn)
                {
                case BP.WF.WorkAttr.RDT:
                case BP.WF.WorkAttr.FID:
                case BP.WF.WorkAttr.OID:
                case BP.WF.WorkAttr.Rec:
                case BP.WF.WorkAttr.MyNum:
                case BP.WF.WorkAttr.MD5:
                case BP.WF.WorkAttr.Emps:
                case BP.WF.WorkAttr.CDT:
                    continue;

                default:
                    break;
                }

                bool isChange  = false;
                bool UIVisible = this.Pub2.GetCBByID("CB_" + attr.KeyOfEn + "_UIVisible").Checked;
                if (attr.UIVisible != UIVisible)
                {
                    isChange = true;
                }

                bool UIIsEnable = this.Pub2.GetCBByID("CB_" + attr.KeyOfEn + "_UIIsEnable").Checked;
                if (attr.UIIsEnable != UIIsEnable)
                {
                    isChange = true;
                }

                bool IsSigan = this.Pub2.GetCBByID("CB_" + attr.KeyOfEn + "_IsSigan").Checked;
                if (attr.IsSigan != IsSigan)
                {
                    isChange = true;
                }

                string defVal = this.Pub2.GetTextBoxByID("TB_" + attr.KeyOfEn + "_DefVal").Text;
                if (attr.DefValReal != defVal)
                {
                    isChange = true;
                }

                bool IsNotNull = this.Pub2.GetCBByID("CB_" + attr.KeyOfEn + "_IsNotNull").Checked;
                if (IsNotNull == true)
                {
                    isChange = true;
                }

                bool IsWriteToFlowTable = this.Pub2.GetCBByID("CB_" + attr.KeyOfEn + "_" + FrmFieldAttr.IsWriteToFlowTable).Checked;
                if (IsWriteToFlowTable == true)
                {
                    isChange = true;
                }

                string exp = this.Pub2.GetTextBoxByID("TB_" + attr.KeyOfEn + "_RegularExp").Text;
                if (string.IsNullOrEmpty(exp))
                {
                    isChange = true;
                }

                if (isChange == false)
                {
                    continue;
                }

                BP.Sys.FrmField sln = new BP.Sys.FrmField();
                sln.UIVisible  = UIVisible;
                sln.UIIsEnable = UIIsEnable;
                sln.IsSigan    = IsSigan;
                sln.DefVal     = defVal;

                sln.IsNotNull          = IsNotNull;
                sln.RegularExp         = exp;
                sln.IsWriteToFlowTable = IsWriteToFlowTable;
                sln.FK_Node            = int.Parse(this.FK_Node);
                sln.FK_Flow            = this.FK_Flow;

                sln.FK_MapData = this.FK_MapData;
                sln.KeyOfEn    = attr.KeyOfEn;
                sln.Name       = attr.Name;

                sln.MyPK = this.FK_MapData + "_" + this.FK_Flow + "_" + this.FK_Node + "_" + attr.KeyOfEn;
                sln.Insert();
            }
            this.Response.Redirect("Sln.aspx?FK_Flow=" + this.FK_Flow + "&FK_Node=" + this.FK_Node + "&FK_MapData=" + this.FK_MapData + "&IsOk=1", true);
        }
Exemple #3
0
        private string GetFlowFormTree()
        {
            string flowId = getUTF8ToString("flowId");
            string nodeId = getUTF8ToString("nodeId");

            //add root
            BP.WF.Template.FlowFormTree root = new BP.WF.Template.FlowFormTree();
            root.No       = "01";
            root.ParentNo = "0";
            root.Name     = "目录";
            root.NodeType = "root";
            appFlowFormTree.Clear();
            appFlowFormTree.AddEntity(root);

            #region 添加表单及文件夹

            //节点表单
            FrmNodes    frmNodes = new FrmNodes();
            QueryObject qo       = new QueryObject(frmNodes);
            qo.AddWhere(FrmNodeAttr.FK_Node, nodeId);
            qo.addAnd();
            qo.AddWhere(FrmNodeAttr.FK_Flow, flowId);
            qo.addOrderBy(FrmNodeAttr.Idx);
            qo.DoQuery();
            //文件夹
            SysFormTrees formTrees = new SysFormTrees();
            formTrees.RetrieveAll(SysFormTreeAttr.Name);
            //所有表单集合
            MapDatas mds = new MapDatas();
            mds.Retrieve(MapDataAttr.AppType, (int)AppType.Application);
            foreach (FrmNode frmNode in frmNodes)
            {
                foreach (MapData md in mds)
                {
                    if (frmNode.FK_Frm != md.No)
                    {
                        continue;
                    }

                    foreach (SysFormTree formTree in formTrees)
                    {
                        if (md.FK_FormTree != formTree.No)
                        {
                            continue;
                        }

                        if (!appFlowFormTree.Contains("No", formTree.No))
                        {
                            BP.WF.Template.FlowFormTree nodeFolder = new BP.WF.Template.FlowFormTree();
                            nodeFolder.No       = formTree.No;
                            nodeFolder.ParentNo = root.No;
                            nodeFolder.Name     = formTree.Name;
                            nodeFolder.NodeType = "folder";
                            appFlowFormTree.AddEntity(nodeFolder);
                        }
                    }
                    //检查必填项
                    bool        IsNotNull  = false;
                    FrmFields   formFields = new FrmFields();
                    QueryObject obj        = new QueryObject(formFields);
                    obj.AddWhere(FrmFieldAttr.FK_Node, nodeId);
                    obj.addAnd();
                    obj.AddWhere(FrmFieldAttr.FK_MapData, md.No);
                    obj.addAnd();
                    obj.AddWhere(FrmFieldAttr.IsNotNull, "1");
                    obj.DoQuery();
                    if (formFields != null && formFields.Count > 0)
                    {
                        IsNotNull = true;
                    }

                    BP.WF.Template.FlowFormTree nodeForm = new BP.WF.Template.FlowFormTree();
                    nodeForm.No       = md.No;
                    nodeForm.ParentNo = md.FK_FormTree;
                    nodeForm.Name     = md.Name;
                    nodeForm.NodeType = IsNotNull ? "form|1" : "form|0";
                    appFlowFormTree.AddEntity(nodeForm);
                }
            }
            #endregion
            //扩展工具,显示位置为表单树类型
            NodeToolbars extToolBars = new NodeToolbars();
            QueryObject  info        = new QueryObject(extToolBars);
            info.AddWhere(NodeToolbarAttr.FK_Node, nodeId);
            info.addAnd();
            info.AddWhere(NodeToolbarAttr.ShowWhere, (int)ShowWhere.Tree);
            info.DoQuery();

            foreach (NodeToolbar item in extToolBars)
            {
                string url = "";
                if (string.IsNullOrEmpty(item.Url))
                {
                    continue;
                }

                url = item.Url;

                BP.WF.Template.FlowFormTree formTree = new BP.WF.Template.FlowFormTree();
                formTree.No       = item.OID.ToString();
                formTree.ParentNo = "01";
                formTree.Name     = item.Title;
                formTree.NodeType = "tools|0";
                if (!string.IsNullOrEmpty(item.Target) && item.Target.ToUpper() == "_BLANK")
                {
                    formTree.NodeType = "tools|1";
                }

                formTree.Url = url;
                appFlowFormTree.AddEntity(formTree);
            }
            TansEntitiesToGenerTree(appFlowFormTree, root.No, "");
            return(appendMenus.ToString());
        }
Exemple #4
0
        public string Fields_Init()
        {
            FrmFields fss = new FrmFields(this.FK_MapData, this.FK_Node);

            MapAttrs    attrs = new MapAttrs();
            QueryObject obj   = new QueryObject(attrs);

            obj.AddWhere(MapAttrAttr.FK_MapData, this.FK_MapData);
            obj.addOrderBy(MapAttrAttr.Y, MapAttrAttr.X);
            obj.DoQuery();

            List <FieldsAttrs> fieldsAttrsList = new List <FieldsAttrs>();
            int idx = 0;

            foreach (MapAttr attr in attrs)
            {
                switch (attr.KeyOfEn)
                {
                case BP.WF.WorkAttr.RDT:
                case BP.WF.WorkAttr.FID:
                case BP.WF.WorkAttr.OID:
                case BP.WF.WorkAttr.Rec:
                case BP.WF.WorkAttr.MyNum:
                case BP.WF.WorkAttr.MD5:
                case BP.WF.WorkAttr.Emps:
                case BP.WF.WorkAttr.CDT:
                    continue;

                default:
                    break;
                }

                fieldsAttrsList.Add(new FieldsAttrs {
                });
                fieldsAttrsList[idx].idx     = idx;
                fieldsAttrsList[idx].KeyOfEn = attr.KeyOfEn;
                fieldsAttrsList[idx].Name    = attr.Name;
                fieldsAttrsList[idx].LGTypeT = attr.LGTypeT;

                FrmField sln = fss.GetEntityByKey(FrmFieldAttr.KeyOfEn, attr.KeyOfEn) as FrmField;
                if (sln == null)
                {
                    fieldsAttrsList[idx].UIVisible              = false;
                    fieldsAttrsList[idx].UIIsEnable             = false;
                    fieldsAttrsList[idx].IsSigan                = false;
                    fieldsAttrsList[idx].DefVal                 = "";
                    fieldsAttrsList[idx].IsNotNull              = false;
                    fieldsAttrsList[idx].IsSigan                = false;
                    fieldsAttrsList[idx].RegularExp             = "";
                    fieldsAttrsList[idx].IsWriteToFlowTable     = false;
                    fieldsAttrsList[idx].IsWriteToGenerWorkFlow = false;
                }
                else
                {
                    fieldsAttrsList[idx].UIVisible          = sln.UIVisible;
                    fieldsAttrsList[idx].UIIsEnable         = sln.UIIsEnable;
                    fieldsAttrsList[idx].IsSigan            = sln.IsSigan;
                    fieldsAttrsList[idx].DefVal             = sln.DefVal;
                    fieldsAttrsList[idx].IsNotNull          = sln.IsNotNull;
                    fieldsAttrsList[idx].IsSigan            = sln.IsSigan;
                    fieldsAttrsList[idx].RegularExp         = sln.RegularExp;
                    fieldsAttrsList[idx].IsWriteToFlowTable = sln.IsWriteToFlowTable;
                    //fieldsAttrsList[idx].IsWriteToGenerWorkFlow = sln.IsWriteToGenerWorkFlow;
                }

                idx++;
            }

            return(LitJson.JsonMapper.ToJson(fieldsAttrsList));
        }
Exemple #5
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;";
            }
        }
Exemple #6
0
        private string GetFlowFormTree()
        {
            //add root
            BP.WF.Template.FlowFormTree root = new BP.WF.Template.FlowFormTree();
            root.No       = "00";
            root.ParentNo = "0";
            root.Name     = "目录";
            root.NodeType = "root";
            appFlowFormTree.Clear();
            appFlowFormTree.AddEntity(root);

            #region 添加表单及文件夹

            //节点表单
            string     tfModel = SystemConfig.AppSettings["TreeFrmModel"];
            BP.WF.Node nd      = new BP.WF.Node(this.FK_Node);

            FrmNodes    frmNodes = new FrmNodes();
            QueryObject qo       = new QueryObject(frmNodes);
            qo.AddWhere(FrmNodeAttr.FK_Node, this.FK_Node);
            qo.addAnd();
            qo.AddWhere(FrmNodeAttr.FK_Flow, this.FK_Flow);
            //如果配置了启用关键字段,一下会判断绑定的独立表单中的关键字段是否有数据,没有就不会被显示
            // add  by  海南  zqp
            if (tfModel == "1")
            {
                //针对合流点与分合流节点有效
                //获取独立表单的字段
                MapDatas mdes  = new MapDatas();
                string   mypks = "";
                if (nd.IsStartNode == false)
                {
                    qo.addOrderBy(FrmNodeAttr.Idx);
                    qo.DoQuery();
                    foreach (FrmNode fn in frmNodes)
                    {
                        if (fn.HisFrmType == FrmType.Column4Frm || fn.HisFrmType == FrmType.FreeFrm)
                        {
                            mdes.Retrieve(MapDataAttr.No, fn.FK_Frm);
                            //根据设置的关键字段是否有值,进行判断
                            foreach (MapData md in mdes)
                            {
                                Paras ps = new Paras();
                                ps.SQL = "SELECT " + fn.GuanJianZiDuan + " FROM " + md.PTable + " WHERE "
                                         + " OID=" + SystemConfig.AppCenterDBVarStr + "OID";
                                if (this.FID == 0)
                                {
                                    ps.Add("OID", this.WorkID);
                                }
                                else
                                {
                                    ps.Add("OID", this.FID);
                                }
                                try
                                {
                                    DataTable dtmd  = BP.DA.DBAccess.RunSQLReturnTable(ps);
                                    string    dtVal = dtmd.Rows[0]["" + fn.GuanJianZiDuan + ""].ToString();
                                    if (string.IsNullOrWhiteSpace(dtVal))
                                    {
                                        mypks = mypks + "'" + md.No + "',";
                                    }
                                }
                                catch (Exception ex)
                                {
                                    mypks = mypks + "'" + md.No + "',";
                                }
                            }
                        }
                    }
                    mypks = mypks.TrimEnd(',');
                    if (!string.IsNullOrWhiteSpace(mypks))
                    {
                        //添加查询条件
                        qo = new QueryObject(frmNodes);
                        qo.AddWhere(FrmNodeAttr.FK_Node, this.FK_Node);
                        qo.addAnd();
                        qo.AddWhere(FrmNodeAttr.FK_Flow, this.FK_Flow);
                        qo.addAnd();
                        qo.AddWhere(FrmNodeAttr.FK_Frm + " not in(" + mypks + ")");
                        qo.addOrderBy(FrmNodeAttr.Idx);
                        qo.DoQuery();
                    }
                }
                else
                {
                    qo.addOrderBy(FrmNodeAttr.Idx);
                    qo.DoQuery();
                }
            }
            else
            {
                qo.addOrderBy(FrmNodeAttr.Idx);
                qo.DoQuery();
            }
            //文件夹
            SysFormTrees formTrees = new SysFormTrees();
            formTrees.RetrieveAll(SysFormTreeAttr.Name);

            //所有表单集合
            MapDatas mds = new MapDatas();
            mds.RetrieveInSQL("SELECT FK_Frm FROM WF_FrmNode WHERE FK_Node=" + this.FK_Node);

            foreach (FrmNode frmNode in frmNodes)
            {
                #region 增加判断是否启用规则.
                switch (frmNode.FrmEnableRole)
                {
                case FrmEnableRole.Allways:
                    break;

                case FrmEnableRole.WhenHaveData:     //判断是否有数据.
                    MapData md = new MapData(frmNode.FK_Frm);
                    if (DBAccess.RunSQLReturnValInt("SELECT COUNT(*) as Num FROM " + md.PTable + " WHERE OID=" + this.WorkID) == 0)
                    {
                        continue;
                    }
                    break;

                case FrmEnableRole.WhenHaveFrmPara:     //判断是否有参数.
                    string frms = this.Request.QueryString["Frms"];
                    if (frms != null && frms.Contains(frmNode.FK_Frm) == true)
                    {
                        /*包含这个表单.*/
                    }
                    else
                    {
                        continue;
                    }
                    break;

                case FrmEnableRole.ByFrmFields:
                    throw new Exception("@这种类型的判断,ByFrmFields 还没有完成。");

                case FrmEnableRole.BySQL:      // 按照SQL的方式.
                    string mysql = frmNode.FrmEnableExp.Clone() as string;
                    mysql = mysql.Replace("@OID", this.WorkID.ToString());
                    mysql = mysql.Replace("@WorkID", this.WorkID.ToString());

                    mysql = mysql.Replace("@NodeID", this.FK_Node.ToString());
                    mysql = mysql.Replace("@FK_Node", this.FK_Node.ToString());

                    mysql = mysql.Replace("@FK_Flow", this.FK_Flow);

                    if (DBAccess.RunSQLReturnValFloat(mysql) <= 0)
                    {
                        continue;
                    }
                    break;

                case FrmEnableRole.Disable:      // 如果禁用了,就continue出去..
                    continue;

                default:
                    throw new Exception("@没有判断的规则." + frmNode.FrmEnableRole);
                }
                #endregion

                #region 检查是否有没有目录的表单?
                bool isHave = false;
                foreach (MapData md in mds)
                {
                    if (md.FK_FormTree == "")
                    {
                        isHave = true;
                        break;
                    }
                }

                string treeNo = "0";
                if (isHave && mds.Count == 1)
                {
                    treeNo = "0";
                }
                else if (isHave == true)
                {
                    foreach (MapData md in mds)
                    {
                        if (md.FK_FormTree != "")
                        {
                            treeNo = md.FK_FormTree;
                            break;
                        }
                    }
                }
                #endregion 检查是否有没有目录的表单?

                foreach (MapData md in mds)
                {
                    if (frmNode.FK_Frm != md.No)
                    {
                        continue;
                    }

                    #warning 这里有错误, 如果是节点表单的话,就没有这个值,没有这个值就绑定不到表单树,代国强解决.
                    if (md.FK_FormTree == "")
                    {
                        md.FK_FormTree = treeNo;
                    }

                    foreach (SysFormTree formTree in formTrees)
                    {
                        if (md.FK_FormTree != formTree.No)
                        {
                            continue;
                        }
                        if (appFlowFormTree.Contains("No", formTree.No) == false)
                        {
                            BP.WF.Template.FlowFormTree nodeFolder = new BP.WF.Template.FlowFormTree();
                            nodeFolder.No       = formTree.No;
                            nodeFolder.ParentNo = root.No;
                            nodeFolder.Name     = formTree.Name;
                            nodeFolder.NodeType = "folder";
                            appFlowFormTree.AddEntity(nodeFolder);
                        }
                    }
                    //检查必填项
                    bool        IsNotNull  = false;
                    FrmFields   formFields = new FrmFields();
                    QueryObject obj        = new QueryObject(formFields);
                    obj.AddWhere(FrmFieldAttr.FK_Node, this.FK_Node);
                    obj.addAnd();
                    obj.AddWhere(FrmFieldAttr.FK_MapData, md.No);
                    obj.addAnd();
                    obj.AddWhere(FrmFieldAttr.IsNotNull, "1");
                    obj.DoQuery();
                    if (formFields != null && formFields.Count > 0)
                    {
                        IsNotNull = true;
                    }

                    BP.WF.Template.FlowFormTree nodeForm = new BP.WF.Template.FlowFormTree();
                    nodeForm.No       = md.No;
                    nodeForm.ParentNo = md.FK_FormTree;
                    nodeForm.Name     = md.Name;
                    nodeForm.NodeType = IsNotNull ? "form|1" : "form|0";
                    nodeForm.IsEdit   = Convert.ToString(Convert.ToInt32(frmNode.IsEdit));
                    appFlowFormTree.AddEntity(nodeForm);
                }
            }
            #endregion

            //扩展工具,显示位置为表单树类型
            NodeToolbars extToolBars = new NodeToolbars();
            QueryObject  info        = new QueryObject(extToolBars);
            info.AddWhere(NodeToolbarAttr.FK_Node, this.FK_Node);
            info.addAnd();
            info.AddWhere(NodeToolbarAttr.ShowWhere, (int)ShowWhere.Tree);
            info.DoQuery();

            foreach (NodeToolbar item in extToolBars)
            {
                string url = "";
                if (string.IsNullOrEmpty(item.Url))
                {
                    continue;
                }

                url = item.Url;

                BP.WF.Template.FlowFormTree formTree = new BP.WF.Template.FlowFormTree();
                formTree.No       = item.OID.ToString();
                formTree.ParentNo = "01";
                formTree.Name     = item.Title;
                formTree.NodeType = "tools|0";
                if (!string.IsNullOrEmpty(item.Target) && item.Target.ToUpper() == "_BLANK")
                {
                    formTree.NodeType = "tools|1";
                }

                formTree.Url = url;
                appFlowFormTree.AddEntity(formTree);
            }
            TansEntitiesToGenerTree(appFlowFormTree, root.No, "");
            return(appendMenus.ToString());
        }
Exemple #7
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);
            }
        }
Exemple #8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //WebUser.SignInOfGener(new BP.Port.Emp("fuhui"));

            UserName = WebUser.Name;
            if (string.IsNullOrEmpty(this.FK_MapData))
            {
                divMenu.InnerHtml = "<h1 style='color:red'>必须传入参数FK_Mapdata!<h1>";
                return;
            }

            fk_mapdatas = FK_MapData.Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);

            //获得外部的标记。
            string type = Request["action"];

            if (string.IsNullOrEmpty(type))
            {
                /** 第一次进来,的时候,没有标记。
                 */
                //初始化它的解决方案.  add by stone. 2015-01-25. 增加权限控制方案,以在不同的节点实现不同的控制.
                IsEdit = string.IsNullOrWhiteSpace(Request.QueryString["IsEdit"])
                             ? true
                             : Request.QueryString["IsEdit"] == "1";
                IsPrint = string.IsNullOrWhiteSpace(Request.QueryString["IsPrint"])
                             ? true
                             : Request.QueryString["IsPrint"] == "1";

                GenerateToolbarSlns();
            }
            else
            {
                if (type.Equals("LoadFile"))
                {
                    LoadFile();
                    return;
                }

                if (type.Equals("SaveFile"))
                {
                    SaveFile(fk_mapdatas);
                    SaveFieldInfos(fk_mapdatas);
                    return;
                }

                throw new Exception("@没有处理的标记错误:" + type);
            }

            firsts = new Dictionary <string, bool>();
            GEEntityExcelFrm en        = null;
            FileInfo         tmpFile   = null;
            FileInfo         excelFile = null;
            FrmFields        frmFields = null;

            //检查数据文件是否存在?如果存在并打开不存在并copy模版。
            var root     = SystemConfig.PathOfDataUser + "\\FrmOfficeTemplate\\";
            var rootInfo = new DirectoryInfo(root);
            var isFirst  = false;

            if (!rootInfo.Exists)
            {
                rootInfo.Create();
            }

            ReplaceParams     = "[";
            ReplaceFields     = "[";
            ReplaceDtlNos     = "[";
            ReplaceDtls       = "[";
            IsFirsts          = "[";
            FK_MapDatas       = "[";
            ReplaceFieldCtrls = "[";

            //根据excel表单no来处理各自的信息
            var pk = 0;

            foreach (var fk_md in fk_mapdatas)
            {
                //创建excel数据实体.
                en = new GEEntityExcelFrm(fk_md);

                var files = rootInfo.GetFiles(fk_md + ".*");
                // 判断是否有这个数据文件.
                if (files.Length == 0)
                {
                    Response.Write("<h3>Excel表单模板文件不存在,请确认已经上传Excel表单模板,该模版的位于服务器:" + rootInfo.FullName + "</h3>");
                    Response.End();
                    return;
                }

                FK_MapDatas += "{\"Name\":\"" + en.ClassID + "\",\"Text\":\"" + en.EnDesc + "\"},";

                // 检查数据目录文件是否存在?
                var pathDir = SystemConfig.PathOfDataUser + @"\FrmOfficeFiles\" + fk_md;
                if (!Directory.Exists(pathDir))
                {
                    Directory.CreateDirectory(pathDir);
                }

                // 判断who is pk
                pk = GetPK(fk_md);
                if (pk == 0)
                {
                    return;
                }

                // 初始化数据文件.
                tmpFile   = files[0];
                excelFile = new FileInfo(pathDir + "\\" + pk + tmpFile.Extension);
                if (excelFile.Exists == false)
                {
                    /*如果不存在就copy 一个副本。*/
                    File.Copy(tmpFile.FullName, excelFile.FullName);
                    isFirst = true;
                }
                else
                {
                    //edited by liuxc,2015-3-25,此处增加判断,如果模板文件与生成的数据文件的最后修改时间是一致的,表明此数据文件还没有经过修改,也标识为第一次,加载填充数据信息
                    isFirst = excelFile.LastWriteTime.Equals(tmpFile.LastWriteTime);
                }

                firsts.Add(fk_md, isFirst);
                IsFirsts += "{\"" + fk_md + "\":" + isFirst.ToString().ToLower() + "},";

                //edited by liuxc,2015-1-30,如果在构造中使用传递OID的构造函数,则下面的Save时,第一次会插入不成功,此处是因为insert时判断OID不为0则认为是已经存在的记录,实际上此处还没有存在,所以使用下面的逻辑进行判断,如果没有该条记录,则插入新记录
                en.OID = pk;

                if (en.IsExits == false)
                {
                    en.InsertAsOID(pk);
                }
                else
                {
                    en.Retrieve();
                }

                //给实体赋值.
                en.FilePath   = excelFile.FullName;
                en.RDT        = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                en.LastEditer = WebUser.Name;
                en.SetPara(FK_Node.ToString(), true);
                en.ResetDefaultVal();

                //接受外部参数数据。
                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]);
                }

                en.Save(); //执行保存.

                //装载数据。
                ReplaceParams     += "{\"" + fk_md + "\":";
                ReplaceFields     += "{\"" + fk_md + "\":";
                ReplaceDtlNos     += "{\"" + fk_md + "\":";
                ReplaceDtls       += "{\"" + fk_md + "\":";
                ReplaceFieldCtrls += "{\"" + fk_md + "\":[";

                this.LoadFrmData(fk_md, en);

                //字段控制
                frmFields = new FrmFields(fk_md, FK_Node);
                foreach (FrmField frmField in frmFields)
                {
                    ReplaceFieldCtrls +=
                        string.Format("{{\"{0}\":{{\"Name\":\"{1}\",\"UIVisible\":{2},\"UIIsEnable\":{3},\"IsNotNull\":{4},\"OldValue\":\"{5}\"}}}},",
                                      frmField.KeyOfEn,
                                      frmField.Name,
                                      frmField.UIVisible.ToString().ToLower(),
                                      frmField.UIIsEnable.ToString().ToLower(),
                                      frmField.IsNotNull.ToString().ToLower(),
                                      frmField.UIIsEnable ? "" : en.GetValStringByKey(frmField.KeyOfEn, ""));
                }

                ReplaceParams    += "},";
                ReplaceFields    += "},";
                ReplaceDtlNos    += "},";
                ReplaceDtls      += "},";
                ReplaceFieldCtrls = ReplaceFieldCtrls.TrimEnd(',') + "]},";
            }

            ReplaceParams     = ReplaceParams.TrimEnd(',') + "]";
            ReplaceFields     = ReplaceFields.TrimEnd(',') + "]";
            ReplaceDtlNos     = ReplaceDtlNos.TrimEnd(',') + "]";
            ReplaceDtls       = ReplaceDtls.TrimEnd(',') + "]";
            IsFirsts          = IsFirsts.TrimEnd(',') + "]";
            FK_MapDatas       = FK_MapDatas.TrimEnd(',') + "]";
            ReplaceFieldCtrls = ReplaceFieldCtrls.TrimEnd(',') + "]";

            //替换掉 word 里面的数据.
            fileName.Text = string.Format(@"\{0}\{1}{2}", fk_mapdatas[0], pk, excelFile.Extension);
            fileType.Text = excelFile.Extension.TrimStart('.');
        }
Exemple #9
0
        /// <summary>
        /// 绑定方案
        /// </summary>
        public void BindSln()
        {
            // 查询出来解决方案.
            FrmFields fss = new FrmFields(this.FK_MapData, int.Parse(this.FK_Node));

            // 处理好.
            MapAttrs attrs = new MapAttrs();
            //增加排序
            QueryObject obj = new QueryObject(attrs);

            obj.AddWhere(MapAttrAttr.FK_MapData, this.FK_MapData);
            obj.addOrderBy(MapAttrAttr.Y, MapAttrAttr.X);
            obj.DoQuery();

            this.Pub2.AddTable("80%");
            this.Pub2.AddTR();
            this.Pub2.AddTDTitle("Idx");
            this.Pub2.AddTDTitle("字段");
            this.Pub2.AddTDTitle("名称");
            this.Pub2.AddTDTitle("类型");

            this.Pub2.AddTDTitle("width='90px'", "可见?");
            this.Pub2.AddTDTitle("<input type='checkbox' id='s' onclick=\"CheckAll('UIIsEnable')\" />可用?");

            this.Pub2.AddTDTitle("是否是签名?");
            this.Pub2.AddTDTitle("默认值");

            this.Pub2.AddTDTitle("<input type='checkbox' id='s' onclick=\"CheckAll('IsNotNull')\" />检查必填?");
            this.Pub2.AddTDTitle("正则表达式");

            this.Pub2.AddTDTitle("<input type='checkbox' id='s' onclick=\"CheckAll('IsWriteToFlowTable')\" />写入流程数据表?");
            this.Pub2.AddTDTitle("");
            this.Pub2.AddTREnd();

            CheckBox cb = new CheckBox();
            TextBox  tb = new TextBox();

            int idx = 0;

            foreach (MapAttr attr in attrs)
            {
                switch (attr.KeyOfEn)
                {
                case BP.WF.WorkAttr.RDT:
                case BP.WF.WorkAttr.FID:
                case BP.WF.WorkAttr.OID:
                case BP.WF.WorkAttr.Rec:
                case BP.WF.WorkAttr.MyNum:
                case BP.WF.WorkAttr.MD5:
                case BP.WF.WorkAttr.Emps:
                case BP.WF.WorkAttr.CDT:
                    continue;

                default:
                    break;
                }

                idx++;
                this.Pub2.AddTR();
                this.Pub2.AddTDIdx(idx);
                this.Pub2.AddTD(attr.KeyOfEn);
                this.Pub2.AddTD(attr.Name);
                this.Pub2.AddTD(attr.LGTypeT);

                FrmField sln = fss.GetEntityByKey(FrmFieldAttr.KeyOfEn, attr.KeyOfEn) as FrmField;
                if (sln == null)
                {
                    cb         = new CheckBox();
                    cb.ID      = "CB_" + attr.KeyOfEn + "_UIVisible";
                    cb.Checked = attr.UIVisible;
                    cb.Text    = "可见?";
                    this.Pub2.AddTD("width=90px", cb);

                    cb         = new CheckBox();
                    cb.ID      = "CB_" + attr.KeyOfEn + "_UIIsEnable";
                    cb.Checked = attr.UIIsEnable;
                    cb.Text    = "可用?";
                    this.Pub2.AddTD("width=90px", cb);

                    cb         = new CheckBox();
                    cb.ID      = "CB_" + attr.KeyOfEn + "_IsSigan";
                    cb.Checked = attr.IsSigan;
                    cb.Text    = "是否数字签名?";
                    this.Pub2.AddTD("width=150px", cb);

                    tb      = new TextBox();
                    tb.ID   = "TB_" + attr.KeyOfEn + "_DefVal";
                    tb.Text = attr.DefValReal;
                    this.Pub2.AddTD(tb);


                    cb    = new CheckBox();
                    cb.ID = "CB_" + attr.KeyOfEn + "_" + FrmFieldAttr.IsNotNull;
                    // cb.Checked = attr.IsNotNull;
                    cb.Checked = false;
                    cb.Text    = "检查必填?";
                    this.Pub2.AddTD(cb);

                    tb    = new TextBox();
                    tb.ID = "TB_" + attr.KeyOfEn + "_" + FrmFieldAttr.RegularExp;
                    //tb.Text = attr.RegularExp;
                    //  tb.Columns = 150;
                    this.Pub2.AddTD(tb);


                    cb         = new CheckBox();
                    cb.ID      = "CB_" + attr.KeyOfEn + "_" + FrmFieldAttr.IsWriteToFlowTable;
                    cb.Checked = false;
                    cb.Text    = "是否写入流程表?";
                    this.Pub2.AddTD(cb);

                    this.Pub2.AddTD();
                    //this.Pub2.AddTD("<a href=\"javascript:EditSln('" + this.FK_MapData + "','" + this.SlnString + "','" + attr.KeyOfEn + "')\" >Edit</a>");
                }
                else
                {
                    cb         = new CheckBox();
                    cb.ID      = "CB_" + attr.KeyOfEn + "_UIVisible";
                    cb.Checked = sln.UIVisible;
                    cb.Text    = "可见?";
                    this.Pub2.AddTD("width=90px", cb);

                    cb         = new CheckBox();
                    cb.ID      = "CB_" + attr.KeyOfEn + "_UIIsEnable";
                    cb.Checked = sln.UIIsEnable;
                    cb.Text    = "可用?";
                    this.Pub2.AddTD("width=90px", cb);

                    cb         = new CheckBox();
                    cb.ID      = "CB_" + attr.KeyOfEn + "_IsSigan";
                    cb.Checked = sln.IsSigan;
                    cb.Text    = "是否数字签名?";
                    this.Pub2.AddTD("width=150px", cb);

                    tb      = new TextBox();
                    tb.ID   = "TB_" + attr.KeyOfEn + "_DefVal";
                    tb.Text = sln.DefVal;
                    this.Pub2.AddTD(tb);

                    cb         = new CheckBox();
                    cb.ID      = "CB_" + attr.KeyOfEn + "_" + FrmFieldAttr.IsNotNull;
                    cb.Checked = sln.IsNotNull;
                    cb.Text    = "必填?";
                    this.Pub2.AddTD(cb);

                    tb      = new TextBox();
                    tb.ID   = "TB_" + attr.KeyOfEn + "_RegularExp";
                    tb.Text = sln.RegularExp;
                    this.Pub2.AddTD(tb);

                    cb         = new CheckBox();
                    cb.ID      = "CB_" + attr.KeyOfEn + "_" + FrmFieldAttr.IsWriteToFlowTable;
                    cb.Checked = sln.IsWriteToFlowTable;
                    cb.Text    = "写入流程数据表?";
                    this.Pub2.AddTD(cb);

                    this.Pub2.AddTD("<a href=\"javascript:DelSln('" + this.FK_MapData + "','" + this.FK_Flow + "','" + this.FK_Node + "','" + this.FK_Node + "','" + attr.KeyOfEn + "')\" ><img src='../Img/Btn/Delete.gif' border=0/>Delete</a>");
                }
                this.Pub2.AddTREnd();
            }
            this.Pub2.AddTableEnd();

            Button btn = new Button();

            btn.ID     = "Btn_Save";
            btn.Click += new EventHandler(btn_Field_Click);
            btn.Text   = "保存";
            this.Pub2.Add(btn); //保存.

            if (fss.Count != 0)
            {
                btn        = new Button();
                btn.ID     = "Btn_Del";
                btn.Click += new EventHandler(btn_Field_Click);
                btn.Text   = " Delete All ";
                btn.Attributes["onclick"] = "return confirm('Are you sure?');";
                this.Pub2.Add(btn); //删除定义..
            }

            if (dtNodes.Rows.Count >= 1)
            {
                //btn = new Button();
                //btn.ID = "Btn_Copy";
                ////btn.Click += new EventHandler(btn_Field_Click);
                //btn.Text = " Copy From Node ";
                //btn.Attributes["onclick"] = "";
                this.Pub2.Add("<input type=button value='从其他节点上赋值权限' onclick=\"javascript:CopyIt('" + this.FK_MapData + "','" + this.FK_Flow + "','" + this.FK_Node + "')\">"); //删除定义..
            }
        }