Example #1
0
        public int DoNewNode(bool isLogin, params string[] param)
        {
            LetAdminLogin("CH", isLogin);

            string fk_flow = param[0];

            if (string.IsNullOrEmpty(fk_flow))
            {
                return(0);
            }

            string nodeName = param[1];
            string icon     = param[2];

            int x           = (int)double.Parse(param[3]),
                y           = (int)double.Parse(param[4]),
                HisRunModel = int.Parse(param[5]);

            Flow fl = new Flow(fk_flow);

            BP.WF.Node nf = fl.DoNewNode(x, y);
            nf.ICON        = icon;
            nf.Name        = nodeName;
            nf.HisRunModel = (RunModel)HisRunModel;
            nf.Update();
            return(nf.NodeID);
        }
Example #2
0
        /// <summary>
        /// 修改节点运行模式
        /// </summary>
        /// <returns></returns>
        public string Node_ChangeRunModel()
        {
            string runModel = GetValFromFrmByKey("RunModel");

            BP.WF.Node node = new BP.WF.Node(this.FK_Node);
            //节点运行模式
            switch (runModel)
            {
            case "NodeOrdinary":
                node.HisRunModel = BP.WF.RunModel.Ordinary;
                break;

            case "NodeFL":
                node.HisRunModel = BP.WF.RunModel.FL;
                break;

            case "NodeHL":
                node.HisRunModel = BP.WF.RunModel.HL;
                break;

            case "NodeFHL":
                node.HisRunModel = BP.WF.RunModel.FHL;
                break;

            case "NodeSubThread":
                node.HisRunModel = BP.WF.RunModel.SubThread;
                break;
            }
            node.Update();

            return("设置成功.");
        }
        void btn_Click(object sender, EventArgs e)
        {
            Nodes nds = new Nodes(this.FK_Flow);

            BP.WF.Node mynd = new BP.WF.Node(this.FK_Node);
            string     strs = "@";

            foreach (BP.WF.Node nd in nds)
            {
                CheckBox cb = this.Pub1.GetCBByID("CB_" + nd.NodeID);
                if (cb.Checked == false)
                {
                    continue;
                }

                strs += nd.NodeID + "@";
            }


            if (mynd.ShowSheets == strs)
            {
                return;
            }

            mynd.ShowSheets = strs;
            mynd.Update();
            //   Alert(strs);
            // Alert("保存成功。");
        }
Example #4
0
        /// <summary>
        /// 修改节点名称
        /// </summary>
        /// <returns></returns>
        public string Node_EditNodeName()
        {
            string FK_Node  = this.GetValFromFrmByKey("NodeID");
            string NodeName = System.Web.HttpContext.Current.Server.UrlDecode(this.GetValFromFrmByKey("NodeName"));

            BP.WF.Node node = new BP.WF.Node();
            node.NodeID = int.Parse(FK_Node);
            int iResult = node.RetrieveFromDBSources();

            if (iResult > 0)
            {
                node.Name = NodeName;
                node.Update();
                return("@修改成功.");
            }

            return("err@修改节点失败,请确认该节点是否存在?");
        }
        void btn_Del_Click(object sender, EventArgs e)
        {
            BillTemplate t = new BillTemplate();

            t.No = this.RefNo;
            t.Delete();

            #region 更新节点信息。
            BP.WF.Node    nd      = new BP.WF.Node(this.NodeID);
            string        Billids = "";
            BillTemplates tmps    = new BillTemplates(nd);
            foreach (BillTemplate tmp in tmps)
            {
                Billids += "@" + tmp.No;
            }
            nd.HisBillIDs = Billids;
            nd.Update();
            #endregion 更新节点信息。
            this.Response.Redirect("Bill.aspx?FK_Flow=" + this.FK_Flow + "&NodeID=" + this.NodeID, true);
        }
Example #6
0
        /// <summary>
        /// 创建流程节点并返回编号
        /// </summary>
        /// <returns></returns>
        public string CreateNode()
        {
            try
            {
                string FK_Flow = this.GetRequestVal("FK_Flow");
                string x       = this.GetRequestVal("X");
                string y       = this.GetRequestVal("Y");
                int    iX      = 20;
                int    iY      = 20;

                if (DataType.IsNullOrEmpty(x) == false)
                {
                    iX = (int)double.Parse(x);
                }

                if (DataType.IsNullOrEmpty(y) == false)
                {
                    iY = (int)double.Parse(y);
                }

                int nodeId = BP.WF.Template.TemplateGlo.NewNode(FK_Flow, iX, iY);

                BP.WF.Node node = new BP.WF.Node(nodeId);
                node.Update();

                Hashtable ht = new Hashtable();
                ht.Add("NodeID", node.NodeID);
                ht.Add("Name", node.Name);

                return(BP.Tools.Json.ToJsonEntityModel(ht));
            }
            catch (Exception ex)
            {
                return("err@" + ex.Message);
            }
        }
        void btn_Click(object sender, EventArgs e)
        {
            HtmlInputFile file = this.Ucsys1.FindControl("f") as HtmlInputFile;
            BillTemplate  bt   = new BillTemplate();

            bt.NodeID = this.NodeID;
            BP.WF.Node nd = new BP.WF.Node(this.NodeID);
            if (this.RefNo != null)
            {
                bt.No = this.RefNo;
                bt.Retrieve();
                bt             = this.Ucsys1.Copy(bt) as BillTemplate;
                bt.NodeID      = this.NodeID;
                bt.FK_BillType = this.Ucsys1.GetDDLByID("DDL_BillType").SelectedItemStringVal;
                if (file.Value == null || file.Value.Trim() == "")
                {
                    bt.Update();
                    this.Alert("保存成功");
                    return;
                }

                if (bt.HisBillFileType == BillFileType.RuiLang)
                {
                    if (file.Value.ToLower().Contains(".grf") == false)
                    {
                        this.Alert("@错误,非法的 grf 格式文件。");
                        return;
                    }
                }
                else
                {
                    if (file.Value.ToLower().Contains(".rtf") == false)
                    {
                        this.Alert("@错误,非法的 rtf 格式文件。");
                        return;
                    }
                }
                string temp     = "";
                string tempName = "";
                if (bt.HisBillFileType == BillFileType.RuiLang)
                {
                    tempName = "Temp.grf";
                    temp     = BP.Sys.SystemConfig.PathOfCyclostyleFile + "\\Temp.grf";
                    file.PostedFile.SaveAs(temp);
                }
                else
                {
                    tempName = "Temp.rtf";
                    temp     = BP.Sys.SystemConfig.PathOfCyclostyleFile + "\\Temp.rtf";
                    file.PostedFile.SaveAs(temp);
                }



                //检查文件是否正确。
                try
                {
                    string[] paras = BP.DA.Cash.GetBillParas_Gener(tempName, nd.HisFlow.HisGERpt.EnMap.Attrs);
                }
                catch (Exception ex)
                {
                    this.Ucsys2.AddMsgOfWarning("错误信息", ex.Message);
                    return;
                }
                string fullFile = FileFullPath(file.PostedFile.FileName, bt);//BP.Sys.SystemConfig.PathOfCyclostyleFile + "\\" + bt.No + ".rtf";
                System.IO.File.Copy(temp, fullFile, true);
                bt.Update();
                return;
            }
            bt = this.Ucsys1.Copy(bt) as BillTemplate;

            if (file.Value != null)
            {
                if (bt.HisBillFileType == BillFileType.RuiLang)
                {
                    if (file.Value.ToLower().Contains(".grf") == false)
                    {
                        this.Alert("@错误,非法的 grf 格式文件。");
                        // this.Alert("@错误,非法的 rtf 格式文件。");
                        return;
                    }
                }
                else
                {
                    if (file.Value.ToLower().Contains(".rtf") == false)
                    {
                        this.Alert("@错误,非法的 rtf 格式文件。");
                        // this.Alert("@错误,非法的 rtf 格式文件。");
                        return;
                    }
                }
            }
            else
            {
                this.Alert("请上传文件。");
                // this.Alert("@错误,非法的 rtf 格式文件。");
                return;
            }

            /* 如果包含这二个字段。*/
            string fileName = file.PostedFile.FileName;

            fileName = fileName.Substring(fileName.LastIndexOf("\\") + 1);
            if (bt.Name == "")
            {
                bt.Name = fileName.Replace(".rtf", "");
                bt.Name = fileName.Replace(".grf", "");
            }

            try
            {
                bt.No = BP.Tools.chs2py.convert(bt.Name);
                if (bt.IsExits)
                {
                    bt.No = bt.No + "." + BP.DA.DBAccess.GenerOID().ToString();
                }
            }
            catch
            {
                bt.No = BP.DA.DBAccess.GenerOID().ToString();
            }
            string tmp     = "";
            string tmpName = "";

            if (bt.HisBillFileType == BillFileType.RuiLang)
            {
                tmpName = "Temp.grf";
                tmp     = BP.Sys.SystemConfig.PathOfCyclostyleFile + "\\Temp.grf";
                file.PostedFile.SaveAs(tmp);
            }
            else
            {
                tmpName = "Temp.rtf";
                tmp     = BP.Sys.SystemConfig.PathOfCyclostyleFile + "\\Temp.rtf";
                file.PostedFile.SaveAs(tmp);
            }


            //检查文件是否正确。
            try
            {
                string[] paras1 = BP.DA.Cash.GetBillParas_Gener(tmpName, nd.HisFlow.HisGERpt.EnMap.Attrs);
            }
            catch (Exception ex)
            {
                this.Ucsys2.AddMsgOfWarning("Error:", ex.Message);
                return;
            }

            string fullFile1 = FileFullPath(fileName, bt);//BP.Sys.SystemConfig.PathOfCyclostyleFile + "\\" + bt.No + ".rtf";

            System.IO.File.Copy(tmp, fullFile1, true);
            // file.PostedFile.SaveAs(fullFile1);
            bt.FK_BillType = this.Ucsys1.GetDDLByID("DDL_BillType").SelectedItemStringVal;
            bt.Insert();

            #region 更新节点信息。
            string        Billids = "";
            BillTemplates tmps    = new BillTemplates(nd);
            foreach (BillTemplate Btmp in tmps)
            {
                Billids += "@" + Btmp.No;
            }
            nd.HisBillIDs = Billids;
            nd.Update();
            #endregion 更新节点信息。

            this.Response.Redirect("Bill.aspx?FK_Flow=" + this.FK_Flow + "&NodeID=" + this.NodeID, true);
        }
Example #8
0
        /// <summary>
        /// 树节点管理
        /// </summary>
        public string Do()
        {
            string doWhat = getUTF8ToString("doWhat");
            string para1  = getUTF8ToString("para1");
            // 如果admin账户登陆时有错误发生,则返回错误信息
            var result = LetAdminLogin("CH", true);

            if (string.IsNullOrEmpty(result) == false)
            {
                return(result);
            }

            switch (doWhat)
            {
            case "GetFlowSorts":        //获取所有流程类型
                try
                {
                    FlowSorts flowSorts = new FlowSorts();
                    flowSorts.RetrieveAll(FlowSortAttr.Idx);
                    return(BP.Tools.Entitis2Json.ConvertEntitis2GenerTree(flowSorts, "0"));
                }
                catch (Exception ex)
                {
                    return(Newtonsoft.Json.JsonConvert.SerializeObject(new { success = false, msg = ex.Message }));
                }

            case "NewSameLevelFrmSort":     //创建同级别的 表单树 目录.
                SysFormTree frmSort = null;
                try
                {
                    var para = para1.Split(',');
                    frmSort = new SysFormTree(para[0]);
                    string sameNodeNo = frmSort.DoCreateSameLevelNode().No;
                    frmSort      = new SysFormTree(sameNodeNo);
                    frmSort.Name = para[1];
                    frmSort.Update();
                    return(null);
                }
                catch (Exception ex)
                {
                    return("Do Method NewFormSort Branch has a error , para:\t" + para1 + ex.Message);
                }

            case "NewSubLevelFrmSort":     //创建子级别的 表单树 目录.
                SysFormTree frmSortSub = null;
                try
                {
                    var para = para1.Split(',');
                    frmSortSub = new SysFormTree(para[0]);
                    string sameNodeNo = frmSortSub.DoCreateSubNode().No;
                    frmSortSub      = new SysFormTree(sameNodeNo);
                    frmSortSub.Name = para[1];
                    frmSortSub.Update();
                    return(null);
                }
                catch (Exception ex)
                {
                    return("Do Method NewSubLevelFrmSort Branch has a error , para:\t" + para1 + ex.Message);
                }

            case "NewSameLevelFlowSort":      //创建同级别的 流程树 目录.
                FlowSort fs = null;
                try
                {
                    var para = para1.Split(',');
                    fs = new FlowSort(para[0].Replace("F", ""));    //传入的编号多出F符号,需要替换掉
                    string sameNodeNo = fs.DoCreateSameLevelNode().No;
                    fs      = new FlowSort(sameNodeNo);
                    fs.Name = para[1];
                    fs.Update();
                    return
                        (Newtonsoft.Json.JsonConvert.SerializeObject(
                             new { success = true, msg = string.Empty, data = "F" + fs.No }));
                }
                catch (Exception ex)
                {
                    BP.DA.Log.DefaultLogWriteLineError("Do Method NewSameLevelFlowSort Branch has a error , para:\t" + para1 + ex.Message);
                    return(Newtonsoft.Json.JsonConvert.SerializeObject(new { success = false, msg = ex.Message }));
                }

            case "NewSubFlowSort":     //创建子级别的 流程树 目录.
                try
                {
                    var      para        = para1.Split(',');
                    FlowSort fsSub       = new FlowSort(para[0].Replace("F", ""));//传入的编号多出F符号,需要替换掉
                    string   subNodeNo   = fsSub.DoCreateSubNode().No;
                    FlowSort subFlowSort = new FlowSort(subNodeNo);
                    subFlowSort.Name = para[1];
                    subFlowSort.Update();
                    return
                        (Newtonsoft.Json.JsonConvert.SerializeObject(
                             new { success = true, msg = string.Empty, data = "F" + subFlowSort.No }));
                }
                catch (Exception ex)
                {
                    BP.DA.Log.DefaultLogWriteLineError("Do Method NewSubFlowSort Branch has a error , para:\t" + ex.Message);
                    return(Newtonsoft.Json.JsonConvert.SerializeObject(new { success = false, msg = ex.Message }));
                }

            case "EditFlowSort":     //编辑表单树.
                try
                {
                    var para = para1.Split(',');
                    fs      = new FlowSort(para[0].Replace("F", ""));//传入的编号多出F符号,需要替换掉
                    fs.Name = para[1];
                    fs.Save();
                    return
                        (Newtonsoft.Json.JsonConvert.SerializeObject(
                             new { success = true, msg = string.Empty, data = fs.No }));
                }
                catch (Exception ex)
                {
                    BP.DA.Log.DefaultLogWriteLineError("Do Method EditFlowSort Branch has a error , para:\t" + para1 + ex.Message);
                    return(Newtonsoft.Json.JsonConvert.SerializeObject(new { success = false, msg = ex.Message }));
                }

            case "NewFlow":     //创建新流程.
                try
                {
                    string[] ps = para1.Split(',');
                    if (ps.Length != 6)
                    {
                        throw new Exception("@创建流程参数错误");
                    }

                    string fk_floSort = ps[0];                                       //类别编号.
                    fk_floSort = fk_floSort.Replace("F", "");                        //传入的编号多出F符号,需要替换掉

                    string         flowName      = ps[1];                            // 流程名称.
                    DataStoreModel dataSaveModel = (DataStoreModel)int.Parse(ps[2]); //数据保存方式。
                    string         pTable        = ps[3];                            // 物理表名。
                    string         flowMark      = ps[4];                            // 流程标记.
                    string         flowVer       = ps[5];                            // 流程版本

                    string FK_Flow = BP.BPMN.Glo.NewFlow(fk_floSort, flowName, dataSaveModel, pTable, flowMark, flowVer);
                    return
                        (Newtonsoft.Json.JsonConvert.SerializeObject(
                             new { success = true, msg = string.Empty, data = new { no = FK_Flow, name = flowName } }));
                }
                catch (Exception ex)
                {
                    BP.DA.Log.DefaultLogWriteLineError("Do Method NewFlow Branch has a error , para:\t" + para1 + ex.Message);
                    return(Newtonsoft.Json.JsonConvert.SerializeObject(new { success = false, msg = ex.Message }));
                }

            case "DelFlow":     //删除流程.
                try
                {
                    return(Newtonsoft.Json.JsonConvert.SerializeObject(
                               new { success = true, msg = WorkflowDefintionManager.DeleteFlowTemplete(para1) }));
                }
                catch (Exception ex)
                {
                    return(Newtonsoft.Json.JsonConvert.SerializeObject(new { success = false, msg = ex.Message }));
                }

            case "DelFlowSort":
                try
                {
                    string   FK_FlowSort = para1.Replace("F", "");
                    string   forceDel    = getUTF8ToString("force");
                    FlowSort delfs       = new FlowSort();
                    delfs.No = FK_FlowSort;
                    //强制删除,不需判断是否含有子项。
                    if (forceDel == "true")
                    {
                        delfs.DeleteFlowSortSubNode_Force();
                        delfs.Delete();
                        return(Newtonsoft.Json.JsonConvert.SerializeObject(new { success = true, reason = "" }));
                    }

                    //判断是否包含子类别
                    if (delfs.HisSubFlowSorts != null && delfs.HisSubFlowSorts.Count > 0)
                    {
                        return(Newtonsoft.Json.JsonConvert.SerializeObject(new { success = false, reason = "havesubsorts", msg = "此类别下包含子类别。" }));
                    }

                    //判断是否包含工作流程
                    if (delfs.HisFlows != null && delfs.HisFlows.Count > 0)
                    {
                        return(Newtonsoft.Json.JsonConvert.SerializeObject(new { success = false, reason = "haveflows", msg = "此类别下包含流程。" }));
                    }

                    //执行删除
                    delfs.Delete();
                    return(Newtonsoft.Json.JsonConvert.SerializeObject(new { success = true, reason = "" }));
                }
                catch (Exception ex)
                {
                    BP.DA.Log.DefaultLogWriteLineError("Do Method DelFlowSort Branch has a error , para:\t" + para1 + ex.Message);
                    return(Newtonsoft.Json.JsonConvert.SerializeObject(new { success = false, msg = ex.Message }));
                }

            case "DelNode":
                try
                {
                    if (!string.IsNullOrEmpty(para1))
                    {
                        BP.WF.Node delNode = new BP.WF.Node(int.Parse(para1));
                        delNode.Delete();
                    }
                    else
                    {
                        throw new Exception("@参数错误:" + para1);
                    }
                }
                catch (Exception ex)
                {
                    return("err:" + ex.Message);
                }
                return(null);

            case "SetBUnit":
                try
                {
                    if (!string.IsNullOrEmpty(para1))
                    {
                        BP.WF.Node nd = new BP.WF.Node(int.Parse(para1));
                        nd.IsTask = !nd.IsBUnit;
                        nd.Update();
                    }
                    else
                    {
                        throw new Exception("@参数错误:" + para1);
                    }
                }
                catch (Exception ex)
                {
                    return("err:" + ex.Message);
                }
                return(null);

            case "GetSettings":
                return(SystemConfig.AppSettings[para1]);

            case "SaveFlowFrm":      //保存流程表单.
                Entity en = null;
                try
                {
                    AtPara ap     = new AtPara(para1);
                    string enName = ap.GetValStrByKey("EnName");
                    string pk     = ap.GetValStrByKey("PKVal");
                    en = ClassFactory.GetEn(enName);
                    en.ResetDefaultVal();
                    if (en == null)
                    {
                        throw new Exception("无效的类名:" + enName);
                    }

                    if (string.IsNullOrEmpty(pk) == false)
                    {
                        en.PKVal = pk;
                        en.RetrieveFromDBSources();
                    }

                    foreach (string key in ap.HisHT.Keys)
                    {
                        if (key == "PKVal")
                        {
                            continue;
                        }
                        en.SetValByKey(key, ap.HisHT[key].ToString().Replace('^', '@'));
                    }
                    en.Save();
                    return(en.PKVal as string);
                }
                catch (Exception ex)
                {
                    if (en != null)
                    {
                        en.CheckPhysicsTable();
                    }
                    return("Error:" + ex.Message);
                }

            case "ChangeNodeType":
                var p = para1.Split(',');

                try
                {
                    if (p.Length != 3)
                    {
                        throw new Exception("@修改节点类型参数错误");
                    }

                    //var sql = "UPDATE WF_Node SET Icon='{0}' WHERE FK_Flow='{1}' AND NodeID='{2}'";
                    var sql = "UPDATE WF_Node SET RunModel={0} WHERE FK_Flow='{1}' AND NodeID={2}";
                    DBAccess.RunSQL(string.Format(sql, p[0], p[1], p[2]));
                    return(Newtonsoft.Json.JsonConvert.SerializeObject(new { success = true }));
                }
                catch (Exception ex)
                {
                    return(Newtonsoft.Json.JsonConvert.SerializeObject(new { success = false, msg = ex.Message }));
                }

            case "ChangeNodeIcon":
                p = para1.Split(',');

                try
                {
                    if (p.Length != 3)
                    {
                        throw new Exception("@修改节点图标参数错误");
                    }

                    var sql = "UPDATE WF_Node SET Icon='{0}' WHERE FK_Flow='{1}' AND NodeID={2}";
                    DBAccess.RunSQL(string.Format(sql, p[0], p[1], p[2]));
                    return(Newtonsoft.Json.JsonConvert.SerializeObject(new { success = true }));
                }
                catch (Exception ex)
                {
                    return(Newtonsoft.Json.JsonConvert.SerializeObject(new { success = false, msg = ex.Message }));
                }

            default:
                throw new Exception("@没有约定的执行标记:" + doWhat);
            }
        }